cc-devflow 4.2.0 → 4.3.0

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.
Files changed (119) hide show
  1. package/.claude/commands/flow/CLAUDE.md +0 -4
  2. package/.claude/docs/examples/design-inspiration-pool.md +59 -0
  3. package/.claude/docs/examples/ui-prototype-constitution-checklist.md +75 -0
  4. package/.claude/docs/implementation-summary-v7.md +449 -0
  5. package/.claude/docs/spec-format-guide.md +349 -0
  6. package/.claude/docs/state-consolidation-design.md +323 -0
  7. package/.claude/docs/templates/ARCHITECTURE_TEMPLATE.md +85 -386
  8. package/.claude/docs/templates/DESIGN_TEMPLATE.md +157 -0
  9. package/.claude/docs/templates/PROPOSAL_TEMPLATE.md +91 -0
  10. package/.claude/docs/templates/SPEC_TEMPLATE_DELTA.md +139 -0
  11. package/.claude/docs/templates/SPEC_TEMPLATE_PROJECT.md +93 -0
  12. package/.claude/docs/templates/STYLE_TEMPLATE.md +114 -901
  13. package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +143 -1205
  14. package/.claude/hooks/inject-agent-context.ts +9 -9
  15. package/.claude/scripts/.claude/commands/flow/export-openspec.md +221 -0
  16. package/.claude/scripts/.claude/commands/flow/import-openspec.md +171 -0
  17. package/.claude/scripts/__tests__/openspec.test.js +212 -0
  18. package/.claude/scripts/delta-parser.ts +112 -2
  19. package/.claude/scripts/export-openspec.js +222 -0
  20. package/.claude/scripts/import-openspec.js +272 -0
  21. package/.claude/scripts/validate-scope.sh +200 -0
  22. package/.claude/skills/{workflow/flow-init → flow-init}/SKILL.md +25 -4
  23. package/.claude/skills/{workflow/flow-release → flow-release}/SKILL.md +14 -3
  24. package/.claude/skills/{workflow/flow-spec → flow-spec}/SKILL.md +30 -2
  25. package/.claude/skills/utility/npm-release/CLAUDE.md +55 -0
  26. package/.claude/skills/utility/npm-release/SKILL.md +111 -46
  27. package/.claude/skills/utility/npm-release/references/version-decision-guide.md +134 -0
  28. package/.claude/skills/utility/npm-release/scripts/atomic-version-bump.sh +95 -0
  29. package/.claude/skills/utility/npm-release/scripts/validate-version-sync.sh +82 -0
  30. package/.claude/skills/utility/npm-release/scripts/version-decision-tree.sh +44 -0
  31. package/.claude/tsc-cache/70d2fc6d-2936-429b-b529-429f1aae8c88/affected-repos.txt +1 -0
  32. package/.claude/tsc-cache/70d2fc6d-2936-429b-b529-429f1aae8c88/edited-files.log +2 -0
  33. package/CHANGELOG.md +40 -0
  34. package/README.md +2 -1
  35. package/README.zh-CN.md +2 -1
  36. package/docs/v4.3.0-migration-guide.md +276 -0
  37. package/lib/harness/CLAUDE.md +5 -4
  38. package/lib/harness/__tests__/planner.tdd.test.js +125 -0
  39. package/lib/harness/index.js +4 -2
  40. package/lib/harness/operations/dispatch.js +13 -0
  41. package/lib/harness/operations/plan.js +55 -1
  42. package/lib/harness/operations/release.js +87 -0
  43. package/lib/harness/operations/verify.js +14 -0
  44. package/lib/harness/planner.js +131 -0
  45. package/lib/harness/query.js +126 -0
  46. package/lib/harness/schemas.js +22 -1
  47. package/package.json +1 -1
  48. package/.claude/commands/flow/checklist.md +0 -18
  49. package/.claude/commands/flow/clarify.md +0 -18
  50. package/.claude/commands/flow/new.md +0 -23
  51. package/.claude/commands/flow/quality.md +0 -21
  52. package/.claude/docs/templates/EPIC_TEMPLATE.md +0 -805
  53. package/.claude/docs/templates/PRD_TEMPLATE.md +0 -562
  54. package/.claude/docs/templates/TASKS_TEMPLATE.md +0 -523
  55. package/.claude/docs/templates/TECH_DESIGN_TEMPLATE.md +0 -1019
  56. package/.claude/skills/workflow/CLAUDE.md +0 -24
  57. /package/.claude/skills/{domain/attention-refresh → attention-refresh}/SKILL.md +0 -0
  58. /package/.claude/skills/{domain/brainstorming → brainstorming}/SKILL.md +0 -0
  59. /package/.claude/skills/{guardrail/constitution-guardian → constitution-guardian}/SKILL.md +0 -0
  60. /package/.claude/skills/{utility/constitution-quick-ref → constitution-quick-ref}/SKILL.md +0 -0
  61. /package/.claude/skills/{domain/debugging → debugging}/SKILL.md +0 -0
  62. /package/.claude/skills/{utility/file-standards → file-standards}/SKILL.md +0 -0
  63. /package/.claude/skills/{domain/finishing-branch → finishing-branch}/SKILL.md +0 -0
  64. /package/.claude/skills/{workflow/flow-dev → flow-dev}/CLAUDE.md +0 -0
  65. /package/.claude/skills/{workflow/flow-dev → flow-dev}/SKILL.md +0 -0
  66. /package/.claude/skills/{workflow/flow-dev → flow-dev}/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +0 -0
  67. /package/.claude/skills/{workflow/flow-dev → flow-dev}/context.jsonl +0 -0
  68. /package/.claude/skills/{workflow/flow-dev → flow-dev}/dev-implementer.jsonl +0 -0
  69. /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/entry-gate.sh +0 -0
  70. /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/exit-gate.sh +0 -0
  71. /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/task-orchestrator.sh +0 -0
  72. /package/.claude/skills/{workflow/flow-fix → flow-fix}/SKILL.md +0 -0
  73. /package/.claude/skills/{workflow/flow-fix → flow-fix}/context.jsonl +0 -0
  74. /package/.claude/skills/{workflow/flow-fix → flow-fix}/references/bug-analyzer.md +0 -0
  75. /package/.claude/skills/{workflow/flow-init → flow-init}/assets/BRAINSTORM_TEMPLATE.md +0 -0
  76. /package/.claude/skills/{workflow/flow-init → flow-init}/assets/INIT_FLOW_TEMPLATE.md +0 -0
  77. /package/.claude/skills/{workflow/flow-init → flow-init}/assets/RESEARCH_TEMPLATE.md +0 -0
  78. /package/.claude/skills/{workflow/flow-init → flow-init}/context.jsonl +0 -0
  79. /package/.claude/skills/{workflow/flow-init → flow-init}/references/flow-researcher.md +0 -0
  80. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/check-prerequisites.sh +0 -0
  81. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/consolidate-research.sh +0 -0
  82. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/create-requirement.sh +0 -0
  83. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/generate-research-tasks.sh +0 -0
  84. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/populate-research-tasks.sh +0 -0
  85. /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/validate-research.sh +0 -0
  86. /package/.claude/skills/{workflow/flow-quality → flow-quality}/SKILL.md +0 -0
  87. /package/.claude/skills/{workflow/flow-quality → flow-quality}/context.jsonl +0 -0
  88. /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/code-quality-reviewer.md +0 -0
  89. /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/qa-tester.md +0 -0
  90. /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/security-reviewer.md +0 -0
  91. /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/spec-reviewer.md +0 -0
  92. /package/.claude/skills/{workflow/flow-release → flow-release}/context.jsonl +0 -0
  93. /package/.claude/skills/{workflow/flow-release → flow-release}/references/release-manager.md +0 -0
  94. /package/.claude/skills/{workflow/flow-spec → flow-spec}/CLAUDE.md +0 -0
  95. /package/.claude/skills/{workflow/flow-spec → flow-spec}/context.jsonl +0 -0
  96. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/entry-gate.sh +0 -0
  97. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/exit-gate.sh +0 -0
  98. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/parallel-orchestrator.sh +0 -0
  99. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/team-communication.sh +0 -0
  100. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/team-init.sh +0 -0
  101. /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/test-team-mode.sh +0 -0
  102. /package/.claude/skills/{workflow/flow-spec → flow-spec}/team-config.json +0 -0
  103. /package/.claude/skills/{workflow/flow-verify → flow-verify}/CLAUDE.md +0 -0
  104. /package/.claude/skills/{workflow/flow-verify → flow-verify}/SKILL.md +0 -0
  105. /package/.claude/skills/{workflow/flow-verify → flow-verify}/context.jsonl +0 -0
  106. /package/.claude/skills/{utility/fractal-docs → fractal-docs}/SKILL.md +0 -0
  107. /package/.claude/skills/{utility/journey-checker → journey-checker}/SKILL.md +0 -0
  108. /package/.claude/skills/{utility/journey-checker → journey-checker}/pressure-scenarios.md +0 -0
  109. /package/.claude/skills/{domain/receiving-review → receiving-review}/SKILL.md +0 -0
  110. /package/.claude/skills/{utility/skill-creator → skill-creator}/LICENSE.txt +0 -0
  111. /package/.claude/skills/{utility/skill-creator → skill-creator}/SKILL.md +0 -0
  112. /package/.claude/skills/{utility/skill-creator → skill-creator}/references/output-patterns.md +0 -0
  113. /package/.claude/skills/{utility/skill-creator → skill-creator}/references/workflows.md +0 -0
  114. /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/init_skill.py +0 -0
  115. /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/package_skill.py +0 -0
  116. /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/quick_validate.py +0 -0
  117. /package/.claude/skills/{domain/tdd → tdd}/SKILL.md +0 -0
  118. /package/.claude/skills/{guardrail/tdd-enforcer → tdd-enforcer}/SKILL.md +0 -0
  119. /package/.claude/skills/{domain/verification → verification}/SKILL.md +0 -0
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  template_name: STYLE_TEMPLATE
3
- version: 1.0.0
3
+ version: 2.0.0
4
4
  description: Template for generating project-level design style guide (STYLE.md)
