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

tipviz

v2.3.2

Published

Framework-agnostic a tooltip Web Components for modern web applications. Focused on data visualization.

Downloads

60

Readme

tipviz

Drop-in tooltip web component for data visualizations. Zero dependencies, works anywhere.

Add rich, interactive tooltips to D3 charts or any DOM element with a few lines of code. The <tip-viz-tooltip> custom element handles positioning, HTML content, and styling — no framework required.

Features

  • Framework-agnostic — vanilla JS, React, Vue, Svelte, D3… if it renders HTML, tooltips work
  • Shadow DOM encapsulation — styles don't leak in or out
  • Auto-positioning — moves itself to document.body for correct scroll-aware placement
  • Three styling modessetStyles(), stylesheet attribute, or CSS ::part()
  • Sanitized HTML — uses setHTML() with fragment fallback; no raw innerHTML
  • 8 directional placementsn, s, e, w, nw, ne, sw, se
  • Typed API — full TypeScript types included

Installation

CDN (ESM) — add one script tag and go:

<script type="module" src="https://cdn.jsdelivr.net/npm/tipviz@latest/dist/index.mjs"></script>

CDN (UMD) — no ES modules support:

<script src="https://cdn.jsdelivr.net/npm/tipviz@latest/dist/index.umd.js"></script>

npm / pnpm / yarn / bun:

npm i tipviz
# pnpm add tipviz / yarn add tipviz / bun add tipviz

Quick Usage

// 1. Place in HTML (anywhere — it auto-moves to body)
<tip-viz-tooltip id="tooltip"></tip-viz-tooltip>

// 2. Configure
const tooltip = document.getElementById("tooltip");
tooltip.setHtml((data) => `<div>${data.label}: ${data.value}</div>`);
tooltip.setDirection(() => "n");          // n | s | e | w | nw | ne | sw | se
tooltip.setOffset(() => [0, 8]);        // [x, y] — x→left, y→top
tooltip.setStyles(`
  .tipviz-tooltip { background: rgba(0,0,0,0.85); color: white; padding: 6px; border-radius: 4px; }
`);

// 3. Show / hide on interaction
element.addEventListener("mouseenter", (e) => tooltip.show(someData, e.currentTarget));
element.addEventListener("mouseleave", () => tooltip.hide());

API Reference

Methods

| Method | Description | |--------|-------------| | setHtml(fn) | Sets the HTML content callback (data, target) => string | | setDirection(fn) | Sets the placement direction callback (data, target) => Direction | | setOffset(fn) | Sets the pixel offset callback (data, target) => [x, y] | | setStyles(css) | Injects CSS via CSSStyleSheet with <style> fallback | | loadStylesheet(url) | Loads an external stylesheet into the shadow root | | show(data, target) | Renders and positions the tooltip | | hide() | Hides the tooltip |

Attributes

| Attribute | Default | Description | |-----------|---------|-------------| | transition-duration | 200 | Fade duration in milliseconds | | stylesheet | — | URL to load inside the shadow root | | no-auto-reposition | — | Opt out of auto-moving to document.body |

Events

tooltip.addEventListener("show", (e) => {
  console.log(e.detail.target, e.detail.data, e.detail.direction, e.detail.position);
});
tooltip.addEventListener("hide", () => { /* ... */ });

Styling

Three independent options:

// 1. CSS string injected into shadow root
tooltip.setStyles(`.tipviz-tooltip { background: black; color: white; }`);

// 2. External stylesheet loaded into shadow root
// <tip-viz-tooltip stylesheet="/tooltip.css"></tip-viz-tooltip>

// 3. CSS ::part() from outside the shadow DOM
// tip-viz-tooltip::part(tooltip-box) { background: black; color: white; }

Documentation


Development

Requirements: Node.js >= 18

git clone https://github.com/MetalbolicX/tipviz.git
cd tipviz
pnpm install

pnpm run dev           # vite dev server (demo + examples)
pnpm run build         # vite build (docs / demo)
pnpm run tsdown:build  # library build → dist/ (cjs, es, umd, dts)
pnpm run test          # unit + integration tests
pnpm run test:watch    # watch mode

Typecheck and lint (not wired to npm scripts):

npx tsc --noEmit
npx eslint src/

License

MIT — see the LICENSE file.