vuejs 1.0.20 → 1.0.21

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 102d3087a91ffb15dba385f2312742a48b90556b
4
- data.tar.gz: 5129db28c66a55caf135ef4e6fd2c164f8fffc07
3
+ metadata.gz: d31786cb8bffc4b3f5d2f550c97c0ed48e5e792e
4
+ data.tar.gz: 2c3b7d907290bd32768405370b7b523ebf14814b
5
5
  SHA512:
6
- metadata.gz: 9959cd6a8cb7366c1df8e60f6c78ae8f3e8f70f3e6d069af47063067533d8e1885570a633e8715af7c71529cc93e4b267c729f2dee1631a436def1997df1e413
7
- data.tar.gz: c6a887d1c5f7bf9ca79b91ca928a36a44c22c2245d3e486616753b54dcb3b8588c2e94ecd3d402d5fc4564005e88bfb37680470f18aa3d607a390bd4bdf97417
6
+ metadata.gz: 768437ac5e4c6a1df970c1781cd0efdd8498c39a564c40146c3f81135d9cef1e10e0fb71c999983a092ae049b1da8c4d75d310511f57e043f7b359901c292c4f
7
+ data.tar.gz: 0bdd144fa560dbae978f55f882cff82438faef069b824f95300150ffe4bfb9d10c24c5f44a8d1dd0927c91ac3b98066816c0e3b9484c50410969dc47311f9577
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Bryan Lim
3
+ Copyright (c) 2016 Bryan Lim (@ytbryan)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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 (v0.7.11) + vue-router (v1.0.20) + vue-resource (0.7.0)
5
+ The current version is Vue.js (v1.0.20) + vue-router (v0.7.12) + 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.20"
2
+ VERSION = "1.0.21"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * vue-router v0.7.11
2
+ * vue-router v0.7.12
3
3
  * (c) 2016 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -125,6 +125,21 @@
125
125
 
126
126
  var escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
127
127
 
128
+ var noWarning = false;
129
+ function warn(msg) {
130
+ if (!noWarning && typeof console !== 'undefined') {
131
+ console.error('[vue-router] ' + msg);
132
+ }
133
+ }
134
+
135
+ function tryDecode(uri, asComponent) {
136
+ try {
137
+ return asComponent ? decodeURIComponent(uri) : decodeURI(uri);
138
+ } catch (e) {
139
+ warn('malformed URI' + (asComponent ? ' component: ' : ': ') + uri);
140
+ }
141
+ }
142
+
128
143
  function isArray(test) {
129
144
  return Object.prototype.toString.call(test) === "[object Array]";
130
145
  }
@@ -465,7 +480,7 @@
465
480
  function decodeQueryParamPart(part) {
466
481
  // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
467
482
  part = part.replace(/\+/gm, '%20');
468
- return decodeURIComponent(part);
483
+ return tryDecode(part, true);
469
484
  }
470
485
 
471
486
  // The main interface
@@ -647,7 +662,8 @@
647
662
  return queryParams;
648
663
  },
649
664
 
