Releases: Ayc0/mock-match-media
Releases · Ayc0/mock-match-media
v1.0.3
v1.0.2
v1.0.1
What's Changed
Removes the necessity to add this for JSDOM (see bloczjs/react-responsive@8856834 for example):
import { TextEncoder } from "node:util";
Object.assign(globalThis, { TextEncoder });Full Changelog: v1.0.0...v1.0.1
v1.0.0
What's Changed
Breaking changes
- Update node versions to 20, 22, 23, 24,
- Update internal library from
css-mediaquerytomedia-query-fnsto support CSS media queries level 5 (queries like@media (width < 150px)).- Update
height,width,deviceHeightanddeviceWidthinsetMediato be numbers instead of strings (see #41) - Change to
setMediafeature from kebab-case to camelCase (see #35) - Minor breaking change: the default value of
height,width,deviceHeightanddeviceWidthis now0instead ofundefined, aspectRatiocan‘t be set anymore, instead it’s now derived fromheight&width(same fordeviceAspectRatio),
- Update
Before in v0:
setMedia({
"prefers-color-scheme": "dark",
"width": "15px",
"aspect-ratio": "1",
});After in v1:
setMedia({
prefersColorScheme: "dark",
width: 15,
height: 15,
});For JSDOM environments (like for Jest), you may also need to add this:
import { TextEncoder } from "node:util";
Object.assign(globalThis, { TextEncoder });Other changes
- Fully build dependency to dual ship CJS & ESM (see #58),
- Add a
polyfill.d.ts&jest-setup.d.tsin theexportsfield (see #57),
Internal changes
Full Changelog: v0.4.3...v1.0.0
v1.0.0-alpha.5
v1.0.0-alpha.4
What's Changed
Full Changelog: v1.0.0-alpha.3...v1.0.0-alpha.4
v1.0.0-alpha.3
v1.0.0-alpha.2
v1.0.0-alpha.1
What's Changed
- [BREAKING CHANGE] update supported node versions to 18, 20, 22, 23, and 24 by @Ayc0 in #40
- [BREAKING CHANGE] Update
height,width,deviceHeightanddeviceWidthinsetMediato be numbers instead of strings by @Ayc0 in #41 - [BREAKING CHANGES] drop node 18.x to support ESM by @Ayc0 in #42
- [BREAKING CHANGES] Supports CSS media queries level 5 + change to setMedia feature from kebab-case to camelCase by @Ayc0 in #35
- [BREAKING CHANGE] Make device-width & device-height respond to width & height * dppx by @Ayc0 in #48
Internal changes:
- add tests for media-type by @Ayc0 in #44
- add tests for prefers-color-scheme by @Ayc0 in #45
- Update all deps by @Ayc0 in #49
Full Changelog: v0.4.3...v1.0.0-alpha.1