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

native-signal-ui

v0.4.1

Published

A super-simple signal-based UI framework based on my custom signal framework `native-signal`

Readme

native-signal-ui

A minimal, signal-based UI library. No virtual DOM, no diffing, no component re-renders — you build real DOM nodes with JSX, and individual signals wire themselves directly to the attributes and text nodes that depend on them. When a signal changes, only the exact DOM that reads it updates.

It is built on top of native-signal, my framework-independent signal library (Angular-style signals, but standalone and fast). native-signal is a runtime dependency — all reactivity comes from there; this package is just the thin DOM-binding layer on top.


Documentation

Topic guides live in docs/ (and ship with the npm package, so an agent working in a downstream project can read them from node_modules/native-signal-ui/):

  • Setup — Vite + TypeScript, the classic JSX factory, and making the global JSX types visible. This is the part that trips people up.
  • Reactivity in JSX — reactive children & attributes, style: / class: namespaced attrs, events, and two-way form bind.
  • Control flow — If, AB, Switch, ForKeyed.
  • Components — the Component base class.
  • Pitfalls — own() / WeakRef GC, classic vs. automatic JSX, native-signal as an external.
  • API reference — the full export table.

Working with an AI agent? Point it at AGENTS.md (also CLAUDE.md) — a terse index of the hard invariants plus links into the docs above.


Mental model

A JSX expression evaluates to a DOM node (an HTMLElement, DocumentFragment, Text, etc.) — not a description of one. There is no render loop and no reconciliation:

const count = new NativeSignal(0);

const view = <button onclick={() => count.set(count.get() + 1)}>
    Clicked {count} times
</button>;

document.body.append(view);
  • <button> is created once as a live HTMLButtonElement.
  • {count} is detected as a signal. The runtime drops two comment anchors into the DOM and mounts a Computed between them that re-renders only that text node when count changes.
  • Nothing else re-runs. The onclick handler, the surrounding text, the element itself — all built once and left alone.

The whole library is roughly: a JSX factory (h), a normalize_child routine that knows how to mount each kind of child (nodes, strings, signals, promises, arrays, { to_html() } objects), and a handful of control-flow helpers that manage anchor-delimited "slots" of DOM.


Quick start

Reactivity primitives come from native-signal/weak. JSX uses the classic transform (runtime.h / runtime.Fragment) — see Setup before your first build.

import { runtime } from "native-signal-ui";
import { If, ForKeyed } from "native-signal-ui";
import { NativeSignal, Computed } from "native-signal/weak";

const name  = new NativeSignal("world");
const todos = new NativeSignal<{ id: number; text: string }[]>([]);

const app = (
    <div class="app">
        <input value={name} oninput={(e: any) => name.set(e.target.value)} />
        <h1>Hello, {name}!</h1>

        {If(new Computed(() => todos.get().length === 0), <p>No todos yet.</p>)}

        <ul>
            {ForKeyed("id", todos, (t) => <li>{t.text}</li>)}
        </ul>
    </div>
);

document.body.append(app);

todos.set([{ id: 0, text: "New Todo!" }]);

Scripts

  • npm run build — produce the ESM bundle + .d.ts files in dist/
  • npm run dev — Vite dev server
  • npm test — run the vitest suite
  • npm run typecheck — tsc --noEmit

License

UNLICENSED for now — set this before publishing.