@pairdraw/core 0.19.2 → 0.20.0

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 (847) hide show
  1. package/dist/ai/providers.d.ts +6 -0
  2. package/dist/ai/providers.d.ts.map +1 -1
  3. package/dist/ai/providers.js.map +1 -1
  4. package/dist/cache/resource.d.ts +8 -1
  5. package/dist/cache/resource.d.ts.map +1 -1
  6. package/dist/cache/resource.js +18 -0
  7. package/dist/cache/resource.js.map +1 -1
  8. package/dist/canvas/effects.d.ts +6 -4
  9. package/dist/canvas/effects.d.ts.map +1 -1
  10. package/dist/canvas/effects.js +37 -34
  11. package/dist/canvas/effects.js.map +1 -1
  12. package/dist/canvas/fills.d.ts.map +1 -1
  13. package/dist/canvas/fills.js +12 -8
  14. package/dist/canvas/fills.js.map +1 -1
  15. package/dist/canvas/images/adjustments.d.ts +18 -0
  16. package/dist/canvas/images/adjustments.d.ts.map +1 -0
  17. package/dist/canvas/images/adjustments.js +184 -0
  18. package/dist/canvas/images/adjustments.js.map +1 -0
  19. package/dist/canvas/images/sampling.d.ts +13 -0
  20. package/dist/canvas/images/sampling.d.ts.map +1 -0
  21. package/dist/canvas/images/sampling.js +49 -0
  22. package/dist/canvas/images/sampling.js.map +1 -0
  23. package/dist/canvas/index.d.ts +2 -2
  24. package/dist/canvas/masks.d.ts +1 -1
  25. package/dist/canvas/masks.d.ts.map +1 -1
  26. package/dist/canvas/masks.js.map +1 -1
  27. package/dist/canvas/noise/render.d.ts +15 -0
  28. package/dist/canvas/noise/render.d.ts.map +1 -0
  29. package/dist/canvas/noise/render.js +56 -0
  30. package/dist/canvas/noise/render.js.map +1 -0
  31. package/dist/canvas/noise/shader.d.ts +43 -0
  32. package/dist/canvas/noise/shader.d.ts.map +1 -0
  33. package/dist/canvas/noise/shader.js +161 -0
  34. package/dist/canvas/noise/shader.js.map +1 -0
  35. package/dist/canvas/noise/table.d.ts +13 -0
  36. package/dist/canvas/noise/table.d.ts.map +1 -0
  37. package/dist/canvas/noise/table.js +408 -0
  38. package/dist/canvas/noise/table.js.map +1 -0
  39. package/dist/canvas/noise/tile.d.ts +22 -0
  40. package/dist/canvas/noise/tile.d.ts.map +1 -0
  41. package/dist/canvas/noise/tile.js +73 -0
  42. package/dist/canvas/noise/tile.js.map +1 -0
  43. package/dist/canvas/outline-stroke.js +1 -1
  44. package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
  45. package/dist/canvas/overlays/auto-layout-hover.js +31 -71
  46. package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
  47. package/dist/canvas/renderer/chunks/index.d.ts +1 -1
  48. package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
  49. package/dist/canvas/renderer/lifecycle.js +6 -0
  50. package/dist/canvas/renderer/lifecycle.js.map +1 -1
  51. package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
  52. package/dist/canvas/renderer/pipeline.js +13 -1
  53. package/dist/canvas/renderer/pipeline.js.map +1 -1
  54. package/dist/canvas/renderer/play-scenes.d.ts +13 -0
  55. package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
  56. package/dist/canvas/renderer/play-scenes.js +40 -0
  57. package/dist/canvas/renderer/play-scenes.js.map +1 -0
  58. package/dist/canvas/renderer/tiles/cache.d.ts +19 -1
  59. package/dist/canvas/renderer/tiles/cache.d.ts.map +1 -1
  60. package/dist/canvas/renderer/tiles/cache.js +32 -1
  61. package/dist/canvas/renderer/tiles/cache.js.map +1 -1
  62. package/dist/canvas/renderer/tiles/controller.d.ts +11 -0
  63. package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
  64. package/dist/canvas/renderer/tiles/controller.js +18 -1
  65. package/dist/canvas/renderer/tiles/controller.js.map +1 -1
  66. package/dist/canvas/renderer/tiles/index.d.ts +2 -2
  67. package/dist/canvas/renderer/tiles/planner.d.ts +1 -1
  68. package/dist/canvas/renderer/types.d.ts +18 -3
  69. package/dist/canvas/renderer/types.d.ts.map +1 -1
  70. package/dist/canvas/renderer/visual-bounds.d.ts +1 -1
  71. package/dist/canvas/renderer/visual-bounds.js +1 -1
  72. package/dist/canvas/renderer.d.ts +22 -2
  73. package/dist/canvas/renderer.d.ts.map +1 -1
  74. package/dist/canvas/renderer.js +29 -1
  75. package/dist/canvas/renderer.js.map +1 -1
  76. package/dist/canvas/scene.d.ts +2 -1
  77. package/dist/canvas/scene.d.ts.map +1 -1
  78. package/dist/canvas/scene.js +41 -9
  79. package/dist/canvas/scene.js.map +1 -1
  80. package/dist/canvas/shadows/silhouette.js +1 -1
  81. package/dist/canvas/texture.d.ts +20 -0
  82. package/dist/canvas/texture.d.ts.map +1 -0
  83. package/dist/canvas/texture.js +100 -0
  84. package/dist/canvas/texture.js.map +1 -0
  85. package/dist/clipboard.js +16 -5
  86. package/dist/clipboard.js.map +1 -1
  87. package/dist/constants.d.ts +5 -1
  88. package/dist/constants.d.ts.map +1 -1
  89. package/dist/constants.js +5 -1
  90. package/dist/constants.js.map +1 -1
  91. package/dist/design-jsx/renderer.d.ts.map +1 -1
  92. package/dist/design-memory/check.d.ts +90 -0
  93. package/dist/design-memory/check.d.ts.map +1 -0
  94. package/dist/design-memory/check.js +281 -0
  95. package/dist/design-memory/check.js.map +1 -0
  96. package/dist/design-memory/describe.d.ts +37 -0
  97. package/dist/design-memory/describe.d.ts.map +1 -0
  98. package/dist/design-memory/describe.js +52 -0
  99. package/dist/design-memory/describe.js.map +1 -0
  100. package/dist/design-memory/distil.d.ts +22 -0
  101. package/dist/design-memory/distil.d.ts.map +1 -0
  102. package/dist/design-memory/distil.js +54 -0
  103. package/dist/design-memory/distil.js.map +1 -0
  104. package/dist/design-memory/document.d.ts +12 -0
  105. package/dist/design-memory/document.d.ts.map +1 -0
  106. package/dist/design-memory/document.js +64 -0
  107. package/dist/design-memory/document.js.map +1 -0
  108. package/dist/design-memory/guard.d.ts +48 -0
  109. package/dist/design-memory/guard.d.ts.map +1 -0
  110. package/dist/design-memory/guard.js +105 -0
  111. package/dist/design-memory/guard.js.map +1 -0
  112. package/dist/design-memory/index.d.ts +9 -0
  113. package/dist/design-memory/index.js +9 -0
  114. package/dist/design-memory/refusal.d.ts +32 -0
  115. package/dist/design-memory/refusal.d.ts.map +1 -0
  116. package/dist/design-memory/refusal.js +68 -0
  117. package/dist/design-memory/refusal.js.map +1 -0
  118. package/dist/design-memory/rules.d.ts +63 -0
  119. package/dist/design-memory/rules.d.ts.map +1 -0
  120. package/dist/design-memory/rules.js +224 -0
  121. package/dist/design-memory/rules.js.map +1 -0
  122. package/dist/design-memory/values.d.ts +28 -0
  123. package/dist/design-memory/values.d.ts.map +1 -0
  124. package/dist/design-memory/values.js +160 -0
  125. package/dist/design-memory/values.js.map +1 -0
  126. package/dist/editor/alignment.js +1 -1
  127. package/dist/editor/bridges/components.d.ts +2 -0
  128. package/dist/editor/bridges/components.d.ts.map +1 -1
  129. package/dist/editor/bridges/components.js +2 -0
  130. package/dist/editor/bridges/components.js.map +1 -1
  131. package/dist/editor/bridges/undo.d.ts +1 -1
  132. package/dist/editor/clipboard/assets.js +1 -1
  133. package/dist/editor/clipboard/export.d.ts.map +1 -1
  134. package/dist/editor/clipboard/export.js +16 -2
  135. package/dist/editor/clipboard/export.js.map +1 -1
  136. package/dist/editor/clipboard/placement.d.ts +1 -1
  137. package/dist/editor/clipboard/placement.js +1 -1
  138. package/dist/editor/components/instances.d.ts +2 -0
  139. package/dist/editor/components/instances.d.ts.map +1 -1
  140. package/dist/editor/components/instances.js +22 -1
  141. package/dist/editor/components/instances.js.map +1 -1
  142. package/dist/editor/components.d.ts +2 -0
  143. package/dist/editor/components.d.ts.map +1 -1
  144. package/dist/editor/connectors/attach.js +1 -1
  145. package/dist/editor/create.d.ts +27 -3
  146. package/dist/editor/create.d.ts.map +1 -1
  147. package/dist/editor/create.js +16 -60
  148. package/dist/editor/create.js.map +1 -1
  149. package/dist/editor/design-memory.d.ts +11 -0
  150. package/dist/editor/design-memory.d.ts.map +1 -0
  151. package/dist/editor/design-memory.js +40 -0
  152. package/dist/editor/design-memory.js.map +1 -0
  153. package/dist/editor/design-tokens.d.ts +4 -0
  154. package/dist/editor/design-tokens.d.ts.map +1 -1
  155. package/dist/editor/design-tokens.js +30 -1
  156. package/dist/editor/design-tokens.js.map +1 -1
  157. package/dist/editor/document-colors.d.ts +23 -0
  158. package/dist/editor/document-colors.d.ts.map +1 -0
  159. package/dist/editor/document-colors.js +53 -0
  160. package/dist/editor/document-colors.js.map +1 -0
  161. package/dist/editor/eyedropper.d.ts +47 -0
  162. package/dist/editor/eyedropper.d.ts.map +1 -0
  163. package/dist/editor/eyedropper.js +168 -0
  164. package/dist/editor/eyedropper.js.map +1 -0
  165. package/dist/editor/fonts.d.ts +9 -0
  166. package/dist/editor/fonts.d.ts.map +1 -0
  167. package/dist/editor/fonts.js +14 -0
  168. package/dist/editor/fonts.js.map +1 -0
  169. package/dist/editor/history/atomic-tool.d.ts +9 -2
  170. package/dist/editor/history/atomic-tool.d.ts.map +1 -1
  171. package/dist/editor/history/atomic-tool.js +6 -0
  172. package/dist/editor/history/atomic-tool.js.map +1 -1
  173. package/dist/editor/history/capture.d.ts +13 -0
  174. package/dist/editor/history/capture.d.ts.map +1 -0
  175. package/dist/editor/history/capture.js +28 -0
  176. package/dist/editor/history/capture.js.map +1 -0
  177. package/dist/editor/history/document-change.d.ts.map +1 -1
  178. package/dist/editor/history/document-change.js +2 -22
  179. package/dist/editor/history/document-change.js.map +1 -1
  180. package/dist/editor/history/edit.d.ts +7 -0
  181. package/dist/editor/history/edit.d.ts.map +1 -1
  182. package/dist/editor/history/edit.js +4 -2
  183. package/dist/editor/history/edit.js.map +1 -1
  184. package/dist/editor/history/subtree.d.ts +9 -0
  185. package/dist/editor/history/subtree.d.ts.map +1 -1
  186. package/dist/editor/history/subtree.js +12 -2
  187. package/dist/editor/history/subtree.js.map +1 -1
  188. package/dist/editor/index.d.ts +4 -2
  189. package/dist/editor/index.js +4 -2
  190. package/dist/editor/pages.d.ts +7 -5
  191. package/dist/editor/pages.d.ts.map +1 -1
  192. package/dist/editor/pages.js +35 -25
  193. package/dist/editor/pages.js.map +1 -1
  194. package/dist/editor/play/states.d.ts +3 -1
  195. package/dist/editor/play/states.d.ts.map +1 -1
  196. package/dist/editor/play/states.js +1 -1
  197. package/dist/editor/play/states.js.map +1 -1
  198. package/dist/editor/read-only/actions.js +4 -0
  199. package/dist/editor/read-only/actions.js.map +1 -1
  200. package/dist/editor/render-requests.d.ts +18 -0
  201. package/dist/editor/render-requests.d.ts.map +1 -0
  202. package/dist/editor/render-requests.js +76 -0
  203. package/dist/editor/render-requests.js.map +1 -0
  204. package/dist/editor/scale/rescale.d.ts +1 -1
  205. package/dist/editor/selection/overlays.d.ts.map +1 -1
  206. package/dist/editor/selection/overlays.js +1 -1
  207. package/dist/editor/selection/overlays.js.map +1 -1
  208. package/dist/editor/selection/read.d.ts +4 -0
  209. package/dist/editor/selection.d.ts +5 -0
  210. package/dist/editor/selection.d.ts.map +1 -1
  211. package/dist/editor/tool-registry.d.ts.map +1 -1
  212. package/dist/editor/tool-registry.js +2 -1
  213. package/dist/editor/tool-registry.js.map +1 -1
  214. package/dist/editor/types.d.ts +5 -1
  215. package/dist/editor/types.d.ts.map +1 -1
  216. package/dist/editor/variations/create.d.ts +28 -0
  217. package/dist/editor/variations/create.d.ts.map +1 -0
  218. package/dist/editor/variations/create.js +176 -0
  219. package/dist/editor/variations/create.js.map +1 -0
  220. package/dist/editor/variations/pick.d.ts +16 -0
  221. package/dist/editor/variations/pick.d.ts.map +1 -0
  222. package/dist/editor/variations/pick.js +23 -0
  223. package/dist/editor/variations/pick.js.map +1 -0
  224. package/dist/editor/variations.d.ts +28 -0
  225. package/dist/editor/variations.d.ts.map +1 -0
  226. package/dist/editor/variations.js +88 -0
  227. package/dist/editor/variations.js.map +1 -0
  228. package/dist/figma-api/accessors/reactions.d.ts.map +1 -1
  229. package/dist/figma-api/accessors/reactions.js +4 -1
  230. package/dist/figma-api/accessors/reactions.js.map +1 -1
  231. package/dist/figma-api/accessors/text/index.js +3 -0
  232. package/dist/figma-api/accessors/text/index.js.map +1 -1
  233. package/dist/figma-api/accessors/text/opentype.d.ts +17 -0
  234. package/dist/figma-api/accessors/text/opentype.d.ts.map +1 -0
  235. package/dist/figma-api/accessors/text/opentype.js +28 -0
  236. package/dist/figma-api/accessors/text/opentype.js.map +1 -0
  237. package/dist/figma-api/accessors/visual.d.ts.map +1 -1
  238. package/dist/figma-api/accessors/visual.js +33 -0
  239. package/dist/figma-api/accessors/visual.js.map +1 -1
  240. package/dist/figma-api/effects.d.ts +79 -3
  241. package/dist/figma-api/effects.d.ts.map +1 -1
  242. package/dist/figma-api/effects.js +150 -9
  243. package/dist/figma-api/effects.js.map +1 -1
  244. package/dist/figma-api/index.d.ts +5 -0
  245. package/dist/figma-api/index.d.ts.map +1 -1
  246. package/dist/figma-api/index.js +6 -1
  247. package/dist/figma-api/index.js.map +1 -1
  248. package/dist/figma-api/overrides.d.ts +13 -1
  249. package/dist/figma-api/overrides.d.ts.map +1 -1
  250. package/dist/figma-api/overrides.js +196 -4
  251. package/dist/figma-api/overrides.js.map +1 -1
  252. package/dist/figma-api/paints.d.ts +3 -3
  253. package/dist/figma-api/paints.d.ts.map +1 -1
  254. package/dist/figma-api/paints.js +14 -4
  255. package/dist/figma-api/paints.js.map +1 -1
  256. package/dist/figma-api/proxy.d.ts +4 -1
  257. package/dist/figma-api/proxy.d.ts.map +1 -1
  258. package/dist/figma-api/proxy.js +1 -1
  259. package/dist/figma-api/proxy.js.map +1 -1
  260. package/dist/figma-api/reactions.d.ts +41 -13
  261. package/dist/figma-api/reactions.d.ts.map +1 -1
  262. package/dist/figma-api/reactions.js +113 -31
  263. package/dist/figma-api/reactions.js.map +1 -1
  264. package/dist/figma-api/render-bounds.js +1 -1
  265. package/dist/figma-api/surface.d.ts +6 -3
  266. package/dist/figma-api/surface.d.ts.map +1 -1
  267. package/dist/figma-api/surface.js +6 -2
  268. package/dist/figma-api/surface.js.map +1 -1
  269. package/dist/figma-api/transform.d.ts +1 -1
  270. package/dist/geometry/figma.d.ts +1 -1
  271. package/dist/geometry/image-crop.d.ts +1 -1
  272. package/dist/geometry/image-crop.js +1 -1
  273. package/dist/index.d.ts +4 -2
  274. package/dist/index.js +4 -2
  275. package/dist/io/formats/boolean-path.d.ts +19 -0
  276. package/dist/io/formats/boolean-path.d.ts.map +1 -0
  277. package/dist/io/formats/boolean-path.js +47 -0
  278. package/dist/io/formats/boolean-path.js.map +1 -0
  279. package/dist/io/formats/design-tokens/decode.js +1 -1
  280. package/dist/io/formats/design-tokens/index.d.ts +4 -1
  281. package/dist/io/formats/design-tokens/index.js +4 -1
  282. package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
  283. package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
  284. package/dist/io/formats/design-tokens/plan/changes.js +1 -1
  285. package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
  286. package/dist/io/formats/design-tokens/project.d.ts +17 -2
  287. package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
  288. package/dist/io/formats/design-tokens/project.js +29 -8
  289. package/dist/io/formats/design-tokens/project.js.map +1 -1
  290. package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
  291. package/dist/io/formats/design-tokens/styles.js.map +1 -1
  292. package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
  293. package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
  294. package/dist/io/formats/design-tokens/sync/apply.js +73 -0
  295. package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
  296. package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
  297. package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
  298. package/dist/io/formats/design-tokens/sync/drift.js +391 -0
  299. package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
  300. package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
  301. package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
  302. package/dist/io/formats/design-tokens/sync/files.js +35 -0
  303. package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
  304. package/dist/io/formats/drawio/edges.d.ts +7 -1
  305. package/dist/io/formats/drawio/edges.d.ts.map +1 -1
  306. package/dist/io/formats/drawio/edges.js +54 -1
  307. package/dist/io/formats/drawio/edges.js.map +1 -1
  308. package/dist/io/formats/drawio/export.d.ts.map +1 -1
  309. package/dist/io/formats/drawio/export.js +19 -2
  310. package/dist/io/formats/drawio/export.js.map +1 -1
  311. package/dist/io/formats/drawio/index.js +1 -0
  312. package/dist/io/formats/drawio/index.js.map +1 -1
  313. package/dist/io/formats/drawio/label.js +1 -1
  314. package/dist/io/formats/drawio/paint.js +1 -1
  315. package/dist/io/formats/drawio/placement.d.ts +1 -1
  316. package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
  317. package/dist/io/formats/fig/export/patch/index.js +5 -0
  318. package/dist/io/formats/fig/export/patch/index.js.map +1 -1
  319. package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
  320. package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
  321. package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
  322. package/dist/io/formats/html/import.d.ts.map +1 -1
  323. package/dist/io/formats/html/import.js +3 -1
  324. package/dist/io/formats/html/import.js.map +1 -1
  325. package/dist/io/formats/html/index.d.ts +2 -2
  326. package/dist/io/formats/html/index.d.ts.map +1 -1
  327. package/dist/io/formats/html/index.js +6 -4
  328. package/dist/io/formats/html/index.js.map +1 -1
  329. package/dist/io/formats/html/vectors.d.ts +2 -1
  330. package/dist/io/formats/html/vectors.d.ts.map +1 -1
  331. package/dist/io/formats/html/vectors.js +3 -2
  332. package/dist/io/formats/html/vectors.js.map +1 -1
  333. package/dist/io/formats/mermaid/styles.js +1 -1
  334. package/dist/io/formats/pdf/document.d.ts +3 -1
  335. package/dist/io/formats/pdf/document.d.ts.map +1 -1
  336. package/dist/io/formats/pdf/document.js +6 -3
  337. package/dist/io/formats/pdf/document.js.map +1 -1
  338. package/dist/io/formats/pdf/prepare.d.ts +1 -1
  339. package/dist/io/formats/pen/imports.d.ts +4 -1
  340. package/dist/io/formats/pen/imports.d.ts.map +1 -1
  341. package/dist/io/formats/pen/imports.js.map +1 -1
  342. package/dist/io/formats/pen/index.d.ts.map +1 -1
  343. package/dist/io/formats/pen/index.js +31 -3
  344. package/dist/io/formats/pen/index.js.map +1 -1
  345. package/dist/io/formats/pptx/export.js +1 -1
  346. package/dist/io/formats/pptx/geometry.d.ts +1 -1
  347. package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
  348. package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
  349. package/dist/io/formats/raster/adjusted-images.js +118 -0
  350. package/dist/io/formats/raster/adjusted-images.js.map +1 -0
  351. package/dist/io/formats/raster/headless.d.ts +11 -1
  352. package/dist/io/formats/raster/headless.d.ts.map +1 -1
  353. package/dist/io/formats/raster/headless.js +4 -4
  354. package/dist/io/formats/raster/headless.js.map +1 -1
  355. package/dist/io/formats/raster/index.d.ts +2 -2
  356. package/dist/io/formats/raster/pixels.d.ts +7 -1
  357. package/dist/io/formats/raster/pixels.d.ts.map +1 -1
  358. package/dist/io/formats/raster/pixels.js.map +1 -1
  359. package/dist/io/formats/raster/render.d.ts.map +1 -1
  360. package/dist/io/formats/raster/render.js +4 -0
  361. package/dist/io/formats/raster/render.js.map +1 -1
  362. package/dist/io/formats/svg/defs.d.ts +5 -6
  363. package/dist/io/formats/svg/defs.d.ts.map +1 -1
  364. package/dist/io/formats/svg/defs.js +1 -53
  365. package/dist/io/formats/svg/defs.js.map +1 -1
  366. package/dist/io/formats/svg/effects.d.ts +16 -0
  367. package/dist/io/formats/svg/effects.d.ts.map +1 -0
  368. package/dist/io/formats/svg/effects.js +126 -0
  369. package/dist/io/formats/svg/effects.js.map +1 -0
  370. package/dist/io/formats/svg/export.d.ts +7 -1
  371. package/dist/io/formats/svg/export.d.ts.map +1 -1
  372. package/dist/io/formats/svg/export.js +174 -36
  373. package/dist/io/formats/svg/export.js.map +1 -1
  374. package/dist/io/formats/svg/filter.d.ts +27 -0
  375. package/dist/io/formats/svg/filter.d.ts.map +1 -0
  376. package/dist/io/formats/svg/filter.js +44 -0
  377. package/dist/io/formats/svg/filter.js.map +1 -0
  378. package/dist/io/formats/svg/grain.d.ts +26 -0
  379. package/dist/io/formats/svg/grain.d.ts.map +1 -0
  380. package/dist/io/formats/svg/grain.js +298 -0
  381. package/dist/io/formats/svg/grain.js.map +1 -0
  382. package/dist/io/formats/svg/strokes.d.ts +1 -1
  383. package/dist/io/formats/svg/strokes.d.ts.map +1 -1
  384. package/dist/io/formats/svg/strokes.js +1 -2
  385. package/dist/io/formats/svg/strokes.js.map +1 -1
  386. package/dist/io/formats/svg/text/import.js +1 -1
  387. package/dist/io/formats/svg/text/layout.d.ts +5 -2
  388. package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
  389. package/dist/io/formats/svg/text/layout.js +6 -3
  390. package/dist/io/formats/svg/text/layout.js.map +1 -1
  391. package/dist/io/formats/video/composite.d.ts +18 -0
  392. package/dist/io/formats/video/composite.d.ts.map +1 -0
  393. package/dist/io/formats/video/composite.js +79 -0
  394. package/dist/io/formats/video/composite.js.map +1 -0
  395. package/dist/io/formats/video/formats.d.ts +29 -0
  396. package/dist/io/formats/video/formats.d.ts.map +1 -0
  397. package/dist/io/formats/video/formats.js +43 -0
  398. package/dist/io/formats/video/formats.js.map +1 -0
  399. package/dist/io/formats/video/gif.d.ts +13 -0
  400. package/dist/io/formats/video/gif.d.ts.map +1 -0
  401. package/dist/io/formats/video/gif.js +56 -0
  402. package/dist/io/formats/video/gif.js.map +1 -0
  403. package/dist/io/formats/video/index.d.ts +9 -0
  404. package/dist/io/formats/video/index.js +9 -0
  405. package/dist/io/formats/video/plan.d.ts +64 -0
  406. package/dist/io/formats/video/plan.d.ts.map +1 -0
  407. package/dist/io/formats/video/plan.js +90 -0
  408. package/dist/io/formats/video/plan.js.map +1 -0
  409. package/dist/io/formats/video/record.d.ts +36 -0
  410. package/dist/io/formats/video/record.d.ts.map +1 -0
  411. package/dist/io/formats/video/record.js +154 -0
  412. package/dist/io/formats/video/record.js.map +1 -0
  413. package/dist/io/formats/video/sink.d.ts +29 -0
  414. package/dist/io/formats/video/sink.d.ts.map +1 -0
  415. package/dist/io/formats/video/sink.js +16 -0
  416. package/dist/io/formats/video/sink.js.map +1 -0
  417. package/dist/io/formats/video/size.d.ts +19 -0
  418. package/dist/io/formats/video/size.d.ts.map +1 -0
  419. package/dist/io/formats/video/size.js +26 -0
  420. package/dist/io/formats/video/size.js.map +1 -0
  421. package/dist/io/formats/video/webcodecs.d.ts +18 -0
  422. package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
  423. package/dist/io/formats/video/webcodecs.js +74 -0
  424. package/dist/io/formats/video/webcodecs.js.map +1 -0
  425. package/dist/io/formats.d.ts.map +1 -1
  426. package/dist/io/formats.js +40 -11
  427. package/dist/io/formats.js.map +1 -1
  428. package/dist/io/types.d.ts +19 -4
  429. package/dist/io/types.d.ts.map +1 -1
  430. package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
  431. package/dist/layout/auto-layout-handles.d.ts +66 -0
  432. package/dist/layout/auto-layout-handles.d.ts.map +1 -0
  433. package/dist/layout/auto-layout-handles.js +291 -0
  434. package/dist/layout/auto-layout-handles.js.map +1 -0
  435. package/dist/layout.d.ts +3 -2
  436. package/dist/layout.d.ts.map +1 -1
  437. package/dist/layout.js +2 -1
  438. package/dist/layout.js.map +1 -1
  439. package/dist/lint/fixes.d.ts.map +1 -1
  440. package/dist/lint/fixes.js +9 -3
  441. package/dist/lint/fixes.js.map +1 -1
  442. package/dist/lint/index.d.ts +3 -2
  443. package/dist/lint/index.js +2 -1
  444. package/dist/lint/linter.d.ts +12 -0
  445. package/dist/lint/linter.d.ts.map +1 -1
  446. package/dist/lint/linter.js +110 -8
  447. package/dist/lint/linter.js.map +1 -1
  448. package/dist/lint/presets.d.ts.map +1 -1
  449. package/dist/lint/presets.js +2 -0
  450. package/dist/lint/presets.js.map +1 -1
  451. package/dist/lint/rules/design-memory.d.ts +15 -0
  452. package/dist/lint/rules/design-memory.d.ts.map +1 -0
  453. package/dist/lint/rules/design-memory.js +90 -0
  454. package/dist/lint/rules/design-memory.js.map +1 -0
  455. package/dist/lint/rules/index.d.ts +6 -5
  456. package/dist/lint/rules/index.d.ts.map +1 -1
  457. package/dist/lint/rules/index.js +6 -2
  458. package/dist/lint/rules/index.js.map +1 -1
  459. package/dist/lint/rules/no-unbound-token-values.d.ts +6 -0
  460. package/dist/lint/rules/no-unbound-token-values.d.ts.map +1 -0
  461. package/dist/lint/rules/no-unbound-token-values.js +79 -0
  462. package/dist/lint/rules/no-unbound-token-values.js.map +1 -0
  463. package/dist/lint/types.d.ts +25 -2
  464. package/dist/lint/types.d.ts.map +1 -1
  465. package/dist/node/video.d.ts +12 -0
  466. package/dist/node/video.d.ts.map +1 -0
  467. package/dist/node/video.js +206 -0
  468. package/dist/node/video.js.map +1 -0
  469. package/dist/pairdraw-api/design-memory.d.ts +19 -0
  470. package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
  471. package/dist/pairdraw-api/design-memory.js +39 -0
  472. package/dist/pairdraw-api/design-memory.js.map +1 -0
  473. package/dist/pairdraw-api/index.d.ts +45 -1
  474. package/dist/pairdraw-api/index.d.ts.map +1 -1
  475. package/dist/pairdraw-api/index.js +55 -2
  476. package/dist/pairdraw-api/index.js.map +1 -1
  477. package/dist/pairdraw-api/nodes.d.ts +12 -1
  478. package/dist/pairdraw-api/nodes.d.ts.map +1 -1
  479. package/dist/pairdraw-api/nodes.js +28 -1
  480. package/dist/pairdraw-api/nodes.js.map +1 -1
  481. package/dist/pairdraw-api/variations.d.ts +48 -0
  482. package/dist/pairdraw-api/variations.d.ts.map +1 -0
  483. package/dist/pairdraw-api/variations.js +76 -0
  484. package/dist/pairdraw-api/variations.js.map +1 -0
  485. package/dist/prototype/easing.d.ts +13 -0
  486. package/dist/prototype/easing.d.ts.map +1 -0
  487. package/dist/prototype/easing.js +36 -0
  488. package/dist/prototype/easing.js.map +1 -0
  489. package/dist/prototype/frames.d.ts +10 -0
  490. package/dist/prototype/frames.d.ts.map +1 -0
  491. package/dist/prototype/frames.js +12 -0
  492. package/dist/prototype/frames.js.map +1 -0
  493. package/dist/prototype/hit.d.ts +17 -0
  494. package/dist/prototype/hit.d.ts.map +1 -0
  495. package/dist/prototype/hit.js +45 -0
  496. package/dist/prototype/hit.js.map +1 -0
  497. package/dist/prototype/index.d.ts +14 -0
  498. package/dist/prototype/index.js +14 -0
  499. package/dist/prototype/pointer.d.ts +63 -0
  500. package/dist/prototype/pointer.d.ts.map +1 -0
  501. package/dist/prototype/pointer.js +104 -0
  502. package/dist/prototype/pointer.js.map +1 -0
  503. package/dist/prototype/reactions.d.ts +45 -0
  504. package/dist/prototype/reactions.d.ts.map +1 -0
  505. package/dist/prototype/reactions.js +122 -0
  506. package/dist/prototype/reactions.js.map +1 -0
  507. package/dist/prototype/scene.d.ts +35 -0
  508. package/dist/prototype/scene.d.ts.map +1 -0
  509. package/dist/prototype/scene.js +86 -0
  510. package/dist/prototype/scene.js.map +1 -0
  511. package/dist/prototype/scenes.d.ts +81 -0
  512. package/dist/prototype/scenes.d.ts.map +1 -0
  513. package/dist/prototype/scenes.js +175 -0
  514. package/dist/prototype/scenes.js.map +1 -0
  515. package/dist/prototype/scroll.d.ts +48 -0
  516. package/dist/prototype/scroll.d.ts.map +1 -0
  517. package/dist/prototype/scroll.js +159 -0
  518. package/dist/prototype/scroll.js.map +1 -0
  519. package/dist/prototype/session.d.ts +71 -0
  520. package/dist/prototype/session.d.ts.map +1 -0
  521. package/dist/prototype/session.js +135 -0
  522. package/dist/prototype/session.js.map +1 -0
  523. package/dist/prototype/smart-animate/animation.d.ts +34 -0
  524. package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
  525. package/dist/prototype/smart-animate/animation.js +212 -0
  526. package/dist/prototype/smart-animate/animation.js.map +1 -0
  527. package/dist/prototype/smart-animate/match.d.ts +24 -0
  528. package/dist/prototype/smart-animate/match.d.ts.map +1 -0
  529. package/dist/prototype/smart-animate/match.js +72 -0
  530. package/dist/prototype/smart-animate/match.js.map +1 -0
  531. package/dist/prototype/snapshot.d.ts +19 -0
  532. package/dist/prototype/snapshot.d.ts.map +1 -0
  533. package/dist/prototype/snapshot.js +56 -0
  534. package/dist/prototype/snapshot.js.map +1 -0
  535. package/dist/prototype/timeline.d.ts +132 -0
  536. package/dist/prototype/timeline.d.ts.map +1 -0
  537. package/dist/prototype/timeline.js +260 -0
  538. package/dist/prototype/timeline.js.map +1 -0
  539. package/dist/rpc/read-commands.js +1 -1
  540. package/dist/text/font/features.d.ts +9 -0
  541. package/dist/text/font/features.d.ts.map +1 -0
  542. package/dist/text/font/features.js +27 -0
  543. package/dist/text/font/features.js.map +1 -0
  544. package/dist/text/font/manager.d.ts +12 -0
  545. package/dist/text/font/manager.d.ts.map +1 -1
  546. package/dist/text/font/manager.js +60 -1
  547. package/dist/text/font/manager.js.map +1 -1
  548. package/dist/text/index.d.ts +10 -8
  549. package/dist/text/index.js +3 -1
  550. package/dist/text/replace-fonts.d.ts +41 -0
  551. package/dist/text/replace-fonts.d.ts.map +1 -0
  552. package/dist/text/replace-fonts.js +121 -0
  553. package/dist/text/replace-fonts.js.map +1 -0
  554. package/dist/tools/analyze/responsive/index.d.ts +15 -0
  555. package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
  556. package/dist/tools/analyze/responsive/index.js +203 -0
  557. package/dist/tools/analyze/responsive/index.js.map +1 -0
  558. package/dist/tools/analyze.d.ts +2 -1
  559. package/dist/tools/analyze.js +2 -1
  560. package/dist/tools/codegen/token-sync.d.ts +7 -0
  561. package/dist/tools/codegen/token-sync.d.ts.map +1 -0
  562. package/dist/tools/codegen/token-sync.js +85 -0
  563. package/dist/tools/codegen/token-sync.js.map +1 -0
  564. package/dist/tools/codegen/tokens.d.ts +1 -1
  565. package/dist/tools/codegen.d.ts +2 -1
  566. package/dist/tools/codegen.js +2 -1
  567. package/dist/tools/create/basic.js +1 -1
  568. package/dist/tools/create/behaviours.js +1 -1
  569. package/dist/tools/create/components.d.ts.map +1 -1
  570. package/dist/tools/create/components.js +4 -0
  571. package/dist/tools/create/components.js.map +1 -1
  572. package/dist/tools/create/html.js +3 -2
  573. package/dist/tools/create/html.js.map +1 -1
  574. package/dist/tools/create/icons.d.ts.map +1 -1
  575. package/dist/tools/create/icons.js +2 -1
  576. package/dist/tools/create/icons.js.map +1 -1
  577. package/dist/tools/create/mermaid.js +2 -1
  578. package/dist/tools/create/mermaid.js.map +1 -1
  579. package/dist/tools/create/render.js +1 -1
  580. package/dist/tools/create/svg.js +2 -1
  581. package/dist/tools/create/svg.js.map +1 -1
  582. package/dist/tools/create/vector.js +1 -1
  583. package/dist/tools/design-memory.d.ts +8 -0
  584. package/dist/tools/design-memory.d.ts.map +1 -0
  585. package/dist/tools/design-memory.js +68 -0
  586. package/dist/tools/design-memory.js.map +1 -0
  587. package/dist/tools/image-ai/generate.d.ts.map +1 -1
  588. package/dist/tools/image-ai/generate.js +3 -1
  589. package/dist/tools/image-ai/generate.js.map +1 -1
  590. package/dist/tools/index.d.ts +2 -1
  591. package/dist/tools/index.js +2 -1
  592. package/dist/tools/modify/fonts.d.ts +6 -0
  593. package/dist/tools/modify/fonts.d.ts.map +1 -0
  594. package/dist/tools/modify/fonts.js +27 -0
  595. package/dist/tools/modify/fonts.js.map +1 -0
  596. package/dist/tools/modify/paint.js +1 -1
  597. package/dist/tools/modify/reactions.d.ts.map +1 -1
  598. package/dist/tools/modify/reactions.js +3 -3
  599. package/dist/tools/modify/reactions.js.map +1 -1
  600. package/dist/tools/modify/text.d.ts.map +1 -1
  601. package/dist/tools/modify/text.js +26 -5
  602. package/dist/tools/modify/text.js.map +1 -1
  603. package/dist/tools/modify/update.d.ts +10 -1
  604. package/dist/tools/modify/update.d.ts.map +1 -1
  605. package/dist/tools/modify/update.js +34 -3
  606. package/dist/tools/modify/update.js.map +1 -1
  607. package/dist/tools/modify.d.ts +2 -1
  608. package/dist/tools/modify.js +2 -1
  609. package/dist/tools/read/fonts.d.ts.map +1 -1
  610. package/dist/tools/read/fonts.js +17 -2
  611. package/dist/tools/read/fonts.js.map +1 -1
  612. package/dist/tools/read/libraries.js +2 -1
  613. package/dist/tools/read/libraries.js.map +1 -1
  614. package/dist/tools/read/space.d.ts +3 -1
  615. package/dist/tools/read/space.d.ts.map +1 -1
  616. package/dist/tools/read/space.js +4 -3
  617. package/dist/tools/read/space.js.map +1 -1
  618. package/dist/tools/registry/core.d.ts +1 -1
  619. package/dist/tools/registry/core.d.ts.map +1 -1
  620. package/dist/tools/registry/core.js +3 -1
  621. package/dist/tools/registry/core.js.map +1 -1
  622. package/dist/tools/registry/extended.d.ts.map +1 -1
  623. package/dist/tools/registry/extended.js +16 -1
  624. package/dist/tools/registry/extended.js.map +1 -1
  625. package/dist/tools/schema.d.ts +18 -2
  626. package/dist/tools/schema.d.ts.map +1 -1
  627. package/dist/tools/schema.js +1 -1
  628. package/dist/tools/schema.js.map +1 -1
  629. package/dist/tools/stock-photo.js +1 -0
  630. package/dist/tools/stock-photo.js.map +1 -1
  631. package/dist/tools/structure/basic.d.ts.map +1 -1
  632. package/dist/tools/structure/basic.js +1 -0
  633. package/dist/tools/structure/basic.js.map +1 -1
  634. package/dist/tools/structure/batch.d.ts.map +1 -1
  635. package/dist/tools/structure/batch.js +8 -1
  636. package/dist/tools/structure/batch.js.map +1 -1
  637. package/dist/tools/structure/hierarchy.d.ts.map +1 -1
  638. package/dist/tools/structure/hierarchy.js +4 -0
  639. package/dist/tools/structure/hierarchy.js.map +1 -1
  640. package/dist/tools/structure/variations.d.ts +8 -0
  641. package/dist/tools/structure/variations.d.ts.map +1 -0
  642. package/dist/tools/structure/variations.js +106 -0
  643. package/dist/tools/structure/variations.js.map +1 -0
  644. package/dist/tools/structure.d.ts +2 -1
  645. package/dist/tools/structure.js +2 -1
  646. package/dist/tools/styles/types.d.ts +2 -4
  647. package/dist/tools/styles/types.d.ts.map +1 -1
  648. package/dist/tools/styles/types.js.map +1 -1
  649. package/dist/tools/vector/boolean.d.ts.map +1 -1
  650. package/dist/tools/vector/boolean.js +4 -0
  651. package/dist/tools/vector/boolean.js.map +1 -1
  652. package/dist/tools/vector/vectorize.js +1 -0
  653. package/dist/tools/vector/vectorize.js.map +1 -1
  654. package/dist/tools/vector/video.d.ts +6 -0
  655. package/dist/tools/vector/video.d.ts.map +1 -0
  656. package/dist/tools/vector/video.js +133 -0
  657. package/dist/tools/vector/video.js.map +1 -0
  658. package/dist/tools/vector.d.ts +2 -1
  659. package/dist/tools/vector.js +2 -1
  660. package/dist/tools/video-host.d.ts +12 -0
  661. package/dist/tools/video-host.d.ts.map +1 -0
  662. package/dist/tools/video-host.js +19 -0
  663. package/dist/tools/video-host.js.map +1 -0
  664. package/dist/vector/point-transform.d.ts +1 -1
  665. package/dist/vector/vectorize/svg/to-vectors.d.ts +1 -1
  666. package/package.json +31 -9
  667. package/src/ai/providers.ts +2 -0
  668. package/src/cache/resource.ts +24 -1
  669. package/src/canvas/effects.ts +47 -50
  670. package/src/canvas/fills.ts +19 -15
  671. package/src/canvas/images/adjustments.ts +203 -0
  672. package/src/canvas/images/sampling.ts +88 -0
  673. package/src/canvas/index.ts +1 -0
  674. package/src/canvas/masks.ts +1 -1
  675. package/src/canvas/noise/render.ts +75 -0
  676. package/src/canvas/noise/shader.ts +161 -0
  677. package/src/canvas/noise/table.ts +91 -0
  678. package/src/canvas/noise/tile.ts +94 -0
  679. package/src/canvas/overlays/auto-layout-hover.ts +47 -65
  680. package/src/canvas/renderer/lifecycle.ts +6 -0
  681. package/src/canvas/renderer/pipeline.ts +19 -1
  682. package/src/canvas/renderer/play-scenes.ts +51 -0
  683. package/src/canvas/renderer/tiles/cache.ts +54 -1
  684. package/src/canvas/renderer/tiles/controller.ts +30 -1
  685. package/src/canvas/renderer/types.ts +18 -2
  686. package/src/canvas/renderer.ts +40 -3
  687. package/src/canvas/scene.ts +65 -9
  688. package/src/canvas/texture.ts +136 -0
  689. package/src/clipboard.ts +23 -10
  690. package/src/constants.ts +6 -0
  691. package/src/design-memory/check.ts +376 -0
  692. package/src/design-memory/describe.ts +77 -0
  693. package/src/design-memory/distil.ts +69 -0
  694. package/src/design-memory/document.ts +80 -0
  695. package/src/design-memory/guard.ts +157 -0
  696. package/src/design-memory/index.ts +8 -0
  697. package/src/design-memory/refusal.ts +90 -0
  698. package/src/design-memory/rules.ts +274 -0
  699. package/src/design-memory/values.ts +179 -0
  700. package/src/editor/bridges/components.ts +2 -0
  701. package/src/editor/clipboard/export.ts +24 -7
  702. package/src/editor/components/instances.ts +31 -0
  703. package/src/editor/create.ts +25 -69
  704. package/src/editor/design-memory.ts +39 -0
  705. package/src/editor/design-tokens.ts +41 -2
  706. package/src/editor/document-colors.ts +65 -0
  707. package/src/editor/eyedropper.ts +198 -0
  708. package/src/editor/fonts.ts +19 -0
  709. package/src/editor/history/atomic-tool.ts +29 -1
  710. package/src/editor/history/capture.ts +19 -0
  711. package/src/editor/history/document-change.ts +5 -17
  712. package/src/editor/history/edit.ts +11 -1
  713. package/src/editor/history/subtree.ts +13 -2
  714. package/src/editor/index.ts +11 -0
  715. package/src/editor/pages.ts +40 -29
  716. package/src/editor/play/states.ts +1 -1
  717. package/src/editor/read-only/actions.ts +4 -0
  718. package/src/editor/render-requests.ts +83 -0
  719. package/src/editor/selection/overlays.ts +1 -0
  720. package/src/editor/tool-registry.ts +2 -1
  721. package/src/editor/types.ts +4 -0
  722. package/src/editor/variations/create.ts +235 -0
  723. package/src/editor/variations/pick.ts +35 -0
  724. package/src/editor/variations.ts +110 -0
  725. package/src/figma-api/accessors/reactions.ts +11 -1
  726. package/src/figma-api/accessors/text/index.ts +7 -0
  727. package/src/figma-api/accessors/text/opentype.ts +33 -0
  728. package/src/figma-api/accessors/visual.ts +55 -2
  729. package/src/figma-api/compatibility.ts +5 -2
  730. package/src/figma-api/effects.ts +143 -5
  731. package/src/figma-api/index.ts +10 -0
  732. package/src/figma-api/overrides.ts +295 -3
  733. package/src/figma-api/paints.ts +24 -9
  734. package/src/figma-api/proxy.ts +6 -1
  735. package/src/figma-api/reactions.ts +130 -32
  736. package/src/figma-api/surface.ts +6 -2
  737. package/src/global.d.ts +26 -0
  738. package/src/io/formats/boolean-path.ts +60 -0
  739. package/src/io/formats/design-tokens/index.ts +21 -0
  740. package/src/io/formats/design-tokens/plan/changes.ts +4 -1
  741. package/src/io/formats/design-tokens/project.ts +40 -9
  742. package/src/io/formats/design-tokens/styles.ts +10 -2
  743. package/src/io/formats/design-tokens/sync/apply.ts +130 -0
  744. package/src/io/formats/design-tokens/sync/drift.ts +587 -0
  745. package/src/io/formats/design-tokens/sync/files.ts +40 -0
  746. package/src/io/formats/drawio/edges.ts +65 -0
  747. package/src/io/formats/drawio/export.ts +37 -14
  748. package/src/io/formats/drawio/index.ts +2 -0
  749. package/src/io/formats/fig/export/patch/index.ts +8 -0
  750. package/src/io/formats/fig/thumbnail-page.ts +4 -4
  751. package/src/io/formats/html/import.ts +9 -1
  752. package/src/io/formats/html/index.ts +14 -7
  753. package/src/io/formats/html/vectors.ts +8 -2
  754. package/src/io/formats/pdf/document.ts +14 -4
  755. package/src/io/formats/pen/imports.ts +5 -6
  756. package/src/io/formats/pen/index.ts +36 -5
  757. package/src/io/formats/raster/adjusted-images.ts +125 -0
  758. package/src/io/formats/raster/headless.ts +3 -3
  759. package/src/io/formats/raster/index.ts +6 -1
  760. package/src/io/formats/raster/pixels.ts +7 -0
  761. package/src/io/formats/raster/render.ts +12 -1
  762. package/src/io/formats/svg/defs.ts +4 -72
  763. package/src/io/formats/svg/effects.ts +131 -0
  764. package/src/io/formats/svg/export.ts +278 -46
  765. package/src/io/formats/svg/filter.ts +47 -0
  766. package/src/io/formats/svg/grain.ts +249 -0
  767. package/src/io/formats/svg/strokes.ts +2 -2
  768. package/src/io/formats/svg/text/layout.ts +13 -3
  769. package/src/io/formats/video/composite.ts +79 -0
  770. package/src/io/formats/video/formats.ts +77 -0
  771. package/src/io/formats/video/gif.ts +65 -0
  772. package/src/io/formats/video/index.ts +30 -0
  773. package/src/io/formats/video/plan.ts +116 -0
  774. package/src/io/formats/video/record.ts +227 -0
  775. package/src/io/formats/video/sink.ts +32 -0
  776. package/src/io/formats/video/size.ts +25 -0
  777. package/src/io/formats/video/webcodecs.ts +89 -0
  778. package/src/io/formats.ts +59 -11
  779. package/src/io/types.ts +29 -10
  780. package/src/layout/auto-layout-handles.ts +396 -0
  781. package/src/layout.ts +2 -0
  782. package/src/lint/fixes.ts +12 -3
  783. package/src/lint/index.ts +3 -1
  784. package/src/lint/linter.ts +107 -10
  785. package/src/lint/presets.ts +2 -0
  786. package/src/lint/rules/design-memory.ts +97 -0
  787. package/src/lint/rules/index.ts +6 -1
  788. package/src/lint/rules/no-unbound-token-values.ts +73 -0
  789. package/src/lint/types.ts +32 -0
  790. package/src/node/video.ts +196 -0
  791. package/src/pairdraw-api/design-memory.ts +61 -0
  792. package/src/pairdraw-api/index.ts +81 -0
  793. package/src/pairdraw-api/nodes.ts +38 -0
  794. package/src/pairdraw-api/variations.ts +109 -0
  795. package/src/prototype/easing.ts +37 -0
  796. package/src/prototype/frames.ts +9 -0
  797. package/src/prototype/hit.ts +70 -0
  798. package/src/prototype/index.ts +69 -0
  799. package/src/prototype/pointer.ts +146 -0
  800. package/src/prototype/reactions.ts +178 -0
  801. package/src/prototype/scene.ts +116 -0
  802. package/src/prototype/scenes.ts +256 -0
  803. package/src/prototype/scroll.ts +190 -0
  804. package/src/prototype/session.ts +188 -0
  805. package/src/prototype/smart-animate/animation.ts +267 -0
  806. package/src/prototype/smart-animate/match.ts +85 -0
  807. package/src/prototype/snapshot.ts +60 -0
  808. package/src/prototype/timeline.ts +400 -0
  809. package/src/text/font/features.ts +27 -0
  810. package/src/text/font/manager.ts +79 -1
  811. package/src/text/index.ts +2 -0
  812. package/src/text/replace-fonts.ts +171 -0
  813. package/src/tools/analyze/responsive/index.ts +264 -0
  814. package/src/tools/analyze.ts +2 -0
  815. package/src/tools/codegen/token-sync.ts +98 -0
  816. package/src/tools/codegen.ts +1 -0
  817. package/src/tools/create/components.ts +4 -0
  818. package/src/tools/create/html.ts +1 -0
  819. package/src/tools/create/icons.ts +1 -0
  820. package/src/tools/create/mermaid.ts +1 -0
  821. package/src/tools/create/svg.ts +1 -0
  822. package/src/tools/design-memory.ts +72 -0
  823. package/src/tools/image-ai/generate.ts +2 -0
  824. package/src/tools/index.ts +1 -0
  825. package/src/tools/modify/fonts.ts +34 -0
  826. package/src/tools/modify/reactions.ts +15 -8
  827. package/src/tools/modify/text.ts +42 -5
  828. package/src/tools/modify/update.ts +46 -2
  829. package/src/tools/modify.ts +1 -0
  830. package/src/tools/read/fonts.ts +24 -2
  831. package/src/tools/read/libraries.ts +1 -0
  832. package/src/tools/read/space.ts +3 -2
  833. package/src/tools/registry/core.ts +3 -1
  834. package/src/tools/registry/extended.ts +28 -1
  835. package/src/tools/schema.ts +28 -4
  836. package/src/tools/stock-photo.ts +1 -0
  837. package/src/tools/structure/basic.ts +1 -0
  838. package/src/tools/structure/batch.ts +12 -1
  839. package/src/tools/structure/hierarchy.ts +4 -0
  840. package/src/tools/structure/variations.ts +118 -0
  841. package/src/tools/structure.ts +2 -0
  842. package/src/tools/styles/types.ts +3 -4
  843. package/src/tools/vector/boolean.ts +4 -0
  844. package/src/tools/vector/vectorize.ts +1 -0
  845. package/src/tools/vector/video.ts +228 -0
  846. package/src/tools/vector.ts +1 -0
  847. package/src/tools/video-host.ts +18 -0
