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

inpt

v0.0.0

Published

A collection of input management tools.

Downloads

92

Readme

Input Controller

CI Version

A fast, event-based input management library for the browser.

Demo · Documentation

Installation

npm install input-controller

Features

  • Emits action events for bound inputs.
  • Emits normalized events for different pointer types and gestures.
  • Supports input bindings with user-defined actions.
  • Supports input combinations with modifiers.
    • Input matching uses fast bitwise operations.
    • Matches are reevaluated immediately when any input changes.
  • Supports different pointer lock behaviors per pointer button: none, lock and lock-hold.
  • Disables the context menu when any action is bound to the secondary button.
    • This does not apply if the action also requires a modifier.

Usage

import { InputManager } from "input-controller";

const inputManager = new InputManager(settings.input, domElement);
inputManager.addEventListener("activate", event => console.log(event));
inputManager.addEventListener("deactivate", event => console.log(event));
inputManager.addEventListener("move", event => console.log(event));

Settings

Configuration

import { KeyCode, Input, PointerButton } from "input-controller";

const settings = inputManager.settings;
settings.pointer.setBehavior(PointerButton.MAIN, "lock");

const keyBindings = settings.keyBindings;
keyBindings.set("Space", "jump");
keyBindings.set(new Input("KeyS", { modifiers: ["Ctrl"] }), "save");

const pointerBindings = settings.pointerBindings;
pointerBindings.set(PointerButton.MAIN, "drag");
pointerBindings.set(Gesture.PINCH, "zoom");
pointerBindings.set(Gesture.ROTATE, "rotate");

See the docs for more information.

Saving and Loading

// JSON round-trip.
const json = JSON.stringify(settings);
settings.fromJSON(json);

// Via local storage.
localStorage.setItem("input-controller", JSON.stringify(settings));
settings.fromJSON(localStorage.getItem("input-controller"));

// Save as JSON file.
const settingsURL = URL.createObjectURL(settings.toBlob());
const a = document.createElement("a");
a.setAttribute("href", settingsURL);
a.setAttribute("download", "input-controller.json");
a.click();
URL.revokeObjectURL(settingsURL);

// Load from JSON file.
fetch("./input-controller.json")
	.then(response => response.text())
	.then(data => settings.fromJSON(data))
	.catch(e => console.error(e));

Contributing

Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.