sparkdesign 0.4.8 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_COMPONENT_LIBRARY_QUICKREF.md +117 -0
- package/AI_README.md +7 -2
- package/README.md +4 -1
- package/cli/registry/AGENTS.md +1 -1
- package/cli/registry/agent-manifest.json +4040 -67
- package/cli/registry/basic/accordion.tsx +79 -0
- package/cli/registry/basic/badge.tsx +49 -0
- package/cli/registry/basic/button.tsx +19 -14
- package/cli/registry/basic/calendar.tsx +16 -16
- package/cli/registry/basic/collapsible-card.tsx +10 -1
- package/cli/registry/basic/combobox.tsx +11 -2
- package/cli/registry/basic/date-picker.tsx +3 -2
- package/cli/registry/basic/ellipsis-text.tsx +151 -0
- package/cli/registry/basic/form.tsx +186 -0
- package/cli/registry/basic/icon-button.tsx +12 -4
- package/cli/registry/basic/popover.tsx +19 -2
- package/cli/registry/basic/rating.tsx +161 -0
- package/cli/registry/basic/sidebar.tsx +665 -0
- package/cli/registry/basic/sonner.tsx +10 -10
- package/cli/registry/basic/stepper.tsx +163 -0
- package/cli/registry/basic/timeline.tsx +129 -0
- package/cli/registry/chat/chat-input/compound.tsx +1 -0
- package/cli/registry/chat/permission-card.tsx +1 -1
- package/cli/registry/chat/user-question/compound.tsx +2 -0
- package/cli/registry/meta.json +171 -13
- package/dist/registry/basic/accordion.d.ts +15 -0
- package/dist/registry/basic/badge.d.ts +23 -0
- package/dist/registry/basic/calendar.d.ts +1 -1
- package/dist/registry/basic/combobox.d.ts +2 -1
- package/dist/registry/basic/date-picker.d.ts +2 -2
- package/dist/registry/basic/ellipsis-text.d.ts +45 -0
- package/dist/registry/basic/form.d.ts +23 -0
- package/dist/registry/basic/icon-button.d.ts +15 -2
- package/dist/registry/basic/item.d.ts +1 -1
- package/dist/registry/basic/popover.d.ts +2 -0
- package/dist/registry/basic/rating.d.ts +31 -0
- package/dist/registry/basic/sidebar.d.ts +72 -0
- package/dist/registry/basic/stepper.d.ts +36 -0
- package/dist/registry/basic/tag.d.ts +1 -1
- package/dist/registry/basic/timeline.d.ts +34 -0
- package/dist/spark-design.cjs.js +27 -30
- package/dist/spark-design.es.js +6398 -5130
- package/dist/sparkdesign.css +1 -1
- package/dist/src/components/basic/Accordion/index.d.ts +13 -0
- package/dist/src/components/basic/Badge/index.d.ts +13 -0
- package/dist/src/components/basic/EllipsisText/index.d.ts +4 -36
- package/dist/src/components/basic/Form/index.d.ts +12 -0
- package/dist/src/components/basic/Rating/index.d.ts +13 -0
- package/dist/src/components/basic/Sidebar/index.d.ts +13 -0
- package/dist/src/components/basic/Stepper/index.d.ts +13 -0
- package/dist/src/components/basic/Timeline/index.d.ts +13 -0
- package/dist/src/components/index.d.ts +12 -4
- package/docs/agent/component-selection.md +104 -4
- package/docs/agent/prompt-recipes.md +167 -0
- package/docs/guides/agent-usage.md +213 -0
- package/docs/guides/system-operating-model.md +148 -0
- package/package.json +20 -3
- package/registry/agent-manifest.json +4040 -67
- package/cli/registry/basic/sheet.tsx +0 -18
- package/cli/registry/chat/user-question/UserQuestionCard.tsx +0 -198
- package/cli/registry/chat/user-question/UserQuestionFooter.tsx +0 -66
- package/cli/registry/chat/user-question/UserQuestionHeader.tsx +0 -64
- package/cli/registry/chat/user-question/useUserQuestionState.ts +0 -165
- package/dist/registry/basic/sheet.d.ts +0 -13
- package/dist/registry/chat/user-question/UserQuestionCard.d.ts +0 -36
- package/dist/registry/chat/user-question/UserQuestionFooter.d.ts +0 -24
- package/dist/registry/chat/user-question/UserQuestionHeader.d.ts +0 -26
- package/dist/registry/chat/user-question/useUserQuestionState.d.ts +0 -26
- package/dist/src/components/basic/CollapsibleSection/index.d.ts +0 -43
- package/dist/src/components/basic/Sheet/index.d.ts +0 -13
- package/dist/src/components/chat/Response/StreamingMarkdownBlock.d.ts +0 -12
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Spark Design Agent Quick Reference
|
|
2
|
+
|
|
3
|
+
> 给进入本仓库的 agent 的 1 页速查卡。详细说明见 [docs/guides/agent-usage.md](./docs/guides/agent-usage.md);组件选择见 [docs/agent/component-selection.md](./docs/agent/component-selection.md);项目级质量标准见 [docs/guides/system-operating-model.md](./docs/guides/system-operating-model.md);可复制提示词见 [docs/agent/prompt-recipes.md](./docs/agent/prompt-recipes.md)。
|
|
4
|
+
|
|
5
|
+
## 默认选择
|
|
6
|
+
|
|
7
|
+
- 默认优先:`npx sparkdesign@latest add <component>`
|
|
8
|
+
- 次选:`npm install sparkdesign`
|
|
9
|
+
- 只有用户明确要整包 import,或项目已经在用整包时,才优先走整包
|
|
10
|
+
|
|
11
|
+
## 两条路径不要混用
|
|
12
|
+
|
|
13
|
+
### CLI 本地源码模式
|
|
14
|
+
|
|
15
|
+
使用:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx sparkdesign@latest init
|
|
19
|
+
npx sparkdesign@latest add button
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
默认导入:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { Button } from '@/components/ui/basic/button'
|
|
26
|
+
import { Response } from '@/components/ui/chat/response'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
不要再写:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Button } from 'sparkdesign'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 整包模式
|
|
36
|
+
|
|
37
|
+
使用:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install sparkdesign
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
导入:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import 'sparkdesign/style'
|
|
47
|
+
import { Button, Response } from 'sparkdesign'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 样式硬规则
|
|
51
|
+
|
|
52
|
+
- 一律优先 design tokens,不要硬编码颜色、圆角、间距
|
|
53
|
+
- 根节点优先设置 `data-theme` 和 `data-style`
|
|
54
|
+
- Portal / 浮层组件要考虑 theme/style 继承,不要靠 remount 刷主题
|
|
55
|
+
|
|
56
|
+
允许:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
className="bg-primary text-text rounded-md"
|
|
60
|
+
className="px-[var(--spacing-3)]"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
不允许:
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
className="bg-[#1890FF] text-[#333] rounded-[10px]"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 组件选择
|
|
70
|
+
|
|
71
|
+
- 先读 `registry/agent-manifest.json`,按 intent、states、a11y、composition、antiPatterns 选择
|
|
72
|
+
- `basic/*`: 通用 UI
|
|
73
|
+
- `chat/*`: 对话流 UI
|
|
74
|
+
- 常见组合优先看 manifest recipes,不要只按组件名猜
|
|
75
|
+
|
|
76
|
+
优先复用已有组件:
|
|
77
|
+
|
|
78
|
+
- `button` / `icon-button`
|
|
79
|
+
- `tooltip` / `dropdown-menu` / `alert-dialog`
|
|
80
|
+
- `chat-input`
|
|
81
|
+
- `response`
|
|
82
|
+
- `reasoning-step`
|
|
83
|
+
- `code-block-part` / `terminal-code-block-part`
|
|
84
|
+
- `task-part` / `plan-part`
|
|
85
|
+
|
|
86
|
+
## 影响 CLI 时必须检查
|
|
87
|
+
|
|
88
|
+
- `registry/`
|
|
89
|
+
- `registry/meta.json`
|
|
90
|
+
- `cli/registry/` 是否已同步
|
|
91
|
+
- `npm run check:registry-meta`
|
|
92
|
+
|
|
93
|
+
## 组件完成定义
|
|
94
|
+
|
|
95
|
+
组件不只是源码文件。公开变更完成前,必须让这些表面一致:
|
|
96
|
+
|
|
97
|
+
- registry 源码与 CLI 副本
|
|
98
|
+
- 主包导出与 props 类型
|
|
99
|
+
- showcase demo / config / props / 本地化标签
|
|
100
|
+
- `registry/agent-manifest.json` 的 intent、states、a11y、composition、antiPatterns
|
|
101
|
+
- P3 header 与相关 P2 map
|
|
102
|
+
|
|
103
|
+
## 发布规则
|
|
104
|
+
|
|
105
|
+
- **唯一发布入口是仓库根目录**
|
|
106
|
+
- 不要从 `cli/` 目录执行 `npm publish`
|
|
107
|
+
- 根包 `sparkdesign` 同时承载:
|
|
108
|
+
- 运行时整包
|
|
109
|
+
- `bin.sparkdesign -> ./cli/dist/index.js`
|
|
110
|
+
|
|
111
|
+
## 开工前先回答 5 个问题
|
|
112
|
+
|
|
113
|
+
1. 当前项目是在用 CLI 本地源码,还是整包 import?
|
|
114
|
+
2. 目标组件属于 `basic` 还是 `chat`?
|
|
115
|
+
3. 是否已有可复用组件?
|
|
116
|
+
4. 样式是否完全基于 token?
|
|
117
|
+
5. 改动会不会影响 CLI registry 与发布链路?
|
package/AI_README.md
CHANGED
|
@@ -7,8 +7,11 @@ Spark Design correctly.
|
|
|
7
7
|
|
|
8
8
|
1. `registry/agent-manifest.json` — choose components by intent, slots, states, accessibility, composition, and anti-patterns.
|
|
9
9
|
2. `registry/tokens/ontology.json` — choose token families by semantic purpose before writing styles.
|
|
10
|
-
3. `docs/guides/
|
|
11
|
-
4.
|
|
10
|
+
3. `docs/guides/system-operating-model.md` — quality bar for structure, showcase, AI semantics, and maintenance gates.
|
|
11
|
+
4. `docs/agent/component-selection.md` — decision order, name boundaries, recipes, and manifest maintenance.
|
|
12
|
+
5. `docs/agent/prompt-recipes.md` — copyable prompts for install, screen composition, AI workflows, component changes, and audits.
|
|
13
|
+
6. `docs/guides/agent-usage.md` — consumption rules for CLI copy vs package import.
|
|
14
|
+
7. Component source only after the manifest tells you which component to use.
|
|
12
15
|
|
|
13
16
|
For npm package consumers:
|
|
14
17
|
|
|
@@ -22,7 +25,9 @@ import ontology from 'sparkdesign/token-ontology.json'
|
|
|
22
25
|
- Prefer `npx sparkdesign@latest add <component>` when building a business app that should own component source.
|
|
23
26
|
- Prefer `import { Component } from 'sparkdesign'` only for prototypes, showcase usage, or projects already using the package runtime.
|
|
24
27
|
- Use `basic/*` for product primitives and `chat/*` for assistant, tool, file, reasoning, and response flows.
|
|
28
|
+
- Choose components by manifest intent and anti-patterns before matching by name.
|
|
25
29
|
- Use `data-theme` for color and `data-style` for density, radius, and rhythm.
|
|
30
|
+
- Treat showcase, docs, registry metadata, and agent manifest updates as one public contract when a component changes.
|
|
26
31
|
|
|
27
32
|
## Hard Rules
|
|
28
33
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
现代化 React 设计系统,支持双维度主题(颜色 theme + 布局 scale),5 种内置布局风格,提供 Basic 基础组件与 Chat 对话流组件,可扩展颜色主题。
|
|
4
4
|
|
|
5
|
-
**当前版本**:`0.4.
|
|
5
|
+
**当前版本**:`0.4.9`([CLI 快速上手](docs/getting-started-cli.md) / [NPM 快速上手](docs/getting-started.md))
|
|
6
6
|
|
|
7
7
|
> 🌟 **纯新手?** 查看 [CLI 快速上手指南](docs/getting-started-cli.md),一步步带你跑起来!
|
|
8
8
|
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
- **图标系统可替换**:通过 `IconsProvider` 接 Lucide、Remix 或自定义图标库
|
|
18
18
|
- **Tailwind 友好**:类名与设计 token 映射,无硬编码色值
|
|
19
19
|
- **组件分层**:Basic 原子组件 + Chat 对话组件,开箱即用
|
|
20
|
+
- **AI 友好契约**:`agent-manifest.json` + token ontology + component selection guide 让 agent 按 intent、states、a11y、composition 和 anti-patterns 选择组件
|
|
21
|
+
- **可复制 Agent Recipes**:安装、页面组合、AI 工作流、组件维护和审查都有提示词模板
|
|
22
|
+
- **同构维护流程**:registry、CLI、showcase、docs、P2/P3 与发布门禁保持一致
|
|
20
23
|
|
|
21
24
|
## 两种使用方式
|
|
22
25
|
|
package/cli/registry/AGENTS.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Member list
|
|
6
6
|
|
|
7
|
-
- `basic/` — alert, alert-dialog, aspect-ratio, avatar, breadcrumb, button, button-group, calendar, card, carousel, chart, checkbox, collapse, collapsible, collapsible-card, combobox, command, context-menu, data-table, date-picker, dialog, direction, drawer, dropdown-menu, empty, field, hover-card, icon-button, input, input-group, input-otp, item, kbd, label, menubar, native-select, navigation-menu, option-list, pagination, popover, progress, radio-group, resizable, scroll-area, scrollbar, select, separator,
|
|
7
|
+
- `basic/` — accordion, alert, alert-dialog, aspect-ratio, avatar, badge, breadcrumb, button, button-group, calendar, card, carousel, chart, checkbox, collapse, collapsible, collapsible-card, combobox, command, context-menu, data-table, date-picker, dialog, direction, drawer, dropdown-menu, ellipsis-text, empty, field, form, hover-card, icon-button, input, input-group, input-otp, item, kbd, label, menubar, native-select, navigation-menu, option-list, pagination, popover, progress, radio-group, rating, resizable, scroll-area, scrollbar, select, separator, shimmering-text, sidebar, sidebar-menu, skeleton, slider, spinner, stepper, switch, table, tabs, tag, textarea, timeline, toggle, tooltip, typography.
|
|
8
8
|
- `chat/` — ask-user-part, browser-action-part, chat-input, code-block-part, conversation-anchor-nav, file-attachment, file-card, file-review-part, folder-button, generated-images-grid, generation-status-bar, hint-banner, image-attachment, image-generating, markdown, mermaid-part, permission-card, plan-part, queue-indicator, reasoning-step, related-prompts, response, send-button, streaming-markdown-block, task-part, terminal-code-block-part, thinking-indicator, tool-invocation-card, user-message, user-question, user-question-answer.
|
|
9
9
|
- `lib/` — file-icon-maps, use-mermaid-render, utils; helper modules copied with registry components when needed.
|
|
10
10
|
- `tokens/` — index.css, theme.css, theme-base.css, scale.css, ontology.json, scrollbar utility, theme presets, and scale token packs.
|