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

@debuffjp/input

v0.24.1

Published

Action-based keyboard, pointer and gamepad input for debuff

Readme

@debuffjp/input

Action-based input across keyboard, mouse/touch/pen (Pointer Events) and gamepads (standard mapping). No dependencies.

import { Input } from "@debuffjp/input";

const input = new Input(game, {
  bindings: {
    left: ["ArrowLeft", "KeyA", "PadLeft", "PadStickLeft"],
    right: ["ArrowRight", "KeyD", "PadRight", "PadStickRight"],
    jump: ["Space", "PadA", "Pointer"],
  },
});

// inside Scene.update
const dx = input.axis("left", "right");
if (input.pressed("jump")) jump();

Edges clear automatically after each simulation step, so a tap shorter than a frame is never missed.

Binding names

| Source | Names | | --- | --- | | Keyboard | KeyboardEvent.code: Space, KeyZ, ArrowUp, … | | Pointer | Pointer (primary mouse button, touch or pen), PointerRight, PointerMiddle (right and middle mouse buttons) | | Gamepad | PadA PadB PadX PadY PadL1 PadR1 PadL2 PadR2 PadSelect PadStart PadL3 PadR3 PadUp PadDown PadLeft PadRight | | Left stick | PadStickUp PadStickDown PadStickLeft PadStickRight |

API

  • input.down(action), input.pressed(action), input.released(action), input.axis(neg, pos)
  • input.rebind(action, keys): replace an action's bindings (a controls menu), keeping captured keys in step. input.bindings is Input's own copy of the map you passed, so change it with rebind rather than in place.
  • input.pointer: x, y (logical), down, pressed, released, touches
  • input.pointer.kind: "mouse", "touch" or "pen", whichever made the latest press
  • input.pointer.touchesStarted, touchesEnded: contacts that started or ended this step (each with id, x, y, kind), so a game doesn't diff touches itself
  • input.pointer.right, input.pointer.middle: down, pressed, released for the right and middle mouse buttons
  • input.pointer.wheel, wheelX: wheel or trackpad scroll this step in CSS pixels (positive = down / right), reset every step. Pass captureWheel: true to stop the page scrolling under a game that zooms with the wheel.
  • input.keys: down(code), pressed(code), released(code)
  • input.pads: stickX, stickY, connected, deadzone
  • Programmatic control for tests and on-screen buttons: keys.press/release, pointer.press/move/release/scroll/pressButton/releaseButton, and pointer.touchStart(id, x, y) / touchMove / touchEnd for multi-touch (the first contact also presses the primary pointer, as a real touch does)