@appdirect/design-system

中文文档
0.0.19发布于 2026/11/06UNLICENSEDTypeScriptCommonJS近 30 天下载 3051

AppDirect Design System components. Wraps Mantine v9 with standardized props, variants, and tokens.

原始使用文档
文档目录7 节
  1. Install
  2. What ships in the package
  3. Keep DESIGN.md in sync
  4. App usage
  5. Stories (tooling only)
  6. Contracts and ds-audit
  7. Provider note

@appdirect/design-system

AppDirect Design System components. Thin wrappers around Mantine v9.

Install

npm install @appdirect/design-system

Peer dependencies (install at the versions declared by this package):

  • react, react-dom
  • @mantine/core, @mantine/dates, @mantine/hooks

What ships in the package

WhatPath / exportUse for
Runtime JSmain / exports["."].default → dist/index.jsApp and bundler imports
TypeScript sourceexports["."].types → dist/index.ts (+ component .ts/.tsx)Editor types; do not point bundlers at these for runtime
Token CSS@appdirect/design-system/css/foundations.css, .../mantine.cssTheme variables (--ad-*)
Config / shared types@appdirect/design-system/config, @appdirect/design-system/typesScales, variant unions
Stories (source)@appdirect/design-system/stories, .../stories/*Agent / designer reference patterns (add-feature)
Contracts@appdirect/design-system/contracts, .../contracts/*ds-audit and enforcement
Design spec@appdirect/design-system/DESIGN.mdCanonical apps/design-system/DESIGN.md (token tables + prose)
CLIds-auditAudit a prototype or app against contracts
CLIad-sync-design-mdCopy DESIGN.md into the consumer repo (postinstall / sync-design-docs)

Bundlers (Rspack, webpack, Vite, Next) should resolve the package entry to .js. You do not need transpilePackages / SWC includes for this package’s TypeScript. Keep loading *.module.css from the package with your CSS-modules rule.

Keep DESIGN.md in sync

Do not hand-copy the design spec. Wire consumers to pull the published file on install:

{
  "scripts": {
    "postinstall": "ad-sync-design-md",
    "sync-design-docs": "ad-sync-design-md"
  }
}
  • Default destination: docs/DESIGN.md
  • Repo-root destination: DESIGN_MD_PATH=DESIGN.md or ad-sync-design-md --out DESIGN.md
  • Authoring source of truth in this monorepo: apps/design-system/DESIGN.md

App usage

Load token CSS once near the app root (standalone prototypes often use this package’s CSS re-exports; the tokens package is the same files):

import '@appdirect/design-system/css/foundations.css';
import '@appdirect/design-system/css/mantine.css';
// or:
// import '@appdirect/ad-design-tokens/css/foundations.css';
// import '@appdirect/ad-design-tokens/css/mantine.css';

Import product UI from this package, not raw @mantine/core, when a DS wrapper exists:

import { Button, TextInput, Stack, Card, PageContentHeader } from '@appdirect/design-system';

export function Example() {
  return (
    <Stack gap="md">
      <PageContentHeader title="Invoices" description="Open billing period" />
      <Card padding="md">
        <TextInput label="Search" />
        <Button variant="primary">Save</Button>
      </Card>
    </Stack>
  );
}

Use AppDirect button variants (primary, secondary, default, outline, danger, link, secret), not Mantine filled / light / subtle. Prefer --ad-* tokens for colour; avoid palette props like color="blue".

Shared helpers:

import { /* sizes, etc. */ } from '@appdirect/design-system/config';
import type { DSButtonVariant } from '@appdirect/design-system/types';

Stories (tooling only)

Storybook stories ship as reference source under dist/stories/. They are not a runtime export of React components.

// Index of every story: title, component, description, story names, imports
import stories from '@appdirect/design-system/stories';
// or open files via the package export:
// @appdirect/design-system/stories/Buttons/Button.stories.tsx

Prototype agents (add-feature) read node_modules/@appdirect/design-system/dist/stories/ (and the stories export) to copy composition patterns. The build fails when a story imports a Mantine component the design system has not adopted.

Contracts and ds-audit

npx ds-audit
# or: ./node_modules/.bin/ds-audit

Contracts live at @appdirect/design-system/contracts (index) and @appdirect/design-system/contracts/<id>. Use them with @appdirect/ds-enforce ESLint rules in apps that adopt the system.

Provider note

MantineProvider / theme setup stays in the host app (for example src/providers/ in micro-ui / prototype apps). This package does not export a provider.

版本与发布记录

@appdirect/design-system 共发布 20 个版本,首次发布于 2026/10/14;过去 12 个月发布了 20 个版本。

版本发布日期距今
0.0.19latest2026/11/062 天前
0.0.182026/10/318 天前
0.0.172026/10/2811 天前
0.0.162026/10/2711 天前
0.0.152026/10/2712 天前
0.0.142026/10/2712 天前

关于 @appdirect/design-system 的常见问题

@appdirect/design-system 是什么?

AppDirect Design System components. Wraps Mantine v9 with standardized props, variants, and tokens.

如何安装 @appdirect/design-system?

在项目目录运行 npm install @appdirect/design-system,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^19.2.0)、react-dom(^19.2.0)、@mantine/core(^9.6.0)、@mantine/dates(^9.6.0)、@mantine/hooks(^9.6.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 ds-audit、ad-sync-design-md,可以用 npx ds-audit 直接运行。

@appdirect/design-system 支持 TypeScript 吗?

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

@appdirect/design-system 支持 ESM 还是 CommonJS?

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

@appdirect/design-system 可以商用吗?

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

@appdirect/design-system 的下载量有多少?

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

@appdirect/design-system 还在维护吗?

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