@aurea-uds/tokens

中文文档
0.62.1发布于 2026/11/08Apache-2.0TypeScriptCommonJS零依赖近 30 天下载 6646

Os tokens da Aurea UDS: a fonte em DTCG e as variáveis CSS geradas dela.

原始使用文档
文档目录6 节
  1. The axes
  2. The density contract — what actually changes
  3. The theme contract — and an asymmetry, on purpose
  4. Units: rem for everything that should follow the text
  5. Tokens nobody uses
  6. Cascade

Aurea foundations — what the tokens govern, and what they do not

The official answer to "which axis controls this value".

The counts live in STATE.md, generated and checked. This file holds the rules.


The axes

AxisTokensUnitNotes
Colour--<semantic>, --<family>-<step>oklch / hexthe semantic token comes first; a ramp step is for building a semantic token, not for direct use
Space--space-0 … --space-24remthe scale skips values on purpose — not every integer exists
Type size--text-xs … --text-7xlrem
Type family--font-ui, --font-heading, --font-editorial, --font-code—Inter / Sora (every h1 to h6) / Inter (alias, removed in 1.0) / IBM Plex Mono
Type weight--weight-regular … --weight-extraboldnumber
Line height--leading-none … --leading-relaxednumber--leading-none exists for components whose HEIGHT is part of the contract
Letter spacing--tracking-tight … --tracking-widestem
Radius--radius-xs … --radius-card, --radius-sheet, --radius-controlpx--radius-card (22px), --radius-sheet (32px, the sheet that rises from the bottom) and --radius-control (999px) are identity — checked
Border--border-widthpx
Shadow--shadow-sm, --shadow-md, --shadow-lgshadow
Layer--z-sticky … --z-toastnumberfor stacking OVERLAYS. A local z-index: 1/2/3 inside a component is not this axis
Motion--duration-*, --ease-*duration / curve
Icon size--icon-sm … --icon-xlremin rem so the glyph follows the text
Touch target--target-minrem44px with a 16px root — WCAG 2.5.5/2.5.8
Breakpoint--breakpoint-2xs … --breakpoint-2xlpx@media cannot read var(), so the CSS repeats each breakpoint in em (it follows the browser's font size) and a build check guards the scale
Densitysee belowrem

A new value on any of these axes comes from a token. The raw values in the core are counted per axis against a baseline: the count may go down, never up.


The density contract — what actually changes

data-density="compact | comfortable | spacious" changes eleven tokens, and only those:

--control-h-xs, --control-h-sm, --control-h-md, --control-h-lg, --control-h-xl, --touch-control-h-sm, --touch-control-h-md, --touch-control-h-lg (the control heights of the native touch target), --row-h, --card-pad, --section-gap.

In other words: density changes control height, table row height, card padding and the gap between sections.

It does not change, on purpose: type size, the general space scale, layout gaps, radii, icon sizes or line heights. Density is about how close together the controls sit, not a second type scale.

Every control must take its height from --control-h-*. tests/visual/geometry.spec.ts checks this.


The theme contract — and an asymmetry, on purpose

data-theme="dark | light". Dark is the base; light overrides it.

The two themes are not fully symmetric, and this is the exception: light overrides three colours that dark leaves at the base value — warning-500, oracle-300 and oracle-400. Nothing is undefined in dark: those tokens inherit the base value, so no value is missing.

The identity does not change between themes: the main yellow is oklch(0.795 0.184 86.047) in both, and the build fails on the canonical value, not only on the token name.


Units: rem for everything that should follow the text

Type, space, icon size, control height, sidebar width and top bar height are rem, so that someone who enlarges the browser's text gets bigger controls instead of clipped text (WCAG 1.4.4). The conversion from px was exact (px÷16), so nothing moved at the default root size.

Radii stay in px: a corner is a physical shape, not text, and scaling it with the text makes the capsule stop being a capsule.


Tokens nobody uses

Not every token is referenced by the core. That is not automatically waste:

GroupWhy it exists
--breakpoint-*@media cannot read var(). The CSS repeats the number and a build check guards the scale against them
--oracle-*used only by apps/docs/docs.css. oracle is vocabulary of the app it came from, not of the system — they go away together with that page
ramp stepsintermediate steps of the semantic families, kept so a consumer can build a variant

The rule: a token is born from a use, not from a scale that looks complete. Tokens that had no use anywhere were removed, and the ones that were needed were created.

Repeats are references, not copies: --radius-full is {radius-control}, so the two names cannot diverge. Two tokens with the same number written by hand diverge the day one of them is adjusted.


Cascade

packages/core/dist/aurea.css wraps the tokens and the component CSS in @layer aurea. The consumer's own CSS, written without a layer, wins over the library whatever the selector's specificity — no !important, no specificity hunting.

The tokens sit inside the layer, together with the core, not outside it. A custom property declaration competes in the cascade like any other: with the tokens outside, the :root override that the core declares inside a media query lost to the base value, and the sidebar jumped 48px. An app that redefines a token in its own unlayered :root still wins over both.

版本与发布记录

@aurea-uds/tokens 共发布 78 个版本,首次发布于 2026/07/31;过去 12 个月发布了 78 个版本。

版本发布日期距今
0.62.1latest2026/11/08今天
0.62.02026/11/08今天
0.61.02026/11/071 天前
0.59.02026/11/071 天前
0.56.02026/11/052 天前
0.54.12026/11/044 天前

关于 @aurea-uds/tokens 的常见问题

@aurea-uds/tokens 是什么?

Os tokens da Aurea UDS: a fonte em DTCG e as variáveis CSS geradas dela.

如何安装 @aurea-uds/tokens?

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

@aurea-uds/tokens 支持 TypeScript 吗?

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

@aurea-uds/tokens 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@aurea-uds/tokens 可以商用吗?

@aurea-uds/tokens 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aurea-uds/tokens 的下载量有多少?

根据 npm 官方下载统计,@aurea-uds/tokens 在 2026/10/07 – 2026/11/05 这 30 天内被下载 6,646 次,日均约 222 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aurea-uds/tokens 还在维护吗?

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