Files
hms/.claude/skills/design-handoff/rules/interaction-rules.yml
iven a4732cd2d4 feat(skills): 添加截图提取 + 交互推断脚本 + SPEC 模板
- extract-screenshots.mjs: Playwright 截取 IosFrame 内容区域,裁掉设备框
- infer-interactions.mjs: 8 条规则正则匹配源码推断交互行为
- 重写 interaction-rules.yml: patterns 改为代码级正则(非自然语言描述)
- templates/spec-template.md: SPEC.md 六章节模板
2026-05-18 00:04:31 +08:00

109 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
version: 1
updated: "2026-05-17"
# ============================================================================
# 交互推断规则
# patterns 使用正则表达式,匹配 HTML/JS 源码中的实际代码模式
# require_all: true 表示所有 pattern 必须同时匹配(默认 false任一匹配即可
# ============================================================================
rules:
- id: swiper-autoplay
name: "自动轮播 + 手动滑动"
patterns:
- "linear-gradient"
- "width.*24.*width.*8"
require_all: false
infer:
component: "Swiper"
props: "autoplay circular indicatorDots"
behavior: "自动轮播3-5秒切换"
confidence: high
- id: card-tap
name: "卡片点击跳转"
patterns:
- "\\.map\\("
require_all: false
infer:
component: "ContentCard"
props: "activeFeedback onPress"
behavior: "卡片可点击,带触控反馈"
confidence: medium
- id: form-submit
name: "表单提交"
patterns:
- "<input"
- "<button"
require_all: false
infer:
component: "FormInput + PrimaryButton"
props: ""
behavior: "表单输入+提交按钮"
confidence: high
- id: list-scroll
name: "列表滚动"
patterns:
- "overflow.*auto|scroll"
- "\\.map\\(.*\\.map\\(.*\\.map\\("
require_all: false
infer:
component: "ScrollView"
props: "scrollY onScrollToLower"
behavior: "可滚动列表,支持上拉加载"
confidence: medium
- id: tab-switch
name: "标签页切换"
patterns:
- "tab"
- "segment"
- "filter"
require_all: false
infer:
component: "TabFilter"
props: "tabs onChange"
behavior: "标签页切换筛选"
confidence: medium
- id: static-decoration
name: "纯装饰无交互"
patterns:
- "position.*absolute"
- "opacity.*0\\."
require_all: true
infer:
component: null
props: ""
behavior: "纯装饰性元素,无交互"
confidence: high
- id: login-cta
name: "登录/注册触发"
patterns:
- "登录"
- "立即"
- "注册"
require_all: false
infer:
component: "PrimaryButton"
props: "onClick"
behavior: "登录/注册引导按钮"
confidence: high
- id: empty-fallback
name: "空数据降级"
patterns:
- "\\.length > 0"
- "\\.length === 0"
- "暂无"
- "没有"
require_all: false
infer:
component: null
props: ""
behavior: "条件渲染:有数据显示列表,无数据显示空状态"
confidence: medium