@@ -0,0 +1,106 @@
1
+ import { defineTool, nodeIdInputSchema, toolFailure, toolNumber } from "../schema.js";
2
+ import { PairdrawAPI } from "../../pairdraw-api/index.js";
3
+ import * as v from "valibot";
4
+ import { VARIATION_LABEL_MAX_LENGTH, VARIATION_MAX_COUNT } from "@pairdraw/scene-graph/variations";
5
+ //#region src/tools/structure/variations.ts
6
+ /** What an agent does after making versions, returned with them. */
7
+ const NEXT_STEPS = "Change each version in its own direction by editing the layers inside it (batch_update, set_*, or render with parent_id or replace_id inside the version); keep each version's root layer. Then check them together with export_image of set_id. Do not call pick_variation unless the person asks you to pick or discard.";
8
+ /** A set as the tools report it. */
9
+ function setResult(set) {
10
+ const { id, original, versions } = set.toJSON();
11
+ return {
12
+ set_id: id,
13
+ original,
14
+ versions
15
+ };
16
+ }
17
+ const createVariationsTool = defineTool({
18
+ name: "create_variations",
19
+ description: `Copy a layer 1 to ${VARIATION_MAX_COUNT} times as versions side by side in a section beside it, so the person can compare them and keep one. Label each version with the one idea it tries ("Calmer palette", "Denser list"). Then change the layers inside each version with batch_update, set_* or render (parent_id = the version, or replace_id = a layer inside it); keep each version's own root layer, since a version whose root becomes another kind of layer (a frame for an instance) cannot replace the original. Check them all at once with export_image of the set id. The original does not change. On a version, it copies that version into the same set. Leave picking to the person (pick_variation).`,
20
+ execution: {
21
+ kind: "sync",
22
+ mutation: "document"
23
+ },
24
+ input: v.strictObject({
25
+ id: v.pipe(nodeIdInputSchema, v.description("Layer to vary, or a version to copy")),
26
+ count: toolNumber(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(VARIATION_MAX_COUNT), v.description("How many versions to make"))),
27
+ labels: v.optional(v.pipe(v.array(v.pipe(v.string(), v.maxLength(VARIATION_LABEL_MAX_LENGTH))), v.maxLength(VARIATION_MAX_COUNT), v.description("What each version tries, in order; one per version at most")))
28
+ }),
29
+ execute: (figma, { id, count, labels }) => {
30
+ try {
31
+ const { set, versions } = new PairdrawAPI(figma).createVariations(id, {
32
+ count,
33
+ labels
34
+ });
35
+ const { original } = set.toJSON();
36
+ return {
37
+ set_id: set.id,
38
+ original_id: original?.id ?? id,
39
+ versions: versions.map((version) => ({
40
+ id: version.id,
41
+ name: version.name
42
+ })),
43
+ next: NEXT_STEPS
44
+ };
45
+ } catch (error) {
46
+ return toolFailure(error);
47
+ }
48
+ }
49
+ });
50
+ const listVariations = defineTool({
51
+ name: "list_variations",
52
+ description: "List sets of variations: the set holding a layer (its section, a version, or a layer inside one), or every set on the current page, each with its original and versions.",
53
+ execution: {
54
+ kind: "sync",
55
+ mutation: "none"
56
+ },
57
+ input: v.strictObject({ id: v.optional(v.pipe(nodeIdInputSchema, v.description("A layer in the set to read"))) }),
58
+ execute: (figma, { id }) => {
59
+ try {
60
+ const pairdraw = new PairdrawAPI(figma);
61
+ if (id === void 0) return { sets: pairdraw.variations.map(setResult) };
62
+ const set = pairdraw.getVariations(id);
63
+ return { sets: set ? [setResult(set)] : [] };
64
+ } catch (error) {
65
+ return toolFailure(error);
66
+ }
67
+ }
68
+ });
69
+ const pickVariation = defineTool({
70
+ name: "pick_variation",
71
+ description: "Only when the person asked to pick or discard: keep one version of a set of variations in place of its original, which keeps its id, name, and place, and remove the rest; or discard them all with keep: null.",
72
+ execution: {
73
+ kind: "sync",
74
+ mutation: "document"
75
+ },
76
+ input: v.strictObject({
77
+ set_id: v.pipe(nodeIdInputSchema, v.description("The set, or any layer in it")),
78
+ keep: v.pipe(v.nullable(nodeIdInputSchema), v.description("The version to keep, or null to discard every version"))
79
+ }),
80
+ execute: (figma, { set_id, keep }) => {
81
+ try {
82
+ const set = new PairdrawAPI(figma).getVariations(set_id);
83
+ if (!set) return { error: `"${set_id}" is not in a set of variations` };
84
+ const { original, versions } = set.toJSON();
85
+ if (keep === null) {
86
+ set.discard();
87
+ return {
88
+ original_id: original?.id ?? null,
89
+ kept: null,
90
+ removed: versions.length
91
+ };
92
+ }
93
+ return {
94
+ original_id: set.use(keep).id,
95
+ kept: keep,
96
+ removed: versions.length - 1
97
+ };
98
+ } catch (error) {
99
+ return toolFailure(error);
100
+ }
101
+ }
102
+ });
103
+ //#endregion
104
+ export { createVariationsTool, listVariations, pickVariation };
105
+
106
+ //# sourceMappingURL=variations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variations.js","names":[],"sources":["../../../src/tools/structure/variations.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { VARIATION_LABEL_MAX_LENGTH, VARIATION_MAX_COUNT } from '@pairdraw/scene-graph/variations'\n\nimport { PairdrawAPI, type VariationSetHandle } from '#core/pairdraw-api'\nimport { defineTool, nodeIdInputSchema, toolFailure, toolNumber } from '#core/tools/schema'\n\n/** What an agent does after making versions, returned with them. */\nconst NEXT_STEPS =\n 'Change each version in its own direction by editing the layers inside it (batch_update, ' +\n \"set_*, or render with parent_id or replace_id inside the version); keep each version's root \" +\n 'layer. Then check them together with export_image of set_id. Do not call pick_variation ' +\n 'unless the person asks you to pick or discard.'\n\n/** A set as the tools report it. */\nfunction setResult(set: VariationSetHandle) {\n const { id, original, versions } = set.toJSON()\n return { set_id: id, original, versions }\n}\n\nexport const createVariationsTool = defineTool({\n name: 'create_variations',\n description:\n `Copy a layer 1 to ${VARIATION_MAX_COUNT} times as versions side by side in a section beside it, ` +\n 'so the person can compare them and keep one. Label each version with the one idea it tries ' +\n '(\"Calmer palette\", \"Denser list\"). Then change the layers inside each version with ' +\n 'batch_update, set_* or render (parent_id = the version, or replace_id = a layer inside it); ' +\n \"keep each version's own root layer, since a version whose root becomes another kind of \" +\n 'layer (a frame for an instance) cannot replace the original. Check them all at once with ' +\n 'export_image of the set id. The original does not change. On a version, it copies that ' +\n 'version into the same set. Leave picking to the person (pick_variation).',\n execution: { kind: 'sync', mutation: 'document' },\n input: v.strictObject({\n id: v.pipe(nodeIdInputSchema, v.description('Layer to vary, or a version to copy')),\n count: toolNumber(\n v.pipe(\n v.number(),\n v.integer(),\n v.minValue(1),\n v.maxValue(VARIATION_MAX_COUNT),\n v.description('How many versions to make')\n )\n ),\n labels: v.optional(\n v.pipe(\n v.array(v.pipe(v.string(), v.maxLength(VARIATION_LABEL_MAX_LENGTH))),\n v.maxLength(VARIATION_MAX_COUNT),\n v.description('What each version tries, in order; one per version at most')\n )\n )\n }),\n execute: (figma, { id, count, labels }) => {\n try {\n const { set, versions } = new PairdrawAPI(figma).createVariations(id, { count, labels })\n const { original } = set.toJSON()\n return {\n set_id: set.id,\n original_id: original?.id ?? id,\n versions: versions.map((version) => ({ id: version.id, name: version.name })),\n next: NEXT_STEPS\n }\n } catch (error) {\n return toolFailure(error)\n }\n }\n})\n\nexport const listVariations = defineTool({\n name: 'list_variations',\n description:\n 'List sets of variations: the set holding a layer (its section, a version, or a layer ' +\n 'inside one), or every set on the current page, each with its original and versions.',\n execution: { kind: 'sync', mutation: 'none' },\n input: v.strictObject({\n id: v.optional(v.pipe(nodeIdInputSchema, v.description('A layer in the set to read')))\n }),\n execute: (figma, { id }) => {\n try {\n const pairdraw = new PairdrawAPI(figma)\n if (id === undefined) return { sets: pairdraw.variations.map(setResult) }\n const set = pairdraw.getVariations(id)\n return { sets: set ? [setResult(set)] : [] }\n } catch (error) {\n return toolFailure(error)\n }\n }\n})\n\nexport const pickVariation = defineTool({\n name: 'pick_variation',\n description:\n 'Only when the person asked to pick or discard: keep one version of a set of variations in ' +\n 'place of its original, which keeps its id, name, and place, and remove the rest; or discard ' +\n 'them all with keep: null.',\n execution: { kind: 'sync', mutation: 'document' },\n input: v.strictObject({\n set_id: v.pipe(nodeIdInputSchema, v.description('The set, or any layer in it')),\n keep: v.pipe(\n v.nullable(nodeIdInputSchema),\n v.description('The version to keep, or null to discard every version')\n )\n }),\n execute: (figma, { set_id, keep }) => {\n try {\n const set = new PairdrawAPI(figma).getVariations(set_id)\n if (!set) return { error: `\"${set_id}\" is not in a set of variations` }\n const { original, versions } = set.toJSON()\n if (keep === null) {\n set.discard()\n return { original_id: original?.id ?? null, kept: null, removed: versions.length }\n }\n const kept = set.use(keep)\n return { original_id: kept.id, kept: keep, removed: versions.length - 1 }\n } catch (error) {\n return toolFailure(error)\n }\n }\n})\n"],"mappings":";;;;;;AAQA,MAAM,aACJ;;AAMF,SAAS,UAAU,KAAyB;CAC1C,MAAM,EAAE,IAAI,UAAU,aAAa,IAAI,OAAO;CAC9C,OAAO;EAAE,QAAQ;EAAI;EAAU;CAAS;AAC1C;AAEA,MAAa,uBAAuB,WAAW;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,SAAS,WAAW,IAAI,SAAS,EAAE;GACxE,MAAM,MAAM,SAAS,cAAc,EAAE;GACrC,OAAO,EAAE,MAAM,MAAM,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,EAAE;EAC7C,SAAS,OAAO;GACd,OAAO,YAAY,KAAK;EAC1B;CACF;AACF,CAAC;AAED,MAAa,gBAAgB,WAAW;CACtC,MAAM;CACN,aACE;CAGF,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAW;CAChD,OAAO,EAAE,aAAa;EACpB,QAAQ,EAAE,KAAK,mBAAmB,EAAE,YAAY,6BAA6B,CAAC;EAC9E,MAAM,EAAE,KACN,EAAE,SAAS,iBAAiB,GAC5B,EAAE,YAAY,uDAAuD,CACvE;CACF,CAAC;CACD,UAAU,OAAO,EAAE,QAAQ,WAAW;EACpC,IAAI;GACF,MAAM,MAAM,IAAI,YAAY,KAAK,CAAC,CAAC,cAAc,MAAM;GACvD,IAAI,CAAC,KAAK,OAAO,EAAE,OAAO,IAAI,OAAO,iCAAiC;GACtE,MAAM,EAAE,UAAU,aAAa,IAAI,OAAO;GAC1C,IAAI,SAAS,MAAM;IACjB,IAAI,QAAQ;IACZ,OAAO;KAAE,aAAa,UAAU,MAAM;KAAM,MAAM;KAAM,SAAS,SAAS;IAAO;GACnF;GAEA,OAAO;IAAE,aADI,IAAI,IAAI,IACI,CAAC,CAAC;IAAI,MAAM;IAAM,SAAS,SAAS,SAAS;GAAE;EAC1E,SAAS,OAAO;GACd,OAAO,YAAY,KAAK;EAC1B;CACF;AACF,CAAC"}
@@ -4,4 +4,5 @@ import { nodeAncestors, nodeBindings, nodeChildren, nodeTree } from "./structure
4
4
  import { nodeReplaceWith } from "./structure/replace.js";