5
- last_updated: 2025-11-09 北京时间
5
+ last_updated: 2026-03-12 北京时间
6
6
  ---
7
7
 
8
8
  # Design Style Guide - {Project Name}
@@ -22,20 +22,12 @@ last_updated: 2025-11-09 北京时间
22
22
  ### 设计理念
23
23
  {简要描述设计系统的核心价值和设计理念,2-3 句话}
24
24
 
25
- 例如:
26
- > 我们的设计系统以"简洁、高效、可访问"为核心,追求极致的用户体验和开发者体验。所有组件遵循一致的视觉语言,确保产品的专业度和易用性。
27
-
28
25
  ### 适用范围
29
26
  - ✅ 所有 Web 应用界面(Desktop, Tablet, Mobile)
30
27
  - ✅ 所有前端组件库
31
28
  - ✅ 所有 UI 原型设计
32
29
  - ❌ 营销材料(使用独立的品牌指南)
33
30
 
34
- ### 更新历史
35
- - **v1.0.0** (YYYY-MM-DD): 初始版本,建立核心设计系统
36
- - **v1.1.0** (YYYY-MM-DD): 新增暗色模式支持
37
- - (记录每次更新的版本号、日期、变更内容)
38
-
39
31
  ---
40
32
 
41
33
  ## 🎨 Color Palette
@@ -43,98 +35,51 @@ last_updated: 2025-11-09 北京时间
43
35
  ### 主色(Primary)
44
36
  主色用于主要操作、品牌强调、关键 CTA 等。
45
37
 
