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

@ydesign/ui-tokens

v0.1.1

Published

跨框架共享的设计 tokens:CSS variables + Tailwind preset + TS 常量

Readme

@ydesign/ui-tokens

跨框架共享的设计 tokens:CSS variables + Tailwind preset + TS 常量。

零运行时依赖,可被 React / Vue / Frameworkless bundle / 任意宿主页面消费。

安装

pnpm add @ydesign/ui-tokens

使用

1. 引入 CSS variables(必需)

在应用入口(任意 CSS 文件、main.ts 或 React/Vue 根组件):

import '@ydesign/ui-tokens/style.css';

注入后,:root 下会出现 --ydl-color-* / --ydl-radius-* 等所有 token。

2. 在 CSS / inline style 中使用

.toolbar {
  background-color: var(--ydl-color-bg-container);
  color: var(--ydl-color-text);
  border-bottom: 1px solid var(--ydl-color-border);
}

3. 在 JS / TS 中使用

import { tokens } from '@ydesign/ui-tokens';

<div style={{ color: tokens.color.text.css, padding: tokens.spacing.md.css }} />
// tokens.color.text.css === 'var(--ydl-color-text)'
// tokens.color.text.varName === '--ydl-color-text'

4. 配合 Tailwind v4

/* globals.css */
@import 'tailwindcss';
@import '@ydesign/ui-tokens/style.css';
@config '@ydesign/ui-tokens/tailwind-preset';

之后即可:

<div className="bg-bg-container text-text border border-border" />

5. 切换深色模式

<html> 或任意祖先元素上加 data-theme="dark"

<html data-theme="dark">

所有 token 自动切换为深色值。

Token 命名

  • 前缀 --ydl-(避免和宿主页面冲突)
  • 语义化命名(--ydl-color-primary 而非 --ydl-blue-500
  • 当前 light/dark 默认值精确对齐 antd v6,迁移期视觉零变化

全部 token 列表

src/tokens.css