@kitschpatrol/tldraw-cli 4.6.29 → 4.6.31

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.
Files changed (68) hide show
  1. package/bin/cli.js +123 -154
  2. package/dist/lib/index.d.ts +0 -1
  3. package/dist/lib/index.js +114 -151
  4. package/dist/lib/local-tldraw-server.d.ts +1 -1
  5. package/dist/lib/tldraw-controller.d.ts +9 -11
  6. package/dist/lib/tldraw-open.d.ts +3 -0
  7. package/dist/lib/tldraw-to-image.d.ts +3 -0
  8. package/dist/lib/validation.d.ts +3 -0
  9. package/dist/tldraw/assets/index-BDQS5y6_.js +423 -0
  10. package/dist/tldraw/assets/index-BkIYKf7d.css +1 -0
  11. package/dist/tldraw/index.html +2 -2
  12. package/dist/tldraw/translations/ar.json +91 -10
  13. package/dist/tldraw/translations/bn.json +376 -0
  14. package/dist/tldraw/translations/ca.json +91 -10
  15. package/dist/tldraw/translations/cs.json +65 -41
  16. package/dist/tldraw/translations/da.json +15 -36
  17. package/dist/tldraw/translations/de.json +80 -14
  18. package/dist/tldraw/translations/el.json +376 -0
  19. package/dist/tldraw/translations/es.json +87 -10
  20. package/dist/tldraw/translations/fa.json +13 -21
  21. package/dist/tldraw/translations/fi.json +84 -20
  22. package/dist/tldraw/translations/fr.json +25 -21
  23. package/dist/tldraw/translations/gl.json +45 -18
  24. package/dist/tldraw/translations/gu-in.json +376 -0
  25. package/dist/tldraw/translations/he.json +348 -58
  26. package/dist/tldraw/translations/hi-in.json +96 -10
  27. package/dist/tldraw/translations/hr.json +36 -18
  28. package/dist/tldraw/translations/hu.json +31 -20
  29. package/dist/tldraw/translations/id.json +117 -114
  30. package/dist/tldraw/translations/it.json +56 -10
  31. package/dist/tldraw/translations/ja.json +43 -18
  32. package/dist/tldraw/translations/km-kh.json +376 -0
  33. package/dist/tldraw/translations/kn.json +376 -0
  34. package/dist/tldraw/translations/ko-kr.json +3 -24
  35. package/dist/tldraw/translations/languages.json +56 -12
  36. package/dist/tldraw/translations/main.json +13 -34
  37. package/dist/tldraw/translations/ml.json +376 -0
  38. package/dist/tldraw/translations/mr.json +376 -0
  39. package/dist/tldraw/translations/ms.json +376 -0
  40. package/dist/tldraw/translations/ne.json +91 -10
  41. package/dist/tldraw/translations/nl.json +376 -0
  42. package/dist/tldraw/translations/no.json +334 -20
  43. package/dist/tldraw/translations/pa.json +376 -0
  44. package/dist/tldraw/translations/pl.json +36 -57
  45. package/dist/tldraw/translations/pt-br.json +279 -236
  46. package/dist/tldraw/translations/pt-pt.json +320 -30
  47. package/dist/tldraw/translations/ro.json +26 -21
  48. package/dist/tldraw/translations/ru.json +27 -26
  49. package/dist/tldraw/translations/sl.json +24 -21
  50. package/dist/tldraw/translations/so.json +14 -35
  51. package/dist/tldraw/translations/sv.json +330 -50
  52. package/dist/tldraw/translations/ta.json +376 -0
  53. package/dist/tldraw/translations/te.json +302 -38
  54. package/dist/tldraw/translations/th.json +95 -14
  55. package/dist/tldraw/translations/tl.json +376 -0
  56. package/dist/tldraw/translations/tr.json +44 -23
  57. package/dist/tldraw/translations/uk.json +25 -24
  58. package/dist/tldraw/translations/ur.json +376 -0
  59. package/dist/tldraw/translations/vi.json +101 -20
  60. package/dist/tldraw/translations/zh-cn.json +13 -23
  61. package/dist/tldraw/translations/zh-tw.json +53 -17
  62. package/license.txt +1 -1
  63. package/package.json +42 -42
  64. package/readme.md +17 -27
  65. package/dist/.DS_Store +0 -0
  66. package/dist/lib/tldraw-to-share-url.d.ts +0 -1
  67. package/dist/tldraw/assets/index-B6B9QXXc.js +0 -425
  68. package/dist/tldraw/assets/index-DZaxLi12.css +0 -1
