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

gap-inspector

v0.2.2

Published

A React dev overlay that measures visual gaps and explains the CSS/layout contributions behind them.

Readme

Gap Inspector

Gap Inspector is a React dev overlay for explaining visual spacing. It lets you draw a horizontal or vertical line between rendered elements, then copies a markdown report with the selected DOM elements, total gap, CSS/layout contributors, and a pixel equation.

It is built for the frontend workflow where "make this gap match that gap" is too vague for an agent to execute reliably.

Install

npm install gap-inspector -D

Usage

import { GapInspector } from "gap-inspector";

export function App() {
  return (
    <>
      <YourApp />
      <GapInspector />
    </>
  );
}

The toolbar appears in the bottom-right corner. Open it and draw a line between two rendered edges; the measurement axis is inferred from the drag direction. Drag the panel header to move the inspector anywhere on screen.

What It Reports

Measured horizontal gap: 48px

From: `.Sidebar`
To: `.PreviewPanel`
Common ancestor: `.MainShell`

Contributions:
- 16px from `.MainShell` column-gap (16px) - flex parent
- 8px from `.TableWrap` padding-right (8px)
- 6px from `.MarketTableBody` scrollbar gutter - Native scrollbar gutter inside this scroll container.
- 24px from `.MainShell` flex space-between - Rendered space between sibling layout branches.

Equation: 16px + 8px + 6px + 24px = 54px

Notes

The tool measures rendered geometry first, then attributes pixels to computed CSS where it can. Some spacing is not directly caused by a single margin or padding declaration. Flex distribution, grid tracks, explicit widths, min-width, transforms, scrollbars, and empty wrappers may show up as layout or unattributed space.

That distinction is deliberate: the report should be useful to an LLM without inventing false causes.

Adjacent vertical margins that collapse are reported as the single winning margin (with a note about the collapsed sibling). Negative margins and transformed elements cannot be expressed as positive contributors, so they are surfaced as warnings instead.

Hold /Alt while the inspector is open to let pointer events through to the page — useful for opening click-driven menus or scrolling nested panes into the state you want to measure.

Limitations

  • Closed shadow roots cannot be inspected. Open shadow roots are pierced for hit-testing and get host >>> inner selectors in reports.
  • Iframes are measured as opaque boxes; their contents render in a separate document and cannot be attributed (the report warns when an endpoint is an iframe).
  • CSS-only :hover states collapse as soon as the pointer moves onto the inspector canvas, so they cannot be measured. The Alt passthrough covers UI that stays open after a click.
  • position: fixed/sticky elements move relative to the document, so their committed overlays catch up one frame behind during scroll (everything else tracks scroll with zero lag).

API

<GapInspector
  initiallyOpen={false}
  onMeasure={(measurement) => {
    console.log(measurement.markdown);
  }}
/>

You can also call the measurement engine directly:

import { measureGap } from "gap-inspector";

const measurement = measureGap({
  axis: "horizontal",
  start: { x: 220, y: 340 },
  end: { x: 420, y: 340 }
});