@pairdraw/core 0.19.1 → 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 (1031) 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/previews.d.ts +1 -1
  20. package/dist/canvas/images/sampling.d.ts +13 -0
  21. package/dist/canvas/images/sampling.d.ts.map +1 -0
  22. package/dist/canvas/images/sampling.js +49 -0
  23. package/dist/canvas/images/sampling.js.map +1 -0
  24. package/dist/canvas/index.d.ts +2 -2
  25. package/dist/canvas/masks.d.ts +1 -1
  26. package/dist/canvas/masks.d.ts.map +1 -1
  27. package/dist/canvas/masks.js.map +1 -1
  28. package/dist/canvas/noise/render.d.ts +15 -0
  29. package/dist/canvas/noise/render.d.ts.map +1 -0
  30. package/dist/canvas/noise/render.js +56 -0
  31. package/dist/canvas/noise/render.js.map +1 -0
  32. package/dist/canvas/noise/shader.d.ts +43 -0
  33. package/dist/canvas/noise/shader.d.ts.map +1 -0
  34. package/dist/canvas/noise/shader.js +161 -0
  35. package/dist/canvas/noise/shader.js.map +1 -0
  36. package/dist/canvas/noise/table.d.ts +13 -0
  37. package/dist/canvas/noise/table.d.ts.map +1 -0
  38. package/dist/canvas/noise/table.js +408 -0
  39. package/dist/canvas/noise/table.js.map +1 -0
  40. package/dist/canvas/noise/tile.d.ts +22 -0
  41. package/dist/canvas/noise/tile.d.ts.map +1 -0
  42. package/dist/canvas/noise/tile.js +73 -0
  43. package/dist/canvas/noise/tile.js.map +1 -0
  44. package/dist/canvas/outline-stroke.js +1 -1
  45. package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
  46. package/dist/canvas/overlays/auto-layout-hover.js +31 -71
  47. package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
  48. package/dist/canvas/overlays/index.d.ts +2 -2
  49. package/dist/canvas/overlays/index.js +2 -2
  50. package/dist/canvas/overlays/selection.d.ts +1 -2
  51. package/dist/canvas/overlays/selection.d.ts.map +1 -1
  52. package/dist/canvas/overlays/selection.js +2 -9
  53. package/dist/canvas/overlays/selection.js.map +1 -1
  54. package/dist/canvas/renderer/chunks/index.d.ts +1 -1
  55. package/dist/canvas/renderer/fonts.d.ts.map +1 -1
  56. package/dist/canvas/renderer/fonts.js +2 -0
  57. package/dist/canvas/renderer/fonts.js.map +1 -1
  58. package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
  59. package/dist/canvas/renderer/lifecycle.js +6 -0
  60. package/dist/canvas/renderer/lifecycle.js.map +1 -1
  61. package/dist/canvas/renderer/methods.d.ts +0 -1
  62. package/dist/canvas/renderer/methods.d.ts.map +1 -1
  63. package/dist/canvas/renderer/methods.js +1 -4
  64. package/dist/canvas/renderer/methods.js.map +1 -1
  65. package/dist/canvas/renderer/overlay-pass.d.ts.map +1 -1
  66. package/dist/canvas/renderer/overlay-pass.js +0 -1
  67. package/dist/canvas/renderer/overlay-pass.js.map +1 -1
  68. package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
  69. package/dist/canvas/renderer/pipeline.js +13 -2
  70. package/dist/canvas/renderer/pipeline.js.map +1 -1
  71. package/dist/canvas/renderer/play-scenes.d.ts +13 -0
  72. package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
  73. package/dist/canvas/renderer/play-scenes.js +40 -0
  74. package/dist/canvas/renderer/play-scenes.js.map +1 -0
  75. package/dist/canvas/renderer/tiles/cache.d.ts +19 -1
  76. package/dist/canvas/renderer/tiles/cache.d.ts.map +1 -1
  77. package/dist/canvas/renderer/tiles/cache.js +32 -1
  78. package/dist/canvas/renderer/tiles/cache.js.map +1 -1
  79. package/dist/canvas/renderer/tiles/controller.d.ts +11 -0
  80. package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
  81. package/dist/canvas/renderer/tiles/controller.js +18 -1
  82. package/dist/canvas/renderer/tiles/controller.js.map +1 -1
  83. package/dist/canvas/renderer/tiles/index.d.ts +2 -2
  84. package/dist/canvas/renderer/tiles/planner.d.ts +1 -1
  85. package/dist/canvas/renderer/types.d.ts +18 -4
  86. package/dist/canvas/renderer/types.d.ts.map +1 -1
  87. package/dist/canvas/renderer/visual-bounds.d.ts +1 -1
  88. package/dist/canvas/renderer/visual-bounds.js +1 -1
  89. package/dist/canvas/renderer.d.ts +22 -3
  90. package/dist/canvas/renderer.d.ts.map +1 -1
  91. package/dist/canvas/renderer.js +29 -1
  92. package/dist/canvas/renderer.js.map +1 -1
  93. package/dist/canvas/scene.d.ts +2 -1
  94. package/dist/canvas/scene.d.ts.map +1 -1
  95. package/dist/canvas/scene.js +41 -9
  96. package/dist/canvas/scene.js.map +1 -1
  97. package/dist/canvas/shadows/silhouette.js +1 -1
  98. package/dist/canvas/texture.d.ts +20 -0
  99. package/dist/canvas/texture.d.ts.map +1 -0
  100. package/dist/canvas/texture.js +100 -0
  101. package/dist/canvas/texture.js.map +1 -0
  102. package/dist/clipboard.js +16 -5
  103. package/dist/clipboard.js.map +1 -1
  104. package/dist/constants.d.ts +5 -1
  105. package/dist/constants.d.ts.map +1 -1
  106. package/dist/constants.js +5 -1
  107. package/dist/constants.js.map +1 -1
  108. package/dist/design-jsx/index.d.ts +2 -2
  109. package/dist/design-jsx/index.js +2 -2
  110. package/dist/design-jsx/renderer.d.ts +3 -2
  111. package/dist/design-jsx/renderer.d.ts.map +1 -1
  112. package/dist/design-jsx/renderer.js +2 -2
  113. package/dist/design-jsx/renderer.js.map +1 -1
  114. package/dist/design-memory/check.d.ts +90 -0
  115. package/dist/design-memory/check.d.ts.map +1 -0
  116. package/dist/design-memory/check.js +281 -0
  117. package/dist/design-memory/check.js.map +1 -0
  118. package/dist/design-memory/describe.d.ts +37 -0
  119. package/dist/design-memory/describe.d.ts.map +1 -0
  120. package/dist/design-memory/describe.js +52 -0
  121. package/dist/design-memory/describe.js.map +1 -0
  122. package/dist/design-memory/distil.d.ts +22 -0
  123. package/dist/design-memory/distil.d.ts.map +1 -0
  124. package/dist/design-memory/distil.js +54 -0
  125. package/dist/design-memory/distil.js.map +1 -0
  126. package/dist/design-memory/document.d.ts +12 -0
  127. package/dist/design-memory/document.d.ts.map +1 -0
  128. package/dist/design-memory/document.js +64 -0
  129. package/dist/design-memory/document.js.map +1 -0
  130. package/dist/design-memory/guard.d.ts +48 -0
  131. package/dist/design-memory/guard.d.ts.map +1 -0
  132. package/dist/design-memory/guard.js +105 -0
  133. package/dist/design-memory/guard.js.map +1 -0
  134. package/dist/design-memory/index.d.ts +9 -0
  135. package/dist/design-memory/index.js +9 -0
  136. package/dist/design-memory/refusal.d.ts +32 -0
  137. package/dist/design-memory/refusal.d.ts.map +1 -0
  138. package/dist/design-memory/refusal.js +68 -0
  139. package/dist/design-memory/refusal.js.map +1 -0
  140. package/dist/design-memory/rules.d.ts +63 -0
  141. package/dist/design-memory/rules.d.ts.map +1 -0
  142. package/dist/design-memory/rules.js +224 -0
  143. package/dist/design-memory/rules.js.map +1 -0
  144. package/dist/design-memory/values.d.ts +28 -0
  145. package/dist/design-memory/values.d.ts.map +1 -0
  146. package/dist/design-memory/values.js +160 -0
  147. package/dist/design-memory/values.js.map +1 -0
  148. package/dist/editor/alignment.js +1 -1
  149. package/dist/editor/bridges/components.d.ts +2 -0
  150. package/dist/editor/bridges/components.d.ts.map +1 -1
  151. package/dist/editor/bridges/components.js +2 -0
  152. package/dist/editor/bridges/components.js.map +1 -1
  153. package/dist/editor/bridges/undo.d.ts +1 -1
  154. package/dist/editor/clipboard/assets.js +1 -1
  155. package/dist/editor/clipboard/export.d.ts.map +1 -1
  156. package/dist/editor/clipboard/export.js +16 -2
  157. package/dist/editor/clipboard/export.js.map +1 -1
  158. package/dist/editor/clipboard/placement.d.ts +1 -1
  159. package/dist/editor/clipboard/placement.js +1 -1
  160. package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
  161. package/dist/editor/clipboard/snapshot.js +12 -4
  162. package/dist/editor/clipboard/snapshot.js.map +1 -1
  163. package/dist/editor/clipboard.d.ts.map +1 -1
  164. package/dist/editor/clipboard.js +2 -7
  165. package/dist/editor/clipboard.js.map +1 -1
  166. package/dist/editor/color-space.d.ts.map +1 -1
  167. package/dist/editor/color-space.js +33 -38
  168. package/dist/editor/color-space.js.map +1 -1
  169. package/dist/editor/components/instances.d.ts +2 -0
  170. package/dist/editor/components/instances.d.ts.map +1 -1
  171. package/dist/editor/components/instances.js +22 -1
  172. package/dist/editor/components/instances.js.map +1 -1
  173. package/dist/editor/components.d.ts +2 -0
  174. package/dist/editor/components.d.ts.map +1 -1
  175. package/dist/editor/connectors/attach.js +1 -1
  176. package/dist/editor/create.d.ts +36 -8
  177. package/dist/editor/create.d.ts.map +1 -1
  178. package/dist/editor/create.js +26 -61
  179. package/dist/editor/create.js.map +1 -1
  180. package/dist/editor/design-memory.d.ts +11 -0
  181. package/dist/editor/design-memory.d.ts.map +1 -0
  182. package/dist/editor/design-memory.js +40 -0
  183. package/dist/editor/design-memory.js.map +1 -0
  184. package/dist/editor/design-tokens.d.ts +4 -0
  185. package/dist/editor/design-tokens.d.ts.map +1 -1
  186. package/dist/editor/design-tokens.js +30 -1
  187. package/dist/editor/design-tokens.js.map +1 -1
  188. package/dist/editor/document-colors.d.ts +23 -0
  189. package/dist/editor/document-colors.d.ts.map +1 -0
  190. package/dist/editor/document-colors.js +53 -0
  191. package/dist/editor/document-colors.js.map +1 -0
  192. package/dist/editor/eyedropper.d.ts +47 -0
  193. package/dist/editor/eyedropper.d.ts.map +1 -0
  194. package/dist/editor/eyedropper.js +168 -0
  195. package/dist/editor/eyedropper.js.map +1 -0
  196. package/dist/editor/fonts.d.ts +9 -0
  197. package/dist/editor/fonts.d.ts.map +1 -0
  198. package/dist/editor/fonts.js +14 -0
  199. package/dist/editor/fonts.js.map +1 -0
  200. package/dist/editor/history/atomic-tool.d.ts +9 -2
  201. package/dist/editor/history/atomic-tool.d.ts.map +1 -1
  202. package/dist/editor/history/atomic-tool.js +6 -0
  203. package/dist/editor/history/atomic-tool.js.map +1 -1
  204. package/dist/editor/history/capture.d.ts +13 -0
  205. package/dist/editor/history/capture.d.ts.map +1 -0
  206. package/dist/editor/history/capture.js +28 -0
  207. package/dist/editor/history/capture.js.map +1 -0
  208. package/dist/editor/history/document-change.d.ts.map +1 -1
  209. package/dist/editor/history/document-change.js +2 -22
  210. package/dist/editor/history/document-change.js.map +1 -1
  211. package/dist/editor/history/edit.d.ts +7 -0
  212. package/dist/editor/history/edit.d.ts.map +1 -1
  213. package/dist/editor/history/edit.js +6 -3
  214. package/dist/editor/history/edit.js.map +1 -1
  215. package/dist/editor/history/subtree.d.ts +9 -0
  216. package/dist/editor/history/subtree.d.ts.map +1 -1
  217. package/dist/editor/history/subtree.js +12 -2
  218. package/dist/editor/history/subtree.js.map +1 -1
  219. package/dist/editor/index.d.ts +4 -2
  220. package/dist/editor/index.js +4 -2
  221. package/dist/editor/nudge.js +1 -1
  222. package/dist/editor/nudge.js.map +1 -1
  223. package/dist/editor/pages.d.ts +7 -5
  224. package/dist/editor/pages.d.ts.map +1 -1
  225. package/dist/editor/pages.js +35 -25
  226. package/dist/editor/pages.js.map +1 -1
  227. package/dist/editor/play/states.d.ts +3 -1
  228. package/dist/editor/play/states.d.ts.map +1 -1
  229. package/dist/editor/play/states.js +1 -1
  230. package/dist/editor/play/states.js.map +1 -1
  231. package/dist/editor/read-only/actions.js +6 -0
  232. package/dist/editor/read-only/actions.js.map +1 -1
  233. package/dist/editor/render-requests.d.ts +18 -0
  234. package/dist/editor/render-requests.d.ts.map +1 -0
  235. package/dist/editor/render-requests.js +76 -0
  236. package/dist/editor/render-requests.js.map +1 -0
  237. package/dist/editor/scale/rescale.d.ts +1 -1
  238. package/dist/editor/selection/container.d.ts +2 -0
  239. package/dist/editor/selection/container.d.ts.map +1 -1
  240. package/dist/editor/selection/container.js +17 -1
  241. package/dist/editor/selection/container.js.map +1 -1
  242. package/dist/editor/selection/navigation.js +7 -4
  243. package/dist/editor/selection/navigation.js.map +1 -1
  244. package/dist/editor/selection/overlays.d.ts.map +1 -1
  245. package/dist/editor/selection/overlays.js +1 -1
  246. package/dist/editor/selection/overlays.js.map +1 -1
  247. package/dist/editor/selection/read.d.ts +6 -2
  248. package/dist/editor/selection.d.ts +9 -2
  249. package/dist/editor/selection.d.ts.map +1 -1
  250. package/dist/editor/shapes/with-text.d.ts.map +1 -1
  251. package/dist/editor/shapes/with-text.js +2 -5
  252. package/dist/editor/shapes/with-text.js.map +1 -1
  253. package/dist/editor/structure/auto-layout-wrap.js +1 -1
  254. package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
  255. package/dist/editor/structure/boolean.d.ts +2 -3
  256. package/dist/editor/structure/boolean.d.ts.map +1 -1
  257. package/dist/editor/structure/boolean.js.map +1 -1
  258. package/dist/editor/structure/group/bounds.d.ts.map +1 -1
  259. package/dist/editor/structure/group/bounds.js +1 -3
  260. package/dist/editor/structure/group/bounds.js.map +1 -1
  261. package/dist/editor/structure/outline-stroke.js +3 -3
  262. package/dist/editor/structure/outline-stroke.js.map +1 -1
  263. package/dist/editor/structure/reorder.d.ts.map +1 -1
  264. package/dist/editor/structure/reorder.js +7 -14
  265. package/dist/editor/structure/reorder.js.map +1 -1
  266. package/dist/editor/structure/state.js +1 -1
  267. package/dist/editor/structure/state.js.map +1 -1
  268. package/dist/editor/structure.d.ts +1 -2
  269. package/dist/editor/structure.d.ts.map +1 -1
  270. package/dist/editor/structure.js +3 -3
  271. package/dist/editor/structure.js.map +1 -1
  272. package/dist/editor/tool-registry.d.ts.map +1 -1
  273. package/dist/editor/tool-registry.js +2 -1
  274. package/dist/editor/tool-registry.js.map +1 -1
  275. package/dist/editor/types.d.ts +9 -2
  276. package/dist/editor/types.d.ts.map +1 -1
  277. package/dist/editor/variables.d.ts.map +1 -1
  278. package/dist/editor/variables.js +57 -1
  279. package/dist/editor/variables.js.map +1 -1
  280. package/dist/editor/variations/create.d.ts +28 -0
  281. package/dist/editor/variations/create.d.ts.map +1 -0
  282. package/dist/editor/variations/create.js +176 -0
  283. package/dist/editor/variations/create.js.map +1 -0
  284. package/dist/editor/variations/pick.d.ts +16 -0
  285. package/dist/editor/variations/pick.d.ts.map +1 -0
  286. package/dist/editor/variations/pick.js +23 -0
  287. package/dist/editor/variations/pick.js.map +1 -0
  288. package/dist/editor/variations.d.ts +28 -0
  289. package/dist/editor/variations.d.ts.map +1 -0
  290. package/dist/editor/variations.js +88 -0
  291. package/dist/editor/variations.js.map +1 -0
  292. package/dist/figma-api/accessors/reactions.d.ts.map +1 -1
  293. package/dist/figma-api/accessors/reactions.js +4 -1
  294. package/dist/figma-api/accessors/reactions.js.map +1 -1
  295. package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
  296. package/dist/figma-api/accessors/text/index.js +7 -1
  297. package/dist/figma-api/accessors/text/index.js.map +1 -1
  298. package/dist/figma-api/accessors/text/opentype.d.ts +17 -0
  299. package/dist/figma-api/accessors/text/opentype.d.ts.map +1 -0
  300. package/dist/figma-api/accessors/text/opentype.js +28 -0
  301. package/dist/figma-api/accessors/text/opentype.js.map +1 -0
  302. package/dist/figma-api/accessors/visual.d.ts.map +1 -1
  303. package/dist/figma-api/accessors/visual.js +33 -0
  304. package/dist/figma-api/accessors/visual.js.map +1 -1
  305. package/dist/figma-api/effects.d.ts +79 -3
  306. package/dist/figma-api/effects.d.ts.map +1 -1
  307. package/dist/figma-api/effects.js +150 -9
  308. package/dist/figma-api/effects.js.map +1 -1
  309. package/dist/figma-api/fonts/loaded.d.ts +3 -1
  310. package/dist/figma-api/fonts/loaded.d.ts.map +1 -1
  311. package/dist/figma-api/fonts/loaded.js +8 -1
  312. package/dist/figma-api/fonts/loaded.js.map +1 -1
  313. package/dist/figma-api/index.d.ts +18 -0
  314. package/dist/figma-api/index.d.ts.map +1 -1
  315. package/dist/figma-api/index.js +19 -1
  316. package/dist/figma-api/index.js.map +1 -1
  317. package/dist/figma-api/overrides.d.ts +13 -1
  318. package/dist/figma-api/overrides.d.ts.map +1 -1
  319. package/dist/figma-api/overrides.js +196 -4
  320. package/dist/figma-api/overrides.js.map +1 -1
  321. package/dist/figma-api/paints.d.ts +3 -3
  322. package/dist/figma-api/paints.d.ts.map +1 -1
  323. package/dist/figma-api/paints.js +14 -4
  324. package/dist/figma-api/paints.js.map +1 -1
  325. package/dist/figma-api/proxy.d.ts +4 -1
  326. package/dist/figma-api/proxy.d.ts.map +1 -1
  327. package/dist/figma-api/proxy.js +1 -1
  328. package/dist/figma-api/proxy.js.map +1 -1
  329. package/dist/figma-api/reactions.d.ts +41 -13
  330. package/dist/figma-api/reactions.d.ts.map +1 -1
  331. package/dist/figma-api/reactions.js +113 -31
  332. package/dist/figma-api/reactions.js.map +1 -1
  333. package/dist/figma-api/render-bounds.js +1 -1
  334. package/dist/figma-api/serialization.d.ts.map +1 -1
  335. package/dist/figma-api/serialization.js +2 -1
  336. package/dist/figma-api/serialization.js.map +1 -1
  337. package/dist/figma-api/shape-details.d.ts +26 -0
  338. package/dist/figma-api/shape-details.d.ts.map +1 -0
  339. package/dist/figma-api/shape-details.js +28 -0
  340. package/dist/figma-api/shape-details.js.map +1 -0
  341. package/dist/figma-api/shape-with-text.js +2 -5
  342. package/dist/figma-api/shape-with-text.js.map +1 -1
  343. package/dist/figma-api/surface.d.ts +7 -4
  344. package/dist/figma-api/surface.d.ts.map +1 -1
  345. package/dist/figma-api/surface.js +7 -2
  346. package/dist/figma-api/surface.js.map +1 -1
  347. package/dist/figma-api/transform.d.ts +1 -1
  348. package/dist/geometry/figma.d.ts +1 -1
  349. package/dist/geometry/image-crop.d.ts +1 -1
  350. package/dist/geometry/image-crop.js +1 -1
  351. package/dist/icons/svg.js +1 -1
  352. package/dist/icons/svg.js.map +1 -1
  353. package/dist/index.d.ts +4 -2
  354. package/dist/index.js +4 -2
  355. package/dist/io/formats/boolean-path.d.ts +19 -0
  356. package/dist/io/formats/boolean-path.d.ts.map +1 -0
  357. package/dist/io/formats/boolean-path.js +47 -0
  358. package/dist/io/formats/boolean-path.js.map +1 -0
  359. package/dist/io/formats/design-tokens/decode.js +1 -1
  360. package/dist/io/formats/design-tokens/index.d.ts +4 -1
  361. package/dist/io/formats/design-tokens/index.js +4 -1
  362. package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
  363. package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
  364. package/dist/io/formats/design-tokens/plan/changes.js +1 -1
  365. package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
  366. package/dist/io/formats/design-tokens/project.d.ts +17 -2
  367. package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
  368. package/dist/io/formats/design-tokens/project.js +29 -8
  369. package/dist/io/formats/design-tokens/project.js.map +1 -1
  370. package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
  371. package/dist/io/formats/design-tokens/styles.js.map +1 -1
  372. package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
  373. package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
  374. package/dist/io/formats/design-tokens/sync/apply.js +73 -0
  375. package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
  376. package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
  377. package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
  378. package/dist/io/formats/design-tokens/sync/drift.js +391 -0
  379. package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
  380. package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
  381. package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
  382. package/dist/io/formats/design-tokens/sync/files.js +35 -0
  383. package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
  384. package/dist/io/formats/drawio/edges.d.ts +7 -1
  385. package/dist/io/formats/drawio/edges.d.ts.map +1 -1
  386. package/dist/io/formats/drawio/edges.js +54 -1
  387. package/dist/io/formats/drawio/edges.js.map +1 -1
  388. package/dist/io/formats/drawio/export.d.ts.map +1 -1
  389. package/dist/io/formats/drawio/export.js +19 -2
  390. package/dist/io/formats/drawio/export.js.map +1 -1
  391. package/dist/io/formats/drawio/index.d.ts.map +1 -1
  392. package/dist/io/formats/drawio/index.js +2 -1
  393. package/dist/io/formats/drawio/index.js.map +1 -1
  394. package/dist/io/formats/drawio/label.js +1 -1
  395. package/dist/io/formats/drawio/paint.js +1 -1
  396. package/dist/io/formats/drawio/placement.d.ts +1 -1
  397. package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
  398. package/dist/io/formats/fig/export/patch/index.js +5 -0
  399. package/dist/io/formats/fig/export/patch/index.js.map +1 -1
  400. package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
  401. package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
  402. package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
  403. package/dist/io/formats/html/import.d.ts.map +1 -1
  404. package/dist/io/formats/html/import.js +3 -1
  405. package/dist/io/formats/html/import.js.map +1 -1
  406. package/dist/io/formats/html/index.d.ts +2 -2
  407. package/dist/io/formats/html/index.d.ts.map +1 -1
  408. package/dist/io/formats/html/index.js +6 -4
  409. package/dist/io/formats/html/index.js.map +1 -1
  410. package/dist/io/formats/html/layers.d.ts +7 -4
  411. package/dist/io/formats/html/layers.d.ts.map +1 -1
  412. package/dist/io/formats/html/layers.js +4 -1
  413. package/dist/io/formats/html/layers.js.map +1 -1
  414. package/dist/io/formats/html/vectors.d.ts +2 -1
  415. package/dist/io/formats/html/vectors.d.ts.map +1 -1
  416. package/dist/io/formats/html/vectors.js +3 -2
  417. package/dist/io/formats/html/vectors.js.map +1 -1
  418. package/dist/io/formats/mermaid/styles.js +1 -1
  419. package/dist/io/formats/pdf/document.d.ts +3 -1
  420. package/dist/io/formats/pdf/document.d.ts.map +1 -1
  421. package/dist/io/formats/pdf/document.js +6 -3
  422. package/dist/io/formats/pdf/document.js.map +1 -1
  423. package/dist/io/formats/pdf/dom.d.ts +6 -1
  424. package/dist/io/formats/pdf/dom.d.ts.map +1 -1
  425. package/dist/io/formats/pdf/dom.js +9 -22
  426. package/dist/io/formats/pdf/dom.js.map +1 -1
  427. package/dist/io/formats/pdf/export.js +1 -1
  428. package/dist/io/formats/pdf/export.js.map +1 -1
  429. package/dist/io/formats/pdf/prepare.d.ts +1 -1
  430. package/dist/io/formats/pen/imports.d.ts +4 -1
  431. package/dist/io/formats/pen/imports.d.ts.map +1 -1
  432. package/dist/io/formats/pen/imports.js.map +1 -1
  433. package/dist/io/formats/pen/index.d.ts.map +1 -1
  434. package/dist/io/formats/pen/index.js +31 -3
  435. package/dist/io/formats/pen/index.js.map +1 -1
  436. package/dist/io/formats/pptx/export.js +1 -1
  437. package/dist/io/formats/pptx/geometry.d.ts +1 -1
  438. package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
  439. package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
  440. package/dist/io/formats/raster/adjusted-images.js +118 -0
  441. package/dist/io/formats/raster/adjusted-images.js.map +1 -0
  442. package/dist/io/formats/raster/headless.d.ts +11 -1
  443. package/dist/io/formats/raster/headless.d.ts.map +1 -1
  444. package/dist/io/formats/raster/headless.js +4 -4
  445. package/dist/io/formats/raster/headless.js.map +1 -1
  446. package/dist/io/formats/raster/index.d.ts +2 -2
  447. package/dist/io/formats/raster/pixels.d.ts +7 -1
  448. package/dist/io/formats/raster/pixels.d.ts.map +1 -1
  449. package/dist/io/formats/raster/pixels.js.map +1 -1
  450. package/dist/io/formats/raster/render.d.ts.map +1 -1
  451. package/dist/io/formats/raster/render.js +4 -0
  452. package/dist/io/formats/raster/render.js.map +1 -1
  453. package/dist/io/formats/svg/defs.d.ts +5 -6
  454. package/dist/io/formats/svg/defs.d.ts.map +1 -1
  455. package/dist/io/formats/svg/defs.js +4 -54
  456. package/dist/io/formats/svg/defs.js.map +1 -1
  457. package/dist/io/formats/svg/effects.d.ts +16 -0
  458. package/dist/io/formats/svg/effects.d.ts.map +1 -0
  459. package/dist/io/formats/svg/effects.js +126 -0
  460. package/dist/io/formats/svg/effects.js.map +1 -0
  461. package/dist/io/formats/svg/export.d.ts +7 -1
  462. package/dist/io/formats/svg/export.d.ts.map +1 -1
  463. package/dist/io/formats/svg/export.js +224 -50
  464. package/dist/io/formats/svg/export.js.map +1 -1
  465. package/dist/io/formats/svg/filter.d.ts +27 -0
  466. package/dist/io/formats/svg/filter.d.ts.map +1 -0
  467. package/dist/io/formats/svg/filter.js +44 -0
  468. package/dist/io/formats/svg/filter.js.map +1 -0
  469. package/dist/io/formats/svg/grain.d.ts +26 -0
  470. package/dist/io/formats/svg/grain.d.ts.map +1 -0
  471. package/dist/io/formats/svg/grain.js +298 -0
  472. package/dist/io/formats/svg/grain.js.map +1 -0
  473. package/dist/io/formats/svg/strokes.d.ts +1 -1
  474. package/dist/io/formats/svg/strokes.d.ts.map +1 -1
  475. package/dist/io/formats/svg/strokes.js +1 -2
  476. package/dist/io/formats/svg/strokes.js.map +1 -1
  477. package/dist/io/formats/svg/text/import.js +1 -1
  478. package/dist/io/formats/svg/text/layout.d.ts +5 -2
  479. package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
  480. package/dist/io/formats/svg/text/layout.js +6 -3
  481. package/dist/io/formats/svg/text/layout.js.map +1 -1
  482. package/dist/io/formats/video/composite.d.ts +18 -0
  483. package/dist/io/formats/video/composite.d.ts.map +1 -0
  484. package/dist/io/formats/video/composite.js +79 -0
  485. package/dist/io/formats/video/composite.js.map +1 -0
  486. package/dist/io/formats/video/formats.d.ts +29 -0
  487. package/dist/io/formats/video/formats.d.ts.map +1 -0
  488. package/dist/io/formats/video/formats.js +43 -0
  489. package/dist/io/formats/video/formats.js.map +1 -0
  490. package/dist/io/formats/video/gif.d.ts +13 -0
  491. package/dist/io/formats/video/gif.d.ts.map +1 -0
  492. package/dist/io/formats/video/gif.js +56 -0
  493. package/dist/io/formats/video/gif.js.map +1 -0
  494. package/dist/io/formats/video/index.d.ts +9 -0
  495. package/dist/io/formats/video/index.js +9 -0
  496. package/dist/io/formats/video/plan.d.ts +64 -0
  497. package/dist/io/formats/video/plan.d.ts.map +1 -0
  498. package/dist/io/formats/video/plan.js +90 -0
  499. package/dist/io/formats/video/plan.js.map +1 -0
  500. package/dist/io/formats/video/record.d.ts +36 -0
  501. package/dist/io/formats/video/record.d.ts.map +1 -0
  502. package/dist/io/formats/video/record.js +154 -0
  503. package/dist/io/formats/video/record.js.map +1 -0
  504. package/dist/io/formats/video/sink.d.ts +29 -0
  505. package/dist/io/formats/video/sink.d.ts.map +1 -0
  506. package/dist/io/formats/video/sink.js +16 -0
  507. package/dist/io/formats/video/sink.js.map +1 -0
  508. package/dist/io/formats/video/size.d.ts +19 -0
  509. package/dist/io/formats/video/size.d.ts.map +1 -0
  510. package/dist/io/formats/video/size.js +26 -0
  511. package/dist/io/formats/video/size.js.map +1 -0
  512. package/dist/io/formats/video/webcodecs.d.ts +18 -0
  513. package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
  514. package/dist/io/formats/video/webcodecs.js +74 -0
  515. package/dist/io/formats/video/webcodecs.js.map +1 -0
  516. package/dist/io/formats.d.ts.map +1 -1
  517. package/dist/io/formats.js +40 -11
  518. package/dist/io/formats.js.map +1 -1
  519. package/dist/io/types.d.ts +19 -4
  520. package/dist/io/types.d.ts.map +1 -1
  521. package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
  522. package/dist/layout/apply.d.ts.map +1 -1
  523. package/dist/layout/apply.js +50 -12
  524. package/dist/layout/apply.js.map +1 -1
  525. package/dist/layout/auto-layout-handles.d.ts +66 -0
  526. package/dist/layout/auto-layout-handles.d.ts.map +1 -0
  527. package/dist/layout/auto-layout-handles.js +291 -0
  528. package/dist/layout/auto-layout-handles.js.map +1 -0
  529. package/dist/layout/derived.d.ts +7 -1
  530. package/dist/layout/derived.d.ts.map +1 -1
  531. package/dist/layout/derived.js +11 -1
  532. package/dist/layout/derived.js.map +1 -1
  533. package/dist/layout/grid.d.ts +7 -2
  534. package/dist/layout/grid.d.ts.map +1 -1
  535. package/dist/layout/grid.js +27 -9
  536. package/dist/layout/grid.js.map +1 -1
  537. package/dist/layout/mutations.d.ts +1 -0
  538. package/dist/layout/mutations.d.ts.map +1 -1
  539. package/dist/layout/mutations.js +10 -0
  540. package/dist/layout/mutations.js.map +1 -1
  541. package/dist/layout/strokes.d.ts +9 -1
  542. package/dist/layout/strokes.d.ts.map +1 -1
  543. package/dist/layout/strokes.js +12 -1
  544. package/dist/layout/strokes.js.map +1 -1
  545. package/dist/layout/yoga-helpers.d.ts +3 -1
  546. package/dist/layout/yoga-helpers.d.ts.map +1 -1
  547. package/dist/layout/yoga-helpers.js +16 -2
  548. package/dist/layout/yoga-helpers.js.map +1 -1
  549. package/dist/layout.d.ts +3 -2
  550. package/dist/layout.d.ts.map +1 -1
  551. package/dist/layout.js +73 -39
  552. package/dist/layout.js.map +1 -1
  553. package/dist/lint/fixes.d.ts.map +1 -1
  554. package/dist/lint/fixes.js +9 -3
  555. package/dist/lint/fixes.js.map +1 -1
  556. package/dist/lint/index.d.ts +3 -2
  557. package/dist/lint/index.js +2 -1
  558. package/dist/lint/linter.d.ts +13 -0
  559. package/dist/lint/linter.d.ts.map +1 -1
  560. package/dist/lint/linter.js +123 -9
  561. package/dist/lint/linter.js.map +1 -1
  562. package/dist/lint/presets.d.ts.map +1 -1
  563. package/dist/lint/presets.js +2 -0
  564. package/dist/lint/presets.js.map +1 -1
  565. package/dist/lint/rules/design-memory.d.ts +15 -0
  566. package/dist/lint/rules/design-memory.d.ts.map +1 -0
  567. package/dist/lint/rules/design-memory.js +90 -0
  568. package/dist/lint/rules/design-memory.js.map +1 -0
  569. package/dist/lint/rules/effect-style-required.js +1 -0
  570. package/dist/lint/rules/effect-style-required.js.map +1 -1
  571. package/dist/lint/rules/index.d.ts +6 -5
  572. package/dist/lint/rules/index.d.ts.map +1 -1
  573. package/dist/lint/rules/index.js +6 -2
  574. package/dist/lint/rules/index.js.map +1 -1
  575. package/dist/lint/rules/no-unbound-token-values.d.ts +6 -0
  576. package/dist/lint/rules/no-unbound-token-values.d.ts.map +1 -0
  577. package/dist/lint/rules/no-unbound-token-values.js +79 -0
  578. package/dist/lint/rules/no-unbound-token-values.js.map +1 -0
  579. package/dist/lint/rules/text-style-required.js +1 -0
  580. package/dist/lint/rules/text-style-required.js.map +1 -1
  581. package/dist/lint/types.d.ts +32 -2
  582. package/dist/lint/types.d.ts.map +1 -1
  583. package/dist/node/video.d.ts +12 -0
  584. package/dist/node/video.d.ts.map +1 -0
  585. package/dist/node/video.js +206 -0
  586. package/dist/node/video.js.map +1 -0
  587. package/dist/pairdraw-api/design-memory.d.ts +19 -0
  588. package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
  589. package/dist/pairdraw-api/design-memory.js +39 -0
  590. package/dist/pairdraw-api/design-memory.js.map +1 -0
  591. package/dist/pairdraw-api/index.d.ts +45 -1
  592. package/dist/pairdraw-api/index.d.ts.map +1 -1
  593. package/dist/pairdraw-api/index.js +55 -2
  594. package/dist/pairdraw-api/index.js.map +1 -1
  595. package/dist/pairdraw-api/nodes.d.ts +12 -1
  596. package/dist/pairdraw-api/nodes.d.ts.map +1 -1
  597. package/dist/pairdraw-api/nodes.js +28 -1
  598. package/dist/pairdraw-api/nodes.js.map +1 -1
  599. package/dist/pairdraw-api/variations.d.ts +48 -0
  600. package/dist/pairdraw-api/variations.d.ts.map +1 -0
  601. package/dist/pairdraw-api/variations.js +76 -0
  602. package/dist/pairdraw-api/variations.js.map +1 -0
  603. package/dist/prototype/easing.d.ts +13 -0
  604. package/dist/prototype/easing.d.ts.map +1 -0
  605. package/dist/prototype/easing.js +36 -0
  606. package/dist/prototype/easing.js.map +1 -0
  607. package/dist/prototype/frames.d.ts +10 -0
  608. package/dist/prototype/frames.d.ts.map +1 -0
  609. package/dist/prototype/frames.js +12 -0
  610. package/dist/prototype/frames.js.map +1 -0
  611. package/dist/prototype/hit.d.ts +17 -0
  612. package/dist/prototype/hit.d.ts.map +1 -0
  613. package/dist/prototype/hit.js +45 -0
  614. package/dist/prototype/hit.js.map +1 -0
  615. package/dist/prototype/index.d.ts +14 -0
  616. package/dist/prototype/index.js +14 -0
  617. package/dist/prototype/pointer.d.ts +63 -0
  618. package/dist/prototype/pointer.d.ts.map +1 -0
  619. package/dist/prototype/pointer.js +104 -0
  620. package/dist/prototype/pointer.js.map +1 -0
  621. package/dist/prototype/reactions.d.ts +45 -0
  622. package/dist/prototype/reactions.d.ts.map +1 -0
  623. package/dist/prototype/reactions.js +122 -0
  624. package/dist/prototype/reactions.js.map +1 -0
  625. package/dist/prototype/scene.d.ts +35 -0
  626. package/dist/prototype/scene.d.ts.map +1 -0
  627. package/dist/prototype/scene.js +86 -0
  628. package/dist/prototype/scene.js.map +1 -0
  629. package/dist/prototype/scenes.d.ts +81 -0
  630. package/dist/prototype/scenes.d.ts.map +1 -0
  631. package/dist/prototype/scenes.js +175 -0
  632. package/dist/prototype/scenes.js.map +1 -0
  633. package/dist/prototype/scroll.d.ts +48 -0
  634. package/dist/prototype/scroll.d.ts.map +1 -0
  635. package/dist/prototype/scroll.js +159 -0
  636. package/dist/prototype/scroll.js.map +1 -0
  637. package/dist/prototype/session.d.ts +71 -0
  638. package/dist/prototype/session.d.ts.map +1 -0
  639. package/dist/prototype/session.js +135 -0
  640. package/dist/prototype/session.js.map +1 -0
  641. package/dist/prototype/smart-animate/animation.d.ts +34 -0
  642. package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
  643. package/dist/prototype/smart-animate/animation.js +212 -0
  644. package/dist/prototype/smart-animate/animation.js.map +1 -0
  645. package/dist/prototype/smart-animate/match.d.ts +24 -0
  646. package/dist/prototype/smart-animate/match.d.ts.map +1 -0
  647. package/dist/prototype/smart-animate/match.js +72 -0
  648. package/dist/prototype/smart-animate/match.js.map +1 -0
  649. package/dist/prototype/snapshot.d.ts +19 -0
  650. package/dist/prototype/snapshot.d.ts.map +1 -0
  651. package/dist/prototype/snapshot.js +56 -0
  652. package/dist/prototype/snapshot.js.map +1 -0
  653. package/dist/prototype/timeline.d.ts +132 -0
  654. package/dist/prototype/timeline.d.ts.map +1 -0
  655. package/dist/prototype/timeline.js +260 -0
  656. package/dist/prototype/timeline.js.map +1 -0
  657. package/dist/rpc/commands.d.ts +2 -2
  658. package/dist/rpc/index.d.ts +2 -2
  659. package/dist/rpc/read-commands.d.ts +18 -8
  660. package/dist/rpc/read-commands.d.ts.map +1 -1
  661. package/dist/rpc/read-commands.js +18 -9
  662. package/dist/rpc/read-commands.js.map +1 -1
  663. package/dist/text/font/faces.d.ts +12 -1
  664. package/dist/text/font/faces.d.ts.map +1 -1
  665. package/dist/text/font/faces.js +15 -1
  666. package/dist/text/font/faces.js.map +1 -1
  667. package/dist/text/font/features.d.ts +9 -0
  668. package/dist/text/font/features.d.ts.map +1 -0
  669. package/dist/text/font/features.js +27 -0
  670. package/dist/text/font/features.js.map +1 -0
  671. package/dist/text/font/manager.d.ts +12 -0
  672. package/dist/text/font/manager.d.ts.map +1 -1
  673. package/dist/text/font/manager.js +66 -12
  674. package/dist/text/font/manager.js.map +1 -1
  675. package/dist/text/index.d.ts +11 -9
  676. package/dist/text/index.js +4 -2
  677. package/dist/text/replace-fonts.d.ts +41 -0
  678. package/dist/text/replace-fonts.d.ts.map +1 -0
  679. package/dist/text/replace-fonts.js +121 -0
  680. package/dist/text/replace-fonts.js.map +1 -0
  681. package/dist/tools/analyze/responsive/index.d.ts +15 -0
  682. package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
  683. package/dist/tools/analyze/responsive/index.js +203 -0
  684. package/dist/tools/analyze/responsive/index.js.map +1 -0
  685. package/dist/tools/analyze.d.ts +2 -1
  686. package/dist/tools/analyze.js +2 -1
  687. package/dist/tools/codegen/token-sync.d.ts +7 -0
  688. package/dist/tools/codegen/token-sync.d.ts.map +1 -0
  689. package/dist/tools/codegen/token-sync.js +85 -0
  690. package/dist/tools/codegen/token-sync.js.map +1 -0
  691. package/dist/tools/codegen/tokens.d.ts +1 -1
  692. package/dist/tools/codegen.d.ts +2 -1
  693. package/dist/tools/codegen.js +2 -1
  694. package/dist/tools/create/basic.js +1 -1
  695. package/dist/tools/create/behaviours.js +1 -1
  696. package/dist/tools/create/components.d.ts.map +1 -1
  697. package/dist/tools/create/components.js +4 -0
  698. package/dist/tools/create/components.js.map +1 -1
  699. package/dist/tools/create/html.js +3 -2
  700. package/dist/tools/create/html.js.map +1 -1
  701. package/dist/tools/create/icons.d.ts.map +1 -1
  702. package/dist/tools/create/icons.js +2 -1
  703. package/dist/tools/create/icons.js.map +1 -1
  704. package/dist/tools/create/mermaid.js +2 -1
  705. package/dist/tools/create/mermaid.js.map +1 -1
  706. package/dist/tools/create/render.js +1 -1
  707. package/dist/tools/create/svg.js +2 -1
  708. package/dist/tools/create/svg.js.map +1 -1
  709. package/dist/tools/create/vector.js +1 -1
  710. package/dist/tools/design-memory.d.ts +8 -0
  711. package/dist/tools/design-memory.d.ts.map +1 -0
  712. package/dist/tools/design-memory.js +68 -0
  713. package/dist/tools/design-memory.js.map +1 -0
  714. package/dist/tools/image-ai/generate.d.ts.map +1 -1
  715. package/dist/tools/image-ai/generate.js +3 -1
  716. package/dist/tools/image-ai/generate.js.map +1 -1
  717. package/dist/tools/index.d.ts +2 -1
  718. package/dist/tools/index.js +2 -1
  719. package/dist/tools/modify/fonts.d.ts +6 -0
  720. package/dist/tools/modify/fonts.d.ts.map +1 -0
  721. package/dist/tools/modify/fonts.js +27 -0
  722. package/dist/tools/modify/fonts.js.map +1 -0
  723. package/dist/tools/modify/layout.d.ts.map +1 -1
  724. package/dist/tools/modify/layout.js +1 -0
  725. package/dist/tools/modify/layout.js.map +1 -1
  726. package/dist/tools/modify/paint.js +1 -1
  727. package/dist/tools/modify/reactions.d.ts.map +1 -1
  728. package/dist/tools/modify/reactions.js +3 -3
  729. package/dist/tools/modify/reactions.js.map +1 -1
  730. package/dist/tools/modify/text.d.ts.map +1 -1
  731. package/dist/tools/modify/text.js +26 -5
  732. package/dist/tools/modify/text.js.map +1 -1
  733. package/dist/tools/modify/update.d.ts +10 -1
  734. package/dist/tools/modify/update.d.ts.map +1 -1
  735. package/dist/tools/modify/update.js +34 -3
  736. package/dist/tools/modify/update.js.map +1 -1
  737. package/dist/tools/modify.d.ts +2 -1
  738. package/dist/tools/modify.js +2 -1
  739. package/dist/tools/read/fonts.d.ts.map +1 -1
  740. package/dist/tools/read/fonts.js +17 -2
  741. package/dist/tools/read/fonts.js.map +1 -1
  742. package/dist/tools/read/libraries.js +2 -1
  743. package/dist/tools/read/libraries.js.map +1 -1
  744. package/dist/tools/read/nodes.d.ts.map +1 -1
  745. package/dist/tools/read/nodes.js.map +1 -1
  746. package/dist/tools/read/space.d.ts +3 -1
  747. package/dist/tools/read/space.d.ts.map +1 -1
  748. package/dist/tools/read/space.js +4 -3
  749. package/dist/tools/read/space.js.map +1 -1
  750. package/dist/tools/registry/core.d.ts +1 -1
  751. package/dist/tools/registry/core.d.ts.map +1 -1
  752. package/dist/tools/registry/core.js +3 -1
  753. package/dist/tools/registry/core.js.map +1 -1
  754. package/dist/tools/registry/extended.d.ts.map +1 -1
  755. package/dist/tools/registry/extended.js +16 -1
  756. package/dist/tools/registry/extended.js.map +1 -1
  757. package/dist/tools/schema.d.ts +18 -2
  758. package/dist/tools/schema.d.ts.map +1 -1
  759. package/dist/tools/schema.js +1 -1
  760. package/dist/tools/schema.js.map +1 -1
  761. package/dist/tools/stock-photo.js +1 -0
  762. package/dist/tools/stock-photo.js.map +1 -1
  763. package/dist/tools/structure/basic.d.ts.map +1 -1
  764. package/dist/tools/structure/basic.js +1 -0
  765. package/dist/tools/structure/basic.js.map +1 -1
  766. package/dist/tools/structure/batch.d.ts.map +1 -1
  767. package/dist/tools/structure/batch.js +22 -1
  768. package/dist/tools/structure/batch.js.map +1 -1
  769. package/dist/tools/structure/hierarchy.d.ts.map +1 -1
  770. package/dist/tools/structure/hierarchy.js +4 -0
  771. package/dist/tools/structure/hierarchy.js.map +1 -1
  772. package/dist/tools/structure/variations.d.ts +8 -0
  773. package/dist/tools/structure/variations.d.ts.map +1 -0
  774. package/dist/tools/structure/variations.js +106 -0
  775. package/dist/tools/structure/variations.js.map +1 -0
  776. package/dist/tools/structure.d.ts +2 -1
  777. package/dist/tools/structure.js +2 -1
  778. package/dist/tools/styles/types.d.ts +2 -4
  779. package/dist/tools/styles/types.d.ts.map +1 -1
  780. package/dist/tools/styles/types.js.map +1 -1
  781. package/dist/tools/vector/boolean.d.ts.map +1 -1
  782. package/dist/tools/vector/boolean.js +4 -0
  783. package/dist/tools/vector/boolean.js.map +1 -1
  784. package/dist/tools/vector/path.d.ts.map +1 -1
  785. package/dist/tools/vector/path.js +39 -7
  786. package/dist/tools/vector/path.js.map +1 -1
  787. package/dist/tools/vector/vectorize.js +1 -0
  788. package/dist/tools/vector/vectorize.js.map +1 -1
  789. package/dist/tools/vector/video.d.ts +6 -0
  790. package/dist/tools/vector/video.d.ts.map +1 -0
  791. package/dist/tools/vector/video.js +133 -0
  792. package/dist/tools/vector/video.js.map +1 -0
  793. package/dist/tools/vector.d.ts +2 -1
  794. package/dist/tools/vector.js +2 -1
  795. package/dist/tools/video-host.d.ts +12 -0
  796. package/dist/tools/video-host.d.ts.map +1 -0
  797. package/dist/tools/video-host.js +19 -0
  798. package/dist/tools/video-host.js.map +1 -0
  799. package/dist/vector/point-transform.d.ts +1 -1
  800. package/dist/vector/vectorize/svg/to-vectors.d.ts +1 -1
  801. package/dist/xpath.d.ts +3 -0
  802. package/dist/xpath.d.ts.map +1 -1
  803. package/dist/xpath.js +3 -1
  804. package/dist/xpath.js.map +1 -1
  805. package/package.json +31 -9
  806. package/src/ai/providers.ts +2 -0
  807. package/src/cache/resource.ts +24 -1
  808. package/src/canvas/effects.ts +47 -50
  809. package/src/canvas/fills.ts +19 -15
  810. package/src/canvas/images/adjustments.ts +203 -0
  811. package/src/canvas/images/sampling.ts +88 -0
  812. package/src/canvas/index.ts +1 -0
  813. package/src/canvas/masks.ts +1 -1
  814. package/src/canvas/noise/render.ts +75 -0
  815. package/src/canvas/noise/shader.ts +161 -0
  816. package/src/canvas/noise/table.ts +91 -0
  817. package/src/canvas/noise/tile.ts +94 -0
  818. package/src/canvas/overlays/auto-layout-hover.ts +47 -65
  819. package/src/canvas/overlays/index.ts +0 -1
  820. package/src/canvas/overlays/selection.ts +1 -12
  821. package/src/canvas/renderer/fonts.ts +2 -0
  822. package/src/canvas/renderer/lifecycle.ts +6 -0
  823. package/src/canvas/renderer/methods.ts +0 -9
  824. package/src/canvas/renderer/overlay-pass.ts +0 -1
  825. package/src/canvas/renderer/pipeline.ts +19 -2
  826. package/src/canvas/renderer/play-scenes.ts +51 -0
  827. package/src/canvas/renderer/tiles/cache.ts +54 -1
  828. package/src/canvas/renderer/tiles/controller.ts +30 -1
  829. package/src/canvas/renderer/types.ts +18 -3
  830. package/src/canvas/renderer.ts +40 -4
  831. package/src/canvas/scene.ts +65 -9
  832. package/src/canvas/texture.ts +136 -0
  833. package/src/clipboard.ts +23 -10
  834. package/src/constants.ts +6 -0
  835. package/src/design-jsx/index.ts +1 -1
  836. package/src/design-jsx/renderer.ts +1 -1
  837. package/src/design-memory/check.ts +376 -0
  838. package/src/design-memory/describe.ts +77 -0
  839. package/src/design-memory/distil.ts +69 -0
  840. package/src/design-memory/document.ts +80 -0
  841. package/src/design-memory/guard.ts +157 -0
  842. package/src/design-memory/index.ts +8 -0
  843. package/src/design-memory/refusal.ts +90 -0
  844. package/src/design-memory/rules.ts +274 -0
  845. package/src/design-memory/values.ts +179 -0
  846. package/src/editor/bridges/components.ts +2 -0
  847. package/src/editor/clipboard/export.ts +24 -7
  848. package/src/editor/clipboard/snapshot.ts +21 -4
  849. package/src/editor/clipboard.ts +4 -14
  850. package/src/editor/color-space.ts +47 -38
  851. package/src/editor/components/instances.ts +31 -0
  852. package/src/editor/create.ts +39 -71
  853. package/src/editor/design-memory.ts +39 -0
  854. package/src/editor/design-tokens.ts +41 -2
  855. package/src/editor/document-colors.ts +65 -0
  856. package/src/editor/eyedropper.ts +198 -0
  857. package/src/editor/fonts.ts +19 -0
  858. package/src/editor/history/atomic-tool.ts +29 -1
  859. package/src/editor/history/capture.ts +19 -0
  860. package/src/editor/history/document-change.ts +5 -17
  861. package/src/editor/history/edit.ts +16 -2
  862. package/src/editor/history/subtree.ts +13 -2
  863. package/src/editor/index.ts +11 -0
  864. package/src/editor/nudge.ts +1 -1
  865. package/src/editor/pages.ts +40 -29
  866. package/src/editor/play/states.ts +1 -1
  867. package/src/editor/read-only/actions.ts +6 -0
  868. package/src/editor/render-requests.ts +83 -0
  869. package/src/editor/selection/container.ts +24 -1
  870. package/src/editor/selection/navigation.ts +8 -6
  871. package/src/editor/selection/overlays.ts +1 -0
  872. package/src/editor/shapes/with-text.ts +2 -5
  873. package/src/editor/structure/auto-layout-wrap.ts +1 -1
  874. package/src/editor/structure/boolean.ts +1 -3
  875. package/src/editor/structure/group/bounds.ts +1 -5
  876. package/src/editor/structure/outline-stroke.ts +3 -3
  877. package/src/editor/structure/reorder.ts +8 -14
  878. package/src/editor/structure/state.ts +1 -1
  879. package/src/editor/structure.ts +5 -8
  880. package/src/editor/tool-registry.ts +2 -1
  881. package/src/editor/types.ts +8 -1
  882. package/src/editor/variables.ts +74 -2
  883. package/src/editor/variations/create.ts +235 -0
  884. package/src/editor/variations/pick.ts +35 -0
  885. package/src/editor/variations.ts +110 -0
  886. package/src/figma-api/accessors/reactions.ts +11 -1
  887. package/src/figma-api/accessors/text/index.ts +17 -1
  888. package/src/figma-api/accessors/text/opentype.ts +33 -0
  889. package/src/figma-api/accessors/visual.ts +55 -2
  890. package/src/figma-api/compatibility.ts +5 -2
  891. package/src/figma-api/effects.ts +143 -5
  892. package/src/figma-api/fonts/loaded.ts +9 -0
  893. package/src/figma-api/index.ts +35 -0
  894. package/src/figma-api/overrides.ts +295 -3
  895. package/src/figma-api/paints.ts +24 -9
  896. package/src/figma-api/proxy.ts +6 -1
  897. package/src/figma-api/reactions.ts +130 -32
  898. package/src/figma-api/serialization.ts +2 -1
  899. package/src/figma-api/shape-details.ts +50 -0
  900. package/src/figma-api/shape-with-text.ts +2 -5
  901. package/src/figma-api/surface.ts +7 -2
  902. package/src/global.d.ts +31 -0
  903. package/src/icons/svg.ts +3 -1
  904. package/src/io/formats/boolean-path.ts +60 -0
  905. package/src/io/formats/design-tokens/index.ts +21 -0
  906. package/src/io/formats/design-tokens/plan/changes.ts +4 -1
  907. package/src/io/formats/design-tokens/project.ts +40 -9
  908. package/src/io/formats/design-tokens/styles.ts +10 -2
  909. package/src/io/formats/design-tokens/sync/apply.ts +130 -0
  910. package/src/io/formats/design-tokens/sync/drift.ts +587 -0
  911. package/src/io/formats/design-tokens/sync/files.ts +40 -0
  912. package/src/io/formats/drawio/edges.ts +65 -0
  913. package/src/io/formats/drawio/export.ts +37 -14
  914. package/src/io/formats/drawio/index.ts +5 -1
  915. package/src/io/formats/fig/export/patch/index.ts +8 -0
  916. package/src/io/formats/fig/thumbnail-page.ts +4 -4
  917. package/src/io/formats/html/import.ts +9 -1
  918. package/src/io/formats/html/index.ts +14 -7
  919. package/src/io/formats/html/layers.ts +11 -2
  920. package/src/io/formats/html/vectors.ts +8 -2
  921. package/src/io/formats/pdf/document.ts +14 -4
  922. package/src/io/formats/pdf/dom.ts +10 -18
  923. package/src/io/formats/pdf/export.ts +1 -1
  924. package/src/io/formats/pen/imports.ts +5 -6
  925. package/src/io/formats/pen/index.ts +36 -5
  926. package/src/io/formats/raster/adjusted-images.ts +125 -0
  927. package/src/io/formats/raster/headless.ts +3 -3
  928. package/src/io/formats/raster/index.ts +6 -1
  929. package/src/io/formats/raster/pixels.ts +7 -0
  930. package/src/io/formats/raster/render.ts +12 -1
  931. package/src/io/formats/svg/defs.ts +14 -73
  932. package/src/io/formats/svg/effects.ts +131 -0
  933. package/src/io/formats/svg/export.ts +371 -64
  934. package/src/io/formats/svg/filter.ts +47 -0
  935. package/src/io/formats/svg/grain.ts +249 -0
  936. package/src/io/formats/svg/strokes.ts +2 -2
  937. package/src/io/formats/svg/text/layout.ts +13 -3
  938. package/src/io/formats/video/composite.ts +79 -0
  939. package/src/io/formats/video/formats.ts +77 -0
  940. package/src/io/formats/video/gif.ts +65 -0
  941. package/src/io/formats/video/index.ts +30 -0
  942. package/src/io/formats/video/plan.ts +116 -0
  943. package/src/io/formats/video/record.ts +227 -0
  944. package/src/io/formats/video/sink.ts +32 -0
  945. package/src/io/formats/video/size.ts +25 -0
  946. package/src/io/formats/video/webcodecs.ts +89 -0
  947. package/src/io/formats.ts +59 -11
  948. package/src/io/types.ts +29 -10
  949. package/src/layout/apply.ts +87 -21
  950. package/src/layout/auto-layout-handles.ts +396 -0
  951. package/src/layout/derived.ts +14 -0
  952. package/src/layout/grid.ts +33 -9
  953. package/src/layout/mutations.ts +13 -1
  954. package/src/layout/strokes.ts +12 -0
  955. package/src/layout/yoga-helpers.ts +18 -1
  956. package/src/layout.ts +96 -49
  957. package/src/lint/fixes.ts +12 -3
  958. package/src/lint/index.ts +3 -1
  959. package/src/lint/linter.ts +124 -12
  960. package/src/lint/presets.ts +2 -0
  961. package/src/lint/rules/design-memory.ts +97 -0
  962. package/src/lint/rules/effect-style-required.ts +2 -0
  963. package/src/lint/rules/index.ts +6 -1
  964. package/src/lint/rules/no-unbound-token-values.ts +73 -0
  965. package/src/lint/rules/text-style-required.ts +2 -0
  966. package/src/lint/types.ts +40 -0
  967. package/src/node/video.ts +196 -0
  968. package/src/pairdraw-api/design-memory.ts +61 -0
  969. package/src/pairdraw-api/index.ts +81 -0
  970. package/src/pairdraw-api/nodes.ts +38 -0
  971. package/src/pairdraw-api/variations.ts +109 -0
  972. package/src/prototype/easing.ts +37 -0
  973. package/src/prototype/frames.ts +9 -0
  974. package/src/prototype/hit.ts +70 -0
  975. package/src/prototype/index.ts +69 -0
  976. package/src/prototype/pointer.ts +146 -0
  977. package/src/prototype/reactions.ts +178 -0
  978. package/src/prototype/scene.ts +116 -0
  979. package/src/prototype/scenes.ts +256 -0
  980. package/src/prototype/scroll.ts +190 -0
  981. package/src/prototype/session.ts +188 -0
  982. package/src/prototype/smart-animate/animation.ts +267 -0
  983. package/src/prototype/smart-animate/match.ts +85 -0
  984. package/src/prototype/snapshot.ts +60 -0
  985. package/src/prototype/timeline.ts +400 -0
  986. package/src/rpc/index.ts +1 -0
  987. package/src/rpc/read-commands.ts +40 -23
  988. package/src/text/font/faces.ts +22 -0
  989. package/src/text/font/features.ts +27 -0
  990. package/src/text/font/manager.ts +88 -12
  991. package/src/text/index.ts +2 -0
  992. package/src/text/replace-fonts.ts +171 -0
  993. package/src/tools/analyze/responsive/index.ts +264 -0
  994. package/src/tools/analyze.ts +2 -0
  995. package/src/tools/codegen/token-sync.ts +98 -0
  996. package/src/tools/codegen.ts +1 -0
  997. package/src/tools/create/components.ts +4 -0
  998. package/src/tools/create/html.ts +1 -0
  999. package/src/tools/create/icons.ts +1 -0
  1000. package/src/tools/create/mermaid.ts +1 -0
  1001. package/src/tools/create/svg.ts +1 -0
  1002. package/src/tools/design-memory.ts +72 -0
  1003. package/src/tools/image-ai/generate.ts +2 -0
  1004. package/src/tools/index.ts +1 -0
  1005. package/src/tools/modify/fonts.ts +34 -0
  1006. package/src/tools/modify/layout.ts +5 -0
  1007. package/src/tools/modify/reactions.ts +15 -8
  1008. package/src/tools/modify/text.ts +42 -5
  1009. package/src/tools/modify/update.ts +46 -2
  1010. package/src/tools/modify.ts +1 -0
  1011. package/src/tools/read/fonts.ts +24 -2
  1012. package/src/tools/read/libraries.ts +1 -0
  1013. package/src/tools/read/nodes.ts +0 -1
  1014. package/src/tools/read/space.ts +3 -2
  1015. package/src/tools/registry/core.ts +3 -1
  1016. package/src/tools/registry/extended.ts +28 -1
  1017. package/src/tools/schema.ts +28 -4
  1018. package/src/tools/stock-photo.ts +1 -0
  1019. package/src/tools/structure/basic.ts +1 -0
  1020. package/src/tools/structure/batch.ts +34 -1
  1021. package/src/tools/structure/hierarchy.ts +4 -0
  1022. package/src/tools/structure/variations.ts +118 -0
  1023. package/src/tools/structure.ts +2 -0
  1024. package/src/tools/styles/types.ts +3 -4
  1025. package/src/tools/vector/boolean.ts +4 -0
  1026. package/src/tools/vector/path.ts +30 -6
  1027. package/src/tools/vector/vectorize.ts +1 -0
  1028. package/src/tools/vector/video.ts +228 -0
  1029. package/src/tools/vector.ts +1 -0
  1030. package/src/tools/video-host.ts +18 -0
  1031. package/src/xpath.ts +6 -1
