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

@tdduydev/tokens

v0.1.0

Published

Design tokens for the xdev-ui kit: CSS variables, a Tailwind v4 theme block and a typed TypeScript object.

Readme

@tdduydev/tokens

Design tokens for the xdev-ui kit, built from one source (tokens.json, synced from xDev Hive, plus overrides.json) into three outputs:

  • CSS variables (tokens.css) with a dark default and a light theme.
  • A Tailwind v4 theme block (theme.css) that turns those variables into utility classes.
  • A typed TypeScript object (tokens) with concrete values, for React Native and tooling.

Install

npm install @tdduydev/tokens

Requires Node 20 or newer to build; the published package ships prebuilt files.

Use with CSS

/* app.css: Tailwind v4 */
@import "tailwindcss";
@import "@tdduydev/tokens/tokens.css";
@import "@tdduydev/tokens/theme.css";

Without Tailwind, import @tdduydev/tokens/tokens.css alone and read the variables directly: background: var(--bg-canvas).

Set the theme on any element (usually <html>). Dark is the default, so data-theme="dark" is optional:

<html data-theme="light"></html>

Warning: import tokens.css as plain, unlayered CSS. Do not write @import "@tdduydev/tokens/tokens.css" layer(...). Themed shadows (--shadow-1 to --shadow-4, --shadow-sticky) have the same name in theme.css and in tokens.css. Tailwind emits them as --shadow-1: var(--shadow-1) inside @layer theme, and only the unlayered tokens.css value gives them a real value. Static values (radius, shadow-0) are written to theme.css as literals, so they do not depend on this.

tokens.css also contains a prefers-reduced-motion: reduce block that sets transition-duration and animation-duration to 0s.

Token groups

| Group | In tokens.css | In theme.css | In tokens (TS) | | ------------ | --------------------------------------- | ------------------- | ----------------------------- | | color | yes, themed tokens in both theme blocks | yes | dark, light | | shadow | yes, themed tokens in both theme blocks | yes | shadow.dark, shadow.light | | radius | yes | yes | radius | | size | yes | yes (--spacing-*) | size | | layout | yes | yes (--spacing-*) | layout | | spacing | yes | no | spacing | | border | yes | no | border | | zIndex | yes | no | zIndex | | tracking | yes | no | tracking | | breakpoint | no | no | breakpoint | | type | no | no | type |

Why some groups stop early:

  • spacing: Tailwind's default 4px scale already covers the 4/8 grid, so there is no class to add.
  • breakpoint: CSS variables cannot be used inside @media, and the values equal Tailwind's defaults.
  • type: a text style combines size, line height, weight and tracking. Use the TypeScript object.
  • tracking: no @theme entry is needed. tracking-wide, tracking-tight and tracking-normal read --tracking-wide, --tracking-tight and --tracking-normal, which tokens.css sets.

A token is themed when it has different light and dark values, or when it is an alias of a themed token. Everything else is declared once in :root.

Tailwind class naming rule

Every token has a CSS variable named after it (--<token name>). theme.css maps each variable to a Tailwind theme key using these rules. Components use these classes, never primitive palette colors or hex values.

| Token | Theme key | Class examples | | ------------------- | ------------------ | ------------------------------------------------------------------------------------ | | color bg-X | --color-X | bg-canvas, bg-surface, bg-inverse | | color text-X | --color-fg-X | text-fg-primary, text-fg-secondary, text-fg-link | | color border-X | --color-line-X | border-line-subtle, border-line-default | | any other color | --color-<name> | bg-surface-1, bg-action-primary-bg, text-status-success-fg, bg-accent-violet | | radius-X | --radius-X | rounded-card, rounded-pill, rounded-control, rounded-chip | | shadow-X | --shadow-X | shadow-3, shadow-sticky | | any other shadow | --shadow-<name> | shadow-ring-glass, shadow-button-glass-shadow, shadow-focus-ring | | size and layout | --spacing-<name> | h-button-h-md, h-topbar-h, w-sidebar-w, max-w-content-max |

Notes:

  • radius-md, radius-lg and the other radius names replace Tailwind's rounded-md and rounded-lg values, because the variable name is the same.
  • Color primitives (blue-*, neutral-*, navy-*, green-*, amber-*, red-*, brand-*) also get theme keys. Only the stops that Hive defines are replaced. Prefer semantic tokens.
  • The build stops with an error if two tokens produce the same theme key.

Edit tokens through overrides.json

tokens.json is a synced copy of the Hive tokens. Do not edit it. Put changes in overrides.json, grouped by the same keys as tokens.json (color, shadow, layout, and so on):

{
  "color": [
    { "name": "text-link-hover", "value": { "dark": "#b8a8ff", "light": "#4b30b8" } },
    { "name": "status-danger-bg", "value": { "dark": "#3a2324" } },
    { "name": "text-off", "add": true, "value": { "dark": "#5c5c60", "light": "#96929c" } }
  ],
  "layout": [{ "name": "topbar-h", "value": "56px" }]
}
  • An entry replaces the value of an existing token of that group. A { "dark": ... } value without light keeps the Hive light value (the reverse works too).
  • "add": true adds a new token. It must give both light and dark when it is themed.
  • A value can reference another token with {token-name}. It becomes var(--token-name) in CSS and is resolved to a concrete value in the TypeScript object.
  • The build fails with a clear message when an entry names a token that does not exist (and has no add), when add names a token that already exists, when an alias points to a missing token, or when aliases form a cycle.

Build and test:

npm run build -w @tdduydev/tokens   # writes dist/
npm test -w @tdduydev/tokens

@tdduydev/tokens/tokens.json is the upstream Hive source without overrides. Read dist outputs or the tokens object for final values.

Use the TypeScript object in React Native

React Native has no CSS variables, so the tokens object holds concrete values: aliases are resolved, and each theme has its own map. Keys are token names (the CSS variable name without --).

import { useColorScheme } from 'react-native'
import { tokens } from '@tdduydev/tokens'

export function useTokens() {
  const scheme = useColorScheme() === 'light' ? 'light' : 'dark'
  return {
    color: tokens[scheme],
    shadow: tokens.shadow[scheme],
    radius: tokens.radius,
    size: tokens.size,
  }
}

const t = useTokens()
const styles = {
  card: {
    backgroundColor: t.color['bg-surface'],
    borderRadius: parseFloat(t.radius['radius-card']), // "24px" -> 24
    minHeight: parseFloat(t.size['button-h-md']),
  },
}

All values are strings, as written in CSS. Convert lengths with parseFloat. shadow values are CSS box-shadow strings and need translating to React Native's shadow props (or a library that parses them). type.styles holds composed text styles (family, fontSize, lineHeight, fontWeight, optional letterSpacing) and type.families maps the family keys to font stacks.

License

MIT