Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "concave", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Basic lensing for React", | ||
"main": "build/index.js", | ||
"types": "build/index.d.ts", | ||
"main": "dist/concave.umd.js", | ||
"module": "dist/concave.es.js", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/concave.es.js", | ||
"require": "./dist/concave.umd.js" | ||
} | ||
}, | ||
"author": "Gabe Scholz", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"files": [ | ||
"dist" | ||
], | ||
"keywords": [ | ||
@@ -13,3 +24,5 @@ "react", | ||
"optics", | ||
"state" | ||
"state", | ||
"state-management", | ||
"store" | ||
], | ||
@@ -22,7 +35,9 @@ "repository": { | ||
"test": "jest", | ||
"build": "rm -rf build && tsc", | ||
"prepublish": "yarn test && yarn build" | ||
"typecheck": "tsc --noEmit", | ||
"build": "rm -rf dist && vite build", | ||
"prepublish": "yarn test && yarn typecheck && yarn build" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.3.0", | ||
"@testing-library/react": "^13.0.0-alpha.5", | ||
@@ -36,8 +51,10 @@ "@types/jest": "^27.0.3", | ||
"ts-jest": "^27.0.7", | ||
"typescript": "^4.5.2" | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.5.2", | ||
"vite": "^2.7.2" | ||
}, | ||
"peerDependencies": { | ||
"react": "^18", | ||
"react-dom": "^18" | ||
"react": "^18.0.0-rc.0", | ||
"react-dom": "^18.0.0-rc.0" | ||
} | ||
} |
@@ -12,10 +12,8 @@ # Lenses in React | ||
import { create } from "react-lenses"; | ||
import Concave from "concave"; | ||
import type { State } from "./application-state"; | ||
export const { lens, LensProvider } = create<State>(); | ||
export const [lens, LensProvider] = Concave.stateless<State>(); | ||
``` | ||
The lens itself is provided via a `children` function to `LensProvider`. | ||
```tsx | ||
@@ -42,3 +40,3 @@ // App.tsx | ||
import { Lens } from "react-lenses"; | ||
import { Lens } from "concave"; | ||
import type { State } from "./application-state"; | ||
@@ -60,2 +58,3 @@ import { Profile } from "./Profile"; | ||
// Profile.tsx | ||
import { Lens } from "concave"; | ||
@@ -67,6 +66,12 @@ type Props = { | ||
const Profile = (props: Props) => { | ||
const [profile, updateProfile] = props.state.use(); | ||
const [name, updateProfileName] = props.state.name.use(); | ||
const [email, updateProfileEmail] = props.state.email.use(); | ||
return <input type="text" value={profile.name} onChange={(ev) => updateProfile(() => ev.target.value)} />; | ||
return ( | ||
<> | ||
<input type="text" value={name} onChange={(ev) => updateProfileName(() => ev.target.value)} /> | ||
<input type="email" value={email} onChange={(ev) => updateProfileEmail(() => ev.target.value)} /> | ||
</> | ||
); | ||
}; | ||
``` |
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
74
28374
12
15
432
3
1