@@ -13,8 +13,6 @@
13
13
  "action.convert-to-bookmark": "轉換為書籤",
14
14
  "action.convert-to-embed": "轉換為嵌入",
15
15
  "action.copy": "複製",
16
- "action.copy-as-json": "複製為 JSON",
17
- "action.copy-as-json.short": "JSON",
18
16
  "action.copy-as-png": "複製為 PNG",
19
17
  "action.copy-as-png.short": "PNG",
20
18
  "action.copy-as-svg": "複製為 SVG",
@@ -28,31 +26,35 @@
28
26
  "action.duplicate": "複製",
29
27
  "action.edit-link": "編輯連結",
30
28
  "action.exit-pen-mode": "退出畫筆模式",
31
- "action.export-all-as-json": "全部匯出成 JSON",
32
- "action.export-all-as-json.short": "JSON",
33
29
  "action.export-all-as-png": "全部匯出成 PNG",
34
30
  "action.export-all-as-png.short": "PNG",
35
31
  "action.export-all-as-svg": "全部匯出成 SVG",
36
32
  "action.export-all-as-svg.short": "SVG",
37
- "action.export-as-json": "匯出成 JSON",
38
- "action.export-as-json.short": "JSON",
39
33
  "action.export-as-png": "匯出成 PNG",
40
34
  "action.export-as-png.short": "PNG",
41
35
  "action.export-as-svg": "匯出成 SVG",
42
36
  "action.export-as-svg.short": "SVG",
43
37
  "action.fit-frame-to-content": "貼合內容大小",
38
+ "action.flatten-to-image": "平鋪",
44
39
  "action.flip-horizontal": "水平翻轉",
45
40
  "action.flip-horizontal.short": "水平翻轉",
46
41
  "action.flip-vertical": "垂直翻轉",
47
42
  "action.flip-vertical.short": "垂直翻轉",
43
+ "action.fork-project": "分叉此專案",
44
+ "action.fork-project-on-tldraw": "在 tldraw 上分叉專案",
48
45
  "action.group": "群組",
46
+ "action.insert-embed": "插入嵌入",
49
47
  "action.insert-media": "上傳媒體檔",
48
+ "action.leave-shared-project": "離開共享專案",
50
49
  "action.new-project": "新建專案",
51
50
  "action.new-shared-project": "新建共享專案",
51
+ "action.open-cursor-chat": "Cursor chat",
52
52
  "action.open-embed-link": "開啟連結",
53
53
  "action.open-file": "開啟檔案",
54
54
  "action.pack": "打包",
55
55
  "action.paste": "貼上",
56
+ "action.paste-error-description": "由於沒有剪貼簿權限而無法貼上。請啟用權限並重試。",
57
+ "action.paste-error-title": "貼上失敗",
56
58
  "action.print": "列印",
57
59
  "action.redo": "取消復原",
58
60
  "action.remove-frame": "移除框架",
@@ -79,10 +81,19 @@
79
81
  "action.toggle-dark-mode.menu": "深色模式",
80
82
  "action.toggle-debug-mode": "切換除錯模式",
81
83
  "action.toggle-debug-mode.menu": "除錯模式",
84
+ "action.toggle-dynamic-size-mode": "切換動態大小",
85
+ "action.toggle-dynamic-size-mode.menu": "動態大小",
86
+ "action.toggle-edge-scrolling": "切換邊緣滾動",
87
+ "action.toggle-edge-scrolling.menu": "邊緣滾動",
82
88
  "action.toggle-focus-mode": "切換專注模式",
