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

@canonical/token-types

v0.5.2

Published

Shared types for Canonical design token tooling.

Readme

@canonical/token-types

Shared TypeScript types for Canonical design token tooling. This package defines the JSON contract between the Terrazzo CSS plugin (producer) and the LSP (consumer) — the tokens.json artifact format.

Installation

bun add -d @canonical/token-types

Usage

Import types for working with the tokens.json artifact:

import type { Artifact, ArtifactToken, ArtifactEnvelope } from "@canonical/token-types";

function loadTokens(json: ArtifactEnvelope): Artifact {
  if ("tokens" in json) return json.tokens; // wrapped envelope
  return json;                               // flat artifact
}

Use the runtime guard to narrow DTCG type strings:

import { isKnownDtcgTokenType } from "@canonical/token-types";

if (isKnownDtcgTokenType(token.type)) {
  // token.type is narrowed to KnownDtcgTokenType
}

Exports

Types

| Type | Description | |------|-------------| | Artifact | The complete artifact: CSS variable name to token metadata. | | ArtifactToken | A single token entry combining metadata, resolved values, source location, derivation, and registration fields. | | ArtifactTokenInit | Input contract for constructing a DTCG-sourced artifact token. | | DerivedArtifactTokenInit | Input contract for constructing a derived or plugin-generated token. | | ArtifactEnvelope | Union of flat Artifact and WrappedArtifactEnvelope — the plugin may emit either. | | WrappedArtifactEnvelope | Artifact payload with version, generator, and tokens fields. | | ArtifactDeclaration | A declaration site (selector, file, line, enclosing at-rules). | | ArtifactAtRule | An at-rule context (name + prelude). | | DtcgTokenType | DTCG $type values — known literals with a string escape hatch for forward compatibility. | | KnownDtcgTokenType | The known DTCG type literals (color, dimension, number, etc.). | | TokenTier | Tier classification: "primitive", "semantic", or "derived". | | ArtifactTier | Tier strings carried by artifacts — known tiers plus a string escape hatch. | | DerivationKind | Derivation formula kinds ("hover", "active", "disabled", "delta", etc.). |

Runtime

| Export | Description | |--------|-------------| | KNOWN_DTCG_TOKEN_TYPES | const array of all recognised DTCG type literals. | | isKnownDtcgTokenType(value) | Type guard narrowing a string to KnownDtcgTokenType. |

Development

bun run build     # Compile (tsc)
bun run test      # Run type-level tests
bun run check     # Type check