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

@zandoh/keysmith

v0.3.2

Published

Keyboard shortcut manager for the web: commands, scopes, sequences, and user remapping. Fast, headless, accessible, framework agnostic.

Readme

keysmith

Keyboard shortcut manager for the web. Fast, headless, accessible, framework agnostic.

npm ci license

Documentation and live demo · Design spec · Roadmap

Why keysmith

keysmith is a shortcut manager, not a key binder. Commands have stable identity; keys attach to commands, and scopes decide where they fire. Handlers subscribe to file.save, never to mod+s, so user remapping, persistence, and help overlays come from the architecture instead of being bolted on.

  • Chords (mod+s) and sequences (g i, mod+k mod+s) in one recognizer, with timeouts
  • Scopes with explicit activation; collisions reported at registration via conflicts()
  • User remapping with serializable keymaps, including per-command disable, satisfying WCAG 2.1.4
  • Warnings when a binding collides with combinations the browser or OS claims
  • commands() introspection with platform display strings (⌘S / Ctrl+S) for cheatsheets and settings screens
  • A typing guard: unmodified bindings do not fire while the user is typing
  • Layout correctness (see below)
  • One dependency (@zandoh/tsbus), no UI, works with any framework or none

Install

npm install @zandoh/keysmith
# or: bun add / pnpm add / yarn add @zandoh/keysmith

Quick start

import { createKeysmith } from "@zandoh/keysmith";

const keys = createKeysmith();

keys.add({
  id: "file.save",
  keys: "mod+s", // Meta on macOS, Control elsewhere
  description: "Save the current file",
  onTrigger: () => save(),
});

keys.add({ id: "go.inbox", keys: "g i", scope: "list" });
keys.on("go.inbox", () => router.push("/inbox"));
keys.activate("list");

// User remapping, persisted anywhere JSON goes
keys.remap("go.inbox", "g m");
localStorage.setItem("keymap", JSON.stringify(keys.exportKeymap()));

// Data for a cheatsheet: descriptions, groups, "⌘S" / "Ctrl+S"
keys.commands();

Notation

| Notation | Meaning | | --------------------------- | ----------------------------------------------------------- | | mod+s | mod is Meta on macOS and Control elsewhere | | ctrl+alt+p | Explicit modifiers: ctrl, alt, shift, meta | | g i | Sequence: g then i, within the sequence timeout | | mod+k mod+s | Chord sequence | | ? | Symbols match the produced character, with or without shift | | enter, esc, up, f5 | Named keys | | w with mode: "position" | Physical key (KeyW): stays put on AZERTY, Dvorak, etc. |

Invalid notation throws at registration with a message that says how to fix it, including cross-platform ambiguities like mod+ctrl and layout traps like shift+/.

API

| Method | Purpose | | --------------------------------------- | -------------------------------------------------- | | add(options) | Register a command binding; returns a remover | | addAll(definitions) | Register a manifest atomically; returns a remover | | on(id, handler, opts?) | Subscribe to a command (priority, AbortSignal) | | onPattern(pattern, handler) | Wildcard subscription, e.g. "editor:*" | | activate(scope) / deactivate(scope) | Control where bindings fire | | remap(id, keys \| null) | Override or disable a binding at runtime | | resetKeymap(id?) | Clear one override, or all of them | | exportKeymap() / importKeymap(map) | Serialize and restore user overrides | | commands(layout?) | Metadata and display strings for every command | | conflicts() | Current duplicate and prefix collisions | | destroy() | Remove listeners and registrations |

Options on createKeysmith: platform, target, sequenceTimeout, onError, and domEvents (dispatch each trigger as CustomEvent("keysmith:<id>") on document, no import required at the consumption site).

Layout correctness

Most shortcut libraries mishandle non-US layouts. keysmith treats these as core requirements, each covered by regression tests:

  • IME composition and dead keys never match
  • AltGr text entry (reported as ctrl+alt on Windows) is never stolen by ctrl+alt chords, and AltGr-produced symbols still match symbol bindings
  • Alt chords survive macOS character composition (alt+k types "˚"; the binding still fires)
  • Symbols match the produced character regardless of shift state
  • Position mode targets physical keys for spatial layouts like WASD, and getLayoutMap() + commands(layout) display those bindings using the user's actual key labels where the browser supports it

The matrix runs as Playwright tests through the real browser event pipeline (AZERTY, QWERTZ AltGr, Dvorak, macOS composition, IME) alongside the unit suite.

Server rendering

Importing and constructing are safe without a DOM: no listener attaches, and the data APIs (commands(), conflicts(), keymap import/export) work anywhere. Handlers cannot be serialized; ship command definitions as data with addAll(manifest) and attach handlers by id on the client. The worked pattern, including the platform hint for server-rendered display strings, is in docs/ssr.md.

Status

Pre-1.0. The API surface above is stable in shape but may still change in detail; see the roadmap and changelog.

License

MIT