83
89
  "action.toggle-focus-mode.menu": "專注模式",
84
90
  "action.toggle-grid": "切換網格",
85
91
  "action.toggle-grid.menu": "顯示網格",
92
+ "action.toggle-lock": "鎖定\/解鎖",
93
+ "action.toggle-paste-at-cursor": "在游標位置切換貼上",
94
+ "action.toggle-paste-at-cursor.menu": "在游標位置貼上",
95
+ "action.toggle-reduce-motion": "切換減少活動",
96
+ "action.toggle-reduce-motion.menu": "減少活動",
86
97
  "action.toggle-snap-mode": "切換始終貼齊",
87
98
  "action.toggle-snap-mode.menu": "始終貼齊",
88
99
  "action.toggle-tool-lock": "切換工具鎖定",
@@ -90,6 +101,8 @@
90
101
  "action.toggle-transparent": "切換透明背景",
91
102
  "action.toggle-transparent.context-menu": "透明",
92
103
  "action.toggle-transparent.menu": "透明",
104
+ "action.toggle-wrap-mode": "在 wrap 切換選擇",
105
+ "action.toggle-wrap-mode.menu": "在 wrap 選擇",
93
106
  "action.undo": "復原",
94
107
  "action.ungroup": "取消群組",
95
108
  "action.unlock-all": "全部解鎖",
@@ -121,7 +134,10 @@
121
134
  "arrowheadStart-style.pipe": "管狀",
122
135
  "arrowheadStart-style.square": "正方形",
123
136
  "arrowheadStart-style.triangle": "三角形",
137
+ "assets.files.size-too-big": "檔案大小太大",
138
+ "assets.files.type-not-allowed": "檔案類型不允許",
124
139
  "assets.files.upload-failed": "上傳失敗",
140
+ "assets.url.failed": "無法加載 URL 預覽",
125
141
  "color-style.black": "黑色",
126
142
  "color-style.blue": "藍色",
127
143
  "color-style.green": "綠色",
@@ -133,19 +149,22 @@
133
149
  "color-style.orange": "橘色",
134
150
  "color-style.red": "紅色",
135
151
  "color-style.violet": "紫色",
152
+ "color-style.white": "白色",
136
153
  "color-style.yellow": "黃色",
137
154
  "context-menu.arrange": "佈局",
138
155
  "context-menu.copy-as": "複製成",
139
156
  "context-menu.edit": "編輯",
157
+ "context-menu.export-all-as": "全部匯出為",
140
158
  "context-menu.export-as": "匯出成",
141
159
  "context-menu.move-to-page": "移至頁面",
142
160
  "context-menu.reorder": "重新排序",
143
161
  "context.pages.new-page": "新頁面",
162
+ "cursor-chat.type-to-chat": "輸入聊天內容...",
144
163
  "dash-style.dashed": "虛線",
145
164
  "dash-style.dotted": "虛點",
146
165
  "dash-style.draw": "手繪",
147
166
  "dash-style.solid": "實線",
148
- "debug-panel.more": "更多",
167
+ "document-name-menu.copy-link": "複製連結",
149
168
  "document.default-name": "無標題",
150
169
  "edit-link-dialog.cancel": "取消",
151
170
  "edit-link-dialog.clear": "清除",
@@ -154,8 +173,6 @@
154
173
  "edit-link-dialog.save": "繼續",
155
174
  "edit-link-dialog.title": "編輯連結",
156
175
  "edit-link-dialog.url": "網址",
157
- "edit-pages-dialog.move-down": "下移",
158
- "edit-pages-dialog.move-up": "上移",
159
176
  "embed-dialog.back": "返回",
160
177
  "embed-dialog.cancel": "取消",
161
178
  "embed-dialog.create": "建立",
