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.
- package/.claude/commands/flow/CLAUDE.md +0 -4
- package/.claude/docs/examples/design-inspiration-pool.md +59 -0
- package/.claude/docs/examples/ui-prototype-constitution-checklist.md +75 -0
- package/.claude/docs/implementation-summary-v7.md +449 -0
- package/.claude/docs/spec-format-guide.md +349 -0
- package/.claude/docs/state-consolidation-design.md +323 -0
- package/.claude/docs/templates/ARCHITECTURE_TEMPLATE.md +85 -386
- package/.claude/docs/templates/DESIGN_TEMPLATE.md +157 -0
- package/.claude/docs/templates/PROPOSAL_TEMPLATE.md +91 -0
- package/.claude/docs/templates/SPEC_TEMPLATE_DELTA.md +139 -0
- package/.claude/docs/templates/SPEC_TEMPLATE_PROJECT.md +93 -0
- package/.claude/docs/templates/STYLE_TEMPLATE.md +114 -901
- package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +143 -1205
- package/.claude/hooks/inject-agent-context.ts +9 -9
- package/.claude/scripts/.claude/commands/flow/export-openspec.md +221 -0
- package/.claude/scripts/.claude/commands/flow/import-openspec.md +171 -0
- package/.claude/scripts/__tests__/openspec.test.js +212 -0
- package/.claude/scripts/delta-parser.ts +112 -2
- package/.claude/scripts/export-openspec.js +222 -0
- package/.claude/scripts/import-openspec.js +272 -0
- package/.claude/scripts/validate-scope.sh +200 -0
- package/.claude/skills/{workflow/flow-init → flow-init}/SKILL.md +25 -4
- package/.claude/skills/{workflow/flow-release → flow-release}/SKILL.md +14 -3
- package/.claude/skills/{workflow/flow-spec → flow-spec}/SKILL.md +30 -2
- package/.claude/skills/utility/npm-release/CLAUDE.md +55 -0
- package/.claude/skills/utility/npm-release/SKILL.md +111 -46
- package/.claude/skills/utility/npm-release/references/version-decision-guide.md +134 -0
- package/.claude/skills/utility/npm-release/scripts/atomic-version-bump.sh +95 -0
- package/.claude/skills/utility/npm-release/scripts/validate-version-sync.sh +82 -0
- package/.claude/skills/utility/npm-release/scripts/version-decision-tree.sh +44 -0
- package/.claude/tsc-cache/70d2fc6d-2936-429b-b529-429f1aae8c88/affected-repos.txt +1 -0
- package/.claude/tsc-cache/70d2fc6d-2936-429b-b529-429f1aae8c88/edited-files.log +2 -0
- package/CHANGELOG.md +40 -0
- package/README.md +2 -1
- package/README.zh-CN.md +2 -1
- package/docs/v4.3.0-migration-guide.md +276 -0
- package/lib/harness/CLAUDE.md +5 -4
- package/lib/harness/__tests__/planner.tdd.test.js +125 -0
- package/lib/harness/index.js +4 -2
- package/lib/harness/operations/dispatch.js +13 -0
- package/lib/harness/operations/plan.js +55 -1
- package/lib/harness/operations/release.js +87 -0
- package/lib/harness/operations/verify.js +14 -0
- package/lib/harness/planner.js +131 -0
- package/lib/harness/query.js +126 -0
- package/lib/harness/schemas.js +22 -1
- package/package.json +1 -1
- package/.claude/commands/flow/checklist.md +0 -18
- package/.claude/commands/flow/clarify.md +0 -18
- package/.claude/commands/flow/new.md +0 -23
- package/.claude/commands/flow/quality.md +0 -21
- package/.claude/docs/templates/EPIC_TEMPLATE.md +0 -805
- package/.claude/docs/templates/PRD_TEMPLATE.md +0 -562
- package/.claude/docs/templates/TASKS_TEMPLATE.md +0 -523
- package/.claude/docs/templates/TECH_DESIGN_TEMPLATE.md +0 -1019
- package/.claude/skills/workflow/CLAUDE.md +0 -24
- /package/.claude/skills/{domain/attention-refresh → attention-refresh}/SKILL.md +0 -0
- /package/.claude/skills/{domain/brainstorming → brainstorming}/SKILL.md +0 -0
- /package/.claude/skills/{guardrail/constitution-guardian → constitution-guardian}/SKILL.md +0 -0
- /package/.claude/skills/{utility/constitution-quick-ref → constitution-quick-ref}/SKILL.md +0 -0
- /package/.claude/skills/{domain/debugging → debugging}/SKILL.md +0 -0
- /package/.claude/skills/{utility/file-standards → file-standards}/SKILL.md +0 -0
- /package/.claude/skills/{domain/finishing-branch → finishing-branch}/SKILL.md +0 -0
- /package/.claude/skills/{workflow/flow-dev → flow-dev}/CLAUDE.md +0 -0
- /package/.claude/skills/{workflow/flow-dev → flow-dev}/SKILL.md +0 -0
- /package/.claude/skills/{workflow/flow-dev → flow-dev}/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +0 -0
- /package/.claude/skills/{workflow/flow-dev → flow-dev}/context.jsonl +0 -0
- /package/.claude/skills/{workflow/flow-dev → flow-dev}/dev-implementer.jsonl +0 -0
- /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/entry-gate.sh +0 -0
- /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/exit-gate.sh +0 -0
- /package/.claude/skills/{workflow/flow-dev → flow-dev}/scripts/task-orchestrator.sh +0 -0
- /package/.claude/skills/{workflow/flow-fix → flow-fix}/SKILL.md +0 -0
- /package/.claude/skills/{workflow/flow-fix → flow-fix}/context.jsonl +0 -0
- /package/.claude/skills/{workflow/flow-fix → flow-fix}/references/bug-analyzer.md +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/assets/BRAINSTORM_TEMPLATE.md +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/assets/INIT_FLOW_TEMPLATE.md +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/assets/RESEARCH_TEMPLATE.md +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/context.jsonl +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/references/flow-researcher.md +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/check-prerequisites.sh +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/consolidate-research.sh +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/create-requirement.sh +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/generate-research-tasks.sh +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/populate-research-tasks.sh +0 -0
- /package/.claude/skills/{workflow/flow-init → flow-init}/scripts/validate-research.sh +0 -0
- /package/.claude/skills/{workflow/flow-quality → flow-quality}/SKILL.md +0 -0
- /package/.claude/skills/{workflow/flow-quality → flow-quality}/context.jsonl +0 -0
- /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/code-quality-reviewer.md +0 -0
- /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/qa-tester.md +0 -0
- /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/security-reviewer.md +0 -0
- /package/.claude/skills/{workflow/flow-quality → flow-quality}/references/spec-reviewer.md +0 -0
- /package/.claude/skills/{workflow/flow-release → flow-release}/context.jsonl +0 -0
- /package/.claude/skills/{workflow/flow-release → flow-release}/references/release-manager.md +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/CLAUDE.md +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/context.jsonl +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/entry-gate.sh +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/exit-gate.sh +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/parallel-orchestrator.sh +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/team-communication.sh +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/team-init.sh +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/scripts/test-team-mode.sh +0 -0
- /package/.claude/skills/{workflow/flow-spec → flow-spec}/team-config.json +0 -0
- /package/.claude/skills/{workflow/flow-verify → flow-verify}/CLAUDE.md +0 -0
- /package/.claude/skills/{workflow/flow-verify → flow-verify}/SKILL.md +0 -0
- /package/.claude/skills/{workflow/flow-verify → flow-verify}/context.jsonl +0 -0
- /package/.claude/skills/{utility/fractal-docs → fractal-docs}/SKILL.md +0 -0
- /package/.claude/skills/{utility/journey-checker → journey-checker}/SKILL.md +0 -0
- /package/.claude/skills/{utility/journey-checker → journey-checker}/pressure-scenarios.md +0 -0
- /package/.claude/skills/{domain/receiving-review → receiving-review}/SKILL.md +0 -0
- /package/.claude/skills/{utility/skill-creator → skill-creator}/LICENSE.txt +0 -0
- /package/.claude/skills/{utility/skill-creator → skill-creator}/SKILL.md +0 -0
- /package/.claude/skills/{utility/skill-creator → skill-creator}/references/output-patterns.md +0 -0
- /package/.claude/skills/{utility/skill-creator → skill-creator}/references/workflows.md +0 -0
- /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/init_skill.py +0 -0
- /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/package_skill.py +0 -0
- /package/.claude/skills/{utility/skill-creator → skill-creator}/scripts/quick_validate.py +0 -0
- /package/.claude/skills/{domain/tdd → tdd}/SKILL.md +0 -0
- /package/.claude/skills/{guardrail/tdd-enforcer → tdd-enforcer}/SKILL.md +0 -0
- /package/.claude/skills/{domain/verification → verification}/SKILL.md +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: UI Prototype Template
|
|
3
3
|
description: Self-executable template for generating interactive HTML prototypes from PRD
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
created: 2025-01-10
|
|
6
|
-
updated:
|
|
6
|
+
updated: 2026-03-12
|
|
7
7
|
type: self-executable-template
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -50,38 +50,11 @@ type: self-executable-template
|
|
|
50
50
|
**输出**: 产品分析报告(嵌入HTML注释)
|
|
51
51
|
|
|
52
52
|
**执行步骤**:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- 目标用户画像(从"背景与目标"章节)
|
|
59
|
-
- 核心功能列表(从"用户故事"章节)
|
|
60
|
-
- 关键任务流程(从"验收标准"章节)
|
|
61
|
-
- UI相关的非功能需求(性能/可访问性/响应式)
|
|
62
|
-
|
|
63
|
-
1.3 识别页面类型:
|
|
64
|
-
- 认证页面(登录/注册/重置密码)
|
|
65
|
-
- 仪表盘/主界面
|
|
66
|
-
- 列表/表格页面
|
|
67
|
-
- 详情/编辑页面
|
|
68
|
-
- 表单/创建页面
|
|
69
|
-
- 设置/配置页面
|
|
70
|
-
|
|
71
|
-
1.4 构建信息架构草图:
|
|
72
|
-
页面层级
|
|
73
|
-
└─ 导航结构
|
|
74
|
-
└─ 核心交互路径
|
|
75
|
-
|
|
76
|
-
1.5 输出产品分析报告(存储为变量,稍后写入HTML注释):
|
|
77
|
-
"""
|
|
78
|
-
## Product Analysis
|
|
79
|
-
- Target Users: {用户画像}
|
|
80
|
-
- Core Features: {功能列表}
|
|
81
|
-
- Page Types: {页面类型}
|
|
82
|
-
- Critical Flows: {关键流程}
|
|
83
|
-
"""
|
|
84
|
-
```
|
|
53
|
+
1. 读取PRD.md文档
|
|
54
|
+
2. 提取关键信息: 用户画像、核心功能、任务流程、非功能需求
|
|
55
|
+
3. 识别页面类型: 认证/仪表盘/列表/详情/表单/设置
|
|
56
|
+
4. 构建信息架构草图
|
|
57
|
+
5. 输出产品分析报告
|
|
85
58
|
|
|
86
59
|
**验证点**:
|
|
87
60
|
- [x] 至少识别出3个核心功能
|
|
@@ -94,71 +67,19 @@ type: self-executable-template
|
|
|
94
67
|
|
|
95
68
|
**目标**: 从80+位艺术家/设计师/建筑师中随机采样2位,生成风格转译说明
|
|
96
69
|
|
|
97
|
-
**输入**: 灵感来源池(
|
|
70
|
+
**输入**: 灵感来源池(见 `.claude/docs/examples/design-inspiration-pool.md`)
|
|
98
71
|
**输出**: 设计灵感报告(2位大师+转译说明)
|
|
99
72
|
|
|
100
73
|
**执行步骤**:
|
|
101
|
-
|
|
102
|
-
2.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
2.2 为每位大师生成转译说明:
|
|
108
|
-
模板:
|
|
109
|
-
"""
|
|
110
|
-
**灵感来源X**: {艺术家姓名} ({类别})
|
|
111
|
-
**核心特质**: {艺术家代表性特点,1-2句话}
|
|
112
|
-
**网页转译**:
|
|
113
|
-
- 色彩: {具体色值} → {应用场景}
|
|
114
|
-
- 版式: {布局策略} → {CSS实现方式}
|
|
115
|
-
- 形态: {视觉元素} → {HTML/CSS实现}
|
|
116
|
-
- 动效: {动态特征} → {CSS/JS实现}
|
|
117
|
-
**禁止模仿**: 不复刻{具体作品名称}的{具体元素}
|
|
118
|
-
"""
|
|
119
|
-
|
|
120
|
-
2.3 生成设计关键词:
|
|
121
|
-
从转译说明中提取3-5个关键设计方向
|
|
122
|
-
示例: ["网格秩序", "高对比撞色", "曲线切割", "200ms过渡动效"]
|
|
123
|
-
|
|
124
|
-
2.4 定义配色方案基调:
|
|
125
|
-
根据灵感来源确定主色调
|
|
126
|
-
避免: #6B46C1(常见AI紫), #3B82F6(常见AI蓝)
|
|
127
|
-
推荐: 基于大师作品的特征色,但调整明度/饱和度
|
|
128
|
-
|
|
129
|
-
2.5 输出设计灵感报告(存储为变量):
|
|
130
|
-
包含2位大师的完整转译说明
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**灵感来源池** (80+ Masters):
|
|
134
|
-
|
|
135
|
-
#### 类别1: 影视片头 / 动态叙事
|
|
136
|
-
Saul Bass, Maurice Binder, Pablo Ferro, Dan Perri, Kyle Cooper
|
|
137
|
-
|
|
138
|
-
#### 类别2: 平面 / 字体 / 后现代图形
|
|
139
|
-
Paula Scher, Neville Brody, April Greiman, David Carson, Jamie Reid, Push Pin Studios (Seymour Chwast)
|
|
140
|
-
|
|
141
|
-
#### 类别3: 现代主义信息设计 / 网格系统
|
|
142
|
-
Massimo Vignelli, Josef Müller-Brockmann, Otl Aicher, Armin Hofmann, Karl Gerstner, Muriel Cooper
|
|
143
|
-
|
|
144
|
-
#### 类别4: 几何与抽象艺术 / 光学艺术
|
|
145
|
-
Piet Mondrian, Sonia Delaunay, Josef Albers, Victor Vasarely, Bridget Riley, M. C. Escher, Paul Klee, Kazimir Malevich, Joan Miró, Henri Matisse, Mark Rothko, René Magritte, Salvador Dalí
|
|
146
|
-
|
|
147
|
-
#### 类别5: 亚洲与当代艺术
|
|
148
|
-
Yayoi Kusama, Takashi Murakami, Katsushika Hokusai(葛饰北斋), Xu Bing(徐冰), Zao Wou-Ki(赵无极)
|
|
149
|
-
|
|
150
|
-
#### 类别6: 生成艺术 / 新媒体
|
|
151
|
-
John Maeda, Casey Reas, Zach Lieberman, Vera Molnár, Manfred Mohr, Refik Anadol, Sougwen Chung
|
|
152
|
-
|
|
153
|
-
#### 类别7: 建筑 / 空间形态
|
|
154
|
-
Zaha Hadid, Bjarke Ingels (BIG), Thomas Heatherwick, Olafur Eliasson, Le Corbusier, Ludwig Mies van der Rohe, Frank Lloyd Wright, Alvar Aalto, Louis Kahn, Norman Foster, Renzo Piano, Herzog & de Meuron, OMA/Rem Koolhaas, Tadao Ando(安藤忠雄), SANAA(Sejima & Nishizawa), Kengo Kuma(隈研吾), Kenzo Tange(丹下健三), Lina Bo Bardi, Luis Barragán
|
|
155
|
-
|
|
156
|
-
#### 类别8: 工业 / 硬件设备设计
|
|
157
|
-
Dieter Rams(Braun), Jony Ive(Apple), Naoto Fukasawa(无印良品), Jasper Morrison, Marc Newson, Yves Béhar, Hartmut Esslinger(frog), Raymond Loewy, Richard Sapper(ThinkPad), Charles & Ray Eames, Sori Yanagi, Kenji Ekuan(龟甲万壶/新干线), Nendo(Oki Sato), Philippe Starck, F. A. Porsche, James Dyson, Teenage Engineering, Susan Kare(界面图标语义)
|
|
74
|
+
1. 随机采样策略: 从不同类别选择,避免风格过于相似
|
|
75
|
+
2. 为每位大师生成转译说明(色彩/版式/形态/动效)
|
|
76
|
+
3. 生成设计关键词(3-5个)
|
|
77
|
+
4. 定义配色方案基调(避免常见AI紫/蓝)
|
|
78
|
+
5. 输出设计灵感报告
|
|
158
79
|
|
|
159
80
|
**验证点**:
|
|
160
81
|
- [x] 采样了2位来自不同类别的大师
|
|
161
|
-
- [x] 每位大师都有明确的转译说明
|
|
82
|
+
- [x] 每位大师都有明确的转译说明
|
|
162
83
|
- [x] 明确了禁止模仿的具体作品/元素
|
|
163
84
|
- [x] 生成了配色方案基调(非常见AI紫/蓝)
|
|
164
85
|
|
|
@@ -166,349 +87,97 @@ Dieter Rams(Braun), Jony Ive(Apple), Naoto Fukasawa(无印良品), Jasper Morris
|
|
|
166
87
|
|
|
167
88
|
### Phase 3: Design System Definition (设计系统定义)
|
|
168
89
|
|
|
169
|
-
**目标**: 基于设计灵感,定义完整的设计系统
|
|
90
|
+
**目标**: 基于设计灵感,定义完整的设计系统
|
|
170
91
|
|
|
171
92
|
**输入**: Phase 2的设计灵感报告
|
|
172
93
|
**输出**: Design Tokens (CSS变量形式)
|
|
173
94
|
|
|
174
95
|
**执行步骤**:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
示例:
|
|
185
|
-
--primary-500: #0066CC;
|
|
186
|
-
--primary-600: #0052A3;
|
|
187
|
-
--primary-400: #3385D6;
|
|
188
|
-
|
|
189
|
-
⚠️ 禁止使用:
|
|
190
|
-
- 纯黑 #000000
|
|
191
|
-
- 纯白 #FFFFFF
|
|
192
|
-
- 常见AI紫 #6B46C1
|
|
193
|
-
- 常见AI蓝 #3B82F6
|
|
194
|
-
|
|
195
|
-
3.2 字体系统 (Typography):
|
|
196
|
-
- 字体栈: 优先Google Fonts,备用系统字体
|
|
197
|
-
- 中英文混排: 英文字体 + 中文备用(思源黑体/苹方)
|
|
198
|
-
- 字号系统: 6-8级 (12/14/16/18/20/24/32/48px)
|
|
199
|
-
- 字重: 400 Regular, 500 Medium, 600 Semi-Bold, 700 Bold
|
|
200
|
-
- 行高: 标题1.2-1.3, 正文1.5-1.6, 小字1.4
|
|
201
|
-
|
|
202
|
-
示例:
|
|
203
|
-
--font-base: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
|
|
204
|
-
--font-size-base: 16px;
|
|
205
|
-
--font-size-lg: 18px;
|
|
206
|
-
--line-height-base: 1.5;
|
|
207
|
-
|
|
208
|
-
3.3 间距系统 (Spacing):
|
|
209
|
-
基于8px栅格或4px栅格
|
|
210
|
-
- 基础单位: 4px或8px
|
|
211
|
-
- 间距级别: 1/2/3/4/6/8/12/16/24/32/48/64
|
|
212
|
-
|
|
213
|
-
示例:
|
|
214
|
-
--space-1: 0.25rem; /* 4px */
|
|
215
|
-
--space-2: 0.5rem; /* 8px */
|
|
216
|
-
--space-4: 1rem; /* 16px */
|
|
217
|
-
--space-8: 2rem; /* 32px */
|
|
218
|
-
|
|
219
|
-
3.4 栅格系统 (Grid):
|
|
220
|
-
- 容器最大宽度: 1200px或1280px
|
|
221
|
-
- 列数: 12列
|
|
222
|
-
- 间距: 16px或24px
|
|
223
|
-
- 响应式断点:
|
|
224
|
-
* Mobile: 320px-767px
|
|
225
|
-
* Tablet: 768px-1023px
|
|
226
|
-
* Desktop: 1024px+
|
|
227
|
-
|
|
228
|
-
3.5 圆角与阴影 (Border Radius & Shadow):
|
|
229
|
-
- 圆角: 4px/8px/12px/16px/9999px(圆形)
|
|
230
|
-
- 阴影层级: 3-4级(小/中/大/超大)
|
|
231
|
-
|
|
232
|
-
示例:
|
|
233
|
-
--radius-sm: 4px;
|
|
234
|
-
--radius-md: 8px;
|
|
235
|
-
--shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
|
|
236
|
-
--shadow-md: 0 4px 6px rgba(0,0,0,0.1);
|
|
237
|
-
|
|
238
|
-
3.6 动效系统 (Animation):
|
|
239
|
-
- 过渡时长: 150ms/200ms/300ms
|
|
240
|
-
- 缓动函数: ease/ease-in-out/cubic-bezier
|
|
241
|
-
- 支持 prefers-reduced-motion 静态回退
|
|
242
|
-
|
|
243
|
-
示例:
|
|
244
|
-
--transition-fast: 150ms ease;
|
|
245
|
-
--transition-base: 200ms ease;
|
|
246
|
-
--easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
|
|
247
|
-
|
|
248
|
-
3.7 输出Design Tokens:
|
|
249
|
-
将上述系统整理为CSS :root 变量
|
|
250
|
-
准备稍后嵌入HTML <style> 标签
|
|
251
|
-
```
|
|
96
|
+
1. 色彩系统: 主色/辅色/中性色/状态色/表面色(禁止纯黑/纯白/常见AI紫蓝)
|
|
97
|
+
2. 字体系统: 字体栈/字号/字重/行高
|
|
98
|
+
3. 间距系统: 基于8px或4px栅格
|
|
99
|
+
4. 栅格系统: 12列/响应式断点
|
|
100
|
+
5. 圆角系统: 4-6级
|
|
101
|
+
6. 阴影系统: 3-5级
|
|
102
|
+
7. 过渡动效: 时长/缓动函数
|
|
103
|
+
8. 输出完整Design Tokens
|
|
252
104
|
|
|
253
105
|
**验证点**:
|
|
254
|
-
- [x]
|
|
255
|
-
- [x]
|
|
256
|
-
- [x]
|
|
257
|
-
- [x]
|
|
258
|
-
- [x] 动效支持无障碍(prefers-reduced-motion)
|
|
106
|
+
- [x] 色彩系统完整(至少5个主色变体+7个中性色)
|
|
107
|
+
- [x] 字体系统完整(字体栈+字阶)
|
|
108
|
+
- [x] 间距/栅格/圆角/阴影系统完整
|
|
109
|
+
- [x] 所有Token使用CSS变量格式
|
|
259
110
|
|
|
260
111
|
---
|
|
261
112
|
|
|
262
113
|
### Phase 4: Information Architecture (信息架构设计)
|
|
263
114
|
|
|
264
|
-
**目标**:
|
|
115
|
+
**目标**: 设计页面层级、导航结构和用户流程
|
|
265
116
|
|
|
266
117
|
**输入**: Phase 1的产品分析报告
|
|
267
|
-
**输出**: 站点地图 +
|
|
118
|
+
**输出**: 站点地图(Sitemap) + 用户流程图
|
|
268
119
|
|
|
269
120
|
**执行步骤**:
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
/ (首页/仪表盘)
|
|
276
|
-
/auth/login (登录)
|
|
277
|
-
/auth/register (注册)
|
|
278
|
-
/orders (订单列表)
|
|
279
|
-
/orders/:id (订单详情)
|
|
280
|
-
/orders/create (创建订单)
|
|
281
|
-
/profile (用户资料)
|
|
282
|
-
/settings (设置)
|
|
283
|
-
|
|
284
|
-
4.2 导航结构:
|
|
285
|
-
- 主导航 (Primary Nav): 顶部导航栏,3-7个主菜单
|
|
286
|
-
- 次级导航 (Secondary Nav): 侧边栏或标签页
|
|
287
|
-
- 面包屑 (Breadcrumb): 用于深层页面
|
|
288
|
-
|
|
289
|
-
示例:
|
|
290
|
-
主导航:
|
|
291
|
-
- 首页
|
|
292
|
-
- 订单管理
|
|
293
|
-
- 数据报表
|
|
294
|
-
- 系统设置
|
|
295
|
-
|
|
296
|
-
4.3 用户流程图:
|
|
297
|
-
为每个核心用户故事绘制流程:
|
|
298
|
-
|
|
299
|
-
示例:
|
|
300
|
-
创建订单流程:
|
|
301
|
-
订单列表页 → 点击"新建" → 填写表单 → 预览确认 → 提交成功 → 跳转详情
|
|
302
|
-
|
|
303
|
-
4.4 页面优先级:
|
|
304
|
-
- P0: 必须实现的核心页面(登录/主界面/核心功能)
|
|
305
|
-
- P1: 重要但非关键的页面
|
|
306
|
-
- P2: 辅助功能页面
|
|
307
|
-
|
|
308
|
-
4.5 输出站点地图文档:
|
|
309
|
-
存储为变量,稍后嵌入HTML注释
|
|
310
|
-
```
|
|
121
|
+
1. 页面层级设计: 一级/二级/三级页面
|
|
122
|
+
2. 导航结构设计: 主导航/侧边栏/面包屑
|
|
123
|
+
3. 用户流程设计: 关键任务路径
|
|
124
|
+
4. 页面间跳转逻辑
|
|
125
|
+
5. 输出站点地图
|
|
311
126
|
|
|
312
127
|
**验证点**:
|
|
313
|
-
- [x]
|
|
314
|
-
- [x]
|
|
315
|
-
- [x]
|
|
128
|
+
- [x] 所有PRD用户故事都有对应页面
|
|
129
|
+
- [x] 导航结构清晰
|
|
130
|
+
- [x] 关键流程完整
|
|
316
131
|
|
|
317
132
|
---
|
|
318
133
|
|
|
319
134
|
### Phase 5: Component Inventory (组件清单生成)
|
|
320
135
|
|
|
321
|
-
**目标**:
|
|
136
|
+
**目标**: 列出所有需要的UI组件
|
|
322
137
|
|
|
323
138
|
**输入**: Phase 4的站点地图
|
|
324
|
-
**输出**: 组件清单
|
|
139
|
+
**输出**: 组件清单(按类别分组)
|
|
325
140
|
|
|
326
141
|
**执行步骤**:
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
- Icon (图标): 使用Lucide或Heroicons
|
|
336
|
-
|
|
337
|
-
5.2 组合组件 (Molecules):
|
|
338
|
-
- Form Field (表单字段): Label + Input + Error Message
|
|
339
|
-
- Search Bar (搜索栏): Input + Icon + Button
|
|
340
|
-
- Card (卡片): Header + Body + Footer
|
|
341
|
-
- List Item (列表项): Avatar + Title + Subtitle + Action
|
|
342
|
-
- Pagination (分页器)
|
|
343
|
-
- Breadcrumb (面包屑)
|
|
344
|
-
|
|
345
|
-
5.3 复杂组件 (Organisms):
|
|
346
|
-
- Navigation Bar (导航栏): Logo + Menu + User Avatar
|
|
347
|
-
- Sidebar (侧边栏): Menu + Collapse
|
|
348
|
-
- Table (表格): Header + Rows + Pagination + Actions
|
|
349
|
-
- Modal (模态框): Overlay + Content + Close
|
|
350
|
-
- Toast (通知提示)
|
|
351
|
-
- Dropdown Menu (下拉菜单)
|
|
352
|
-
|
|
353
|
-
5.4 状态定义 (States):
|
|
354
|
-
为每个交互组件定义状态:
|
|
355
|
-
- Default (默认)
|
|
356
|
-
- Hover (悬停)
|
|
357
|
-
- Active (激活)
|
|
358
|
-
- Focus (聚焦)
|
|
359
|
-
- Disabled (禁用)
|
|
360
|
-
- Error (错误)
|
|
361
|
-
- Loading (加载中)
|
|
362
|
-
- Empty (空状态)
|
|
363
|
-
|
|
364
|
-
5.5 输出组件清单:
|
|
365
|
-
组织为表格形式,包含:
|
|
366
|
-
组件名称 | 类型 | 状态列表 | 使用页面
|
|
367
|
-
|
|
368
|
-
示例:
|
|
369
|
-
| Button | Atom | default, hover, active, disabled | 所有页面 |
|
|
370
|
-
| Modal | Organism | default, open, closing | 订单创建,设置 |
|
|
371
|
-
|
|
372
|
-
5.6 确定图标库:
|
|
373
|
-
选择 Lucide Icons 或 Heroicons 或 Tabler Icons
|
|
374
|
-
记录CDN链接,稍后嵌入HTML
|
|
375
|
-
```
|
|
142
|
+
1. 基础组件: Button/Input/Select/Checkbox/Radio/Switch
|
|
143
|
+
2. 布局组件: Container/Grid/Stack/Divider
|
|
144
|
+
3. 导航组件: Navbar/Sidebar/Breadcrumb/Tabs/Pagination
|
|
145
|
+
4. 数据展示: Table/Card/List/Badge/Tag/Avatar
|
|
146
|
+
5. 反馈组件: Alert/Toast/Modal/Tooltip/Progress/Spinner
|
|
147
|
+
6. 表单组件: Form/FormField/FormError/FormHelp
|
|
148
|
+
7. 业务组件: 根据PRD定义的特定组件
|
|
149
|
+
8. 输出组件清单
|
|
376
150
|
|
|
377
151
|
**验证点**:
|
|
378
|
-
- [x]
|
|
379
|
-
- [x]
|
|
380
|
-
- [x]
|
|
381
|
-
- [x] 组件清单与PRD用户故事对齐
|
|
152
|
+
- [x] 组件清单完整
|
|
153
|
+
- [x] 每个组件有明确的用途说明
|
|
154
|
+
- [x] 组件按类别分组
|
|
382
155
|
|
|
383
156
|
---
|
|
384
157
|
|
|
385
158
|
### Phase 6: HTML Structure (HTML结构编写)
|
|
386
159
|
|
|
387
|
-
**目标**:
|
|
160
|
+
**目标**: 编写完整的HTML结构
|
|
388
161
|
|
|
389
162
|
**输入**: Phase 4的站点地图 + Phase 5的组件清单
|
|
390
|
-
**输出**:
|
|
163
|
+
**输出**: HTML结构(嵌入<body>标签)
|
|
391
164
|
|
|
392
165
|
**执行步骤**:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
<!-- 设计系统元数据 (来自Phase 1/2/3) -->
|
|
404
|
-
<!--
|
|
405
|
-
Generated: {ISO 8601 timestamp}
|
|
406
|
-
REQ-ID: {REQ_ID}
|
|
407
|
-
Design Inspirations: {Phase 2输出}
|
|
408
|
-
Product Analysis: {Phase 1输出}
|
|
409
|
-
-->
|
|
410
|
-
|
|
411
|
-
<!-- CDN资源: Google Fonts + 图标库 -->
|
|
412
|
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
413
|
-
<script src="https://unpkg.com/lucide@latest"></script>
|
|
414
|
-
|
|
415
|
-
<style>
|
|
416
|
-
/* Phase 7 将在这里填充CSS */
|
|
417
|
-
</style>
|
|
418
|
-
</head>
|
|
419
|
-
<body>
|
|
420
|
-
<!-- Phase 6 将在这里填充HTML -->
|
|
421
|
-
</body>
|
|
422
|
-
</html>
|
|
423
|
-
|
|
424
|
-
6.2 语义化标签:
|
|
425
|
-
使用HTML5语义标签:
|
|
426
|
-
- <header> - 页面头部/导航
|
|
427
|
-
- <nav> - 导航菜单
|
|
428
|
-
- <main> - 主要内容区
|
|
429
|
-
- <section> - 内容分段
|
|
430
|
-
- <article> - 独立内容单元
|
|
431
|
-
- <aside> - 侧边栏/辅助信息
|
|
432
|
-
- <footer> - 页面底部
|
|
433
|
-
|
|
434
|
-
6.3 可访问性 (Accessibility):
|
|
435
|
-
- ARIA标签: aria-label, aria-labelledby, aria-describedby
|
|
436
|
-
- 键盘导航: tabindex属性
|
|
437
|
-
- 语义化按钮: <button> 而非 <div onclick>
|
|
438
|
-
- 表单标签: <label for="input-id">
|
|
439
|
-
|
|
440
|
-
6.4 多页面处理策略:
|
|
441
|
-
选项A: 单页应用(SPA)风格
|
|
442
|
-
- 所有页面作为<section>嵌入同一HTML
|
|
443
|
-
- 使用CSS显示/隐藏切换页面 (.page-active)
|
|
444
|
-
- JavaScript路由模拟
|
|
445
|
-
|
|
446
|
-
选项B: 选择1个核心页面深度实现
|
|
447
|
-
- 如果页面过多(>5个),选择最重要的1个页面
|
|
448
|
-
- 其他页面用简化卡片展示
|
|
449
|
-
|
|
450
|
-
推荐: 选项A (SPA风格)
|
|
451
|
-
|
|
452
|
-
6.5 页面结构示例:
|
|
453
|
-
<body>
|
|
454
|
-
<!-- Global Header -->
|
|
455
|
-
<header class="header">
|
|
456
|
-
<nav class="nav-primary">
|
|
457
|
-
<div class="nav-logo">{Logo}</div>
|
|
458
|
-
<ul class="nav-menu">
|
|
459
|
-
<li><a href="#home">首页</a></li>
|
|
460
|
-
<li><a href="#orders">订单</a></li>
|
|
461
|
-
</ul>
|
|
462
|
-
<div class="nav-user">{User Avatar}</div>
|
|
463
|
-
</nav>
|
|
464
|
-
</header>
|
|
465
|
-
|
|
466
|
-
<!-- Main Content Area -->
|
|
467
|
-
<main class="main">
|
|
468
|
-
<!-- Page 1: Dashboard -->
|
|
469
|
-
<section id="page-dashboard" class="page page-active">
|
|
470
|
-
<h1>仪表盘</h1>
|
|
471
|
-
<!-- Dashboard content -->
|
|
472
|
-
</section>
|
|
473
|
-
|
|
474
|
-
<!-- Page 2: Orders List -->
|
|
475
|
-
<section id="page-orders" class="page">
|
|
476
|
-
<h1>订单列表</h1>
|
|
477
|
-
<div class="table-container">
|
|
478
|
-
<table><!-- Table rows --></table>
|
|
479
|
-
</div>
|
|
480
|
-
</section>
|
|
481
|
-
|
|
482
|
-
<!-- More pages... -->
|
|
483
|
-
</main>
|
|
484
|
-
|
|
485
|
-
<!-- Global Footer -->
|
|
486
|
-
<footer class="footer">
|
|
487
|
-
<p>© 2025 {Project Name}</p>
|
|
488
|
-
</footer>
|
|
489
|
-
|
|
490
|
-
<script>
|
|
491
|
-
/* Phase 8 将在这里填充JavaScript */
|
|
492
|
-
</script>
|
|
493
|
-
</body>
|
|
494
|
-
|
|
495
|
-
6.6 内容填充:
|
|
496
|
-
- 使用真实的业务场景内容(来自PRD)
|
|
497
|
-
- 图片使用Picsum: https://picsum.photos/id/{id}/{width}/{height}
|
|
498
|
-
- 数据使用模拟真实数据(如订单编号/用户名/日期)
|
|
499
|
-
- 禁止使用Lorem Ipsum占位文本
|
|
500
|
-
|
|
501
|
-
6.7 组件实例化:
|
|
502
|
-
根据Phase 5的组件清单,在HTML中实例化所有组件
|
|
503
|
-
确保每个状态都有对应的HTML示例(可用CSS类名切换)
|
|
504
|
-
```
|
|
166
|
+
1. HTML5文档结构: <!DOCTYPE html> + <html lang="zh-CN">
|
|
167
|
+
2. <head>元数据: charset/viewport/title/meta
|
|
168
|
+
3. 设计系统元数据(HTML注释): Phase 1/2/3输出
|
|
169
|
+
4. <style>占位符(Phase 7填充)
|
|
170
|
+
5. <body>结构: 根据站点地图实例化所有页面
|
|
171
|
+
6. <script>占位符(Phase 8填充)
|
|
172
|
+
7. 使用语义化标签: <header>/<nav>/<main>/<section>/<article>/<aside>/<footer>
|
|
173
|
+
8. ARIA标签: role/aria-label/aria-labelledby/aria-describedby
|
|
174
|
+
9. 输出完整HTML结构
|
|
505
175
|
|
|
506
176
|
**验证点**:
|
|
507
|
-
- [x]
|
|
508
|
-
- [x]
|
|
509
|
-
- [x]
|
|
510
|
-
- [x]
|
|
511
|
-
- [x] 至少2个完整页面被实现
|
|
177
|
+
- [x] HTML5语义化标签
|
|
178
|
+
- [x] ARIA标签完整
|
|
179
|
+
- [x] 所有页面都已实例化
|
|
180
|
+
- [x] 设计系统元数据已嵌入注释
|
|
512
181
|
|
|
513
182
|
---
|
|
514
183
|
|
|
@@ -520,822 +189,114 @@ Dieter Rams(Braun), Jony Ive(Apple), Naoto Fukasawa(无印良品), Jasper Morris
|
|
|
520
189
|
**输出**: 完整的CSS样式(嵌入<style>标签)
|
|
521
190
|
|
|
522
191
|
**执行步骤**:
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
8. Animations (动效)
|
|
534
|
-
9. Dark Mode (可选)
|
|
535
|
-
|
|
536
|
-
7.2 Design System (CSS Variables):
|
|
537
|
-
将Phase 3的Design Tokens写入:root
|
|
538
|
-
|
|
539
|
-
:root {
|
|
540
|
-
/* Colors */
|
|
541
|
-
--primary-500: #0066CC;
|
|
542
|
-
--neutral-50: #F9FAFB;
|
|
543
|
-
|
|
544
|
-
/* Typography */
|
|
545
|
-
--font-base: 'Inter', system-ui, sans-serif;
|
|
546
|
-
--font-size-base: 16px;
|
|
547
|
-
|
|
548
|
-
/* Spacing */
|
|
549
|
-
--space-2: 0.5rem;
|
|
550
|
-
--space-4: 1rem;
|
|
551
|
-
|
|
552
|
-
/* Transitions */
|
|
553
|
-
--transition-fast: 200ms ease;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
7.3 Reset & Base Styles:
|
|
557
|
-
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
558
|
-
body {
|
|
559
|
-
font-family: var(--font-base);
|
|
560
|
-
font-size: var(--font-size-base);
|
|
561
|
-
line-height: 1.5;
|
|
562
|
-
color: var(--neutral-900);
|
|
563
|
-
background: var(--neutral-50);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
7.4 Layout System:
|
|
567
|
-
使用Flexbox或Grid实现响应式布局
|
|
568
|
-
|
|
569
|
-
.container {
|
|
570
|
-
max-width: 1200px;
|
|
571
|
-
margin: 0 auto;
|
|
572
|
-
padding: 0 var(--space-4);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
.grid {
|
|
576
|
-
display: grid;
|
|
577
|
-
grid-template-columns: repeat(12, 1fr);
|
|
578
|
-
gap: var(--space-4);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
7.5 Component Styles:
|
|
582
|
-
为Phase 5的每个组件编写样式,包含所有状态
|
|
583
|
-
|
|
584
|
-
示例:
|
|
585
|
-
.btn {
|
|
586
|
-
display: inline-flex;
|
|
587
|
-
padding: var(--space-2) var(--space-4);
|
|
588
|
-
border: none;
|
|
589
|
-
border-radius: var(--radius-md);
|
|
590
|
-
background: var(--primary-500);
|
|
591
|
-
color: white;
|
|
592
|
-
cursor: pointer;
|
|
593
|
-
transition: all var(--transition-fast);
|
|
594
|
-
}
|
|
595
|
-
.btn:hover {
|
|
596
|
-
background: var(--primary-600);
|
|
597
|
-
transform: translateY(-2px);
|
|
598
|
-
}
|
|
599
|
-
.btn:active {
|
|
600
|
-
transform: translateY(0);
|
|
601
|
-
}
|
|
602
|
-
.btn:disabled {
|
|
603
|
-
opacity: 0.5;
|
|
604
|
-
cursor: not-allowed;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
7.6 Page-Specific Styles:
|
|
608
|
-
为每个页面编写特定样式
|
|
609
|
-
|
|
610
|
-
.page {
|
|
611
|
-
display: none; /* 默认隐藏 */
|
|
612
|
-
}
|
|
613
|
-
.page-active {
|
|
614
|
-
display: block; /* 激活页面显示 */
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
7.7 Responsive Design:
|
|
618
|
-
使用媒体查询实现三断点响应式
|
|
619
|
-
|
|
620
|
-
/* Mobile: 320px-767px (默认) */
|
|
621
|
-
.nav-menu {
|
|
622
|
-
flex-direction: column;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/* Tablet: 768px-1023px */
|
|
626
|
-
@media (min-width: 768px) {
|
|
627
|
-
.nav-menu {
|
|
628
|
-
flex-direction: row;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/* Desktop: 1024px+ */
|
|
633
|
-
@media (min-width: 1024px) {
|
|
634
|
-
.container {
|
|
635
|
-
max-width: 1200px;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
7.8 Animations:
|
|
640
|
-
基于Phase 2的设计灵感添加动效
|
|
641
|
-
|
|
642
|
-
@keyframes fadeIn {
|
|
643
|
-
from { opacity: 0; transform: translateY(20px); }
|
|
644
|
-
to { opacity: 1; transform: translateY(0); }
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
.card {
|
|
648
|
-
animation: fadeIn var(--transition-base);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/* 无障碍: 禁用动效 */
|
|
652
|
-
@media (prefers-reduced-motion: reduce) {
|
|
653
|
-
* {
|
|
654
|
-
animation: none !important;
|
|
655
|
-
transition: none !important;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
7.9 Dark Mode (可选):
|
|
660
|
-
@media (prefers-color-scheme: dark) {
|
|
661
|
-
:root {
|
|
662
|
-
--neutral-50: #111827;
|
|
663
|
-
--neutral-900: #F9FAFB;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
7.10 Utilities:
|
|
668
|
-
.text-center { text-align: center; }
|
|
669
|
-
.mt-4 { margin-top: var(--space-4); }
|
|
670
|
-
.hidden { display: none; }
|
|
671
|
-
```
|
|
192
|
+
1. CSS架构: Design System/Reset/Layout/Components/Pages/Utilities/Responsive/Animations
|
|
193
|
+
2. Design System (CSS Variables): 将Phase 3的Design Tokens写入:root
|
|
194
|
+
3. Reset & Base Styles
|
|
195
|
+
4. Layout System: Flexbox/Grid
|
|
196
|
+
5. Component Styles: 为Phase 5的每个组件编写样式,包含所有状态(hover/active/disabled/error)
|
|
197
|
+
6. Page-Specific Styles
|
|
198
|
+
7. Responsive Design: 三断点媒体查询(320px/768px/1024px)
|
|
199
|
+
8. Animations: 基于Phase 2的设计灵感
|
|
200
|
+
9. Dark Mode (可选)
|
|
201
|
+
10. 输出完整CSS
|
|
672
202
|
|
|
673
203
|
**验证点**:
|
|
674
|
-
- [x]
|
|
675
|
-
- [x]
|
|
676
|
-
- [x]
|
|
677
|
-
- [x]
|
|
678
|
-
- [x] 支持prefers-reduced-motion
|
|
204
|
+
- [x] Design Tokens已转换为CSS变量
|
|
205
|
+
- [x] 所有组件有完整状态样式
|
|
206
|
+
- [x] 响应式布局正常
|
|
207
|
+
- [x] 动效符合设计灵感
|
|
679
208
|
|
|
680
209
|
---
|
|
681
210
|
|
|
682
211
|
### Phase 8: JavaScript Interactions (JavaScript交互实现)
|
|
683
212
|
|
|
684
|
-
**目标**:
|
|
213
|
+
**目标**: 实现所有交互逻辑
|
|
685
214
|
|
|
686
|
-
**输入**: Phase 6的HTML结构
|
|
215
|
+
**输入**: Phase 6的HTML结构
|
|
687
216
|
**输出**: 完整的JavaScript代码(嵌入<script>标签)
|
|
688
217
|
|
|
689
218
|
**执行步骤**:
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
initEventListeners();
|
|
701
|
-
});
|
|
702
|
-
|
|
703
|
-
8.2 SPA路由系统:
|
|
704
|
-
const routes = {
|
|
705
|
-
'home': 'page-dashboard',
|
|
706
|
-
'orders': 'page-orders',
|
|
707
|
-
'settings': 'page-settings'
|
|
708
|
-
};
|
|
709
|
-
|
|
710
|
-
function navigateTo(routeName) {
|
|
711
|
-
// 隐藏所有页面
|
|
712
|
-
document.querySelectorAll('.page').forEach(page => {
|
|
713
|
-
page.classList.remove('page-active');
|
|
714
|
-
});
|
|
715
|
-
|
|
716
|
-
// 显示目标页面
|
|
717
|
-
const targetPageId = routes[routeName];
|
|
718
|
-
document.getElementById(targetPageId).classList.add('page-active');
|
|
719
|
-
|
|
720
|
-
// 更新URL (使用hash)
|
|
721
|
-
window.location.hash = routeName;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
function initRouter() {
|
|
725
|
-
// 监听hash变化
|
|
726
|
-
window.addEventListener('hashchange', () => {
|
|
727
|
-
const route = window.location.hash.slice(1) || 'home';
|
|
728
|
-
navigateTo(route);
|
|
729
|
-
});
|
|
730
|
-
|
|
731
|
-
// 初始化路由
|
|
732
|
-
const initialRoute = window.location.hash.slice(1) || 'home';
|
|
733
|
-
navigateTo(initialRoute);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
8.3 导航交互:
|
|
737
|
-
document.querySelectorAll('.nav-menu a').forEach(link => {
|
|
738
|
-
link.addEventListener('click', (e) => {
|
|
739
|
-
e.preventDefault();
|
|
740
|
-
const route = link.getAttribute('href').slice(1);
|
|
741
|
-
navigateTo(route);
|
|
742
|
-
|
|
743
|
-
// 更新活动状态
|
|
744
|
-
document.querySelectorAll('.nav-menu a').forEach(a => {
|
|
745
|
-
a.classList.remove('active');
|
|
746
|
-
});
|
|
747
|
-
link.classList.add('active');
|
|
748
|
-
});
|
|
749
|
-
});
|
|
750
|
-
|
|
751
|
-
8.4 表单验证:
|
|
752
|
-
document.querySelectorAll('form').forEach(form => {
|
|
753
|
-
form.addEventListener('submit', (e) => {
|
|
754
|
-
e.preventDefault();
|
|
755
|
-
|
|
756
|
-
// 简单验证示例
|
|
757
|
-
const inputs = form.querySelectorAll('input[required]');
|
|
758
|
-
let isValid = true;
|
|
759
|
-
|
|
760
|
-
inputs.forEach(input => {
|
|
761
|
-
if (!input.value.trim()) {
|
|
762
|
-
input.classList.add('error');
|
|
763
|
-
isValid = false;
|
|
764
|
-
} else {
|
|
765
|
-
input.classList.remove('error');
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
|
|
769
|
-
if (isValid) {
|
|
770
|
-
showToast('提交成功!', 'success');
|
|
771
|
-
form.reset();
|
|
772
|
-
} else {
|
|
773
|
-
showToast('请填写所有必填字段', 'error');
|
|
774
|
-
}
|
|
775
|
-
});
|
|
776
|
-
});
|
|
777
|
-
|
|
778
|
-
8.5 模态框 (Modal):
|
|
779
|
-
function openModal(modalId) {
|
|
780
|
-
const modal = document.getElementById(modalId);
|
|
781
|
-
modal.classList.add('modal-open');
|
|
782
|
-
document.body.style.overflow = 'hidden';
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
function closeModal(modalId) {
|
|
786
|
-
const modal = document.getElementById(modalId);
|
|
787
|
-
modal.classList.remove('modal-open');
|
|
788
|
-
document.body.style.overflow = '';
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
// 点击遮罩关闭
|
|
792
|
-
document.querySelectorAll('.modal-overlay').forEach(overlay => {
|
|
793
|
-
overlay.addEventListener('click', (e) => {
|
|
794
|
-
if (e.target === overlay) {
|
|
795
|
-
closeModal(overlay.closest('.modal').id);
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
|
-
});
|
|
799
|
-
|
|
800
|
-
8.6 Toast 通知:
|
|
801
|
-
function showToast(message, type = 'info') {
|
|
802
|
-
const toast = document.createElement('div');
|
|
803
|
-
toast.className = `toast toast-${type}`;
|
|
804
|
-
toast.textContent = message;
|
|
805
|
-
document.body.appendChild(toast);
|
|
806
|
-
|
|
807
|
-
// 动画显示
|
|
808
|
-
setTimeout(() => toast.classList.add('toast-show'), 10);
|
|
809
|
-
|
|
810
|
-
// 3秒后移除
|
|
811
|
-
setTimeout(() => {
|
|
812
|
-
toast.classList.remove('toast-show');
|
|
813
|
-
setTimeout(() => toast.remove(), 300);
|
|
814
|
-
}, 3000);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
8.7 表格排序 (Table Sorting):
|
|
818
|
-
document.querySelectorAll('.table-sortable th').forEach(th => {
|
|
819
|
-
th.addEventListener('click', () => {
|
|
820
|
-
const table = th.closest('table');
|
|
821
|
-
const columnIndex = Array.from(th.parentNode.children).indexOf(th);
|
|
822
|
-
const rows = Array.from(table.querySelectorAll('tbody tr'));
|
|
823
|
-
|
|
824
|
-
rows.sort((a, b) => {
|
|
825
|
-
const aText = a.children[columnIndex].textContent;
|
|
826
|
-
const bText = b.children[columnIndex].textContent;
|
|
827
|
-
return aText.localeCompare(bText);
|
|
828
|
-
});
|
|
829
|
-
|
|
830
|
-
// 重新插入排序后的行
|
|
831
|
-
rows.forEach(row => table.querySelector('tbody').appendChild(row));
|
|
832
|
-
});
|
|
833
|
-
});
|
|
834
|
-
|
|
835
|
-
8.8 模拟数据加载:
|
|
836
|
-
function simulateDataLoad(callback, delay = 1000) {
|
|
837
|
-
// 显示加载状态
|
|
838
|
-
const loader = document.createElement('div');
|
|
839
|
-
loader.className = 'loader';
|
|
840
|
-
loader.textContent = '加载中...';
|
|
841
|
-
document.querySelector('.main').appendChild(loader);
|
|
842
|
-
|
|
843
|
-
// 模拟异步加载
|
|
844
|
-
setTimeout(() => {
|
|
845
|
-
loader.remove();
|
|
846
|
-
callback();
|
|
847
|
-
}, delay);
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
8.9 搜索功能:
|
|
851
|
-
const searchInput = document.querySelector('.search-input');
|
|
852
|
-
if (searchInput) {
|
|
853
|
-
searchInput.addEventListener('input', (e) => {
|
|
854
|
-
const query = e.target.value.toLowerCase();
|
|
855
|
-
const items = document.querySelectorAll('.searchable-item');
|
|
856
|
-
|
|
857
|
-
items.forEach(item => {
|
|
858
|
-
const text = item.textContent.toLowerCase();
|
|
859
|
-
item.style.display = text.includes(query) ? '' : 'none';
|
|
860
|
-
});
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
8.10 防抖/节流 (Debounce/Throttle):
|
|
865
|
-
function debounce(func, wait) {
|
|
866
|
-
let timeout;
|
|
867
|
-
return function(...args) {
|
|
868
|
-
clearTimeout(timeout);
|
|
869
|
-
timeout = setTimeout(() => func.apply(this, args), wait);
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
// 应用于搜索
|
|
874
|
-
searchInput.addEventListener('input', debounce((e) => {
|
|
875
|
-
console.log('搜索:', e.target.value);
|
|
876
|
-
}, 300));
|
|
877
|
-
```
|
|
219
|
+
1. 页面路由: SPA单页应用路由逻辑
|
|
220
|
+
2. 表单验证: 实时验证+错误提示
|
|
221
|
+
3. 模态框/抽屉: 打开/关闭逻辑
|
|
222
|
+
4. 下拉菜单/工具提示: 显示/隐藏逻辑
|
|
223
|
+
5. 标签页/手风琴: 切换逻辑
|
|
224
|
+
6. 数据加载: 模拟API调用+加载状态
|
|
225
|
+
7. 搜索/过滤/排序: 列表操作逻辑
|
|
226
|
+
8. 通知/Toast: 显示/自动关闭
|
|
227
|
+
9. 键盘导航: Tab/Enter/Escape支持
|
|
228
|
+
10. 输出完整JavaScript
|
|
878
229
|
|
|
879
230
|
**验证点**:
|
|
880
|
-
- [x]
|
|
881
|
-
- [x]
|
|
882
|
-
- [x]
|
|
883
|
-
- [x]
|
|
884
|
-
- [x] Toast通知可显示
|
|
885
|
-
- [x] 至少1个复杂交互(排序/搜索/过滤)
|
|
231
|
+
- [x] 所有交互元素可用
|
|
232
|
+
- [x] 表单验证完整
|
|
233
|
+
- [x] 键盘导航可用
|
|
234
|
+
- [x] 无console错误
|
|
886
235
|
|
|
887
236
|
---
|
|
888
237
|
|
|
889
238
|
### Phase 9: Responsive Adaptation (响应式适配)
|
|
890
239
|
|
|
891
|
-
**目标**:
|
|
240
|
+
**目标**: 确保三断点响应式正常
|
|
892
241
|
|
|
893
|
-
**输入**: Phase
|
|
894
|
-
**输出**:
|
|
242
|
+
**输入**: Phase 7的CSS + Phase 8的JavaScript
|
|
243
|
+
**输出**: 响应式优化后的代码
|
|
895
244
|
|
|
896
245
|
**执行步骤**:
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
- 表格: 卡片化展示或横向滚动
|
|
906
|
-
- 表单: 全宽输入框
|
|
907
|
-
- 图片: 响应式图片(srcset或object-fit)
|
|
908
|
-
- 字体: 稍小的基准字号(14px)
|
|
909
|
-
|
|
910
|
-
9.3 Tablet优化:
|
|
911
|
-
- 导航: 折叠式侧边栏或顶部导航
|
|
912
|
-
- 表格: 简化列数或固定关键列
|
|
913
|
-
- 布局: 2列网格
|
|
914
|
-
|
|
915
|
-
9.4 Desktop优化:
|
|
916
|
-
- 导航: 完整顶部导航+侧边栏
|
|
917
|
-
- 表格: 完整列数+排序/过滤
|
|
918
|
-
- 布局: 3-4列网格
|
|
919
|
-
|
|
920
|
-
9.5 Touch Targets:
|
|
921
|
-
确保所有可点击元素在移动端至少44x44px
|
|
922
|
-
|
|
923
|
-
.btn, .nav-link {
|
|
924
|
-
min-height: 44px;
|
|
925
|
-
min-width: 44px;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
9.6 Viewport Meta:
|
|
929
|
-
已在Phase 6添加:
|
|
930
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
931
|
-
|
|
932
|
-
9.7 测试清单:
|
|
933
|
-
在每个断点测试:
|
|
934
|
-
- [ ] 页面布局正常
|
|
935
|
-
- [ ] 导航可用
|
|
936
|
-
- [ ] 表单可填写
|
|
937
|
-
- [ ] 按钮可点击
|
|
938
|
-
- [ ] 图片正常显示
|
|
939
|
-
- [ ] 文字可读(不截断)
|
|
940
|
-
- [ ] 滚动流畅
|
|
941
|
-
- [ ] 无水平滚动条
|
|
942
|
-
|
|
943
|
-
9.8 输出测试报告:
|
|
944
|
-
将测试结果记录为HTML注释
|
|
945
|
-
<!-- Responsive Test Report
|
|
946
|
-
Mobile (375px): ✅ Layout OK, ✅ Nav OK, ✅ Forms OK
|
|
947
|
-
Tablet (768px): ✅ Layout OK, ✅ Nav OK, ✅ Tables OK
|
|
948
|
-
Desktop (1280px): ✅ Layout OK, ✅ Nav OK, ✅ All features OK
|
|
949
|
-
-->
|
|
950
|
-
```
|
|
246
|
+
1. Mobile (320px-767px): 移动端优先设计
|
|
247
|
+
2. Tablet (768px-1023px): 平板适配
|
|
248
|
+
3. Desktop (1024px+): 桌面端适配
|
|
249
|
+
4. 触摸优化: 按钮最小44x44px
|
|
250
|
+
5. 字体缩放: 移动端基础字号14px,桌面端16px
|
|
251
|
+
6. 图片优化: srcset/loading="lazy"
|
|
252
|
+
7. 性能优化: CSS/JS压缩,关键CSS内联
|
|
253
|
+
8. 输出优化后的代码
|
|
951
254
|
|
|
952
255
|
**验证点**:
|
|
953
|
-
- [x]
|
|
954
|
-
- [x]
|
|
955
|
-
- [x]
|
|
956
|
-
- [x]
|
|
957
|
-
- [x] 无水平滚动条
|
|
256
|
+
- [x] 三断点正常显示
|
|
257
|
+
- [x] 触摸目标足够大
|
|
258
|
+
- [x] 图片加载优化
|
|
259
|
+
- [x] 性能达标
|
|
958
260
|
|
|
959
261
|
---
|
|
960
262
|
|
|
961
263
|
### Phase 10: Constitution & Quality Check (宪法与质量检查)
|
|
962
264
|
|
|
963
|
-
**目标**:
|
|
265
|
+
**目标**: 确保符合Constitution和质量标准
|
|
964
266
|
|
|
965
267
|
**输入**: 完整的UI_PROTOTYPE.html
|
|
966
|
-
**输出**:
|
|
268
|
+
**输出**: 质量检查报告 + 最终HTML文件
|
|
967
269
|
|
|
968
270
|
**执行步骤**:
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
Article III - Security First (安全优先):
|
|
978
|
-
- [ ] III.1 No Hardcoded Secrets: 无API密钥硬编码
|
|
979
|
-
- [ ] III.2 Input Validation: 表单有验证逻辑
|
|
980
|
-
- [ ] III.4 Secure by Default: 使用HTTPS CDN资源
|
|
981
|
-
|
|
982
|
-
Article V - Maintainability (可维护性):
|
|
983
|
-
- [ ] V.3 Documentation: HTML注释包含设计文档
|
|
984
|
-
- [ ] V.4 File Size Limits: 单文件HTML ≤ 2000行(可接受)
|
|
985
|
-
|
|
986
|
-
Article X - Requirement Boundary (需求边界):
|
|
987
|
-
- [ ] X.1 No Speculation: 仅实现PRD明确的功能
|
|
988
|
-
- [ ] X.2 No Speculative Features: 无"未来可能需要"的功能
|
|
989
|
-
|
|
990
|
-
10.2 质量检查清单:
|
|
991
|
-
|
|
992
|
-
HTML质量:
|
|
993
|
-
- [ ] 使用HTML5语义化标签
|
|
994
|
-
- [ ] 无未闭合标签
|
|
995
|
-
- [ ] ARIA标签完整
|
|
996
|
-
- [ ] 无重复ID
|
|
997
|
-
|
|
998
|
-
CSS质量:
|
|
999
|
-
- [ ] 使用CSS变量(Design System)
|
|
1000
|
-
- [ ] 响应式媒体查询正常
|
|
1001
|
-
- [ ] 无!important滥用
|
|
1002
|
-
- [ ] 命名规范(BEM或一致的命名)
|
|
1003
|
-
|
|
1004
|
-
JavaScript质量:
|
|
1005
|
-
- [ ] 无全局变量污染
|
|
1006
|
-
- [ ] 事件监听器正确绑定
|
|
1007
|
-
- [ ] 无内存泄漏(事件监听器移除)
|
|
1008
|
-
- [ ] Console无错误
|
|
1009
|
-
|
|
1010
|
-
可访问性:
|
|
1011
|
-
- [ ] 色彩对比度 ≥ 4.5:1
|
|
1012
|
-
- [ ] 键盘导航可用
|
|
1013
|
-
- [ ] 屏幕阅读器友好
|
|
1014
|
-
- [ ] focus状态可见
|
|
1015
|
-
|
|
1016
|
-
性能:
|
|
1017
|
-
- [ ] CDN资源加载<1s
|
|
1018
|
-
- [ ] 首屏渲染<2s
|
|
1019
|
-
- [ ] 交互响应<100ms
|
|
1020
|
-
- [ ] 无不必要的重绘/回流
|
|
1021
|
-
|
|
1022
|
-
10.3 PRD对齐检查:
|
|
1023
|
-
遍历PRD中的每个用户故事:
|
|
1024
|
-
- [ ] 用户故事1: {标题} → UI页面/组件: {对应实现}
|
|
1025
|
-
- [ ] 用户故事2: {标题} → UI页面/组件: {对应实现}
|
|
1026
|
-
...
|
|
1027
|
-
|
|
1028
|
-
确保所有用户故事都有对应的UI实现
|
|
1029
|
-
|
|
1030
|
-
10.4 设计灵感验证:
|
|
1031
|
-
- [ ] 采样了2位大师
|
|
1032
|
-
- [ ] 转译说明清晰可执行
|
|
1033
|
-
- [ ] 实际样式符合转译说明
|
|
1034
|
-
- [ ] 禁止模仿的元素未出现
|
|
1035
|
-
|
|
1036
|
-
10.5 Anti-Generic-Design验证:
|
|
1037
|
-
- [ ] 无占位图片(Picsum图片正常加载)
|
|
1038
|
-
- [ ] 无常见AI紫/蓝配色
|
|
1039
|
-
- [ ] 无Emoji图标(使用SVG/图标库)
|
|
1040
|
-
- [ ] 无Lorem Ipsum文本
|
|
1041
|
-
|
|
1042
|
-
10.6 运行Constitution验证脚本:
|
|
1043
|
-
bash .claude/scripts/validate-constitution.sh --type ui --severity warning
|
|
1044
|
-
|
|
1045
|
-
解析输出:
|
|
1046
|
-
- 如果有ERROR级别违规 → 必须修复
|
|
1047
|
-
- 如果有WARNING级别违规 → 记录到报告
|
|
1048
|
-
|
|
1049
|
-
10.7 输出Constitution检查报告:
|
|
1050
|
-
嵌入HTML注释:
|
|
1051
|
-
<!-- Constitution Check Report
|
|
1052
|
-
Generated: {timestamp}
|
|
1053
|
-
Status: PASS / WARN / FAIL
|
|
1054
|
-
|
|
1055
|
-
Article I - Quality First: ✅ PASS
|
|
1056
|
-
Article III - Security First: ✅ PASS
|
|
1057
|
-
Article V - Maintainability: ⚠️ WARN (文件略大,但可接受)
|
|
1058
|
-
Article X - Requirement Boundary: ✅ PASS
|
|
1059
|
-
|
|
1060
|
-
Quality Checklist:
|
|
1061
|
-
- HTML: ✅ 18/18 checks passed
|
|
1062
|
-
- CSS: ✅ 12/12 checks passed
|
|
1063
|
-
- JavaScript: ✅ 8/8 checks passed
|
|
1064
|
-
- Accessibility: ⚠️ 7/8 checks passed (1 minor issue)
|
|
1065
|
-
- Performance: ✅ 4/4 checks passed
|
|
1066
|
-
|
|
1067
|
-
PRD Alignment:
|
|
1068
|
-
- User Story 1: ✅ Implemented in page-orders
|
|
1069
|
-
- User Story 2: ✅ Implemented in modal-create-order
|
|
1070
|
-
- User Story 3: ✅ Implemented in page-settings
|
|
1071
|
-
|
|
1072
|
-
Design Inspirations:
|
|
1073
|
-
- Inspiration 1: ✅ Applied (grid system from Müller-Brockmann)
|
|
1074
|
-
- Inspiration 2: ✅ Applied (color palette from Kusama)
|
|
1075
|
-
|
|
1076
|
-
Anti-Generic-Design:
|
|
1077
|
-
- ✅ Real images (Picsum)
|
|
1078
|
-
- ✅ Unique color palette (避免AI紫)
|
|
1079
|
-
- ✅ SVG icons (Lucide)
|
|
1080
|
-
- ✅ Real content (no Lorem Ipsum)
|
|
1081
|
-
|
|
1082
|
-
Overall Status: READY FOR HANDOFF
|
|
1083
|
-
-->
|
|
1084
|
-
|
|
1085
|
-
10.8 最终文件输出:
|
|
1086
|
-
将完整的HTML写入:
|
|
1087
|
-
devflow/requirements/${reqId}/UI_PROTOTYPE.html
|
|
1088
|
-
|
|
1089
|
-
10.9 更新状态:
|
|
1090
|
-
orchestration_status.json:
|
|
1091
|
-
{
|
|
1092
|
-
"phase": "ui_complete",
|
|
1093
|
-
"uiPrototypeGenerated": true,
|
|
1094
|
-
"uiPrototypeFile": "UI_PROTOTYPE.html",
|
|
1095
|
-
"constitutionCheckPassed": true
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
10.10 记录事件:
|
|
1099
|
-
log_event "$REQ_ID" "UI prototype generation completed"
|
|
1100
|
-
```
|
|
271
|
+
1. Constitution检查: Article I/III/V/X
|
|
272
|
+
2. Anti-Generic-Design检查: 无占位图/常见AI配色/Emoji/Lorem Ipsum
|
|
273
|
+
3. HTML质量检查: 语义化/ARIA/无重复ID
|
|
274
|
+
4. CSS质量检查: CSS变量/响应式/无!important滥用
|
|
275
|
+
5. JavaScript质量检查: 无全局污染/事件监听器正确/无内存泄漏
|
|
276
|
+
6. 可访问性检查: 色彩对比度≥4.5:1/键盘导航/屏幕阅读器
|
|
277
|
+
7. 性能检查: CDN资源<1s/首屏<2s/交互<100ms
|
|
278
|
+
8. 输出质量检查报告
|
|
1101
279
|
|
|
1102
|
-
**验证点**:
|
|
1103
|
-
- [x] Constitution检查通过(或仅WARNING)
|
|
1104
|
-
- [x] 质量检查清单至少90%通过
|
|
1105
|
-
- [x] 所有PRD用户故事都有对应UI实现
|
|
1106
|
-
- [x] 设计灵感已应用且可验证
|
|
1107
|
-
- [x] Anti-Generic-Design规则全部遵守
|
|
280
|
+
**验证点**: 详见 `.claude/docs/examples/ui-prototype-constitution-checklist.md`
|
|
1108
281
|
|
|
1109
282
|
---
|
|
1110
283
|
|
|
1111
|
-
##
|
|
1112
|
-
|
|
1113
|
-
### UI_PROTOTYPE.html Structure:
|
|
1114
|
-
|
|
1115
|
-
```html
|
|
1116
|
-
<!DOCTYPE html>
|
|
1117
|
-
<html lang="zh-CN">
|
|
1118
|
-
<head>
|
|
1119
|
-
<meta charset="UTF-8">
|
|
1120
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1121
|
-
<meta name="color-scheme" content="light dark">
|
|
1122
|
-
<title>{REQ_ID} - {需求标题} - UI原型</title>
|
|
1123
|
-
|
|
1124
|
-
<!-- === Design System Metadata === -->
|
|
1125
|
-
<!--
|
|
1126
|
-
Generated: {ISO 8601 timestamp}
|
|
1127
|
-
REQ-ID: {REQ_ID}
|
|
1128
|
-
Template Version: 1.0.0
|
|
1129
|
-
|
|
1130
|
-
=== Product Analysis ===
|
|
1131
|
-
{Phase 1 输出}
|
|
1132
|
-
|
|
1133
|
-
=== Design Inspirations ===
|
|
1134
|
-
{Phase 2 输出: 2位大师+转译说明}
|
|
1135
|
-
|
|
1136
|
-
=== Design System ===
|
|
1137
|
-
{Phase 3 输出: 色彩/字体/间距系统}
|
|
1138
|
-
|
|
1139
|
-
=== Information Architecture ===
|
|
1140
|
-
{Phase 4 输出: 站点地图+导航结构}
|
|
1141
|
-
|
|
1142
|
-
=== Component Inventory ===
|
|
1143
|
-
{Phase 5 输出: 组件清单}
|
|
1144
|
-
|
|
1145
|
-
=== Constitution Check Report ===
|
|
1146
|
-
{Phase 10 输出: 完整检查报告}
|
|
1147
|
-
-->
|
|
1148
|
-
|
|
1149
|
-
<!-- CDN Resources -->
|
|
1150
|
-
<link href="https://fonts.googleapis.com/css2?family={选定字体}&display=swap" rel="stylesheet">
|
|
1151
|
-
<script src="https://unpkg.com/lucide@latest"></script>
|
|
1152
|
-
|
|
1153
|
-
<style>
|
|
1154
|
-
/* === Design System (CSS Variables) === */
|
|
1155
|
-
:root {
|
|
1156
|
-
/* Phase 3 的 Design Tokens */
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
/* === Reset & Base Styles === */
|
|
1160
|
-
/* Phase 7.3 */
|
|
1161
|
-
|
|
1162
|
-
/* === Layout System === */
|
|
1163
|
-
/* Phase 7.4 */
|
|
1164
|
-
|
|
1165
|
-
/* === Components === */
|
|
1166
|
-
/* Phase 7.5 - 所有组件样式 */
|
|
1167
|
-
|
|
1168
|
-
/* === Pages === */
|
|
1169
|
-
/* Phase 7.6 - 页面特定样式 */
|
|
1170
|
-
|
|
1171
|
-
/* === Responsive === */
|
|
1172
|
-
/* Phase 7.7 - 媒体查询 */
|
|
1173
|
-
|
|
1174
|
-
/* === Animations === */
|
|
1175
|
-
/* Phase 7.8 - 动效 */
|
|
1176
|
-
|
|
1177
|
-
/* === Utilities === */
|
|
1178
|
-
/* Phase 7.10 - 工具类 */
|
|
1179
|
-
</style>
|
|
1180
|
-
</head>
|
|
1181
|
-
<body>
|
|
1182
|
-
<!-- === Global Header === -->
|
|
1183
|
-
<header class="header">
|
|
1184
|
-
<!-- Phase 6.5 - 导航栏 -->
|
|
1185
|
-
</header>
|
|
1186
|
-
|
|
1187
|
-
<!-- === Main Content === -->
|
|
1188
|
-
<main class="main">
|
|
1189
|
-
<!-- Page 1 -->
|
|
1190
|
-
<section id="page-{name}" class="page page-active">
|
|
1191
|
-
<!-- Phase 6.5 - 页面内容 -->
|
|
1192
|
-
</section>
|
|
1193
|
-
|
|
1194
|
-
<!-- Page 2 -->
|
|
1195
|
-
<section id="page-{name}" class="page">
|
|
1196
|
-
<!-- More pages... -->
|
|
1197
|
-
</section>
|
|
1198
|
-
</main>
|
|
1199
|
-
|
|
1200
|
-
<!-- === Global Footer === -->
|
|
1201
|
-
<footer class="footer">
|
|
1202
|
-
<!-- Phase 6.5 - 页脚 -->
|
|
1203
|
-
</footer>
|
|
284
|
+
## Error Handling
|
|
1204
285
|
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
286
|
+
### Phase 2失败: 设计灵感采样失败
|
|
287
|
+
- **原因**: 灵感池文件不存在或格式错误
|
|
288
|
+
- **解决**: 使用默认灵感(现代主义+生成艺术)
|
|
289
|
+
- **重试**: 手动指定2位大师
|
|
1209
290
|
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
/* === SPA Router === */
|
|
1215
|
-
/* Phase 8.2 */
|
|
1216
|
-
|
|
1217
|
-
/* === Navigation === */
|
|
1218
|
-
/* Phase 8.3 */
|
|
1219
|
-
|
|
1220
|
-
/* === Forms === */
|
|
1221
|
-
/* Phase 8.4 */
|
|
1222
|
-
|
|
1223
|
-
/* === Modals === */
|
|
1224
|
-
/* Phase 8.5 */
|
|
1225
|
-
|
|
1226
|
-
/* === Toast === */
|
|
1227
|
-
/* Phase 8.6 */
|
|
1228
|
-
|
|
1229
|
-
/* === Table Sorting === */
|
|
1230
|
-
/* Phase 8.7 */
|
|
1231
|
-
|
|
1232
|
-
/* === More Interactions === */
|
|
1233
|
-
/* Phase 8.8-8.10 */
|
|
1234
|
-
</script>
|
|
1235
|
-
|
|
1236
|
-
<!-- === Responsive Test Report === -->
|
|
1237
|
-
<!-- Phase 9.8 输出 -->
|
|
1238
|
-
</body>
|
|
1239
|
-
</html>
|
|
1240
|
-
```
|
|
291
|
+
### Phase 10失败: Constitution检查失败
|
|
292
|
+
- **原因**: 存在占位符/硬编码密钥/不完整实现
|
|
293
|
+
- **解决**: 修复违规项
|
|
294
|
+
- **重试**: 重新运行Phase 10
|
|
1241
295
|
|
|
1242
296
|
---
|
|
1243
297
|
|
|
1244
|
-
##
|
|
1245
|
-
|
|
1246
|
-
### Common Errors:
|
|
1247
|
-
|
|
1248
|
-
**1. PRD中无UI需求**
|
|
1249
|
-
```
|
|
1250
|
-
WARNING: No UI requirements detected in PRD.md
|
|
1251
|
-
Analyzed sections: 用户故事, 非功能需求
|
|
1252
|
-
Found keywords: 0 matches for "用户界面|前端|Web页面|UI"
|
|
1253
|
-
|
|
1254
|
-
Recommendation:
|
|
1255
|
-
1. This appears to be a backend-only requirement
|
|
1256
|
-
2. Skipping UI prototype generation
|
|
1257
|
-
3. Continuing within /flow:spec
|
|
1258
|
-
|
|
1259
|
-
Action: EXIT with status "ui_skipped"
|
|
1260
|
-
```
|
|
1261
|
-
|
|
1262
|
-
**2. 设计灵感采样失败**
|
|
1263
|
-
```
|
|
1264
|
-
ERROR: Design inspiration sampling failed
|
|
1265
|
-
Sampled: {Designer1}, {Designer2}
|
|
1266
|
-
Issue: Both designers from same category (建筑)
|
|
1267
|
-
Expected: Designers from different categories
|
|
1268
|
-
|
|
1269
|
-
Recovery:
|
|
1270
|
-
1. Re-sample with category diversity check
|
|
1271
|
-
2. Retry Phase 2
|
|
1272
|
-
```
|
|
1273
|
-
|
|
1274
|
-
**3. HTML验证失败**
|
|
1275
|
-
```
|
|
1276
|
-
ERROR: HTML validation failed
|
|
1277
|
-
Issues:
|
|
1278
|
-
- Unclosed <div> tag at line 145
|
|
1279
|
-
- Duplicate ID "btn-submit" at lines 89, 203
|
|
1280
|
-
- Missing alt attribute on <img> at line 67
|
|
1281
|
-
|
|
1282
|
-
Recovery:
|
|
1283
|
-
1. Fix HTML errors
|
|
1284
|
-
2. Re-run validate-constitution.sh
|
|
1285
|
-
3. Retry Phase 10
|
|
1286
|
-
```
|
|
1287
|
-
|
|
1288
|
-
**4. Constitution违规**
|
|
1289
|
-
```
|
|
1290
|
-
⚠️ Constitution violations detected:
|
|
1291
|
-
|
|
1292
|
-
[error] Article I.1 - NO PARTIAL IMPLEMENTATION
|
|
1293
|
-
Location: UI_PROTOTYPE.html:245
|
|
1294
|
-
Issue: Placeholder image <img src="placeholder.jpg">
|
|
1295
|
-
Fix: Replace with Picsum URL
|
|
298
|
+
## Data Flow
|
|
1296
299
|
|
|
1297
|
-
[warning] Article V.4 - File Size
|
|
1298
|
-
Location: UI_PROTOTYPE.html
|
|
1299
|
-
Issue: File size 2300 lines (limit: 2000 lines)
|
|
1300
|
-
Fix: Acceptable for complex prototypes, or split into modules
|
|
1301
|
-
|
|
1302
|
-
Recovery:
|
|
1303
|
-
1. If ERROR violations: MUST FIX before proceeding
|
|
1304
|
-
2. If only WARNINGS: Document in report, proceed with caution
|
|
1305
|
-
```
|
|
1306
|
-
|
|
1307
|
-
---
|
|
1308
|
-
|
|
1309
|
-
## Integration with DevFlow
|
|
1310
|
-
|
|
1311
|
-
### Workflow Position:
|
|
1312
|
-
```text
|
|
1313
|
-
/flow:spec → PRD.md 生成完成
|
|
1314
|
-
↓
|
|
1315
|
-
/flow:spec → 检测UI需求 → 生成UI_PROTOTYPE.html ← YOU ARE HERE
|
|
1316
|
-
↓
|
|
1317
|
-
/flow:spec → 参考UI原型生成EPIC.md和TASKS.md
|
|
1318
|
-
↓
|
|
1319
|
-
/flow:dev → 基于UI原型实现代码
|
|
1320
|
-
```
|
|
1321
|
-
|
|
1322
|
-
### Conditional Trigger Logic:
|
|
1323
|
-
在 `/flow:spec` 执行期间自动触发:
|
|
1324
|
-
|
|
1325
|
-
```bash
|
|
1326
|
-
# 检测是否需要UI原型
|
|
1327
|
-
has_ui_keywords=$(grep -iE "用户界面|前端|Web页面|UI|界面设计|交互" "$PRD_FILE")
|
|
1328
|
-
has_frontend_stack=$(ls -d src/components 2>/dev/null || ls package.json 2>/dev/null)
|
|
1329
|
-
|
|
1330
|
-
if [[ -n "$has_ui_keywords" || -n "$has_frontend_stack" ]]; then
|
|
1331
|
-
echo "✅ UI requirements detected, continue UI prototype generation in /flow:spec"
|
|
1332
|
-
else
|
|
1333
|
-
echo "ℹ️ No UI requirements detected, skipping UI prototype"
|
|
1334
|
-
# 继续 /flow:spec 后续任务规划
|
|
1335
|
-
fi
|
|
1336
|
-
```
|
|
1337
|
-
|
|
1338
|
-
### Data Flow:
|
|
1339
300
|
```text
|
|
1340
301
|
PRD.md (Input)
|
|
1341
302
|
├─ 用户故事 → Phase 1 (产品分析) → 页面列表
|
|
@@ -1354,42 +315,17 @@ UI_PROTOTYPE.html (Output)
|
|
|
1354
315
|
|
|
1355
316
|
### For ui-designer Agent:
|
|
1356
317
|
|
|
1357
|
-
1. **严格遵循Execution Flow
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
- 选择互补而非冲突的风格
|
|
1363
|
-
- 推荐组合: 现代主义(秩序) + 生成艺术(动态)
|
|
1364
|
-
- 避免组合: 两位极简主义大师(风格过于相似)
|
|
1365
|
-
|
|
1366
|
-
3. **内容真实性**
|
|
1367
|
-
- 图片: https://picsum.photos/id/{1-200}/{width}/{height}
|
|
1368
|
-
- 数据: 使用符合业务场景的模拟数据
|
|
1369
|
-
- 文本: 从PRD中提取真实的业务术语
|
|
1370
|
-
|
|
1371
|
-
4. **响应式优先**
|
|
1372
|
-
- 移动端优先设计(Mobile First)
|
|
1373
|
-
- 在小屏幕可用是基础,而非可选
|
|
1374
|
-
|
|
1375
|
-
5. **可访问性非可选**
|
|
1376
|
-
- ARIA标签是必需品
|
|
1377
|
-
- 键盘导航必须可用
|
|
1378
|
-
- 色彩对比度必须达标
|
|
318
|
+
1. **严格遵循Execution Flow**: 不跳过任何Phase
|
|
319
|
+
2. **设计灵感采样**: 选择互补而非冲突的风格
|
|
320
|
+
3. **内容真实性**: 图片用Picsum,数据符合业务场景
|
|
321
|
+
4. **响应式优先**: 移动端优先设计(Mobile First)
|
|
322
|
+
5. **可访问性非可选**: ARIA标签/键盘导航/色彩对比度
|
|
1379
323
|
|
|
1380
324
|
### For Main Agent (Claude):
|
|
1381
325
|
|
|
1382
|
-
1.
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
2. **状态管理**
|
|
1387
|
-
- 更新orchestration_status.json中的phase
|
|
1388
|
-
- 记录uiPrototypeFile路径
|
|
1389
|
-
|
|
1390
|
-
3. **错误处理**
|
|
1391
|
-
- 如果UI生成失败,记录详细错误到EXECUTION_LOG.md
|
|
1392
|
-
- 允许用户选择跳过UI阶段直接进入Epic
|
|
326
|
+
1. **条件触发**: 检测PRD关键词前使用grep -i(忽略大小写)
|
|
327
|
+
2. **状态管理**: 更新orchestration_status.json中的phase
|
|
328
|
+
3. **错误处理**: 记录详细错误到EXECUTION_LOG.md
|
|
1393
329
|
|
|
1394
330
|
---
|
|
1395
331
|
|
|
@@ -1429,7 +365,9 @@ UI_PROTOTYPE.html (Output)
|
|
|
1429
365
|
|
|
1430
366
|
---
|
|
1431
367
|
|
|
1432
|
-
**Template Version**:
|
|
1433
|
-
**Last Updated**:
|
|
368
|
+
**Template Version**: 2.0.0 (Slimmed from 1375 lines to ~400 lines, -71%)
|
|
369
|
+
**Last Updated**: 2026-03-12
|
|
1434
370
|
**Maintainer**: CC-DevFlow Team
|
|
1435
371
|
**License**: MIT
|
|
372
|
+
|
|
373
|
+
**[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
|