@daikin-oss/dds-tokens

中文文档
2.0.0发布于 2026/09/01ISCTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 2880

Design token definitions for DDS

原始使用文档
文档目录6 节
  1. Usage
  2. Import CSS
  3. Import SCSS mixins
  4. Tailwind CSS v4 Integration
  5. Import JS variables
  6. Use JSON files

dds-tokens

This package provides design tokens for the Daikin Design System (DDS) in multiple formats:

  • JS/TypeScript: ESM and CommonJS modules with TypeScript declarations
  • CSS: CSS custom properties (CSS variables)
  • SCSS: Sass mixins for flexible integration
  • Tailwind CSS v4: Theme files for Tailwind CSS integration
  • JSON: Token metadata for tooling and integrations

Available themes:

  • Brands: Daikin and AAF
  • Color schemes: Light and Dark mode for each brand
  • Density: Default and Compact sizing, independent of brand/color scheme

[!NOTE] Brand/color and density are independent axes, each split into separate files. You must import both a color theme file and a density file to register all the CSS variables some components rely on.

For the complete list of output files, check the build folder after installation.

Usage

Install package:

npm install @daikin-oss/dds-tokens

Import CSS

import "@daikin-oss/dds-tokens/css/daikin/Dark/variables.css";

or

@import url("@daikin-oss/dds-tokens/css/daikin/Dark/variables.css");

This imports all design tokens as CSS custom properties under the :root selector.

Density tokens (sizing for height-controlled components) are separate from the brand/color CSS files and can be imported independently, then combined with any brand/color theme:

@import url("@daikin-oss/dds-tokens/css/daikin/Dark/variables.css");
@import url("@daikin-oss/dds-tokens/css/density/Compact/variables.css");

Available density files:

  • css/density/Default/variables.css
  • css/density/Compact/variables.css

Import SCSS mixins

SCSS mixins require the SCSS compiler, but they provide flexibility in terms of where CSS variables are deployed.

Import all themes:

@use "pkg:@daikin-oss/dds-tokens/scss/mixins" as dds-tokens;

:root {
  @include dds-tokens.daikin-Light-variables;
}

:root[data-theme="aaf"] {
  @include dds-tokens.aaf-Light-variables;
}

@media (prefers-color-scheme: dark) {
  :root {
    @include dds-tokens.daikin-Dark-variables;
  }

  :root[data-theme="aaf"] {
    @include dds-tokens.aaf-Dark-variables;
  }
}

Import individual themes:

@use "pkg:@daikin-oss/dds-tokens/scss/daikin/Light/mixins" as daikin-Light;
@use "pkg:@daikin-oss/dds-tokens/scss/daikin/Dark/mixins" as daikin-Dark;

:root {
  @include daikin-Light.variables;
}

:root.dark {
  @include daikin-Dark.variables;
}

Density mixins can be included the same way, independent of brand/color theme:

@use "pkg:@daikin-oss/dds-tokens/scss/density/Default/mixins" as density-Default;
@use "pkg:@daikin-oss/dds-tokens/scss/density/Compact/mixins" as density-Compact;

:root {
  @include density-Default.variables;
}

:root[data-density="compact"] {
  @include density-Compact.variables;
}

Tailwind CSS v4 Integration

This package provides Tailwind CSS v4 theme files that map DDS tokens to Tailwind CSS variables.

Common theme file (theme-agnostic)

The tailwind4.css file provides a theme-agnostic mapping that works with any DDS theme:

@import "@daikin-oss/dds-tokens/tailwind4.css";

This file uses @theme inline and references DDS CSS variables without fallback values. You must load a DDS theme CSS file separately to provide the actual token values.

Example:

@import "@daikin-oss/dds-tokens/css/daikin/Light/variables.css";
@import "@daikin-oss/dds-tokens/css/density/Default/variables.css";

@import "@daikin-oss/dds-tokens/tailwind4.css";

Theme-specific files

You can also use theme-specific Tailwind CSS files that include fallback values:

@import "@daikin-oss/dds-tokens/css/daikin/Light/tailwind4.css";
@import "@daikin-oss/dds-tokens/css/density/Default/tailwind4.css";

Available files:

  • css/daikin/Light/tailwind4.css
  • css/daikin/Dark/tailwind4.css
  • css/aaf/Light/tailwind4.css
  • css/aaf/Dark/tailwind4.css
  • css/density/Default/tailwind4.css
  • css/density/Compact/tailwind4.css

These files use @theme (not inline) with fallback values, allowing them to work standalone without requiring a separate DDS theme CSS file.

Variable mapping

DDS tokens are mapped to Tailwind CSS variables based on their token type:

  • color → --color-dds-*
  • spacing → --spacing-dds-*
  • borderRadius → --radius-dds-*
  • borderWidth → --border-width-dds-*
  • fontSize → --font-size-dds-*
  • fontWeight → --font-weight-dds-*
  • fontFamily → --font-family-dds-*
  • lineHeight → --line-height-dds-*

Example output:

/* Common file (build/tailwind4.css) */
@theme inline {
  --color-dds-color-blue-10: var(--dds-color-blue-10);
  --spacing-dds-space-100: var(--dds-space-100);
  /* ... */
}

/* Theme-specific file (build/css/daikin/Light/tailwind4.css) */
@theme {
  --color-dds-color-blue-10: var(--dds-color-blue-10, #ddf3fc);
  --spacing-dds-space-100: var(--dds-space-100, 4px);
  /* ... */
}

Import JS variables

// ESM
import { colorBlue10 } from "@daikin-oss/dds-tokens/js/daikin/Light/variables.js";
import { inputHeight } from "@daikin-oss/dds-tokens/js/density/Default/variables.js";

// CommonJS
const {
  colorBlue10,
} = require("@daikin-oss/dds-tokens/js/daikin/Light/variables.js");

Use JSON files

JSON files under json/ provide token metadata including types and values. These are primarily for internal use and tooling integrations.

Available files:

  • json/daikin/Light/tokens.json
  • json/daikin/Dark/tokens.json
  • json/aaf/Light/tokens.json
  • json/aaf/Dark/tokens.json
  • json/density/Default/tokens.json
  • json/density/Compact/tokens.json

File structure: { "<token name>": ["<token value>", "<style-dictionary token type>", "<tokens-studio token type>" | null] }

Example:

{
  "color-blue-10": ["#ddf3fc", "color", null],
  "space-100": ["4px", "dimension", "spacing"]
}

Additionally, the source theme JSON files (located in themes/) are published in the same path within the package for advanced use cases.

版本与发布记录

@daikin-oss/dds-tokens 共发布 21 个版本,首次发布于 2024/06/01;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.0.0latest2026/09/012 个月前
2.0.0-next.3next2026/08/282 个月前
2.0.0-next.22026/08/252 个月前
2.0.0-next.12026/08/212 个月前
1.4.0-next.02026/08/202 个月前
1.3.02026/08/182 个月前

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

@daikin-oss/dds-tokens 是什么?

Design token definitions for DDS

如何安装 @daikin-oss/dds-tokens?

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

@daikin-oss/dds-tokens 支持 TypeScript 吗?

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

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

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

@daikin-oss/dds-tokens 可以商用吗?

@daikin-oss/dds-tokens 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

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

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

@daikin-oss/dds-tokens 还在维护吗?

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