redux-zero
Advanced tools
Comparing version 3.0.0 to 4.0.0
# Changelog | ||
### 4.0.0 | ||
- Separating `Provider` and `connect` from `createStore`. With this we'll be able to build for different frameworks: | ||
```javascript | ||
import createStore from 'redux-zero' | ||
import { Provider, connect } from 'redux-zero/react' | ||
``` | ||
### 3.0.0 | ||
@@ -4,0 +13,0 @@ |
import createStore from "./store/createStore"; | ||
import connect from "./components/connect"; | ||
import Provider from "./components/Provider"; | ||
export { createStore, connect, Provider }; | ||
export default createStore; |
@@ -1,2 +0,2 @@ | ||
!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},s=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return n(r,t),r.prototype.getChildContext=function(){return{store:this.props.store}},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="function"==typeof n?u({},t,n(t)):u({},t,n),e.forEach(function(e){return e(t)})},subscribe:function(t){return e.push(t),function(){e.splice(e.indexOf(t))}},getState:function(){return t}}},t.connect=function(t){return function(i){return s=function(o){function s(){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(s,o),s.prototype.componentWillMount=function(){this.unsubscribe=this.context.store.subscribe(this.update)},s.prototype.componentWillUnmount=function(){this.unsubscribe(this.update)},s.prototype.getProps=function(){var e=this.context.store&&this.context.store.getState()||{};return t(e,this.props)},s.prototype.render=function(){return e.createElement(i,u({store:this.context.store},this.props,this.state))},s}(e.Component),s.contextTypes={store:o},s;var s}},t.Provider=s,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t["redux-zero"]=e()}(this,function(){"use strict";var t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};return function(e){void 0===e&&(e={});var n=[];return{setState:function(o){e="function"==typeof o?t({},e,o(e)):t({},e,o),n.forEach(function(t){return t(e)})},subscribe:function(t){return n.push(t),function(){n.splice(n.indexOf(t))}},getState:function(){return e}}}}); | ||
//# sourceMappingURL=redux-zero.min.js.map |
{ | ||
"name": "redux-zero", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "", | ||
"main": "dist/redux-zero.cjs.js", | ||
"jsnext:main": "dist/redux-zero.es.js", | ||
"module": "dist/redux-zero.es.js", | ||
"typings": "index.d.ts", | ||
"main": "dist/redux-zero.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
@@ -19,4 +17,3 @@ "compile": "tsc --pretty", | ||
"build:cjs": "cross-env NODE_ENV=cjs rollup --config", | ||
"build:es": "cross-env NODE_ENV=es rollup --config", | ||
"build": "npm run build:umd && npm run build:cjs && npm run build:es", | ||
"build": "npm run build:umd && npm run build:cjs", | ||
"prepublish": "npm run build" | ||
@@ -27,3 +24,3 @@ }, | ||
"dist", | ||
"typings" | ||
"react" | ||
], | ||
@@ -67,3 +64,3 @@ "license": "MIT", | ||
"rollup-plugin-commonjs": "8.2.1", | ||
"rollup-plugin-filesize": "^1.4.2", | ||
"rollup-plugin-filesize": "1.4.2", | ||
"rollup-plugin-node-resolve": "3.0.0", | ||
@@ -70,0 +67,0 @@ "rollup-plugin-peer-deps-external": "1.0.0", |
@@ -11,4 +11,2 @@ <h1 align="center"> | ||
![](http://img.badgesize.io/https://unpkg.com/redux-zero/dist/redux-zero.min.js?style=flat-square) | ||
![](http://img.badgesize.io/https://unpkg.com/redux-zero/dist/redux-zero.min.js?style=flat-square&compression=gzip) | ||
[![build](https://img.shields.io/travis/concretesolutions/redux-zero/master.svg?style=flat-square)](https://travis-ci.org/concretesolutions/redux-zero) | ||
@@ -44,3 +42,4 @@ [![npm](https://img.shields.io/npm/v/redux-zero.svg?style=flat-square)](https://www.npmjs.com/package/redux-zero) | ||
```js | ||
import { createStore, Provider, connect } from 'redux-zero' | ||
import createStore from "redux-zero" | ||
import { Provider, connect } from "redux-zero/react" | ||
``` | ||
@@ -51,3 +50,4 @@ | ||
```js | ||
const { createStore, Provider, connect } = require('redux-zero'); | ||
const createStore = require("redux-zero") | ||
const { Provider, connect } = require("redux-zero/react") | ||
``` | ||
@@ -59,8 +59,7 @@ | ||
<script src="https://unpkg.com/redux-zero/dist/redux-zero.min.js"></script> | ||
<script src="https://unpkg.com/redux-zero/react/index.min.js"></script> | ||
``` | ||
## Example | ||
Let's make an increment/decrement simple application with React: | ||
Let's make an increment/decrement simple application: | ||
First, create your store. This is where your application state will live: | ||
@@ -70,3 +69,3 @@ | ||
/* store.js */ | ||
import { createStore } from "redux-zero"; | ||
import createStore from "redux-zero"; | ||
@@ -103,3 +102,3 @@ const initialState = { count: 1 }; | ||
import React from "react"; | ||
import { connect } from "redux-zero"; | ||
import { connect } from "redux-zero/react"; | ||
@@ -127,3 +126,3 @@ import { increment, decrement } from "./actions"; | ||
import { render } from "react-dom"; | ||
import { Provider } from "redux-zero"; | ||
import { Provider } from "redux-zero/react"; | ||
@@ -149,4 +148,4 @@ import store from "./store"; | ||
## Roadmap | ||
- Extract 'connect' so that Redux Zero can be used with multiple frameworks | ||
- Add more use case examples (including unit tests) | ||
- Add (Provider, connect) to Preact | ||
@@ -153,0 +152,0 @@ ## Docs |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
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
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
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
30
31484
292
150
1