@@ -4,7 +4,8 @@ import { fittedDashPattern } from "../../../canvas/strokes/sides.js";
4
4
  import { lineStrokePath } from "../../../canvas/strokes/line.js";
5
5
  import { renderSVGNode, svg } from "./node.js";
6
6
  import { arcPath, boxOutlinePath, geometryBlobToSVGPath, hasRadius, hasSmoothCorners, makePolygonPoints, nodeOutlinePath, round, roundedPolygonPath, shapeWithTextOutlinePath } from "./paths.js";
7
- import { SVG_BLEND_MODE, SVG_STROKE_CAP, SVG_STROKE_JOIN, createFilterDef, formatSolidColor, nextDefId, resolveFill, solidFillOpacity } from "./defs.js";
7
+ import { SVG_BLEND_MODE, SVG_STROKE_CAP, SVG_STROKE_JOIN, formatSolidColor, nextDefId, resolveFill, solidFillOpacity } from "./defs.js";
8
+ import { createFilterDef } from "./effects.js";
8
9
  import { arrowHeadElements, openPathElements, vectorArrowHeads } from "./arrows.js";
9
10
  import { alignedStroke, alignedStrokeElement, shapeWithTextDetailElements } from "./strokes.js";
10
11
  import { renderTextNode } from "./text/export.js";
