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

@napplet/nub-keys

v0.2.1

Published

NUB-KEYS message types for keyboard forwarding and action keybindings

Readme

@napplet/nub-keys

TypeScript message types for the keys NUB domain (keyboard forwarding and action keybindings).

Installation

npm install @napplet/nub-keys

Overview

NUB-KEYS provides bidirectional keyboard interaction between napplets and the shell. Sandboxed iframes capture keyboard events and prevent them from reaching the parent window, so shell-level hotkeys do not work when a napplet has focus. NUB-KEYS solves this with two mechanisms:

  1. Keyboard forwarding -- the napplet sends unbound keystrokes to the shell via keys.forward
  2. Action registration -- the napplet declares named actions the shell can bind to keys

When the shell binds an action to a key, it pushes binding updates to the napplet. The napplet suppresses forwarding for bound keys and triggers the action locally with zero latency.

Message Types

All messages use the NIP-5D JSON envelope wire format ({ type: "keys.<action>", ...payload }).

Napplet -> Shell

| Type | Payload | Description | |------|---------|-------------| | keys.forward | key, code, ctrl, alt, shift, meta | Forward a keystroke (fire-and-forget, no id) | | keys.registerAction | id, action | Register a named action (correlated by id) | | keys.unregisterAction | actionId | Remove a registered action (fire-and-forget) |

Shell -> Napplet

| Type | Payload | Description | |------|---------|-------------| | keys.registerAction.result | id, actionId, binding?, error? | Result of action registration | | keys.bindings | bindings[] | Complete binding list (not a diff) | | keys.action | actionId | Shell triggers an action in the napplet |

Usage

import type {
  KeysForwardMessage,
  KeysRegisterActionMessage,
  KeysRegisterActionResultMessage,
  KeysUnregisterActionMessage,
  KeysBindingsMessage,
  KeysActionMessage,
  KeysNubMessage,
  Action,
  RegisterResult,
  KeyBinding,
} from '@napplet/nub-keys';

import { DOMAIN } from '@napplet/nub-keys';
// DOMAIN === 'keys'

Supporting Types

interface Action {
  id: string;          // unique action identifier, e.g. "editor.save"
  label: string;       // human-readable label for the shell's keybinding UI
  defaultKey?: string; // suggested binding hint, e.g. "Ctrl+S"
}

interface RegisterResult {
  actionId: string;
  binding?: string;    // key combo the shell assigned, if any
}

interface KeyBinding {
  actionId: string;
  key: string;         // key combo string, e.g. "Ctrl+S"
}

Key Combo Format

Modifiers in alphabetical order: Alt+Ctrl+Meta+Shift+Key. Examples: Ctrl+S, Alt+Shift+P, F5, Escape.

Domain Registration

Importing @napplet/nub-keys automatically registers the 'keys' domain with the core dispatch singleton via registerNub(). This ensures dispatch.getRegisteredDomains() includes 'keys'.

Protocol Reference

License

MIT