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

@standardbeagle/design-token

v0.1.0

Published

W3C DTCG design-token authoring, validation, transformation, diff/merge, and Tailwind config emission. MCP server + library.

Readme

@standardbeagle/design-token

W3C DTCG design-token authoring, validation, transformation, diff/merge, and Tailwind config emission. MCP server + library.

Install

npm install @standardbeagle/design-token

# or use via MCP:
npx -y @standardbeagle/design-token@latest mcp

Two model styles coexist:

  • Flat-token model{ name, value, type, ... } records used by token_create, token_transform, token_export, token_import.
  • W3C DTCG tree — nested object with $value/$type leaves used by tokens_validate, tokens_generate, tokens_diff, tokens_merge, tailwind_generate.

Tools

token_create

Create a single design token. Resolves reference against tokens context if provided.

Input:

{
  name: string,
  value: string,
  type: 'color' | 'size' | 'spacing' | 'font' | 'border' | 'radius' | 'shadow',
  description?: string,
  reference?: string,         // name of another token to inherit value from
  tokens?: Token[],           // optional context for reference resolution
}

Output:

{ name: string, value: string, type: string, description?: string, reference?: string }

Example:

await callTool('token_create', { name: 'brand', value: '#0066cc', type: 'color' });

token_transform

Transform an array of flat tokens to a target string format.

Input:

{
  tokens: Token[],
  format: 'css-vars' | 'scss' | 'json' | 'android-xml' | 'ios-swift',
}

Output:

{ format: string, output: string }

Example:

await callTool('token_transform', {
  tokens: [{ name: 'brand', value: '#0066cc', type: 'color' }],
  format: 'css-vars',
});
// output: ':root { --brand: #0066cc; }'

tokens_validate

Validate a W3C DTCG token tree. Recursively walks groups and validates each leaf $value against its $type-specific schema (12+ types: color, dimension, fontFamily, fontWeight, duration, cubicBezier, number, strokeStyle, border, transition, shadow, gradient, typography).

Input:

{
  tokens: object,           // DTCG tree
  strict?: boolean,         // default false; when true, unknown $type → error
}

Output:

{
  valid: boolean,
  errors: Array<{ path: string, message: string }>,
  warnings: Array<{ path: string, message: string }>,
}

Example:

await callTool('tokens_validate', {
  tokens: { color: { brand: { $value: '#0066cc', $type: 'color' } } },
});

tokens_generate

Generate a W3C DTCG token tree from a flat color palette + modular type scale + linear spacing scale. Output is a nested object with color.<name>, font.size.{caption,small,body,h6..h1}, and spacing.0..N — every leaf carries $value/$type so the result passes tokens_validate. Deterministic from inputs.

Input:

{
  palette: Record<string, string>,                  // {colorName: cssColor}
  type_scale?: { base?: number, ratio?: number },   // defaults: 16 / 1.25
  spacing?:    { base?: number, steps?: number },   // defaults: 4 / 10
}

Output:

{
  tokens: object,           // valid DTCG tree
}

Example:

await callTool('tokens_generate', {
  palette: { primary: '#0066cc', neutral: '#888888' },
  type_scale: { base: 16, ratio: 1.25 },
  spacing: { base: 4, steps: 8 },
});

token_export

Export flat tokens to a target platform format with optional prefix and category filtering.

Input:

{
  tokens: Token[],
  format: 'css-vars' | 'scss' | 'json' | 'android-xml' | 'ios-swift',
  prefix?: string,
  includeCategories?: TokenType[],
  excludeCategories?: TokenType[],
}

Output:

{ format: string, output: string }

Example:

await callTool('token_export', {
  tokens: [{ name: 'brand', value: '#0066cc', type: 'color' }],
  format: 'scss',
  prefix: 'sb',
});

token_import

Parse a CSS, SCSS, or JSON source string into the flat-token model.

Input:

{
  source: string,
  format: 'json' | 'css' | 'scss',
}

Output:

{ tokens: Token[] }

Example:

await callTool('token_import', {
  source: ':root { --brand: #0066cc; }',
  format: 'css',
});

tokens_diff

Diff two W3C DTCG token trees at the leaf level. Flattens both trees and reports added (paths only in b), removed (paths only in a), and changed (different $value). Output arrays are sorted by path. $description-only edits are not reported as changes. Pure, deterministic.

Input:

{
  a: object,   // baseline
  b: object,   // candidate
}

Output:

{
  added:   Array<{ path: string, $value: unknown, $type?: string }>,
  removed: Array<{ path: string, $value: unknown, $type?: string }>,
  changed: Array<{ path: string, before: unknown, after: unknown }>,
}

Example:

await callTool('tokens_diff', {
  a: { color: { brand: { $value: '#0066cc', $type: 'color' } } },
  b: { color: { brand: { $value: '#0055aa', $type: 'color' } } },
});
// changed: [{ path: 'color.brand', before: '#0066cc', after: '#0055aa' }]

tokens_merge

Merge a base DTCG token tree with an ordered list of overrides. Resolution modes: last-wins (default; rightmost source wins), first-wins (earliest source wins, base preferred), error (throws on first leaf-vs-leaf conflict with payload). Group-vs-leaf structural conflicts always throw. Every contested path is reported in conflicts[] regardless of mode, so callers can audit silent resolutions.

Input:

{
  base: object,
  overrides?: object[],
  conflict_resolution?: 'last-wins' | 'first-wins' | 'error', // default 'last-wins'
}

Output:

{
  merged: object,
  conflicts: Array<{ path: string, sources: number[], values: unknown[], winner: number }>,
}

Example:

await callTool('tokens_merge', {
  base: { color: { brand: { $value: '#0066cc', $type: 'color' } } },
  overrides: [{ color: { brand: { $value: '#0055aa', $type: 'color' } } }],
});

tailwind_generate

Generate a Tailwind theme.extend config (and optionally a JS or TS module source) from a flat palette + modular type scale + linear spacing scale, with optional semantic-color aliases. Composes tokens_generate and the toTailwindTheme exporter — adds no new primitives. semantic_map entries are resolved eagerly against the palette (Tailwind has no native ref concept). Pure and deterministic.

Input:

{
  palette: Record<string, string>,
  type_scale: { base: number, ratio: number },
  spacing: { base: number, steps: number },
  semantic_map?: Record<string, string>,                // {alias: paletteKey}
  output_format?: 'object' | 'js-module' | 'ts-module', // default 'object'
}

Output:

{
  config: { theme: { extend: object } },
  module_source?: string,        // present when output_format !== 'object'
}

Example:

await callTool('tailwind_generate', {
  palette: { brand: '#0066cc', danger: '#dc2626' },
  type_scale: { base: 16, ratio: 1.25 },
  spacing: { base: 4, steps: 8 },
  semantic_map: { primary: 'brand' },
  output_format: 'ts-module',
});

Direct TypeScript usage

import { tokenCreate }    from '@standardbeagle/design-token/tools/token-create.js';
import { tokenTransform } from '@standardbeagle/design-token/tools/token-transform.js';
import { tokensValidate } from '@standardbeagle/design-token/tools/tokens-validate.js';
import { tokensGenerate } from '@standardbeagle/design-token/tools/tokens-generate.js';
import { tokensDiff }     from '@standardbeagle/design-token/tools/tokens-diff.js';
import { tokensMerge }    from '@standardbeagle/design-token/tools/tokens-merge.js';
import { tailwindGenerate } from '@standardbeagle/design-token/tools/tailwind-generate.js';

License

MIT