@addaab/ads

中文文档
1.4.1发布于 2026/11/04UNLICENSEDTypeScriptESM + CJS近 30 天下载 2783

Adda Design System — tokens, web components, React wrappers, and CSS. AI agents: read AGENTS.md (setup + rules), docs/components.md (component API) and docs/tokens.md (design tokens).

原始使用文档
文档目录11 节
  1. For AI agents (Claude Code, Claude Design, Lovable, v0, Cur…
  2. Install
  3. Prefixes
  4. Consumption modes
  5. 1. Vite + custom elements (preferred)
  6. 2. React (generated wrappers)
  7. 3. CSS only (vanilla HTML)
  8. 4. Lazy loader (no bundler)
  9. Package exports
  10. Light DOM policy
  11. Source & contributing

Adda Design System (@addaab/ads)

Design tokens, Stencil web components, generated React wrappers, and CSS — shipped as one installable package.

For AI agents (Claude Code, Claude Design, Lovable, v0, Cursor …)

Read these before generating code with this package (they ship inside it):

  • AGENTS.md: required setup (CSS, Avenir Next font), React patterns, server-rendered pages (markup contract), component catalogue, host page CSS and rules
  • UPGRADING.md: migration guide for breaking releases, with a codemod. 1.0.0 renames the ads- prefix to dsa-
  • docs/components.md: every component's props, events, slots, and HTML and React examples
  • docs/tokens.md: design tokens and which ones to use
  • llms.txt: index of the above; docs/custom-elements.json is the Custom Elements Manifest

Install

npm install @addaab/ads

For the React wrappers, also install their peer dependencies:

npm install @stencil/react-output-target react react-dom

@stencil/react-output-target is marked as an optional peer dependency (CSS-only and custom-element consumers don't need it), but the React wrappers import @stencil/react-output-target/runtime at runtime. React apps must install it explicitly; without it you get Cannot find module '@stencil/react-output-target/runtime'.

Prefixes

KindConventionExample
Custom elementsdsa- tag<dsa-button>
CSS classesdsa- BEM.dsa-button, .dsa-button--primary
Token CSS variablesFigma export names (unchanged)--component-color-…, --alias-…

Consumption modes

1. Vite + custom elements (preferred)

Tree-shakeable: import only what you use, then register that element.

import { defineCustomElement } from '@addaab/ads/components/dsa-button';
import '@addaab/ads/css'; // or `@addaab/ads/css/dsa-button` + `@addaab/ads/tokens/css`

defineCustomElement();
<dsa-button variant="primary">Open account</dsa-button>

React wrappers call defineCustomElement for you.

2. React (generated wrappers)

React bindings are produced by @stencil/react-output-target during the Stencil build. Do not hand-maintain them.

import { DsaButton } from '@addaab/ads/react';
import '@addaab/ads/css';

<DsaButton variant="primary">Open account</DsaButton>

Per-component: import { DsaButton } from '@addaab/ads/react/dsa-button'.

3. CSS only (vanilla HTML)

<button class="dsa-button dsa-button--primary dsa-button--medium" type="button">Open account</button>
import '@addaab/ads/css/dsa-button';
import '@addaab/ads/tokens/css';

4. Lazy loader (no bundler)

import { defineCustomElements } from '@addaab/ads/loader';
defineCustomElements();

Prefer mode 1 with Vite.

Package exports

ImportPurpose
@addaab/ads/components/<name>Custom element module (auto-defines)
@addaab/ads/reactGenerated React wrappers
@addaab/ads/cssTokens + all component CSS
@addaab/ads/css/<name>Single component CSS
@addaab/ads/tokensToken JSON
@addaab/ads/tokens/cssToken CSS variables
@addaab/ads/tokens/typography.dsa-type-* typography classes (included in @addaab/ads/css)
@addaab/ads/tokens/jsToken list as JS (tokens array: path, CSS variable, value)
@addaab/ads/AGENTS.mdConsumer guide for AI agents and developers
@addaab/ads/UPGRADING.mdMigration guide for breaking releases (1.0.0: ads- → dsa-)
@addaab/ads/codemods/migrate-to-dsa.mjsCodemod for the 1.0.0 rename (node … <dir> --write)
@addaab/ads/docs/*Generated API reference (components.md, tokens.md, custom-elements.json)
@addaab/ads/loaderStencil lazy loader

Light DOM policy

Components use light DOM by default (shadow: false) for SEO and accessibility. Use shadow DOM only when a component needs strong isolation; that component's readme documents the reason.

Source & contributing

Source, issue tracking, and contribution docs live in the Adda Design System Azure DevOps repo (packages/ads). See docs/RELEASING.md there for how releases are cut.

版本与发布记录

@addaab/ads 共发布 14 个版本,首次发布于 2026/10/01;过去 12 个月发布了 14 个版本。

版本发布日期距今
1.4.1latest2026/11/043 天前
1.4.02026/10/308 天前
1.3.02026/10/2910 天前
1.2.12026/10/2810 天前
1.2.02026/10/2711 天前
1.0.02026/10/2612 天前

关于 @addaab/ads 的常见问题

@addaab/ads 是什么?

Adda Design System — tokens, web components, React wrappers, and CSS. AI agents: read AGENTS.md (setup + rules), docs/components.md (component API) and docs/tokens.md (design tokens).

如何安装 @addaab/ads?

在项目目录运行 npm install @addaab/ads,或使用 pnpm add / yarn add / bun add。

@addaab/ads 支持 TypeScript 吗?

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

@addaab/ads 支持 ESM 还是 CommonJS?

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

@addaab/ads 可以商用吗?

@addaab/ads 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@addaab/ads 的下载量有多少?

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

@addaab/ads 还在维护吗?

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