effector-react
Advanced tools
Comparing version 0.18.1 to 0.18.2
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),effector=require("effector");function e(e){var r,n;return n=r=class extends t.Component{constructor(){super(...arguments),this.state={currentState:e.getState()},this._unsubscribe=null,this._hasUnmounted=!1}componentDidMount(){this.subscribe()}componentWillUnmount(){this.unsubscribe(),this._hasUnmounted=!0}render(){return this.props.children(this.state.currentState)}subscribe(){const t=e.subscribe(t=>{this._hasUnmounted||this.setState(e=>t===e.currentState?null:{currentState:t})});this._unsubscribe=t}unsubscribe(){"function"==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},r.displayName=`${e.shortName}.Consumer`,n}function r(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}function n(r,n,s){var o,c;const u=e(r);return c=o=class extends t.Component{constructor(){super(...arguments),this.renderProp=(t=>s(this.props,t,this.context))}render(){return t.createElement(u,null,this.renderProp)}},o.contextType=n,c}function s(r,n){const s=e(r);return class extends t.Component{constructor(){super(...arguments),this.renderProp=(t=>n(this.props,t))}render(){return t.createElement(s,null,this.renderProp)}}}function o(){return(o=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 c(r,n){const s=e(r),c=e=>t.createElement(s,null,r=>t.createElement(n,o({},e,r)));return c.displayName=`Connect(${n.displayName||n.name||"Unknown"})`,c}function u(t){return e=>c(e,t)}const a=effector.createDomain("Gate"),i=a.store;function p(e,r){void 0===e&&(e="gate"),void 0===r&&(r={});const n=i(!1),s=i(r),o=effector.createApi(s,{set:(t,e)=>e}).set,c=effector.createApi(n,{open:()=>d.predicate()&&!0,close:()=>!1,destructor:()=>!1}),u=c.open,a=c.close,l=c.destructor;class d extends t.PureComponent{static childGate(t){void 0===t&&(t="Subgate");const r=p(`${e}/${t}`);r.predicate=(()=>d.status.getState());let n=!1,s=!1;return r.open.watch(()=>{s||(n=!0)}),r.close.watch(()=>{s||(n=!1)}),d.status.watch(t=>{s=!0,n&&t&&!r.status.getState()&&r.open(),s=!1}),d.close.watch(()=>{s=!0,r.close(),s=!1}),d.destructor.watch(()=>r.destructor()),r}componentDidMount(){d.open()}componentWillUnmount(){d.close()}render(){return d.set(this.props),null}}d.predicate=(()=>!0),d.displayName=`Gate:${e}`,d.isOpen=!1,d.current=s.getState(),d.open=u,d.close=a,d.status=n,d.state=s,d.set=o,d.destructor=l,d.isTerminated=!1;const h=n.watch(t=>d.isOpen=t),m=s.watch(t=>d.current=t);n.map(t=>{t||(d.current=r)});s.reset(a);const b=l.watch(()=>{d.isTerminated=!0}),f=l.watch(()=>{f(),h(),m(),b(),d.status.off(d.open),d.status.off(d.close),d.status.off(d.destructor),d.state.off(d.set)});return d}exports.createStoreConsumer=e,exports.unstable_createStoreProvider=r,exports.createContextComponent=n,exports.createComponent=s,exports.connect=u,exports.createReactState=c,exports.createGate=p; | ||
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.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 b=l.watch(()=>{d.isTerminated=1}),f=l.watch(()=>{f(),h(),m(),b(),(()=>{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 @@ | ||
import{Component as t,createElement as e,PureComponent as r}from"react";import{createDomain as s,createApi as n}from"effector";function o(e){var r,s;return s=r=class extends t{constructor(){super(...arguments),this.state={currentState:e.getState()},this._unsubscribe=null,this._hasUnmounted=!1}componentDidMount(){this.subscribe()}componentWillUnmount(){this.unsubscribe(),this._hasUnmounted=!0}render(){return this.props.children(this.state.currentState)}subscribe(){const t=e.subscribe(t=>{this._hasUnmounted||this.setState(e=>t===e.currentState?null:{currentState:t})});this._unsubscribe=t}unsubscribe(){"function"==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},r.displayName=`${e.shortName}.Consumer`,s}function u(e){var r,s;return s=r=class extends t{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},s}function c(r,s,n){var u,c;const a=o(r);return c=u=class extends t{constructor(){super(...arguments),this.renderProp=(t=>n(this.props,t,this.context))}render(){return e(a,null,this.renderProp)}},u.contextType=s,c}function a(r,s){const n=o(r);return class extends t{constructor(){super(...arguments),this.renderProp=(t=>s(this.props,t))}render(){return e(n,null,this.renderProp)}}}function i(){return(i=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 l(t,r){const s=o(t),n=t=>e(s,null,s=>e(r,i({},t,s)));return n.displayName=`Connect(${r.displayName||r.name||"Unknown"})`,n}function p(t){return e=>l(e,t)}const d=s("Gate").store;function h(t,e){void 0===t&&(t="gate"),void 0===e&&(e={});const s=d(!1),o=d(e),u=n(o,{set:(t,e)=>e}).set,c=n(s,{open:()=>p.predicate()&&!0,close:()=>!1,destructor:()=>!1}),a=c.open,i=c.close,l=c.destructor;class p extends r{static childGate(e){void 0===e&&(e="Subgate");const r=h(`${t}/${e}`);r.predicate=(()=>p.status.getState());let s=!1,n=!1;return r.open.watch(()=>{n||(s=!0)}),r.close.watch(()=>{n||(s=!1)}),p.status.watch(t=>{n=!0,s&&t&&!r.status.getState()&&r.open(),n=!1}),p.close.watch(()=>{n=!0,r.close(),n=!1}),p.destructor.watch(()=>r.destructor()),r}componentDidMount(){p.open()}componentWillUnmount(){p.close()}render(){return p.set(this.props),null}}p.predicate=(()=>!0),p.displayName=`Gate:${t}`,p.isOpen=!1,p.current=o.getState(),p.open=a,p.close=i,p.status=s,p.state=o,p.set=u,p.destructor=l,p.isTerminated=!1;const f=s.watch(t=>p.isOpen=t),m=o.watch(t=>p.current=t);s.map(t=>{t||(p.current=e)});o.reset(i);const b=l.watch(()=>{p.isTerminated=!0}),v=l.watch(()=>{v(),f(),m(),b(),p.status.off(p.open),p.status.off(p.close),p.status.off(p.destructor),p.state.off(p.set)});return p}export{o as createStoreConsumer,u as unstable_createStoreProvider,c as createContextComponent,a as createComponent,p as connect,l as createReactState,h as createGate}; | ||
function t(t){var e,r;return r=e=class extends a{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 a{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 u=t(e);return o=n=class extends a{constructor(){super(...arguments),this.renderProp=(t=>s(this.props,t,this.context))}render(){return i(u,null,this.renderProp)}},n.contextType=r,o}function s(e,r){const s=t(e);return class extends a{constructor(){super(...arguments),this.renderProp=(t=>r(this.props,t))}render(){return i(s,null,this.renderProp)}}}function n(){return(n=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 o(e,r){const s=t(e),o=t=>i(s,null,e=>i(r,n({},t,e)));return o.displayName=`Connect(${r.displayName||r.name||'Unknown'})`,o}function u(t){return e=>o(e,t)}function c(t,e){void 0===t&&(t='gate'),void 0===e&&(e={});const r=h(0),s=h(e),n=d(s,{set:(t,e)=>e}).set,o=d(r,{open:()=>p.predicate()&&1,close:()=>0,destructor:()=>0}),u=o.open,a=o.close,i=o.destructor;class p extends l{static childGate(e){void 0===e&&(e='Subgate');const r=c(`${t}/${e}`);r.predicate=(()=>p.status.getState());let s=0,n=0;return r.open.watch(()=>{n||(s=1)}),r.close.watch(()=>{n||(s=0)}),p.status.watch(t=>{n=1,s&&t&&!r.status.getState()&&r.open(),n=0}),p.close.watch(()=>{n=1,r.close(),n=0}),p.destructor.watch(()=>r.destructor()),r}componentDidMount(){p.open()}componentWillUnmount(){p.close()}render(){return p.set(this.props),null}}p.predicate=(()=>1),p.displayName=`Gate:${t}`,p.isOpen=0,p.current=s.getState(),p.open=u,p.close=a,p.status=r,p.state=s,p.set=n,p.destructor=i,p.isTerminated=0;const f=r.watch(t=>p.isOpen=t),m=s.watch(t=>p.current=t);r.map(t=>{t||(p.current=e)}),s.reset(a);const b=i.watch(()=>{p.isTerminated=1}),v=i.watch(()=>{v(),f(),m(),b(),(()=>{p.status.off(p.open),p.status.off(p.close),p.status.off(p.destructor)})(),p.state.off(p.set)});return p}import{Component as a,createElement as i,PureComponent as l}from'react';import{createDomain as p,createApi as d}from'effector';const h=p('Gate').store;export{t as createStoreConsumer,e as unstable_createStoreProvider,r as createContextComponent,s as createComponent,u as connect,o as createReactState,c as createGate}; | ||
//# sourceMappingURL=effector-react.es.js.map |
{ | ||
"name": "effector-react", | ||
"version": "0.18.1", | ||
"version": "0.18.2", | ||
"description": "React bindings for effector", | ||
"main": "effector-react.cjs.js", | ||
"module": "effector-react.es.js", | ||
"umd:main": "effector-react.umd.js", | ||
"jsnext:main": "effector-react.es.js", | ||
"typings": "index.d.ts", | ||
"dependencies": { | ||
"effector": "^0.18.1" | ||
"effector": "^0.18.2" | ||
}, | ||
@@ -22,9 +23,9 @@ "peerDependencies": { | ||
"effector-react.cjs.js", | ||
"effector-react.bundle.js", | ||
"effector-react.umd.js", | ||
"effector-react.es.js.map", | ||
"effector-react.cjs.js.map", | ||
"effector-react.bundle.js.map", | ||
"effector-react.umd.js.map", | ||
"effector-react.cjs.js.flow", | ||
"effector-react.es.js.flow", | ||
"effector-react.bundle.js.flow" | ||
"effector-react.umd.js.flow" | ||
], | ||
@@ -31,0 +32,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
56001
90
4
Updatedeffector@^0.18.2