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

@frankhoodbs/breakpoints

v2.2.4

Published

Simple utility to handle breakpoints responsiveness

Downloads

480

Readme

Vue Breakpoints Utility

A Vue 3 utility that offers a streamlined interface for working with CSS breakpoints, leveraging CSS custom properties (or CSS variables) defined within the :root selector. This utility taps into the css-custom-properties-list dependency to extract the custom properties and provides handy methods to manage media queries within Vue.

Key Features

  1. Automatic Breakpoint Extraction: Identifies and handles breakpoints straight from CSS custom properties.
  2. Vue Integration: Harnesses Vue's reactivity to provide real-time information about the current breakpoints and media query utilities.
  3. Prefix Support: Supports custom prefixes for breakpoint variable names.

Version License

Usage

To get started, first import and initialize the Breakpoints class:

import { Breakpoints } from '@your-package/vue-breakpoints-utility';

const breakpointsUtility = new Breakpoints(document.documentElement, document.styleSheets);

Accessing the Current Breakpoint

You can easily get the current active breakpoint:

console.log(breakpointsUtility.currentBreakpoint.value); // e.g. 'md'

Utility Methods for Media Queries

The utility offers a range of methods designed to facilitate media query management. Here are some of the most common uses:

  1. And Up - Returns true if the viewport width is at or above the specified breakpoint:
if (breakpointsUtility.utilityMethods.mdAndUp.value) {
  // Code for medium devices and above
}
  1. And Down - Returns true if the viewport width is at or below the specified breakpoint:
if (breakpointsUtility.utilityMethods.lgAndDown.value) {
  // Code for large devices and below
}
  1. Only - Returns true only for the specific breakpoint:
if (breakpointsUtility.utilityMethods.lgOnly.value) {
  // Code exclusive to large devices
}

These utilities harness Vue's reactivity, ensuring your UI or logic adapts in real-time to viewport changes. This should give a comprehensive guide on the utility's usage, including the main methods that were mentioned in the code.

Dependencies

  • @vueuse/core: Used for harnessing the reactivity of Vue 3.
  • @frankhoodbs/css-custom-properties-list: Employed to extract CSS custom properties.