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

@tracker1/image-zoomer-too

v1.0.0

Published

A React component for image viewing with zoom/pan support, using EventEmitter for external control

Readme

@tracker1/image-zoomer-too

npm version JSR License: MIT

A React component for image viewing with zoom/pan support. Designed to work with any UI framework by using EventEmitter for external control, allowing you to provide your own zoom controls.

Features

  • Fit to Container - Image initially scales to fit within the container
  • Zoom In/Out - Zoom from fit size up to 300% via mouse wheel, pinch gestures, or external controls
  • Pan Support - Click and drag to pan when zoomed in
  • Touch Gestures - Pinch to zoom, drag to pan on touch devices
  • External Control - Use EventEmitter to control zoom from your own UI components
  • No Style Injection - Styles are applied directly to elements, no global CSS required

Installation

JSR (Deno)

import { ImageZoomer, useImageZoomer } from "jsr:@tracker1/image-zoomer-too";

NPM

npm install @tracker1/image-zoomer-too
import { ImageZoomer, useImageZoomer } from "@tracker1/image-zoomer-too";

Usage

React Component

import { ImageZoomer, useImageZoomer } from "@tracker1/image-zoomer-too";

function MyImageViewer() {
  const zoomer = useImageZoomer();

  return (
    <div style={{ width: "100%", height: "500px" }}>
      {/* Your custom zoom controls */}
      <div>
        <button onClick={zoomer.zoomIn}>+</button>
        <button onClick={zoomer.zoomOut}>-</button>
        <button onClick={zoomer.zoomReset}>Reset</button>
      </div>

      {/* The image zoomer component */}
      <ImageZoomer
        imageUrl="/path/to/image.jpg"
        emitter={zoomer.emitter}
        onZoomerReady={zoomer.onZoomerReady}
      />
    </div>
  );
}

useImageDimensions Hook

A utility hook to get image dimensions before rendering:

import { useImageDimensions } from "@tracker1/image-zoomer-too";

function MyComponent() {
  const dimensions = useImageDimensions("/path/to/image.jpg");

  if (!dimensions) {
    return <div>Loading...</div>;
  }

  return (
    <div>
      Image size: {dimensions.width} x {dimensions.height}
    </div>
  );
}

API

React Exports

<ImageZoomer />

| Prop | Type | Description | | --------------- | ------------------------------------ | ---------------------------------------- | | imageUrl | string | URL of the image to display | | emitter | ZoomerEventEmitter | EventEmitter for receiving zoom commands | | className | string? | Optional CSS class name | | style | React.CSSProperties? | Optional inline styles | | onZoomerReady | (instance: ZoomerInstance) => void | Callback when zoomer is initialized |

useImageZoomer()

Returns an object with:

| Property | Type | Description | | --------------- | ------------------------ | ----------------------------------- | | emitter | ZoomerEventEmitter | EventEmitter to pass to ImageZoomer | | instance | ZoomerInstance \| null | The zoomer instance (after ready) | | zoomIn | () => void | Zoom in by one step | | zoomOut | () => void | Zoom out by one step | | zoomReset | () => void | Reset to fit size | | onZoomerReady | (instance) => void | Callback to pass to ImageZoomer |

useImageDimensions(url)

| Parameter | Type | Description | | --------- | ----------------------------- | ----------------- | | url | string \| null \| undefined | Image URL to load |

Returns { width: number, height: number } | null

Controls

| Input | Action | | ------------- | ------------------------------ | | Mouse wheel | Zoom in/out at cursor position | | Click + drag | Pan the image | | Pinch gesture | Zoom in/out (touch devices) | | Touch drag | Pan the image (touch devices) |

Demo

View the live demo at: https://tracker1.github.io/image-zoomer-too/

License

MIT