@@ -179,6 +196,7 @@
179
196
  "file-system.file-open-error.title": "無法開啟檔案",
180
197
  "file-system.shared-document-file-open-error.description": "不支援從共享專案開啟檔案。",
181
198
  "file-system.shared-document-file-open-error.title": "無法開啟檔案",
199
+ "fill-style.fill": "充滿",
182
200
  "fill-style.none": "無",
183
201
  "fill-style.pattern": "圖案",
184
202
  "fill-style.semi": "半填滿",
@@ -192,6 +210,8 @@
192
210
  "geo-style.arrow-left": "向左箭頭",
193
211
  "geo-style.arrow-right": "向右箭頭",
194
212
  "geo-style.arrow-up": "向上箭頭",
213
+ "geo-style.check-box": "勾選框",
214
+ "geo-style.cloud": "雲端",
195
215
  "geo-style.diamond": "菱形 2",
196
216
  "geo-style.ellipse": "橢圓形",
197
217
  "geo-style.hexagon": "六邊形",
@@ -208,16 +228,19 @@
208
228
  "help-menu.about": "關於",
209
229
  "help-menu.discord": "Discord",
210
230
  "help-menu.github": "GitHub",
231
+ "help-menu.import-tldr-file": "匯入檔案...",
211
232
  "help-menu.keyboard-shortcuts": "鍵盤快捷鍵",
233
+ "help-menu.privacy": "隱私權政策",
234
+ "help-menu.terms": "服務條款",
212
235
  "help-menu.title": "幫助和資源",
213
236
  "help-menu.twitter": "Twitter",
214
- "home-project-dialog.ok": "好的",
215
237
  "menu.copy-as": "複製成",
216
238
  "menu.edit": "編輯",
217
239
  "menu.export-as": "匯出成",
218
240
  "menu.file": "檔案",
219
241
  "menu.language": "語言",
220
242
  "menu.preferences": "選項",
243
+ "menu.theme": "主題",
221
244
  "menu.title": "選單",
222
245
  "menu.view": "檢視",
223
246
  "navigation-zone.toggle-minimap": "切換小地圖",
@@ -243,12 +266,11 @@
243
266
  "people-menu.change-color": "更改顏色",
244
267
  "people-menu.change-name": "更改名稱",
245
268
  "people-menu.follow": "追蹤",
269
+ "people-menu.following": "關注",
246
270
  "people-menu.invite": "邀請其他人",
271
+ "people-menu.leading": "關注你",
247
272
  "people-menu.title": "人員",
248
273
  "people-menu.user": "(您)",
249
- "rename-project-dialog.cancel": "取消",
250
- "rename-project-dialog.rename": "重新命名",
251
- "rename-project-dialog.title": "重新命名專案",
252
274
  "share-menu.copied": "已複製連結!",
253
275
  "share-menu.copy-link": "複製連結",
254
276
  "share-menu.copy-link-note": "任何人透過連結都能檢視和編輯此專案。",
@@ -259,10 +281,17 @@
259
281
  "share-menu.fork-note": "基於此快照建立新的共享專案。",
260
282
  "share-menu.offline-note": "共享此專案將建立即時副本,並產生新網址。您可以分享網址,與其他至多三十人一起檢視和編輯副本。",
261
283
  "share-menu.project-too-large": "抱歉,無法共享此專案,因為檔案過大。我們已在調整這件事!",
262
- "share-menu.readonly-link": "唯讀",
263
284
  "share-menu.save-note": "將此專案作為 .tldr 檔下載到您的電腦。",
264
285
  "share-menu.share-project": "共享此專案",
286
+ "share-menu.snapshot-link-note": "將此專案作為唯讀快照連結進行擷取並共享。",
265
287
  "share-menu.title": "共享",
