@dannote/figma-use 0.6.1 → 0.6.2
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/CHANGELOG.md +26 -1
- package/README.md +18 -0
- package/SKILL.md +52 -35
- package/dist/cli/index.js +264 -154
- package/dist/proxy/index.js +19 -20
- package/package.json +5 -1
- package/packages/cli/src/render/component-set.tsx +30 -21
- package/packages/cli/src/render/components.tsx +40 -16
- package/packages/cli/src/render/index.ts +14 -14
- package/packages/cli/src/render/reconciler.ts +222 -190
- package/packages/cli/src/render/vars.ts +23 -22
- package/packages/plugin/dist/main.js +168 -55
- package/packages/plugin/dist/ui.html +23 -18
- package/packages/plugin/dist/ui.js +44 -43
package/CHANGELOG.md
CHANGED
|
@@ -7,8 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.2] - 2026-01-19
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `bun run format` — format code with oxfmt
|
|
15
|
+
- `bun run lint` — lint code with oxlint
|
|
16
|
+
|
|
10
17
|
## [0.6.1] - 2026-01-19
|
|
11
18
|
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **`diff` commands** (experimental) — incremental updates via unified diff patches
|
|
22
|
+
- `diff create --from <id> --to <id>` — compare two node trees and generate patch
|
|
23
|
+
- `diff apply` — apply a patch to Figma nodes (validates old values!)
|
|
24
|
+
- `diff show` — show diff between current state and new properties
|
|
25
|
+
```bash
|
|
26
|
+
# Compare two frames (e.g., before/after, A/B variants)
|
|
27
|
+
figma-use diff create --from 123:456 --to 789:012
|
|
28
|
+
|
|
29
|
+
# Apply patch (validates old values match)
|
|
30
|
+
figma-use diff apply --stdin < patch.diff
|
|
31
|
+
|
|
32
|
+
# Dry run
|
|
33
|
+
figma-use diff apply --stdin --dry-run < patch.diff
|
|
34
|
+
```
|
|
35
|
+
- Uses `diff` library for unified diff parsing and validation
|
|
36
|
+
|
|
12
37
|
### Fixed
|
|
13
38
|
|
|
14
39
|
- `--timeout` now applies to single commands (e.g., `eval`) via proxy `/command`
|
|
@@ -222,7 +247,7 @@ the same batch. See `component-set.tsx` for detailed explanation.
|
|
|
222
247
|
- From stdin: `echo '<Frame style={{...}} />' | figma-use render --stdin`
|
|
223
248
|
- With props: `--props '{"title": "Hello"}'`
|
|
224
249
|
- Into parent: `--parent "1:23"`
|
|
225
|
-
- Dry run: `--
|
|
250
|
+
- Dry run: `--dry-run` outputs NodeChanges JSON
|
|
226
251
|
- **Multiplayer WebSocket connection pooling** in proxy
|
|
227
252
|
- First render: ~4s (establishes connection)
|
|
228
253
|
- Subsequent renders: ~0.4s (10x faster!)
|
package/README.md
CHANGED
|
@@ -304,6 +304,24 @@ figma-use me # Current user info
|
|
|
304
304
|
figma-use file info # File key and name
|
|
305
305
|
```
|
|
306
306
|
|
|
307
|
+
### Diff (Experimental)
|
|
308
|
+
|
|
309
|
+
Compare two frames and generate a unified diff patch:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Compare original vs modified version
|
|
313
|
+
figma-use diff create --from 123:456 --to 789:012
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Apply patch with validation (fails if current state doesn't match expected):
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
figma-use diff apply patch.diff # Apply from file
|
|
320
|
+
figma-use diff apply --stdin < patch.diff # Apply from stdin
|
|
321
|
+
figma-use diff apply patch.diff --dry-run # Preview changes
|
|
322
|
+
figma-use diff apply patch.diff --force # Skip validation
|
|
323
|
+
```
|
|
324
|
+
|
|
307
325
|
### Escape Hatch
|
|
308
326
|
|
|
309
327
|
```bash
|
package/SKILL.md
CHANGED
|
@@ -34,57 +34,74 @@ figma-use plugin install
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
## ⚠️ Incremental Updates (
|
|
37
|
+
## ⚠️ Incremental Updates via Diff (Experimental)
|
|
38
38
|
|
|
39
39
|
**After initial render, NEVER re-render the full JSX tree.**
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
1. Save node IDs from the initial render (`--json` output)
|
|
43
|
-
2. Use targeted CLI commands to modify individual nodes
|
|
44
|
-
3. Only re-render if the structure fundamentally changes (>50% new elements)
|
|
41
|
+
Use unified diff patches to apply targeted changes with validation:
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
figma-use set fill <id> "#FF0000" # Change color
|
|
49
|
-
figma-use set opacity <id> 0.5 # Change opacity
|
|
50
|
-
figma-use set radius <id> 12 # Change corner radius
|
|
51
|
-
figma-use node resize <id> --width 300 --height 200
|
|
52
|
-
figma-use node move <id> --x 100 --y 200
|
|
53
|
-
figma-use node rename <id> "New Name"
|
|
54
|
-
```
|
|
43
|
+
> ⚠️ **Experimental:** `diff` commands are new and may change.
|
|
55
44
|
|
|
56
|
-
###
|
|
45
|
+
### Compare two frames and generate patch
|
|
57
46
|
```bash
|
|
58
|
-
|
|
59
|
-
figma-use create
|
|
47
|
+
# Compare original vs modified version
|
|
48
|
+
figma-use diff create --from 123:456 --to 789:012
|
|
60
49
|
```
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
51
|
+
Output (unified diff format):
|
|
52
|
+
```diff
|
|
53
|
+
--- /Card/Header #123:457
|
|
54
|
+
+++ /Card/Header #789:013
|
|
55
|
+
@@ -1,5 +1,5 @@
|
|
56
|
+
type: FRAME
|
|
57
|
+
size: 200 50
|
|
58
|
+
pos: 0 0
|
|
59
|
+
-fill: #FFFFFF
|
|
60
|
+
+fill: #F0F0F0
|
|
61
|
+
-opacity: 0.8
|
|
62
|
+
+opacity: 1
|
|
65
63
|
```
|
|
66
64
|
|
|
67
|
-
###
|
|
65
|
+
### Apply patch (validates old values!)
|
|
68
66
|
```bash
|
|
69
|
-
#
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
# Dry run — preview changes
|
|
68
|
+
figma-use diff apply patch.diff --dry-run
|
|
69
|
+
|
|
70
|
+
# Apply changes (fails if old values don't match)
|
|
71
|
+
figma-use diff apply patch.diff
|
|
73
72
|
|
|
74
|
-
#
|
|
75
|
-
figma-use
|
|
73
|
+
# Force apply (skip validation)
|
|
74
|
+
figma-use diff apply patch.diff --force
|
|
75
|
+
|
|
76
|
+
# From stdin
|
|
77
|
+
cat patch.diff | figma-use diff apply --stdin
|
|
76
78
|
```
|
|
77
79
|
|
|
78
|
-
###
|
|
79
|
-
```bash
|
|
80
|
-
# Change shadow color from black to warm orange
|
|
81
|
-
figma-use set fill 123:789 "#D97706"
|
|
80
|
+
### Workflow: Iterative design with critique
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
1. **Render initial design:**
|
|
83
|
+
```bash
|
|
84
|
+
cat design.jsx | figma-use render --stdin --json > nodes.json
|
|
85
|
+
```
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
2. **Get critique, then generate patch:**
|
|
88
|
+
```bash
|
|
89
|
+
# Clone and modify (or compare to another frame)
|
|
90
|
+
figma-use diff create --from <original> --to <modified>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
3. **Apply patch to original:**
|
|
94
|
+
```bash
|
|
95
|
+
figma-use diff apply --stdin < changes.diff
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Direct commands (for simple changes)
|
|
99
|
+
```bash
|
|
100
|
+
figma-use set fill <id> "#FF0000"
|
|
101
|
+
figma-use set opacity <id> 0.5
|
|
102
|
+
figma-use node resize <id> --width 300 --height 200
|
|
103
|
+
figma-use node move <id> --x 100 --y 200
|
|
104
|
+
figma-use node delete <id>
|
|
88
105
|
```
|
|
89
106
|
|
|
90
107
|
---
|