Comparing version 0.23.5 to 0.24.0
@@ -308,3 +308,2 @@ (function (global, factory) { | ||
/* eslint-disable no-console */ | ||
var mapValues = function mapValues(obj, func) { | ||
@@ -322,2 +321,3 @@ var result = {}; | ||
/* eslint-disable no-console */ | ||
var withHandlers = function withHandlers(handlers) { | ||
@@ -510,2 +510,60 @@ return function (BaseComponent) { | ||
var withStateHandlers = function withStateHandlers(initialState, stateUpdaters) { | ||
return function (BaseComponent) { | ||
var factory = createFactory(BaseComponent); | ||
var WithStateHandlers = function (_Component) { | ||
inherits(WithStateHandlers, _Component); | ||
function WithStateHandlers() { | ||
var _temp, _this, _ret; | ||
classCallCheck(this, WithStateHandlers); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), possibleConstructorReturn(_this, _ret); | ||
} | ||
WithStateHandlers.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) { | ||
var propsChanged = nextProps !== this.props; | ||
// the idea is to skip render if stateUpdater handler return undefined | ||
// this allows to create no state update handlers with access to state and props | ||
var stateChanged = !shallowEqual_1(nextState, this.state); | ||
return propsChanged || stateChanged; | ||
}; | ||
WithStateHandlers.prototype.render = function render() { | ||
return factory(_extends({}, this.props, this.state, this.stateUpdaters)); | ||
}; | ||
return WithStateHandlers; | ||
}(React.Component); | ||
var _initialiseProps = function _initialiseProps() { | ||
var _this2 = this; | ||
this.state = typeof initialState === 'function' ? initialState(this.props) : initialState; | ||
this.stateUpdaters = mapValues(stateUpdaters, function (handler) { | ||
return function () { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return _this2.setState(function (state, props) { | ||
return handler(state, props).apply(undefined, args); | ||
}); | ||
}; | ||
}); | ||
}; | ||
{ | ||
return setDisplayName(wrapDisplayName(BaseComponent, 'withStateHandlers'))(WithStateHandlers); | ||
} | ||
return WithStateHandlers; | ||
}; | ||
}; | ||
var withReducer = function withReducer(stateName, dispatchName, reducer, initialState) { | ||
@@ -615,4 +673,2 @@ return function (BaseComponent) { | ||
Nothing.displayName = 'Nothing'; | ||
var renderNothing = function renderNothing(_) { | ||
@@ -683,5 +739,4 @@ return Nothing; | ||
/* eslint-disable */ | ||
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + getDisplayName(BaseComponent) + '".') | ||
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + getDisplayName(BaseComponent) + '".')); | ||
/* eslint-enable */ | ||
); | ||
} | ||
@@ -845,7 +900,7 @@ } | ||
var createEagerElement = function createEagerElement(type, props, children) { | ||
var isReferentiallyTransparent = isReferentiallyTransparentFunctionComponent(type | ||
var isReferentiallyTransparent = isReferentiallyTransparentFunctionComponent(type); | ||
/* eslint-disable */ | ||
);var hasKey = props && props.hasOwnProperty('key' | ||
var hasKey = props && props.hasOwnProperty('key'); | ||
/* eslint-enable */ | ||
);return createEagerElementUtil(hasKey, isReferentiallyTransparent, type, props, children); | ||
return createEagerElementUtil(hasKey, isReferentiallyTransparent, type, props, children); | ||
}; | ||
@@ -1094,6 +1149,3 @@ | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = index_1 | ||
// Stream of props | ||
(), _this.props$ = config$$1.fromESObservable((_config$fromESObserva = { | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = index_1(), _this.props$ = config$$1.fromESObservable((_config$fromESObserva = { | ||
subscribe: function subscribe(observer) { | ||
@@ -1114,2 +1166,5 @@ var unsubscribe = _this.propsEmitter.listen(function (props) { | ||
// Stream of props | ||
// Stream of vdom | ||
@@ -1141,6 +1196,6 @@ | ||
// Call without arguments to complete stream | ||
this.propsEmitter.emit | ||
this.propsEmitter.emit(); | ||
// Clean-up subscription before un-mounting | ||
();this.subscription.unsubscribe(); | ||
this.subscription.unsubscribe(); | ||
}; | ||
@@ -1246,2 +1301,3 @@ | ||
exports.withState = withState; | ||
exports.withStateHandlers = withStateHandlers; | ||
exports.withReducer = withReducer; | ||
@@ -1248,0 +1304,0 @@ exports.branch = branch; |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n(t.Recompose=t.Recompose||{},t.React)}(this,function(t,n){"use strict";function r(t,n){return t===n?0!==t||0!==n||1/t==1/n:t!==t&&n!==n}function e(t,n){if(r(t,n))return!0;if("object"!=typeof t||null===t||"object"!=typeof n||null===n)return!1;var e=Object.keys(t);if(e.length!==Object.keys(n).length)return!1;for(var o=0;e.length>o;o++)if(!E.call(n,e[o])||!r(t[e[o]],n[e[o]]))return!1;return!0}function o(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return 0===n.length?function(t){return t}:1===n.length?n[0]:n.reduce(function(t,n){return function(){return t(n.apply(void 0,arguments))}})}var u="default"in n?n.default:n,i=function(t,n){return function(r){return r[t]=n,r}},c=function(t){return i("displayName",t)},p=function(t){if("string"==typeof t)return t;if(t)return t.displayName||t.name||"Component"},f=function(t,n){return n+"("+p(t)+")"},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},l=Object.assign||function(t){for(var n=1;arguments.length>n;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},y=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)},h=function(t,n){var r={};for(var e in t)0>n.indexOf(e)&&Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r},v=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n},m=function(t,n,r,e,o){if(!t&&n)return r(o?l({},e,{children:o}):e);var i=r;return o?u.createElement(i,e,o):u.createElement(i,e)},d=function(t){return!(!t||!t.prototype||"object"!==a(t.prototype.isReactComponent))},b=function(t){return!("function"!=typeof t||d(t)||t.defaultProps||t.contextTypes)},O=function(t){var n=b(t);return function(r,e){return m(!1,n,t,r,e)}},g=function(t){return function(n){var r=O(n);return function(n){return r(t(n))}}},P=function(t){return g(function(n){return l({},n,"function"==typeof t?t(n):t)})},S=function(t,n){for(var r={},e=0;n.length>e;e++){var o=n[e];t.hasOwnProperty(o)&&(r[o]=t[o])}return r},E=Object.prototype.hasOwnProperty,C=e,w=function(t,r){return function(e){var o=O(e),u="function"==typeof t?t:function(n,r){return!C(S(n,t),S(r,t))};return function(t){function n(){var e,o,u;s(this,n);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return e=o=v(this,t.call.apply(t,[this].concat(c))),o.computedProps=r(o.props),u=e,v(o,u)}return y(n,t),n.prototype.componentWillReceiveProps=function(t){u(this.props,t)&&(this.computedProps=r(t))},n.prototype.render=function(){return o(l({},this.props,this.computedProps))},n}(n.Component)}},x=function(t,n){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[e]=n(t[e],e));return r},j=function(t){return function(r){var e=O(r),o=function(){var n=this;this.cachedHandlers={},this.handlers=x("function"==typeof t?t(this.props):t,function(t,r){return function(){var e=n.cachedHandlers[r];if(e)return e.apply(void 0,arguments);var o=t(n.props);return n.cachedHandlers[r]=o,o.apply(void 0,arguments)}})};return function(t){function n(){var r,e,u;s(this,n);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return r=e=v(this,t.call.apply(t,[this].concat(c))),o.call(e),u=r,v(e,u)}return y(n,t),n.prototype.componentWillReceiveProps=function(){this.cachedHandlers={}},n.prototype.render=function(){return e(l({},this.props,this.handlers))},n}(n.Component)}},T=function(t){return function(n){var r=O(n),e=function(t){return r(t)};return e.defaultProps=t,e}},N=function(t,n){for(var r=h(t,[]),e=0;n.length>e;e++){var o=n[e];r.hasOwnProperty(o)&&delete r[o]}return r},V=function(t,n){return g(function(r){var e;return l({},N(r,[t]),(e={},e[n]=r[t],e))})},R=Object.keys,W=function(t,n){return R(t).reduce(function(r,e){var o=t[e];return r[n(o,e)]=o,r},{})},A=function(t){return g(function(n){return l({},N(n,R(t)),W(S(n,R(t)),function(n,r){return t[r]}))})},F=function(t){return function(n){var r=O(n);return function(n){return r(l({},n,n[t]))}}},_=function(t,r,e){return function(o){var u=O(o);return function(n){function o(){var t,r,u;s(this,o);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return t=r=v(this,n.call.apply(n,[this].concat(c))),r.state={stateValue:"function"==typeof e?e(r.props):e},r.updateStateValue=function(t,n){return r.setState(function(n){var r=n.stateValue;return{stateValue:"function"==typeof t?t(r):t}},n)},u=t,v(r,u)}return y(o,n),o.prototype.render=function(){var n;return u(l({},this.props,(n={},n[t]=this.state.stateValue,n[r]=this.updateStateValue,n)))},o}(n.Component)}},k=function(t,r,e,o){return function(u){var i=O(u);return function(n){function u(){var t,r,o;s(this,u);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return t=r=v(this,n.call.apply(n,[this].concat(c))),r.state={stateValue:r.initializeStateValue()},r.dispatch=function(t){return r.setState(function(n){return{stateValue:e(n.stateValue,t)}})},o=t,v(r,o)}return y(u,n),u.prototype.initializeStateValue=function(){return void 0!==o?"function"==typeof o?o(this.props):o:e(void 0,{type:"@@recompose/INIT"})},u.prototype.render=function(){var n;return i(l({},this.props,(n={},n[t]=this.state.stateValue,n[r]=this.dispatch,n)))},u}(n.Component)}},H=function(t){return t},U=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:H;return function(e){var o=void 0,u=void 0;return function(i){return t(i)?(o=o||O(n(e)))(i):(u=u||O(r(e)))(i)}}},D=function(t){return function(n){var r=O(t);return function(t){return r(t)}}},M=function(t){function n(){return s(this,n),v(this,t.apply(this,arguments))}return y(n,t),n.prototype.render=function(){return null},n}(n.Component);M.displayName="Nothing";var $,q=function(t){return M},z=function(t){return function(r){var e=O(r);return function(n){function r(){return s(this,r),v(this,n.apply(this,arguments))}return y(r,n),r.prototype.shouldComponentUpdate=function(n){return t(this.props,n)},r.prototype.render=function(){return e(this.props)},r}(n.Component)}},I=function(t){return z(function(t,n){return!C(t,n)})(t)},K=function(t){return z(function(n,r){return!C(S(r,t),S(n,t))})},B=function(t){var n=t.propTypes,r=Object.keys(n||{});return K(r)(t)},G=function(t,r){return function(e){var o=O(e),u=function(t){function n(){var e,o,u;s(this,n);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return e=o=v(this,t.call.apply(t,[this].concat(c))),o.getChildContext=function(){return r(o.props)},u=e,v(o,u)}return y(n,t),n.prototype.render=function(){return o(this.props)},n}(n.Component);return u.childContextTypes=t,u}},J=function(t){return function(n){var r=O(n),e=function(t,n){return r(l({},t,n))};return e.contextTypes=t,e}},L=function(t){return function(r){var e=O(r),o=function(t){function n(){return s(this,n),v(this,t.apply(this,arguments))}return y(n,t),n.prototype.render=function(){return e(l({},this.props,this.state))},n}(n.Component);return Object.keys(t).forEach(function(n){return o.prototype[n]=t[n]}),o}},Q=function(t){if(d(t))return t;var r=function(n){function r(){return s(this,r),v(this,n.apply(this,arguments))}return y(r,n),r.prototype.render=function(){return"string"==typeof t?u.createElement(t,this.props):t(this.props,this.context)},r}(n.Component);return r.displayName=p(t),r.propTypes=t.propTypes,r.contextTypes=t.contextTypes,r.defaultProps=t.defaultProps,r},X=function(t){return i("propTypes",t)},Y=function(t,n,r){var e=b(t),o=n&&n.hasOwnProperty("key");return m(o,e,t,n,r)},Z=function(t){return function(n){function r(){return s(this,r),v(this,n.apply(this,arguments))}return y(r,n),r.prototype.componentWillMount=function(){t(this.props)},r.prototype.componentWillReceiveProps=function(n){t(n)},r.prototype.render=function(){return null},r}(n.Component)},tt=function(t){var n=function(n){return Y(n[t],N(n,[t]))};return n.displayName="componentFromProp("+t+")",n},nt=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var e=n.map(O);return function(t){var n=h(t,[]),r=t.children;return e.reduceRight(function(t,r){return r(n,t)},r)}},rt={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},et={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},ot="function"==typeof Object.getOwnPropertySymbols,ut=function(t,n,r){if("string"!=typeof n){var e=Object.getOwnPropertyNames(n);ot&&(e=e.concat(Object.getOwnPropertySymbols(n)));for(var o=0;e.length>o;++o)if(!(rt[e[o]]||et[e[o]]||r&&r[e[o]]))try{t[e[o]]=n[e[o]]}catch(t){}}return t},it=function(t){return function(n){var r=t(n);return ut(r,n),r}},ct=function(t,n){return n={exports:{}},t(n,n.exports),n.exports}(function(t,n){Object.defineProperty(n,"__esModule",{value:!0});n.createChangeEmitter=function(){function t(){o===e&&(o=e.slice())}function n(n){if("function"!=typeof n)throw Error("Expected listener to be a function.");var r=!0;return t(),o.push(n),function(){if(r){r=!1,t();var e=o.indexOf(n);o.splice(e,1)}}}function r(){e=o;for(var t=e,n=0;t.length>n;n++)t[n].apply(t,arguments)}var e=[],o=e;return{listen:n,emit:r}}}),pt=ct.createChangeEmitter;$="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();var ft=function(t){var n,r=t.Symbol;return"function"==typeof r?r.observable?n=r.observable:(n=r("observable"),r.observable=n):n="@@observable",n}($),at={fromESObservable:null,toESObservable:null},st=function(t){at=t},lt={fromESObservable:function(t){return"function"==typeof at.fromESObservable?at.fromESObservable(t):t},toESObservable:function(t){return"function"==typeof at.toESObservable?at.toESObservable(t):t}},yt=function(t){return function(r){return function(n){function e(){var o,u,i,c;s(this,e);for(var p=arguments.length,f=Array(p),a=0;p>a;a++)f[a]=arguments[a];return u=i=v(this,n.call.apply(n,[this].concat(f))),i.state={vdom:null},i.propsEmitter=pt(),i.props$=t.fromESObservable((o={subscribe:function(t){return{unsubscribe:i.propsEmitter.listen(function(n){n?t.next(n):t.complete()})}}},o[ft]=function(){return this},o)),i.vdom$=t.toESObservable(r(i.props$)),c=u,v(i,c)}return y(e,n),e.prototype.componentWillMount=function(){var t=this;this.subscription=this.vdom$.subscribe({next:function(n){t.setState({vdom:n})}}),this.propsEmitter.emit(this.props)},e.prototype.componentWillReceiveProps=function(t){this.propsEmitter.emit(t)},e.prototype.shouldComponentUpdate=function(t,n){return n.vdom!==this.state.vdom},e.prototype.componentWillUnmount=function(){this.propsEmitter.emit(),this.subscription.unsubscribe()},e.prototype.render=function(){return this.state.vdom},e}(n.Component)}},ht=function(t){return yt(lt)(t)},vt=function(t){return t},mt=function(t){var n=yt({fromESObservable:vt,toESObservable:vt});return function(r){return function(e){var o=O(e),u=t.fromESObservable,i=t.toESObservable;return n(function(t){var n;return n={subscribe:function(n){var e=i(r(u(t))).subscribe({next:function(t){return n.next(o(t))}});return{unsubscribe:function(){return e.unsubscribe()}}}},n[ft]=function(){return this},n})}}},dt=function(t){return mt(lt)(t)},bt=function(t){return function(){var n,r=pt(),e=t.fromESObservable((n={subscribe:function(t){return{unsubscribe:r.listen(function(n){return t.next(n)})}}},n[ft]=function(){return this},n));return{handler:r.emit,stream:e}}}(lt);t.mapProps=g,t.withProps=P,t.withPropsOnChange=w,t.withHandlers=j,t.defaultProps=T,t.renameProp=V,t.renameProps=A,t.flattenProp=F,t.withState=_,t.withReducer=k,t.branch=U,t.renderComponent=D,t.renderNothing=q,t.shouldUpdate=z,t.pure=I,t.onlyUpdateForKeys=K,t.onlyUpdateForPropTypes=B,t.withContext=G,t.getContext=J,t.lifecycle=L,t.toClass=Q,t.setStatic=i,t.setPropTypes=X,t.setDisplayName=c,t.compose=o,t.getDisplayName=p,t.wrapDisplayName=f,t.shallowEqual=C,t.isClassComponent=d,t.createEagerElement=Y,t.createEagerFactory=O,t.createSink=Z,t.componentFromProp=tt,t.nest=nt,t.hoistStatics=it,t.componentFromStream=ht,t.componentFromStreamWithConfig=yt,t.mapPropsStream=dt,t.mapPropsStreamWithConfig=mt,t.createEventHandler=bt,t.setObservableConfig=st,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n(t.Recompose=t.Recompose||{},t.React)}(this,function(t,n){"use strict";function r(t,n){return t===n?0!==t||0!==n||1/t==1/n:t!==t&&n!==n}function e(t,n){if(r(t,n))return!0;if("object"!=typeof t||null===t||"object"!=typeof n||null===n)return!1;var e=Object.keys(t);if(e.length!==Object.keys(n).length)return!1;for(var o=0;e.length>o;o++)if(!C.call(n,e[o])||!r(t[e[o]],n[e[o]]))return!1;return!0}function o(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return 0===n.length?function(t){return t}:1===n.length?n[0]:n.reduce(function(t,n){return function(){return t(n.apply(void 0,arguments))}})}var u,i="default"in n?n.default:n,c=function(t,n){return function(r){return r[t]=n,r}},p=function(t){return c("displayName",t)},s=function(t){if("string"==typeof t)return t;if(t)return t.displayName||t.name||"Component"},a=function(t,n){return n+"("+s(t)+")"},f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},h=Object.assign||function(t){for(var n=1;arguments.length>n;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},y=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)},v=function(t,n){var r={};for(var e in t)0>n.indexOf(e)&&Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r},d=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n},m=function(t,n,r,e,o){if(!t&&n)return r(o?h({},e,{children:o}):e);var u=r;return o?i.createElement(u,e,o):i.createElement(u,e)},b=function(t){return!(!t||!t.prototype||"object"!==f(t.prototype.isReactComponent))},O=function(t){return!("function"!=typeof t||b(t)||t.defaultProps||t.contextTypes)},g=function(t){var n=O(t);return function(r,e){return m(!1,n,t,r,e)}},S=function(t){return function(n){var r=g(n);return function(n){return r(t(n))}}},P=function(t){return S(function(n){return h({},n,"function"==typeof t?t(n):t)})},E=function(t,n){for(var r={},e=0;n.length>e;e++){var o=n[e];t.hasOwnProperty(o)&&(r[o]=t[o])}return r},C=Object.prototype.hasOwnProperty,w=e,x=function(t,r){return function(e){var o=g(e),u="function"==typeof t?t:function(n,r){return!w(E(n,t),E(r,t))};return function(t){function n(){var e,o,u;l(this,n);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return e=o=d(this,t.call.apply(t,[this].concat(c))),o.computedProps=r(o.props),u=e,d(o,u)}return y(n,t),n.prototype.componentWillReceiveProps=function(t){u(this.props,t)&&(this.computedProps=r(t))},n.prototype.render=function(){return o(h({},this.props,this.computedProps))},n}(n.Component)}},j=function(t,n){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[e]=n(t[e],e));return r},T=function(t){return function(r){var e=g(r),o=function(){var n=this;this.cachedHandlers={},this.handlers=j("function"==typeof t?t(this.props):t,function(t,r){return function(){var e=n.cachedHandlers[r];if(e)return e.apply(void 0,arguments);var o=t(n.props);return n.cachedHandlers[r]=o,o.apply(void 0,arguments)}})};return function(t){function n(){var r,e,u;l(this,n);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return r=e=d(this,t.call.apply(t,[this].concat(c))),o.call(e),u=r,d(e,u)}return y(n,t),n.prototype.componentWillReceiveProps=function(){this.cachedHandlers={}},n.prototype.render=function(){return e(h({},this.props,this.handlers))},n}(n.Component)}},V=function(t){return function(n){var r=g(n),e=function(t){return r(t)};return e.defaultProps=t,e}},N=function(t,n){for(var r=v(t,[]),e=0;n.length>e;e++){var o=n[e];r.hasOwnProperty(o)&&delete r[o]}return r},R=function(t,n){return S(function(r){var e;return h({},N(r,[t]),(e={},e[n]=r[t],e))})},A=Object.keys,U=function(t,n){return A(t).reduce(function(r,e){var o=t[e];return r[n(o,e)]=o,r},{})},W=function(t){return S(function(n){return h({},N(n,A(t)),U(E(n,A(t)),function(n,r){return t[r]}))})},F=function(t){return function(n){var r=g(n);return function(n){return r(h({},n,n[t]))}}},_=function(t,r,e){return function(o){var u=g(o);return function(n){function o(){var t,r,u;l(this,o);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return t=r=d(this,n.call.apply(n,[this].concat(c))),r.state={stateValue:"function"==typeof e?e(r.props):e},r.updateStateValue=function(t,n){return r.setState(function(n){var r=n.stateValue;return{stateValue:"function"==typeof t?t(r):t}},n)},u=t,d(r,u)}return y(o,n),o.prototype.render=function(){var n;return u(h({},this.props,(n={},n[t]=this.state.stateValue,n[r]=this.updateStateValue,n)))},o}(n.Component)}},k=function(t,r){return function(e){var o=g(e),u=function(){var n=this;this.state="function"==typeof t?t(this.props):t,this.stateUpdaters=j(r,function(t){return function(){for(var r=arguments.length,e=Array(r),o=0;r>o;o++)e[o]=arguments[o];return n.setState(function(n,r){return t(n,r).apply(void 0,e)})}})};return function(t){function n(){var r,e,o;l(this,n);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return r=e=d(this,t.call.apply(t,[this].concat(c))),u.call(e),o=r,d(e,o)}return y(n,t),n.prototype.shouldComponentUpdate=function(t,n){var r=t!==this.props,e=!w(n,this.state);return r||e},n.prototype.render=function(){return o(h({},this.props,this.state,this.stateUpdaters))},n}(n.Component)}},H=function(t,r,e,o){return function(u){var i=g(u);return function(n){function u(){var t,r,o;l(this,u);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return t=r=d(this,n.call.apply(n,[this].concat(c))),r.state={stateValue:r.initializeStateValue()},r.dispatch=function(t){return r.setState(function(n){return{stateValue:e(n.stateValue,t)}})},o=t,d(r,o)}return y(u,n),u.prototype.initializeStateValue=function(){return void 0!==o?"function"==typeof o?o(this.props):o:e(void 0,{type:"@@recompose/INIT"})},u.prototype.render=function(){var n;return i(h({},this.props,(n={},n[t]=this.state.stateValue,n[r]=this.dispatch,n)))},u}(n.Component)}},D=function(t){return t},M=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:D;return function(e){var o=void 0,u=void 0;return function(i){return t(i)?(o=o||g(n(e)))(i):(u=u||g(r(e)))(i)}}},$=function(t){return function(n){var r=g(t);return function(t){return r(t)}}},q=function(t){function n(){return l(this,n),d(this,t.apply(this,arguments))}return y(n,t),n.prototype.render=function(){return null},n}(n.Component),z=function(t){return q},I=function(t){return function(r){var e=g(r);return function(n){function r(){return l(this,r),d(this,n.apply(this,arguments))}return y(r,n),r.prototype.shouldComponentUpdate=function(n){return t(this.props,n)},r.prototype.render=function(){return e(this.props)},r}(n.Component)}},K=function(t){return I(function(t,n){return!w(t,n)})(t)},B=function(t){return I(function(n,r){return!w(E(r,t),E(n,t))})},G=function(t){var n=t.propTypes,r=Object.keys(n||{});return B(r)(t)},J=function(t,r){return function(e){var o=g(e),u=function(t){function n(){var e,o,u;l(this,n);for(var i=arguments.length,c=Array(i),p=0;i>p;p++)c[p]=arguments[p];return e=o=d(this,t.call.apply(t,[this].concat(c))),o.getChildContext=function(){return r(o.props)},u=e,d(o,u)}return y(n,t),n.prototype.render=function(){return o(this.props)},n}(n.Component);return u.childContextTypes=t,u}},L=function(t){return function(n){var r=g(n),e=function(t,n){return r(h({},t,n))};return e.contextTypes=t,e}},Q=function(t){return function(r){var e=g(r),o=function(t){function n(){return l(this,n),d(this,t.apply(this,arguments))}return y(n,t),n.prototype.render=function(){return e(h({},this.props,this.state))},n}(n.Component);return Object.keys(t).forEach(function(n){return o.prototype[n]=t[n]}),o}},X=function(t){if(b(t))return t;var r=function(n){function r(){return l(this,r),d(this,n.apply(this,arguments))}return y(r,n),r.prototype.render=function(){return"string"==typeof t?i.createElement(t,this.props):t(this.props,this.context)},r}(n.Component);return r.displayName=s(t),r.propTypes=t.propTypes,r.contextTypes=t.contextTypes,r.defaultProps=t.defaultProps,r},Y=function(t){return c("propTypes",t)},Z=function(t,n,r){var e=O(t),o=n&&n.hasOwnProperty("key");return m(o,e,t,n,r)},tt=function(t){return function(n){function r(){return l(this,r),d(this,n.apply(this,arguments))}return y(r,n),r.prototype.componentWillMount=function(){t(this.props)},r.prototype.componentWillReceiveProps=function(n){t(n)},r.prototype.render=function(){return null},r}(n.Component)},nt=function(t){var n=function(n){return Z(n[t],N(n,[t]))};return n.displayName="componentFromProp("+t+")",n},rt=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var e=n.map(g);return function(t){var n=v(t,[]),r=t.children;return e.reduceRight(function(t,r){return r(n,t)},r)}},et={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},ot={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},ut="function"==typeof Object.getOwnPropertySymbols,it=function(t,n,r){if("string"!=typeof n){var e=Object.getOwnPropertyNames(n);ut&&(e=e.concat(Object.getOwnPropertySymbols(n)));for(var o=0;e.length>o;++o)if(!(et[e[o]]||ot[e[o]]||r&&r[e[o]]))try{t[e[o]]=n[e[o]]}catch(t){}}return t},ct=function(t){return function(n){var r=t(n);return it(r,n),r}},pt=function(t,n){return n={exports:{}},t(n,n.exports),n.exports}(function(t,n){Object.defineProperty(n,"__esModule",{value:!0});n.createChangeEmitter=function(){function t(){o===e&&(o=e.slice())}function n(n){if("function"!=typeof n)throw Error("Expected listener to be a function.");var r=!0;return t(),o.push(n),function(){if(r){r=!1,t();var e=o.indexOf(n);o.splice(e,1)}}}function r(){e=o;for(var t=e,n=0;t.length>n;n++)t[n].apply(t,arguments)}var e=[],o=e;return{listen:n,emit:r}}}),st=pt.createChangeEmitter;u="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();var at=function(t){var n,r=t.Symbol;return"function"==typeof r?r.observable?n=r.observable:(n=r("observable"),r.observable=n):n="@@observable",n}(u),ft={fromESObservable:null,toESObservable:null},lt=function(t){ft=t},ht={fromESObservable:function(t){return"function"==typeof ft.fromESObservable?ft.fromESObservable(t):t},toESObservable:function(t){return"function"==typeof ft.toESObservable?ft.toESObservable(t):t}},yt=function(t){return function(r){return function(n){function e(){var o,u,i,c;l(this,e);for(var p=arguments.length,s=Array(p),a=0;p>a;a++)s[a]=arguments[a];return u=i=d(this,n.call.apply(n,[this].concat(s))),i.state={vdom:null},i.propsEmitter=st(),i.props$=t.fromESObservable((o={subscribe:function(t){return{unsubscribe:i.propsEmitter.listen(function(n){n?t.next(n):t.complete()})}}},o[at]=function(){return this},o)),i.vdom$=t.toESObservable(r(i.props$)),c=u,d(i,c)}return y(e,n),e.prototype.componentWillMount=function(){var t=this;this.subscription=this.vdom$.subscribe({next:function(n){t.setState({vdom:n})}}),this.propsEmitter.emit(this.props)},e.prototype.componentWillReceiveProps=function(t){this.propsEmitter.emit(t)},e.prototype.shouldComponentUpdate=function(t,n){return n.vdom!==this.state.vdom},e.prototype.componentWillUnmount=function(){this.propsEmitter.emit(),this.subscription.unsubscribe()},e.prototype.render=function(){return this.state.vdom},e}(n.Component)}},vt=function(t){return yt(ht)(t)},dt=function(t){return t},mt=function(t){var n=yt({fromESObservable:dt,toESObservable:dt});return function(r){return function(e){var o=g(e),u=t.fromESObservable,i=t.toESObservable;return n(function(t){var n;return n={subscribe:function(n){var e=i(r(u(t))).subscribe({next:function(t){return n.next(o(t))}});return{unsubscribe:function(){return e.unsubscribe()}}}},n[at]=function(){return this},n})}}},bt=function(t){return mt(ht)(t)},Ot=function(t){return function(){var n,r=st(),e=t.fromESObservable((n={subscribe:function(t){return{unsubscribe:r.listen(function(n){return t.next(n)})}}},n[at]=function(){return this},n));return{handler:r.emit,stream:e}}}(ht);t.mapProps=S,t.withProps=P,t.withPropsOnChange=x,t.withHandlers=T,t.defaultProps=V,t.renameProp=R,t.renameProps=W,t.flattenProp=F,t.withState=_,t.withStateHandlers=k,t.withReducer=H,t.branch=M,t.renderComponent=$,t.renderNothing=z,t.shouldUpdate=I,t.pure=K,t.onlyUpdateForKeys=B,t.onlyUpdateForPropTypes=G,t.withContext=J,t.getContext=L,t.lifecycle=Q,t.toClass=X,t.setStatic=c,t.setPropTypes=Y,t.setDisplayName=p,t.compose=o,t.getDisplayName=s,t.wrapDisplayName=a,t.shallowEqual=w,t.isClassComponent=b,t.createEagerElement=Z,t.createEagerFactory=g,t.createSink=tt,t.componentFromProp=nt,t.nest=rt,t.hoistStatics=ct,t.componentFromStream=vt,t.componentFromStreamWithConfig=yt,t.mapPropsStream=bt,t.mapPropsStreamWithConfig=mt,t.createEventHandler=Ot,t.setObservableConfig=lt,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -247,3 +247,2 @@ 'use strict'; | ||
/* eslint-disable no-console */ | ||
var mapValues = function mapValues(obj, func) { | ||
@@ -261,2 +260,3 @@ var result = {}; | ||
/* eslint-disable no-console */ | ||
var withHandlers = function withHandlers(handlers) { | ||
@@ -449,2 +449,60 @@ return function (BaseComponent) { | ||
var withStateHandlers = function withStateHandlers(initialState, stateUpdaters) { | ||
return function (BaseComponent) { | ||
var factory = createFactory(BaseComponent); | ||
var WithStateHandlers = function (_Component) { | ||
inherits(WithStateHandlers, _Component); | ||
function WithStateHandlers() { | ||
var _temp, _this, _ret; | ||
classCallCheck(this, WithStateHandlers); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), possibleConstructorReturn(_this, _ret); | ||
} | ||
WithStateHandlers.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) { | ||
var propsChanged = nextProps !== this.props; | ||
// the idea is to skip render if stateUpdater handler return undefined | ||
// this allows to create no state update handlers with access to state and props | ||
var stateChanged = !shallowEqual(nextState, this.state); | ||
return propsChanged || stateChanged; | ||
}; | ||
WithStateHandlers.prototype.render = function render() { | ||
return factory(_extends({}, this.props, this.state, this.stateUpdaters)); | ||
}; | ||
return WithStateHandlers; | ||
}(React.Component); | ||
var _initialiseProps = function _initialiseProps() { | ||
var _this2 = this; | ||
this.state = typeof initialState === 'function' ? initialState(this.props) : initialState; | ||
this.stateUpdaters = mapValues(stateUpdaters, function (handler) { | ||
return function () { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return _this2.setState(function (state, props) { | ||
return handler(state, props).apply(undefined, args); | ||
}); | ||
}; | ||
}); | ||
}; | ||
if (process.env.NODE_ENV !== 'production') { | ||
return setDisplayName(wrapDisplayName(BaseComponent, 'withStateHandlers'))(WithStateHandlers); | ||
} | ||
return WithStateHandlers; | ||
}; | ||
}; | ||
var withReducer = function withReducer(stateName, dispatchName, reducer, initialState) { | ||
@@ -554,4 +612,2 @@ return function (BaseComponent) { | ||
Nothing.displayName = 'Nothing'; | ||
var renderNothing = function renderNothing(_) { | ||
@@ -622,5 +678,4 @@ return Nothing; | ||
/* eslint-disable */ | ||
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + getDisplayName(BaseComponent) + '".') | ||
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + getDisplayName(BaseComponent) + '".')); | ||
/* eslint-enable */ | ||
); | ||
} | ||
@@ -784,7 +839,7 @@ } | ||
var createEagerElement = function createEagerElement(type, props, children) { | ||
var isReferentiallyTransparent = isReferentiallyTransparentFunctionComponent(type | ||
var isReferentiallyTransparent = isReferentiallyTransparentFunctionComponent(type); | ||
/* eslint-disable */ | ||
);var hasKey = props && props.hasOwnProperty('key' | ||
var hasKey = props && props.hasOwnProperty('key'); | ||
/* eslint-enable */ | ||
);return createEagerElementUtil(hasKey, isReferentiallyTransparent, type, props, children); | ||
return createEagerElementUtil(hasKey, isReferentiallyTransparent, type, props, children); | ||
}; | ||
@@ -889,6 +944,3 @@ | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = changeEmitter.createChangeEmitter | ||
// Stream of props | ||
(), _this.props$ = config$$1.fromESObservable((_config$fromESObserva = { | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = changeEmitter.createChangeEmitter(), _this.props$ = config$$1.fromESObservable((_config$fromESObserva = { | ||
subscribe: function subscribe(observer) { | ||
@@ -909,2 +961,5 @@ var unsubscribe = _this.propsEmitter.listen(function (props) { | ||
// Stream of props | ||
// Stream of vdom | ||
@@ -936,6 +991,6 @@ | ||
// Call without arguments to complete stream | ||
this.propsEmitter.emit | ||
this.propsEmitter.emit(); | ||
// Clean-up subscription before un-mounting | ||
();this.subscription.unsubscribe(); | ||
this.subscription.unsubscribe(); | ||
}; | ||
@@ -1041,2 +1096,3 @@ | ||
exports.withState = withState; | ||
exports.withStateHandlers = withStateHandlers; | ||
exports.withReducer = withReducer; | ||
@@ -1043,0 +1099,0 @@ exports.branch = branch; |
@@ -40,6 +40,3 @@ 'use strict'; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = (0, _changeEmitter.createChangeEmitter | ||
// Stream of props | ||
)(), _this.props$ = config.fromESObservable((_config$fromESObserva = { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = (0, _changeEmitter.createChangeEmitter)(), _this.props$ = config.fromESObservable((_config$fromESObserva = { | ||
subscribe: function subscribe(observer) { | ||
@@ -60,2 +57,5 @@ var unsubscribe = _this.propsEmitter.listen(function (props) { | ||
// Stream of props | ||
// Stream of vdom | ||
@@ -87,6 +87,6 @@ | ||
// Call without arguments to complete stream | ||
this.propsEmitter.emit | ||
this.propsEmitter.emit(); | ||
// Clean-up subscription before un-mounting | ||
();this.subscription.unsubscribe(); | ||
this.subscription.unsubscribe(); | ||
}; | ||
@@ -93,0 +93,0 @@ |
@@ -16,9 +16,9 @@ 'use strict'; | ||
var createEagerElement = function createEagerElement(type, props, children) { | ||
var isReferentiallyTransparent = (0, _isReferentiallyTransparentFunctionComponent2.default)(type | ||
var isReferentiallyTransparent = (0, _isReferentiallyTransparentFunctionComponent2.default)(type); | ||
/* eslint-disable */ | ||
);var hasKey = props && props.hasOwnProperty('key' | ||
var hasKey = props && props.hasOwnProperty('key'); | ||
/* eslint-enable */ | ||
);return (0, _createEagerElementUtil2.default)(hasKey, isReferentiallyTransparent, type, props, children); | ||
return (0, _createEagerElementUtil2.default)(hasKey, isReferentiallyTransparent, type, props, children); | ||
}; | ||
exports.default = createEagerElement; |
@@ -240,3 +240,2 @@ import React, { Component } from 'react'; | ||
/* eslint-disable no-console */ | ||
var mapValues = function mapValues(obj, func) { | ||
@@ -254,2 +253,3 @@ var result = {}; | ||
/* eslint-disable no-console */ | ||
var withHandlers = function withHandlers(handlers) { | ||
@@ -442,2 +442,60 @@ return function (BaseComponent) { | ||
var withStateHandlers = function withStateHandlers(initialState, stateUpdaters) { | ||
return function (BaseComponent) { | ||
var factory = createFactory(BaseComponent); | ||
var WithStateHandlers = function (_Component) { | ||
inherits(WithStateHandlers, _Component); | ||
function WithStateHandlers() { | ||
var _temp, _this, _ret; | ||
classCallCheck(this, WithStateHandlers); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), possibleConstructorReturn(_this, _ret); | ||
} | ||
WithStateHandlers.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) { | ||
var propsChanged = nextProps !== this.props; | ||
// the idea is to skip render if stateUpdater handler return undefined | ||
// this allows to create no state update handlers with access to state and props | ||
var stateChanged = !shallowEqual(nextState, this.state); | ||
return propsChanged || stateChanged; | ||
}; | ||
WithStateHandlers.prototype.render = function render() { | ||
return factory(_extends({}, this.props, this.state, this.stateUpdaters)); | ||
}; | ||
return WithStateHandlers; | ||
}(Component); | ||
var _initialiseProps = function _initialiseProps() { | ||
var _this2 = this; | ||
this.state = typeof initialState === 'function' ? initialState(this.props) : initialState; | ||
this.stateUpdaters = mapValues(stateUpdaters, function (handler) { | ||
return function () { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return _this2.setState(function (state, props) { | ||
return handler(state, props).apply(undefined, args); | ||
}); | ||
}; | ||
}); | ||
}; | ||
if (process.env.NODE_ENV !== 'production') { | ||
return setDisplayName(wrapDisplayName(BaseComponent, 'withStateHandlers'))(WithStateHandlers); | ||
} | ||
return WithStateHandlers; | ||
}; | ||
}; | ||
var withReducer = function withReducer(stateName, dispatchName, reducer, initialState) { | ||
@@ -547,4 +605,2 @@ return function (BaseComponent) { | ||
Nothing.displayName = 'Nothing'; | ||
var renderNothing = function renderNothing(_) { | ||
@@ -615,5 +671,4 @@ return Nothing; | ||
/* eslint-disable */ | ||
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + getDisplayName(BaseComponent) + '".') | ||
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + getDisplayName(BaseComponent) + '".')); | ||
/* eslint-enable */ | ||
); | ||
} | ||
@@ -777,7 +832,7 @@ } | ||
var createEagerElement = function createEagerElement(type, props, children) { | ||
var isReferentiallyTransparent = isReferentiallyTransparentFunctionComponent(type | ||
var isReferentiallyTransparent = isReferentiallyTransparentFunctionComponent(type); | ||
/* eslint-disable */ | ||
);var hasKey = props && props.hasOwnProperty('key' | ||
var hasKey = props && props.hasOwnProperty('key'); | ||
/* eslint-enable */ | ||
);return createEagerElementUtil(hasKey, isReferentiallyTransparent, type, props, children); | ||
return createEagerElementUtil(hasKey, isReferentiallyTransparent, type, props, children); | ||
}; | ||
@@ -882,6 +937,3 @@ | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = createChangeEmitter | ||
// Stream of props | ||
(), _this.props$ = config$$1.fromESObservable((_config$fromESObserva = { | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { vdom: null }, _this.propsEmitter = createChangeEmitter(), _this.props$ = config$$1.fromESObservable((_config$fromESObserva = { | ||
subscribe: function subscribe(observer) { | ||
@@ -902,2 +954,5 @@ var unsubscribe = _this.propsEmitter.listen(function (props) { | ||
// Stream of props | ||
// Stream of vdom | ||
@@ -929,6 +984,6 @@ | ||
// Call without arguments to complete stream | ||
this.propsEmitter.emit | ||
this.propsEmitter.emit(); | ||
// Clean-up subscription before un-mounting | ||
();this.subscription.unsubscribe(); | ||
this.subscription.unsubscribe(); | ||
}; | ||
@@ -1025,2 +1080,2 @@ | ||
export { mapProps, withProps, withPropsOnChange, withHandlers, defaultProps, renameProp, renameProps, flattenProp, withState, withReducer, branch, renderComponent, renderNothing, shouldUpdate, pure, onlyUpdateForKeys, onlyUpdateForPropTypes, withContext, getContext, lifecycle, toClass, setStatic, setPropTypes, setDisplayName, compose, getDisplayName, wrapDisplayName, shallowEqual, isClassComponent, createEagerElement, createFactory as createEagerFactory, createSink, componentFromProp, nest, hoistStatics, componentFromStream, componentFromStreamWithConfig, mapPropsStream, mapPropsStreamWithConfig, createEventHandler, configureObservable as setObservableConfig }; | ||
export { mapProps, withProps, withPropsOnChange, withHandlers, defaultProps, renameProp, renameProps, flattenProp, withState, withStateHandlers, withReducer, branch, renderComponent, renderNothing, shouldUpdate, pure, onlyUpdateForKeys, onlyUpdateForPropTypes, withContext, getContext, lifecycle, toClass, setStatic, setPropTypes, setDisplayName, compose, getDisplayName, wrapDisplayName, shallowEqual, isClassComponent, createEagerElement, createFactory as createEagerFactory, createSink, componentFromProp, nest, hoistStatics, componentFromStream, componentFromStreamWithConfig, mapPropsStream, mapPropsStreamWithConfig, createEventHandler, configureObservable as setObservableConfig }; |
@@ -86,2 +86,11 @@ 'use strict'; | ||
var _withStateHandlers = require('./withStateHandlers'); | ||
Object.defineProperty(exports, 'withStateHandlers', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_withStateHandlers).default; | ||
} | ||
}); | ||
var _withReducer = require('./withReducer'); | ||
@@ -88,0 +97,0 @@ |
@@ -29,5 +29,4 @@ 'use strict'; | ||
/* eslint-disable */ | ||
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + (0, _getDisplayName2.default)(BaseComponent) + '".') | ||
console.error('A component without any `propTypes` was passed to ' + '`onlyUpdateForPropTypes()`. Check the implementation of the ' + ('component with display name "' + (0, _getDisplayName2.default)(BaseComponent) + '".')); | ||
/* eslint-enable */ | ||
); | ||
} | ||
@@ -34,0 +33,0 @@ } |
{ | ||
"name": "recompose", | ||
"version": "0.23.5", | ||
"version": "0.24.0", | ||
"author": "Andrew Clark <acdlite@me.com>", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -29,4 +29,2 @@ 'use strict'; | ||
Nothing.displayName = 'Nothing'; | ||
var renderNothing = function renderNothing(_) { | ||
@@ -33,0 +31,0 @@ return Nothing; |
@@ -21,2 +21,6 @@ 'use strict'; | ||
var _mapValues = require('./utils/mapValues'); | ||
var _mapValues2 = _interopRequireDefault(_mapValues); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,14 +35,2 @@ | ||
var mapValues = function mapValues(obj, func) { | ||
var result = {}; | ||
/* eslint-disable no-restricted-syntax */ | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
result[key] = func(obj[key], key); | ||
} | ||
} | ||
/* eslint-enable no-restricted-syntax */ | ||
return result; | ||
}; | ||
var withHandlers = function withHandlers(handlers) { | ||
@@ -78,3 +70,3 @@ return function (BaseComponent) { | ||
this.cachedHandlers = {}; | ||
this.handlers = mapValues(typeof handlers === 'function' ? handlers(this.props) : handlers, function (createHandler, handlerName) { | ||
this.handlers = (0, _mapValues2.default)(typeof handlers === 'function' ? handlers(this.props) : handlers, function (createHandler, handlerName) { | ||
return function () { | ||
@@ -81,0 +73,0 @@ var cachedHandler = _this2.cachedHandlers[handlerName]; |
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
204846
60
4517
78