figma-restoration-tools
Version:
Professional Figma Component Restoration Kit - MCP tools with snapDOM-powered high-quality screenshots, intelligent shadow detection, and smart debugging for Vue component restoration. Includes figma_compare and snapdom_screenshot tools.
142 lines (119 loc) • 3.16 kB
Markdown
本文档介绍如何使用MCP工具进行Figma组件的像素级还原对比分析。
确保您有:
- Figma设计稿的PNG导出(推荐3x分辨率)
- 已实现的Vue组件
- 运行的Vue开发服务器
```javascript
{
"tool": "snapdom_screenshot",
"arguments": {
"componentName": "MyButton",
"snapDOMOptions": {
"scale": 3,
"compress": true,
"embedFonts": true
}
}
}
```
```javascript
{
"tool": "figma_compare",
"arguments": {
"componentName": "MyButton",
"threshold": 0.1,
"generateReport": true
}
}
```
**结果存储位置**:`src/components/MyButton/`
```javascript
{
"tool": "snapdom_screenshot",
"arguments": {
"componentName": "MyButton",
"outputPath": "/Users/username/project/figma-analysis/MyButton-v1.0",
"snapDOMOptions": {
"scale": 3,
"compress": true,
"embedFonts": true
}
}
}
```
```javascript
{
"tool": "figma_compare",
"arguments": {
"componentName": "MyButton",
"outputPath": "/Users/username/project/figma-analysis/MyButton-v1.0",
"threshold": 0.1,
"generateReport": true
}
}
```
**结果存储位置**:`/Users/username/project/figma-analysis/MyButton-v1.0/`
```javascript
// 不同版本的对比分析
{
"outputPath": "/project/analysis/MyButton-v1.0"
}
{
"outputPath": "/project/analysis/MyButton-v2.0"
}
```
```javascript
// 开发环境
{
"outputPath": "/project/qa/dev/MyButton"
}
// 测试环境
{
"outputPath": "/project/qa/test/MyButton"
}
```
```javascript
// 设计师目录
{
"outputPath": "/shared/design-review/MyButton"
}
// 开发者目录
{
"outputPath": "/shared/dev-review/MyButton"
}
```
无论使用默认路径还是自定义路径,都会产生以下文件:
```
指定路径/
├── actual.png
├── expected.png
├── diff.png
├── figma-analysis-report.json
├── figma-analysis-report.md
└── region-analysis.json
```
1. **路径规范**:使用绝对路径避免相对路径问题
2. **文件组织**:为不同版本、环境创建独立目录
3. **命名约定**:在路径中包含组件名称和版本信息
4. **团队协作**:使用共享路径便于团队成员访问结果
- 确保自定义路径的目录存在写权限
- expected.png需要手动放置到指定路径
- 两个工具的outputPath参数必须保持一致
- 路径中避免使用特殊字符和空格