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

@ruledwdl/state

v0.1.3

Published

Simple state + ops + events manager for RuledWDL components

Readme

@ruledwdl/state

State management, DOM tree mutation, and event bus manager for RuledWDL components.

npm version License: AGPL v3


Features

  • Component Management: Multi-component registry lifecycle (list, get, create, remove).
  • Layers Positioning & Tree Mutations: AST layer operations (append, before, after, wrap, remove, set, tree, list) with full support for WDL operator grammars (>, +, <, <*N, <@N).
  • Attribute & Variant Operations: Read, set, update, and remove element attributes, plus a first-class variant API for managing data-variant attributes.
  • Data Binding Operations: Path-based state getter/setters (hero.data.get('user.name'), hero.data.set(...)).
  • REGISTRY Schema V2.1 Management: Add, update, and remove Schema V2.1 Scoped CSS rules (hero.registry.addRule(...)) and variables.
  • Pub/Sub Event Bus: Typed event notifications for layers:change, attr:change, data:change, variant:change, and registry:change.
  • Headless & Platform-Agnostic: Pure JavaScript/TypeScript in-memory state engine — runs natively in Node.js, Web Workers, Cloudflare Workers, or Browsers.

Installation

npm install @ruledwdl/state

Usage Example

import { ComponentManager } from '@ruledwdl/state';

const manager = new ComponentManager();

// 1. Create a Component State instance
const hero = manager.create('hero', {
  layers: 'section.hero > div.container > h1.title + p.subtitle',
  attr: { '.title': { text: 'Hello World' } },
  data: { user: { name: 'Pradeep' } },
  registry: {
    $version: '2.1',
    vars: { bg: '#ffffff' }
  }
});

// 2. Layer Positioning & Tree Mutations
hero.layers.after('subtitle', 'button.cta');     // Inserts sibling <button class="cta">
hero.layers.wrap('title', 'div.title-wrapper');  // Wraps title in <div class="title-wrapper">
hero.layers.append('container', 'span.badge');   // Appends <span class="badge"> inside container

// 3. Variant & Attribute Management
hero.variant.set('elevated');                   // Sets data-variant="elevated" on root element
hero.attr.set('.cta', { text: 'Get Started' });  // Updates element attributes

// 4. Data State Operations
hero.data.set('user.role', 'Admin');

// 5. REGISTRY Schema V2.1 Rules Management
hero.registry.addRule({
  selector: '&:hover .cta',
  css: { background: 'var(--color-primary-hover)' }
});

// 6. Listen to State Events
hero.on('variant:change', (event) => {
  console.log('Variant updated:', event);
});

// 7. Get Serialized Layers String
console.log(hero.layers.list());

License

Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0-or-later).