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

@type-editor/keymap

v0.0.3

Published

This is a refactored version of the ProseMirror's 'keymap' module. Original: https://github.com/ProseMirror/prosemirror-keymap

Readme

@type-editor/keymap

This is a refactored version of the prosemirror-keymap module.

A plugin for conveniently defining key bindings in a Type Editor.

Installation

npm install @type-editor/keymap

Overview

This module provides utilities for defining keyboard shortcuts that trigger editor commands. It exports a keymap function that creates a plugin from a set of key bindings, and pre-configured base keymaps with common editing shortcuts.

API

keymap

Creates a keymap plugin for the given set of key bindings.

import { keymap } from '@type-editor/keymap';
import { toggleBold, insertHardBreak } from './my-commands';

const myKeymap = keymap({
  "Mod-b": toggleBold,
  "Mod-Enter": insertHardBreak,
  "Alt-ArrowUp": joinUp
});

Bindings should map key names to command-style functions (see @type-editor/commands), which will be called with (EditorState, dispatch, EditorView) arguments and should return true when they've handled the key.

keydownHandler

Creates a keydown handler function from a set of key bindings. This is useful when you want to handle key events directly in editor props rather than through a plugin.

import { keydownHandler } from '@type-editor/keymap';

const handler = keydownHandler({
  "Enter": insertParagraph,
  "Mod-b": toggleBold
});

// Use in EditorProps: { handleKeyDown: handler }

Base Keymaps

The module exports pre-configured keymaps with common editing bindings:

| Export | Description | |-----------------|-------------------------------------------------------------------------------| | baseKeymap | Platform-aware keymap (uses macBaseKeymap on Mac, pcBaseKeymap elsewhere) | | pcBaseKeymap | Standard PC keyboard bindings | | macBaseKeymap | Mac-specific bindings (extends pcBaseKeymap with additional shortcuts) |

Default Bindings

The base keymaps include the following bindings (commands are chained where multiple are listed):

| Key | Command(s) | |---------------------|------------------------------------------------------------------------| | Enter | newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock | | Mod-Enter | exitCode | | Backspace | deleteSelection, joinBackward, selectNodeBackward | | Mod-Backspace | deleteSelection, joinBackward, selectNodeBackward | | Shift-Backspace | deleteSelection, joinBackward, selectNodeBackward | | Delete | deleteSelection, joinForward, selectNodeForward | | Mod-Delete | deleteSelection, joinForward, selectNodeForward | | Mod-a | selectAll |

Additional Mac-only bindings

| Key | Command | |------------------------|------------------------| | Ctrl-h | Same as Backspace | | Alt-Backspace | Same as Mod-Backspace | | Ctrl-d | Same as Delete | | Ctrl-Alt-Backspace | Same as Mod-Delete | | Alt-Delete | Same as Mod-Delete | | Alt-d | Same as Mod-Delete | | Ctrl-a | selectTextblockStart | | Ctrl-e | selectTextblockEnd |

Key Name Format

Key names may be strings like "Shift-Ctrl-Enter" — a key identifier prefixed with zero or more modifiers.

Key Identifiers

Key identifiers are based on the strings that can appear in KeyboardEvent.key. Use lowercase letters to refer to letter keys (or uppercase letters if you want shift to be held). You may use "Space" as an alias for the " " name.

Modifiers

Modifiers can be given in any order:

| Modifier | Aliases | |----------|--------------------------------------------------| | Shift- | s- | | Alt- | a- | | Ctrl- | c-, Control- | | Cmd- | m-, Meta- | | Mod- | Platform-aware: Cmd- on Mac, Ctrl- elsewhere |

For characters that are created by holding shift, the Shift- prefix is implied and should not be added explicitly.

Multiple Keymaps

You can add multiple keymap plugins to an editor. The order in which they appear determines their precedence — plugins earlier in the array get to dispatch first.

import { keymap, baseKeymap } from '@type-editor/keymap';

const plugins = [
  keymap(customBindings),  // Custom bindings take precedence
  keymap(baseKeymap)       // Fallback to base keymap
];

Related Packages

License

MIT