Skip to content

v5.1.0

Latest

Choose a tag to compare

@Ayc0 Ayc0 released this 06 Jun 09:14
· 15 commits to main since this release

What's Changed

Deprecations, will be removed in the next major

  • MediaRangesProvider and MediaRangesContext β€” use createMediaRanges instead (#187)
  • The as prop on the top-level Only (#187) β€” wrap children in the element you need, or use createMediaRanges's Only
  • The "breakpoint"-named aliases kept for backward compatibility after the rename (#181):
    • exports: useBreakpoint, BreakpointsProvider, BreakpointsContext
    • props on BreakpointsProvider: breakpoints, additionalBreakpoints

Customer facing

  • Add createMediaRanges + DEFAULT_MEDIA_RANGES, a strongly-typed alternative to MediaRangesProvider (#187)
    • createMediaRanges(ranges) returns a { useMediaRange, Only } pair bound to the ranges you pass in β€” no React context, no additionalMediaRanges vs mediaRanges split
    • The returned useMediaRange / Only validate the on string end-to-end: every space-separated token must match a declared range or its auto-generated Up / Down alias. Invalid input surfaces a readable TypeScript error like Invalid media ranges: foo bar instead of never
    • The returned Only only forwards children β€” as and arbitrary forwarded props are not supported; wrap your children in whatever element you need
    • Spread DEFAULT_MEDIA_RANGES when you want to keep the defaults (xs, sm, md, lg, xl)
  • Rename "breakpoint" to "media range" across the library, tests and documentation to better reflect that each name describes a range between two breakpoints rather than a single breakpoint (#181)
    • New exports: useMediaRange, MediaRangesProvider, MediaRangesContext
    • New props on MediaRangesProvider: mediaRanges, additionalMediaRanges
    • Previous exports are kept but deprecated

Internal

  • Migrate from yarn to pnpm (#200)
  • Replace eslint & prettier by oxlint & oxfmt (#197)
  • Replace jest & jest-dom & puppeteer & parcel with vite + vitest + playwright (#201 & #203)
  • Update README.md (#207)

Full Changelog: v5.0.0...v5.1.0