5
5
  import { arrangeNodes } from "./structure/arrange.js";
6
6
  import { batchUpdate } from "./structure/batch.js";
7
- export { arrangeNodes, batchUpdate, cloneNode, deleteNode, flattenNodes, groupNodes, nodeAncestors, nodeBindings, nodeBounds, nodeChildren, nodeMove, nodeReplaceWith, nodeResize, nodeToComponent, nodeTree, renameNode, reparentNode, ungroupNode };
7
+ import { createVariationsTool, listVariations, pickVariation } from "./structure/variations.js";
8
+ export { arrangeNodes, batchUpdate, cloneNode, createVariationsTool, deleteNode, flattenNodes, groupNodes, listVariations, nodeAncestors, nodeBindings, nodeBounds, nodeChildren, nodeMove, nodeReplaceWith, nodeResize, nodeToComponent, nodeTree, pickVariation, renameNode, reparentNode, ungroupNode };
@@ -4,4 +4,5 @@ import { nodeAncestors, nodeBindings, nodeChildren, nodeTree } from "./structure
4
4
  import { nodeReplaceWith } from "./structure/replace.js";
5
5
  import { arrangeNodes } from "./structure/arrange.js";
6
6
  import { batchUpdate } from "./structure/batch.js";
7
- export { arrangeNodes, batchUpdate, cloneNode, deleteNode, flattenNodes, groupNodes, nodeAncestors, nodeBindings, nodeBounds, nodeChildren, nodeMove, nodeReplaceWith, nodeResize, nodeToComponent, nodeTree, renameNode, reparentNode, ungroupNode };
7
+ import { createVariationsTool, listVariations, pickVariation } from "./structure/variations.js";
8
+ export { arrangeNodes, batchUpdate, cloneNode, createVariationsTool, deleteNode, flattenNodes, groupNodes, listVariations, nodeAncestors, nodeBindings, nodeBounds, nodeChildren, nodeMove, nodeReplaceWith, nodeResize, nodeToComponent, nodeTree, pickVariation, renameNode, reparentNode, ungroupNode };
@@ -1,3 +1,4 @@
1
+ import { FontFaceReference } from "../../text/replace-fonts.js";
1
2
  //#region src/tools/styles/types.d.ts
