@kitschpatrol/tldraw-cli 4.6.8 → 4.6.10

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 (74) hide show
  1. package/bin/cli.js +40 -22
  2. package/dist/lib/index.js +39 -21
  3. package/dist/tldraw/assets/index-BpL0JxLJ.js +389 -0
  4. package/dist/tldraw/assets/{index-lYfYBaQA.css → index-DNGZJ3vS.css} +1 -1
  5. package/dist/tldraw/assets/inter-cyrillic-500-normal-D4Vwzodn.woff2 +0 -0
  6. package/dist/tldraw/assets/inter-cyrillic-500-normal-DH2hs3aW.woff +0 -0
  7. package/dist/tldraw/assets/inter-cyrillic-700-normal-Bc8_fv8J.woff +0 -0
  8. package/dist/tldraw/assets/inter-cyrillic-700-normal-bGtGjVdZ.woff2 +0 -0
  9. package/dist/tldraw/assets/inter-cyrillic-ext-500-normal-BShVwWPj.woff2 +0 -0
  10. package/dist/tldraw/assets/inter-cyrillic-ext-500-normal-CUiC4oBV.woff +0 -0
  11. package/dist/tldraw/assets/inter-cyrillic-ext-700-normal-Ced3hgUT.woff +0 -0
  12. package/dist/tldraw/assets/inter-cyrillic-ext-700-normal-ClVoMEGq.woff2 +0 -0
  13. package/dist/tldraw/assets/inter-greek-500-normal-CeQXL5ds.woff2 +0 -0
  14. package/dist/tldraw/assets/inter-greek-500-normal-d_eO-yCQ.woff +0 -0
  15. package/dist/tldraw/assets/inter-greek-700-normal-BRYTaFLL.woff +0 -0
  16. package/dist/tldraw/assets/inter-greek-700-normal-Cxpycf-U.woff2 +0 -0
  17. package/dist/tldraw/assets/inter-greek-ext-500-normal-B6guLgqG.woff2 +0 -0
  18. package/dist/tldraw/assets/inter-greek-ext-500-normal-M2hEX8vc.woff +0 -0
  19. package/dist/tldraw/assets/inter-greek-ext-700-normal-DXvzx4Na.woff +0 -0
  20. package/dist/tldraw/assets/inter-greek-ext-700-normal-SzCdnevJ.woff2 +0 -0
  21. package/dist/tldraw/assets/inter-latin-500-normal-D2bGa7uu.woff2 +0 -0
  22. package/dist/tldraw/assets/inter-latin-500-normal-deR1Tlfd.woff +0 -0
  23. package/dist/tldraw/assets/inter-latin-700-normal-B8MtJ_2k.woff +0 -0
  24. package/dist/tldraw/assets/inter-latin-700-normal-Sckx8rpT.woff2 +0 -0
  25. package/dist/tldraw/assets/inter-latin-ext-500-normal-CIS2RHJS.woff2 +0 -0
  26. package/dist/tldraw/assets/inter-latin-ext-500-normal-UMdmhHu2.woff +0 -0
  27. package/dist/tldraw/assets/inter-latin-ext-700-normal-6V9MnIL5.woff +0 -0
  28. package/dist/tldraw/assets/inter-latin-ext-700-normal-CzikT_rs.woff2 +0 -0
  29. package/dist/tldraw/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
  30. package/dist/tldraw/assets/inter-vietnamese-500-normal-DQPw2Hwd.woff +0 -0
  31. package/dist/tldraw/assets/inter-vietnamese-700-normal-CGpBpxLq.woff2 +0 -0
  32. package/dist/tldraw/assets/inter-vietnamese-700-normal-dAnkLlTo.woff +0 -0
  33. package/dist/tldraw/icons/icon/0_merged.svg +1 -0
  34. package/dist/tldraw/icons/icon/icon-names.json +1 -0
  35. package/dist/tldraw/icons/icon/rotate-ccw.svg +1 -1
  36. package/dist/tldraw/icons/icon/size-extra-large.svg +1 -1
  37. package/dist/tldraw/icons/icon/status-offline.svg +1 -0
  38. package/dist/tldraw/icons/icon/vertical-align-end.svg +1 -1
  39. package/dist/tldraw/icons/icon/vertical-align-middle.svg +1 -1
  40. package/dist/tldraw/icons/icon/vertical-align-start.svg +1 -1
  41. package/dist/tldraw/icons/icon/warning-triangle.svg +1 -1
  42. package/dist/tldraw/index.html +2 -2
  43. package/dist/tldraw/translations/main.json +2 -0
  44. package/package.json +13 -13
  45. package/readme.md +61 -0
  46. package/dist/tldraw/assets/index-B0zSeFIu.js +0 -327
  47. package/dist/tldraw/assets/inter-cyrillic-500-normal-BRrLR67x.woff2 +0 -0
  48. package/dist/tldraw/assets/inter-cyrillic-500-normal-DskEQOpE.woff +0 -0
  49. package/dist/tldraw/assets/inter-cyrillic-700-normal-6zNX8Blf.woff2 +0 -0
  50. package/dist/tldraw/assets/inter-cyrillic-700-normal-DsxIEgNh.woff +0 -0
  51. package/dist/tldraw/assets/inter-cyrillic-ext-500-normal-DOnSzjnx.woff2 +0 -0
  52. package/dist/tldraw/assets/inter-cyrillic-ext-500-normal-Xebo2OyJ.woff +0 -0
  53. package/dist/tldraw/assets/inter-cyrillic-ext-700-normal-CAj4IH3j.woff +0 -0
  54. package/dist/tldraw/assets/inter-cyrillic-ext-700-normal-CMkYcdkw.woff2 +0 -0
  55. package/dist/tldraw/assets/inter-greek-500-normal-BjpBGs91.woff +0 -0
  56. package/dist/tldraw/assets/inter-greek-500-normal-CmOavsDc.woff2 +0 -0
  57. package/dist/tldraw/assets/inter-greek-700-normal-4IUP0jwf.woff2 +0 -0
  58. package/dist/tldraw/assets/inter-greek-700-normal-CmOaYR_c.woff +0 -0
  59. package/dist/tldraw/assets/inter-greek-ext-500-normal-2pdUafRD.woff2 +0 -0
  60. package/dist/tldraw/assets/inter-greek-ext-500-normal-Dtavx3qw.woff +0 -0
  61. package/dist/tldraw/assets/inter-greek-ext-700-normal-Cwql_mmq.woff +0 -0
  62. package/dist/tldraw/assets/inter-greek-ext-700-normal-DqOFU2GX.woff2 +0 -0
  63. package/dist/tldraw/assets/inter-latin-500-normal-D4I8BKCx.woff +0 -0
  64. package/dist/tldraw/assets/inter-latin-500-normal-kWhwEdDH.woff2 +0 -0
  65. package/dist/tldraw/assets/inter-latin-700-normal-C2zfFY7I.woff2 +0 -0
  66. package/dist/tldraw/assets/inter-latin-700-normal-CHFldGL2.woff +0 -0
  67. package/dist/tldraw/assets/inter-latin-ext-500-normal-B9u8Q_zH.woff2 +0 -0
  68. package/dist/tldraw/assets/inter-latin-ext-500-normal-SuUkSNTU.woff +0 -0
  69. package/dist/tldraw/assets/inter-latin-ext-700-normal-Bu7lG2nd.woff +0 -0
  70. package/dist/tldraw/assets/inter-latin-ext-700-normal-CAa3MqUt.woff2 +0 -0
  71. package/dist/tldraw/assets/inter-vietnamese-500-normal-0i6yoQMg.woff +0 -0
  72. package/dist/tldraw/assets/inter-vietnamese-500-normal-5IkPJ6Nk.woff2 +0 -0
  73. package/dist/tldraw/assets/inter-vietnamese-700-normal-ByO5Ry5o.woff2 +0 -0
  74. package/dist/tldraw/assets/inter-vietnamese-700-normal-Db0hjN_z.woff +0 -0
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="30" height="31" fill="none"><rect width="2" height="8" x="15" y="19.297" fill="#000" rx="1" transform="rotate(45 15 19.297)"/><rect width="2" height="8" x="13.586" y="20.711" fill="#000" rx="1" transform="rotate(-45 13.586 20.711)"/><rect width="2" height="8" x="15" y="11.118" fill="#000" rx="1" transform="rotate(-135 15 11.118)"/><rect width="2" height="8" x="16.414" y="9.704" fill="#000" rx="1" transform="rotate(135 16.414 9.704)"/><rect width="2" height="22" x="4" y="16.207" fill="#000" rx="1" transform="rotate(-90 4 16.207)"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="none"><rect width="2" height="8" x="15" y="19.09" fill="#000" rx="1" transform="rotate(45 15 19.09)"/><rect width="2" height="8" x="13.586" y="20.504" fill="#000" rx="1" transform="rotate(-45 13.586 20.504)"/><rect width="2" height="8" x="15" y="10.911" fill="#000" rx="1" transform="rotate(-135 15 10.911)"/><rect width="2" height="8" x="16.414" y="9.497" fill="#000" rx="1" transform="rotate(135 16.414 9.497)"/><rect width="2" height="22" x="4" y="16" fill="#000" rx="1" transform="rotate(-90 4 16)"/></svg>
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="30" height="31" fill="none"><rect width="2" height="22" x="4" y="10.707" fill="#000" rx="1" transform="rotate(-90 4 10.707)"/><rect width="2" height="8" x="15" y="13.799" fill="#000" rx="1" transform="rotate(45 15 13.799)"/><rect width="2" height="8" x="13.586" y="15.213" fill="#000" rx="1" transform="rotate(-45 13.586 15.213)"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="none"><rect width="2" height="22" x="4" y="10.5" fill="#000" rx="1" transform="rotate(-90 4 10.5)"/><rect width="2" height="8" x="15" y="13.592" fill="#000" rx="1" transform="rotate(45 15 13.592)"/><rect width="2" height="8" x="13.586" y="15.006" fill="#000" rx="1" transform="rotate(-45 13.586 15.006)"/></svg>
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="30" fill="none"><circle cx="16.4" cy="19.439" r="1.5" fill="#000"/><path fill="#000" d="M15.054 10.46a1.347 1.347 0 1 1 2.692 0l-.308 5.001a1.04 1.04 0 0 1-2.076 0z"/><path stroke="#000" stroke-width="2" d="M29.96 23.85 16.514 1.293a.6.6 0 0 0-1.03 0L2.04 23.85a.6.6 0 0 0 .515.907h26.888a.6.6 0 0 0 .515-.907Z"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="none"><circle cx="15.4" cy="19.439" r="1.5" fill="#000"/><path fill="#000" d="M14.054 10.46a1.347 1.347 0 1 1 2.692 0l-.308 5.001a1.04 1.04 0 0 1-2.076 0z"/><path stroke="#000" stroke-width="2" d="M28.483 23.858 15.52 1.332a.6.6 0 0 0-1.04 0L1.517 23.858a.6.6 0 0 0 .52.9h25.926a.6.6 0 0 0 .52-.9Z"/></svg>
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>tldraw via tldraw-cli</title>
7
- <script type="module" crossorigin src="/assets/index-B0zSeFIu.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-lYfYBaQA.css">
7
+ <script type="module" crossorigin src="/assets/index-BpL0JxLJ.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-DNGZJ3vS.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
@@ -245,6 +245,7 @@
245
245
  "menu.file": "File",
