@devslab/dds-tokens

中文文档
0.33.0发布于 2026/11/12SEE LICENSE IN LICENSETypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 4050

DDS (DevsLab Design System) design tokens — one JSON source, built for CSS, Tailwind, TypeScript/RN and Ionic

原始使用文档

@devslab/dds-tokens

🌐 한국어

DDS design tokens, built from the single source at the repo root (tokens/*.json, W3C Design Tokens format) into every consumption shape (spec §2). pnpm build produces:

ArtifactImportConsumer
dist/tokens.css@devslab/dds-tokens/tokens.cssEvery web surface. --dds-* custom properties — light on :root, dark on [data-theme="dark"]
dist/tailwind/theme.css@devslab/dds-tokens/tailwind/theme.cssTailwind v4 (@theme)
dist/tailwind/preset.js / .cjs@devslab/dds-tokens/tailwind/presetTailwind v3 (presets: [...])
dist/tokens.ts (+ tokens.js / tokens.d.ts)@devslab/dds-tokensRN and any runtime code — raw numbers (px on web, pt on RN)
dist/ionic.css@devslab/dds-tokens/ionic.cssIonic apps — --ion-* mapped onto --dds-*: brand color (primary + -rgb/-shade/-tint/-contrast), the three status colors with their -contrast, page background/text/border, font, and app chrome (item, toolbar, tab-bar, card)

Usage notes

  • Load order. tokens.css first; theme.css / ionic.css reference its variables. Tailwind color utilities resolve through var(--dds-*), so they follow the theme at runtime.
  • Dark mode. Set data-theme="dark" on <html> (or any subtree — data-theme="light" pins a subtree back, so panels can be fixed to either theme). No media query is emitted; auto-follow is the consumer's call, same as devslab.kr's toggle.
  • The raw palette is not in the CSS. Components may only use semantic tokens (spec §3.1); what the CSS doesn't ship can't be hardcoded against. Palette values are available from tokens.ts for mapping-definition code.
  • Tailwind naming. Color names keep the semantic path: bg-bg-brand, text-text-primary, border-border-default. Flattening ("brand") would collide — color.bg.brand and color.text.brand are different values. Spacing is not overridden: Tailwind's default quarter-rem grid already equals the DDS 4px scale (p-1=4px … p-16=64px; DDS space.2 = p-0.5).

Scripts

  • pnpm build — Style Dictionary v4 resolves tokens/*.json; explicit formatters emit the artifacts (an unknown $type fails the build).
  • pnpm check — token JSON validation (leaf shape, reference resolution, light/dark parity, value shapes) + tsc --strict on the generated TS.

The repo-level pnpm verify additionally runs scripts/check-docs-sync.mjs, which fails CI when docs/design-system*.md or preview/index.html drift from the token values.

版本与发布记录

@devslab/dds-tokens 共发布 46 个版本,首次发布于 2026/08/31;过去 12 个月发布了 46 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.33.0latest2026/11/12今天
0.32.22026/11/111 天前
0.32.12026/11/102 天前
0.32.02026/11/102 天前
0.31.02026/11/092 天前
0.30.02026/11/084 天前

关于 @devslab/dds-tokens 的常见问题

@devslab/dds-tokens 是什么?

DDS (DevsLab Design System) design tokens — one JSON source, built for CSS, Tailwind, TypeScript/RN and Ionic

如何安装 @devslab/dds-tokens?

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

@devslab/dds-tokens 支持 TypeScript 吗?

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

@devslab/dds-tokens 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@devslab/dds-tokens 可以商用吗?

@devslab/dds-tokens 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@devslab/dds-tokens 的下载量有多少?

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

@devslab/dds-tokens 还在维护吗?

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