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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@monstermann/hotkeys

v0.0.0

Published

Highly flexible keyboard shortcut management for any environment.

Downloads

3

Readme

npm bundle size (scoped version) npm bundle size (scoped version)

hotkeys

Highly flexible keyboard shortcut management for any environment.

This library focuses on providing the data-structure and building blocks necessary to allow you to build probably™ anything you can think of regarding shortcuts.

It does so by adopting a code-over-config approach, a range of utility functions that come with no side-effects, or any default behaviour. You are in control of how to parse shortcuts, how to register them, how to match them against keyboard events and how to execute them.

Motivation

  • Custom shortcut parsing
    • The provided ones may not correctly detect certain keys
    • You would like to use an alternative syntax such as VIM-style shortcuts (<c-w><left>)
    • Custom aliases
  • Custom event handling
    • You would like to ship shortcuts in non-browser environments such as react-ink, or terminals
    • You would like to programmatically trigger shortcuts
    • High control over browser event handling
      • Binding to document, a focusable element, React refs, React callbacks, third-party libraries, …
      • Listening to 'keydown', 'keyup', 'keypress', 'input', 'beforeinput', with or without { capture: true }, …
  • Telemetry
    • Tracking shortcut usage
    • Tracking attempted shortcut usage (shortcuts that have been tried, but not yet implemented)
  • Resolving shortcut conflicts
    • Throwing Exceptions
    • Or using different strategies such as priorities, scopes, layers
  • Building a UI around shortcuts
    • Retrieving a list of currently active shortcuts, along with titles, descriptions and SVG icons, to be fed into something like cmdk or kbar
    • Displaying shortcuts using symbols such as ⌘K
    • Displaying a UI for incomplete shortcut sequences (eg. like which-key)
  • Recording and replaying keypresses
    • Filtering out certain keypresses
  • Error handling
    • Attaching additional meta-information such as the shortcut
  • Sequence management
    • Emulating VSCode's behaviour (Infinite timeouts, warning message for invalid sequences)
    • Emulating VIM's behaviour (timeoutlen, nowait, canceling partial sequences with esc)
  • Grouping shortcuts together using scopes, enabling/disabling scopes, etc.
  • Disabling specific shortcuts under certain conditions
  • Different keybindings enabled only for MacOS/Windows
  • Support for sticky keys for accessibility reasons
  • Pausing and resuming event listeners
  • Skipping between CompositionStart & CompositionEnd events
  • Support user-provided { 'ctrl+a': 'CommandName' } configs similar to VSCode or Zed
  • Emulating Emacs' or VIM's concept of (sub)modes (eg. Hydra.nvim)

As I have been frequently hitting brick walls trying to go for any of the above, I set out to create this 📦!

Alternatives

If the above does not resonate with you, you might want to consider alternatives that provide a more out-of-the-box experience, for example:

Overview