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

@emyrk/wow-tooltip-renderer

v0.1.0

Published

Pure TypeScript resolver and formatters for World of Warcraft spell/item tooltips from DBC-style records. No React, no fetch, no styling.

Readme

@emyrk/wow-tooltip-renderer

Pure TypeScript renderer for World of Warcraft spell and item tooltips built from DBC-style records. No React, no fetch, no styling — data in, strings (and hex colors) out. The React tooltip components and data fetching live in a separate package / the consuming app.

Why

Chronicle and Chronicle Wiki both render tooltips from spell/item records whose text contains template variables ($s1, $o1, $d, $23455s1, $lpoint:points;, ${$m1*3}, …). This package owns the deterministic resolution of those templates and the static game-data lookup tables, so consumers don't hand-roll their own.

Install

Published to npm as @emyrk/wow-tooltip-renderer:

pnpm add @emyrk/wow-tooltip-renderer

Inside this monorepo the Chronicle frontend consumes the package source directly via a path alias (see frontend/chronicle/vite.config.ts), so it always tracks the working tree. External consumers (e.g. Chronicle Wiki) install the published build. Releases are cut by bumping version in package.json and merging to main — see .github/workflows/release-renderer.yml.

Usage

import {
  extractReferencedSpellIds,
  resolveSpellDescription,
} from "@emyrk/wow-tooltip-renderer";

// 1. Find cross-spell references the template needs.
const refIds = extractReferencedSpellIds(template); // e.g. [23455]

// 2. The app fetches those spells (app owns tenant-aware API base URLs) and
//    builds a Map<number, WoWSpell>.

// 3. Resolve. The resolver never fetches.
const text = resolveSpellDescription(spell, template, referencedSpells, 60);

Item tooltips use the same spell resolver for Use/Equip/Chance-on-hit effects, socket bonuses, and set bonuses, plus pure formatters/constants:

import {
  formatItemStat,   // (statType, value) -> { text, green }
  calculateDPS,     // (damageRange, delayMs) -> number | null
  getQualityColor,  // quality level -> hex
  STAT_DISPLAY, INVENTORY_TYPE_TEXT, SOCKET_INFO, /* ... */
} from "@emyrk/wow-tooltip-renderer";

Design rules

  1. The resolver is pure and deterministic; it never fetches.
  2. The consuming app owns tenant-aware API base URLs and data fetching.
  3. Colors are exported as hex values, not CSS-framework classes.
  4. Missing cross-referenced spells leave the placeholder visible (for diagnosis).

Template grammar

The resolver is a single left-to-right pass (see src/spell/resolver.ts for the documented grammar). Supported escapes:

| Variable | Meaning | | --- | --- | | $s1/$m1, $s2, $s3 | Effect value (single or min to max range) | | $o1/$o2/$o3 | Periodic total over the spell duration | | $d, $dN | Duration | | $t, $tN | Tick interval (seconds) | | $a1 | AOE radius | | $r, $n, $h, $u, $v, $x1, $b1, $e1 | range / charges / proc chance / stacks / etc. | | $NNNNs1 | Cross-spell reference (e.g. $23455s1) | | $*N;s1, $/N;s1 | Multiply / divide a value | | ${expr} | Inline arithmetic (variables resolve first, then evaluate) | | $lsingular:plural; | Pluralization (uses the most recent number) | | $gmale:female; | Gender (defaults to male — no caster gender at tooltip time) |

Tests

pnpm install
pnpm test        # unit + golden fixture tests
pnpm typecheck

The Chronicle frontend consumes this package through a thin shim at frontend/chronicle/src/api/wowdb.ts, which re-exports the resolver, formatters, constants, and WoWSpell type (this package is the source of truth) and adds the few app-specific helpers that depend on Chronicle's runtime (tenant icon CDN, Tailwind theme classes). The frontend's golden tests (frontend/chronicle/src/api/wowdb.test.ts) run real generated DBC vectors through the shim — and therefore this package — for all servers.

The rewrite from the previous regex resolver to this parser was validated with a differential parity test asserting byte-for-byte identical output across every DBC vector for all 7 servers before the old implementation was removed.