diff --git a/bower.json b/bower.json index f204f86..f6ae382 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ko-component-router", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://github.com/caseyWebb/ko-component-router", "authors": [ "Casey Webb " diff --git a/dist/ko-component-router.js b/dist/ko-component-router.js index b24ce0b..09dfa9b 100644 --- a/dist/ko-component-router.js +++ b/dist/ko-component-router.js @@ -11,41 +11,41 @@ return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; -/******/ + /******/ // The require function /******/ function __webpack_require__(moduleId) { -/******/ + /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; -/******/ + /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; -/******/ + /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ + /******/ // Flag the module as loaded /******/ module.loaded = true; -/******/ + /******/ // Return the exports of the module /******/ return module.exports; /******/ } -/******/ -/******/ + + /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; -/******/ + /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; -/******/ + /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; -/******/ + /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) @@ -1283,7 +1283,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 7 */ /***/ function(module, exports, __webpack_require__) { - module.exports = "
"; + module.exports = "
"; /***/ }, /* 8 */ @@ -2120,14 +2120,14 @@ return /******/ (function(modules) { // webpackBootstrap function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } - + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(17))) /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { - + /***/ }, /* 12 */ @@ -2384,7 +2384,7 @@ return /******/ (function(modules) { // webpackBootstrap }; module.exports = isFunction; - + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, @@ -2512,69 +2512,40 @@ return /******/ (function(modules) { // webpackBootstrap // shim for using process in browser var process = module.exports = {}; + var queue = []; + var draining = false; - process.nextTick = (function () { - var canSetImmediate = typeof window !== 'undefined' - && window.setImmediate; - var canMutationObserver = typeof window !== 'undefined' - && window.MutationObserver; - var canPost = typeof window !== 'undefined' - && window.postMessage && window.addEventListener - ; - - if (canSetImmediate) { - return function (f) { return window.setImmediate(f) }; + function drainQueue() { + if (draining) { + return; } - - var queue = []; - - if (canMutationObserver) { - var hiddenDiv = document.createElement("div"); - var observer = new MutationObserver(function () { - var queueList = queue.slice(); - queue.length = 0; - queueList.forEach(function (fn) { - fn(); - }); - }); - - observer.observe(hiddenDiv, { attributes: true }); - - return function nextTick(fn) { - if (!queue.length) { - hiddenDiv.setAttribute('yes', 'no'); - } - queue.push(fn); - }; + draining = true; + var currentQueue; + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + var i = -1; + while (++i < len) { + currentQueue[i](); + } + len = queue.length; } - - if (canPost) { - window.addEventListener('message', function (ev) { - var source = ev.source; - if ((source === window || source === null) && ev.data === 'process-tick') { - ev.stopPropagation(); - if (queue.length > 0) { - var fn = queue.shift(); - fn(); - } - } - }, true); - - return function nextTick(fn) { - queue.push(fn); - window.postMessage('process-tick', '*'); - }; + draining = false; + } + process.nextTick = function (fun) { + queue.push(fun); + if (!draining) { + setTimeout(drainQueue, 0); } - - return function nextTick(fn) { - setTimeout(fn, 0); - }; - })(); + }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; function noop() {} @@ -2595,6 +2566,7 @@ return /******/ (function(modules) { // webpackBootstrap process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; + process.umask = function() { return 0; }; /***/ }, @@ -3400,7 +3372,7 @@ return /******/ (function(modules) { // webpackBootstrap length = object.length; } if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && (length && isLength(length)))) { + (typeof object != 'function' && (length && isLength(length)))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; @@ -3682,7 +3654,7 @@ return /******/ (function(modules) { // webpackBootstrap } module.exports = bufferClone; - + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, @@ -3973,7 +3945,7 @@ return /******/ (function(modules) { // webpackBootstrap }(0, 0)); module.exports = support; - + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, @@ -4294,8 +4266,10 @@ return /******/ (function(modules) { // webpackBootstrap othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { return false; } } @@ -4389,3 +4363,4 @@ return /******/ (function(modules) { // webpackBootstrap /***/ } /******/ ]) }); +; \ No newline at end of file diff --git a/dist/ko-component-router.min.js b/dist/ko-component-router.min.js index 35bccfd..23b3085 100644 --- a/dist/ko-component-router.min.js +++ b/dist/ko-component-router.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports["ko-component-router"]=e():t["ko-component-router"]=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var n,o,i;n=r(17),o=r(18),i=function(t,e,i){var u,a,c,s,f;return null==i&&(i={}),u=null!=(s=i.HTML5)?s:!1,c=null!=(f=i.basePath)?f:"",a=u?o:n,t.router=new a(t,e,c),t.components.register("ko-component-router",r(16)(t))},t.exports={start:i}},function(t){function e(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=Math.pow(2,53)-1;t.exports=e},function(t,e,r){function n(t){return null==t?!1:f.call(t)==u?p.test(s.call(t)):i(t)&&a.test(t)||!1}var o=r(48),i=r(3),u="[object Function]",a=/^\[object .+?Constructor\]$/,c=Object.prototype,s=Function.prototype.toString,f=c.toString,p=RegExp("^"+o(f).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=n},function(t){function e(t){return t&&"object"==typeof t||!1}t.exports=e},function(t){function e(t){var e=typeof t;return"function"==e||t&&"object"==e||!1}t.exports=e},function(t,e,r){var n=r(1),o=r(2),i=r(3),u="[object Array]",a=Object.prototype,c=a.toString,s=o(s=Array.isArray)&&s,f=s||function(t){return i(t)&&n(t.length)&&c.call(t)==u||!1};t.exports=f},function(t,e,r){var n=r(1),o=r(2),i=r(4),u=r(43),a=o(a=Object.keys)&&a,c=a?function(t){if(t)var e=t.constructor,r=t.length;return"function"==typeof e&&e.prototype===t||"function"!=typeof t&&r&&n(r)?u(t):i(t)?a(t):[]}:u;t.exports=c},function(t,e,r){var n=n||{};!function(){"use strict";function t(t,e){for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}var o="win32"===n.platform,i=r(56);if(o){var u=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,a=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/,c=function(t){var e=u.exec(t),r=(e[1]||"")+(e[2]||""),n=e[3]||"",o=a.exec(n),i=o[1],c=o[2],s=o[3];return[r,i,c,s]},s=function(t){return"\\\\"+t.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\")};e.resolve=function(){function r(t){return!!t}for(var o="",a="",c=!1,f=arguments.length-1;f>=-1;f--){var p;if(f>=0?p=arguments[f]:o?(p=n.env["="+o],p&&p.substr(0,3).toLowerCase()===o.toLowerCase()+"\\"||(p=o+"\\")):p=n.cwd(),!i.isString(p))throw new TypeError("Arguments to path.resolve must be strings");if(p){var l=u.exec(p),h=l[1]||"",g=h&&":"!==h.charAt(1),y=e.isAbsolute(p),v=l[3];if((!h||!o||h.toLowerCase()===o.toLowerCase())&&(o||(o=h),c||(a=v+"\\"+a,c=y),o&&c))break}}return g&&(o=s(o)),a=t(a.split(/[\\\/]+/).filter(r),!c).join("\\"),o+(c?"\\":"")+a||"."},e.normalize=function(r){var n=u.exec(r),o=n[1]||"",i=o&&":"!==o.charAt(1),a=e.isAbsolute(r),c=n[3],f=/[\\\/]$/.test(c);return o&&":"===o.charAt(1)&&(o=o[0].toLowerCase()+o.substr(1)),c=t(c.split(/[\\\/]+/).filter(function(t){return!!t}),!a).join("\\"),c||a||(c="."),c&&f&&(c+="\\"),i&&(o=s(o)),o+(a?"\\":"")+c},e.isAbsolute=function(t){var e=u.exec(t),r=e[1]||"",n=!!r&&":"!==r.charAt(1);return!!e[2]||n},e.join=function(){function t(t){if(!i.isString(t))throw new TypeError("Arguments to path.join must be strings");return t}var r=Array.prototype.filter.call(arguments,t),n=r.join("\\");return/^[\\\/]{2}[^\\\/]/.test(r[0])||(n=n.replace(/^[\\\/]{2,}/,"\\")),e.normalize(n)},e.relative=function(t,r){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r+1)}t=e.resolve(t),r=e.resolve(r);for(var o=t.toLowerCase(),i=r.toLowerCase(),u=n(r.split("\\")),a=n(o.split("\\")),c=n(i.split("\\")),s=Math.min(a.length,c.length),f=s,p=0;s>p;p++)if(a[p]!==c[p]){f=p;break}if(0==f)return r;for(var l=[],p=f;p=-1&&!r;o--){var u=o>=0?arguments[o]:n.cwd();if(!i.isString(u))throw new TypeError("Arguments to path.resolve must be strings");u&&(e=u+"/"+e,r="/"===u.charAt(0))}return e=t(e.split("/").filter(function(t){return!!t}),!r).join("/"),(r?"/":"")+e||"."},e.normalize=function(r){for(var n=e.isAbsolute(r),o="/"===r[r.length-1],i=r.split("/"),u=[],a=0;a=0&&""===t[r];r--);return e>r?[]:t.slice(e,r+1)}t=e.resolve(t).substr(1),r=e.resolve(r).substr(1);for(var o=n(t.split("/")),i=n(r.split("/")),u=Math.min(o.length,i.length),a=u,c=0;u>c;c++)if(o[c]!==i[c]){a=c;break}for(var s=[],c=a;ci;i++)h=l[i],h.matches(t)&&s.push(h);if(0!==s.length){for(n=1/0,r=null,p=null,o=u=0,c=s.length;c>u&&(h=s[o],e=h.params(t),f=Object.keys(e).length,!(n>f&&(n=f,r=h.component,p=e,0===f)));o=++u);return{component:r,routeParams:p}}},t.prototype._pushState=function(t){return history.pushState({},document.title,this._basePath+t)},t.prototype._replaceState=function(t){return history.replaceState({},document.title,this._basePath+t)},t.prototype._ignoreClick=function(t){var e,r;return e=this._getParentAnchor(t.target),null==e?!0:(r=this._getPathFromAnchor(e),null==this._getComponentAndParamsForPath(r)?!0:2===t.detail||t.defaultPrevented||!this._isLink(e)||e.getAttribute("download")||"external"===e.getAttribute("rel")||e.pathname===this.current().path||e.getAttribute("href").indexOf("mailto:")>-1||e.target||!this._sameOrigin(e.href))},t.prototype._getParentAnchor=function(t){for(;t&&"A"!==t.nodeName;)t=t.parentNode;return t},t.prototype._isLink=function(t){return t=this._getParentAnchor(t),t&&"A"===t.nodeName},t.prototype._getPathFromUrl=function(){return a.pathname+a.search+a.hash},t.prototype._getPathFromAnchor=function(t){var e,r,n,o;return e=t.getAttribute("href"),n=null!=(o=e.split("?")[1])?o:"",n&&(n="?"+n),r=function(){switch(!1){case"/"!==e[0]:return t.pathname;case".."!==e:return c.resolve(this.current().path,e);default:return c.resolve(this.current().path,"../"+e)}}.call(this),(r+n+(t.hash||"")).replace(this._basePath,"")},t.prototype._sameOrigin=function(t){var e;return e=a.protocol+"//"+a.hostname,a.port&&(e+=":"+a.port),t&&0===t.indexOf(e)},t.prototype._onContextMenu=function(t){var e;if(!this._ignoreClick(t))return e=this._getParentAnchor(t.target),this._patchContextMenu(e)},t.prototype._patchContextMenu=function(t){var e,r,n,o;if(!t.hasAttribute("data-orig-href"))return e=t.getAttribute("href"),r=this._getPathFromAnchor(t),o=this._basePath+r,t.setAttribute("data-orig-href",e),t.setAttribute("href",o),n=this._revertContextMenuPatch.bind(this,t),window.addEventListener("click",n)},t.prototype._revertContextMenuPatch=function(t){var e;return e=t.getAttribute("data-orig-href"),t.setAttribute("href",e),t.removeAttribute("data-orig-href"),window.removeEventListener("click",this._revertContextMenuPatch)},t}(),t.exports=n},function(t,e,r){function n(t,e,r){for(var n=-1,i=o(t),u=r(t),a=u.length;++n-1&&t%1==0&&e>t}var r=Math.pow(2,53)-1;t.exports=e},function(t,e,r){function n(t){var e=i(t)?t.length:void 0;return o(e)&&c.call(t)==u||!1}var o=r(1),i=r(3),u="[object Arguments]",a=Object.prototype,c=a.toString;t.exports=n},function(t,e,r){function n(t){if(null==t)return[];c(t)||(t=Object(t));var e=t.length;e=e&&a(e)&&(i(t)||s.nonEnumArgs&&o(t))&&e||0;for(var r=t.constructor,n=-1,f="function"==typeof r&&r.prototype===t,l=Array(e),h=e>0;++nn;r=++n)f=c[r],null!=f&&(f=decodeURIComponent(f))&&(o=this.paramKeys[r].name)&&(a[o]=f);return a},t}(),t.exports=n},function(t,e,r){var n,o,i,u,a,c,s,f,p,l,h,g,y,v,b;l=r(45),h=r(46),y=r(50),g=null!=(v=null!=(b=window.history)?b.location:void 0)?v:window.location,u=!1,f=null,o="",c=function(){return history._nativePushState=history.pushState,history.pushState=function(t,e,r){var n,i,u;return null==t&&(t={}),u=!y(t)(null!=(i=f())?i:{}),n=o!==r,history._nativePushState.apply(this,arguments),(u||n)&&f(t),o=r},history._nativeReplaceState=history.replaceState,history.replaceState=function(t,e,r){var n,i,u;return null==t&&(t={}),u=!y(t)(null!=(i=f())?i:{}),n=o!==r,history._nativeReplaceState.apply(this,arguments),(u||n)&&f(t),o=r}},a=function(){return window.addEventListener("popstate",function(){return f(history.state)})},s=function(t){var e,r,n;r={};for(e in t)switch(n=t[e],!1){case!l(n):continue;case!h(n):r[e]=s(n);break;default:r[e]=n}return r},p=function(t){var e,r;return r=g.pathname+g.search+g.hash,e=document.title,history.replaceState(s(t),e,r)},i=function(){var t;return null!=(t=f())?t:{}},n=function(){function t(t){var e;return f=t.observable(history.state),u||(c(),a(),u=!0),e=t.pureComputed({read:i,write:p})}return t}(),t.exports=n},function(t){t.exports='
'},function(t){function e(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++rc))return!1;for(;f&&++a0:!o(t))}var o=r(4);t.exports=n},function(t,e,r){function n(t){var e;if(!i(t)||s.call(t)!=u||!c.call(t,"constructor")&&(e=t.constructor,"function"==typeof e&&!(e instanceof e)))return!1;var r;return o(t,function(t,e){r=e}),"undefined"==typeof r||c.call(t,r)}var o=r(26),i=r(3),u="[object Object]",a=Object.prototype,c=a.hasOwnProperty,s=a.toString;t.exports=n},function(t,e,r){function n(t){for(var e=c(t),r=e.length,n=r&&t.length,f=n&&a(n)&&(i(t)||s.nonEnumArgs&&o(t)),l=-1,h=[];++l0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=e,r.addListener=e,r.once=e,r.off=e,r.removeListener=e,r.removeAllListeners=e,r.emit=e,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},function(t){t.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e,r){(function(t,n){function o(t,r){var n={seen:[],stylize:u};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&e._extend(n,r),j(n.showHidden)&&(n.showHidden=!1),j(n.depth)&&(n.depth=2),j(n.colors)&&(n.colors=!1),j(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=i),c(n,t,n.depth)}function i(t,e){var r=o.styles[e];return r?"["+o.colors[r][0]+"m"+t+"["+o.colors[r][1]+"m":t}function u(t){return t}function a(t){var e={};return t.forEach(function(t){e[t]=!0}),e}function c(t,r,n){if(t.customInspect&&r&&P(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return m(o)||(o=c(t,o,n)),o}var i=s(t,r);if(i)return i;var u=Object.keys(r),y=a(u);if(t.showHidden&&(u=Object.getOwnPropertyNames(r)),S(r)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return f(r);if(0===u.length){if(P(r)){var v=r.name?": "+r.name:"";return t.stylize("[Function"+v+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(A(r))return t.stylize(Date.prototype.toString.call(r),"date");if(S(r))return f(r)}var b="",d=!1,w=["{","}"];if(g(r)&&(d=!0,w=["[","]"]),P(r)){var j=r.name?": "+r.name:"";b=" [Function"+j+"]"}if(_(r)&&(b=" "+RegExp.prototype.toString.call(r)),A(r)&&(b=" "+Date.prototype.toUTCString.call(r)),S(r)&&(b=" "+f(r)),0===u.length&&(!d||0==r.length))return w[0]+b+w[1];if(0>n)return _(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var x;return x=d?p(t,r,n,y,u):u.map(function(e){return l(t,r,n,y,e,d)}),t.seen.pop(),h(x,b,w)}function s(t,e){if(j(e))return t.stylize("undefined","undefined");if(m(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return d(e)?t.stylize(""+e,"number"):y(e)?t.stylize(""+e,"boolean"):v(e)?t.stylize("null","null"):void 0}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,r,n,o){for(var i=[],u=0,a=e.length;a>u;++u)i.push(F(e,String(u))?l(t,e,r,n,String(u),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(l(t,e,r,n,o,!0))}),i}function l(t,e,r,n,o,i){var u,a,s;if(s=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]},s.get?a=s.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):s.set&&(a=t.stylize("[Setter]","special")),F(n,o)||(u="["+o+"]"),a||(t.seen.indexOf(s.value)<0?(a=v(r)?c(t,s.value,null):c(t,s.value,r-1),a.indexOf("\n")>-1&&(a=i?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),j(u)){if(i&&o.match(/^\d+$/))return a;u=JSON.stringify(""+o),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+a}function h(t,e,r){var n=0,o=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function g(t){return Array.isArray(t)}function y(t){return"boolean"==typeof t}function v(t){return null===t}function b(t){return null==t}function d(t){return"number"==typeof t}function m(t){return"string"==typeof t}function w(t){return"symbol"==typeof t}function j(t){return void 0===t}function _(t){return x(t)&&"[object RegExp]"===E(t)}function x(t){return"object"==typeof t&&null!==t}function A(t){return x(t)&&"[object Date]"===E(t)}function S(t){return x(t)&&("[object Error]"===E(t)||t instanceof Error)}function P(t){return"function"==typeof t}function O(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function E(t){return Object.prototype.toString.call(t)}function C(t){return 10>t?"0"+t.toString(10):t.toString(10)}function k(){var t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":");return[t.getDate(),L[t.getMonth()],e].join(" ")}function F(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var M=/%[sdj%]/g;e.format=function(t){if(!m(t)){for(var e=[],r=0;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return t}}),a=n[r];i>r;a=n[++r])u+=v(a)||!x(a)?" "+a:" "+o(a);return u},e.deprecate=function(r,o){function i(){if(!u){if(n.throwDeprecation)throw new Error(o);n.traceDeprecation?console.trace(o):console.error(o),u=!0}return r.apply(this,arguments)}if(j(t.process))return function(){return e.deprecate(r,o).apply(this,arguments)};if(n.noDeprecation===!0)return r;var u=!1;return i};var U,z={};e.debuglog=function(t){if(j(U)&&(U=n.env.NODE_DEBUG||""),t=t.toUpperCase(),!z[t])if(new RegExp("\\b"+t+"\\b","i").test(U)){var r=n.pid; -z[t]=function(){var n=e.format.apply(e,arguments);console.error("%s %d: %s",t,r,n)}}else z[t]=function(){};return z[t]},e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=g,e.isBoolean=y,e.isNull=v,e.isNullOrUndefined=b,e.isNumber=d,e.isString=m,e.isSymbol=w,e.isUndefined=j,e.isRegExp=_,e.isObject=x,e.isDate=A,e.isError=S,e.isFunction=P,e.isPrimitive=O,e.isBuffer=r(55);var L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.log=function(){console.log("%s - %s",k(),e.format.apply(e,arguments))},e.inherits=r(54),e._extend=function(t,e){if(!e||!x(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(e,function(){return this}(),r(53))}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports["ko-component-router"]=e():t["ko-component-router"]=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var n,o,i;n=r(17),o=r(18),i=function(t,e,i){var u,a,c,s,p;return null==i&&(i={}),u=null!=(s=i.HTML5)?s:!1,c=null!=(p=i.basePath)?p:"",a=u?o:n,t.router=new a(t,e,c),t.components.register("ko-component-router",r(16)(t))},t.exports={start:i}},function(t){function e(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=Math.pow(2,53)-1;t.exports=e},function(t,e,r){function n(t){return null==t?!1:p.call(t)==u?f.test(s.call(t)):i(t)&&a.test(t)||!1}var o=r(48),i=r(3),u="[object Function]",a=/^\[object .+?Constructor\]$/,c=Object.prototype,s=Function.prototype.toString,p=c.toString,f=RegExp("^"+o(p).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=n},function(t){function e(t){return t&&"object"==typeof t||!1}t.exports=e},function(t){function e(t){var e=typeof t;return"function"==e||t&&"object"==e||!1}t.exports=e},function(t,e,r){var n=r(1),o=r(2),i=r(3),u="[object Array]",a=Object.prototype,c=a.toString,s=o(s=Array.isArray)&&s,p=s||function(t){return i(t)&&n(t.length)&&c.call(t)==u||!1};t.exports=p},function(t,e,r){var n=r(1),o=r(2),i=r(4),u=r(43),a=o(a=Object.keys)&&a,c=a?function(t){if(t)var e=t.constructor,r=t.length;return"function"==typeof e&&e.prototype===t||"function"!=typeof t&&r&&n(r)?u(t):i(t)?a(t):[]}:u;t.exports=c},function(t,e,r){var n=n||{};!function(){"use strict";function t(t,e){for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}var o="win32"===n.platform,i=r(56);if(o){var u=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,a=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/,c=function(t){var e=u.exec(t),r=(e[1]||"")+(e[2]||""),n=e[3]||"",o=a.exec(n),i=o[1],c=o[2],s=o[3];return[r,i,c,s]},s=function(t){return"\\\\"+t.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\")};e.resolve=function(){function r(t){return!!t}for(var o="",a="",c=!1,p=arguments.length-1;p>=-1;p--){var f;if(p>=0?f=arguments[p]:o?(f=n.env["="+o],f&&f.substr(0,3).toLowerCase()===o.toLowerCase()+"\\"||(f=o+"\\")):f=n.cwd(),!i.isString(f))throw new TypeError("Arguments to path.resolve must be strings");if(f){var l=u.exec(f),h=l[1]||"",g=h&&":"!==h.charAt(1),y=e.isAbsolute(f),v=l[3];if((!h||!o||h.toLowerCase()===o.toLowerCase())&&(o||(o=h),c||(a=v+"\\"+a,c=y),o&&c))break}}return g&&(o=s(o)),a=t(a.split(/[\\\/]+/).filter(r),!c).join("\\"),o+(c?"\\":"")+a||"."},e.normalize=function(r){var n=u.exec(r),o=n[1]||"",i=o&&":"!==o.charAt(1),a=e.isAbsolute(r),c=n[3],p=/[\\\/]$/.test(c);return o&&":"===o.charAt(1)&&(o=o[0].toLowerCase()+o.substr(1)),c=t(c.split(/[\\\/]+/).filter(function(t){return!!t}),!a).join("\\"),c||a||(c="."),c&&p&&(c+="\\"),i&&(o=s(o)),o+(a?"\\":"")+c},e.isAbsolute=function(t){var e=u.exec(t),r=e[1]||"",n=!!r&&":"!==r.charAt(1);return!!e[2]||n},e.join=function(){function t(t){if(!i.isString(t))throw new TypeError("Arguments to path.join must be strings");return t}var r=Array.prototype.filter.call(arguments,t),n=r.join("\\");return/^[\\\/]{2}[^\\\/]/.test(r[0])||(n=n.replace(/^[\\\/]{2,}/,"\\")),e.normalize(n)},e.relative=function(t,r){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r+1)}t=e.resolve(t),r=e.resolve(r);for(var o=t.toLowerCase(),i=r.toLowerCase(),u=n(r.split("\\")),a=n(o.split("\\")),c=n(i.split("\\")),s=Math.min(a.length,c.length),p=s,f=0;s>f;f++)if(a[f]!==c[f]){p=f;break}if(0==p)return r;for(var l=[],f=p;f=-1&&!r;o--){var u=o>=0?arguments[o]:n.cwd();if(!i.isString(u))throw new TypeError("Arguments to path.resolve must be strings");u&&(e=u+"/"+e,r="/"===u.charAt(0))}return e=t(e.split("/").filter(function(t){return!!t}),!r).join("/"),(r?"/":"")+e||"."},e.normalize=function(r){for(var n=e.isAbsolute(r),o="/"===r[r.length-1],i=r.split("/"),u=[],a=0;a=0&&""===t[r];r--);return e>r?[]:t.slice(e,r+1)}t=e.resolve(t).substr(1),r=e.resolve(r).substr(1);for(var o=n(t.split("/")),i=n(r.split("/")),u=Math.min(o.length,i.length),a=u,c=0;u>c;c++)if(o[c]!==i[c]){a=c;break}for(var s=[],c=a;ci;i++)h=l[i],h.matches(t)&&s.push(h);if(0!==s.length){for(n=1/0,r=null,f=null,o=u=0,c=s.length;c>u&&(h=s[o],e=h.params(t),p=Object.keys(e).length,!(n>p&&(n=p,r=h.component,f=e,0===p)));o=++u);return{component:r,routeParams:f}}},t.prototype._pushState=function(t){return history.pushState({},document.title,this._basePath+t)},t.prototype._replaceState=function(t){return history.replaceState({},document.title,this._basePath+t)},t.prototype._ignoreClick=function(t){var e,r;return e=this._getParentAnchor(t.target),null==e?!0:(r=this._getPathFromAnchor(e),null==this._getComponentAndParamsForPath(r)?!0:2===t.detail||t.defaultPrevented||!this._isLink(e)||e.getAttribute("download")||"external"===e.getAttribute("rel")||e.pathname===this.current().path||e.getAttribute("href").indexOf("mailto:")>-1||e.target||!this._sameOrigin(e.href))},t.prototype._getParentAnchor=function(t){for(;t&&"A"!==t.nodeName;)t=t.parentNode;return t},t.prototype._isLink=function(t){return t=this._getParentAnchor(t),t&&"A"===t.nodeName},t.prototype._getPathFromUrl=function(){return a.pathname+a.search+a.hash},t.prototype._getPathFromAnchor=function(t){var e,r,n,o;return e=t.getAttribute("href"),n=null!=(o=e.split("?")[1])?o:"",n&&(n="?"+n),r=function(){switch(!1){case"/"!==e[0]:return t.pathname;case".."!==e:return c.resolve(this.current().path,e);default:return c.resolve(this.current().path,"../"+e)}}.call(this),(r+n+(t.hash||"")).replace(this._basePath,"")},t.prototype._sameOrigin=function(t){var e;return e=a.protocol+"//"+a.hostname,a.port&&(e+=":"+a.port),t&&0===t.indexOf(e)},t.prototype._onContextMenu=function(t){var e;if(!this._ignoreClick(t))return e=this._getParentAnchor(t.target),this._patchContextMenu(e)},t.prototype._patchContextMenu=function(t){var e,r,n,o;if(!t.hasAttribute("data-orig-href"))return e=t.getAttribute("href"),r=this._getPathFromAnchor(t),o=this._basePath+r,t.setAttribute("data-orig-href",e),t.setAttribute("href",o),n=this._revertContextMenuPatch.bind(this,t),window.addEventListener("click",n)},t.prototype._revertContextMenuPatch=function(t){var e;return e=t.getAttribute("data-orig-href"),t.setAttribute("href",e),t.removeAttribute("data-orig-href"),window.removeEventListener("click",this._revertContextMenuPatch)},t}(),t.exports=n},function(t,e,r){function n(t,e,r){for(var n=-1,i=o(t),u=r(t),a=u.length;++n-1&&t%1==0&&e>t}var r=Math.pow(2,53)-1;t.exports=e},function(t,e,r){function n(t){var e=i(t)?t.length:void 0;return o(e)&&c.call(t)==u||!1}var o=r(1),i=r(3),u="[object Arguments]",a=Object.prototype,c=a.toString;t.exports=n},function(t,e,r){function n(t){if(null==t)return[];c(t)||(t=Object(t));var e=t.length;e=e&&a(e)&&(i(t)||s.nonEnumArgs&&o(t))&&e||0;for(var r=t.constructor,n=-1,p="function"==typeof r&&r.prototype===t,l=Array(e),h=e>0;++nn;r=++n)p=c[r],null!=p&&(p=decodeURIComponent(p))&&(o=this.paramKeys[r].name)&&(a[o]=p);return a},t}(),t.exports=n},function(t,e,r){var n,o,i,u,a,c,s,p,f,l,h,g,y,v,b;l=r(45),h=r(46),y=r(50),g=null!=(v=null!=(b=window.history)?b.location:void 0)?v:window.location,u=!1,p=null,o="",c=function(){return history._nativePushState=history.pushState,history.pushState=function(t,e,r){var n,i,u;return null==t&&(t={}),u=!y(t)(null!=(i=p())?i:{}),n=o!==r,history._nativePushState.apply(this,arguments),(u||n)&&p(t),o=r},history._nativeReplaceState=history.replaceState,history.replaceState=function(t,e,r){var n,i,u;return null==t&&(t={}),u=!y(t)(null!=(i=p())?i:{}),n=o!==r,history._nativeReplaceState.apply(this,arguments),(u||n)&&p(t),o=r}},a=function(){return window.addEventListener("popstate",function(){return p(history.state)})},s=function(t){var e,r,n;r={};for(e in t)switch(n=t[e],!1){case!l(n):continue;case!h(n):r[e]=s(n);break;default:r[e]=n}return r},f=function(t){var e,r;return r=g.pathname+g.search+g.hash,e=document.title,history.replaceState(s(t),e,r)},i=function(){var t;return null!=(t=p())?t:{}},n=function(){function t(t){var e;return p=t.observable(history.state),u||(c(),a(),u=!0),e=t.pureComputed({read:i,write:f})}return t}(),t.exports=n},function(t){t.exports='
'},function(t){function e(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++rc))return!1;for(;p&&++a0:!o(t))}var o=r(4);t.exports=n},function(t,e,r){function n(t){var e;if(!i(t)||s.call(t)!=u||!c.call(t,"constructor")&&(e=t.constructor,"function"==typeof e&&!(e instanceof e)))return!1;var r;return o(t,function(t,e){r=e}),"undefined"==typeof r||c.call(t,r)}var o=r(26),i=r(3),u="[object Object]",a=Object.prototype,c=a.hasOwnProperty,s=a.toString;t.exports=n},function(t,e,r){function n(t){for(var e=c(t),r=e.length,n=r&&t.length,p=n&&a(n)&&(i(t)||s.nonEnumArgs&&o(t)),l=-1,h=[];++l=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&e._extend(n,r),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=i),c(n,t,n.depth)}function i(t,e){var r=o.styles[e];return r?"["+o.colors[r][0]+"m"+t+"["+o.colors[r][1]+"m":t}function u(t){return t}function a(t){var e={};return t.forEach(function(t){e[t]=!0}),e}function c(t,r,n){if(t.customInspect&&r&&P(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return d(o)||(o=c(t,o,n)),o}var i=s(t,r);if(i)return i;var u=Object.keys(r),y=a(u);if(t.showHidden&&(u=Object.getOwnPropertyNames(r)),S(r)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return p(r);if(0===u.length){if(P(r)){var v=r.name?": "+r.name:"";return t.stylize("[Function"+v+"]","special")}if(x(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(A(r))return t.stylize(Date.prototype.toString.call(r),"date");if(S(r))return p(r)}var b="",m=!1,j=["{","}"];if(g(r)&&(m=!0,j=["[","]"]),P(r)){var _=r.name?": "+r.name:"";b=" [Function"+_+"]"}if(x(r)&&(b=" "+RegExp.prototype.toString.call(r)),A(r)&&(b=" "+Date.prototype.toUTCString.call(r)),S(r)&&(b=" "+p(r)),0===u.length&&(!m||0==r.length))return j[0]+b+j[1];if(0>n)return x(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var w;return w=m?f(t,r,n,y,u):u.map(function(e){return l(t,r,n,y,e,m)}),t.seen.pop(),h(w,b,j)}function s(t,e){if(_(e))return t.stylize("undefined","undefined");if(d(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return m(e)?t.stylize(""+e,"number"):y(e)?t.stylize(""+e,"boolean"):v(e)?t.stylize("null","null"):void 0}function p(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,r,n,o){for(var i=[],u=0,a=e.length;a>u;++u)i.push(F(e,String(u))?l(t,e,r,n,String(u),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(l(t,e,r,n,o,!0))}),i}function l(t,e,r,n,o,i){var u,a,s;if(s=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]},s.get?a=s.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):s.set&&(a=t.stylize("[Setter]","special")),F(n,o)||(u="["+o+"]"),a||(t.seen.indexOf(s.value)<0?(a=v(r)?c(t,s.value,null):c(t,s.value,r-1),a.indexOf("\n")>-1&&(a=i?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),_(u)){if(i&&o.match(/^\d+$/))return a;u=JSON.stringify(""+o),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+a}function h(t,e,r){var n=0,o=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function g(t){return Array.isArray(t)}function y(t){return"boolean"==typeof t}function v(t){return null===t}function b(t){return null==t}function m(t){return"number"==typeof t}function d(t){return"string"==typeof t}function j(t){return"symbol"==typeof t}function _(t){return void 0===t}function x(t){return w(t)&&"[object RegExp]"===E(t)}function w(t){return"object"==typeof t&&null!==t}function A(t){return w(t)&&"[object Date]"===E(t)}function S(t){return w(t)&&("[object Error]"===E(t)||t instanceof Error)}function P(t){return"function"==typeof t}function O(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function E(t){return Object.prototype.toString.call(t)}function C(t){return 10>t?"0"+t.toString(10):t.toString(10)}function k(){var t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":");return[t.getDate(),L[t.getMonth()],e].join(" ")}function F(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var U=/%[sdj%]/g;e.format=function(t){if(!d(t)){for(var e=[],r=0;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return t}}),a=n[r];i>r;a=n[++r])u+=v(a)||!w(a)?" "+a:" "+o(a);return u},e.deprecate=function(r,o){function i(){if(!u){if(n.throwDeprecation)throw new Error(o);n.traceDeprecation?console.trace(o):console.error(o),u=!0}return r.apply(this,arguments)}if(_(t.process))return function(){return e.deprecate(r,o).apply(this,arguments)};if(n.noDeprecation===!0)return r;var u=!1;return i};var z,M={};e.debuglog=function(t){if(_(z)&&(z=n.env.NODE_DEBUG||""),t=t.toUpperCase(),!M[t])if(new RegExp("\\b"+t+"\\b","i").test(z)){var r=n.pid;M[t]=function(){var n=e.format.apply(e,arguments);console.error("%s %d: %s",t,r,n)}}else M[t]=function(){};return M[t]},e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=g,e.isBoolean=y,e.isNull=v,e.isNullOrUndefined=b,e.isNumber=m,e.isString=d,e.isSymbol=j,e.isUndefined=_,e.isRegExp=x,e.isObject=w,e.isDate=A,e.isError=S,e.isFunction=P,e.isPrimitive=O,e.isBuffer=r(55); +var L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.log=function(){console.log("%s - %s",k(),e.format.apply(e,arguments))},e.inherits=r(54),e._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(e,function(){return this}(),r(53))}])}); \ No newline at end of file diff --git a/package.json b/package.json index faa8410..f5ee758 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ko-component-router", - "version": "1.0.0", + "version": "1.0.1", "description": "Component-based routing for KnockoutJS", "main": "dist/ko-component-router.js", "scripts": { @@ -24,7 +24,7 @@ "license": "MIT", "dependencies": { "knockout": "^3.3.0", - "lodash": "^3.3.1", + "lodash": "^3.5.0", "path": "^0.11.14", "path-to-regexp": "^1.0.3" },