Releases: aml2610/react-painter
Releases · aml2610/react-painter
v1.0.1
v1.0.0
What's Changed
New hooks API
usePainterhook — all canvas painting logic extracted into a standalone hook. This is the recommended API for new code:import { usePainter } from 'react-painter'; const Drawable = () => { const { canvas, triggerSave, setColor } = usePainter({ width: 300, height: 300, onSave: blob => console.log(blob), }); return <div>{canvas}</div>; };
ReactPainterrender prop still works — it's now a thin wrapper aroundusePainter, so existing code is unaffected.
Breaking changes
- React peer dependency bumped to
>=16.8.0(from>=0.14.x) — hooks require React 16.8+. If you're on an older React, stay on 0.5.0.
v0.5.0
What's Changed
Modernized build & tooling
- TypeScript 5 + strict mode — upgraded from TS 2.8, enabled
strict,react-jsxtransform,bundlermodule resolution - tsup — replaced Babel/tsc with tsup for dual ESM + CJS output with
.d.tsdeclarations - ESLint — replaced deprecated tslint with
@typescript-eslint/eslint-plugin - Vitest — replaced Jest + canvas-prebuilt with Vitest + jsdom + jest-canvas-mock; expanded test coverage to 20 tests
- Vite demo — replaced Storybook with a lightweight Vite demo app, deployed to GitHub Pages
Breaking changes
- Dropped
prop-typespeer dependency — TypeScript types provide the same safety at compile time with zero runtime cost. If you relied on runtime prop validation, this is removed.
Package exports
{
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}Validated with publint and @arethetypeswrong/cli.
Improve code readability
- modularise helpers & keep ReactPainter component lightweight
- document less clear code paths
- integrate prettier for code formatting
- fix image link for story with image (for testing only)
- fix typos in README
Fix touch
Bug fix
Change ownership
Ownership of the library has changed.
Build and release process have been improved a bit.
Performance Improvement
Utilize createImageBitmap (if supported by browser) to improve performance.
Fix README not rendered correctly in npm
Fix README
Version 0.3.0
Use render prop object properties to set the line prop e.g. color, lineJoin, and lineCap.
Prop is currently set initialValues of the line prop only.