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

@plotdb/scrolly

v0.1.0

Published

A tiny scrollytelling engine + optional d3 chart helpers

Readme

@plotdb/scrolly

A tiny scrollytelling engine, plus a few optional d3 chart helpers.

  • Engine (Scrolly.init) — pure DOM + IntersectionObserver, zero dependencies.
  • Chart helpers (Scrolly.chart.*) and map loader (Scrolly.map.*) — thin conveniences that touch d3 / pdmaptw / topojson from the global scope only when called. A page that never calls them needs no d3.

Written in plain JS. Loads as a classic script and exposes a global window.Scrolly.

Install / include

<script src="scrolly.min.js"></script>

or via a bundler using @plotdb/scrolly (browser/main → dist/index.min.js).

The markup contract

Two kinds of elements, tied together by a shared data-scene:

<!-- narrative: the steps that scroll past -->
<div class="step" data-scene="intro"></div>
<div class="step" data-scene="intro" data-phase="zoom"></div>
<div class="step" data-scene="map"></div>

<!-- graphic: sticky layers, one shown at a time -->
<div class="scene" data-scene="intro">…</div>
<div class="scene" data-scene="map">…</div>

As each .step reaches the middle of the viewport, the engine:

  • toggles .on onto the matching .scene (others lose it),
  • toggles .active onto the current .step,
  • calls your onStep(scene, phase, stepEl).

You supply the CSS (position the .scenes absolutely inside a sticky stage, fade on .on). data-phase lets several steps share one scene but request different states.

Engine

const ctrl = Scrolly.init({
  onStep(scene, phase, stepEl) {   // called on every step change, and on resize (stepEl=null)
    DRAW[scene] && DRAW[scene](phase);
  },
  // options (all optional):
  stepSel:   '.step',              // step selector
  sceneSel:  '.scene',             // scene selector
  rootMargin:'-45% 0px -45% 0px',  // IntersectionObserver band (default: middle of viewport)
});

ctrl.show('map', 'zoom');          // drive it programmatically
ctrl.current();                    // -> { scene, phase }

On resize, onStep is re-called (debounced) with the current scene so charts can redraw to the new size.

Chart helpers (need global d3)

const { frame, grid, axisX, axisY, drawIn, legendBar, linreg } = Scrolly.chart;

const { svg, W, H, M } = frame(hostEl, { t:20, r:20, b:28, l:56 }); // clear host, sized <svg>
grid(svg, y, M, W);                       // horizontal gridlines at y.ticks(5)
axisX(svg, x, H, M, fmt);                 // bottom axis (optional tickFormat)
axisY(svg, y, M, fmt);                    // left axis
drawIn(path, dur);                        // animate a <path> drawing itself in
legendBar(hostEl, lo, hi, LO, HI, unit);  // horizontal gradient legend
const { m, b, r } = linreg(xs, ys);       // least-squares slope/intercept + Pearson r

Map helper (needs global pdmaptw + topojson)

const fc = await Scrolly.map.loadFeatures('county'); // topojson -> GeoJSON, names normalised
const name = Scrolly.map.nameOf(feature);            // normalised (臺->台) place name

Scrolly.nz(s) is the same 臺→台 normaliser, exposed for building name→code lookups.

License

MIT