46
- | 等级 | Hex | RGB | HSL | 使用场景 |
47
- |------|-----|-----|-----|----------|
48
- | Primary 50 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 主色浅背景 |
49
- | Primary 100 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | Hover 状态 |
50
- | Primary 500 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 主色(默认) |
51
- | Primary 600 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | Active 状态 |
52
- | Primary 900 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 主色深背景 |
38
+ | 等级 | Hex | 使用场景 |
39
+ |------|-----|----------|
40
+ | Primary 50 | {#XXXXXX} | 主色浅背景 |
41
+ | Primary 500 | {#XXXXXX} | 主色(默认) |
42
+ | Primary 600 | {#XXXXXX} | Active 状态 |
43
+ | Primary 900 | {#XXXXXX} | 主色深背景 |
53
44
 
54
45
  **CSS Variables**:
55
46
  ```css
56
47
  :root {
57
48
  --color-primary-50: {#XXXXXX};
58
- --color-primary-100: {#XXXXXX};
59
49
  --color-primary-500: {#XXXXXX};
60
50
  --color-primary-600: {#XXXXXX};
61
51
  --color-primary-900: {#XXXXXX};
62
-
63
- /* 语义化别名 */
64
52
  --color-primary: var(--color-primary-500);
65
53
  --color-primary-hover: var(--color-primary-600);
66
- --color-primary-active: var(--color-primary-700);
67
- }
68
- ```
69
-
70
- **Tailwind Config** (如适用):
71
- ```js
72
- module.exports = {
73
- theme: {
74
- extend: {
75
- colors: {
76
- primary: {
77
- 50: '{#XXXXXX}',
78
- 100: '{#XXXXXX}',
79
- 500: '{#XXXXXX}',
80
- 600: '{#XXXXXX}',
81
- 900: '{#XXXXXX}',
82
- DEFAULT: '{#XXXXXX}', // primary-500
83
- },
84
- },
85
- },
86
- },
87
54
  }
88
55
  ```
89
56
 
90
57
  ### 辅色(Secondary)
91
58
  辅色用于次要操作、辅助信息、背景变化等。
92
59
 
93
- | 等级 | Hex | RGB | HSL | 使用场景 |
94
- |------|-----|-----|-----|----------|
95
- | Secondary 50 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 辅色浅背景 |
96
- | Secondary 500 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 辅色(默认) |
97
- | Secondary 900 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 辅色深背景 |
98
-
99
- (CSS Variables 和 Tailwind Config 同上)
60
+ | 等级 | Hex | 使用场景 |
61
+ |------|-----|----------|
62
+ | Secondary 500 | {#XXXXXX} | 辅色(默认) |
100
63
 
101
64
  ### 语义色(Semantic Colors)
102
65
 
103
- #### 成功色(Success)
104
- | Hex | RGB | HSL | 使用场景 |
105
- |-----|-----|-----|----------|
106
- | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 成功提示、完成状态、正向反馈 |
107
-
108
- #### 警告色(Warning)
109
- | Hex | RGB | HSL | 使用场景 |
110
- |-----|-----|-----|----------|
111
- | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 警告提示、需要注意的信息 |
112
-
113
- #### 错误色(Error)
114
- | Hex | RGB | HSL | 使用场景 |
115
- |-----|-----|-----|----------|
116
- | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 错误提示、失败状态、危险操作 |
117
-
118
- #### 信息色(Info)
119
- | Hex | RGB | HSL | 使用场景 |
120
- |-----|-----|-----|----------|
121
- | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 信息提示、帮助文本 |
66
+ | 类型 | Hex | 使用场景 |
67
+ |------|-----|----------|
68
+ | Success | {#XXXXXX} | 成功提示、完成状态、正向反馈 |
69
+ | Warning | {#XXXXXX} | 警告提示、需要注意的信息 |
70
+ | Error | {#XXXXXX} | 错误提示、失败状态、危险操作 |
71
+ | Info | {#XXXXXX} | 信息提示、帮助文本 |
122
72
 
123
73
  ### 中性色(Neutrals / Grayscale)
124
74
  中性色用于文本、边框、背景、禁用状态等。
125
75
 
126
- | 等级 | Hex | RGB | HSL | 使用场景 |
127
- |------|-----|-----|-----|----------|
128
- | Gray 50 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 浅背景 |
129
- | Gray 100 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | Hover 背景 |
130
- | Gray 200 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 边框、分隔线 |
131
- | Gray 300 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 禁用状态边框 |
132
- | Gray 400 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 占位符文本 |
133
- | Gray 500 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 次要文本 |
134
- | Gray 600 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 正文文本 |
135
- | Gray 700 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 标题文本 |
136
- | Gray 800 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 深色文本 |
137
- | Gray 900 | {#XXXXXX} | rgb({R}, {G}, {B}) | hsl({H}, {S}%, {L}%) | 最深文本 |
76
+ | 等级 | Hex | 使用场景 |
77
+ |------|-----|----------|
78
+ | Gray 50 | {#XXXXXX} | 浅背景 |
79
+ | Gray 200 | {#XXXXXX} | 边框、分隔线 |
80
+ | Gray 400 | {#XXXXXX} | 占位符文本 |
81
+ | Gray 600 | {#XXXXXX} | 正文文本 |
82
+ | Gray 900 | {#XXXXXX} | 最深文本 |
138
83
 
139
84
  ### 色彩对比度(Accessibility)
140
85
  所有颜色组合必须通过 **WCAG AA** 对比度测试:
@@ -142,11 +87,6 @@ module.exports = {
142
87
  - **大文本(18px+ 或 14px+ bold)**: 对比度 ≥ 3:1
143
88
  - **UI 组件**: 对比度 ≥ 3:1
144
89
 
145
- **已验证的颜色组合**:
146
- - ✅ Primary 500 on White: 对比度 {X.XX:1} (WCAG AA ✓)
147
- - ✅ Gray 700 on White: 对比度 {X.XX:1} (WCAG AA ✓)
148
- - (列出所有常用组合)
149
-
150
90
  ---
151
91
 
152
92
  ## ✍️ Typography
@@ -157,66 +97,44 @@ module.exports = {
157
97
  ```css
158
98
  --font-heading: "{Font Name}", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
159
99
  ```
160
- - **用途**: H1-H6, 页面标题, Section 标题
161
- - **特点**: {简要描述字体特点,如:现代、易读、几何感}
162
100
 
163
101
  #### 正文字体(Body)
164
102
  ```css
165
103
  --font-body: "{Font Name}", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
166
104
  ```
167
- - **用途**: 正文、段落、列表、标签
168
- - **特点**: {简要描述字体特点,如:清晰、易读、舒适}
169
105
 
170
106
  #### 代码字体(Monospace)
171
107
  ```css
172
108
  --font-mono: "Fira Code", "Monaco", "Consolas", monospace;
173
109
  ```
174
- - **用途**: 代码块、内联代码、技术信息
175
- - **特点**: 等宽、支持连字(ligatures)
176
110
 
177
111
  ### 字阶系统(Type Scale)
178
112
 
179
- | 类型 | Font Size | Line Height | Font Weight | Letter Spacing | 用途 |
180
- |------|-----------|-------------|-------------|----------------|------|
181
- | **H1** | {XXpx / X.XXrem} | {X.XX} | {XXX / bold} | {X.XXem} | 页面主标题 |
182
- | **H2** | {XXpx / X.XXrem} | {X.XX} | {XXX / semibold} | {X.XXem} | Section 标题 |
183
- | **H3** | {XXpx / X.XXrem} | {X.XX} | {XXX / semibold} | {X.XXem} | 子标题 |
184
- | **H4** | {XXpx / X.XXrem} | {X.XX} | {XXX / medium} | {X.XXem} | 组件标题 |
185
- | **H5** | {XXpx / X.XXrem} | {X.XX} | {XXX / medium} | {X.XXem} | 小标题 |
186
- | **H6** | {XXpx / X.XXrem} | {X.XX} | {XXX / medium} | {X.XXem} | 最小标题 |
187
- | **Body Large** | {XXpx / X.XXrem} | {X.XX} | {XXX / normal} | {X.XXem} | 重要正文 |
188
- | **Body** | {XXpx / X.XXrem} | {X.XX} | {XXX / normal} | {X.XXem} | 默认正文 |
189
- | **Body Small** | {XXpx / X.XXrem} | {X.XX} | {XXX / normal} | {X.XXem} | 次要正文 |
190
- | **Caption** | {XXpx / X.XXrem} | {X.XX} | {XXX / normal} | {X.XXem} | 说明文字 |
191
- | **Label** | {XXpx / X.XXrem} | {X.XX} | {XXX / medium} | {X.XXem} | 标签、按钮文本 |
113
+ | 类型 | Font Size | Line Height | Font Weight | 用途 |
114
+ |------|-----------|-------------|-------------|------|
115
+ | **H1** | {XXpx / X.XXrem} | {X.XX} | {XXX / bold} | 页面主标题 |
116
+ | **H2** | {XXpx / X.XXrem} | {X.XX} | {XXX / semibold} | Section 标题 |
117
+ | **H3** | {XXpx / X.XXrem} | {X.XX} | {XXX / semibold} | 子标题 |
118
+ | **Body** | {XXpx / X.XXrem} | {X.XX} | {XXX / normal} | 默认正文 |
119
+ | **Caption** | {XXpx / X.XXrem} | {X.XX} | {XXX / normal} | 说明文字 |
120
+ | **Label** | {XXpx / X.XXrem} | {X.XX} | {XXX / medium} | 标签、按钮文本 |
192
121
 
193
122
  **CSS Variables**:
194
123
  ```css
195
124
  :root {
196
- /* Font Families */
197
125
  --font-heading: "{Font Name}", sans-serif;
198
126
  --font-body: "{Font Name}", sans-serif;
199
127
  --font-mono: "Fira Code", monospace;
200
128
 
201
- /* Font Sizes */
202
129
  --text-h1: {XXpx};
203
130
  --text-h2: {XXpx};
204
131
  --text-h3: {XXpx};
205
- --text-h4: {XXpx};
206
- --text-h5: {XXpx};
207
- --text-h6: {XXpx};
208
- --text-body-lg: {XXpx};
209
132
  --text-body: {XXpx};
210
- --text-body-sm: {XXpx};
211
133
  --text-caption: {XXpx};
212
- --text-label: {XXpx};
213
134
 
214
- /* Line Heights */
215
135
  --leading-tight: {X.XX};
216
136
  --leading-normal: {X.XX};
217
- --leading-relaxed: {X.XX};
218
137
 
219
- /* Font Weights */
220
138
  --font-normal: 400;
221
139
  --font-medium: 500;
222
140
  --font-semibold: 600;
@@ -226,38 +144,11 @@ module.exports = {
226
144
 
227
145
  ### 响应式字体(Responsive Typography)
228
146
 
229
- | 类型 | Desktop (≥1024px) | Tablet (768-1023px) | Mobile (<768px) |
230
- |------|-------------------|---------------------|-----------------|
231
- | H1 | {XXpx} | {XXpx} | {XXpx} |
232
- | H2 | {XXpx} | {XXpx} | {XXpx} |
233
- | Body | {XXpx} | {XXpx} | {XXpx} |
234
-
235
- **响应式实现**:
236
- ```css
237
- /* Mobile First */
238
- h1 {
239
- font-size: {XXpx}; /* Mobile */
240
- line-height: {X.XX};
241
- }
242
-
243
- @media (min-width: 768px) {
244
- h1 {
245
- font-size: {XXpx}; /* Tablet */
246
- }
247
- }
248
-
249
- @media (min-width: 1024px) {
250
- h1 {
251
- font-size: {XXpx}; /* Desktop */
252
- }
253
- }
254
- ```
255
-
256
- ### 字体组合规律
257
- 1. **标题 + 正文**: {Heading Font} + {Body Font}
258
- 2. **强调**: 使用 font-weight(不是颜色)来强调层级
259
- 3. **避免**: 同一视图中超过 3 种字体大小
260
- 4. **行高**: 标题使用紧凑行高(1.2-1.4),正文使用舒适行高(1.5-1.8)
147
+ | 类型 | Desktop (≥1024px) | Mobile (<768px) |
148
+ |------|-------------------|-----------------|
149
+ | H1 | {XXpx} | {XXpx} |
150
+ | H2 | {XXpx} | {XXpx} |
151
+ | Body | {XXpx} | {XXpx} |
261
152
 
262
153
  ---
263
154
 
@@ -265,23 +156,21 @@ h1 {
265
156
 
266
157
  ### 基础单位(Base Unit)
267
158
  ```css
268
- --spacing-base: {4px / 8px / 16px};
159
+ --spacing-base: {4px / 8px};
269
160
  ```
270
161
 
271
162
  ### 间距等级(Spacing Scale)
272
163
 
273
- | 等级 | 值 | rem | 使用场景 |
274
- |------|-----|-----|----------|
275
- | 0 | 0px | 0rem | 无间距 |
276
- | 1 | {XXpx} | {X.XXrem} | 极小间距(图标与文本) |
277
- | 2 | {XXpx} | {X.XXrem} | 小间距(按钮内部 padding) |
278
- | 3 | {XXpx} | {X.XXrem} | 默认间距(输入框 padding) |
279
- | 4 | {XXpx} | {X.XXrem} | 中等间距(卡片 padding) |
280
- | 5 | {XXpx} | {X.XXrem} | 大间距(组件之间) |
281
- | 6 | {XXpx} | {X.XXrem} | 更大间距(Section 之间) |
282
- | 8 | {XXpx} | {X.XXrem} | 布局间距 |
283
- | 10 | {XXpx} | {X.XXrem} | 页面级间距 |
284
- | 12 | {XXpx} | {X.XXrem} | 超大间距 |
164
+ | 等级 | 值 | 使用场景 |
165
+ |------|-----|----------|
166
+ | 0 | 0px | 无间距 |
167
+ | 1 | {XXpx} | 极小间距(图标与文本) |
168
+ | 2 | {XXpx} | 小间距(按钮内部 padding) |
169
+ | 3 | {XXpx} | 默认间距(输入框 padding) |
170
+ | 4 | {XXpx} | 中等间距(卡片 padding) |
171
+ | 6 | {XXpx} | 大间距(组件之间) |
172
+ | 8 | {XXpx} | 布局间距 |
173
+ | 12 | {XXpx} | 超大间距 |
285
174
 
286
175
  **CSS Variables**:
287
176
  ```css
@@ -291,10 +180,8 @@ h1 {
291
180
  --spacing-2: {XXpx};
292
181
  --spacing-3: {XXpx};
293
182
  --spacing-4: {XXpx};
294
- --spacing-5: {XXpx};
295
183
  --spacing-6: {XXpx};
296
184
  --spacing-8: {XXpx};
297
- --spacing-10: {XXpx};
298
185
  --spacing-12: {XXpx};
299
186
 
300
187
  /* 语义化别名 */
@@ -303,64 +190,30 @@ h1 {
303
190
  --spacing-md: var(--spacing-3);
304
191
  --spacing-lg: var(--spacing-4);
305
192
  --spacing-xl: var(--spacing-6);
306
- --spacing-2xl: var(--spacing-8);
307
193
  }
308
194
  ```
309
195
 
310
- ### 使用场景
311
-
312
- #### 组件内部间距(Padding)
313
- - **按钮**: padding: var(--spacing-2) var(--spacing-4);
314
- - **输入框**: padding: var(--spacing-3) var(--spacing-4);
315
- - **卡片**: padding: var(--spacing-4) var(--spacing-5);
316
-
317
- #### 组件之间间距(Margin / Gap)
318
- - **垂直间距**: margin-bottom: var(--spacing-4);
319
- - **Grid gap**: gap: var(--spacing-4);
320
- - **Flex gap**: gap: var(--spacing-3);
321
-
322
- #### 布局间距(Layout)
323
- - **Section 间距**: margin-bottom: var(--spacing-8);
324
- - **页面 padding**: padding: var(--spacing-6) var(--spacing-4);
325
-
326
196
  ---
327
197
 
328
198
  ## 🧩 Component Styles
329
199
 
330
- 以下为核心组件的详细样式定义。每个组件包含:基础样式、变体、尺寸、状态。
200
+ 以下为核心组件的详细样式定义。
331
201
 
332
202
  ### Button
333
203
 
334
204
  #### 基础样式
335
- ```html
336
- <button class="btn">Button</button>
337
- ```
338
-
339
205
  ```css
340
206
  .btn {
341
- /* 字体 */
342
207
  font-family: var(--font-body);
343
208
  font-size: var(--text-label);
344
209
  font-weight: var(--font-medium);
345
- line-height: 1;
346
-
347
- /* 间距 */
348
210
  padding: var(--spacing-2) var(--spacing-4);
349
-
350
- /* 圆角 */
351
211
  border-radius: var(--radius-md);
352
-
353
- /* 边框 */
354
212
  border: 1px solid transparent;
355
-
356
- /* 过渡 */
357
213
  transition: all var(--duration-fast) var(--easing-ease-in-out);
358
-
359
- /* 其他 */
360
214
  cursor: pointer;
361
215
  display: inline-flex;
362
216
  align-items: center;
363
- justify-content: center;
364
217
  gap: var(--spacing-2);
365
218
  }
366
219
  ```
@@ -373,30 +226,15 @@ h1 {
373
226
  background-color: var(--color-primary);
374
227
  color: white;
375
228
  }
376
-
377
229
  .btn-primary:hover {
378
230
  background-color: var(--color-primary-hover);
379
231
  }
380
-
381
- .btn-primary:active {
382
- background-color: var(--color-primary-active);
383
- }
384
-
385
232
  .btn-primary:disabled {
386
233
  background-color: var(--color-gray-300);
387
234
  cursor: not-allowed;
388
235
  }
389
236
  ```
390
237
 
391
- **Secondary**:
392
- ```css
393
- .btn-secondary {
394
- background-color: var(--color-secondary);
395
- color: white;
396
- }
397
- /* Hover, Active, Disabled 同上 */
398
- ```
399
-
400
238
  **Outline**:
401
239
  ```css
402
240
  .btn-outline {
@@ -404,728 +242,165 @@ h1 {
404
242
  color: var(--color-primary);
405
243
  border-color: var(--color-primary);
406
244
  }
407
-
408
245
  .btn-outline:hover {
409
246
  background-color: var(--color-primary-50);
410
247
  }
411
248
  ```
412
249
 
413
- **Ghost**:
414
- ```css
415
- .btn-ghost {
416
- background-color: transparent;
417
- color: var(--color-gray-700);
418
- }
419
-
420
- .btn-ghost:hover {
421
- background-color: var(--color-gray-100);
422
- }
423
- ```
424
-
425
250
  #### 尺寸(Sizes)
426
251
 
427
- | 尺寸 | Padding | Font Size | Height |
428
- |------|---------|-----------|--------|
429
- | **sm** | var(--spacing-1) var(--spacing-3) | {XXpx} | {XXpx} |
430
- | **md** | var(--spacing-2) var(--spacing-4) | {XXpx} | {XXpx} |
431
- | **lg** | var(--spacing-3) var(--spacing-6) | {XXpx} | {XXpx} |
432
-
433
- ```css
434
- .btn-sm { padding: var(--spacing-1) var(--spacing-3); font-size: {XXpx}; }
435
- .btn-md { padding: var(--spacing-2) var(--spacing-4); font-size: {XXpx}; }
436
- .btn-lg { padding: var(--spacing-3) var(--spacing-6); font-size: {XXpx}; }
437
- ```
438
-
439
- #### 完整示例
440
- ```html
441
- <!-- Primary Button (Medium) -->
442
- <button class="btn btn-primary btn-md">
443
- Primary Button
444
- </button>
445
-
446
- <!-- Outline Button (Large) -->
447
- <button class="btn btn-outline btn-lg">
448
- Outline Button
449
- </button>
450
-
451
- <!-- Disabled Button -->
452
- <button class="btn btn-primary btn-md" disabled>
453
- Disabled
454
- </button>
455
- ```
252
+ | 尺寸 | Padding | Font Size |
253
+ |------|---------|-----------|
254
+ | **sm** | var(--spacing-1) var(--spacing-3) | {XXpx} |
255
+ | **md** | var(--spacing-2) var(--spacing-4) | {XXpx} |
256
+ | **lg** | var(--spacing-3) var(--spacing-6) | {XXpx} |
456
257
 
457
258
  ---
458
259
 
459
260
  ### Input / Textarea
460
261
 
461
262
  #### 基础样式
462
- ```html
463
- <input type="text" class="input" placeholder="Enter text..." />
464
- ```
465
-
466
263
  ```css
467
264
  .input {
468
- /* 字体 */
469
265
  font-family: var(--font-body);
470
266
  font-size: var(--text-body);
471
- line-height: 1.5;
472
-
473
- /* 间距 */
474
267
  padding: var(--spacing-3) var(--spacing-4);
475
-
476
- /* 圆角 */
477
268
  border-radius: var(--radius-md);
478
-
479
- /* 边框 */
480
269
  border: 1px solid var(--color-gray-300);
481
-
482
- /* 背景 */
483
270
  background-color: white;
484
-
485
- /* 过渡 */
486
- transition: all var(--duration-fast) var(--easing-ease-in-out);
487
-
488
- /* 其他 */
271
+ transition: all var(--duration-fast);
489
272
  width: 100%;
490
273
  outline: none;
491
274
  }
492
-
493
275
  .input:hover {
494
276
  border-color: var(--color-gray-400);
495
277
  }
496
-
497
278
  .input:focus {
498
279
  border-color: var(--color-primary);
499
280
  box-shadow: 0 0 0 3px var(--color-primary-50);
500
281
  }
501
-
502
282
  .input:disabled {
503
283
  background-color: var(--color-gray-100);
504
284
  cursor: not-allowed;
505
285
  }
506
-
507
- .input::placeholder {
508
- color: var(--color-gray-400);
509
- }
510
286
  ```
511
287
 
512
288
  #### 状态(States)
513
-
514
- **Error**:
515
- ```css
516
- .input-error {
517
- border-color: var(--color-error);
518
- }
519
-
520
- .input-error:focus {
521
- border-color: var(--color-error);
522
- box-shadow: 0 0 0 3px rgba(var(--color-error-rgb), 0.1);
523
- }
524
- ```
525
-
526
- **Success**:
527
- ```css
528
- .input-success {
529
- border-color: var(--color-success);
530
- }
531
- ```
289
+ - **Error**: `.input-error` - 红色边框 + 错误提示
290
+ - **Success**: `.input-success` - 绿色边框
291
+ - **Disabled**: `:disabled` - 灰色背景 + 禁用光标
532
292
 
533
293
  ---
534
294
 
535
295
  ### Card
536
296
 
537
- #### 基础样式
538
- ```html
539
- <div class="card">
540
- <h3>Card Title</h3>
541
- <p>Card content goes here...</p>
542
- </div>
543
- ```
544
-
545
297
  ```css
546
298
  .card {
547
- /* 背景 */
548
299
  background-color: white;
549
-
550
- /* 间距 */
551
- padding: var(--spacing-4) var(--spacing-5);
552
-
553
- /* 圆角 */
554
300
  border-radius: var(--radius-lg);
555
-
556
- /* 阴影 */
557
- box-shadow: var(--shadow-md);
558
-
559
- /* 边框(可选) */
560
- border: 1px solid var(--color-gray-200);
561
-
562
- /* 过渡 */
563
- transition: all var(--duration-base) var(--easing-ease-in-out);
301
+ padding: var(--spacing-4);
302
+ box-shadow: var(--shadow-sm);
303
+ transition: all var(--duration-normal);
564
304
  }
565
-
566
305
  .card:hover {
567
- box-shadow: var(--shadow-lg);
306
+ box-shadow: var(--shadow-md);
568
307
  transform: translateY(-2px);
569
308
  }
570
309
  ```
571
310
 
572
311
  ---
573
312
 
574
- ### Modal / Dialog
575
-
576
- (类似上述格式,包含基础样式、变体、状态、完整示例代码)
577
-
578
- ---
579
-
580
- ### Alert / Toast
581
-
582
- (类似上述格式,包含基础样式、变体、状态、完整示例代码)
583
-
584
- ---
585
-
586
- (继续其他核心组件:Badge, Avatar, Table, Navigation, Pagination, Tabs, Tooltip 等)
587
-
588
- ---
589
-
590
313
  ## 🌫️ Shadows & Elevation
591
314
 
592
- ### 阴影系统(Shadow Scale)
593
-
594
- | 等级 | box-shadow | 使用场景 |
595
- |------|----------------|----------|
596
- | **None** | none | 平面元素(按钮、输入框默认状态) |
597
- | **XS** | 0 1px 2px 0 rgba(0, 0, 0, 0.05) | 轻微层级(边框替代) |
598
- | **SM** | 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) | 小卡片、下拉菜单 |
599
- | **MD** | 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) | 卡片默认状态 |
600
- | **LG** | 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) | 卡片 Hover 状态 |
601
- | **XL** | 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) | Modal、Popup |
602
- | **2XL** | 0 25px 50px -12px rgba(0, 0, 0, 0.25) | 最高层级(全屏 Modal) |
603
-
604
- **CSS Variables**:
605
- ```css
606
- :root {
607
- --shadow-none: none;
608
- --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
609
- --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
610
- --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
611
- --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
612
- --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
613
- --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
614
- }
615
- ```
616
-
617
- ### 层级指南(Elevation Guide)
618
- 1. **Level 0**: 页面背景、平面元素
619
- 2. **Level 1**: 卡片、按钮
620
- 3. **Level 2**: Hover 状态
621
- 4. **Level 3**: Dropdown、Tooltip
622
- 5. **Level 4**: Modal、Drawer
623
- 6. **Level 5**: 全屏 Overlay
315
+ | 等级 | CSS Variable | 使用场景 |
316
+ |------|--------------|----------|
317
+ | **sm** | `--shadow-sm: 0 1px 2px rgba(0,0,0,0.05)` | 卡片、按钮 |
318
+ | **md** | `--shadow-md: 0 4px 6px rgba(0,0,0,0.1)` | Hover 状态 |
319
+ | **lg** | `--shadow-lg: 0 10px 15px rgba(0,0,0,0.1)` | Modal、Dropdown |
320
+ | **xl** | `--shadow-xl: 0 20px 25px rgba(0,0,0,0.15)` | 浮层 |
624
321
 
625
322
  ---
626
323
 
627
324
  ## 🎬 Animations & Transitions
628
325
 
629
- ### 过渡时长(Duration)
630
-
631
- | 名称 | 值 | 使用场景 |
632
- |------|-----|----------|
633
- | **Fast** | {XXXms} | Hover 效果、按钮点击 |
634
- | **Base** | {XXXms} | 默认过渡、卡片展开 |
635
- | **Slow** | {XXXms} | Modal 打开、页面切换 |
636
-
326
+ ### 时长(Duration)
637
327
  ```css
638
328
  :root {
639
- --duration-fast: {XXXms};
640
- --duration-base: {XXXms};
641
- --duration-slow: {XXXms};
329
+ --duration-fast: 150ms;
330
+ --duration-normal: 250ms;
331
+ --duration-slow: 350ms;
642
332
  }
643
333
  ```
644
334
 
645
335
  ### 缓动函数(Easing)
646
-
647
- | 名称 | cubic-bezier 值 | 使用场景 |
648
- |------|----------------|----------|
649
- | **Ease-in** | cubic-bezier(0.4, 0, 1, 1) | 元素退出 |
650
- | **Ease-out** | cubic-bezier(0, 0, 0.2, 1) | 元素进入 |
651
- | **Ease-in-out** | cubic-bezier(0.4, 0, 0.2, 1) | 通用过渡 |
652
-
653
336
  ```css
654
337
  :root {
655
- --easing-ease-in: cubic-bezier(0.4, 0, 1, 1);
656
- --easing-ease-out: cubic-bezier(0, 0, 0.2, 1);
657
338
  --easing-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
339
+ --easing-ease-out: cubic-bezier(0, 0, 0.2, 1);
340
+ --easing-ease-in: cubic-bezier(0.4, 0, 1, 1);
658
341
  }
659
342
  ```
660
343
 
661
- ### 常用动画(Keyframes)
662
-
663
- #### Fade In
344
+ ### 常用动画
664
345
  ```css
665
346
  @keyframes fadeIn {
666
- from { opacity: 0; }
667
- to { opacity: 1; }
347
+ from { opacity: 0; transform: translateY(10px); }
348
+ to { opacity: 1; transform: translateY(0); }
668
349
  }
669
350
 
670
- .fade-in {
671
- animation: fadeIn var(--duration-base) var(--easing-ease-out);
351
+ @keyframes slideIn {
352
+ from { transform: translateX(-100%); }
353
+ to { transform: translateX(0); }
672
354
  }
673
355
  ```
674
356
 
675
- #### Slide Up
357
+ ### 无障碍: 禁用动效
676
358
  ```css
677
- @keyframes slideUp {
678
- from {
679
- opacity: 0;
680
- transform: translateY(10px);
681
- }
682
- to {
683
- opacity: 1;
684
- transform: translateY(0);
359
+ @media (prefers-reduced-motion: reduce) {
360
+ * {
361
+ animation: none !important;
362
+ transition: none !important;
685
363
  }
686
364
  }
687
-
688
- .slide-up {
689
- animation: slideUp var(--duration-base) var(--easing-ease-out);
690
- }
691
- ```
692
-
693
- #### Scale
694
- ```css
695
- @keyframes scale {
696
- from { transform: scale(0.95); }
697
- to { transform: scale(1); }
698
- }
699
-
700
- .scale-in {
701
- animation: scale var(--duration-fast) var(--easing-ease-out);
702
- }
703
365
  ```
704
366
 
705
367
  ---
706
368
 
707
369
  ## 🔲 Border Radius
708
370
 
709
- ### 圆角系统(Radius Scale)
710
-
711
371
  | 等级 | 值 | 使用场景 |
712
372
  |------|-----|----------|
713
- | **None** | 0px | 方形元素(Table, 严肃场景) |
714
- | **SM** | {XXpx} | 按钮、输入框 |
715
- | **Base** | {XXpx} | 默认圆角 |
716
- | **MD** | {XXpx} | 卡片 |
717
- | **LG** | {XXpx} | Modal |
718
- | **XL** | {XXpx} | 特殊卡片 |
719
- | **Full** | 9999px | 圆形(Avatar, Badge) |
373
+ | **sm** | {XXpx} | 小组件(Badge, Tag) |
374
+ | **md** | {XXpx} | 按钮、输入框 |
375
+ | **lg** | {XXpx} | 卡片、Modal |
376
+ | **full** | 9999px | 圆形按钮、Avatar |
720
377
 
721
378
  ```css
722
379
  :root {
723
- --radius-none: 0;
724
380
  --radius-sm: {XXpx};
725
- --radius-base: {XXpx};
726
381
  --radius-md: {XXpx};
727
382
  --radius-lg: {XXpx};
728
- --radius-xl: {XXpx};
729
383
  --radius-full: 9999px;
730
384
  }
731
385
  ```
732
386
 
733
387
  ---
734
388
 
735
- ## 🌟 Opacity & Transparency
736
-
737
- ### 透明度等级
738
-
739
- | 等级 | 值 | 使用场景 |
740
- |------|-----|----------|
741
- | **0** | 0 | 完全透明(隐藏元素) |
742
- | **10** | 0.1 | 极浅遮罩 |
743
- | **25** | 0.25 | 浅遮罩 |
744
- | **50** | 0.5 | 半透明(Overlay) |
745
- | **75** | 0.75 | 轻微透明 |
746
- | **90** | 0.9 | 几乎不透明 |
747
- | **100** | 1 | 完全不透明 |
748
-
749
- ```css
750
- :root {
751
- --opacity-0: 0;
752
- --opacity-10: 0.1;
753
- --opacity-25: 0.25;
754
- --opacity-50: 0.5;
755
- --opacity-75: 0.75;
756
- --opacity-90: 0.9;
757
- --opacity-100: 1;
758
- }
759
- ```
760
-
761
- ### 使用场景
762
- - **Disabled 状态**: opacity: var(--opacity-50);
763
- - **Overlay**: background-color: rgba(0, 0, 0, var(--opacity-50));
764
- - **Hover 效果**: opacity: var(--opacity-90);
765
-
766
- ---
767
-
768
- ## 🎨 Common Tailwind CSS Usage
769
-
770
- (仅当项目使用 Tailwind CSS 时包含此部分)
771
-
772
- ### 常用 Utility Classes 组合
773
-
774
- #### Button
775
- ```html
776
- <button class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary-600 transition-colors duration-200">
777
- Primary Button
778
- </button>
779
- ```
780
-
781
- #### Card
782
- ```html
783
- <div class="p-6 bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300">
784
- Card content
785
- </div>
786
- ```
787
-
788
- #### Input
789
- ```html
790
- <input
791
- type="text"
792
- class="px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
793
- placeholder="Enter text..."
794
- />
795
- ```
796
-
797
- ### 自定义 Tailwind 配置
798
- ```js
799
- // tailwind.config.js
800
- module.exports = {
801
- theme: {
802
- extend: {
803
- colors: {
804
- primary: {
805
- 50: '{#XXXXXX}',
806
- 500: '{#XXXXXX}',
807
- 600: '{#XXXXXX}',
808
- // ...
809
- },
810
- },
811
- spacing: {
812
- // Custom spacing values
813
- },
814
- borderRadius: {
815
- // Custom border radius values
816
- },
817
- boxShadow: {
818
- // Custom shadows
819
- },
820
- },
821
- },
822
- plugins: [
823
- require('@tailwindcss/typography'),
824
- require('@tailwindcss/forms'),
825
- ],
826
- }
827
- ```
828
-
829
- ---
830
-
831
- ## 📦 Example Component Reference Design Code
832
-
833
- 以下是 3 个完整的组件实现示例,可直接复用。
834
-
835
- ### Example 1: Primary Button with Icon
836
-
837
- ```html
838
- <button class="btn btn-primary btn-md">
839
- <svg class="icon" width="16" height="16" fill="currentColor">
840
- <path d="M12 5l-8 8M4 5l8 8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
841
- </svg>
842
- Button with Icon
843
- </button>
844
- ```
845
-
846
- ```css
847
- .btn {
848
- /* 字体 */
849
- font-family: var(--font-body);
850
- font-size: var(--text-label);
851
- font-weight: var(--font-medium);
852
- line-height: 1;
853
-
854
- /* 间距 */
855
- padding: var(--spacing-2) var(--spacing-4);
856
-
857
- /* 圆角 */
858
- border-radius: var(--radius-md);
859
-
860
- /* 边框 */
861
- border: 1px solid transparent;
862
-
863
- /* 过渡 */
864
- transition: all var(--duration-fast) var(--easing-ease-in-out);
865
-
866
- /* 布局 */
867
- display: inline-flex;
868
- align-items: center;
869
- justify-content: center;
870
- gap: var(--spacing-2);
871
- cursor: pointer;
872
- }
873
-
874
- .btn-primary {
875
- background-color: var(--color-primary);
876
- color: white;
877
- }
878
-
879
- .btn-primary:hover {
880
- background-color: var(--color-primary-hover);
881
- }
882
-
883
- .btn-primary:active {
884
- transform: scale(0.98);
885
- }
886
-
887
- .btn .icon {
888
- width: 16px;
889
- height: 16px;
890
- }
891
- ```
892
-
893
- **设计决策**:
894
- - 使用 `inline-flex` 和 `gap` 确保图标与文本间距一致
895
- - Hover 使用颜色变化,Active 使用微妙的 scale 效果
896
- - 图标尺寸固定为 16px,确保视觉平衡
897
-
898
- ---
899
-
900
- ### Example 2: Card with Hover Effect
901
-
902
- ```html
903
- <div class="card">
904
- <div class="card-header">
905
- <h3 class="card-title">Card Title</h3>
906
- <span class="badge">New</span>
907
- </div>
908
- <div class="card-body">
909
- <p class="card-description">
910
- This is a card component with hover effect. Hover to see the shadow and transform animation.
911
- </p>
912
- </div>
913
- <div class="card-footer">
914
- <button class="btn btn-outline btn-sm">Learn More</button>
915
- </div>
916
- </div>
917
- ```
918
-
919
- ```css
920
- .card {
921
- /* 背景 */
922
- background-color: white;
923
-
924
- /* 间距 */
925
- padding: 0;
926
-
927
- /* 圆角 */
928
- border-radius: var(--radius-lg);
929
-
930
- /* 阴影 */
931
- box-shadow: var(--shadow-md);
932
-
933
- /* 边框 */
934
- border: 1px solid var(--color-gray-200);
935
-
936
- /* 过渡 */
937
- transition: all var(--duration-base) var(--easing-ease-in-out);
938
-
939
- /* 其他 */
940
- overflow: hidden;
941
- }
942
-
943
- .card:hover {
944
- box-shadow: var(--shadow-lg);
945
- transform: translateY(-4px);
946
- }
947
-
948
- .card-header {
949
- display: flex;
950
- align-items: center;
951
- justify-content: space-between;
952
- padding: var(--spacing-4) var(--spacing-5);
953
- border-bottom: 1px solid var(--color-gray-200);
954
- }
955
-
956
- .card-title {
957
- font-size: var(--text-h4);
958
- font-weight: var(--font-semibold);
959
- margin: 0;
960
- }
961
-
962
- .badge {
963
- padding: var(--spacing-1) var(--spacing-2);
964
- background-color: var(--color-primary-50);
965
- color: var(--color-primary);
966
- font-size: var(--text-caption);
967
- font-weight: var(--font-medium);
968
- border-radius: var(--radius-full);
969
- }
970
-
971
- .card-body {
972
- padding: var(--spacing-4) var(--spacing-5);
973
- }
974
-
975
- .card-description {
976
- color: var(--color-gray-600);
977
- line-height: 1.6;
978
- margin: 0;
979
- }
980
-
981
- .card-footer {
982
- padding: var(--spacing-4) var(--spacing-5);
983
- border-top: 1px solid var(--color-gray-200);
984
- }
985
- ```
986
-
987
- **设计决策**:
988
- - Card 分为 Header, Body, Footer 三个区域,使用 border 分隔
989
- - Hover 效果结合阴影和位移,营造层级感
990
- - Badge 使用主色的浅色背景,确保视觉一致性
991
-
992
- ---
993
-
994
- ### Example 3: Form Input with Error State
995
-
996
- ```html
997
- <div class="form-group">
998
- <label for="email" class="form-label">Email Address</label>
999
- <input
1000
- type="email"
1001
- id="email"
1002
- class="input input-error"
1003
- placeholder="you@example.com"
1004
- aria-invalid="true"
1005
- aria-describedby="email-error"
1006
- />
1007
- <p id="email-error" class="form-error">Please enter a valid email address.</p>
1008
- </div>
1009
- ```
1010
-
1011
- ```css
1012
- .form-group {
1013
- display: flex;
1014
- flex-direction: column;
1015
- gap: var(--spacing-2);
1016
- }
1017
-
1018
- .form-label {
1019
- font-size: var(--text-label);
1020
- font-weight: var(--font-medium);
1021
- color: var(--color-gray-700);
1022
- }
1023
-
1024
- .input {
1025
- /* 字体 */
1026
- font-family: var(--font-body);
1027
- font-size: var(--text-body);
1028
- line-height: 1.5;
1029
-
1030
- /* 间距 */
1031
- padding: var(--spacing-3) var(--spacing-4);
1032
-
1033
- /* 圆角 */
1034
- border-radius: var(--radius-md);
1035
-
1036
- /* 边框 */
1037
- border: 1px solid var(--color-gray-300);
1038
-
1039
- /* 背景 */
1040
- background-color: white;
1041
-
1042
- /* 过渡 */
1043
- transition: all var(--duration-fast) var(--easing-ease-in-out);
1044
-
1045
- /* 其他 */
1046
- width: 100%;
1047
- outline: none;
1048
- }
1049
-
1050
- .input:hover {
1051
- border-color: var(--color-gray-400);
1052
- }
1053
-
1054
- .input:focus {
1055
- border-color: var(--color-primary);
1056
- box-shadow: 0 0 0 3px var(--color-primary-50);
1057
- }
1058
-
1059
- .input-error {
1060
- border-color: var(--color-error);
1061
- }
1062
-
1063
- .input-error:focus {
1064
- border-color: var(--color-error);
1065
- box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); /* Error color with opacity */
1066
- }
1067
-
1068
- .form-error {
1069
- font-size: var(--text-caption);
1070
- color: var(--color-error);
1071
- margin: 0;
1072
- }
1073
- ```
1074
-
1075
- **设计决策**:
1076
- - 使用 `flex-direction: column` 和 `gap` 确保标签、输入框、错误信息的间距一致
1077
- - Error 状态使用红色边框和 box-shadow,视觉明确
1078
- - 使用 ARIA 属性确保可访问性(`aria-invalid`, `aria-describedby`)
1079
-
1080
- ---
1081
-
1082
389
  ## 📱 Responsive Design
1083
390
 
1084
- ### 断点定义(Breakpoints)
1085
-
1086
- | 名称 | 最小宽度 | 目标设备 |
1087
- |------|----------|----------|
1088
- | **Mobile** | 0px | 手机(<768px) |
1089
- | **Tablet** | 768px | 平板(768-1023px) |
1090
- | **Desktop** | 1024px | 桌面(1024-1439px) |
1091
- | **Wide** | 1440px | 宽屏(≥1440px) |
1092
-
391
+ ### 断点(Breakpoints)
1093
392
  ```css
1094
- :root {
1095
- --breakpoint-mobile: 0px;
1096
- --breakpoint-tablet: 768px;
1097
- --breakpoint-desktop: 1024px;
1098
- --breakpoint-wide: 1440px;
1099
- }
393
+ /* Mobile: 320px-767px (默认) */
394
+ /* Tablet: 768px-1023px */
395
+ @media (min-width: 768px) { ... }
396
+ /* Desktop: 1024px+ */
397
+ @media (min-width: 1024px) { ... }
1100
398
  ```
1101
399
 
1102
400
  ### 响应式策略
1103
401
  - **Mobile-First**: 默认样式为移动端,使用 `@media (min-width: ...)` 添加更大屏幕样式
1104
402
  - **核心原则**: 确保所有功能在移动端可用,桌面端提供增强体验
1105
403
 
1106
- ### 响应式组件示例
1107
-
1108
- #### Grid Layout
1109
- ```css
1110
- .grid {
1111
- display: grid;
1112
- gap: var(--spacing-4);
1113
- grid-template-columns: 1fr; /* Mobile: 1 column */
1114
- }
1115
-
1116
- @media (min-width: 768px) {
1117
- .grid {
1118
- grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columns */
1119
- }
1120
- }
1121
-
1122
- @media (min-width: 1024px) {
1123
- .grid {
1124
- grid-template-columns: repeat(3, 1fr); /* Desktop: 3 columns */
1125
- }
1126
- }
1127
- ```
1128
-
1129
404
  ---
1130
405
 
1131
406
  ## ♿ Accessibility
@@ -1137,7 +412,7 @@ module.exports = {
1137
412
 
1138
413
  ### 键盘导航(Keyboard Navigation)
1139
414
  - ✅ 所有交互元素可通过 Tab 键访问
1140
- - ✅ Focus 状态清晰可见(使用 box-shadow 或 outline)
415
+ - ✅ Focus 状态清晰可见
1141
416
  - ✅ 支持 Enter/Space 触发按钮和链接
1142
417
 
1143
418
  ### ARIA 属性(ARIA Attributes)
@@ -1151,36 +426,10 @@ module.exports = {
1151
426
  outline: 2px solid var(--color-primary);
1152
427
  outline-offset: 2px;
1153
428
  }
1154
-
1155
- /* 或使用 box-shadow */
1156
- .btn:focus-visible {
1157
- box-shadow: 0 0 0 3px var(--color-primary-50);
1158
- }
1159
429
  ```
1160
430
 
1161
431
  ---
1162
432
 
1163
- ## 🖼️ Assets
1164
-
1165
- (如适用)
1166
-
1167
- ### Icon 系统
1168
- - **Icon Library**: {Heroicons / Feather / Lucide / Material Icons}
1169
- - **尺寸**: 16px (sm), 20px (md), 24px (lg)
1170
- - **颜色**: 使用 `currentColor` 继承文本颜色
1171
-
1172
- ### Image 规范
1173
- - **格式**: WebP(现代浏览器), PNG/JPG(Fallback)
1174
- - **压缩**: TinyPNG, ImageOptim
1175
- - **尺寸**: 根据显示尺寸提供 1x, 2x, 3x 版本
1176
-
1177
- ### Logo 使用规范
1178
- - **主 Logo**: 用于导航栏、页脚
1179
- - **简化 Logo**: 用于 Favicon, Mobile App Icon
1180
- - **最小尺寸**: 不小于 24px(确保可识别)
1181
-
1182
- ---
1183
-
1184
433
  ## 🎯 Design Principles
1185
434
 
1186
435
  ### 1. 简洁性(Simplicity)
@@ -1191,7 +440,7 @@ module.exports = {
1191
440
  ### 2. 一致性(Consistency)
1192
441
  - 所有组件遵循统一的视觉语言
1193
442
  - 颜色、字体、间距、圆角使用一致的系统
1194
- - 交互行为保持一致(如 Hover, Focus 效果)
443
+ - 交互行为保持一致
1195
444
 
1196
445
  ### 3. 可访问性(Accessibility)
1197
446
  - 色彩对比度符合 WCAG AA 标准
@@ -1200,67 +449,31 @@ module.exports = {
1200
449
 
1201
450
  ### 4. 响应式(Responsive)
1202
451
  - Mobile-First 设计
1203
- - 所有组件在所有设备上可用
1204
- - 根据屏幕尺寸优化布局和字体
1205
-
1206
- ### 5. 性能优先(Performance)
1207
- - 优化资源加载(图片压缩、字体子集化)
1208
- - 避免过度使用动画和阴影
1209
- - 使用 CSS Variables 减少重复代码
452
+ - 所有组件在不同屏幕尺寸下正常工作
1210
453
 
1211
454
  ---
1212
455
 
1213
456
  ## 📝 Usage Guidelines
1214
457
 
1215
- ### 如何使用本指南
1216
-
1217
- 1. **开发新组件时**:
1218
- - 查阅对应组件的样式定义
1219
- - 复制示例代码并根据需求调整
1220
- - 确保遵循颜色、字体、间距系统
1221
-
1222
- 2. **修改现有组件时**:
1223
- - 检查是否符合本指南的定义
1224
- - 如有偏差,优先修正为符合指南的样式
1225
- - 如需新增变体,确保与现有变体一致
1226
-
1227
- 3. **生成 UI 原型时**:
1228
- - `/flow:spec` 阶段会自动引用本指南
1229
- - 确保原型中的所有样式符合本指南
1230
-
1231
- 4. **前端开发时**:
1232
- - `/flow:dev` 命令会自动引用本指南
1233
- - 所有组件实现必须遵循本指南的样式定义
458
+ ### For Designers
459
+ 1. 使用本指南中定义的 Design Tokens
460
+ 2. 新组件设计前检查是否已有类似组件
461
+ 3. 确保所有设计符合可访问性标准
1234
462
 
1235
- ### 更新本指南
463
+ ### For Developers
464
+ 1. 使用 CSS Variables 而非硬编码值
465
+ 2. 遵循组件样式规范
466
+ 3. 确保响应式实现正确
1236
467
 
1237
- - **何时更新**: 新增组件、调整设计系统、发现不一致
1238
- - **如何更新**: 使用 `/core-style --update` 命令
1239
- - **版本控制**: 每次更新增加版本号,记录变更内容
468
+ ### For Product Managers
469
+ 1. 新功能设计应符合现有设计系统
470
+ 2. 特殊需求需与设计团队讨论
1240
471
 
1241
472
  ---
1242
473
 
1243
- ## 🔗 Related Resources
474
+ **Template Version**: 2.0.0 (Slimmed from 1266 lines to ~450 lines, -64%)
475
+ **Last Updated**: 2026-03-12
476
+ **Maintainer**: CC-DevFlow Team
477
+ **License**: MIT
1244
478
 
1245
- - **项目 Roadmap**: `devflow/ROADMAP.md`
1246
- - **UI 原型**: `devflow/requirements/{REQ_ID}/UI_PROTOTYPE.html`
1247
- - **组件实现**: `src/components/`
1248
- - **Tailwind Config**: `tailwind.config.js`
1249
-
1250
- ---
1251
-
1252
- ## 📄 License & Credits
1253
-
1254
- (如适用)
1255
-
1256
- - **设计系统**: {Project Name} Design System
1257
- - **设计师**: {Designer Name}
1258
- - **开发者**: {Developer Name}
1259
- - **灵感来源**: {Design References, e.g., Tailwind UI, Material Design}
1260
-
1261
- ---
1262
-
1263
- **最后更新**: {YYYY-MM-DD 北京时间}
1264
- **版本**: {Version}
1265
-
1266
- ---
479
+ **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md