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

@edrlab/thorium-badges

v1.0.2

Published

Web components for embedding "Add to Thorium Reader" badges (catalog and publication) on any page.

Readme

@edrlab/thorium-badges

Add to Thorium Reader

Web components for embedding "Add to Thorium Reader" badges on any page. Two custom elements are provided:

  • <thorium-badge-catalog> — adds a catalog (and optional bookshelf), OPDS or web, to Thorium Reader.
  • <thorium-badge-publication> — adds a single publication to Thorium Reader.

Each element renders as a link — the inline SVG badge wrapped in an <a> to the corresponding Thorium universal link (/add/catalog or /add/publication). Its required attributes must be set, or it throws (see below). Catalog/bookshelf URLs can be either OPDS feeds or plain web URLs; the publication URL is a direct link to a publication file.

Installation

npm install @edrlab/thorium-badges
pnpm add @edrlab/thorium-badges

Usage

As a package import

Import the package once (for its side effect of registering the custom elements), then use the elements in markup:

import "@edrlab/thorium-badges";
<thorium-badge-catalog
  title="My Library"
  main="https://example.com/catalog"
></thorium-badge-catalog>

<thorium-badge-publication
  publication="https://example.com/publication"
  title="My Book"
  author="Jane Doe"
></thorium-badge-publication>

Via <script src> (no build step)

pnpm run build also produces an IIFE bundle at dist/thorium-badges.iife.js, which self-registers both custom elements when loaded directly with a <script src> tag instead of being imported as a module — useful for hosting the bundle and letting third parties embed the badge without a build step.

Since the package is also published to npm, the same bundle is available from unpkg or jsDelivr with no need to host it yourself:

<script src="https://www.thoriumreader.com/embed/thorium-badges.js"></script>
<!-- or -->
<script src="https://unpkg.com/@edrlab/thorium-badges"></script>
<!-- or -->
<script src="https://cdn.jsdelivr.net/npm/@edrlab/thorium-badges"></script>

<thorium-badge-catalog title="My Library" main="https://example.com/catalog"></thorium-badge-catalog>

Attributes

<thorium-badge-catalog>

| Attribute | Required | Description | | -------------------- | -------- | -------------------------------------------------------------- | | title | ✓ | Catalog display name. | | main / bookshelf | one of | OPDS or web URL to browse the catalog and/or access the user's bookshelf. | | passphrase | | Plain-text passphrase, if the feed is protected. | | hashed-passphrase | | Pre-hashed passphrase, as an alternative to passphrase. | | open-in | | Where Thorium should open the catalog. | | icon | | URL of an icon to show for the catalog. | | banner | | URL of a banner image. | | color | | Accent color for the catalog entry. | | lang | | Badge locale ("auto" to detect from the browser; unset behaves the same as "auto"). |

Throws if title or at least one of main/bookshelf isn't set.

<thorium-badge-publication>

| Attribute | Required | Description | | -------------------- | -------- | -------------------------------------------------------- | | publication | ✓ | Direct URL to the publication file. | | title | | Publication title. | | author | | Publication author. | | cover | | URL of the cover image. | | passphrase | | Plain-text passphrase, if the publication is protected. | | hashed-passphrase | | Pre-hashed passphrase, as an alternative to passphrase. | | lang | | Badge locale ("auto" to detect from the browser; unset behaves the same as "auto"). |

Throws if publication isn't set.

Any attribute pointing to a URL (main, bookshelf, icon, banner, publication, cover) is also validated and throws if it isn't a well-formed URL.

Localization

Supported lang values are en, fr, and it.

  • Set lang to one of those codes to force that locale.
  • Leaving lang unset, or setting it to "auto", matches the visitor's browser language (navigator.languages) against the supported list, using the first one that matches.
  • If that match fails to find a supported locale — or lang is any other unsupported value — the badge falls back to en.

Development

From this package directory:

pnpm run dev    # regenerate badge texts, then vite build --watch
pnpm run build  # regenerate badge texts, then build ESM + IIFE bundles into dist/