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

v3.0.1

Published

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

Downloads

252

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()
  • Template + data bindingsetTemplate() + setData() for O(1) DOM updates
  • 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>

Zero-JS setup

No JavaScript required — set template and data as attributes:

<tip-viz-tooltip template='<div data-bind="label"></div>' data='{"label":"Sales"}'></tip-viz-tooltip>
<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.setTemplate(`<div data-bind="label"></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.setData({ label: "Hello World" });
  tooltip.show(e.currentTarget);
});
element.addEventListener("mouseleave", () => tooltip.hide());

API Reference

Methods

| Method | Description | |--------|-------------| | setTemplate(html) | Sets the HTML template with [data-bind] binding attributes | | setData(data) | Updates bound elements with matching data-bind keys | | 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 | | setSanitizerConfig(config) | Overrides the default sanitization config | | show(target) | Positions and reveals 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
pnpm run validate      # lint + typecheck + tests (reusable validation)

Typecheck and lint (also available as pnpm run validate):

npx tsc --noEmit
npx eslint src/

Release & publish workflow

Dry-run (local, no registry contact):

pnpm run tsdown:build
pnpm run validate
pnpm run publish:dry-run

Real publish (requires npm OTP + registry credentials):

pnpm run tsdown:build   # triggered automatically by prepack
pnpm run validate        # triggered automatically by prepublishOnly
npm publish             # or: pnpm publish

prepublishOnly and prepack run automatically on npm publish/pnpm pack so validation and the library build are guaranteed. Use publish:dry-run to inspect exactly what would be published before touching any registry.


License

MIT — see the LICENSE file.