@solid-primitives/media
Advanced tools
Comparing version
@@ -44,4 +44,3 @@ import { isServer } from 'solid-js/web'; | ||
); | ||
if (isServer || !window.matchMedia) | ||
return fallback; | ||
if (isServer || !window.matchMedia) return fallback; | ||
const { mediaFeature = "min-width", watchChange = true } = options; | ||
@@ -48,0 +47,0 @@ const [matches, setMatches] = createHydratableStaticStore(fallback, () => { |
{ | ||
"name": "@solid-primitives/media", | ||
"version": "2.2.9", | ||
"version": "2.2.10", | ||
"description": "Primitives for media query and device features", | ||
@@ -52,2 +52,3 @@ "author": "David Di Biase <dave.dibiase@gmail.com>", | ||
"exports": { | ||
"@solid-primitives/source": "./src/index.ts", | ||
"import": { | ||
@@ -63,6 +64,6 @@ "types": "./dist/index.d.ts", | ||
"dependencies": { | ||
"@solid-primitives/event-listener": "^2.3.3", | ||
"@solid-primitives/rootless": "^1.4.5", | ||
"@solid-primitives/event-listener": "^2.3.3", | ||
"@solid-primitives/utils": "^6.2.3", | ||
"@solid-primitives/static-store": "^0.0.8" | ||
"@solid-primitives/static-store": "^0.0.9", | ||
"@solid-primitives/utils": "^6.2.3" | ||
}, | ||
@@ -69,0 +70,0 @@ "peerDependencies": { |
@@ -14,6 +14,6 @@ <p> | ||
- [`makeMediaQueryListener`](#makeMediaQueryListener) - Listen for changes to provided Media Query. | ||
- [`createMediaQuery`](#createMediaQuery) - Creates a very simple and straightforward media query monitor. | ||
- [`createBreakpoints`](#createBreakpoints) - Creates a multi-breakpoint monitor to make responsive components easily. | ||
- [`createPrefersDark`](#createPrefersDark) - Provides a signal indicating if the user has requested dark color theme. | ||
- [`makeMediaQueryListener`](#makemediaquerylistener) - Listen for changes to provided Media Query. | ||
- [`createMediaQuery`](#createmediaquery) - Creates a very simple and straightforward media query monitor. | ||
- [`createBreakpoints`](#createbreakpoints) - Creates a multi-breakpoint monitor to make responsive components easily. | ||
- [`createPrefersDark`](#createprefersdark) - Provides a signal indicating if the user has requested dark color theme. | ||
@@ -205,2 +205,3 @@ ## Installation | ||
## Notes | ||
### iOS 13 Support & Deprecated `addListener` | ||
@@ -211,11 +212,12 @@ | ||
```ts | ||
if (!'addEventListener' in MediaQueryList) { | ||
MediaQueryList.prototype.addEventListener = function(type, callback) { | ||
if (type === "change") this.addListener(callback) | ||
} | ||
MediaQueryList.prototype.removeEventListener = function(type, callback) { | ||
if (type === "change") this.removeListener(callback) | ||
} | ||
if ((!"addEventListener") in MediaQueryList) { | ||
MediaQueryList.prototype.addEventListener = function (type, callback) { | ||
if (type === "change") this.addListener(callback); | ||
}; | ||
MediaQueryList.prototype.removeEventListener = function (type, callback) { | ||
if (type === "change") this.removeListener(callback); | ||
}; | ||
} | ||
``` | ||
## Changelog | ||
@@ -228,2 +230,1 @@ | ||
Thanks to Aditya Agarwal for contributing createBreakpoints. | ||
Sorry, the diff of this file is not supported yet
23613
0.22%227
0.44%245
-0.81%+ Added
- Removed