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

belling-dom

v1.2.8

Published

a fast declarative JavaScript library

Readme

belling.js

import { div, span, root } from "belling-dom";
// Create DOM
div(
  span("width:"), 
  b, 
  () => a.v + "px"
)
/* Auto-update when b.v changes. Function children update when internal states change */
.on({
  unmount() {
    // Execute when element is destroyed
  },
  click() {
    a.v += 1;
  },
})
.attr({
  "data-a": () => a.v.toString(),
})
.style({
  paddingLeft: b,
}).ref((dom)=>{
  // get dom node
});
// Render
new root(document.getElementById("App"), div());

Lists

const l = state(makeArr(0, 1, 2));
ForEach("div", l, (v) => div(v.toString()));
ForIn("div", l, (i, v) => div(() => i.v + ":", v.toString()));
  • Performs diff updates when l changes, adding new elements and removing old ones.
  • When there are duplicate items in a list, the components rendered for those identical items cannot be reused during diff updates due to the inability to determine a stable mapping relationship.

Ele

Dynamic Nodes

const show = state(true as boolean);
dynNode(() => {
  if (show.v) return input();
  else return div();
});

Achieves functionality similar to Vue's v-if and supports complex logic.

中文版

import { div, span,root } from "belling-dom"

// 创建dom
div(span("width:"), b, () => a.v + "px")
 /* 当b.v改变,视图会自动更新。若子节点传入函数,当函数内的状态改变时,也会更新视图 */
 .on({
  unmount() {
   // 当元素被销毁时执行
  },
  click() {
   a.v += 1;
  },
 })
 .attr({
  "data-a": () => a.v.toString(),
 })
 .style({
  paddingLeft: b,
 });

// 渲染
new root(document.getElementById("App"), div());

列表

const l = state(makeArr(0, 1, 2))
ForEach("div", l, (v) => div(, v.toString()));
ForIn("div", l, (i, v) => div(() => i.v + ":", v.toString()));

当'l'改变时列表会进行diff更新,diff更新会添加新增内容,销毁被移除的内容。

当列表中存在相同项时,由于无法确定映射关系,相同项所渲染的组件在diff更新中无法复用。

动态节点

const show = state(true as boolean);
dynNode(() => {
  if (show.v) return input();
  else return div();
});

可以实现vue中v-if的功能,也可以实现其他更复杂功能。