vuejs 1.0.21 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d31786cb8bffc4b3f5d2f550c97c0ed48e5e792e
4
- data.tar.gz: 2c3b7d907290bd32768405370b7b523ebf14814b
3
+ metadata.gz: b59bb869339efb98b682f6dda4a101a92dd4ad2e
4
+ data.tar.gz: de8e7c90f144cc313f59dd25a1768f2c5601c564
5
5
  SHA512:
6
- metadata.gz: 768437ac5e4c6a1df970c1781cd0efdd8498c39a564c40146c3f81135d9cef1e10e0fb71c999983a092ae049b1da8c4d75d310511f57e043f7b359901c292c4f
7
- data.tar.gz: 0bdd144fa560dbae978f55f882cff82438faef069b824f95300150ffe4bfb9d10c24c5f44a8d1dd0927c91ac3b98066816c0e3b9484c50410969dc47311f9577
6
+ metadata.gz: 3f1a628095390b9e8e4a761733813ad3b78fff7a5a590ea05289f1da1d7010c701ebe368477bde0585b8c495419a67dbb2d1c065b07e1b98bc7b500388ca72b8
7
+ data.tar.gz: 94c93f25a80b7ceb40adc9a32286ec80cc50f739ef3bf0025d948b702eda12d33d5da040a8551fc639cbc7b459131f222ac45226fc5f1734ce90b768a01c49c2
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Vuejs ships with the latest [Vue.js + router + resource](http://vuejs.org/) and integrate with Rails' asset pipeline. Vue.js is created by Evan You.
4
4
 
5
- The current version is Vue.js (v1.0.20) + vue-router (v0.7.12) + vue-resource (v0.7.0)
5
+ The current version is Vue.js (v1.0.21) + vue-router (v0.7.13) + vue-resource (v0.7.0)
6
6
 
7
7
  > Reactive Components for Modern Web Interfaces
8
8
 
data/lib/vuejs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vuejs
2
- VERSION = "1.0.21"
2
+ VERSION = "1.0.22"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * vue-router v0.7.12
2
+ * vue-router v0.7.13
3
3
  * (c) 2016 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -1875,7 +1875,6 @@
1875
1875
  function Link (Vue) {
1876
1876
  var _Vue$util = Vue.util;
1877
1877
  var _bind = _Vue$util.bind;
1878
- var getAttr = _Vue$util.getAttr;
1879
1878
  var isObject = _Vue$util.isObject;
1880
1879
  var addClass = _Vue$util.addClass;
1881
1880
  var removeClass = _Vue$util.removeClass;
@@ -1928,8 +1927,9 @@
1928
1927
  // update things when the route changes
1929
1928
  this.unwatch = vm.$watch('$route', _bind(this.onRouteUpdate, this));
1930
1929
  // check v-link-active ids
1931
- var activeIds = getAttr(this.el, LINK_UPDATE);
1930
+ var activeIds = this.el.getAttribute(LINK_UPDATE);
1932
1931
  if (activeIds) {
1932
+ this.el.removeAttribute(LINK_UPDATE);
1933
1933
  this.activeIds = activeIds.split(',');
1934
1934
  }
1935
1935
  // no need to handle click if link expects to be opened
@@ -2706,4 +2706,4 @@
2706
2706
 
2707
2707
  return Router;
2708
2708
 
2709
- }));
2709
+ }));
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v1.0.20
2
+ * Vue.js v1.0.21
3
3
  * (c) 2016 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -740,7 +740,7 @@ var directive = Object.freeze({
740
740
  var close = escapeRegex(config.delimiters[1]);
741
741
  var unsafeOpen = escapeRegex(config.unsafeDelimiters[0]);
742
742
  var unsafeClose = escapeRegex(config.unsafeDelimiters[1]);
743
- tagRE = new RegExp(unsafeOpen + '(.+?)' + unsafeClose + '|' + open + '(.+?)' + close, 'g');
743
+ tagRE = new RegExp(unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '|' + open + '((?:.|\\n)+?)' + close, 'g');
744
744
  htmlRE = new RegExp('^' + unsafeOpen + '.*' + unsafeClose + '$');
745
745
  // reset cache
746
746
  cache = new Cache(1000);
@@ -765,7 +765,6 @@ var directive = Object.freeze({
765
765
  if (hit) {
766
766
  return hit;
767
767
  }
768
- text = text.replace(/\n/g, '');
769
768
  if (!tagRE.test(text)) {
770
769
  return null;
771
770
  }
@@ -981,23 +980,22 @@ var text = Object.freeze({
981
980
  });
982
981
 
983
982
  var warn = undefined;
983
+ var formatComponentName = undefined;
984
984
 
985
985
  if ('development' !== 'production') {
986
986
  (function () {
987
987
  var hasConsole = typeof console !== 'undefined';
988
- warn = function (msg, e) {
989
- if (hasConsole && (!config.silent || config.debug)) {
990
- console.warn('[Vue warn]: ' + msg);
991
- /* istanbul ignore if */
992
- if (config.debug) {
993
- if (e) {
994
- throw e;
995
- } else {
996
- console.warn(new Error('Warning Stack Trace').stack);
997
- }
998
- }
988
+
989
+ warn = function (msg, vm) {
990
+ if (hasConsole && !config.silent) {
991
+ console.error('[Vue warn]: ' + msg + (vm ? formatComponentName(vm) : ''));
999
992
  }
1000
993
  };
994
+
995
+ formatComponentName = function (vm) {
996
+ var name = vm._isVue ? vm.$options.name : vm.name;
997
+ return name ? ' (found in component: <' + hyphenate(name) + '>)' : '';
998
+ };
1001
999
  })();
1002
1000
  }
1003
1001
 
@@ -1631,7 +1629,7 @@ var transition = Object.freeze({
1631
1629
  return parentVal;
1632
1630
  }
1633
1631
  if (typeof childVal !== 'function') {
1634
- 'development' !== 'production' && warn('The "data" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.');
1632
+ 'development' !== 'production' && warn('The "data" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);
1635
1633
  return parentVal;
1636
1634
  }
1637
1635
  if (!parentVal) {
@@ -1665,7 +1663,7 @@ var transition = Object.freeze({
1665
1663
 
1666
1664
  strats.el = function (parentVal, childVal, vm) {
1667
1665
  if (!vm && childVal && typeof childVal !== 'function') {
1668
- 'development' !== 'production' && warn('The "el" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.');
1666
+ 'development' !== 'production' && warn('The "el" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);
1669
1667
  return;
1670
1668
  }
1671
1669
  var ret = childVal || parentVal;
@@ -1681,15 +1679,6 @@ var transition = Object.freeze({
1681
1679
  return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
1682
1680
  };
1683
1681
 
1684
- /**
1685
- * 0.11 deprecation warning
1686
- */
1687
-
1688
- strats.paramAttributes = function () {
1689
- /* istanbul ignore next */
1690
- 'development' !== 'production' && warn('"paramAttributes" option has been deprecated in 0.12. ' + 'Use "props" instead.');
1691
- };
1692
-
1693
1682
  /**
1694
1683
  * Assets
1695
1684
  *
@@ -1888,31 +1877,26 @@ var transition = Object.freeze({
1888
1877
  * @param {Object} options
1889
1878
  * @param {String} type
1890
1879
  * @param {String} id
1880
+ * @param {Boolean} warnMissing
1891
1881
  * @return {Object|Function}
1892
1882
  */
1893
1883
 
1894
- function resolveAsset(options, type, id) {
1884
+ function resolveAsset(options, type, id, warnMissing) {
1895
1885
  /* istanbul ignore if */
1896
1886
  if (typeof id !== 'string') {
1897
1887
  return;
1898
1888
  }
1899
1889
  var assets = options[type];
1900
1890
  var camelizedId;
1901
- return assets[id] ||
1891
+ var res = assets[id] ||
1902
1892
  // camelCase ID
1903
1893
  assets[camelizedId = camelize(id)] ||
1904
1894
  // Pascal Case ID
1905
1895
  assets[camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)];
1906
- }
1907
-
1908
- /**
1909
- * Assert asset exists
1910
- */
1911
-
1912
- function assertAsset(val, type, id) {
1913
- if (!val) {
1914
- 'development' !== 'production' && warn('Failed to resolve ' + type + ': ' + id);
1896
+ if ('development' !== 'production' && warnMissing && !res) {
1897
+ warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id, options);
1915
1898
  }
1899
+ return res;
1916
1900
  }
1917
1901
 
1918
1902
  var uid$1 = 0;
@@ -2029,10 +2013,9 @@ var transition = Object.freeze({
2029
2013
  });
2030
2014
 
2031
2015
  /**
2032
- * Convenience method to remove the element at given index.
2016
+ * Convenience method to remove the element at given index or target element reference.
2033
2017
  *
2034
- * @param {Number} index
2035
- * @param {*} val
2018
+ * @param {*} item
2036
2019
  */
2037
2020
 
2038
2021
  def(arrayProto, '$remove', function $remove(item) {
@@ -2329,7 +2312,6 @@ var transition = Object.freeze({
2329
2312
  getOuterHTML: getOuterHTML,
2330
2313
  mergeOptions: mergeOptions,
2331
2314
  resolveAsset: resolveAsset,
2332
- assertAsset: assertAsset,
2333
2315
  checkComponentAttr: checkComponentAttr,
2334
2316
  commonTagRE: commonTagRE,
2335
2317
  reservedTagRE: reservedTagRE,
@@ -2716,8 +2698,8 @@ var transition = Object.freeze({
2716
2698
 
2717
2699
  var warnNonExistent;
2718
2700
  if ('development' !== 'production') {
2719
- warnNonExistent = function (path) {
2720
- warn('You are setting a non-existent path "' + path.raw + '" ' + 'on a vm instance. Consider pre-initializing the property ' + 'with the "data" option for more reliable reactivity ' + 'and better performance.');
2701
+ warnNonExistent = function (path, vm) {
2702
+ warn('You are setting a non-existent path "' + path.raw + '" ' + 'on a vm instance. Consider pre-initializing the property ' + 'with the "data" option for more reliable reactivity ' + 'and better performance.', vm);
2721
2703
  };
2722
2704
  }
2723
2705
 
@@ -2749,7 +2731,7 @@ var transition = Object.freeze({
2749
2731
  if (!isObject(obj)) {
2750
2732
  obj = {};
2751
2733
  if ('development' !== 'production' && last._isVue) {
2752
- warnNonExistent(path);
2734
+ warnNonExistent(path, last);
2753
2735
  }
2754
2736
  set(last, key, obj);
2755
2737
  }
@@ -2760,7 +2742,7 @@ var transition = Object.freeze({
2760
2742
  obj[key] = val;
2761
2743
  } else {
2762
2744
  if ('development' !== 'production' && obj._isVue) {
2763
- warnNonExistent(path);
2745
+ warnNonExistent(path, obj);
2764
2746
  }
2765
2747
  set(obj, key, val);
2766
2748
  }
@@ -3027,8 +3009,8 @@ var expression = Object.freeze({
3027
3009
  if ('development' !== 'production' && has[id] != null) {
3028
3010
  circular[id] = (circular[id] || 0) + 1;
3029
3011
  if (circular[id] > config._maxUpdateCount) {
3030
- queue.splice(has[id], 1);
3031
- warn('You may have an infinite update loop for watcher ' + 'with expression: ' + watcher.expression);
3012
+ warn('You may have an infinite update loop for watcher ' + 'with expression "' + watcher.expression + '"', watcher.vm);
3013
+ break;
3032
3014
  }
3033
3015
  }
3034
3016
  }
@@ -3132,7 +3114,7 @@ var expression = Object.freeze({
3132
3114
  value = this.getter.call(scope, scope);
3133
3115
  } catch (e) {
3134
3116
  if ('development' !== 'production' && config.warnExpressionErrors) {
3135
- warn('Error when evaluating expression "' + this.expression + '". ' + (config.debug ? '' : 'Turn on debug mode to see stack trace.'), e);
3117
+ warn('Error when evaluating expression ' + '"' + this.expression + '": ' + e.toString(), this.vm);
3136
3118
  }
3137
3119
  }
3138
3120
  // "touch" every property so they are all tracked as
@@ -3168,14 +3150,14 @@ var expression = Object.freeze({
3168
3150
  this.setter.call(scope, scope, value);
3169
3151
  } catch (e) {
3170
3152
  if ('development' !== 'production' && config.warnExpressionErrors) {
3171
- warn('Error when evaluating setter "' + this.expression + '"', e);
3153
+ warn('Error when evaluating setter ' + '"' + this.expression + '": ' + e.toString(), this.vm);
3172
3154
  }
3173
3155
  }
3174
3156
  // two-way sync for v-for alias
3175
3157
  var forContext = scope.$forContext;
3176
3158
  if (forContext && forContext.alias === this.expression) {
3177
3159
  if (forContext.filters) {
3178
- 'development' !== 'production' && warn('It seems you are using two-way binding on ' + 'a v-for alias (' + this.expression + '), and the ' + 'v-for has filters. This will not work properly. ' + 'Either remove the filters or use an array of ' + 'objects and bind to object properties instead.');
3160
+ 'development' !== 'production' && warn('It seems you are using two-way binding on ' + 'a v-for alias (' + this.expression + '), and the ' + 'v-for has filters. This will not work properly. ' + 'Either remove the filters or use an array of ' + 'objects and bind to object properties instead.', this.vm);
3179
3161
  return;
3180
3162
  }
3181
3163
  forContext._withLock(function () {
@@ -3915,9 +3897,9 @@ var template = Object.freeze({
3915
3897
  var EL = 1500;
3916
3898
  var COMPONENT = 1500;
3917
3899
  var PARTIAL = 1750;
3918
- var FOR = 2000;
3919
- var IF = 2000;
3920
- var SLOT = 2100;
3900
+ var IF = 2100;
3901
+ var FOR = 2200;
3902
+ var SLOT = 2300;
3921
3903
 
3922
3904
  var uid$3 = 0;
3923
3905
 
@@ -3943,7 +3925,7 @@ var template = Object.freeze({
3943
3925
  }
3944
3926
 
3945
3927
  if (!this.alias) {
3946
- 'development' !== 'production' && warn('Alias is required in v-for.');
3928
+ 'development' !== 'production' && warn('Invalid v-for expression "' + this.descriptor.raw + '": ' + 'alias is required.', this.vm);
3947
3929
  return;
3948
3930
  }
3949
3931
 
@@ -4285,7 +4267,7 @@ var template = Object.freeze({
4285
4267
  var primitive = !isObject(value);
4286
4268
  var id;
4287
4269
  if (key || trackByKey || primitive) {
4288
- id = trackByKey ? trackByKey === '$index' ? index : value[trackByKey] : key || value;
4270
+ id = trackByKey ? trackByKey === '$index' ? index : getPath(value, trackByKey) : key || value;
4289
4271
  if (!cache[id]) {
4290
4272
  cache[id] = frag;
4291
4273
  } else if (trackByKey !== '$index') {
@@ -4320,7 +4302,7 @@ var template = Object.freeze({
4320
4302
  var primitive = !isObject(value);
4321
4303
  var frag;
4322
4304
  if (key || trackByKey || primitive) {
4323
- var id = trackByKey ? trackByKey === '$index' ? index : value[trackByKey] : key || value;
4305
+ var id = trackByKey ? trackByKey === '$index' ? index : getPath(value, trackByKey) : key || value;
4324
4306
  frag = this.cache[id];
4325
4307
  } else {
4326
4308
  frag = value[this.id];
@@ -4347,7 +4329,7 @@ var template = Object.freeze({
4347
4329
  var key = hasOwn(scope, '$key') && scope.$key;
4348
4330
  var primitive = !isObject(value);
4349
4331
  if (trackByKey || key || primitive) {
4350
- var id = trackByKey ? trackByKey === '$index' ? index : value[trackByKey] : key || value;
4332
+ var id = trackByKey ? trackByKey === '$index' ? index : getPath(value, trackByKey) : key || value;
4351
4333
  this.cache[id] = null;
4352
4334
  } else {
4353
4335
  value[this.id] = null;
@@ -4499,7 +4481,7 @@ var template = Object.freeze({
4499
4481
 
4500
4482
  if ('development' !== 'production') {
4501
4483
  vFor.warnDuplicate = function (value) {
4502
- warn('Duplicate value found in v-for="' + this.descriptor.raw + '": ' + JSON.stringify(value) + '. Use track-by="$index" if ' + 'you are expecting duplicate values.');
4484
+ warn('Duplicate value found in v-for="' + this.descriptor.raw + '": ' + JSON.stringify(value) + '. Use track-by="$index" if ' + 'you are expecting duplicate values.', this.vm);
4503
4485
  };
4504
4486
  }
4505
4487
 
@@ -4521,7 +4503,7 @@ var template = Object.freeze({
4521
4503
  this.anchor = createAnchor('v-if');
4522
4504
  replace(el, this.anchor);
4523
4505
  } else {
4524
- 'development' !== 'production' && warn('v-if="' + this.expression + '" cannot be ' + 'used on an instance root element.');
4506
+ 'development' !== 'production' && warn('v-if="' + this.expression + '" cannot be ' + 'used on an instance root element.', this.vm);
4525
4507
  this.invalid = true;
4526
4508
  }
4527
4509
  },
@@ -4954,7 +4936,7 @@ var template = Object.freeze({
4954
4936
  // friendly warning...
4955
4937
  this.checkFilters();
4956
4938
  if (this.hasRead && !this.hasWrite) {
4957
- 'development' !== 'production' && warn('It seems you are using a read-only filter with ' + 'v-model. You might want to use a two-way filter ' + 'to ensure correct behavior.');
4939
+ 'development' !== 'production' && warn('It seems you are using a read-only filter with ' + 'v-model="' + this.descriptor.raw + '". ' + 'You might want to use a two-way filter to ensure correct behavior.', this.vm);
4958
4940
  }
4959
4941
  var el = this.el;
4960
4942
  var tag = el.tagName;
@@ -4966,7 +4948,7 @@ var template = Object.freeze({
4966
4948
  } else if (tag === 'TEXTAREA') {
4967
4949
  handler = handlers.text;
4968
4950
  } else {
4969
- 'development' !== 'production' && warn('v-model does not support element type: ' + tag);
4951
+ 'development' !== 'production' && warn('v-model does not support element type: ' + tag, this.vm);
4970
4952
  return;
4971
4953
  }
4972
4954
  el.__v_model = this;
@@ -5082,7 +5064,7 @@ var template = Object.freeze({
5082
5064
  }
5083
5065
 
5084
5066
  if (typeof handler !== 'function') {
5085
- 'development' !== 'production' && warn('v-on:' + this.arg + '="' + this.expression + '" expects a function value, ' + 'got ' + handler);
5067
+ 'development' !== 'production' && warn('v-on:' + this.arg + '="' + this.expression + '" expects a function value, ' + 'got ' + handler, this.vm);
5086
5068
  return;
5087
5069
  }
5088
5070
 
@@ -5175,11 +5157,17 @@ var template = Object.freeze({
5175
5157
  if (value) {
5176
5158
  var isImportant = importantRE.test(value) ? 'important' : '';
5177
5159
  if (isImportant) {
5160
+ /* istanbul ignore if */
5161
+ if ('development' !== 'production') {
5162
+ warn('It\'s probably a bad idea to use !important with inline rules. ' + 'This feature will be deprecated in a future version of Vue.');
5163
+ }
5178
5164
  value = value.replace(importantRE, '').trim();
5165
+ this.el.style.setProperty(prop.kebab, value, isImportant);
5166
+ } else {
5167
+ this.el.style[prop.camel] = value;
5179
5168
  }
5180
- this.el.style.setProperty(prop, value, isImportant);
5181
5169
  } else {
5182
- this.el.style.removeProperty(prop);
5170
+ this.el.style[prop.camel] = '';
5183
5171
  }
5184
5172
  }
5185
5173
 
@@ -5224,11 +5212,17 @@ var template = Object.freeze({
5224
5212
  while (i--) {
5225
5213
  prefixed = camelPrefixes[i] + upper;
5226
5214
  if (prefixed in testEl.style) {
5227
- return prefixes[i] + prop;
5215
+ return {
5216
+ kebab: prefixes[i] + prop,
5217
+ camel: prefixed
5218
+ };
5228
5219
  }
5229
5220
  }
5230
5221
  if (camel in testEl.style) {
5231
- return prop;
5222
+ return {
5223
+ kebab: prop,
5224
+ camel: camel
5225
+ };
5232
5226
  }
5233
5227
  }
5234
5228
 
@@ -5275,7 +5269,7 @@ var template = Object.freeze({
5275
5269
 
5276
5270
  // only allow binding on native attributes
5277
5271
  if (disallowedInterpAttrRE.test(attr) || attr === 'name' && (tag === 'PARTIAL' || tag === 'SLOT')) {
5278
- 'development' !== 'production' && warn(attr + '="' + descriptor.raw + '": ' + 'attribute interpolation is not allowed in Vue.js ' + 'directives and special attributes.');
5272
+ 'development' !== 'production' && warn(attr + '="' + descriptor.raw + '": ' + 'attribute interpolation is not allowed in Vue.js ' + 'directives and special attributes.', this.vm);
5279
5273
  this.el.removeAttribute(attr);
5280
5274
  this.invalid = true;
5281
5275
  }
@@ -5285,12 +5279,12 @@ var template = Object.freeze({
5285
5279
  var raw = attr + '="' + descriptor.raw + '": ';
5286
5280
  // warn src
5287
5281
  if (attr === 'src') {
5288
- warn(raw + 'interpolation in "src" attribute will cause ' + 'a 404 request. Use v-bind:src instead.');
5282
+ warn(raw + 'interpolation in "src" attribute will cause ' + 'a 404 request. Use v-bind:src instead.', this.vm);
5289
5283
  }
5290
5284
 
5291
5285
  // warn style
5292
5286
  if (attr === 'style') {
5293
- warn(raw + 'interpolation in "style" attribute will cause ' + 'the attribute to be discarded in Internet Explorer. ' + 'Use v-bind:style instead.');
5287
+ warn(raw + 'interpolation in "style" attribute will cause ' + 'the attribute to be discarded in Internet Explorer. ' + 'Use v-bind:style instead.', this.vm);
5294
5288
  }
5295
5289
  }
5296
5290
  }
@@ -5386,7 +5380,7 @@ var template = Object.freeze({
5386
5380
 
5387
5381
  var ref = {
5388
5382
  bind: function bind() {
5389
- 'development' !== 'production' && warn('v-ref:' + this.arg + ' must be used on a child ' + 'component. Found on <' + this.el.tagName.toLowerCase() + '>.');
5383
+ 'development' !== 'production' && warn('v-ref:' + this.arg + ' must be used on a child ' + 'component. Found on <' + this.el.tagName.toLowerCase() + '>.', this.vm);
5390
5384
  }
5391
5385
  };
5392
5386
 
@@ -5450,19 +5444,16 @@ var template = Object.freeze({
5450
5444
  },
5451
5445
 
5452
5446
  cleanup: function cleanup(value) {
5453
- if (this.prevKeys) {
5454
- var i = this.prevKeys.length;
5455
- while (i--) {
5456
- var key = this.prevKeys[i];
5457
- if (!key) continue;
5458
- if (isPlainObject(key)) {
5459
- var keys = Object.keys(key);
5460
- for (var k = 0; k < keys.length; k++) {
5461
- removeClass(this.el, keys[k]);
5462
- }
5463
- } else {
5464
- removeClass(this.el, key);
5465
- }
5447
+ if (!this.prevKeys) return;
5448
+
5449
+ var i = this.prevKeys.length;
5450
+ while (i--) {
5451
+ var key = this.prevKeys[i];
5452
+ if (!key) continue;
5453
+
5454
+ var keys = isPlainObject(key) ? Object.keys(key) : [key];
5455
+ for (var j = 0, l = keys.length; j < l; j++) {
5456
+ toggleClasses(this.el, keys[j], removeClass);
5466
5457
  }
5467
5458
  }
5468
5459
  }
@@ -5472,22 +5463,48 @@ var template = Object.freeze({
5472
5463
  var keys = Object.keys(obj);
5473
5464
  for (var i = 0, l = keys.length; i < l; i++) {
5474
5465
  var key = keys[i];
5475
- if (obj[key]) {
5476
- addClass(el, key);
5477
- }
5466
+ if (!obj[key]) continue;
5467
+ toggleClasses(el, key, addClass);
5478
5468
  }
5479
5469
  }
5480
5470
 
5481
5471
  function stringToObject(value) {
5482
5472
  var res = {};
5483
5473
  var keys = value.trim().split(/\s+/);
5484
- var i = keys.length;
5485
- while (i--) {
5474
+ for (var i = 0, l = keys.length; i < l; i++) {
5486
5475
  res[keys[i]] = true;
5487
5476
  }
5488
5477
  return res;
5489
5478
  }
5490
5479
 
5480
+ /**
5481
+ * Add or remove a class/classes on an element
5482
+ *
5483
+ * @param {Element} el
5484
+ * @param {String} key The class name. This may or may not
5485
+ * contain a space character, in such a
5486
+ * case we'll deal with multiple class
5487
+ * names at once.
5488
+ * @param {Function} fn
5489
+ */
5490
+
5491
+ function toggleClasses(el, key, fn) {
5492
+ key = key.trim();
5493
+
5494
+ if (key.indexOf(' ') === -1) {
5495
+ fn(el, key);
5496
+ return;
5497
+ }
5498
+
5499
+ // The key contains one or more space characters.
5500
+ // Since a class name doesn't accept such characters, we
5501
+ // treat it as multiple classes.
5502
+ var keys = key.split(/\s+/);
5503
+ for (var i = 0, l = keys.length; i < l; i++) {
5504
+ fn(el, keys[i]);
5505
+ }
5506
+ }
5507
+
5491
5508
  var component = {
5492
5509
 
5493
5510
  priority: COMPONENT,
@@ -5703,7 +5720,7 @@ var template = Object.freeze({
5703
5720
  }
5704
5721
  /* istanbul ignore if */
5705
5722
  if ('development' !== 'production' && this.el.hasAttribute('transition') && child._isFragment) {
5706
- warn('Transitions will not work on a fragment instance. ' + 'Template: ' + child.$options.template);
5723
+ warn('Transitions will not work on a fragment instance. ' + 'Template: ' + child.$options.template, child);
5707
5724
  }
5708
5725
  return child;
5709
5726
  }
@@ -5862,10 +5879,11 @@ var template = Object.freeze({
5862
5879
  *
5863
5880
  * @param {Element|DocumentFragment} el
5864
5881
  * @param {Array} propOptions
5882
+ * @param {Vue} vm
5865
5883
  * @return {Function} propsLinkFn
5866
5884
  */
5867
5885
 
5868
- function compileProps(el, propOptions) {
5886
+ function compileProps(el, propOptions, vm) {
5869
5887
  var props = [];
5870
5888
  var names = Object.keys(propOptions);
5871
5889
  var i = names.length;
@@ -5875,7 +5893,7 @@ var template = Object.freeze({
5875
5893
  options = propOptions[name] || empty;
5876
5894
 
5877
5895
  if ('development' !== 'production' && name === '$data') {
5878
- warn('Do not use $data as prop.');
5896
+ warn('Do not use $data as prop.', vm);
5879
5897
  continue;
5880
5898
  }
5881
5899
 
@@ -5884,7 +5902,7 @@ var template = Object.freeze({
5884
5902
  // so we need to camelize the path here
5885
5903
  path = camelize(name);
5886
5904
  if (!identRE$1.test(path)) {
5887
- 'development' !== 'production' && warn('Invalid prop key: "' + name + '". Prop keys ' + 'must be valid identifiers.');
5905
+ 'development' !== 'production' && warn('Invalid prop key: "' + name + '". Prop keys ' + 'must be valid identifiers.', vm);
5888
5906
  continue;
5889
5907
  }
5890
5908
 
@@ -5922,14 +5940,14 @@ var template = Object.freeze({
5922
5940
  // check non-settable path for two-way bindings
5923
5941
  if ('development' !== 'production' && prop.mode === propBindingModes.TWO_WAY && !settablePathRE.test(value)) {
5924
5942
  prop.mode = propBindingModes.ONE_WAY;
5925
- warn('Cannot bind two-way prop with non-settable ' + 'parent path: ' + value);
5943
+ warn('Cannot bind two-way prop with non-settable ' + 'parent path: ' + value, vm);
5926
5944
  }
5927
5945
  }
5928
5946
  prop.parentPath = value;
5929
5947
 
5930
5948
  // warn required two-way
5931
5949
  if ('development' !== 'production' && options.twoWay && prop.mode !== propBindingModes.TWO_WAY) {
5932
- warn('Prop "' + name + '" expects a two-way binding type.');
5950
+ warn('Prop "' + name + '" expects a two-way binding type.', vm);
5933
5951
  }
5934
5952
  } else if ((value = getAttr(el, attr)) !== null) {
5935
5953
  // has literal binding!
@@ -5939,10 +5957,10 @@ var template = Object.freeze({
5939
5957
  var lowerCaseName = path.toLowerCase();
5940
5958
  value = /[A-Z\-]/.test(name) && (el.getAttribute(lowerCaseName) || el.getAttribute(':' + lowerCaseName) || el.getAttribute('v-bind:' + lowerCaseName) || el.getAttribute(':' + lowerCaseName + '.once') || el.getAttribute('v-bind:' + lowerCaseName + '.once') || el.getAttribute(':' + lowerCaseName + '.sync') || el.getAttribute('v-bind:' + lowerCaseName + '.sync'));
5941
5959
  if (value) {
5942
- warn('Possible usage error for prop `' + lowerCaseName + '` - ' + 'did you mean `' + attr + '`? HTML is case-insensitive, remember to use ' + 'kebab-case for props in templates.');
5960
+ warn('Possible usage error for prop `' + lowerCaseName + '` - ' + 'did you mean `' + attr + '`? HTML is case-insensitive, remember to use ' + 'kebab-case for props in templates.', vm);
5943
5961
  } else if (options.required) {
5944
5962
  // warn missing required
5945
- warn('Missing required prop: ' + name);
5963
+ warn('Missing required prop: ' + name, vm);
5946
5964
  }
5947
5965
  }
5948
5966
  // push prop
@@ -6010,34 +6028,75 @@ var template = Object.freeze({
6010
6028
  }
6011
6029
 
6012
6030
  /**
6013
- * Set a prop's initial value on a vm and its data object.
6031
+ * Process a prop with a rawValue, applying necessary coersions,
6032
+ * default values & assertions and call the given callback with
6033
+ * processed value.
6014
6034
  *
6015
6035
  * @param {Vue} vm
6016
6036
  * @param {Object} prop
6017
- * @param {*} value
6037
+ * @param {*} rawValue
6038
+ * @param {Function} fn
6018
6039
  */
6019
6040
 
6020
- function initProp(vm, prop, value) {
6021
- var key = prop.path;
6022
- value = coerceProp(prop, value);
6041
+ function processPropValue(vm, prop, rawValue, fn) {
6042
+ var isSimple = prop.dynamic && isSimplePath(prop.parentPath);
6043
+ var value = rawValue;
6023
6044
  if (value === undefined) {
6024
- value = getPropDefaultValue(vm, prop.options);
6045
+ value = getPropDefaultValue(vm, prop);
6025
6046
  }
6026
- if (assertProp(prop, value)) {
6027
- defineReactive(vm, key, value);
6047
+ value = coerceProp(prop, value);
6048
+ var coerced = value !== rawValue;
6049
+ if (!assertProp(prop, value, vm)) {
6050
+ value = undefined;
6051
+ }
6052
+ if (isSimple && !coerced) {
6053
+ withoutConversion(function () {
6054
+ fn(value);
6055
+ });
6056
+ } else {
6057
+ fn(value);
6028
6058
  }
6029
6059
  }
6030
6060
 
6061
+ /**
6062
+ * Set a prop's initial value on a vm and its data object.
6063
+ *
6064
+ * @param {Vue} vm
6065
+ * @param {Object} prop
6066
+ * @param {*} value
6067
+ */
6068
+
6069
+ function initProp(vm, prop, value) {
6070
+ processPropValue(vm, prop, value, function (value) {
6071
+ defineReactive(vm, prop.path, value);
6072
+ });
6073
+ }
6074
+
6075
+ /**
6076
+ * Update a prop's value on a vm.
6077
+ *
6078
+ * @param {Vue} vm
6079
+ * @param {Object} prop
6080
+ * @param {*} value
6081
+ */
6082
+
6083
+ function updateProp(vm, prop, value) {
6084
+ processPropValue(vm, prop, value, function (value) {
6085
+ vm[prop.path] = value;
6086
+ });
6087
+ }
6088
+
6031
6089
  /**
6032
6090
  * Get the default value of a prop.
6033
6091
  *
6034
6092
  * @param {Vue} vm
6035
- * @param {Object} options
6093
+ * @param {Object} prop
6036
6094
  * @return {*}
6037
6095
  */
6038
6096
 
6039
- function getPropDefaultValue(vm, options) {
6097
+ function getPropDefaultValue(vm, prop) {
6040
6098
  // no default, return undefined
6099
+ var options = prop.options;
6041
6100
  if (!hasOwn(options, 'default')) {
6042
6101
  // absent boolean value defaults to false
6043
6102
  return options.type === Boolean ? false : undefined;
@@ -6045,7 +6104,7 @@ var template = Object.freeze({
6045
6104
  var def = options['default'];
6046
6105
  // warn against non-factory defaults for Object & Array
6047
6106
  if (isObject(def)) {
6048
- 'development' !== 'production' && warn('Object/Array as default prop values will be shared ' + 'across multiple instances. Use a factory function ' + 'to return the default value instead.');
6107
+ 'development' !== 'production' && warn('Invalid default value for prop "' + prop.name + '": ' + 'Props with type Object/Array must use a factory function ' + 'to return the default value.', vm);
6049
6108
  }
6050
6109
  // call factory function for non-Function types
6051
6110
  return typeof def === 'function' && options.type !== Function ? def.call(vm) : def;
@@ -6056,9 +6115,10 @@ var template = Object.freeze({
6056
6115
  *
6057
6116
  * @param {Object} prop
6058
6117
  * @param {*} value
6118
+ * @param {Vue} vm
6059
6119
  */
6060
6120
 
6061
- function assertProp(prop, value) {
6121
+ function assertProp(prop, value, vm) {
6062
6122
  if (!prop.options.required && ( // non-required
6063
6123
  prop.raw === null || // abscent
6064
6124
  value == null) // null or undefined
@@ -6067,39 +6127,28 @@ var template = Object.freeze({
6067
6127
  }
6068
6128
  var options = prop.options;
6069
6129
  var type = options.type;
6070
- var valid = true;
6071
- var expectedType;
6130
+ var valid = !type;
6131
+ var expectedTypes = [];
6072
6132
  if (type) {
6073
- if (type === String) {
6074
- expectedType = 'string';
6075
- valid = typeof value === expectedType;
6076
- } else if (type === Number) {
6077
- expectedType = 'number';
6078
- valid = typeof value === 'number';
6079
- } else if (type === Boolean) {
6080
- expectedType = 'boolean';
6081
- valid = typeof value === 'boolean';
6082
- } else if (type === Function) {
6083
- expectedType = 'function';
6084
- valid = typeof value === 'function';
6085
- } else if (type === Object) {
6086
- expectedType = 'object';
6087
- valid = isPlainObject(value);
6088
- } else if (type === Array) {
6089
- expectedType = 'array';
6090
- valid = isArray(value);
6091
- } else {
6092
- valid = value instanceof type;
6133
+ if (!isArray(type)) {
6134
+ type = [type];
6135
+ }
6136
+ for (var i = 0; i < type.length && !valid; i++) {
6137
+ var assertedType = assertType(value, type[i]);
6138
+ expectedTypes.push(assertedType.expectedType);
6139
+ valid = assertedType.valid;
6093
6140
  }
6094
6141
  }
6095
6142
  if (!valid) {
6096
- 'development' !== 'production' && warn('Invalid prop: type check failed for ' + prop.path + '="' + prop.raw + '".' + ' Expected ' + formatType(expectedType) + ', got ' + formatValue(value) + '.');
6143
+ if ('development' !== 'production') {
6144
+ warn('Invalid prop: type check failed for prop "' + prop.name + '".' + ' Expected ' + expectedTypes.map(formatType).join(', ') + ', got ' + formatValue(value) + '.', vm);
6145
+ }
6097
6146
  return false;
6098
6147
  }
6099
6148
  var validator = options.validator;
6100
6149
  if (validator) {
6101
6150
  if (!validator(value)) {
6102
- 'development' !== 'production' && warn('Invalid prop: custom validator check failed for ' + prop.path + '="' + prop.raw + '"');
6151
+ 'development' !== 'production' && warn('Invalid prop: custom validator check failed for prop "' + prop.name + '".', vm);
6103
6152
  return false;
6104
6153
  }
6105
6154
  }
@@ -6123,10 +6172,62 @@ var template = Object.freeze({
6123
6172
  return coerce(value);
6124
6173
  }
6125
6174
 
6126
- function formatType(val) {
6127
- return val ? val.charAt(0).toUpperCase() + val.slice(1) : 'custom type';
6175
+ /**
6176
+ * Assert the type of a value
6177
+ *
6178
+ * @param {*} value
6179
+ * @param {Function} type
6180
+ * @return {Object}
6181
+ */
6182
+
6183
+ function assertType(value, type) {
6184
+ var valid;
6185
+ var expectedType;
6186
+ if (type === String) {
6187
+ expectedType = 'string';
6188
+ valid = typeof value === expectedType;
6189
+ } else if (type === Number) {
6190
+ expectedType = 'number';
6191
+ valid = typeof value === expectedType;
6192
+ } else if (type === Boolean) {
6193
+ expectedType = 'boolean';
6194
+ valid = typeof value === expectedType;
6195
+ } else if (type === Function) {
6196
+ expectedType = 'function';
6197
+ valid = typeof value === expectedType;
6198
+ } else if (type === Object) {
6199
+ expectedType = 'object';
6200
+ valid = isPlainObject(value);
6201
+ } else if (type === Array) {
6202
+ expectedType = 'array';
6203
+ valid = isArray(value);
6204
+ } else {
6205
+ valid = value instanceof type;
6206
+ }
6207
+ return {
6208
+ valid: valid,
6209
+ expectedType: expectedType
6210
+ };
6128
6211
  }
6129
6212
 
6213
+ /**
6214
+ * Format type for output
6215
+ *
6216
+ * @param {String} type
6217
+ * @return {String}
6218
+ */
6219
+
6220
+ function formatType(type) {
6221
+ return type ? type.charAt(0).toUpperCase() + type.slice(1) : 'custom type';
6222
+ }
6223
+
6224
+ /**
6225
+ * Format value
6226
+ *
6227
+ * @param {*} value
6228
+ * @return {String}
6229
+ */
6230
+
6130
6231
  function formatValue(val) {
6131
6232
  return Object.prototype.toString.call(val).slice(8, -1);
6132
6233
  }
@@ -6143,19 +6244,9 @@ var template = Object.freeze({
6143
6244
  var childKey = prop.path;
6144
6245
  var parentKey = prop.parentPath;
6145
6246
  var twoWay = prop.mode === bindingModes.TWO_WAY;
6146
- var isSimple = isSimplePath(parentKey);
6147
6247
 
6148
6248
  var parentWatcher = this.parentWatcher = new Watcher(parent, parentKey, function (val) {
6149
- val = coerceProp(prop, val);
6150
- if (assertProp(prop, val)) {
6151
- if (isSimple) {
6152
- withoutConversion(function () {
6153
- child[childKey] = val;
6154
- });
6155
- } else {
6156
- child[childKey] = val;
6157
- }
6158
- }
6249
+ updateProp(child, prop, val);
6159
6250
  }, {
6160
6251
  twoWay: twoWay,
6161
6252
  filters: prop.filters,
@@ -6165,14 +6256,7 @@ var template = Object.freeze({
6165
6256
  });
6166
6257
 
6167
6258
  // set the child initial value.
6168
- var value = parentWatcher.value;
6169
- if (isSimple && value !== undefined) {
6170
- withoutConversion(function () {
6171
- initProp(child, prop, value);
6172
- });
6173
- } else {
6174
- initProp(child, prop, value);
6175
- }
6259
+ initProp(child, prop, parentWatcher.value);
6176
6260
 
6177
6261
  // setup two-way binding
6178
6262
  if (twoWay) {
@@ -6292,7 +6376,7 @@ var template = Object.freeze({
6292
6376
  /* istanbul ignore if */
6293
6377
  if ('development' !== 'production') {
6294
6378
  if (this.type && this.type !== TYPE_TRANSITION && this.type !== TYPE_ANIMATION) {
6295
- warn('invalid CSS transition type for transition="' + this.id + '": ' + this.type);
6379
+ warn('invalid CSS transition type for transition="' + this.id + '": ' + this.type, vm);
6296
6380
  }
6297
6381
  }
6298
6382
  // bind
@@ -6782,7 +6866,7 @@ var template = Object.freeze({
6782
6866
  */
6783
6867
 
6784
6868
  function compileAndLinkProps(vm, el, props, scope) {
6785
- var propsLinkFn = compileProps(el, props);
6869
+ var propsLinkFn = compileProps(el, props, vm);
6786
6870
  var propDirs = linkAndCapture(function () {
6787
6871
  propsLinkFn(vm, scope);
6788
6872
  }, vm);
@@ -7273,7 +7357,7 @@ var template = Object.freeze({
7273
7357
  if (name === 'class' && Array.prototype.some.call(attrs, function (attr) {
7274
7358
  return attr.name === ':class' || attr.name === 'v-bind:class';
7275
7359
  })) {
7276
- warn('class="' + rawValue + '": Do not mix mustache interpolation ' + 'and v-bind for "class" on the same element. Use one or the other.');
7360
+ warn('class="' + rawValue + '": Do not mix mustache interpolation ' + 'and v-bind for "class" on the same element. Use one or the other.', options);
7277
7361
  }
7278
7362
  }
7279
7363
  } else
@@ -7311,12 +7395,7 @@ var template = Object.freeze({
7311
7395
  continue;
7312
7396
  }
7313
7397
 
7314
- dirDef = resolveAsset(options, 'directives', dirName);
7315
-
7316
- if ('development' !== 'production') {
7317
- assertAsset(dirDef, 'directive', dirName);
7318
- }
7319
-
7398
+ dirDef = resolveAsset(options, 'directives', dirName, true);
7320
7399
  if (dirDef) {
7321
7400
  pushDir(dirName, dirDef);
7322
7401
  }
@@ -7568,7 +7647,7 @@ var template = Object.freeze({
7568
7647
  }
7569
7648
  /* eslint-enable no-cond-assign */
7570
7649
  if ('development' !== 'production' && getBindAttr(el, 'slot')) {
7571
- warn('The "slot" attribute must be static.');
7650
+ warn('The "slot" attribute must be static.', vm.$parent);
7572
7651
  }
7573
7652
  }
7574
7653
  for (name in contents) {
@@ -7653,7 +7732,7 @@ var template = Object.freeze({
7653
7732
  var el = options.el;
7654
7733
  var props = options.props;
7655
7734
  if (props && !el) {
7656
- 'development' !== 'production' && warn('Props will not be compiled if no `el` option is ' + 'provided at instantiation.');
7735
+ 'development' !== 'production' && warn('Props will not be compiled if no `el` option is ' + 'provided at instantiation.', this);
7657
7736
  }
7658
7737
  // make sure to convert string selectors into element now
7659
7738
  el = options.el = query(el);
@@ -7671,7 +7750,7 @@ var template = Object.freeze({
7671
7750
  var data = this._data = dataFn ? dataFn() : {};
7672
7751
  if (!isPlainObject(data)) {
7673
7752
  data = {};
7674
- 'development' !== 'production' && warn('data functions should return an object.');
7753
+ 'development' !== 'production' && warn('data functions should return an object.', this);
7675
7754
  }
7676
7755
  var props = this._props;
7677
7756
  var runtimeData = this._runtimeData ? typeof this._runtimeData === 'function' ? this._runtimeData() : this._runtimeData : null;
@@ -7688,7 +7767,7 @@ var template = Object.freeze({
7688
7767
  if (!props || !hasOwn(props, key) || runtimeData && hasOwn(runtimeData, key) && props[key].raw === null) {
7689
7768
  this._proxy(key);
7690
7769
  } else if ('development' !== 'production') {
7691
- warn('Data field "' + key + '" is already defined ' + 'as a prop. Use prop default value instead.');
7770
+ warn('Data field "' + key + '" is already defined ' + 'as a prop. Use prop default value instead.', this);
7692
7771
  }
7693
7772
  }
7694
7773
  // observe data
@@ -7888,7 +7967,7 @@ var template = Object.freeze({
7888
7967
  handler._fromParent = true;
7889
7968
  vm.$on(name.replace(eventRE), handler);
7890
7969
  } else if ('development' !== 'production') {
7891
- warn('v-on:' + name + '="' + attrs[i].value + '"' + (vm.$options.name ? ' on component <' + vm.$options.name + '>' : '') + ' expects a function value, got ' + handler);
7970
+ warn('v-on:' + name + '="' + attrs[i].value + '" ' + 'expects a function value, got ' + handler, vm);
7892
7971
  }
7893
7972
  }
7894
7973
  }
@@ -7937,7 +8016,7 @@ var template = Object.freeze({
7937
8016
  if (method) {
7938
8017
  vm[action](key, method, options);
7939
8018
  } else {
7940
- 'development' !== 'production' && warn('Unknown method: "' + handler + '" when ' + 'registering callback for ' + action + ': "' + key + '".');
8019
+ 'development' !== 'production' && warn('Unknown method: "' + handler + '" when ' + 'registering callback for ' + action + ': "' + key + '".', vm);
7941
8020
  }
7942
8021
  } else if (handler && type === 'object') {
7943
8022
  register(vm, action, key, handler.handler, handler);
@@ -8578,10 +8657,7 @@ var template = Object.freeze({
8578
8657
  var filter, fn, args, arg, offset, i, l, j, k;
8579
8658
  for (i = 0, l = filters.length; i < l; i++) {
8580
8659
  filter = filters[write ? l - i - 1 : i];
8581
- fn = resolveAsset(this.$options, 'filters', filter.name);
8582
- if ('development' !== 'production') {
8583
- assertAsset(fn, 'filter', filter.name);
8584
- }
8660
+ fn = resolveAsset(this.$options, 'filters', filter.name, true);
8585
8661
  if (!fn) continue;
8586
8662
  fn = write ? fn.write : fn.read || fn;
8587
8663
  if (typeof fn !== 'function') continue;
@@ -8614,10 +8690,7 @@ var template = Object.freeze({
8614
8690
  if (typeof value === 'function') {
8615
8691
  factory = value;
8616
8692
  } else {
8617
- factory = resolveAsset(this.$options, 'components', value);
8618
- if ('development' !== 'production') {
8619
- assertAsset(factory, 'component', value);
8620
- }
8693
+ factory = resolveAsset(this.$options, 'components', value, true);
8621
8694
  }
8622
8695
  if (!factory) {
8623
8696
  return;
@@ -9219,7 +9292,7 @@ var template = Object.freeze({
9219
9292
 
9220
9293
  Vue.prototype.$mount = function (el) {
9221
9294
  if (this._isCompiled) {
9222
- 'development' !== 'production' && warn('$mount() should be called only once.');
9295
+ 'development' !== 'production' && warn('$mount() should be called only once.', this);
9223
9296
  return;
9224
9297
  }
9225
9298
  el = query(el);
@@ -9378,10 +9451,7 @@ var template = Object.freeze({
9378
9451
  },
9379
9452
 
9380
9453
  insert: function insert(id) {
9381
- var partial = resolveAsset(this.vm.$options, 'partials', id);
9382
- if ('development' !== 'production') {
9383
- assertAsset(partial, 'partial', id);
9384
- }
9454
+ var partial = resolveAsset(this.vm.$options, 'partials', id, true);
9385
9455
  if (partial) {
9386
9456
  this.factory = new FragmentFactory(this.vm, partial);
9387
9457
  vIf.insert.call(this);
@@ -9437,9 +9507,7 @@ var template = Object.freeze({
9437
9507
  // because why not
9438
9508
  var n = delimiter === 'in' ? 3 : 2;
9439
9509
  // extract and flatten keys
9440
- var keys = toArray(arguments, n).reduce(function (prev, cur) {
9441
- return prev.concat(cur);
9442
- }, []);
9510
+ var keys = Array.prototype.concat.apply([], toArray(arguments, n));
9443
9511
  var res = [];
9444
9512
  var item, key, val, j;
9445
9513
  for (var i = 0, l = arr.length; i < l; i++) {
@@ -9464,26 +9532,58 @@ var template = Object.freeze({
9464
9532
  /**
9465
9533
  * Filter filter for arrays
9466
9534
  *
9467
- * @param {String} sortKey
9468
- * @param {String} reverse
9535
+ * @param {String|Array<String>|Function} ...sortKeys
9536
+ * @param {Number} [order]
9469
9537
  */
9470
9538
 
9471
- function orderBy(arr, sortKey, reverse) {
9539
+ function orderBy(arr) {
9540
+ var comparator = null;
9541
+ var sortKeys = undefined;
9472
9542
  arr = convertArray(arr);
9473
- if (!sortKey) {
9543
+
9544
+ // determine order (last argument)
9545
+ var args = toArray(arguments, 1);
9546
+ var order = args[args.length - 1];
9547
+ if (typeof order === 'number') {
9548
+ order = order < 0 ? -1 : 1;
9549
+ args = args.length > 1 ? args.slice(0, -1) : args;
9550
+ } else {
9551
+ order = 1;
9552
+ }
9553
+
9554
+ // determine sortKeys & comparator
9555
+ var firstArg = args[0];
9556
+ if (!firstArg) {
9474
9557
  return arr;
9558
+ } else if (typeof firstArg === 'function') {
9559
+ // custom comparator
9560
+ comparator = function (a, b) {
9561
+ return firstArg(a, b) * order;
9562
+ };
9563
+ } else {
9564
+ // string keys. flatten first
9565
+ sortKeys = Array.prototype.concat.apply([], args);
9566
+ comparator = function (a, b, i) {
9567
+ i = i || 0;
9568
+ return i >= sortKeys.length - 1 ? baseCompare(a, b, i) : baseCompare(a, b, i) || comparator(a, b, i + 1);
9569
+ };
9475
9570
  }
9476
- var order = reverse && reverse < 0 ? -1 : 1;
9477
- // sort on a copy to avoid mutating original array
9478
- return arr.slice().sort(function (a, b) {
9479
- if (sortKey !== '$key') {
9480
- if (isObject(a) && '$value' in a) a = a.$value;
9481
- if (isObject(b) && '$value' in b) b = b.$value;
9571
+
9572
+ function baseCompare(a, b, sortKeyIndex) {
9573
+ var sortKey = sortKeys[sortKeyIndex];
9574
+ if (sortKey) {
9575
+ if (sortKey !== '$key') {
9576
+ if (isObject(a) && '$value' in a) a = a.$value;
9577
+ if (isObject(b) && '$value' in b) b = b.$value;
9578
+ }
9579
+ a = isObject(a) ? getPath(a, sortKey) : a;
9580
+ b = isObject(b) ? getPath(b, sortKey) : b;
9482
9581
  }
9483
- a = isObject(a) ? getPath(a, sortKey) : a;
9484
- b = isObject(b) ? getPath(b, sortKey) : b;
9485
9582
  return a === b ? 0 : a > b ? order : -order;
9486
- });
9583
+ }
9584
+
9585
+ // sort on a copy to avoid mutating original array
9586
+ return arr.slice().sort(comparator);
9487
9587
  }
9488
9588
 
9489
9589
  /**
@@ -9803,17 +9903,19 @@ var template = Object.freeze({
9803
9903
 
9804
9904
  installGlobalAPI(Vue);
9805
9905
 
9806
- Vue.version = '1.0.20';
9906
+ Vue.version = '1.0.21';
9807
9907
 
9808
9908
  // devtools global hook
9809
9909
  /* istanbul ignore next */
9810
- if (config.devtools) {
9811
- if (devtools) {
9812
- devtools.emit('init', Vue);
9813
- } else if ('development' !== 'production' && inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)) {
9814
- console.log('Download the Vue Devtools for a better development experience:\n' + 'https://github.com/vuejs/vue-devtools');
9910
+ setTimeout(function () {
9911
+ if (config.devtools) {
9912
+ if (devtools) {
9913
+ devtools.emit('init', Vue);
9914
+ } else if ('development' !== 'production' && inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)) {
9915
+ console.log('Download the Vue Devtools for a better development experience:\n' + 'https://github.com/vuejs/vue-devtools');
9916
+ }
9815
9917
  }
9816
- }
9918
+ }, 0);
9817
9919
 
9818
9920
  return Vue;
9819
9921
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vuejs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.21
4
+ version: 1.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Lim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-07 00:00:00.000000000 Z
11
+ date: 2016-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler