design-clone 1.1.1 → 1.2.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/README.md +16 -8
- package/SKILL.md +74 -0
- package/docs/cli-reference.md +25 -1
- package/docs/design-clone-architecture.md +47 -19
- package/package.json +5 -1
- package/src/ai/prompts/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/ai/prompts/__pycache__/design_tokens.cpython-313.pyc +0 -0
- package/src/ai/prompts/__pycache__/structure_analysis.cpython-313.pyc +0 -0
- package/src/core/animation-extractor.js +526 -0
- package/src/core/screenshot.js +175 -0
- package/src/core/state-capture.js +602 -0
- package/src/core/video-capture.js +540 -0
- package/src/utils/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/utils/__pycache__/env.cpython-313.pyc +0 -0
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Clone website designs with multi-viewport screenshots, HTML/CSS extraction, and
|
|
|
10
10
|
|
|
11
11
|
- **Multi-viewport screenshots**: Desktop (1920px), Tablet (768px), Mobile (375px)
|
|
12
12
|
- **HTML/CSS extraction**: Clean source files with unused CSS removal
|
|
13
|
+
- **Hover state capture**: Screenshots and CSS for interactive element states (phase 2)
|
|
13
14
|
- **AI structure analysis**: Gemini Vision analyzes page layout (optional)
|
|
14
15
|
- **Asset extraction**: Downloads images, fonts, icons
|
|
15
16
|
- **Menu verification**: Tests responsive navigation functionality
|
|
@@ -75,14 +76,21 @@ Full pixel-perfect clone:
|
|
|
75
76
|
|
|
76
77
|
```
|
|
77
78
|
cloned-design/
|
|
78
|
-
├── desktop.png
|
|
79
|
-
├── tablet.png
|
|
80
|
-
├── mobile.png
|
|
81
|
-
├── source.html
|
|
82
|
-
├── source.css
|
|
83
|
-
├── source-raw.css
|
|
84
|
-
├──
|
|
85
|
-
├── tokens.json
|
|
79
|
+
├── desktop.png # 1920x1080 screenshot
|
|
80
|
+
├── tablet.png # 768x1024 screenshot
|
|
81
|
+
├── mobile.png # 375x812 screenshot
|
|
82
|
+
├── source.html # Cleaned HTML
|
|
83
|
+
├── source.css # Filtered CSS
|
|
84
|
+
├── source-raw.css # Original CSS (unfiltered)
|
|
85
|
+
├── animations.css # Extracted @keyframes definitions
|
|
86
|
+
├── animation-tokens.json # Animation metadata (keyframes, transitions, timings)
|
|
87
|
+
├── hover.css # Generated :hover CSS rules (with --capture-hover)
|
|
88
|
+
├── structure.md # AI analysis (if GEMINI_API_KEY set)
|
|
89
|
+
├── tokens.json # Extracted design tokens
|
|
90
|
+
├── hover-states/ # Hover state captures (with --capture-hover)
|
|
91
|
+
│ ├── hover-N-normal.png # Element before hover
|
|
92
|
+
│ ├── hover-N-hover.png # Element during hover
|
|
93
|
+
│ └── hover-diff.json # Captured element summary
|
|
86
94
|
└── assets/
|
|
87
95
|
├── images/
|
|
88
96
|
├── fonts/
|
package/SKILL.md
CHANGED
|
@@ -13,6 +13,7 @@ Clone website designs with multi-viewport screenshots, HTML/CSS extraction, CSS
|
|
|
13
13
|
- **Direct Unsplash Images** - Real images without API key needed
|
|
14
14
|
- **Japanese Design Principles** - Ma, Kanso, Shibui, Seijaku for elegant designs
|
|
15
15
|
- **Multi-viewport Screenshots** - Desktop, tablet, mobile captures
|
|
16
|
+
- **Hover State Capture** - Interactive element screenshots and :hover CSS generation
|
|
16
17
|
- **Gemini Vision Analysis** - AI-powered design token extraction
|
|
17
18
|
- **ui-ux-pro-max Quality Check** - Accessibility, hover states, contrast validation
|
|
18
19
|
|
|
@@ -164,6 +165,7 @@ node src/core/screenshot.js \
|
|
|
164
165
|
--url "URL" \
|
|
165
166
|
--output ./output \
|
|
166
167
|
--extract-html --extract-css \
|
|
168
|
+
--capture-hover true \
|
|
167
169
|
--full-page
|
|
168
170
|
|
|
169
171
|
# Step 2: Filter CSS
|
|
@@ -199,6 +201,8 @@ python3 $HOME/.claude/skills/ui-ux-pro-max/scripts/search.py "animation hover" -
|
|
|
199
201
|
python3 $HOME/.claude/skills/ui-ux-pro-max/scripts/search.py "z-index" --domain ux
|
|
200
202
|
```
|
|
201
203
|
|
|
204
|
+
**Note:** Step 1 includes `--capture-hover true` to capture interactive element states and generate `:hover` CSS rules. Outputs include `hover-states/` directory and `hover.css`.
|
|
205
|
+
|
|
202
206
|
## Quality Checklist (ui-ux-pro-max)
|
|
203
207
|
|
|
204
208
|
After generating HTML/CSS, verify these items using `ui-ux-pro-max` skill:
|
|
@@ -256,6 +260,73 @@ After generating HTML/CSS, verify these items using `ui-ux-pro-max` skill:
|
|
|
256
260
|
| Shibui (渋い) | Subtle elegance | Soft shadows, gentle transitions |
|
|
257
261
|
| Seijaku (静寂) | Tranquility | Calm colors, visual harmony |
|
|
258
262
|
|
|
263
|
+
## Animation & Interaction Capture (v1.2+)
|
|
264
|
+
|
|
265
|
+
### CSS Animations
|
|
266
|
+
|
|
267
|
+
Automatically extracts @keyframes and transition properties when using `--extract-css`:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
node src/core/screenshot.js --url https://example.com --output ./out --extract-css true
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Output:**
|
|
274
|
+
- `animations.css` - All @keyframes definitions with frame data
|
|
275
|
+
- `animation-tokens.json` - Detailed animation metadata (durations, timing functions)
|
|
276
|
+
|
|
277
|
+
### Hover State Capture
|
|
278
|
+
|
|
279
|
+
Capture interactive element hover states:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
node src/core/screenshot.js --url https://example.com --output ./out --capture-hover
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Output:**
|
|
286
|
+
- `hover-states/` - Before/after screenshots for each interactive element
|
|
287
|
+
- `hover.css` - Generated :hover rules from computed style differences
|
|
288
|
+
- `hover-diff.json` - Style diff data
|
|
289
|
+
|
|
290
|
+
**Detection Methods:**
|
|
291
|
+
1. CSS-based: Parses :hover selectors from extracted CSS
|
|
292
|
+
2. DOM-based: Queries buttons, links, and interactive elements
|
|
293
|
+
|
|
294
|
+
### Video Recording
|
|
295
|
+
|
|
296
|
+
Record scroll preview video (opt-in due to 3-5x capture time increase):
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# WebM (native, no extra deps)
|
|
300
|
+
node src/core/screenshot.js --url https://example.com --output ./out --video
|
|
301
|
+
|
|
302
|
+
# MP4 (requires ffmpeg)
|
|
303
|
+
node src/core/screenshot.js --url https://example.com --output ./out --video --video-format mp4
|
|
304
|
+
|
|
305
|
+
# GIF (requires ffmpeg)
|
|
306
|
+
node src/core/screenshot.js --url https://example.com --output ./out --video --video-format gif
|
|
307
|
+
|
|
308
|
+
# Custom duration (default: 12000ms)
|
|
309
|
+
node src/core/screenshot.js --url https://example.com --output ./out --video --video-duration 8000
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**Output:**
|
|
313
|
+
- `preview.webm` (default) or `preview.mp4` / `preview.gif`
|
|
314
|
+
|
|
315
|
+
**ffmpeg Setup (for MP4/GIF):**
|
|
316
|
+
```bash
|
|
317
|
+
npm install fluent-ffmpeg @ffmpeg-installer/ffmpeg
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Feature Flags Reference
|
|
321
|
+
|
|
322
|
+
| Flag | Default | Description |
|
|
323
|
+
|------|---------|-------------|
|
|
324
|
+
| `--extract-animations` | true (with --extract-css) | Extract @keyframes and transitions |
|
|
325
|
+
| `--capture-hover` | false | Capture hover state screenshots |
|
|
326
|
+
| `--video` | false | Record scroll preview video |
|
|
327
|
+
| `--video-format` | webm | Video format: webm, mp4, gif |
|
|
328
|
+
| `--video-duration` | 12000 | Video duration in ms |
|
|
329
|
+
|
|
259
330
|
## Environment Variables
|
|
260
331
|
|
|
261
332
|
Create `.env` file (see `.env.example`):
|
|
@@ -270,6 +341,9 @@ GEMINI_API_KEY=your-key # Optional: enables AI structure analysis
|
|
|
270
341
|
|--------|----------|---------|
|
|
271
342
|
| screenshot.js | src/core/ | Capture screenshots + extract HTML/CSS |
|
|
272
343
|
| filter-css.js | src/core/ | Filter unused CSS rules |
|
|
344
|
+
| animation-extractor.js | src/core/ | Extract @keyframes and transitions from CSS |
|
|
345
|
+
| state-capture.js | src/core/ | Capture hover states for interactive elements |
|
|
346
|
+
| video-capture.js | src/core/ | Record scroll preview video with optional ffmpeg conversion |
|
|
273
347
|
| extract-assets.js | src/core/ | Download images, fonts, icons |
|
|
274
348
|
| discover-pages.js | src/core/ | Discover navigation links |
|
|
275
349
|
| multi-page-screenshot.js | src/core/ | Capture multiple pages |
|
package/docs/cli-reference.md
CHANGED
|
@@ -22,10 +22,14 @@ node src/core/screenshot.js [options]
|
|
|
22
22
|
| --close | bool | false | Close browser after capture (false keeps session) |
|
|
23
23
|
| --extract-html | bool | false | Extract cleaned HTML |
|
|
24
24
|
| --extract-css | bool | false | Extract all CSS from page |
|
|
25
|
+
| --extract-animations | bool | true* | Extract @keyframes and transitions (enabled with --extract-css) |
|
|
25
26
|
| --filter-unused | bool | true | Filter CSS to remove unused selectors |
|
|
27
|
+
| --capture-hover | bool | false | Capture hover state screenshots and generate :hover CSS |
|
|
26
28
|
| --verbose | bool | false | Verbose logging |
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
*Default true when --extract-css is enabled, can be disabled with `--extract-animations false`
|
|
31
|
+
|
|
32
|
+
**Output**: JSON with screenshot paths and metadata. Includes `browserRestarts` count tracking for stability monitoring. When `--capture-hover` is enabled, also includes hover state results in output.
|
|
29
33
|
|
|
30
34
|
## filter-css.js
|
|
31
35
|
|
|
@@ -92,3 +96,23 @@ Verify layout consistency.
|
|
|
92
96
|
```bash
|
|
93
97
|
node src/verification/verify-layout.js --html FILE
|
|
94
98
|
```
|
|
99
|
+
|
|
100
|
+
## state-capture.js
|
|
101
|
+
|
|
102
|
+
Capture hover states for interactive elements.
|
|
103
|
+
|
|
104
|
+
Used internally by screenshot.js with `--capture-hover` flag.
|
|
105
|
+
|
|
106
|
+
| Export | Description |
|
|
107
|
+
|--------|-------------|
|
|
108
|
+
| `captureAllHoverStates(page, cssString, outputDir)` | Detect interactive elements and capture normal/hover screenshots |
|
|
109
|
+
| `captureHoverState(page, selector, outputDir, index)` | Capture hover state for a single element |
|
|
110
|
+
| `generateHoverCss(results)` | Generate `:hover` CSS rules from captured style diffs |
|
|
111
|
+
| `detectInteractiveElements(page, cssString)` | Detect interactive elements via CSS analysis and DOM query |
|
|
112
|
+
|
|
113
|
+
**Key Features:**
|
|
114
|
+
- Dual detection: CSS-based (`:hover` selectors) and DOM-based (interactive elements, transitions)
|
|
115
|
+
- Per-element style diff capture (backgroundColor, color, transform, boxShadow, etc.)
|
|
116
|
+
- Automatic screenshot pair generation (normal + hover states)
|
|
117
|
+
- CSS rule generation from detected style changes
|
|
118
|
+
- Validates selectors and skips hidden/invisible elements
|
|
@@ -131,6 +131,8 @@ Both Node.js and Python share same resolution order:
|
|
|
131
131
|
| Script | Location | Language | Purpose |
|
|
132
132
|
|--------|----------|----------|---------|
|
|
133
133
|
| screenshot.js | src/core/ | Node.js | Screenshot capture, HTML/CSS extraction |
|
|
134
|
+
| animation-extractor.js | src/core/ | Node.js | Extract @keyframes, transitions, animation properties |
|
|
135
|
+
| state-capture.js | src/core/ | Node.js | Capture hover states for interactive elements |
|
|
134
136
|
| filter-css.js | src/core/ | Node.js | Remove unused CSS selectors |
|
|
135
137
|
| extract-assets.js | src/core/ | Node.js | Download images, fonts, icons |
|
|
136
138
|
| analyze-structure.py | src/ai/ | Python | Gemini AI structure analysis |
|
|
@@ -179,42 +181,68 @@ bin/
|
|
|
179
181
|
### design:clone
|
|
180
182
|
|
|
181
183
|
```
|
|
182
|
-
URL → src/core/screenshot.js
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
→ src/core/filter-css.js
|
|
184
|
+
URL → src/core/screenshot.js → Screenshots (3 viewports)
|
|
185
|
+
→ source.html (cleaned)
|
|
186
|
+
→ source-raw.css
|
|
187
|
+
→ src/core/filter-css.js → source.css (filtered)
|
|
188
|
+
→ src/core/animation-extractor → animations.css
|
|
189
|
+
→ animation-tokens.json
|
|
190
|
+
→ src/core/state-capture.js* → hover-states/ (hover screenshots)
|
|
191
|
+
→ hover.css (generated :hover rules)
|
|
186
192
|
```
|
|
187
193
|
|
|
194
|
+
*Enabled with `--capture-hover true` flag
|
|
195
|
+
|
|
188
196
|
### design:clone-px
|
|
189
197
|
|
|
190
198
|
```
|
|
191
|
-
URL → src/core/screenshot.js
|
|
192
|
-
→ src/core/filter-css.js
|
|
193
|
-
→ src/core/
|
|
194
|
-
→ src/
|
|
195
|
-
→ src/
|
|
196
|
-
→ src/
|
|
199
|
+
URL → src/core/screenshot.js → Screenshots + HTML/CSS
|
|
200
|
+
→ src/core/filter-css.js → Filtered CSS
|
|
201
|
+
→ src/core/animation-extractor → animations.css, animation-tokens.json
|
|
202
|
+
→ src/core/state-capture.js* → hover-states/, hover.css
|
|
203
|
+
→ src/core/extract-assets.js → assets/ (images, fonts, icons)
|
|
204
|
+
→ src/ai/analyze-structure.py → structure.md (AI analysis)
|
|
205
|
+
→ src/ai/extract-design-tokens.py → tokens.json, tokens.css
|
|
206
|
+
→ src/verification/verify-menu.js → Menu validation report
|
|
197
207
|
```
|
|
198
208
|
|
|
209
|
+
*Hover state capture enabled by default in design:clone-px workflow
|
|
210
|
+
|
|
199
211
|
## Output Structure
|
|
200
212
|
|
|
201
213
|
```
|
|
202
214
|
cloned-design/
|
|
203
|
-
├── desktop.png
|
|
204
|
-
├── tablet.png
|
|
205
|
-
├── mobile.png
|
|
206
|
-
├── source.html
|
|
207
|
-
├── source.css
|
|
208
|
-
├── source-raw.css
|
|
209
|
-
├──
|
|
210
|
-
├── tokens.json
|
|
211
|
-
├──
|
|
215
|
+
├── desktop.png # 1920x1080
|
|
216
|
+
├── tablet.png # 768x1024
|
|
217
|
+
├── mobile.png # 375x812
|
|
218
|
+
├── source.html # Cleaned HTML
|
|
219
|
+
├── source.css # Filtered CSS
|
|
220
|
+
├── source-raw.css # Original CSS
|
|
221
|
+
├── animations.css # Extracted @keyframes definitions
|
|
222
|
+
├── animation-tokens.json # Animation metadata (keyframes, transitions, timings)
|
|
223
|
+
├── hover.css # Generated :hover CSS rules (when --capture-hover)
|
|
224
|
+
├── structure.md # AI analysis (optional)
|
|
225
|
+
├── tokens.json # Design tokens
|
|
226
|
+
├── tokens.css # CSS variables
|
|
227
|
+
├── hover-states/ # Hover state captures (when --capture-hover)
|
|
228
|
+
│ ├── hover-0-normal.png # Element before hover
|
|
229
|
+
│ ├── hover-0-hover.png # Element during hover
|
|
230
|
+
│ ├── hover-1-normal.png # ...
|
|
231
|
+
│ ├── hover-1-hover.png
|
|
232
|
+
│ └── hover-diff.json # Summary of detected and captured elements
|
|
212
233
|
└── assets/
|
|
213
234
|
├── images/
|
|
214
235
|
├── fonts/
|
|
215
236
|
└── icons/
|
|
216
237
|
```
|
|
217
238
|
|
|
239
|
+
**Hover State Output** (when `--capture-hover true`):
|
|
240
|
+
- `hover-states/`: Directory containing hover state captures
|
|
241
|
+
- `hover-N-normal.png`: Screenshot of element in normal state
|
|
242
|
+
- `hover-N-hover.png`: Screenshot of element with hover state applied
|
|
243
|
+
- `hover-diff.json`: Summary with detected count, captured count, and style differences for each element
|
|
244
|
+
- `hover.css`: Generated CSS rules with `:hover` selectors extracted from style diffs
|
|
245
|
+
|
|
218
246
|
## Dependencies
|
|
219
247
|
|
|
220
248
|
### Node.js (package.json)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "design-clone",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Claude Code skill for cloning website designs via multi-viewport screenshots, HTML/CSS extraction, and Gemini AI analysis",
|
|
6
6
|
"bin": {
|
|
@@ -54,5 +54,9 @@
|
|
|
54
54
|
"puppeteer": {
|
|
55
55
|
"optional": true
|
|
56
56
|
}
|
|
57
|
+
},
|
|
58
|
+
"optionalDependencies": {
|
|
59
|
+
"fluent-ffmpeg": "^2.1.2",
|
|
60
|
+
"@ffmpeg-installer/ffmpeg": "^1.1.0"
|
|
57
61
|
}
|
|
58
62
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|