@upmo-ai/tokens

中文文档
1.0.0-rc.1发布于 2026/11/03AGPL-3.0-onlyTypeScriptES Module零依赖

Upmo design tokens: CSS variables for the light, dark and high-contrast themes, and a typed object of every value.

原始使用文档
文档目录3 节
  1. Usage
  2. Design direction
  3. Build

@upmo-ai/tokens

Upmo design tokens: the single source of truth for colour, type, spacing, radius, shadow, size, breakpoint, z-index and motion. Built from tokens.json into three artifacts:

  • dist/tokens.css - CSS custom properties for the light, dark and hc (high-contrast) themes, scoped by :root and [data-theme="..."], plus typography utility classes (.body, .h1, .code, etc.). Each type style is also a set of :root variables: --text-<style>-size, -line, -weight and, where the style sets letter-spacing, -tracking (for example --text-body-size: 15px, --text-overline-tracking: 0.06em).
  • dist/tokens.js + dist/tokens.d.ts - a typed JS object of every value, per theme, for when CSS variables are not enough (charts, canvas, JS logic).
  • dist/tokens.json - the raw source, copied for tooling.

No React, no runtime dependencies.

Usage

import '@upmo-ai/tokens/tokens.css';
import { color, spacing, motion } from '@upmo-ai/tokens';

color['emerald-deep'].light; // "#176b47"
motion['duration-sweep'];     // "1600ms"

Set the theme on a root element:

<html data-theme="dark"> ... </html>

Design direction

  • True-neutral grounds. Ramp-like, business and data-dense. Borders carry structure; shadows lift floating layers only. Emerald is a sparing accent, never a surface fill.
  • Status / liveness tones. neutral / active / positive / attention / critical. The live caret (Working, Checking) draws itself on the duration-sweep loop and collapses to a static drawn caret under reduced motion.
  • Accessible floor. Body text clears 4.5:1 on its stated ground; control edges and large/icon colour clear 3:1; verified in light and dark. The high-contrast theme raises everything further.

Build

pnpm --filter @upmo-ai/tokens build

版本与发布记录

@upmo-ai/tokens 共发布 2 个版本,首次发布于 2026/11/03;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.0.0-rc.1latest2026/11/03今天
0.0.0-stage2026/11/03今天

关于 @upmo-ai/tokens 的常见问题

@upmo-ai/tokens 是什么?

Upmo设计标记:用于浅色、深色和高对比度主题的CSS变量,以及每个值的类型化对象。

如何安装 @upmo-ai/tokens?

在项目目录运行 npm install @upmo-ai/tokens,或使用 pnpm add / yarn add / bun add。

@upmo-ai/tokens 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@upmo-ai/tokens 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@upmo-ai/tokens 可以商用吗?

@upmo-ai/tokens 使用 AGPL-3.0-only 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@upmo-ai/tokens 还在维护吗?

最新版本 1.0.0-rc.1 发布于 2026/11/03(今天);至今共发布 2 个版本,其中过去 12 个月发布了 2 个;首次发布于 2026/11/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。