Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unseenco/taxi

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unseenco/taxi - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

2

dist/taxi.esm.js

@@ -1,2 +0,2 @@

import t from"@unseenco/e";function e(){return e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},e.apply(this,arguments)}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i=new DOMParser;function o(t){var e=new URL(t,window.location.origin),n=null;return e.hash.length&&(n=t.replace(e.hash,"")),{hasHash:e.hash.length>0,pathname:e.pathname,raw:t,href:n||e.href}}function a(t){"HEAD"===t.parentNode.tagName?document.head.appendChild(c(t)):document.body.appendChild(c(t))}function c(t){for(var e=document.createElement("SCRIPT"),n=0;n<t.attributes.length;n++){var r=t.attributes[n];e.setAttribute(r.nodeName,r.nodeValue)}return t.innerHTML&&(e.innerHTML=t.innerHTML),e}var s=/*#__PURE__*/function(){function t(){this.data=new Map,this.regexCache=new Map}var e=t.prototype;return e.add=function(t,e,n){this.data.has(t)||(this.data.set(t,new Map),this.regexCache.set(t,new RegExp("^"+t+"$"))),this.data.get(t).set(e,n),this.regexCache.set(e,new RegExp("^"+e+"$"))},e.findMatch=function(t,e){for(var n,i=r(this.data);!(n=i()).done;){var o=n.value,a=o[1];if(t.pathname.match(this.regexCache.get(o[0]))){for(var c,s=r(a);!(c=s()).done;){var h=c.value,u=h[1];if(e.pathname.match(this.regexCache.get(h[0])))return u}break}}return null},t}(),h=/*#__PURE__*/function(){function e(t){var e=this;void 0===t&&(t={}),this.isTransitioning=!1,this.currentView=null,this.cache=new Map,this.onClick=function(t){if(!t.metaKey&&!t.ctrlKey){var n=o(t.currentTarget.href);if(e.currentLocation=o(window.location.href),e.currentLocation.href!==n.href||e.currentLocation.hasHash&&!n.hasHash)return t.preventDefault(),void e.navigate(n.raw,t.currentTarget.dataset.taxiTransition||!1,t.currentTarget);e.currentLocation.hasHash||n.hasHash||t.preventDefault()}},this.onPopstate=function(){return window.location.pathname!==e.currentLocation.pathname&&(e.isTransitioning?(window.history.pushState({},"",e.currentLocation.href),!1):void e.navigate(window.location.href,!1,"popstate"))};var n=t.links,r=void 0===n?"a:not([target]):not([href^=\\#]):not([data-taxi-ignore])":n,i=t.views,a=t.transitions,c=void 0===a?{default:l}:a,s=t.reloadJsFilter,h=void 0===s?function(t){return!("__bs_script__"===(null==t?void 0:t.id)||null!=t&&t.src.includes("browser-sync-client.js"))}:s;this.views=void 0===i?{default:f}:i,this.transitions=c,this.defaultView=this.views.default||f,this.defaultTransition=this.transitions.default||l,this.wrapper=document.querySelector("[data-taxi]"),this.reloadJsFilter=h,this.cache=new Map,this.attachEvents(r),this.currentLocation=o(window.location.href),this.cache.set(this.currentLocation.href,this.createCacheEntry(document.cloneNode(!0))),this.currentView=this.cache.get(this.currentLocation.href),this.currentView.view.initialLoad()}var n=e.prototype;return n.setDefaultView=function(t){this.defaultView=this.views[t]},n.setDefaultTransition=function(t){this.defaultTransition=this.transitions[t]},n.addRoute=function(t,e,n){this.router||(this.router=new s),this.router.add(t,e,n)},n.preload=function(t){var e=this;return t=o(t).href,this.cache.has(t)||this.fetch(t).then(function(n){try{return e.cache.set(t,e.createCacheEntry(n)),Promise.resolve()}catch(t){return Promise.reject(t)}}),this},n.navigate=function(t,e,n){var r=this;return void 0===e&&(e=!1),void 0===n&&(n=!1),this.targetLocation=o(t),new Promise(function(t,i){if(r.isTransitioning)i(new Error("A transition is currently in progress"));else{var o=new(r.chooseTransition(e))({wrapper:r.wrapper});r.beforeFetch(r.targetLocation,o,n).then(function(){try{return r.cache.has(r.targetLocation.href)?Promise.resolve(r.afterFetch(r.targetLocation,o,r.cache.get(r.targetLocation.href),n)):Promise.resolve(r.fetch(r.targetLocation.raw).then(function(t){try{return Promise.resolve(r.afterFetch(r.targetLocation,o,r.createCacheEntry(t),n))}catch(t){return Promise.reject(t)}}))}catch(t){return Promise.reject(t)}}).then(function(){t()})}})},n.beforeFetch=function(e,n,r){var i=this;return this.isTransitioning=!0,console.log("NAVIGATE_OUT"),t.emit("NAVIGATE_OUT",{from:this.currentView,trigger:r}),new Promise(function(t){i.currentView.view.leave(n,r).then(function(){"popstate"!==r&&window.history.pushState({},"",e.raw),t()})})},n.afterFetch=function(e,n,r,i){var o=this;return this.cache.has(e.href)||this.cache.set(e.href,r),this.currentLocation=e,console.log("NAVIGATE_IN"),t.emit("NAVIGATE_IN",{from:this.currentView,to:r,trigger:i}),new Promise(function(e){r.view.update(),o.loadScripts(r.scripts),r.view.enter(n,i).then(function(){console.log("NAVIGATE_COMPLETE",o.cache),t.emit("NAVIGATE_COMPLETE",{from:o.currentView,to:r,trigger:i}),o.currentView=r,o.isTransitioning=!1,e()})})},n.loadScripts=function(t){for(var e,n=[].concat(t),i=[].concat(document.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),o=0;o<i.length;o++)for(var s=0;s<n.length;s++)if(i[o].outerHTML===n[s].outerHTML){(e=i[o]).parentNode.replaceChild(c(e),e),n.splice(s,1);break}for(var h,u=r(n);!(h=u()).done;)a(h.value)},n.attachEvents=function(e){t.delegate("click",e,this.onClick),t.on("popstate",window,this.onPopstate)},n.fetch=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return new Promise(function(e){fetch(t,{mode:"same-origin",method:"GET",headers:{"X-Requested-With":"Taxi"},credentials:"same-origin"}).then(function(e){return e.ok||(console.warn("Taxi encountered a non 2xx HTTP status code"),window.location.href=t),e.text()}).then(function(t){var n;e("string"==typeof(n=t)?i.parseFromString(n,"text/html"):n)}).catch(function(e){console.warn(e),window.location.href=t})})}),n.chooseTransition=function(t){var e;if(t)return this.transitions[t];var n=null==(e=this.router)?void 0:e.findMatch(this.currentLocation,this.targetLocation);return n?this.transitions[n]:this.defaultTransition},n.createCacheEntry=function(t){var e=t.querySelector("[data-taxi-view]"),n=e.dataset.taxiView.length?this.views[e.dataset.taxiView]:this.defaultView;return{page:t,content:e,scripts:[].concat(t.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),title:t.title,view:new n({wrapper:this.wrapper,title:t.title,content:e,page:t})}},e}(),u={__proto__:null,default:h},f=/*#__PURE__*/function(){function t(t){var e=t.page,n=t.title,r=t.wrapper;this.content=t.content,this.page=e,this.title=n,this.wrapper=r}var e=t.prototype;return e.onEnter=function(){},e.onEnterCompleted=function(){},e.onLeave=function(){},e.onLeaveCompleted=function(){},e.initialLoad=function(){this.onEnter(),this.onEnterCompleted()},e.update=function(){document.title=this.title,this.wrapper.insertAdjacentHTML("beforeend",this.content.outerHTML)},e.remove=function(){this.wrapper.firstElementChild.remove()},e.enter=function(t,e){var n=this;return new Promise(function(r){n.onEnter(),t.enter({trigger:e,to:n.content}).then(function(){n.onEnterCompleted(),r()})})},e.leave=function(t,e){var n=this;return new Promise(function(r){n.onLeave(),t.leave({trigger:e,from:n.content}).then(function(){n.remove(),n.onLeaveCompleted(),r()})})},t}(),l=/*#__PURE__*/function(){function t(t){this.wrapper=t.wrapper}var n=t.prototype;return n.leave=function(t){var n=this;return new Promise(function(r){n.onLeave(e({},t,{done:r}))})},n.enter=function(t){var n=this;return new Promise(function(r){n.onEnter(e({},t,{done:r}))})},n.onLeave=function(t){(0,t.done)()},n.onEnter=function(t){(0,t.done)()},t}();export{u as Taxi,l as Transition,f as View};
import t from"@unseenco/e";function e(){return e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},e.apply(this,arguments)}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i=new DOMParser;function o(t){var e=new URL(t,window.location.origin),n=null;return e.hash.length&&(n=t.replace(e.hash,"")),{hasHash:e.hash.length>0,pathname:e.pathname,raw:t,href:n||e.href}}function a(t){"HEAD"===t.parentNode.tagName?document.head.appendChild(c(t)):document.body.appendChild(c(t))}function c(t){for(var e=document.createElement("SCRIPT"),n=0;n<t.attributes.length;n++){var r=t.attributes[n];e.setAttribute(r.nodeName,r.nodeValue)}return t.innerHTML&&(e.innerHTML=t.innerHTML),e}var s=/*#__PURE__*/function(){function t(){this.data=new Map,this.regexCache=new Map}var e=t.prototype;return e.add=function(t,e,n){this.data.has(t)||(this.data.set(t,new Map),this.regexCache.set(t,new RegExp("^"+t+"$"))),this.data.get(t).set(e,n),this.regexCache.set(e,new RegExp("^"+e+"$"))},e.findMatch=function(t,e){for(var n,i=r(this.data);!(n=i()).done;){var o=n.value,a=o[1];if(t.pathname.match(this.regexCache.get(o[0]))){for(var c,s=r(a);!(c=s()).done;){var h=c.value,u=h[1];if(e.pathname.match(this.regexCache.get(h[0])))return u}break}}return null},t}(),h=/*#__PURE__*/function(){function e(t){var e=this;void 0===t&&(t={}),this.isTransitioning=!1,this.currentView=null,this.cache=new Map,this.onClick=function(t){if(!t.metaKey&&!t.ctrlKey){var n=o(t.currentTarget.href);if(e.currentLocation=o(window.location.href),e.currentLocation.href!==n.href||e.currentLocation.hasHash&&!n.hasHash)return t.preventDefault(),void e.navigate(n.raw,t.currentTarget.dataset.taxiTransition||!1,t.currentTarget);e.currentLocation.hasHash||n.hasHash||t.preventDefault()}},this.onPopstate=function(){return window.location.pathname!==e.currentLocation.pathname&&(e.isTransitioning?(window.history.pushState({},"",e.currentLocation.href),!1):void e.navigate(window.location.href,!1,"popstate"))};var n=t.links,r=void 0===n?"a:not([target]):not([href^=\\#]):not([data-taxi-ignore])":n,i=t.views,a=t.transitions,c=void 0===a?{default:f}:a,s=t.reloadJsFilter,h=void 0===s?function(t){return!("__bs_script__"===(null==t?void 0:t.id)||null!=t&&t.src.includes("browser-sync-client.js"))}:s;this.views=void 0===i?{default:l}:i,this.transitions=c,this.defaultView=this.views.default||l,this.defaultTransition=this.transitions.default||f,this.wrapper=document.querySelector("[data-taxi]"),this.reloadJsFilter=h,this.cache=new Map,this.attachEvents(r),this.currentLocation=o(window.location.href),this.cache.set(this.currentLocation.href,this.createCacheEntry(document.cloneNode(!0))),this.currentView=this.cache.get(this.currentLocation.href),this.currentView.view.initialLoad()}var n=e.prototype;return n.setDefaultView=function(t){this.defaultView=this.views[t]},n.setDefaultTransition=function(t){this.defaultTransition=this.transitions[t]},n.addRoute=function(t,e,n){this.router||(this.router=new s),this.router.add(t,e,n)},n.preload=function(t){var e=this;return t=o(t).href,this.cache.has(t)||this.fetch(t).then(function(n){try{return e.cache.set(t,e.createCacheEntry(n)),Promise.resolve()}catch(t){return Promise.reject(t)}}),this},n.navigate=function(t,e,n){var r=this;return void 0===e&&(e=!1),void 0===n&&(n=!1),this.targetLocation=o(t),new Promise(function(t,i){if(r.isTransitioning)i(new Error("A transition is currently in progress"));else{var o=new(r.chooseTransition(e))({wrapper:r.wrapper});r.beforeFetch(r.targetLocation,o,n).then(function(){try{return r.cache.has(r.targetLocation.href)?Promise.resolve(r.afterFetch(r.targetLocation,o,r.cache.get(r.targetLocation.href),n)):Promise.resolve(r.fetch(r.targetLocation.raw).then(function(t){try{return Promise.resolve(r.afterFetch(r.targetLocation,o,r.createCacheEntry(t),n))}catch(t){return Promise.reject(t)}}))}catch(t){return Promise.reject(t)}}).then(function(){t()})}})},n.beforeFetch=function(e,n,r){var i=this;return this.isTransitioning=!0,console.log("NAVIGATE_OUT"),t.emit("NAVIGATE_OUT",{from:this.currentView,trigger:r}),new Promise(function(t){i.currentView.view.leave(n,r).then(function(){"popstate"!==r&&window.history.pushState({},"",e.raw),t()})})},n.afterFetch=function(e,n,r,i){var o=this;return this.cache.has(e.href)||this.cache.set(e.href,r),this.currentLocation=e,console.log("NAVIGATE_IN"),t.emit("NAVIGATE_IN",{from:this.currentView,to:r,trigger:i}),new Promise(function(e){r.view.update(),o.loadScripts(r.scripts),r.view.enter(n,i).then(function(){console.log("NAVIGATE_COMPLETE",o.cache),t.emit("NAVIGATE_COMPLETE",{from:o.currentView,to:r,trigger:i}),o.currentView=r,o.isTransitioning=!1,e()})})},n.loadScripts=function(t){for(var e,n=[].concat(t),i=[].concat(document.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),o=0;o<i.length;o++)for(var s=0;s<n.length;s++)if(i[o].outerHTML===n[s].outerHTML){(e=i[o]).parentNode.replaceChild(c(e),e),n.splice(s,1);break}for(var h,u=r(n);!(h=u()).done;)a(h.value)},n.attachEvents=function(e){t.delegate("click",e,this.onClick),t.on("popstate",window,this.onPopstate)},n.fetch=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return new Promise(function(e){fetch(t,{mode:"same-origin",method:"GET",headers:{"X-Requested-With":"Taxi"},credentials:"same-origin"}).then(function(e){return e.ok||(console.warn("Taxi encountered a non 2xx HTTP status code"),window.location.href=t),e.text()}).then(function(t){var n;e("string"==typeof(n=t)?i.parseFromString(n,"text/html"):n)}).catch(function(e){console.warn(e),window.location.href=t})})}),n.chooseTransition=function(t){var e;if(t)return this.transitions[t];var n=null==(e=this.router)?void 0:e.findMatch(this.currentLocation,this.targetLocation);return n?this.transitions[n]:this.defaultTransition},n.createCacheEntry=function(t){var e=t.querySelector("[data-taxi-view]"),n=e.dataset.taxiView.length?this.views[e.dataset.taxiView]:this.defaultView;return{page:t,content:e,scripts:[].concat(t.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),title:t.title,view:new n({wrapper:this.wrapper,title:t.title,content:e,page:t})}},e}(),u={__proto__:null,default:h},f=/*#__PURE__*/function(){function t(t){this.wrapper=t.wrapper}var n=t.prototype;return n.leave=function(t){var n=this;return new Promise(function(r){n.onLeave(e({},t,{done:r}))})},n.enter=function(t){var n=this;return new Promise(function(r){n.onEnter(e({},t,{done:r}))})},n.onLeave=function(t){(0,t.done)()},n.onEnter=function(t){(0,t.done)()},t}(),l=/*#__PURE__*/function(){function t(t){var e=t.page,n=t.title,r=t.wrapper;this.content=t.content,this.page=e,this.title=n,this.wrapper=r}var e=t.prototype;return e.onEnter=function(){},e.onEnterCompleted=function(){},e.onLeave=function(){},e.onLeaveCompleted=function(){},e.initialLoad=function(){this.onEnter(),this.onEnterCompleted()},e.update=function(){document.title=this.title,this.wrapper.insertAdjacentHTML("beforeend",this.content.outerHTML)},e.remove=function(){this.wrapper.firstElementChild.remove()},e.enter=function(t,e){var n=this;return new Promise(function(r){n.onEnter(),t.enter({trigger:e,to:n.content}).then(function(){n.onEnterCompleted(),r()})})},e.leave=function(t,e){var n=this;return new Promise(function(r){n.onLeave(),t.leave({trigger:e,from:n.content}).then(function(){n.remove(),n.onLeaveCompleted(),r()})})},t}();export{u as Taxi,f as Transition,l as View};
//# sourceMappingURL=taxi.esm.js.map

