diff --git a/CHANGELOG.md b/CHANGELOG.md index 37d60399..70dcaf44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 8.5.0 + +* `data-navigo` now accepts a `"false"` (as string) argument. +* links with `target="_blank"` are ignored. + ## 8.4.4 ES build. Fixing #261. diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 1f757fed..b8eb2684 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -41,6 +41,7 @@ - [Removing a route](#removing-a-route) - [Navigating between routes](#navigating-between-routes) - [Augment your `` tags](#augment-your-a-tags) + - [`data-navigo` with value](#data-navigo-with-value) - [Passing options to the `navigate` method](#passing-options-to-the-navigate-method) - [Resolving routes](#resolving-routes) - [Resolve options](#resolve-options) @@ -317,6 +318,12 @@ When Navigo is initialized checks the page for such tags and attaches `click` ha Navigo has a method called `updatePageLinks` which you have to call every time when you change the DOM and you expect to see new links on the page. Because Navigo is not wired to a rendering engine doesn't really know about the DOM manipulations. It does though makes an assumption - after each of your route handlers there is a `updatePageLinks` call. The router expects that after the successful route resolving the DOM is updated and calls that function again. Feel free to fire `updatePageLinks` multiple times on the same DOM tree. There will be just one `click` handler attached to your links. +*Links with `target="_blank"` are ignored even if they have `data-navigo` attribute.* + +### `data-navigo` with value + +If you use `data-navigo="false"` the link will be ignored by Navigo and if there was a click handler for it the handler will be removed. + ### Passing options to the `navigate` method As we learned above, when a link with `data-navigo` attribute is clicked the `navigate` method of the router gets executed. That same method accepts options and if you want to pass some of them use the following syntax: diff --git a/lib/es/index.js b/lib/es/index.js index 1784d839..0a5a4cb7 100644 --- a/lib/es/index.js +++ b/lib/es/index.js @@ -168,8 +168,18 @@ function Navigo(appRoute, resolveOptions) { function updatePageLinks() { if (!isWindowAvailable) return; findLinks().forEach(function (link) { + if ("false" === link.getAttribute("data-navigo") || "_blank" === link.getAttribute("target")) { + if (link.hasListenerAttached) { + link.removeEventListener("click", link.navigoHandler); + } + + return; + } + if (!link.hasListenerAttached) { - link.addEventListener("click", function (e) { + link.hasListenerAttached = true; + + link.navigoHandler = function (e) { if ((e.ctrlKey || e.metaKey) && e.target.tagName.toLowerCase() === "a") { return false; } @@ -195,8 +205,9 @@ function Navigo(appRoute, resolveOptions) { e.stopPropagation(); self.navigate((0, _utils.clean)(location), options); } - }); - link.hasListenerAttached = true; + }; + + link.addEventListener("click", link.navigoHandler); } }); return self; diff --git a/lib/navigo.amd.js b/lib/navigo.amd.js index 2f436afc..96925013 100644 --- a/lib/navigo.amd.js +++ b/lib/navigo.amd.js @@ -252,8 +252,18 @@ function Navigo(appRoute, resolveOptions) { function updatePageLinks() { if (!isWindowAvailable) return; findLinks().forEach(function (link) { + if ("false" === link.getAttribute("data-navigo") || "_blank" === link.getAttribute("target")) { + if (link.hasListenerAttached) { + link.removeEventListener("click", link.navigoHandler); + } + + return; + } + if (!link.hasListenerAttached) { - link.addEventListener("click", function (e) { + link.hasListenerAttached = true; + + link.navigoHandler = function (e) { if ((e.ctrlKey || e.metaKey) && e.target.tagName.toLowerCase() === "a") { return false; } @@ -279,8 +289,9 @@ function Navigo(appRoute, resolveOptions) { e.stopPropagation(); self.navigate((0,_utils__WEBPACK_IMPORTED_MODULE_0__.clean)(location), options); } - }); - link.hasListenerAttached = true; + }; + + link.addEventListener("click", link.navigoHandler); } }); return self; diff --git a/lib/navigo.amd.js.map b/lib/navigo.amd.js.map index 881f0481..55a78120 100644 --- a/lib/navigo.amd.js.map +++ b/lib/navigo.amd.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo.amd/webpack/runtime/make namespace object","webpack://Navigo.amd/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","currentLocationPath","options","instance","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","navigate","to","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","off","what","filter","r","isFunction","listen","__popstateListener","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","hasListenerAttached","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","getAttribute","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","generate","data","result","reduce","route","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","find","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForLeaveHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForNotFoundHandler","notFoundHandled","errorOut","flushCurrent","undefinedOrTrue","_checkForAfterHook","after","already","before","map","beforeHookInternal","_","d","concat","force","oldMatch","leaveLoopDone","leave","notFoundRoute","notFoundMatch","i","nextMatch","end","_setLocationPath","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","fallback","s","regExpResultToParams","names","index","decodeURIComponent","join","query","pairs","pair","currentPath","GETParams","paramNames","pattern","full","dots","regexp","pushState","obj","source","str","temp","v","h"],"mappings":";;;;;;;;;;;;;;AAKe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAAIF,IAAJ,EAAU;AACRA,YAAI,CAACC,OAAD,CAAJ;AACD;;AACD;AACD;;AACD,QAAIG,KAAK,CAACC,OAAN,CAAcP,KAAK,CAACI,GAAD,CAAnB,CAAJ,EAA+B;AAC7BJ,WAAK,CAACQ,MAAN,OAAAR,KAAK,GACHI,GADG,EAEH,CAFG,SAGCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,EAAcD,OAAd,IAAyBH,KAAK,CAACI,GAAD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,IAAD,CAAN,CAAa7E,IAAb,CAAkB0J,CAAC,CAAC7E,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOlB,MAAP;AACD,C;;;;;;UC5KD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.amd.js","sourcesContent":["type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(\n currentLocationPath?: string,\n options?: ResolveOptions\n ): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => {\n // console.log(`${currentLocationPath} -> Matches: ${matches.length}`);\n return matches && matches.length > 0;\n },\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (!link.hasListenerAttached) {\n link.addEventListener(\"click\", function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n });\n link.hasListenerAttached = true;\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const result = routes.reduce((result, route) => {\n let key;\n\n if (route.name === name) {\n result = route.path as string;\n for (key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return result;\n }, \"\");\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForLeaveHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n checkForLeaveHook,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.after) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.before) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n [\n ...instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n // no match or different path\n if (\n !context.match ||\n !instance.matchLocation(\n oldMatch.route.path as string,\n context.match.url\n )\n ) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) => f(d, context.match);\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n ],\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n // console.log(\n // \"_processMatches matches=\" +\n // (context.matches ? context.matches.length : 0)\n // );\n (function nextMatch() {\n if (idx === context.matches.length) {\n done();\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n })();\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo.amd/webpack/runtime/make namespace object","webpack://Navigo.amd/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","currentLocationPath","options","instance","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","navigate","to","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","off","what","filter","r","isFunction","listen","__popstateListener","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","generate","data","result","reduce","route","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","find","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForLeaveHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForNotFoundHandler","notFoundHandled","errorOut","flushCurrent","undefinedOrTrue","_checkForAfterHook","after","already","before","map","beforeHookInternal","_","d","concat","force","oldMatch","leaveLoopDone","leave","notFoundRoute","notFoundMatch","i","nextMatch","end","_setLocationPath","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","fallback","s","regExpResultToParams","names","index","decodeURIComponent","join","query","pairs","pair","currentPath","GETParams","paramNames","pattern","full","dots","regexp","pushState","obj","source","str","temp","v","h"],"mappings":";;;;;;;;;;;;;;AAKe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAAIF,IAAJ,EAAU;AACRA,YAAI,CAACC,OAAD,CAAJ;AACD;;AACD;AACD;;AACD,QAAIG,KAAK,CAACC,OAAN,CAAcP,KAAK,CAACI,GAAD,CAAnB,CAAJ,EAA+B;AAC7BJ,WAAK,CAACQ,MAAN,OAAAR,KAAK,GACHI,GADG,EAEH,CAFG,SAGCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,EAAcD,OAAd,IAAyBH,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,CAAzB,GAAyCJ,KAAK,CAACI,GAAD,CAAL,CAAW,CAAX,CAH1C,EAAL;AAKAC,UAAI;AACL,KAPD,MAOO;AACL;AACA;AACCL,WAAK,CAACI,GAAD,CAAN,CAAyBD,OAAzB,EAAkC,UAACM,WAAD,EAAiB;AACjD,YAAI,OAAOA,WAAP,KAAuB,WAAvB,IAAsCA,WA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IAAD,CAAN,GAAe,EAAf;AACnBlB,cAAM,CAACkB,IAAD,CAAN,CAAa9E,IAAb,CAAkB2J,CAAC,CAAC7E,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOlB,MAAP;AACD,C;;;;;;UC5KD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.amd.js","sourcesContent":["type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(\n currentLocationPath?: string,\n options?: ResolveOptions\n ): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => {\n // console.log(`${currentLocationPath} -> Matches: ${matches.length}`);\n return matches && matches.length > 0;\n },\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const result = routes.reduce((result, route) => {\n let key;\n\n if (route.name === name) {\n result = route.path as string;\n for (key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return result;\n }, \"\");\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForLeaveHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n checkForLeaveHook,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.after) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.before) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n [\n ...instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n // no match or different path\n if (\n !context.match ||\n !instance.matchLocation(\n oldMatch.route.path as string,\n context.match.url\n )\n ) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) => f(d, context.match);\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n ],\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n // console.log(\n // \"_processMatches matches=\" +\n // (context.matches ? context.matches.length : 0)\n // );\n (function nextMatch() {\n if (idx === context.matches.length) {\n done();\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n })();\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.amd.min.js b/lib/navigo.amd.min.js index e99b05f4..d5592cca 100644 --- a/lib/navigo.amd.min.js +++ b/lib/navigo.amd.min.js @@ -1,2 +1,2 @@ -define("Navigo.amd",[],(()=>(()=>{"use strict";var t={184:(t,n,e)=>{e.d(n,{default:()=>S});var o=/([:*])(\w+)/g,r=/\*/g,a=/\/\?/g;function i(t){return void 0===t&&(t="/"),d()?location.pathname+location.search+location.hash:t}function c(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function s(t){return"string"==typeof t}function u(t){var n=c(t).split(/\?(.*)?$/);return[c(n[0]),n.slice(1).join("")]}function h(t){for(var n={},e=t.split("&"),o=0;o=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function S(t){return c(a+"/"+c(t))}function H(t,n,e,o){return t=s(t)?S(t):t,{name:o||c(String(t)),path:t,handler:n,hooks:v(e)}}function j(t,n){var e={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:n||o};return g([m,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,A)],e),!!e.matches&&e.matches}function x(){if(_)return(_?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){t.hasListenerAttached||(t.addEventListener("click",(function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var a=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),r.navigate(c(e),a))})),t.hasListenerAttached=!0)})),r}function C(t){var n=u(c(t)),o=n[0],r=n[1],a=""===r?null:h(r);return{url:o,queryString:r,route:H(o,(function(){}),[e],o),data:null,params:a}}function U(t,n,e){return"string"==typeof n&&(n=q(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function q(t){return"string"==typeof t?L.find((function(n){return n.name===S(t)})):L.find((function(n){return n.handler===t}))}t?a=c(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=L,this.destroyed=w,this.current=p,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=a),L.push(H(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],a=o.uses,i=o.as,c=o.hooks;L.push(H(n,a,[e,c],i))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return s(t)?c(n.path)!==c(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=j,this.navigate=function(t,n){t=c(a)+"/"+c(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};g([O,k,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,A),P],e)},this.destroy=function(){this.routes=L=[],b&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return r._notFoundRoute=H("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=x,this.link=function(t){return"/"+a+"/"+c(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return u(R(t))},this.lastResolved=function(){return p},this.generate=function(t,n){var e=L.reduce((function(e,o){var r;if(o.name===t)for(r in e=o.path,n)e=e.replace(":"+r,n[r]);return e}),"");return e.match(/^\//)?e:"/"+e},this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:o};return y(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n){var e={instance:r,currentLocationPath:n};return m(e,(function(){})),t=c(t),f(e.currentLocationPath,{name:t,path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return C(c(i(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=U.bind(this,"before"),this.addAfterHook=U.bind(this,"after"),this.addAlreadyHook=U.bind(this,"already"),this.addLeaveHook=U.bind(this,"leave"),this.getRoute=q,this._pathToMatchObject=C,this._clean=c,this._checkForAHash=R,this._setCurrent=function(t){return p=r.current=t},function(){b&&(this.__popstateListener=function(){j()},window.addEventListener("popstate",this.__popstateListener))}.call(this),x.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(184)})().default)); +define("Navigo.amd",[],(()=>(()=>{"use strict";var t={184:(t,n,e)=>{e.d(n,{default:()=>S});var o=/([:*])(\w+)/g,r=/\*/g,a=/\/\?/g;function i(t){return void 0===t&&(t="/"),d()?location.pathname+location.search+location.hash:t}function c(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function s(t){return"string"==typeof t}function u(t){var n=c(t).split(/\?(.*)?$/);return[c(n[0]),n.slice(1).join("")]}function h(t){for(var n={},e=t.split("&"),o=0;o=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function S(t){return c(a+"/"+c(t))}function H(t,n,e,o){return t=s(t)?S(t):t,{name:o||c(String(t)),path:t,handler:n,hooks:v(e)}}function j(t,n){var e={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:n||o};return g([m,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_)],e),!!e.matches&&e.matches}function x(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var a=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),r.navigate(c(e),a))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),r}function C(t){var n=u(c(t)),o=n[0],r=n[1],a=""===r?null:h(r);return{url:o,queryString:r,route:H(o,(function(){}),[e],o),data:null,params:a}}function U(t,n,e){return"string"==typeof n&&(n=q(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function q(t){return"string"==typeof t?L.find((function(n){return n.name===S(t)})):L.find((function(n){return n.handler===t}))}t?a=c(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=L,this.destroyed=w,this.current=p,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=a),L.push(H(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],a=o.uses,i=o.as,c=o.hooks;L.push(H(n,a,[e,c],i))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return s(t)?c(n.path)!==c(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=j,this.navigate=function(t,n){t=c(a)+"/"+c(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};g([O,k,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_),b],e)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return r._notFoundRoute=H("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=x,this.link=function(t){return"/"+a+"/"+c(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return u(R(t))},this.lastResolved=function(){return p},this.generate=function(t,n){var e=L.reduce((function(e,o){var r;if(o.name===t)for(r in e=o.path,n)e=e.replace(":"+r,n[r]);return e}),"");return e.match(/^\//)?e:"/"+e},this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:o};return y(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n){var e={instance:r,currentLocationPath:n};return m(e,(function(){})),t=c(t),f(e.currentLocationPath,{name:t,path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return C(c(i(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=U.bind(this,"before"),this.addAfterHook=U.bind(this,"after"),this.addAlreadyHook=U.bind(this,"already"),this.addLeaveHook=U.bind(this,"leave"),this.getRoute=q,this._pathToMatchObject=C,this._clean=c,this._checkForAHash=R,this._setCurrent=function(t){return p=r.current=t},function(){P&&(this.__popstateListener=function(){j()},window.addEventListener("popstate",this.__popstateListener))}.call(this),x.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(184)})().default)); //# sourceMappingURL=navigo.amd.min.js.map \ No newline at end of file diff --git a/lib/navigo.amd.min.js.map b/lib/navigo.amd.min.js.map index 29852fb9..cfdcf2b3 100644 --- a/lib/navigo.amd.min.js.map +++ b/lib/navigo.amd.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/startup","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand"],"names":["PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractGETParameters","url","tmp","split","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","currentPath","route","pattern","current","GETParams","params","paramNames","path","full","dots","name","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","context","idx","next","splice","moveForward","_setLocationPath","currentLocationPath","instance","root","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","to","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","matchLocation","f","d","concat","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","self","this","destroyed","indexOf","composePathWithRoot","createRoute","String","resolve","options","setLocationPath","call","document","querySelectorAll","link","hasListenerAttached","addEventListener","e","ctrlKey","metaKey","target","tagName","toLowerCase","getAttribute","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","navigate","pathToMatchObject","addHook","func","getRoute","nameOrHandler","find","r","on","Object","keys","p","uses","as","off","what","destroy","removeEventListener","__popstateListener","notFound","generate","getLinkPath","currentLocation","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","exports","module","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"2FAAO,IAAMA,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCexB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAcT,SAASG,EAAqBC,GACnC,IAAMC,EAAMN,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,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pG,QAAUgC,GArMpD,WACM+B,IACFsC,KAAKkD,mBAAqB,WACxB5C,KAEFzF,OAAOiG,iBAAiB,WAAYd,KAAKkD,sBAkMtCzC,KAAKT,MACZf,EAAgBwB,KAAKT,SC3XnB8D,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUC,QAG3C,IAAIC,EAASJ,EAAyBE,GAAY,CAGjDC,QAAS,IAOV,OAHAE,EAAoBH,GAAUE,EAAQA,EAAOD,QAASF,GAG/CG,EAAOD,QCjBf,OCFAF,EAAoBpF,EAAI,CAACsF,EAASG,KACjC,IAAI,IAAIlL,KAAOkL,EACXL,EAAoBM,EAAED,EAAYlL,KAAS6K,EAAoBM,EAAEJ,EAAS/K,IAC5EuJ,OAAO6B,eAAeL,EAAS/K,EAAK,CAAEqL,YAAY,EAAMC,IAAKJ,EAAWlL,MCJ3E6K,EAAoBM,EAAI,CAACpJ,EAAKwJ,IAAShC,OAAOiC,UAAUC,eAAelE,KAAKxF,EAAKwJ,GFG1EV,EAAoB,M","file":"navigo.amd.min.js","sourcesContent":["export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n [\n ...instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n // no match or different path\n if (\n !context.match ||\n !instance.matchLocation(\n oldMatch.route.path as string,\n context.match.url\n )\n ) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) => f(d, context.match);\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n ],\n {},\n () => done()\n );\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForLeaveHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n checkForLeaveHook,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.before) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.after) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n // console.log(\n // \"_processMatches matches=\" +\n // (context.matches ? context.matches.length : 0)\n // );\n (function nextMatch() {\n if (idx === context.matches.length) {\n done();\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n })();\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(\n currentLocationPath?: string,\n options?: ResolveOptions\n ): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => {\n // console.log(`${currentLocationPath} -> Matches: ${matches.length}`);\n return matches && matches.length > 0;\n },\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (!link.hasListenerAttached) {\n link.addEventListener(\"click\", function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n });\n link.hasListenerAttached = true;\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const result = routes.reduce((result, route) => {\n let key;\n\n if (route.name === name) {\n result = route.path as string;\n for (key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return result;\n }, \"\");\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(184);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo.amd/./src/constants.ts","webpack://Navigo.amd/./src/utils.ts","webpack://Navigo.amd/./src/Q.ts","webpack://Navigo.amd/./src/middlewares/setLocationPath.ts","webpack://Navigo.amd/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo.amd/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo.amd/./src/middlewares/checkForForceOp.ts","webpack://Navigo.amd/./src/middlewares/updateBrowserURL.ts","webpack://Navigo.amd/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo.amd/./src/lifecycles.ts","webpack://Navigo.amd/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo.amd/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo.amd/./src/middlewares/callHandler.ts","webpack://Navigo.amd/./src/middlewares/checkForAfterHook.ts","webpack://Navigo.amd/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo.amd/./src/middlewares/errorOut.ts","webpack://Navigo.amd/./src/middlewares/flushCurrent.ts","webpack://Navigo.amd/./src/middlewares/processMatches.ts","webpack://Navigo.amd/./src/index.ts","webpack://Navigo.amd/webpack/bootstrap","webpack://Navigo.amd/webpack/startup","webpack://Navigo.amd/webpack/runtime/define property getters","webpack://Navigo.amd/webpack/runtime/hasOwnProperty shorthand"],"names":["PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractGETParameters","url","tmp","split","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","currentPath","route","pattern","current","GETParams","params","paramNames","path","full","dots","name","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","context","idx","next","splice","moveForward","_setLocationPath","currentLocationPath","instance","root","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","to","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","matchLocation","f","d","concat","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","self","this","destroyed","indexOf","composePathWithRoot","createRoute","String","resolve","options","setLocationPath","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","navigate","addEventListener","removeEventListener","pathToMatchObject","addHook","func","getRoute","nameOrHandler","find","r","on","Object","keys","p","uses","as","off","what","destroy","__popstateListener","notFound","generate","getLinkPath","currentLocation","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","exports","module","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"2FAAO,IAAMA,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCexB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAcT,SAASG,EAAqBC,GACnC,IAAMC,EAAMN,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,EAAMM,EAAI,IAAKA,EAAIE,MAAM,GAAGC,KAAK,KAEpC,SAASC,EAAWC,GAGzB,IAFA,IAAIC,EAAQ,GACRC,EAAQF,EAAYJ,MAAM,KACrBO,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAOH,EAAMC,GAAGP,MAAM,KAC1B,GAAgB,KAAZS,EAAK,GAAW,CAClB,IAAIC,EAAMC,mBAAmBF,EAAK,IAC7BJ,EAAMK,IAGJE,MAAMC,QAAQR,EAAMK,MAAOL,EAAMK,GAAO,CAACL,EAAMK,KACpDL,EAAMK,GAAKI,KAAKH,mBAAmBF,EAAK,IAAM,MAH9CJ,EAAMK,GAAOC,mBAAmBF,EAAK,IAAM,KAOjD,OAAOJ,EAEF,SAASU,EAAWC,EAAqBC,GAA6B,IAIvEC,EAJuE,EA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BrF,EAAI,CAACuF,EAASG,KACjC,IAAI,IAAInL,KAAOmL,EACXL,EAAoBM,EAAED,EAAYnL,KAAS8K,EAAoBM,EAAEJ,EAAShL,IAC5EyJ,OAAO4B,eAAeL,EAAShL,EAAK,CAAEsL,YAAY,EAAMC,IAAKJ,EAAWnL,MCJ3E8K,EAAoBM,EAAI,CAACrJ,EAAKyJ,IAAS/B,OAAOgC,UAAUC,eAAenE,KAAKxF,EAAKyJ,GFG1EV,EAAoB,M","file":"navigo.amd.min.js","sourcesContent":["export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n [\n ...instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n // no match or different path\n if (\n !context.match ||\n !instance.matchLocation(\n oldMatch.route.path as string,\n context.match.url\n )\n ) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) => f(d, context.match);\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n ],\n {},\n () => done()\n );\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForLeaveHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n checkForLeaveHook,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.before) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.after) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n // console.log(\n // \"_processMatches matches=\" +\n // (context.matches ? context.matches.length : 0)\n // );\n (function nextMatch() {\n if (idx === context.matches.length) {\n done();\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n })();\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(\n currentLocationPath?: string,\n options?: ResolveOptions\n ): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => {\n // console.log(`${currentLocationPath} -> Matches: ${matches.length}`);\n return matches && matches.length > 0;\n },\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const result = routes.reduce((result, route) => {\n let key;\n\n if (route.name === name) {\n result = route.path as string;\n for (key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return result;\n }, \"\");\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(184);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.js b/lib/navigo.js index 960454cc..c9be3aab 100644 --- a/lib/navigo.js +++ b/lib/navigo.js @@ -262,8 +262,18 @@ function Navigo(appRoute, resolveOptions) { function updatePageLinks() { if (!isWindowAvailable) return; findLinks().forEach(function (link) { + if ("false" === link.getAttribute("data-navigo") || "_blank" === link.getAttribute("target")) { + if (link.hasListenerAttached) { + link.removeEventListener("click", link.navigoHandler); + } + + return; + } + if (!link.hasListenerAttached) { - link.addEventListener("click", function (e) { + link.hasListenerAttached = true; + + link.navigoHandler = function (e) { if ((e.ctrlKey || e.metaKey) && e.target.tagName.toLowerCase() === "a") { return false; } @@ -289,8 +299,9 @@ function Navigo(appRoute, resolveOptions) { e.stopPropagation(); self.navigate((0,_utils__WEBPACK_IMPORTED_MODULE_0__.clean)(location), options); } - }); - link.hasListenerAttached = true; + }; + + link.addEventListener("click", link.navigoHandler); } }); return self; diff --git a/lib/navigo.js.map b/lib/navigo.js.map index 67f7d793..fa47a579 100644 --- a/lib/navigo.js.map +++ b/lib/navigo.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo/webpack/runtime/make namespace object","webpack://Navigo/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","currentLocationPath","options","instance","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","navigate","to","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","off","what","filter","r","isFunction","listen","__popstateListener","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","hasListenerAttached","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","getAttribute","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","generate","data","result","reduce","route","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","find","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForLeaveHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForNotFoundHandler","notFoundHandled","errorOut","flushCurrent","undefinedOrTrue","_checkForAfterHook","after","already","before","map","beforeHookInternal","_","d","concat","force","oldMatch","leaveLoopDone","leave","notFoundRoute","notFoundMatch","i","nextMatch","end","_setLocationPath","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","fallback","s","regExpResultToParams","names","index","decodeURIComponent","join","query","pairs","pair","currentPath","GETParams","paramNames","pattern","full","dots","regexp","pushState","obj","source","str","temp","v","h"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;ACLe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAA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OAFH,CAEW,UAAC8J,CAAD,EAAO;AACd,KAAC,QAAD,EAAW,OAAX,EAAoB,SAApB,EAA+B,OAA/B,EAAwC9J,OAAxC,CAAgD,UAACiF,IAAD,EAAU;AACxD,UAAI6E,CAAC,CAAC7E,IAAD,CAAL,EAAa;AACX,YAAI,CAAClB,MAAM,CAACkB,IAAD,CAAX,EAAmBlB,MAAM,CAACkB,IAAD,CAAN,GAAe,EAAf;AACnBlB,cAAM,CAACkB,IAAD,CAAN,CAAa7E,IAAb,CAAkB0J,CAAC,CAAC7E,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOlB,MAAP;AACD,C;;;;;;UC5KD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(\n currentLocationPath?: string,\n options?: ResolveOptions\n ): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => {\n // console.log(`${currentLocationPath} -> Matches: ${matches.length}`);\n return matches && matches.length > 0;\n },\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (!link.hasListenerAttached) {\n link.addEventListener(\"click\", function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n });\n link.hasListenerAttached = true;\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const result = routes.reduce((result, route) => {\n let key;\n\n if (route.name === name) {\n result = route.path as string;\n for (key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return result;\n }, \"\");\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForLeaveHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n checkForLeaveHook,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.after) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.before) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n [\n ...instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n // no match or different path\n if (\n !context.match ||\n !instance.matchLocation(\n oldMatch.route.path as string,\n context.match.url\n )\n ) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) => f(d, context.match);\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n ],\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n // console.log(\n // \"_processMatches matches=\" +\n // (context.matches ? context.matches.length : 0)\n // );\n (function nextMatch() {\n if (idx === context.matches.length) {\n done();\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n })();\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand","webpack://Navigo/webpack/runtime/make namespace object","webpack://Navigo/webpack/startup"],"names":["Q","funcs","c","done","context","idx","next","Array","isArray","splice","moveForward","if","condition","one","two","PARAMETER_REGEXP","REPLACE_VARIABLE_REGEXP","WILDCARD_REGEXP","REPLACE_WILDCARD","NOT_SURE_REGEXP","REPLACE_NOT_SURE","START_BY_SLASH_REGEXP","MATCH_REGEXP_FLAGS","Navigo","appRoute","resolveOptions","DEFAULT_RESOLVE_OPTIONS","strategy","hash","noMatchWarning","self","root","current","routes","destroyed","genericHooks","isPushStateAvailable","pushStateAvailable","isWindowAvailable","windowAvailable","console","warn","clean","_checkForAHash","url","indexOf","split","composePathWithRoot","path","createRoute","handler","hooks","name","isString","String","accumulateHooks","on","RegExp","Object","keys","forEach","p","uses","as","push","resolve","currentLocationPath","options","instance","navigateOptions","setLocationPath","matchPathToRegisteredRoutes","matches","length","processMatches","notFoundLifeCycle","navigate","to","checkForDeprecationMethods","checkForForceOp","updateBrowserURL","off","what","filter","r","isFunction","listen","__popstateListener","window","addEventListener","destroy","removeEventListener","notFound","_notFoundRoute","updatePageLinks","findLinks","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","location","match","URL","u","pathname","search","err","parseNavigateOptions","preventDefault","stopPropagation","slice","call","document","querySelectorAll","setGenericHooks","lastResolved","generate","data","result","reduce","route","key","replace","getLinkPath","pathToMatchObject","extractGETParameters","queryString","params","parseQuery","getCurrentLocation","getCurrentEnvURL","directMatchWithRegisteredRoutes","directMatchWithLocation","currentLocation","matchRoute","addHook","type","func","getRoute","f","nameOrHandler","find","matchLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_pathToMatchObject","_clean","_setCurrent","foundLifecycle","checkForAlreadyHook","checkForLeaveHook","checkForBeforeHook","callHandler","checkForAfterHook","checkForNotFoundHandler","notFoundHandled","errorOut","flushCurrent","undefinedOrTrue","_checkForAfterHook","after","already","before","map","beforeHookInternal","_","d","concat","force","oldMatch","leaveLoopDone","leave","notFoundRoute","notFoundMatch","i","nextMatch","end","_setLocationPath","value","isItUsingHash","history","historyAPIMethod","stateObj","title","setTimeout","tmp","href","fallback","s","regExpResultToParams","names","index","decodeURIComponent","join","query","pairs","pair","currentPath","GETParams","paramNames","pattern","full","dots","regexp","pushState","obj","source","str","temp","v","h"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;ACLe,SAASA,CAAT,CACbC,KADa,EAEbC,CAFa,EAGbC,IAHa,EAIb;AACA,MAAMC,OAAO,GAAGF,CAAC,IAAI,EAArB;AACA,MAAIG,GAAG,GAAG,CAAV;;AAEA,GAAC,SAASC,IAAT,GAAgB;AACf,QAAI,CAACL,KAAK,CAACI,GAAD,CAAV,EAAiB;AACf,UAA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GAA2B;AAChC,SAAO,OAAOiD,MAAP,KAAkB,WAAzB;AACD;AACM,SAASjC,eAAT,CACLJ,KADK,EAELyE,MAFK,EAGc;AAAA,MAFnBzE,KAEmB;AAFnBA,SAEmB,GAFX,EAEW;AAAA;;AAAA,MADnByE,MACmB;AADnBA,UACmB,GADS,EACT;AAAA;;AACnBzE,OAAK,CACFgC,MADH,CACU,UAACwI,CAAD;AAAA,WAAOA,CAAP;AAAA,GADV,EAEG/J,OAFH,CAEW,UAAC+J,CAAD,EAAO;AACd,KAAC,QAAD,EAAW,OAAX,EAAoB,SAApB,EAA+B,OAA/B,EAAwC/J,OAAxC,CAAgD,UAACkF,IAAD,EAAU;AACxD,UAAI6E,CAAC,CAAC7E,IAAD,CAAL,EAAa;AACX,YAAI,CAAClB,MAAM,CAACkB,IAAD,CAAX,EAAmBlB,MAAM,CAACkB,IAAD,CAAN,GAAe,EAAf;AACnBlB,cAAM,CAACkB,IAAD,CAAN,CAAa9E,IAAb,CAAkB2J,CAAC,CAAC7E,IAAD,CAAnB;AACD;AACF,KALD;AAMD,GATH;AAUA,SAAOlB,MAAP;AACD,C;;;;;;UC5KD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,sF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"navigo.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(\n currentLocationPath?: string,\n options?: ResolveOptions\n ): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => {\n // console.log(`${currentLocationPath} -> Matches: ${matches.length}`);\n return matches && matches.length > 0;\n },\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const result = routes.reduce((result, route) => {\n let key;\n\n if (route.name === name) {\n result = route.path as string;\n for (key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return result;\n }, \"\");\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForLeaveHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n checkForLeaveHook,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.after) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.before) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n [\n ...instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n // no match or different path\n if (\n !context.match ||\n !instance.matchLocation(\n oldMatch.route.path as string,\n context.match.url\n )\n ) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) => f(d, context.match);\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n ],\n {},\n () => done()\n );\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n // console.log(\n // \"_processMatches matches=\" +\n // (context.matches ? context.matches.length : 0)\n // );\n (function nextMatch() {\n if (idx === context.matches.length) {\n done();\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n })();\n}\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.ts\");\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/navigo.min.js b/lib/navigo.min.js index 3c3b3631..12198030 100644 --- a/lib/navigo.min.js +++ b/lib/navigo.min.js @@ -1,2 +1,2 @@ -!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Navigo",[],n):"object"==typeof exports?exports.Navigo=n():t.Navigo=n()}("undefined"!=typeof self?self:this,(function(){return(()=>{"use strict";var t={184:(t,n,e)=>{e.d(n,{default:()=>S});var o=/([:*])(\w+)/g,r=/\*/g,a=/\/\?/g;function i(t){return void 0===t&&(t="/"),d()?location.pathname+location.search+location.hash:t}function c(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function s(t){return"string"==typeof t}function u(t){var n=c(t).split(/\?(.*)?$/);return[c(n[0]),n.slice(1).join("")]}function h(t){for(var n={},e=t.split("&"),o=0;o=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function S(t){return c(a+"/"+c(t))}function x(t,n,e,o){return t=s(t)?S(t):t,{name:o||c(String(t)),path:t,handler:n,hooks:v(e)}}function j(t,n){var e={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:n||o};return g([m,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,A)],e),!!e.matches&&e.matches}function H(){if(_)return(_?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){t.hasListenerAttached||(t.addEventListener("click",(function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var a=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));w||(n.preventDefault(),n.stopPropagation(),r.navigate(c(e),a))})),t.hasListenerAttached=!0)})),r}function C(t){var n=u(c(t)),o=n[0],r=n[1],a=""===r?null:h(r);return{url:o,queryString:r,route:x(o,(function(){}),[e],o),data:null,params:a}}function N(t,n,e){return"string"==typeof n&&(n=U(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function U(t){return"string"==typeof t?L.find((function(n){return n.name===S(t)})):L.find((function(n){return n.handler===t}))}t?a=c(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=L,this.destroyed=w,this.current=p,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=a),L.push(x(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],a=o.uses,i=o.as,c=o.hooks;L.push(x(n,a,[e,c],i))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return s(t)?c(n.path)!==c(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=j,this.navigate=function(t,n){t=c(a)+"/"+c(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};g([O,k,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,A),b],e)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=w=!0},this.notFound=function(t,n){return r._notFoundRoute=x("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=H,this.link=function(t){return"/"+a+"/"+c(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return u(R(t))},this.lastResolved=function(){return p},this.generate=function(t,n){var e=L.reduce((function(e,o){var r;if(o.name===t)for(r in e=o.path,n)e=e.replace(":"+r,n[r]);return e}),"");return e.match(/^\//)?e:"/"+e},this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:o};return y(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n){var e={instance:r,currentLocationPath:n};return m(e,(function(){})),t=c(t),f(e.currentLocationPath,{name:t,path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return C(c(i(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=N.bind(this,"before"),this.addAfterHook=N.bind(this,"after"),this.addAlreadyHook=N.bind(this,"already"),this.addLeaveHook=N.bind(this,"leave"),this.getRoute=U,this._pathToMatchObject=C,this._clean=c,this._checkForAHash=R,this._setCurrent=function(t){return p=r.current=t},function(){P&&(this.__popstateListener=function(){j()},window.addEventListener("popstate",this.__popstateListener))}.call(this),H.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(184)})().default})); +!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Navigo",[],n):"object"==typeof exports?exports.Navigo=n():t.Navigo=n()}("undefined"!=typeof self?self:this,(function(){return(()=>{"use strict";var t={184:(t,n,e)=>{e.d(n,{default:()=>S});var o=/([:*])(\w+)/g,r=/\*/g,a=/\/\?/g;function i(t){return void 0===t&&(t="/"),d()?location.pathname+location.search+location.hash:t}function c(t){return t.replace(/\/+$/,"").replace(/^\/+/,"")}function s(t){return"string"==typeof t}function u(t){var n=c(t).split(/\?(.*)?$/);return[c(n[0]),n.slice(1).join("")]}function h(t){for(var n={},e=t.split("&"),o=0;o=0&&(t=!0===o.hash?t.split("#")[1]||"/":t.split("#")[0]),t}function S(t){return c(a+"/"+c(t))}function x(t,n,e,o){return t=s(t)?S(t):t,{name:o||c(String(t)),path:t,handler:n,hooks:v(e)}}function H(t,n){var e={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:n||o};return g([m,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_)],e),!!e.matches&&e.matches}function j(){if(A)return(A?[].slice.call(document.querySelectorAll("[data-navigo]")):[]).forEach((function(t){"false"!==t.getAttribute("data-navigo")&&"_blank"!==t.getAttribute("target")?t.hasListenerAttached||(t.hasListenerAttached=!0,t.navigoHandler=function(n){if((n.ctrlKey||n.metaKey)&&"a"===n.target.tagName.toLowerCase())return!1;var e=t.getAttribute("href");if(null==e)return!1;if(e.match(/^(http|https)/)&&"undefined"!=typeof URL)try{var o=new URL(e);e=o.pathname+o.search}catch(t){}var a=function(t){if(!t)return{};var n,e=t.split(","),o={};return e.forEach((function(t){var e=t.split(":").map((function(t){return t.replace(/(^ +| +$)/g,"")}));switch(e[0]){case"historyAPIMethod":o.historyAPIMethod=e[1];break;case"resolveOptionsStrategy":n||(n={}),n.strategy=e[1];break;case"resolveOptionsHash":n||(n={}),n.hash="true"===e[1];break;case"updateBrowserURL":case"callHandler":case"updateState":case"force":o[e[0]]="true"===e[1]}})),n&&(o.resolveOptions=n),o}(t.getAttribute("data-navigo-options"));b||(n.preventDefault(),n.stopPropagation(),r.navigate(c(e),a))},t.addEventListener("click",t.navigoHandler)):t.hasListenerAttached&&t.removeEventListener("click",t.navigoHandler)})),r}function C(t){var n=u(c(t)),o=n[0],r=n[1],a=""===r?null:h(r);return{url:o,queryString:r,route:x(o,(function(){}),[e],o),data:null,params:a}}function N(t,n,e){return"string"==typeof n&&(n=U(n)),n?(n.hooks[t]||(n.hooks[t]=[]),n.hooks[t].push(e),function(){n.hooks[t]=n.hooks[t].filter((function(t){return t!==e}))}):(console.warn("Route doesn't exists: "+n),function(){})}function U(t){return"string"==typeof t?L.find((function(n){return n.name===S(t)})):L.find((function(n){return n.handler===t}))}t?a=c(t):console.warn('Navigo requires a root path in its constructor. If not provided will use "/" as default.'),this.root=a,this.routes=L,this.destroyed=b,this.current=p,this.on=function(t,n,o){var r=this;return"object"!=typeof t||t instanceof RegExp?("function"==typeof t&&(o=n,n=t,t=a),L.push(x(t,n,[e,o])),this):(Object.keys(t).forEach((function(n){if("function"==typeof t[n])r.on(n,t[n]);else{var o=t[n],a=o.uses,i=o.as,c=o.hooks;L.push(x(n,a,[e,c],i))}})),this)},this.off=function(t){return this.routes=L=L.filter((function(n){return s(t)?c(n.path)!==c(t):"function"==typeof t?t!==n.handler:String(n.path)!==String(t)})),this},this.resolve=H,this.navigate=function(t,n){t=c(a)+"/"+c(t);var e={instance:r,to:t,navigateOptions:n||{},resolveOptions:n&&n.resolveOptions?n.resolveOptions:o,currentLocationPath:R(t)};g([O,k,y,g.if((function(t){var n=t.matches;return n&&n.length>0}),E,_),w],e)},this.destroy=function(){this.routes=L=[],P&&window.removeEventListener("popstate",this.__popstateListener),this.destroyed=b=!0},this.notFound=function(t,n){return r._notFoundRoute=x("*",t,[e,n],"__NOT_FOUND__"),this},this.updatePageLinks=j,this.link=function(t){return"/"+a+"/"+c(t)},this.hooks=function(t){return e=t,this},this.extractGETParameters=function(t){return u(R(t))},this.lastResolved=function(){return p},this.generate=function(t,n){var e=L.reduce((function(e,o){var r;if(o.name===t)for(r in e=o.path,n)e=e.replace(":"+r,n[r]);return e}),"");return e.match(/^\//)?e:"/"+e},this.getLinkPath=function(t){return t.getAttribute("href")},this.match=function(t){var n={instance:r,currentLocationPath:t,navigateOptions:{},resolveOptions:o};return y(n,(function(){})),!!n.matches&&n.matches},this.matchLocation=function(t,n){var e={instance:r,currentLocationPath:n};return m(e,(function(){})),t=c(t),f(e.currentLocationPath,{name:t,path:t,handler:function(){},hooks:{}})||!1},this.getCurrentLocation=function(){return C(c(i(a)).replace(new RegExp("^"+a),""))},this.addBeforeHook=N.bind(this,"before"),this.addAfterHook=N.bind(this,"after"),this.addAlreadyHook=N.bind(this,"already"),this.addLeaveHook=N.bind(this,"leave"),this.getRoute=U,this._pathToMatchObject=C,this._clean=c,this._checkForAHash=R,this._setCurrent=function(t){return p=r.current=t},function(){P&&(this.__popstateListener=function(){H()},window.addEventListener("popstate",this.__popstateListener))}.call(this),j.call(this)}}},n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{}};return t[o](r,r.exports,e),r.exports}return e.d=(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e(184)})().default})); //# sourceMappingURL=navigo.min.js.map \ No newline at end of file diff --git a/lib/navigo.min.js.map b/lib/navigo.min.js.map index 76b15ca0..4883a8e8 100644 --- a/lib/navigo.min.js.map +++ b/lib/navigo.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/startup","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand"],"names":["root","factory","exports","module","define","amd","self","this","PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractGETParameters","url","tmp","split","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","currentPath","route","pattern","current","GETParams","params","paramNames","path","full","dots","name","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","context","idx","next","splice","moveForward","_setLocationPath","currentLocationPath","instance","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","to","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","matchLocation","f","d","concat","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","destroyed","indexOf","composePathWithRoot","createRoute","String","resolve","options","setLocationPath","call","document","querySelectorAll","link","hasListenerAttached","addEventListener","e","ctrlKey","metaKey","target","tagName","toLowerCase","getAttribute","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","navigate","pathToMatchObject","addHook","func","getRoute","nameOrHandler","find","r","on","Object","keys","p","uses","as","off","what","destroy","removeEventListener","__popstateListener","notFound","generate","getLinkPath","currentLocation","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,SAAU,GAAIH,GACK,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,IARnB,CASmB,oBAATK,KAAuBA,KAAOC,MAAM,WAC9C,M,+DCVO,IAAMC,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCexB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAcT,SAASG,EAAqBC,GACnC,IAAMC,EAAMN,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,EAAMM,EAAI,IAAKA,EAAIE,MAAM,GAAGC,KAAK,KAEpC,SAASC,EAAW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AAYrJ,KAAKyL,sBAkMtCzC,KAAKhJ,MACZ0H,EAAgBsB,KAAKhJ,SC3XnBqM,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAU5M,QAG3C,IAAIC,EAASyM,EAAyBE,GAAY,CAGjD5M,QAAS,IAOV,OAHA6M,EAAoBD,GAAU3M,EAAQA,EAAOD,QAAS2M,GAG/C1M,EAAOD,QCjBf,OCFA2M,EAAoBlF,EAAI,CAACzH,EAAS8M,KACjC,IAAI,IAAI7K,KAAO6K,EACXH,EAAoBI,EAAED,EAAY7K,KAAS0K,EAAoBI,EAAE/M,EAASiC,IAC5EoJ,OAAO2B,eAAehN,EAASiC,EAAK,CAAEgL,YAAY,EAAMC,IAAKJ,EAAW7K,MCJ3E0K,EAAoBI,EAAI,CAAC/I,EAAKmJ,IAAS9B,OAAO+B,UAAUC,eAAehE,KAAKrF,EAAKmJ,GFG1ER,EAAoB,M","file":"navigo.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n [\n ...instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n // no match or different path\n if (\n !context.match ||\n !instance.matchLocation(\n oldMatch.route.path as string,\n context.match.url\n )\n ) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) => f(d, context.match);\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n ],\n {},\n () => done()\n );\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForLeaveHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n checkForLeaveHook,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.before) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.after) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n // console.log(\n // \"_processMatches matches=\" +\n // (context.matches ? context.matches.length : 0)\n // );\n (function nextMatch() {\n if (idx === context.matches.length) {\n done();\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n })();\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(\n currentLocationPath?: string,\n options?: ResolveOptions\n ): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => {\n // console.log(`${currentLocationPath} -> Matches: ${matches.length}`);\n return matches && matches.length > 0;\n },\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (!link.hasListenerAttached) {\n link.addEventListener(\"click\", function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n });\n link.hasListenerAttached = true;\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const result = routes.reduce((result, route) => {\n let key;\n\n if (route.name === name) {\n result = route.path as string;\n for (key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return result;\n }, \"\");\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(184);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Navigo/webpack/universalModuleDefinition","webpack://Navigo/./src/constants.ts","webpack://Navigo/./src/utils.ts","webpack://Navigo/./src/Q.ts","webpack://Navigo/./src/middlewares/setLocationPath.ts","webpack://Navigo/./src/middlewares/matchPathToRegisteredRoutes.ts","webpack://Navigo/./src/middlewares/checkForDeprecationMethods.ts","webpack://Navigo/./src/middlewares/checkForForceOp.ts","webpack://Navigo/./src/middlewares/updateBrowserURL.ts","webpack://Navigo/./src/middlewares/checkForLeaveHook.ts","webpack://Navigo/./src/lifecycles.ts","webpack://Navigo/./src/middlewares/checkForAlreadyHook.ts","webpack://Navigo/./src/middlewares/checkForBeforeHook.ts","webpack://Navigo/./src/middlewares/callHandler.ts","webpack://Navigo/./src/middlewares/checkForAfterHook.ts","webpack://Navigo/./src/middlewares/checkForNotFoundHandler.ts","webpack://Navigo/./src/middlewares/errorOut.ts","webpack://Navigo/./src/middlewares/flushCurrent.ts","webpack://Navigo/./src/middlewares/processMatches.ts","webpack://Navigo/./src/index.ts","webpack://Navigo/webpack/bootstrap","webpack://Navigo/webpack/startup","webpack://Navigo/webpack/runtime/define property getters","webpack://Navigo/webpack/runtime/hasOwnProperty shorthand"],"names":["root","factory","exports","module","define","amd","self","this","PARAMETER_REGEXP","WILDCARD_REGEXP","NOT_SURE_REGEXP","getCurrentEnvURL","fallback","windowAvailable","location","pathname","search","hash","clean","s","replace","isString","extractGETParameters","url","tmp","split","slice","join","parseQuery","queryString","query","pairs","i","length","pair","key","decodeURIComponent","Array","isArray","push","matchRoute","currentPath","route","pattern","current","GETParams","params","paramNames","path","full","dots","name","data","regexp","RegExp","match","names","reduce","value","index","regExpResultToParams","pushStateAvailable","window","history","pushState","undefinedOrTrue","obj","accumulateHooks","hooks","result","filter","h","forEach","type","Q","funcs","c","done","context","idx","next","splice","moveForward","_setLocationPath","currentLocationPath","instance","_checkForAHash","matchPathToRegisteredRoutes","routes","matches","resolveOptions","strategy","checkForDeprecationMethods","navigateOptions","console","warn","checkForForceOp","force","_setCurrent","_pathToMatchObject","to","if","condition","one","two","isWindowAvailable","isPushStateAvailable","updateBrowserURL","isItUsingHash","historyAPIMethod","stateObj","title","setTimeout","href","checkForLeaveHook","lastResolved","map","oldMatch","_","leaveLoopDone","leave","matchLocation","f","d","concat","foundLifecycle","already","before","handler","updatePageLinks","after","notFoundLifeCycle","notFoundRoute","_notFoundRoute","notFoundHandled","notFoundMatch","noMatchWarning","processMatches","nextMatch","Navigo","appRoute","genericHooks","DEFAULT_RESOLVE_OPTIONS","destroyed","indexOf","composePathWithRoot","createRoute","String","resolve","options","setLocationPath","call","document","querySelectorAll","link","getAttribute","hasListenerAttached","navigoHandler","e","ctrlKey","metaKey","target","tagName","toLowerCase","URL","u","err","source","str","temp","v","parseNavigateOptions","preventDefault","stopPropagation","navigate","addEventListener","removeEventListener","pathToMatchObject","addHook","func","getRoute","nameOrHandler","find","r","on","Object","keys","p","uses","as","off","what","destroy","__popstateListener","notFound","generate","getLinkPath","currentLocation","getCurrentLocation","addBeforeHook","bind","addAfterHook","addAlreadyHook","addLeaveHook","_clean","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","definition","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,SAAU,GAAIH,GACK,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,IARnB,CASmB,oBAATK,KAAuBA,KAAOC,MAAM,WAC9C,M,+DCVO,IAAMC,EAAmB,eAEnBC,EAAkB,MAElBC,EAAkB,QCexB,SAASC,EAAiBC,GAC/B,YADuD,IAAxBA,MAAW,KACtCC,IACKC,SAASC,SAAWD,SAASE,OAASF,SAASG,KAEjDL,EAEF,SAASM,EAAMC,GACpB,OAAOA,EAAEC,QAAQ,OAAQ,IAAIA,QAAQ,OAAQ,IAExC,SAASC,EAASF,GACvB,MAAoB,iBAANA,EAcT,SAASG,EAAqBC,GACnC,IAAMC,EAAMN,EAAMK,GAAKE,MAAM,YAC7B,MAAO,CAACP,EAAMM,EAAI,IAAKA,EAAIE,MAAM,GAAGC,KAAK,KAEpC,SAASC,EAAWC,GAGzB,IAFA,IAAIC,EAAQ,GACRC,EAAQF,EAAYJ,MAAM,KACrBO,EAAI,EAAGA,EAAID,EAA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,GA/MpD,WACM8B,IACFnG,KAAK0L,mBAAqB,WACxB7C,KAEFtF,OAAOiH,iBAAiB,WAAYxK,KAAK0L,sBA4MtC1C,KAAKhJ,MACZ0H,EAAgBsB,KAAKhJ,SCrYnBsM,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAU7M,QAG3C,IAAIC,EAAS0M,EAAyBE,GAAY,CAGjD7M,QAAS,IAOV,OAHA8M,EAAoBD,GAAU5M,EAAQA,EAAOD,QAAS4M,GAG/C3M,EAAOD,QCjBf,OCFA4M,EAAoBnF,EAAI,CAACzH,EAAS+M,KACjC,IAAI,IAAI9K,KAAO8K,EACXH,EAAoBI,EAAED,EAAY9K,KAAS2K,EAAoBI,EAAEhN,EAASiC,IAC5EsJ,OAAO0B,eAAejN,EAASiC,EAAK,CAAEiL,YAAY,EAAMC,IAAKJ,EAAW9K,MCJ3E2K,EAAoBI,EAAI,CAAChJ,EAAKoJ,IAAS7B,OAAO8B,UAAUC,eAAejE,KAAKrF,EAAKoJ,GFG1ER,EAAoB,M","file":"navigo.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Navigo\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Navigo\"] = factory();\n\telse\n\t\troot[\"Navigo\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn ","export const PARAMETER_REGEXP = /([:*])(\\w+)/g;\nexport const REPLACE_VARIABLE_REGEXP = \"([^/]+)\";\nexport const WILDCARD_REGEXP = /\\*/g;\nexport const REPLACE_WILDCARD = \"(?:.*)\";\nexport const NOT_SURE_REGEXP = /\\/\\?/g;\nexport const REPLACE_NOT_SURE = \"/?([^/]+|)\";\nexport const START_BY_SLASH_REGEXP = \"(?:/^|^)\";\nexport const MATCH_REGEXP_FLAGS = \"\";\n","import {\n RouteHooksStorage,\n Match,\n Route,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\n\nimport {\n PARAMETER_REGEXP,\n WILDCARD_REGEXP,\n REPLACE_VARIABLE_REGEXP,\n REPLACE_WILDCARD,\n START_BY_SLASH_REGEXP,\n MATCH_REGEXP_FLAGS,\n REPLACE_NOT_SURE,\n NOT_SURE_REGEXP,\n} from \"./constants\";\n\nexport function getCurrentEnvURL(fallback = \"/\"): string {\n if (windowAvailable()) {\n return location.pathname + location.search + location.hash;\n }\n return fallback;\n}\nexport function clean(s: string) {\n return s.replace(/\\/+$/, \"\").replace(/^\\/+/, \"\");\n}\nexport function isString(s: any): boolean {\n return typeof s === \"string\";\n}\nexport function isFunction(s: any): boolean {\n return typeof s === \"function\";\n}\nexport function regExpResultToParams(match, names: string[]) {\n if (names.length === 0) return null;\n if (!match) return null;\n return match.slice(1, match.length).reduce((params, value, index) => {\n if (params === null) params = {};\n params[names[index]] = decodeURIComponent(value);\n return params;\n }, null);\n}\nexport function extractGETParameters(url: string) {\n const tmp = clean(url).split(/\\?(.*)?$/);\n return [clean(tmp[0]), tmp.slice(1).join(\"\")];\n}\nexport function parseQuery(queryString: string): Object {\n var query = {};\n var pairs = queryString.split(\"&\");\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split(\"=\");\n if (pair[0] !== \"\") {\n let key = decodeURIComponent(pair[0]);\n if (!query[key]) {\n query[key] = decodeURIComponent(pair[1] || \"\");\n } else {\n if (!Array.isArray(query[key])) query[key] = [query[key]];\n query[key].push(decodeURIComponent(pair[1] || \"\"));\n }\n }\n }\n return query;\n}\nexport function matchRoute(currentPath: string, route: Route): false | Match {\n const [current, GETParams] = extractGETParameters(clean(currentPath));\n const params = GETParams === \"\" ? null : parseQuery(GETParams);\n const paramNames = [];\n let pattern;\n if (isString(route.path)) {\n pattern =\n START_BY_SLASH_REGEXP +\n clean(route.path as string)\n .replace(PARAMETER_REGEXP, function (full, dots, name) {\n paramNames.push(name);\n return REPLACE_VARIABLE_REGEXP;\n })\n .replace(WILDCARD_REGEXP, REPLACE_WILDCARD)\n .replace(NOT_SURE_REGEXP, REPLACE_NOT_SURE) +\n \"$\";\n if (clean(route.path as string) === \"\") {\n if (clean(current) === \"\") {\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data: null,\n params,\n };\n }\n }\n } else {\n pattern = route.path;\n }\n const regexp = new RegExp(pattern, MATCH_REGEXP_FLAGS);\n const match = current.match(regexp);\n\n if (match) {\n const data = isString(route.path)\n ? regExpResultToParams(match, paramNames)\n : match.slice(1);\n return {\n url: current,\n queryString: GETParams,\n route: route,\n data,\n params,\n };\n }\n return false;\n}\nexport function pushStateAvailable(): boolean {\n return !!(\n typeof window !== \"undefined\" &&\n window.history &&\n window.history.pushState\n );\n}\nexport function undefinedOrTrue(obj, key: string): boolean {\n return typeof obj[key] === \"undefined\" || obj[key] === true;\n}\nexport function parseNavigateOptions(source?: string): NavigateOptions {\n if (!source) return {};\n const pairs = source.split(\",\");\n const options: NavigateOptions = {};\n let resolveOptions: ResolveOptions;\n\n pairs.forEach((str) => {\n const temp = str.split(\":\").map((v) => v.replace(/(^ +| +$)/g, \"\"));\n switch (temp[0]) {\n case \"historyAPIMethod\":\n options.historyAPIMethod = temp[1];\n break;\n case \"resolveOptionsStrategy\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.strategy = temp[1];\n break;\n case \"resolveOptionsHash\":\n if (!resolveOptions) resolveOptions = {};\n resolveOptions.hash = temp[1] === \"true\";\n break;\n case \"updateBrowserURL\":\n case \"callHandler\":\n case \"updateState\":\n case \"force\":\n options[temp[0]] = temp[1] === \"true\";\n break;\n }\n });\n if (resolveOptions) {\n options.resolveOptions = resolveOptions;\n }\n return options;\n}\nexport function windowAvailable() {\n return typeof window !== \"undefined\";\n}\nexport function accumulateHooks(\n hooks = [],\n result: RouteHooksStorage = {}\n): RouteHooksStorage {\n hooks\n .filter((h) => h)\n .forEach((h) => {\n [\"before\", \"after\", \"already\", \"leave\"].forEach((type) => {\n if (h[type]) {\n if (!result[type]) result[type] = [];\n result[type].push(h[type]);\n }\n });\n });\n return result as RouteHooksStorage;\n}\n","type QChild = {\n type: \"child\";\n funcs: Array | QChild>;\n};\n\nexport default function Q(\n funcs: Array | QChild>,\n c?: any,\n done?: Function\n) {\n const context = c || {};\n let idx = 0;\n\n (function next() {\n if (!funcs[idx]) {\n if (done) {\n done(context);\n }\n return;\n }\n if (Array.isArray(funcs[idx])) {\n funcs.splice(\n idx,\n 1,\n ...(funcs[idx][0](context) ? funcs[idx][1] : funcs[idx][2])\n );\n next();\n } else {\n // console.log(funcs[idx].name + \" / \" + JSON.stringify(context));\n // console.log(funcs[idx].name);\n (funcs[idx] as Function)(context, (moveForward) => {\n if (typeof moveForward === \"undefined\" || moveForward === true) {\n idx += 1;\n next();\n } else if (done) {\n done(context);\n }\n });\n }\n })();\n}\n\nQ.if = function (condition: Function, one, two) {\n if (!Array.isArray(one)) one = [one];\n if (!Array.isArray(two)) two = [two];\n return [condition, one, two];\n};\n","import { QContext } from \"../../index\";\nimport { getCurrentEnvURL } from \"../utils\";\n\nexport default function _setLocationPath(context: QContext, done) {\n if (typeof context.currentLocationPath === \"undefined\") {\n context.currentLocationPath = getCurrentEnvURL(context.instance.root);\n }\n context.currentLocationPath = context.instance._checkForAHash(\n context.currentLocationPath\n );\n done();\n}\n","import { matchRoute } from \"../utils\";\nimport { QContext, Match } from \"../../index\";\n\nexport default function matchPathToRegisteredRoutes(context: QContext, done) {\n for (let i = 0; i < context.instance.routes.length; i++) {\n const route = context.instance.routes[i];\n const match: false | Match = matchRoute(context.currentLocationPath, route);\n if (match) {\n if (!context.matches) context.matches = [];\n context.matches.push(match);\n if (context.resolveOptions.strategy === \"ONE\") {\n done();\n return;\n }\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForDeprecationMethods(context: QContext, done) {\n if (context.navigateOptions) {\n if (typeof context.navigateOptions[\"shouldResolve\"] !== \"undefined\") {\n console.warn(\n `\"shouldResolve\" is deprecated. Please check the documentation.`\n );\n }\n if (typeof context.navigateOptions[\"silent\"] !== \"undefined\") {\n console.warn(`\"silent\" is deprecated. Please check the documentation.`);\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function checkForForceOp(context: QContext, done) {\n if (context.navigateOptions.force === true) {\n context.instance._setCurrent([\n context.instance._pathToMatchObject(context.to),\n ]);\n done(false);\n } else {\n done();\n }\n}\n","import { undefinedOrTrue, pushStateAvailable, windowAvailable } from \"../utils\";\nimport { QContext } from \"../../index\";\n\nconst isWindowAvailable = windowAvailable();\nconst isPushStateAvailable = pushStateAvailable();\n\nexport default function updateBrowserURL(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateBrowserURL\")) {\n const value = `/${context.to}`.replace(/\\/\\//g, \"/\"); // making sure that we don't have two slashes\n const isItUsingHash =\n isWindowAvailable &&\n context.resolveOptions &&\n context.resolveOptions.hash === true;\n if (isPushStateAvailable) {\n history[context.navigateOptions.historyAPIMethod || \"pushState\"](\n context.navigateOptions.stateObj || {},\n context.navigateOptions.title || \"\",\n isItUsingHash ? `#${value}` : value\n );\n // This is to solve a nasty bug where the page doesn't scroll to the anchor.\n // We set a microtask to update the hash only.\n if (location && location.hash) {\n setTimeout(() => {\n let tmp = location.hash;\n location.hash = \"\";\n location.hash = tmp;\n }, 1);\n }\n } else if (isWindowAvailable) {\n window.location.href = context.to;\n }\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForLeaveHook(context: QContext, done) {\n const instance = context.instance;\n if (!instance.lastResolved()) {\n done();\n return;\n }\n Q(\n [\n ...instance.lastResolved().map((oldMatch) => {\n return (_, leaveLoopDone) => {\n // no leave hook\n if (!oldMatch.route.hooks || !oldMatch.route.hooks.leave) {\n leaveLoopDone();\n return;\n }\n // no match or different path\n if (\n !context.match ||\n !instance.matchLocation(\n oldMatch.route.path as string,\n context.match.url\n )\n ) {\n Q(\n oldMatch.route.hooks.leave\n .map((f) => {\n // just so we match the Q interface\n return (_, d) => f(d, context.match);\n })\n .concat([() => leaveLoopDone()])\n );\n return;\n } else {\n leaveLoopDone();\n }\n };\n }),\n ],\n {},\n () => done()\n );\n}\n","import { QContext } from \"../index\";\nimport Q from \"./Q\";\nimport checkForLeaveHook from \"./middlewares/checkForLeaveHook\";\nimport checkForBeforeHook from \"./middlewares/checkForBeforeHook\";\nimport callHandler from \"./middlewares/callHandler\";\nimport checkForAfterHook from \"./middlewares/checkForAfterHook\";\nimport checkForAlreadyHook from \"./middlewares/checkForAlreadyHook\";\nimport checkForNotFoundHandler from \"./middlewares/checkForNotFoundHandler\";\nimport errorOut from \"./middlewares/errorOut\";\nimport flushCurrent from \"./middlewares/flushCurrent\";\n\nexport const foundLifecycle = [\n checkForAlreadyHook,\n checkForLeaveHook,\n checkForBeforeHook,\n callHandler,\n checkForAfterHook,\n];\n\nexport const notFoundLifeCycle = [\n checkForNotFoundHandler,\n Q.if(({ notFoundHandled }: QContext) => notFoundHandled, foundLifecycle, [\n errorOut,\n checkForLeaveHook,\n ]),\n flushCurrent,\n];\n","import { QContext } from \"../../index\";\n\nexport default function checkForAlreadyHook(context: QContext, done) {\n const current = context.instance.lastResolved();\n if (\n current &&\n current[0] &&\n current[0].route === context.match.route &&\n current[0].url === context.match.url &&\n current[0].queryString === context.match.queryString\n ) {\n current.forEach((c) => {\n if (c.route.hooks && c.route.hooks.already) {\n c.route.hooks.already.forEach((f) => f(context.match));\n }\n });\n done(false);\n return;\n }\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\n\nexport default function checkForBeforeHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.before) {\n Q(\n context.match.route.hooks.before\n .map((f) => {\n // just so we match the Q interface\n return function beforeHookInternal(_, d) {\n return f(d, context.match);\n };\n })\n .concat([() => done()])\n );\n } else {\n done();\n }\n}\n","import { QContext } from \"../../index\";\nimport { undefinedOrTrue } from \"../utils\";\n\nexport default function callHandler(context: QContext, done) {\n if (undefinedOrTrue(context.navigateOptions, \"updateState\")) {\n context.instance._setCurrent(context.matches);\n }\n if (undefinedOrTrue(context.navigateOptions, \"callHandler\")) {\n context.match.route.handler(context.match);\n }\n context.instance.updatePageLinks();\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function _checkForAfterHook(context: QContext, done) {\n if (context.match.route.hooks && context.match.route.hooks.after) {\n context.match.route.hooks.after.forEach((f) => f(context.match));\n }\n done();\n}\n","import { QContext, Match } from \"../../index\";\nimport { parseQuery, extractGETParameters, clean } from \"../utils\";\n\nexport default function checkForNotFoundHandler(context: QContext, done) {\n const notFoundRoute = context.instance._notFoundRoute;\n if (notFoundRoute) {\n context.notFoundHandled = true;\n const [url, queryString] = extractGETParameters(\n context.currentLocationPath\n );\n notFoundRoute.path = clean(url);\n const notFoundMatch: Match = {\n url: notFoundRoute.path,\n queryString,\n data: null,\n route: notFoundRoute,\n params: queryString !== \"\" ? parseQuery(queryString) : null,\n };\n context.matches = [notFoundMatch];\n context.match = notFoundMatch;\n }\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function errorOut(context: QContext, done) {\n if (\n !context.resolveOptions ||\n context.resolveOptions.noMatchWarning === false ||\n typeof context.resolveOptions.noMatchWarning === \"undefined\"\n )\n console.warn(\n `Navigo: \"${context.currentLocationPath}\" didn't match any of the registered routes.`\n );\n done();\n}\n","import { QContext } from \"../../index\";\n\nexport default function flushCurrent(context: QContext, done) {\n context.instance._setCurrent(null);\n done();\n}\n","import { QContext } from \"../../index\";\nimport Q from \"../Q\";\nimport { foundLifecycle } from \"../lifecycles\";\n\nexport default function processMatches(context: QContext, done) {\n let idx = 0;\n // console.log(\n // \"_processMatches matches=\" +\n // (context.matches ? context.matches.length : 0)\n // );\n (function nextMatch() {\n if (idx === context.matches.length) {\n done();\n return;\n }\n Q(\n foundLifecycle,\n { ...context, match: context.matches[idx] },\n function end() {\n idx += 1;\n nextMatch();\n }\n );\n })();\n}\n","import {\n Match,\n Route,\n RouteHooks,\n QContext,\n NavigateOptions,\n ResolveOptions,\n} from \"../index\";\nimport NavigoRouter from \"../index\";\nimport {\n pushStateAvailable,\n matchRoute,\n parseQuery,\n extractGETParameters,\n isFunction,\n isString,\n clean,\n parseNavigateOptions,\n windowAvailable,\n getCurrentEnvURL,\n accumulateHooks,\n} from \"./utils\";\nimport Q from \"./Q\";\nimport setLocationPath from \"./middlewares/setLocationPath\";\nimport matchPathToRegisteredRoutes from \"./middlewares/matchPathToRegisteredRoutes\";\nimport checkForDeprecationMethods from \"./middlewares/checkForDeprecationMethods\";\nimport checkForForceOp from \"./middlewares/checkForForceOp\";\nimport updateBrowserURL from \"./middlewares/updateBrowserURL\";\nimport processMatches from \"./middlewares/processMatches\";\n\nimport { notFoundLifeCycle } from \"./lifecycles\";\n\nexport default function Navigo(\n appRoute?: string,\n resolveOptions?: ResolveOptions\n) {\n let DEFAULT_RESOLVE_OPTIONS: ResolveOptions = resolveOptions || {\n strategy: \"ONE\",\n hash: false,\n noMatchWarning: false,\n };\n let self: NavigoRouter = this;\n let root = \"/\";\n let current: Match[] = null;\n let routes: Route[] = [];\n let destroyed = false;\n let genericHooks: RouteHooks;\n\n const isPushStateAvailable = pushStateAvailable();\n const isWindowAvailable = windowAvailable();\n\n if (!appRoute) {\n console.warn(\n 'Navigo requires a root path in its constructor. If not provided will use \"/\" as default.'\n );\n } else {\n root = clean(appRoute);\n }\n\n function _checkForAHash(url: string): string {\n if (url.indexOf(\"#\") >= 0) {\n if (DEFAULT_RESOLVE_OPTIONS.hash === true) {\n url = url.split(\"#\")[1] || \"/\";\n } else {\n url = url.split(\"#\")[0];\n }\n }\n return url;\n }\n\n function composePathWithRoot(path: string) {\n return clean(`${root}/${clean(path)}`);\n }\n function createRoute(\n path: string | RegExp,\n handler: Function,\n hooks: RouteHooks[],\n name?: string\n ): Route {\n path = isString(path) ? composePathWithRoot(path as string) : path;\n return {\n name: name || clean(String(path)),\n path,\n handler,\n hooks: accumulateHooks(hooks),\n };\n }\n\n // public APIs\n function on(\n path: string | Function | Object | RegExp,\n handler?: Function,\n hooks?: RouteHooks\n ) {\n if (typeof path === \"object\" && !(path instanceof RegExp)) {\n Object.keys(path).forEach((p) => {\n if (typeof path[p] === \"function\") {\n this.on(p, path[p]);\n } else {\n const { uses: handler, as: name, hooks } = path[p];\n routes.push(createRoute(p, handler, [genericHooks, hooks], name));\n }\n });\n return this;\n } else if (typeof path === \"function\") {\n hooks = handler as RouteHooks;\n handler = path as Function;\n path = root;\n }\n routes.push(\n createRoute(path as string | RegExp, handler, [genericHooks, hooks])\n );\n return this;\n }\n function resolve(\n currentLocationPath?: string,\n options?: ResolveOptions\n ): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath,\n navigateOptions: {},\n resolveOptions: options || DEFAULT_RESOLVE_OPTIONS,\n };\n Q(\n [\n setLocationPath,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => {\n // console.log(`${currentLocationPath} -> Matches: ${matches.length}`);\n return matches && matches.length > 0;\n },\n processMatches,\n notFoundLifeCycle\n ),\n ],\n context\n );\n\n return context.matches ? context.matches : false;\n }\n function navigate(to: string, navigateOptions?: NavigateOptions): void {\n to = `${clean(root)}/${clean(to)}`;\n const context: QContext = {\n instance: self,\n to,\n navigateOptions: navigateOptions || {},\n resolveOptions:\n navigateOptions && navigateOptions.resolveOptions\n ? navigateOptions.resolveOptions\n : DEFAULT_RESOLVE_OPTIONS,\n currentLocationPath: _checkForAHash(to),\n };\n Q(\n [\n checkForDeprecationMethods,\n checkForForceOp,\n matchPathToRegisteredRoutes,\n Q.if(\n ({ matches }: QContext) => matches && matches.length > 0,\n processMatches,\n notFoundLifeCycle\n ),\n updateBrowserURL,\n ],\n context\n );\n }\n function off(what: string | RegExp | Function) {\n this.routes = routes = routes.filter((r) => {\n if (isString(what)) {\n return clean(r.path as string) !== clean(what as string);\n } else if (isFunction(what)) {\n return what !== r.handler;\n }\n return String(r.path) !== String(what);\n });\n return this;\n }\n function listen() {\n if (isPushStateAvailable) {\n this.__popstateListener = () => {\n resolve();\n };\n window.addEventListener(\"popstate\", this.__popstateListener);\n }\n }\n function destroy() {\n this.routes = routes = [];\n if (isPushStateAvailable) {\n window.removeEventListener(\"popstate\", this.__popstateListener);\n }\n this.destroyed = destroyed = true;\n }\n function notFound(handler, hooks?: RouteHooks) {\n self._notFoundRoute = createRoute(\n \"*\",\n handler,\n [genericHooks, hooks],\n \"__NOT_FOUND__\"\n );\n return this;\n }\n function updatePageLinks() {\n if (!isWindowAvailable) return;\n findLinks().forEach((link) => {\n if (\n \"false\" === link.getAttribute(\"data-navigo\") ||\n \"_blank\" === link.getAttribute(\"target\")\n ) {\n if (link.hasListenerAttached) {\n link.removeEventListener(\"click\", link.navigoHandler);\n }\n return;\n }\n if (!link.hasListenerAttached) {\n link.hasListenerAttached = true;\n link.navigoHandler = function (e) {\n if (\n (e.ctrlKey || e.metaKey) &&\n e.target.tagName.toLowerCase() === \"a\"\n ) {\n return false;\n }\n let location = link.getAttribute(\"href\");\n if (typeof location === \"undefined\" || location === null) {\n return false;\n }\n // handling absolute paths\n if (location.match(/^(http|https)/) && typeof URL !== \"undefined\") {\n try {\n const u = new URL(location);\n location = u.pathname + u.search;\n } catch (err) {}\n }\n const options = parseNavigateOptions(\n link.getAttribute(\"data-navigo-options\")\n );\n\n if (!destroyed) {\n e.preventDefault();\n e.stopPropagation();\n self.navigate(clean(location), options);\n }\n };\n link.addEventListener(\"click\", link.navigoHandler);\n }\n });\n return self;\n }\n function findLinks() {\n if (isWindowAvailable) {\n return [].slice.call(document.querySelectorAll(\"[data-navigo]\"));\n }\n return [];\n }\n function link(path: string) {\n return `/${root}/${clean(path)}`;\n }\n function setGenericHooks(hooks: RouteHooks) {\n genericHooks = hooks;\n return this;\n }\n function lastResolved(): Match[] | null {\n return current;\n }\n function generate(name: string, data?: Object): string {\n const result = routes.reduce((result, route) => {\n let key;\n\n if (route.name === name) {\n result = route.path as string;\n for (key in data) {\n result = result.replace(\":\" + key, data[key]);\n }\n }\n return result;\n }, \"\");\n return !result.match(/^\\//) ? `/${result}` : result;\n }\n function getLinkPath(link) {\n return link.getAttribute(\"href\");\n }\n function pathToMatchObject(path: string): Match {\n const [url, queryString] = extractGETParameters(clean(path));\n const params = queryString === \"\" ? null : parseQuery(queryString);\n const route = createRoute(url, () => {}, [genericHooks], url);\n return {\n url,\n queryString,\n route,\n data: null,\n params: params,\n };\n }\n function getCurrentLocation(): Match {\n return pathToMatchObject(\n clean(getCurrentEnvURL(root)).replace(new RegExp(`^${root}`), \"\")\n );\n }\n function directMatchWithRegisteredRoutes(path: string): false | Match[] {\n const context: QContext = {\n instance: self,\n currentLocationPath: path,\n navigateOptions: {},\n resolveOptions: DEFAULT_RESOLVE_OPTIONS,\n };\n matchPathToRegisteredRoutes(context, () => {});\n return context.matches ? context.matches : false;\n }\n function directMatchWithLocation(\n path: string,\n currentLocation?: string\n ): false | Match {\n const context: QContext = {\n instance: self,\n currentLocationPath: currentLocation,\n };\n setLocationPath(context, () => {});\n path = clean(path);\n const match = matchRoute(context.currentLocationPath, {\n name: path,\n path,\n handler: () => {},\n hooks: {},\n });\n return match ? match : false;\n }\n function addHook(\n type: string,\n route: Route | string,\n func: Function\n ): Function {\n if (typeof route === \"string\") {\n route = getRoute(route);\n }\n if (route) {\n if (!route.hooks[type]) route.hooks[type] = [];\n route.hooks[type].push(func);\n return () => {\n (route as Route).hooks[type] = (route as Route).hooks[type].filter(\n (f) => f !== func\n );\n };\n } else {\n console.warn(`Route doesn't exists: ${route}`);\n }\n return () => {};\n }\n function getRoute(nameOrHandler: string | Function): Route | undefined {\n if (typeof nameOrHandler === \"string\") {\n return routes.find((r) => r.name === composePathWithRoot(nameOrHandler));\n }\n return routes.find((r) => r.handler === nameOrHandler);\n }\n\n this.root = root;\n this.routes = routes;\n this.destroyed = destroyed;\n this.current = current;\n\n this.on = on;\n this.off = off;\n this.resolve = resolve;\n this.navigate = navigate;\n this.destroy = destroy;\n this.notFound = notFound;\n this.updatePageLinks = updatePageLinks;\n this.link = link;\n this.hooks = setGenericHooks;\n this.extractGETParameters = (url) =>\n extractGETParameters(_checkForAHash(url));\n this.lastResolved = lastResolved;\n this.generate = generate;\n this.getLinkPath = getLinkPath;\n this.match = directMatchWithRegisteredRoutes;\n this.matchLocation = directMatchWithLocation;\n this.getCurrentLocation = getCurrentLocation;\n this.addBeforeHook = addHook.bind(this, \"before\");\n this.addAfterHook = addHook.bind(this, \"after\");\n this.addAlreadyHook = addHook.bind(this, \"already\");\n this.addLeaveHook = addHook.bind(this, \"leave\");\n this.getRoute = getRoute;\n this._pathToMatchObject = pathToMatchObject;\n this._clean = clean;\n this._checkForAHash = _checkForAHash;\n this._setCurrent = (c) => (current = self.current = c);\n\n listen.call(this);\n updatePageLinks.call(this);\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(184);\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index 0d0bc839..8dfcbfe3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "navigo", - "version": "8.4.4", + "version": "8.5.0", "description": "A simple vanilla JavaScript router", "main": "lib/navigo.js", "browser": "lib/navigo.min.js", diff --git a/src/__tests__/updatePageLinks.spec.ts b/src/__tests__/updatePageLinks.spec.ts index ce11118c..2173567e 100644 --- a/src/__tests__/updatePageLinks.spec.ts +++ b/src/__tests__/updatePageLinks.spec.ts @@ -264,4 +264,93 @@ describe("Given the Navigo library", () => { }, 50); }); }); + describe("when the value of data-navigo is set to `false`", () => { + it("should skip the link", () => { + const querySelectorAll = jest.spyOn(document, "querySelectorAll"); + let handler; + + // @ts-ignore + querySelectorAll.mockImplementationOnce(() => { + return [ + { + addEventListener(eventType, h) { + handler = h; + }, + getAttribute(attr) { + if (attr === "href") { + return "/foo/bar"; + } else if (attr === "data-navigo") { + return "false"; + } + }, + }, + ]; + }); + + new Navigo("/app"); + + expect(handler).toEqual(undefined); + querySelectorAll.mockRestore(); + }); + }); + describe("when set data-navigo to `false` later on", () => { + it("should remove the listener from the link", () => { + const querySelectorAll = jest.spyOn(document, "querySelectorAll"); + let count = 0; + const addEventListener = jest.fn(); + const removeEventListener = jest.fn(); + const link = { + addEventListener, + removeEventListener, + getAttribute(attr) { + count += 1; + if (attr === "href") { + return "/foo/bar"; + } else if (attr === "data-navigo") { + if (count === 1) return ""; + return "false"; + } + }, + }; + + // @ts-ignore + querySelectorAll.mockImplementation(() => [link]); + + const r: NavigoRouter = new Navigo("/app"); + r.updatePageLinks(); + + expect(addEventListener).toBeCalledTimes(1); + expect(removeEventListener).toBeCalledTimes(1); + querySelectorAll.mockRestore(); + }); + }); + describe('when we have `target="_blank"` attribute', () => { + it("should skip the link", () => { + const querySelectorAll = jest.spyOn(document, "querySelectorAll"); + let handler; + + // @ts-ignore + querySelectorAll.mockImplementationOnce(() => { + return [ + { + addEventListener(eventType, h) { + handler = h; + }, + getAttribute(attr) { + if (attr === "href") { + return "/foo/bar"; + } else if (attr === "target") { + return "_blank"; + } + }, + }, + ]; + }); + + new Navigo("/app"); + + expect(handler).toEqual(undefined); + querySelectorAll.mockRestore(); + }); + }); }); diff --git a/src/index.ts b/src/index.ts index 9e03d24f..f9e9351b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -205,8 +205,18 @@ export default function Navigo( function updatePageLinks() { if (!isWindowAvailable) return; findLinks().forEach((link) => { + if ( + "false" === link.getAttribute("data-navigo") || + "_blank" === link.getAttribute("target") + ) { + if (link.hasListenerAttached) { + link.removeEventListener("click", link.navigoHandler); + } + return; + } if (!link.hasListenerAttached) { - link.addEventListener("click", function (e) { + link.hasListenerAttached = true; + link.navigoHandler = function (e) { if ( (e.ctrlKey || e.metaKey) && e.target.tagName.toLowerCase() === "a" @@ -233,8 +243,8 @@ export default function Navigo( e.stopPropagation(); self.navigate(clean(location), options); } - }); - link.hasListenerAttached = true; + }; + link.addEventListener("click", link.navigoHandler); } }); return self;