288
+ "share-menu.upload-failed": "抱歉,我們目前無法上傳您的專案。請重試或讓我們知道問題是否持續存在。",
289
+ "sharing.confirm-leave.cancel": "取消",
290
+ "sharing.confirm-leave.description": "您確定要離開此共享專案嗎?您可以導覽到其 URL 返回。",
291
+ "sharing.confirm-leave.dont-show-again": "不再詢問",
292
+ "sharing.confirm-leave.leave": "離開",
293
+ "sharing.confirm-leave.title": "離開當前專案?",
294
+ "shortcuts-dialog.collaboration": "合作",
266
295
  "shortcuts-dialog.edit": "編輯",
267
296
  "shortcuts-dialog.file": "檔案",
268
297
  "shortcuts-dialog.preferences": "選項",
@@ -277,7 +306,6 @@
277
306
  "spline-style.cubic": "立方體",
278
307
  "spline-style.line": "直線",
279
308
  "status.offline": "斷線",
280
- "status.online": "已連線",
281
309
  "style-panel.align": "對齊",
282
310
  "style-panel.arrowhead-end": "末端",
283
311
  "style-panel.arrowhead-start": "前端",
@@ -287,26 +315,31 @@
287
315
  "style-panel.fill": "填充",
288
316
  "style-panel.font": "字型",
289
317
  "style-panel.geo": "形狀",
318
+ "style-panel.label-align": "標籤對齊",
290
319
  "style-panel.mixed": "混合",
291
320
  "style-panel.opacity": "不透明度",
292
321
  "style-panel.position": "位置",
293
322
  "style-panel.size": "大小",
294
323
  "style-panel.spline": "曲線",
295
324
  "style-panel.title": "樣式",
325
+ "style-panel.vertical-align": "垂直對齊",
326
+ "theme.dark": "黑暗",
327
+ "theme.light": "明亮",
328
+ "theme.system": "系統",
296
329
  "toast.close": "關閉",
297
330
  "toast.error.copy-fail.desc": "圖片複製失敗",
298
331
  "toast.error.copy-fail.title": "複製失敗",
299
332
  "toast.error.export-fail.desc": "圖片匯出失敗",
300
333
  "toast.error.export-fail.title": "匯出失敗",
301
- "tool-panel.drawing": "繪圖",
302
334
  "tool-panel.more": "更多",
303
- "tool-panel.shapes": "形狀",
304
335
  "tool.arrow": "箭頭",
305
336
  "tool.arrow-down": "向下箭頭",
306
337
  "tool.arrow-left": "向左箭頭",
307
338
  "tool.arrow-right": "向右箭頭",
308
339
  "tool.arrow-up": "向上箭頭",
309
340
  "tool.asset": "資源",
341
+ "tool.check-box": "勾選框",
342
+ "tool.cloud": "雲端",
310
343
  "tool.diamond": "菱形 2",
311
344
  "tool.draw": "手繪",
312
345
  "tool.ellipse": "橢圓形",
@@ -315,11 +348,14 @@
315
348
  "tool.frame": "框架",
316
349
  "tool.hand": "抓取",
317
350
  "tool.hexagon": "六邊形",
351
+ "tool.highlight": "醒目提醒",
352
+ "tool.laser": "雷射",
318
353
  "tool.line": "直線",
319
354
  "tool.note": "便利貼",
320
355
  "tool.octagon": "八邊形",
321
356
  "tool.oval": "卵形",
322
357
  "tool.pentagon": "五邊形",
358
+ "tool.pointer-down": "指針向下",
323
359
  "tool.rectangle": "矩形",
324
360
  "tool.rhombus": "菱形",
325
361
  "tool.select": "選取",