@@ -1,2 +0,2 @@

function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e=/*#__PURE__*/t(require("@unseenco/e"));function n(){return n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n.apply(this,arguments)}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o=new DOMParser;function a(t){var e=new URL(t,window.location.origin),n=null;return e.hash.length&&(n=t.replace(e.hash,"")),{hasHash:e.hash.length>0,pathname:e.pathname,raw:t,href:n||e.href}}function c(t){"HEAD"===t.parentNode.tagName?document.head.appendChild(s(t)):document.body.appendChild(s(t))}function s(t){for(var e=document.createElement("SCRIPT"),n=0;n<t.attributes.length;n++){var r=t.attributes[n];e.setAttribute(r.nodeName,r.nodeValue)}return t.innerHTML&&(e.innerHTML=t.innerHTML),e}var h=/*#__PURE__*/function(){function t(){this.data=new Map,this.regexCache=new Map}var e=t.prototype;return e.add=function(t,e,n){this.data.has(t)||(this.data.set(t,new Map),this.regexCache.set(t,new RegExp("^"+t+"$"))),this.data.get(t).set(e,n),this.regexCache.set(e,new RegExp("^"+e+"$"))},e.findMatch=function(t,e){for(var n,r=i(this.data);!(n=r()).done;){var o=n.value,a=o[1];if(t.pathname.match(this.regexCache.get(o[0]))){for(var c,s=i(a);!(c=s()).done;){var h=c.value,u=h[1];if(e.pathname.match(this.regexCache.get(h[0])))return u}break}}return null},t}(),u=/*#__PURE__*/function(){function t(t){var e=this;void 0===t&&(t={}),this.isTransitioning=!1,this.currentView=null,this.cache=new Map,this.onClick=function(t){if(!t.metaKey&&!t.ctrlKey){var n=a(t.currentTarget.href);if(e.currentLocation=a(window.location.href),e.currentLocation.href!==n.href||e.currentLocation.hasHash&&!n.hasHash)return t.preventDefault(),void e.navigate(n.raw,t.currentTarget.dataset.taxiTransition||!1,t.currentTarget);e.currentLocation.hasHash||n.hasHash||t.preventDefault()}},this.onPopstate=function(){return window.location.pathname!==e.currentLocation.pathname&&(e.isTransitioning?(window.history.pushState({},"",e.currentLocation.href),!1):void e.navigate(window.location.href,!1,"popstate"))};var n=t.links,r=void 0===n?"a:not([target]):not([href^=\\#]):not([data-taxi-ignore])":n,i=t.views,o=t.transitions,c=void 0===o?{default:d}:o,s=t.reloadJsFilter,h=void 0===s?function(t){return!("__bs_script__"===(null==t?void 0:t.id)||null!=t&&t.src.includes("browser-sync-client.js"))}:s;this.views=void 0===i?{default:l}:i,this.transitions=c,this.defaultView=this.views.default||l,this.defaultTransition=this.transitions.default||d,this.wrapper=document.querySelector("[data-taxi]"),this.reloadJsFilter=h,this.cache=new Map,this.attachEvents(r),this.currentLocation=a(window.location.href),this.cache.set(this.currentLocation.href,this.createCacheEntry(document.cloneNode(!0))),this.currentView=this.cache.get(this.currentLocation.href),this.currentView.view.initialLoad()}var n=t.prototype;return n.setDefaultView=function(t){this.defaultView=this.views[t]},n.setDefaultTransition=function(t){this.defaultTransition=this.transitions[t]},n.addRoute=function(t,e,n){this.router||(this.router=new h),this.router.add(t,e,n)},n.preload=function(t){var e=this;return t=a(t).href,this.cache.has(t)||this.fetch(t).then(function(n){try{return e.cache.set(t,e.createCacheEntry(n)),Promise.resolve()}catch(t){return Promise.reject(t)}}),this},n.navigate=function(t,e,n){var r=this;return void 0===e&&(e=!1),void 0===n&&(n=!1),this.targetLocation=a(t),new Promise(function(t,i){if(r.isTransitioning)i(new Error("A transition is currently in progress"));else{var o=new(r.chooseTransition(e))({wrapper:r.wrapper});r.beforeFetch(r.targetLocation,o,n).then(function(){try{return r.cache.has(r.targetLocation.href)?Promise.resolve(r.afterFetch(r.targetLocation,o,r.cache.get(r.targetLocation.href),n)):Promise.resolve(r.fetch(r.targetLocation.raw).then(function(t){try{return Promise.resolve(r.afterFetch(r.targetLocation,o,r.createCacheEntry(t),n))}catch(t){return Promise.reject(t)}}))}catch(t){return Promise.reject(t)}}).then(function(){t()})}})},n.beforeFetch=function(t,n,r){var i=this;return this.isTransitioning=!0,console.log("NAVIGATE_OUT"),e.default.emit("NAVIGATE_OUT",{from:this.currentView,trigger:r}),new Promise(function(e){i.currentView.view.leave(n,r).then(function(){"popstate"!==r&&window.history.pushState({},"",t.raw),e()})})},n.afterFetch=function(t,n,r,i){var o=this;return this.cache.has(t.href)||this.cache.set(t.href,r),this.currentLocation=t,console.log("NAVIGATE_IN"),e.default.emit("NAVIGATE_IN",{from:this.currentView,to:r,trigger:i}),new Promise(function(t){r.view.update(),o.loadScripts(r.scripts),r.view.enter(n,i).then(function(){console.log("NAVIGATE_COMPLETE",o.cache),e.default.emit("NAVIGATE_COMPLETE",{from:o.currentView,to:r,trigger:i}),o.currentView=r,o.isTransitioning=!1,t()})})},n.loadScripts=function(t){for(var e,n=[].concat(t),r=[].concat(document.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),o=0;o<r.length;o++)for(var a=0;a<n.length;a++)if(r[o].outerHTML===n[a].outerHTML){(e=r[o]).parentNode.replaceChild(s(e),e),n.splice(a,1);break}for(var h,u=i(n);!(h=u()).done;)c(h.value)},n.attachEvents=function(t){e.default.delegate("click",t,this.onClick),e.default.on("popstate",window,this.onPopstate)},n.fetch=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return new Promise(function(e){fetch(t,{mode:"same-origin",method:"GET",headers:{"X-Requested-With":"Taxi"},credentials:"same-origin"}).then(function(e){return e.ok||(console.warn("Taxi encountered a non 2xx HTTP status code"),window.location.href=t),e.text()}).then(function(t){var n;e("string"==typeof(n=t)?o.parseFromString(n,"text/html"):n)}).catch(function(e){console.warn(e),window.location.href=t})})}),n.chooseTransition=function(t){var e;if(t)return this.transitions[t];var n=null==(e=this.router)?void 0:e.findMatch(this.currentLocation,this.targetLocation);return n?this.transitions[n]:this.defaultTransition},n.createCacheEntry=function(t){var e=t.querySelector("[data-taxi-view]"),n=e.dataset.taxiView.length?this.views[e.dataset.taxiView]:this.defaultView;return{page:t,content:e,scripts:[].concat(t.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),title:t.title,view:new n({wrapper:this.wrapper,title:t.title,content:e,page:t})}},t}(),f={__proto__:null,default:u},l=/*#__PURE__*/function(){function t(t){var e=t.page,n=t.title,r=t.wrapper;this.content=t.content,this.page=e,this.title=n,this.wrapper=r}var e=t.prototype;return e.onEnter=function(){},e.onEnterCompleted=function(){},e.onLeave=function(){},e.onLeaveCompleted=function(){},e.initialLoad=function(){this.onEnter(),this.onEnterCompleted()},e.update=function(){document.title=this.title,this.wrapper.insertAdjacentHTML("beforeend",this.content.outerHTML)},e.remove=function(){this.wrapper.firstElementChild.remove()},e.enter=function(t,e){var n=this;return new Promise(function(r){n.onEnter(),t.enter({trigger:e,to:n.content}).then(function(){n.onEnterCompleted(),r()})})},e.leave=function(t,e){var n=this;return new Promise(function(r){n.onLeave(),t.leave({trigger:e,from:n.content}).then(function(){n.remove(),n.onLeaveCompleted(),r()})})},t}(),d=/*#__PURE__*/function(){function t(t){this.wrapper=t.wrapper}var e=t.prototype;return e.leave=function(t){var e=this;return new Promise(function(r){e.onLeave(n({},t,{done:r}))})},e.enter=function(t){var e=this;return new Promise(function(r){e.onEnter(n({},t,{done:r}))})},e.onLeave=function(t){(0,t.done)()},e.onEnter=function(t){(0,t.done)()},t}();exports.Taxi=f,exports.Transition=d,exports.View=l;
function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e=/*#__PURE__*/t(require("@unseenco/e"));function n(){return n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n.apply(this,arguments)}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o=new DOMParser;function a(t){var e=new URL(t,window.location.origin),n=null;return e.hash.length&&(n=t.replace(e.hash,"")),{hasHash:e.hash.length>0,pathname:e.pathname,raw:t,href:n||e.href}}function c(t){"HEAD"===t.parentNode.tagName?document.head.appendChild(s(t)):document.body.appendChild(s(t))}function s(t){for(var e=document.createElement("SCRIPT"),n=0;n<t.attributes.length;n++){var r=t.attributes[n];e.setAttribute(r.nodeName,r.nodeValue)}return t.innerHTML&&(e.innerHTML=t.innerHTML),e}var h=/*#__PURE__*/function(){function t(){this.data=new Map,this.regexCache=new Map}var e=t.prototype;return e.add=function(t,e,n){this.data.has(t)||(this.data.set(t,new Map),this.regexCache.set(t,new RegExp("^"+t+"$"))),this.data.get(t).set(e,n),this.regexCache.set(e,new RegExp("^"+e+"$"))},e.findMatch=function(t,e){for(var n,r=i(this.data);!(n=r()).done;){var o=n.value,a=o[1];if(t.pathname.match(this.regexCache.get(o[0]))){for(var c,s=i(a);!(c=s()).done;){var h=c.value,u=h[1];if(e.pathname.match(this.regexCache.get(h[0])))return u}break}}return null},t}(),u=/*#__PURE__*/function(){function t(t){var e=this;void 0===t&&(t={}),this.isTransitioning=!1,this.currentView=null,this.cache=new Map,this.onClick=function(t){if(!t.metaKey&&!t.ctrlKey){var n=a(t.currentTarget.href);if(e.currentLocation=a(window.location.href),e.currentLocation.href!==n.href||e.currentLocation.hasHash&&!n.hasHash)return t.preventDefault(),void e.navigate(n.raw,t.currentTarget.dataset.taxiTransition||!1,t.currentTarget);e.currentLocation.hasHash||n.hasHash||t.preventDefault()}},this.onPopstate=function(){return window.location.pathname!==e.currentLocation.pathname&&(e.isTransitioning?(window.history.pushState({},"",e.currentLocation.href),!1):void e.navigate(window.location.href,!1,"popstate"))};var n=t.links,r=void 0===n?"a:not([target]):not([href^=\\#]):not([data-taxi-ignore])":n,i=t.views,o=t.transitions,c=void 0===o?{default:l}:o,s=t.reloadJsFilter,h=void 0===s?function(t){return!("__bs_script__"===(null==t?void 0:t.id)||null!=t&&t.src.includes("browser-sync-client.js"))}:s;this.views=void 0===i?{default:d}:i,this.transitions=c,this.defaultView=this.views.default||d,this.defaultTransition=this.transitions.default||l,this.wrapper=document.querySelector("[data-taxi]"),this.reloadJsFilter=h,this.cache=new Map,this.attachEvents(r),this.currentLocation=a(window.location.href),this.cache.set(this.currentLocation.href,this.createCacheEntry(document.cloneNode(!0))),this.currentView=this.cache.get(this.currentLocation.href),this.currentView.view.initialLoad()}var n=t.prototype;return n.setDefaultView=function(t){this.defaultView=this.views[t]},n.setDefaultTransition=function(t){this.defaultTransition=this.transitions[t]},n.addRoute=function(t,e,n){this.router||(this.router=new h),this.router.add(t,e,n)},n.preload=function(t){var e=this;return t=a(t).href,this.cache.has(t)||this.fetch(t).then(function(n){try{return e.cache.set(t,e.createCacheEntry(n)),Promise.resolve()}catch(t){return Promise.reject(t)}}),this},n.navigate=function(t,e,n){var r=this;return void 0===e&&(e=!1),void 0===n&&(n=!1),this.targetLocation=a(t),new Promise(function(t,i){if(r.isTransitioning)i(new Error("A transition is currently in progress"));else{var o=new(r.chooseTransition(e))({wrapper:r.wrapper});r.beforeFetch(r.targetLocation,o,n).then(function(){try{return r.cache.has(r.targetLocation.href)?Promise.resolve(r.afterFetch(r.targetLocation,o,r.cache.get(r.targetLocation.href),n)):Promise.resolve(r.fetch(r.targetLocation.raw).then(function(t){try{return Promise.resolve(r.afterFetch(r.targetLocation,o,r.createCacheEntry(t),n))}catch(t){return Promise.reject(t)}}))}catch(t){return Promise.reject(t)}}).then(function(){t()})}})},n.beforeFetch=function(t,n,r){var i=this;return this.isTransitioning=!0,console.log("NAVIGATE_OUT"),e.default.emit("NAVIGATE_OUT",{from:this.currentView,trigger:r}),new Promise(function(e){i.currentView.view.leave(n,r).then(function(){"popstate"!==r&&window.history.pushState({},"",t.raw),e()})})},n.afterFetch=function(t,n,r,i){var o=this;return this.cache.has(t.href)||this.cache.set(t.href,r),this.currentLocation=t,console.log("NAVIGATE_IN"),e.default.emit("NAVIGATE_IN",{from:this.currentView,to:r,trigger:i}),new Promise(function(t){r.view.update(),o.loadScripts(r.scripts),r.view.enter(n,i).then(function(){console.log("NAVIGATE_COMPLETE",o.cache),e.default.emit("NAVIGATE_COMPLETE",{from:o.currentView,to:r,trigger:i}),o.currentView=r,o.isTransitioning=!1,t()})})},n.loadScripts=function(t){for(var e,n=[].concat(t),r=[].concat(document.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),o=0;o<r.length;o++)for(var a=0;a<n.length;a++)if(r[o].outerHTML===n[a].outerHTML){(e=r[o]).parentNode.replaceChild(s(e),e),n.splice(a,1);break}for(var h,u=i(n);!(h=u()).done;)c(h.value)},n.attachEvents=function(t){e.default.delegate("click",t,this.onClick),e.default.on("popstate",window,this.onPopstate)},n.fetch=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return new Promise(function(e){fetch(t,{mode:"same-origin",method:"GET",headers:{"X-Requested-With":"Taxi"},credentials:"same-origin"}).then(function(e){return e.ok||(console.warn("Taxi encountered a non 2xx HTTP status code"),window.location.href=t),e.text()}).then(function(t){var n;e("string"==typeof(n=t)?o.parseFromString(n,"text/html"):n)}).catch(function(e){console.warn(e),window.location.href=t})})}),n.chooseTransition=function(t){var e;if(t)return this.transitions[t];var n=null==(e=this.router)?void 0:e.findMatch(this.currentLocation,this.targetLocation);return n?this.transitions[n]:this.defaultTransition},n.createCacheEntry=function(t){var e=t.querySelector("[data-taxi-view]"),n=e.dataset.taxiView.length?this.views[e.dataset.taxiView]:this.defaultView;return{page:t,content:e,scripts:[].concat(t.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),title:t.title,view:new n({wrapper:this.wrapper,title:t.title,content:e,page:t})}},t}(),f={__proto__:null,default:u},l=/*#__PURE__*/function(){function t(t){this.wrapper=t.wrapper}var e=t.prototype;return e.leave=function(t){var e=this;return new Promise(function(r){e.onLeave(n({},t,{done:r}))})},e.enter=function(t){var e=this;return new Promise(function(r){e.onEnter(n({},t,{done:r}))})},e.onLeave=function(t){(0,t.done)()},e.onEnter=function(t){(0,t.done)()},t}(),d=/*#__PURE__*/function(){function t(t){var e=t.page,n=t.title,r=t.wrapper;this.content=t.content,this.page=e,this.title=n,this.wrapper=r}var e=t.prototype;return e.onEnter=function(){},e.onEnterCompleted=function(){},e.onLeave=function(){},e.onLeaveCompleted=function(){},e.initialLoad=function(){this.onEnter(),this.onEnterCompleted()},e.update=function(){document.title=this.title,this.wrapper.insertAdjacentHTML("beforeend",this.content.outerHTML)},e.remove=function(){this.wrapper.firstElementChild.remove()},e.enter=function(t,e){var n=this;return new Promise(function(r){n.onEnter(),t.enter({trigger:e,to:n.content}).then(function(){n.onEnterCompleted(),r()})})},e.leave=function(t,e){var n=this;return new Promise(function(r){n.onLeave(),t.leave({trigger:e,from:n.content}).then(function(){n.remove(),n.onLeaveCompleted(),r()})})},t}();exports.Taxi=f,exports.Transition=l,exports.View=d;
//# sourceMappingURL=taxi.js.map

