effector-react
Advanced tools
Comparing version 0.18.0 to 0.18.1
@@ -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"),h=d.store;function f(t,e){void 0===t&&(t="gate"),void 0===e&&(e={});const s=h(!1),o=h(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=f(`${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 d=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(),d(),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,f as createGate}; | ||
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}; | ||
//# sourceMappingURL=effector-react.es.js.map |
@@ -16,3 +16,3 @@ | ||
store: Store<State>, | ||
renderProp: (props: Props, state: State) => React.Node, | ||
renderProp: (props: Props, state: State) => React.ReactNode, | ||
): React.ComponentType<Props> | ||
@@ -19,0 +19,0 @@ export function createContextComponent<Props, State, Context>( |
{ | ||
"name": "effector-react", | ||
"version": "0.18.0", | ||
"version": "0.18.1", | ||
"description": "React bindings for effector", | ||
@@ -9,8 +9,4 @@ "main": "effector-react.cjs.js", | ||
"typings": "index.d.ts", | ||
"scripts": {}, | ||
"author": "Zero Bias", | ||
"license": "MIT", | ||
"devDependencies": {}, | ||
"dependencies": { | ||
"effector": "^0.18.0" | ||
"effector": "^0.18.1" | ||
}, | ||
@@ -20,31 +16,17 @@ "peerDependencies": { | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Zero Bias", | ||
"email": "ribkatt@gmail.com" | ||
}, | ||
{ | ||
"name": "goodmind", | ||
"email": "andwebar@gmail.com" | ||
} | ||
], | ||
"sideEffects": false, | ||
"files": [ | ||
"README.md", | ||
"LICENSE", | ||
"index.d.ts", | ||
"index.js.flow", | ||
"effector-react.es.js", | ||
"effector-react.cjs.js", | ||
"effector-react.bundle.js", | ||
"effector-react.es.js.map", | ||
"effector-react.cjs.js.map", | ||
"effector-react.bundle.js.map", | ||
"effector-react.cjs.js.flow", | ||
"effector-react.es.js.flow", | ||
"index.d.ts", | ||
"index.js.flow" | ||
"effector-react.bundle.js.flow" | ||
], | ||
"repository": "https://github.com/zerobias/effector", | ||
"homepage": "https://zerobias.github.io/effector/", | ||
"engines": { | ||
"node": ">=6.0.0" | ||
}, | ||
"bugs": "https://github.com/zerobias/effector/issues", | ||
"keywords": [ | ||
@@ -63,3 +45,24 @@ "data", | ||
"react" | ||
] | ||
], | ||
"author": "Zero Bias", | ||
"maintainers": [ | ||
{ | ||
"name": "Zero Bias", | ||
"email": "ribkatt@gmail.com" | ||
}, | ||
{ | ||
"name": "goodmind", | ||
"email": "andwebar@gmail.com" | ||
} | ||
], | ||
"sideEffects": false, | ||
"license": "MIT", | ||
"devDependencies": {}, | ||
"scripts": {}, | ||
"repository": "https://github.com/zerobias/effector", | ||
"bugs": "https://github.com/zerobias/effector/issues", | ||
"homepage": "https://zerobias.github.io/effector", | ||
"engines": { | ||
"node": ">=6.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
55824
14
89
Updatedeffector@^0.18.1