package/license.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Eric Mika
3
+ Copyright (c) 2024-2025 Eric Mika
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,67 +1,64 @@
1
1
  {
2
2
  "name": "@kitschpatrol/tldraw-cli",
3
- "version": "4.6.29",
4
- "type": "module",
5
- "description": "A CLI tool for exporting tldraw sketch URLs and local .tldr files to a variety of image formats.",
6
- "repository": "github:kitschpatrol/tldraw-cli",
3
+ "version": "4.6.31",
4
+ "description": "A CLI tool and TypeScript library for exporting tldraw sketches to PNG or SVG images.",
5
+ "keywords": [
6
+ "tldraw",
7
+ "tldr",
8
+ "cli",
9
+ "diagram",
10
+ "drawing",
11
+ "sketch",
12
+ "export",
13
+ "npm-package"
14
+ ],
7
15
  "homepage": "https://github.com/kitschpatrol/tldraw-cli",
8
16
  "bugs": "https://github.com/kitschpatrol/tldraw-cli/issues",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/kitschpatrol/tldraw-cli"
20
+ },
21
+ "license": "MIT",
9
22
  "author": {
10
23
  "name": "Eric Mika",
11
24
  "email": "eric@ericmika.com",
12
25
  "url": "https://ericmika.com"
13
26
  },
14
- "license": "MIT",
15
- "engines": {
16
- "node": ">=18.0.0",
17
- "pnpm": ">=9.0.0"
18
- },
19
- "bin": {
20
- "tldraw-cli": "bin/cli.js",
21
- "tldraw": "bin/cli.js"
22
- },
27
+ "type": "module",
23
28
  "main": "./dist/lib/index.js",
24
29
  "module": "./dist/lib/index.js",
25
30
  "types": "./dist/lib/index.d.ts",
31
+ "bin": {
32
+ "tldraw": "bin/cli.js",
33
+ "tldraw-cli": "bin/cli.js"
34
+ },
26
35
  "files": [
27
36
  "bin/*",
28
37
  "dist/*"
29
38
  ],
30
- "keywords": [
31
- "tldraw",
32
- "tldr",
33
- "cli",
34
- "diagram",
35
- "drawing",
36
- "sketch",
37
- "export",
38
- "npm-package"
39
- ],
40
39
  "dependencies": {
41
- "@fontsource/inter": "^5.1.1",
40
+ "@fontsource/inter": "^5.2.5",
42
41
  "express": "^4.21.2",
43
- "puppeteer": "^23.11.1",
42
+ "puppeteer": "^24.3.0",
44
43
  "uint8array-extras": "^1.4.0",
45
44
  "yargs": "^17.7.2"
46
45
  },
47
46
  "devDependencies": {
48
- "@kitschpatrol/shared-config": "^4.7.12",
47
+ "@kitschpatrol/shared-config": "^5.0.8",
49
48
  "@sindresorhus/slugify": "^2.2.1",
50
- "@tldraw/assets": "3.7.2",
49
+ "@tldraw/assets": "3.8.1",
51
50
  "@types/express": "^4.17.21",
52
- "@types/node": "18.0.0",
51
+ "@types/node": "^20.17.22",
53
52
  "@types/react": "^18.3.18",
54
53
  "@types/react-dom": "^18.3.5",
55
54
  "@types/yargs": "^17.0.33",
56
- "@vitejs/plugin-react-swc": "^3.7.2",
57
- "bumpp": "^10.0.1",
55
+ "@vitejs/plugin-react-swc": "^3.8.0",
56
+ "bumpp": "^10.0.3",
58
57
  "chalk": "^5.4.1",
59
58
  "cheerio": "^1.0.0",
60
- "esbuild": "^0.24.2",
61
- "eslint-plugin-react-hooks": "^4.6.2",
62
- "eslint-plugin-react-refresh": "^0.4.18",
59
+ "esbuild": "^0.25.0",
63
60
  "get-port": "^7.1.0",
64
- "nanoid": "^5.0.9",
61
+ "nanoid": "^5.1.2",
65
62
  "open": "^10.1.0",
66
63
  "path-type": "^6.0.0",
67
64
  "plur": "^5.1.0",
@@ -72,26 +69,29 @@
72
69
  "sharp": "^0.33.5",
73
70
  "sharp-phash": "^2.2.0",
74
71
  "strip-ansi": "^7.1.0",
75
- "tldraw": "3.7.2",
76
- "tsx": "^4.19.2",
77
- "typescript": "^5.7.3",
72
+ "tldraw": "3.8.1",
73
+ "tsx": "^4.19.3",
74
+ "typescript": "^5.8.2",
78
75
  "untildify": "^5.0.0",
79
- "vite": "^5.4.14",
80
- "vitest": "^2.1.8"
76
+ "vite": "^6.2.0",
77
+ "vitest": "^3.0.7"
78
+ },
79
+ "engines": {
80
+ "node": ">=20.9.0"
81
81
  },
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "pnpm run build:tldraw && pnpm run build:lib && pnpm run build:cli",
87
- "build:cli": "tsx ./scripts/build-cli.ts",
87
+ "build:cli": "tsx ./scripts/build-cli.ts && tsc -p tsconfig.build.json",
88
88
  "build:lib": "tsx ./scripts/build-lib.ts && tsc -p tsconfig.lib.json",
89
89
  "build:tldraw": "pnpm run tldraw:copy-assets && vite build",
90
90
  "clean": "git rm -f pnpm-lock.yaml ; git clean -fdX",
91
91
  "dev": "pnpm run dev:tldraw",
92
92
  "dev:tldraw": "pnpm run tldraw:copy-assets && vite",
93
- "fix": "shared-config --fix",
94
- "lint": "shared-config --lint",
93
+ "fix": "kpi fix",
94
+ "lint": "kpi lint",
95
95
  "preview": "pnpm run preview:tldraw",
96
96
  "preview:tldraw": "vite preview",
97
97
  "release": "bumpp --commit 'Release: %s' && pnpm run build && pnpm publish --otp $(op read 'op://Personal/Npmjs/one-time password?attribute=otp')",
package/readme.md CHANGED
@@ -15,13 +15,13 @@
15
15
 
16
16
  <!-- description -->
17
17
 
18
- **A CLI tool for exporting tldraw sketch URLs and local .tldr files to a variety of image formats.**
18
+ **A CLI tool and TypeScript library for exporting tldraw sketches to PNG or SVG images.**
19
19
 
20
20
  <!-- /description -->
21
21
 
22
22
  > [!IMPORTANT]
23
23
  >
24
- > The tldraw project and website are rapidly evolving, and time is not always avaialbe to keep `tldraw-cli`'s abstractions up to date, particularly for commands that interface directly with sketch URLs. Working with local `.tldr` files should be relatively stable, but caveat emptor.
24
+ > The tldraw project and website are rapidly evolving, and time is not always available to keep `tldraw-cli`'s abstractions up to date, particularly for commands that interface directly with sketch URLs. Working with local `.tldr` files should be relatively stable, but caveat emptor.
25
25
 
26
26
  <!-- table-of-contents { maxDepth: 2 } -->
27
27
 
@@ -303,24 +303,25 @@ The library exports two async function, `tldrawToImage`, and `tldrawOpen`.
303
303
 
304
304
  This mirrors the `tldraw export` CLI command.
305
305
 
306
- It takes an options argument mirroring the arguments available via the command line. The same default values apply:
306
+ It takes an options argument mirroring the arguments available via the command line. Here's the full type signature of the function. The same default values from the CLI apply:
307
307
 
308
308
  ```ts
309
- async function tldrawToImage(
309
+ type TldrawToImageFn = (
310
310
  tldrPathOrUrl: string,
311
- {
311
+ options: {
312
312
  dark?: boolean
313
- format?: 'svg' | 'png' | 'json' | 'tldr'
313
+ format?: 'png' | 'svg' | 'tldr'
314
314
  frames?: boolean | string[]
315
315
  name?: string
316
316
  output?: string
317
317
  padding?: number
318
- pages?: boolean | string[] | number[]
318
+ pages?: boolean | number[] | string[]
319
319
  print?: boolean
320
320
  scale?: number
321
321
  stripStyle?: boolean
322
322
  transparent?: boolean
323
- }): Promise<string[]>;
323
+ },
324
+ ) => Promise<string[]>
324
325
  ```
