npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@skriptx2/jsmediaquery

v1.2.1

Published

**Description:** A lightweight and flexible library for managing CSS media queries programmatically. This utility simplifies responsive design by providing an easy-to-use API for detecting and reacting to viewport changes. Perfect for developers seekin

Downloads

299

Readme

Description:
A lightweight and flexible library for managing CSS media queries programmatically. This utility simplifies responsive design by providing an easy-to-use API for detecting and reacting to viewport changes. Perfect for developers seeking to streamline responsive UI development across projects.

Features:

  • Simplified media query detection with readable syntax.
  • Event listeners for media query changes.
  • Customizable breakpoints and support for complex query strings.
  • Lightweight with no external dependencies.
  • Compatible with modern browsers.

Use Cases:

  • Creating dynamic layouts that adapt to different screen sizes.
  • Managing responsive design logic in JavaScript/TypeScript applications.
  • Building reusable, breakpoint-aware components.

Get Started:
Include this library in your project to take control of your responsive design needs without writing repetitive CSS media query code.

Installation


npm install @skriptx2/jsmediaquery

Code Usage

import { MediaQuery } from "@skriptx2/jsmediaquery";

MediaQuery.sm(); // returns true if between 577px and 767px

MediaQuery.get(); // returns breakpoints

Examples

Alt text

Alt text

Alt text

To change the breakpoint


MediaQuery.set({sm:700}) // sets sm max breakpoint to 700px

Alt text

Full Usage


MediaQuery.xs(); // Extra small device
MediaQuery.gtxs(); //  Greater than extra small device
MediaQuery.ltsm(); // Less than small device
MediaQuery.sm(); // Small device
MediaQuery.gtsm(); // Greater than small device
MediaQuery.ltmd(); // Less than medium device
MediaQuery.md(); // Medium device
MediaQuery.gtmd(); // Greater than medium device
MediaQuery.ltlg(); // Less than large device
MediaQuery.lg(); // Large device
MediaQuery.gtlg(); // Greater than large device
MediaQuery.ltxl(); //  Less than extra large device
MediaQuery.xl(); //  Extra large device
MediaQuery.gtxl(); //  Greater than extra large device
MediaQuery.ltxxl(); //  Less than double extra large device
MediaQuery.xxl(); //  Double extra large device

MediaQuery.all(); // Returns all values
MediaQuery.set(); // Sets breakpoints
MediaQuery.get(); // Gets breakpoints
MediaQuery.innerWidth; // Gets window innerwidth

Contributions are welcome! 🎉