From 746ade72c0c366c0229d0d8d401edcbd74cbbd15 Mon Sep 17 00:00:00 2001 From: Casey Webb Date: Tue, 10 Mar 2015 18:58:12 -0500 Subject: [PATCH] Prep for v1.0.0 --- .npmignore | 4 +- bower.json | 23 +++---- dist/ko-component-router.js | 115 ++++++++++++-------------------- dist/ko-component-router.min.js | 4 +- package.json | 3 +- 5 files changed, 61 insertions(+), 88 deletions(-) diff --git a/.npmignore b/.npmignore index 57dc7b2..75ace46 100644 --- a/.npmignore +++ b/.npmignore @@ -13,4 +13,6 @@ bower.json webpack.config.* *.sublime-project -*.sublime-workspace \ No newline at end of file +*.sublime-workspace + +.gitignore \ No newline at end of file diff --git a/bower.json b/bower.json index 24f286a..f204f86 100644 --- a/bower.json +++ b/bower.json @@ -1,10 +1,11 @@ { "name": "ko-component-router", - "version": "0.0.1", + "version": "1.0.0", + "homepage": "https://github.com/caseyWebb/ko-component-router", "authors": [ "Casey Webb " ], - "description": "Component-based routing for KnockoutJS", + "description": "Component-based Routing for KnockoutJS", "main": "dist/ko-component-router.js", "moduleType": [ "amd", @@ -12,26 +13,22 @@ "node" ], "keywords": [ - "knockoutjs", + "ko", "knockout", + "knockoutjs", + "router", "routing", - "spa", - "router" + "spa" ], "license": "MIT", "ignore": [ "**/.*", "node_modules", "bower_components", - "src", - "package.json", - "webpack.config.*", - "test" - "*.sublime-project", + "test", "*.sublime-workspace", - ".npmignore", - ".gitignore", - ".DS_Store" + "*.sublime-project", + "src" ], "dependencies": { "knockout": "~3.3.0" diff --git a/dist/ko-component-router.js b/dist/ko-component-router.js index 2736f37..ce3fd4a 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); /******/ }) @@ -1257,7 +1257,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 7 */ /***/ function(module, exports, __webpack_require__) { - module.exports = "
"; + module.exports = "
"; /***/ }, /* 8 */ @@ -2094,14 +2094,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 */ @@ -2358,7 +2358,7 @@ return /******/ (function(modules) { // webpackBootstrap }; module.exports = isFunction; - + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, @@ -2486,69 +2486,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() {} @@ -2569,6 +2540,7 @@ return /******/ (function(modules) { // webpackBootstrap process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; + process.umask = function() { return 0; }; /***/ }, @@ -3656,7 +3628,7 @@ return /******/ (function(modules) { // webpackBootstrap } module.exports = bufferClone; - + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, @@ -3947,7 +3919,7 @@ return /******/ (function(modules) { // webpackBootstrap }(0, 0)); module.exports = support; - + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, @@ -4363,3 +4335,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 6a30a18..ac377e6 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,c,a,s,f;return null==i&&(i={}),u=null!=(s=i.HTML5)?s:!1,a=null!=(f=i.basePath)?f:"",c=u?o:n,t.router=new c(t,e,a),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)&&c.test(t)||!1}var o=r(48),i=r(3),u="[object Function]",c=/^\[object .+?Constructor\]$/,a=Object.prototype,s=Function.prototype.toString,f=a.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]",c=Object.prototype,a=c.toString,s=o(s=Array.isArray)&&s,f=s||function(t){return i(t)&&n(t.length)&&a.call(t)==u||!1};t.exports=f},function(t,e,r){var n=r(1),o=r(2),i=r(4),u=r(43),c=o(c=Object.keys)&&c,a=c?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)?c(t):[]}:u;t.exports=a},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]*?)$/,c=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/,a=function(t){var e=u.exec(t),r=(e[1]||"")+(e[2]||""),n=e[3]||"",o=c.exec(n),i=o[1],a=o[2],s=o[3];return[r,i,a,s]},s=function(t){return"\\\\"+t.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\")};e.resolve=function(){function r(t){return!!t}for(var o="",c="",a=!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]||"",y=h&&":"!==h.charAt(1),g=e.isAbsolute(p),v=l[3];if((!h||!o||h.toLowerCase()===o.toLowerCase())&&(o||(o=h),a||(c=v+"\\"+c,a=g),o&&a))break}}return y&&(o=s(o)),c=t(c.split(/[\\\/]+/).filter(r),!a).join("\\"),o+(a?"\\":"")+c||"."},e.normalize=function(r){var n=u.exec(r),o=n[1]||"",i=o&&":"!==o.charAt(1),c=e.isAbsolute(r),a=n[3],f=/[\\\/]$/.test(a);return o&&":"===o.charAt(1)&&(o=o[0].toLowerCase()+o.substr(1)),a=t(a.split(/[\\\/]+/).filter(function(t){return!!t}),!c).join("\\"),a||c||(a="."),a&&f&&(a+="\\"),i&&(o=s(o)),o+(c?"\\":"")+a},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("\\")),c=n(o.split("\\")),a=n(i.split("\\")),s=Math.min(c.length,a.length),f=s,p=0;s>p;p++)if(c[p]!==a[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=[],c=0;c=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),c=u,a=0;u>a;a++)if(o[a]!==i[a]){c=a;break}for(var s=[],a=c;ai;i++)h=l[i],h.matches(t)&&s.push(h);if(0===s.length)return!1;for(n=1/0,r=null,p=null,o=u=0,a=s.length;a>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 this.current({path:t,routeParams:p,component:r}),!0},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,e){var r,n;return n=t.detail,r=t.defaultPrevented,2===n||r||!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 c.pathname+c.search+c.hash},t.prototype._getPathFromAnchor=function(t){var e,r;return e=t.getAttribute("href"),r=function(){switch(!1){case"/"!==e[0]:return t.pathname;case".."!==e:return a.resolve(this.current().path,e);default:return a.resolve(this.current().path,"../"+e)}}.call(this),r+t.search+(t.hash||""),r.replace(this._basePath,"")},t.prototype._sameOrigin=function(t){var e;return e=c.protocol+"//"+c.hostname,c.port&&(e+=":"+c.port),t&&0===t.indexOf(e)},t.prototype._onContextMenu=function(t){var e;return e=this._getParentAnchor(t.target),!t.defaultPrevented&&this._isLink(e)?this._patchContextMenu(e):void 0},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),c=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)&&a.call(t)==u||!1}var o=r(1),i=r(3),u="[object Arguments]",c=Object.prototype,a=c.toString;t.exports=n},function(t,e,r){function n(t){if(null==t)return[];a(t)||(t=Object(t));var e=t.length;e=e&&c(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=a[r],null!=f&&(f=decodeURIComponent(f))&&(o=this.paramKeys[r].name)&&(c[o]=f);return c},t}(),t.exports=n},function(t,e,r){var n,o,i,u,c,a,s,f,p,l,h,y,g,v,b;l=r(45),h=r(46),g=r(50),y=null!=(v=null!=(b=window.history)?b.location:void 0)?v:window.location,u=!1,f=null,o="",a=function(){return history._nativePushState=history.pushState,history.pushState=function(t,e,r){var n,i,u;return null==t&&(t={}),u=!g(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=!g(t)(null!=(i=f())?i:{}),n=o!==r,history._nativeReplaceState.apply(this,arguments),(u||n)&&f(t),o=r}},c=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=y.pathname+y.search+y.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||(a(),c(),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));++ra))return!1;for(;f&&++c0:!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||!a.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||a.call(t,r)}var o=r(26),i=r(3),u="[object Object]",c=Object.prototype,a=c.hasOwnProperty,s=c.toString;t.exports=n},function(t,e,r){function n(t){for(var e=a(t),r=e.length,n=r&&t.length,f=n&&c(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]),g(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),a(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 c(t){var e={};return t.forEach(function(t){e[t]=!0}),e}function a(t,r,n){if(t.customInspect&&r&&O(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return m(o)||(o=a(t,o,n)),o}var i=s(t,r);if(i)return i;var u=Object.keys(r),g=c(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(O(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 f(r)}var b="",d=!1,w=["{","}"];if(y(r)&&(d=!0,w=["[","]"]),O(r)){var j=r.name?": "+r.name:"";b=" [Function"+j+"]"}if(x(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 x(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var _;return _=d?p(t,r,n,g,u):u.map(function(e){return l(t,r,n,g,e,d)}),t.seen.pop(),h(_,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"):g(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,c=e.length;c>u;++u)i.push(M(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,c,s;if(s=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]},s.get?c=s.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):s.set&&(c=t.stylize("[Setter]","special")),M(n,o)||(u="["+o+"]"),c||(t.seen.indexOf(s.value)<0?(c=v(r)?a(t,s.value,null):a(t,s.value,r-1),c.indexOf("\n")>-1&&(c=i?c.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+c.split("\n").map(function(t){return" "+t}).join("\n"))):c=t.stylize("[Circular]","special")),j(u)){if(i&&o.match(/^\d+$/))return c;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+": "+c}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 y(t){return Array.isArray(t)}function g(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 x(t){return _(t)&&"[object RegExp]"===E(t)}function _(t){return"object"==typeof t&&null!==t}function A(t){return _(t)&&"[object Date]"===E(t)}function S(t){return _(t)&&("[object Error]"===E(t)||t instanceof Error)}function O(t){return"function"==typeof t}function P(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 M(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var U=/%[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}}),c=n[r];i>r;c=n[++r])u+=v(c)||!_(c)?" "+c:" "+o(c);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 F,z={};e.debuglog=function(t){if(j(F)&&(F=n.env.NODE_DEBUG||""),t=t.toUpperCase(),!z[t])if(new RegExp("\\b"+t+"\\b","i").test(F)){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=y,e.isBoolean=g,e.isNull=v,e.isNullOrUndefined=b,e.isNumber=d,e.isString=m,e.isSymbol=w,e.isUndefined=j,e.isRegExp=x,e.isObject=_,e.isDate=A,e.isError=S,e.isFunction=O,e.isPrimitive=P,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||!_(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,c,a,s,f;return null==i&&(i={}),u=null!=(s=i.HTML5)?s:!1,a=null!=(f=i.basePath)?f:"",c=u?o:n,t.router=new c(t,e,a),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)&&c.test(t)||!1}var o=r(48),i=r(3),u="[object Function]",c=/^\[object .+?Constructor\]$/,a=Object.prototype,s=Function.prototype.toString,f=a.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]",c=Object.prototype,a=c.toString,s=o(s=Array.isArray)&&s,f=s||function(t){return i(t)&&n(t.length)&&a.call(t)==u||!1};t.exports=f},function(t,e,r){var n=r(1),o=r(2),i=r(4),u=r(43),c=o(c=Object.keys)&&c,a=c?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)?c(t):[]}:u;t.exports=a},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]*?)$/,c=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/,a=function(t){var e=u.exec(t),r=(e[1]||"")+(e[2]||""),n=e[3]||"",o=c.exec(n),i=o[1],a=o[2],s=o[3];return[r,i,a,s]},s=function(t){return"\\\\"+t.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\")};e.resolve=function(){function r(t){return!!t}for(var o="",c="",a=!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]||"",y=h&&":"!==h.charAt(1),g=e.isAbsolute(p),v=l[3];if((!h||!o||h.toLowerCase()===o.toLowerCase())&&(o||(o=h),a||(c=v+"\\"+c,a=g),o&&a))break}}return y&&(o=s(o)),c=t(c.split(/[\\\/]+/).filter(r),!a).join("\\"),o+(a?"\\":"")+c||"."},e.normalize=function(r){var n=u.exec(r),o=n[1]||"",i=o&&":"!==o.charAt(1),c=e.isAbsolute(r),a=n[3],f=/[\\\/]$/.test(a);return o&&":"===o.charAt(1)&&(o=o[0].toLowerCase()+o.substr(1)),a=t(a.split(/[\\\/]+/).filter(function(t){return!!t}),!c).join("\\"),a||c||(a="."),a&&f&&(a+="\\"),i&&(o=s(o)),o+(c?"\\":"")+a},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("\\")),c=n(o.split("\\")),a=n(i.split("\\")),s=Math.min(c.length,a.length),f=s,p=0;s>p;p++)if(c[p]!==a[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=[],c=0;c=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),c=u,a=0;u>a;a++)if(o[a]!==i[a]){c=a;break}for(var s=[],a=c;ai;i++)h=l[i],h.matches(t)&&s.push(h);if(0===s.length)return!1;for(n=1/0,r=null,p=null,o=u=0,a=s.length;a>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 this.current({path:t,routeParams:p,component:r}),!0},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,e){var r,n;return n=t.detail,r=t.defaultPrevented,2===n||r||!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 c.pathname+c.search+c.hash},t.prototype._getPathFromAnchor=function(t){var e,r;return e=t.getAttribute("href"),r=function(){switch(!1){case"/"!==e[0]:return t.pathname;case".."!==e:return a.resolve(this.current().path,e);default:return a.resolve(this.current().path,"../"+e)}}.call(this),r+t.search+(t.hash||""),r.replace(this._basePath,"")},t.prototype._sameOrigin=function(t){var e;return e=c.protocol+"//"+c.hostname,c.port&&(e+=":"+c.port),t&&0===t.indexOf(e)},t.prototype._onContextMenu=function(t){var e;return e=this._getParentAnchor(t.target),!t.defaultPrevented&&this._isLink(e)?this._patchContextMenu(e):void 0},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),c=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)&&a.call(t)==u||!1}var o=r(1),i=r(3),u="[object Arguments]",c=Object.prototype,a=c.toString;t.exports=n},function(t,e,r){function n(t){if(null==t)return[];a(t)||(t=Object(t));var e=t.length;e=e&&c(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=a[r],null!=f&&(f=decodeURIComponent(f))&&(o=this.paramKeys[r].name)&&(c[o]=f);return c},t}(),t.exports=n},function(t,e,r){var n,o,i,u,c,a,s,f,p,l,h,y,g,v,b;l=r(45),h=r(46),g=r(50),y=null!=(v=null!=(b=window.history)?b.location:void 0)?v:window.location,u=!1,f=null,o="",a=function(){return history._nativePushState=history.pushState,history.pushState=function(t,e,r){var n,i,u;return null==t&&(t={}),u=!g(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=!g(t)(null!=(i=f())?i:{}),n=o!==r,history._nativeReplaceState.apply(this,arguments),(u||n)&&f(t),o=r}},c=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=y.pathname+y.search+y.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||(a(),c(),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));++ra))return!1;for(;f&&++c0:!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||!a.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||a.call(t,r)}var o=r(26),i=r(3),u="[object Object]",c=Object.prototype,a=c.hasOwnProperty,s=c.toString;t.exports=n},function(t,e,r){function n(t){for(var e=a(t),r=e.length,n=r&&t.length,f=n&&c(n)&&(i(t)||s.nonEnumArgs&&o(t)),l=-1,h=[];++l=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&e._extend(n,r),x(n.showHidden)&&(n.showHidden=!1),x(n.depth)&&(n.depth=2),x(n.colors)&&(n.colors=!1),x(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=i),a(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 c(t){var e={};return t.forEach(function(t){e[t]=!0}),e}function a(t,r,n){if(t.customInspect&&r&&O(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return d(o)||(o=a(t,o,n)),o}var i=s(t,r);if(i)return i;var u=Object.keys(r),g=c(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(O(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="",m=!1,j=["{","}"];if(y(r)&&(m=!0,j=["[","]"]),O(r)){var x=r.name?": "+r.name:"";b=" [Function"+x+"]"}if(_(r)&&(b=" "+RegExp.prototype.toString.call(r)),A(r)&&(b=" "+Date.prototype.toUTCString.call(r)),S(r)&&(b=" "+f(r)),0===u.length&&(!m||0==r.length))return j[0]+b+j[1];if(0>n)return _(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var w;return w=m?p(t,r,n,g,u):u.map(function(e){return l(t,r,n,g,e,m)}),t.seen.pop(),h(w,b,j)}function s(t,e){if(x(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"):g(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,c=e.length;c>u;++u)i.push(U(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,c,s;if(s=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]},s.get?c=s.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):s.set&&(c=t.stylize("[Setter]","special")),U(n,o)||(u="["+o+"]"),c||(t.seen.indexOf(s.value)<0?(c=v(r)?a(t,s.value,null):a(t,s.value,r-1),c.indexOf("\n")>-1&&(c=i?c.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+c.split("\n").map(function(t){return" "+t}).join("\n"))):c=t.stylize("[Circular]","special")),x(u)){if(i&&o.match(/^\d+$/))return c;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+": "+c}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 y(t){return Array.isArray(t)}function g(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 x(t){return void 0===t}function _(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 O(t){return"function"==typeof t}function P(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 U(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var F=/%[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}}),c=n[r];i>r;c=n[++r])u+=v(c)||!w(c)?" "+c:" "+o(c);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(x(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(x(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=y,e.isBoolean=g,e.isNull=v,e.isNullOrUndefined=b,e.isNumber=m,e.isString=d,e.isSymbol=j,e.isUndefined=x,e.isRegExp=_,e.isObject=w,e.isDate=A,e.isError=S,e.isFunction=O,e.isPrimitive=P,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 e990d4c..faa8410 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ko-component-router", - "version": "0.0.1", + "version": "1.0.0", "description": "Component-based routing for KnockoutJS", "main": "dist/ko-component-router.js", "scripts": { @@ -13,6 +13,7 @@ "prepublish": "npm run build" }, "keywords": [ + "ko", "knockout", "knockoutjs", "router",