@storeon/solidjs
Advanced tools
Comparing version 2.0.0 to 3.0.0
15
index.js
import { | ||
reconcile, | ||
createState, | ||
createContext, | ||
@@ -9,6 +7,7 @@ useContext, | ||
} from 'solid-js' | ||
import { createStore, reconcile } from 'solid-js/store' | ||
const StoreContext = createContext() | ||
function StoreonProvider (props) { | ||
export function StoreonProvider (props) { | ||
if (process.env.NODE_ENV !== 'production' && !props.store) { | ||
@@ -22,5 +21,5 @@ throw new Error( | ||
let [state, setState] = createState(props.store.get()) | ||
let [state, setState] = createStore(props.store.get()) | ||
let undind = props.store.on('@changed', (_, changed) => { | ||
let unbind = props.store.on('@changed', (_, changed) => { | ||
Object.keys(changed).forEach(key => { | ||
@@ -30,3 +29,3 @@ setState(key, reconcile(changed[key])) | ||
}) | ||
onCleanup(() => undind()) | ||
onCleanup(() => unbind()) | ||
@@ -39,3 +38,3 @@ return createComponent(StoreContext.Provider, { | ||
function useStoreon () { | ||
export function useStoreon () { | ||
let store = useContext(StoreContext) | ||
@@ -52,3 +51,1 @@ | ||
} | ||
export { StoreonProvider, useStoreon } |
{ | ||
"name": "@storeon/solidjs", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "A tiny connector for Storeon and Solid.js", | ||
"main": "index.cjs", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
@@ -12,4 +12,9 @@ "repository": "git@github.com:storeon/solidjs.git", | ||
"sideEffects": false, | ||
"type": "module", | ||
"exports": { | ||
"require": "./index.cjs", | ||
"import": "./index.js" | ||
}, | ||
"engines": { | ||
"node": ">=10" | ||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0" | ||
}, | ||
@@ -26,18 +31,56 @@ "files": [ | ||
], | ||
"scripts": { | ||
"start": "parcel serve example/index.html --open", | ||
"lint": "eslint ./*.js", | ||
"test": "node --experimental-vm-modules node_modules/.bin/jest --coverage && yarn lint && size-limit", | ||
"publish": "dual-publish" | ||
}, | ||
"peerDependencies": { | ||
"solid-js": "^0.22.0", | ||
"solid-js": "^1.0.0", | ||
"storeon": "^3.0.0" | ||
}, | ||
"type": "module", | ||
"module": "index.js", | ||
"react-native": "index.js", | ||
"exports": { | ||
".": { | ||
"require": "./index.cjs", | ||
"import": "./index.js", | ||
"types": "index.d.ts" | ||
}, | ||
"./package.json": "./package.json", | ||
"index.d.ts": "index.d.ts" | ||
"devDependencies": { | ||
"@babel/cli": "^7.15.7", | ||
"@babel/core": "^7.15.8", | ||
"@babel/preset-env": "^7.15.8", | ||
"@logux/eslint-config": "^46.0.0", | ||
"@size-limit/dual-publish": "^6.0.3", | ||
"@size-limit/preset-small-lib": "^6.0.3", | ||
"@testing-library/jest-dom": "^5.14.1", | ||
"babel-preset-solid": "^1.1.7", | ||
"dual-publish": "^2.0.2", | ||
"eslint": "^8.1.0", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.25.2", | ||
"eslint-plugin-jest": "^25.2.2", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prefer-let": "^1.1.0", | ||
"eslint-plugin-promise": "^5.1.1", | ||
"eslint-plugin-security": "^1.4.0", | ||
"eslint-plugin-unicorn": "^37.0.1", | ||
"jest": "^27.3.1", | ||
"size-limit": "^6.0.3", | ||
"solid-jest": "^0.2.0", | ||
"solid-js": "^1.1.7", | ||
"solid-testing-library": "^0.2.1", | ||
"storeon": "^3.1.4" | ||
}, | ||
"size-limit": [ | ||
{ | ||
"name": "core", | ||
"import": { | ||
"index.js": "{ StoreonProvider, useStoreon }" | ||
}, | ||
"limit": "200 B", | ||
"ignore": [ | ||
"solid-js" | ||
] | ||
} | ||
], | ||
"eslintConfig": { | ||
"extends": "@logux/eslint-config" | ||
}, | ||
"jest": { | ||
"preset": "solid-jest/preset/browser" | ||
} | ||
} | ||
} |
@@ -10,3 +10,3 @@ # Storeon Solid.js | ||
- **Size**. 172 bytes (+ Storeon itself) instead of ~3kB of Redux (minified and gzipped). | ||
- **Size**. 200 bytes (+ Storeon itself) instead of ~3kB of Redux (minified and gzipped). | ||
- **Ecosystem**. Many additional [tools] can be combined with a store. | ||
@@ -13,0 +13,0 @@ - **Speed**. It tracks what parts of state were changed and re-renders only components based on the changes. |
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
7433
3
24
6
44