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

@zakkster/lite-gamepad

v1.0.0

Published

Unified keyboard + gamepad input poller. Radial deadzone, diagonal normalization, AbortController cleanup.

Readme

@zakkster/lite-gamepad

npm version npm bundle size npm downloads npm total downloads TypeScript Dependencies License: MIT

🎮 What is lite-gamepad?

@zakkster/lite-gamepad unifies WASD, arrow keys, and gamepad analog sticks into a single normalized Float32Array(2) movement vector.

It gives you:

  • 🎮 Unified keyboard + gamepad in one API
  • 🕹️ Radial deadzone with smooth scaling (no snap)
  • ↗️ Diagonal normalization (no speed boost on diagonals)
  • 🧹 AbortController cleanup — no leaked listeners
  • 🔢 Uint8Array key state (zero allocation per poll)
  • 🪶 < 1 KB minified

Call poll() once per frame — get a normalized direction vector.

Part of the @zakkster/lite-* ecosystem — micro-libraries built for deterministic, cache-friendly game development.

🚀 Install

npm i @zakkster/lite-gamepad

🕹️ Quick Start

import { InputVectorizer } from '@zakkster/lite-gamepad';

const input = new InputVectorizer();

function gameLoop() {
    const [dx, dy] = input.poll();
    player.x += dx * speed * dt;
    player.y += dy * speed * dt;
    requestAnimationFrame(gameLoop);
}

// Check action buttons
if (input.isActionPressed(32, 0)) shoot(); // Space or Gamepad A

// Cleanup
input.destroy();

🧠 Why This Exists

Keyboard gives you [-1, 0, 1] per axis. Gamepad gives you [-1.0 ... 1.0] with deadzone drift. lite-gamepad normalizes both into the same Float32Array(2) — clamped magnitude, smooth deadzone, zero allocation.

📊 Comparison

| Library | Size | Keyboard | Gamepad | Deadzone | Normalized | Install | |---------|------|----------|---------|----------|------------|---------| | gamepad.js | ~3 KB | No | Yes | Basic | No | npm i gamepad.js | | keymaster | ~4 KB | Yes | No | N/A | No | npm i keymaster | | lite-gamepad | < 1 KB | Yes | Yes | Radial smooth | Yes | npm i @zakkster/lite-gamepad |

⚙️ API

new InputVectorizer()

poll() — Returns Float32Array(2) normalized movement vector. Call once per frame.

isActionPressed(keyCode, gamepadButtonIndex?) — Check action key/button state

destroy() — Cleans up all event listeners via AbortController

🧪 Benchmark

N/A — input polling is I/O bound, not CPU bound.
Key advantage: zero allocation per poll() call (Float32Array reuse).

📦 TypeScript

Full TypeScript declarations included in InputVectorizer.d.ts.

📚 LLM-Friendly Documentation

See llms.txt for AI-optimized metadata and usage examples.

License

MIT