figmatk 0.0.13 → 0.0.14
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/package.json
CHANGED
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
clone or remove slides, or produce a .deck file for Figma Slides.
|
|
7
7
|
Powered by FigmaTK under the hood.
|
|
8
8
|
metadata:
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.14"
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# FigmaTK Skill
|
|
@@ -32,30 +32,36 @@ To let the user view the result: tell them to **open the file in Figma Desktop**
|
|
|
32
32
|
|
|
33
33
|
## Path A — Create from Scratch (High-Level API)
|
|
34
34
|
|
|
35
|
-
Use this when the user wants a new presentation.
|
|
35
|
+
Use this when the user wants a new presentation. Follow these steps **in order, every time, no exceptions**.
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Step 1 — Set up workspace (MANDATORY FIRST STEP — never skip)
|
|
38
38
|
|
|
39
|
-
The
|
|
39
|
+
The environment has no `node_modules`. **Before writing any script**, run this exact command:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
mkdir -p /tmp/figmatk-ws && cd /tmp/figmatk-ws && npm init -y && npm install figmatk
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Do not proceed to Step 2 until this command succeeds.
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
### Step 2 — Write the script to `/tmp/figmatk-ws/deck.mjs`
|
|
48
|
+
|
|
49
|
+
**Always write the script to `/tmp/figmatk-ws/deck.mjs`** — not to the current directory, not to any other path.
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
**Always use the bare specifier** `import { Deck } from 'figmatk'` — never a file path import.
|
|
52
52
|
|
|
53
53
|
```javascript
|
|
54
54
|
import { Deck } from 'figmatk';
|
|
55
55
|
|
|
56
|
+
function hex(h) {
|
|
57
|
+
return { r: parseInt(h.slice(1,3),16)/255, g: parseInt(h.slice(3,5),16)/255, b: parseInt(h.slice(5,7),16)/255 };
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
const deck = await Deck.create('My Presentation');
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
// Each call to addBlankSlide() returns a new blank slide.
|
|
63
|
+
// The template blank slide is auto-removed on the first call.
|
|
64
|
+
const slide = deck.addBlankSlide();
|
|
59
65
|
slide.setBackground('Black'); // named color — see list below
|
|
60
66
|
slide.addText('Slide Title', {
|
|
61
67
|
style: 'Title', color: 'White',
|
|
@@ -66,9 +72,18 @@ slide.addText('Subtitle', {
|
|
|
66
72
|
x: 64, y: 240, width: 1200, align: 'LEFT'
|
|
67
73
|
});
|
|
68
74
|
|
|
69
|
-
await deck.save('/
|
|
75
|
+
await deck.save('/tmp/my-presentation.deck');
|
|
76
|
+
console.log('Done — open /tmp/my-presentation.deck in Figma Desktop');
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Step 3 — Run the script
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
node /tmp/figmatk-ws/deck.mjs
|
|
70
83
|
```
|
|
71
84
|
|
|
85
|
+
If this fails, check the error and fix the script — **do not change the workspace setup or the import path**.
|
|
86
|
+
|
|
72
87
|
### ⚠️ Critical gotchas
|
|
73
88
|
|
|
74
89
|
| Issue | Wrong | Right |
|