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

@arup-ri/narrows-tokens

v0.2.0

Published

Narrows design tokens — CSS, SCSS, JSON, and JS/TS

Readme

@narrows/tokens

Narrows design tokens — CSS, SCSS, JSON, and JS/TS. Zero runtime dependencies. Works in any JS/TS project, SCSS build, Python script, or plain HTML page.

This package was extracted from the Narrows monorepo, which contains the companion @narrows/react component library.

Install

npm install @narrows/tokens
# or
pnpm add @narrows/tokens

Usage

JavaScript / TypeScript

import { tokens } from '@narrows/tokens'

const primary = tokens.arup.brand.arupRed    // '#AE132A'
const blue    = tokens.colors.base.blue[600] // '#2563EB'
const gap     = tokens.spacing[4]            // '1rem'
const radius  = tokens.radii.md              // '0.375rem'

CSS custom properties

/* Import once at the root of your app */
@import '@narrows/tokens/tokens.css';

.button {
  background: var(--narrows-arup-brand-arupRed);
  border-radius: var(--narrows-radii-md);
  padding: var(--narrows-spacing-2) var(--narrows-spacing-4);
}

SCSS variables

@use '@narrows/tokens/tokens.scss' as t;

.button {
  background: t.$narrows-arup-brand-arupRed;
  border-radius: t.$narrows-radii-md;
}

JSON (Python, Ruby, etc.)

import json, pathlib

tokens = json.loads(
    pathlib.Path("node_modules/@narrows/tokens/dist/tokens.json").read_text()
)

primary = tokens["arup"]["brand"]["arupRed"]      # '#AE132A'
blue    = tokens["colors"]["base"]["blue"]["600"] # '#2563EB'

Design tokens

All tokens are defined once in src/ and emitted in multiple formats on every build:

| File | Use case | |---|---| | dist/tokens.css | Any HTML/CSS project — var(--narrows-arup-brand-arupRed) | | dist/tokens.scss | SCSS projects — $narrows-arup-brand-arupRed | | dist/tokens.json | Python, Ruby, Style Dictionary, generic JSON consumers | | dist/tokens.figma.json | Tokens Studio ↔ Figma sync (W3C DTCG format, committed to git) | | dist/tokens.js / .cjs | JS/TS projects |

CSS variables follow the --narrows-* prefix to avoid collisions with other libraries.

Typography — composite text styles

Typography is organized around named roles (body, heading, caption, label, code) with four size steps each (small, medium, large, xlarge). Each role-size token is a composite that sets font family, size, weight, and line height together.

import { tokens } from '@narrows/tokens'

tokens.textStyles['body-medium']
// { fontFamily: '...', fontSize: '1rem', fontWeight: '500', lineHeight: '1.5' }

Lower-level primitives (fontSizes, fontWeights, lineHeights, fonts) are still exported for one-off sizing needs (e.g. icon dimensions), but textStyles should be preferred for actual typographic content.

Figma integration

This repo syncs design tokens to Figma via the Tokens Studio plugin (free tier).

dist/tokens.figma.json is the sync file — it is committed to the repo and read directly from GitHub by the plugin. Composite textStyles tokens (e.g. body-medium) are exported using the W3C DTCG typography composite type, so Tokens Studio/Figma variables surface them as a single typography style rather than separate size/weight/line-height variables.

When you update a token value:

# 1. Edit src/*.ts (e.g. typography.ts)
pnpm build

# 2. Commit and push tokens.figma.json
git add dist/tokens.figma.json
git commit -m "chore: update tokens"
git push

# 3. In Figma → Tokens Studio plugin → Pull

Local development

Requirements

Setup

pnpm install

Build

pnpm build

Typecheck

pnpm typecheck

Watch mode

pnpm dev

Repository structure

narrows-tokens/
├── src/
│   ├── arup/           # ARUP corporate identity colors: brand, neutral,
│   │                   # accent, secondary, status (tokens.arup.*)
│   ├── colors/         # Non-ARUP default palette: base (tokens.colors.base)
│   ├── typography.ts   # fonts, fontSizes, fontWeights, lineHeights,
│   │                   # letterSpacings, and composite textStyles
│   │                   # (e.g. `body-medium`)
│   └── index.ts        # Aggregates all token categories
├── build/
│   └── generate.ts     # Emits CSS, SCSS, JSON, and tokens.figma.json
└── dist/
    ├── tokens.js / .cjs / .d.ts
    ├── tokens.css
    ├── tokens.scss
    ├── tokens.json
    └── tokens.figma.json  # Committed — used by Tokens Studio ↔ Figma sync

Releasing

Versions are managed manually by bumping the version field in package.json and publishing with pnpm.

pnpm typecheck
pnpm build
pnpm publish --access public

| Change type | Example | Version bump | |---|---|---| | Bug fix, internal refactor | Fix a token value | patch — 0.0.1 → 0.0.2 | | New token category | Add a new spacing scale | minor — 0.0.1 → 0.1.0 | | Breaking API change | Rename a token key | major — 0.0.1 → 1.0.0 |

Contributing

  1. Fork the repo and create a branch from main
  2. Make your changes
  3. Run pnpm typecheck && pnpm build to verify nothing is broken
  4. Open a pull request

License

MIT