@adobe/spectrum-design-data

中文文档
3.9.1发布于 2026/11/07Apache-2.0ES Module零依赖构建来源已验证近 30 天下载 2331

Spectrum design tokens in cascade format — the canonical source of truth for @adobe/spectrum-tokens

原始使用文档
文档目录6 节
  1. What is the cascade format?
  2. Relationship to @adobe/spectrum-tokens
  3. Token corpus
  4. Name-object quality
  5. moon tasks
  6. Consuming the cascade format

@adobe/spectrum-design-data

Spectrum design tokens in cascade format — the canonical source of truth for @adobe/spectrum-tokens.

What is the cascade format?

Each .tokens.json file in tokens/ is a JSON array of spec-compliant token objects. Each token carries a structured name object with taxonomy fields (component, property, state, colorFamily, scaleIndex, etc.) instead of a flat kebab-case string. The format is defined in packages/design-data-spec.

// tokens/color-palette.tokens.json (excerpt)
[
  {
    "name": { "property": "color", "colorFamily": "blue", "scaleIndex": 100 },
    "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
    "value": "#E9F4FF",
    "uuid": "…"
  }
]

Relationship to @adobe/spectrum-tokens

packages/tokens/src/ (the legacy flat-object format consumed by Style Dictionary and downstream tooling) is generated from this package. Do not edit packages/tokens/src/ directly — changes will be overwritten.

To regenerate the legacy package after editing tokens here:

moon run design-data:legacy-output

Token corpus

8 files, 4 166 cascade tokens (from 2 460 legacy entries):

FileDescription
color-palette.jsonGlobal color scale (blues, reds, …)
color-component.jsonComponent-scoped color tokens
color-aliases.jsonSemantic color aliases
semantic-color-palette.jsonSemantic/contextual palette
typography.jsonFont sizes, weights, families
layout.jsonGlobal spacing and sizing
layout-component.jsonComponent-scoped layout tokens
icons.jsonIcon sizing tokens

Name-object quality

95% of tokens carry structured name objects:

  • 23% enriched from sidecar name metadata (colorFamily, scaleIndex, variant, …)
  • 71% decomposed from the legacy key (component + property + state)
  • 6% thin (full legacy key stored in property) — tracked as SPEC-017 tech debt

moon tasks

TaskCommandPurpose
validatemoon run design-data:validateValidate cascade files against spec rules
legacy-outputmoon run design-data:legacy-outputRegenerate packages/tokens/src/
roundtrip-verifymoon run design-data:roundtrip-verifyCI guard: fail if cascade and legacy diverge
regenerate-from-legacymoon run design-data:regenerate-from-legacyRe-sync cascade from legacy (one-time / escape hatch)

Consuming the cascade format

import colorPalette from "@adobe/spectrum-design-data/tokens/color-palette";
// colorPalette is an array of cascade token objects

版本与发布记录

@adobe/spectrum-design-data 共发布 63 个版本,首次发布于 2026/06/01;过去 12 个月发布了 63 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.9.1latest2026/11/07今天
3.9.02026/11/07今天
3.8.22026/11/052 天前
3.8.12026/11/052 天前
3.8.02026/11/044 天前
3.7.12026/11/017 天前

其他发布通道:beta → 3.3.0-beta.2,size-token-taxonomy → 0.0.0-size-token-taxonomy-20261029173424。

关于 @adobe/spectrum-design-data 的常见问题

@adobe/spectrum-design-data 是什么?

Spectrum design tokens in cascade format — the canonical source of truth for @adobe/spectrum-tokens

如何安装 @adobe/spectrum-design-data?

在项目目录运行 npm install @adobe/spectrum-design-data,或使用 pnpm add / yarn add / bun add。

@adobe/spectrum-design-data 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adobe__spectrum-design-data 是否存在。

@adobe/spectrum-design-data 支持 ESM 还是 CommonJS?

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

@adobe/spectrum-design-data 可以商用吗?

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

@adobe/spectrum-design-data 的下载量有多少?

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

@adobe/spectrum-design-data 还在维护吗?

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