@@ -22,6 +23,32 @@ function networkElements(node, network, common) {
22
23
  if (looseSegments(network).length === 0) return regions;
23
24
  return [...regions, ...openPathElements(node, network, common, looseSegments)];
24
25
  }
26
+ /** Paints one path's fill stack; a blended fill draws its stroke as a separate path. */
27
+ function vectorFillElements(attrs, visibleFills, strokeAttrs, common, node, ctx) {
28
+ const elements = [];
29
+ for (const [index, fill] of visibleFills.entries()) {
30
+ const fillAttr = resolveFill(fill, node, ctx);
31
+ if (!fillAttr) continue;
32
+ const style = paintBlendStyle(fill);
33
+ const last = index === visibleFills.length - 1;
34
+ const splitStroke = style !== void 0 && last && common.stroke !== "none";
35
+ const stroke = last && !splitStroke ? common.stroke : "none";
36
+ elements.push(svg("path", {
37
+ ...attrs,
38
+ fill: fillAttr,
39
+ "fill-opacity": solidFillOpacity(fill, ctx.colorSpace),
40
+ style,
41
+ stroke
42
+ }));
43
+ if (splitStroke) elements.push(svg("path", {
44
+ d: attrs.d,
45
+ "fill-rule": attrs["fill-rule"],
46
+ fill: "none",
47
+ ...strokeAttrs
48
+ }));
49
+ }
50
+ return elements;
51
+ }
25
52
  function vectorShapeElements(node, common, strokeAttrs, ctx, fallbackFills) {
26
53
  const elements = [];
27
54
  if (node.fillGeometry.length > 0) for (const geo of node.fillGeometry) {
@@ -45,18 +72,23 @@ function vectorShapeElements(node, common, strokeAttrs, ctx, fallbackFills) {
45
72
  }));
