vapor-ui
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVapor UI Design Skill
Vapor UI设计技能
Instructions
说明
Step 1: Identify User Intent & Detect Version
步骤1:识别用户意图并检测版本
Run these checks in parallel:
-
Determine user intent:
- Component lookup: User wants to know available components or specific component details
- Usage guidance: User needs props, variants, or example code
- Mockup generation: User wants to create a UI prototype
- Figma conversion: User wants to convert Figma design to code
-
Determine Vapor UI version (in order of priority):
- User-provided version: If user specifies a version, use it directly
- Auto-detect from codebase:
Output:bash
node scripts/detect-version.mjs [start-path]andCORE: x.x.xICONS: x.x.x
Useversion for component scripts,COREversion for icon scripts.ICONS
并行执行以下检查:
-
确定用户意图:
- 组件查询:用户想了解可用组件或特定组件的详细信息
- 使用指导:用户需要属性、变体或示例代码
- 原型生成:用户想要创建UI原型
- Figma转换:用户想要将Figma设计转换为代码
-
确定Vapor UI版本(优先级顺序):
- 用户指定版本:如果用户明确版本,直接使用该版本
- 从代码库自动检测:
输出:bash
node scripts/detect-version.mjs [start-path]和CORE: x.x.xICONS: x.x.x
组件脚本使用版本,图标脚本使用CORE版本。ICONS
Step 2: Component Information
步骤2:组件信息
Get component list:
bash
node scripts/get-component-list.mjs <VERSION>Example:
node scripts/get-component-list.mjs 1.0.0-beta.12Get component details (props, description):
bash
node scripts/get-component-info.mjs <VERSION> <COMPONENT> [PART]Example:
node scripts/get-component-info.mjs 1.0.0-beta.12 avatarFor detailed component structure, refer to .
references/component-structure.md获取组件列表:
bash
node scripts/get-component-list.mjs <VERSION>示例:
node scripts/get-component-list.mjs 1.0.0-beta.12获取组件详情(属性、描述):
bash
node scripts/get-component-info.mjs <VERSION> <COMPONENT> [PART]示例:
node scripts/get-component-info.mjs 1.0.0-beta.12 avatar如需了解详细的组件结构,请参考。
references/component-structure.mdStep 3: Component Examples
步骤3:组件示例
Get example code:
bash
node scripts/get-component-examples.mjs <VERSION> <COMPONENT> [EXAMPLE_NAME]Example:
node scripts/get-component-examples.mjs 1.0.0-beta.12 avatar default-avatar获取示例代码:
bash
node scripts/get-component-examples.mjs <VERSION> <COMPONENT> [EXAMPLE_NAME]示例:
node scripts/get-component-examples.mjs 1.0.0-beta.12 avatar default-avatarStep 3.5: Icon Lookup
步骤3.5:图标查询
Get icon list:
bash
node scripts/get-icon-list.mjs <ICONS_VERSION> [search-keyword]Examples:
- - List all icons
node scripts/get-icon-list.mjs 1.0.0-beta.12 - - Search icons containing "arrow"
node scripts/get-icon-list.mjs 1.0.0-beta.12 arrow - - List only outline icons
node scripts/get-icon-list.mjs 1.0.0-beta.12 --outline - - List only filled icons
node scripts/get-icon-list.mjs 1.0.0-beta.12 --filled
Note: Use version from output for icon queries.
ICONSdetect-version.mjs获取图标列表:
bash
node scripts/get-icon-list.mjs <ICONS_VERSION> [search-keyword]示例:
- - 列出所有图标
node scripts/get-icon-list.mjs 1.0.0-beta.12 - - 搜索包含“arrow”的图标
node scripts/get-icon-list.mjs 1.0.0-beta.12 arrow - - 仅列出轮廓图标
node scripts/get-icon-list.mjs 1.0.0-beta.12 --outline - - 仅列出填充图标
node scripts/get-icon-list.mjs 1.0.0-beta.12 --filled
注意:图标查询请使用输出中的版本。
detect-version.mjsICONSStep 4: Mockup Generation
步骤4:原型生成
For mockup requests:
- Run to identify available components
get-component-list.mjs - Run for each needed component's props
get-component-info.mjs - Run for usage patterns
get-component-examples.mjs - Generate code using Vapor UI components only
- Provide complete, copy-paste ready code
对于原型生成请求:
- 运行确认可用组件
get-component-list.mjs - 为每个所需组件运行获取属性信息
get-component-info.mjs - 运行获取使用模式
get-component-examples.mjs - 仅使用Vapor UI组件生成代码
- 提供可直接复制粘贴的完整代码
Step 5: Figma Design Conversion
步骤5:Figma设计转换
For Figma conversion requests:
-
Parse Figma URL to extractand
file_key:node_idhttps://www.figma.com/design/{file_key}/...?node-id={node_id} -
Get design context using MCP:
mcp__figma-dev-mode-mcp-server__get_design_context - file_key: extracted from URL - node_id: extracted from URL (format: "X-Y" or "X:Y") - depth: 5 (or higher for complex designs) -
Analyze node tree:
- 💙 prefix nodes: Design system components (see )
references/design-system-recognition.md - Auto-layout frames: Convert to VStack/HStack/Box/Grid (see )
references/figma-layout-mapping.md - TEXT nodes: Extract text content
- 💙 prefix nodes: Design system components (see
-
Convert layout properties:
- → VStack
layoutMode: VERTICAL - → HStack
layoutMode: HORIZONTAL - → gap token
itemSpacing - → padding tokens
padding* - See for full mapping
references/token-mapping.md
-
Recognize design system components:
- Nodes starting with 💙 are vapor-ui components
- Extract for variant → props mapping
componentProperties - Example: with
💙Button→Size: md, ColorPalette: primary<Button size="md" colorPalette="primary"> - Important: Layout props (,
gap,padding,margin, etc.) must be insidebackgroundColorprop$css
-
Generate code:
- Build JSX from node tree (bottom-up)
- Apply style utility props using design tokens
- Output production-ready code
对于Figma转换请求:
-
解析Figma链接提取和
file_key:node_idhttps://www.figma.com/design/{file_key}/...?node-id={node_id} -
使用MCP获取设计上下文:
mcp__figma-dev-mode-mcp-server__get_design_context - file_key: 从链接中提取 - node_id: 从链接中提取(格式:"X-Y" 或 "X:Y") - depth: 5(复杂设计可设为更高值) -
分析节点树:
- 💙前缀节点:设计系统组件(详见)
references/design-system-recognition.md - 自动布局框架:转换为VStack/HStack/Box/Grid(详见)
references/figma-layout-mapping.md - TEXT节点:提取文本内容
- 💙前缀节点:设计系统组件(详见
-
转换布局属性:
- → VStack
layoutMode: VERTICAL - → HStack
layoutMode: HORIZONTAL - → gap令牌
itemSpacing - → padding令牌
padding* - 完整映射请参考
references/token-mapping.md
-
识别设计系统组件:
- 以💙开头的节点为vapor-ui组件
- 提取用于变体到属性的映射
componentProperties - 示例:带有
💙Button→Size: md, ColorPalette: primary<Button size="md" colorPalette="primary"> - 重要提示:布局属性(、
gap、padding、margin等)必须放在backgroundColor属性内$css
-
生成代码:
- 从下到上构建JSX
- 使用设计令牌应用样式工具属性
- 输出可用于生产环境的代码
Examples
示例
Example 1: Component Usage Query
User: "How do I use the Button component?"
Action:
- Run
node scripts/get-component-info.mjs 1.0.0-beta.12 button - Run
node scripts/get-component-examples.mjs 1.0.0-beta.12 button - Provide props, variants, and example code
Result: Complete Button usage guide with code examples
Example 2: Mockup Generation
User: "Create a login page mockup"
Action:
- Run to check available components
get-component-list.mjs - Run for text-input, button, card, form
get-component-info.mjs - Run for form patterns
get-component-examples.mjs - Generate responsive layout using Vapor UI
Result: Production-ready login page code
Example 3: Component Discovery
User: "What form components are available?"
Action:
- Run
node scripts/get-component-list.mjs 1.0.0-beta.12 - Filter output for form-related components (text-input, textarea, checkbox, radio, select, etc.)
Result: Categorized list of form-related components
For Figma conversion examples, see .
references/conversion-examples.md示例1:组件使用查询
用户:“如何使用Button组件?”
操作:
- 运行
node scripts/get-component-info.mjs 1.0.0-beta.12 button - 运行
node scripts/get-component-examples.mjs 1.0.0-beta.12 button - 提供属性、变体及示例代码
结果:包含代码示例的完整Button使用指南
示例2:原型生成
用户:“创建一个登录页面原型”
操作:
- 运行检查可用组件
get-component-list.mjs - 为text-input、button、card、form组件运行
get-component-info.mjs - 运行获取表单使用模式
get-component-examples.mjs - 使用Vapor UI生成响应式布局
结果:可用于生产环境的登录页面代码
示例3:组件发现
用户:“有哪些表单组件可用?”
操作:
- 运行
node scripts/get-component-list.mjs 1.0.0-beta.12 - 过滤出表单相关组件(text-input、textarea、checkbox、radio、select等)
结果:分类后的表单相关组件列表
Figma转换示例请参考。
references/conversion-examples.mdTroubleshooting
故障排除
| Error | Cause | Solution |
|---|---|---|
| Component not found | Name mismatch or version error | Run |
| Script fetch error | Invalid version or network issue | Re-run |
| Figma node not recognized | No 💙 prefix | Treat as custom layout (Box/VStack/HStack/Grid) |
| Spacing mismatch | Non-standard values | Round to nearest token (see |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| 组件未找到 | 名称不匹配或版本错误 | 运行 |
| 脚本获取错误 | 版本无效或网络问题 | 重新运行 |
| Figma节点未被识别 | 无💙前缀 | 视为自定义布局(Box/VStack/HStack/Grid) |
| 间距不匹配 | 使用非标准值 | 四舍五入到最近的令牌值(详见 |
References
参考资料
Component Documentation
组件文档
- : GitHub URL patterns for fetching component data
references/url-patterns.md - : Component file structure and JSON schema
references/component-structure.md
- :用于获取组件数据的GitHub URL模式
references/url-patterns.md - :组件文件结构及JSON schema
references/component-structure.md
Figma Conversion
Figma转换
- : Auto-layout to component mapping
references/figma-layout-mapping.md - : 💙 prefix component recognition
references/design-system-recognition.md - : Figma values to vapor-ui tokens
references/token-mapping.md - : Figma to code conversion examples
references/conversion-examples.md
- :自动布局到组件的映射
references/figma-layout-mapping.md - :💙前缀组件识别规则
references/design-system-recognition.md - :Figma值到vapor-ui令牌的映射
references/token-mapping.md - :Figma转代码的示例
references/conversion-examples.md
Scripts
脚本
| Script | Purpose |
|---|---|
| Detect @vapor-ui/core and @vapor-ui/icons versions from package.json |
| List all available components |
| Get component props and documentation |
| Get component example code |
| List and search icons (supports --outline, --filled, keyword search) |
| 脚本 | 用途 |
|---|---|
| 从package.json检测@vapor-ui/core和@vapor-ui/icons版本 |
| 列出所有可用组件 |
| 获取组件属性及文档 |
| 获取组件示例代码 |
| 列出并搜索图标(支持--outline、--filled及关键词搜索) |
MCP Tools
MCP工具
| Tool | Purpose |
|---|---|
| Fetch Figma design node tree |
| Get visual reference image |
| Get Figma file metadata |
| 工具 | 用途 |
|---|---|
| 获取Figma设计节点树 |
| 获取视觉参考图像 |
| 获取Figma文件元数据 |