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

@supercat1337/store-utils

v2.0.0

Published

DOM binding utilities for @supercat1337/store – reactive atoms, collections, and computed values

Readme

@supercat1337/store-utils

A collection of DOM binding utilities for reactive stores created by @supercat1337/store.

Installation

npm install @supercat1337/store-utils

Features

  • One‑way and two‑way bindings between reactive atoms/collections and DOM elements
  • Automatic cleanup when elements are removed from DOM (autoDisconnect: true by default)
  • Support for custom event names in two‑way bindings
  • TypeScript support via JSDoc (includes .d.ts)

Quick Example

import { Store } from '@supercat1337/store';
import {
    bindToInput,
    bindToCheckbox,
    bindToClassToggle,
    bindToShow,
} from '@supercat1337/store-utils';

const store = new Store();
const count = store.createAtom(10);
const enabled = store.createAtom(true);
const visible = store.createAtom(true);
const danger = store.createAtom(false);

// Two-way binding with input
const input = document.querySelector('input');
bindToInput(input, count);

// Two-way binding with checkbox
const checkbox = document.querySelector('#enable');
bindToCheckbox(checkbox, enabled);

// Toggle CSS class when danger is true
const span = document.querySelector('.counter');
bindToClassToggle(span, danger, 'text-danger');

// Show/hide element
const container = document.querySelector('.container');
bindToShow(container, visible);

API Reference

One‑way bindings

| Function | Description | | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | bindToAttribute(element, reactive, attrName, options?) | Sets/removes an attribute based on reactive string or null. | | bindToClassString(element, reactive, options?) | Sets element.className from a reactive string. | | bindToClassToggle(element, reactive, className, options?) | Toggles a CSS class based on boolean value. Option invert flips the logic. | | bindToDisabled(element, reactive, options?) | Sets element.disabled from a reactive boolean. | | bindToHtml(element, reactive, options?) | Sets element.innerHTML from a reactive string/number. | | bindToProperty(element, reactive, propName, options?) | Sets any DOM property from a reactive value. | | bindToShow(element, reactive, options?) | Toggles visibility via a CSS class (default d-none). Class is applied when value is false. Option invert changes that. | | bindToStyle(element, reactive, options?) | Sets element.style.cssText from a reactive string, or applies an object of styles (replaces all). | | bindToDataset(element, reactive, options?) | Sets data-* attributes from a reactive object (keys become data-key). Replaces entire dataset. | | bindToText(element, reactive, options?) | Sets element.textContent from a reactive string/number. |

Two‑way bindings

| Function | Description | | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | bindToCheckbox(checkbox, reactive, options?) | Syncs checkbox checked property with a boolean atom. Listens to change event by default. | | bindToCheckboxGroup(checkboxes, collection, options?) | Syncs a group of checkboxes with a collection of strings (selected values). Listens to change event. | | bindToInput(input, reactive, options?) | Syncs input/textarea value with a string/number atom. By default listens to input event (or change for type="number"). | | bindToRadioGroup(radios, reactive, options?) | Syncs a group of radio buttons (same name) with a string atom. Listens to change event. | | bindToSelect(select, reactive, options?) | Syncs a single‑select with a string atom. Listens to change event. | | bindToSelectMultiple(select, collection, options?) | Syncs a multi‑select with a collection of strings (selected values). Listens to change event. |

List binding

| Function | Description | | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | | bindToList(container, collection, itemSetter, itemCreator?, options?) | Renders a reactive collection into a DOM container. Supports templates and custom element creation. | | ListItemHelper | Helper class provided to itemSetter and itemCreator – gives access to template, item index, and getDiffs. | | ListItemSetterDetails | Contains itemElement, index, value, oldValue, length for each list item. |

Utilities

| Function | Description | | -------------------------------------- | ------------------------------------------------------------- | | getDiffs(newObj, oldObj, compareFn?) | Returns an object with true for changed/added properties. | | globalOptions | Global defaults: { debounceTime: 0, autoDisconnect: true }. |

Options

All binding functions accept an optional options object:

| Option | Type | Default | Description | | ------------------------ | ------- | ---------- | --------------------------------------------------------------------- | | debounceTime | number | 0 | Debounce time (ms) for store subscription. | | autoDisconnect | boolean | true | Automatically unsubscribe when the bound element is removed from DOM. | | event (two-way) | string | depends | Custom event name for DOM updates (e.g. 'click', 'blur'). | | lazy (input) | boolean | false | If true, listens to change instead of input. | | invert (class toggles) | boolean | false | If true, class is applied when value is false. | | hideClassName (show) | string | 'd-none' | CSS class used to hide the element. |

Global Options

You can change defaults for all bindings:

import { globalOptions } from '@supercat1337/store-utils';

globalOptions.debounceTime = 100;
globalOptions.autoDisconnect = false;

License

MIT [Albert Bazaleev]