Releases: Jackardios/react-class-variants
Releases · Jackardios/react-class-variants
v2.0.0-alpha.3
Bug Fixes
mergeProps utility improvements
- Preserve base
classNamewhen override is falsy (null,undefined, empty string) - Preserve base event handler when override is
nullorundefined - Only merge React event handlers (
onClick,onMouseDown, etc.) — props likeonboarding,ongoingare no longer incorrectly merged as event handlers
Full Changelog: v2.0.0-alpha.2...v2.0.0-alpha.3
v2.0.0-alpha.2
Performance Optimizations & Bug Fixes
Changes
- Performance: Optimize
variants()resolver by pre-computing boolean variants and caching variant names - Performance: Optimize compound variants loop (avoid function creation inside loop)
- Fix:
mergePropsclassName handling for undefined/empty values - DX: Add
displayNameto variant components for React DevTools - Refactor: Consolidate
Simplify/Prettifytypes into singleSimplifytype - Docs: Add JSDoc documentation for exported types and functions
- Tests: Comprehensive test suite rewrite (243 tests, 98.14% coverage)
Installation
npm install react-class-variants@alphav2.0.0-alpha.1
Minor Changes
-
a145ff8: Add advanced type utilities and improve type system
New Type Utilities:
ExtractVariantOptions<T>- Universal utility to extract variant props type from any variant function, resolver, or componentExtractVariantConfig<T>- Universal utility to extract full variant configuration from any variant function, resolver, or component- Enhanced internal type metadata with
__configproperty for better type extraction
Type System Improvements:
- Added
VariantsResolverFn<C, V>type with config metadata - Added
VariantPropsResolverFn<C, V>type with config metadata - Simplified
BaseVariantComponentPropsby removing intermediateOnlyVariantsConfigtype - Better type inference for variant configurations
Testing:
- Added 150+ lines of comprehensive type tests for new utilities
- Tests for
ExtractVariantOptionsandExtractVariantConfigworking withvariants(),variantPropsResolver(), andvariantComponent() - Improved edge case coverage
Documentation:
- Added detailed section on type utilities in README
- Examples for
ExtractVariantOptionsandExtractVariantConfig - Usage patterns for extracting types from variant functions and components
Developer Experience:
- Added
test:typesscript to package.json - Integrated type tests into CI pipeline
- Added Vitest coverage and UI tools for better testing experience