Socket
Socket
Sign inDemoInstall

riot-route

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

riot-route - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

18

dist/amd.route.js

@@ -452,8 +452,14 @@ define(function () { 'use strict';

if (win) {
if (document.readyState === 'complete') { start(autoExec); }
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
else { win[ADD_EVENT_LISTENER]('load', function() {
setTimeout(function() { start(autoExec); }, 1);
}); }
if (document.readyState === 'interactive' || document.readyState === 'complete') {
start(autoExec);
}
else {
document.onreadystatechange = function () {
if (document.readyState === 'interactive') {
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
setTimeout(function() { start(autoExec); }, 1);
}
};
}
}

@@ -460,0 +466,0 @@ started = true;

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

define(function(){"use strict";var e=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,l;for(l=0;l<a;l++){f[l]=i[l+1]}u=r.call(t[n]||[],0);for(l=0;o=u[l];++l){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var t=/^.+?\/\/+[^\/]+/;var r="EventListener";var n="remove"+r;var i="add"+r;var a="hasAttribute";var f="popstate";var u="hashchange";var o="trigger";var l=3;var c=typeof window!="undefined"&&window;var s=typeof document!="undefined"&&document;var v=c&&history;var h=c&&(v.location||c.location);var p=P.prototype;var d=s&&s.ontouchstart?"touchstart":"click";var m=e();var b=false;var g=false;var y;var w;var $;var A;var x;var K=[];var N=0;function O(e){return e.split(/[\/?#]/)}function S(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function T(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function E(e){y=T(L,1);c[i](f,y);c[i](u,y);s[i](d,R);if(e){L(true)}}function P(){this.$=[];e(this);m.on("stop",this.s.bind(this));m.on("emit",this.e.bind(this))}function j(e){return e.replace(/^\/|\/$/,"")}function k(e){return typeof e=="string"}function q(e){return(e||h.href).replace(t,"")}function D(e){return w[0]==="#"?(e||h.href||"").split(w)[1]||"":(h?q(e):e||"").replace(w,"")}function L(e){var t=N===0;if(l<=N){return}N++;K.push(function(){var t=D();if(e||t!==$){m[o]("emit",t);$=t}});if(t){var r;while(r=K.shift()){r()}N=0}}function R(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var r=e.target;while(r&&r.nodeName!=="A"){r=r.parentNode}if(!r||r.nodeName!=="A"||r[a]("download")||!r[a]("href")||r.target&&r.target!=="_self"||r.href.indexOf(h.href.match(t)[0])===-1){return}if(r.href!==h.href&&(r.href.split("#")[0]===h.href.split("#")[0]||w[0]!=="#"&&q(r.href).indexOf(w)!==0||w[0]==="#"&&r.href.split(w)[0]!==h.href.split(w)[0]||!_(D(r.href),r.title||s.title))){return}e.preventDefault()}function _(e,t,r){if(!v){return m[o]("emit",D(e))}e=w+j(e);t=t||s.title;r?v.replaceState(null,t,e):v.pushState(null,t,e);s.title=t;g=false;L();return g}p.m=function(e,t,r){if(k(e)&&(!t||k(t))){_(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};p.s=function(){this.off("*");this.$=[]};p.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?A:x)(j(e),j(t));if(typeof r!="undefined"){this[o].apply(null,[t].concat(r));return g=true}},this)};p.r=function(e,t){if(e!=="@"){e="/"+j(e);this.$.push(e)}this.on(e,t)};var z=new P;var B=z.m.bind(z);B.create=function(){var e=new P;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};B.base=function(e){w=e||"#";$=D()};B.exec=function(){L(true)};B.parser=function(e,t){if(!e&&!t){A=O;x=S}if(e){A=e}if(t){x=t}};B.query=function(){var e={};var t=h.href||$;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};B.stop=function(){if(b){if(c){c[n](f,y);c[n](u,y);s[n](d,R)}m[o]("stop");b=false}};B.start=function(e){if(!b){if(c){if(document.readyState==="complete"){E(e)}else{c[i]("load",function(){setTimeout(function(){E(e)},1)})}}b=true}};B.base();B.parser();return B});
define(function(){"use strict";var e=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,c;for(c=0;c<a;c++){f[c]=i[c+1]}u=r.call(t[n]||[],0);for(c=0;o=u[c];++c){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var t=/^.+?\/\/+[^\/]+/;var r="EventListener";var n="remove"+r;var i="add"+r;var a="hasAttribute";var f="popstate";var u="hashchange";var o="trigger";var c=3;var l=typeof window!="undefined"&&window;var s=typeof document!="undefined"&&document;var v=l&&history;var h=l&&(v.location||l.location);var p=P.prototype;var d=s&&s.ontouchstart?"touchstart":"click";var m=e();var y=false;var b=false;var g;var w;var $;var A;var S;var x=[];var K=0;function N(e){return e.split(/[\/?#]/)}function O(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function T(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function E(e){g=T(L,1);l[i](f,g);l[i](u,g);s[i](d,R);if(e){L(true)}}function P(){this.$=[];e(this);m.on("stop",this.s.bind(this));m.on("emit",this.e.bind(this))}function j(e){return e.replace(/^\/|\/$/,"")}function k(e){return typeof e=="string"}function q(e){return(e||h.href).replace(t,"")}function D(e){return w[0]==="#"?(e||h.href||"").split(w)[1]||"":(h?q(e):e||"").replace(w,"")}function L(e){var t=K===0;if(c<=K){return}K++;x.push(function(){var t=D();if(e||t!==$){m[o]("emit",t);$=t}});if(t){var r;while(r=x.shift()){r()}K=0}}function R(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var r=e.target;while(r&&r.nodeName!=="A"){r=r.parentNode}if(!r||r.nodeName!=="A"||r[a]("download")||!r[a]("href")||r.target&&r.target!=="_self"||r.href.indexOf(h.href.match(t)[0])===-1){return}if(r.href!==h.href&&(r.href.split("#")[0]===h.href.split("#")[0]||w[0]!=="#"&&q(r.href).indexOf(w)!==0||w[0]==="#"&&r.href.split(w)[0]!==h.href.split(w)[0]||!_(D(r.href),r.title||s.title))){return}e.preventDefault()}function _(e,t,r){if(!v){return m[o]("emit",D(e))}e=w+j(e);t=t||s.title;r?v.replaceState(null,t,e):v.pushState(null,t,e);s.title=t;b=false;L();return b}p.m=function(e,t,r){if(k(e)&&(!t||k(t))){_(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};p.s=function(){this.off("*");this.$=[]};p.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?A:S)(j(e),j(t));if(typeof r!="undefined"){this[o].apply(null,[t].concat(r));return b=true}},this)};p.r=function(e,t){if(e!=="@"){e="/"+j(e);this.$.push(e)}this.on(e,t)};var z=new P;var B=z.m.bind(z);B.create=function(){var e=new P;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};B.base=function(e){w=e||"#";$=D()};B.exec=function(){L(true)};B.parser=function(e,t){if(!e&&!t){A=N;S=O}if(e){A=e}if(t){S=t}};B.query=function(){var e={};var t=h.href||$;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};B.stop=function(){if(y){if(l){l[n](f,g);l[n](u,g);s[n](d,R)}m[o]("stop");y=false}};B.start=function(e){if(!y){if(l){if(document.readyState==="interactive"||document.readyState==="complete"){E(e)}else{document.onreadystatechange=function(){if(document.readyState==="interactive"){setTimeout(function(){E(e)},1)}}}}y=true}};B.base();B.parser();return B});

@@ -454,8 +454,14 @@ define(['riot'], function (riot) { 'use strict';

if (win) {
if (document.readyState === 'complete') { start(autoExec); }
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
else { win[ADD_EVENT_LISTENER]('load', function() {
setTimeout(function() { start(autoExec); }, 1);
}); }
if (document.readyState === 'interactive' || document.readyState === 'complete') {
start(autoExec);
}
else {
document.onreadystatechange = function () {
if (document.readyState === 'interactive') {
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
setTimeout(function() { start(autoExec); }, 1);
}
};
}
}

@@ -462,0 +468,0 @@ started = true;

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

define(["riot"],function(e){"use strict";e="default"in e?e["default"]:e;var t=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,c;for(c=0;c<a;c++){f[c]=i[c+1]}u=r.call(t[n]||[],0);for(c=0;o=u[c];++c){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var r=/^.+?\/\/+[^\/]+/;var n="EventListener";var i="remove"+n;var a="add"+n;var f="hasAttribute";var u="popstate";var o="hashchange";var c="trigger";var l=3;var s=typeof window!="undefined"&&window;var h=typeof document!="undefined"&&document;var p=s&&history;var v=s&&(p.location||s.location);var d=k.prototype;var g=h&&h.ontouchstart?"touchstart":"click";var m=t();var y=false;var b=false;var w;var $;var A;var x;var E;var O=[];var T=0;function K(e){return e.split(/[\/?#]/)}function N(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function S(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function j(e){w=S(R,1);s[a](u,w);s[a](o,w);h[a](g,_);if(e){R(true)}}function k(){this.$=[];t(this);m.on("stop",this.s.bind(this));m.on("emit",this.e.bind(this))}function P(e){return e.replace(/^\/|\/$/,"")}function q(e){return typeof e=="string"}function D(e){return(e||v.href).replace(r,"")}function L(e){return $[0]==="#"?(e||v.href||"").split($)[1]||"":(v?D(e):e||"").replace($,"")}function R(e){var t=T===0;if(l<=T){return}T++;O.push(function(){var t=L();if(e||t!==A){m[c]("emit",t);A=t}});if(t){var r;while(r=O.shift()){r()}T=0}}function _(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var t=e.target;while(t&&t.nodeName!=="A"){t=t.parentNode}if(!t||t.nodeName!=="A"||t[f]("download")||!t[f]("href")||t.target&&t.target!=="_self"||t.href.indexOf(v.href.match(r)[0])===-1){return}if(t.href!==v.href&&(t.href.split("#")[0]===v.href.split("#")[0]||$[0]!=="#"&&D(t.href).indexOf($)!==0||$[0]==="#"&&t.href.split($)[0]!==v.href.split($)[0]||!z(L(t.href),t.title||h.title))){return}e.preventDefault()}function z(e,t,r){if(!p){return m[c]("emit",L(e))}e=$+P(e);t=t||h.title;r?p.replaceState(null,t,e):p.pushState(null,t,e);h.title=t;b=false;R();return b}d.m=function(e,t,r){if(q(e)&&(!t||q(t))){z(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};d.s=function(){this.off("*");this.$=[]};d.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?x:E)(P(e),P(t));if(typeof r!="undefined"){this[c].apply(null,[t].concat(r));return b=true}},this)};d.r=function(e,t){if(e!=="@"){e="/"+P(e);this.$.push(e)}this.on(e,t)};var B=new k;var C=B.m.bind(B);C.create=function(){var e=new k;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};C.base=function(e){$=e||"#";A=L()};C.exec=function(){R(true)};C.parser=function(e,t){if(!e&&!t){x=K;E=N}if(e){x=e}if(t){E=t}};C.query=function(){var e={};var t=v.href||A;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};C.stop=function(){if(y){if(s){s[i](u,w);s[i](o,w);h[i](g,_)}m[c]("stop");y=false}};C.start=function(e){if(!y){if(s){if(document.readyState==="complete"){j(e)}else{s[a]("load",function(){setTimeout(function(){j(e)},1)})}}y=true}};C.base();C.parser();e.tag2("router","<yield></yield>","","",function(e){var t=this;this.route=C.create();this.select=function(e){[].concat(t.tags.route).forEach(function(t){return t.show=t===e})};this.on("mount",function(){window.setTimeout(function(){return C.start(true)},0)})});e.tag2("route",'<virtual if="{show}"><yield></yield></virtual>',"","",function(e){var t=this;this.show=false;this.parent.route(e.path,function(){var e=[],n=arguments.length;while(n--)e[n]=arguments[n];t.one("updated",function(){r(t.tags).forEach(function(t){t.trigger.apply(t,["route"].concat(e));t.update()})});t.parent.select(t);t.parent.update()});function r(e){return Object.keys(e).map(function(t){return e[t]}).reduce(function(e,t){return e.concat(t)},[])}});return C});
define(["riot"],function(e){"use strict";e="default"in e?e["default"]:e;var t=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,c;for(c=0;c<a;c++){f[c]=i[c+1]}u=r.call(t[n]||[],0);for(c=0;o=u[c];++c){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var r=/^.+?\/\/+[^\/]+/;var n="EventListener";var i="remove"+n;var a="add"+n;var f="hasAttribute";var u="popstate";var o="hashchange";var c="trigger";var l=3;var s=typeof window!="undefined"&&window;var h=typeof document!="undefined"&&document;var v=s&&history;var p=s&&(v.location||s.location);var d=k.prototype;var m=h&&h.ontouchstart?"touchstart":"click";var g=t();var y=false;var b=false;var w;var $;var A;var S;var x;var E=[];var O=0;function T(e){return e.split(/[\/?#]/)}function K(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function N(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function j(e){w=N(R,1);s[a](u,w);s[a](o,w);h[a](m,_);if(e){R(true)}}function k(){this.$=[];t(this);g.on("stop",this.s.bind(this));g.on("emit",this.e.bind(this))}function P(e){return e.replace(/^\/|\/$/,"")}function q(e){return typeof e=="string"}function D(e){return(e||p.href).replace(r,"")}function L(e){return $[0]==="#"?(e||p.href||"").split($)[1]||"":(p?D(e):e||"").replace($,"")}function R(e){var t=O===0;if(l<=O){return}O++;E.push(function(){var t=L();if(e||t!==A){g[c]("emit",t);A=t}});if(t){var r;while(r=E.shift()){r()}O=0}}function _(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var t=e.target;while(t&&t.nodeName!=="A"){t=t.parentNode}if(!t||t.nodeName!=="A"||t[f]("download")||!t[f]("href")||t.target&&t.target!=="_self"||t.href.indexOf(p.href.match(r)[0])===-1){return}if(t.href!==p.href&&(t.href.split("#")[0]===p.href.split("#")[0]||$[0]!=="#"&&D(t.href).indexOf($)!==0||$[0]==="#"&&t.href.split($)[0]!==p.href.split($)[0]||!z(L(t.href),t.title||h.title))){return}e.preventDefault()}function z(e,t,r){if(!v){return g[c]("emit",L(e))}e=$+P(e);t=t||h.title;r?v.replaceState(null,t,e):v.pushState(null,t,e);h.title=t;b=false;R();return b}d.m=function(e,t,r){if(q(e)&&(!t||q(t))){z(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};d.s=function(){this.off("*");this.$=[]};d.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?S:x)(P(e),P(t));if(typeof r!="undefined"){this[c].apply(null,[t].concat(r));return b=true}},this)};d.r=function(e,t){if(e!=="@"){e="/"+P(e);this.$.push(e)}this.on(e,t)};var B=new k;var C=B.m.bind(B);C.create=function(){var e=new k;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};C.base=function(e){$=e||"#";A=L()};C.exec=function(){R(true)};C.parser=function(e,t){if(!e&&!t){S=T;x=K}if(e){S=e}if(t){x=t}};C.query=function(){var e={};var t=p.href||A;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};C.stop=function(){if(y){if(s){s[i](u,w);s[i](o,w);h[i](m,_)}g[c]("stop");y=false}};C.start=function(e){if(!y){if(s){if(document.readyState==="interactive"||document.readyState==="complete"){j(e)}else{document.onreadystatechange=function(){if(document.readyState==="interactive"){setTimeout(function(){j(e)},1)}}}}y=true}};C.base();C.parser();e.tag2("router","<yield></yield>","","",function(e){var t=this;this.route=C.create();this.select=function(e){[].concat(t.tags.route).forEach(function(t){return t.show=t===e})};this.on("mount",function(){window.setTimeout(function(){return C.start(true)},0)})});e.tag2("route",'<virtual if="{show}"><yield></yield></virtual>',"","",function(e){var t=this;this.show=false;this.parent.route(e.path,function(){var e=[],n=arguments.length;while(n--)e[n]=arguments[n];t.one("updated",function(){r(t.tags).forEach(function(t){t.trigger.apply(t,["route"].concat(e));t.update()})});t.parent.select(t);t.parent.update()});function r(e){return Object.keys(e).map(function(t){return e[t]}).reduce(function(e,t){return e.concat(t)},[])}});return C});

@@ -453,8 +453,14 @@ var route = (function () {

if (win) {
if (document.readyState === 'complete') { start(autoExec); }
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
else { win[ADD_EVENT_LISTENER]('load', function() {
setTimeout(function() { start(autoExec); }, 1);
}); }
if (document.readyState === 'interactive' || document.readyState === 'complete') {
start(autoExec);
}
else {
document.onreadystatechange = function () {
if (document.readyState === 'interactive') {
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
setTimeout(function() { start(autoExec); }, 1);
}
};
}
}

@@ -461,0 +467,0 @@ started = true;

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

var route=function(){"use strict";var e=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,l;for(l=0;l<a;l++){f[l]=i[l+1]}u=r.call(t[n]||[],0);for(l=0;o=u[l];++l){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var t=/^.+?\/\/+[^\/]+/;var r="EventListener";var n="remove"+r;var i="add"+r;var a="hasAttribute";var f="popstate";var u="hashchange";var o="trigger";var l=3;var c=typeof window!="undefined"&&window;var s=typeof document!="undefined"&&document;var v=c&&history;var h=c&&(v.location||c.location);var p=P.prototype;var d=s&&s.ontouchstart?"touchstart":"click";var m=e();var b=false;var g=false;var y;var w;var $;var A;var x;var K=[];var N=0;function O(e){return e.split(/[\/?#]/)}function S(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function T(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function E(e){y=T(L,1);c[i](f,y);c[i](u,y);s[i](d,R);if(e){L(true)}}function P(){this.$=[];e(this);m.on("stop",this.s.bind(this));m.on("emit",this.e.bind(this))}function j(e){return e.replace(/^\/|\/$/,"")}function k(e){return typeof e=="string"}function q(e){return(e||h.href).replace(t,"")}function D(e){return w[0]==="#"?(e||h.href||"").split(w)[1]||"":(h?q(e):e||"").replace(w,"")}function L(e){var t=N===0;if(l<=N){return}N++;K.push(function(){var t=D();if(e||t!==$){m[o]("emit",t);$=t}});if(t){var r;while(r=K.shift()){r()}N=0}}function R(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var r=e.target;while(r&&r.nodeName!=="A"){r=r.parentNode}if(!r||r.nodeName!=="A"||r[a]("download")||!r[a]("href")||r.target&&r.target!=="_self"||r.href.indexOf(h.href.match(t)[0])===-1){return}if(r.href!==h.href&&(r.href.split("#")[0]===h.href.split("#")[0]||w[0]!=="#"&&q(r.href).indexOf(w)!==0||w[0]==="#"&&r.href.split(w)[0]!==h.href.split(w)[0]||!_(D(r.href),r.title||s.title))){return}e.preventDefault()}function _(e,t,r){if(!v){return m[o]("emit",D(e))}e=w+j(e);t=t||s.title;r?v.replaceState(null,t,e):v.pushState(null,t,e);s.title=t;g=false;L();return g}p.m=function(e,t,r){if(k(e)&&(!t||k(t))){_(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};p.s=function(){this.off("*");this.$=[]};p.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?A:x)(j(e),j(t));if(typeof r!="undefined"){this[o].apply(null,[t].concat(r));return g=true}},this)};p.r=function(e,t){if(e!=="@"){e="/"+j(e);this.$.push(e)}this.on(e,t)};var z=new P;var B=z.m.bind(z);B.create=function(){var e=new P;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};B.base=function(e){w=e||"#";$=D()};B.exec=function(){L(true)};B.parser=function(e,t){if(!e&&!t){A=O;x=S}if(e){A=e}if(t){x=t}};B.query=function(){var e={};var t=h.href||$;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};B.stop=function(){if(b){if(c){c[n](f,y);c[n](u,y);s[n](d,R)}m[o]("stop");b=false}};B.start=function(e){if(!b){if(c){if(document.readyState==="complete"){E(e)}else{c[i]("load",function(){setTimeout(function(){E(e)},1)})}}b=true}};B.base();B.parser();return B}();
var route=function(){"use strict";var e=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,c;for(c=0;c<a;c++){f[c]=i[c+1]}u=r.call(t[n]||[],0);for(c=0;o=u[c];++c){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var t=/^.+?\/\/+[^\/]+/;var r="EventListener";var n="remove"+r;var i="add"+r;var a="hasAttribute";var f="popstate";var u="hashchange";var o="trigger";var c=3;var l=typeof window!="undefined"&&window;var s=typeof document!="undefined"&&document;var v=l&&history;var h=l&&(v.location||l.location);var p=P.prototype;var d=s&&s.ontouchstart?"touchstart":"click";var m=e();var y=false;var b=false;var g;var w;var $;var A;var S;var x=[];var K=0;function N(e){return e.split(/[\/?#]/)}function O(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function T(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function E(e){g=T(L,1);l[i](f,g);l[i](u,g);s[i](d,R);if(e){L(true)}}function P(){this.$=[];e(this);m.on("stop",this.s.bind(this));m.on("emit",this.e.bind(this))}function j(e){return e.replace(/^\/|\/$/,"")}function k(e){return typeof e=="string"}function q(e){return(e||h.href).replace(t,"")}function D(e){return w[0]==="#"?(e||h.href||"").split(w)[1]||"":(h?q(e):e||"").replace(w,"")}function L(e){var t=K===0;if(c<=K){return}K++;x.push(function(){var t=D();if(e||t!==$){m[o]("emit",t);$=t}});if(t){var r;while(r=x.shift()){r()}K=0}}function R(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var r=e.target;while(r&&r.nodeName!=="A"){r=r.parentNode}if(!r||r.nodeName!=="A"||r[a]("download")||!r[a]("href")||r.target&&r.target!=="_self"||r.href.indexOf(h.href.match(t)[0])===-1){return}if(r.href!==h.href&&(r.href.split("#")[0]===h.href.split("#")[0]||w[0]!=="#"&&q(r.href).indexOf(w)!==0||w[0]==="#"&&r.href.split(w)[0]!==h.href.split(w)[0]||!_(D(r.href),r.title||s.title))){return}e.preventDefault()}function _(e,t,r){if(!v){return m[o]("emit",D(e))}e=w+j(e);t=t||s.title;r?v.replaceState(null,t,e):v.pushState(null,t,e);s.title=t;b=false;L();return b}p.m=function(e,t,r){if(k(e)&&(!t||k(t))){_(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};p.s=function(){this.off("*");this.$=[]};p.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?A:S)(j(e),j(t));if(typeof r!="undefined"){this[o].apply(null,[t].concat(r));return b=true}},this)};p.r=function(e,t){if(e!=="@"){e="/"+j(e);this.$.push(e)}this.on(e,t)};var z=new P;var B=z.m.bind(z);B.create=function(){var e=new P;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};B.base=function(e){w=e||"#";$=D()};B.exec=function(){L(true)};B.parser=function(e,t){if(!e&&!t){A=N;S=O}if(e){A=e}if(t){S=t}};B.query=function(){var e={};var t=h.href||$;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};B.stop=function(){if(y){if(l){l[n](f,g);l[n](u,g);s[n](d,R)}m[o]("stop");y=false}};B.start=function(e){if(!y){if(l){if(document.readyState==="interactive"||document.readyState==="complete"){E(e)}else{document.onreadystatechange=function(){if(document.readyState==="interactive"){setTimeout(function(){E(e)},1)}}}}y=true}};B.base();B.parser();return B}();

@@ -455,8 +455,14 @@ var route = (function (riot) {

if (win) {
if (document.readyState === 'complete') { start(autoExec); }
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
else { win[ADD_EVENT_LISTENER]('load', function() {
setTimeout(function() { start(autoExec); }, 1);
}); }
if (document.readyState === 'interactive' || document.readyState === 'complete') {
start(autoExec);
}
else {
document.onreadystatechange = function () {
if (document.readyState === 'interactive') {
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
setTimeout(function() { start(autoExec); }, 1);
}
};
}
}

@@ -463,0 +469,0 @@ started = true;

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

var route=function(e){"use strict";e="default"in e?e["default"]:e;var t=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,c;for(c=0;c<a;c++){f[c]=i[c+1]}u=r.call(t[n]||[],0);for(c=0;o=u[c];++c){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var r=/^.+?\/\/+[^\/]+/;var n="EventListener";var i="remove"+n;var a="add"+n;var f="hasAttribute";var u="popstate";var o="hashchange";var c="trigger";var l=3;var s=typeof window!="undefined"&&window;var h=typeof document!="undefined"&&document;var v=s&&history;var p=s&&(v.location||s.location);var d=k.prototype;var g=h&&h.ontouchstart?"touchstart":"click";var m=t();var y=false;var b=false;var w;var $;var A;var x;var E;var O=[];var T=0;function K(e){return e.split(/[\/?#]/)}function N(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function S(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function j(e){w=S(R,1);s[a](u,w);s[a](o,w);h[a](g,_);if(e){R(true)}}function k(){this.$=[];t(this);m.on("stop",this.s.bind(this));m.on("emit",this.e.bind(this))}function P(e){return e.replace(/^\/|\/$/,"")}function q(e){return typeof e=="string"}function D(e){return(e||p.href).replace(r,"")}function L(e){return $[0]==="#"?(e||p.href||"").split($)[1]||"":(p?D(e):e||"").replace($,"")}function R(e){var t=T===0;if(l<=T){return}T++;O.push(function(){var t=L();if(e||t!==A){m[c]("emit",t);A=t}});if(t){var r;while(r=O.shift()){r()}T=0}}function _(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var t=e.target;while(t&&t.nodeName!=="A"){t=t.parentNode}if(!t||t.nodeName!=="A"||t[f]("download")||!t[f]("href")||t.target&&t.target!=="_self"||t.href.indexOf(p.href.match(r)[0])===-1){return}if(t.href!==p.href&&(t.href.split("#")[0]===p.href.split("#")[0]||$[0]!=="#"&&D(t.href).indexOf($)!==0||$[0]==="#"&&t.href.split($)[0]!==p.href.split($)[0]||!z(L(t.href),t.title||h.title))){return}e.preventDefault()}function z(e,t,r){if(!v){return m[c]("emit",L(e))}e=$+P(e);t=t||h.title;r?v.replaceState(null,t,e):v.pushState(null,t,e);h.title=t;b=false;R();return b}d.m=function(e,t,r){if(q(e)&&(!t||q(t))){z(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};d.s=function(){this.off("*");this.$=[]};d.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?x:E)(P(e),P(t));if(typeof r!="undefined"){this[c].apply(null,[t].concat(r));return b=true}},this)};d.r=function(e,t){if(e!=="@"){e="/"+P(e);this.$.push(e)}this.on(e,t)};var B=new k;var C=B.m.bind(B);C.create=function(){var e=new k;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};C.base=function(e){$=e||"#";A=L()};C.exec=function(){R(true)};C.parser=function(e,t){if(!e&&!t){x=K;E=N}if(e){x=e}if(t){E=t}};C.query=function(){var e={};var t=p.href||A;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};C.stop=function(){if(y){if(s){s[i](u,w);s[i](o,w);h[i](g,_)}m[c]("stop");y=false}};C.start=function(e){if(!y){if(s){if(document.readyState==="complete"){j(e)}else{s[a]("load",function(){setTimeout(function(){j(e)},1)})}}y=true}};C.base();C.parser();e.tag2("router","<yield></yield>","","",function(e){var t=this;this.route=C.create();this.select=function(e){[].concat(t.tags.route).forEach(function(t){return t.show=t===e})};this.on("mount",function(){window.setTimeout(function(){return C.start(true)},0)})});e.tag2("route",'<virtual if="{show}"><yield></yield></virtual>',"","",function(e){var t=this;this.show=false;this.parent.route(e.path,function(){var e=[],n=arguments.length;while(n--)e[n]=arguments[n];t.one("updated",function(){r(t.tags).forEach(function(t){t.trigger.apply(t,["route"].concat(e));t.update()})});t.parent.select(t);t.parent.update()});function r(e){return Object.keys(e).map(function(t){return e[t]}).reduce(function(e,t){return e.concat(t)},[])}});return C}(riot);
var route=function(e){"use strict";e="default"in e?e["default"]:e;var t=function(e){e=e||{};var t={},r=Array.prototype.slice;Object.defineProperties(e,{on:{value:function(r,n){if(typeof n=="function"){(t[r]=t[r]||[]).push(n)}return e},enumerable:false,writable:false,configurable:false},off:{value:function(r,n){if(r=="*"&&!n){t={}}else{if(n){var i=t[r];for(var a=0,f;f=i&&i[a];++a){if(f==n){i.splice(a--,1)}}}else{delete t[r]}}return e},enumerable:false,writable:false,configurable:false},one:{value:function(t,r){function n(){e.off(t,n);r.apply(e,arguments)}return e.on(t,n)},enumerable:false,writable:false,configurable:false},trigger:{value:function(n){var i=arguments;var a=arguments.length-1,f=new Array(a),u,o,c;for(c=0;c<a;c++){f[c]=i[c+1]}u=r.call(t[n]||[],0);for(c=0;o=u[c];++c){o.apply(e,f)}if(t["*"]&&n!="*"){e.trigger.apply(e,["*",n].concat(f))}return e},enumerable:false,writable:false,configurable:false}});return e};var r=/^.+?\/\/+[^\/]+/;var n="EventListener";var i="remove"+n;var a="add"+n;var f="hasAttribute";var u="popstate";var o="hashchange";var c="trigger";var l=3;var s=typeof window!="undefined"&&window;var h=typeof document!="undefined"&&document;var v=s&&history;var p=s&&(v.location||s.location);var d=k.prototype;var m=h&&h.ontouchstart?"touchstart":"click";var g=t();var y=false;var b=false;var w;var $;var A;var S;var x;var E=[];var O=0;function T(e){return e.split(/[\/?#]/)}function K(e,t){var r=t.replace(/\?/g,"\\?").replace(/\*/g,"([^/?#]+?)").replace(/\.\./,".*");var n=new RegExp("^"+r+"$");var i=e.match(n);if(i){return i.slice(1)}}function N(e,t){var r;return function(){clearTimeout(r);r=setTimeout(e,t)}}function j(e){w=N(R,1);s[a](u,w);s[a](o,w);h[a](m,_);if(e){R(true)}}function k(){this.$=[];t(this);g.on("stop",this.s.bind(this));g.on("emit",this.e.bind(this))}function P(e){return e.replace(/^\/|\/$/,"")}function q(e){return typeof e=="string"}function D(e){return(e||p.href).replace(r,"")}function L(e){return $[0]==="#"?(e||p.href||"").split($)[1]||"":(p?D(e):e||"").replace($,"")}function R(e){var t=O===0;if(l<=O){return}O++;E.push(function(){var t=L();if(e||t!==A){g[c]("emit",t);A=t}});if(t){var r;while(r=E.shift()){r()}O=0}}function _(e){if(e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented){return}var t=e.target;while(t&&t.nodeName!=="A"){t=t.parentNode}if(!t||t.nodeName!=="A"||t[f]("download")||!t[f]("href")||t.target&&t.target!=="_self"||t.href.indexOf(p.href.match(r)[0])===-1){return}if(t.href!==p.href&&(t.href.split("#")[0]===p.href.split("#")[0]||$[0]!=="#"&&D(t.href).indexOf($)!==0||$[0]==="#"&&t.href.split($)[0]!==p.href.split($)[0]||!z(L(t.href),t.title||h.title))){return}e.preventDefault()}function z(e,t,r){if(!v){return g[c]("emit",L(e))}e=$+P(e);t=t||h.title;r?v.replaceState(null,t,e):v.pushState(null,t,e);h.title=t;b=false;R();return b}d.m=function(e,t,r){if(q(e)&&(!t||q(t))){z(e,t,r||false)}else if(t){this.r(e,t)}else{this.r("@",e)}};d.s=function(){this.off("*");this.$=[]};d.e=function(e){this.$.concat("@").some(function(t){var r=(t==="@"?S:x)(P(e),P(t));if(typeof r!="undefined"){this[c].apply(null,[t].concat(r));return b=true}},this)};d.r=function(e,t){if(e!=="@"){e="/"+P(e);this.$.push(e)}this.on(e,t)};var B=new k;var C=B.m.bind(B);C.create=function(){var e=new k;var t=e.m.bind(e);t.stop=e.s.bind(e);return t};C.base=function(e){$=e||"#";A=L()};C.exec=function(){R(true)};C.parser=function(e,t){if(!e&&!t){S=T;x=K}if(e){S=e}if(t){x=t}};C.query=function(){var e={};var t=p.href||A;t.replace(/[?&](.+?)=([^&]*)/g,function(t,r,n){e[r]=n});return e};C.stop=function(){if(y){if(s){s[i](u,w);s[i](o,w);h[i](m,_)}g[c]("stop");y=false}};C.start=function(e){if(!y){if(s){if(document.readyState==="interactive"||document.readyState==="complete"){j(e)}else{document.onreadystatechange=function(){if(document.readyState==="interactive"){setTimeout(function(){j(e)},1)}}}}y=true}};C.base();C.parser();e.tag2("router","<yield></yield>","","",function(e){var t=this;this.route=C.create();this.select=function(e){[].concat(t.tags.route).forEach(function(t){return t.show=t===e})};this.on("mount",function(){window.setTimeout(function(){return C.start(true)},0)})});e.tag2("route",'<virtual if="{show}"><yield></yield></virtual>',"","",function(e){var t=this;this.show=false;this.parent.route(e.path,function(){var e=[],n=arguments.length;while(n--)e[n]=arguments[n];t.one("updated",function(){r(t.tags).forEach(function(t){t.trigger.apply(t,["route"].concat(e));t.update()})});t.parent.select(t);t.parent.update()});function r(e){return Object.keys(e).map(function(t){return e[t]}).reduce(function(e,t){return e.concat(t)},[])}});return C}(riot);

@@ -330,8 +330,14 @@ 'use strict';

if (win) {
if (document.readyState === 'complete') { start(autoExec); }
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
else { win[ADD_EVENT_LISTENER]('load', function() {
setTimeout(function() { start(autoExec); }, 1);
}); }
if (document.readyState === 'interactive' || document.readyState === 'complete') {
start(autoExec);
}
else {
document.onreadystatechange = function () {
if (document.readyState === 'interactive') {
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
setTimeout(function() { start(autoExec); }, 1);
}
};
}
}

@@ -338,0 +344,0 @@ started = true;

@@ -326,8 +326,14 @@ import observable from 'riot-observable';

if (win) {
if (document.readyState === 'complete') { start(autoExec); }
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
else { win[ADD_EVENT_LISTENER]('load', function() {
setTimeout(function() { start(autoExec); }, 1);
}); }
if (document.readyState === 'interactive' || document.readyState === 'complete') {
start(autoExec);
}
else {
document.onreadystatechange = function () {
if (document.readyState === 'interactive') {
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
setTimeout(function() { start(autoExec); }, 1);
}
};
}
}

@@ -334,0 +340,0 @@ started = true;

{
"name": "riot-route",
"version": "3.1.0",
"version": "3.1.1",
"description": "Simple isomorphic router",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -329,8 +329,14 @@ 'use strict'

if (win) {
if (document.readyState === 'complete') start(autoExec)
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
else win[ADD_EVENT_LISTENER]('load', function() {
setTimeout(function() { start(autoExec) }, 1)
})
if (document.readyState === 'interactive' || document.readyState === 'complete') {
start(autoExec)
}
else {
document.onreadystatechange = function () {
if (document.readyState === 'interactive') {
// the timeout is needed to solve
// a weird safari bug https://github.com/riot/route/issues/33
setTimeout(function() { start(autoExec) }, 1)
}
}
}
}

@@ -337,0 +343,0 @@ started = true

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc