@dannote/figma-use 0.6.0 → 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 +34 -1
- package/README.md +34 -3
- package/SKILL.md +72 -0
- package/bin/figma-use.js +1 -4
- package/dist/cli/index.js +22348 -20440
- package/dist/proxy/index.js +25 -25
- package/package.json +7 -3
- 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,6 +7,39 @@ 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
|
+
|
|
17
|
+
## [0.6.1] - 2026-01-19
|
|
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
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- `--timeout` now applies to single commands (e.g., `eval`) via proxy `/command`
|
|
40
|
+
- CLI now works after global install ([#1](https://github.com/dannote/figma-use/issues/1))
|
|
41
|
+
- Move `kiwi-schema` to devDependencies (already bundled into dist)
|
|
42
|
+
|
|
10
43
|
## [0.6.0] - 2026-01-18
|
|
11
44
|
|
|
12
45
|
### Added
|
|
@@ -214,7 +247,7 @@ the same batch. See `component-set.tsx` for detailed explanation.
|
|
|
214
247
|
- From stdin: `echo '<Frame style={{...}} />' | figma-use render --stdin`
|
|
215
248
|
- With props: `--props '{"title": "Hello"}'`
|
|
216
249
|
- Into parent: `--parent "1:23"`
|
|
217
|
-
- Dry run: `--
|
|
250
|
+
- Dry run: `--dry-run` outputs NodeChanges JSON
|
|
218
251
|
- **Multiplayer WebSocket connection pooling** in proxy
|
|
219
252
|
- First render: ~4s (establishes connection)
|
|
220
253
|
- Subsequent renders: ~0.4s (10x faster!)
|
package/README.md
CHANGED
|
@@ -12,11 +12,24 @@ No JSON schemas, no MCP protocol overhead — just JSX that any LLM can write.
|
|
|
12
12
|
|
|
13
13
|
📄 **Includes [SKILL.md](./SKILL.md)** — drop-in reference for Claude Code and other AI agents.
|
|
14
14
|
|
|
15
|
+
## Demo
|
|
16
|
+
|
|
17
|
+
<table>
|
|
18
|
+
<tr>
|
|
19
|
+
<td width="50%">
|
|
15
20
|
<a href="https://youtu.be/9eSYVZRle7o">
|
|
16
|
-
|
|
21
|
+
<img src="https://img.youtube.com/vi/9eSYVZRle7o/maxresdefault.jpg" alt="Button components demo" width="100%">
|
|
17
22
|
</a>
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
<p align="center"><b>▶️ Button components</b></p>
|
|
24
|
+
</td>
|
|
25
|
+
<td width="50%">
|
|
26
|
+
<a href="https://youtu.be/efJWp2Drzb4">
|
|
27
|
+
<img src="https://img.youtube.com/vi/efJWp2Drzb4/maxresdefault.jpg" alt="Calendar demo" width="100%">
|
|
28
|
+
</a>
|
|
29
|
+
<p align="center"><b>▶️ Tailwind UI calendar</b></p>
|
|
30
|
+
</td>
|
|
31
|
+
</tr>
|
|
32
|
+
</table>
|
|
20
33
|
|
|
21
34
|
## Why CLI over MCP?
|
|
22
35
|
|
|
@@ -291,6 +304,24 @@ figma-use me # Current user info
|
|
|
291
304
|
figma-use file info # File key and name
|
|
292
305
|
```
|
|
293
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
|
+
|
|
294
325
|
### Escape Hatch
|
|
295
326
|
|
|
296
327
|
```bash
|
package/SKILL.md
CHANGED
|
@@ -34,6 +34,78 @@ figma-use plugin install
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
+
## ⚠️ Incremental Updates via Diff (Experimental)
|
|
38
|
+
|
|
39
|
+
**After initial render, NEVER re-render the full JSX tree.**
|
|
40
|
+
|
|
41
|
+
Use unified diff patches to apply targeted changes with validation:
|
|
42
|
+
|
|
43
|
+
> ⚠️ **Experimental:** `diff` commands are new and may change.
|
|
44
|
+
|
|
45
|
+
### Compare two frames and generate patch
|
|
46
|
+
```bash
|
|
47
|
+
# Compare original vs modified version
|
|
48
|
+
figma-use diff create --from 123:456 --to 789:012
|
|
49
|
+
```
|
|
50
|
+
|
|
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
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Apply patch (validates old values!)
|
|
66
|
+
```bash
|
|
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
|
|
72
|
+
|
|
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
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Workflow: Iterative design with critique
|
|
81
|
+
|
|
82
|
+
1. **Render initial design:**
|
|
83
|
+
```bash
|
|
84
|
+
cat design.jsx | figma-use render --stdin --json > nodes.json
|
|
85
|
+
```
|
|
86
|
+
|
|
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>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
37
109
|
## JSX Rendering (Fastest Way)
|
|
38
110
|
|
|
39
111
|
Use `render --stdin` with **pure JSX only**. No variables, no functions, no imports — just JSX tags:
|
package/bin/figma-use.js
CHANGED
|
@@ -4,10 +4,7 @@ import { fileURLToPath } from 'url'
|
|
|
4
4
|
import { dirname, join } from 'path'
|
|
5
5
|
|
|
6
6
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
7
|
-
|
|
8
|
-
// Use source files directly (Bun handles TypeScript)
|
|
9
|
-
// This ensures defineComponent registry is shared with imported .figma.tsx files
|
|
10
|
-
const cliPath = join(__dirname, '..', 'packages', 'cli', 'src', 'index.ts')
|
|
7
|
+
const cliPath = join(__dirname, '..', 'dist', 'cli', 'index.js')
|
|
11
8
|
|
|
12
9
|
const child = spawn('bun', ['run', cliPath, ...process.argv.slice(2)], { stdio: 'inherit' })
|
|
13
10
|
child.on('exit', (code) => process.exit(code || 0))
|