figmatk 0.0.12 → 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.
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "name": "figmatk",
15
15
  "description": "Swiss Army Knife for Figma Files (.deck)",
16
- "version": "0.0.12",
16
+ "version": "0.0.14",
17
17
  "author": {
18
18
  "name": "FigmaTK Contributors"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figmatk",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Create and edit Figma Slides .deck files programmatically — no Figma API required",
5
5
  "author": {
6
6
  "name": "FigmaTK Contributors"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figmatk",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Figma Toolkit — Swiss-army knife CLI for Figma .deck and .fig files",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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.12"
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. Write a Node.js script and execute it.
35
+ Use this when the user wants a new presentation. Follow these steps **in order, every time, no exceptions**.
36
36
 
37
- ### Setup (required before running any script)
37
+ ### Step 1 — Set up workspace (MANDATORY FIRST STEP never skip)
38
38
 
39
- The plugin cache does not include `node_modules`. Always install figmatk into a local workspace first:
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
- Then write your script inside `/tmp/figmatk-ws/` and run it from there:
45
+ Do not proceed to Step 2 until this command succeeds.
46
46
 
47
- ```bash
48
- node /tmp/figmatk-ws/my-deck.mjs
49
- ```
47
+ ### Step 2 — Write the script to `/tmp/figmatk-ws/deck.mjs`
50
48
 
51
- > **Import:** always use the bare specifier `import { Deck } from 'figmatk'`Node will resolve it from the local `node_modules` in the workspace.
49
+ **Always write the script to `/tmp/figmatk-ws/deck.mjs`**not to the current directory, not to any other path.
50
+
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
- const slide = deck.addBlankSlide(); // template blank slide auto-removed
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('/path/to/output.deck');
75
+ await deck.save('/tmp/my-presentation.deck');
76
+ console.log('Done — open /tmp/my-presentation.deck in Figma Desktop');
70
77
  ```
71
78
 
79
+ ### Step 3 — Run the script
80
+
81
+ ```bash
82
+ node /tmp/figmatk-ws/deck.mjs
83
+ ```
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 |
@@ -102,13 +117,17 @@ function hex(h) {
102
117
  | `Body 3` | 24pt | Regular | Captions, labels |
103
118
  | `Note` | 20pt | Regular | Footnotes, sources |
104
119
 
105
- ### Named colors for `setBackground()`
120
+ ### Colors for `setBackground()`
121
+
122
+ Accepts named colors, hex strings, or designer aliases — **when using figmatk 0.0.12+ from the workspace install**.
106
123
 
107
- > **Case-sensitive.** `'Black'` works, `'black'` does not.
124
+ **Named colors** (case-sensitive, from the Light Slides theme):
108
125
 
109
126
  `'Black'`, `'White'`, `'Grey'`, `'Blue'`, `'Red'`, `'Yellow'`, `'Green'`, `'Orange'`, `'Pink'`, `'Purple'`, `'Teal'`, `'Violet'`, `'Persimmon'`, `'Pale Pink'`, `'Pale Blue'`, `'Pale Green'`, `'Pale Teal'`, `'Pale Purple'`, `'Pale Persimmon'`, `'Pale Violet'`, `'Pale Red'`, `'Pale Yellow'`
110
127
 
111
- Use `'Black'` for dark backgrounds, `'White'` for light. For custom slide backgrounds, use the closest named color — **not hex**.
128
+ **Hex strings** (0.0.12+): `slide.setBackground('#C8102E')`
129
+
130
+ **Designer aliases** (0.0.12+): `slide.setBackground('navy')`, `slide.setBackground('coral')`, `slide.setBackground('terracotta')` etc.
112
131
 
113
132
  ### Slide dimensions
114
133