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

blots

v2.0.21

Published

A Minimal and Expressive JS SPA Micro Framework

Readme

Blots.js

Blots.js is a lightweight JavaScript micro-framework for SPAs, offering:

  • 📍 Routing system with support for path and query parameters
  • 🧠 Template engine using custom HTML attributes
  • Reactivity powered by native JavaScript Proxy objects

📦 Installation

npm i blots

🚀 Basic Initialization

import { Router } from "blots";

const router = new Router();

// Define routes
router.add("/user/:id/:name", (params, query) => {
  console.log("Route Params:", params);
  console.log("Query String Params:", query);
});

// Start routing
router.resolve();

🧩 Creating a Component

import { render, include, state } from "blots";
import htmlElement from "./my-component.html?raw";
import headerElement from "@components/header/header.html?raw";
import footerElement from "@components/footer/footer.html?raw";

const data = state(
  {
    refs: {},
    title: "Hello from my component",
    displayCondition: false,
    activeClass: true,
    testClick(e) {
      console.log(e);
      data.displayCondition = !data.displayCondition;
      data.activeClass = !data.activeClass;
      console.log(data.refs.btnAddLesson);
    },
    inputChange(e) {
      data.title = e.target.value;
    },
  },
  intro
);

export function myComponent(params, query) {
  render("app", htmlElement, data);
  include("header-element", headerElement);
  include("footer-element", footerElement);
}

🧬 HTML Bindings

<section>
  <style>
    .my-class {
      background-color: yellow;
    }
  </style>

  <!-- Menu component mount point -->
  <menu-element></menu-element>

  <!-- {{ prop }}: displays a reactive property -->
  <h1>{{ title }}</h1>
  <p>{{ name }}</p>

  <!-- Conditional rendering with @if -->
  <p @if="displayText">Conditional text</p>
  <button @click="setDisplayText">Toggle Text</button>

  <hr />

  <!-- Inputs with events and data binding -->
  <div>
    <input type="text" placeholder="Search..." @change="search" @ref="search" />
    <input type="text" placeholder="Bound to title" @model="title" />
    <input type="text" placeholder="Bound to name" @model="name" />
  </div>

  <hr />

  <!-- Actions -->
  <button @click="increment">Add</button>
  <button @click="reset">Reset</button>

  <p>Users: {{ count }}</p>

  <hr />

  <!-- Conditional class -->
  <div @class="{ 'my-class': !displayText }">
    <!-- Iteration with loop -->
    {{# users }}
    <p>Name: {{ name }} - Email: {{ email }}</p>
    {{/ users }}
  </div>
</section>

🧭 Defining Routes with Components

import { Router } from "blots";
import myComponent from "./components/my-component.js";

const router = new Router();

// Each route can instantiate a different component
router.add("/user/:id/:name", myComponent);

// Start the router
router.resolve();

🗂 index.html Structure

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Blots App</title>
  </head>
  <body>
    <a href="/">Home</a>
    <a href="/user/10/steve?test=true">User</a>

    <!-- App root -->
    <app></app>

    <script type="module" src="./main.js"></script>
  </body>
</html>

📝 Final Notes

  • Imported .html files are automatically processed as templates.
  • Reactive properties automatically update the DOM when changed.
  • Full support for deep reactivity and two-way data binding.
  • Core integration with the DOM is done using custom attributes like @click, @model, @if, @ref, and @class.