redux-zero
Advanced tools
Comparing version 1.0.6 to 1.1.0
@@ -29,4 +29,4 @@ /// <reference types="react" /> | ||
contextTypes: { | ||
store: any; | ||
store: (props: object, propName: string, componentName: string) => Error; | ||
}; | ||
}; |
/// <reference types="react" /> | ||
import * as React from "react"; | ||
export interface Props { | ||
context: object; | ||
} | ||
export interface State { | ||
} | ||
export default class Provider extends React.Component<Props, State> { | ||
import Props from "../interfaces/Props"; | ||
import Store from "../interfaces/Store"; | ||
export default class Provider extends React.Component<Props, {}> { | ||
static childContextTypes: { | ||
store: any; | ||
store: (props: object, propName: string, componentName: string) => Error; | ||
}; | ||
getChildContext(): object; | ||
getChildContext(): { | ||
store: Store; | ||
}; | ||
render(): React.ReactElement<any>; | ||
} |
@@ -6,3 +6,2 @@ 'use strict'; | ||
var React = require('react'); | ||
var PropTypes = require('prop-types'); | ||
@@ -76,2 +75,9 @@ /*! ***************************************************************************** | ||
function propsValidation(props, propName, componentName) { | ||
if (typeof props === "object") { | ||
return null; | ||
} | ||
return new Error("Invalid prop " + propName + " supplied to " + componentName); | ||
} | ||
function connect(mapToProps) { | ||
@@ -107,3 +113,3 @@ return function (Child) { return _a = /** @class */ (function (_super) { | ||
_a.contextTypes = { | ||
store: PropTypes.object | ||
store: propsValidation | ||
}, | ||
@@ -126,3 +132,3 @@ _a; var _a; }; | ||
Provider.childContextTypes = { | ||
store: PropTypes.object | ||
store: propsValidation | ||
}; | ||
@@ -129,0 +135,0 @@ return Provider; |
import { Children, Component, createElement } from 'react'; | ||
import { object } from 'prop-types'; | ||
@@ -71,2 +70,9 @@ /*! ***************************************************************************** | ||
function propsValidation(props, propName, componentName) { | ||
if (typeof props === "object") { | ||
return null; | ||
} | ||
return new Error("Invalid prop " + propName + " supplied to " + componentName); | ||
} | ||
function connect(mapToProps) { | ||
@@ -102,3 +108,3 @@ return function (Child) { return _a = /** @class */ (function (_super) { | ||
_a.contextTypes = { | ||
store: object | ||
store: propsValidation | ||
}, | ||
@@ -121,3 +127,3 @@ _a; var _a; }; | ||
Provider.childContextTypes = { | ||
store: object | ||
store: propsValidation | ||
}; | ||
@@ -124,0 +130,0 @@ return Provider; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],e):e(t["redux-zero"]={},t.React,t.PropTypes)}(this,function(t,e,n){"use strict";function r(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t,e){for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},c=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return r(o,t),o.prototype.getChildContext=function(){return this.props.context},o.prototype.render=function(){var t=this.props.children;return e.Children.only(t)},o.childContextTypes={store:n.object},o}(e.Component);t.createStore=function(t){void 0===t&&(t={});var e=[];return{setState:function(n){t=u({},t,n),e.forEach(function(e){return e(t)})},subscribe:function(t){e.push(t)},unsubscribe:function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},getState:function(){return t}}},t.connect=function(t){return function(i){return c=function(n){function c(){var t=null!==n&&n.apply(this,arguments)||this;return t.state=t.getProps(),t.update=function(){var e=t.getProps();o(e,t.state)||t.setState(e)},t}return r(c,n),c.prototype.componentWillMount=function(){this.context.store.subscribe(this.update)},c.prototype.componentWillUnmount=function(){this.context.store.unsubscribe(this.update)},c.prototype.getProps=function(){var e=this.context.store&&this.context.store.getState()||{};return t(e,this.props)},c.prototype.render=function(){return e.createElement(i,u({store:this.context.store},this.props,this.state))},c}(e.Component),c.contextTypes={store:n.object},c;var c}},t.Provider=c,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t["redux-zero"]={},t.React)}(this,function(t,e){"use strict";function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function r(t,e){for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}function o(t,e,n){return"object"==typeof t?null:new Error("Invalid prop "+e+" supplied to "+n)}var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},c=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return n(r,t),r.prototype.getChildContext=function(){return this.props.context},r.prototype.render=function(){var t=this.props.children;return e.Children.only(t)},r.childContextTypes={store:o},r}(e.Component);t.createStore=function(t){void 0===t&&(t={});var e=[];return{setState:function(n){t=u({},t,n),e.forEach(function(e){return e(t)})},subscribe:function(t){e.push(t)},unsubscribe:function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},getState:function(){return t}}},t.connect=function(t){return function(i){return c=function(o){function c(){var t=null!==o&&o.apply(this,arguments)||this;return t.state=t.getProps(),t.update=function(){var e=t.getProps();r(e,t.state)||t.setState(e)},t}return n(c,o),c.prototype.componentWillMount=function(){this.context.store.subscribe(this.update)},c.prototype.componentWillUnmount=function(){this.context.store.unsubscribe(this.update)},c.prototype.getProps=function(){var e=this.context.store&&this.context.store.getState()||{};return t(e,this.props)},c.prototype.render=function(){return e.createElement(i,u({store:this.context.store},this.props,this.state))},c}(e.Component),c.contextTypes={store:o},c;var c}},t.Provider=c,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=redux-zero.min.js.map |
{ | ||
"name": "redux-zero", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -45,3 +45,2 @@ "main": "dist/redux-zero.cjs.js", | ||
"peerDependencies": { | ||
"prop-types": ">=15", | ||
"react": ">=15" | ||
@@ -55,3 +54,2 @@ }, | ||
"prettier": "^1.7.4", | ||
"prop-types": "^15.6.0", | ||
"react": "^16.0.0", | ||
@@ -58,0 +56,0 @@ "react-dom": "^16.0.0", |
@@ -8,2 +8,3 @@ # redux-zero | ||
- Less boilerplate | ||
- No PropTypes | ||
- Smaller and simpler than [redux](https://github.com/reactjs/redux) | ||
@@ -10,0 +11,0 @@ - Written in TypeScript |
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
47119
1
17
35
631
145