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

@intent-framework/dom

v0.1.0-alpha.10

Published

DOM materializer for Intent screens and router

Readme

@intent-framework/dom

DOM materializer for Intent screens and router.

Install

pnpm add @intent-framework/core @intent-framework/dom
npm install @intent-framework/core @intent-framework/dom

What it provides

  • renderDom() — materialize a screen into semantic HTML
  • renderRouter() — materialize a router into navigable DOM pages
  • Real HTML labels, inputs, buttons, and aria-live output
  • Reactive action enablement and blocked reasons
  • Enter key triggers the default action when unambiguous
  • Opt-in screen-name heading via showScreenName
  • Opt-in semantic data attributes via showSemanticIds

renderDom behavior

Input types

| Ask kind | Renders as | |----------|------------| | $.state.text() / default | <input type="text"> | | asContact("email") | <input type="email"> with autocomplete="email" | | asSecret() | <input type="password"> | | $.state.boolean() | <input type="checkbox"> | | $.state.choice() with asChoice() | <select> with <option> elements |

Boolean and choice asks

Boolean asks render as checkboxes. The checked state is synced with the underlying BooleanState.

Choice asks render as <select> elements. Options are populated from the ChoiceState options array. The selected value is synced with the underlying state.

Blocked reasons

When an action is disabled due to blocked reasons, the renderer adds:

  • disabled attribute on the button
  • <p class="intent-blocked-reason" role="alert"> with the first blocked reason text
  • aria-describedby on the button pointing to the reason element

When the action becomes enabled, the reason element is removed from the DOM and aria-describedby is cleared.

Single-surface output

When a screen has exactly one surface, the output is backward compatible: a single <main> element containing one <form> with all asks and actions. No surface name suffix is added to DOM ids.

Multi-surface output

When a screen has multiple surfaces, each surface renders as a separate <section> with aria-label set to the surface name. Each section contains its own <form> with only the items belonging to that surface.

DOM id suffixes: All ask inputs, buttons, hint paragraphs, reason paragraphs, and feedback outputs get a --<surfaceName> suffix to avoid id collisions.

Duplicate controls share state: The same ask appearing in multiple surfaces shares the underlying state. Typing in one surface updates the input in all surfaces.

Duplicate action buttons: The same action appearing in multiple surfaces renders separate buttons, all executing the same executeAct() call.

Per-surface feedback: Each surface gets its own <output aria-live="polite"> element. Action feedback is updated independently per surface.

data-intent-* semantic ids: The data-intent-ask and data-intent-action attributes remain the same across all copies — they identify the semantic node, not the DOM position.

Enter key default action

When exactly one primary action exists (or exactly one action total), pressing Enter in any text input triggers that action. The Enter hint ("Press Enter to ...") appears reactively when the default action becomes enabled, and is hidden when disabled. Shift/ Meta/ Ctrl/ Alt + Enter are ignored. Enter is ignored on <textarea>, <select>, and checkbox inputs.

Options

renderDom(Screen, {
  target: document.getElementById("root")!,
  showScreenName: true,        // render screen name as <h1>
  showSemanticIds: true,       // add data-intent-screen, data-intent-ask, data-intent-action attributes
})

Minimal example

import { screen } from "@intent-framework/core"
import { renderDom } from "@intent-framework/dom"

const InviteMember = screen("InviteMember", $ => {
  const email = $.state.text("email")

  const emailAsk = $.ask("Email", email)
    .required()
    .validate(value => value.includes("@") ? true : "Enter a valid email")

  const invite = $.act("Invite member")
    .primary()
    .when(emailAsk.valid, "Enter a valid email first")

  $.surface("main").contains(emailAsk, invite)
})

const cleanup = renderDom(InviteMember, {
  target: document.getElementById("root")!,
})

The renderer produces real DOM — labels, inputs, buttons, and an aria-live output. No JSX required.

Where this fits

DOM is a renderer for Intent screens. It depends on @intent-framework/core and can optionally integrate with @intent-framework/router via renderRouter(). It is not the source of truth — the screen definition is.

Learn more

Status

Experimental alpha. APIs may change. Not recommended for production use.