@tanstack/history
Advanced tools
Comparing version 0.0.1-beta.211 to 0.0.1-beta.212
@@ -118,4 +118,6 @@ /** | ||
} | ||
state.key = createRandomKey(); | ||
return state; | ||
return { | ||
...state, | ||
key: createRandomKey() | ||
}; | ||
} | ||
@@ -122,0 +124,0 @@ |
@@ -114,4 +114,6 @@ /** | ||
} | ||
state.key = createRandomKey(); | ||
return state; | ||
return { | ||
...state, | ||
key: createRandomKey() | ||
}; | ||
} | ||
@@ -118,0 +120,0 @@ |
@@ -11,3 +11,3 @@ { | ||
"name": "packages/history/src/index.ts", | ||
"uid": "4ab1-3" | ||
"uid": "e9bc-3" | ||
} | ||
@@ -20,14 +20,14 @@ ] | ||
"nodeParts": { | ||
"4ab1-3": { | ||
"renderedLength": 8888, | ||
"gzipLength": 2610, | ||
"e9bc-3": { | ||
"renderedLength": 8900, | ||
"gzipLength": 2605, | ||
"brotliLength": 0, | ||
"mainUid": "4ab1-2" | ||
"mainUid": "e9bc-2" | ||
} | ||
}, | ||
"nodeMetas": { | ||
"4ab1-2": { | ||
"e9bc-2": { | ||
"id": "/packages/history/src/index.ts", | ||
"moduleParts": { | ||
"index.production.js": "4ab1-3" | ||
"index.production.js": "e9bc-3" | ||
}, | ||
@@ -34,0 +34,0 @@ "imported": [], |
@@ -120,4 +120,6 @@ /** | ||
} | ||
state.key = createRandomKey(); | ||
return state; | ||
return { | ||
...state, | ||
key: createRandomKey() | ||
}; | ||
} | ||
@@ -124,0 +126,0 @@ |
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TanStackHistory={})}(this,(function(e){"use strict";const t="pushstate",n="popstate",o="beforeunload",r=e=>(e.preventDefault(),e.returnValue=""),i=()=>{removeEventListener(o,r,{capture:!0})};function s(e){let t=e.getLocation(),n=new Set,s=[],h=[];const c=()=>{t=e.getLocation(),n.forEach((e=>e()))},d=()=>{if(s.length)s[0]?.(d,(()=>{s=[],i()}));else for(;h.length;)h.shift()?.()},u=e=>{h.push(e),d()};return{get location(){return t},subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(t,n)=>{n=a(n),u((()=>{e.pushState(t,n,c)}))},replace:(t,n)=>{n=a(n),u((()=>{e.replaceState(t,n,c)}))},go:t=>{u((()=>{e.go(t)}))},back:()=>{u((()=>{e.back()}))},forward:()=>{u((()=>{e.forward()}))},createHref:t=>e.createHref(t),block:e=>(s.push(e),1===s.length&&addEventListener(o,r,{capture:!0}),()=>{s=s.filter((t=>t!==e)),s.length||i()}),flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:c}}function a(e){return e||(e={}),e.key=d(),e}function h(e){const o=e?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),r=e?.createHref??(e=>e);let i=c(o(),window.history.state);let a,h,d=!0;const u=()=>{d=!1,(()=>{a&&(window.history[a.isPush?"pushState":"replaceState"](a.state,"",a.href),a=void 0,h=void 0)})(),d=!0},f=(e,t,n,o)=>{const s=r(t);i=c(s,n),a={href:s,state:n,isPush:a?.isPush||"push"===e},o(),h||(h=Promise.resolve().then((()=>u())))},l=()=>{i=c(o(),window.history.state),y.notify()};var w=window.history.pushState,p=window.history.replaceState;const y=s({getLocation:()=>i,pushState:(e,t,n)=>f("push",e,t,n),replaceState:(e,t,n)=>f("replace",e,t,n),back:()=>window.history.back(),forward:()=>window.history.forward(),go:e=>window.history.go(e),createHref:e=>r(e),flush:u,destroy:()=>{window.history.pushState=w,window.history.replaceState=p,window.removeEventListener(t,l),window.removeEventListener(n,l)}});return window.addEventListener(t,l),window.addEventListener(n,l),window.history.pushState=function(){let e=w.apply(window.history,arguments);return d&&y.notify(),e},window.history.replaceState=function(){let e=p.apply(window.history,arguments);return d&&y.notify(),e},y}function c(e,t){let n=e.indexOf("#"),o=e.indexOf("?");return{href:e,pathname:e.substring(0,n>0?o>0?Math.min(n,o):n:o>0?o:e.length),hash:n>-1?e.substring(n):"",search:o>-1?e.slice(o,-1===n?void 0:n):"",state:t||{}}}function d(){return(Math.random()+1).toString(36).substring(7)}e.createBrowserHistory=h,e.createHashHistory=function(){return h({getHref:()=>window.location.hash.substring(1),createHref:e=>`#${e}`})},e.createMemoryHistory=function(e={initialEntries:["/"]}){const t=e.initialEntries;let n=e.initialIndex??t.length-1,o={key:d()};return s({getLocation:()=>c(t[n],o),pushState:(e,r)=>{o=r,t.push(e),n++},replaceState:(e,r)=>{o=r,t[n]=e},back:()=>{n--},forward:()=>{n=Math.min(n+1,t.length-1)},go:e=>window.history.go(e),createHref:e=>e})},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TanStackHistory={})}(this,(function(e){"use strict";const t="pushstate",n="popstate",o="beforeunload",r=e=>(e.preventDefault(),e.returnValue=""),i=()=>{removeEventListener(o,r,{capture:!0})};function s(e){let t=e.getLocation(),n=new Set,s=[],h=[];const c=()=>{t=e.getLocation(),n.forEach((e=>e()))},d=()=>{if(s.length)s[0]?.(d,(()=>{s=[],i()}));else for(;h.length;)h.shift()?.()},u=e=>{h.push(e),d()};return{get location(){return t},subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(t,n)=>{n=a(n),u((()=>{e.pushState(t,n,c)}))},replace:(t,n)=>{n=a(n),u((()=>{e.replaceState(t,n,c)}))},go:t=>{u((()=>{e.go(t)}))},back:()=>{u((()=>{e.back()}))},forward:()=>{u((()=>{e.forward()}))},createHref:t=>e.createHref(t),block:e=>(s.push(e),1===s.length&&addEventListener(o,r,{capture:!0}),()=>{s=s.filter((t=>t!==e)),s.length||i()}),flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:c}}function a(e){return e||(e={}),{...e,key:d()}}function h(e){const o=e?.getHref??(()=>`${window.location.pathname}${window.location.search}${window.location.hash}`),r=e?.createHref??(e=>e);let i=c(o(),window.history.state);let a,h,d=!0;const u=()=>{d=!1,(()=>{a&&(window.history[a.isPush?"pushState":"replaceState"](a.state,"",a.href),a=void 0,h=void 0)})(),d=!0},f=(e,t,n,o)=>{const s=r(t);i=c(s,n),a={href:s,state:n,isPush:a?.isPush||"push"===e},o(),h||(h=Promise.resolve().then((()=>u())))},l=()=>{i=c(o(),window.history.state),y.notify()};var w=window.history.pushState,p=window.history.replaceState;const y=s({getLocation:()=>i,pushState:(e,t,n)=>f("push",e,t,n),replaceState:(e,t,n)=>f("replace",e,t,n),back:()=>window.history.back(),forward:()=>window.history.forward(),go:e=>window.history.go(e),createHref:e=>r(e),flush:u,destroy:()=>{window.history.pushState=w,window.history.replaceState=p,window.removeEventListener(t,l),window.removeEventListener(n,l)}});return window.addEventListener(t,l),window.addEventListener(n,l),window.history.pushState=function(){let e=w.apply(window.history,arguments);return d&&y.notify(),e},window.history.replaceState=function(){let e=p.apply(window.history,arguments);return d&&y.notify(),e},y}function c(e,t){let n=e.indexOf("#"),o=e.indexOf("?");return{href:e,pathname:e.substring(0,n>0?o>0?Math.min(n,o):n:o>0?o:e.length),hash:n>-1?e.substring(n):"",search:o>-1?e.slice(o,-1===n?void 0:n):"",state:t||{}}}function d(){return(Math.random()+1).toString(36).substring(7)}e.createBrowserHistory=h,e.createHashHistory=function(){return h({getHref:()=>window.location.hash.substring(1),createHref:e=>`#${e}`})},e.createMemoryHistory=function(e={initialEntries:["/"]}){const t=e.initialEntries;let n=e.initialIndex??t.length-1,o={key:d()};return s({getLocation:()=>c(t[n],o),pushState:(e,r)=>{o=r,t.push(e),n++},replaceState:(e,r)=>{o=r,t[n]=e},back:()=>{n--},forward:()=>{n=Math.min(n+1,t.length-1)},go:e=>window.history.go(e),createHref:e=>e})},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.production.js.map |
{ | ||
"name": "@tanstack/history", | ||
"author": "Tanner Linsley", | ||
"version": "0.0.1-beta.211", | ||
"version": "0.0.1-beta.212", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": "tanstack/history", |
@@ -159,4 +159,6 @@ // While the public API was clearly inspired by the "history" npm package, | ||
} | ||
state.key = createRandomKey() | ||
return state | ||
return { | ||
...state, | ||
key: createRandomKey(), | ||
} | ||
} | ||
@@ -163,0 +165,0 @@ |
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
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
258801
1300