@@ -1,2 +0,2 @@

import t from"@unseenco/e";const e=new DOMParser;function n(t){const e=new URL(t,window.location.origin);let n=null;return e.hash.length&&(n=t.replace(e.hash,"")),{hasHash:e.hash.length>0,pathname:e.pathname,raw:t,href:n||e.href}}function r(t){"HEAD"===t.parentNode.tagName?document.head.appendChild(i(t)):document.body.appendChild(i(t))}function i(t){const e=document.createElement("SCRIPT");for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n];e.setAttribute(r.nodeName,r.nodeValue)}return t.innerHTML&&(e.innerHTML=t.innerHTML),e}class a{constructor(){this.data=new Map,this.regexCache=new Map}add(t,e,n){this.data.has(t)||(this.data.set(t,new Map),this.regexCache.set(t,new RegExp(`^${t}$`))),this.data.get(t).set(e,n),this.regexCache.set(e,new RegExp(`^${e}$`))}findMatch(t,e){for(const[n,r]of this.data)if(t.pathname.match(this.regexCache.get(n))){for(const[t,n]of r)if(e.pathname.match(this.regexCache.get(t)))return n;break}return null}}var o={__proto__:null,default:class{constructor(t={}){this.isTransitioning=!1,this.currentView=null,this.cache=new Map,this.onClick=t=>{if(!t.metaKey&&!t.ctrlKey){const e=n(t.currentTarget.href);if(this.currentLocation=n(window.location.href),this.currentLocation.href!==e.href||this.currentLocation.hasHash&&!e.hasHash)return t.preventDefault(),void this.navigate(e.raw,t.currentTarget.dataset.taxiTransition||!1,t.currentTarget);this.currentLocation.hasHash||e.hasHash||t.preventDefault()}},this.onPopstate=()=>window.location.pathname!==this.currentLocation.pathname&&(this.isTransitioning?(window.history.pushState({},"",this.currentLocation.href),!1):void this.navigate(window.location.href,!1,"popstate"));const{links:e="a:not([target]):not([href^=\\#]):not([data-taxi-ignore])",views:r={default:s},transitions:i={default:c},reloadJsFilter:a=function(t){return!("__bs_script__"===(null==t?void 0:t.id)||null!=t&&t.src.includes("browser-sync-client.js"))}}=t;this.views=r,this.transitions=i,this.defaultView=this.views.default||s,this.defaultTransition=this.transitions.default||c,this.wrapper=document.querySelector("[data-taxi]"),this.reloadJsFilter=a,this.cache=new Map,this.attachEvents(e),this.currentLocation=n(window.location.href),this.cache.set(this.currentLocation.href,this.createCacheEntry(document.cloneNode(!0))),this.currentView=this.cache.get(this.currentLocation.href),this.currentView.view.initialLoad()}setDefaultView(t){this.defaultView=this.views[t]}setDefaultTransition(t){this.defaultTransition=this.transitions[t]}addRoute(t,e,n){this.router||(this.router=new a),this.router.add(t,e,n)}preload(t){var e=this;return t=n(t).href,this.cache.has(t)||this.fetch(t).then(async function(n){e.cache.set(t,e.createCacheEntry(n))}),this}navigate(t,e=!1,r=!1){var i=this;return this.targetLocation=n(t),new Promise((t,n)=>{if(this.isTransitioning)return void n(new Error("A transition is currently in progress"));const a=new(this.chooseTransition(e))({wrapper:this.wrapper});this.beforeFetch(this.targetLocation,a,r).then(async function(){return i.cache.has(i.targetLocation.href)?await i.afterFetch(i.targetLocation,a,i.cache.get(i.targetLocation.href),r):i.fetch(i.targetLocation.raw).then(async function(t){return await i.afterFetch(i.targetLocation,a,i.createCacheEntry(t),r)})}).then(()=>{t()})})}beforeFetch(e,n,r){return this.isTransitioning=!0,console.log("NAVIGATE_OUT"),t.emit("NAVIGATE_OUT",{from:this.currentView,trigger:r}),new Promise(t=>{this.currentView.view.leave(n,r).then(()=>{"popstate"!==r&&window.history.pushState({},"",e.raw),t()})})}afterFetch(e,n,r,i){return this.cache.has(e.href)||this.cache.set(e.href,r),this.currentLocation=e,console.log("NAVIGATE_IN"),t.emit("NAVIGATE_IN",{from:this.currentView,to:r,trigger:i}),new Promise(e=>{r.view.update(),this.loadScripts(r.scripts),r.view.enter(n,i).then(()=>{console.log("NAVIGATE_COMPLETE",this.cache),t.emit("NAVIGATE_COMPLETE",{from:this.currentView,to:r,trigger:i}),this.currentView=r,this.isTransitioning=!1,e()})})}loadScripts(t){const e=[...t],n=[...document.querySelectorAll("script:not([data-no-reload])")].filter(this.reloadJsFilter);for(let t=0;t<n.length;t++)for(let r=0;r<e.length;r++)if(n[t].outerHTML===e[r].outerHTML){(a=n[t]).parentNode.replaceChild(i(a),a),e.splice(r,1);break}var a;for(const t of e)r(t)}attachEvents(e){t.delegate("click",e,this.onClick),t.on("popstate",window,this.onPopstate)}fetch(t){return new Promise(n=>{fetch(t,{mode:"same-origin",method:"GET",headers:{"X-Requested-With":"Taxi"},credentials:"same-origin"}).then(e=>(e.ok||(console.warn("Taxi encountered a non 2xx HTTP status code"),window.location.href=t),e.text())).then(t=>{var r;n("string"==typeof(r=t)?e.parseFromString(r,"text/html"):r)}).catch(e=>{console.warn(e),window.location.href=t})})}chooseTransition(t){var e;if(t)return this.transitions[t];const n=null==(e=this.router)?void 0:e.findMatch(this.currentLocation,this.targetLocation);return n?this.transitions[n]:this.defaultTransition}createCacheEntry(t){const e=t.querySelector("[data-taxi-view]"),n=e.dataset.taxiView.length?this.views[e.dataset.taxiView]:this.defaultView;return{page:t,content:e,scripts:[...t.querySelectorAll("script:not([data-no-reload])")].filter(this.reloadJsFilter),title:t.title,view:new n({wrapper:this.wrapper,title:t.title,content:e,page:t})}}}};class s{constructor({content:t,page:e,title:n,wrapper:r}){this.content=t,this.page=e,this.title=n,this.wrapper=r}onEnter(){}onEnterCompleted(){}onLeave(){}onLeaveCompleted(){}initialLoad(){this.onEnter(),this.onEnterCompleted()}update(){document.title=this.title,this.wrapper.insertAdjacentHTML("beforeend",this.content.outerHTML)}remove(){this.wrapper.firstElementChild.remove()}enter(t,e){return new Promise(n=>{this.onEnter(),t.enter({trigger:e,to:this.content}).then(()=>{this.onEnterCompleted(),n()})})}leave(t,e){return new Promise(n=>{this.onLeave(),t.leave({trigger:e,from:this.content}).then(()=>{this.remove(),this.onLeaveCompleted(),n()})})}}function h(){return h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},h.apply(this,arguments)}class c{constructor({wrapper:t}){this.wrapper=t}leave(t){return new Promise(e=>{this.onLeave(h({},t,{done:e}))})}enter(t){return new Promise(e=>{this.onEnter(h({},t,{done:e}))})}onLeave({done:t}){t()}onEnter({done:t}){t()}}export{o as Taxi,c as Transition,s as View};
import t from"@unseenco/e";const e=new DOMParser;function n(t){const e=new URL(t,window.location.origin);let n=null;return e.hash.length&&(n=t.replace(e.hash,"")),{hasHash:e.hash.length>0,pathname:e.pathname,raw:t,href:n||e.href}}function r(t){"HEAD"===t.parentNode.tagName?document.head.appendChild(i(t)):document.body.appendChild(i(t))}function i(t){const e=document.createElement("SCRIPT");for(let n=0;n<t.attributes.length;n++){const r=t.attributes[n];e.setAttribute(r.nodeName,r.nodeValue)}return t.innerHTML&&(e.innerHTML=t.innerHTML),e}class a{constructor(){this.data=new Map,this.regexCache=new Map}add(t,e,n){this.data.has(t)||(this.data.set(t,new Map),this.regexCache.set(t,new RegExp(`^${t}$`))),this.data.get(t).set(e,n),this.regexCache.set(e,new RegExp(`^${e}$`))}findMatch(t,e){for(const[n,r]of this.data)if(t.pathname.match(this.regexCache.get(n))){for(const[t,n]of r)if(e.pathname.match(this.regexCache.get(t)))return n;break}return null}}var o={__proto__:null,default:class{constructor(t={}){this.isTransitioning=!1,this.currentView=null,this.cache=new Map,this.onClick=t=>{if(!t.metaKey&&!t.ctrlKey){const e=n(t.currentTarget.href);if(this.currentLocation=n(window.location.href),this.currentLocation.href!==e.href||this.currentLocation.hasHash&&!e.hasHash)return t.preventDefault(),void this.navigate(e.raw,t.currentTarget.dataset.taxiTransition||!1,t.currentTarget);this.currentLocation.hasHash||e.hasHash||t.preventDefault()}},this.onPopstate=()=>window.location.pathname!==this.currentLocation.pathname&&(this.isTransitioning?(window.history.pushState({},"",this.currentLocation.href),!1):void this.navigate(window.location.href,!1,"popstate"));const{links:e="a:not([target]):not([href^=\\#]):not([data-taxi-ignore])",views:r={default:c},transitions:i={default:h},reloadJsFilter:a=function(t){return!("__bs_script__"===(null==t?void 0:t.id)||null!=t&&t.src.includes("browser-sync-client.js"))}}=t;this.views=r,this.transitions=i,this.defaultView=this.views.default||c,this.defaultTransition=this.transitions.default||h,this.wrapper=document.querySelector("[data-taxi]"),this.reloadJsFilter=a,this.cache=new Map,this.attachEvents(e),this.currentLocation=n(window.location.href),this.cache.set(this.currentLocation.href,this.createCacheEntry(document.cloneNode(!0))),this.currentView=this.cache.get(this.currentLocation.href),this.currentView.view.initialLoad()}setDefaultView(t){this.defaultView=this.views[t]}setDefaultTransition(t){this.defaultTransition=this.transitions[t]}addRoute(t,e,n){this.router||(this.router=new a),this.router.add(t,e,n)}preload(t){var e=this;return t=n(t).href,this.cache.has(t)||this.fetch(t).then(async function(n){e.cache.set(t,e.createCacheEntry(n))}),this}navigate(t,e=!1,r=!1){var i=this;return this.targetLocation=n(t),new Promise((t,n)=>{if(this.isTransitioning)return void n(new Error("A transition is currently in progress"));const a=new(this.chooseTransition(e))({wrapper:this.wrapper});this.beforeFetch(this.targetLocation,a,r).then(async function(){return i.cache.has(i.targetLocation.href)?await i.afterFetch(i.targetLocation,a,i.cache.get(i.targetLocation.href),r):i.fetch(i.targetLocation.raw).then(async function(t){return await i.afterFetch(i.targetLocation,a,i.createCacheEntry(t),r)})}).then(()=>{t()})})}beforeFetch(e,n,r){return this.isTransitioning=!0,console.log("NAVIGATE_OUT"),t.emit("NAVIGATE_OUT",{from:this.currentView,trigger:r}),new Promise(t=>{this.currentView.view.leave(n,r).then(()=>{"popstate"!==r&&window.history.pushState({},"",e.raw),t()})})}afterFetch(e,n,r,i){return this.cache.has(e.href)||this.cache.set(e.href,r),this.currentLocation=e,console.log("NAVIGATE_IN"),t.emit("NAVIGATE_IN",{from:this.currentView,to:r,trigger:i}),new Promise(e=>{r.view.update(),this.loadScripts(r.scripts),r.view.enter(n,i).then(()=>{console.log("NAVIGATE_COMPLETE",this.cache),t.emit("NAVIGATE_COMPLETE",{from:this.currentView,to:r,trigger:i}),this.currentView=r,this.isTransitioning=!1,e()})})}loadScripts(t){const e=[...t],n=[...document.querySelectorAll("script:not([data-no-reload])")].filter(this.reloadJsFilter);for(let t=0;t<n.length;t++)for(let r=0;r<e.length;r++)if(n[t].outerHTML===e[r].outerHTML){(a=n[t]).parentNode.replaceChild(i(a),a),e.splice(r,1);break}var a;for(const t of e)r(t)}attachEvents(e){t.delegate("click",e,this.onClick),t.on("popstate",window,this.onPopstate)}fetch(t){return new Promise(n=>{fetch(t,{mode:"same-origin",method:"GET",headers:{"X-Requested-With":"Taxi"},credentials:"same-origin"}).then(e=>(e.ok||(console.warn("Taxi encountered a non 2xx HTTP status code"),window.location.href=t),e.text())).then(t=>{var r;n("string"==typeof(r=t)?e.parseFromString(r,"text/html"):r)}).catch(e=>{console.warn(e),window.location.href=t})})}chooseTransition(t){var e;if(t)return this.transitions[t];const n=null==(e=this.router)?void 0:e.findMatch(this.currentLocation,this.targetLocation);return n?this.transitions[n]:this.defaultTransition}createCacheEntry(t){const e=t.querySelector("[data-taxi-view]"),n=e.dataset.taxiView.length?this.views[e.dataset.taxiView]:this.defaultView;return{page:t,content:e,scripts:[...t.querySelectorAll("script:not([data-no-reload])")].filter(this.reloadJsFilter),title:t.title,view:new n({wrapper:this.wrapper,title:t.title,content:e,page:t})}}}};function s(){return s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s.apply(this,arguments)}class h{constructor({wrapper:t}){this.wrapper=t}leave(t){return new Promise(e=>{this.onLeave(s({},t,{done:e}))})}enter(t){return new Promise(e=>{this.onEnter(s({},t,{done:e}))})}onLeave({done:t}){t()}onEnter({done:t}){t()}}class c{constructor({content:t,page:e,title:n,wrapper:r}){this.content=t,this.page=e,this.title=n,this.wrapper=r}onEnter(){}onEnterCompleted(){}onLeave(){}onLeaveCompleted(){}initialLoad(){this.onEnter(),this.onEnterCompleted()}update(){document.title=this.title,this.wrapper.insertAdjacentHTML("beforeend",this.content.outerHTML)}remove(){this.wrapper.firstElementChild.remove()}enter(t,e){return new Promise(n=>{this.onEnter(),t.enter({trigger:e,to:this.content}).then(()=>{this.onEnterCompleted(),n()})})}leave(t,e){return new Promise(n=>{this.onLeave(),t.leave({trigger:e,from:this.content}).then(()=>{this.remove(),this.onLeaveCompleted(),n()})})}}export{o as Taxi,h as Transition,c as View};
//# sourceMappingURL=taxi.modern.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@unseenco/e")):"function"==typeof define&&define.amd?define(["exports","@unseenco/e"],e):e((t||self).taxi={},t.E)}(this,function(t,e){function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=/*#__PURE__*/n(e);function i(){return i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i.apply(this,arguments)}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c=new DOMParser;function s(t){var e=new URL(t,window.location.origin),n=null;return e.hash.length&&(n=t.replace(e.hash,"")),{hasHash:e.hash.length>0,pathname:e.pathname,raw:t,href:n||e.href}}function u(t){"HEAD"===t.parentNode.tagName?document.head.appendChild(h(t)):document.body.appendChild(h(t))}function h(t){for(var e=document.createElement("SCRIPT"),n=0;n<t.attributes.length;n++){var r=t.attributes[n];e.setAttribute(r.nodeName,r.nodeValue)}return t.innerHTML&&(e.innerHTML=t.innerHTML),e}var f=/*#__PURE__*/function(){function t(){this.data=new Map,this.regexCache=new Map}var e=t.prototype;return e.add=function(t,e,n){this.data.has(t)||(this.data.set(t,new Map),this.regexCache.set(t,new RegExp("^"+t+"$"))),this.data.get(t).set(e,n),this.regexCache.set(e,new RegExp("^"+e+"$"))},e.findMatch=function(t,e){for(var n,r=a(this.data);!(n=r()).done;){var i=n.value,o=i[1];if(t.pathname.match(this.regexCache.get(i[0]))){for(var c,s=a(o);!(c=s()).done;){var u=c.value,h=u[1];if(e.pathname.match(this.regexCache.get(u[0])))return h}break}}return null},t}(),l=/*#__PURE__*/function(){function t(t){var e=this;void 0===t&&(t={}),this.isTransitioning=!1,this.currentView=null,this.cache=new Map,this.onClick=function(t){if(!t.metaKey&&!t.ctrlKey){var n=s(t.currentTarget.href);if(e.currentLocation=s(window.location.href),e.currentLocation.href!==n.href||e.currentLocation.hasHash&&!n.hasHash)return t.preventDefault(),void e.navigate(n.raw,t.currentTarget.dataset.taxiTransition||!1,t.currentTarget);e.currentLocation.hasHash||n.hasHash||t.preventDefault()}},this.onPopstate=function(){return window.location.pathname!==e.currentLocation.pathname&&(e.isTransitioning?(window.history.pushState({},"",e.currentLocation.href),!1):void e.navigate(window.location.href,!1,"popstate"))};var n=t.links,r=void 0===n?"a:not([target]):not([href^=\\#]):not([data-taxi-ignore])":n,i=t.views,o=t.transitions,a=void 0===o?{default:v}:o,c=t.reloadJsFilter,u=void 0===c?function(t){return!("__bs_script__"===(null==t?void 0:t.id)||null!=t&&t.src.includes("browser-sync-client.js"))}:c;this.views=void 0===i?{default:p}:i,this.transitions=a,this.defaultView=this.views.default||p,this.defaultTransition=this.transitions.default||v,this.wrapper=document.querySelector("[data-taxi]"),this.reloadJsFilter=u,this.cache=new Map,this.attachEvents(r),this.currentLocation=s(window.location.href),this.cache.set(this.currentLocation.href,this.createCacheEntry(document.cloneNode(!0))),this.currentView=this.cache.get(this.currentLocation.href),this.currentView.view.initialLoad()}var e=t.prototype;return e.setDefaultView=function(t){this.defaultView=this.views[t]},e.setDefaultTransition=function(t){this.defaultTransition=this.transitions[t]},e.addRoute=function(t,e,n){this.router||(this.router=new f),this.router.add(t,e,n)},e.preload=function(t){var e=this;return t=s(t).href,this.cache.has(t)||this.fetch(t).then(function(n){try{return e.cache.set(t,e.createCacheEntry(n)),Promise.resolve()}catch(t){return Promise.reject(t)}}),this},e.navigate=function(t,e,n){var r=this;return void 0===e&&(e=!1),void 0===n&&(n=!1),this.targetLocation=s(t),new Promise(function(t,i){if(r.isTransitioning)i(new Error("A transition is currently in progress"));else{var o=new(r.chooseTransition(e))({wrapper:r.wrapper});r.beforeFetch(r.targetLocation,o,n).then(function(){try{return r.cache.has(r.targetLocation.href)?Promise.resolve(r.afterFetch(r.targetLocation,o,r.cache.get(r.targetLocation.href),n)):Promise.resolve(r.fetch(r.targetLocation.raw).then(function(t){try{return Promise.resolve(r.afterFetch(r.targetLocation,o,r.createCacheEntry(t),n))}catch(t){return Promise.reject(t)}}))}catch(t){return Promise.reject(t)}}).then(function(){t()})}})},e.beforeFetch=function(t,e,n){var i=this;return this.isTransitioning=!0,console.log("NAVIGATE_OUT"),r.default.emit("NAVIGATE_OUT",{from:this.currentView,trigger:n}),new Promise(function(r){i.currentView.view.leave(e,n).then(function(){"popstate"!==n&&window.history.pushState({},"",t.raw),r()})})},e.afterFetch=function(t,e,n,i){var o=this;return this.cache.has(t.href)||this.cache.set(t.href,n),this.currentLocation=t,console.log("NAVIGATE_IN"),r.default.emit("NAVIGATE_IN",{from:this.currentView,to:n,trigger:i}),new Promise(function(t){n.view.update(),o.loadScripts(n.scripts),n.view.enter(e,i).then(function(){console.log("NAVIGATE_COMPLETE",o.cache),r.default.emit("NAVIGATE_COMPLETE",{from:o.currentView,to:n,trigger:i}),o.currentView=n,o.isTransitioning=!1,t()})})},e.loadScripts=function(t){for(var e,n=[].concat(t),r=[].concat(document.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),i=0;i<r.length;i++)for(var o=0;o<n.length;o++)if(r[i].outerHTML===n[o].outerHTML){(e=r[i]).parentNode.replaceChild(h(e),e),n.splice(o,1);break}for(var c,s=a(n);!(c=s()).done;)u(c.value)},e.attachEvents=function(t){r.default.delegate("click",t,this.onClick),r.default.on("popstate",window,this.onPopstate)},e.fetch=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return new Promise(function(e){fetch(t,{mode:"same-origin",method:"GET",headers:{"X-Requested-With":"Taxi"},credentials:"same-origin"}).then(function(e){return e.ok||(console.warn("Taxi encountered a non 2xx HTTP status code"),window.location.href=t),e.text()}).then(function(t){var n;e("string"==typeof(n=t)?c.parseFromString(n,"text/html"):n)}).catch(function(e){console.warn(e),window.location.href=t})})}),e.chooseTransition=function(t){var e;if(t)return this.transitions[t];var n=null==(e=this.router)?void 0:e.findMatch(this.currentLocation,this.targetLocation);return n?this.transitions[n]:this.defaultTransition},e.createCacheEntry=function(t){var e=t.querySelector("[data-taxi-view]"),n=e.dataset.taxiView.length?this.views[e.dataset.taxiView]:this.defaultView;return{page:t,content:e,scripts:[].concat(t.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),title:t.title,view:new n({wrapper:this.wrapper,title:t.title,content:e,page:t})}},t}(),d={__proto__:null,default:l},p=/*#__PURE__*/function(){function t(t){var e=t.page,n=t.title,r=t.wrapper;this.content=t.content,this.page=e,this.title=n,this.wrapper=r}var e=t.prototype;return e.onEnter=function(){},e.onEnterCompleted=function(){},e.onLeave=function(){},e.onLeaveCompleted=function(){},e.initialLoad=function(){this.onEnter(),this.onEnterCompleted()},e.update=function(){document.title=this.title,this.wrapper.insertAdjacentHTML("beforeend",this.content.outerHTML)},e.remove=function(){this.wrapper.firstElementChild.remove()},e.enter=function(t,e){var n=this;return new Promise(function(r){n.onEnter(),t.enter({trigger:e,to:n.content}).then(function(){n.onEnterCompleted(),r()})})},e.leave=function(t,e){var n=this;return new Promise(function(r){n.onLeave(),t.leave({trigger:e,from:n.content}).then(function(){n.remove(),n.onLeaveCompleted(),r()})})},t}(),v=/*#__PURE__*/function(){function t(t){this.wrapper=t.wrapper}var e=t.prototype;return e.leave=function(t){var e=this;return new Promise(function(n){e.onLeave(i({},t,{done:n}))})},e.enter=function(t){var e=this;return new Promise(function(n){e.onEnter(i({},t,{done:n}))})},e.onLeave=function(t){(0,t.done)()},e.onEnter=function(t){(0,t.done)()},t}();t.Taxi=d,t.Transition=v,t.View=p});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@unseenco/e")):"function"==typeof define&&define.amd?define(["exports","@unseenco/e"],e):e((t||self).taxi={},t.E)}(this,function(t,e){function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=/*#__PURE__*/n(e);function i(){return i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i.apply(this,arguments)}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c=new DOMParser;function s(t){var e=new URL(t,window.location.origin),n=null;return e.hash.length&&(n=t.replace(e.hash,"")),{hasHash:e.hash.length>0,pathname:e.pathname,raw:t,href:n||e.href}}function u(t){"HEAD"===t.parentNode.tagName?document.head.appendChild(h(t)):document.body.appendChild(h(t))}function h(t){for(var e=document.createElement("SCRIPT"),n=0;n<t.attributes.length;n++){var r=t.attributes[n];e.setAttribute(r.nodeName,r.nodeValue)}return t.innerHTML&&(e.innerHTML=t.innerHTML),e}var f=/*#__PURE__*/function(){function t(){this.data=new Map,this.regexCache=new Map}var e=t.prototype;return e.add=function(t,e,n){this.data.has(t)||(this.data.set(t,new Map),this.regexCache.set(t,new RegExp("^"+t+"$"))),this.data.get(t).set(e,n),this.regexCache.set(e,new RegExp("^"+e+"$"))},e.findMatch=function(t,e){for(var n,r=a(this.data);!(n=r()).done;){var i=n.value,o=i[1];if(t.pathname.match(this.regexCache.get(i[0]))){for(var c,s=a(o);!(c=s()).done;){var u=c.value,h=u[1];if(e.pathname.match(this.regexCache.get(u[0])))return h}break}}return null},t}(),l=/*#__PURE__*/function(){function t(t){var e=this;void 0===t&&(t={}),this.isTransitioning=!1,this.currentView=null,this.cache=new Map,this.onClick=function(t){if(!t.metaKey&&!t.ctrlKey){var n=s(t.currentTarget.href);if(e.currentLocation=s(window.location.href),e.currentLocation.href!==n.href||e.currentLocation.hasHash&&!n.hasHash)return t.preventDefault(),void e.navigate(n.raw,t.currentTarget.dataset.taxiTransition||!1,t.currentTarget);e.currentLocation.hasHash||n.hasHash||t.preventDefault()}},this.onPopstate=function(){return window.location.pathname!==e.currentLocation.pathname&&(e.isTransitioning?(window.history.pushState({},"",e.currentLocation.href),!1):void e.navigate(window.location.href,!1,"popstate"))};var n=t.links,r=void 0===n?"a:not([target]):not([href^=\\#]):not([data-taxi-ignore])":n,i=t.views,o=t.transitions,a=void 0===o?{default:p}:o,c=t.reloadJsFilter,u=void 0===c?function(t){return!("__bs_script__"===(null==t?void 0:t.id)||null!=t&&t.src.includes("browser-sync-client.js"))}:c;this.views=void 0===i?{default:v}:i,this.transitions=a,this.defaultView=this.views.default||v,this.defaultTransition=this.transitions.default||p,this.wrapper=document.querySelector("[data-taxi]"),this.reloadJsFilter=u,this.cache=new Map,this.attachEvents(r),this.currentLocation=s(window.location.href),this.cache.set(this.currentLocation.href,this.createCacheEntry(document.cloneNode(!0))),this.currentView=this.cache.get(this.currentLocation.href),this.currentView.view.initialLoad()}var e=t.prototype;return e.setDefaultView=function(t){this.defaultView=this.views[t]},e.setDefaultTransition=function(t){this.defaultTransition=this.transitions[t]},e.addRoute=function(t,e,n){this.router||(this.router=new f),this.router.add(t,e,n)},e.preload=function(t){var e=this;return t=s(t).href,this.cache.has(t)||this.fetch(t).then(function(n){try{return e.cache.set(t,e.createCacheEntry(n)),Promise.resolve()}catch(t){return Promise.reject(t)}}),this},e.navigate=function(t,e,n){var r=this;return void 0===e&&(e=!1),void 0===n&&(n=!1),this.targetLocation=s(t),new Promise(function(t,i){if(r.isTransitioning)i(new Error("A transition is currently in progress"));else{var o=new(r.chooseTransition(e))({wrapper:r.wrapper});r.beforeFetch(r.targetLocation,o,n).then(function(){try{return r.cache.has(r.targetLocation.href)?Promise.resolve(r.afterFetch(r.targetLocation,o,r.cache.get(r.targetLocation.href),n)):Promise.resolve(r.fetch(r.targetLocation.raw).then(function(t){try{return Promise.resolve(r.afterFetch(r.targetLocation,o,r.createCacheEntry(t),n))}catch(t){return Promise.reject(t)}}))}catch(t){return Promise.reject(t)}}).then(function(){t()})}})},e.beforeFetch=function(t,e,n){var i=this;return this.isTransitioning=!0,console.log("NAVIGATE_OUT"),r.default.emit("NAVIGATE_OUT",{from:this.currentView,trigger:n}),new Promise(function(r){i.currentView.view.leave(e,n).then(function(){"popstate"!==n&&window.history.pushState({},"",t.raw),r()})})},e.afterFetch=function(t,e,n,i){var o=this;return this.cache.has(t.href)||this.cache.set(t.href,n),this.currentLocation=t,console.log("NAVIGATE_IN"),r.default.emit("NAVIGATE_IN",{from:this.currentView,to:n,trigger:i}),new Promise(function(t){n.view.update(),o.loadScripts(n.scripts),n.view.enter(e,i).then(function(){console.log("NAVIGATE_COMPLETE",o.cache),r.default.emit("NAVIGATE_COMPLETE",{from:o.currentView,to:n,trigger:i}),o.currentView=n,o.isTransitioning=!1,t()})})},e.loadScripts=function(t){for(var e,n=[].concat(t),r=[].concat(document.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),i=0;i<r.length;i++)for(var o=0;o<n.length;o++)if(r[i].outerHTML===n[o].outerHTML){(e=r[i]).parentNode.replaceChild(h(e),e),n.splice(o,1);break}for(var c,s=a(n);!(c=s()).done;)u(c.value)},e.attachEvents=function(t){r.default.delegate("click",t,this.onClick),r.default.on("popstate",window,this.onPopstate)},e.fetch=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return new Promise(function(e){fetch(t,{mode:"same-origin",method:"GET",headers:{"X-Requested-With":"Taxi"},credentials:"same-origin"}).then(function(e){return e.ok||(console.warn("Taxi encountered a non 2xx HTTP status code"),window.location.href=t),e.text()}).then(function(t){var n;e("string"==typeof(n=t)?c.parseFromString(n,"text/html"):n)}).catch(function(e){console.warn(e),window.location.href=t})})}),e.chooseTransition=function(t){var e;if(t)return this.transitions[t];var n=null==(e=this.router)?void 0:e.findMatch(this.currentLocation,this.targetLocation);return n?this.transitions[n]:this.defaultTransition},e.createCacheEntry=function(t){var e=t.querySelector("[data-taxi-view]"),n=e.dataset.taxiView.length?this.views[e.dataset.taxiView]:this.defaultView;return{page:t,content:e,scripts:[].concat(t.querySelectorAll("script:not([data-no-reload])")).filter(this.reloadJsFilter),title:t.title,view:new n({wrapper:this.wrapper,title:t.title,content:e,page:t})}},t}(),d={__proto__:null,default:l},p=/*#__PURE__*/function(){function t(t){this.wrapper=t.wrapper}var e=t.prototype;return e.leave=function(t){var e=this;return new Promise(function(n){e.onLeave(i({},t,{done:n}))})},e.enter=function(t){var e=this;return new Promise(function(n){e.onEnter(i({},t,{done:n}))})},e.onLeave=function(t){(0,t.done)()},e.onEnter=function(t){(0,t.done)()},t}(),v=/*#__PURE__*/function(){function t(t){var e=t.page,n=t.title,r=t.wrapper;this.content=t.content,this.page=e,this.title=n,this.wrapper=r}var e=t.prototype;return e.onEnter=function(){},e.onEnterCompleted=function(){},e.onLeave=function(){},e.onLeaveCompleted=function(){},e.initialLoad=function(){this.onEnter(),this.onEnterCompleted()},e.update=function(){document.title=this.title,this.wrapper.insertAdjacentHTML("beforeend",this.content.outerHTML)},e.remove=function(){this.wrapper.firstElementChild.remove()},e.enter=function(t,e){var n=this;return new Promise(function(r){n.onEnter(),t.enter({trigger:e,to:n.content}).then(function(){n.onEnterCompleted(),r()})})},e.leave=function(t,e){var n=this;return new Promise(function(r){n.onLeave(),t.leave({trigger:e,from:n.content}).then(function(){n.remove(),n.onLeaveCompleted(),r()})})},t}();t.Taxi=d,t.Transition=p,t.View=v});
//# sourceMappingURL=taxi.umd.js.map
{
"name": "@unseenco/taxi",
"description": "A modern page transition library which supports routing, preloading, and additional script reloading.",
"version": "0.1.6",
"version": "0.1.7",
"license": "GPL-3.0-or-later",

@@ -6,0 +6,0 @@ "source": "src/taxi.js",

export default class Transition {
/**
* @param {{wrapper: HTMLElement}} props
*/
constructor({ wrapper }: {
wrapper: any;
wrapper: HTMLElement;
});
wrapper: any;
wrapper: HTMLElement;
/**

@@ -24,16 +27,18 @@ * @param {{ from: HTMLElement, trigger: string|HTMLElement|false }} props

* Handle the transition leaving the previous page.
*
* @param {HTMLElement} from The previous page's content
* @param {string|HTMLElement|false} trigger The navigation trigger
* @param {function} done
* @param {{from: HTMLElement, trigger: string|HTMLElement|false, done: function}} props
*/
onLeave({ from, trigger, done }: HTMLElement): void;
onLeave({ from, trigger, done }: {
from: HTMLElement;
trigger: string | HTMLElement | false;
done: Function;
}): void;
/**
* Handle the transition entering the next page.
*
* @param {HTMLElement} to The next page's content
* @param {string|HTMLElement|false} trigger The navigation trigger
* @param {function} done
* @param {{to: HTMLElement, trigger: string|HTMLElement|false, done: function}} props
*/
onEnter({ to, trigger, done }: HTMLElement): void;
onEnter({ to, trigger, done }: {
to: HTMLElement;
trigger: string | HTMLElement | false;
done: Function;
}): void;
}
export default class Transition {
/**
* @param {{wrapper: HTMLElement}} props
*/
constructor({ wrapper }) {

@@ -28,6 +31,3 @@ this.wrapper = wrapper

* Handle the transition leaving the previous page.
*
* @param {HTMLElement} from The previous page's content
* @param {string|HTMLElement|false} trigger The navigation trigger
* @param {function} done
* @param {{from: HTMLElement, trigger: string|HTMLElement|false, done: function}} props
*/

@@ -40,6 +40,3 @@ onLeave({ from, trigger, done }) {

* Handle the transition entering the next page.
*
* @param {HTMLElement} to The next page's content
* @param {string|HTMLElement|false} trigger The navigation trigger
* @param {function} done
* @param {{to: HTMLElement, trigger: string|HTMLElement|false, done: function}} props
*/

@@ -46,0 +43,0 @@ onEnter({ to, trigger, done }) {

@@ -6,12 +6,14 @@ /**

/**
* @param {HTMLElement|Element} content
* @param {Document|Node} page
* @param {string} title
* @param {Element} wrapper
* @param {{content: HTMLElement|Element, page: Document|Node, title: string, wrapper: Element}} props
*/
constructor({ content, page, title, wrapper }: HTMLElement | Element);
content: any;
page: any;
title: any;
wrapper: any;
constructor({ content, page, title, wrapper }: {
content: HTMLElement | Element;
page: Document | Node;
title: string;
wrapper: Element;
});
content: Element | HTMLElement;
page: Node | Document;
title: string;
wrapper: Element;
onEnter(): void;

@@ -39,1 +41,2 @@ onEnterCompleted(): void;

}
import Transition from "./Transition";

@@ -0,1 +1,3 @@

import Transition from "./Transition"
/**

@@ -6,6 +8,3 @@ * @module Taxi/View

/**
* @param {HTMLElement|Element} content
* @param {Document|Node} page
* @param {string} title
* @param {Element} wrapper
* @param {{content: HTMLElement|Element, page: Document|Node, title: string, wrapper: Element}} props
*/

@@ -12,0 +11,0 @@ constructor({ content, page, title, wrapper }) {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc