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

@micropasts/authority-card

v0.1.0

Published

Zero-dependency JavaScript Web Components for resolving and rendering Linked Open Data authority records (Pleiades, Wikidata, Getty AAT/TGN/ULAN, Nomisma) with Shadow DOM and Tailwind CSS support.

Readme

@micropasts/authority-card

Zero-dependency JavaScript Web Components that turn persistent Linked Open Data URIs (Pleiades, Wikidata, Getty AAT/TGN/ULAN, Nomisma.org, or custom endpoints) into cached hover popovers and synchronized inspector panels.

Available in two flavors:

  • <authority-card> — Encapsulated Shadow DOM component with CSS custom properties, ::part() selectors, and custom HTML template hooks.
  • <authority-card-tw> — Light-DOM component styled with Tailwind CSS utility classes and dark: variants.

Table of Contents


Features

  • Pure ES2022 JavaScript: Written in clean vanilla JavaScript without TypeScript compilation, framework lock-in, or runtime dependencies.
  • Built-in LOD Adapters: Resolves URIs from Pleiades, Wikidata, Getty Vocabularies (AAT, TGN, ULAN), and Nomisma.org into a consistent display model.
  • Request Deduplication & Caching: Concurrent or repeated lookups for the same URI share a single in-flight promise and cache results in memory.
  • Offline / Static Hydration: Pre-seed records from embedded JSON-LD or Linked Art @graph payloads via seedRecords() so static sites can render without external network requests.
  • Cross-Component Event Bus: Emits and listens for heritage:select CustomEvents so maps, timelines, graphs, and side panels stay synchronized.

Project Structure

authority-card/
├── .github/
│   └── workflows/
│       └── pages.yml          # Builds dist + docs/ and deploys docs/ to GitHub Pages
├── scripts/
│   └── build.js               # Bundles dist/ and builds self-contained docs/ output
├── src/
│   ├── core.js                # Cache, deduplication, event bus, LOD adapters
│   ├── shadow.js              # Encapsulated <authority-card> (CSS vars + ::part + templates)
│   ├── tailwind.js            # Light-DOM <authority-card-tw> (Tailwind utility classes)
│   ├── demo.html              # Source HTML template for the demo
│   └── index.js               # Package entry point
├── docs/                      # Generated GitHub Pages output (index.html + authority-card.esm.js)
├── package.json
└── README.md

Installation & Build

Install from npm:

npm install @micropasts/authority-card

Or build locally from source with zero external build dependencies:

npm run build

Running npm run build generates:

  • dist/authority-card.esm.js — Combined ES Module bundle
  • dist/authority-card.iife.js — Global <script> bundle (window.AuthorityCardLib)
  • docs/index.html and docs/authority-card.esm.js — Self-contained GitHub Pages demo

To build and serve the demo locally:

npm run dev

Quick Start

1. Tailwind CSS Version (<authority-card-tw>)

<script type="module" src="./dist/authority-card.esm.js"></script>

<p>
  Excavated at
  <authority-card-tw uri="https://pleiades.stoa.org/places/79739">
    Verulamium
  </authority-card-tw>,
  a silver
  <authority-card-tw uri="https://nomisma.org/id/denarius">
    denarius
  </authority-card-tw>
  of
  <authority-card-tw uri="http://www.wikidata.org/entity/Q1405">
    Augustus
  </authority-card-tw>.
</p>

2. Shadow DOM Version (<authority-card>)

Works without Tailwind CSS on any static page, CMS, or scholarly edition:

<script type="module" src="./dist/authority-card.esm.js"></script>

<authority-card uri="http://vocab.getty.edu/aat/300037222">
  denarii
</authority-card>

3. Synchronized Inspector Panel Mode

Mount a persistent panel that updates whenever any inline card (or external map, timeline, or graph component) broadcasts heritage:select:

<authority-card-tw mode="panel" listen="heritage:select"></authority-card-tw>

<script type="module">
  import { emitSelect } from '@micropasts/authority-card';

  // Example: triggered when a user selects a site on a map or timeline
  emitSelect(window, 'https://pleiades.stoa.org/places/79739');
</script>

Customizing Styles

Tailwind Utility Overrides (<authority-card-tw>)

Pass trigger-class and card-class attributes on individual instances:

<authority-card-tw
  uri="http://vocab.getty.edu/aat/300037222"
  trigger-class="text-amber-700 font-semibold"
  card-class="border-amber-500 shadow-2xl">
  denarii
</authority-card-tw>

Or override the shared class dictionary globally at application startup:

import { AuthorityCardTailwind } from '@micropasts/authority-card';

AuthorityCardTailwind.classes.popover =
  'absolute left-0 top-full mt-2 z-50 w-96 rounded-none border-2 border-black bg-white p-4 shadow-lg';

Shadow DOM Tokens & ::part() (<authority-card>)

Customize CSS custom properties or style exposed ::part() elements directly from your stylesheet:

authority-card.custom-theme {
  --ac-bg: #1c1917;
  --ac-fg: #fafaf9;
  --ac-muted: #a8a29e;
  --ac-border: #b45309;
  --ac-radius: 0.25rem;
  --ac-width: 360px;
}

authority-card.custom-theme::part(title) {
  font-family: Georgia, serif;
  color: #fbbf24;
}

Full Markup Template Override

Replace the card inner markup while keeping all caching, deduplication, and adapter logic:

import { AuthorityCard } from '@micropasts/authority-card';

AuthorityCard.setTemplate((record, esc) => `
  <div class="my-card">
    <strong>${esc(record.label)}</strong> (${esc(record.source)})
    <p>${esc(record.scopeNote)}</p>
  </div>
`);

Registering Custom Adapters & Seeding Offline Data

import { registerAdapter, seedRecords } from '@micropasts/authority-card';

// 1. Register a custom authority resolver
registerAdapter({
  name: 'British Museum',
  badgeColor: '#1e3a8a',
  match: (uri) => /collection\.britishmuseum\.org\/id\/object\/([^/?#]+)/i.exec(uri),
  async fetch([, id], uri) {
    const res = await fetch(`${uri}.json`);
    const data = await res.json();
    return {
      id,
      label: data._label || id,
      subtitle: 'British Museum Collection',
      scopeNote: data.referred_to_by?.[0]?.content || '',
    };
  },
});

// 2. Seed records from embedded JSON-LD (zero network requests)
seedRecords({
  'https://pleiades.stoa.org/places/79739': {
    source: 'Pleiades',
    badgeColor: '#15803d',
    label: 'Verulamium',
    subtitle: 'Ancient Roman Municipium',
    scopeNote: 'Major Roman town near modern St Albans, Hertfordshire.',
    meta: [{ label: 'Coordinates', value: '51.7519°, -0.3558°' }],
  },
});

Deploying the Demo to GitHub Pages (docs/)

npm run build outputs the demo site to docs/index.html alongside docs/authority-card.esm.js.

  1. Push your repository to GitHub with main as your default branch.
  2. In Settings → Pages, choose either:
    • Source: GitHub Actions (uses .github/workflows/pages.yml to run npm run build and deploy ./docs), or
    • Source: Deploy from a branch → select main and /docs after running npm run build.

License

MIT