46
73
  continue;
47
74
  }
48
- for (const [index, fill] of visibleFills.entries()) {
49
- const fillAttr = resolveFill(fill, node, ctx);
50
- if (!fillAttr) continue;
51
- elements.push(svg("path", {
52
- ...attrs,
53
- fill: fillAttr,
54
- "fill-opacity": solidFillOpacity(fill, ctx.colorSpace),
55
- stroke: index === visibleFills.length - 1 ? common.stroke : "none"
56
- }));
57
- }
75
+ elements.push(...vectorFillElements(attrs, visibleFills, strokeAttrs, common, node, ctx));
58
76
  }
59
77
  else if (node.vectorNetwork) elements.push(...networkElements(node, node.vectorNetwork, common));
78
+ elements.push(...vectorStrokeTail(node, strokeAttrs));
79
+ return withVectorFallback(elements, node, common);
80
+ }
81
+ /** The empty vector's fallback shape, after both paints have contributed their elements. */
82
+ function withVectorFallback(elements, node, common) {
83
+ return elements.length > 0 ? elements : [svg("rect", {
84
+ width: round(node.width),
85
+ height: round(node.height),
86
+ ...common
87
+ })];
88
+ }
89
+ /** The stored stroke geometry and arrowheads both vector paints share after their outlines. */
90
+ function vectorStrokeTail(node, strokeAttrs) {
91
+ const elements = [];
60
92
  if (node.strokeGeometry.length > 0 && strokeAttrs.stroke && strokeAttrs.stroke !== "none") for (const geo of node.strokeGeometry) {
61
93
  const d = geometryBlobToSVGPath(geo.commandsBlob);
62
94
  if (d) elements.push(svg("path", {
@@ -67,11 +99,26 @@ function vectorShapeElements(node, common, strokeAttrs, ctx, fallbackFills) {
67
99
  }));
68
100
  }
69
101
  if (node.vectorNetwork) elements.push(...vectorArrowHeads(node, node.vectorNetwork, strokeAttrs));
70
- return elements.length > 0 ? elements : [svg("rect", {
71
- width: round(node.width),
72
- height: round(node.height),
73
- ...common
74
- })];
102
+ return elements;
103
+ }
104
+ /** A vector layer's outlines as strokes alone, for a second stroke over the painted fills. */
105
+ function vectorStrokeElements(node, strokeAttrs) {
106
+ const elements = [];
107
+ const common = {
108
+ fill: "none",
109
+ ...strokeAttrs
110
+ };
111
+ if (node.fillGeometry.length > 0) for (const geo of node.fillGeometry) {
112
+ const d = geometryBlobToSVGPath(geo.commandsBlob);
113
+ if (d) elements.push(svg("path", {
114
+ d,
115
+ "fill-rule": geo.windingRule === "EVENODD" ? "evenodd" : void 0,
116
+ ...common
117
+ }));
118
+ }
119
+ else if (node.vectorNetwork) elements.push(...networkElements(node, node.vectorNetwork, common));
120
+ elements.push(...vectorStrokeTail(node, strokeAttrs));
121
+ return withVectorFallback(elements, node, common);
75
122
  }
76
123
  /** A line's dashes stretched along it as the canvas lays them, half a dash at each end. */
77
124
  function lineDashAttrs(stroke, length) {
@@ -82,7 +129,7 @@ function lineDashAttrs(stroke, length) {
82
129
  "stroke-dashoffset": round(fitted.offset)
83
130
  };
84
131
  }
85
- function nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx) {
132
+ function nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx, stroke) {
86
133
  const common = {
87
134
  fill: fillAttr ?? "none",
88
135
  "fill-opacity": fillOpacity,
@@ -102,8 +149,8 @@ function nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx) {
102
149
  ...common
103
150
  })];
104
151
  case "LINE": {
105
- const stroke = node.strokes.find((item) => item.visible);
106
- const { network, from: start, to: end } = lineStrokePath(node, stroke?.weight ?? 0, stroke?.cap ?? node.strokeCap);
152
+ const lineStroke = stroke ?? node.strokes.find((item) => item.visible);
153
+ const { network, from: start, to: end } = lineStrokePath(node, lineStroke?.weight ?? 0, lineStroke?.cap ?? node.strokeCap);
107
154
  return [svg("line", {
108
155
  x1: round(start.x),
109
156
  y1: round(start.y),
@@ -111,8 +158,8 @@ function nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx) {
111
158
  y2: round(end.y),
112
159
  fill: "none",
113
160
  ...strokeAttrs,
114
- ...lineDashAttrs(stroke, Math.hypot(end.x - start.x, end.y - start.y))
115
- }), ...arrowHeadElements(node, network, stroke, strokeAttrs)];
161
+ ...lineDashAttrs(lineStroke, Math.hypot(end.x - start.x, end.y - start.y))
162
+ }), ...arrowHeadElements(node, network, lineStroke, strokeAttrs)];
116
163
  }
117
164
  case "STAR":
118
165
  case "POLYGON": return node.cornerRadius > 0 ? [svg("path", {
@@ -182,7 +229,7 @@ function buildGroupAttrs(node, ctx) {
182
229
  if (node.opacity < 1) attrs.opacity = round(node.opacity);
183
230
  const blend = SVG_BLEND_MODE[node.blendMode];
184
231
  if (blend && blend !== "normal" && node.blendMode !== "PASS_THROUGH") attrs.style = `mix-blend-mode: ${blend}`;
185
- const filterDef = createFilterDef(node.effects, ctx);
232
+ const filterDef = createFilterDef(node, ctx);
186
233
  if (filterDef) {
187
234
  ctx.defs.push(filterDef.node);
188
235
  attrs.filter = `url(#${filterDef.id})`;
@@ -197,12 +244,10 @@ function buildGroupAttrs(node, ctx) {
197
244
  clipId
198
245
  };
199
246
  }
200
- function buildSVGStrokeAttrs(visibleStrokes, colorSpace, nodeCap) {
201
- if (visibleStrokes.length === 0) return {};
202
- const stroke = visibleStrokes[0];
203
- const cap = stroke.cap ?? nodeCap;
247
+ function buildSVGStrokeAttrs(stroke, node, ctx) {
248
+ const cap = stroke.cap ?? node.strokeCap;
204
249
  const attrs = {
205
- stroke: formatSolidColor(stroke.color, 1, colorSpace),
250
+ stroke: stroke.type === "SOLID" ? formatSolidColor(stroke.color, 1, ctx.colorSpace) : resolveFill(stroke, node, ctx) ?? formatSolidColor(stroke.color, 1, ctx.colorSpace),
206
251
  "stroke-width": round(stroke.weight)
207
252
  };
208
253
  if (stroke.opacity < 1) attrs["stroke-opacity"] = round(stroke.opacity);
@@ -211,17 +256,46 @@ function buildSVGStrokeAttrs(visibleStrokes, colorSpace, nodeCap) {
211
256
  if (stroke.dashPattern && stroke.dashPattern.length > 0) attrs["stroke-dasharray"] = stroke.dashPattern.map((n) => round(n)).join(" ");
212
257
  return attrs;
213
258
  }
259
+ /** The blend CSS a paint adds, when the canvas would not composite it source-over. */
260
+ function paintBlendStyle(fill) {
261
+ const blend = fill?.blendMode ? SVG_BLEND_MODE[fill.blendMode] : void 0;
262
+ return blend && blend !== "normal" ? `mix-blend-mode: ${blend}` : void 0;
263
+ }
264
+ /** Adds a paint's blend mode to the elements that draw it. */
265
+ function withPaintBlend(elements, fill) {
266
+ const style = paintBlendStyle(fill);
267
+ if (style) for (const element of elements) element.attrs.style = style;
268
+ return elements;
269
+ }
270
+ /**
271
+ * Draws the fill and the stroke as separate elements when the fill blends, so the stroke keeps the
272
+ * source-over canvas gives it instead of inheriting the fill's blend mode.
273
+ */
274
+ function shapeWithPaint(node, fillAttr, fillOpacity, strokeAttrs, fill, ctx) {
275
+ if (!(paintBlendStyle(fill) !== void 0) || !strokeAttrs.stroke) return withPaintBlend(nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx), fill);
276
+ return [...withPaintBlend(nodeShapeElements(node, fillAttr, fillOpacity, {}, ctx), fill), ...nodeShapeElements(node, null, void 0, strokeAttrs, ctx)];
277
+ }
214
278
  function hasPathLevelFills(node) {
215
279
  return node.type === "VECTOR" && node.fillGeometry.some((geometry) => geometry.fills?.length);
216
280
  }
281
+ /** One stroke at its own weight over the fills: a centred one on the outline, an aligned one around it. */
282
+ function strokeElements(node, stroke, strokeAttrs, ctx) {
283
+ const aligned = hasPathLevelFills(node) ? null : alignedStroke(node, stroke);
284
+ if (aligned) return [...alignedStrokeElement(node, aligned, strokeAttrs, ctx), ...node.type === "SHAPE_WITH_TEXT" ? shapeWithTextDetailElements(node, strokeAttrs, ctx) : []];
285
+ if (node.type === "VECTOR") return vectorStrokeElements(node, strokeAttrs);
286
+ return nodeShapeElements(node, null, void 0, strokeAttrs, ctx, stroke);
287
+ }
288
+ /**
289
+ * The fills and the strokes over them. The first stroke joins the fill's own element as before;
290
+ * every later visible stroke is drawn in layer order, without painting the fill again.
291
+ */
217
292
  function buildShapeChildren(node, visibleFills, fillAttr, fillOpacity, strokeAttrs, visibleStrokes, ctx) {
218
- const aligned = hasPathLevelFills(node) ? null : alignedStroke(node, visibleStrokes[0]);
219
- if (!aligned) return fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, strokeAttrs, visibleStrokes.length, ctx);
220
- return [
221
- ...fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, {}, 0, ctx),
222
- ...alignedStrokeElement(node, aligned, strokeAttrs, ctx),
223
- ...node.type === "SHAPE_WITH_TEXT" ? shapeWithTextDetailElements(node, strokeAttrs, ctx) : []
224
- ];
293
+ if (visibleStrokes.length === 0) return fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, {}, 0, ctx);
294
+ const first = visibleStrokes[0];
295
+ const firstAttrs = strokeAttrs[0];
296
+ const elements = alignedStroke(node, first) ? [...fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, {}, 0, ctx), ...strokeElements(node, first, firstAttrs, ctx)] : fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, firstAttrs, visibleStrokes.length, ctx);
297
+ for (let index = 1; index < visibleStrokes.length; index++) elements.push(...strokeElements(node, visibleStrokes[index], strokeAttrs[index], ctx));
298
+ return elements;
225
299
  }
