Comparing version 1.8.3 to 1.8.4
{ | ||
"name": "patronum", | ||
"version": "1.8.3", | ||
"version": "1.8.4", | ||
"description": "☄️ Effector utility library delivering modularity and convenience", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("effector")):"function"==typeof define&&define.amd?define(["exports","effector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).patronum={},e.effector)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function o(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.and=function(...e){return(0,r.default.combine)({and:[e,e=>e.reduce(((e,t)=>Boolean(e)&&Boolean(t)))],or:{sid:"-rbm5ks"}})}})),i=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function({events:e,reset:t,target:o=(0,r.default.createEvent)({name:"target",sid:"3pez5"})}){r.default.is.unit(o)||n("target should be a unit");t&&!r.default.is.unit(t)&&n("reset should be a unit");return(0,r.default.withRegion)(o,(()=>{const n=Object.keys(e),a=Array.isArray(e)?[...n].fill(""):{},i=(0,r.default.createStore)(n.length,{name:"$counter",sid:"-dszn9a"}),u=(0,r.default.createStore)(a,{name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[o],or:{sid:"-8yzcn6"}})),u.reset(o),t&&(i.reset((0,r.default.sample)({and:[t],or:{sid:"-72suil"}})),u.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{name:"$isDone",sid:"ucs7nc"}).on(e[a],(()=>!0)).reset(o);t&&n.reset(t),i.on(n,(e=>e-1)),u.on(e[a],((e,t)=>{const n=Array.isArray(e)?[...e]:{...e};return n[a]=t,n}))}(0,r.default.guard)({and:[{source:(0,r.default.sample)({and:[u,(0,r.default.merge)(Object.values(e),{name:"and",sid:"-l8g4ey"})],or:{name:"source",sid:"uf92v9"}}),filter:i.map((e=>0===e)),target:o}],or:{sid:"ciekm0"}})})),o}})),u=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e)):t=>!e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.condition=function({if:e,then:t,else:o,source:a=(0,r.default.createEvent)({name:"source",sid:"epke23"})}){const i=r.default.is.unit(e)||(u=e,"function"==typeof u)?e:t=>t===e;var u;t&&o?(0,r.default.split)({and:[{source:a,match:{then:i,else:n(i)},cases:{then:t,else:o}}],or:{sid:"9tug3k"}}):t?(0,r.default.guard)({and:[{source:a,filter:i,target:t}],or:{sid:"abznoh"}}):o&&(0,r.default.guard)({and:[{source:a,filter:n(i),target:o}],or:{sid:"-eb29qp"}});return a}})),s=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function({source:e,timeout:t,target:n}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if(r.default.is.domain(e,{sid:"iu8yzo"}))throw new TypeError("source cannot be domain");if("number"!=typeof t||t<0||!Number.isFinite(t))throw new Error(`timeout must be positive number or zero. Received: "${t}"`);let o,a;const i=n??(0,r.default.createEvent)({name:"tick",sid:"-xw52dh"}),u=(0,r.default.createEffect)((e=>(clearTimeout(a),o&&o(),new Promise(((n,r)=>{o=r,a=setTimeout(n,t,e)})))),{name:"timerFx",sid:"m8kfsq"});return(0,r.default.forward)({and:{from:e,to:u},or:{sid:"k4foqk"}}),(0,r.default.forward)({and:{from:u.done.map((({result:e})=>e)),to:i},or:{sid:"k76npd"}}),i}})),d=o((function(e,t){function n(e){return r.default.is.store(e,{sid:"-j30z7b"})?"store":r.default.is.effect(e,{sid:"-j1dlf8"})?"effect":r.default.is.event(e,{sid:"-io6j6k"})?"event":r.default.is.domain(e,{sid:"-imj5eh"})?"domain":r.default.is.unit(e)?"unit":"unknown"}function o(e,t,n=""){const r=n+i(e);e.watch((e=>{console.info(`[${t}] ${r}`,e)}))}function a(e){o(e.done,"effect",i(e)+"."),o(e.fail,"effect",i(e)+".")}function i(e){return e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:""}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=function(...e){for(const t of e){const e=n(t);(r.default.is.store(t,{sid:"8mdztw"})||r.default.is.effect(t,{sid:"-gueih2"})||r.default.is.event(t,{sid:"-gueh0j"}))&&o(t,e),r.default.is.effect(t,{sid:"-jlpzbv"})&&a(t),r.default.is.domain(t,{sid:"-jjisyf"})&&(t.onCreateEvent((e=>o(e,"event"))),t.onCreateStore((e=>o(e,"store"))),t.onCreateEffect(a))}}})),f=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"-z2vw3w"})}){if(!r.default.is.unit(e))throw new TypeError("source must be a unit from effector");if(!r.default.is.unit(n))throw new TypeError("target must be a unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(t),a=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-584o7j"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:o}],or:{name:"source",sid:"9rbdjo"}}),clock:e,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:a}],or:{sid:"-wmj29s"}}),(0,r.default.forward)({and:{from:a.doneData,to:n},or:{sid:"-vsadmx"}}),n}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.either=function e(t,n,o){if(r.default.is.store(t,{sid:"n60kh0"}))return(0,r.default.combine)({and:[t,n,o,(e,t,n)=>e?t:n],or:{sid:"8ceklb"}});return e(t)}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.equals=function(e,t){return(0,r.default.combine)({and:[e,t,(e,t)=>e===t],or:{sid:"jvku5g"}})}})),m=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.every=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"sid3ut"})?a.map((e=>t=>e===t)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"h09uhg"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.every(e)],or:{sid:"hfkdw9"}})}})),p=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.format=function(e,...t){return(0,r.default.combine)({and:[t,t=>e.reduce(((n,r,o)=>n.concat(function(e,t){return t===e.length-1}(e,o)?r:`${r}${function(e){if(Array.isArray(e))return e.map((e=>String(e))).join(", ");return String(e)}(t[o])}`)),"")],or:{sid:"-yrbthp"}})}})),y=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function({effects:e,domain:t}){if(t){const e=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[e.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0)],or:{sid:"ubqxa7"}})}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.interval=function({timeout:e,start:t,stop:n,leading:o=!1,trailing:a=!1}){const i=(0,r.default.createEvent)({name:"tick",sid:"uo9p3s"}),u=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-wxesi8"}),s=function(e){if(r.default.is.store(e,{sid:"6p7767"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"5hw6se"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=u.map((e=>!e)),f=(0,r.default.createEvent)({name:"saveTimeout",sid:"as5clk"}),c=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-bh90bo"}).on(f,((e,t)=>t)),l=(0,r.default.createEvent)({name:"saveReject",sid:"-64swis"}),m=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"eabbu7"}).on(l,((e,t)=>t)),p=(0,r.default.createEffect)((e=>new Promise(((t,n)=>{const r=setTimeout(t,e);f(r),l(n)}))),{name:"timeoutFx",sid:"7lc3mj"}),y=(0,r.default.attach)({and:{source:[c,m],effect:([e,t])=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"pcn5jq"}});(0,r.default.guard)({and:[{clock:t,source:s,filter:d,target:p}],or:{sid:"-w5qmwp"}}),o&&(0,r.default.guard)({and:[{clock:t,filter:d,target:i}],or:{sid:"-vpslni"}});(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:u}],or:{sid:"-vaed34"}}),(0,r.default.guard)({and:[{clock:p.done,source:s,filter:u,target:p}],or:{sid:"-v73liy"}}),(0,r.default.sample)({and:[{clock:p.done,fn:()=>{},target:i}],or:{sid:"-urpcwu"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"-uanqf7"}}),u.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:y}],or:{sid:"6lcmyy"}}));return{tick:i,isRunning:u}}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.not=function(e){return e.map((e=>!e))}})),g=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=function(...e){return(0,r.default.combine)({and:[e,e=>e.reduce(((e,t)=>Boolean(e)||Boolean(t)))],or:{sid:"-44722k"}})}})),h=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function({effects:e,domain:t,of:o="some"}){if(!r.default.is.domain(t,{sid:"97b92c"})&&!e)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${o}"`);let a=e??[];const i=n[o];t&&(a=[],t.onCreateEffect((e=>a.push(e))));return(0,r.default.combine)({and:[a.map((e=>e.pending)),i],or:{sid:"a37bj0"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e];n.forEach((e=>{e.reset.call(e,r)}))}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=function({source:e,shape:t}){const n={};for(const r in t)if(r in t){const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}))}return n}})),_=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.snapshot=function({source:e,clock:t,fn:n=(e=>e)}){const o=n(e.defaultState),a=t?(0,r.default.sample)({and:[e,t,n],or:{name:"onSnapshot",sid:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auir6n"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),E=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.some=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"zbwu0l"})?a.map((e=>t=>e===t)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-lv5do0"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.some(e)],or:{sid:"-efc5w7"}})}})),k=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.splitMap=function({source:e,cases:t}){const n={};let o=r.default.is.store(e,{name:"current",sid:"-htjkz7"})?e.updates:e;for(const e in t)if(e in t){const r=t[e];n[e]=o.filterMap(r),o=o.filter({fn:e=>!r(e)})}return n.__=o,n}})),P=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function({targets:e,source:t=(0,r.default.createEvent)({name:"source",sid:"-iel8gi"})}){for(const n in e)if(n in e){const o=(0,r.default.guard)({and:[{source:t,filter:e=>"object"==typeof e&&null!==e&&n in e}],or:{name:"hasTargetKey",sid:"-gh83lo"}});r.default.is.store(e[n],{sid:"jliekw"})?e[n].on(o,((e,t)=>t[n])):(0,r.default.sample)({and:[{source:o,fn:e=>e[n],target:e[n]}],or:{sid:"lnzpe6"}})}return t}})),M=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function({effect:e,defaultValue:t="initial"}){const n=(0,r.default.createStore)(t,{name:"$status",sid:"abrgim"});return n.on(e,(()=>"pending")).on(e.done,(()=>"done")).on(e.fail,(()=>"fail")),n}})),O=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"cenyj5"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if("number"!=typeof t||t<0)throw new Error("timeout must be positive number or zero");const o=(0,r.default.createEffect)((()=>new Promise((e=>setTimeout(e,t)))),{name:"timerFx",sid:"uv7gwq"});return(0,r.default.guard)({and:[{source:e,filter:o.pending.map((e=>!e)),target:o}],or:{sid:"-iy4kn2"}}),(0,r.default.sample)({and:[{source:e,clock:o.done,target:n}],or:{sid:"-ija4mb"}}),n}})),$=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=t??n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),u=(0,r.default.restore)(i,o??a(),{name:"$time",sid:"-ys9vce"});return(0,r.default.forward)({and:{from:e,to:i},or:{sid:"rdje9v"}}),u};const n=()=>Date.now()})),T=a.and,A=i.combineEvents,S=u.condition,x=s.debounce,z=d.debug,q=f.delay,F=c.either,N=l.equals,B=m.every,C=p.format,R=y.inFlight,D=b.interval,I=v.not,K=g.or,V=h.pending,G=w.reset,H=j.reshape,J=_.snapshot,L=E.some,Q=k.splitMap,U=P.spread,W=M.status,X=O.throttle,Y=$.time,Z={and:T,combineEvents:A,condition:S,debounce:x,debug:z,delay:q,either:F,equals:N,every:B,format:C,inFlight:R,interval:D,not:I,or:K,pending:V,reset:G,reshape:H,snapshot:J,some:L,splitMap:Q,spread:U,status:W,throttle:X,time:Y};e.and=T,e.combineEvents=A,e.condition=S,e.debounce=x,e.debug=z,e.default=Z,e.delay=q,e.either=F,e.equals=N,e.every=B,e.format=C,e.inFlight=R,e.interval=D,e.not=I,e.or=K,e.pending=V,e.reset=G,e.reshape=H,e.snapshot=J,e.some=L,e.splitMap=Q,e.spread=U,e.status=W,e.throttle=X,e.time=Y,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("effector")):"function"==typeof define&&define.amd?define(["exports","effector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).patronum={},e.effector)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function o(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.and=function(...e){return(0,r.default.combine)({and:[e,e=>e.reduce(((e,t)=>Boolean(e)&&Boolean(t)))],or:{sid:"-rbm5ks"}})}})),i=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function({events:e,reset:t,target:o=(0,r.default.createEvent)({name:"target",sid:"3pez5"})}){r.default.is.unit(o)||n("target should be a unit");t&&!r.default.is.unit(t)&&n("reset should be a unit");return(0,r.default.withRegion)(o,(()=>{const n=Object.keys(e),a=Array.isArray(e)?[...n].fill(""):{},i=(0,r.default.createStore)(n.length,{name:"$counter",sid:"-dszn9a"}),u=(0,r.default.createStore)(a,{name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[o],or:{sid:"-8yzcn6"}})),u.reset(o),t&&(i.reset((0,r.default.sample)({and:[t],or:{sid:"-72suil"}})),u.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{name:"$isDone",sid:"ucs7nc"}).on(e[a],(()=>!0)).reset(o);t&&n.reset(t),i.on(n,(e=>e-1)),u.on(e[a],((e,t)=>{const n=Array.isArray(e)?[...e]:{...e};return n[a]=t,n}))}(0,r.default.guard)({and:[{source:(0,r.default.sample)({and:[u,(0,r.default.merge)(Object.values(e),{name:"and",sid:"-l8g4ey"})],or:{name:"source",sid:"uf92v9"}}),filter:i.map((e=>0===e)),target:o}],or:{sid:"ciekm0"}})})),o}})),u=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e)):t=>!e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.condition=function({if:e,then:t,else:o,source:a=(0,r.default.createEvent)({name:"source",sid:"epke23"})}){const i=r.default.is.unit(e)||(u=e,"function"==typeof u)?e:t=>t===e;var u;t&&o?(0,r.default.split)({and:[{source:a,match:{then:i,else:n(i)},cases:{then:t,else:o}}],or:{sid:"9tug3k"}}):t?(0,r.default.guard)({and:[{source:a,filter:i,target:t}],or:{sid:"abznoh"}}):o&&(0,r.default.guard)({and:[{source:a,filter:n(i),target:o}],or:{sid:"-eb29qp"}});return a}})),s=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function({source:e,timeout:t,target:n}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if(r.default.is.domain(e,{sid:"iu8yzo"}))throw new TypeError("source cannot be domain");if("number"!=typeof t||t<0||!Number.isFinite(t))throw new Error(`timeout must be positive number or zero. Received: "${t}"`);let o,a;const i=null!=n?n:(0,r.default.createEvent)({name:"tick",sid:"-xw52dh"}),u=(0,r.default.createEffect)((e=>(clearTimeout(a),o&&o(),new Promise(((n,r)=>{o=r,a=setTimeout(n,t,e)})))),{name:"timerFx",sid:"m8kfsq"});return(0,r.default.forward)({and:{from:e,to:u},or:{sid:"k4foqk"}}),(0,r.default.forward)({and:{from:u.done.map((({result:e})=>e)),to:i},or:{sid:"k76npd"}}),i}})),d=o((function(e,t){function n(e){return r.default.is.store(e,{sid:"-j30z7b"})?"store":r.default.is.effect(e,{sid:"-j1dlf8"})?"effect":r.default.is.event(e,{sid:"-io6j6k"})?"event":r.default.is.domain(e,{sid:"-imj5eh"})?"domain":r.default.is.unit(e)?"unit":"unknown"}function o(e,t,n=""){const r=n+i(e);e.watch((e=>{console.info(`[${t}] ${r}`,e)}))}function a(e){o(e.done,"effect",i(e)+"."),o(e.fail,"effect",i(e)+".")}function i(e){return e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:""}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=function(...e){for(const t of e){const e=n(t);(r.default.is.store(t,{sid:"8mdztw"})||r.default.is.effect(t,{sid:"-gueih2"})||r.default.is.event(t,{sid:"-gueh0j"}))&&o(t,e),r.default.is.effect(t,{sid:"-jlpzbv"})&&a(t),r.default.is.domain(t,{sid:"-jjisyf"})&&(t.onCreateEvent((e=>o(e,"event"))),t.onCreateStore((e=>o(e,"store"))),t.onCreateEffect(a))}}})),f=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"-z2vw3w"})}){if(!r.default.is.unit(e))throw new TypeError("source must be a unit from effector");if(!r.default.is.unit(n))throw new TypeError("target must be a unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(t),a=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-584o7j"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:o}],or:{name:"source",sid:"9rbdjo"}}),clock:e,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:a}],or:{sid:"-wmj29s"}}),(0,r.default.forward)({and:{from:a.doneData,to:n},or:{sid:"-vsadmx"}}),n}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.either=function e(t,n,o){if(r.default.is.store(t,{sid:"n60kh0"}))return(0,r.default.combine)({and:[t,n,o,(e,t,n)=>e?t:n],or:{sid:"8ceklb"}});return e(t)}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.equals=function(e,t){return(0,r.default.combine)({and:[e,t,(e,t)=>e===t],or:{sid:"jvku5g"}})}})),m=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.every=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"sid3ut"})?a.map((e=>t=>e===t)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"h09uhg"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.every(e)],or:{sid:"hfkdw9"}})}})),p=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.format=function(e,...t){return(0,r.default.combine)({and:[t,t=>e.reduce(((n,r,o)=>n.concat(function(e,t){return t===e.length-1}(e,o)?r:`${r}${function(e){if(Array.isArray(e))return e.map((e=>String(e))).join(", ");return String(e)}(t[o])}`)),"")],or:{sid:"-yrbthp"}})}})),y=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function({effects:e,domain:t}){if(t){const e=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[e.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0)],or:{sid:"ubqxa7"}})}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.interval=function({timeout:e,start:t,stop:n,leading:o=!1,trailing:a=!1}){const i=(0,r.default.createEvent)({name:"tick",sid:"uo9p3s"}),u=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-wxesi8"}),s=function(e){if(r.default.is.store(e,{sid:"6p7767"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"5hw6se"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=u.map((e=>!e)),f=(0,r.default.createEvent)({name:"saveTimeout",sid:"as5clk"}),c=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-bh90bo"}).on(f,((e,t)=>t)),l=(0,r.default.createEvent)({name:"saveReject",sid:"-64swis"}),m=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"eabbu7"}).on(l,((e,t)=>t)),p=(0,r.default.createEffect)((e=>new Promise(((t,n)=>{const r=setTimeout(t,e);f(r),l(n)}))),{name:"timeoutFx",sid:"7lc3mj"}),y=(0,r.default.attach)({and:{source:[c,m],effect:([e,t])=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"pcn5jq"}});(0,r.default.guard)({and:[{clock:t,source:s,filter:d,target:p}],or:{sid:"-w5qmwp"}}),o&&(0,r.default.guard)({and:[{clock:t,filter:d,target:i}],or:{sid:"-vpslni"}});(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:u}],or:{sid:"-vaed34"}}),(0,r.default.guard)({and:[{clock:p.done,source:s,filter:u,target:p}],or:{sid:"-v73liy"}}),(0,r.default.sample)({and:[{clock:p.done,fn:()=>{},target:i}],or:{sid:"-urpcwu"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"-uanqf7"}}),u.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:y}],or:{sid:"6lcmyy"}}));return{tick:i,isRunning:u}}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.not=function(e){return e.map((e=>!e))}})),g=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=function(...e){return(0,r.default.combine)({and:[e,e=>e.reduce(((e,t)=>Boolean(e)||Boolean(t)))],or:{sid:"-44722k"}})}})),h=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function({effects:e,domain:t,of:o="some"}){if(!r.default.is.domain(t,{sid:"97b92c"})&&!e)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${o}"`);let a=null!=e?e:[];const i=n[o];t&&(a=[],t.onCreateEffect((e=>a.push(e))));return(0,r.default.combine)({and:[a.map((e=>e.pending)),i],or:{sid:"a37bj0"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e];n.forEach((e=>{e.reset.call(e,r)}))}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=function({source:e,shape:t}){const n={};for(const r in t)if(r in t){const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}))}return n}})),_=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.snapshot=function({source:e,clock:t,fn:n=(e=>e)}){const o=n(e.defaultState),a=t?(0,r.default.sample)({and:[e,t,n],or:{name:"onSnapshot",sid:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auir6n"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),E=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.some=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"zbwu0l"})?a.map((e=>t=>e===t)):e=>e===a;var i;const u=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-lv5do0"}}),s=n;return(0,r.default.combine)({and:[s,u,(e,t)=>t.some(e)],or:{sid:"-efc5w7"}})}})),k=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.splitMap=function({source:e,cases:t}){const n={};let o=r.default.is.store(e,{name:"current",sid:"-htjkz7"})?e.updates:e;for(const e in t)if(e in t){const r=t[e];n[e]=o.filterMap(r),o=o.filter({fn:e=>!r(e)})}return n.__=o,n}})),P=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function({targets:e,source:t=(0,r.default.createEvent)({name:"source",sid:"-iel8gi"})}){for(const n in e)if(n in e){const o=(0,r.default.guard)({and:[{source:t,filter:e=>"object"==typeof e&&null!==e&&n in e}],or:{name:"hasTargetKey",sid:"-gh83lo"}});r.default.is.store(e[n],{sid:"jliekw"})?e[n].on(o,((e,t)=>t[n])):(0,r.default.sample)({and:[{source:o,fn:e=>e[n],target:e[n]}],or:{sid:"lnzpe6"}})}return t}})),M=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function({effect:e,defaultValue:t="initial"}){const n=(0,r.default.createStore)(t,{name:"$status",sid:"abrgim"});return n.on(e,(()=>"pending")).on(e.done,(()=>"done")).on(e.fail,(()=>"fail")),n}})),O=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"cenyj5"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if("number"!=typeof t||t<0)throw new Error("timeout must be positive number or zero");const o=(0,r.default.createEffect)((()=>new Promise((e=>setTimeout(e,t)))),{name:"timerFx",sid:"uv7gwq"});return(0,r.default.guard)({and:[{source:e,filter:o.pending.map((e=>!e)),target:o}],or:{sid:"-iy4kn2"}}),(0,r.default.sample)({and:[{source:e,clock:o.done,target:n}],or:{sid:"-ija4mb"}}),n}})),$=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=null!=t?t:n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),u=(0,r.default.restore)(i,null!=o?o:a(),{name:"$time",sid:"-ys9vce"});return(0,r.default.forward)({and:{from:e,to:i},or:{sid:"rdje9v"}}),u};const n=()=>Date.now()})),T=a.and,A=i.combineEvents,S=u.condition,x=s.debounce,z=d.debug,q=f.delay,F=c.either,N=l.equals,B=m.every,C=p.format,R=y.inFlight,D=b.interval,I=v.not,K=g.or,V=h.pending,G=w.reset,H=j.reshape,J=_.snapshot,L=E.some,Q=k.splitMap,U=P.spread,W=M.status,X=O.throttle,Y=$.time,Z={and:T,combineEvents:A,condition:S,debounce:x,debug:z,delay:q,either:F,equals:N,every:B,format:C,inFlight:R,interval:D,not:I,or:K,pending:V,reset:G,reshape:H,snapshot:J,some:L,splitMap:Q,spread:U,status:W,throttle:X,time:Y};e.and=T,e.combineEvents=A,e.condition=S,e.debounce=x,e.debug=z,e.default=Z,e.delay=q,e.either=F,e.equals=N,e.every=B,e.format=C,e.inFlight=R,e.interval=D,e.not=I,e.or=K,e.pending=V,e.reset=G,e.reshape=H,e.snapshot=J,e.some=L,e.splitMap=Q,e.spread=U,e.status=W,e.throttle=X,e.time=Y,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=patronum.umd.js.map |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
265177