2
3
  /**
3
4
  * The curated visual directions `get_style` serves, by id. Each one is Pairdraw's own: tokens
@@ -6,10 +7,7 @@
6
7
  declare const STYLE_ARCHETYPE_IDS: readonly ["swiss-grid", "editorial-serif", "scholarly", "poster-bold", "luxury-noir", "architectural-mono", "soft-minimal", "enterprise-trust", "analytics-console", "bento-showcase", "nordic-light", "wellness-calm", "fintech-night", "neo-brutalist", "playful-pop", "frosted-aurora", "neon-night", "risograph-print", "sketchbook", "terminal", "warm-organic"];
7
8
  type StyleArchetypeId = (typeof STYLE_ARCHETYPE_IDS)[number];
8
9
  /** A font face as the text tools name it: a family the web font services carry and a style. */
9
- interface StyleFont {
10
- family: string;
11
- style: string;
12
- }
10
+ type StyleFont = FontFaceReference;
13
11
  /** The colors of a direction by role, as hex. Text roles meet WCAG AA on what they sit on. */
14
12
  interface StylePalette {
15
13
  /** The page or canvas behind everything. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/tools/styles/types.ts"],"mappings":";;;;;cAIa;KAwBD,2BAA2B;;UAGtB;EACf;EACA;;;UAIe;;EAEf;;EAEA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;UAOe;EACf;;EAEA;EACA;EACA;EACA;EACA;;UAGe;EACf,IAAI;EACJ;;EAEA;;EAEA;;EAEA;EACA;EACA;IAAS,SAAS;IAAW,MAAM;IAAW,OAAO;;;EAErD;EACA,SAAS;;EAET;IAAU;IAAe;IAAgB;;;EAEzC;IAAW;IAAc;;;EAEzB;EACA,WAAW"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/tools/styles/types.ts"],"mappings":";;;;;;cAMa;KAwBD,2BAA2B;;KAG3B,YAAY;;UAGP;;EAEf;;EAEA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;UAOe;EACf;;EAEA;EACA;EACA;EACA;EACA;;UAGe;EACf,IAAI;EACJ;;EAEA;;EAEA;;EAEA;EACA;EACA;IAAS,SAAS;IAAW,MAAM;IAAW,OAAO;;;EAErD;EACA,SAAS;;EAET;IAAU;IAAe;IAAgB;;;EAEzC;IAAW;IAAc;;;EAEzB;EACA,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/tools/styles/types.ts"],"sourcesContent":["/**\n * The curated visual directions `get_style` serves, by id. Each one is Pairdraw's own: tokens\n * here and its written direction in `guides/<id>.md`.\n */\nexport const STYLE_ARCHETYPE_IDS = [\n 'swiss-grid',\n 'editorial-serif',\n 'scholarly',\n 'poster-bold',\n 'luxury-noir',\n 'architectural-mono',\n 'soft-minimal',\n 'enterprise-trust',\n 'analytics-console',\n 'bento-showcase',\n 'nordic-light',\n 'wellness-calm',\n 'fintech-night',\n 'neo-brutalist',\n 'playful-pop',\n 'frosted-aurora',\n 'neon-night',\n 'risograph-print',\n 'sketchbook',\n 'terminal',\n 'warm-organic'\n] as const\n\nexport type StyleArchetypeId = (typeof STYLE_ARCHETYPE_IDS)[number]\n\n/** A font face as the text tools name it: a family the web font services carry and a style. */\nexport interface StyleFont {\n family: string\n style: string\n}\n\n/** The colors of a direction by role, as hex. Text roles meet WCAG AA on what they sit on. */\nexport interface StylePalette {\n /** The page or canvas behind everything. */\n background: string\n /** Cards, panels, and inputs that sit on the background. */\n surface: string\n text: string\n /** Secondary text, captions, and placeholders; readable on background and surface. */\n mutedText: string\n /** Dividers and outlines. */\n border: string\n /** Primary actions, links, and the one color that leads. */\n accent: string\n /** Text and icons placed on the accent. */\n onAccent: string\n /** A second color for tags, highlights, charts, and illustration. */\n highlight: string\n}\n\n/**\n * The elevation a direction gives raised layers, as `set_effects` takes it; null where it keeps\n * layers flat.\n */\nexport interface StyleElevation {\n type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'BACKGROUND_BLUR'\n /** Hex, with alpha as `#RRGGBBAA`; blurs have none. */\n color?: string\n offset_x: number\n offset_y: number\n radius: number\n spread: number\n}\n\nexport interface StyleArchetype {\n id: StyleArchetypeId\n name: string\n /** One sentence on what it looks and feels like. */\n summary: string\n /** Words a request is matched against: moods, eras, and techniques. */\n tags: readonly string[]\n /** Kinds of product, page, or brand it suits. */\n bestFor: readonly string[]\n appearance: 'light' | 'dark'\n fonts: { heading: StyleFont; body: StyleFont; mono?: StyleFont }\n /** Font sizes in pixels, smallest first: caption, body, and up to the display size. */\n typeScale: readonly number[]\n palette: StylePalette\n /** Corner radii in pixels for small controls, cards, and large panels. */\n radius: { small: number; medium: number; large: number }\n /** The base spacing step and the gap between page sections, in pixels. */\n spacing: { unit: number; section: number }\n /** The weight of borders and dividers. */\n strokeWeight: number\n elevation: StyleElevation | null\n}\n"],"mappings":";;;;;AAIA,MAAa,sBAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/tools/styles/types.ts"],"sourcesContent":["import type { FontFaceReference } from '#core/text/replace-fonts'\n\n/**\n * The curated visual directions `get_style` serves, by id. Each one is Pairdraw's own: tokens\n * here and its written direction in `guides/<id>.md`.\n */\nexport const STYLE_ARCHETYPE_IDS = [\n 'swiss-grid',\n 'editorial-serif',\n 'scholarly',\n 'poster-bold',\n 'luxury-noir',\n 'architectural-mono',\n 'soft-minimal',\n 'enterprise-trust',\n 'analytics-console',\n 'bento-showcase',\n 'nordic-light',\n 'wellness-calm',\n 'fintech-night',\n 'neo-brutalist',\n 'playful-pop',\n 'frosted-aurora',\n 'neon-night',\n 'risograph-print',\n 'sketchbook',\n 'terminal',\n 'warm-organic'\n] as const\n\nexport type StyleArchetypeId = (typeof STYLE_ARCHETYPE_IDS)[number]\n\n/** A font face as the text tools name it: a family the web font services carry and a style. */\nexport type StyleFont = FontFaceReference\n\n/** The colors of a direction by role, as hex. Text roles meet WCAG AA on what they sit on. */\nexport interface StylePalette {\n /** The page or canvas behind everything. */\n background: string\n /** Cards, panels, and inputs that sit on the background. */\n surface: string\n text: string\n /** Secondary text, captions, and placeholders; readable on background and surface. */\n mutedText: string\n /** Dividers and outlines. */\n border: string\n /** Primary actions, links, and the one color that leads. */\n accent: string\n /** Text and icons placed on the accent. */\n onAccent: string\n /** A second color for tags, highlights, charts, and illustration. */\n highlight: string\n}\n\n/**\n * The elevation a direction gives raised layers, as `set_effects` takes it; null where it keeps\n * layers flat.\n */\nexport interface StyleElevation {\n type: 'DROP_SHADOW' | 'INNER_SHADOW' | 'BACKGROUND_BLUR'\n /** Hex, with alpha as `#RRGGBBAA`; blurs have none. */\n color?: string\n offset_x: number\n offset_y: number\n radius: number\n spread: number\n}\n\nexport interface StyleArchetype {\n id: StyleArchetypeId\n name: string\n /** One sentence on what it looks and feels like. */\n summary: string\n /** Words a request is matched against: moods, eras, and techniques. */\n tags: readonly string[]\n /** Kinds of product, page, or brand it suits. */\n bestFor: readonly string[]\n appearance: 'light' | 'dark'\n fonts: { heading: StyleFont; body: StyleFont; mono?: StyleFont }\n /** Font sizes in pixels, smallest first: caption, body, and up to the display size. */\n typeScale: readonly number[]\n palette: StylePalette\n /** Corner radii in pixels for small controls, cards, and large panels. */\n radius: { small: number; medium: number; large: number }\n /** The base spacing step and the gap between page sections, in pixels. */\n spacing: { unit: number; section: number }\n /** The weight of borders and dividers. */\n strokeWeight: number\n elevation: StyleElevation | null\n}\n"],"mappings":";;;;;AAMA,MAAa,sBAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"boolean.d.ts","names":[],"sources":["../../../src/tools/vector/boolean.ts"],"mappings":";;cAoBa,cAAA;cAaA,iBAAA;cAaA,kBAAA;cAaA,gBAAA"}
