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

@im4all/bitsy-js

v1.0.0

Published

Add interactivity to the HTML you render

Readme

A tiny, dependency-free, HTML-first view library. It adds data binding, signals, loops, conditions, fragments, events, remote data, and form validation to markup you already render. About 30.5 kB minified, 9.2 kB gzipped, no build step.

Docs, guides, and live examples: bitsyjs.habibhadi.com.

BitsyJS reads attributes and tags directly from the DOM and enhances the page after load. There is no virtual DOM, no component compiler, no runtime dependency, and no required build step.

Install

npm install @im4all/bitsy-js
import { BitsyJS } from "@im4all/bitsy-js";

Or load it straight from a CDN. No bundler needed:

<script type="module">
    import { BitsyJS } from "https://unpkg.com/@im4all/bitsy-js/dist/bitsy.min.js";

    const bitsy = new BitsyJS();
    await bitsy.run();
</script>

TypeScript declarations are included.

Why it is created

The world didn't need another JS library. I just wanted to include a damn HTML file.

Sometimes I want a quick HTML page: change a line, upload it over FTP, done. Yes, FTP. I know what year it is. If all I did was fix a typo, I don't want a laptop or a build server making an event out of it.

Plain HTML can't even include one file in another, so I wanted PHP's include. Then a variable in my markup, a loop over a list, a form check, an HTTP request. Small things, and I kept ending up with a full framework or three libraries in a trench coat. Build-free options existed, but some felt more complicated than the page I was making, and I usually needed another library anyway. I still have a soft spot for jQuery: drop in a script and get on with it.

I use modern frameworks when I'm building an app. For docs, a presentation, or a landing page, I wanted to start with HTML and keep it that way. So I built BitsyJS, by hand, even in the AI era, so I can come back in six months and still know how it works.

Quick start

<div b-data>
    <h1>{title}</h1>
    <p b-if="isLoggedIn">Welcome back, {user.name}</p>
    <p b-if="!isLoggedIn">Please sign in.</p>

    <ul>
        <li b-for="player of players">{_index}: {player.name} - {player.score}</li>
    </ul>
</div>
import { BitsyJS } from "@im4all/bitsy-js";

const bitsy = new BitsyJS({
    data: {
        title: "Scoreboard",
        isLoggedIn: true,
        user: { name: "Ada" },
        players: [
            { name: "Alpha", score: 10 },
            { name: "Beta", score: 7 },
        ],
    },
});

bitsy.ready(() => console.log("rendered"));
await bitsy.run();

Core directives

| Directive | Purpose | | ----------------------------- | ------------------------------------------------------------------------------ | | b-data="{ key: value }" | Local data scope. Placeholders use {path.to.value}. | | b-for="item of items" | Repeats an element per item. Provides _index, _isFirst, _isLast. | | b-if="expression" | Shows or hides an element with display: none. | | b-view src="./partial.html" | Fetches and inlines an HTML fragment. | | b-container | Groups markup and removes the wrapper after rendering. | | b-js="expression" | Evaluates an expression and writes the result as HTML. |

Events use data-b-event="click" plus effect attributes such as -html, -toggle-class, -remote, and -indicator. Forms use data-b-validate-form and data-b-form-ajax. Full tables are in the API reference.

Signals

Use signals for state that changes after run():

import { BitsyJS, computed, signal } from "@im4all/bitsy-js";

const count = signal(0);
const doubled = computed(() => count() * 2);
await new BitsyJS({ data: { count, doubled } }).run();
<div b-data>
    <p>Count: {count()}. Doubled: {doubled()}.</p>
    <button type="button" b-on:click="count.update(n => n + 1)">+1</button>
</div>

Text and attribute bindings, b-if, and b-js update when the signals they read change. In handlers, $event is the DOM event and $el is the element that owns the handler. See the signals demo.

Pre-render

The package ships a bitsy-prerender CLI (Playwright based) for pages that need rendered HTML:

npm install -D playwright
npx playwright install chromium
npx bitsy-prerender --src=./site --dist=./dist --clean

Custom tags and security

Every directive name can be overridden through the tags option, and form classes and messages through validatorConfig.

Directive expressions run through new Function with access to browser globals, and HTML values are inserted as markup. Only use expressions, fragments, and remote endpoints you trust.

Development

npm install
npm run dev     # local server
npm run build   # dist/bitsy.min.js
npm test        # Playwright + Chromium

Runnable demos live in demo/ and are linked from index.html. After changing the library, sync the docs bundle: cp dist/bitsy.min.js docs/assets/bitsy.min.js.

License

MIT. See LICENSE.