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

@asafarim/design-tokens

v0.5.0

Published

ASafariM design tokens (CSS variables) with multi-theme support and 30 variable fonts (100-900).

Readme

@asafarim/design-tokens

A production-grade design-tokens package for the ASafariM ecosystem.

This package provides:

  • CSS variables (runtime theming) for:
    • light / dark / high-contrast
    • density (compact / comfortable)
    • RTL support (logical property guidance)
  • TypeScript exports for strongly-typed token consumption
  • Programmatic theming helpers (SSR-safe)
  • Validation utilities for safe token evolution

Why design tokens

Design tokens are the single source of truth for design decisions (color, typography, spacing, motion…).

  • Consistency across apps (React/Angular/Vue/vanilla)
  • Themeability at runtime via CSS variables
  • Governance: controlled evolution with semantic versioning

Install

From the monorepo root (pnpm workspaces):

pnpm -C packages/design-tokens build

In a consuming package/app:

pnpm add @asafarim/design-tokens

CSS usage (any framework)

Import the CSS entrypoint once at app startup:

import "@asafarim/design-tokens/css";

This ships a layered CSS setup:

  1. :root base tokens (spacing, typography, motion, radii, z-index…)
  2. [data-theme] theme tokens (colors, surfaces)
  3. [data-density] density tokens
  4. [dir="rtl"] RTL helpers

Playground screenshots

Design tokens playground (light)

Design tokens playground (dark)

Theme switching

document.documentElement.dataset.theme = "light";
// or
document.documentElement.dataset.theme = "dark";
// or
document.documentElement.dataset.contrast = "high";

Density switching

document.documentElement.dataset.density = "compact";
// or
document.documentElement.dataset.density = "comfortable";

TypeScript usage

import { tokens, themes, applyThemeToElement } from "@asafarim/design-tokens";

console.log(tokens.color.brand.primary500.value); // "#3A5AFE"

applyThemeToElement(document.documentElement, themes.light);

Accessing CSS variable names

import { cssVarNames } from "@asafarim/design-tokens";

// dot-path -> CSS var
console.log(cssVarNames["color.brand.primary500"]); // "--asm-color-brand-primary-500"

SSR safety

  • prefersColorScheme() will not crash when window is unavailable.
  • applyThemeToElement() can be used in tests or SSR hydration flows.

Client overrides (branding)

You can apply partial overrides without forking the package:

import { applyThemeToElement, themes } from "@asafarim/design-tokens";

applyThemeToElement(document.documentElement, themes.light, {
  overrides: {
    "--asm-color-brand-primary-500": "#00A3FF"
  }
});

High-contrast + reduced motion guidance

  • High contrast is enabled using [data-contrast="high"].
  • Reduced motion is handled via @media (prefers-reduced-motion: reduce) and the motion preset tokens.

Contribution rules (token governance)

  • Never rename or delete existing semantic token keys in a minor/patch release.
  • Prefer adding new semantic tokens, deprecating old ones with meta.deprecated.
  • When changing a value of an existing token:
    • Patch: only if it’s a clear bug fix (e.g., invalid color)
    • Minor: safe visual adjustments
    • Major: visual/systemic shifts

Run validation before publishing:

pnpm -C packages/design-tokens build
node -e "import('@asafarim/design-tokens').then(m => console.log(m.validateTokens()))"

Versioning rules

  • PATCH: bug fixes, documentation, token metadata
  • MINOR: additive tokens, new themes, non-breaking build changes
  • MAJOR: renames/removals, behavior changes in theming helpers, breaking token semantics