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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vanilla-pattern-lock

v0.3.0

Published

Pattern lock lib written in vanilla JS

Readme

vanilla-pattern-lock

npm npm version

Android like pattern unlock.

Features

  • Converts pattern to number
  • Vanilla JS - no external libs required
  • Support for touch devices
  • Small size (less than 10KB)
  • TS typings

pattern-lock2-ffmpg

Demo

https://maxwroc.github.io/vanilla-pattern-lock/

Usage

const lock = new PatternLock({ 
    vibrate: true // whether to vibrate on dot/node selection (mobile devices)
});

lock
  .render(document.getElementById("lockContainer"))
  .on("complete", pattern => { // triggers when user stops swiping
      if (pattern == 12345) {
          lock.success(); // green markers
      }
      else {
          lock.failure(); // red markers
          setTimeout(() => {
              lock.clear();
          }, 2000);
      }
  })

Documentation

Methods

| Method interface | Return value | Description | |:-----|:-----|:-----| | render(container: Element) | PatternLock | Renders pattern lock SVG elementcontainer - Element in which SVG will be rendered | clear() | PatternLock | Clears existing selection and resets internal state | getPattern() | number | Returns current pattern | success() | PatternLock | Shows success markers/indicators | failure() | PatternLock | Shows failure markers/indicators

Event related methods

| Method interface | Return value | Description | |:-----|:-----|:-----| | on(name: string, func: Function) | PatternLock | Sets handler for an event (for handler interface look below) | off(name: string, func: Function) | PatternLock | Removes handler for an event

Events

| Event name | Handler interface | Description | |:-----|:-----|:-----| | complete | (pattern: number): void | Fired when user finished entering pattern | select | (index: number, elem: Element): void | Fired when the dot/node is selected.index - Index of the dot/nodeelem - Dot element (SVG image element) | selectionStart | (): void | Fired when user starts entering pattern | selectionEnd | (): void | Fired when user ends entering pattern | clear | (): void | Fired when clear method is called (current pattern is erased)

Settings

| Name | Type | Description | |:-----|:-----|:-----| | vibrate | boolean | Whether to vibrate when dot is selected

Installation / download

Like it? Star it!

If you like it please consider leaving star on github.

Credits

This code is based on Tympanix/pattern-lock-js. The original library depends on JQuery and it is written in plain JS. I have rewritten the original code in TypeScript and I've added few additional features.