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

@yagejs-addons/virtual-controls

v0.2.0

Published

Mobile touch overlay for YAGE — virtual joystick + on-screen action buttons that drive the action map, with swappable presenters

Readme

@yagejs-addons/virtual-controls

Mobile touch overlay for YAGE: a virtual joystick and on-screen action buttons that drive the game through the input system — gameplay code reads ordinary actions (isPressed, getVector, getHoldDuration) and getStick(), and never knows the overlay exists.

  • Smart defaults — floating stick bottom-left, buttons auto-clustered bottom-right (1 button, a diagonal pair, or an A/B/X/Y diamond), sizes relative to the viewport, shown automatically on touch-first devices (visible: "auto").
  • No input leaks — every touch a control claims is consumed (consumePointer), so joystick drags and button taps never fire gameplay MouseLeft actions or tap-to-move handlers underneath.
  • Real action semantics — buttons hold actions via the synthetic action API (setActionHeld), so press/release edges, hold durations, and charge mechanics behave exactly like a physical key; the stick also feeds getStick("left") when no physical gamepad is active.
  • Customizable to fully custom — placements, zones, stick modes (fixed / floating / follow), thresholds, a flat theme for the built-in Graphics presenter, or your own presenter behind a two-interface contract. The headless model is usable with no renderer at all.

Install

npm install @yagejs-addons/virtual-controls @yagejs/core @yagejs/input @yagejs/renderer

@yagejs/renderer is optional — only the /presenters entry needs it.

Quick start

The bound action names must exist in your InputPlugin action map — the overlay drives existing actions (unknown names warn and are skipped):

import { VirtualControls } from "@yagejs-addons/virtual-controls";
import { createControlsPresenter } from "@yagejs-addons/virtual-controls/presenters";

engine.use(
  new InputPlugin({
    actions: {
      left: ["KeyA"], right: ["KeyD"], up: ["KeyW"], down: ["KeyS"],
      jump: ["Space"], dash: ["ShiftLeft"],
    },
  }),
);

class GameScene extends Scene {
  onEnter() {
    this.spawn("touch-controls").add(
      new VirtualControls({
        stick: { actions: ["left", "right", "up", "down"] }, // L/R/U/D order
        buttons: [
          { id: "a", action: "jump" },
          { id: "b", action: "dash" },
        ],
        presenter: createControlsPresenter(),
      }),
    );
  }
}

The overlay appears on touch-first devices and stays hidden on desktops; pass visible: true | false or call setVisible() to decide yourself.

Docs: yage.dev/addons/virtual-controls — runnable demo in the repo's examples/virtual-controls.html.