1
+ {"version":3,"file":"boolean.d.ts","names":[],"sources":["../../../src/tools/vector/boolean.ts"],"mappings":";;cAoBa,cAAA;cAcA,iBAAA;cAcA,kBAAA;cAcA,gBAAA"}
@@ -18,6 +18,7 @@ const booleanUnion = defineTool({
18
18
  kind: "sync",
19
19
  mutation: "document"
20
20
  },
21
+ content: "merged",
21
22
  input: v.strictObject({ ids: v.pipe(v.array(v.string()), v.minLength(2), v.description("Node IDs to union")) }),
22
23
  execute: (figma, { ids }) => {
23
24
  return booleanOf(figma, ids, "union");
@@ -30,6 +31,7 @@ const booleanSubtract = defineTool({
30
31
  kind: "sync",
31
32
  mutation: "document"
32
33
  },
34
+ content: "merged",
33
35
  input: v.strictObject({ ids: v.pipe(v.array(v.string()), v.minLength(2), v.description("Node IDs (first minus rest)")) }),
34
36
  execute: (figma, { ids }) => {
35
37
  return booleanOf(figma, ids, "subtract");
@@ -42,6 +44,7 @@ const booleanIntersect = defineTool({
42
44
  kind: "sync",
43
45
  mutation: "document"
44
46
  },
47
+ content: "merged",
45
48
  input: v.strictObject({ ids: v.pipe(v.array(v.string()), v.minLength(2), v.description("Node IDs to intersect")) }),
46
49
  execute: (figma, { ids }) => {
47
50
  return booleanOf(figma, ids, "intersect");
@@ -54,6 +57,7 @@ const booleanExclude = defineTool({
54
57
  kind: "sync",
55
58
  mutation: "document"
56
59
  },
60
+ content: "merged",
57
61
  input: v.strictObject({ ids: v.pipe(v.array(v.string()), v.minLength(2), v.description("Node IDs to exclude")) }),
58
62
  execute: (figma, { ids }) => {
59
63
  return booleanOf(figma, ids, "exclude");
@@ -1 +1 @@
1
- {"version":3,"file":"boolean.js","names":[],"sources":["../../../src/tools/vector/boolean.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type { FigmaAPI } from '#core/figma-api'\nimport { defineTool, nodeSummary, requireNodes, toolFailure } from '#core/tools/schema'\n\n/** Combines the layers in the first one's parent, as Figma's boolean methods do. */\nfunction booleanOf(\n figma: FigmaAPI,\n ids: readonly string[],\n operation: 'union' | 'subtract' | 'intersect' | 'exclude'\n) {\n const nodes = requireNodes(figma, ids)\n if (!nodes) return { error: 'One or more node IDs were not found' }\n try {\n return nodeSummary(figma[operation](nodes, nodes[0].parent ?? figma.currentPage))\n } catch (error) {\n return toolFailure(error)\n }\n}\n\nexport const booleanUnion = defineTool({\n name: 'boolean_union',\n\n description: 'Union (combine) multiple nodes.',\n execution: { kind: 'sync', mutation: 'document' },\n input: v.strictObject({\n ids: v.pipe(v.array(v.string()), v.minLength(2), v.description('Node IDs to union'))\n }),\n execute: (figma, { ids }) => {\n return booleanOf(figma, ids, 'union')\n }\n})\n\nexport const booleanSubtract = defineTool({\n name: 'boolean_subtract',\n\n description: 'Subtract the second node from the first.',\n execution: { kind: 'sync', mutation: 'document' },\n input: v.strictObject({\n ids: v.pipe(v.array(v.string()), v.minLength(2), v.description('Node IDs (first minus rest)'))\n }),\n execute: (figma, { ids }) => {\n return booleanOf(figma, ids, 'subtract')\n }\n})\n\nexport const booleanIntersect = defineTool({\n name: 'boolean_intersect',\n\n description: 'Intersect multiple nodes.',\n execution: { kind: 'sync', mutation: 'document' },\n input: v.strictObject({\n ids: v.pipe(v.array(v.string()), v.minLength(2), v.description('Node IDs to intersect'))\n }),\n execute: (figma, { ids }) => {\n return booleanOf(figma, ids, 'intersect')\n }\n})\n\nexport const booleanExclude = defineTool({\n name: 'boolean_exclude',\n\n description: 'Exclude (XOR) multiple nodes.',\n execution: { kind: 'sync', mutation: 'document' },\n input: v.strictObject({\n ids: v.pipe(v.array(v.string()), v.minLength(2), v.description('Node IDs to exclude'))\n }),\n execute: (figma, { ids }) => {\n return booleanOf(figma, ids, 'exclude')\n }\n})\n"],"mappings":";;;;AAMA,SAAS,UACP,OACA,KACA,WACA;CACA,MAAM,QAAQ,aAAa,OAAO,GAAG;CACrC,IAAI,CAAC,OAAO,OAAO,EAAE,OAAO,sCAAsC;CAClE,IAAI;EACF,OAAO,YAAY,MAAM,UAAU,CAAC,OAAO,MAAM,EAAE,CAAC,UAAU,MAAM,WAAW,CAAC;CAClF,SAAS,OAAO;EACd,OAAO,YAAY,KAAK;CAC1B;AACF;AAEA,MAAa,eAAe,WAAW;CACrC,MAAM;CAEN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAW;CAChD,OAAO,EAAE,aAAa,EACpB,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,YAAY,mBAAmB,CAAC,EACrF,CAAC;CACD,UAAU,OAAO,EAAE,UAAU;EAC3B,OAAO,UAAU,OAAO,KAAK,OAAO;CACtC;AACF,CAAC;AAED,MAAa,kBAAkB,WAAW;CACxC,MAAM;CAEN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAW;CAChD,OAAO,EAAE,aAAa,EACpB,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,YAAY,6BAA6B,CAAC,EAC/F,CAAC;CACD,UAAU,OAAO,EAAE,UAAU;EAC3B,OAAO,UAAU,OAAO,KAAK,UAAU;CACzC;AACF,CAAC;AAED,MAAa,mBAAmB,WAAW;CACzC,MAAM;CAEN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAW;CAChD,OAAO,EAAE,aAAa,EACpB,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,YAAY,uBAAuB,CAAC,EACzF,CAAC;CACD,UAAU,OAAO,EAAE,UAAU;EAC3B,OAAO,UAAU,OAAO,KAAK,WAAW;CAC1C;AACF,CAAC;AAED,MAAa,iBAAiB,WAAW;CACvC,MAAM;CAEN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAW;CAChD,OAAO,EAAE,aAAa,EACpB,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,YAAY,qBAAqB,CAAC,EACvF,CAAC;CACD,UAAU,OAAO,EAAE,UAAU;EAC3B,OAAO,UAAU,OAAO,KAAK,SAAS;CACxC;AACF,CAAC"}
1
+ {"version":3,"file":"boolean.js","names":[],"sources":["../../../src/tools/vector/boolean.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type { FigmaAPI } from '#core/figma-api'\nimport { defineTool, nodeSummary, requireNodes, toolFailure } from '#core/tools/schema'\n\n/** Combines the layers in the first one's parent, as Figma's boolean methods do. */\nfunction booleanOf(\n figma: FigmaAPI,\n ids: readonly string[],\n operation: 'union' | 'subtract' | 'intersect' | 'exclude'\n) {\n const nodes = requireNodes(figma, ids)\n if (!nodes) return { error: 'One or more node IDs were not found' }\n try {\n return nodeSummary(figma[operation](nodes, nodes[0].parent ?? figma.currentPage))\n } catch (error) {\n return toolFailure(error)\n }\n}\n\nexport const booleanUnion = defineTool({\n name: 'boolean_union',\n\n description: 'Union (combine) multiple nodes.',\n execution: { kind: 'sync', mutation: 'document' },\n content: 'merged',\n input: v.strictObject({\n ids: v.pipe(v.array(v.string()), v.minLength(2), v.description('Node IDs to union'))\n }),\n execute: (figma, { ids }) => {\n return booleanOf(figma, ids, 'union')\n }\n})\n\nexport const booleanSubtract = defineTool({\n name: 'boolean_subtract',\n\n description: 'Subtract the second node from the first.',\n execution: { kind: 'sync', mutation: 'document' },\n content: 'merged',\n input: v.strictObject({\n ids: v.pipe(v.array(v.string()), v.minLength(2), v.description('Node IDs (first minus rest)'))\n }),\n execute: (figma, { ids }) => {\n return booleanOf(figma, ids, 'subtract')\n }\n})\n\nexport const booleanIntersect = defineTool({\n name: 'boolean_intersect',\n\n description: 'Intersect multiple nodes.',\n execution: { kind: 'sync', mutation: 'document' },\n content: 'merged',\n input: v.strictObject({\n ids: v.pipe(v.array(v.string()), v.minLength(2), v.description('Node IDs to intersect'))\n }),\n execute: (figma, { ids }) => {\n return booleanOf(figma, ids, 'intersect')\n }\n})\n\nexport const booleanExclude = defineTool({\n name: 'boolean_exclude',\n\n description: 'Exclude (XOR) multiple nodes.',\n execution: { kind: 'sync', mutation: 'document' },\n content: 'merged',\n input: v.strictObject({\n ids: v.pipe(v.array(v.string()), v.minLength(2), v.description('Node IDs to exclude'))\n }),\n execute: (figma, { ids }) => {\n return booleanOf(figma, ids, 'exclude')\n }\n})\n"],"mappings":";;;;AAMA,SAAS,UACP,OACA,KACA,WACA;CACA,MAAM,QAAQ,aAAa,OAAO,GAAG;CACrC,IAAI,CAAC,OAAO,OAAO,EAAE,OAAO,sCAAsC;CAClE,IAAI;EACF,OAAO,YAAY,MAAM,UAAU,CAAC,OAAO,MAAM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KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,YAAY,qBAAqB,CAAC,EACvF,CAAC;CACD,UAAU,OAAO,EAAE,UAAU;EAC3B,OAAO,UAAU,OAAO,KAAK,SAAS;CACxC;AACF,CAAC"}
@@ -22,6 +22,7 @@ const vectorizeImage = defineTool({
22
22
  kind: "async",
23
23
  mutation: "document"
24
24
  },
25
+ content: "imported",
25
26
  capabilities: ["document:write", "network:access"],
26
27
  input: v.strictObject({ id: v.pipe(nodeIdInputSchema, v.description("Layer whose image fill to vectorize")) }),
27
28
  execute: async (figma, { id }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"vectorize.js","names":[],"sources":["../../../src/tools/vector/vectorize.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { defineTool, nodeIdInputSchema, nodeNotFound, toolFailure } from '#core/tools/schema'\nimport {\n createVectorFrameBeside,\n svgToVectorPaths,\n vectorizableImageFill\n} from '#core/vector/vectorize'\n\n/** An image to vectorize: its hash in the document and its encoded bytes. */\nexport interface ImageVectorizeRequest {\n imageHash: string\n bytes: Uint8Array\n}\n\n/**\n * The vectorize service a host set up, such as the app with the user's provider key. It answers\n * with SVG markup, or rejects with a message the agent can pass on to the user.\n */\nexport interface ImageVectorizer {\n vectorize(request: ImageVectorizeRequest): Promise<string>\n}\n\nconst vectorizers = new WeakMap<object, ImageVectorizer>()\n\n/** Lets `vectorize_image` run for the documents of `owner`, a document's graph. */\nexport function registerImageVectorizer(owner: object, vectorizer: ImageVectorizer): () => void {\n vectorizers.set(owner, vectorizer)\n return () => {\n if (vectorizers.get(owner) === vectorizer) vectorizers.delete(owner)\n }\n}\n\nexport function getImageVectorizer(owner: object): ImageVectorizer | undefined {\n return vectorizers.get(owner)\n}\n\nexport const vectorizeImage = defineTool({\n name: 'vectorize_image',\n description:\n 'Convert the image a layer shows (its topmost visible image fill, on a layer of any kind) into editable vector paths with the vectorize service the user set up in Settings. The original layer stays; the paths go in a new frame beside it, whose id is returned. It sends the image to that service with the user’s own key and can take a few minutes, so call it only when the user asks for vectors from an image.',\n execution: { kind: 'async', mutation: 'document' },\n capabilities: ['document:write', 'network:access'],\n input: v.strictObject({\n id: v.pipe(nodeIdInputSchema, v.description('Layer whose image fill to vectorize'))\n }),\n execute: async (figma, { id }) => {\n const graph = figma.graph\n const node = graph.getNode(id)\n if (!node) return nodeNotFound(id)\n const fill = vectorizableImageFill(node)\n if (!fill) return { error: `\"${node.name}\" has no visible image fill to vectorize` }\n const vectorizer = getImageVectorizer(graph)\n if (!vectorizer) {\n return {\n error:\n 'Vectorizing runs in the app, with the vectorize service and key set up in its Settings; it is not available here.'\n }\n }\n const bytes = graph.images.get(fill.imageHash)\n if (!bytes) return { error: `The image data of \"${node.name}\" is missing` }\n\n let svg: string\n try {\n svg = await vectorizer.vectorize({ imageHash: fill.imageHash, bytes })\n } catch (error) {\n return toolFailure(error)\n }\n\n // The service may outlast the layer or its image: another edit can change either meanwhile.\n const current = graph.getNode(id)\n if (!current || vectorizableImageFill(current)?.imageHash !== fill.imageHash) {\n return { error: `The image of \"${node.name}\" changed before vectorizing finished` }\n }\n const vectorized = svgToVectorPaths(svg, { width: current.width, height: current.height })\n if (!vectorized?.paths.length) return { error: 'The vectorize service returned no paths' }\n const frameId = createVectorFrameBeside(graph, id, vectorized)\n const frame = frameId ? graph.getNode(frameId) : undefined\n if (!frame) return { error: `Could not add the vectors beside \"${current.name}\"` }\n return {\n id: frame.id,\n name: frame.name,\n type: frame.type,\n source_id: id,\n paths: frame.childIds.length\n }\n }\n})\n"],"mappings":";;;;;;AAuBA,MAAM,8BAAc,IAAI,QAAiC;;AAGzD,SAAgB,wBAAwB,OAAe,YAAyC;CAC9F,YAAY,IAAI,OAAO,UAAU;CACjC,aAAa;EACX,IAAI,YAAY,IAAI,KAAK,MAAM,YAAY,YAAY,OAAO,KAAK;CACrE;AACF;AAEA,SAAgB,mBAAmB,OAA4C;CAC7E,OAAO,YAAY,IAA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AC,OAAO,OAAO,EAAE,OAAO,qCAAqC,QAAQ,KAAK,GAAG;EACjF,OAAO;GACL,IAAI,MAAM;GACV,MAAM,MAAM;GACZ,MAAM,MAAM;GACZ,WAAW;GACX,OAAO,MAAM,SAAS;EACxB;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"vectorize.js","names":[],"sources":["../../../src/tools/vector/vectorize.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { defineTool, nodeIdInputSchema, nodeNotFound, toolFailure } from '#core/tools/schema'\nimport {\n createVectorFrameBeside,\n svgToVectorPaths,\n vectorizableImageFill\n} from '#core/vector/vectorize'\n\n/** An image to vectorize: its hash in the document and its encoded bytes. */\nexport interface ImageVectorizeRequest {\n imageHash: string\n bytes: Uint8Array\n}\n\n/**\n * The vectorize service a host set up, such as the app with the user's provider key. It answers\n * with SVG markup, or rejects with a message the agent can pass on to the user.\n */\nexport interface ImageVectorizer {\n vectorize(request: ImageVectorizeRequest): Promise<string>\n}\n\nconst vectorizers = new WeakMap<object, ImageVectorizer>()\n\n/** Lets `vectorize_image` run for the documents of `owner`, a document's graph. */\nexport function registerImageVectorizer(owner: object, vectorizer: ImageVectorizer): () => void {\n vectorizers.set(owner, vectorizer)\n return () => {\n if (vectorizers.get(owner) === vectorizer) vectorizers.delete(owner)\n }\n}\n\nexport function getImageVectorizer(owner: object): ImageVectorizer | undefined {\n return vectorizers.get(owner)\n}\n\nexport const vectorizeImage = defineTool({\n name: 'vectorize_image',\n description:\n 'Convert the image a layer shows (its topmost visible image fill, on a layer of any kind) into editable vector paths with the vectorize service the user set up in Settings. The original layer stays; the paths go in a new frame beside it, whose id is returned. It sends the image to that service with the user’s own key and can take a few minutes, so call it only when the user asks for vectors from an image.',\n execution: { kind: 'async', mutation: 'document' },\n content: 'imported',\n capabilities: ['document:write', 'network:access'],\n input: v.strictObject({\n id: v.pipe(nodeIdInputSchema, v.description('Layer whose image fill to vectorize'))\n }),\n execute: async (figma, { id }) => {\n const graph = figma.graph\n const node = graph.getNode(id)\n if (!node) return nodeNotFound(id)\n const fill = vectorizableImageFill(node)\n if (!fill) return { error: `\"${node.name}\" has no visible image fill to vectorize` }\n const vectorizer = getImageVectorizer(graph)\n if (!vectorizer) {\n return {\n error:\n 'Vectorizing runs in the app, with the vectorize service and key set up in its Settings; it is not available here.'\n }\n }\n const bytes = graph.images.get(fill.imageHash)\n if (!bytes) return { error: `The image data of \"${node.name}\" is missing` }\n\n let svg: string\n try {\n svg = await vectorizer.vectorize({ imageHash: fill.imageHash, bytes })\n } catch (error) {\n return toolFailure(error)\n }\n\n // The service may outlast the layer or its image: another edit can change either meanwhile.\n const current = graph.getNode(id)\n if (!current || vectorizableImageFill(current)?.imageHash !== fill.imageHash) {\n return { error: `The image of \"${node.name}\" changed before vectorizing finished` }\n }\n const vectorized = svgToVectorPaths(svg, { width: current.width, height: current.height })\n if (!vectorized?.paths.length) return { error: 'The vectorize service returned no paths' }\n const frameId = createVectorFrameBeside(graph, id, vectorized)\n const frame = frameId ? graph.getNode(frameId) : undefined\n if (!frame) return { error: `Could not add the vectors beside \"${current.name}\"` }\n return {\n id: frame.id,\n name: frame.name,\n type: frame.type,\n source_id: id,\n paths: frame.childIds.length\n }\n }\n})\n"],"mappings":";;;;;;AAuBA,MAAM,8BAAc,IAAI,QAAiC;;AAGzD,SAAgB,wBAAwB,OAAe,YAAyC;CAC9F,YAAY,IAAI,OAAO,UAAU;CACjC,aAAa;EACX,IAAI,YAAY,IAAI,KAAK,MAAM,YAAY,YAAY,OAAO,KAAK;CACrE;AACF;AAEA,SAAgB,mBAAmB,OAA4C;CAC7E,OAAO,YAAY,IAAI,KAAK;AAC9B;AAEA,MAAa,iBAAiB,WAAW;CACvC,MAAM;CACN,aACE;CACF,WAAW;EAAE,MAAM;EAAS,UAAU;CAAW;CACjD,SAAS;CACT,cAAc,CAAC,kBAAkB,gBAAgB;CACjD,OAAO,EAAE,aAAa,EACpB,IAAI,EAAE,KAAK,mBAAmB,EAAE,YAAY,qCA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from "../schema.js";
2
+ //#region src/tools/vector/video.d.ts
3
+ declare const exportVideo: ToolDef;
4
+ //#endregion
5
+ export { exportVideo };
6
+ //# sourceMappingURL=video.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.d.ts","names":[],"sources":["../../../src/tools/vector/video.ts"],"mappings":";;cAiCa,aAAA"}
@@ -0,0 +1,133 @@
1
+ import { defineTool, toolNumber } from "../schema.js";
2
+ import { framesOnPage } from "../../prototype/frames.js";
3
+ import { startFrame } from "../../prototype/session.js";
4
+ import { getVideoEncoder } from "../video-host.js";
5
+ import { fromUint8Array } from "js-base64";
6
+ import * as v from "valibot";
7
+ //#region src/tools/vector/video.ts
8
+ /** A top-level frame of the page by ID or name. */
9
+ function pageFrame(graph, pageId, ref) {
10
+ const frames = framesOnPage(graph, pageId);
11
+ return frames.find((frame) => frame.id === ref) ?? frames.find((frame) => frame.name === ref) ?? null;
12
+ }
13
+ /** A layer on the page by ID or name, the first in layer order when names repeat. */
14
+ function pageNode(graph, pageId, ref) {
15
+ const byId = graph.getNode(ref);
16
+ if (byId) return byId;
17
+ const pending = [...graph.getChildren(pageId)];
18
+ for (let node = pending.shift(); node; node = pending.shift()) {
19
+ if (node.name === ref) return node;
20
+ pending.unshift(...graph.getChildren(node.id));
21
+ }
22
+ return null;
23
+ }
24
+ function seconds(ms) {
25
+ return Math.round(ms) / 1e3;
26
+ }
27
+ const exportVideo = defineTool({
28
+ name: "export_video",
29
+ description: "Record a prototype as a video, as Play shows it: start at a top-level frame, follow its After delay interactions (and optional scripted clicks) with their Dissolve and Smart animate transitions on a virtual clock, and return the file as base64 with the steps it recorded. The clip ends when play returns to the start frame (loops: true), when nothing else happens (the last frame is held `tail` seconds), or at maxDuration (truncated: true). Pass path to write the file instead of returning it.",
30
+ execution: {
31
+ kind: "async",
32
+ mutation: "none",
33
+ long: true
34
+ },
35
+ exposure: { webmcp: false },
36
+ input: v.strictObject({
37
+ start: v.optional(v.pipe(v.string(), v.description("Top-level frame ID or name to start from (default: the selected frame, or the page’s first frame)"))),
38
+ format: v.optional(v.pipe(v.picklist([
39
+ "mp4",
40
+ "gif",
41
+ "webm"
42
+ ]), v.description("File format: mp4 (H.264, default), gif, or webm (VP9). MP4 and WebM need WebCodecs, which the app has, or headlessly an ffmpeg on the path")), "mp4"),
43
+ fps: v.optional(toolNumber(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(60), v.description("Frames per second (default: 30, or 15 for GIF, which plays at most 50)")))),
44
+ scale: v.optional(toolNumber(v.pipe(v.number(), v.minValue(.1), v.maxValue(4), v.description("Size of the start frame in the video (default: 1)"))), 1),
45
+ maxEdge: v.optional(toolNumber(v.pipe(v.number(), v.minValue(64), v.maxValue(3840), v.description("Longest width or height in pixels (default: 1920). A GIF is capped at 960 even when this is larger")))),
46
+ maxDuration: v.optional(toolNumber(v.pipe(v.number(), v.minValue(1), v.maxValue(120), v.description("Seconds the clip may last at most (default: 30)"))), 30),
47
+ tail: v.optional(toolNumber(v.pipe(v.number(), v.minValue(0), v.maxValue(10), v.description("Seconds the last frame stays when the flow ends (default: 1)"))), 1),
48
+ clicks: v.optional(v.pipe(v.array(v.strictObject({
49
+ at: toolNumber(v.pipe(v.number(), v.minValue(0), v.description("Seconds from the start"))),
50
+ node: v.pipe(v.string(), v.description("Layer ID or name to click"))
51
+ })), v.description("Clicks to run as play goes, each on a layer of the frame shown at that time, as a click in Play"))),
52
+ path: v.optional(v.pipe(v.string(), v.description("Write the video to this path instead of returning it (requires PAIRDRAW_MCP_ROOT)")))
53
+ }),
54
+ execute: async (figma, args, signal) => {
55
+ const [{ TimelineError }, video] = await Promise.all([import("../../prototype/index.js"), import("../../io/formats/video/index.js")]);
56
+ const graph = figma.graph;
57
+ const pageId = figma.currentPageId;
58
+ const selected = new Set(figma.currentPage.selection.map((node) => node.id));
59
+ const startId = args.start ? pageFrame(graph, pageId, args.start)?.id : startFrame(graph, pageId, selected);
60
+ const start = startId ? graph.getNode(startId) : void 0;
61
+ if (!start) return { error: args.start ? `No top-level frame named or with ID '${args.start}' on this page` : "This page has no frames to play" };
62
+ const clicks = [];
63
+ for (const click of args.clicks ?? []) {
64
+ const node = pageNode(graph, pageId, click.node);
65
+ if (!node) return { error: `No layer named or with ID '${click.node}' on this page` };
66
+ clicks.push({
67
+ atMs: click.at * 1e3,
68
+ nodeId: node.id
69
+ });
70
+ }
71
+ const { exportImage, exportGraphImage, rasterCodec } = figma;
72
+ if (!exportImage || !rasterCodec) return { error: "Video export is not available in this environment" };
73
+ const render = video.exportedFrameRenderer((frameId, scale, copy) => copy ? exportGraphImage?.(copy, pageId, [frameId], {
74
+ scale,
75
+ format: "PNG"
76
+ }) ?? Promise.resolve(null) : exportImage([frameId], {
77
+ scale,
78
+ format: "PNG",
79
+ pageId
80
+ }), rasterCodec);
81
+ let plan;
82
+ let recorded;
83
+ try {
84
+ plan = video.planPrototypeVideo(graph, {
85
+ startFrameId: start.id,
86
+ format: args.format,
87
+ scale: args.scale,
88
+ maxEdge: args.maxEdge,
89
+ fps: args.fps,
90
+ maxMs: args.maxDuration * 1e3,
91
+ tailMs: args.tail * 1e3,
92
+ clicks
93
+ });
94
+ recorded = await video.recordPrototypeVideo(graph, plan, render, {
95
+ host: getVideoEncoder(graph),
96
+ signal
97
+ });
98
+ } catch (error) {
99
+ if (signal?.aborted) return { error: "Video export was cancelled" };
100
+ if (error instanceof TimelineError || error instanceof video.VideoFormatError) return { error: error.message };
101
+ throw error;
102
+ }
103
+ const { timeline, width, height, fps } = plan;
104
+ const { bytes, frameCount } = recorded;
105
+ return {
106
+ mimeType: video.VIDEO_MIME_TYPES[args.format],
107
+ base64: fromUint8Array(bytes),
108
+ byteLength: bytes.length,
109
+ width,
110
+ height,
111
+ fps,
112
+ durationMs: timeline.durationMs,
113
+ frameCount,
114
+ loops: timeline.loops,
115
+ truncated: timeline.truncated,
116
+ skippedClicks: timeline.skippedClicks.map((click) => ({
117
+ at: seconds(click.atMs),
118
+ node: graph.getNode(click.nodeId)?.name ?? click.nodeId
119
+ })),
120
+ steps: timeline.steps.map((step) => ({
121
+ at: seconds(step.atMs),
122
+ frame: graph.getNode(step.frameId)?.name ?? step.frameId,
123
+ frameId: step.frameId,
124
+ trigger: step.trigger,
125
+ transition: step.transition
126
+ }))
127
+ };
128
+ }
129
+ });
130
+ //#endregion
131
+ export { exportVideo };
132
+
133
+ //# sourceMappingURL=video.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.js","names":[],"sources":["../../../src/tools/vector/video.ts"],"sourcesContent":["import { fromUint8Array } from 'js-base64'\nimport * as v from 'valibot'\n\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\n\nimport { framesOnPage, startFrame } from '#core/prototype'\nimport { defineTool, toolNumber } from '#core/tools/schema'\nimport { getVideoEncoder } from '#core/tools/video-host'\n\n/** A top-level frame of the page by ID or name. */\nfunction pageFrame(graph: SceneGraph, pageId: string, ref: string): SceneNode | null {\n const frames = framesOnPage(graph, pageId)\n return (\n frames.find((frame) => frame.id === ref) ?? frames.find((frame) => frame.name === ref) ?? null\n )\n}\n\n/** A layer on the page by ID or name, the first in layer order when names repeat. */\nfunction pageNode(graph: SceneGraph, pageId: string, ref: string): SceneNode | null {\n const byId = graph.getNode(ref)\n if (byId) return byId\n const pending = [...graph.getChildren(pageId)]\n for (let node = pending.shift(); node; node = pending.shift()) {\n if (node.name === ref) return node\n pending.unshift(...graph.getChildren(node.id))\n }\n return null\n}\n\nfunction seconds(ms: number): number {\n return Math.round(ms) / 1000\n}\n\nexport const exportVideo = defineTool({\n name: 'export_video',\n description:\n 'Record a prototype as a video, as Play shows it: start at a top-level frame, follow its After delay interactions (and optional scripted clicks) with their Dissolve and Smart animate transitions on a virtual clock, and return the file as base64 with the steps it recorded. ' +\n 'The clip ends when play returns to the start frame (loops: true), when nothing else happens (the last frame is held `tail` seconds), or at maxDuration (truncated: true). Pass path to write the file instead of returning it.',\n execution: { kind: 'async', mutation: 'none', long: true },\n exposure: { webmcp: false },\n input: v.strictObject({\n start: v.optional(\n v.pipe(\n v.string(),\n v.description(\n 'Top-level frame ID or name to start from (default: the selected frame, or the page’s first frame)'\n )\n )\n ),\n format: v.optional(\n v.pipe(\n v.picklist(['mp4', 'gif', 'webm']),\n v.description(\n 'File format: mp4 (H.264, default), gif, or webm (VP9). MP4 and WebM need WebCodecs, which the app has, or headlessly an ffmpeg on the path'\n )\n ),\n 'mp4'\n ),\n fps: v.optional(\n toolNumber(\n v.pipe(\n v.number(),\n v.integer(),\n v.minValue(1),\n v.maxValue(60),\n v.description('Frames per second (default: 30, or 15 for GIF, which plays at most 50)')\n )\n )\n ),\n scale: v.optional(\n toolNumber(\n v.pipe(\n v.number(),\n v.minValue(0.1),\n v.maxValue(4),\n v.description('Size of the start frame in the video (default: 1)')\n )\n ),\n 1\n ),\n maxEdge: v.optional(\n toolNumber(\n v.pipe(\n v.number(),\n v.minValue(64),\n v.maxValue(3840),\n v.description(\n 'Longest width or height in pixels (default: 1920). A GIF is capped at 960 even when this is larger'\n )\n )\n )\n ),\n maxDuration: v.optional(\n toolNumber(\n v.pipe(\n v.number(),\n v.minValue(1),\n v.maxValue(120),\n v.description('Seconds the clip may last at most (default: 30)')\n )\n ),\n 30\n ),\n tail: v.optional(\n toolNumber(\n v.pipe(\n v.number(),\n v.minValue(0),\n v.maxValue(10),\n v.description('Seconds the last frame stays when the flow ends (default: 1)')\n )\n ),\n 1\n ),\n clicks: v.optional(\n v.pipe(\n v.array(\n v.strictObject({\n at: toolNumber(\n v.pipe(v.number(), v.minValue(0), v.description('Seconds from the start'))\n ),\n node: v.pipe(v.string(), v.description('Layer ID or name to click'))\n })\n ),\n v.description(\n 'Clicks to run as play goes, each on a layer of the frame shown at that time, as a click in Play'\n )\n )\n ),\n path: v.optional(\n v.pipe(\n v.string(),\n v.description(\n 'Write the video to this path instead of returning it (requires PAIRDRAW_MCP_ROOT)'\n )\n )\n )\n }),\n execute: async (figma, args, signal) => {\n const [{ TimelineError }, video] = await Promise.all([\n import('#core/prototype'),\n import('#core/io/formats/video')\n ])\n const graph = figma.graph\n const pageId = figma.currentPageId\n const selected = new Set(figma.currentPage.selection.map((node) => node.id))\n const startId = args.start\n ? pageFrame(graph, pageId, args.start)?.id\n : startFrame(graph, pageId, selected)\n const start = startId ? graph.getNode(startId) : undefined\n if (!start) {\n return {\n error: args.start\n ? `No top-level frame named or with ID '${args.start}' on this page`\n : 'This page has no frames to play'\n }\n }\n const clicks = []\n for (const click of args.clicks ?? []) {\n const node = pageNode(graph, pageId, click.node)\n if (!node) return { error: `No layer named or with ID '${click.node}' on this page` }\n clicks.push({ atMs: click.at * 1000, nodeId: node.id })\n }\n const { exportImage, exportGraphImage, rasterCodec } = figma\n if (!exportImage || !rasterCodec) {\n return { error: 'Video export is not available in this environment' }\n }\n // A Smart animate's posed copy keeps the document's ids, its page among them.\n const render = video.exportedFrameRenderer(\n (frameId, scale, copy) =>\n copy\n ? (exportGraphImage?.(copy, pageId, [frameId], { scale, format: 'PNG' }) ??\n Promise.resolve(null))\n : exportImage([frameId], { scale, format: 'PNG', pageId }),\n rasterCodec\n )\n\n let plan\n let recorded\n try {\n plan = video.planPrototypeVideo(graph, {\n startFrameId: start.id,\n format: args.format,\n scale: args.scale,\n maxEdge: args.maxEdge,\n fps: args.fps,\n maxMs: args.maxDuration * 1000,\n tailMs: args.tail * 1000,\n clicks\n })\n recorded = await video.recordPrototypeVideo(graph, plan, render, {\n host: getVideoEncoder(graph),\n signal\n })\n } catch (error) {\n if (signal?.aborted) return { error: 'Video export was cancelled' }\n if (error instanceof TimelineError || error instanceof video.VideoFormatError) {\n return { error: error.message }\n }\n throw error\n }\n const { timeline, width, height, fps } = plan\n const { bytes, frameCount } = recorded\n return {\n mimeType: video.VIDEO_MIME_TYPES[args.format],\n base64: fromUint8Array(bytes),\n byteLength: bytes.length,\n width,\n height,\n fps,\n durationMs: timeline.durationMs,\n frameCount,\n loops: timeline.loops,\n truncated: timeline.truncated,\n skippedClicks: timeline.skippedClicks.map((click) => ({\n at: seconds(click.atMs),\n node: graph.getNode(click.nodeId)?.name ?? click.nodeId\n })),\n steps: timeline.steps.map((step) => ({\n at: seconds(step.atMs),\n frame: graph.getNode(step.frameId)?.name ?? step.frameId,\n frameId: step.frameId,\n trigger: step.trigger,\n transition: step.transition\n }))\n }\n }\n})\n"],"mappings":";;;;;;;;AAUA,SAAS,UAAU,OAAmB,QAAgB,KAA+B;CACnF,MAAM,SAAS,aAAa,OAAO,MAAM;CACzC,OACE,OAAO,MAAM,UAAU,MAAM,OAAO,GAAG,KAAK,OAAO,MAAM,UAAU,MAAM,SAAS,GAAG,KAAK;AAE9F;;AAGA,SAAS,SAAS,OAAmB,QAAgB,KAA+B;CAClF,MAAM,OAAO,MAAM,QAAQ,GAAG;CAC9B,IAAI,MAAM,OAAO;CACjB,MAAM,UAAU,CAAC,GAAG,MAAM,YAAY,MAAM,CAAC;CAC7C,KAAK,IAAI,OAAO,QAAQ,MAAM,GAAG,MAAM,OAAO,QAAQ,MAAM,GAAG;EAC7D,IAAI,KAAK,SAAS,KAAK,OAAO;EAC9B,QAAQ,QAAQ,GAAG,MAAM,YAAY,KAAK,EAAE,CAAC;CAC/C;CACA,OAAO;AACT;AAEA,SAAS,QAAQ,IAAoB;CACnC,OAAO,KAAK,MAAM,EAAE,IAAI;AAC1B;AAEA,MAAa,cAAc,WAAW;CACpC,MAAM;CACN,aACE;CAEF,WAAW;EAAE,MAAM;EAAS,UAAU;EAAQ,MAAM;CAAK;CACzD,UAAU,EAAE,QAAQ,MAAM;CAC1B,OAAO,EAAE,aAAa;EACpB,OAAO,EAAE,SACP,EAAE,KACA,EAAE,OAAO,GACT,EAAE,YACA,mGACF,CACF,CACF;EACA,QAAQ,EAAE,SACR,EAAE,KACA,EAAE,SAAS;GAAC;GAAO;GAAO;EAAM,CAAC,GACjC,EAAE,YACA,4IACF,CACF,GACA,KACF;EACA,KAAK,EAAE,SACL,WACE,EAAE,KACA,EAAE,OAAO,GACT,EAAE,QAAQ,GACV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Q,SAAS,OAAO,EAAE,OAAO,6BAA6B;GAClE,IAAI,iBAAiB,iBAAiB,iBAAiB,MAAM,kBAC3D,OAAO,EAAE,OAAO,MAAM,QAAQ;GAEhC,MAAM;EACR;EACA,MAAM,EAAE,UAAU,OAAO,QAAQ,QAAQ;EACzC,MAAM,EAAE,OAAO,eAAe;EAC9B,OAAO;GACL,UAAU,MAAM,iBAAiB,KAAK;GACtC,QAAQ,eAAe,KAAK;GAC5B,YAAY,MAAM;GAClB;GACA;GACA;GACA,YAAY,SAAS;GACrB;GACA,OAAO,SAAS;GAChB,WAAW,SAAS;GACpB,eAAe,SAAS,cAAc,KAAK,WAAW;IACpD,IAAI,QAAQ,MAAM,IAAI;IACtB,MAAM,MAAM,QAAQ,MAAM,MAAM,CAAC,EAAE,QAAQ,MAAM;GACnD,EAAE;GACF,OAAO,SAAS,MAAM,KAAK,UAAU;IACnC,IAAI,QAAQ,KAAK,IAAI;IACrB,OAAO,MAAM,QAAQ,KAAK,OAAO,CAAC,EAAE,QAAQ,KAAK;IACjD,SAAS,KAAK;IACd,SAAS,KAAK;IACd,YAAY,KAAK;GACnB,EAAE;EACJ;CACF;AACF,CAAC"}
@@ -3,4 +3,5 @@ import { booleanExclude, booleanIntersect, booleanSubtract, booleanUnion } from
3
3
  import { pathFlip, pathGet, pathMove, pathScale, pathSet } from "./vector/path.js";
4
4
  import { viewportGet, viewportSet, viewportZoomToFit } from "./vector/viewport.js";
5
5
  import { exportHTML, exportImage, exportPDF, exportSVG } from "./vector/export.js";
6
- export { type ImageVectorizeRequest, type ImageVectorizer, booleanExclude, booleanIntersect, booleanSubtract, booleanUnion, exportHTML, exportImage, exportPDF, exportSVG, getImageVectorizer, pathFlip, pathGet, pathMove, pathScale, pathSet, registerImageVectorizer, vectorizeImage, viewportGet, viewportSet, viewportZoomToFit };
6
+ import { exportVideo } from "./vector/video.js";
7
+ export { type ImageVectorizeRequest, type ImageVectorizer, booleanExclude, booleanIntersect, booleanSubtract, booleanUnion, exportHTML, exportImage, exportPDF, exportSVG, exportVideo, getImageVectorizer, pathFlip, pathGet, pathMove, pathScale, pathSet, registerImageVectorizer, vectorizeImage, viewportGet, viewportSet, viewportZoomToFit };
@@ -2,5 +2,6 @@ import { exportHTML, exportImage, exportPDF, exportSVG } from "./vector/export.j
2
2
  import { booleanExclude, booleanIntersect, booleanSubtract, booleanUnion } from "./vector/boolean.js";
3
3
  import { pathFlip, pathGet, pathMove, pathScale, pathSet } from "./vector/path.js";
4
4
  import { viewportGet, viewportSet, viewportZoomToFit } from "./vector/viewport.js";
5
+ import { exportVideo } from "./vector/video.js";
5
6
  import { getImageVectorizer, registerImageVectorizer, vectorizeImage } from "./vector/vectorize.js";
6
- export { booleanExclude, booleanIntersect, booleanSubtract, booleanUnion, exportHTML, exportImage, exportPDF, exportSVG, getImageVectorizer, pathFlip, pathGet, pathMove, pathScale, pathSet, registerImageVectorizer, vectorizeImage, viewportGet, viewportSet, viewportZoomToFit };
7
+ export { booleanExclude, booleanIntersect, booleanSubtract, booleanUnion, exportHTML, exportImage, exportPDF, exportSVG, exportVideo, getImageVectorizer, pathFlip, pathGet, pathMove, pathScale, pathSet, registerImageVectorizer, vectorizeImage, viewportGet, viewportSet, viewportZoomToFit };
@@ -0,0 +1,12 @@
1
+ import { VideoHostEncoder } from "../io/formats/video/formats.js";
2
+ import "../io/formats/video/index.js";
3
+ //#region src/tools/video-host.d.ts
4
+ /**
5
+ * Lets `export_video` encode, for the documents of `owner` (a document's graph), the formats
6
+ * WebCodecs cannot encode in that host, as the CLI does with ffmpeg. The app needs none.
7
+ */
8
+ declare function registerVideoEncoder(owner: object, encoder: VideoHostEncoder): () => void;
9
+ declare function getVideoEncoder(owner: object): VideoHostEncoder | undefined;
10
+ //#endregion
11
+ export { getVideoEncoder, registerVideoEncoder };
12
+ //# sourceMappingURL=video-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-host.d.ts","names":[],"sources":["../../src/tools/video-host.ts"],"mappings":";;;;;;;iBAQgB,qBAAqB,eAAe,SAAS;iBAO7C,gBAAgB,gBAAgB"}
@@ -0,0 +1,19 @@
1
+ //#region src/tools/video-host.ts
2
+ const encoders = /* @__PURE__ */ new WeakMap();
3
+ /**
4
+ * Lets `export_video` encode, for the documents of `owner` (a document's graph), the formats
5
+ * WebCodecs cannot encode in that host, as the CLI does with ffmpeg. The app needs none.
6
+ */
7
+ function registerVideoEncoder(owner, encoder) {
8
+ encoders.set(owner, encoder);
9
+ return () => {
10
+ if (encoders.get(owner) === encoder) encoders.delete(owner);
11
+ };
12
+ }
13
+ function getVideoEncoder(owner) {
14
+ return encoders.get(owner);
15
+ }
16
+ //#endregion
17
+ export { getVideoEncoder, registerVideoEncoder };
18
+
19
+ //# sourceMappingURL=video-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-host.js","names":[],"sources":["../../src/tools/video-host.ts"],"sourcesContent":["import type { VideoHostEncoder } from '#core/io/formats/video'\n\nconst encoders = new WeakMap<object, VideoHostEncoder>()\n\n/**\n * Lets `export_video` encode, for the documents of `owner` (a document's graph), the formats\n * WebCodecs cannot encode in that host, as the CLI does with ffmpeg. The app needs none.\n */\nexport function registerVideoEncoder(owner: object, encoder: VideoHostEncoder): () => void {\n encoders.set(owner, encoder)\n return () => {\n if (encoders.get(owner) === encoder) encoders.delete(owner)\n }\n}\n\nexport function getVideoEncoder(owner: object): VideoHostEncoder | undefined {\n return encoders.get(owner)\n}\n"],"mappings":";AAEA,MAAM,2BAAW,IAAI,QAAkC;;;;;AAMvD,SAAgB,qBAAqB,OAAe,SAAuC;CACzF,SAAS,IAAI,OAAO,OAAO;CAC3B,aAAa;EACX,IAAI,SAAS,IAAI,KAAK,MAAM,SAAS,SAAS,OAAO,KAAK;CAC5D;AACF;AAEA,SAAgB,gBAAgB,OAA6C;CAC3E,OAAO,SAAS,IAAI,KAAK;AAC3B"}
@@ -1,6 +1,6 @@
1
1
  import { HandlePosition } from "../geometry/transform-zones.js";
2
- import { VectorNetwork, VectorSegment } from "@pairdraw/scene-graph";
3
2
  import { Mat3 } from "@pairdraw/scene-graph/matrix";
3
+ import { VectorNetwork, VectorSegment } from "@pairdraw/scene-graph";
4
4
  import { Rect, Vector } from "@pairdraw/scene-graph/primitives";
5
5
  //#region src/vector/point-transform.d.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { SVGElementLayer, SVGTextPiece, SVGTextRun } from "../../../icons/types.js";
2
- import { Fill, Stroke, VectorNetwork } from "@pairdraw/scene-graph";
3
2
  import { Mat3 } from "@pairdraw/scene-graph/matrix";
3
+ import { Fill, Stroke, VectorNetwork } from "@pairdraw/scene-graph";
4
4
  import { Rect, Size } from "@pairdraw/scene-graph/primitives";
5
5
  //#region src/vector/vectorize/svg/to-vectors.d.ts
6
6
  interface VectorizedClip {