246
246
  "menu.language": "Language",
247
247
  "menu.preferences": "Preferences",
248
+ "menu.help": "Help",
248
249
  "menu.view": "View",
249
250
  "context-menu.edit": "Edit",
250
251
  "context-menu.arrange": "Arrange",
@@ -295,6 +296,7 @@
295
296
  "people-menu.invite": "Invite others",
296
297
  "help-menu.title": "Help and resources",
297
298
  "help-menu.about": "About",
299
+ "help-menu.docs": "Documentation & API",
298
300
  "help-menu.discord": "Discord",
299
301
  "help-menu.github": "GitHub",
300
302
  "help-menu.keyboard-shortcuts": "Keyboard shortcuts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitschpatrol/tldraw-cli",
3
- "version": "4.6.8",
3
+ "version": "4.6.10",
4
4
  "type": "module",
5
5
  "description": "A CLI tool for exporting tldraw sketch URLs and local .tldr files to SVG or PNG images.",
6
6
  "repository": {
@@ -44,16 +44,16 @@
44
44
  "npm-package"
45
45
  ],
46
46
  "dependencies": {
47
- "@fontsource/inter": "^5.0.19",
47
+ "@fontsource/inter": "^5.0.20",
48
48
  "express": "^4.19.2",
49
- "puppeteer": "^22.13.0",
50
- "uint8array-extras": "^1.3.0",
49
+ "puppeteer": "^22.15.0",
50
+ "uint8array-extras": "^1.4.0",
51
51
  "yargs": "^17.7.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@kitschpatrol/shared-config": "^4.7.2",
55
55
  "@sindresorhus/slugify": "^2.2.1",
56
- "@tldraw/assets": "2.4.0-canary.922dd416b17f",
56
+ "@tldraw/assets": "2.4.3",
57
57
  "@types/express": "^4.17.21",
58
58
  "@types/react": "^18.3.3",
59
59
  "@types/react-dom": "^18.3.0",
@@ -64,25 +64,25 @@
64
64
  "cheerio": "1.0.0-rc.12",
65
65
  "esbuild": "^0.23.0",
66
66
  "eslint-plugin-react-hooks": "^4.6.2",
67
- "eslint-plugin-react-refresh": "^0.4.8",
67
+ "eslint-plugin-react-refresh": "^0.4.9",
68
68
  "get-port": "^7.1.0",
69
69
  "nanoid": "^5.0.7",
70
70
  "open": "^10.1.0",
71
- "path-type": "^5.0.0",
71
+ "path-type": "^6.0.0",
72
72
  "plur": "^5.1.0",
73
- "pretty-ms": "^9.0.0",
73
+ "pretty-ms": "^9.1.0",
74
74
  "react": "^18.3.1",
75
75
  "react-dom": "^18.3.1",
76
76
  "safe-stable-stringify": "^2.4.3",
77
77
  "sharp": "^0.33.4",
78
78
  "sharp-phash": "^2.1.0",
79
79
  "strip-ansi": "^7.1.0",
80
- "tldraw": "2.4.0-canary.922dd416b17f",
81
- "tsx": "^4.16.2",
82
- "typescript": "^5.5.3",
80
+ "tldraw": "2.4.3",
81
+ "tsx": "^4.16.3",
82
+ "typescript": "^5.5.4",
83
83
  "untildify": "^5.0.0",
84
- "vite": "^5.3.3",
85
- "vitest": "^2.0.2"
84
+ "vite": "^5.3.5",
85
+ "vitest": "^2.0.5"
86
86
  },
