vuejs-rails 2.3.2 → 2.4.2

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: 869cf26b6079bbf39d417889c604e1522950bc46
4
- data.tar.gz: c31c58f1e95cfe35f632b11c7f696ec352063702
3
+ metadata.gz: 00fe95643d70351b7ba2185baa2ea97019e2c833
4
+ data.tar.gz: f6e21b32f50bddcc02e21a50cff51ce1596266b5
5
5
  SHA512:
6
- metadata.gz: e014ef47475c5c5b37a9d5bb071cd5484f6c05ca71386add02ffbbeae695806bafd908a371bd30a36dd34c536ab906e12ec5488edc9d3cdce39c2195f7b15134
7
- data.tar.gz: d24371fcf29b98392b191b75927493dfb2386490fc4847bd2042f781eff7830cd274e324ff6b746b1c0a728d8bb4558c25e94c4645180bc46799caa481423f03
6
+ metadata.gz: e5fc8bd72431edc865996acb59036fbf45ca6c61b4c3370bcc9877e238e023a1501fe0ca7abbd428908289317906d3c1502a83145ef79b2a06b5f2620571ab08
7
+ data.tar.gz: 6054e461fc87a5cae3992f555da26b96cda2b6711b5a0eacbe240d976d91107cf356d42f0b3989eae4090d130215aa7c82b660f087c524d1c08c5c8b25157a41
data/Readme.md CHANGED
@@ -9,9 +9,9 @@ Rails 3.1+ asset-pipeline gem to provide Vue.js
9
9
 
10
10
  ### Package Versions
11
11
 
12
- - vue v2.3.2
13
- - vue-router v2.5.2
14
- - vue-resource v1.3.1
12
+ - vue v2.4.2
13
+ - vue-router v2.7.0
14
+ - vue-resource v1.3.4
15
15
  - vuex v2.3.0
16
16
 
17
17
  ### Setup
@@ -2,9 +2,9 @@ require "vuejs-rails/version"
2
2
 
3
3
  module Vue
4
4
  mattr_accessor :development_mode
5
+ self.development_mode = defined?(::Rails) && ::Rails.env.development?
5
6
 
6
7
  class << self
7
- development_mode = defined?(::Rails) && ::Rails.env.development?
8
8
  def full_or_minified(asset_name)
9
9
  development_mode ? "dist/#{asset_name}.js": "dist/#{asset_name}.min.js"
10
10
  end
@@ -1,5 +1,5 @@
1
1
  module Vue
2
2
  module Rails
3
- VERSION = '2.3.2'
3
+ VERSION = '2.4.2'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * vue-resource v1.3.1
2
+ * vue-resource v1.3.4
3
3
  * https://github.com/pagekit/vue-resource
4
4
  * Released under the MIT License.
5
5
  */
@@ -304,6 +304,19 @@ function trim(str) {
304
304
  return str ? str.replace(/^\s*|\s*$/g, '') : '';
305
305
  }
306
306
 
307
+ function trimEnd(str, chars) {
308
+
309
+ if (str && chars === undefined) {
310
+ return str.replace(/\s+$/, '');
311
+ }
312
+
313
+ if (!str || !chars) {
314
+ return str;
315
+ }
316
+
317
+ return str.replace(new RegExp(("[" + chars + "]+$")), '');
318
+ }
319
+
307
320
  function toLower(str) {
308
321
  return str ? str.toLowerCase() : '';
309
322
  }
@@ -446,8 +459,8 @@ var root = function (options$$1, next) {
446
459
 
447
460
  var url = next(options$$1);
448
461
 
449
- if (isString(options$$1.root) && !url.match(/^(https?:)?\//)) {
450
- url = options$$1.root + '/' + url;
462
+ if (isString(options$$1.root) && !/^(https?:)?\//.test(url)) {
463
+ url = trimEnd(options$$1.root, '/') + '/' + url;
451
464
  }
452
465
 
453
466
  return url;
@@ -840,42 +853,41 @@ var cors = function (request, next) {
840
853
  };
841
854
 
842
855
  /**
843
- * Body Interceptor.
856
+ * Form data Interceptor.
844
857
  */
845
858
 
846
- var body = function (request, next) {
859
+ var form = function (request, next) {
847
860
 
848
861
  if (isFormData(request.body)) {
849
862
 
850
863
  request.headers.delete('Content-Type');
851
864
 
852
- } else if (isObject(request.body) || isArray(request.body)) {
865
+ } else if (isObject(request.body) && request.emulateJSON) {
853
866
 
854
- if (request.emulateJSON) {
855
- request.body = Url.params(request.body);
856
- request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
857
- } else {
858
- request.body = JSON.stringify(request.body);
859
- }
867
+ request.body = Url.params(request.body);
868
+ request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
860
869
  }
861
870
 
862
- next(function (response) {
871
+ next();
872
+ };
873
+
874
+ /**
875
+ * JSON Interceptor.
876
+ */
863
877
 
864
- Object.defineProperty(response, 'data', {
878
+ var json = function (request, next) {
865
879
 
866
- get: function get() {
867
- return this.body;
868
- },
880
+ var type = request.headers.get('Content-Type') || '';
869
881
 
870
- set: function set(body) {
871
- this.body = body;
872
- }
882
+ if (isObject(request.body) && type.indexOf('application/json') === 0) {
883
+ request.body = JSON.stringify(request.body);
884
+ }
873
885
 
874
- });
886
+ next(function (response) {
875
887
 
876
888
  return response.bodyText ? when(response.text(), function (text) {
877
889
 
878
- var type = response.headers.get('Content-Type') || '';
890
+ type = response.headers.get('Content-Type') || '';
879
891
 
880
892
  if (type.indexOf('application/json') === 0 || isJson(text)) {
881
893
 
@@ -1130,7 +1142,7 @@ var Client = function (context) {
1130
1142
  }
1131
1143
 
1132
1144
  function Client(request) {
1133
- return new PromiseObj(function (resolve) {
1145
+ return new PromiseObj(function (resolve, reject) {
1134
1146
 
1135
1147
  function exec() {
1136
1148
 
@@ -1155,10 +1167,10 @@ var Client = function (context) {
1155
1167
  resHandlers.forEach(function (handler) {
1156
1168
  response = when(response, function (response) {
1157
1169
  return handler.call(context, response) || response;
1158
- });
1170
+ }, reject);
1159
1171
  });
1160
1172
 
1161
- when(response, resolve);
1173
+ when(response, resolve, reject);
1162
1174
 
1163
1175
  return;
1164
1176
  }
@@ -1303,6 +1315,18 @@ Response.prototype.json = function json () {
1303
1315
  return when(this.text(), function (text) { return JSON.parse(text); });
1304
1316
  };
1305
1317
 
1318
+ Object.defineProperty(Response.prototype, 'data', {
1319
+
1320
+ get: function get() {
1321
+ return this.body;
1322
+ },
1323
+
1324
+ set: function set(body) {
1325
+ this.body = body;
1326
+ }
1327
+
1328
+ });
1329
+
1306
1330
  function blobText(body) {
1307
1331
  return new PromiseObj(function (resolve) {
1308
1332
 
@@ -1400,8 +1424,8 @@ Http.headers = {
1400
1424
  custom: {}
1401
1425
  };
1402
1426
 
1403
- Http.interceptor = {before: before, method: method, body: body, jsonp: jsonp, header: header, cors: cors};
1404
- Http.interceptors = ['before', 'method', 'body', 'jsonp', 'header', 'cors'];
1427
+ Http.interceptor = {before: before, method: method, jsonp: jsonp, json: json, form: form, header: header, cors: cors};
1428
+ Http.interceptors = ['before', 'method', 'jsonp', 'json', 'form', 'header', 'cors'];
1405
1429
 
1406
1430
  ['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
1407
1431
 
@@ -1413,8 +1437,8 @@ Http.interceptors = ['before', 'method', 'body', 'jsonp', 'header', 'cors'];
1413
1437
 
1414
1438
  ['post', 'put', 'patch'].forEach(function (method$$1) {
1415
1439
 
1416
- Http[method$$1] = function (url, body$$1, options$$1) {
1417
- return this(assign(options$$1 || {}, {url: url, method: method$$1, body: body$$1}));
1440
+ Http[method$$1] = function (url, body, options$$1) {
1441
+ return this(assign(options$$1 || {}, {url: url, method: method$$1, body: body}));
1418
1442
  };
1419
1443
 
1420
1444
  });
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * vue-resource v1.3.1
2
+ * vue-resource v1.3.4
3
3
  * https://github.com/pagekit/vue-resource
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function t(t){this.state=D,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}function e(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}function n(t){"undefined"!=typeof console&&z&&console.warn("[VueResource warn]: "+t)}function o(t){"undefined"!=typeof console&&console.error(t)}function r(t,e){return X(t,e)}function i(t){return t?t.replace(/^\s*|\s*$/g,""):""}function u(t){return t?t.toLowerCase():""}function s(t){return t?t.toUpperCase():""}function a(t){return"string"==typeof t}function c(t){return"function"==typeof t}function f(t){return null!==t&&"object"==typeof t}function p(t){return f(t)&&Object.getPrototypeOf(t)==Object.prototype}function h(t){return"undefined"!=typeof Blob&&t instanceof Blob}function d(t){return"undefined"!=typeof FormData&&t instanceof FormData}function l(t,n,o){var r=e.resolve(t);return arguments.length<2?r:r.then(n,o)}function m(t,e,n){return n=n||{},c(n)&&(n=n.call(e)),v(t.bind({$vm:e,$options:n}),t,{$options:n})}function y(t,e){var n,o;if(Y(t))for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(f(t))for(o in t)G.call(t,o)&&e.call(t[o],t[o],o);return t}function v(t){return _.call(arguments,1).forEach(function(e){w(t,e,!0)}),t}function b(t){return _.call(arguments,1).forEach(function(e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function g(t){return _.call(arguments,1).forEach(function(e){w(t,e)}),t}function w(t,e,n){for(var o in e)n&&(p(e[o])||Y(e[o]))?(p(e[o])&&!p(t[o])&&(t[o]={}),Y(e[o])&&!Y(t[o])&&(t[o]=[]),w(t[o],e[o],n)):void 0!==e[o]&&(t[o]=e[o])}function T(t,e,n){var o=x(t),r=o.expand(e);return n&&n.push.apply(n,o.vars),r}function x(t){var e=["+","#",".","/",";","?","&"],n=[];return{vars:n,expand:function(o){return t.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(t,r,i){if(r){var u=null,s=[];if(-1!==e.indexOf(r.charAt(0))&&(u=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(t){var e=/([^:\*]*)(?::(\d+)|(\*))?/.exec(t);s.push.apply(s,j(o,u,e[1],e[2]||e[3])),n.push(e[1])}),u&&"+"!==u){var a=",";return"?"===u?a="&":"#"!==u&&(a=u),(0!==s.length?u:"")+s.join(a)}return s.join(",")}return C(i)})}}}function j(t,e,n,o){var r=t[n],i=[];if(E(r)&&""!==r)if("string"==typeof r||"number"==typeof r||"boolean"==typeof r)r=r.toString(),o&&"*"!==o&&(r=r.substring(0,parseInt(o,10))),i.push(P(e,r,O(e)?n:null));else if("*"===o)Array.isArray(r)?r.filter(E).forEach(function(t){i.push(P(e,t,O(e)?n:null))}):Object.keys(r).forEach(function(t){E(r[t])&&i.push(P(e,r[t],t))});else{var u=[];Array.isArray(r)?r.filter(E).forEach(function(t){u.push(P(e,t))}):Object.keys(r).forEach(function(t){E(r[t])&&(u.push(encodeURIComponent(t)),u.push(P(e,r[t].toString())))}),O(e)?i.push(encodeURIComponent(n)+"="+u.join(",")):0!==u.length&&i.push(u.join(","))}else";"===e?i.push(encodeURIComponent(n)):""!==r||"&"!==e&&"?"!==e?""===r&&i.push(""):i.push(encodeURIComponent(n)+"=");return i}function E(t){return void 0!==t&&null!==t}function O(t){return";"===t||"&"===t||"?"===t}function P(t,e,n){return e="+"===t||"#"===t?C(e):encodeURIComponent(e),n?encodeURIComponent(n)+"="+e:e}function C(t){return t.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t)),t}).join("")}function $(t,e){var n,o=this||{},r=t;return a(t)&&(r={url:t,params:e}),r=v({},$.options,o.$options,r),$.transforms.forEach(function(t){a(t)&&(t=$.transform[t]),c(t)&&(n=U(t,n,o.$vm))}),n(r)}function U(t,e,n){return function(o){return t.call(n,o,e)}}function A(t,e,n){var o,r=Y(e),i=p(e);y(e,function(e,u){o=f(e)||Y(e),n&&(u=n+"["+(i||o?u:"")+"]"),!n&&r?t.add(e.name,e.value):o?A(t,e,u):t.add(u,e)})}function R(t){var e=t.match(/^\[|^\{(?!\{)/),n={"[":/]$/,"{":/}$/};return e&&n[e[0]].test(t)}function S(t,e){e((t.client||(K?ht:dt))(t))}function k(t,e){return Object.keys(t).reduce(function(t,n){return u(e)===u(n)?n:t},null)}function I(t){if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return i(t)}function q(t){return new e(function(e){var n=new FileReader;n.readAsText(t),n.onload=function(){e(n.result)}})}function H(t){return 0===t.type.indexOf("text")||-1!==t.type.indexOf("json")}function L(t){var n=this||{},r=lt(n.$vm);return b(t||{},n.$options,L.options),L.interceptors.forEach(function(t){a(t)&&(t=L.interceptor[t]),c(t)&&r.use(t)}),r(new vt(t)).then(function(t){return t.ok?t:e.reject(t)},function(t){return t instanceof Error&&o(t),e.reject(t)})}function B(t,e,n,o){var r=this||{},i={};return n=Z({},B.actions,n),y(n,function(n,u){n=v({url:t,params:Z({},e)},o,n),i[u]=function(){return(r.$http||L)(M(n,arguments))}}),i}function M(t,e){var n,o=Z({},t),r={};switch(e.length){case 2:r=e[0],n=e[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(o.method)?n=e[0]:r=e[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+e.length+" arguments"}return o.body=n,o.params=Z({},o.params,r),o}function N(t){N.installed||(Q(t),t.url=$,t.http=L,t.resource=B,t.Promise=e,Object.defineProperties(t.prototype,{$url:{get:function(){return m(t.url,this,this.$options.url)}},$http:{get:function(){return m(t.http,this,this.$options.http)}},$resource:{get:function(){return t.resource.bind(this)}},$promise:{get:function(){var e=this;return function(n){return new t.Promise(n,e)}}}}))}var D=2;t.reject=function(e){return new t(function(t,n){n(e)})},t.resolve=function(e){return new t(function(t,n){t(e)})},t.all=function(e){return new t(function(n,o){var r=0,i=[];0===e.length&&n(i);for(var u=0;u<e.length;u+=1)t.resolve(e[u]).then(function(t){return function(o){i[t]=o,(r+=1)===e.length&&n(i)}}(u),o)})},t.race=function(e){return new t(function(n,o){for(var r=0;r<e.length;r+=1)t.resolve(e[r]).then(n,o)})};var J=t.prototype;J.resolve=function(t){var e=this;if(e.state===D){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){n||e.resolve(t),n=!0},function(t){n||e.reject(t),n=!0})}catch(t){return void(n||e.reject(t))}e.state=0,e.value=t,e.notify()}},J.reject=function(t){var e=this;if(e.state===D){if(t===e)throw new TypeError("Promise settled with itself.");e.state=1,e.value=t,e.notify()}},J.notify=function(){var t=this;r(function(){if(t.state!==D)for(;t.deferred.length;){var e=t.deferred.shift(),n=e[0],o=e[1],r=e[2],i=e[3];try{0===t.state?r("function"==typeof n?n.call(void 0,t.value):t.value):1===t.state&&("function"==typeof o?r(o.call(void 0,t.value)):i(t.value))}catch(t){i(t)}}})},J.then=function(e,n){var o=this;return new t(function(t,r){o.deferred.push([e,n,t,r]),o.notify()})},J.catch=function(t){return this.then(void 0,t)},"undefined"==typeof Promise&&(window.Promise=t),e.all=function(t,n){return new e(Promise.all(t),n)},e.resolve=function(t,n){return new e(Promise.resolve(t),n)},e.reject=function(t,n){return new e(Promise.reject(t),n)},e.race=function(t,n){return new e(Promise.race(t),n)};var W=e.prototype;W.bind=function(t){return this.context=t,this},W.then=function(t,n){return t&&t.bind&&this.context&&(t=t.bind(this.context)),n&&n.bind&&this.context&&(n=n.bind(this.context)),new e(this.promise.then(t,n),this.context)},W.catch=function(t){return t&&t.bind&&this.context&&(t=t.bind(this.context)),new e(this.promise.catch(t),this.context)},W.finally=function(t){return this.then(function(e){return t.call(this),e},function(e){return t.call(this),Promise.reject(e)})};var X,F={},G=F.hasOwnProperty,V=[],_=V.slice,z=!1,K="undefined"!=typeof window,Q=function(t){var e=t.config,n=t.nextTick;X=n,z=e.debug||!e.silent},Y=Array.isArray,Z=Object.assign||g,tt=function(t,e){var n=e(t);return a(t.root)&&!n.match(/^(https?:)?\//)&&(n=t.root+"/"+n),n},et=function(t,e){var n=Object.keys($.options.params),o={},r=e(t);return y(t.params,function(t,e){-1===n.indexOf(e)&&(o[e]=t)}),o=$.params(o),o&&(r+=(-1==r.indexOf("?")?"?":"&")+o),r},nt=function(t){var e=[],n=T(t.url,t.params,e);return e.forEach(function(e){delete t.params[e]}),n};$.options={url:"",root:null,params:{}},$.transform={template:nt,query:et,root:tt},$.transforms=["template","query","root"],$.params=function(t){var e=[],n=encodeURIComponent;return e.add=function(t,e){c(e)&&(e=e()),null===e&&(e=""),this.push(n(t)+"="+n(e))},A(e,t),e.join("&").replace(/%20/g,"+")},$.parse=function(t){var e=document.createElement("a");return document.documentMode&&(e.href=t,t=e.href),e.href=t,{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",port:e.port,host:e.host,hostname:e.hostname,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):""}};var ot=function(t){return new e(function(e){var n=new XDomainRequest,o=function(o){var r=o.type,i=0;"load"===r?i=200:"error"===r&&(i=500),e(t.respondWith(n.responseText,{status:i}))};t.abort=function(){return n.abort()},n.open(t.method,t.getUrl()),t.timeout&&(n.timeout=t.timeout),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){},n.send(t.getBody())})},rt=K&&"withCredentials"in new XMLHttpRequest,it=function(t,e){if(K){var n=$.parse(location.href),o=$.parse(t.getUrl());o.protocol===n.protocol&&o.host===n.host||(t.crossOrigin=!0,t.emulateHTTP=!1,rt||(t.client=ot))}e()},ut=function(t,e){d(t.body)?t.headers.delete("Content-Type"):(f(t.body)||Y(t.body))&&(t.emulateJSON?(t.body=$.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded")):t.body=JSON.stringify(t.body)),e(function(t){return Object.defineProperty(t,"data",{get:function(){return this.body},set:function(t){this.body=t}}),t.bodyText?l(t.text(),function(e){if(0===(t.headers.get("Content-Type")||"").indexOf("application/json")||R(e))try{t.body=JSON.parse(e)}catch(e){t.body=null}else t.body=e;return t}):t})},st=function(t){return new e(function(e){var n,o,r=t.jsonp||"callback",i=t.jsonpCallback||"_jsonp"+Math.random().toString(36).substr(2),u=null;n=function(n){var r=n.type,s=0;"load"===r&&null!==u?s=200:"error"===r&&(s=500),s&&window[i]&&(delete window[i],document.body.removeChild(o)),e(t.respondWith(u,{status:s}))},window[i]=function(t){u=JSON.stringify(t)},t.abort=function(){n({type:"abort"})},t.params[r]=i,t.timeout&&setTimeout(t.abort,t.timeout),o=document.createElement("script"),o.src=t.getUrl(),o.type="text/javascript",o.async=!0,o.onload=n,o.onerror=n,document.body.appendChild(o)})},at=function(t,e){"JSONP"==t.method&&(t.client=st),e()},ct=function(t,e){c(t.before)&&t.before.call(this,t),e()},ft=function(t,e){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST"),e()},pt=function(t,e){y(Z({},L.headers.common,t.crossOrigin?{}:L.headers.custom,L.headers[u(t.method)]),function(e,n){t.headers.has(n)||t.headers.set(n,e)}),e()},ht=function(t){return new e(function(e){var n=new XMLHttpRequest,o=function(o){var r=t.respondWith("response"in n?n.response:n.responseText,{status:1223===n.status?204:n.status,statusText:1223===n.status?"No Content":i(n.statusText)});y(i(n.getAllResponseHeaders()).split("\n"),function(t){r.headers.append(t.slice(0,t.indexOf(":")),t.slice(t.indexOf(":")+1))}),e(r)};t.abort=function(){return n.abort()},t.progress&&("GET"===t.method?n.addEventListener("progress",t.progress):/^(POST|PUT)$/i.test(t.method)&&n.upload.addEventListener("progress",t.progress)),n.open(t.method,t.getUrl(),!0),t.timeout&&(n.timeout=t.timeout),t.responseType&&"responseType"in n&&(n.responseType=t.responseType),(t.withCredentials||t.credentials)&&(n.withCredentials=!0),t.crossOrigin||t.headers.set("X-Requested-With","XMLHttpRequest"),t.headers.forEach(function(t,e){n.setRequestHeader(e,t)}),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.send(t.getBody())})},dt=function(t){var n=require("got");return new e(function(e){var o,r=t.getUrl(),u=t.getBody(),s=t.method,a={};t.headers.forEach(function(t,e){a[e]=t}),n(r,{body:u,method:s,headers:a}).then(o=function(n){var o=t.respondWith(n.body,{status:n.statusCode,statusText:i(n.statusMessage)});y(n.headers,function(t,e){o.headers.set(e,t)}),e(o)},function(t){return o(t.response)})})},lt=function(t){function o(o){return new e(function(e){function s(){r=i.pop(),c(r)?r.call(t,o,a):(n("Invalid interceptor of type "+typeof r+", must be a function"),a())}function a(n){if(c(n))u.unshift(n);else if(f(n))return u.forEach(function(e){n=l(n,function(n){return e.call(t,n)||n})}),void l(n,e);s()}s()},t)}var r,i=[S],u=[];return f(t)||(t=null),o.use=function(t){i.push(t)},o},mt=function(t){var e=this;this.map={},y(t,function(t,n){return e.append(n,t)})};mt.prototype.has=function(t){return null!==k(this.map,t)},mt.prototype.get=function(t){var e=this.map[k(this.map,t)];return e?e.join():null},mt.prototype.getAll=function(t){return this.map[k(this.map,t)]||[]},mt.prototype.set=function(t,e){this.map[I(k(this.map,t)||t)]=[i(e)]},mt.prototype.append=function(t,e){var n=this.map[k(this.map,t)];n?n.push(i(e)):this.set(t,e)},mt.prototype.delete=function(t){delete this.map[k(this.map,t)]},mt.prototype.deleteAll=function(){this.map={}},mt.prototype.forEach=function(t,e){var n=this;y(this.map,function(o,r){y(o,function(o){return t.call(e,o,r,n)})})};var yt=function(t,e){var n=e.url,o=e.headers,r=e.status,i=e.statusText;this.url=n,this.ok=r>=200&&r<300,this.status=r||0,this.statusText=i||"",this.headers=new mt(o),this.body=t,a(t)?this.bodyText=t:h(t)&&(this.bodyBlob=t,H(t)&&(this.bodyText=q(t)))};yt.prototype.blob=function(){return l(this.bodyBlob)},yt.prototype.text=function(){return l(this.bodyText)},yt.prototype.json=function(){return l(this.text(),function(t){return JSON.parse(t)})};var vt=function(t){this.body=null,this.params={},Z(this,t,{method:s(t.method||"GET")}),this.headers instanceof mt||(this.headers=new mt(this.headers))};vt.prototype.getUrl=function(){return $(this)},vt.prototype.getBody=function(){return this.body},vt.prototype.respondWith=function(t,e){return new yt(t,Z(e||{},{url:this.getUrl()}))};var bt={Accept:"application/json, text/plain, */*"},gt={"Content-Type":"application/json;charset=utf-8"};return L.options={},L.headers={put:gt,post:gt,patch:gt,delete:gt,common:bt,custom:{}},L.interceptor={before:ct,method:ft,body:ut,jsonp:at,header:pt,cors:it},L.interceptors=["before","method","body","jsonp","header","cors"],["get","delete","head","jsonp"].forEach(function(t){L[t]=function(e,n){return this(Z(n||{},{url:e,method:t}))}}),["post","put","patch"].forEach(function(t){L[t]=function(e,n,o){return this(Z(o||{},{url:e,method:t,body:n}))}}),B.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(N),N});
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function t(t){this.state=J,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}function e(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}function n(t){"undefined"!=typeof console&&_&&console.warn("[VueResource warn]: "+t)}function o(t){"undefined"!=typeof console&&console.error(t)}function r(t,e){return F(t,e)}function i(t){return t?t.replace(/^\s*|\s*$/g,""):""}function u(t,e){return t&&void 0===e?t.replace(/\s+$/,""):t&&e?t.replace(new RegExp("["+e+"]+$"),""):t}function s(t){return t?t.toLowerCase():""}function a(t){return t?t.toUpperCase():""}function c(t){return"string"==typeof t}function f(t){return"function"==typeof t}function p(t){return null!==t&&"object"==typeof t}function h(t){return p(t)&&Object.getPrototypeOf(t)==Object.prototype}function d(t){return"undefined"!=typeof Blob&&t instanceof Blob}function l(t){return"undefined"!=typeof FormData&&t instanceof FormData}function m(t,n,o){var r=e.resolve(t);return arguments.length<2?r:r.then(n,o)}function y(t,e,n){return n=n||{},f(n)&&(n=n.call(e)),b(t.bind({$vm:e,$options:n}),t,{$options:n})}function v(t,e){var n,o;if(Q(t))for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(p(t))for(o in t)G.call(t,o)&&e.call(t[o],t[o],o);return t}function b(t){return V.call(arguments,1).forEach(function(e){T(t,e,!0)}),t}function g(t){return V.call(arguments,1).forEach(function(e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function w(t){return V.call(arguments,1).forEach(function(e){T(t,e)}),t}function T(t,e,n){for(var o in e)n&&(h(e[o])||Q(e[o]))?(h(e[o])&&!h(t[o])&&(t[o]={}),Q(e[o])&&!Q(t[o])&&(t[o]=[]),T(t[o],e[o],n)):void 0!==e[o]&&(t[o]=e[o])}function x(t,e,n){var o=j(t),r=o.expand(e);return n&&n.push.apply(n,o.vars),r}function j(t){var e=["+","#",".","/",";","?","&"],n=[];return{vars:n,expand:function(o){return t.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(t,r,i){if(r){var u=null,s=[];if(-1!==e.indexOf(r.charAt(0))&&(u=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(t){var e=/([^:\*]*)(?::(\d+)|(\*))?/.exec(t);s.push.apply(s,E(o,u,e[1],e[2]||e[3])),n.push(e[1])}),u&&"+"!==u){var a=",";return"?"===u?a="&":"#"!==u&&(a=u),(0!==s.length?u:"")+s.join(a)}return s.join(",")}return $(i)})}}}function E(t,e,n,o){var r=t[n],i=[];if(O(r)&&""!==r)if("string"==typeof r||"number"==typeof r||"boolean"==typeof r)r=r.toString(),o&&"*"!==o&&(r=r.substring(0,parseInt(o,10))),i.push(C(e,r,P(e)?n:null));else if("*"===o)Array.isArray(r)?r.filter(O).forEach(function(t){i.push(C(e,t,P(e)?n:null))}):Object.keys(r).forEach(function(t){O(r[t])&&i.push(C(e,r[t],t))});else{var u=[];Array.isArray(r)?r.filter(O).forEach(function(t){u.push(C(e,t))}):Object.keys(r).forEach(function(t){O(r[t])&&(u.push(encodeURIComponent(t)),u.push(C(e,r[t].toString())))}),P(e)?i.push(encodeURIComponent(n)+"="+u.join(",")):0!==u.length&&i.push(u.join(","))}else";"===e?i.push(encodeURIComponent(n)):""!==r||"&"!==e&&"?"!==e?""===r&&i.push(""):i.push(encodeURIComponent(n)+"=");return i}function O(t){return void 0!==t&&null!==t}function P(t){return";"===t||"&"===t||"?"===t}function C(t,e,n){return e="+"===t||"#"===t?$(e):encodeURIComponent(e),n?encodeURIComponent(n)+"="+e:e}function $(t){return t.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t)),t}).join("")}function U(t,e){var n,o=this||{},r=t;return c(t)&&(r={url:t,params:e}),r=b({},U.options,o.$options,r),U.transforms.forEach(function(t){c(t)&&(t=U.transform[t]),f(t)&&(n=R(t,n,o.$vm))}),n(r)}function R(t,e,n){return function(o){return t.call(n,o,e)}}function A(t,e,n){var o,r=Q(e),i=h(e);v(e,function(e,u){o=p(e)||Q(e),n&&(u=n+"["+(i||o?u:"")+"]"),!n&&r?t.add(e.name,e.value):o?A(t,e,u):t.add(u,e)})}function S(t){var e=t.match(/^\[|^\{(?!\{)/),n={"[":/]$/,"{":/}$/};return e&&n[e[0]].test(t)}function k(t,e){e((t.client||(z?ht:dt))(t))}function I(t,e){return Object.keys(t).reduce(function(t,n){return s(e)===s(n)?n:t},null)}function q(t){if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return i(t)}function H(t){return new e(function(e){var n=new FileReader;n.readAsText(t),n.onload=function(){e(n.result)}})}function L(t){return 0===t.type.indexOf("text")||-1!==t.type.indexOf("json")}function B(t){var n=this||{},r=lt(n.$vm);return g(t||{},n.$options,B.options),B.interceptors.forEach(function(t){c(t)&&(t=B.interceptor[t]),f(t)&&r.use(t)}),r(new vt(t)).then(function(t){return t.ok?t:e.reject(t)},function(t){return t instanceof Error&&o(t),e.reject(t)})}function M(t,e,n,o){var r=this||{},i={};return n=Y({},M.actions,n),v(n,function(n,u){n=b({url:t,params:Y({},e)},o,n),i[u]=function(){return(r.$http||B)(N(n,arguments))}}),i}function N(t,e){var n,o=Y({},t),r={};switch(e.length){case 2:r=e[0],n=e[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(o.method)?n=e[0]:r=e[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+e.length+" arguments"}return o.body=n,o.params=Y({},o.params,r),o}function D(t){D.installed||(K(t),t.url=U,t.http=B,t.resource=M,t.Promise=e,Object.defineProperties(t.prototype,{$url:{get:function(){return y(t.url,this,this.$options.url)}},$http:{get:function(){return y(t.http,this,this.$options.http)}},$resource:{get:function(){return t.resource.bind(this)}},$promise:{get:function(){var e=this;return function(n){return new t.Promise(n,e)}}}}))}var J=2;t.reject=function(e){return new t(function(t,n){n(e)})},t.resolve=function(e){return new t(function(t,n){t(e)})},t.all=function(e){return new t(function(n,o){var r=0,i=[];0===e.length&&n(i);for(var u=0;u<e.length;u+=1)t.resolve(e[u]).then(function(t){return function(o){i[t]=o,(r+=1)===e.length&&n(i)}}(u),o)})},t.race=function(e){return new t(function(n,o){for(var r=0;r<e.length;r+=1)t.resolve(e[r]).then(n,o)})};var W=t.prototype;W.resolve=function(t){var e=this;if(e.state===J){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){n||e.resolve(t),n=!0},function(t){n||e.reject(t),n=!0})}catch(t){return void(n||e.reject(t))}e.state=0,e.value=t,e.notify()}},W.reject=function(t){var e=this;if(e.state===J){if(t===e)throw new TypeError("Promise settled with itself.");e.state=1,e.value=t,e.notify()}},W.notify=function(){var t=this;r(function(){if(t.state!==J)for(;t.deferred.length;){var e=t.deferred.shift(),n=e[0],o=e[1],r=e[2],i=e[3];try{0===t.state?r("function"==typeof n?n.call(void 0,t.value):t.value):1===t.state&&("function"==typeof o?r(o.call(void 0,t.value)):i(t.value))}catch(t){i(t)}}})},W.then=function(e,n){var o=this;return new t(function(t,r){o.deferred.push([e,n,t,r]),o.notify()})},W.catch=function(t){return this.then(void 0,t)},"undefined"==typeof Promise&&(window.Promise=t),e.all=function(t,n){return new e(Promise.all(t),n)},e.resolve=function(t,n){return new e(Promise.resolve(t),n)},e.reject=function(t,n){return new e(Promise.reject(t),n)},e.race=function(t,n){return new e(Promise.race(t),n)};var X=e.prototype;X.bind=function(t){return this.context=t,this},X.then=function(t,n){return t&&t.bind&&this.context&&(t=t.bind(this.context)),n&&n.bind&&this.context&&(n=n.bind(this.context)),new e(this.promise.then(t,n),this.context)},X.catch=function(t){return t&&t.bind&&this.context&&(t=t.bind(this.context)),new e(this.promise.catch(t),this.context)},X.finally=function(t){return this.then(function(e){return t.call(this),e},function(e){return t.call(this),Promise.reject(e)})};var F,G={}.hasOwnProperty,V=[].slice,_=!1,z="undefined"!=typeof window,K=function(t){var e=t.config,n=t.nextTick;F=n,_=e.debug||!e.silent},Q=Array.isArray,Y=Object.assign||w,Z=function(t,e){var n=e(t);return c(t.root)&&!/^(https?:)?\//.test(n)&&(n=u(t.root,"/")+"/"+n),n},tt=function(t,e){var n=Object.keys(U.options.params),o={},r=e(t);return v(t.params,function(t,e){-1===n.indexOf(e)&&(o[e]=t)}),(o=U.params(o))&&(r+=(-1==r.indexOf("?")?"?":"&")+o),r},et=function(t){var e=[],n=x(t.url,t.params,e);return e.forEach(function(e){delete t.params[e]}),n};U.options={url:"",root:null,params:{}},U.transform={template:et,query:tt,root:Z},U.transforms=["template","query","root"],U.params=function(t){var e=[],n=encodeURIComponent;return e.add=function(t,e){f(e)&&(e=e()),null===e&&(e=""),this.push(n(t)+"="+n(e))},A(e,t),e.join("&").replace(/%20/g,"+")},U.parse=function(t){var e=document.createElement("a");return document.documentMode&&(e.href=t,t=e.href),e.href=t,{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",port:e.port,host:e.host,hostname:e.hostname,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):""}};var nt=function(t){return new e(function(e){var n=new XDomainRequest,o=function(o){var r=o.type,i=0;"load"===r?i=200:"error"===r&&(i=500),e(t.respondWith(n.responseText,{status:i}))};t.abort=function(){return n.abort()},n.open(t.method,t.getUrl()),t.timeout&&(n.timeout=t.timeout),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){},n.send(t.getBody())})},ot=z&&"withCredentials"in new XMLHttpRequest,rt=function(t,e){if(z){var n=U.parse(location.href),o=U.parse(t.getUrl());o.protocol===n.protocol&&o.host===n.host||(t.crossOrigin=!0,t.emulateHTTP=!1,ot||(t.client=nt))}e()},it=function(t,e){l(t.body)?t.headers.delete("Content-Type"):p(t.body)&&t.emulateJSON&&(t.body=U.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded")),e()},ut=function(t,e){var n=t.headers.get("Content-Type")||"";p(t.body)&&0===n.indexOf("application/json")&&(t.body=JSON.stringify(t.body)),e(function(t){return t.bodyText?m(t.text(),function(e){if(0===(n=t.headers.get("Content-Type")||"").indexOf("application/json")||S(e))try{t.body=JSON.parse(e)}catch(e){t.body=null}else t.body=e;return t}):t})},st=function(t){return new e(function(e){var n,o,r=t.jsonp||"callback",i=t.jsonpCallback||"_jsonp"+Math.random().toString(36).substr(2),u=null;n=function(n){var r=n.type,s=0;"load"===r&&null!==u?s=200:"error"===r&&(s=500),s&&window[i]&&(delete window[i],document.body.removeChild(o)),e(t.respondWith(u,{status:s}))},window[i]=function(t){u=JSON.stringify(t)},t.abort=function(){n({type:"abort"})},t.params[r]=i,t.timeout&&setTimeout(t.abort,t.timeout),(o=document.createElement("script")).src=t.getUrl(),o.type="text/javascript",o.async=!0,o.onload=n,o.onerror=n,document.body.appendChild(o)})},at=function(t,e){"JSONP"==t.method&&(t.client=st),e()},ct=function(t,e){f(t.before)&&t.before.call(this,t),e()},ft=function(t,e){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST"),e()},pt=function(t,e){v(Y({},B.headers.common,t.crossOrigin?{}:B.headers.custom,B.headers[s(t.method)]),function(e,n){t.headers.has(n)||t.headers.set(n,e)}),e()},ht=function(t){return new e(function(e){var n=new XMLHttpRequest,o=function(o){var r=t.respondWith("response"in n?n.response:n.responseText,{status:1223===n.status?204:n.status,statusText:1223===n.status?"No Content":i(n.statusText)});v(i(n.getAllResponseHeaders()).split("\n"),function(t){r.headers.append(t.slice(0,t.indexOf(":")),t.slice(t.indexOf(":")+1))}),e(r)};t.abort=function(){return n.abort()},t.progress&&("GET"===t.method?n.addEventListener("progress",t.progress):/^(POST|PUT)$/i.test(t.method)&&n.upload.addEventListener("progress",t.progress)),n.open(t.method,t.getUrl(),!0),t.timeout&&(n.timeout=t.timeout),t.responseType&&"responseType"in n&&(n.responseType=t.responseType),(t.withCredentials||t.credentials)&&(n.withCredentials=!0),t.crossOrigin||t.headers.set("X-Requested-With","XMLHttpRequest"),t.headers.forEach(function(t,e){n.setRequestHeader(e,t)}),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.send(t.getBody())})},dt=function(t){var n=require("got");return new e(function(e){var o,r=t.getUrl(),u=t.getBody(),s=t.method,a={};t.headers.forEach(function(t,e){a[e]=t}),n(r,{body:u,method:s,headers:a}).then(o=function(n){var o=t.respondWith(n.body,{status:n.statusCode,statusText:i(n.statusMessage)});v(n.headers,function(t,e){o.headers.set(e,t)}),e(o)},function(t){return o(t.response)})})},lt=function(t){function o(o){return new e(function(e,s){function a(){f(r=i.pop())?r.call(t,o,c):(n("Invalid interceptor of type "+typeof r+", must be a function"),c())}function c(n){if(f(n))u.unshift(n);else if(p(n))return u.forEach(function(e){n=m(n,function(n){return e.call(t,n)||n},s)}),void m(n,e,s);a()}a()},t)}var r,i=[k],u=[];return p(t)||(t=null),o.use=function(t){i.push(t)},o},mt=function(t){var e=this;this.map={},v(t,function(t,n){return e.append(n,t)})};mt.prototype.has=function(t){return null!==I(this.map,t)},mt.prototype.get=function(t){var e=this.map[I(this.map,t)];return e?e.join():null},mt.prototype.getAll=function(t){return this.map[I(this.map,t)]||[]},mt.prototype.set=function(t,e){this.map[q(I(this.map,t)||t)]=[i(e)]},mt.prototype.append=function(t,e){var n=this.map[I(this.map,t)];n?n.push(i(e)):this.set(t,e)},mt.prototype.delete=function(t){delete this.map[I(this.map,t)]},mt.prototype.deleteAll=function(){this.map={}},mt.prototype.forEach=function(t,e){var n=this;v(this.map,function(o,r){v(o,function(o){return t.call(e,o,r,n)})})};var yt=function(t,e){var n=e.url,o=e.headers,r=e.status,i=e.statusText;this.url=n,this.ok=r>=200&&r<300,this.status=r||0,this.statusText=i||"",this.headers=new mt(o),this.body=t,c(t)?this.bodyText=t:d(t)&&(this.bodyBlob=t,L(t)&&(this.bodyText=H(t)))};yt.prototype.blob=function(){return m(this.bodyBlob)},yt.prototype.text=function(){return m(this.bodyText)},yt.prototype.json=function(){return m(this.text(),function(t){return JSON.parse(t)})},Object.defineProperty(yt.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var vt=function(t){this.body=null,this.params={},Y(this,t,{method:a(t.method||"GET")}),this.headers instanceof mt||(this.headers=new mt(this.headers))};vt.prototype.getUrl=function(){return U(this)},vt.prototype.getBody=function(){return this.body},vt.prototype.respondWith=function(t,e){return new yt(t,Y(e||{},{url:this.getUrl()}))};var bt={Accept:"application/json, text/plain, */*"},gt={"Content-Type":"application/json;charset=utf-8"};return B.options={},B.headers={put:gt,post:gt,patch:gt,delete:gt,common:bt,custom:{}},B.interceptor={before:ct,method:ft,jsonp:at,json:ut,form:it,header:pt,cors:rt},B.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach(function(t){B[t]=function(e,n){return this(Y(n||{},{url:e,method:t}))}}),["post","put","patch"].forEach(function(t){B[t]=function(e,n,o){return this(Y(o||{},{url:e,method:t,body:n}))}}),M.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(D),D});
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue-router v2.5.2
2
+ * vue-router v2.7.0
3
3
  * (c) 2017 Evan You
4
4
  * @license MIT
5
5
  */
@@ -23,6 +23,10 @@ function warn (condition, message) {
23
23
  }
24
24
  }
25
25
 
26
+ function isError (err) {
27
+ return Object.prototype.toString.call(err).indexOf('Error') > -1
28
+ }
29
+
26
30
  var View = {
27
31
  name: 'router-view',
28
32
  functional: true,
@@ -51,7 +55,7 @@ var View = {
51
55
  // has been toggled inactive but kept-alive.
52
56
  var depth = 0;
53
57
  var inactive = false;
54
- while (parent) {
58
+ while (parent && parent._routerRoot !== parent) {
55
59
  if (parent.$vnode && parent.$vnode.data.routerView) {
56
60
  depth++;
57
61
  }
@@ -80,7 +84,11 @@ var View = {
80
84
  // this will be called in the instance's injected lifecycle hooks
81
85
  data.registerRouteInstance = function (vm, val) {
82
86
  // val could be undefined for unregistration
83
- if (matched.instances[name] !== vm) {
87
+ var current = matched.instances[name];
88
+ if (
89
+ (val && current !== vm) ||
90
+ (!val && current === vm)
91
+ ) {
84
92
  matched.instances[name] = val;
85
93
  }
86
94
  }
@@ -198,7 +206,7 @@ function stringifyQuery (obj) {
198
206
 
199
207
  if (Array.isArray(val)) {
200
208
  var result = [];
201
- val.slice().forEach(function (val2) {
209
+ val.forEach(function (val2) {
202
210
  if (val2 === undefined) {
203
211
  return
204
212
  }
@@ -302,7 +310,15 @@ function isObjectEqual (a, b) {
302
310
  if (aKeys.length !== bKeys.length) {
303
311
  return false
304
312
  }
305
- return aKeys.every(function (key) { return String(a[key]) === String(b[key]); })
313
+ return aKeys.every(function (key) {
314
+ var aVal = a[key];
315
+ var bVal = b[key];
316
+ // check nested equality
317
+ if (typeof aVal === 'object' && typeof bVal === 'object') {
318
+ return isObjectEqual(aVal, bVal)
319
+ }
320
+ return String(aVal) === String(bVal)
321
+ })
306
322
  }
307
323
 
308
324
  function isIncludedRoute (current, target) {
@@ -433,7 +449,7 @@ var Link = {
433
449
 
434
450
  function guardEvent (e) {
435
451
  // don't redirect with control keys
436
- if (e.metaKey || e.ctrlKey || e.shiftKey) { return }
452
+ if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
437
453
  // don't redirect when preventDefault called
438
454
  if (e.defaultPrevented) { return }
439
455
  // don't redirect on right click
@@ -473,14 +489,6 @@ function install (Vue) {
473
489
 
474
490
  _Vue = Vue;
475
491
 
476
- Object.defineProperty(Vue.prototype, '$router', {
477
- get: function get () { return this.$root._router }
478
- });
479
-
480
- Object.defineProperty(Vue.prototype, '$route', {
481
- get: function get () { return this.$root._route }
482
- });
483
-
484
492
  var isDef = function (v) { return v !== undefined; };
485
493
 
486
494
  var registerInstance = function (vm, callVal) {
@@ -493,9 +501,12 @@ function install (Vue) {
493
501
  Vue.mixin({
494
502
  beforeCreate: function beforeCreate () {
495
503
  if (isDef(this.$options.router)) {
504
+ this._routerRoot = this;
496
505
  this._router = this.$options.router;
497
506
  this._router.init(this);
498
507
  Vue.util.defineReactive(this, '_route', this._router.history.current);
508
+ } else {
509
+ this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
499
510
  }
500
511
  registerInstance(this, this);
501
512
  },
@@ -504,12 +515,20 @@ function install (Vue) {
504
515
  }
505
516
  });
506
517
 
518
+ Object.defineProperty(Vue.prototype, '$router', {
519
+ get: function get () { return this._routerRoot._router }
520
+ });
521
+
522
+ Object.defineProperty(Vue.prototype, '$route', {
523
+ get: function get () { return this._routerRoot._route }
524
+ });
525
+
507
526
  Vue.component('router-view', View);
508
527
  Vue.component('router-link', Link);
509
528
 
510
529
  var strats = Vue.config.optionMergeStrategies;
511
530
  // use the same hook merging strategy for route hooks
512
- strats.beforeRouteEnter = strats.beforeRouteLeave = strats.created;
531
+ strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
513
532
  }
514
533
 
515
534
  /* */
@@ -591,8 +610,6 @@ var index$1 = Array.isArray || function (arr) {
591
610
  return Object.prototype.toString.call(arr) == '[object Array]';
592
611
  };
593
612
 
594
- var isarray = index$1;
595
-
596
613
  /**
597
614
  * Expose `pathToRegexp`.
598
615
  */
@@ -773,7 +790,7 @@ function tokensToFunction (tokens) {
773
790
  }
774
791
  }
775
792
 
776
- if (isarray(value)) {
793
+ if (index$1(value)) {
777
794
  if (!token.repeat) {
778
795
  throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
779
796
  }
@@ -924,7 +941,7 @@ function stringToRegexp (path, keys, options) {
924
941
  * @return {!RegExp}
925
942
  */
926
943
  function tokensToRegExp (tokens, keys, options) {
927
- if (!isarray(keys)) {
944
+ if (!index$1(keys)) {
928
945
  options = /** @type {!Object} */ (keys || options);
929
946
  keys = [];
930
947
  }
@@ -1000,7 +1017,7 @@ function tokensToRegExp (tokens, keys, options) {
1000
1017
  * @return {!RegExp}
1001
1018
  */
1002
1019
  function pathToRegexp (path, keys, options) {
1003
- if (!isarray(keys)) {
1020
+ if (!index$1(keys)) {
1004
1021
  options = /** @type {!Object} */ (keys || options);
1005
1022
  keys = [];
1006
1023
  }
@@ -1011,7 +1028,7 @@ function pathToRegexp (path, keys, options) {
1011
1028
  return regexpToRegexp(path, /** @type {!Array} */ (keys))
1012
1029
  }
1013
1030
 
1014
- if (isarray(path)) {
1031
+ if (index$1(path)) {
1015
1032
  return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
1016
1033
  }
1017
1034
 
@@ -1098,9 +1115,15 @@ function addRouteRecord (
1098
1115
  }
1099
1116
 
1100
1117
  var normalizedPath = normalizePath(path, parent);
1118
+ var pathToRegexpOptions = route.pathToRegexpOptions || {};
1119
+
1120
+ if (typeof route.caseSensitive === 'boolean') {
1121
+ pathToRegexpOptions.sensitive = route.caseSensitive;
1122
+ }
1123
+
1101
1124
  var record = {
1102
1125
  path: normalizedPath,
1103
- regex: compileRouteRegex(normalizedPath),
1126
+ regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
1104
1127
  components: route.components || { default: route.component },
1105
1128
  instances: {},
1106
1129
  name: name,
@@ -1117,11 +1140,11 @@ function addRouteRecord (
1117
1140
  };
1118
1141
 
1119
1142
  if (route.children) {
1120
- // Warn if route is named and has a default child route.
1143
+ // Warn if route is named, does not redirect and has a default child route.
1121
1144
  // If users navigate to this route by name, the default child will
1122
1145
  // not be rendered (GH Issue #629)
1123
1146
  {
1124
- if (route.name && route.children.some(function (child) { return /^\/?$/.test(child.path); })) {
1147
+ if (route.name && !route.redirect && route.children.some(function (child) { return /^\/?$/.test(child.path); })) {
1125
1148
  warn(
1126
1149
  false,
1127
1150
  "Named Route '" + (route.name) + "' has a default child route. " +
@@ -1141,21 +1164,24 @@ function addRouteRecord (
1141
1164
  }
1142
1165
 
1143
1166
  if (route.alias !== undefined) {
1144
- if (Array.isArray(route.alias)) {
1145
- route.alias.forEach(function (alias) {
1146
- var aliasRoute = {
1147
- path: alias,
1148
- children: route.children
1149
- };
1150
- addRouteRecord(pathList, pathMap, nameMap, aliasRoute, parent, record.path);
1151
- });
1152
- } else {
1167
+ var aliases = Array.isArray(route.alias)
1168
+ ? route.alias
1169
+ : [route.alias];
1170
+
1171
+ aliases.forEach(function (alias) {
1153
1172
  var aliasRoute = {
1154
- path: route.alias,
1173
+ path: alias,
1155
1174
  children: route.children
1156
1175
  };
1157
- addRouteRecord(pathList, pathMap, nameMap, aliasRoute, parent, record.path);
1158
- }
1176
+ addRouteRecord(
1177
+ pathList,
1178
+ pathMap,
1179
+ nameMap,
1180
+ aliasRoute,
1181
+ parent,
1182
+ record.path || '/' // matchAs
1183
+ );
1184
+ });
1159
1185
  }
1160
1186
 
1161
1187
  if (!pathMap[record.path]) {
@@ -1176,8 +1202,8 @@ function addRouteRecord (
1176
1202
  }
1177
1203
  }
1178
1204
 
1179
- function compileRouteRegex (path) {
1180
- var regex = index(path);
1205
+ function compileRouteRegex (path, pathToRegexpOptions) {
1206
+ var regex = index(path, [], pathToRegexpOptions);
1181
1207
  {
1182
1208
  var keys = {};
1183
1209
  regex.keys.forEach(function (key) {
@@ -1218,7 +1244,7 @@ function normalizeLocation (
1218
1244
  if (current.name) {
1219
1245
  next.name = current.name;
1220
1246
  next.params = params;
1221
- } else if (current.matched) {
1247
+ } else if (current.matched.length) {
1222
1248
  var rawPath = current.matched[current.matched.length - 1].path;
1223
1249
  next.path = fillParams(rawPath, params, ("path " + (current.path)));
1224
1250
  } else {
@@ -1288,6 +1314,7 @@ function createMatcher (
1288
1314
  {
1289
1315
  warn(record, ("Route with name '" + name + "' does not exist"));
1290
1316
  }
1317
+ if (!record) { return _createRoute(null, location) }
1291
1318
  var paramNames = record.regex.keys
1292
1319
  .filter(function (key) { return !key.optional; })
1293
1320
  .map(function (key) { return key.name; });
@@ -1498,7 +1525,9 @@ function handleScroll (
1498
1525
  if (isObject && typeof shouldScroll.selector === 'string') {
1499
1526
  var el = document.querySelector(shouldScroll.selector);
1500
1527
  if (el) {
1501
- position = getElementPosition(el);
1528
+ var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
1529
+ offset = normalizeOffset(offset);
1530
+ position = getElementPosition(el, offset);
1502
1531
  } else if (isValidPosition(shouldScroll)) {
1503
1532
  position = normalizePosition(shouldScroll);
1504
1533
  }
@@ -1529,13 +1558,13 @@ function getScrollPosition () {
1529
1558
  }
1530
1559
  }
1531
1560
 
1532
- function getElementPosition (el) {
1561
+ function getElementPosition (el, offset) {
1533
1562
  var docEl = document.documentElement;
1534
1563
  var docRect = docEl.getBoundingClientRect();
1535
1564
  var elRect = el.getBoundingClientRect();
1536
1565
  return {
1537
- x: elRect.left - docRect.left,
1538
- y: elRect.top - docRect.top
1566
+ x: elRect.left - docRect.left - offset.x,
1567
+ y: elRect.top - docRect.top - offset.y
1539
1568
  }
1540
1569
  }
1541
1570
 
@@ -1550,6 +1579,13 @@ function normalizePosition (obj) {
1550
1579
  }
1551
1580
  }
1552
1581
 
1582
+ function normalizeOffset (obj) {
1583
+ return {
1584
+ x: isNumber(obj.x) ? obj.x : 0,
1585
+ y: isNumber(obj.y) ? obj.y : 0
1586
+ }
1587
+ }
1588
+
1553
1589
  function isNumber (v) {
1554
1590
  return typeof v === 'number'
1555
1591
  }
@@ -1632,6 +1668,107 @@ function runQueue (queue, fn, cb) {
1632
1668
 
1633
1669
  /* */
1634
1670
 
1671
+ function resolveAsyncComponents (matched) {
1672
+ return function (to, from, next) {
1673
+ var hasAsync = false;
1674
+ var pending = 0;
1675
+ var error = null;
1676
+
1677
+ flatMapComponents(matched, function (def, _, match, key) {
1678
+ // if it's a function and doesn't have cid attached,
1679
+ // assume it's an async component resolve function.
1680
+ // we are not using Vue's default async resolving mechanism because
1681
+ // we want to halt the navigation until the incoming component has been
1682
+ // resolved.
1683
+ if (typeof def === 'function' && def.cid === undefined) {
1684
+ hasAsync = true;
1685
+ pending++;
1686
+
1687
+ var resolve = once(function (resolvedDef) {
1688
+ if (resolvedDef.__esModule && resolvedDef.default) {
1689
+ resolvedDef = resolvedDef.default;
1690
+ }
1691
+ // save resolved on async factory in case it's used elsewhere
1692
+ def.resolved = typeof resolvedDef === 'function'
1693
+ ? resolvedDef
1694
+ : _Vue.extend(resolvedDef);
1695
+ match.components[key] = resolvedDef;
1696
+ pending--;
1697
+ if (pending <= 0) {
1698
+ next();
1699
+ }
1700
+ });
1701
+
1702
+ var reject = once(function (reason) {
1703
+ var msg = "Failed to resolve async component " + key + ": " + reason;
1704
+ "development" !== 'production' && warn(false, msg);
1705
+ if (!error) {
1706
+ error = isError(reason)
1707
+ ? reason
1708
+ : new Error(msg);
1709
+ next(error);
1710
+ }
1711
+ });
1712
+
1713
+ var res;
1714
+ try {
1715
+ res = def(resolve, reject);
1716
+ } catch (e) {
1717
+ reject(e);
1718
+ }
1719
+ if (res) {
1720
+ if (typeof res.then === 'function') {
1721
+ res.then(resolve, reject);
1722
+ } else {
1723
+ // new syntax in Vue 2.3
1724
+ var comp = res.component;
1725
+ if (comp && typeof comp.then === 'function') {
1726
+ comp.then(resolve, reject);
1727
+ }
1728
+ }
1729
+ }
1730
+ }
1731
+ });
1732
+
1733
+ if (!hasAsync) { next(); }
1734
+ }
1735
+ }
1736
+
1737
+ function flatMapComponents (
1738
+ matched,
1739
+ fn
1740
+ ) {
1741
+ return flatten(matched.map(function (m) {
1742
+ return Object.keys(m.components).map(function (key) { return fn(
1743
+ m.components[key],
1744
+ m.instances[key],
1745
+ m, key
1746
+ ); })
1747
+ }))
1748
+ }
1749
+
1750
+ function flatten (arr) {
1751
+ return Array.prototype.concat.apply([], arr)
1752
+ }
1753
+
1754
+ // in Webpack 2, require.ensure now also returns a Promise
1755
+ // so the resolve/reject functions may get called an extra time
1756
+ // if the user uses an arrow function shorthand that happens to
1757
+ // return that Promise.
1758
+ function once (fn) {
1759
+ var called = false;
1760
+ return function () {
1761
+ var args = [], len = arguments.length;
1762
+ while ( len-- ) args[ len ] = arguments[ len ];
1763
+
1764
+ if (called) { return }
1765
+ called = true;
1766
+ return fn.apply(this, args)
1767
+ }
1768
+ }
1769
+
1770
+ /* */
1771
+
1635
1772
  var History = function History (router, base) {
1636
1773
  this.router = router;
1637
1774
  this.base = normalizeBase(base);
@@ -1802,6 +1939,8 @@ function normalizeBase (base) {
1802
1939
  // respect <base> tag
1803
1940
  var baseEl = document.querySelector('base');
1804
1941
  base = (baseEl && baseEl.getAttribute('href')) || '/';
1942
+ // strip full URL origin
1943
+ base = base.replace(/^https?:\/\/[^\/]+/, '');
1805
1944
  } else {
1806
1945
  base = '/';
1807
1946
  }
@@ -1925,103 +2064,6 @@ function poll (
1925
2064
  }
1926
2065
  }
1927
2066
 
1928
- function resolveAsyncComponents (matched) {
1929
- return function (to, from, next) {
1930
- var hasAsync = false;
1931
- var pending = 0;
1932
- var error = null;
1933
-
1934
- flatMapComponents(matched, function (def, _, match, key) {
1935
- // if it's a function and doesn't have cid attached,
1936
- // assume it's an async component resolve function.
1937
- // we are not using Vue's default async resolving mechanism because
1938
- // we want to halt the navigation until the incoming component has been
1939
- // resolved.
1940
- if (typeof def === 'function' && def.cid === undefined) {
1941
- hasAsync = true;
1942
- pending++;
1943
-
1944
- var resolve = once(function (resolvedDef) {
1945
- // save resolved on async factory in case it's used elsewhere
1946
- def.resolved = typeof resolvedDef === 'function'
1947
- ? resolvedDef
1948
- : _Vue.extend(resolvedDef);
1949
- match.components[key] = resolvedDef;
1950
- pending--;
1951
- if (pending <= 0) {
1952
- next();
1953
- }
1954
- });
1955
-
1956
- var reject = once(function (reason) {
1957
- var msg = "Failed to resolve async component " + key + ": " + reason;
1958
- "development" !== 'production' && warn(false, msg);
1959
- if (!error) {
1960
- error = isError(reason)
1961
- ? reason
1962
- : new Error(msg);
1963
- next(error);
1964
- }
1965
- });
1966
-
1967
- var res;
1968
- try {
1969
- res = def(resolve, reject);
1970
- } catch (e) {
1971
- reject(e);
1972
- }
1973
- if (res) {
1974
- if (typeof res.then === 'function') {
1975
- res.then(resolve, reject);
1976
- } else {
1977
- // new syntax in Vue 2.3
1978
- var comp = res.component;
1979
- if (comp && typeof comp.then === 'function') {
1980
- comp.then(resolve, reject);
1981
- }
1982
- }
1983
- }
1984
- }
1985
- });
1986
-
1987
- if (!hasAsync) { next(); }
1988
- }
1989
- }
1990
-
1991
- function flatMapComponents (
1992
- matched,
1993
- fn
1994
- ) {
1995
- return flatten(matched.map(function (m) {
1996
- return Object.keys(m.components).map(function (key) { return fn(
1997
- m.components[key],
1998
- m.instances[key],
1999
- m, key
2000
- ); })
2001
- }))
2002
- }
2003
-
2004
- function flatten (arr) {
2005
- return Array.prototype.concat.apply([], arr)
2006
- }
2007
-
2008
- // in Webpack 2, require.ensure now also returns a Promise
2009
- // so the resolve/reject functions may get called an extra time
2010
- // if the user uses an arrow function shorthand that happens to
2011
- // return that Promise.
2012
- function once (fn) {
2013
- var called = false;
2014
- return function () {
2015
- if (called) { return }
2016
- called = true;
2017
- return fn.apply(this, arguments)
2018
- }
2019
- }
2020
-
2021
- function isError (err) {
2022
- return Object.prototype.toString.call(err).indexOf('Error') > -1
2023
- }
2024
-
2025
2067
  /* */
2026
2068
 
2027
2069
 
@@ -2038,9 +2080,10 @@ var HTML5History = (function (History$$1) {
2038
2080
  }
2039
2081
 
2040
2082
  window.addEventListener('popstate', function (e) {
2083
+ var current = this$1.current;
2041
2084
  this$1.transitionTo(getLocation(this$1.base), function (route) {
2042
2085
  if (expectScroll) {
2043
- handleScroll(router, route, this$1.current, true);
2086
+ handleScroll(router, route, current, true);
2044
2087
  }
2045
2088
  });
2046
2089
  });
@@ -2196,10 +2239,10 @@ function pushHash (path) {
2196
2239
  }
2197
2240
 
2198
2241
  function replaceHash (path) {
2199
- var i = window.location.href.indexOf('#');
2200
- window.location.replace(
2201
- window.location.href.slice(0, i >= 0 ? i : 0) + '#' + path
2202
- );
2242
+ var href = window.location.href;
2243
+ var i = href.indexOf('#');
2244
+ var base = i >= 0 ? href.slice(0, i) : href;
2245
+ window.location.replace((base + "#" + path));
2203
2246
  }
2204
2247
 
2205
2248
  /* */
@@ -2275,7 +2318,7 @@ var VueRouter = function VueRouter (options) {
2275
2318
  this.matcher = createMatcher(options.routes || [], this);
2276
2319
 
2277
2320
  var mode = options.mode || 'hash';
2278
- this.fallback = mode === 'history' && !supportsPushState;
2321
+ this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
2279
2322
  if (this.fallback) {
2280
2323
  mode = 'hash';
2281
2324
  }
@@ -2397,7 +2440,9 @@ VueRouter.prototype.forward = function forward () {
2397
2440
 
2398
2441
  VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
2399
2442
  var route = to
2400
- ? this.resolve(to).route
2443
+ ? to.matched
2444
+ ? to
2445
+ : this.resolve(to).route
2401
2446
  : this.currentRoute;
2402
2447
  if (!route) {
2403
2448
  return []
@@ -2457,7 +2502,7 @@ function createHref (base, fullPath, mode) {
2457
2502
  }
2458
2503
 
2459
2504
  VueRouter.install = install;
2460
- VueRouter.version = '2.5.2';
2505
+ VueRouter.version = '2.7.0';
2461
2506
 
2462
2507
  if (inBrowser && window.Vue) {
2463
2508
  window.Vue.use(VueRouter);