Socket
Socket
Sign inDemoInstall

atomic-router

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atomic-router - npm Package Compare versions

Comparing version 0.3.0-dev.0 to 0.3.0-dev.1

1

dist/atomic-router.cjs.development.js

@@ -930,2 +930,3 @@ 'use strict';

opened: opened,
updated: updated,
left: left,

@@ -932,0 +933,0 @@ navigate: navigateFx,

2

dist/atomic-router.cjs.production.min.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("effector"),r=require("path-to-regexp"),e=require("qs");function n(t,r,e,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,a){var i=t.apply(r,e);function u(t){n(i,o,a,u,c,"next",t)}function c(t){n(i,o,a,u,c,"throw",t)}u(void 0)}))}}function a(){return(a=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function u(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return i(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,void 0):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,s=(function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function c(t,r,e,n){var o=Object.create((r&&r.prototype instanceof h?r:h).prototype),a=new L(n||[]);return o._invoke=function(t,r,e){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(e.method=o,e.arg=a;;){var i=e.delegate;if(i){var u=b(i,e);if(u){if(u===f)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var c=s(t,r,e);if("normal"===c.type){if(n=e.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n="completed",e.method="throw",e.arg=c.arg)}}}(t,e,a),o}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function l(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,d=v&&v(v(O([])));d&&d!==r&&e.call(d,o)&&(y=d);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function w(t,r){var n;this._invoke=function(o,a){function i(){return new r((function(n,i){!function n(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&e.call(h,"__await")?r.resolve(h.__await).then((function(t){n("next",t,i,u)}),(function(t){n("throw",t,i,u)})):r.resolve(h).then((function(t){f.value=t,i(f)}),(function(t){return n("throw",t,i,u)}))}u(c.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function b(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function E(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function O(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return a.next=a}}return{next:k}}function k(){return{value:void 0,done:!0}}return l.prototype=p,u(m,"constructor",p),u(p,"constructor",l),l.displayName=u(p,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===l||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(r,e,n,o,a){void 0===a&&(a=Promise);var i=new w(c(r,e,n,o),a);return t.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(m),u(m,i,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=O,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=e.call(a,"catchLoc"),c=e.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),f},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),E(e),f}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;E(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:O(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}(c={exports:{}}),c.exports);function f(t){var e=t.params,n=t.query;return r.compile(t.pathCreator)(e)+(Object.keys(n).length?"?"+new URLSearchParams(n):"")}function h(t){var e=t.actualPath,n=r.match(t.pathCreator)(e);return n?{matches:!0,params:n.params}:{matches:!1}}var l=t.createEffect((function(t){if(!t.history)throw new Error("[Routing] No history provided");return t.history[t.method](t.path,{}),t}));exports.buildPath=f,exports.createHistoryRouter=function(r){var n=t.createEvent(),i=t.createStore(null).on(n,(function(t,r){return r})),c=t.attach({source:{history:i},effect:l,mapParams:function(t,r){return a({history:r.history},t)}}),p=t.createEffect((function(t){var r=t.params,e=t.query;return{path:f({pathCreator:t.route.path,params:r,query:e}),params:r,query:e,method:"push"}})),y=t.createEffect((function(t){for(var e,n=t.path,o=t.query,a=[],i=[],c=u(r.routes);!(e=c()).done;){var s=e.value,f=h({pathCreator:s.path,actualPath:n});(f.matches?a:i).push({route:s,params:f.params,query:o})}return{entered:a,left:i}}));t.sample({clock:p.doneData,target:c}),t.sample({clock:c.doneData,target:y});for(var v,d=y.doneData.map((function(t){return t.entered})),m=y.doneData.map((function(t){return t.left})),g=function(){var r=v.value;t.sample({clock:r.route.navigate.doneData,fn:function(t){return{route:r,params:t.params,query:t.query}},target:p}),t.guard({clock:d.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened.map((function(t){return!t})),target:r.route.opened}),t.guard({clock:d.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened.map((function(t){return t})),target:r.route.updated}),t.guard({clock:m.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened,target:r.route.left})},w=u(r.routes);!(v=w()).done;)g();var b,x=t.attach({source:{history:i},effect:(b=o(s.mark((function t(r){var n,o;return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=[(n=r.history).location.pathname,e.parse(n.location.search.slice(1))],t.abrupt("return",{path:o[0],query:o[1]});case 3:case"end":return t.stop()}}),t)}))),function(t){return b.apply(this,arguments)})});t.sample({source:x.doneData,target:y});var E,L=t.attach({source:{history:i},effect:(E=o(s.mark((function r(e){var n,o;return s.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.history,o=t.scopeBind(x),n.listen((function(){return o()})),r.abrupt("return",!0);case 4:case"end":return r.stop()}}),r)}))),function(t){return E.apply(this,arguments)})});return t.sample({clock:L.doneData,target:x}),t.sample({clock:i,target:L}),{$history:i,setHistory:n,push:c,routes:r.routes}},exports.createRoute=function(){var r=t.createEffect(function(){var t=o(s.mark((function t(r){return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",{params:r.params||{},query:r.query||{}});case 2:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}()),e=t.attach({effect:r,mapParams:function(t){return{params:t||{},query:{}}}}),n=t.createStore(!1),a=t.createStore({}),i=t.createStore({}),u=t.createEvent(),c=t.createEvent(),f=t.createEvent();return n.on(u,(function(){return!0})).on(f,(function(){return!1})),a.on(u,(function(t,r){return r.params})).on(c,(function(t,r){return r.params})),i.on(u,(function(t,r){return r.query})).on(c,(function(t,r){return r.query})),t.sample({clock:r.doneData,target:u}),{$isOpened:n,$params:a,$query:i,opened:u,left:f,navigate:r,open:e}},exports.matchPath=h;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("effector"),r=require("path-to-regexp"),e=require("qs");function n(t,r,e,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,a){var i=t.apply(r,e);function u(t){n(i,o,a,u,c,"next",t)}function c(t){n(i,o,a,u,c,"throw",t)}u(void 0)}))}}function a(){return(a=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function u(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return i(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,void 0):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,s=(function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function c(t,r,e,n){var o=Object.create((r&&r.prototype instanceof h?r:h).prototype),a=new L(n||[]);return o._invoke=function(t,r,e){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(e.method=o,e.arg=a;;){var i=e.delegate;if(i){var u=b(i,e);if(u){if(u===f)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var c=s(t,r,e);if("normal"===c.type){if(n=e.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n="completed",e.method="throw",e.arg=c.arg)}}}(t,e,a),o}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function h(){}function l(){}function p(){}var y={};u(y,o,(function(){return this}));var v=Object.getPrototypeOf,d=v&&v(v(O([])));d&&d!==r&&e.call(d,o)&&(y=d);var m=p.prototype=h.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function w(t,r){var n;this._invoke=function(o,a){function i(){return new r((function(n,i){!function n(o,a,i,u){var c=s(t[o],t,a);if("throw"!==c.type){var f=c.arg,h=f.value;return h&&"object"==typeof h&&e.call(h,"__await")?r.resolve(h.__await).then((function(t){n("next",t,i,u)}),(function(t){n("throw",t,i,u)})):r.resolve(h).then((function(t){f.value=t,i(f)}),(function(t){return n("throw",t,i,u)}))}u(c.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function b(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function E(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function O(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return a.next=a}}return{next:k}}function k(){return{value:void 0,done:!0}}return l.prototype=p,u(m,"constructor",p),u(p,"constructor",l),l.displayName=u(p,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===l||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(r,e,n,o,a){void 0===a&&(a=Promise);var i=new w(c(r,e,n,o),a);return t.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(m),u(m,i,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=O,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=e.call(a,"catchLoc"),c=e.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),f},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),E(e),f}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;E(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:O(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}(c={exports:{}}),c.exports);function f(t){var e=t.params,n=t.query;return r.compile(t.pathCreator)(e)+(Object.keys(n).length?"?"+new URLSearchParams(n):"")}function h(t){var e=t.actualPath,n=r.match(t.pathCreator)(e);return n?{matches:!0,params:n.params}:{matches:!1}}var l=t.createEffect((function(t){if(!t.history)throw new Error("[Routing] No history provided");return t.history[t.method](t.path,{}),t}));exports.buildPath=f,exports.createHistoryRouter=function(r){var n=t.createEvent(),i=t.createStore(null).on(n,(function(t,r){return r})),c=t.attach({source:{history:i},effect:l,mapParams:function(t,r){return a({history:r.history},t)}}),p=t.createEffect((function(t){var r=t.params,e=t.query;return{path:f({pathCreator:t.route.path,params:r,query:e}),params:r,query:e,method:"push"}})),y=t.createEffect((function(t){for(var e,n=t.path,o=t.query,a=[],i=[],c=u(r.routes);!(e=c()).done;){var s=e.value,f=h({pathCreator:s.path,actualPath:n});(f.matches?a:i).push({route:s,params:f.params,query:o})}return{entered:a,left:i}}));t.sample({clock:p.doneData,target:c}),t.sample({clock:c.doneData,target:y});for(var v,d=y.doneData.map((function(t){return t.entered})),m=y.doneData.map((function(t){return t.left})),g=function(){var r=v.value;t.sample({clock:r.route.navigate.doneData,fn:function(t){return{route:r,params:t.params,query:t.query}},target:p}),t.guard({clock:d.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened.map((function(t){return!t})),target:r.route.opened}),t.guard({clock:d.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened.map((function(t){return t})),target:r.route.updated}),t.guard({clock:m.filterMap((function(t){return t.find((function(t){return t.route===r}))})),filter:r.route.$isOpened,target:r.route.left})},w=u(r.routes);!(v=w()).done;)g();var b,x=t.attach({source:{history:i},effect:(b=o(s.mark((function t(r){var n,o;return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=[(n=r.history).location.pathname,e.parse(n.location.search.slice(1))],t.abrupt("return",{path:o[0],query:o[1]});case 3:case"end":return t.stop()}}),t)}))),function(t){return b.apply(this,arguments)})});t.sample({source:x.doneData,target:y});var E,L=t.attach({source:{history:i},effect:(E=o(s.mark((function r(e){var n,o;return s.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.history,o=t.scopeBind(x),n.listen((function(){return o()})),r.abrupt("return",!0);case 4:case"end":return r.stop()}}),r)}))),function(t){return E.apply(this,arguments)})});return t.sample({clock:L.doneData,target:x}),t.sample({clock:i,target:L}),{$history:i,setHistory:n,push:c,routes:r.routes}},exports.createRoute=function(){var r=t.createEffect(function(){var t=o(s.mark((function t(r){return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",{params:r.params||{},query:r.query||{}});case 2:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}()),e=t.attach({effect:r,mapParams:function(t){return{params:t||{},query:{}}}}),n=t.createStore(!1),a=t.createStore({}),i=t.createStore({}),u=t.createEvent(),c=t.createEvent(),f=t.createEvent();return n.on(u,(function(){return!0})).on(f,(function(){return!1})),a.on(u,(function(t,r){return r.params})).on(c,(function(t,r){return r.params})),i.on(u,(function(t,r){return r.query})).on(c,(function(t,r){return r.query})),t.sample({clock:r.doneData,target:u}),{$isOpened:n,$params:a,$query:i,opened:u,updated:c,left:f,navigate:r,open:e}},exports.matchPath=h;
//# sourceMappingURL=atomic-router.cjs.production.min.js.map

@@ -926,2 +926,3 @@ import { createEffect, attach, createStore, createEvent, sample, guard, scopeBind } from 'effector';

opened: opened,
updated: updated,
left: left,

@@ -928,0 +929,0 @@ navigate: navigateFx,

{
"version": "0.3.0-dev.0",
"version": "0.3.0-dev.1",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -59,2 +59,3 @@ import {

opened,
updated,
left,

@@ -61,0 +62,0 @@ navigate: navigateFx,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc