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

@nycopportunity/pttrn-scripts

v1.1.1

Published

A set of common utility ES modules to help keep scripting DRY and support accessibility

Downloads

64

Readme

Patterns Scripts

A set of common utility ES modules to help keep scripting DRY and support accessibility. Used along with @nycopportunity/pttrn-cli projects.

Installation

$ npm install @nycopportunity/pttrn-scripts

Import ES modules from the source.

import '@nycopportunity/pttrn-scripts/src/{{ module }}/{{ module }}'

new {{ Module }}();

In most cases implementation is done by adding a data-js attribute to the appropriate element. Configuration is often handled through other data and aria attributes but advanced customization can also be achieved by setting module properties pre or post instantiation. Where utilities are listening to click events the listeners are added to the body and trigger the script when the click target selector matches the utility settings.

<{{ element }} data-js="{{ script }}"> My script enhanced element </{{ element }}>

Some utilities support scripting only and do not have HTML counterparts. See documentation for more details.

Docs

  • Copy - A wrapper around the Navigator Clipboard API that creates a click to copy to clipboard button
  • Dialog - A utility for creating modal or non-modal dialogs
  • Direction - A utility for setting the reading direction of the document and saves the user preference to local storage
  • Forms - Form validation and other form utilities
  • Google Translate Element - Custom Google Translate Selector
  • Icons - Fetches an svg sprite and adds it to the DOM
  • Localize - Retrieve localized strings from a global constant
  • LZW - Compression algorithm for encoding strings of data
  • Newsletter - Enhances an embedded Mailchimp form with validation
  • Observe - A wrapper around the Intersection Observer API that creates an scroll watch on a scrollable element
  • Spinner - Generic process or loading spinner animation
  • Themes - A CSS theme cycling utility that toggles the document classname and saves the user preference to local storage
  • Toggle - Multi-purpose element visibility toggle
  • Tooltips - An accessible tooltip toggle and positioning
  • Track - Auto click tracking for Google Analytics and Webtrends
  • Web Share - A wrapper around the Navigator Share API that creates a web sharing button
  • Window Vh - Sets the CSS Custom Property --100vh to the viewport's true height as a workaround for iOS 100vh value