figmatk 0.0.19 → 0.1.1

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.19",
16
+ "version": "0.1.1",
17
17
  "author": {
18
18
  "name": "FigmaTK Contributors"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figmatk",
3
- "version": "0.0.19",
3
+ "version": "0.1.1",
4
4
  "description": "Create and edit Figma Slides .deck files programmatically — no Figma API required",
5
5
  "author": {
6
6
  "name": "FigmaTK Contributors"
package/lib/api.mjs CHANGED
@@ -617,10 +617,15 @@ export class Slide {
617
617
  * @param {number} [opts.cornerRadius]- Corner radius (default: 0)
618
618
  * @returns {Promise<object>} the raw node
619
619
  */
620
- async addImage(x, y, width, height, pathOrBuf, opts = {}) {
620
+ async addImage(pathOrBuf, opts = {}) {
621
621
  const fd = this._fd;
622
622
  const localID = fd.maxLocalID() + 1;
623
623
 
624
+ const x = opts.x ?? 0;
625
+ const y = opts.y ?? 0;
626
+ const width = opts.width ?? 1920;
627
+ const height = opts.height ?? 1080;
628
+
624
629
  const imgBuf = typeof pathOrBuf === 'string'
625
630
  ? readFileSync(resolve(pathOrBuf))
626
631
  : pathOrBuf;
@@ -1586,8 +1591,8 @@ class FrameProxy {
1586
1591
  return Slide.prototype.addRectangle.call(this, x, y, width, height, opts);
1587
1592
  }
1588
1593
 
1589
- async addImage(x, y, width, height, pathOrBuf, opts = {}) {
1590
- return Slide.prototype.addImage.call(this, x, y, width, height, pathOrBuf, opts);
1594
+ async addImage(pathOrBuf, opts = {}) {
1595
+ return Slide.prototype.addImage.call(this, pathOrBuf, opts);
1591
1596
  }
1592
1597
  }
1593
1598
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figmatk",
3
- "version": "0.0.19",
3
+ "version": "0.1.1",
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.19"
9
+ version: "0.1.1"
10
10
  ---
11
11
 
12
12
  # Figma Slides Creator
@@ -45,7 +45,7 @@ Use this when the user wants a new presentation. Follow these steps **in order,
45
45
  The environment has no `node_modules`. **Before writing any script**, run this exact command:
46
46
 
47
47
  ```bash
48
- mkdir -p /tmp/figmatk-ws && cd /tmp/figmatk-ws && npm init -y && npm install figmatk
48
+ [ -d /tmp/figmatk-ws/node_modules ] || (mkdir -p /tmp/figmatk-ws && cd /tmp/figmatk-ws && npm init -y && npm install figmatk)
49
49
  ```
50
50
 
51
51
  Do not proceed to Step 2 until this command succeeds.
@@ -100,7 +100,8 @@ If this fails, check the error and fix the script — **do not change the worksp
100
100
  | Shape fill color | `{ fill: '#F4900C' }` | `{ fill: hex('#F4900C') }` — use the hex() helper |
101
101
  | `addLine` options | `{ strokeColor: ..., strokeWeight: 2 }` | `{ color: 'Black', weight: 2 }` |
102
102
  | `align` value | `align: 'left'` | `align: 'LEFT'` (uppercase) |
103
- | `addImage` without await | `slide.addImage(...)` | `await slide.addImage(...)` — async, images silently missing without await |
103
+ | `addImage` without await | `slide.addImage('/tmp/photo.jpg')` | `await slide.addImage('/tmp/photo.jpg')` — async, images silently missing without await |
104
+ | `addImage` old signature | `await slide.addImage(x, y, w, h, path)` | `await slide.addImage(path, { x, y, width, height })` — path is first arg now |
104
105
 
105
106
  ### Hex color helper (for shape fills)
106
107
 
@@ -152,7 +153,7 @@ slide.addDiamond(x, y, width, height, opts)
152
153
  slide.addTriangle(x, y, width, height, opts)
153
154
  slide.addStar(x, y, width, height, opts)
154
155
  slide.addLine(x1, y1, x2, y2, opts) // opts: color, weight
155
- await slide.addImage(x, y, width, height, pathOrBuf, opts) // ⚠️ ASYNC — must use await, opts: cornerRadius, opacity
156
+ await slide.addImage(pathOrBuf, opts) // ⚠️ ASYNC — must use await; opts: x, y, width, height (default: full slide 1920×1080), cornerRadius, opacity
156
157
  slide.addTable(data, opts) // 2D string array; opts: x, y, width, colWidths, rowHeight
157
158
  slide.addSVG(x, y, width, svgPathOrBuf, opts)
158
159
  ```