226
300
  function fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, strokeAttrs, visibleStrokeCount, ctx) {
227
301
  if (hasPathLevelFills(node)) return vectorShapeElements(node, {
@@ -233,11 +307,11 @@ function fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, stroke
233
307
  const elements = [];
234
308
  for (const fill of visibleFills) {
235
309
  const ref = resolveFill(fill, node, ctx);
236
- if (ref) elements.push(...nodeShapeElements(node, ref, solidFillOpacity(fill, ctx.colorSpace), fill === visibleFills[visibleFills.length - 1] ? strokeAttrs : {}, ctx));
310
+ if (ref) elements.push(...shapeWithPaint(node, ref, solidFillOpacity(fill, ctx.colorSpace), fill === visibleFills[visibleFills.length - 1] ? strokeAttrs : {}, fill, ctx));
237
311
  }
238
312
  return elements;
239
313
  }
240
- if ((fillAttr || visibleStrokeCount > 0) && !isGroupLike(node)) return nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx);
314
+ if ((fillAttr || visibleStrokeCount > 0) && !isGroupLike(node)) return shapeWithPaint(node, fillAttr, fillOpacity, strokeAttrs, visibleFills.length === 1 ? visibleFills[0] : void 0, ctx);
241
315
  return [];
242
316
  }
243
317
  /** The paint CSS `color` sets, for a tinted icon path. */
@@ -253,6 +327,97 @@ function exportedFill(fill, node, ctx) {
253
327
  opacity: solidFillOpacity(fill, ctx.colorSpace)
254
328
  };
255
329
  }
