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

@guillrobin/canvas-led

v0.1.3

Published

Virtual led drawn on a canvas intended as npm test package.

Readme

canvas-led

0.1.3 Added a cache to store graphics already drawn; the drawing code is still as inefficient as ever but it is only called once per led state.

0.1.1 Initial

Test package for TypeScript 3.2.1, ES6 and npm under Webstorm 2018.3.2.

This package is a test. Fell free to use it. It features a vitual led.

Warning : This is a test mockup
  • ES6 Module system only
  • Drawing code is ugly and unfinished

Demo

Please take a look at index.html with an ES6 compliant browser.

Package Managers

# NPM
npm install @guillrobin/canvas-led

Basic usage

Include index.js script, before your closing <body> tag AND before jQuery script inclusion :

<script type="text/javascript" src="node_modules/jquery/dist/jquery.min.js"></script>
<script type="module" src="node_modules/@guillrobin/canvas-led/index.js"></script>
</body>

Data Attribute Settings

You can eventually customize led states declaratively but you still need to call $(element).led() to initialize the component.

<div data-led='{
    "state": 0,
    "size": 64,
    "states":   [ {"color":"grey"},
                  {"color":"yellowgreen"},
                  {"color":"gold"},
                  {"color":"crimson"},
                  {"color":"deepskyblue"} ] }' >
</div>

Settings

Option | Type | Default | Description ------ | ---- | ------- | ----------- size |number |64 |Led canvas size in pixels (width & height). state |number |0 |Current led state. states |LedState |Demo leds |Predefined states of the led.

Methods

Methods are called on led(s) instance(s) through the led method itself:

// Find <div>s with .example class and initializes it's content
$('.example').led();

This (maybe ?) accommodating syntax allows you to call any internal method as well:

// Change the size of your led to 32 pixels
$('#myLed').led('setsize', 32);

Method | Argument | Description ------ | -------- | ----------- empty | empty | Initializes currently selected div(s), please see upwards. setsize | size: number | Set led element size, (width & height) in pixels. setstate | newState: number | Set led state. toggle | | Toggle between states 0 and 1 only.

Default settings (demo led states)

  • 0 : grey (off style led)
  • 1 : yellowgreen (on style led)
  • 2 : gold
  • 3 : crimson
  • 4 : deepkyblue

Browser support

Need ES6 compliant browser.

Dependencies

jQuery

License

Copyleft