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

state-launcher

v0.3.0

Published

`state-launcher` is a dev/test-only command launcher for putting an application into named states such as `billing.paymentFailed` or `inbox.manyMessages`.

Readme

state-launcher

state-launcher is a dev/test-only command launcher for putting an application into named states such as billing.paymentFailed or inbox.manyMessages.

The package keeps command registration and state transitions in the application. You can provide its browser panel to developers, or use the same registry through the headless API when another development surface should render the catalog.

Choose a surface

| Surface | Use it when | It provides | | ---------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | Browser launcher | Developers or QA need an in-page command panel. | Shadow DOM-isolated UI, search, route-aware ranking, recent commands, errors, and Clear. | | Headless API | An external development surface owns the command browser. | Serializable snapshots, change subscriptions, id-based launches, and active-state clearing. |

Both surfaces use the same singleton registry, launch handlers, abort signals, cleanup functions, and active-state transitions. The headless entry point does not mount the panel or import its Preact UI.

Fit and boundaries

Use State Launcher for development tools, QA workflows, test setup, and component-owned launch handlers. Do not use it for production navigation, feature flags, end-user state, cross-device history, mock-server orchestration, or data seeding.

The package is ESM. The browser panel uses Preact and requires a browser DOM; the React hook uses the optional React peer dependency. The headless bundle has no DOM-mounting or Preact runtime path, but commands still need to be registered and handled by the application that owns the state transitions.

Browser example

This example defines one stable command, registers it for discovery, mounts the panel, and launches the same command programmatically:

import { defineLaunchableState, mountStateLauncher, registerLaunchableState } from 'state-launcher'

const paymentFailed = defineLaunchableState('billing.paymentFailed', {
  label: 'Payment failed',
  description: 'Show the billing surface with a failed payment method.',
  tags: ['billing', 'card'],
  launch() {
    document.body.dataset.debugState = 'billing.paymentFailed'
  },
})

const unregister = registerLaunchableState([paymentFailed])
import.meta.hot?.dispose(unregister)

const launcher = mountStateLauncher({ title: 'App states' })
document.querySelector('#open-state-launcher')?.addEventListener('click', () => {
  launcher.toggle()
})

await paymentFailed.launch()

Headless example

Use the dedicated entry point when a consumer needs records and commands without mounting the browser panel:

import {
  clearActiveState,
  getStateLauncherSnapshot,
  launchStateLauncherCommand,
  subscribeStateLauncher,
} from 'state-launcher/headless'

const publishCatalog = (snapshot: ReturnType<typeof getStateLauncherSnapshot>) => {
  console.log(JSON.stringify(snapshot))
}

publishCatalog(getStateLauncherSnapshot())
const unsubscribe = subscribeStateLauncher(publishCatalog)

await launchStateLauncherCommand('billing.paymentFailed')
await clearActiveState()
unsubscribe()

Documentation

Build or preview the docs with:

pnpm docs:build
pnpm docs:dev