Changelog
All notable changes to this project will be documented in this file.
[4.0.0] - 2024-12-17
Breaking Changes
- Replace
qualityparameter withoutputSize: The confusing logarithmicqualityparameter has been replaced with an intuitiveoutputSizeparameter that specifies the exact output image dimensions in pixelsoutputSize: 0(default) — output matches the original selection sizeoutputSize: 512— always outputs 512x512px image- Migration: Remove
qualityfrom your config and useoutputSizeinstead
Added
- Add comprehensive Storybook documentation with API reference
- Add custom styling examples (GradientTheme, DarkTheme, MinimalLight)
- Add font inheritance documentation
- Add VitePress documentation site at hqcropper.dev
Fixed
- Fix race condition: Escape key listener now added after image loads
- Fix
canvas.toBlob()error handling with proper reject on failure
Changed
- Bundle size reduced by 7.2% (25.46 KB → 23.62 KB)
- Rename TypeScript types for clarity:
IConfig→ConfigurationOptionsIClassNames→ClassNamesIState→ApplicationState
- Replace random CSS class names with deterministic hash (stable sourcemaps, debuggable in production)
- Consolidate 4 resize handler CSS files into single parameterized function
- Simplify DOM cache implementation using Map
- Replace
getRandomString()with simple counter for listener IDs - Use modern
node.remove()instead of deprecatedremoveChild() - Improve TypeScript types for DOM cache with mapped element types
Removed
- Remove
src/utils.ts(unused after refactoring) - Remove 4 separate
getCssResize*Style.tsfiles (consolidated)
[3.3.0] - 2024-12-17
Added
- Add mobile device support with touch events (
touchstart,touchmove,touchend) - Add responsive layout for small screens (<540px)
- Add
touch-action: noneto prevent scroll during portal interactions - Increase resize handles touch target size (24px on mobile devices)
Fixed
- Fix viewport height issues on mobile with
100dvhandposition: fixed - Fix button clicks being blocked by
preventDefaultontouchend
[3.2.0] - 2024-12-13
Fixed
- Fix memory leak: state listeners now properly cleaned up on modal close
- Fix memory leak: DOM event listeners now properly removed on modal close
- Fix RESIZE_TL (top-left corner resize) using wrong variables
- Fix race condition:
canvas.remove()now called aftertoBlobcompletes - Fix MIME type format in canvas export
- Fix division by zero in
handleCropImagewhen frame dimensions are 0 - Fix potential infinity/NaN when quality config is <= 1
- Fix incorrect DOM element types in observers
- Fix magic number in
getPortalProps
Added
- Add
unsubscribe(id)method to remove specific listener by ID - Add
unsubscribeAll()method to clear all state listeners - Add
minPortalSizeconfig option (default: 50px) - Add
maxFileSizeconfig option (default: 0 = no limit) - Add
allowedTypesconfig option - Add file validation before processing
- Add
onErrorcallback parameter - Add
ErrorHandlertype export - Add FileReader and Image error handling
Changed
registerMouseEventsnow returns cleanup function- Observers now use DOM element caching for better performance
- Mousemove events now throttled via
requestAnimationFrame - Portal and preview props observers merged
- Add comprehensive Storybook stories
- Migrate from yarn to pnpm
[3.1.0] - Previous release
See GitHub releases for earlier changes.