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

zoooom

v1.2.1

Published

ENHANCE! Pan, zoom, and inspect images with mouse, touch, keyboard, and joystick. Zero dependencies.

Readme

zoooom

enhance

Zero-dependency pan/zoom image viewer. 25KB.

I got tired of image hosts compressing everything and couldn't find a viewer that zoomed toward the cursor instead of the center. So I built one.

Interactive demo · Gallery (165 images)

npm install zoooom
import Zoooom from 'zoooom';
new Zoooom('#container', { src: 'image.jpg' });

What's different

Most zoom libraries either scale from center (wrong), require a framework, or are map engines in disguise.

This one zooms toward your cursor. The coordinate math keeps the pixel under your pointer stationary at every scale change. Trackpad scrolling is detected separately from mouse wheel clicks and gets continuous exponential zoom instead of discrete steps. Pinch-to-zoom tracks the actual midpoint between your fingers, updated each frame. Safari gesture events are handled where available.

Images render at native resolution regardless of container size. A calculated base scale fits them visually, so zooming in reveals actual source pixels instead of upscaling a constrained raster. This works in a 500px embed or a full-viewport viewer.

Zero dependencies. ~25KB. Works with a script tag.


Input

| Method | Action | |--------|--------| | Mouse drag | Pan | | Scroll wheel | Zoom toward cursor | | Trackpad | Continuous zoom toward cursor | | Ctrl+wheel | Pinch gesture (Windows/Linux) | | Safari gestures | Native gesture zoom | | Single touch | Pan | | Two-finger pinch | Zoom with center tracking | | Arrow keys | Pan with momentum | | +/- keys | Zoom | | R key | Reset | | Joystick (plugin) | 8-direction pan + zoom |

API

const viewer = new Zoooom(container, options);

viewer.zoomIn()
viewer.zoomOut()
viewer.enhance()                 // alias: zoomIn
viewer.zoomTo(scale)
viewer.zoomToPoint(scale, x, y)
viewer.panTo(x, y)
viewer.panBy(dx, dy)
viewer.center()
viewer.reset()
viewer.load(src, alt?)
viewer.destroy()

viewer.scale        // current zoom (1 = fitted)
viewer.translateX   // current X offset
viewer.translateY   // current Y offset
viewer.isLoaded

viewer.on('load' | 'error' | 'zoom' | 'pan' | 'reset' | 'destroy', fn)
viewer.off(event, fn)

Options

| Option | Default | | |--------|---------|---| | src | — | Image URL | | alt | 'Image' | Alt text | | minScale | 0.8 | Min zoom | | maxScale | 'auto' | From native dimensions | | zoomFactor | 1.5 | Per-step multiplier | | velocityDamping | 0.85 | Momentum friction | | trackpadSensitivity | 0.002 | Continuous zoom tuning | | mouse | true | | | touch | true | | | wheel | true | | | keyboard | true | | | loading | true | Loading spinner | | injectStyles | true | Auto-inject CSS | | respectReducedMotion | true | Honor motion preference | | onLoad | — | | | onZoom | — | | | onPan | — | |

The container must have explicit dimensions (width and height). The library does not set these.

Joystick Plugin

import { ZoooomJoystick } from 'zoooom/joystick';
new ZoooomJoystick(viewer, { radius: 60, deadzone: 0.1, maxSpeed: 10 });

Full bundle: unpkg.com/zoooom/dist/zoooom-full.iife.global.js

Accessibility

  • prefers-reduced-motion honored (no transitions, no momentum)
  • Full keyboard navigation
  • ARIA on all controls
  • 44px touch targets
  • Joystick announces direction and speed to screen readers

CSS Variables

[data-zoooom] {
  --zoooom-bg: #000;
  --zoooom-spinner-color: #2196f3;
  --zoooom-spinner-track: rgba(255, 255, 255, 0.3);
  --zoooom-spinner-size: 40px;
  --zoooom-loading-bg: rgba(0, 0, 0, 0.85);
  --zoooom-cursor: grab;
  --zoooom-cursor-active: grabbing;
}

Disable auto-injection with injectStyles: false and use zoooom/css for a standalone stylesheet.

Script Tag

<div id="v" style="width:100%;height:100vh"></div>
<script src="https://unpkg.com/zoooom/dist/zoooom.iife.global.js"></script>
<script>new Zoooom('#v', { src: 'photo.jpg' });</script>

License

MIT