vuejs-rails 1.0.21 → 1.0.24

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: c9905a40996d0b0a3b9097bee06ba919495e9003
4
- data.tar.gz: 1763773db990572473ada992aa112061495efae4
3
+ metadata.gz: a2577a08c2d277a4f5a7c3afc88ce511c46b59dd
4
+ data.tar.gz: 8b7d24d0ea59feb2faccfb2c254256c9070dbcb6
5
5
  SHA512:
6
- metadata.gz: 0d8a7cced5d25651068706054d1e2dd8ee56c060f60a610e097ed4531abab07c4b7ae4d1cfac09e0ab4cf865409fdace2d74dccda2237a18df7d27f53424ba9a
7
- data.tar.gz: f97458fa23057f2fc718b5c05b6799dba3ba9745c8253709c8e72646eb068ad9cad24f7da7465a7986854a4ab7a18ab434ab10e1b25d69bd1a4f0dd9a5050693
6
+ metadata.gz: 73424af37a8b27043e74bb640ca90605419b494113d3b99205dc59dfec3c759af51ac2cdf4f1cc0052aba6227414a98ad322978e90d5376cf82eda48b97bcac0
7
+ data.tar.gz: 70328412997be4f0393d2f2acd688d1415e28a896cf11f91d592eb64364f10fc934cbbe115d8006e1f229f13dc924a1fa9412993584eb99db43e7ff5cee93a82
data/Readme.md CHANGED
@@ -10,12 +10,20 @@ Have in your Gemfile:
10
10
 
11
11
  gem 'vuejs-rails'
12
12
 
13
- And, have in your application.js manifest:
13
+ And in your application.js manifest:
14
14
 
15
15
  //= require vue
16
16
  //= require vue-router (optional)
17
17
  //= require vue-resource (optional)
18
18
 
19
+ If your application.js requires TurboLinks (a default setting for new Rails apps), you should strongly consider disabling it, as it will cause pages to load without reloading the Javascript.
20
+
21
+ In app/views/layouts/application.html.erb, move this line from the head of the document to the end of the body:
22
+
23
+ ```<%= javascript_include_tag 'application' %>```
24
+
25
+ You may write your Vue.js code directly in your views using ```<script>``` tags, or in a separate Javascript file (recommended).
26
+
19
27
  ## Contributing
20
28
 
21
29
  Contributions are welcome, please follow [GitHub Flow](https://guides.github.com/introduction/flow/index.html)
@@ -1,5 +1,5 @@
1
1
  module Vue
2
2
  module Rails
3
- VERSION = '1.0.21'
3
+ VERSION = '1.0.24'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v1.0.21
2
+ * Vue.js v1.0.24
3
3
  * (c) 2016 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -50,6 +50,10 @@
50
50
  delete obj[key];
51
51
  var ob = obj.__ob__;
52
52
  if (!ob) {
53
+ if (obj._isVue) {
54
+ delete obj._data[key];
55
+ obj._digest();
56
+ }
53
57
  return;
54
58
  }
55
59
  ob.dep.notify();
@@ -400,6 +404,8 @@
400
404
  var UA = inBrowser && window.navigator.userAgent.toLowerCase();
401
405
  var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
402
406
  var isAndroid = UA && UA.indexOf('android') > 0;
407
+ var isIos = UA && /(iphone|ipad|ipod|ios)/i.test(UA);
408
+ var isWechat = UA && UA.indexOf('micromessenger') > 0;
403
409
 
404
410
  var transitionProp = undefined;
405
411
  var transitionEndEvent = undefined;
@@ -440,7 +446,7 @@
440
446
  }
441
447
 
442
448
  /* istanbul ignore if */
443
- if (typeof MutationObserver !== 'undefined') {
449
+ if (typeof MutationObserver !== 'undefined' && !(isWechat && isIos)) {
444
450
  var counter = 1;
445
451
  var observer = new MutationObserver(nextTickHandler);
446
452
  var textNode = document.createTextNode(counter);
@@ -469,6 +475,27 @@
469
475
  };
470
476
  })();
471
477
 
478
+ var _Set = undefined;
479
+ /* istanbul ignore if */
480
+ if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) {
481
+ // use native Set when available.
482
+ _Set = Set;
483
+ } else {
484
+ // a non-standard Set polyfill that only works with primitive keys.
485
+ _Set = function () {
486
+ this.set = Object.create(null);
487
+ };
488
+ _Set.prototype.has = function (key) {
489
+ return this.set[key] !== undefined;
490
+ };
491
+ _Set.prototype.add = function (key) {
492
+ this.set[key] = 1;
493
+ };
494
+ _Set.prototype.clear = function () {
495
+ this.set = Object.create(null);
496
+ };
497
+ }
498
+
472
499
  function Cache(limit) {
473
500
  this.size = 0;
474
501
  this.limit = limit;
@@ -1113,8 +1140,9 @@ var transition = Object.freeze({
1113
1140
  */
1114
1141
 
1115
1142
  function inDoc(node) {
1116
- var doc = document.documentElement;
1117
- var parent = node && node.parentNode;
1143
+ if (!node) return false;
1144
+ var doc = node.ownerDocument.documentElement;
1145
+ var parent = node.parentNode;
1118
1146
  return doc === node || doc === parent || !!(parent && parent.nodeType === 1 && doc.contains(parent));
1119
1147
  }
1120
1148
 
@@ -1549,7 +1577,7 @@ var transition = Object.freeze({
1549
1577
  if (resolveAsset(options, 'components', tag)) {
1550
1578
  return { id: tag };
1551
1579
  } else {
1552
- var is = hasAttrs && getIsBinding(el);
1580
+ var is = hasAttrs && getIsBinding(el, options);
1553
1581
  if (is) {
1554
1582
  return is;
1555
1583
  } else if ('development' !== 'production') {
@@ -1562,7 +1590,7 @@ var transition = Object.freeze({
1562
1590
  }
1563
1591
  }
1564
1592
  } else if (hasAttrs) {
1565
- return getIsBinding(el);
1593
+ return getIsBinding(el, options);
1566
1594
  }
1567
1595
  }
1568
1596
 
@@ -1570,14 +1598,18 @@ var transition = Object.freeze({
1570
1598
  * Get "is" binding from an element.
1571
1599
  *
1572
1600
  * @param {Element} el
1601
+ * @param {Object} options
1573
1602
  * @return {Object|undefined}
1574
1603
  */
1575
1604
 
1576
- function getIsBinding(el) {
1605
+ function getIsBinding(el, options) {
1577
1606
  // dynamic syntax
1578
- var exp = getAttr(el, 'is');
1607
+ var exp = el.getAttribute('is');
1579
1608
  if (exp != null) {
1580
- return { id: exp };
1609
+ if (resolveAsset(options, 'components', exp)) {
1610
+ el.removeAttribute('is');
1611
+ return { id: exp };
1612
+ }
1581
1613
  } else {
1582
1614
  exp = getBindAttr(el, 'is');
1583
1615
  if (exp != null) {
@@ -1688,7 +1720,7 @@ var transition = Object.freeze({
1688
1720
  */
1689
1721
 
1690
1722
  function mergeAssets(parentVal, childVal) {
1691
- var res = Object.create(parentVal);
1723
+ var res = Object.create(parentVal || null);
1692
1724
  return childVal ? extend(res, guardArrayAssets(childVal)) : res;
1693
1725
  }
1694
1726
 
@@ -1847,8 +1879,16 @@ var transition = Object.freeze({
1847
1879
  function mergeOptions(parent, child, vm) {
1848
1880
  guardComponents(child);
1849
1881
  guardProps(child);
1882
+ if ('development' !== 'production') {
1883
+ if (child.propsData && !vm) {
1884
+ warn('propsData can only be used as an instantiation option.');
1885
+ }
1886
+ }
1850
1887
  var options = {};
1851
1888
  var key;
1889
+ if (child['extends']) {
1890
+ parent = typeof child['extends'] === 'function' ? mergeOptions(parent, child['extends'].options, vm) : mergeOptions(parent, child['extends'], vm);
1891
+ }
1852
1892
  if (child.mixins) {
1853
1893
  for (var i = 0, l = child.mixins.length; i < l; i++) {
1854
1894
  parent = mergeOptions(parent, child.mixins[i], vm);
@@ -2281,11 +2321,14 @@ var transition = Object.freeze({
2281
2321
  devtools: devtools,
2282
2322
  isIE9: isIE9,
2283
2323
  isAndroid: isAndroid,
2324
+ isIos: isIos,
2325
+ isWechat: isWechat,
2284
2326
  get transitionProp () { return transitionProp; },
2285
2327
  get transitionEndEvent () { return transitionEndEvent; },
2286
2328
  get animationProp () { return animationProp; },
2287
2329
  get animationEndEvent () { return animationEndEvent; },
2288
2330
  nextTick: nextTick,
2331
+ get _Set () { return _Set; },
2289
2332
  query: query,
2290
2333
  inDoc: inDoc,
2291
2334
  getAttr: getAttr,
@@ -2398,14 +2441,9 @@ var transition = Object.freeze({
2398
2441
  this._updateRef();
2399
2442
 
2400
2443
  // initialize data as empty object.
2401
- // it will be filled up in _initScope().
2444
+ // it will be filled up in _initData().
2402
2445
  this._data = {};
2403
2446
 
2404
- // save raw constructor data before merge
2405
- // so that we know which properties are provided at
2406
- // instantiation.
2407
- this._runtimeData = options.data;
2408
-
2409
2447
  // call init hook
2410
2448
  this._callHook('init');
2411
2449
 
@@ -2955,24 +2993,22 @@ var expression = Object.freeze({
2955
2993
  // triggered, the DOM would have already been in updated
2956
2994
  // state.
2957
2995
 
2958
- var queueIndex;
2959
2996
  var queue = [];
2960
2997
  var userQueue = [];
2961
2998
  var has = {};
2962
2999
  var circular = {};
2963
3000
  var waiting = false;
2964
- var internalQueueDepleted = false;
2965
3001
 
2966
3002
  /**
2967
3003
  * Reset the batcher's state.
2968
3004
  */
2969
3005
 
2970
3006
  function resetBatcherState() {
2971
- queue = [];
2972
- userQueue = [];
3007
+ queue.length = 0;
3008
+ userQueue.length = 0;
2973
3009
  has = {};
2974
3010
  circular = {};
2975
- waiting = internalQueueDepleted = false;
3011
+ waiting = false;
2976
3012
  }
2977
3013
 
2978
3014
  /**
@@ -2980,15 +3016,26 @@ var expression = Object.freeze({
2980
3016
  */
2981
3017
 
2982
3018
  function flushBatcherQueue() {
2983
- runBatcherQueue(queue);
2984
- internalQueueDepleted = true;
2985
- runBatcherQueue(userQueue);
2986
- // dev tool hook
2987
- /* istanbul ignore if */
2988
- if (devtools && config.devtools) {
2989
- devtools.emit('flush');
3019
+ var _again = true;
3020
+
3021
+ _function: while (_again) {
3022
+ _again = false;
3023
+
3024
+ runBatcherQueue(queue);
3025
+ runBatcherQueue(userQueue);
3026
+ // user watchers triggered more watchers,
3027
+ // keep flushing until it depletes
3028
+ if (queue.length) {
3029
+ _again = true;
3030
+ continue _function;
3031
+ }
3032
+ // dev tool hook
3033
+ /* istanbul ignore if */
3034
+ if (devtools && config.devtools) {
3035
+ devtools.emit('flush');
3036
+ }
3037
+ resetBatcherState();
2990
3038
  }
2991
- resetBatcherState();
2992
3039
  }
2993
3040
 
2994
3041
  /**
@@ -3000,8 +3047,8 @@ var expression = Object.freeze({
3000
3047
  function runBatcherQueue(queue) {
3001
3048
  // do not cache length because more watchers might be pushed
3002
3049
  // as we run existing watchers
3003
- for (queueIndex = 0; queueIndex < queue.length; queueIndex++) {
3004
- var watcher = queue[queueIndex];
3050
+ for (var i = 0; i < queue.length; i++) {
3051
+ var watcher = queue[i];
3005
3052
  var id = watcher.id;
3006
3053
  has[id] = null;
3007
3054
  watcher.run();
@@ -3014,6 +3061,7 @@ var expression = Object.freeze({
3014
3061
  }
3015
3062
  }
3016
3063
  }
3064
+ queue.length = 0;
3017
3065
  }
3018
3066
 
3019
3067
  /**
@@ -3030,20 +3078,14 @@ var expression = Object.freeze({
3030
3078
  function pushWatcher(watcher) {
3031
3079
  var id = watcher.id;
3032
3080
  if (has[id] == null) {
3033
- if (internalQueueDepleted && !watcher.user) {
3034
- // an internal watcher triggered by a user watcher...
3035
- // let's run it immediately after current user watcher is done.
3036
- userQueue.splice(queueIndex + 1, 0, watcher);
3037
- } else {
3038
- // push watcher into appropriate queue
3039
- var q = watcher.user ? userQueue : queue;
3040
- has[id] = q.length;
3041
- q.push(watcher);
3042
- // queue the flush
3043
- if (!waiting) {
3044
- waiting = true;
3045
- nextTick(flushBatcherQueue);
3046
- }
3081
+ // push watcher into appropriate queue
3082
+ var q = watcher.user ? userQueue : queue;
3083
+ has[id] = q.length;
3084
+ q.push(watcher);
3085
+ // queue the flush
3086
+ if (!waiting) {
3087
+ waiting = true;
3088
+ nextTick(flushBatcherQueue);
3047
3089
  }
3048
3090
  }
3049
3091
  }
@@ -3084,8 +3126,8 @@ var expression = Object.freeze({
3084
3126
  this.dirty = this.lazy; // for lazy watchers
3085
3127
  this.deps = [];
3086
3128
  this.newDeps = [];
3087
- this.depIds = Object.create(null);
3088
- this.newDepIds = null;
3129
+ this.depIds = new _Set();
3130
+ this.newDepIds = new _Set();
3089
3131
  this.prevError = null; // for async error stacks
3090
3132
  // parse expression for getter/setter
3091
3133
  if (isFn) {
@@ -3177,8 +3219,6 @@ var expression = Object.freeze({
3177
3219
 
3178
3220
  Watcher.prototype.beforeGet = function () {
3179
3221
  Dep.target = this;
3180
- this.newDepIds = Object.create(null);
3181
- this.newDeps.length = 0;
3182
3222
  };
3183
3223
 
3184
3224
  /**
@@ -3189,10 +3229,10 @@ var expression = Object.freeze({
3189
3229
 
3190
3230
  Watcher.prototype.addDep = function (dep) {
3191
3231
  var id = dep.id;
3192
- if (!this.newDepIds[id]) {
3193
- this.newDepIds[id] = true;
3232
+ if (!this.newDepIds.has(id)) {
3233
+ this.newDepIds.add(id);
3194
3234
  this.newDeps.push(dep);
3195
- if (!this.depIds[id]) {
3235
+ if (!this.depIds.has(id)) {
3196
3236
  dep.addSub(this);
3197
3237
  }
3198
3238
  }
@@ -3207,14 +3247,18 @@ var expression = Object.freeze({
3207
3247
  var i = this.deps.length;
3208
3248
  while (i--) {
3209
3249
  var dep = this.deps[i];
3210
- if (!this.newDepIds[dep.id]) {
3250
+ if (!this.newDepIds.has(dep.id)) {
3211
3251
  dep.removeSub(this);
3212
3252
  }
3213
3253
  }
3254
+ var tmp = this.depIds;
3214
3255
  this.depIds = this.newDepIds;
3215
- var tmp = this.deps;
3256
+ this.newDepIds = tmp;
3257
+ this.newDepIds.clear();
3258
+ tmp = this.deps;
3216
3259
  this.deps = this.newDeps;
3217
3260
  this.newDeps = tmp;
3261
+ this.newDeps.length = 0;
3218
3262
  };
3219
3263
 
3220
3264
  /**
@@ -3338,15 +3382,33 @@ var expression = Object.freeze({
3338
3382
  * @param {*} val
3339
3383
  */
3340
3384
 
3341
- function traverse(val) {
3342
- var i, keys;
3343
- if (isArray(val)) {
3344
- i = val.length;
3345
- while (i--) traverse(val[i]);
3346
- } else if (isObject(val)) {
3347
- keys = Object.keys(val);
3348
- i = keys.length;
3349
- while (i--) traverse(val[keys[i]]);
3385
+ var seenObjects = new _Set();
3386
+ function traverse(val, seen) {
3387
+ var i = undefined,
3388
+ keys = undefined;
3389
+ if (!seen) {
3390
+ seen = seenObjects;
3391
+ seen.clear();
3392
+ }
3393
+ var isA = isArray(val);
3394
+ var isO = isObject(val);
3395
+ if (isA || isO) {
3396
+ if (val.__ob__) {
3397
+ var depId = val.__ob__.dep.id;
3398
+ if (seen.has(depId)) {
3399
+ return;
3400
+ } else {
3401
+ seen.add(depId);
3402
+ }
3403
+ }
3404
+ if (isA) {
3405
+ i = val.length;
3406
+ while (i--) traverse(val[i], seen);
3407
+ } else if (isO) {
3408
+ keys = Object.keys(val);
3409
+ i = keys.length;
3410
+ while (i--) traverse(val[keys[i]], seen);
3411
+ }
3350
3412
  }
3351
3413
  }
3352
3414
 
@@ -3455,10 +3517,13 @@ var expression = Object.freeze({
3455
3517
 
3456
3518
  function nodeToFragment(node) {
3457
3519
  // if its a template tag and the browser supports it,
3458
- // its content is already a document fragment.
3520
+ // its content is already a document fragment. However, iOS Safari has
3521
+ // bug when using directly cloned template content with touch
3522
+ // events and can cause crashes when the nodes are removed from DOM, so we
3523
+ // have to treat template elements as string templates. (#2805)
3524
+ /* istanbul ignore if */
3459
3525
  if (isRealTemplate(node)) {
3460
- trimNode(node.content);
3461
- return node.content;
3526
+ return stringToFragment(node.innerHTML);
3462
3527
  }
3463
3528
  // script template
3464
3529
  if (node.tagName === 'SCRIPT') {
@@ -3854,7 +3919,7 @@ var template = Object.freeze({
3854
3919
  this.vm = vm;
3855
3920
  var template;
3856
3921
  var isString = typeof el === 'string';
3857
- if (isString || isTemplate(el)) {
3922
+ if (isString || isTemplate(el) && !el.hasAttribute('v-if')) {
3858
3923
  template = parseTemplate(el, true);
3859
3924
  } else {
3860
3925
  template = document.createDocumentFragment();
@@ -4196,7 +4261,15 @@ var template = Object.freeze({
4196
4261
  });
4197
4262
  setTimeout(op, staggerAmount);
4198
4263
  } else {
4199
- frag.before(prevEl.nextSibling);
4264
+ var target = prevEl.nextSibling;
4265
+ /* istanbul ignore if */
4266
+ if (!target) {
4267
+ // reset end anchor position in case the position was messed up
4268
+ // by an external drag-n-drop library.
4269
+ after(this.end, prevEl);
4270
+ target = this.end;
4271
+ }
4272
+ frag.before(target);
4200
4273
  }
4201
4274
  },
4202
4275
 
@@ -4267,7 +4340,7 @@ var template = Object.freeze({
4267
4340
  var primitive = !isObject(value);
4268
4341
  var id;
4269
4342
  if (key || trackByKey || primitive) {
4270
- id = trackByKey ? trackByKey === '$index' ? index : getPath(value, trackByKey) : key || value;
4343
+ id = getTrackByKey(index, key, value, trackByKey);
4271
4344
  if (!cache[id]) {
4272
4345
  cache[id] = frag;
4273
4346
  } else if (trackByKey !== '$index') {
@@ -4281,8 +4354,10 @@ var template = Object.freeze({
4281
4354
  } else {
4282
4355
  'development' !== 'production' && this.warnDuplicate(value);
4283
4356
  }
4284
- } else {
4357
+ } else if (Object.isExtensible(value)) {
4285
4358
  def(value, id, frag);
4359
+ } else if ('development' !== 'production') {
4360
+ warn('Frozen v-for objects cannot be automatically tracked, make sure to ' + 'provide a track-by key.');
4286
4361
  }
4287
4362
  }
4288
4363
  frag.raw = value;
@@ -4302,7 +4377,7 @@ var template = Object.freeze({
4302
4377
  var primitive = !isObject(value);
4303
4378
  var frag;
4304
4379
  if (key || trackByKey || primitive) {
4305
- var id = trackByKey ? trackByKey === '$index' ? index : getPath(value, trackByKey) : key || value;
4380
+ var id = getTrackByKey(index, key, value, trackByKey);
4306
4381
  frag = this.cache[id];
4307
4382
  } else {
4308
4383
  frag = value[this.id];
@@ -4329,7 +4404,7 @@ var template = Object.freeze({
4329
4404
  var key = hasOwn(scope, '$key') && scope.$key;
4330
4405
  var primitive = !isObject(value);
4331
4406
  if (trackByKey || key || primitive) {
4332
- var id = trackByKey ? trackByKey === '$index' ? index : getPath(value, trackByKey) : key || value;
4407
+ var id = getTrackByKey(index, key, value, trackByKey);
4333
4408
  this.cache[id] = null;
4334
4409
  } else {
4335
4410
  value[this.id] = null;
@@ -4479,6 +4554,19 @@ var template = Object.freeze({
4479
4554
  return ret;
4480
4555
  }
4481
4556
 
4557
+ /**
4558
+ * Get the track by key for an item.
4559
+ *
4560
+ * @param {Number} index
4561
+ * @param {String} key
4562
+ * @param {*} value
4563
+ * @param {String} [trackByKey]
4564
+ */
4565
+
4566
+ function getTrackByKey(index, key, value, trackByKey) {
4567
+ return trackByKey ? trackByKey === '$index' ? index : trackByKey.charAt(0).match(/\w/) ? getPath(value, trackByKey) : value[trackByKey] : key || value;
4568
+ }
4569
+
4482
4570
  if ('development' !== 'production') {
4483
4571
  vFor.warnDuplicate = function (value) {
4484
4572
  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);
@@ -5080,7 +5168,7 @@ var template = Object.freeze({
5080
5168
  }
5081
5169
  // key filter
5082
5170
  var keys = Object.keys(this.modifiers).filter(function (key) {
5083
- return key !== 'stop' && key !== 'prevent' && key !== 'self';
5171
+ return key !== 'stop' && key !== 'prevent' && key !== 'self' && key !== 'capture';
5084
5172
  });
5085
5173
  if (keys.length) {
5086
5174
  handler = keyFilter(handler, keys);
@@ -5209,6 +5297,12 @@ var template = Object.freeze({
5209
5297
  }
5210
5298
  var i = prefixes.length;
5211
5299
  var prefixed;
5300
+ if (camel !== 'filter' && camel in testEl.style) {
5301
+ return {
5302
+ kebab: prop,
5303
+ camel: camel
5304
+ };
5305
+ }
5212
5306
  while (i--) {
5213
5307
  prefixed = camelPrefixes[i] + upper;
5214
5308
  if (prefixed in testEl.style) {
@@ -5218,12 +5312,6 @@ var template = Object.freeze({
5218
5312
  };
5219
5313
  }
5220
5314
  }
5221
- if (camel in testEl.style) {
5222
- return {
5223
- kebab: prop,
5224
- camel: camel
5225
- };
5226
- }
5227
5315
  }
5228
5316
 
5229
5317
  // xlink
@@ -5312,8 +5400,12 @@ var template = Object.freeze({
5312
5400
  attr = camelize(attr);
5313
5401
  }
5314
5402
  if (!interp && attrWithPropsRE.test(attr) && attr in el) {
5315
- el[attr] = attr === 'value' ? value == null // IE9 will set input.value to "null" for null...
5403
+ var attrValue = attr === 'value' ? value == null // IE9 will set input.value to "null" for null...
5316
5404
  ? '' : value : value;
5405
+
5406
+ if (el[attr] !== attrValue) {
5407
+ el[attr] = attrValue;
5408
+ }
5317
5409
  }
5318
5410
  // set model props
5319
5411
  var modelProp = modelProps[attr];
@@ -5413,66 +5505,66 @@ var template = Object.freeze({
5413
5505
  deep: true,
5414
5506
 
5415
5507
  update: function update(value) {
5416
- if (value && typeof value === 'string') {
5417
- this.handleObject(stringToObject(value));
5418
- } else if (isPlainObject(value)) {
5419
- this.handleObject(value);
5420
- } else if (isArray(value)) {
5421
- this.handleArray(value);
5422
- } else {
5508
+ if (!value) {
5423
5509
  this.cleanup();
5510
+ } else if (typeof value === 'string') {
5511
+ this.setClass(value.trim().split(/\s+/));
5512
+ } else {
5513
+ this.setClass(normalize$1(value));
5424
5514
  }
5425
5515
  },
5426
5516
 
5427
- handleObject: function handleObject(value) {
5428
- this.cleanup(value);
5429
- this.prevKeys = Object.keys(value);
5430
- setObjectClasses(this.el, value);
5431
- },
5432
-
5433
- handleArray: function handleArray(value) {
5517
+ setClass: function setClass(value) {
5434
5518
  this.cleanup(value);
5435
5519
  for (var i = 0, l = value.length; i < l; i++) {
5436
5520
  var val = value[i];
5437
- if (val && isPlainObject(val)) {
5438
- setObjectClasses(this.el, val);
5439
- } else if (val && typeof val === 'string') {
5440
- addClass(this.el, val);
5521
+ if (val) {
5522
+ apply(this.el, val, addClass);
5441
5523
  }
5442
5524
  }
5443
- this.prevKeys = value.slice();
5525
+ this.prevKeys = value;
5444
5526
  },
5445
5527
 
5446
5528
  cleanup: function cleanup(value) {
5447
- if (!this.prevKeys) return;
5448
-
5449
- var i = this.prevKeys.length;
5529
+ var prevKeys = this.prevKeys;
5530
+ if (!prevKeys) return;
5531
+ var i = prevKeys.length;
5450
5532
  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);
5533
+ var key = prevKeys[i];
5534
+ if (!value || value.indexOf(key) < 0) {
5535
+ apply(this.el, key, removeClass);
5457
5536
  }
5458
5537
  }
5459
5538
  }
5460
5539
  };
5461
5540
 
5462
- function setObjectClasses(el, obj) {
5463
- var keys = Object.keys(obj);
5464
- for (var i = 0, l = keys.length; i < l; i++) {
5465
- var key = keys[i];
5466
- if (!obj[key]) continue;
5467
- toggleClasses(el, key, addClass);
5468
- }
5469
- }
5541
+ /**
5542
+ * Normalize objects and arrays (potentially containing objects)
5543
+ * into array of strings.
5544
+ *
5545
+ * @param {Object|Array<String|Object>} value
5546
+ * @return {Array<String>}
5547
+ */
5470
5548
 
5471
- function stringToObject(value) {
5472
- var res = {};
5473
- var keys = value.trim().split(/\s+/);
5474
- for (var i = 0, l = keys.length; i < l; i++) {
5475
- res[keys[i]] = true;
5549
+ function normalize$1(value) {
5550
+ var res = [];
5551
+ if (isArray(value)) {
5552
+ for (var i = 0, l = value.length; i < l; i++) {
5553
+ var _key = value[i];
5554
+ if (_key) {
5555
+ if (typeof _key === 'string') {
5556
+ res.push(_key);
5557
+ } else {
5558
+ for (var k in _key) {
5559
+ if (_key[k]) res.push(k);
5560
+ }
5561
+ }
5562
+ }
5563
+ }
5564
+ } else if (isObject(value)) {
5565
+ for (var key in value) {
5566
+ if (value[key]) res.push(key);
5567
+ }
5476
5568
  }
5477
5569
  return res;
5478
5570
  }
@@ -5488,14 +5580,12 @@ var template = Object.freeze({
5488
5580
  * @param {Function} fn
5489
5581
  */
5490
5582
 
5491
- function toggleClasses(el, key, fn) {
5583
+ function apply(el, key, fn) {
5492
5584
  key = key.trim();
5493
-
5494
5585
  if (key.indexOf(' ') === -1) {
5495
5586
  fn(el, key);
5496
5587
  return;
5497
5588
  }
5498
-
5499
5589
  // The key contains one or more space characters.
5500
5590
  // Since a class name doesn't accept such characters, we
5501
5591
  // treat it as multiple classes.
@@ -5546,6 +5636,7 @@ var template = Object.freeze({
5546
5636
  // cached, when the component is used elsewhere this attribute
5547
5637
  // will remain at link time.
5548
5638
  this.el.removeAttribute('is');
5639
+ this.el.removeAttribute(':is');
5549
5640
  // remove ref, same as above
5550
5641
  if (this.descriptor.ref) {
5551
5642
  this.el.removeAttribute('v-ref:' + hyphenate(this.descriptor.ref));
@@ -5980,6 +6071,7 @@ var template = Object.freeze({
5980
6071
  return function propsLinkFn(vm, scope) {
5981
6072
  // store resolved props info
5982
6073
  vm._props = {};
6074
+ var inlineProps = vm.$options.propsData;
5983
6075
  var i = props.length;
5984
6076
  var prop, path, options, value, raw;
5985
6077
  while (i--) {
@@ -5988,7 +6080,9 @@ var template = Object.freeze({
5988
6080
  path = prop.path;
5989
6081
  options = prop.options;
5990
6082
  vm._props[path] = prop;
5991
- if (raw === null) {
6083
+ if (inlineProps && hasOwn(inlineProps, path)) {
6084
+ initProp(vm, prop, inlineProps[path]);
6085
+ }if (raw === null) {
5992
6086
  // initialize absent prop
5993
6087
  initProp(vm, prop, undefined);
5994
6088
  } else if (prop.dynamic) {
@@ -6749,7 +6843,7 @@ var template = Object.freeze({
6749
6843
  // link function for the node itself.
6750
6844
  var nodeLinkFn = partial || !options._asComponent ? compileNode(el, options) : null;
6751
6845
  // link function for the childNodes
6752
- var childLinkFn = !(nodeLinkFn && nodeLinkFn.terminal) && el.tagName !== 'SCRIPT' && el.hasChildNodes() ? compileNodeList(el.childNodes, options) : null;
6846
+ var childLinkFn = !(nodeLinkFn && nodeLinkFn.terminal) && !isScript(el) && el.hasChildNodes() ? compileNodeList(el.childNodes, options) : null;
6753
6847
 
6754
6848
  /**
6755
6849
  * A composite linker function to be called on a already
@@ -6925,7 +7019,7 @@ var template = Object.freeze({
6925
7019
  });
6926
7020
  if (names.length) {
6927
7021
  var plural = names.length > 1;
6928
- warn('Attribute' + (plural ? 's ' : ' ') + names.join(', ') + (plural ? ' are' : ' is') + ' ignored on component ' + '<' + options.el.tagName.toLowerCase() + '> because ' + 'the component is a fragment instance: ' + 'http://vuejs.org/guide/components.html#Fragment_Instance');
7022
+ warn('Attribute' + (plural ? 's ' : ' ') + names.join(', ') + (plural ? ' are' : ' is') + ' ignored on component ' + '<' + options.el.tagName.toLowerCase() + '> because ' + 'the component is a fragment instance: ' + 'http://vuejs.org/guide/components.html#Fragment-Instance');
6929
7023
  }
6930
7024
  }
6931
7025
 
@@ -6962,7 +7056,7 @@ var template = Object.freeze({
6962
7056
 
6963
7057
  function compileNode(node, options) {
6964
7058
  var type = node.nodeType;
6965
- if (type === 1 && node.tagName !== 'SCRIPT') {
7059
+ if (type === 1 && !isScript(node)) {
6966
7060
  return compileElement(node, options);
6967
7061
  } else if (type === 3 && node.data.trim()) {
6968
7062
  return compileTextNode(node, options);
@@ -7257,7 +7351,6 @@ var template = Object.freeze({
7257
7351
  var attr, name, value, modifiers, matched, dirName, rawName, arg, def, termDef;
7258
7352
  for (var i = 0, j = attrs.length; i < j; i++) {
7259
7353
  attr = attrs[i];
7260
- modifiers = parseModifiers(attr.name);
7261
7354
  name = attr.name.replace(modifierRE, '');
7262
7355
  if (matched = name.match(dirAttrRE)) {
7263
7356
  def = resolveAsset(options, 'directives', matched[1]);
@@ -7265,6 +7358,7 @@ var template = Object.freeze({
7265
7358
  if (!termDef || (def.priority || DEFAULT_TERMINAL_PRIORITY) > termDef.priority) {
7266
7359
  termDef = def;
7267
7360
  rawName = attr.name;
7361
+ modifiers = parseModifiers(attr.name);
7268
7362
  value = attr.value;
7269
7363
  dirName = matched[1];
7270
7364
  arg = matched[2];
@@ -7485,6 +7579,10 @@ var template = Object.freeze({
7485
7579
  }
7486
7580
  }
7487
7581
 
7582
+ function isScript(el) {
7583
+ return el.tagName === 'SCRIPT' && (!el.hasAttribute('type') || el.getAttribute('type') === 'text/javascript');
7584
+ }
7585
+
7488
7586
  var specialCharRE = /[^\w\-:\.]/;
7489
7587
 
7490
7588
  /**
@@ -7614,8 +7712,8 @@ var template = Object.freeze({
7614
7712
  value = attrs[i].value;
7615
7713
  if (!to.hasAttribute(name) && !specialCharRE.test(name)) {
7616
7714
  to.setAttribute(name, value);
7617
- } else if (name === 'class' && !parseText(value)) {
7618
- value.trim().split(/\s+/).forEach(function (cls) {
7715
+ } else if (name === 'class' && !parseText(value) && (value = value.trim())) {
7716
+ value.split(/\s+/).forEach(function (cls) {
7619
7717
  addClass(to, cls);
7620
7718
  });
7621
7719
  }
@@ -7654,6 +7752,10 @@ var template = Object.freeze({
7654
7752
  contents[name] = extractFragment(contents[name], content);
7655
7753
  }
7656
7754
  if (content.hasChildNodes()) {
7755
+ var nodes = content.childNodes;
7756
+ if (nodes.length === 1 && nodes[0].nodeType === 3 && !nodes[0].data.trim()) {
7757
+ return;
7758
+ }
7657
7759
  contents['default'] = extractFragment(content.childNodes, content);
7658
7760
  }
7659
7761
  }
@@ -7672,7 +7774,7 @@ var template = Object.freeze({
7672
7774
  var node = nodes[i];
7673
7775
  if (isTemplate(node) && !node.hasAttribute('v-if') && !node.hasAttribute('v-for')) {
7674
7776
  parent.removeChild(node);
7675
- node = parseTemplate(node);
7777
+ node = parseTemplate(node, true);
7676
7778
  }
7677
7779
  frag.appendChild(node);
7678
7780
  }
@@ -7753,7 +7855,6 @@ var template = Object.freeze({
7753
7855
  'development' !== 'production' && warn('data functions should return an object.', this);
7754
7856
  }
7755
7857
  var props = this._props;
7756
- var runtimeData = this._runtimeData ? typeof this._runtimeData === 'function' ? this._runtimeData() : this._runtimeData : null;
7757
7858
  // proxy data on instance
7758
7859
  var keys = Object.keys(data);
7759
7860
  var i, key;
@@ -7764,10 +7865,10 @@ var template = Object.freeze({
7764
7865
  // 1. it's not already defined as a prop
7765
7866
  // 2. it's provided via a instantiation option AND there are no
7766
7867
  // template prop present
7767
- if (!props || !hasOwn(props, key) || runtimeData && hasOwn(runtimeData, key) && props[key].raw === null) {
7868
+ if (!props || !hasOwn(props, key)) {
7768
7869
  this._proxy(key);
7769
7870
  } else if ('development' !== 'production') {
7770
- warn('Data field "' + key + '" is already defined ' + 'as a prop. Use prop default value instead.', this);
7871
+ warn('Data field "' + key + '" is already defined ' + 'as a prop. To provide default value for a prop, use the "default" ' + 'prop option; if you want to pass prop values to an instantiation ' + 'call, use the "propsData" option.', this);
7771
7872
  }
7772
7873
  }
7773
7874
  // observe data
@@ -7957,18 +8058,21 @@ var template = Object.freeze({
7957
8058
 
7958
8059
  function registerComponentEvents(vm, el) {
7959
8060
  var attrs = el.attributes;
7960
- var name, handler;
8061
+ var name, value, handler;
7961
8062
  for (var i = 0, l = attrs.length; i < l; i++) {
7962
8063
  name = attrs[i].name;
7963
8064
  if (eventRE.test(name)) {
7964
8065
  name = name.replace(eventRE, '');
7965
- handler = (vm._scope || vm._context).$eval(attrs[i].value, true);
7966
- if (typeof handler === 'function') {
7967
- handler._fromParent = true;
7968
- vm.$on(name.replace(eventRE), handler);
7969
- } else if ('development' !== 'production') {
7970
- warn('v-on:' + name + '="' + attrs[i].value + '" ' + 'expects a function value, got ' + handler, vm);
8066
+ // force the expression into a statement so that
8067
+ // it always dynamically resolves the method to call (#2670)
8068
+ // kinda ugly hack, but does the job.
8069
+ value = attrs[i].value;
8070
+ if (isSimplePath(value)) {
8071
+ value += '.apply(this, $arguments)';
7971
8072
  }
8073
+ handler = (vm._scope || vm._context).$eval(value, true);
8074
+ handler._fromParent = true;
8075
+ vm.$on(name.replace(eventRE), handler);
7972
8076
  }
7973
8077
  }
7974
8078
  }
@@ -8619,7 +8723,7 @@ var template = Object.freeze({
8619
8723
  }
8620
8724
  // remove reference from data ob
8621
8725
  // frozen object may not have observer.
8622
- if (this._data.__ob__) {
8726
+ if (this._data && this._data.__ob__) {
8623
8727
  this._data.__ob__.removeVm(this);
8624
8728
  }
8625
8729
  // Clean up references to private properties and other
@@ -8692,6 +8796,7 @@ var template = Object.freeze({
8692
8796
  } else {
8693
8797
  factory = resolveAsset(this.$options, 'components', value, true);
8694
8798
  }
8799
+ /* istanbul ignore if */
8695
8800
  if (!factory) {
8696
8801
  return;
8697
8802
  }
@@ -8741,7 +8846,7 @@ var template = Object.freeze({
8741
8846
  Vue.prototype.$get = function (exp, asStatement) {
8742
8847
  var res = parseExpression(exp);
8743
8848
  if (res) {
8744
- if (asStatement && !isSimplePath(exp)) {
8849
+ if (asStatement) {
8745
8850
  var self = this;
8746
8851
  return function statementHandler() {
8747
8852
  self.$arguments = toArray(arguments);
@@ -9673,17 +9778,19 @@ var template = Object.freeze({
9673
9778
  * 12345 => $12,345.00
9674
9779
  *
9675
9780
  * @param {String} sign
9781
+ * @param {Number} decimals Decimal places
9676
9782
  */
9677
9783
 
9678
- currency: function currency(value, _currency) {
9784
+ currency: function currency(value, _currency, decimals) {
9679
9785
  value = parseFloat(value);
9680
9786
  if (!isFinite(value) || !value && value !== 0) return '';
9681
9787
  _currency = _currency != null ? _currency : '$';
9682
- var stringified = Math.abs(value).toFixed(2);
9683
- var _int = stringified.slice(0, -3);
9788
+ decimals = decimals != null ? decimals : 2;
9789
+ var stringified = Math.abs(value).toFixed(decimals);
9790
+ var _int = decimals ? stringified.slice(0, -1 - decimals) : stringified;
9684
9791
  var i = _int.length % 3;
9685
9792
  var head = i > 0 ? _int.slice(0, i) + (_int.length > 3 ? ',' : '') : '';
9686
- var _float = stringified.slice(-3);
9793
+ var _float = decimals ? stringified.slice(-1 - decimals) : '';
9687
9794
  var sign = value < 0 ? '-' : '';
9688
9795
  return sign + _currency + head + _int.slice(i).replace(digitsRE, '$1,') + _float;
9689
9796
  },
@@ -9903,7 +10010,7 @@ var template = Object.freeze({
9903
10010
 
9904
10011
  installGlobalAPI(Vue);
9905
10012
 
9906
- Vue.version = '1.0.21';
10013
+ Vue.version = '1.0.24';
9907
10014
 
9908
10015
  // devtools global hook
9909
10016
  /* istanbul ignore next */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vuejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.21
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Butler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple asset-pipeline wrapper for vue.js by Evan You
14
14
  email:
@@ -48,9 +48,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project: vuejs-rails
51
- rubygems_version: 2.2.2
51
+ rubygems_version: 2.4.5.1
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: vue.js asset pipeline provider/wrapper
55
55
  test_files: []
56
- has_rdoc: