Comparing version 5.0.0-beta.2 to 5.0.0-beta.3
@@ -1,8 +0,7 @@ | ||
function p(){p=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b],k;for(k in c)Object.prototype.hasOwnProperty.call(c,k)&&(a[k]=c[k])}return a};return p.apply(this,arguments)}function v(){var a=[];return{get length(){return a.length},push:function(b){a.push(b);return function(){a=a.filter(function(a){return a!==b})}},call:function(b){a.forEach(function(a){return a&&a(b)})}}} | ||
function w(a){var b=a.pathname,c=a.search;a=a.hash;return(void 0===b?"/":b)+(void 0===c?"":c)+(void 0===a?"":a)}var x="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function y(a){a.preventDefault();a.returnValue=""}var D=C(); | ||
function C(a){function b(){var g=e.location,a=m.state||{};return[a.idx,x({pathname:g.pathname,search:g.search,hash:g.hash,state:a.usr||null,key:a.key||"default"})]}function c(a,b){void 0===b&&(b=null);var g=p,d=q;if("string"===typeof a){var f={};if(a){var c=a.indexOf("#");0<=c&&(f.hash=a.substr(c),a=a.substr(0,c));c=a.indexOf("?");0<=c&&(f.search=a.substr(c),a=a.substr(0,c));a&&(f.pathname=a)}a=f}return x(g({},d,{},a,{state:b,key:Math.random().toString(36).substr(2,8)}))}function k(a){t=a;a=b();l= | ||
a[0];q=a[1];z.call({action:t,location:q})}function A(a,b){function g(){A(a,b)}var d=c(a,b);if(!h.length||(h.call({action:"PUSH",location:d,retry:g}),!1)){var f=[{usr:d.state,key:d.key,idx:l+1},u(d)];d=f[0];f=f[1];try{m.pushState(d,null,f)}catch(E){e.location.assign(f)}k("PUSH")}}function B(a,b){function g(){B(a,b)}var d=c(a,b);h.length&&(h.call({action:"REPLACE",location:d,retry:g}),1)||(d=[{usr:d.state,key:d.key,idx:l},u(d)],m.replaceState(d[0],null,d[1]),k("REPLACE"))}function n(a){m.go(a)}a=(void 0=== | ||
a?{}:a).window;var e=void 0===a?document.defaultView:a,m=e.history,r=null;e.addEventListener("popstate",function(){if(r)h.call(r),r=null;else{var a=b(),c=a[0];a=a[1];if(h.length)if(null!=c){var e=l-c;e&&(r={action:"POP",location:a,retry:function(){n(-1*e)}},n(e))}else{if("production"!==process.env.NODE_ENV)throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."); | ||
}else k("POP")}});var t="POP";a=b();var l=a[0],q=a[1],h=v(),z=v();null==l&&(l=0,m.replaceState(p({},m.state,{idx:l}),null));var u=w;return{get action(){return t},get location(){return q},createHref:u,push:A,replace:B,go:n,back:function(){n(-1)},forward:function(){n(1)},listen:function(a){return z.push(a)},block:function(a){var b=h.push(a);1===h.length&&e.addEventListener("beforeunload",y);return function(){b();h.length||e.removeEventListener("beforeunload",y)}}}}export default D; | ||
var createHistory=C;export{createHistory}; | ||
function p(){p=Object.assign||function(a){for(var c=1;c<arguments.length;c++){var e=arguments[c],g;for(g in e)Object.prototype.hasOwnProperty.call(e,g)&&(a[g]=e[g])}return a};return p.apply(this,arguments)}var v=__DEV__?function(a){return Object.freeze(a)}:function(a){return a}; | ||
function w(a){function c(){var b=l.location,a=m.state||{};return[a.idx,v({pathname:b.pathname,search:b.search,hash:b.hash,state:a.usr||null,key:a.key||"default"})]}function e(b,a){void 0===a&&(a=null);var c=p,h=q;if("string"===typeof b){var e={};if(b){var d=b.indexOf("#");0<=d&&(e.hash=b.substr(d),b=b.substr(0,d));d=b.indexOf("?");0<=d&&(e.search=b.substr(d),b=b.substr(0,d));b&&(e.pathname=b)}b=e}return v(c({},h,{},b,{state:a,key:Math.random().toString(36).substr(2,8)}))}function g(b){t=b;b=c();k= | ||
b[0];q=b[1];x.call({action:t,location:q})}function y(b,a){function c(){y(b,a)}var h=e(b,a);if(!f.length||(f.call({action:"PUSH",location:h,retry:c}),!1)){var d=[{usr:h.state,key:h.key,idx:k+1},u(h)];h=d[0];d=d[1];try{m.pushState(h,null,d)}catch(E){l.location.assign(d)}g("PUSH")}}function z(a,d){function b(){z(a,d)}var c=e(a,d);f.length&&(f.call({action:"REPLACE",location:c,retry:b}),1)||(c=[{usr:c.state,key:c.key,idx:k},u(c)],m.replaceState(c[0],null,c[1]),g("REPLACE"))}function n(a){m.go(a)}a=(void 0=== | ||
a?{}:a).window;var l=void 0===a?document.defaultView:a,m=l.history,r=null;l.addEventListener("popstate",function(){if(r)f.call(r),r=null;else{var a=c(),d=a[0];a=a[1];if(f.length)if(null!=d){var e=k-d;e&&(r={action:"POP",location:a,retry:function(){n(-1*e)}},n(e))}else{if(__DEV__)throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."); | ||
}else g("POP")}});var t="POP";a=c();var k=a[0],q=a[1],f=A(),x=A();null==k&&(k=0,m.replaceState(p({},m.state,{idx:k}),null));var u=B;return{get action(){return t},get location(){return q},createHref:u,push:y,replace:z,go:n,back:function(){n(-1)},forward:function(){n(1)},listen:function(a){return x.push(a)},block:function(a){var b=f.push(a);1===f.length&&l.addEventListener("beforeunload",C);return function(){b();f.length||l.removeEventListener("beforeunload",C)}}}} | ||
function C(a){a.preventDefault();a.returnValue=""}function A(){var a=[];return{get length(){return a.length},push:function(c){a.push(c);return function(){a=a.filter(function(a){return a!==c})}},call:function(c){a.forEach(function(a){return a&&a(c)})}}}function B(a){var c=a.pathname,e=a.search;a=a.hash;return(void 0===c?"/":c)+(void 0===e?"":e)+(void 0===a?"":a)}var D=w();export default D;var createBrowserHistory=w;export{createBrowserHistory}; | ||
//# sourceMappingURL=browser.js.map |
14
hash.js
@@ -1,8 +0,8 @@ | ||
function q(){q=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b],g;for(g in c)Object.prototype.hasOwnProperty.call(c,g)&&(a[g]=c[g])}return a};return q.apply(this,arguments)}function t(){var a=[];return{get length(){return a.length},push:function(b){a.push(b);return function(){a=a.filter(function(a){return a!==b})}},call:function(b){a.forEach(function(a){return a&&a(b)})}}} | ||
function w(a){var b=a.pathname,c=a.search;a=a.hash;return(void 0===b?"/":b)+(void 0===c?"":c)+(void 0===a?"":a)}function x(a){var b={};if(a){var c=a.indexOf("#");0<=c&&(b.hash=a.substr(c),a=a.substr(0,c));c=a.indexOf("?");0<=c&&(b.search=a.substr(c),a=a.substr(0,c));a&&(b.pathname=a)}return b}var y="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function z(a){a.preventDefault();a.returnValue=""}var F=A(); | ||
function A(a){function b(){var a=x(h.location.hash.substr(1)),m=a.pathname,b=a.search;a=a.hash;var d=l.state||{};return[d.idx,y({pathname:void 0===m?"/":m,search:void 0===b?"":b,hash:void 0===a?"":a,state:d.usr||null,key:d.key||"default"})]}function c(){if(r)f.call(r),r=null;else{var a=b(),m=a[0];a=a[1];if(f.length)if(null!=m){var c=k-m;c&&(r={action:"POP",location:a,retry:function(){n(-1*c)}},n(c))}else{if("production"!==process.env.NODE_ENV)throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."); | ||
}else u("POP")}}function g(a){var b=document.querySelector("base"),e="";b&&b.getAttribute("href")&&(b=h.location.href,e=b.indexOf("#"),e=-1===e?b:b.slice(0,e));return e+"#"+w(a)}function B(a,b){void 0===b&&(b=null);return y(q({},p,{},"string"===typeof a?x(a):a,{state:b,key:Math.random().toString(36).substr(2,8)}))}function u(a){v=a;a=b();k=a[0];p=a[1];C.call({action:v,location:p})}function D(a,b){function c(){D(a,b)}var d=B(a,b);if("production"!==process.env.NODE_ENV&&"/"!==d.pathname.charAt(0))throw d= | ||
JSON.stringify(a),Error("Relative pathnames are not supported in hash history.push("+d+")");if(!f.length||(f.call({action:"PUSH",location:d,retry:c}),!1)){var e=[{usr:d.state,key:d.key,idx:k+1},g(d)];d=e[0];e=e[1];try{l.pushState(d,null,e)}catch(G){h.location.assign(e)}u("PUSH")}}function E(a,b){function c(){E(a,b)}var d=B(a,b);if("production"!==process.env.NODE_ENV&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in hash history.replace("+d+")");f.length&& | ||
(f.call({action:"REPLACE",location:d,retry:c}),1)||(d=[{usr:d.state,key:d.key,idx:k},g(d)],l.replaceState(d[0],null,d[1]),u("REPLACE"))}function n(a){l.go(a)}a=(void 0===a?{}:a).window;var h=void 0===a?document.defaultView:a,l=h.history,r=null;h.addEventListener("popstate",c);h.addEventListener("hashchange",function(){var a=b()[1];w(a)!==w(p)&&c()});var v="POP";a=b();var k=a[0],p=a[1],f=t(),C=t();null==k&&(k=0,l.replaceState(q({},l.state,{idx:k}),null));return{get action(){return v},get location(){return p}, | ||
createHref:g,push:D,replace:E,go:n,back:function(){n(-1)},forward:function(){n(1)},listen:function(a){return C.push(a)},block:function(a){var b=f.push(a);1===f.length&&h.addEventListener("beforeunload",z);return function(){b();f.length||h.removeEventListener("beforeunload",z)}}}}export default F;var createHistory=A;export{createHistory}; | ||
function p(){p=Object.assign||function(a){for(var c=1;c<arguments.length;c++){var b=arguments[c],g;for(g in b)Object.prototype.hasOwnProperty.call(b,g)&&(a[g]=b[g])}return a};return p.apply(this,arguments)}var u=__DEV__?function(a){return Object.freeze(a)}:function(a){return a}; | ||
function w(a){function c(){var a=x(h.location.hash.substr(1)),z=a.pathname,b=a.search;a=a.hash;var d=l.state||{};return[d.idx,u({pathname:void 0===z?"/":z,search:void 0===b?"":b,hash:void 0===a?"":a,state:d.usr||null,key:d.key||"default"})]}function b(){if(q)f.call(q),q=null;else{var a=c(),b=a[0];a=a[1];if(f.length)if(null!=b){var r=k-b;r&&(q={action:"POP",location:a,retry:function(){m(-1*r)}},m(r))}else{if(__DEV__)throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."); | ||
}else t("POP")}}function g(a){var b=document.querySelector("base"),e="";b&&b.getAttribute("href")&&(b=h.location.href,e=b.indexOf("#"),e=-1===e?b:b.slice(0,e));return e+"#"+y(a)}function A(a,b){void 0===b&&(b=null);return u(p({},n,{},"string"===typeof a?x(a):a,{state:b,key:Math.random().toString(36).substr(2,8)}))}function t(a){v=a;a=c();k=a[0];n=a[1];B.call({action:v,location:n})}function C(a,b){function c(){C(a,b)}var d=A(a,b);if(__DEV__&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in hash history.push("+ | ||
d+")");if(!f.length||(f.call({action:"PUSH",location:d,retry:c}),!1)){var e=[{usr:d.state,key:d.key,idx:k+1},g(d)];d=e[0];e=e[1];try{l.pushState(d,null,e)}catch(H){h.location.assign(e)}t("PUSH")}}function D(a,b){function c(){D(a,b)}var d=A(a,b);if(__DEV__&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in hash history.replace("+d+")");f.length&&(f.call({action:"REPLACE",location:d,retry:c}),1)||(d=[{usr:d.state,key:d.key,idx:k},g(d)],l.replaceState(d[0], | ||
null,d[1]),t("REPLACE"))}function m(a){l.go(a)}a=(void 0===a?{}:a).window;var h=void 0===a?document.defaultView:a,l=h.history,q=null;h.addEventListener("popstate",b);h.addEventListener("hashchange",function(){var a=c()[1];y(a)!==y(n)&&b()});var v="POP";a=c();var k=a[0],n=a[1],f=E(),B=E();null==k&&(k=0,l.replaceState(p({},l.state,{idx:k}),null));return{get action(){return v},get location(){return n},createHref:g,push:C,replace:D,go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(a){return B.push(a)}, | ||
block:function(a){var b=f.push(a);1===f.length&&h.addEventListener("beforeunload",F);return function(){b();f.length||h.removeEventListener("beforeunload",F)}}}}function F(a){a.preventDefault();a.returnValue=""}function E(){var a=[];return{get length(){return a.length},push:function(c){a.push(c);return function(){a=a.filter(function(a){return a!==c})}},call:function(c){a.forEach(function(a){return a&&a(c)})}}} | ||
function y(a){var c=a.pathname,b=a.search;a=a.hash;return(void 0===c?"/":c)+(void 0===b?"":b)+(void 0===a?"":a)}function x(a){var c={};if(a){var b=a.indexOf("#");0<=b&&(c.hash=a.substr(b),a=a.substr(0,b));b=a.indexOf("?");0<=b&&(c.search=a.substr(b),a=a.substr(0,b));a&&(c.pathname=a)}return c}var G=w();export default G;var createHashHistory=w;export{createHashHistory}; | ||
//# sourceMappingURL=hash.js.map |
@@ -1,15 +0,15 @@ | ||
'use strict';(function(m,u){"object"===typeof exports&&"undefined"!==typeof module?u(exports):"function"===typeof define&&define.amd?define(["exports"],u):u(m.HistoryLibrary={})})(this,function(m){function u(){u=Object.assign||function(a){for(var e=1;e<arguments.length;e++){var g=arguments[e],q;for(q in g)Object.prototype.hasOwnProperty.call(g,q)&&(a[q]=g[q])}return a};return u.apply(this,arguments)}function x(){var a=[];return{get length(){return a.length},push:function(e){a.push(e);return function(){a= | ||
a.filter(function(a){return a!==e})}},call:function(e){a.forEach(function(a){return a&&a(e)})}}}function B(){return Math.random().toString(36).substr(2,8)}function y(a){var e=a.pathname,g=a.search;a=a.hash;return(void 0===e?"/":e)+(void 0===g?"":g)+(void 0===a?"":a)}function z(a){var e={};if(a){var g=a.indexOf("#");0<=g&&(e.hash=a.substr(g),a=a.substr(0,g));g=a.indexOf("?");0<=g&&(e.search=a.substr(g),a=a.substr(0,g));a&&(e.pathname=a)}return e}function C(a){a.preventDefault();a.returnValue=""}function D(a){function e(){var a= | ||
n.location,c=k.state||{};return[c.idx,Object.freeze({pathname:a.pathname,search:a.search,hash:a.hash,state:c.usr||null,key:c.key||"default"})]}function g(a,c){void 0===c&&(c=null);return Object.freeze(u({},v,{},"string"===typeof a?z(a):a,{state:c,key:B()}))}function q(a){r=a;a=e();p=a[0];v=a[1];b.call({action:r,location:v})}function m(a,c){function b(){m(a,c)}var d=g(a,c);if(!l.length||(l.call({action:"PUSH",location:d,retry:b}),!1)){var A=[{usr:d.state,key:d.key,idx:p+1},f(d)];d=A[0];A=A[1];try{k.pushState(d, | ||
null,A)}catch(I){n.location.assign(A)}q("PUSH")}}function w(a,c){function b(){w(a,c)}var d=g(a,c);l.length&&(l.call({action:"REPLACE",location:d,retry:b}),1)||(d=[{usr:d.state,key:d.key,idx:p},f(d)],k.replaceState(d[0],null,d[1]),q("REPLACE"))}function t(a){k.go(a)}a=(void 0===a?{}:a).window;var n=void 0===a?document.defaultView:a,k=n.history,h=null;n.addEventListener("popstate",function(){if(h)l.call(h),h=null;else{var a=e(),c=a[0];a=a[1];if(l.length)if(null!=c){var b=p-c;b&&(h={action:"POP",location:a, | ||
retry:function(){t(-1*b)}},t(b))}else throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else q("POP")}});var r="POP";a=e();var p=a[0],v=a[1],l=x(),b=x();null==p&&(p=0,k.replaceState(u({},k.state,{idx:p}),null));var f=y;return{get action(){return r}, | ||
get location(){return v},createHref:f,push:m,replace:w,go:t,back:function(){t(-1)},forward:function(){t(1)},listen:function(a){return b.push(a)},block:function(a){var c=l.push(a);1===l.length&&n.addEventListener("beforeunload",C);return function(){c();l.length||n.removeEventListener("beforeunload",C)}}}}function E(a){a.preventDefault();a.returnValue=""}function F(a){function e(){var a=z(h.location.hash.substr(1)),b=a.pathname,d=a.search;a=a.hash;var f=r.state||{};return[f.idx,Object.freeze({pathname:void 0=== | ||
b?"/":b,search:void 0===d?"":d,hash:void 0===a?"":a,state:f.usr||null,key:f.key||"default"})]}function g(){if(p)f.call(p),p=null;else{var a=e(),b=a[0];a=a[1];if(f.length)if(null!=b){var d=l-b;d&&(p={action:"POP",location:a,retry:function(){k(-1*d)}},k(d))}else throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."); | ||
else w("POP")}}function q(a){var b=document.querySelector("base"),c="";b&&b.getAttribute("href")&&(b=h.location.href,c=b.indexOf("#"),c=-1===c?b:b.slice(0,c));return c+"#"+y(a)}function m(a,d){void 0===d&&(d=null);return Object.freeze(u({},b,{},"string"===typeof a?z(a):a,{state:d,key:B()}))}function w(a){v=a;a=e();l=a[0];b=a[1];d.call({action:v,location:b})}function t(a,b){function d(){t(a,b)}var c=m(a,b);if("/"!==c.pathname.charAt(0))throw c=JSON.stringify(a),Error("Relative pathnames are not supported in hash history.push("+ | ||
c+")");if(!f.length||(f.call({action:"PUSH",location:c,retry:d}),!1)){var e=[{usr:c.state,key:c.key,idx:l+1},q(c)];c=e[0];e=e[1];try{r.pushState(c,null,e)}catch(J){h.location.assign(e)}w("PUSH")}}function n(a,b){function d(){n(a,b)}var c=m(a,b);if("/"!==c.pathname.charAt(0))throw c=JSON.stringify(a),Error("Relative pathnames are not supported in hash history.replace("+c+")");f.length&&(f.call({action:"REPLACE",location:c,retry:d}),1)||(c=[{usr:c.state,key:c.key,idx:l},q(c)],r.replaceState(c[0],null, | ||
c[1]),w("REPLACE"))}function k(a){r.go(a)}a=(void 0===a?{}:a).window;var h=void 0===a?document.defaultView:a,r=h.history,p=null;h.addEventListener("popstate",g);h.addEventListener("hashchange",function(a){a=e()[1];y(a)!==y(b)&&g()});var v="POP";a=e();var l=a[0],b=a[1],f=x(),d=x();null==l&&(l=0,r.replaceState(u({},r.state,{idx:l}),null));return{get action(){return v},get location(){return b},createHref:q,push:t,replace:n,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(a){return d.push(a)}, | ||
block:function(a){var b=f.push(a);1===f.length&&h.addEventListener("beforeunload",E);return function(){b();f.length||h.removeEventListener("beforeunload",E)}}}}var G=D(),H=F();m.browserHistory=G;m.createBrowserHistory=D;m.hashHistory=H;m.createHashHistory=F;m.createMemoryHistory=function(a){function e(a,f){void 0===f&&(f=null);return Object.freeze(u({},p,{},"string"===typeof a?z(a):a,{state:f,key:B()}))}function g(a,f,d){return!v.length||(v.call({action:a,location:f,retry:d}),!1)}function q(a,f){r= | ||
a;p=f;l.call({action:r,location:p})}function m(a,f){var b=e(a,f);if("/"!==b.pathname.charAt(0))throw b=JSON.stringify(a),Error("Relative pathnames are not supported in memory history.push("+b+")");g("PUSH",b,function(){m(a,f)})&&(h+=1,k.splice(h,k.length,b),q("PUSH",b))}function w(a,f){var b=e(a,f);if("/"!==b.pathname.charAt(0))throw b=JSON.stringify(a),Error("Relative pathnames are not supported in memory history.replace("+b+")");g("REPLACE",b,function(){w(a,f)})&&(k[h]=b,q("REPLACE",b))}function t(a){var b= | ||
Math.min(Math.max(h+a,0),k.length-1),d=k[b];g("POP",d,function(){t(a)})&&(h=b,q("POP",d))}var n=void 0===a?{}:a;a=n.initialEntries;n=n.initialIndex;n=void 0===n?0:n;var k=(void 0===a?["/"]:a).map(function(a){var b=Object.freeze(u({pathname:"/",search:"",hash:"",state:null,key:B()},"string"===typeof a?z(a):a));if("/"!==b.pathname.charAt(0))throw a=JSON.stringify(a),Error("Relative pathnames are not supported in createHistory({ initialEntries }) (invalid entry: "+a+")");return b}),h=Math.min(Math.max(n, | ||
0),k.length-1),r="POP",p=k[h],v=x(),l=x();return{get index(){return h},get action(){return r},get location(){return p},createHref:y,push:m,replace:w,go:t,back:function(){t(-1)},forward:function(){t(1)},listen:function(a){return l.push(a)},block:function(a){return v.push(a)}}};Object.defineProperty(m,"__esModule",{value:!0})}); | ||
function x(d){d.preventDefault();d.returnValue=""}function y(){let d=[];return{get length(){return d.length},push(e){d.push(e);return function(){d=d.filter(d=>d!==e)}},call(e){d.forEach(d=>d&&d(e))}}}function z(){return Math.random().toString(36).substr(2,8)}function A(d){var {pathname:e="/",search:h="",hash:n=""}=d;return e+h+n} | ||
function B(d){let e={};if(d){var h=d.indexOf("#");0<=h&&(e.hash=d.substr(h),d=d.substr(0,h));h=d.indexOf("?");0<=h&&(e.search=d.substr(h),d=d.substr(0,h));d&&(e.pathname=d)}return e} | ||
var createBrowserHistory=function(d){function e(){let {pathname:a,search:b,hash:c}=r.location,d=m.state||{};return[d.idx,Object.freeze({pathname:a,search:b,hash:c,state:d.usr||null,key:d.key||"default"})]}function h(a,b){b=void 0===b?null:b;return Object.freeze(Object.assign({},p,"string"===typeof a?B(a):a,{state:b,key:z()}))}function n(a){k=a;[l,p]=e();t.call({action:k,location:p})}function w(a,b){function d(){w(a,b)}let u=h(a,b);if(!f.length||(f.call({action:"PUSH",location:u,retry:d}),!1)){let [b, | ||
a]=[{usr:u.state,key:u.key,idx:l+1},c(u)];try{m.pushState(b,null,a)}catch(C){r.location.assign(a)}n("PUSH")}}function v(a,b){function d(){v(a,b)}let u=h(a,b);if(!f.length||(f.call({action:"REPLACE",location:u,retry:d}),!1)){let [b,a]=[{usr:u.state,key:u.key,idx:l},c(u)];m.replaceState(b,null,a);n("REPLACE")}}function q(a){m.go(a)}var {window:r=document.defaultView}=void 0===d?{}:d;let m=r.history,g=null;r.addEventListener("popstate",function(){if(g)f.call(g),g=null;else{let [a,b]=e();if(f.length)if(null!= | ||
a){let c=l-a;c&&(g={action:"POP",location:b,retry(){q(-1*c)}},q(c))}else throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else n("POP")}});let k="POP",[l,p]=e(),f=y(),t=y();null==l&&(l=0,m.replaceState(Object.assign({},m.state,{idx:l}),null));let c= | ||
A;return{get action(){return k},get location(){return p},createHref:c,push:w,replace:v,go:q,back(){q(-1)},forward(){q(1)},listen(a){return t.push(a)},block(a){let b=f.push(a);1===f.length&&r.addEventListener("beforeunload",x);return function(){b();f.length||r.removeEventListener("beforeunload",x)}}}}; | ||
var createHashHistory=function(d){function e(){let {pathname:b="/",search:a="",hash:c=""}=B(g.location.hash.substr(1)),d=k.state||{};return[d.idx,Object.freeze({pathname:b,search:a,hash:c,state:d.usr||null,key:d.key||"default"})]}function h(){if(l)c.call(l),l=null;else{let [b,a]=e();if(c.length)if(null!=b){let c=f-b;c&&(l={action:"POP",location:a,retry(){m(-1*c)}},m(c))}else throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."); | ||
else v("POP")}}function n(b){var a=document.querySelector("base"),c="";a&&a.getAttribute("href")&&(a=g.location.href,c=a.indexOf("#"),c=-1===c?a:a.slice(0,c));return c+"#"+A(b)}function w(b,a){a=void 0===a?null:a;return Object.freeze(Object.assign({},t,"string"===typeof b?B(b):b,{state:a,key:z()}))}function v(b){p=b;[f,t]=e();a.call({action:p,location:t})}function q(b,a){function d(){q(b,a)}var e=w(b,a);if("/"!==e.pathname.charAt(0))throw e=JSON.stringify(b),Error(`Relative pathnames are not supported in hash history.push(${e})`); | ||
if(!c.length||(c.call({action:"PUSH",location:e,retry:d}),!1)){let [a,b]=[{usr:e.state,key:e.key,idx:f+1},n(e)];try{k.pushState(a,null,b)}catch(D){g.location.assign(b)}v("PUSH")}}function r(a,d){function b(){r(a,d)}var e=w(a,d);if("/"!==e.pathname.charAt(0))throw e=JSON.stringify(a),Error(`Relative pathnames are not supported in hash history.replace(${e})`);if(!c.length||(c.call({action:"REPLACE",location:e,retry:b}),!1)){let [a,b]=[{usr:e.state,key:e.key,idx:f},n(e)];k.replaceState(a,null,b);v("REPLACE")}} | ||
function m(a){k.go(a)}var {window:g=document.defaultView}=void 0===d?{}:d;let k=g.history,l=null;g.addEventListener("popstate",h);g.addEventListener("hashchange",()=>{let [,a]=e();A(a)!==A(t)&&h()});let p="POP",[f,t]=e(),c=y(),a=y();null==f&&(f=0,k.replaceState(Object.assign({},k.state,{idx:f}),null));return{get action(){return p},get location(){return t},createHref:n,push:q,replace:r,go:m,back(){m(-1)},forward(){m(1)},listen(b){return a.push(b)},block(a){let b=c.push(a);1===c.length&&g.addEventListener("beforeunload", | ||
x);return function(){b();c.length||g.removeEventListener("beforeunload",x)}}}}; | ||
var createMemoryHistory=function(d){function e(c,a){a=void 0===a?null:a;return Object.freeze(Object.assign({},p,"string"===typeof c?B(c):c,{state:a,key:z()}))}function h(c,a,b){return!f.length||(f.call({action:c,location:a,retry:b}),!1)}function n(c,a){l=c;p=a;t.call({action:l,location:p})}function w(c,a){var b=e(c,a);if("/"!==b.pathname.charAt(0))throw b=JSON.stringify(c),Error(`Relative pathnames are not supported in memory history.push(${b})`);h("PUSH",b,function(){w(c,a)})&&(k+=1,g.splice(k, | ||
g.length,b),n("PUSH",b))}function v(c,a){var b=e(c,a);if("/"!==b.pathname.charAt(0))throw b=JSON.stringify(c),Error(`Relative pathnames are not supported in memory history.replace(${b})`);h("REPLACE",b,function(){v(c,a)})&&(g[k]=b,n("REPLACE",b))}function q(c){let a=Math.min(Math.max(k+c,0),g.length-1),b=g[a];h("POP",b,function(){q(c)})&&(k=a,n("POP",b))}var {initialEntries:r=["/"],initialIndex:m=0}=void 0===d?{}:d;let g=r.map(c=>{let a=Object.freeze(Object.assign({},{pathname:"/",search:"",hash:"", | ||
state:null,key:z()},"string"===typeof c?B(c):c));if("/"!==a.pathname.charAt(0))throw c=JSON.stringify(c),Error(`Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: ${c})`);return a}),k=Math.min(Math.max(m,0),g.length-1),l="POP",p=g[k],f=y(),t=y();return{get index(){return k},get action(){return l},get location(){return p},createHref:A,push:w,replace:v,go:q,back(){q(-1)},forward(){q(1)},listen(c){return t.push(c)},block(c){return f.push(c)}}};export{createBrowserHistory,createHashHistory,createMemoryHistory}; | ||
//# sourceMappingURL=history.development.js.map |
@@ -1,4 +0,16 @@ | ||
export { default as browserHistory, createHistory as createBrowserHistory } from './browser.js'; | ||
export { default as hashHistory, createHistory as createHashHistory } from './hash.js'; | ||
export { createHistory as createMemoryHistory } from './memory.js'; | ||
import _extends from '@babel/runtime/helpers/esm/extends';var w="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function x(a){a.preventDefault();a.returnValue=""}function y(){var a=[];return{get length(){return a.length},push:function(f){a.push(f);return function(){a=a.filter(function(a){return a!==f})}},call:function(f){a.forEach(function(a){return a&&a(f)})}}}function z(){return Math.random().toString(36).substr(2,8)} | ||
function B(a){var f=a.pathname,h=a.search;a=a.hash;return(void 0===f?"/":f)+(void 0===h?"":h)+(void 0===a?"":a)}function C(a){var f={};if(a){var h=a.indexOf("#");0<=h&&(f.hash=a.substr(h),a=a.substr(0,h));h=a.indexOf("?");0<=h&&(f.search=a.substr(h),a=a.substr(0,h));a&&(f.pathname=a)}return f} | ||
var createBrowserHistory=function(a){function f(){var a=m.location,d=k.state||{};return[d.idx,w({pathname:a.pathname,search:a.search,hash:a.hash,state:d.usr||null,key:d.key||"default"})]}function h(a,d){void 0===d&&(d=null);return w(_extends({},r,{},"string"===typeof a?C(a):a,{state:d,key:z()}))}function t(a){p=a;a=f();n=a[0];r=a[1];c.call({action:p,location:r})}function v(a,d){function c(){v(a,d)}var b=h(a,d);if(!l.length||(l.call({action:"PUSH",location:b,retry:c}),!1)){var A=[{usr:b.state,key:b.key, | ||
idx:n+1},e(b)];b=A[0];A=A[1];try{k.pushState(b,null,A)}catch(D){m.location.assign(A)}t("PUSH")}}function u(a,d){function c(){u(a,d)}var b=h(a,d);l.length&&(l.call({action:"REPLACE",location:b,retry:c}),1)||(b=[{usr:b.state,key:b.key,idx:n},e(b)],k.replaceState(b[0],null,b[1]),t("REPLACE"))}function q(a){k.go(a)}a=(void 0===a?{}:a).window;var m=void 0===a?document.defaultView:a,k=m.history,g=null;m.addEventListener("popstate",function(){if(g)l.call(g),g=null;else{var a=f(),d=a[0];a=a[1];if(l.length)if(null!= | ||
d){var c=n-d;c&&(g={action:"POP",location:a,retry:function(){q(-1*c)}},q(c))}else{if("production"!==process.env.NODE_ENV)throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");}else t("POP")}});var p="POP";a=f();var n=a[0],r=a[1],l=y(),c=y();null==n&& | ||
(n=0,k.replaceState(_extends({},k.state,{idx:n}),null));var e=B;return{get action(){return p},get location(){return r},createHref:e,push:v,replace:u,go:q,back:function(){q(-1)},forward:function(){q(1)},listen:function(a){return c.push(a)},block:function(a){var d=l.push(a);1===l.length&&m.addEventListener("beforeunload",x);return function(){d();l.length||m.removeEventListener("beforeunload",x)}}}}; | ||
var createHashHistory=function(a){function f(){var a=C(g.location.hash.substr(1)),c=a.pathname,b=a.search;a=a.hash;var e=p.state||{};return[e.idx,w({pathname:void 0===c?"/":c,search:void 0===b?"":b,hash:void 0===a?"":a,state:e.usr||null,key:e.key||"default"})]}function h(){if(n)e.call(n),n=null;else{var a=f(),c=a[0];a=a[1];if(e.length)if(null!=c){var b=l-c;b&&(n={action:"POP",location:a,retry:function(){k(-1*b)}},k(b))}else{if("production"!==process.env.NODE_ENV)throw Error("You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."); | ||
}else u("POP")}}function t(a){var c=document.querySelector("base"),b="";c&&c.getAttribute("href")&&(c=g.location.href,b=c.indexOf("#"),b=-1===b?c:c.slice(0,b));return b+"#"+B(a)}function v(a,b){void 0===b&&(b=null);return w(_extends({},c,{},"string"===typeof a?C(a):a,{state:b,key:z()}))}function u(a){r=a;a=f();l=a[0];c=a[1];b.call({action:r,location:c})}function q(a,c){function b(){q(a,c)}var d=v(a,c);if("production"!==process.env.NODE_ENV&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in hash history.push("+ | ||
d+")");if(!e.length||(e.call({action:"PUSH",location:d,retry:b}),!1)){var f=[{usr:d.state,key:d.key,idx:l+1},t(d)];d=f[0];f=f[1];try{p.pushState(d,null,f)}catch(E){g.location.assign(f)}u("PUSH")}}function m(a,c){function b(){m(a,c)}var d=v(a,c);if("production"!==process.env.NODE_ENV&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in hash history.replace("+d+")");e.length&&(e.call({action:"REPLACE",location:d,retry:b}),1)||(d=[{usr:d.state,key:d.key, | ||
idx:l},t(d)],p.replaceState(d[0],null,d[1]),u("REPLACE"))}function k(a){p.go(a)}a=(void 0===a?{}:a).window;var g=void 0===a?document.defaultView:a,p=g.history,n=null;g.addEventListener("popstate",h);g.addEventListener("hashchange",function(){var a=f()[1];B(a)!==B(c)&&h()});var r="POP";a=f();var l=a[0],c=a[1],e=y(),b=y();null==l&&(l=0,p.replaceState(_extends({},p.state,{idx:l}),null));return{get action(){return r},get location(){return c},createHref:t,push:q,replace:m,go:k,back:function(){k(-1)},forward:function(){k(1)}, | ||
listen:function(a){return b.push(a)},block:function(a){var c=e.push(a);1===e.length&&g.addEventListener("beforeunload",x);return function(){c();e.length||g.removeEventListener("beforeunload",x)}}}}; | ||
var createMemoryHistory=function(a){function f(a,e){void 0===e&&(e=null);return w(_extends({},n,{},"string"===typeof a?C(a):a,{state:e,key:z()}))}function h(a,e,b){return!r.length||(r.call({action:a,location:e,retry:b}),!1)}function t(a,e){p=a;n=e;l.call({action:p,location:n})}function v(a,e){var b=f(a,e);if("production"!==process.env.NODE_ENV&&"/"!==b.pathname.charAt(0))throw b=JSON.stringify(a),Error("Relative pathnames are not supported in memory history.push("+b+")");h("PUSH",b,function(){v(a, | ||
e)})&&(g+=1,k.splice(g,k.length,b),t("PUSH",b))}function u(a,e){var b=f(a,e);if("production"!==process.env.NODE_ENV&&"/"!==b.pathname.charAt(0))throw b=JSON.stringify(a),Error("Relative pathnames are not supported in memory history.replace("+b+")");h("REPLACE",b,function(){u(a,e)})&&(k[g]=b,t("REPLACE",b))}function q(a){var c=Math.min(Math.max(g+a,0),k.length-1),b=k[c];h("POP",b,function(){q(a)})&&(g=c,t("POP",b))}var m=void 0===a?{}:a;a=m.initialEntries;m=m.initialIndex;m=void 0===m?0:m;var k=(void 0=== | ||
a?["/"]:a).map(function(a){var c=w(_extends({pathname:"/",search:"",hash:"",state:null,key:z()},"string"===typeof a?C(a):a));if("production"!==process.env.NODE_ENV&&"/"!==c.pathname.charAt(0))throw a=JSON.stringify(a),Error("Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+a+")");return c}),g=Math.min(Math.max(m,0),k.length-1),p="POP",n=k[g],r=y(),l=y();return{get index(){return g},get action(){return p},get location(){return n},createHref:B,push:v, | ||
replace:u,go:q,back:function(){q(-1)},forward:function(){q(1)},listen:function(a){return l.push(a)},block:function(a){return r.push(a)}}};export{createBrowserHistory,createHashHistory,createMemoryHistory}; | ||
//# sourceMappingURL=history.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.HistoryLibrary={})}(this,(function(t){function n(){return(n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e,r=arguments[n];for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter((function(t){return t!==n}))}},call:function(n){t.forEach((function(t){return t&&t(n)}))}}}function r(){return Math.random().toString(36).substr(2,8)}function o(t){var n=t.pathname,e=t.search;return(void 0===n?"/":n)+(void 0===e?"":e)+(void 0===(t=t.hash)?"":t)}function a(t){var n={};if(t){var e=t.indexOf("#");0<=e&&(n.hash=t.substr(e),t=t.substr(0,e)),0<=(e=t.indexOf("?"))&&(n.search=t.substr(e),t=t.substr(0,e)),t&&(n.pathname=t)}return n}function i(t){t.preventDefault(),t.returnValue=""}function u(t){function u(){var t=f.location,n=h.state||{};return[n.idx,{pathname:t.pathname,search:t.search,hash:t.hash,state:n.usr||null,key:n.key||"default"}]}function c(t,e){return void 0===e&&(e=null),n({},y,{},"string"==typeof t?a(t):t,{state:e,key:r()})}function l(t){v=t,t=u(),p=t[0],y=t[1],P.call({action:v,location:y})}function s(t){h.go(t)}var f=void 0===(t=(void 0===t?{}:t).window)?document.defaultView:t,h=f.history,d=null;f.addEventListener("popstate",(function(){if(d)g.call(d),d=null;else{var t=u(),n=t[0];if(t=t[1],g.length){if(null!=n){var e=p-n;e&&(d={action:"POP",location:t,retry:function(){s(-1*e)}},s(e))}}else l("POP")}}));var v="POP",p=(t=u())[0],y=t[1],g=e(),P=e();null==p&&(p=0,h.replaceState(n({},h.state,{idx:p}),null));var b=o;return{get action(){return v},get location(){return y},createHref:b,push:function t(n,e){var r=c(n,e);if(!g.length||(g.call({action:"PUSH",location:r,retry:function(){t(n,e)}}),0)){var o=[{usr:r.state,key:r.key,idx:p+1},b(r)];r=o[0],o=o[1];try{h.pushState(r,null,o)}catch(t){f.location.assign(o)}l("PUSH")}},replace:function t(n,e){var r=c(n,e);g.length&&(g.call({action:"REPLACE",location:r,retry:function(){t(n,e)}}),1)||(r=[{usr:r.state,key:r.key,idx:p},b(r)],h.replaceState(r[0],null,r[1]),l("REPLACE"))},go:s,back:function(){s(-1)},forward:function(){s(1)},listen:function(t){return P.push(t)},block:function(t){var n=g.push(t);return 1===g.length&&f.addEventListener("beforeunload",i),function(){n(),g.length||f.removeEventListener("beforeunload",i)}}}}function c(t){t.preventDefault(),t.returnValue=""}function l(t){function i(){var t=a(d.location.hash.substr(1)),n=t.pathname,e=t.search;t=t.hash;var r=v.state||{};return[r.idx,{pathname:void 0===n?"/":n,search:void 0===e?"":e,hash:void 0===t?"":t,state:r.usr||null,key:r.key||"default"}]}function u(){if(p)b.call(p),p=null;else{var t=i(),n=t[0];if(t=t[1],b.length){if(null!=n){var e=g-n;e&&(p={action:"POP",location:t,retry:function(){h(-1*e)}},h(e))}}else f("POP")}}function l(t){var n=document.querySelector("base"),e="";return n&&n.getAttribute("href")&&(e=-1===(e=(n=d.location.href).indexOf("#"))?n:n.slice(0,e)),e+"#"+o(t)}function s(t,e){return void 0===e&&(e=null),n({},P,{},"string"==typeof t?a(t):t,{state:e,key:r()})}function f(t){y=t,t=i(),g=t[0],P=t[1],k.call({action:y,location:P})}function h(t){v.go(t)}var d=void 0===(t=(void 0===t?{}:t).window)?document.defaultView:t,v=d.history,p=null;d.addEventListener("popstate",u),d.addEventListener("hashchange",(function(t){o(i()[1])!==o(P)&&u()}));var y="POP",g=(t=i())[0],P=t[1],b=e(),k=e();return null==g&&(g=0,v.replaceState(n({},v.state,{idx:g}),null)),{get action(){return y},get location(){return P},createHref:l,push:function t(n,e){var r=s(n,e);if(!b.length||(b.call({action:"PUSH",location:r,retry:function(){t(n,e)}}),0)){var o=[{usr:r.state,key:r.key,idx:g+1},l(r)];r=o[0],o=o[1];try{v.pushState(r,null,o)}catch(t){d.location.assign(o)}f("PUSH")}},replace:function t(n,e){var r=s(n,e);b.length&&(b.call({action:"REPLACE",location:r,retry:function(){t(n,e)}}),1)||(r=[{usr:r.state,key:r.key,idx:g},l(r)],v.replaceState(r[0],null,r[1]),f("REPLACE"))},go:h,back:function(){h(-1)},forward:function(){h(1)},listen:function(t){return k.push(t)},block:function(t){var n=b.push(t);return 1===b.length&&d.addEventListener("beforeunload",c),function(){n(),b.length||d.removeEventListener("beforeunload",c)}}}}var s=u(),f=l();t.browserHistory=s,t.createBrowserHistory=u,t.hashHistory=f,t.createHashHistory=l,t.createMemoryHistory=function(t){function i(t,e){return void 0===e&&(e=null),n({},v,{},"string"==typeof t?a(t):t,{state:e,key:r()})}function u(t,n,e){return!p.length||(p.call({action:t,location:n,retry:e}),!1)}function c(t,n){d=t,v=n,y.call({action:d,location:v})}function l(t){var n=Math.min(Math.max(h+t,0),f.length-1),e=f[n];u("POP",e,(function(){l(t)}))&&(h=n,c("POP",e))}var s=void 0===t?{}:t;t=s.initialEntries,s=void 0===(s=s.initialIndex)?0:s;var f=(void 0===t?["/"]:t).map((function(t){return n({pathname:"/",search:"",hash:"",state:null,key:r()},"string"==typeof t?a(t):t)})),h=Math.min(Math.max(s,0),f.length-1),d="POP",v=f[h],p=e(),y=e();return{get index(){return h},get action(){return d},get location(){return v},createHref:o,push:function t(n,e){var r=i(n,e);u("PUSH",r,(function(){t(n,e)}))&&(h+=1,f.splice(h,f.length,r),c("PUSH",r))},replace:function t(n,e){var r=i(n,e);u("REPLACE",r,(function(){t(n,e)}))&&(f[h]=r,c("REPLACE",r))},go:l,back:function(){l(-1)},forward:function(){l(1)},listen:function(t){return y.push(t)},block:function(t){return p.push(t)}}},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
function t(t){t.preventDefault(),t.returnValue=""}function e(){let t=[];return{get length(){return t.length},push:e=>(t.push(e),function(){t=t.filter(t=>t!==e)}),call(e){t.forEach(t=>t&&t(e))}}}function n(){return Math.random().toString(36).substr(2,8)}function l(t){var{pathname:e="/",search:n="",hash:l=""}=t;return e+n+l}function a(t){let e={};if(t){var n=t.indexOf("#");0<=n&&(e.hash=t.substr(n),t=t.substr(0,n)),0<=(n=t.indexOf("?"))&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}var r=function(r){function i(){let{pathname:t,search:e,hash:n}=s.location,l=f.state||{};return[l.idx,{pathname:t,search:e,hash:n,state:l.usr||null,key:l.key||"default"}]}function o(t,e){return e=void 0===e?null:e,Object.assign({},p,"string"==typeof t?a(t):t,{state:e,key:n()})}function u(t){d=t,[g,p]=i(),P.call({action:d,location:p})}function c(t){f.go(t)}var{window:s=document.defaultView}=void 0===r?{}:r;let f=s.history,h=null;s.addEventListener("popstate",(function(){if(h)y.call(h),h=null;else{let[t,e]=i();if(y.length){if(null!=t){let n=g-t;n&&(h={action:"POP",location:e,retry(){c(-1*n)}},c(n))}}else u("POP")}}));let d="POP",[g,p]=i(),y=e(),P=e();null==g&&(g=0,f.replaceState(Object.assign({},f.state,{idx:g}),null));let b=l;return{get action(){return d},get location(){return p},createHref:b,push:function t(e,n){let l=o(e,n);if(!y.length||(y.call({action:"PUSH",location:l,retry:function(){t(e,n)}}),0)){let[t,e]=[{usr:l.state,key:l.key,idx:g+1},b(l)];try{f.pushState(t,null,e)}catch(a){s.location.assign(e)}u("PUSH")}},replace:function t(e,n){let l=o(e,n);if(!y.length||(y.call({action:"REPLACE",location:l,retry:function(){t(e,n)}}),0)){let[t,e]=[{usr:l.state,key:l.key,idx:g},b(l)];f.replaceState(t,null,e),u("REPLACE")}},go:c,back(){c(-1)},forward(){c(1)},listen:t=>P.push(t),block(e){let n=y.push(e);return 1===y.length&&s.addEventListener("beforeunload",t),function(){n(),y.length||s.removeEventListener("beforeunload",t)}}}},i=function(r){function i(){let{pathname:t="/",search:e="",hash:n=""}=a(h.location.hash.substr(1)),l=d.state||{};return[l.idx,{pathname:t,search:e,hash:n,state:l.usr||null,key:l.key||"default"}]}function o(){if(g)b.call(g),g=null;else{let[t,e]=i();if(b.length){if(null!=t){let n=y-t;n&&(g={action:"POP",location:e,retry(){f(-1*n)}},f(n))}}else s("POP")}}function u(t){var e=document.querySelector("base"),n="";return e&&e.getAttribute("href")&&(n=-1===(n=(e=h.location.href).indexOf("#"))?e:e.slice(0,n)),n+"#"+l(t)}function c(t,e){return e=void 0===e?null:e,Object.assign({},P,"string"==typeof t?a(t):t,{state:e,key:n()})}function s(t){p=t,[y,P]=i(),v.call({action:p,location:P})}function f(t){d.go(t)}var{window:h=document.defaultView}=void 0===r?{}:r;let d=h.history,g=null;h.addEventListener("popstate",o),h.addEventListener("hashchange",()=>{let[,t]=i();l(t)!==l(P)&&o()});let p="POP",[y,P]=i(),b=e(),v=e();return null==y&&(y=0,d.replaceState(Object.assign({},d.state,{idx:y}),null)),{get action(){return p},get location(){return P},createHref:u,push:function t(e,n){let l=c(e,n);if(!b.length||(b.call({action:"PUSH",location:l,retry:function(){t(e,n)}}),0)){let[t,e]=[{usr:l.state,key:l.key,idx:y+1},u(l)];try{d.pushState(t,null,e)}catch(a){h.location.assign(e)}s("PUSH")}},replace:function t(e,n){let l=c(e,n);if(!b.length||(b.call({action:"REPLACE",location:l,retry:function(){t(e,n)}}),0)){let[t,e]=[{usr:l.state,key:l.key,idx:y},u(l)];d.replaceState(t,null,e),s("REPLACE")}},go:f,back(){f(-1)},forward(){f(1)},listen:t=>v.push(t),block(e){let n=b.push(e);return 1===b.length&&h.addEventListener("beforeunload",t),function(){n(),b.length||h.removeEventListener("beforeunload",t)}}}},o=function(t){function r(t,e){return e=void 0===e?null:e,Object.assign({},g,"string"==typeof t?a(t):t,{state:e,key:n()})}function i(t,e,n){return!p.length||(p.call({action:t,location:e,retry:n}),!1)}function o(t,e){d=t,g=e,y.call({action:d,location:g})}function u(t){let e=Math.min(Math.max(h+t,0),f.length-1),n=f[e];i("POP",n,(function(){u(t)}))&&(h=e,o("POP",n))}var{initialEntries:c=["/"],initialIndex:s=0}=void 0===t?{}:t;let f=c.map(t=>Object.assign({},{pathname:"/",search:"",hash:"",state:null,key:n()},"string"==typeof t?a(t):t)),h=Math.min(Math.max(s,0),f.length-1),d="POP",g=f[h],p=e(),y=e();return{get index(){return h},get action(){return d},get location(){return g},createHref:l,push:function t(e,n){let l=r(e,n);i("PUSH",l,(function(){t(e,n)}))&&(h+=1,f.splice(h,f.length,l),o("PUSH",l))},replace:function t(e,n){let l=r(e,n);i("REPLACE",l,(function(){t(e,n)}))&&(f[h]=l,o("REPLACE",l))},go:u,back(){u(-1)},forward(){u(1)},listen:t=>y.push(t),block:t=>p.push(t)}};export{r as createBrowserHistory,i as createHashHistory,o as createMemoryHistory}; | ||
//# sourceMappingURL=history.production.min.js.map |
@@ -1,1 +0,1 @@ | ||
'use strict';module.exports="production"===process.env.NODE_ENV?require("./history.production.min.js"):require("./history.development.js"); | ||
'use strict';module.exports="production"===process.env.NODE_ENV?require("./umd/history.production.min.js"):require("./umd/history.development.js"); |
@@ -1,7 +0,7 @@ | ||
function l(){l=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b],e;for(e in c)Object.prototype.hasOwnProperty.call(c,e)&&(a[e]=c[e])}return a};return l.apply(this,arguments)}function r(){var a=[];return{get length(){return a.length},push:function(b){a.push(b);return function(){a=a.filter(function(a){return a!==b})}},call:function(b){a.forEach(function(a){return a&&a(b)})}}} | ||
function t(a){var b=a.pathname,c=a.search;a=a.hash;return(void 0===b?"/":b)+(void 0===c?"":c)+(void 0===a?"":a)}function u(a){var b={};if(a){var c=a.indexOf("#");0<=c&&(b.hash=a.substr(c),a=a.substr(0,c));c=a.indexOf("?");0<=c&&(b.search=a.substr(c),a=a.substr(0,c));a&&(b.pathname=a)}return b}var y="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a}; | ||
var createHistory=function(a){function b(a,b){void 0===b&&(b=null);return y(l({},m,{},"string"===typeof a?u(a):a,{state:b,key:Math.random().toString(36).substr(2,8)}))}function c(a,b,c){return!p.length||(p.call({action:a,location:b,retry:c}),!1)}function e(a,b){q=a;m=b;v.call({action:q,location:m})}function w(a,k){var d=b(a,k);if("production"!==process.env.NODE_ENV&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in memory history.push("+d+")"); | ||
c("PUSH",d,function(){w(a,k)})&&(f+=1,g.splice(f,g.length,d),e("PUSH",d))}function x(a,k){var d=b(a,k);if("production"!==process.env.NODE_ENV&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in memory history.replace("+d+")");c("REPLACE",d,function(){x(a,k)})&&(g[f]=d,e("REPLACE",d))}function n(a){var b=Math.min(Math.max(f+a,0),g.length-1),d=g[b];c("POP",d,function(){n(a)})&&(f=b,e("POP",d))}var h=void 0===a?{}:a;a=h.initialEntries;h=h.initialIndex; | ||
h=void 0===h?0:h;var g=(void 0===a?["/"]:a).map(function(a){var b=y(l({pathname:"/",search:"",hash:"",state:null,key:Math.random().toString(36).substr(2,8)},"string"===typeof a?u(a):a));if("production"!==process.env.NODE_ENV&&"/"!==b.pathname.charAt(0))throw a=JSON.stringify(a),Error("Relative pathnames are not supported in createHistory({ initialEntries }) (invalid entry: "+a+")");return b}),f=Math.min(Math.max(h,0),g.length-1),q="POP",m=g[f],p=r(),v=r();return{get index(){return f},get action(){return q}, | ||
get location(){return m},createHref:t,push:w,replace:x,go:n,back:function(){n(-1)},forward:function(){n(1)},listen:function(a){return v.push(a)},block:function(a){return p.push(a)}}};export{createHistory}; | ||
function l(){l=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b],e;for(e in c)Object.prototype.hasOwnProperty.call(c,e)&&(a[e]=c[e])}return a};return l.apply(this,arguments)}var r=__DEV__?function(a){return Object.freeze(a)}:function(a){return a};function t(){var a=[];return{get length(){return a.length},push:function(b){a.push(b);return function(){a=a.filter(function(a){return a!==b})}},call:function(b){a.forEach(function(a){return a&&a(b)})}}} | ||
function u(a){var b=a.pathname,c=a.search;a=a.hash;return(void 0===b?"/":b)+(void 0===c?"":c)+(void 0===a?"":a)}function y(a){var b={};if(a){var c=a.indexOf("#");0<=c&&(b.hash=a.substr(c),a=a.substr(0,c));c=a.indexOf("?");0<=c&&(b.search=a.substr(c),a=a.substr(0,c));a&&(b.pathname=a)}return b} | ||
var createMemoryHistory=function(a){function b(a,b){void 0===b&&(b=null);return r(l({},m,{},"string"===typeof a?y(a):a,{state:b,key:Math.random().toString(36).substr(2,8)}))}function c(a,b,c){return!p.length||(p.call({action:a,location:b,retry:c}),!1)}function e(a,b){q=a;m=b;v.call({action:q,location:m})}function w(a,k){var d=b(a,k);if(__DEV__&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in memory history.push("+d+")");c("PUSH",d,function(){w(a, | ||
k)})&&(f+=1,g.splice(f,g.length,d),e("PUSH",d))}function x(a,k){var d=b(a,k);if(__DEV__&&"/"!==d.pathname.charAt(0))throw d=JSON.stringify(a),Error("Relative pathnames are not supported in memory history.replace("+d+")");c("REPLACE",d,function(){x(a,k)})&&(g[f]=d,e("REPLACE",d))}function n(a){var b=Math.min(Math.max(f+a,0),g.length-1),d=g[b];c("POP",d,function(){n(a)})&&(f=b,e("POP",d))}var h=void 0===a?{}:a;a=h.initialEntries;h=h.initialIndex;h=void 0===h?0:h;var g=(void 0===a?["/"]:a).map(function(a){var b= | ||
r(l({pathname:"/",search:"",hash:"",state:null,key:Math.random().toString(36).substr(2,8)},"string"===typeof a?y(a):a));if(__DEV__&&"/"!==b.pathname.charAt(0))throw a=JSON.stringify(a),Error("Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+a+")");return b}),f=Math.min(Math.max(h,0),g.length-1),q="POP",m=g[f],p=t(),v=t();return{get index(){return f},get action(){return q},get location(){return m},createHref:u,push:w,replace:x,go:n,back:function(){n(-1)}, | ||
forward:function(){n(1)},listen:function(a){return v.push(a)},block:function(a){return p.push(a)}}};export{createMemoryHistory}; | ||
//# sourceMappingURL=memory.js.map |
{ | ||
"name": "history", | ||
"version": "5.0.0-beta.2", | ||
"version": "5.0.0-beta.3", | ||
"description": "Manage session history with JavaScript", | ||
@@ -10,13 +10,7 @@ "repository": "ReactTraining/history", | ||
"module": "history.js", | ||
"unpkg": "history.production.min.js", | ||
"unpkg": "umd/history.production.min.js", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@babel/runtime": "^7.1.2", | ||
"loose-envify": "^1.2.0" | ||
"@babel/runtime": "^7.7.6" | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
"loose-envify" | ||
] | ||
}, | ||
"keywords": [ | ||
@@ -23,0 +17,0 @@ "history", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
251756
1
20
179
10
- Removedloose-envify@^1.2.0
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
Updated@babel/runtime@^7.7.6