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

@watervein/dom

v0.1.54-dev.2

Published

Watervein DOM package

Readme

@watervein/dom

npm version License: MIT

The high-level developer-facing DSL layer for Watervein. It exports hyper-optimized, functional element builders (div, span, button, etc.) and intuitive DSL type-guards, allowing you to write clean, declarative markup in pure TypeScript with zero build-time JSX transformations.


Key Features

  • Vanillatastic Functional DSL: Drop JSX completely. Construct entire UI layouts using vanilla functional trees like div({}, [ span({}, "Hello") ]) that map directly to the DOM at runtime.
  • Smart DSL Attribute Normalization: Intelligently inspects and intercepts object-based styles and polymorpic reactive class values (Dsl1Class), feeding safe abstractions seamlessly down into dom-core.
  • Full HTML5 Elements Autocomplete: Ships with strongly-typed, out-of-the-box functions for every legal HTML5 element—providing lightning-fast IDE IntelliSense.
  • Isomorphic Core Re-exports: Re-exports foundational mounting workflows and optimized control flows (Show, For) directly from dom-core so you only need a single runtime package import.

Installation

pnpm add @watervein/core @watervein/dom

Usage Guide

Instead of compiling complex HTML templates or virtual nodes, write pure functional component layouts:

import { createState, read, write, UISystem } from '@watervein/core';
import { div, h1, button, p, span, mount } from '@watervein/dom';

const clicks = createState(0);

const counterApp = div({ class: "container" }, [
  h1({}, "Watervein App"),
  p({ style: { color: "gray" } }, "A modern NES-driven template framework."),
  
  button({
    class: { "btn-active": () => read(clicks) > 0 },
    onclick: () => {
      write(clicks, read(clicks) + 1);
      UISystem.flush();
    }
  }, [
    span({}, "Increment Counter: "),
    span({}, () => read(clicks))
  ])
]);

mount(document.getElementById("root")!, counterApp);

API References

Flexible Reactive Binding Specifications

Every element attribute or layout child accepts standard primitives, raw graph nodes, or lazy evaluation functions seamlessly.

type ReactiveProp<T> = T | WvNode<T> | (() => T);

1. Polymorphic Class Mapping (Dsl1Class)

Supports strings, state wrappers, computed anonymous arrow closures, array chains, or conditional boolean dictionaries out of the box.

div({ class: "static-class" })
div({ class: () => isUrgent() ? "danger" : "normal" })
div({ class: { active: isActiveNode, hidden: () => isHidden() } })
div({ class: ["class-a", dynamicClassNode] })

2. Fully Covered Elements Layer (@watervein/dom/elements)

Every method perfectly enforces argument packing options ([props?, children?]) mapping type definitions across structural browser nodes:

  • a(), button(), canvas(), div(), form(), input(), label(), ol(), p(), section(), span(), table(), tbody(), td(), tr(), ul(), and 90+ more.

Architectural Workflow (How the DSL structures layers)

graph TD
    Input["div({ class: { active: node } }, [...])"]

    DOM["<strong>@watervein/dom</strong>"]
    DOMCore["<strong>@watervein/dom-core</strong>"]

    ElementCall["element(\"div\", parsedProps, children)"]
    Mutation["Direct Native DOM Mutations"]

    Input -- "Normalizes and Guards Classes" --> ElementCall
    ElementCall -- "Binds Dynamic Graphs & Effects" --> Mutation

    DOM -.-> ElementCall
    DOMCore -.-> Mutation

    DOM ~~~ DOMCore

    style DOM fill:#edf2f7,stroke:#4a5568,stroke-width:1px
    style DOMCore fill:#edf2f7,stroke:#4a5568,stroke-width:1px
    style Mutation fill:#d4edda,stroke:#155724,stroke-width:1px

By adding a dedicated DSL layer, Watervein protects runtime performance while offering clean developer aesthetics. It checks for reactive boundary nodes (via isNode) upfront, avoiding parsing loops when dom-core begins binding side-effects to the real tree.

License

This project is licensed under either of:

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.