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

gpu-heatmap

v0.1.2

Published

High-performance WebGPU/WebGL2 heatmap renderer for click data

Downloads

7

Readme

gpu-heatmap

⚠️ WORK IN PROGRESS ⚠️

A high-performance heatmap renderer powered by WebGPU with automatic WebGL2 fallback.
Optimized for visualizing hundreds of thousands to millions of points in real time.

  • 🚀 Fast — WebGPU compute shaders + optimized WebGL2 fallback
  • 🔥 Automatic engine selection (auto)
  • 🎛️ Simple API — demo mode or real data
  • 📦 Framework-agnostic (JS/TS/React/Vue/Svelte/etc.)
  • 🎨 CRO-style color palette (blue → green → yellow → red)

Installation

npm install gpu-heatmap

Basic Usage

import { createHeatmapApp } from 'gpu-heatmap'

const canvas = document.querySelector('#heat')

const data = {
  x: new Float32Array([0.1, 0.3, 0.7]),
  y: new Float32Array([0.2, 0.5, 0.9])
}

const app = await createHeatmapApp({
  canvas,
  mode: {
    kind: 'data',
    data
  }
})

// update later
await app.setData(newData)

// cleanup
app.dispose()

Demo Mode

Use auto-generated blobs of points for testing:

const app = await createHeatmapApp({
  canvas,
  mode: {
    kind: 'demo',
    demo: {
      points: 200_000,
      clusters: 8,
      minSpread: 0.05,
      maxSpread: 0.15
    }
  }
})

// regenerate demo data
await app.rerenderDemo()

Engine Selection

The engine can be chosen manually or automatically:

engine: 'webgpu'   // force WebGPU only
engine: 'webgl2'   // force WebGL2 only
engine: 'auto'     // DEFAULT — WebGPU first → fallback to WebGL2

Example:

const app = await createHeatmapApp({
  canvas,
  engine: 'auto',
  mode: { kind: 'data', data }
})

Data Format

Heatmap input format:

type HeatmapData = {
  x: Float32Array
  y: Float32Array
  w?: Float32Array   // optional per-point weight
}

Important:

  • Coordinates must be normalized (0–1)
  • All arrays must be equal length
  • If w is included, weights are automatically normalized per dataset

Example:

const data = {
  x: new Float32Array(N),
  y: new Float32Array(N),
  w: new Float32Array(N) // optional
}

Heatmap Options

Passed through heatmap: { ... }:

heatmap: {
  gridSize: { width: 1024, height: 1024 },
  kernelRadiusPx: 14,
  extent: { xMin: 0, xMax: 1, yMin: 0, yMax: 1 }
}

Available Options

| Option | Type | Description | | ---------------- | ---------------------------- | ------------------------------ | | gridSize | { width, height } | GPU grid resolution | | kernelRadiusPx | number | Gaussian radius for each point | | extent | { xMin, xMax, yMin, yMax } | Input spatial bounds |

Running the Demo Locally

The repo includes a standalone demo using Vite.

Start dev server

npm run dev

Build the demo

npm run preview

API Summary

createHeatmapApp(opts): Promise<HeatmapApp>

High-level helper recommended for most users.

HeatmapApp

type HeatmapApp = {
  heatmap: Heatmap
  setData(data): Promise<void>
  rerenderDemo?: () => Promise<void>
  dispose(): void
}

Low-Level Engine API

If you want direct control:

import { createHeatmap } from 'gpu-heatmap'

const heat = await createHeatmap(canvas, {
  engine: 'auto',
  gridSize: { width: 1024, height: 1024 }
})

heat.setData(data)
await heat.render()

Browser Compatibility

| Engine | Requirement | | ---------- | --------------------------------------- | | WebGPU | Chrome 113+, Edge 113+, modern GPU | | WebGL2 | Supported by nearly all modern browsers |

License

MIT © 2025