Comparing version 1.0.0 to 1.0.1
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 1.0.1 | ||
* Better tree-shaking of React/Preact. | ||
* Fix docs (by Johannes Kronmüller). | ||
## 1.0 | ||
@@ -5,0 +9,0 @@ * Add ES modules support. |
{ | ||
"name": "storeon", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Tiny (175 bytes) event-based Redux-like state manager for React and Preact", | ||
@@ -23,3 +23,41 @@ "keywords": [ | ||
"main": "index.cjs", | ||
"module": "index.js" | ||
"module": "index.js", | ||
"exports": { | ||
".": { | ||
"require": "./index.cjs", | ||
"import": "./index.js" | ||
}, | ||
"./devtools": { | ||
"require": "./devtools/index.cjs", | ||
"import": "./devtools/index.js" | ||
}, | ||
"./preact": { | ||
"require": "./preact/index.cjs", | ||
"import": "./preact/index.js" | ||
}, | ||
"./react": { | ||
"require": "./react/index.cjs", | ||
"import": "./react/index.js" | ||
}, | ||
"./devtools/logger": { | ||
"require": "./devtools/logger/index.cjs", | ||
"import": "./devtools/logger/index.js" | ||
}, | ||
"./preact/connect": { | ||
"require": "./preact/connect/index.cjs", | ||
"import": "./preact/connect/index.js" | ||
}, | ||
"./preact/context": { | ||
"require": "./preact/context/index.cjs", | ||
"import": "./preact/context/index.js" | ||
}, | ||
"./react/connect": { | ||
"require": "./react/connect/index.cjs", | ||
"import": "./react/connect/index.js" | ||
}, | ||
"./react/context": { | ||
"require": "./react/context/index.cjs", | ||
"import": "./react/context/index.js" | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import Preact from 'preact' | ||
import { h } from 'preact' | ||
@@ -9,4 +9,4 @@ import useStoreon from '../index.js' | ||
let props = { ...originProps, ...useStoreon(...keys) } | ||
return Preact.h(Component, props) | ||
return h(Component, props) | ||
} | ||
} |
@@ -1,3 +0,3 @@ | ||
import Preact from 'preact' | ||
import { createContext } from 'preact' | ||
export default Preact.createContext() | ||
export default createContext() |
@@ -1,2 +0,4 @@ | ||
import hooks from 'preact/hooks' | ||
import { | ||
useMemo, useContext, useState, useLayoutEffect, useEffect | ||
} from 'preact/hooks' | ||
@@ -6,6 +8,6 @@ import StoreContext from './context/index.js' | ||
let useIsomorphicLayoutEffect = | ||
typeof window !== 'undefined' ? hooks.useLayoutEffect : hooks.useEffect | ||
typeof window !== 'undefined' ? useLayoutEffect : useEffect | ||
export default (...keys) => { | ||
let store = hooks.useContext(StoreContext) | ||
let store = useContext(StoreContext) | ||
if (process.env.NODE_ENV !== 'production' && !store) { | ||
@@ -18,3 +20,3 @@ throw new Error( | ||
let rerender = hooks.useState({ }) | ||
let rerender = useState({ }) | ||
@@ -28,3 +30,3 @@ useIsomorphicLayoutEffect(() => { | ||
return hooks.useMemo(() => { | ||
return useMemo(() => { | ||
let state = store.get() | ||
@@ -31,0 +33,0 @@ let data = { } |
@@ -1,2 +0,2 @@ | ||
import React from 'react' | ||
import { createElement } from 'react' | ||
@@ -9,4 +9,4 @@ import useStoreon from '../index.js' | ||
let props = { ...originProps, ...useStoreon(...keys) } | ||
return React.createElement(Component, props) | ||
return createElement(Component, props) | ||
} | ||
} |
@@ -1,3 +0,3 @@ | ||
import React from 'react' | ||
import { createContext } from 'react' | ||
export default React.createContext() | ||
export default createContext() |
@@ -1,2 +0,4 @@ | ||
import React from 'react' | ||
import { | ||
useMemo, useContext, useState, useLayoutEffect, useEffect | ||
} from 'react' | ||
@@ -6,6 +8,6 @@ import StoreContext from './context/index.js' | ||
let useIsomorphicLayoutEffect = | ||
typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect | ||
typeof window !== 'undefined' ? useLayoutEffect : useEffect | ||
export default (...keys) => { | ||
let store = React.useContext(StoreContext) | ||
let store = useContext(StoreContext) | ||
if (process.env.NODE_ENV !== 'production' && !store) { | ||
@@ -18,3 +20,3 @@ throw new Error( | ||
let rerender = React.useState({ }) | ||
let rerender = useState({ }) | ||
@@ -28,3 +30,3 @@ useIsomorphicLayoutEffect(() => { | ||
return React.useMemo(() => { | ||
return useMemo(() => { | ||
let state = store.get() | ||
@@ -31,0 +33,0 @@ let data = { } |
@@ -98,3 +98,4 @@ # Storeon | ||
```js | ||
Object.assign = require('object-assign') | ||
import assign from 'object-assign' | ||
Object.assign = assign | ||
``` | ||
@@ -260,5 +261,7 @@ | ||
```js | ||
import devtools from 'storeon/devtools'; | ||
const store = createStore([ | ||
… | ||
process.env.NODE_ENV !== 'production' && require('storeon/devtools') | ||
process.env.NODE_ENV !== 'production' && devtools | ||
]) | ||
@@ -274,5 +277,7 @@ ``` | ||
```js | ||
import logger from 'storeon/devtools/logger'; | ||
const store = createStore([ | ||
… | ||
process.env.NODE_ENV !== 'production' && require('storeon/devtools/logger') | ||
process.env.NODE_ENV !== 'production' && logger | ||
]) | ||
@@ -279,0 +284,0 @@ ``` |
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
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
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
35096
646
383
0