325
326
 
326
327
  The function exports the image in the requested format and returns an array of the output image(s) or file(s).
@@ -330,7 +331,7 @@ Generally, a single file is returned — but the `string[]` return type also acc
330
331
  Assuming you've installed `@kitschpatrol/tldraw-cli` locally in your project, it may be used as follows:
331
332
 
332
333
  ```ts
333
- // tldraw-cli-api-test.ts
334
+ // Tldraw-cli-api-test.ts
334
335
 
335
336
  import { tldrawToImage } from '@kitschpatrol/tldraw-cli'
336
337
 
@@ -351,8 +352,8 @@ console.log(`Wrote frames to: "${framePathsArray}"`)
351
352
 
352
353
  // Convert a specific frame from a tldraw.com URL to a PNG
353
354
  await tldrawToImage('https://www.tldraw.com/s/v2_c_FI5RYWbdpAtjsy4OIKrKw', {
354
- frames: ['Frame 3'],
355
355
  format: 'png',
356
+ frames: ['Frame 3'],
356
357
  })
357
358
 
358
359
  // You can also use the frame id instead of the frame name, if you're into that sort of thing
@@ -365,15 +366,15 @@ await tldrawToImage('https://www.tldraw.com/s/v2_c_FI5RYWbdpAtjsy4OIKrKw', {
365
366
  By default, the Node API only logs warnings and errors. If you want to log the equivalent of the `--verbose` flag from the command line version, then you can set a flag on a logging object exported from the library:
366
367
 
367
368
  ```ts
368
- // tldraw-cli-api-verbose-test.ts
369
+ // Tldraw-cli-api-verbose-test.ts
369
370
 
370
- import { tldrawToImage, log } from '@kitschpatrol/tldraw-cli'
371
+ import { log, tldrawToImage } from '@kitschpatrol/tldraw-cli'
371
372
 
372
- // this will log extra info
373
+ // This will log extra info
373
374
  log.verbose = true
374
375
  await tldrawToImage('https://www.tldraw.com/s/v2_c_JsxJk8dag6QsrqExukis4')
375
376
 
376
- // now we'll only log errors and warnings
377
+ // Now we'll only log errors and warnings
377
378
  log.verbose = false
378
379
  await tldrawToImage('https://www.tldraw.com/s/v2_c_JsxJk8dag6QsrqExukis4')
379
380
  ```
@@ -382,8 +383,8 @@ await tldrawToImage('https://www.tldraw.com/s/v2_c_JsxJk8dag6QsrqExukis4')
382
383
 
383
384
  Mirrors the `tldraw open` CLI command.
384
385
 
385
- > [!CAUTION]
386
- > Passing a local .tldr file with the `location: 'remote'` option will upload and share your sketch on tldraw\.com.
386
+ > [!IMPORTANT]
387
+ > Due to recent tldraw.com requirements to login before sharing a sketch, opening a _local_ .tldr file with the `location: 'remote'` option is no longer supported.
387
388
 
388
389
  ```tsx
389
390
  async function tldrawOpen(
@@ -425,17 +426,6 @@ await tldrawOpen('./sketch.tldr', {
425
426
  })
426
427
  ```
427
428
 
428
- #### `tldrawToShareUrl`
429
-
430
- ```ts
431
- async function tldrawToShareUrl(tldrPathOrUrl: string): Promise<string>
432
- ```
433
-
434
- Returns a live "share" url for a given local or remote tldraw sketch URL.
435
-
436
- > [!CAUTION]
437
- > Passing a local .tldr file to this function will upload and share your local file to tldraw\.com.
438
-
439
429
  ### Common workflows
440
430
 
441
431
  If you're working with .tldr files and `tldraw-cli` locally, it's often convenient to automatically export image files from your sketches whenever they've changed.
package/dist/.DS_Store DELETED
Binary file
@@ -1 +0,0 @@
1
- export declare function tldrawToShareUrl(tldrPathOrUrl: string): Promise<string>;