Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solid-primitives/media

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/media - npm Package Compare versions

Comparing version 2.1.3-beta.0 to 2.1.3

37

dist/index.d.ts

@@ -1,2 +0,2 @@

import { Accessor } from "solid-js";
import { Accessor } from 'solid-js';

@@ -15,6 +15,3 @@ /**

*/
declare function makeMediaQueryListener(
query: string | MediaQueryList,
callback: (e: MediaQueryListEvent) => void,
): VoidFunction;
declare function makeMediaQueryListener(query: string | MediaQueryList, callback: (e: MediaQueryListEvent) => void): VoidFunction;
/**

@@ -62,11 +59,11 @@ * Creates a very simple and straightforward media query monitor.

type Matches<T extends Breakpoints> = {
readonly [K in keyof T]: boolean;
readonly [K in keyof T]: boolean;
};
interface BreakpointOptions<T extends Breakpoints> {
/** If true watches changes and reports state reactively */
watchChange?: boolean;
/** Default value of `match` when `window.matchMedia` is not available like during SSR & legacy browsers */
fallbackState?: Matches<T>;
/** Use `min-width` media query for mobile first or `max-width` for desktop first. Defaults to `min-width` */
mediaFeature?: string;
/** If true watches changes and reports state reactively */
watchChange?: boolean;
/** Default value of `match` when `window.matchMedia` is not available like during SSR & legacy browsers */
fallbackState?: Matches<T>;
/** Use `min-width` media query for mobile first or `max-width` for desktop first. Defaults to `min-width` */
mediaFeature?: string;
}

@@ -91,16 +88,4 @@ /**

*/
declare function createBreakpoints<T extends Breakpoints>(
breakpoints: T,
options?: BreakpointOptions<T>,
): Matches<T>;
declare function createBreakpoints<T extends Breakpoints>(breakpoints: T, options?: BreakpointOptions<T>): Matches<T>;
export {
BreakpointOptions,
Breakpoints,
Matches,
createBreakpoints,
createMediaQuery,
createPrefersDark,
makeMediaQueryListener,
usePrefersDark,
};
export { BreakpointOptions, Breakpoints, Matches, createBreakpoints, createMediaQuery, createPrefersDark, makeMediaQueryListener, usePrefersDark };

@@ -1,5 +0,5 @@

import { sharedConfig } from "solid-js";
import { makeEventListener } from "@solid-primitives/event-listener";
import { createHydrateSignal, createStaticStore, entries } from "@solid-primitives/utils";
import { createSharedRoot } from "@solid-primitives/rootless";
import { sharedConfig } from 'solid-js';
import { makeEventListener } from '@solid-primitives/event-listener';
import { createHydrateSignal, createStaticStore, entries } from '@solid-primitives/utils';
import { createSharedRoot } from '@solid-primitives/rootless';

@@ -21,7 +21,9 @@ // src/index.ts

}
var sharedPrefersDark = /* @__PURE__ */ createSharedRoot(createPrefersDark.bind(void 0, false));
var usePrefersDark = () => (sharedConfig.context ? createPrefersDark() : sharedPrefersDark());
var getEmptyMatchesFromBreakpoints = breakpoints => {
var sharedPrefersDark = /* @__PURE__ */ createSharedRoot(
createPrefersDark.bind(void 0, false)
);
var usePrefersDark = () => sharedConfig.context ? createPrefersDark() : sharedPrefersDark();
var getEmptyMatchesFromBreakpoints = (breakpoints) => {
const matches = {};
entries(breakpoints).forEach(([key]) => (matches[key] = false));
entries(breakpoints).forEach(([key]) => matches[key] = false);
return matches;

@@ -39,6 +41,7 @@ };

matches2[token] = mql.matches;
if (watchChange) makeEventListener(mql, "change", e => setMatches(token, e.matches));
if (watchChange)
makeEventListener(mql, "change", (e) => setMatches(token, e.matches));
});
return matches2;
})(),
})()
);

@@ -48,8 +51,2 @@ return matches;

export {
createBreakpoints,
createMediaQuery,
createPrefersDark,
makeMediaQueryListener,
usePrefersDark,
};
export { createBreakpoints, createMediaQuery, createPrefersDark, makeMediaQueryListener, usePrefersDark };

@@ -1,5 +0,5 @@

import "solid-js";
import "@solid-primitives/event-listener";
import { noop, entries } from "@solid-primitives/utils";
import { createSharedRoot } from "@solid-primitives/rootless";
import 'solid-js';
import '@solid-primitives/event-listener';
import { noop, entries } from '@solid-primitives/utils';
import { createSharedRoot } from '@solid-primitives/rootless';

@@ -20,7 +20,9 @@ // src/index.ts

}
/* @__PURE__ */ createSharedRoot(createPrefersDark.bind(void 0, false));
var usePrefersDark = () => () => false;
var getEmptyMatchesFromBreakpoints = breakpoints => {
/* @__PURE__ */ createSharedRoot(
createPrefersDark.bind(void 0, false)
);
var usePrefersDark = () => () => false ;
var getEmptyMatchesFromBreakpoints = (breakpoints) => {
const matches = {};
entries(breakpoints).forEach(([key]) => (matches[key] = false));
entries(breakpoints).forEach(([key]) => matches[key] = false);
return matches;

@@ -32,8 +34,2 @@ };

export {
createBreakpoints,
createMediaQuery,
createPrefersDark,
makeMediaQueryListener,
usePrefersDark,
};
export { createBreakpoints, createMediaQuery, createPrefersDark, makeMediaQueryListener, usePrefersDark };
{
"name": "@solid-primitives/media",
"version": "2.1.3-beta.0",
"version": "2.1.3",
"description": "Primitives for media query and device features",

@@ -90,5 +90,5 @@ "author": "David Di Biase <dave.dibiase@gmail.com>",

"dependencies": {
"@solid-primitives/event-listener": "^2.2.8-beta.0",
"@solid-primitives/rootless": "^1.2.6-beta.0",
"@solid-primitives/utils": "^5.4.0-beta.0"
"@solid-primitives/event-listener": "^2.2.8",
"@solid-primitives/rootless": "^1.2.6",
"@solid-primitives/utils": "^5.4.0"
},

@@ -95,0 +95,0 @@ "peerDependencies": {

@@ -0,0 +0,0 @@ <p>

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc