effector-react
Advanced tools
Comparing version 0.18.4 to 0.18.5
@@ -1,2 +0,2 @@ | ||
function t(t){var e,r;return r=e=class extends n.Component{constructor(){super(...arguments),this.state={currentState:t.getState()},this._unsubscribe=null,this._hasUnmounted=0}componentDidMount(){this.subscribe()}componentWillUnmount(){this.unsubscribe(),this._hasUnmounted=1}render(){return this.props.children(this.state.currentState)}subscribe(){const e=t.subscribe(t=>{this._hasUnmounted||this.setState(e=>t===e.currentState?null:{currentState:t})});this._unsubscribe=e}unsubscribe(){'function'==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},e.displayName=`${t.shortName}.Consumer`,r}function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function r(r,s){const o=t(r),c=t=>n.createElement(o,null,r=>n.createElement(s,e({},t,r)));return c.displayName=`Connect(${s.displayName||s.name||'Unknown'})`,c}Object.defineProperty(exports,'__esModule',{value:1});var n=require('react'),effector=require('effector');const s=effector.createDomain('Gate').store;exports.createStoreConsumer=t,exports.unstable_createStoreProvider=function(t){var e,r;return r=e=class extends n.Component{constructor(){super(...arguments),this.state={currentValue:null}}static getDerivedStateFromProps(e){return t.setState(e.value),{currentValue:e.value}}render(){return this.props.children}},e.displayName=`${t.shortName}.Provider`,e.defaultProps={children:null},r},exports.createContextComponent=function(e,r,s){var o,c;const u=t(e);return c=o=class extends n.Component{constructor(){super(...arguments),this.renderProp=(t=>s(this.props,t,this.context))}render(){return n.createElement(u,null,this.renderProp)}},o.contextType=r,c},exports.createComponent=function(e,r){const s=t(e);return class extends n.Component{constructor(){super(...arguments),this.renderProp=(t=>r(this.props,t))}render(){return n.createElement(s,null,this.renderProp)}}},exports.useStore=function(t){const e=n.useState(t.getState),r=e[0],s=e[1];return n.useEffect(()=>t.watch(s),[t]),r},exports.connect=function(t){return e=>r(e,t)},exports.createReactState=r,exports.createGate=function t(e,r){void 0===e&&(e='gate'),void 0===r&&(r={});const o=s(0),c=s(r),u=effector.createApi(c,{set:(t,e)=>e}).set,a=effector.createApi(o,{open:()=>d.predicate()&&1,close:()=>0,destructor:()=>0}),i=a.open,p=a.close,l=a.destructor;class d extends n.PureComponent{static childGate(r){void 0===r&&(r='Subgate');const n=t(`${e}/${r}`);n.predicate=(()=>d.status.getState());let s=0,o=0;return n.open.watch(()=>{o||(s=1)}),n.close.watch(()=>{o||(s=0)}),d.status.watch(t=>{o=1,s&&t&&!n.status.getState()&&n.open(),o=0}),d.close.watch(()=>{o=1,n.close(),o=0}),d.destructor.watch(()=>n.destructor()),n}componentDidMount(){d.open()}componentWillUnmount(){d.close()}render(){return d.set(this.props),null}}d.predicate=(()=>1),d.displayName=`Gate:${e}`,d.isOpen=0,d.current=c.getState(),d.open=i,d.close=p,d.status=o,d.state=c,d.set=u,d.destructor=l,d.isTerminated=0;const h=o.watch(t=>d.isOpen=t),m=c.watch(t=>d.current=t);o.map(t=>{t||(d.current=r)}),c.reset(p);const f=l.watch(()=>{d.isTerminated=1}),b=l.watch(()=>{b(),h(),m(),f(),(()=>{d.status.off(d.open),d.status.off(d.close),d.status.off(d.destructor)})(),d.state.off(d.set)});return d}; | ||
function t(t){var e,r;return r=e=class extends n.Component{constructor(){super(...arguments),this.state={currentState:t.getState()},this._unsubscribe=null,this._hasUnmounted=0}componentDidMount(){this.subscribe()}componentWillUnmount(){this.unsubscribe(),this._hasUnmounted=1}render(){return this.props.children(this.state.currentState)}subscribe(){const e=t.subscribe(t=>{this._hasUnmounted||this.setState(e=>t===e.currentState?null:{currentState:t})});this._unsubscribe=e}unsubscribe(){'function'==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},e.displayName=`${t.shortName}.Consumer`,r}function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function r(r,s){const o=t(r),c=t=>n.createElement(o,null,r=>n.createElement(s,e({},t,r)));return c.displayName=`Connect(${s.displayName||s.name||'Unknown'})`,c}Object.defineProperty(exports,'__esModule',{value:1});var n=require('react'),effector=require('effector');const s=effector.createDomain('Gate').store;exports.createStoreConsumer=t,exports.unstable_createStoreProvider=function(t){var e,r;return r=e=class extends n.Component{constructor(){super(...arguments),this.state={currentValue:null}}static getDerivedStateFromProps(e){return t.setState(e.value),{currentValue:e.value}}render(){return this.props.children}},e.displayName=`${t.shortName}.Provider`,e.defaultProps={children:null},r},exports.createContextComponent=function(e,r,s){var o,c;const u=t(e);return c=o=class extends n.Component{constructor(){super(...arguments),this.renderProp=(t=>s(this.props,t,this.context))}render(){return n.createElement(u,null,this.renderProp)}},o.contextType=r,c},exports.createComponent=function(e,r){const s=t(e);return class extends n.Component{constructor(){super(...arguments),this.renderProp=(t=>r(this.props,t))}render(){return n.createElement(s,null,this.renderProp)}}},exports.useStore=function(t){const e=n.useState(t.getState),r=e[0],s=e[1];return n.useEffect(()=>t.watch(t=>s(()=>t)),[t]),r},exports.connect=function(t){return e=>r(e,t)},exports.createReactState=r,exports.createGate=function t(e,r){void 0===e&&(e='gate'),void 0===r&&(r={});const o=s(0),c=s(r),u=effector.createApi(c,{set:(t,e)=>e}).set,a=effector.createApi(o,{open:()=>d.predicate()&&1,close:()=>0,destructor:()=>0}),i=a.open,p=a.close,l=a.destructor;class d extends n.PureComponent{static childGate(r){void 0===r&&(r='Subgate');const n=t(`${e}/${r}`);n.predicate=(()=>d.status.getState());let s=0,o=0;return n.open.watch(()=>{o||(s=1)}),n.close.watch(()=>{o||(s=0)}),d.status.watch(t=>{o=1,s&&t&&!n.status.getState()&&n.open(),o=0}),d.close.watch(()=>{o=1,n.close(),o=0}),d.destructor.watch(()=>n.destructor()),n}componentDidMount(){d.open()}componentWillUnmount(){d.close()}render(){return d.set(this.props),null}}d.predicate=(()=>1),d.displayName=`Gate:${e}`,d.isOpen=0,d.current=c.getState(),d.open=i,d.close=p,d.status=o,d.state=c,d.set=u,d.destructor=l,d.isTerminated=0;const h=o.watch(t=>d.isOpen=t),m=c.watch(t=>d.current=t);o.map(t=>{t||(d.current=r)}),c.reset(p);const f=l.watch(()=>{d.isTerminated=1}),b=l.watch(()=>{b(),h(),m(),f(),(()=>{d.status.off(d.open),d.status.off(d.close),d.status.off(d.destructor)})(),d.state.off(d.set)});return d}; | ||
//# sourceMappingURL=effector-react.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
function t(t){var e,r;return r=e=class extends i{constructor(){super(...arguments),this.state={currentState:t.getState()},this._unsubscribe=null,this._hasUnmounted=0}componentDidMount(){this.subscribe()}componentWillUnmount(){this.unsubscribe(),this._hasUnmounted=1}render(){return this.props.children(this.state.currentState)}subscribe(){const e=t.subscribe(t=>{this._hasUnmounted||this.setState(e=>t===e.currentState?null:{currentState:t})});this._unsubscribe=e}unsubscribe(){'function'==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},e.displayName=`${t.shortName}.Consumer`,r}function e(t){var e,r;return r=e=class extends i{constructor(){super(...arguments),this.state={currentValue:null}}static getDerivedStateFromProps(e){return t.setState(e.value),{currentValue:e.value}}render(){return this.props.children}},e.displayName=`${t.shortName}.Provider`,e.defaultProps={children:null},r}function r(e,r,s){var n,o;const c=t(e);return o=n=class extends i{constructor(){super(...arguments),this.renderProp=(t=>s(this.props,t,this.context))}render(){return l(c,null,this.renderProp)}},n.contextType=r,o}function s(e,r){const s=t(e);return class extends i{constructor(){super(...arguments),this.renderProp=(t=>r(this.props,t))}render(){return l(s,null,this.renderProp)}}}function n(t){const e=p(t.getState),r=e[0],s=e[1];return h(()=>t.watch(s),[t]),r}function o(){return(o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t}).apply(this,arguments)}function c(e,r){const s=t(e),n=t=>l(s,null,e=>l(r,o({},t,e)));return n.displayName=`Connect(${r.displayName||r.name||'Unknown'})`,n}function u(t){return e=>c(e,t)}function a(t,e){void 0===t&&(t='gate'),void 0===e&&(e={});const r=b(0),s=b(e),n=m(s,{set:(t,e)=>e}).set,o=m(r,{open:()=>l.predicate()&&1,close:()=>0,destructor:()=>0}),c=o.open,u=o.close,i=o.destructor;class l extends d{static childGate(e){void 0===e&&(e='Subgate');const r=a(`${t}/${e}`);r.predicate=(()=>l.status.getState());let s=0,n=0;return r.open.watch(()=>{n||(s=1)}),r.close.watch(()=>{n||(s=0)}),l.status.watch(t=>{n=1,s&&t&&!r.status.getState()&&r.open(),n=0}),l.close.watch(()=>{n=1,r.close(),n=0}),l.destructor.watch(()=>r.destructor()),r}componentDidMount(){l.open()}componentWillUnmount(){l.close()}render(){return l.set(this.props),null}}l.predicate=(()=>1),l.displayName=`Gate:${t}`,l.isOpen=0,l.current=s.getState(),l.open=c,l.close=u,l.status=r,l.state=s,l.set=n,l.destructor=i,l.isTerminated=0;const p=r.watch(t=>l.isOpen=t),h=s.watch(t=>l.current=t);r.map(t=>{t||(l.current=e)}),s.reset(u);const f=i.watch(()=>{l.isTerminated=1}),v=i.watch(()=>{v(),p(),h(),f(),(()=>{l.status.off(l.open),l.status.off(l.close),l.status.off(l.destructor)})(),l.state.off(l.set)});return l}import{Component as i,createElement as l,useState as p,useEffect as h,PureComponent as d}from'react';import{createDomain as f,createApi as m}from'effector';const b=f('Gate').store;export{t as createStoreConsumer,e as unstable_createStoreProvider,r as createContextComponent,s as createComponent,n as useStore,u as connect,c as createReactState,a as createGate}; | ||
function t(t){var e,r;return r=e=class extends i{constructor(){super(...arguments),this.state={currentState:t.getState()},this._unsubscribe=null,this._hasUnmounted=0}componentDidMount(){this.subscribe()}componentWillUnmount(){this.unsubscribe(),this._hasUnmounted=1}render(){return this.props.children(this.state.currentState)}subscribe(){const e=t.subscribe(t=>{this._hasUnmounted||this.setState(e=>t===e.currentState?null:{currentState:t})});this._unsubscribe=e}unsubscribe(){'function'==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},e.displayName=`${t.shortName}.Consumer`,r}function e(t){var e,r;return r=e=class extends i{constructor(){super(...arguments),this.state={currentValue:null}}static getDerivedStateFromProps(e){return t.setState(e.value),{currentValue:e.value}}render(){return this.props.children}},e.displayName=`${t.shortName}.Provider`,e.defaultProps={children:null},r}function r(e,r,s){var n,o;const c=t(e);return o=n=class extends i{constructor(){super(...arguments),this.renderProp=(t=>s(this.props,t,this.context))}render(){return l(c,null,this.renderProp)}},n.contextType=r,o}function s(e,r){const s=t(e);return class extends i{constructor(){super(...arguments),this.renderProp=(t=>r(this.props,t))}render(){return l(s,null,this.renderProp)}}}function n(t){const e=p(t.getState),r=e[0],s=e[1];return h(()=>t.watch(t=>s(()=>t)),[t]),r}function o(){return(o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t}).apply(this,arguments)}function c(e,r){const s=t(e),n=t=>l(s,null,e=>l(r,o({},t,e)));return n.displayName=`Connect(${r.displayName||r.name||'Unknown'})`,n}function u(t){return e=>c(e,t)}function a(t,e){void 0===t&&(t='gate'),void 0===e&&(e={});const r=b(0),s=b(e),n=m(s,{set:(t,e)=>e}).set,o=m(r,{open:()=>l.predicate()&&1,close:()=>0,destructor:()=>0}),c=o.open,u=o.close,i=o.destructor;class l extends d{static childGate(e){void 0===e&&(e='Subgate');const r=a(`${t}/${e}`);r.predicate=(()=>l.status.getState());let s=0,n=0;return r.open.watch(()=>{n||(s=1)}),r.close.watch(()=>{n||(s=0)}),l.status.watch(t=>{n=1,s&&t&&!r.status.getState()&&r.open(),n=0}),l.close.watch(()=>{n=1,r.close(),n=0}),l.destructor.watch(()=>r.destructor()),r}componentDidMount(){l.open()}componentWillUnmount(){l.close()}render(){return l.set(this.props),null}}l.predicate=(()=>1),l.displayName=`Gate:${t}`,l.isOpen=0,l.current=s.getState(),l.open=c,l.close=u,l.status=r,l.state=s,l.set=n,l.destructor=i,l.isTerminated=0;const p=r.watch(t=>l.isOpen=t),h=s.watch(t=>l.current=t);r.map(t=>{t||(l.current=e)}),s.reset(u);const f=i.watch(()=>{l.isTerminated=1}),v=i.watch(()=>{v(),p(),h(),f(),(()=>{l.status.off(l.open),l.status.off(l.close),l.status.off(l.destructor)})(),l.state.off(l.set)});return l}import{Component as i,createElement as l,useState as p,useEffect as h,PureComponent as d}from'react';import{createDomain as f,createApi as m}from'effector';const b=f('Gate').store;export{t as createStoreConsumer,e as unstable_createStoreProvider,r as createContextComponent,s as createComponent,n as useStore,u as connect,c as createReactState,a as createGate}; | ||
//# sourceMappingURL=effector-react.es.js.map |
@@ -1,2 +0,2 @@ | ||
(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?t(exports,require('react'),require('effector')):'function'==typeof define&&define.amd?define(['exports','react','effector'],t):t((e=e||self).effectorReact={},e.React,e.effector)})(this,function(e,t,effector){function r(e){var r,n;return n=r=class extends t.Component{constructor(){super(...arguments),this.state={currentState:e.getState()},this._unsubscribe=null,this._hasUnmounted=0}componentDidMount(){this.subscribe()}componentWillUnmount(){this.unsubscribe(),this._hasUnmounted=1}render(){return this.props.children(this.state.currentState)}subscribe(){const t=e.subscribe(e=>{this._hasUnmounted||this.setState(t=>e===t.currentState?null:{currentState:e})});this._unsubscribe=t}unsubscribe(){'function'==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},r.displayName=`${e.shortName}.Consumer`,n}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function s(e,s){const o=r(e),c=e=>t.createElement(o,null,r=>t.createElement(s,n({},e,r)));return c.displayName=`Connect(${s.displayName||s.name||'Unknown'})`,c}const o=effector.createDomain('Gate').store;e.createStoreConsumer=r,e.unstable_createStoreProvider=function(e){var r,n;return n=r=class extends t.Component{constructor(){super(...arguments),this.state={currentValue:null}}static getDerivedStateFromProps(t){return e.setState(t.value),{currentValue:t.value}}render(){return this.props.children}},r.displayName=`${e.shortName}.Provider`,r.defaultProps={children:null},n},e.createContextComponent=function(e,n,s){var o,c;const u=r(e);return c=o=class extends t.Component{constructor(){super(...arguments),this.renderProp=(e=>s(this.props,e,this.context))}render(){return t.createElement(u,null,this.renderProp)}},o.contextType=n,c},e.createComponent=function(e,n){const s=r(e);return class extends t.Component{constructor(){super(...arguments),this.renderProp=(e=>n(this.props,e))}render(){return t.createElement(s,null,this.renderProp)}}},e.useStore=function(e){const r=t.useState(e.getState),n=r[0],s=r[1];return t.useEffect(()=>e.watch(s),[e]),n},e.connect=function(e){return t=>s(t,e)},e.createReactState=s,e.createGate=function e(r,n){void 0===r&&(r='gate'),void 0===n&&(n={});const s=o(0),c=o(n),u=effector.createApi(c,{set:(e,t)=>t}).set,a=effector.createApi(s,{open:()=>d.predicate()&&1,close:()=>0,destructor:()=>0}),i=a.open,p=a.close,l=a.destructor;class d extends t.PureComponent{static childGate(t){void 0===t&&(t='Subgate');const n=e(`${r}/${t}`);n.predicate=(()=>d.status.getState());let s=0,o=0;return n.open.watch(()=>{o||(s=1)}),n.close.watch(()=>{o||(s=0)}),d.status.watch(e=>{o=1,s&&e&&!n.status.getState()&&n.open(),o=0}),d.close.watch(()=>{o=1,n.close(),o=0}),d.destructor.watch(()=>n.destructor()),n}componentDidMount(){d.open()}componentWillUnmount(){d.close()}render(){return d.set(this.props),null}}d.predicate=(()=>1),d.displayName=`Gate:${r}`,d.isOpen=0,d.current=c.getState(),d.open=i,d.close=p,d.status=s,d.state=c,d.set=u,d.destructor=l,d.isTerminated=0;const h=s.watch(e=>d.isOpen=e),f=c.watch(e=>d.current=e);s.map(e=>{e||(d.current=n)}),c.reset(p);const m=l.watch(()=>{d.isTerminated=1}),b=l.watch(()=>{b(),h(),f(),m(),(()=>{d.status.off(d.open),d.status.off(d.close),d.status.off(d.destructor)})(),d.state.off(d.set)});return d},Object.defineProperty(e,'__esModule',{value:1})}); | ||
(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?t(exports,require('react'),require('effector')):'function'==typeof define&&define.amd?define(['exports','react','effector'],t):t((e=e||self).effectorReact={},e.React,e.effector)})(this,function(e,t,effector){function r(e){var r,n;return n=r=class extends t.Component{constructor(){super(...arguments),this.state={currentState:e.getState()},this._unsubscribe=null,this._hasUnmounted=0}componentDidMount(){this.subscribe()}componentWillUnmount(){this.unsubscribe(),this._hasUnmounted=1}render(){return this.props.children(this.state.currentState)}subscribe(){const t=e.subscribe(e=>{this._hasUnmounted||this.setState(t=>e===t.currentState?null:{currentState:e})});this._unsubscribe=t}unsubscribe(){'function'==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},r.displayName=`${e.shortName}.Consumer`,n}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function s(e,s){const o=r(e),c=e=>t.createElement(o,null,r=>t.createElement(s,n({},e,r)));return c.displayName=`Connect(${s.displayName||s.name||'Unknown'})`,c}const o=effector.createDomain('Gate').store;e.createStoreConsumer=r,e.unstable_createStoreProvider=function(e){var r,n;return n=r=class extends t.Component{constructor(){super(...arguments),this.state={currentValue:null}}static getDerivedStateFromProps(t){return e.setState(t.value),{currentValue:t.value}}render(){return this.props.children}},r.displayName=`${e.shortName}.Provider`,r.defaultProps={children:null},n},e.createContextComponent=function(e,n,s){var o,c;const u=r(e);return c=o=class extends t.Component{constructor(){super(...arguments),this.renderProp=(e=>s(this.props,e,this.context))}render(){return t.createElement(u,null,this.renderProp)}},o.contextType=n,c},e.createComponent=function(e,n){const s=r(e);return class extends t.Component{constructor(){super(...arguments),this.renderProp=(e=>n(this.props,e))}render(){return t.createElement(s,null,this.renderProp)}}},e.useStore=function(e){const r=t.useState(e.getState),n=r[0],s=r[1];return t.useEffect(()=>e.watch(e=>s(()=>e)),[e]),n},e.connect=function(e){return t=>s(t,e)},e.createReactState=s,e.createGate=function e(r,n){void 0===r&&(r='gate'),void 0===n&&(n={});const s=o(0),c=o(n),u=effector.createApi(c,{set:(e,t)=>t}).set,a=effector.createApi(s,{open:()=>d.predicate()&&1,close:()=>0,destructor:()=>0}),i=a.open,p=a.close,l=a.destructor;class d extends t.PureComponent{static childGate(t){void 0===t&&(t='Subgate');const n=e(`${r}/${t}`);n.predicate=(()=>d.status.getState());let s=0,o=0;return n.open.watch(()=>{o||(s=1)}),n.close.watch(()=>{o||(s=0)}),d.status.watch(e=>{o=1,s&&e&&!n.status.getState()&&n.open(),o=0}),d.close.watch(()=>{o=1,n.close(),o=0}),d.destructor.watch(()=>n.destructor()),n}componentDidMount(){d.open()}componentWillUnmount(){d.close()}render(){return d.set(this.props),null}}d.predicate=(()=>1),d.displayName=`Gate:${r}`,d.isOpen=0,d.current=c.getState(),d.open=i,d.close=p,d.status=s,d.state=c,d.set=u,d.destructor=l,d.isTerminated=0;const h=s.watch(e=>d.isOpen=e),f=c.watch(e=>d.current=e);s.map(e=>{e||(d.current=n)}),c.reset(p);const m=l.watch(()=>{d.isTerminated=1}),b=l.watch(()=>{b(),h(),f(),m(),(()=>{d.status.off(d.open),d.status.off(d.close),d.status.off(d.destructor)})(),d.state.off(d.set)});return d},Object.defineProperty(e,'__esModule',{value:1})}); | ||
//# sourceMappingURL=effector-react.umd.js.map |
{ | ||
"name": "effector-react", | ||
"version": "0.18.4", | ||
"version": "0.18.5", | ||
"description": "React bindings for effector", | ||
@@ -5,0 +5,0 @@ "main": "effector-react.cjs.js", |
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
58742