650
- recognize: function recognize(path) {
665
+ recognize: function recognize(path, silent) {
666
+ noWarning = silent;
651
667
  var states = [this.rootState],
652
668
  pathLen,
653
669
  i,
@@ -660,10 +676,13 @@
660
676
  if (queryStart !== -1) {
661
677
  var queryString = path.substr(queryStart + 1, path.length);
662
678
  path = path.substr(0, queryStart);
663
- queryParams = this.parseQueryString(queryString);
679
+ if (queryString) {
680
+ queryParams = this.parseQueryString(queryString);
681
+ }
664
682
  }
665
683
 
666
- path = decodeURI(path);
684
+ path = tryDecode(path);
685
+ if (!path) return;
667
686
 
668
687
  // DEBUG GROUP path
669
688
 
@@ -710,8 +729,6 @@
710
729
 
711
730
  RouteRecognizer.prototype.map = map;
712
731
 
713
- RouteRecognizer.VERSION = '0.1.9';
714
-
715
732
  var genQuery = RouteRecognizer.prototype.generateQueryString;
716
733
 
717
734
  // export default for holding the Vue reference
@@ -722,13 +739,10 @@
722
739
  * @param {String} msg
723
740
  */
724
741
 
725
- function warn(msg) {
742
+ function warn$1(msg) {
726
743
  /* istanbul ignore next */
727
- if (window.console) {
728
- console.warn('[vue-router] ' + msg);
729
- if (!exports$1.Vue || exports$1.Vue.config.debug) {
730
- console.warn(new Error('warning stack trace:').stack);
731
- }
744
+ if (typeof console !== 'undefined') {
745
+ console.error('[vue-router] ' + msg);
732
746
  }
733
747
  }
734
748
 
@@ -847,7 +861,7 @@
847
861
  var val = params[key];
848
862
  /* istanbul ignore if */
849
863
  if (!val) {
850
- warn('param "' + key + '" not found when generating ' + 'path for "' + path + '" with params ' + JSON.stringify(params));
864
+ warn$1('param "' + key + '" not found when generating ' + 'path for "' + path + '" with params ' + JSON.stringify(params));
851
865
  }
852
866
  return val || '';
853
867
  });
@@ -865,7 +879,7 @@
865
879
  var onChange = _ref.onChange;
866
880
  babelHelpers.classCallCheck(this, HTML5History);
867
881
 
868
- if (root) {
882
+ if (root && root !== '/') {
869
883
  // make sure there's the starting slash
870
884
  if (root.charAt(0) !== '/') {
871
885
  root = '/' + root;
@@ -886,7 +900,7 @@
886
900
  var _this = this;
887
901
 
888
902
  this.listener = function (e) {
889
- var url = decodeURI(location.pathname + location.search);
903
+ var url = location.pathname + location.search;
890
904
  if (_this.root) {
891
905
  url = url.replace(_this.rootRE, '');
892
906
  }
@@ -962,7 +976,7 @@
962
976
  // note it's possible to have queries in both the actual URL
963
977
  // and the hash fragment itself.
964
978
  var query = location.search && path.indexOf('?') > -1 ? '&' + location.search.slice(1) : location.search;
965
- self.onChange(decodeURI(path.replace(/^#!?/, '') + query));
979
+ self.onChange(path.replace(/^#!?/, '') + query);
966
980
  };
967
981
  window.addEventListener('hashchange', this.listener);
968
982
  this.listener();
@@ -1535,7 +1549,7 @@
1535
1549
  var onError = function onError(err) {
1536
1550
  postActivate ? next() : abort();
1537
1551
  if (err && !transition.router._suppress) {
1538
- warn('Uncaught error during transition: ');
1552
+ warn$1('Uncaught error during transition: ');
1539
1553
  throw err instanceof Error ? err : new Error(err);
1540
1554
  }
1541
1555
  };
@@ -1555,7 +1569,7 @@
1555
1569
  // advance the transition to the next step
1556
1570
  var next = function next() {
1557
1571
  if (nextCalled) {
1558
- warn('transition.next() should be called only once.');
1572
+ warn$1('transition.next() should be called only once.');
1559
1573
  return;
1560
1574
  }
1561
1575
  nextCalled = true;
@@ -1665,7 +1679,7 @@
1665
1679
  return val ? Array.prototype.slice.call(val) : [];
1666
1680
  }
1667
1681
 
1668
- var internalKeysRE = /^(component|subRoutes)$/;
1682
+ var internalKeysRE = /^(component|subRoutes|fullPath)$/;
1669
1683
 
1670
1684
  /**
1671
1685
  * Route Context Object
@@ -1702,9 +1716,13 @@
1702
1716
  }
1703
1717
  // expose path and router
1704
1718
  this.path = path;
1705
- this.router = router;
1706
1719
  // for internal use
1707
1720
  this.matched = matched || router._notFoundHandler;
1721
+ // internal reference to router
1722
+ Object.defineProperty(this, 'router', {
1723
+ enumerable: false,
1724
+ value: router
1725
+ });
1708
1726
  // Important: freeze self to prevent observation
1709
1727
  Object.freeze(this);
1710
1728
  };
@@ -1792,7 +1810,7 @@
1792
1810
  var route = this.vm.$route;
1793
1811
  /* istanbul ignore if */
1794
1812
  if (!route) {
1795
- warn('<router-view> can only be used inside a ' + 'router-enabled app.');
1813
+ warn$1('<router-view> can only be used inside a ' + 'router-enabled app.');
1796
1814
  return;
1797
1815
  }
1798
1816
  // force dynamic directive so v-component doesn't
@@ -1857,39 +1875,62 @@
1857
1875
  function Link (Vue) {
1858
1876
  var _Vue$util = Vue.util;
1859
1877
  var _bind = _Vue$util.bind;
1878
+ var getAttr = _Vue$util.getAttr;
1860
1879
  var isObject = _Vue$util.isObject;
1861
1880
  var addClass = _Vue$util.addClass;
1862
1881
  var removeClass = _Vue$util.removeClass;
1863
1882
 
1883
+ var onPriority = Vue.directive('on').priority;
1884
+ var LINK_UPDATE = '__vue-router-link-update__';
1885
+
1886
+ var activeId = 0;
1887
+
1864
1888
  Vue.directive('link-active', {
1865
- priority: 1001,
1889
+ priority: 9999,
1866
1890
  bind: function bind() {
1867
- this.el.__v_link_active = true;
1891
+ var _this = this;
1892
+
1893
+ var id = String(activeId++);
1894
+ // collect v-links contained within this element.
1895
+ // we need do this here before the parent-child relationship
1896
+ // gets messed up by terminal directives (if, for, components)
1897
+ var childLinks = this.el.querySelectorAll('[v-link]');
1898
+ for (var i = 0, l = childLinks.length; i < l; i++) {
1899
+ var link = childLinks[i];
1900
+ var existingId = link.getAttribute(LINK_UPDATE);
1901
+ var value = existingId ? existingId + ',' + id : id;
1902
+ // leave a mark on the link element which can be persisted
1903
+ // through fragment clones.
1904
+ link.setAttribute(LINK_UPDATE, value);
1905
+ }
1906
+ this.vm.$on(LINK_UPDATE, this.cb = function (link, path) {
1907
+ if (link.activeIds.indexOf(id) > -1) {
1908
+ link.updateClasses(path, _this.el);
1909
+ }
1910
+ });
1911
+ },
1912
+ unbind: function unbind() {
1913
+ this.vm.$off(LINK_UPDATE, this.cb);
1868
1914
  }
1869
1915
  });
1870
1916
 
1871
1917
  Vue.directive('link', {
1872
- priority: 1000,
1918
+ priority: onPriority - 2,
1873
1919
 
1874
1920
  bind: function bind() {
1875
1921
  var vm = this.vm;
1876
1922
  /* istanbul ignore if */
1877
1923
  if (!vm.$route) {
1878
- warn('v-link can only be used inside a router-enabled app.');
1924
+ warn$1('v-link can only be used inside a router-enabled app.');
1879
1925
  return;
1880
1926
  }
1881
1927
  this.router = vm.$route.router;
1882
1928
  // update things when the route changes
1883
1929
  this.unwatch = vm.$watch('$route', _bind(this.onRouteUpdate, this));
1884
- // check if active classes should be applied to a different element
1885
- this.activeEl = this.el;
1886
- var parent = this.el.parentNode;
1887
- while (parent) {
1888
- if (parent.__v_link_active) {
1889
- this.activeEl = parent;
1890
- break;
1891
- }
1892
- parent = parent.parentNode;
1930
+ // check v-link-active ids
1931
+ var activeIds = getAttr(this.el, LINK_UPDATE);
1932
+ if (activeIds) {
1933
+ this.activeIds = activeIds.split(',');
1893
1934
  }
1894
1935
  // no need to handle click if link expects to be opened
1895
1936
  // in a new window/tab.
@@ -1937,8 +1978,12 @@
1937
1978
  }
1938
1979
  if (el.tagName === 'A' && sameOrigin(el)) {
1939
1980
  e.preventDefault();
1981
+ var path = el.pathname;
1982
+ if (this.router.history.root) {
1983
+ path = path.replace(this.router.history.rootRE, '');
1984
+ }
1940
1985
  this.router.go({
1941
- path: el.pathname,
1986
+ path: path,
1942
1987
  replace: target && target.replace,
1943
1988
  append: target && target.append
1944
1989
  });
@@ -1947,15 +1992,19 @@
1947
1992
  },
1948
1993
 
1949
1994
  onRouteUpdate: function onRouteUpdate(route) {
1950
- // router._stringifyPath is dependent on current route
1995
+ // router.stringifyPath is dependent on current route
1951
1996
  // and needs to be called again whenver route changes.
1952
- var newPath = this.router._stringifyPath(this.target);
1997
+ var newPath = this.router.stringifyPath(this.target);
1953
1998
  if (this.path !== newPath) {
1954
1999
  this.path = newPath;
1955
2000
  this.updateActiveMatch();
1956
2001
  this.updateHref();
1957
2002
  }
1958
- this.updateClasses(route.path);
2003
+ if (this.activeIds) {
2004
+ this.vm.$emit(LINK_UPDATE, this, route.path);
2005
+ } else {
2006
+ this.updateClasses(route.path, this.el);
2007
+ }
1959
2008
  },
1960
2009
 
1961
2010
  updateActiveMatch: function updateActiveMatch() {
@@ -1978,12 +2027,11 @@
1978
2027
  }
1979
2028
  },
1980
2029
 
1981
- updateClasses: function updateClasses(path) {
1982
- var el = this.activeEl;
2030
+ updateClasses: function updateClasses(path, el) {
1983
2031
  var activeClass = this.activeClass || this.router._linkActiveClass;
1984
2032
  // clear old class
1985
- if (this.prevActiveClass !== activeClass) {
1986
- removeClass(el, this.prevActiveClass);
2033
+ if (this.prevActiveClass && this.prevActiveClass !== activeClass) {
2034
+ toggleClasses(el, this.prevActiveClass, removeClass);
1987
2035
  }
1988
2036
  // remove query string before matching
1989
2037
  var dest = this.path.replace(queryStringRE, '');
@@ -1993,15 +2041,15 @@
1993
2041
  if (dest === path ||
1994
2042
  // also allow additional trailing slash
1995
2043
  dest.charAt(dest.length - 1) !== '/' && dest === path.replace(trailingSlashRE, '')) {
1996
- addClass(el, activeClass);
2044
+ toggleClasses(el, activeClass, addClass);
1997
2045
  } else {
1998
- removeClass(el, activeClass);
2046
+ toggleClasses(el, activeClass, removeClass);
1999
2047
  }
2000
2048
  } else {
2001
2049
  if (this.activeRE && this.activeRE.test(path)) {
2002
- addClass(el, activeClass);
2050
+ toggleClasses(el, activeClass, addClass);
2003
2051
  } else {
2004
- removeClass(el, activeClass);
2052
+ toggleClasses(el, activeClass, removeClass);
2005
2053
  }
2006
2054
  }
2007
2055
  },
@@ -2015,6 +2063,20 @@
2015
2063
  function sameOrigin(link) {
2016
2064
  return link.protocol === location.protocol && link.hostname === location.hostname && link.port === location.port;
2017
2065
  }
2066
+
2067
+ // this function is copied from v-bind:class implementation until
2068
+ // we properly expose it...
2069
+ function toggleClasses(el, key, fn) {
2070
+ key = key.trim();
2071
+ if (key.indexOf(' ') === -1) {
2072
+ fn(el, key);
2073
+ return;
2074
+ }
2075
+ var keys = key.split(/\s+/);
2076
+ for (var i = 0, l = keys.length; i < l; i++) {
2077
+ fn(el, keys[i]);
2078
+ }
2079
+ }
2018
2080
  }
2019
2081
 
2020
2082
  var historyBackends = {
@@ -2223,7 +2285,7 @@
2223
2285
  replace = path.replace;
2224
2286
  append = path.append;
2225
2287
  }
2226
- path = this._stringifyPath(path);
2288
+ path = this.stringifyPath(path);
2227
2289
  if (path) {
2228
2290
  this.history.go(path, replace, append);
2229
2291
  }
@@ -2254,7 +2316,7 @@
2254
2316
  Router.prototype.start = function start(App, container, cb) {
2255
2317
  /* istanbul ignore if */
2256
2318
  if (this._started) {
2257
- warn('already started.');
2319
+ warn$1('already started.');
2258
2320
  return;
2259
2321
  }
2260
2322
  this._started = true;
@@ -2298,6 +2360,41 @@
2298
2360
  this._started = false;
2299
2361
  };
2300
2362
 
2363
+ /**
2364
+ * Normalize named route object / string paths into
2365
+ * a string.
2366
+ *
2367
+ * @param {Object|String|Number} path
2368
+ * @return {String}
2369
+ */
2370
+
2371
+ Router.prototype.stringifyPath = function stringifyPath(path) {
2372
+ var generatedPath = '';
2373
+ if (path && typeof path === 'object') {
2374
+ if (path.name) {
2375
+ var extend = Vue.util.extend;
2376
+ var currentParams = this._currentTransition && this._currentTransition.to.params;
2377
+ var targetParams = path.params || {};
2378
+ var params = currentParams ? extend(extend({}, currentParams), targetParams) : targetParams;
2379
+ generatedPath = encodeURI(this._recognizer.generate(path.name, params));
2380
+ } else if (path.path) {
2381
+ generatedPath = encodeURI(path.path);
2382
+ }
2383
+ if (path.query) {
2384
+ // note: the generated query string is pre-URL-encoded by the recognizer
2385
+ var query = this._recognizer.generateQueryString(path.query);
2386
+ if (generatedPath.indexOf('?') > -1) {
2387
+ generatedPath += '&' + query.slice(1);
2388
+ } else {
2389
+ generatedPath += query;
2390
+ }
2391
+ }
2392
+ } else {
2393
+ generatedPath = encodeURI(path ? path + '' : '');
2394
+ }
2395
+ return generatedPath;
2396
+ };
2397
+
2301
2398
  // Internal methods ======================================
2302
2399
 
2303
2400
  /**
@@ -2400,7 +2497,7 @@
2400
2497
  */
2401
2498
 
2402
2499
  Router.prototype._checkGuard = function _checkGuard(path) {
2403
- var matched = this._guardRecognizer.recognize(path);
2500
+ var matched = this._guardRecognizer.recognize(path, true);
2404
2501
  if (matched) {
2405
2502
  matched[0].handler(matched[0], matched.queryParams);
2406
2503
  return true;
@@ -2563,43 +2660,6 @@
2563
2660
  }
2564
2661
  };
2565
2662
 
2566
- /**
2567
- * Normalize named route object / string paths into
2568
- * a string.
2569
- *
2570
- * @param {Object|String|Number} path
2571
- * @return {String}
2572
- */
2573
-
2574
- Router.prototype._stringifyPath = function _stringifyPath(path) {
2575
- var fullPath = '';
2576
- if (path && typeof path === 'object') {
2577
- if (path.name) {
2578
- var extend = Vue.util.extend;
2579
- var currentParams = this._currentTransition && this._currentTransition.to.params;
2580
- var targetParams = path.params || {};
2581
- var params = currentParams ? extend(extend({}, currentParams), targetParams) : targetParams;
2582
- if (path.query) {
2583
- params.queryParams = path.query;
2584
- }
2585
- fullPath = this._recognizer.generate(path.name, params);
2586
- } else if (path.path) {
2587
- fullPath = path.path;
2588
- if (path.query) {
2589
- var query = this._recognizer.generateQueryString(path.query);
2590
- if (fullPath.indexOf('?') > -1) {
2591
- fullPath += '&' + query.slice(1);
2592
- } else {
2593
- fullPath += query;
2594
- }
2595
- }
2596
- }
2597
- } else {
2598
- fullPath = path ? path + '' : '';
2599
- }
2600
- return encodeURI(fullPath);
2601
- };
2602
-
2603
2663
  return Router;
2604
2664
  })();
2605
2665
 
@@ -2611,7 +2671,7 @@
2611
2671
  /* istanbul ignore if */
2612
2672
  if (typeof comp !== 'function') {
2613
2673
  handler.component = null;
2614
- warn('invalid component for route "' + path + '".');
2674
+ warn$1('invalid component for route "' + path + '".');
2615
2675
  }
2616
2676
  }
2617
2677
 
@@ -2627,7 +2687,7 @@
2627
2687
  Router.install = function (externalVue) {
2628
2688
  /* istanbul ignore if */
2629
2689
  if (Router.installed) {
2630
- warn('already installed.');
2690
+ warn$1('already installed.');
2631
2691
  return;
2632
2692
  }
2633
2693
  Vue = externalVue;
@@ -2646,4 +2706,4 @@
2646
2706
 
2647
2707
  return Router;
2648
2708
 
2649
- }));
2709
+ }));
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.20
4
+ version: 1.0.21
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-03-27 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler