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

scratch-box

v0.0.15

Published

Web component wrapper around custom animated checkbox (from codepen)

Readme

scratch-box

scratch-box is a form associated custom element web component wrapper around the "CUSTOM ANIMATED CHECKBOXES" codepen by Sara Soueidan.

Declarative Custom Element

This is the world's first visual web component, built with features and Declarative Custom Element cede scripts. It is "code-free". In particular, it draws from the el-maker base class module package, only loading those features that are actually used, as needed. It is entirely built with a static html file root.html and a JSON file el-maker.json. Editing JSON by hand is error-prone and doesn't lend itself to Typescript checking. So the JSON is built from el-maker.mjs using command

npm run build-el-maker

This watches for changes to the mjs file and automatically rebuilds the el-maker.json file.

Dual Mode

The root.html file mentioned above can actually be opened via a static file web server, and the basic functionality of the web component can already be demo'd. Nothing could be easier! All that's missing is some behind the scenes dynamic functionality as far as linking up to an HTML form, and the ability to pass in the checked value dynamically. [TODO -- support passing in via querystring].

SSR support

To use this web component, the root.html file needs to either be embedded in the HTML stream for the landing page, or (lazily) imported/streamed in. In the main demo page, we see a full-blown SSR example, including progressing switching from raw checkboxes with minimal styling to the scratch-box component, passing any edits made to the raw checkboxes to the scratch-box during hydration without skipping a beat.

This optional true SSR progressive enhancement support is made possible with the help of two additional, optional element enhancements -- soak-up and be-gone.

To use from CDN:

<scratch-box imp-h="scratch-box/root.html">
    <span slot=labelTxt>Create demo</span>
</scratch-box>
<scratch-box>
    <span slot=labelTxt>Write article</span>
</scratch-box>
<scratch-box>
    <span slot=labelTxt>Exercise</span>
</scratch-box>
<script type="importmap">
{
    "imports": {
        "scratch-box/": "https://cdn.jsdelivr.net/npm/[email protected]/",
        "be-bound/": "https://esm.sh/[email protected]/"
    }
}
</script>
<script type=module src=https://esm.sh/[email protected] crossorigin="anonymous"></script>
<script type=module src=https://esm.sh/[email protected]/index.js crossorigin=anonymous></script>

Viewing Demos Locally

  1. Install git
  2. Fork/clone this repo
  3. Install node.js
  4. Open command window to folder where you cloned this repo
  5. git submodule add https://github.com/bahrus/types.git types

  6. git submodule update --init --recursive

  7. npm install

  8. npm run serve

  9. Open http://localhost:8000/ in a modern browser