330
+ /**
331
+ * A mask layer's definition: an alpha or luminance `<mask>`, or a `<clipPath>` for an outline
332
+ * mask. The rendered layer carries its own position, opacity, and filters into the mask.
333
+ */
334
+ function maskWire(mask, ctx) {
335
+ const content = renderNode(mask, ctx);
336
+ if (mask.maskType === "VECTOR") {
337
+ const id = nextDefId(ctx, "clip");
338
+ ctx.defs.push(svg("clipPath", {
339
+ id,
340
+ clipPathUnits: "userSpaceOnUse"
341
+ }, content ?? void 0));
342
+ return {
343
+ attribute: "clip-path",
344
+ id
345
+ };
346
+ }
347
+ const id = nextDefId(ctx, "mask");
348
+ const attrs = {
349
+ id,
350
+ maskContentUnits: "userSpaceOnUse"
351
+ };
352
+ if (mask.maskType === "ALPHA") attrs["mask-type"] = "alpha";
353
+ ctx.defs.push(svg("mask", attrs, content ?? void 0));
354
+ return {
355
+ attribute: "mask",
356
+ id
357
+ };
358
+ }
359
+ /**
360
+ * The children as the canvas draws them: a run of visible masks masks the siblings that follow
361
+ * it, until the next mask, and the mask layers themselves never draw on their own.
362
+ */
363
+ function maskedChildNodes(childNodes, ctx) {
364
+ const content = [];
365
+ let masks = [];
366
+ let afterMask = false;
367
+ for (const child of childNodes) {
368
+ if (child.visible && child.isMask) {
369
+ const wire = maskWire(child, ctx);
370
+ masks = afterMask ? [...masks, wire] : [wire];
371
+ afterMask = true;
372
+ continue;
373
+ }
374
+ const rendered = renderNode(child, ctx);
375
+ afterMask = false;
376
+ if (!rendered) continue;
377
+ let wrapped = rendered;
378
+ for (const wire of masks) wrapped = svg("g", { [wire.attribute]: `url(#${wire.id})` }, wrapped);
379
+ content.push(wrapped);
380
+ }
381
+ return content;
382
+ }
383
+ /** A boolean's live result path in the paints its fills and strokes give it. */
384
+ function booleanPathElements(node, d, visibleFills, fillAttr, fillOpacity, strokeAttrs, visibleStrokes, ctx) {
385
+ const common = {
386
+ d,
387
+ "fill-rule": "evenodd"
388
+ };
389
+ const centered = (stroke) => stroke.align !== "INSIDE" && stroke.align !== "OUTSIDE";
390
+ const firstJoins = visibleStrokes.length > 0 && centered(visibleStrokes[0]);
391
+ const joined = firstJoins ? strokeAttrs[0] : {};
392
+ const elements = visibleFills.length <= 1 ? [svg("path", {
393
+ ...common,
394
+ fill: fillAttr ?? "none",
395
+ "fill-opacity": fillOpacity,
396
+ ...joined
397
+ })] : visibleFills.map((fill, index) => svg("path", {
398
+ ...common,
399
+ fill: resolveFill(fill, node, ctx) ?? "none",
400
+ "fill-opacity": solidFillOpacity(fill, ctx.colorSpace),
401
+ ...index === visibleFills.length - 1 ? joined : {}
402
+ }));
403
+ for (let index = firstJoins ? 1 : 0; index < visibleStrokes.length; index++) {
404
+ const stroke = visibleStrokes[index];
405
+ const attrs = strokeAttrs[index];
406
+ elements.push(...centered(stroke) ? [svg("path", {
407
+ d,
408
+ fill: "none",
409
+ ...attrs
410
+ })] : alignedStrokeElement(node, stroke, attrs, ctx, d));
411
+ }
412
+ return elements;
413
+ }
414
+ /** A boolean made in Pairdraw draws its computed result path instead of its operands. */
415
+ function renderBooleanNode(node, ctx, paint) {
416
+ if (node.type !== "BOOLEAN_OPERATION" || node.fillGeometry.length > 0 || !ctx.booleanPath) return null;
417
+ const d = ctx.booleanPath(ctx.graph, node);
418
+ if (!d) return null;
419
+ return svg("g", paint.groupAttrs, ...booleanPathElements(node, d, paint.visibleFills, paint.fillAttr, paint.fillOpacity, paint.strokeAttrs, paint.visibleStrokes, ctx));
420
+ }
256
421
  function renderNode(node, ctx) {
257
422
  if (!node.visible) return null;
258
423
  const { attrs: groupAttrs, clipId } = buildGroupAttrs(node, ctx);
@@ -268,17 +433,24 @@ function renderNode(node, ctx) {
268
433
  const tintedFill = fill.color !== null && tint.includes("fill");
269
434
  const fillAttr = tintedFill ? CURRENT_COLOR : fill.color;
270
435
  const fillOpacity = ownFill ? solidFillOpacity(ownFill, ctx.colorSpace, tintedFill) : fill.opacity;
271
- const ownStrokes = buildSVGStrokeAttrs(visibleStrokes, ctx.colorSpace, node.strokeCap);
272
- const children = buildShapeChildren(node, visibleFills, fillAttr, fillOpacity, ownStrokes.stroke && tint.includes("stroke") ? {
273
- ...ownStrokes,
274
- stroke: CURRENT_COLOR
275
- } : ownStrokes, visibleStrokes, ctx);
276
- const childNodes = ctx.graph.getChildren(node.id);
277
- const childContent = [];
278
- for (const child of childNodes) {
279
- const rendered = renderNode(child, ctx);
280
- if (rendered) childContent.push(rendered);
281
- }
436
+ const strokeAttrs = visibleStrokes.map((stroke) => {
437
+ const attrs = buildSVGStrokeAttrs(stroke, node, ctx);
438
+ return tint.includes("stroke") ? {
439
+ ...attrs,
440
+ stroke: CURRENT_COLOR
441
+ } : attrs;
442
+ });
443
+ const booleanDrawn = renderBooleanNode(node, ctx, {
444
+ groupAttrs,
445
+ visibleFills,
446
+ fillAttr,
447
+ fillOpacity,
448
+ strokeAttrs,
449
+ visibleStrokes
450
+ });
451
+ if (booleanDrawn) return booleanDrawn;
452
+ const children = buildShapeChildren(node, visibleFills, fillAttr, fillOpacity, strokeAttrs, visibleStrokes, ctx);
453
+ const childContent = maskedChildNodes(ctx.graph.getChildren(node.id), ctx);
282
454
  if (clipId && childContent.length > 0) children.push(svg("g", { "clip-path": `url(#${clipId})` }, ...childContent));
283
455
  else children.push(...childContent);
284
456
  const validChildren = children.filter((c) => c !== null);
@@ -301,7 +473,8 @@ function renderNodesToSVG(graph, _pageId, nodeIds, options = {}) {
301
473
  graph,
302
474
  colorSpace: options.colorSpace ?? "srgb",
303
475
  textLayout: options.textLayout,
304
- fontAlias: options.fontAlias
476
+ fontAlias: options.fontAlias,
477
+ booleanPath: options.booleanPath
305
478
  };
306
479
  const contentNodes = [];
307
480
  for (const id of nodeIds) {
@@ -336,14 +509,15 @@ function renderNodesToSVG(graph, _pageId, nodeIds, options = {}) {
336
509
  * places, rotates, and fades it: the drawing starts at the layer's origin without its rotation
337
510
  * or opacity, and keeps its flips.
338
511
  */
339
- function renderNodeSVGElement(graph, node, { idPrefix, colorSpace = "srgb", tint }) {
512
+ function renderNodeSVGElement(graph, node, { idPrefix, colorSpace = "srgb", tint, booleanPath }) {
340
513
  const ctx = {
341
514
  defs: [],
342
515
  defIdCounter: 0,
343
516
  graph,
344
517
  colorSpace,
345
518
  idPrefix,
346
- tint
519
+ tint,
520
+ booleanPath
347
521
  };
348
522
  const drawn = renderNode({
349
523
  ...node,
@@ -1 +1 @@
1
- {"version":3,"file":"export.js","names":[],"sources":["../../../../src/io/formats/svg/export.ts"],"sourcesContent":["import type { RenderColorSpace } from '@pairdraw/scene-graph/color'\n\nimport { normalizeDashPattern } from '#core/canvas/strokes'\nimport { lineStrokePath } from '#core/canvas/strokes/line'\nimport { fittedDashPattern } from '#core/canvas/strokes/sides'\nimport { computeContentBounds } from '#core/io/formats/raster'\n\nimport {\n nextDefId,\n formatSolidColor,\n createFilterDef,\n resolveFill,\n solidFillOpacity,\n SVG_STROKE_CAP,\n SVG_STROKE_JOIN,\n SVG_BLEND_MODE\n} from './defs'\nimport {\n round,\n geometryBlobToSVGPath,\n makePolygonPoints,\n roundedPolygonPath,\n hasRadius,\n hasSmoothCorners,\n boxOutlinePath,\n arcPath,\n shapeWithTextOutlinePath\n} from './paths'\n\nexport { geometryBlobToSVGPath, nodeOutlinePath, type OutlineNode } from './paths'\n\nimport type { SceneGraph, SceneNode, Fill, Stroke, VectorNetwork } from '@pairdraw/scene-graph'\nimport { looseSegments, regionSVGPaths } from '@pairdraw/scene-graph/vector-network'\n\nimport { arrowHeadElements, openPathElements, vectorArrowHeads } from './arrows'\nimport type { SVGExportContext, SVGFontAlias } from './defs'\nimport { svg, renderSVGNode } from './node'\nimport type { SVGNode } from './node'\nimport { alignedStroke, alignedStrokeElement, shapeWithTextDetailElements } from './strokes'\nimport { renderTextNode } from './text/export'\nimport type { SVGTextLayout } from './text/lines'\n\n// --- Node rendering ---\n\n/**\n * A vector network's paths: its regions as they are traced, and its open segments as the canvas\n * strokes them, rounded and pulled back under their heads.\n */\nfunction networkElements(\n node: SceneNode,\n network: VectorNetwork,\n common: Record<string, string | number | undefined>\n): SVGNode[] {\n const regions = regionSVGPaths(network).map((d) => svg('path', { d, ...common }))\n if (looseSegments(network).length === 0) return regions\n return [...regions, ...openPathElements(node, network, common, looseSegments)]\n}\n\nfunction vectorShapeElements(\n node: SceneNode,\n common: Record<string, string | number | undefined>,\n strokeAttrs: Record<string, string | number | undefined>,\n ctx: SVGExportContext,\n fallbackFills?: Fill[]\n): SVGNode[] {\n const elements: SVGNode[] = []\n if (node.fillGeometry.length > 0) {\n for (const geo of node.fillGeometry) {\n const d = geometryBlobToSVGPath(geo.commandsBlob)\n if (!d) continue\n const attrs = {\n d,\n 'fill-rule': geo.windingRule === 'EVENODD' ? 'evenodd' : undefined,\n ...common\n }\n const pathFills = geo.fills?.length ? geo.fills : fallbackFills\n if (!pathFills) {\n elements.push(svg('path', attrs))\n continue\n }\n const visibleFills = pathFills.filter((fill) => fill.visible)\n if (visibleFills.length === 0) {\n elements.push(svg('path', { ...attrs, fill: 'none' }))\n continue\n }\n for (const [index, fill] of visibleFills.entries()) {\n const fillAttr = resolveFill(fill, node, ctx)\n if (!fillAttr) continue\n elements.push(\n svg('path', {\n ...attrs,\n fill: fillAttr,\n 'fill-opacity': solidFillOpacity(fill, ctx.colorSpace),\n stroke: index === visibleFills.length - 1 ? common.stroke : 'none'\n })\n )\n }\n }\n } else if (node.vectorNetwork) {\n elements.push(...networkElements(node, node.vectorNetwork, common))\n }\n if (node.strokeGeometry.length > 0 && strokeAttrs.stroke && strokeAttrs.stroke !== 'none') {\n for (const geo of node.strokeGeometry) {\n const d = geometryBlobToSVGPath(geo.commandsBlob)\n if (d) {\n elements.push(\n svg('path', {\n d,\n fill: strokeAttrs.stroke,\n 'fill-opacity': strokeAttrs['stroke-opacity'],\n stroke: 'none'\n })\n )\n }\n }\n }\n if (node.vectorNetwork) elements.push(...vectorArrowHeads(node, node.vectorNetwork, strokeAttrs))\n return elements.length > 0\n ? elements\n : [svg('rect', { width: round(node.width), height: round(node.height), ...common })]\n}\n\n/** A line's dashes stretched along it as the canvas lays them, half a dash at each end. */\nfunction lineDashAttrs(stroke: Stroke | undefined, length: number) {\n const fitted = fittedDashPattern(length, normalizeDashPattern(stroke?.dashPattern))\n if (!fitted) return {}\n return {\n 'stroke-dasharray': fitted.intervals.map((size) => round(size)).join(' '),\n 'stroke-dashoffset': round(fitted.offset)\n }\n}\n\nfunction nodeShapeElements(\n node: SceneNode,\n fillAttr: string | null,\n fillOpacity: number | undefined,\n strokeAttrs: Record<string, string | number | undefined>,\n ctx: SVGExportContext\n): SVGNode[] {\n const common: Record<string, string | number | undefined> = {\n fill: fillAttr ?? 'none',\n 'fill-opacity': fillOpacity,\n ...strokeAttrs\n }\n\n switch (node.type) {\n case 'ELLIPSE': {\n if (node.arcData) {\n return [svg('path', { d: arcPath(node), ...common })]\n }\n return [\n svg('ellipse', {\n cx: round(node.width / 2),\n cy: round(node.height / 2),\n rx: round(node.width / 2),\n ry: round(node.height / 2),\n ...common\n })\n ]\n }\n\n case 'LINE': {\n // Where the canvas strokes it: to one side of the line, with its caps inside its length.\n const stroke = node.strokes.find((item) => item.visible)\n const {\n network,\n from: start,\n to: end\n } = lineStrokePath(node, stroke?.weight ?? 0, stroke?.cap ?? node.strokeCap)\n return [\n svg('line', {\n x1: round(start.x),\n y1: round(start.y),\n x2: round(end.x),\n y2: round(end.y),\n fill: 'none',\n ...strokeAttrs,\n ...lineDashAttrs(stroke, Math.hypot(end.x - start.x, end.y - start.y))\n }),\n ...arrowHeadElements(node, network, stroke, strokeAttrs)\n ]\n }\n\n case 'STAR':\n case 'POLYGON':\n return node.cornerRadius > 0\n ? [svg('path', { d: roundedPolygonPath(node), ...common })]\n : [svg('polygon', { points: makePolygonPoints(node), ...common })]\n\n case 'VECTOR':\n return vectorShapeElements(node, common, strokeAttrs, ctx)\n\n case 'SHAPE_WITH_TEXT':\n return shapeWithTextElements(node, common, strokeAttrs, ctx)\n\n default:\n return [boxOutlineElement(node, common)]\n }\n}\n\n/**\n * A box layer's outline as one element: a rect, a rect with `rx`/`ry` for one radius, or the\n * shared box path for independent or smoothed corners, so fills and clips follow the same edge.\n */\nfunction boxOutlineElement(\n node: SceneNode,\n attrs: Record<string, string | number | undefined>\n): SVGNode {\n const width = round(node.width)\n const height = round(node.height)\n if (!hasRadius(node)) return svg('rect', { width, height, ...attrs })\n if (node.independentCorners || hasSmoothCorners(node)) {\n return svg('path', { d: boxOutlinePath(node), ...attrs })\n }\n // SVG clamps rx and ry to their own sides; the canvas keeps a too-large radius circular.\n const radius = round(Math.min(node.cornerRadius, node.width / 2, node.height / 2))\n return svg('rect', { width, height, rx: radius, ry: radius, ...attrs })\n}\n\n/**\n * A FigJam shape's outline, and its inner lines, such as a database's front rim, stroked as the\n * canvas strokes them: at the stroke's own weight, ending where the outline does.\n */\nfunction shapeWithTextElements(\n node: SceneNode,\n common: Record<string, string | number | undefined>,\n strokeAttrs: Record<string, string | number | undefined>,\n ctx: SVGExportContext\n): SVGNode[] {\n return [\n svg('path', { d: shapeWithTextOutlinePath(node), ...common }),\n ...shapeWithTextDetailElements(node, strokeAttrs, ctx)\n ]\n}\n\n// --- Main recursive renderer ---\n\nfunction buildTransformAttr(node: SceneNode): string | undefined {\n const transforms: string[] = []\n if (node.x !== 0 || node.y !== 0) transforms.push(`translate(${round(node.x)}, ${round(node.y)})`)\n if (node.rotation !== 0) {\n transforms.push(\n `rotate(${round(node.rotation)}, ${round(node.width / 2)}, ${round(node.height / 2)})`\n )\n }\n if (node.flipX || node.flipY) {\n const tx = node.flipX ? node.width : 0\n const ty = node.flipY ? node.height : 0\n const sx = node.flipX ? -1 : 1\n const sy = node.flipY ? -1 : 1\n transforms.push(`translate(${round(tx)}, ${round(ty)}) scale(${sx}, ${sy})`)\n }\n return transforms.length > 0 ? transforms.join(' ') : undefined\n}\n\nfunction buildGroupAttrs(\n node: SceneNode,\n ctx: SVGExportContext\n): { attrs: Record<string, string | number | undefined>; clipId?: string } {\n const attrs: Record<string, string | number | undefined> = {}\n\n const transform = buildTransformAttr(node)\n if (transform) attrs.transform = transform\n\n if (node.opacity < 1) attrs.opacity = round(node.opacity)\n\n const blend = SVG_BLEND_MODE[node.blendMode]\n if (blend && blend !== 'normal' && node.blendMode !== 'PASS_THROUGH') {\n attrs.style = `mix-blend-mode: ${blend}`\n }\n\n const filterDef = createFilterDef(node.effects, ctx)\n if (filterDef) {\n ctx.defs.push(filterDef.node)\n attrs.filter = `url(#${filterDef.id})`\n }\n\n let clipId: string | undefined\n if (node.clipsContent && node.childIds.length > 0) {\n clipId = nextDefId(ctx, 'clip')\n ctx.defs.push(svg('clipPath', { id: clipId }, boxOutlineElement(node, {})))\n }\n\n return { attrs, clipId }\n}\n\nfunction buildSVGStrokeAttrs(\n visibleStrokes: Stroke[],\n colorSpace: 'srgb' | 'display-p3',\n nodeCap: SceneNode['strokeCap']\n): Record<string, string | number | undefined> {\n if (visibleStrokes.length === 0) return {}\n const stroke = visibleStrokes[0]\n const cap = stroke.cap ?? nodeCap\n const attrs: Record<string, string | number | undefined> = {\n // Opacity 1 keeps the color opaque. Display P3 must not also keep color alpha here, or a\n // viewer multiplies it by stroke-opacity; the canvas paints stroke.opacity alone.\n stroke: formatSolidColor(stroke.color, 1, colorSpace),\n 'stroke-width': round(stroke.weight)\n }\n if (stroke.opacity < 1) attrs['stroke-opacity'] = round(stroke.opacity)\n if (cap !== 'NONE') attrs['stroke-linecap'] = SVG_STROKE_CAP[cap] ?? 'butt'\n if (stroke.join && stroke.join !== 'MITER') {\n attrs['stroke-linejoin'] = SVG_STROKE_JOIN[stroke.join] ?? 'miter'\n }\n if (stroke.dashPattern && stroke.dashPattern.length > 0) {\n attrs['stroke-dasharray'] = stroke.dashPattern.map((n) => round(n)).join(' ')\n }\n return attrs\n}\n\nfunction hasPathLevelFills(node: SceneNode): boolean {\n return node.type === 'VECTOR' && node.fillGeometry.some((geometry) => geometry.fills?.length)\n}\n\nfunction buildShapeChildren(\n node: SceneNode,\n visibleFills: Fill[],\n fillAttr: string | null,\n fillOpacity: number | undefined,\n strokeAttrs: Record<string, string | number | undefined>,\n visibleStrokes: Stroke[],\n ctx: SVGExportContext\n): SVGNode[] {\n const aligned = hasPathLevelFills(node) ? null : alignedStroke(node, visibleStrokes[0])\n if (!aligned) {\n return fillAndStrokeElements(\n node,\n visibleFills,\n fillAttr,\n fillOpacity,\n strokeAttrs,\n visibleStrokes.length,\n ctx\n )\n }\n // The fill goes as it is, and the stroke over it inside or outside the outline.\n return [\n ...fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, {}, 0, ctx),\n ...alignedStrokeElement(node, aligned, strokeAttrs, ctx),\n ...(node.type === 'SHAPE_WITH_TEXT' ? shapeWithTextDetailElements(node, strokeAttrs, ctx) : [])\n ]\n}\n\nfunction fillAndStrokeElements(\n node: SceneNode,\n visibleFills: Fill[],\n fillAttr: string | null,\n fillOpacity: number | undefined,\n strokeAttrs: Record<string, string | number | undefined>,\n visibleStrokeCount: number,\n ctx: SVGExportContext\n): SVGNode[] {\n if (hasPathLevelFills(node)) {\n return vectorShapeElements(\n node,\n { fill: fillAttr ?? 'none', 'fill-opacity': fillOpacity, ...strokeAttrs },\n strokeAttrs,\n ctx,\n visibleFills\n )\n }\n\n if (visibleFills.length > 1) {\n const elements: SVGNode[] = []\n for (const fill of visibleFills) {\n const ref = resolveFill(fill, node, ctx)\n if (ref) {\n elements.push(\n ...nodeShapeElements(\n node,\n ref,\n solidFillOpacity(fill, ctx.colorSpace),\n fill === visibleFills[visibleFills.length - 1] ? strokeAttrs : {},\n ctx\n )\n )\n }\n }\n return elements\n }\n\n const hasFillOrStroke = fillAttr || visibleStrokeCount > 0\n if (hasFillOrStroke && !isGroupLike(node)) {\n return nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx)\n }\n\n return []\n}\n\n/** The paint CSS `color` sets, for a tinted icon path. */\nconst CURRENT_COLOR = 'currentColor'\n\n/** A paint's SVG color and, for an sRGB solid, the `fill-opacity` beside it. */\nfunction exportedFill(\n fill: Fill | undefined,\n node: SceneNode,\n ctx: SVGExportContext\n): { color: string | null; opacity: number | undefined } {\n if (!fill) return { color: null, opacity: undefined }\n return {\n color: resolveFill(fill, node, ctx),\n opacity: solidFillOpacity(fill, ctx.colorSpace)\n }\n}\n\nfunction renderNode(node: SceneNode, ctx: SVGExportContext): SVGNode | null {\n if (!node.visible) return null\n\n const { attrs: groupAttrs, clipId } = buildGroupAttrs(node, ctx)\n\n if (node.type === 'TEXT') {\n const fill = exportedFill(\n node.fills.find((f) => f.visible),\n node,\n ctx\n )\n return svg('g', groupAttrs, renderTextNode(node, fill.color, ctx, fill.opacity))\n }\n\n const visibleFills = node.fills.filter((f) => f.visible)\n const visibleStrokes = node.strokes.filter((s) => s.visible)\n const tint = ctx.tint?.(node) ?? []\n const ownFill = visibleFills.length > 0 && !hasPathLevelFills(node) ? visibleFills[0] : undefined\n const fill = exportedFill(ownFill, node, ctx)\n const tintedFill = fill.color !== null && tint.includes('fill')\n const fillAttr = tintedFill ? CURRENT_COLOR : fill.color\n // `currentColor` has no alpha. Display P3 normally bakes solid opacity into the color, which a\n // tint throws away, so a tinted solid keeps `fill-opacity` in every color space.\n const fillOpacity = ownFill ? solidFillOpacity(ownFill, ctx.colorSpace, tintedFill) : fill.opacity\n const ownStrokes = buildSVGStrokeAttrs(visibleStrokes, ctx.colorSpace, node.strokeCap)\n const strokeAttrs =\n ownStrokes.stroke && tint.includes('stroke')\n ? { ...ownStrokes, stroke: CURRENT_COLOR }\n : ownStrokes\n\n const children: (SVGNode | null)[] = buildShapeChildren(\n node,\n visibleFills,\n fillAttr,\n fillOpacity,\n strokeAttrs,\n visibleStrokes,\n ctx\n )\n\n const childNodes = ctx.graph.getChildren(node.id)\n const childContent: SVGNode[] = []\n for (const child of childNodes) {\n const rendered = renderNode(child, ctx)\n if (rendered) childContent.push(rendered)\n }\n\n if (clipId && childContent.length > 0) {\n children.push(svg('g', { 'clip-path': `url(#${clipId})` }, ...childContent))\n } else {\n children.push(...childContent)\n }\n\n const validChildren = children.filter((c): c is SVGNode => c !== null)\n\n if (validChildren.length === 0 && Object.keys(groupAttrs).length === 0) {\n return null\n }\n\n if (validChildren.length === 1 && Object.keys(groupAttrs).length === 0) {\n return validChildren[0]\n }\n\n return svg('g', groupAttrs, ...validChildren)\n}\n\nfunction isGroupLike(node: SceneNode): boolean {\n return node.type === 'GROUP'\n}\n\n// --- Public API ---\n\nexport interface SVGExportOptions {\n /** Include XML declaration (default: true) */\n xmlDeclaration?: boolean\n /** Target export color space (default: srgb) */\n colorSpace?: 'srgb' | 'display-p3'\n /**\n * Line breaks of text nodes as the editor laid them out, wraps included. Without them, only\n * explicit newlines start a new baseline, which renderers that do not wrap SVG text keep.\n */\n textLayout?: SVGTextLayout\n /**\n * A family to name a font face by instead of its own, such as the one a PDF embeds the face's\n * file under. Text in an aliased face is written in that family at normal weight and style.\n */\n fontAlias?: SVGFontAlias\n}\n\nexport function renderNodesToSVG(\n graph: SceneGraph,\n _pageId: string,\n nodeIds: string[],\n options: SVGExportOptions = {}\n): string | null {\n const bounds = computeContentBounds(graph, nodeIds)\n if (!bounds) return null\n\n const { minX, minY, maxX, maxY } = bounds\n const width = round(maxX - minX)\n const height = round(maxY - minY)\n\n const ctx: SVGExportContext = {\n defs: [],\n defIdCounter: 0,\n graph,\n colorSpace: options.colorSpace ?? 'srgb',\n textLayout: options.textLayout,\n fontAlias: options.fontAlias\n }\n\n const contentNodes: SVGNode[] = []\n\n for (const id of nodeIds) {\n const node = graph.getNode(id)\n if (!node?.visible) continue\n\n const abs = graph.getAbsolutePosition(id)\n const offsetX = abs.x - minX\n const offsetY = abs.y - minY\n\n const needsOffset = offsetX !== node.x || offsetY !== node.y\n const clone = needsOffset ? { ...node, x: round(offsetX), y: round(offsetY) } : node\n\n const rendered = renderNode(clone, ctx)\n if (rendered) contentNodes.push(rendered)\n }\n\n if (contentNodes.length === 0) return null\n\n const rootChildren: (SVGNode | string)[] = []\n if (ctx.defs.length > 0) {\n rootChildren.push(svg('defs', {}, ...ctx.defs))\n }\n rootChildren.push(...contentNodes)\n\n const root = svg(\n 'svg',\n {\n xmlns: 'http://www.w3.org/2000/svg',\n 'xmlns:xlink': 'http://www.w3.org/1999/xlink',\n width,\n height,\n viewBox: `0 0 ${width} ${height}`\n },\n ...(rootChildren as SVGNode[])\n )\n\n const svgStr = renderSVGNode(root)\n const xmlDecl = options.xmlDeclaration !== false ? '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' : ''\n return xmlDecl + svgStr\n}\n\n/**\n * One layer as an `<svg>` element sized to its box, for inlining in HTML where the box already\n * places, rotates, and fades it: the drawing starts at the layer's origin without its rotation\n * or opacity, and keeps its flips.\n */\nexport function renderNodeSVGElement(\n graph: SceneGraph,\n node: SceneNode,\n {\n idPrefix,\n colorSpace = 'srgb',\n tint\n }: Pick<SVGExportContext, 'tint'> & { idPrefix: string; colorSpace?: RenderColorSpace }\n): SVGNode | null {\n const ctx: SVGExportContext = { defs: [], defIdCounter: 0, graph, colorSpace, idPrefix, tint }\n const drawn = renderNode({ ...node, x: 0, y: 0, rotation: 0, opacity: 1 }, ctx)\n if (!drawn) return null\n // A straight line has no height or width, but its stroke still needs a viewport to draw in.\n const width = Math.max(1, round(node.width))\n const height = Math.max(1, round(node.height))\n return svg(\n 'svg',\n { width, height, viewBox: `0 0 ${width} ${height}` },\n ctx.defs.length > 0 ? svg('defs', {}, ...ctx.defs) : null,\n drawn\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgDA,SAAS,gBACP,MACA,SACA,QACW;CACX,MAAM,UAAU,eAAe,OAAO,CAAC,CAAC,KAAK,MAAM,IAAI,QAAQ;EAAE;EAAG,GAAG;CAAO,CAAC,CAAC;CAChF,IAAI,cAAc,OAAO,CAAC,CAAC,WAAW,GAAG,OAAO;CAChD,OAAO,CAAC,GAAG,SAAS,GAAG,iBAAiB,MAAM,SAAS,QAAQ,aAAa,CAAC;AAC/E;AAEA,SAAS,oBACP,MACA,QACA,aACA,KACA,eACW;CACX,MAAM,WAAsB,CAAC;CAC7B,IAAI,KAAK,aAAa,SAAS,GAC7B,KAAK,MAAM,OAAO,KAAK,cAA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G,UAAU;EAAG,SAAS;CAAE,GAAG,GAAG;CAC9E,IAAI,CAAC,OAAO,OAAO;CAEnB,MAAM,QAAQ,KAAK,IAAI,GAAG,MAAM,KAAK,KAAK,CAAC;CAC3C,MAAM,SAAS,KAAK,IAAI,GAAG,MAAM,KAAK,MAAM,CAAC;CAC7C,OAAO,IACL,OACA;EAAE;EAAO;EAAQ,SAAS,OAAO,MAAM,GAAG;CAAS,GACnD,IAAI,KAAK,SAAS,IAAI,IAAI,QAAQ,CAAC,GAAG,GAAG,IAAI,IAAI,IAAI,MACrD,KACF;AACF"}
1
+ {"version":3,"file":"export.js","names":[],"sources":["../../../../src/io/formats/svg/export.ts"],"sourcesContent":["import type { RenderColorSpace } from '@pairdraw/scene-graph/color'\n\nimport { normalizeDashPattern } from '#core/canvas/strokes'\nimport { lineStrokePath } from '#core/canvas/strokes/line'\nimport { fittedDashPattern } from '#core/canvas/strokes/sides'\nimport { computeContentBounds } from '#core/io/formats/raster'\n\nimport {\n nextDefId,\n formatSolidColor,\n resolveFill,\n solidFillOpacity,\n SVG_STROKE_CAP,\n SVG_STROKE_JOIN,\n SVG_BLEND_MODE\n} from './defs'\nimport { createFilterDef } from './effects'\nimport {\n round,\n geometryBlobToSVGPath,\n makePolygonPoints,\n roundedPolygonPath,\n hasRadius,\n hasSmoothCorners,\n boxOutlinePath,\n arcPath,\n shapeWithTextOutlinePath\n} from './paths'\n\nexport { geometryBlobToSVGPath, nodeOutlinePath, type OutlineNode } from './paths'\n\nimport type { SceneGraph, SceneNode, Fill, Stroke, VectorNetwork } from '@pairdraw/scene-graph'\nimport { looseSegments, regionSVGPaths } from '@pairdraw/scene-graph/vector-network'\n\nimport type { BooleanPathResolver } from '#core/io/formats/boolean-path'\n\nimport { arrowHeadElements, openPathElements, vectorArrowHeads } from './arrows'\nimport type { SVGExportContext, SVGFontAlias } from './defs'\nimport { svg, renderSVGNode } from './node'\nimport type { SVGNode } from './node'\nimport { alignedStroke, alignedStrokeElement, shapeWithTextDetailElements } from './strokes'\nimport { renderTextNode } from './text/export'\nimport type { SVGTextLayout } from './text/lines'\n\n// --- Node rendering ---\n\n/**\n * A vector network's paths: its regions as they are traced, and its open segments as the canvas\n * strokes them, rounded and pulled back under their heads.\n */\nfunction networkElements(\n node: SceneNode,\n network: VectorNetwork,\n common: Record<string, string | number | undefined>\n): SVGNode[] {\n const regions = regionSVGPaths(network).map((d) => svg('path', { d, ...common }))\n if (looseSegments(network).length === 0) return regions\n return [...regions, ...openPathElements(node, network, common, looseSegments)]\n}\n\n/** Paints one path's fill stack; a blended fill draws its stroke as a separate path. */\nfunction vectorFillElements(\n attrs: Record<string, string | number | undefined>,\n visibleFills: Fill[],\n strokeAttrs: Record<string, string | number | undefined>,\n common: Record<string, string | number | undefined>,\n node: SceneNode,\n ctx: SVGExportContext\n): SVGNode[] {\n const elements: SVGNode[] = []\n for (const [index, fill] of visibleFills.entries()) {\n const fillAttr = resolveFill(fill, node, ctx)\n if (!fillAttr) continue\n const style = paintBlendStyle(fill)\n const last = index === visibleFills.length - 1\n const splitStroke = style !== undefined && last && common.stroke !== 'none'\n const stroke = last && !splitStroke ? common.stroke : 'none'\n elements.push(\n svg('path', {\n ...attrs,\n fill: fillAttr,\n 'fill-opacity': solidFillOpacity(fill, ctx.colorSpace),\n style,\n stroke\n })\n )\n if (splitStroke) {\n elements.push(\n svg('path', {\n d: attrs.d,\n 'fill-rule': attrs['fill-rule'],\n fill: 'none',\n ...strokeAttrs\n })\n )\n }\n }\n return elements\n}\n\nfunction vectorShapeElements(\n node: SceneNode,\n common: Record<string, string | number | undefined>,\n strokeAttrs: Record<string, string | number | undefined>,\n ctx: SVGExportContext,\n fallbackFills?: Fill[]\n): SVGNode[] {\n const elements: SVGNode[] = []\n if (node.fillGeometry.length > 0) {\n for (const geo of node.fillGeometry) {\n const d = geometryBlobToSVGPath(geo.commandsBlob)\n if (!d) continue\n const attrs = {\n d,\n 'fill-rule': geo.windingRule === 'EVENODD' ? 'evenodd' : undefined,\n ...common\n }\n const pathFills = geo.fills?.length ? geo.fills : fallbackFills\n if (!pathFills) {\n elements.push(svg('path', attrs))\n continue\n }\n const visibleFills = pathFills.filter((fill) => fill.visible)\n if (visibleFills.length === 0) {\n elements.push(svg('path', { ...attrs, fill: 'none' }))\n continue\n }\n elements.push(...vectorFillElements(attrs, visibleFills, strokeAttrs, common, node, ctx))\n }\n } else if (node.vectorNetwork) {\n elements.push(...networkElements(node, node.vectorNetwork, common))\n }\n elements.push(...vectorStrokeTail(node, strokeAttrs))\n return withVectorFallback(elements, node, common)\n}\n\n/** The empty vector's fallback shape, after both paints have contributed their elements. */\nfunction withVectorFallback(\n elements: SVGNode[],\n node: SceneNode,\n common: Record<string, string | number | undefined>\n): SVGNode[] {\n return elements.length > 0\n ? elements\n : [svg('rect', { width: round(node.width), height: round(node.height), ...common })]\n}\n\n/** The stored stroke geometry and arrowheads both vector paints share after their outlines. */\nfunction vectorStrokeTail(\n node: SceneNode,\n strokeAttrs: Record<string, string | number | undefined>\n): SVGNode[] {\n const elements: SVGNode[] = []\n if (node.strokeGeometry.length > 0 && strokeAttrs.stroke && strokeAttrs.stroke !== 'none') {\n for (const geo of node.strokeGeometry) {\n const d = geometryBlobToSVGPath(geo.commandsBlob)\n if (d) {\n elements.push(\n svg('path', {\n d,\n fill: strokeAttrs.stroke,\n 'fill-opacity': strokeAttrs['stroke-opacity'],\n stroke: 'none'\n })\n )\n }\n }\n }\n if (node.vectorNetwork) elements.push(...vectorArrowHeads(node, node.vectorNetwork, strokeAttrs))\n return elements\n}\n\n/** A vector layer's outlines as strokes alone, for a second stroke over the painted fills. */\nfunction vectorStrokeElements(\n node: SceneNode,\n strokeAttrs: Record<string, string | number | undefined>\n): SVGNode[] {\n const elements: SVGNode[] = []\n const common: Record<string, string | number | undefined> = { fill: 'none', ...strokeAttrs }\n if (node.fillGeometry.length > 0) {\n for (const geo of node.fillGeometry) {\n const d = geometryBlobToSVGPath(geo.commandsBlob)\n if (d) {\n elements.push(\n svg('path', {\n d,\n 'fill-rule': geo.windingRule === 'EVENODD' ? 'evenodd' : undefined,\n ...common\n })\n )\n }\n }\n } else if (node.vectorNetwork) {\n elements.push(...networkElements(node, node.vectorNetwork, common))\n }\n elements.push(...vectorStrokeTail(node, strokeAttrs))\n return withVectorFallback(elements, node, common)\n}\n\n/** A line's dashes stretched along it as the canvas lays them, half a dash at each end. */\nfunction lineDashAttrs(stroke: Stroke | undefined, length: number) {\n const fitted = fittedDashPattern(length, normalizeDashPattern(stroke?.dashPattern))\n if (!fitted) return {}\n return {\n 'stroke-dasharray': fitted.intervals.map((size) => round(size)).join(' '),\n 'stroke-dashoffset': round(fitted.offset)\n }\n}\n\nfunction nodeShapeElements(\n node: SceneNode,\n fillAttr: string | null,\n fillOpacity: number | undefined,\n strokeAttrs: Record<string, string | number | undefined>,\n ctx: SVGExportContext,\n stroke?: Stroke\n): SVGNode[] {\n const common: Record<string, string | number | undefined> = {\n fill: fillAttr ?? 'none',\n 'fill-opacity': fillOpacity,\n ...strokeAttrs\n }\n\n switch (node.type) {\n case 'ELLIPSE': {\n if (node.arcData) {\n return [svg('path', { d: arcPath(node), ...common })]\n }\n return [\n svg('ellipse', {\n cx: round(node.width / 2),\n cy: round(node.height / 2),\n rx: round(node.width / 2),\n ry: round(node.height / 2),\n ...common\n })\n ]\n }\n\n case 'LINE': {\n // Where the canvas strokes it: to one side of the line, with its caps inside its length.\n const lineStroke = stroke ?? node.strokes.find((item) => item.visible)\n const {\n network,\n from: start,\n to: end\n } = lineStrokePath(node, lineStroke?.weight ?? 0, lineStroke?.cap ?? node.strokeCap)\n return [\n svg('line', {\n x1: round(start.x),\n y1: round(start.y),\n x2: round(end.x),\n y2: round(end.y),\n fill: 'none',\n ...strokeAttrs,\n ...lineDashAttrs(lineStroke, Math.hypot(end.x - start.x, end.y - start.y))\n }),\n ...arrowHeadElements(node, network, lineStroke, strokeAttrs)\n ]\n }\n\n case 'STAR':\n case 'POLYGON':\n return node.cornerRadius > 0\n ? [svg('path', { d: roundedPolygonPath(node), ...common })]\n : [svg('polygon', { points: makePolygonPoints(node), ...common })]\n\n case 'VECTOR':\n return vectorShapeElements(node, common, strokeAttrs, ctx)\n\n case 'SHAPE_WITH_TEXT':\n return shapeWithTextElements(node, common, strokeAttrs, ctx)\n\n default:\n return [boxOutlineElement(node, common)]\n }\n}\n\n/**\n * A box layer's outline as one element: a rect, a rect with `rx`/`ry` for one radius, or the\n * shared box path for independent or smoothed corners, so fills and clips follow the same edge.\n */\nfunction boxOutlineElement(\n node: SceneNode,\n attrs: Record<string, string | number | undefined>\n): SVGNode {\n const width = round(node.width)\n const height = round(node.height)\n if (!hasRadius(node)) return svg('rect', { width, height, ...attrs })\n if (node.independentCorners || hasSmoothCorners(node)) {\n return svg('path', { d: boxOutlinePath(node), ...attrs })\n }\n // SVG clamps rx and ry to their own sides; the canvas keeps a too-large radius circular.\n const radius = round(Math.min(node.cornerRadius, node.width / 2, node.height / 2))\n return svg('rect', { width, height, rx: radius, ry: radius, ...attrs })\n}\n\n/**\n * A FigJam shape's outline, and its inner lines, such as a database's front rim, stroked as the\n * canvas strokes them: at the stroke's own weight, ending where the outline does.\n */\nfunction shapeWithTextElements(\n node: SceneNode,\n common: Record<string, string | number | undefined>,\n strokeAttrs: Record<string, string | number | undefined>,\n ctx: SVGExportContext\n): SVGNode[] {\n return [\n svg('path', { d: shapeWithTextOutlinePath(node), ...common }),\n ...shapeWithTextDetailElements(node, strokeAttrs, ctx)\n ]\n}\n\n// --- Main recursive renderer ---\n\nfunction buildTransformAttr(node: SceneNode): string | undefined {\n const transforms: string[] = []\n if (node.x !== 0 || node.y !== 0) transforms.push(`translate(${round(node.x)}, ${round(node.y)})`)\n if (node.rotation !== 0) {\n transforms.push(\n `rotate(${round(node.rotation)}, ${round(node.width / 2)}, ${round(node.height / 2)})`\n )\n }\n if (node.flipX || node.flipY) {\n const tx = node.flipX ? node.width : 0\n const ty = node.flipY ? node.height : 0\n const sx = node.flipX ? -1 : 1\n const sy = node.flipY ? -1 : 1\n transforms.push(`translate(${round(tx)}, ${round(ty)}) scale(${sx}, ${sy})`)\n }\n return transforms.length > 0 ? transforms.join(' ') : undefined\n}\n\nfunction buildGroupAttrs(\n node: SceneNode,\n ctx: SVGExportContext\n): { attrs: Record<string, string | number | undefined>; clipId?: string } {\n const attrs: Record<string, string | number | undefined> = {}\n\n const transform = buildTransformAttr(node)\n if (transform) attrs.transform = transform\n\n if (node.opacity < 1) attrs.opacity = round(node.opacity)\n\n const blend = SVG_BLEND_MODE[node.blendMode]\n if (blend && blend !== 'normal' && node.blendMode !== 'PASS_THROUGH') {\n attrs.style = `mix-blend-mode: ${blend}`\n }\n\n const filterDef = createFilterDef(node, ctx)\n if (filterDef) {\n ctx.defs.push(filterDef.node)\n attrs.filter = `url(#${filterDef.id})`\n }\n\n let clipId: string | undefined\n if (node.clipsContent && node.childIds.length > 0) {\n clipId = nextDefId(ctx, 'clip')\n ctx.defs.push(svg('clipPath', { id: clipId }, boxOutlineElement(node, {})))\n }\n\n return { attrs, clipId }\n}\n\nfunction buildSVGStrokeAttrs(\n stroke: Stroke,\n node: SceneNode,\n ctx: SVGExportContext\n): Record<string, string | number | undefined> {\n const cap = stroke.cap ?? node.strokeCap\n const attrs: Record<string, string | number | undefined> = {\n // Opacity 1 keeps the color opaque. Display P3 must not also keep color alpha here, or a\n // viewer multiplies it by stroke-opacity; the canvas paints stroke.opacity alone.\n stroke:\n stroke.type === 'SOLID'\n ? formatSolidColor(stroke.color, 1, ctx.colorSpace)\n : (resolveFill(stroke, node, ctx) ?? formatSolidColor(stroke.color, 1, ctx.colorSpace)),\n 'stroke-width': round(stroke.weight)\n }\n if (stroke.opacity < 1) attrs['stroke-opacity'] = round(stroke.opacity)\n if (cap !== 'NONE') attrs['stroke-linecap'] = SVG_STROKE_CAP[cap] ?? 'butt'\n if (stroke.join && stroke.join !== 'MITER') {\n attrs['stroke-linejoin'] = SVG_STROKE_JOIN[stroke.join] ?? 'miter'\n }\n if (stroke.dashPattern && stroke.dashPattern.length > 0) {\n attrs['stroke-dasharray'] = stroke.dashPattern.map((n) => round(n)).join(' ')\n }\n return attrs\n}\n\n/** The blend CSS a paint adds, when the canvas would not composite it source-over. */\nfunction paintBlendStyle(fill: Fill | undefined): string | undefined {\n const blend = fill?.blendMode ? SVG_BLEND_MODE[fill.blendMode] : undefined\n return blend && blend !== 'normal' ? `mix-blend-mode: ${blend}` : undefined\n}\n\n/** Adds a paint's blend mode to the elements that draw it. */\nfunction withPaintBlend(elements: SVGNode[], fill: Fill | undefined): SVGNode[] {\n const style = paintBlendStyle(fill)\n if (style) for (const element of elements) element.attrs.style = style\n return elements\n}\n\n/**\n * Draws the fill and the stroke as separate elements when the fill blends, so the stroke keeps the\n * source-over canvas gives it instead of inheriting the fill's blend mode.\n */\nfunction shapeWithPaint(\n node: SceneNode,\n fillAttr: string | null,\n fillOpacity: number | undefined,\n strokeAttrs: Record<string, string | number | undefined>,\n fill: Fill | undefined,\n ctx: SVGExportContext\n): SVGNode[] {\n const blends = paintBlendStyle(fill) !== undefined\n if (!blends || !strokeAttrs.stroke) {\n return withPaintBlend(nodeShapeElements(node, fillAttr, fillOpacity, strokeAttrs, ctx), fill)\n }\n return [\n ...withPaintBlend(nodeShapeElements(node, fillAttr, fillOpacity, {}, ctx), fill),\n ...nodeShapeElements(node, null, undefined, strokeAttrs, ctx)\n ]\n}\n\nfunction hasPathLevelFills(node: SceneNode): boolean {\n return node.type === 'VECTOR' && node.fillGeometry.some((geometry) => geometry.fills?.length)\n}\n\n/** One stroke at its own weight over the fills: a centred one on the outline, an aligned one around it. */\nfunction strokeElements(\n node: SceneNode,\n stroke: Stroke,\n strokeAttrs: Record<string, string | number | undefined>,\n ctx: SVGExportContext\n): SVGNode[] {\n const aligned = hasPathLevelFills(node) ? null : alignedStroke(node, stroke)\n if (aligned) {\n return [\n ...alignedStrokeElement(node, aligned, strokeAttrs, ctx),\n ...(node.type === 'SHAPE_WITH_TEXT'\n ? shapeWithTextDetailElements(node, strokeAttrs, ctx)\n : [])\n ]\n }\n if (node.type === 'VECTOR') return vectorStrokeElements(node, strokeAttrs)\n return nodeShapeElements(node, null, undefined, strokeAttrs, ctx, stroke)\n}\n\n/**\n * The fills and the strokes over them. The first stroke joins the fill's own element as before;\n * every later visible stroke is drawn in layer order, without painting the fill again.\n */\nfunction buildShapeChildren(\n node: SceneNode,\n visibleFills: Fill[],\n fillAttr: string | null,\n fillOpacity: number | undefined,\n strokeAttrs: Record<string, string | number | undefined>[],\n visibleStrokes: Stroke[],\n ctx: SVGExportContext\n): SVGNode[] {\n if (visibleStrokes.length === 0) {\n return fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, {}, 0, ctx)\n }\n const first = visibleStrokes[0]\n const firstAttrs = strokeAttrs[0]\n const elements = alignedStroke(node, first)\n ? // The fill goes as it is, and the stroke over it inside or outside the outline.\n [\n ...fillAndStrokeElements(node, visibleFills, fillAttr, fillOpacity, {}, 0, ctx),\n ...strokeElements(node, first, firstAttrs, ctx)\n ]\n : fillAndStrokeElements(\n node,\n visibleFills,\n fillAttr,\n fillOpacity,\n firstAttrs,\n visibleStrokes.length,\n ctx\n )\n for (let index = 1; index < visibleStrokes.length; index++) {\n elements.push(...strokeElements(node, visibleStrokes[index], strokeAttrs[index], ctx))\n }\n return elements\n}\n\nfunction fillAndStrokeElements(\n node: SceneNode,\n visibleFills: Fill[],\n fillAttr: string | null,\n fillOpacity: number | undefined,\n strokeAttrs: Record<string, string | number | undefined>,\n visibleStrokeCount: number,\n ctx: SVGExportContext\n): SVGNode[] {\n if (hasPathLevelFills(node)) {\n return vectorShapeElements(\n node,\n { fill: fillAttr ?? 'none', 'fill-opacity': fillOpacity, ...strokeAttrs },\n strokeAttrs,\n ctx,\n visibleFills\n )\n }\n\n if (visibleFills.length > 1) {\n const elements: SVGNode[] = []\n for (const fill of visibleFills) {\n const ref = resolveFill(fill, node, ctx)\n if (ref) {\n elements.push(\n ...shapeWithPaint(\n node,\n ref,\n solidFillOpacity(fill, ctx.colorSpace),\n fill === visibleFills[visibleFills.length - 1] ? strokeAttrs : {},\n fill,\n ctx\n )\n )\n }\n }\n return elements\n }\n\n const hasFillOrStroke = fillAttr || visibleStrokeCount > 0\n if (hasFillOrStroke && !isGroupLike(node)) {\n return shapeWithPaint(\n node,\n fillAttr,\n fillOpacity,\n strokeAttrs,\n visibleFills.length === 1 ? visibleFills[0] : undefined,\n ctx\n )\n }\n\n return []\n}\n\n/** The paint CSS `color` sets, for a tinted icon path. */\nconst CURRENT_COLOR = 'currentColor'\n\n/** A paint's SVG color and, for an sRGB solid, the `fill-opacity` beside it. */\nfunction exportedFill(\n fill: Fill | undefined,\n node: SceneNode,\n ctx: SVGExportContext\n): { color: string | null; opacity: number | undefined } {\n if (!fill) return { color: null, opacity: undefined }\n return {\n color: resolveFill(fill, node, ctx),\n opacity: solidFillOpacity(fill, ctx.colorSpace)\n }\n}\n\n/**\n * A mask layer's definition: an alpha or luminance `<mask>`, or a `<clipPath>` for an outline\n * mask. The rendered layer carries its own position, opacity, and filters into the mask.\n */\nfunction maskWire(\n mask: SceneNode,\n ctx: SVGExportContext\n): { attribute: 'mask' | 'clip-path'; id: string } {\n const content = renderNode(mask, ctx)\n if (mask.maskType === 'VECTOR') {\n const id = nextDefId(ctx, 'clip')\n ctx.defs.push(svg('clipPath', { id, clipPathUnits: 'userSpaceOnUse' }, content ?? undefined))\n return { attribute: 'clip-path', id }\n }\n const id = nextDefId(ctx, 'mask')\n const attrs: Record<string, string | number | undefined> = {\n id,\n maskContentUnits: 'userSpaceOnUse'\n }\n if (mask.maskType === 'ALPHA') attrs['mask-type'] = 'alpha'\n ctx.defs.push(svg('mask', attrs, content ?? undefined))\n return { attribute: 'mask', id }\n}\n\n/**\n * The children as the canvas draws them: a run of visible masks masks the siblings that follow\n * it, until the next mask, and the mask layers themselves never draw on their own.\n */\nfunction maskedChildNodes(childNodes: SceneNode[], ctx: SVGExportContext): SVGNode[] {\n const content: SVGNode[] = []\n let masks: Array<{ attribute: 'mask' | 'clip-path'; id: string }> = []\n let afterMask = false\n for (const child of childNodes) {\n if (child.visible && child.isMask) {\n const wire = maskWire(child, ctx)\n masks = afterMask ? [...masks, wire] : [wire]\n afterMask = true\n continue\n }\n const rendered = renderNode(child, ctx)\n afterMask = false\n if (!rendered) continue\n let wrapped = rendered\n for (const wire of masks) wrapped = svg('g', { [wire.attribute]: `url(#${wire.id})` }, wrapped)\n content.push(wrapped)\n }\n return content\n}\n\n/** A boolean's live result path in the paints its fills and strokes give it. */\nfunction booleanPathElements(\n node: SceneNode,\n d: string,\n visibleFills: Fill[],\n fillAttr: string | null,\n fillOpacity: number | undefined,\n strokeAttrs: Array<Record<string, string | number | undefined>>,\n visibleStrokes: Stroke[],\n ctx: SVGExportContext\n): SVGNode[] {\n const common = { d, 'fill-rule': 'evenodd' as const }\n // A centred first stroke joins the fill element, as a shape's does; every later stroke, and\n // every inside or outside stroke, is drawn over the result outline on its own. An unset\n // alignment strokes the centred way, as `alignedStroke` treats it.\n const centered = (stroke: Stroke): boolean =>\n stroke.align !== 'INSIDE' && stroke.align !== 'OUTSIDE'\n const firstJoins = visibleStrokes.length > 0 && centered(visibleStrokes[0])\n const joined = firstJoins ? strokeAttrs[0] : {}\n const elements =\n visibleFills.length <= 1\n ? [\n svg('path', {\n ...common,\n fill: fillAttr ?? 'none',\n 'fill-opacity': fillOpacity,\n ...joined\n })\n ]\n : visibleFills.map((fill, index) =>\n svg('path', {\n ...common,\n fill: resolveFill(fill, node, ctx) ?? 'none',\n 'fill-opacity': solidFillOpacity(fill, ctx.colorSpace),\n ...(index === visibleFills.length - 1 ? joined : {})\n })\n )\n\n for (let index = firstJoins ? 1 : 0; index < visibleStrokes.length; index++) {\n const stroke = visibleStrokes[index]\n const attrs = strokeAttrs[index]\n elements.push(\n ...(centered(stroke)\n ? [svg('path', { d, fill: 'none', ...attrs })]\n : alignedStrokeElement(node, stroke, attrs, ctx, d))\n )\n }\n return elements\n}\n\n/** A boolean made in Pairdraw draws its computed result path instead of its operands. */\nfunction renderBooleanNode(\n node: SceneNode,\n ctx: SVGExportContext,\n paint: {\n groupAttrs: Record<string, string | number | undefined>\n visibleFills: Fill[]\n fillAttr: string | null\n fillOpacity: number | undefined\n strokeAttrs: Array<Record<string, string | number | undefined>>\n visibleStrokes: Stroke[]\n }\n): SVGNode | null {\n if (node.type !== 'BOOLEAN_OPERATION' || node.fillGeometry.length > 0 || !ctx.booleanPath) {\n return null\n }\n const d = ctx.booleanPath(ctx.graph, node)\n if (!d) return null\n return svg(\n 'g',\n paint.groupAttrs,\n ...booleanPathElements(\n node,\n d,\n paint.visibleFills,\n paint.fillAttr,\n paint.fillOpacity,\n paint.strokeAttrs,\n paint.visibleStrokes,\n ctx\n )\n )\n}\n\nfunction renderNode(node: SceneNode, ctx: SVGExportContext): SVGNode | null {\n if (!node.visible) return null\n\n const { attrs: groupAttrs, clipId } = buildGroupAttrs(node, ctx)\n\n if (node.type === 'TEXT') {\n const fill = exportedFill(\n node.fills.find((f) => f.visible),\n node,\n ctx\n )\n return svg('g', groupAttrs, renderTextNode(node, fill.color, ctx, fill.opacity))\n }\n\n const visibleFills = node.fills.filter((f) => f.visible)\n const visibleStrokes = node.strokes.filter((s) => s.visible)\n const tint = ctx.tint?.(node) ?? []\n const ownFill = visibleFills.length > 0 && !hasPathLevelFills(node) ? visibleFills[0] : undefined\n const fill = exportedFill(ownFill, node, ctx)\n const tintedFill = fill.color !== null && tint.includes('fill')\n const fillAttr = tintedFill ? CURRENT_COLOR : fill.color\n // `currentColor` has no alpha. Display P3 normally bakes solid opacity into the color, which a\n // tint throws away, so a tinted solid keeps `fill-opacity` in every color space.\n const fillOpacity = ownFill ? solidFillOpacity(ownFill, ctx.colorSpace, tintedFill) : fill.opacity\n const strokeAttrs = visibleStrokes.map((stroke) => {\n const attrs = buildSVGStrokeAttrs(stroke, node, ctx)\n return tint.includes('stroke') ? { ...attrs, stroke: CURRENT_COLOR } : attrs\n })\n\n const booleanDrawn = renderBooleanNode(node, ctx, {\n groupAttrs,\n visibleFills,\n fillAttr,\n fillOpacity,\n strokeAttrs,\n visibleStrokes\n })\n if (booleanDrawn) return booleanDrawn\n\n const children: (SVGNode | null)[] = buildShapeChildren(\n node,\n visibleFills,\n fillAttr,\n fillOpacity,\n strokeAttrs,\n visibleStrokes,\n ctx\n )\n\n const childContent = maskedChildNodes(ctx.graph.getChildren(node.id), ctx)\n\n if (clipId && childContent.length > 0) {\n children.push(svg('g', { 'clip-path': `url(#${clipId})` }, ...childContent))\n } else {\n children.push(...childContent)\n }\n\n const validChildren = children.filter((c): c is SVGNode => c !== null)\n\n if (validChildren.length === 0 && Object.keys(groupAttrs).length === 0) {\n return null\n }\n\n if (validChildren.length === 1 && Object.keys(groupAttrs).length === 0) {\n return validChildren[0]\n }\n\n return svg('g', groupAttrs, ...validChildren)\n}\n\nfunction isGroupLike(node: SceneNode): boolean {\n return node.type === 'GROUP'\n}\n\n// --- Public API ---\n\nexport interface SVGExportOptions {\n /** Include XML declaration (default: true) */\n xmlDeclaration?: boolean\n /** Target export color space (default: srgb) */\n colorSpace?: 'srgb' | 'display-p3'\n /**\n * Line breaks of text nodes as the editor laid them out, wraps included. Without them, only\n * explicit newlines start a new baseline, which renderers that do not wrap SVG text keep.\n */\n textLayout?: SVGTextLayout\n /**\n * A family to name a font face by instead of its own, such as the one a PDF embeds the face's\n * file under. Text in an aliased face is written in that family at normal weight and style.\n */\n fontAlias?: SVGFontAlias\n /**\n * The live result path of a boolean operation made in Pairdraw, which stores none. Left out,\n * such a boolean draws its box and its operands, as an archive-less reader sees it.\n */\n booleanPath?: BooleanPathResolver\n}\n\nexport function renderNodesToSVG(\n graph: SceneGraph,\n _pageId: string,\n nodeIds: string[],\n options: SVGExportOptions = {}\n): string | null {\n const bounds = computeContentBounds(graph, nodeIds)\n if (!bounds) return null\n\n const { minX, minY, maxX, maxY } = bounds\n const width = round(maxX - minX)\n const height = round(maxY - minY)\n\n const ctx: SVGExportContext = {\n defs: [],\n defIdCounter: 0,\n graph,\n colorSpace: options.colorSpace ?? 'srgb',\n textLayout: options.textLayout,\n fontAlias: options.fontAlias,\n booleanPath: options.booleanPath\n }\n\n const contentNodes: SVGNode[] = []\n\n for (const id of nodeIds) {\n const node = graph.getNode(id)\n if (!node?.visible) continue\n\n const abs = graph.getAbsolutePosition(id)\n const offsetX = abs.x - minX\n const offsetY = abs.y - minY\n\n const needsOffset = offsetX !== node.x || offsetY !== node.y\n const clone = needsOffset ? { ...node, x: round(offsetX), y: round(offsetY) } : node\n\n const rendered = renderNode(clone, ctx)\n if (rendered) contentNodes.push(rendered)\n }\n\n if (contentNodes.length === 0) return null\n\n const rootChildren: (SVGNode | string)[] = []\n if (ctx.defs.length > 0) {\n rootChildren.push(svg('defs', {}, ...ctx.defs))\n }\n rootChildren.push(...contentNodes)\n\n const root = svg(\n 'svg',\n {\n xmlns: 'http://www.w3.org/2000/svg',\n 'xmlns:xlink': 'http://www.w3.org/1999/xlink',\n width,\n height,\n viewBox: `0 0 ${width} ${height}`\n },\n ...(rootChildren as SVGNode[])\n )\n\n const svgStr = renderSVGNode(root)\n const xmlDecl = options.xmlDeclaration !== false ? '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n' : ''\n return xmlDecl + svgStr\n}\n\n/**\n * One layer as an `<svg>` element sized to its box, for inlining in HTML where the box already\n * places, rotates, and fades it: the drawing starts at the layer's origin without its rotation\n * or opacity, and keeps its flips.\n */\nexport function renderNodeSVGElement(\n graph: SceneGraph,\n node: SceneNode,\n {\n idPrefix,\n colorSpace = 'srgb',\n tint,\n booleanPath\n }: Pick<SVGExportContext, 'tint' | 'booleanPath'> & {\n idPrefix: string\n colorSpace?: RenderColorSpace\n }\n): SVGNode | null {\n const ctx: SVGExportContext = {\n defs: [],\n defIdCounter: 0,\n graph,\n colorSpace,\n idPrefix,\n tint,\n booleanPath\n }\n const drawn = renderNode({ ...node, x: 0, y: 0, rotation: 0, opacity: 1 }, ctx)\n if (!drawn) return null\n // A straight line has no height or width, but its stroke still needs a viewport to draw in.\n const width = Math.max(1, round(node.width))\n const height = Math.max(1, round(node.height))\n return svg(\n 'svg',\n { width, height, viewBox: `0 0 ${width} ${height}` },\n ctx.defs.length > 0 ? svg('defs', {}, ...ctx.defs) : null,\n drawn\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkDA,SAAS,gBACP,MACA,SACA,QACW;CACX,MAAM,UAAU,eAAe,OAAO,CAAC,CAAC,KAAK,MAAM,IAAI,QAAQ;EAAE;EAAG,GAAG;CAAO,CAAC,CAAC;CAChF,IAAI,cAAc,OAAO,CAAC,CAAC,WAAW,GAAG,OAAO;CAChD,OAAO,CAAC,GAAG,SAAS,GAAG,iBAAiB,MAAM,SAAS,QAAQ,aAAa,CAAC;AAC/E;;AAGA,SAAS,mBACP,OACA,cACA,aACA,QACA,MACA,KACW;CACX,MAAM,WAAsB,CAAC;CAC7B,KAAK,MAAM,CAAC,OAAO,SAAS,aAAa,QAAQ,GAAG;EAClD,MAAM,WAAW,YAAY,MAAM,MAAM,GAAG;EAC5C,IAAI,CAAC,UAAU;EACf,MAAM,QAAQ,gBAAgB,IAAI;EAClC,MAAM,OAAO,UAAU,aAAa,SAAS;EAC7C,MAAM,cAAc,UAAU,KAAA,KAAa,QAAQ,OAAO,WAAW;EACrE,MAAM,SAAS,QAAQ,CAAC,cAAc,OAAO,SAAS;EACtD,SAAS,KACP,IAAI,QAAQ;GACV,GAAG;GACH,MAAM;GACN,gBAAgB,iBAAiB,MAAM,IAAI,UAAU;GACrD;GACA;EACF,CAAC,CACH;EACA,IAAI,aACF,SAAS,KACP,IAAI,QAAQ;GACV,GAAG,MAAM;GACT,aAAa,MAAM;GACnB,MAAM;GACN,GAAG;EACL,CAAC,CACH;CAEJ;CACA,OAAO;AACT;AAEA,SAAS,oBACP,MACA,QACA,aACA,KACA,eACW;CACX,MAAM,WAAsB,CAAC;CAC7B,IAAI,KAAK,aAAa,SAAS,GAC7B,KAAK,MAAM,OAAO,KAAK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3B,GACA,GAAI,YACN;CAEA,MAAM,SAAS,cAAc,IAAI;CAEjC,QADgB,QAAQ,mBAAmB,QAAQ,iDAA6C,MAC/E;AACnB;;;;;;AAOA,SAAgB,qBACd,OACA,MACA,EACE,UACA,aAAa,QACb,MACA,eAKc;CAChB,MAAM,MAAwB;EAC5B,MAAM,CAAC;EACP,cAAc;EACd;EACA;EACA;EACA;EACA;CACF;CACA,MAAM,QAAQ,WAAW;EAAE,GAAG;EAAM,GAAG;EAAG,GAAG;EAAG,UAAU;EAAG,SAAS;CAAE,GAAG,GAAG;CAC9E,IAAI,CAAC,OAAO,OAAO;CAEnB,MAAM,QAAQ,KAAK,IAAI,GAAG,MAAM,KAAK,KAAK,CAAC;CAC3C,MAAM,SAAS,KAAK,IAAI,GAAG,MAAM,KAAK,MAAM,CAAC;CAC7C,OAAO,IACL,OACA;EAAE;EAAO;EAAQ,SAAS,OAAO,MAAM,GAAG;CAAS,GACnD,IAAI,KAAK,SAAS,IAAI,IAAI,QAAQ,CAAC,GAAG,GAAG,IAAI,IAAI,IAAI,MACrD,KACF;AACF"}
@@ -0,0 +1,27 @@
1
+ import { SVGNode } from "./node.js";
2
+ import { SVGExportContext } from "./defs.js";
3
+ import { Color } from "@pairdraw/scene-graph/primitives";
4
+ //#region src/io/formats/svg/filter.d.ts
5
+ /**
6
+ * A flood's colour, opaque: its alpha goes in `flood-opacity`, which a Display P3 colour would
7
+ * otherwise carry a second time.
8
+ */
9
+ declare function floodColor(color: Color, colorSpace: SVGExportContext['colorSpace']): string;
10
+ /** An SVG filter's primitives as they are added, each naming its result uniquely. */
11
+ declare class FilterBuilder {
12
+ private readonly id;
13
+ private readonly ctx;
14
+ readonly primitives: SVGNode[];
15
+ private count;
16
+ constructor(id: string, ctx: SVGExportContext);
17
+ /** A primitive with as many children as `children` holds. */
18
+ pushElement(tag: string, attrs: Record<string, string | number | undefined>, children: SVGNode[]): void;
19
+ /** The colour space the export writes colours in. */
20
+ get colorSpace(): SVGExportContext['colorSpace'];
21
+ /** A new result name, unique in this filter. */
22
+ result(name: string): string;
23
+ push(tag: string, attrs: Record<string, string | number | undefined>, ...children: SVGNode[]): void;
24
+ }
25
+ //#endregion
26
+ export { FilterBuilder, floodColor };
27
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","names":[],"sources":["../../../../src/io/formats/svg/filter.ts"],"mappings":";;;;;;;;iBASgB,WAAW,OAAO,OAAO,YAAY;;cAKxC;mBAKQ;mBACA;WALV,YAAY;UACb;EAGW,YAAA,YACA,KAAK;;EAIxB,YACE,aACA,OAAO,6CACP,UAAU;;MAMR,cAAc;;EAKlB,OAAO;EAKP,KAAK,aAAa,OAAO,gDAAgD,UAAU"}
@@ -0,0 +1,44 @@
1
+ import { svg } from "./node.js";
2
+ import { formatColor } from "./defs.js";
3
+ //#region src/io/formats/svg/filter.ts
4
+ /**
5
+ * A flood's colour, opaque: its alpha goes in `flood-opacity`, which a Display P3 colour would
6
+ * otherwise carry a second time.
7
+ */
8
+ function floodColor(color, colorSpace) {
9
+ return formatColor({
10
+ ...color,
11
+ a: 1
12
+ }, 1, colorSpace);
13
+ }
14
+ /** An SVG filter's primitives as they are added, each naming its result uniquely. */
15
+ var FilterBuilder = class {
16
+ id;
17
+ ctx;
18
+ primitives = [];
19
+ count = 0;
20
+ constructor(id, ctx) {
21
+ this.id = id;
22
+ this.ctx = ctx;
23
+ }
24
+ /** A primitive with as many children as `children` holds. */
25
+ pushElement(tag, attrs, children) {
26
+ this.primitives.push(svg(tag, attrs, ...children));
27
+ }
28
+ /** The colour space the export writes colours in. */
29
+ get colorSpace() {
30
+ return this.ctx.colorSpace;
31
+ }
32
+ /** A new result name, unique in this filter. */
33
+ result(name) {
34
+ this.count += 1;
35
+ return `${this.id}_${name}${this.count}`;
36
+ }
37
+ push(tag, attrs, ...children) {
38
+ this.primitives.push(svg(tag, attrs, ...children));
39
+ }
40
+ };
41
+ //#endregion
42
+ export { FilterBuilder, floodColor };
43
+
44
+ //# sourceMappingURL=filter.js.map