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

@toyz/loom

v0.12.2

Published

Decorator-driven web component framework with reactive state, DOM morphing, DI, and JSX

Downloads

1,098

Readme


What is this?

Loom was born out of pure spite for boilerplate. What began as an ironic "what if decorators did everything?" experiment turned into a genuinely useful framework for building web components.

It powers placing.space in production — a real-time collaborative pixel canvas — so it's been battle-tested with WebSocket streams, thousands of DOM nodes, and zero framework overhead.

Why Loom?

Most frameworks make you choose: lightweight or batteries-included. Loom doesn't.

  • ~20KB gzipped baseline — smaller than React + ReactDOM alone, but includes a router, DI container, reactivity system, and lifecycle management out of the box.
  • No virtual DOM — JSX compiles to real DOM nodes. The morpher diffs the live DOM directly and patches in-place. No throwaway object trees, no GC pressure, no overhead on top of the work you were going to do anyway.
  • Zero dependencies — the entire framework is one package.json entry. No version conflicts, no transitive supply chain risk, no "which router do we pick" debates.
  • Pay-as-you-go — built-in components (<loom-virtual>, <loom-canvas>, <loom-icon>, <loom-image>) and systems (@form, @api, CollectionStore) are tree-shaken if you don't import them. You only ship what you use.
  • Web standards — built on custom elements, Shadow DOM, and TC39 Stage 3 decorators. When browsers ship native decorator support, your code gets faster for free.

Features

  • @component / @styles — register custom elements and scoped styles in one line
  • @reactive / @prop — fine-grained reactivity that only re-renders what changed
  • @computed / @watch — derived state and side effects
  • @on / @emit — declarative event handling via typed event bus
  • JSX + DOM morphing — write JSX, get surgical DOM patches (no virtual DOM)
  • @inject / @service / @factory — full dependency injection container
  • Hash & history router@route, @guard, @group, <loom-outlet>, <loom-link>
  • @api / @intercept — declarative data fetching with SWR, retry, and Result combinators
  • @lazy — code-split components with one decorator
  • @catch_ / @suspend — error boundaries and async loading state
  • @interval / @timeout / @debounce / @throttle / @animationFrame — auto-cleaned timing
  • @mount / @unmount — lifecycle hooks
  • @form — declarative form binding with validation
  • @transform — typed value transforms for props and route params
  • Reactive<T> / CollectionStore<T> — observable state with LocalAdapter persistence
  • css\`` — adopted stylesheets with zero FOUC
  • <loom-virtual> — virtualized list for huge datasets
  • createDecorator — build your own decorators with the same factory Loom uses
  • Zero dependencies — just TypeScript and the platform

Create a Project

npm create @toyz/loom my-app
cd my-app
npm install
npm run dev

Or install manually:

Install

npm install @toyz/loom

Quick Start

import { LoomElement, component, reactive, css, styles } from "@toyz/loom";

const counterStyles = css`
  button {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
  }
  span {
    font-weight: bold;
    margin-left: 0.5rem;
  }
`;

@component("click-counter")
@styles(counterStyles)
class ClickCounter extends LoomElement {
  @reactive accessor count = 0;

  update() {
    return (
      <button onClick={() => this.count++}>
        Clicks: <span>{this.count}</span>
      </button>
    );
  }
}
<click-counter></click-counter>
<script type="module" src="./main.ts"></script>

TSConfig

Loom uses TC39 decorators, which require es2022 or later. Point your config at the Loom JSX runtime:

{
  "compilerOptions": {
    "target": "es2022",
    "jsx": "react-jsx",
    "jsxImportSource": "@toyz/loom"
  }
}

For Vite:

// vite.config.ts
export default defineConfig({
  esbuild: {
    target: "es2022",
    jsx: "automatic",
    jsxImportSource: "@toyz/loom",
  },
});

Docs

Full documentation with interactive examples:

toyz.github.io/loom

License

MIT — do whatever you want with it.