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

rcomps

v1.2.1

Published

Based on responsive-components from Philip Walton, as NPM Module

Downloads

17

Readme

ResponsiveComponents - rcomps

Based on the script by Philip Walton, here in form of an NPM plugin (https://philipwalton.com/articles/responsive-components-a-solution-to-the-container-queries-problem/). If you work with components you will often reach the limits with media queries. To increase reusability, however, you must be independent of the viewport. And this is exactly where container queries come into play.

Installation

npm i rcomps --save
yarn add rcomps --D

Usage

The simplest method is to mark the component with the tag data-observe-resizes.

<div data-observe-resizes>
  <div class="component">...</div>
</div>

<!-- Result -->
<div class="xs sm" data-observe-resizes>
  <div class="component">...</div>
</div>

In this case, the predefined breakpoints are used (xs: 320, sm: 560, m: 768, l: 960, xl: 1200). You can overwrite the breakpoints with a new object - important here is to specify the breakpoints in px.

rcomps({"break1": 500, "break2": 1000})

However, you are even more flexible if you can define breakpoints directly at the component. Nice side effect, you can also trigger utility classes (e.g. from tailwind) via the breakpoints.

<div class="wrapper" data-observe-resizes
     data-breakpoints='{"break1": 300, "break2": 600, "break3": 800, "break4": 1000}'>
  <div class="component">...</div>
</div>

<!-- Result -->
<div class="wrapper break1 break2 break3" data-observe-resizes
     data-breakpoints='{"break1": 300, "break2": 600, "break3": 800, "break4": 1000}'>
  <div class="component">...</div>
</div>

If you use utility classes, you can trigger them individually, depending on the breakpoint. Adding the data attribute data-utility adds only one class at a time. This avoids the order around CSS when it comes to overwriting the declarations.

<div class="wrapper"
     data-observe-resizes
     data-utility
     data-breakpoints='{"bg-green": 300, "bg-red": 600, "bg-blue": 800, "bg-yellow": 1000}'>
  <div class="component">...</div>
</div>

<!-- Result -->
<div class="wrapper bg-blue" 
     data-utility
     data-observe-resizes
     data-breakpoints='{"bg-green": 300, "bg-red": 600, "bg-blue": 800, "bg-yellow": 1000}'>
  <div class="component">...</div>
</div>

Browser Support

  • Firefox 50+
  • Chrome
  • Internet Explorer 10+
  • Edge
  • Safari Desktop 10+
  • Safari Mobile

License

MIT

Thanks

To Philip Walton @philipwalton