87
87
  "publishConfig": {
88
88
  "access": "public"
package/readme.md CHANGED
@@ -28,6 +28,7 @@
28
28
  - [Usage](#usage)
29
29
  - [CLI](#cli)
30
30
  - [API](#api)
31
+ - [Common workflows](#common-workflows)
31
32
  - [Background](#background)
32
33
  - [Implementation notes](#implementation-notes)
33
34
  - [The future](#the-future)
@@ -431,6 +432,66 @@ Returns a live "share" url for a given local or remote tldraw sketch URL.
431
432
  > \[!CAUTION]
432
433
  > Passing a local .tldr file to this function will upload and share your local file to tldraw\.com.
433
434
 
435
+ ### Common workflows
436
+
437
+ 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.
438
+
439
+ Depending on your workspace and particularly use-cases, there are several approaches that can work well to trigger re-export on change:
440
+
441
+ #### A pure CLI workflow
442
+
443
+ The [`chokidar-cli`](https://www.npmjs.com/package/chokidar-cli) tool (which wraps the [Chokidar](https://github.com/paulmillr/chokidar) library) makes quick work of this:
444
+
445
+ ```sh
446
+ npx chokidar-cli "**/*.tldr" -c "npx @kitschpatrol/tldraw-cli export ${path}"
447
+ ```
448
+
449
+ This will watch for changes to .tldr files anywhere in or below the current directory, and then export an SVG every time they change. Pass [additional flags](#subcommand-tldraw-export) to `tldraw-cli export` if you need particular export settings.
450
+
451
+ #### VS Code tldraw extension workflow
452
+
453
+ The [tldraw extension for VS Code](https://marketplace.visualstudio.com/items?itemName=tldraw-org.tldraw-vscode) allows you to edit local .tldr files directly from a tab in your editor. This combines well with the [File Watcher](https://marketplace.visualstudio.com/items?itemName=appulate.filewatcher) extension to trigger re-exports after making edits in a tldraw tab:
454
+
455
+ Install the extensions (assuming you have `code` in your path):
456
+
457
+ ```sh
458
+ code --install-extension tldraw-org.tldraw-vscode
459
+ code --install-extension appulate.filewatcher
460
+ ```
461
+
462
+ Then configure your workspace's `.vscode/settings.json` file to include the following:
463
+
464
+ ```json
465
+ {
466
+ "filewatcher.commands": [
467
+ {
468
+ "match": "\\.tldr",
469
+ "isAsync": true,
470
+ "cmd": "cd ${workspaceRoot} && npx @kitschpatrol/tldraw-cli export ${file}",
471
+ "event": "onFileChange"
472
+ }
473
+ ]
474
+ }
475
+ ```
476
+
477
+ #### Vite / static-site workflow
478
+
479
+ If you're using one of the many [Vite](https://vitejs.dev/)-powered web frameworks out there, the [`@kitschpatrol/vite-plugin-tldraw`](https://github.com/kitschpatrol/vite-plugin-tldraw) plugin can help you treat .tldr as regular importable / linkable assets in your site by automating conversion to a web-friendly format during both development and production builds of your site.
480
+
481
+ See the [plugin's readme](https://github.com/kitschpatrol/vite-plugin-tldraw/blob/main/readme.md) for details, but the gist is that it lets you import and use .tldr files as if they were already SVGs:
482
+
483
+ ```ts
484
+ import tldrFile from './test-sketch.tldr'
485
+
486
+ document.body.innerHTML = `<img src="${tldrFile}">`
487
+ ```
488
+
489
+ Will render:
490
+
491
+ ```html
492
+ <img src="./test-sketch.svg" />
493
+ ```
494
+
434
495
  ## Background
435
496
 
436
497
  The potential utility of a tldraw CLI app has received mention a few times.