@pairdraw/core 0.19.2 → 0.21.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 (1170) hide show
  1. package/dist/ai/providers.d.ts +6 -0
  2. package/dist/ai/providers.d.ts.map +1 -1
  3. package/dist/ai/providers.js.map +1 -1
  4. package/dist/cache/resource.d.ts +8 -1
  5. package/dist/cache/resource.d.ts.map +1 -1
  6. package/dist/cache/resource.js +18 -0
  7. package/dist/cache/resource.js.map +1 -1
  8. package/dist/canvas/effects.d.ts +6 -4
  9. package/dist/canvas/effects.d.ts.map +1 -1
  10. package/dist/canvas/effects.js +37 -34
  11. package/dist/canvas/effects.js.map +1 -1
  12. package/dist/canvas/fills.d.ts.map +1 -1
  13. package/dist/canvas/fills.js +12 -8
  14. package/dist/canvas/fills.js.map +1 -1
  15. package/dist/canvas/images/adjustments.d.ts +18 -0
  16. package/dist/canvas/images/adjustments.d.ts.map +1 -0
  17. package/dist/canvas/images/adjustments.js +184 -0
  18. package/dist/canvas/images/adjustments.js.map +1 -0
  19. package/dist/canvas/images/sampling.d.ts +13 -0
  20. package/dist/canvas/images/sampling.d.ts.map +1 -0
  21. package/dist/canvas/images/sampling.js +49 -0
  22. package/dist/canvas/images/sampling.js.map +1 -0
  23. package/dist/canvas/index.d.ts +2 -2
  24. package/dist/canvas/masks.d.ts +1 -1
  25. package/dist/canvas/masks.d.ts.map +1 -1
  26. package/dist/canvas/masks.js.map +1 -1
  27. package/dist/canvas/noise/render.d.ts +15 -0
  28. package/dist/canvas/noise/render.d.ts.map +1 -0
  29. package/dist/canvas/noise/render.js +56 -0
  30. package/dist/canvas/noise/render.js.map +1 -0
  31. package/dist/canvas/noise/shader.d.ts +46 -0
  32. package/dist/canvas/noise/shader.d.ts.map +1 -0
  33. package/dist/canvas/noise/shader.js +166 -0
  34. package/dist/canvas/noise/shader.js.map +1 -0
  35. package/dist/canvas/noise/table.d.ts +13 -0
  36. package/dist/canvas/noise/table.d.ts.map +1 -0
  37. package/dist/canvas/noise/table.js +408 -0
  38. package/dist/canvas/noise/table.js.map +1 -0
  39. package/dist/canvas/noise/tile.d.ts +22 -0
  40. package/dist/canvas/noise/tile.d.ts.map +1 -0
  41. package/dist/canvas/noise/tile.js +74 -0
  42. package/dist/canvas/noise/tile.js.map +1 -0
  43. package/dist/canvas/outline-stroke.js +1 -1
  44. package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
  45. package/dist/canvas/overlays/auto-layout-hover.js +31 -71
  46. package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
  47. package/dist/canvas/renderer/chunks/index.d.ts +1 -1
  48. package/dist/canvas/renderer/colors.d.ts +20 -5
  49. package/dist/canvas/renderer/colors.d.ts.map +1 -1
  50. package/dist/canvas/renderer/colors.js +48 -42
  51. package/dist/canvas/renderer/colors.js.map +1 -1
  52. package/dist/canvas/renderer/document-surface.d.ts +25 -0
  53. package/dist/canvas/renderer/document-surface.d.ts.map +1 -0
  54. package/dist/canvas/renderer/document-surface.js +46 -0
  55. package/dist/canvas/renderer/document-surface.js.map +1 -0
  56. package/dist/canvas/renderer/fonts.d.ts.map +1 -1
  57. package/dist/canvas/renderer/fonts.js +6 -4
  58. package/dist/canvas/renderer/fonts.js.map +1 -1
  59. package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
  60. package/dist/canvas/renderer/lifecycle.js +10 -3
  61. package/dist/canvas/renderer/lifecycle.js.map +1 -1
  62. package/dist/canvas/renderer/methods.d.ts.map +1 -1
  63. package/dist/canvas/renderer/methods.js +1 -0
  64. package/dist/canvas/renderer/methods.js.map +1 -1
  65. package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
  66. package/dist/canvas/renderer/pipeline.js +36 -3
  67. package/dist/canvas/renderer/pipeline.js.map +1 -1
  68. package/dist/canvas/renderer/play-scenes.d.ts +13 -0
  69. package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
  70. package/dist/canvas/renderer/play-scenes.js +40 -0
  71. package/dist/canvas/renderer/play-scenes.js.map +1 -0
  72. package/dist/canvas/renderer/retained-backing.d.ts.map +1 -1
  73. package/dist/canvas/renderer/retained-backing.js +2 -1
  74. package/dist/canvas/renderer/retained-backing.js.map +1 -1
  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/tiles/surface-pool.d.ts.map +1 -1
  86. package/dist/canvas/renderer/tiles/surface-pool.js +2 -7
  87. package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
  88. package/dist/canvas/renderer/types.d.ts +18 -3
  89. package/dist/canvas/renderer/types.d.ts.map +1 -1
  90. package/dist/canvas/renderer/visual-bounds.d.ts +1 -1
  91. package/dist/canvas/renderer/visual-bounds.js +1 -1
  92. package/dist/canvas/renderer.d.ts +42 -4
  93. package/dist/canvas/renderer.d.ts.map +1 -1
  94. package/dist/canvas/renderer.js +57 -5
  95. package/dist/canvas/renderer.js.map +1 -1
  96. package/dist/canvas/scene.d.ts +2 -1
  97. package/dist/canvas/scene.d.ts.map +1 -1
  98. package/dist/canvas/scene.js +45 -12
  99. package/dist/canvas/scene.js.map +1 -1
  100. package/dist/canvas/shaders/effect.d.ts.map +1 -1
  101. package/dist/canvas/shaders/effect.js +2 -1
  102. package/dist/canvas/shaders/effect.js.map +1 -1
  103. package/dist/canvas/shadows/shape.d.ts.map +1 -1
  104. package/dist/canvas/shadows/shape.js +4 -2
  105. package/dist/canvas/shadows/shape.js.map +1 -1
  106. package/dist/canvas/shadows/silhouette.js +1 -1
  107. package/dist/canvas/shadows.d.ts.map +1 -1
  108. package/dist/canvas/shadows.js +4 -2
  109. package/dist/canvas/shadows.js.map +1 -1
  110. package/dist/canvas/text/decorations.d.ts +2 -2
  111. package/dist/canvas/text/decorations.d.ts.map +1 -1
  112. package/dist/canvas/text/decorations.js +5 -5
  113. package/dist/canvas/text/decorations.js.map +1 -1
  114. package/dist/canvas/text/index.js +1 -1
  115. package/dist/canvas/text/index.js.map +1 -1
  116. package/dist/canvas/text/paragraph/index.d.ts +2 -2
  117. package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
  118. package/dist/canvas/text/paragraph/index.js +16 -5
  119. package/dist/canvas/text/paragraph/index.js.map +1 -1
  120. package/dist/canvas/text/renderer.d.ts +2 -1
  121. package/dist/canvas/text/renderer.d.ts.map +1 -1
  122. package/dist/canvas/text/shape.js +4 -4
  123. package/dist/canvas/text/shape.js.map +1 -1
  124. package/dist/canvas/texture.d.ts +20 -0
  125. package/dist/canvas/texture.d.ts.map +1 -0
  126. package/dist/canvas/texture.js +101 -0
  127. package/dist/canvas/texture.js.map +1 -0
  128. package/dist/clipboard.js +16 -5
  129. package/dist/clipboard.js.map +1 -1
  130. package/dist/constants.d.ts +5 -1
  131. package/dist/constants.d.ts.map +1 -1
  132. package/dist/constants.js +5 -1
  133. package/dist/constants.js.map +1 -1
  134. package/dist/design-jsx/renderer.d.ts.map +1 -1
  135. package/dist/design-memory/check.d.ts +90 -0
  136. package/dist/design-memory/check.d.ts.map +1 -0
  137. package/dist/design-memory/check.js +281 -0
  138. package/dist/design-memory/check.js.map +1 -0
  139. package/dist/design-memory/describe.d.ts +37 -0
  140. package/dist/design-memory/describe.d.ts.map +1 -0
  141. package/dist/design-memory/describe.js +52 -0
  142. package/dist/design-memory/describe.js.map +1 -0
  143. package/dist/design-memory/distil.d.ts +22 -0
  144. package/dist/design-memory/distil.d.ts.map +1 -0
  145. package/dist/design-memory/distil.js +54 -0
  146. package/dist/design-memory/distil.js.map +1 -0
  147. package/dist/design-memory/document.d.ts +12 -0
  148. package/dist/design-memory/document.d.ts.map +1 -0
  149. package/dist/design-memory/document.js +64 -0
  150. package/dist/design-memory/document.js.map +1 -0
  151. package/dist/design-memory/guard.d.ts +48 -0
  152. package/dist/design-memory/guard.d.ts.map +1 -0
  153. package/dist/design-memory/guard.js +105 -0
  154. package/dist/design-memory/guard.js.map +1 -0
  155. package/dist/design-memory/index.d.ts +9 -0
  156. package/dist/design-memory/index.js +9 -0
  157. package/dist/design-memory/refusal.d.ts +32 -0
  158. package/dist/design-memory/refusal.d.ts.map +1 -0
  159. package/dist/design-memory/refusal.js +68 -0
  160. package/dist/design-memory/refusal.js.map +1 -0
  161. package/dist/design-memory/rules.d.ts +63 -0
  162. package/dist/design-memory/rules.d.ts.map +1 -0
  163. package/dist/design-memory/rules.js +224 -0
  164. package/dist/design-memory/rules.js.map +1 -0
  165. package/dist/design-memory/values.d.ts +28 -0
  166. package/dist/design-memory/values.d.ts.map +1 -0
  167. package/dist/design-memory/values.js +160 -0
  168. package/dist/design-memory/values.js.map +1 -0
  169. package/dist/editor/alignment.js +1 -1
  170. package/dist/editor/bridges/components.d.ts +2 -0
  171. package/dist/editor/bridges/components.d.ts.map +1 -1
  172. package/dist/editor/bridges/components.js +2 -0
  173. package/dist/editor/bridges/components.js.map +1 -1
  174. package/dist/editor/clipboard/assets.d.ts.map +1 -1
  175. package/dist/editor/clipboard/assets.js +3 -3
  176. package/dist/editor/clipboard/assets.js.map +1 -1
  177. package/dist/editor/clipboard/component-matches.d.ts +13 -0
  178. package/dist/editor/clipboard/component-matches.d.ts.map +1 -0
  179. package/dist/editor/clipboard/component-matches.js +50 -0
  180. package/dist/editor/clipboard/component-matches.js.map +1 -0
  181. package/dist/editor/clipboard/dependencies.d.ts +7 -0
  182. package/dist/editor/clipboard/dependencies.d.ts.map +1 -1
  183. package/dist/editor/clipboard/dependencies.js +5 -0
  184. package/dist/editor/clipboard/dependencies.js.map +1 -1
  185. package/dist/editor/clipboard/export.d.ts.map +1 -1
  186. package/dist/editor/clipboard/export.js +16 -2
  187. package/dist/editor/clipboard/export.js.map +1 -1
  188. package/dist/editor/clipboard/placement.d.ts +1 -1
  189. package/dist/editor/clipboard/placement.js +1 -1
  190. package/dist/editor/clipboard.d.ts.map +1 -1
  191. package/dist/editor/clipboard.js +48 -19
  192. package/dist/editor/clipboard.js.map +1 -1
  193. package/dist/editor/components/instances.d.ts +2 -0
  194. package/dist/editor/components/instances.d.ts.map +1 -1
  195. package/dist/editor/components/instances.js +22 -1
  196. package/dist/editor/components/instances.js.map +1 -1
  197. package/dist/editor/components/properties.d.ts.map +1 -1
  198. package/dist/editor/components/properties.js +3 -3
  199. package/dist/editor/components/properties.js.map +1 -1
  200. package/dist/editor/components.d.ts +2 -0
  201. package/dist/editor/components.d.ts.map +1 -1
  202. package/dist/editor/connectors/attach.js +1 -1
  203. package/dist/editor/create.d.ts +26 -2
  204. package/dist/editor/create.d.ts.map +1 -1
  205. package/dist/editor/create.js +16 -60
  206. package/dist/editor/create.js.map +1 -1
  207. package/dist/editor/design-memory.d.ts +11 -0
  208. package/dist/editor/design-memory.d.ts.map +1 -0
  209. package/dist/editor/design-memory.js +40 -0
  210. package/dist/editor/design-memory.js.map +1 -0
  211. package/dist/editor/design-tokens.d.ts +4 -0
  212. package/dist/editor/design-tokens.d.ts.map +1 -1
  213. package/dist/editor/design-tokens.js +30 -1
  214. package/dist/editor/design-tokens.js.map +1 -1
  215. package/dist/editor/document-colors.d.ts +23 -0
  216. package/dist/editor/document-colors.d.ts.map +1 -0
  217. package/dist/editor/document-colors.js +53 -0
  218. package/dist/editor/document-colors.js.map +1 -0
  219. package/dist/editor/eyedropper.d.ts +47 -0
  220. package/dist/editor/eyedropper.d.ts.map +1 -0
  221. package/dist/editor/eyedropper.js +171 -0
  222. package/dist/editor/eyedropper.js.map +1 -0
  223. package/dist/editor/fonts.d.ts +9 -0
  224. package/dist/editor/fonts.d.ts.map +1 -0
  225. package/dist/editor/fonts.js +14 -0
  226. package/dist/editor/fonts.js.map +1 -0
  227. package/dist/editor/history/atomic-tool.d.ts +9 -2
  228. package/dist/editor/history/atomic-tool.d.ts.map +1 -1
  229. package/dist/editor/history/atomic-tool.js +9 -2
  230. package/dist/editor/history/atomic-tool.js.map +1 -1
  231. package/dist/editor/history/capture.d.ts +13 -0
  232. package/dist/editor/history/capture.d.ts.map +1 -0
  233. package/dist/editor/history/capture.js +28 -0
  234. package/dist/editor/history/capture.js.map +1 -0
  235. package/dist/editor/history/document-change.d.ts.map +1 -1
  236. package/dist/editor/history/document-change.js +2 -22
  237. package/dist/editor/history/document-change.js.map +1 -1
  238. package/dist/editor/history/edit.d.ts +7 -0
  239. package/dist/editor/history/edit.d.ts.map +1 -1
  240. package/dist/editor/history/edit.js +4 -2
  241. package/dist/editor/history/edit.js.map +1 -1
  242. package/dist/editor/history/subtree.d.ts +9 -0
  243. package/dist/editor/history/subtree.d.ts.map +1 -1
  244. package/dist/editor/history/subtree.js +12 -2
  245. package/dist/editor/history/subtree.js.map +1 -1
  246. package/dist/editor/index.d.ts +4 -2
  247. package/dist/editor/index.js +4 -2
  248. package/dist/editor/pages.d.ts +7 -5
  249. package/dist/editor/pages.d.ts.map +1 -1
  250. package/dist/editor/pages.js +35 -25
  251. package/dist/editor/pages.js.map +1 -1
  252. package/dist/editor/play/states.d.ts +3 -1
  253. package/dist/editor/play/states.d.ts.map +1 -1
  254. package/dist/editor/play/states.js +1 -1
  255. package/dist/editor/play/states.js.map +1 -1
  256. package/dist/editor/read-only/actions.js +4 -0
  257. package/dist/editor/read-only/actions.js.map +1 -1
  258. package/dist/editor/render-requests.d.ts +18 -0
  259. package/dist/editor/render-requests.d.ts.map +1 -0
  260. package/dist/editor/render-requests.js +76 -0
  261. package/dist/editor/render-requests.js.map +1 -0
  262. package/dist/editor/scale/rescale.d.ts +1 -1
  263. package/dist/editor/selection/overlays.d.ts.map +1 -1
  264. package/dist/editor/selection/overlays.js +1 -1
  265. package/dist/editor/selection/overlays.js.map +1 -1
  266. package/dist/editor/selection/read.d.ts +4 -0
  267. package/dist/editor/selection.d.ts +5 -0
  268. package/dist/editor/selection.d.ts.map +1 -1
  269. package/dist/editor/shapes/pencil.js +1 -1
  270. package/dist/editor/structure/state.d.ts.map +1 -1
  271. package/dist/editor/structure/state.js +2 -2
  272. package/dist/editor/structure/state.js.map +1 -1
  273. package/dist/editor/text.d.ts.map +1 -1
  274. package/dist/editor/text.js +2 -2
  275. package/dist/editor/text.js.map +1 -1
  276. package/dist/editor/tool-registry.d.ts.map +1 -1
  277. package/dist/editor/tool-registry.js +2 -1
  278. package/dist/editor/tool-registry.js.map +1 -1
  279. package/dist/editor/types.d.ts +5 -1
  280. package/dist/editor/types.d.ts.map +1 -1
  281. package/dist/editor/variables.js +3 -3
  282. package/dist/editor/variables.js.map +1 -1
  283. package/dist/editor/variations/create.d.ts +28 -0
  284. package/dist/editor/variations/create.d.ts.map +1 -0
  285. package/dist/editor/variations/create.js +176 -0
  286. package/dist/editor/variations/create.js.map +1 -0
  287. package/dist/editor/variations/pick.d.ts +16 -0
  288. package/dist/editor/variations/pick.d.ts.map +1 -0
  289. package/dist/editor/variations/pick.js +23 -0
  290. package/dist/editor/variations/pick.js.map +1 -0
  291. package/dist/editor/variations.d.ts +28 -0
  292. package/dist/editor/variations.d.ts.map +1 -0
  293. package/dist/editor/variations.js +88 -0
  294. package/dist/editor/variations.js.map +1 -0
  295. package/dist/figma-api/accessors/reactions.d.ts.map +1 -1
  296. package/dist/figma-api/accessors/reactions.js +4 -1
  297. package/dist/figma-api/accessors/reactions.js.map +1 -1
  298. package/dist/figma-api/accessors/text/index.js +3 -0
  299. package/dist/figma-api/accessors/text/index.js.map +1 -1
  300. package/dist/figma-api/accessors/text/opentype.d.ts +17 -0
  301. package/dist/figma-api/accessors/text/opentype.d.ts.map +1 -0
  302. package/dist/figma-api/accessors/text/opentype.js +28 -0
  303. package/dist/figma-api/accessors/text/opentype.js.map +1 -0
  304. package/dist/figma-api/accessors/visual.d.ts.map +1 -1
  305. package/dist/figma-api/accessors/visual.js +33 -0
  306. package/dist/figma-api/accessors/visual.js.map +1 -1
  307. package/dist/figma-api/effects.d.ts +79 -3
  308. package/dist/figma-api/effects.d.ts.map +1 -1
  309. package/dist/figma-api/effects.js +150 -9
  310. package/dist/figma-api/effects.js.map +1 -1
  311. package/dist/figma-api/fresh-read.d.ts +15 -0
  312. package/dist/figma-api/fresh-read.d.ts.map +1 -0
  313. package/dist/figma-api/fresh-read.js +54 -0
  314. package/dist/figma-api/fresh-read.js.map +1 -0
  315. package/dist/figma-api/graph-ref.d.ts +9 -0
  316. package/dist/figma-api/graph-ref.d.ts.map +1 -0
  317. package/dist/figma-api/graph-ref.js +14 -0
  318. package/dist/figma-api/graph-ref.js.map +1 -0
  319. package/dist/figma-api/index.d.ts +11 -1
  320. package/dist/figma-api/index.d.ts.map +1 -1
  321. package/dist/figma-api/index.js +16 -4
  322. package/dist/figma-api/index.js.map +1 -1
  323. package/dist/figma-api/overrides.d.ts +13 -1
  324. package/dist/figma-api/overrides.d.ts.map +1 -1
  325. package/dist/figma-api/overrides.js +196 -4
  326. package/dist/figma-api/overrides.js.map +1 -1
  327. package/dist/figma-api/paints.d.ts +3 -3
  328. package/dist/figma-api/paints.d.ts.map +1 -1
  329. package/dist/figma-api/paints.js +14 -4
  330. package/dist/figma-api/paints.js.map +1 -1
  331. package/dist/figma-api/pending-layout.d.ts +3 -3
  332. package/dist/figma-api/pending-layout.d.ts.map +1 -1
  333. package/dist/figma-api/pending-layout.js +7 -3
  334. package/dist/figma-api/pending-layout.js.map +1 -1
  335. package/dist/figma-api/pending-sync.d.ts +1 -1
  336. package/dist/figma-api/pending-sync.d.ts.map +1 -1
  337. package/dist/figma-api/pending-sync.js +3 -1
  338. package/dist/figma-api/pending-sync.js.map +1 -1
  339. package/dist/figma-api/proxy.d.ts +4 -1
  340. package/dist/figma-api/proxy.d.ts.map +1 -1
  341. package/dist/figma-api/proxy.js +2 -1
  342. package/dist/figma-api/proxy.js.map +1 -1
  343. package/dist/figma-api/reactions.d.ts +59 -15
  344. package/dist/figma-api/reactions.d.ts.map +1 -1
  345. package/dist/figma-api/reactions.js +160 -32
  346. package/dist/figma-api/reactions.js.map +1 -1
  347. package/dist/figma-api/render-bounds.js +1 -1
  348. package/dist/figma-api/surface.d.ts +6 -3
  349. package/dist/figma-api/surface.d.ts.map +1 -1
  350. package/dist/figma-api/surface.js +6 -2
  351. package/dist/figma-api/surface.js.map +1 -1
  352. package/dist/figma-api/transform.d.ts +1 -1
  353. package/dist/figma-api/variables/index.d.ts.map +1 -1
  354. package/dist/figma-api/variables/index.js +2 -2
  355. package/dist/figma-api/variables/index.js.map +1 -1
  356. package/dist/geometry/figma.d.ts +1 -1
  357. package/dist/geometry/image-crop.d.ts +1 -1
  358. package/dist/geometry/image-crop.js +1 -1
  359. package/dist/index.d.ts +4 -2
  360. package/dist/index.js +4 -2
  361. package/dist/io/formats/boolean-path.d.ts +19 -0
  362. package/dist/io/formats/boolean-path.d.ts.map +1 -0
  363. package/dist/io/formats/boolean-path.js +47 -0
  364. package/dist/io/formats/boolean-path.js.map +1 -0
  365. package/dist/io/formats/design-tokens/css/known.js +1 -1
  366. package/dist/io/formats/design-tokens/css/known.js.map +1 -1
  367. package/dist/io/formats/design-tokens/css/read.d.ts +3 -1
  368. package/dist/io/formats/design-tokens/css/read.d.ts.map +1 -1
  369. package/dist/io/formats/design-tokens/css/read.js +11 -5
  370. package/dist/io/formats/design-tokens/css/read.js.map +1 -1
  371. package/dist/io/formats/design-tokens/css/sync.d.ts.map +1 -1
  372. package/dist/io/formats/design-tokens/css/sync.js +17 -4
  373. package/dist/io/formats/design-tokens/css/sync.js.map +1 -1
  374. package/dist/io/formats/design-tokens/css/values.d.ts +6 -5
  375. package/dist/io/formats/design-tokens/css/values.d.ts.map +1 -1
  376. package/dist/io/formats/design-tokens/css/values.js +24 -8
  377. package/dist/io/formats/design-tokens/css/values.js.map +1 -1
  378. package/dist/io/formats/design-tokens/decode.d.ts +7 -6
  379. package/dist/io/formats/design-tokens/decode.d.ts.map +1 -1
  380. package/dist/io/formats/design-tokens/decode.js +14 -13
  381. package/dist/io/formats/design-tokens/decode.js.map +1 -1
  382. package/dist/io/formats/design-tokens/export.js +3 -3
  383. package/dist/io/formats/design-tokens/export.js.map +1 -1
  384. package/dist/io/formats/design-tokens/index.d.ts +4 -1
  385. package/dist/io/formats/design-tokens/index.js +4 -1
  386. package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
  387. package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
  388. package/dist/io/formats/design-tokens/plan/changes.js +1 -1
  389. package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
  390. package/dist/io/formats/design-tokens/plan/index.d.ts.map +1 -1
  391. package/dist/io/formats/design-tokens/plan/index.js +4 -3
  392. package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
  393. package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
  394. package/dist/io/formats/design-tokens/plan/styles.js +9 -9
  395. package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
  396. package/dist/io/formats/design-tokens/project.d.ts +17 -2
  397. package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
  398. package/dist/io/formats/design-tokens/project.js +29 -8
  399. package/dist/io/formats/design-tokens/project.js.map +1 -1
  400. package/dist/io/formats/design-tokens/styles.d.ts +4 -4
  401. package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
  402. package/dist/io/formats/design-tokens/styles.js +7 -7
  403. package/dist/io/formats/design-tokens/styles.js.map +1 -1
  404. package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
  405. package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
  406. package/dist/io/formats/design-tokens/sync/apply.js +73 -0
  407. package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
  408. package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
  409. package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
  410. package/dist/io/formats/design-tokens/sync/drift.js +391 -0
  411. package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
  412. package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
  413. package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
  414. package/dist/io/formats/design-tokens/sync/files.js +35 -0
  415. package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
  416. package/dist/io/formats/design-tokens/values.d.ts +10 -5
  417. package/dist/io/formats/design-tokens/values.d.ts.map +1 -1
  418. package/dist/io/formats/design-tokens/values.js +13 -7
  419. package/dist/io/formats/design-tokens/values.js.map +1 -1
  420. package/dist/io/formats/drawio/edges.d.ts +7 -1
  421. package/dist/io/formats/drawio/edges.d.ts.map +1 -1
  422. package/dist/io/formats/drawio/edges.js +54 -1
  423. package/dist/io/formats/drawio/edges.js.map +1 -1
  424. package/dist/io/formats/drawio/export.d.ts.map +1 -1
  425. package/dist/io/formats/drawio/export.js +19 -2
  426. package/dist/io/formats/drawio/export.js.map +1 -1
  427. package/dist/io/formats/drawio/index.js +1 -0
  428. package/dist/io/formats/drawio/index.js.map +1 -1
  429. package/dist/io/formats/drawio/placement.d.ts +1 -1
  430. package/dist/io/formats/drawio/warnings.js +2 -2
  431. package/dist/io/formats/drawio/warnings.js.map +1 -1
  432. package/dist/io/formats/fig/export/index.d.ts.map +1 -1
  433. package/dist/io/formats/fig/export/index.js +15 -3
  434. package/dist/io/formats/fig/export/index.js.map +1 -1
  435. package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
  436. package/dist/io/formats/fig/export/patch/index.js +7 -1
  437. package/dist/io/formats/fig/export/patch/index.js.map +1 -1
  438. package/dist/io/formats/fig/export/setup.d.ts +7 -2
  439. package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
  440. package/dist/io/formats/fig/export/setup.js +12 -13
  441. package/dist/io/formats/fig/export/setup.js.map +1 -1
  442. package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
  443. package/dist/io/formats/fig/export/variables.js +9 -7
  444. package/dist/io/formats/fig/export/variables.js.map +1 -1
  445. package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
  446. package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
  447. package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
  448. package/dist/io/formats/html/import.d.ts.map +1 -1
  449. package/dist/io/formats/html/import.js +3 -1
  450. package/dist/io/formats/html/import.js.map +1 -1
  451. package/dist/io/formats/html/index.d.ts +2 -2
  452. package/dist/io/formats/html/index.d.ts.map +1 -1
  453. package/dist/io/formats/html/index.js +6 -4
  454. package/dist/io/formats/html/index.js.map +1 -1
  455. package/dist/io/formats/html/vectors.d.ts +2 -1
  456. package/dist/io/formats/html/vectors.d.ts.map +1 -1
  457. package/dist/io/formats/html/vectors.js +4 -2
  458. package/dist/io/formats/html/vectors.js.map +1 -1
  459. package/dist/io/formats/mermaid/layers.js +2 -2
  460. package/dist/io/formats/mermaid/layers.js.map +1 -1
  461. package/dist/io/formats/pdf/document.d.ts +3 -1
  462. package/dist/io/formats/pdf/document.d.ts.map +1 -1
  463. package/dist/io/formats/pdf/document.js +6 -3
  464. package/dist/io/formats/pdf/document.js.map +1 -1
  465. package/dist/io/formats/pdf/export.d.ts.map +1 -1
  466. package/dist/io/formats/pdf/export.js +1 -0
  467. package/dist/io/formats/pdf/export.js.map +1 -1
  468. package/dist/io/formats/pdf/prepare.d.ts +4 -4
  469. package/dist/io/formats/pdf/prepare.d.ts.map +1 -1
  470. package/dist/io/formats/pdf/prepare.js +2 -2
  471. package/dist/io/formats/pdf/prepare.js.map +1 -1
  472. package/dist/io/formats/pen/imports.d.ts +4 -1
  473. package/dist/io/formats/pen/imports.d.ts.map +1 -1
  474. package/dist/io/formats/pen/imports.js.map +1 -1
  475. package/dist/io/formats/pen/index.d.ts.map +1 -1
  476. package/dist/io/formats/pen/index.js +35 -5
  477. package/dist/io/formats/pen/index.js.map +1 -1
  478. package/dist/io/formats/pptx/export.js +1 -1
  479. package/dist/io/formats/pptx/geometry.d.ts +1 -1
  480. package/dist/io/formats/pptx/style.js +1 -1
  481. package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
  482. package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
  483. package/dist/io/formats/raster/adjusted-images.js +118 -0
  484. package/dist/io/formats/raster/adjusted-images.js.map +1 -0
  485. package/dist/io/formats/raster/headless.d.ts +11 -1
  486. package/dist/io/formats/raster/headless.d.ts.map +1 -1
  487. package/dist/io/formats/raster/headless.js +4 -4
  488. package/dist/io/formats/raster/headless.js.map +1 -1
  489. package/dist/io/formats/raster/index.d.ts +2 -2
  490. package/dist/io/formats/raster/pixels.d.ts +7 -1
  491. package/dist/io/formats/raster/pixels.d.ts.map +1 -1
  492. package/dist/io/formats/raster/pixels.js.map +1 -1
  493. package/dist/io/formats/raster/render.d.ts +1 -1
  494. package/dist/io/formats/raster/render.d.ts.map +1 -1
  495. package/dist/io/formats/raster/render.js +13 -4
  496. package/dist/io/formats/raster/render.js.map +1 -1
  497. package/dist/io/formats/svg/defs.d.ts +10 -8
  498. package/dist/io/formats/svg/defs.d.ts.map +1 -1
  499. package/dist/io/formats/svg/defs.js +13 -64
  500. package/dist/io/formats/svg/defs.js.map +1 -1
  501. package/dist/io/formats/svg/effects.d.ts +16 -0
  502. package/dist/io/formats/svg/effects.d.ts.map +1 -0
  503. package/dist/io/formats/svg/effects.js +126 -0
  504. package/dist/io/formats/svg/effects.js.map +1 -0
  505. package/dist/io/formats/svg/export.d.ts +11 -2
  506. package/dist/io/formats/svg/export.d.ts.map +1 -1
  507. package/dist/io/formats/svg/export.js +177 -37
  508. package/dist/io/formats/svg/export.js.map +1 -1
  509. package/dist/io/formats/svg/filter.d.ts +30 -0
  510. package/dist/io/formats/svg/filter.d.ts.map +1 -0
  511. package/dist/io/formats/svg/filter.js +48 -0
  512. package/dist/io/formats/svg/filter.js.map +1 -0
  513. package/dist/io/formats/svg/grain.d.ts +26 -0
  514. package/dist/io/formats/svg/grain.d.ts.map +1 -0
  515. package/dist/io/formats/svg/grain.js +298 -0
  516. package/dist/io/formats/svg/grain.js.map +1 -0
  517. package/dist/io/formats/svg/import.d.ts +4 -2
  518. package/dist/io/formats/svg/import.d.ts.map +1 -1
  519. package/dist/io/formats/svg/import.js +2 -1
  520. package/dist/io/formats/svg/import.js.map +1 -1
  521. package/dist/io/formats/svg/strokes.d.ts +1 -1
  522. package/dist/io/formats/svg/strokes.d.ts.map +1 -1
  523. package/dist/io/formats/svg/strokes.js +1 -2
  524. package/dist/io/formats/svg/strokes.js.map +1 -1
  525. package/dist/io/formats/svg/text/export.d.ts.map +1 -1
  526. package/dist/io/formats/svg/text/export.js +8 -8
  527. package/dist/io/formats/svg/text/export.js.map +1 -1
  528. package/dist/io/formats/svg/text/import.js +1 -1
  529. package/dist/io/formats/svg/text/layout.d.ts +5 -2
  530. package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
  531. package/dist/io/formats/svg/text/layout.js +8 -5
  532. package/dist/io/formats/svg/text/layout.js.map +1 -1
  533. package/dist/io/formats/video/composite.d.ts +18 -0
  534. package/dist/io/formats/video/composite.d.ts.map +1 -0
  535. package/dist/io/formats/video/composite.js +79 -0
  536. package/dist/io/formats/video/composite.js.map +1 -0
  537. package/dist/io/formats/video/formats.d.ts +29 -0
  538. package/dist/io/formats/video/formats.d.ts.map +1 -0
  539. package/dist/io/formats/video/formats.js +43 -0
  540. package/dist/io/formats/video/formats.js.map +1 -0
  541. package/dist/io/formats/video/gif.d.ts +13 -0
  542. package/dist/io/formats/video/gif.d.ts.map +1 -0
  543. package/dist/io/formats/video/gif.js +56 -0
  544. package/dist/io/formats/video/gif.js.map +1 -0
  545. package/dist/io/formats/video/index.d.ts +9 -0
  546. package/dist/io/formats/video/index.js +9 -0
  547. package/dist/io/formats/video/plan.d.ts +64 -0
  548. package/dist/io/formats/video/plan.d.ts.map +1 -0
  549. package/dist/io/formats/video/plan.js +90 -0
  550. package/dist/io/formats/video/plan.js.map +1 -0
  551. package/dist/io/formats/video/record.d.ts +36 -0
  552. package/dist/io/formats/video/record.d.ts.map +1 -0
  553. package/dist/io/formats/video/record.js +154 -0
  554. package/dist/io/formats/video/record.js.map +1 -0
  555. package/dist/io/formats/video/sink.d.ts +29 -0
  556. package/dist/io/formats/video/sink.d.ts.map +1 -0
  557. package/dist/io/formats/video/sink.js +16 -0
  558. package/dist/io/formats/video/sink.js.map +1 -0
  559. package/dist/io/formats/video/size.d.ts +19 -0
  560. package/dist/io/formats/video/size.d.ts.map +1 -0
  561. package/dist/io/formats/video/size.js +26 -0
  562. package/dist/io/formats/video/size.js.map +1 -0
  563. package/dist/io/formats/video/webcodecs.d.ts +18 -0
  564. package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
  565. package/dist/io/formats/video/webcodecs.js +74 -0
  566. package/dist/io/formats/video/webcodecs.js.map +1 -0
  567. package/dist/io/formats.d.ts.map +1 -1
  568. package/dist/io/formats.js +41 -11
  569. package/dist/io/formats.js.map +1 -1
  570. package/dist/io/subgraph.d.ts.map +1 -1
  571. package/dist/io/subgraph.js +1 -1
  572. package/dist/io/subgraph.js.map +1 -1
  573. package/dist/io/types.d.ts +20 -5
  574. package/dist/io/types.d.ts.map +1 -1
  575. package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
  576. package/dist/kiwi/fig/session/options.d.ts +3 -0
  577. package/dist/kiwi/fig/session/options.d.ts.map +1 -1
  578. package/dist/kiwi/fig/session/options.js +4 -0
  579. package/dist/kiwi/fig/session/options.js.map +1 -1
  580. package/dist/layout/auto-layout-handles.d.ts +66 -0
  581. package/dist/layout/auto-layout-handles.d.ts.map +1 -0
  582. package/dist/layout/auto-layout-handles.js +291 -0
  583. package/dist/layout/auto-layout-handles.js.map +1 -0
  584. package/dist/layout/yoga-helpers.d.ts +2 -1
  585. package/dist/layout/yoga-helpers.d.ts.map +1 -1
  586. package/dist/layout/yoga-helpers.js +7 -1
  587. package/dist/layout/yoga-helpers.js.map +1 -1
  588. package/dist/layout.d.ts +3 -2
  589. package/dist/layout.d.ts.map +1 -1
  590. package/dist/layout.js +26 -2
  591. package/dist/layout.js.map +1 -1
  592. package/dist/lint/fixes.d.ts.map +1 -1
  593. package/dist/lint/fixes.js +10 -4
  594. package/dist/lint/fixes.js.map +1 -1
  595. package/dist/lint/index.d.ts +3 -2
  596. package/dist/lint/index.js +2 -1
  597. package/dist/lint/linter.d.ts +12 -0
  598. package/dist/lint/linter.d.ts.map +1 -1
  599. package/dist/lint/linter.js +112 -10
  600. package/dist/lint/linter.js.map +1 -1
  601. package/dist/lint/presets.d.ts.map +1 -1
  602. package/dist/lint/presets.js +2 -0
  603. package/dist/lint/presets.js.map +1 -1
  604. package/dist/lint/rules/design-memory.d.ts +15 -0
  605. package/dist/lint/rules/design-memory.d.ts.map +1 -0
  606. package/dist/lint/rules/design-memory.js +90 -0
  607. package/dist/lint/rules/design-memory.js.map +1 -0
  608. package/dist/lint/rules/index.d.ts +6 -5
  609. package/dist/lint/rules/index.d.ts.map +1 -1
  610. package/dist/lint/rules/index.js +6 -2
  611. package/dist/lint/rules/index.js.map +1 -1
  612. package/dist/lint/rules/no-unbound-token-values.d.ts +6 -0
  613. package/dist/lint/rules/no-unbound-token-values.d.ts.map +1 -0
  614. package/dist/lint/rules/no-unbound-token-values.js +79 -0
  615. package/dist/lint/rules/no-unbound-token-values.js.map +1 -0
  616. package/dist/lint/types.d.ts +25 -2
  617. package/dist/lint/types.d.ts.map +1 -1
  618. package/dist/node/video.d.ts +12 -0
  619. package/dist/node/video.d.ts.map +1 -0
  620. package/dist/node/video.js +206 -0
  621. package/dist/node/video.js.map +1 -0
  622. package/dist/pairdraw-api/comments.d.ts +4 -1
  623. package/dist/pairdraw-api/comments.d.ts.map +1 -1
  624. package/dist/pairdraw-api/comments.js +5 -0
  625. package/dist/pairdraw-api/comments.js.map +1 -1
  626. package/dist/pairdraw-api/design-memory.d.ts +19 -0
  627. package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
  628. package/dist/pairdraw-api/design-memory.js +39 -0
  629. package/dist/pairdraw-api/design-memory.js.map +1 -0
  630. package/dist/pairdraw-api/index.d.ts +48 -4
  631. package/dist/pairdraw-api/index.d.ts.map +1 -1
  632. package/dist/pairdraw-api/index.js +59 -6
  633. package/dist/pairdraw-api/index.js.map +1 -1
  634. package/dist/pairdraw-api/nodes.d.ts +13 -2
  635. package/dist/pairdraw-api/nodes.d.ts.map +1 -1
  636. package/dist/pairdraw-api/nodes.js +28 -1
  637. package/dist/pairdraw-api/nodes.js.map +1 -1
  638. package/dist/pairdraw-api/variations.d.ts +48 -0
  639. package/dist/pairdraw-api/variations.d.ts.map +1 -0
  640. package/dist/pairdraw-api/variations.js +76 -0
  641. package/dist/pairdraw-api/variations.js.map +1 -0
  642. package/dist/prototype/easing.d.ts +13 -0
  643. package/dist/prototype/easing.d.ts.map +1 -0
  644. package/dist/prototype/easing.js +36 -0
  645. package/dist/prototype/easing.js.map +1 -0
  646. package/dist/prototype/frames.d.ts +10 -0
  647. package/dist/prototype/frames.d.ts.map +1 -0
  648. package/dist/prototype/frames.js +12 -0
  649. package/dist/prototype/frames.js.map +1 -0
  650. package/dist/prototype/hit.d.ts +17 -0
  651. package/dist/prototype/hit.d.ts.map +1 -0
  652. package/dist/prototype/hit.js +45 -0
  653. package/dist/prototype/hit.js.map +1 -0
  654. package/dist/prototype/index.d.ts +14 -0
  655. package/dist/prototype/index.js +14 -0
  656. package/dist/prototype/pointer.d.ts +63 -0
  657. package/dist/prototype/pointer.d.ts.map +1 -0
  658. package/dist/prototype/pointer.js +104 -0
  659. package/dist/prototype/pointer.js.map +1 -0
  660. package/dist/prototype/reactions.d.ts +45 -0
  661. package/dist/prototype/reactions.d.ts.map +1 -0
  662. package/dist/prototype/reactions.js +122 -0
  663. package/dist/prototype/reactions.js.map +1 -0
  664. package/dist/prototype/scene.d.ts +35 -0
  665. package/dist/prototype/scene.d.ts.map +1 -0
  666. package/dist/prototype/scene.js +86 -0
  667. package/dist/prototype/scene.js.map +1 -0
  668. package/dist/prototype/scenes.d.ts +81 -0
  669. package/dist/prototype/scenes.d.ts.map +1 -0
  670. package/dist/prototype/scenes.js +175 -0
  671. package/dist/prototype/scenes.js.map +1 -0
  672. package/dist/prototype/scroll.d.ts +48 -0
  673. package/dist/prototype/scroll.d.ts.map +1 -0
  674. package/dist/prototype/scroll.js +159 -0
  675. package/dist/prototype/scroll.js.map +1 -0
  676. package/dist/prototype/session.d.ts +71 -0
  677. package/dist/prototype/session.d.ts.map +1 -0
  678. package/dist/prototype/session.js +135 -0
  679. package/dist/prototype/session.js.map +1 -0
  680. package/dist/prototype/smart-animate/animation.d.ts +34 -0
  681. package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
  682. package/dist/prototype/smart-animate/animation.js +212 -0
  683. package/dist/prototype/smart-animate/animation.js.map +1 -0
  684. package/dist/prototype/smart-animate/match.d.ts +24 -0
  685. package/dist/prototype/smart-animate/match.d.ts.map +1 -0
  686. package/dist/prototype/smart-animate/match.js +72 -0
  687. package/dist/prototype/smart-animate/match.js.map +1 -0
  688. package/dist/prototype/snapshot.d.ts +19 -0
  689. package/dist/prototype/snapshot.d.ts.map +1 -0
  690. package/dist/prototype/snapshot.js +56 -0
  691. package/dist/prototype/snapshot.js.map +1 -0
  692. package/dist/prototype/timeline.d.ts +132 -0
  693. package/dist/prototype/timeline.d.ts.map +1 -0
  694. package/dist/prototype/timeline.js +260 -0
  695. package/dist/prototype/timeline.js.map +1 -0
  696. package/dist/rpc/analyze-commands.js +1 -1
  697. package/dist/rpc/read-commands.d.ts +2 -2
  698. package/dist/rpc/read-commands.js +2 -2
  699. package/dist/rpc/read-commands.js.map +1 -1
  700. package/dist/rpc/variables-command.js +2 -2
  701. package/dist/rpc/variables-command.js.map +1 -1
  702. package/dist/text/font/features.d.ts +9 -0
  703. package/dist/text/font/features.d.ts.map +1 -0
  704. package/dist/text/font/features.js +27 -0
  705. package/dist/text/font/features.js.map +1 -0
  706. package/dist/text/font/manager.d.ts +12 -0
  707. package/dist/text/font/manager.d.ts.map +1 -1
  708. package/dist/text/font/manager.js +60 -1
  709. package/dist/text/font/manager.js.map +1 -1
  710. package/dist/text/font/provider.d.ts +15 -0
  711. package/dist/text/font/provider.d.ts.map +1 -0
  712. package/dist/text/font/provider.js +18 -0
  713. package/dist/text/font/provider.js.map +1 -0
  714. package/dist/text/font/readiness.d.ts +32 -0
  715. package/dist/text/font/readiness.d.ts.map +1 -0
  716. package/dist/text/font/{status.js → readiness.js} +8 -4
  717. package/dist/text/font/readiness.js.map +1 -0
  718. package/dist/text/index.d.ts +12 -9
  719. package/dist/text/index.js +6 -3
  720. package/dist/text/prepare.d.ts +9 -4
  721. package/dist/text/prepare.d.ts.map +1 -1
  722. package/dist/text/prepare.js +9 -4
  723. package/dist/text/prepare.js.map +1 -1
  724. package/dist/text/replace-fonts.d.ts +41 -0
  725. package/dist/text/replace-fonts.d.ts.map +1 -0
  726. package/dist/text/replace-fonts.js +121 -0
  727. package/dist/text/replace-fonts.js.map +1 -0
  728. package/dist/tools/analyze/colors.js +1 -1
  729. package/dist/tools/analyze/responsive/index.d.ts +15 -0
  730. package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
  731. package/dist/tools/analyze/responsive/index.js +192 -0
  732. package/dist/tools/analyze/responsive/index.js.map +1 -0
  733. package/dist/tools/analyze/responsive/widths.d.ts +27 -0
  734. package/dist/tools/analyze/responsive/widths.d.ts.map +1 -0
  735. package/dist/tools/analyze/responsive/widths.js +49 -0
  736. package/dist/tools/analyze/responsive/widths.js.map +1 -0
  737. package/dist/tools/analyze.d.ts +3 -1
  738. package/dist/tools/analyze.js +3 -1
  739. package/dist/tools/codegen/token-sync.d.ts +7 -0
  740. package/dist/tools/codegen/token-sync.d.ts.map +1 -0
  741. package/dist/tools/codegen/token-sync.js +85 -0
  742. package/dist/tools/codegen/token-sync.js.map +1 -0
  743. package/dist/tools/codegen/tokens.d.ts +1 -1
  744. package/dist/tools/codegen/tokens.d.ts.map +1 -1
  745. package/dist/tools/codegen/tokens.js +2 -2
  746. package/dist/tools/codegen/tokens.js.map +1 -1
  747. package/dist/tools/codegen.d.ts +2 -1
  748. package/dist/tools/codegen.js +2 -1
  749. package/dist/tools/comments.d.ts.map +1 -1
  750. package/dist/tools/comments.js +2 -2
  751. package/dist/tools/comments.js.map +1 -1
  752. package/dist/tools/component-catalog.d.ts.map +1 -1
  753. package/dist/tools/component-catalog.js +5 -3
  754. package/dist/tools/component-catalog.js.map +1 -1
  755. package/dist/tools/create/components.d.ts.map +1 -1
  756. package/dist/tools/create/components.js +4 -0
  757. package/dist/tools/create/components.js.map +1 -1
  758. package/dist/tools/create/html.d.ts.map +1 -1
  759. package/dist/tools/create/html.js +2 -3
  760. package/dist/tools/create/html.js.map +1 -1
  761. package/dist/tools/create/icons.d.ts.map +1 -1
  762. package/dist/tools/create/icons.js +2 -1
  763. package/dist/tools/create/icons.js.map +1 -1
  764. package/dist/tools/create/mermaid.js +1 -0
  765. package/dist/tools/create/mermaid.js.map +1 -1
  766. package/dist/tools/create/svg.js +5 -1
  767. package/dist/tools/create/svg.js.map +1 -1
  768. package/dist/tools/create/vector.js +2 -2
  769. package/dist/tools/create/vector.js.map +1 -1
  770. package/dist/tools/css/shorthand.d.ts +20 -0
  771. package/dist/tools/css/shorthand.d.ts.map +1 -0
  772. package/dist/tools/css/shorthand.js +54 -0
  773. package/dist/tools/css/shorthand.js.map +1 -0
  774. package/dist/tools/describe/index.js +2 -2
  775. package/dist/tools/describe/index.js.map +1 -1
  776. package/dist/tools/describe/issues.js +1 -1
  777. package/dist/tools/design-memory.d.ts +8 -0
  778. package/dist/tools/design-memory.d.ts.map +1 -0
  779. package/dist/tools/design-memory.js +68 -0
  780. package/dist/tools/design-memory.js.map +1 -0
  781. package/dist/tools/html-host.d.ts.map +1 -1
  782. package/dist/tools/html-host.js +5 -3
  783. package/dist/tools/html-host.js.map +1 -1
  784. package/dist/tools/image-ai/apply.d.ts.map +1 -1
  785. package/dist/tools/image-ai/apply.js +1 -3
  786. package/dist/tools/image-ai/apply.js.map +1 -1
  787. package/dist/tools/image-ai/generate.d.ts.map +1 -1
  788. package/dist/tools/image-ai/generate.js +2 -0
  789. package/dist/tools/image-ai/generate.js.map +1 -1
  790. package/dist/tools/image-ai/service.d.ts.map +1 -1
  791. package/dist/tools/image-ai/service.js +5 -3
  792. package/dist/tools/image-ai/service.js.map +1 -1
  793. package/dist/tools/index.d.ts +3 -1
  794. package/dist/tools/index.js +3 -1
  795. package/dist/tools/modify/effects.js +1 -1
  796. package/dist/tools/modify/effects.js.map +1 -1
  797. package/dist/tools/modify/fonts.d.ts +6 -0
  798. package/dist/tools/modify/fonts.d.ts.map +1 -0
  799. package/dist/tools/modify/fonts.js +27 -0
  800. package/dist/tools/modify/fonts.js.map +1 -0
  801. package/dist/tools/modify/geometry.d.ts.map +1 -1
  802. package/dist/tools/modify/geometry.js +14 -3
  803. package/dist/tools/modify/geometry.js.map +1 -1
  804. package/dist/tools/modify/layout.d.ts.map +1 -1
  805. package/dist/tools/modify/layout.js +35 -8
  806. package/dist/tools/modify/layout.js.map +1 -1
  807. package/dist/tools/modify/matching.d.ts.map +1 -1
  808. package/dist/tools/modify/matching.js +10 -10
  809. package/dist/tools/modify/matching.js.map +1 -1
  810. package/dist/tools/modify/paint.d.ts.map +1 -1
  811. package/dist/tools/modify/paint.js +56 -4
  812. package/dist/tools/modify/paint.js.map +1 -1
  813. package/dist/tools/modify/reactions.d.ts.map +1 -1
  814. package/dist/tools/modify/reactions.js +2 -2
  815. package/dist/tools/modify/reactions.js.map +1 -1
  816. package/dist/tools/modify/text.d.ts.map +1 -1
  817. package/dist/tools/modify/text.js +29 -8
  818. package/dist/tools/modify/text.js.map +1 -1
  819. package/dist/tools/modify/update.d.ts +10 -1
  820. package/dist/tools/modify/update.d.ts.map +1 -1
  821. package/dist/tools/modify/update.js +34 -3
  822. package/dist/tools/modify/update.js.map +1 -1
  823. package/dist/tools/modify.d.ts +2 -1
  824. package/dist/tools/modify.js +2 -1
  825. package/dist/tools/prompts/codegen.js +1 -1
  826. package/dist/tools/prompts/codegen.js.map +1 -1
  827. package/dist/tools/read/css.d.ts +14 -0
  828. package/dist/tools/read/css.d.ts.map +1 -0
  829. package/dist/tools/read/css.js +306 -0
  830. package/dist/tools/read/css.js.map +1 -0
  831. package/dist/tools/read/fonts.d.ts.map +1 -1
  832. package/dist/tools/read/fonts.js +17 -2
  833. package/dist/tools/read/fonts.js.map +1 -1
  834. package/dist/tools/read/libraries.js +1 -0
  835. package/dist/tools/read/libraries.js.map +1 -1
  836. package/dist/tools/read/reactions.js +1 -1
  837. package/dist/tools/read/reactions.js.map +1 -1
  838. package/dist/tools/read/space.d.ts +3 -1
  839. package/dist/tools/read/space.d.ts.map +1 -1
  840. package/dist/tools/read/space.js +4 -5
  841. package/dist/tools/read/space.js.map +1 -1
  842. package/dist/tools/read.d.ts +2 -1
  843. package/dist/tools/read.js +2 -1
  844. package/dist/tools/registry/core.d.ts +1 -1
  845. package/dist/tools/registry/core.d.ts.map +1 -1
  846. package/dist/tools/registry/core.js +5 -1
  847. package/dist/tools/registry/core.js.map +1 -1
  848. package/dist/tools/registry/extended.d.ts.map +1 -1
  849. package/dist/tools/registry/extended.js +16 -1
  850. package/dist/tools/registry/extended.js.map +1 -1
  851. package/dist/tools/schema.d.ts +24 -6
  852. package/dist/tools/schema.d.ts.map +1 -1
  853. package/dist/tools/schema.js +10 -6
  854. package/dist/tools/schema.js.map +1 -1
  855. package/dist/tools/script/host.d.ts.map +1 -1
  856. package/dist/tools/script/host.js +5 -3
  857. package/dist/tools/script/host.js.map +1 -1
  858. package/dist/tools/stock-photo.js +1 -0
  859. package/dist/tools/stock-photo.js.map +1 -1
  860. package/dist/tools/structure/basic.d.ts.map +1 -1
  861. package/dist/tools/structure/basic.js +1 -0
  862. package/dist/tools/structure/basic.js.map +1 -1
  863. package/dist/tools/structure/batch.d.ts.map +1 -1
  864. package/dist/tools/structure/batch.js +8 -1
  865. package/dist/tools/structure/batch.js.map +1 -1
  866. package/dist/tools/structure/hierarchy.d.ts.map +1 -1
  867. package/dist/tools/structure/hierarchy.js +4 -0
  868. package/dist/tools/structure/hierarchy.js.map +1 -1
  869. package/dist/tools/structure/variations.d.ts +8 -0
  870. package/dist/tools/structure/variations.d.ts.map +1 -0
  871. package/dist/tools/structure/variations.js +106 -0
  872. package/dist/tools/structure/variations.js.map +1 -0
  873. package/dist/tools/structure.d.ts +2 -1
  874. package/dist/tools/structure.js +2 -1
  875. package/dist/tools/styles/types.d.ts +2 -4
  876. package/dist/tools/styles/types.d.ts.map +1 -1
  877. package/dist/tools/styles/types.js.map +1 -1
  878. package/dist/tools/variables/collections.js +1 -1
  879. package/dist/tools/variables/collections.js.map +1 -1
  880. package/dist/tools/variables/values.d.ts.map +1 -1
  881. package/dist/tools/variables/values.js +4 -4
  882. package/dist/tools/variables/values.js.map +1 -1
  883. package/dist/tools/vector/boolean.d.ts.map +1 -1
  884. package/dist/tools/vector/boolean.js +4 -0
  885. package/dist/tools/vector/boolean.js.map +1 -1
  886. package/dist/tools/vector/vectorize.d.ts.map +1 -1
  887. package/dist/tools/vector/vectorize.js +7 -4
  888. package/dist/tools/vector/vectorize.js.map +1 -1
  889. package/dist/tools/vector/video.d.ts +6 -0
  890. package/dist/tools/vector/video.d.ts.map +1 -0
  891. package/dist/tools/vector/video.js +133 -0
  892. package/dist/tools/vector/video.js.map +1 -0
  893. package/dist/tools/vector.d.ts +2 -1
  894. package/dist/tools/vector.js +2 -1
  895. package/dist/tools/video-host.d.ts +12 -0
  896. package/dist/tools/video-host.d.ts.map +1 -0
  897. package/dist/tools/video-host.js +21 -0
  898. package/dist/tools/video-host.js.map +1 -0
  899. package/dist/vector/point-transform.d.ts +1 -1
  900. package/dist/vector/vectorize/svg/gradients.d.ts +2 -2
  901. package/dist/vector/vectorize/svg/gradients.d.ts.map +1 -1
  902. package/dist/vector/vectorize/svg/gradients.js +5 -5
  903. package/dist/vector/vectorize/svg/gradients.js.map +1 -1
  904. package/dist/vector/vectorize/svg/to-vectors.d.ts +3 -1
  905. package/dist/vector/vectorize/svg/to-vectors.d.ts.map +1 -1
  906. package/dist/vector/vectorize/svg/to-vectors.js +13 -12
  907. package/dist/vector/vectorize/svg/to-vectors.js.map +1 -1
  908. package/package.json +31 -9
  909. package/src/ai/providers.ts +2 -0
  910. package/src/cache/resource.ts +24 -1
  911. package/src/canvas/effects.ts +47 -50
  912. package/src/canvas/fills.ts +19 -15
  913. package/src/canvas/images/adjustments.ts +203 -0
  914. package/src/canvas/images/sampling.ts +88 -0
  915. package/src/canvas/index.ts +1 -0
  916. package/src/canvas/masks.ts +1 -1
  917. package/src/canvas/noise/render.ts +75 -0
  918. package/src/canvas/noise/shader.ts +169 -0
  919. package/src/canvas/noise/table.ts +91 -0
  920. package/src/canvas/noise/tile.ts +95 -0
  921. package/src/canvas/overlays/auto-layout-hover.ts +47 -65
  922. package/src/canvas/renderer/colors.ts +76 -50
  923. package/src/canvas/renderer/document-surface.ts +53 -0
  924. package/src/canvas/renderer/fonts.ts +6 -4
  925. package/src/canvas/renderer/lifecycle.ts +10 -4
  926. package/src/canvas/renderer/methods.ts +1 -0
  927. package/src/canvas/renderer/pipeline.ts +40 -4
  928. package/src/canvas/renderer/play-scenes.ts +51 -0
  929. package/src/canvas/renderer/retained-backing.ts +2 -1
  930. package/src/canvas/renderer/tiles/cache.ts +54 -1
  931. package/src/canvas/renderer/tiles/controller.ts +30 -1
  932. package/src/canvas/renderer/tiles/surface-pool.ts +9 -7
  933. package/src/canvas/renderer/types.ts +18 -2
  934. package/src/canvas/renderer.ts +76 -14
  935. package/src/canvas/scene.ts +69 -12
  936. package/src/canvas/shaders/effect.ts +2 -1
  937. package/src/canvas/shadows/shape.ts +4 -2
  938. package/src/canvas/shadows.ts +5 -2
  939. package/src/canvas/text/decorations.ts +15 -5
  940. package/src/canvas/text/index.ts +9 -1
  941. package/src/canvas/text/paragraph/index.ts +16 -6
  942. package/src/canvas/text/renderer.ts +2 -1
  943. package/src/canvas/text/shape.ts +4 -4
  944. package/src/canvas/texture.ts +137 -0
  945. package/src/clipboard.ts +23 -10
  946. package/src/constants.ts +6 -0
  947. package/src/design-memory/check.ts +376 -0
  948. package/src/design-memory/describe.ts +77 -0
  949. package/src/design-memory/distil.ts +69 -0
  950. package/src/design-memory/document.ts +80 -0
  951. package/src/design-memory/guard.ts +157 -0
  952. package/src/design-memory/index.ts +8 -0
  953. package/src/design-memory/refusal.ts +90 -0
  954. package/src/design-memory/rules.ts +274 -0
  955. package/src/design-memory/values.ts +179 -0
  956. package/src/editor/bridges/components.ts +2 -0
  957. package/src/editor/clipboard/assets.ts +6 -2
  958. package/src/editor/clipboard/component-matches.ts +65 -0
  959. package/src/editor/clipboard/dependencies.ts +22 -1
  960. package/src/editor/clipboard/export.ts +24 -7
  961. package/src/editor/clipboard.ts +74 -20
  962. package/src/editor/components/instances.ts +31 -0
  963. package/src/editor/components/properties.ts +3 -2
  964. package/src/editor/create.ts +25 -69
  965. package/src/editor/design-memory.ts +39 -0
  966. package/src/editor/design-tokens.ts +41 -2
  967. package/src/editor/document-colors.ts +65 -0
  968. package/src/editor/eyedropper.ts +208 -0
  969. package/src/editor/fonts.ts +19 -0
  970. package/src/editor/history/atomic-tool.ts +32 -3
  971. package/src/editor/history/capture.ts +19 -0
  972. package/src/editor/history/document-change.ts +5 -17
  973. package/src/editor/history/edit.ts +11 -1
  974. package/src/editor/history/subtree.ts +13 -2
  975. package/src/editor/index.ts +11 -0
  976. package/src/editor/pages.ts +40 -29
  977. package/src/editor/play/states.ts +1 -1
  978. package/src/editor/read-only/actions.ts +4 -0
  979. package/src/editor/render-requests.ts +83 -0
  980. package/src/editor/selection/overlays.ts +1 -0
  981. package/src/editor/structure/state.ts +2 -1
  982. package/src/editor/text.ts +2 -1
  983. package/src/editor/tool-registry.ts +2 -1
  984. package/src/editor/types.ts +4 -0
  985. package/src/editor/variables.ts +3 -3
  986. package/src/editor/variations/create.ts +235 -0
  987. package/src/editor/variations/pick.ts +35 -0
  988. package/src/editor/variations.ts +110 -0
  989. package/src/figma-api/accessors/reactions.ts +11 -1
  990. package/src/figma-api/accessors/text/index.ts +7 -0
  991. package/src/figma-api/accessors/text/opentype.ts +33 -0
  992. package/src/figma-api/accessors/visual.ts +55 -2
  993. package/src/figma-api/compatibility.ts +5 -2
  994. package/src/figma-api/effects.ts +143 -5
  995. package/src/figma-api/fresh-read.ts +57 -0
  996. package/src/figma-api/graph-ref.ts +13 -0
  997. package/src/figma-api/index.ts +22 -4
  998. package/src/figma-api/overrides.ts +295 -3
  999. package/src/figma-api/paints.ts +24 -9
  1000. package/src/figma-api/pending-layout.ts +7 -3
  1001. package/src/figma-api/pending-sync.ts +4 -1
  1002. package/src/figma-api/proxy.ts +8 -2
  1003. package/src/figma-api/reactions.ts +212 -33
  1004. package/src/figma-api/surface.ts +6 -2
  1005. package/src/figma-api/variables/index.ts +5 -4
  1006. package/src/global.d.ts +26 -0
  1007. package/src/io/formats/boolean-path.ts +60 -0
  1008. package/src/io/formats/design-tokens/css/known.ts +1 -1
  1009. package/src/io/formats/design-tokens/css/read.ts +20 -7
  1010. package/src/io/formats/design-tokens/css/sync.ts +9 -4
  1011. package/src/io/formats/design-tokens/css/values.ts +37 -9
  1012. package/src/io/formats/design-tokens/decode.ts +17 -12
  1013. package/src/io/formats/design-tokens/export.ts +3 -3
  1014. package/src/io/formats/design-tokens/index.ts +21 -0
  1015. package/src/io/formats/design-tokens/plan/changes.ts +4 -1
  1016. package/src/io/formats/design-tokens/plan/index.ts +6 -5
  1017. package/src/io/formats/design-tokens/plan/styles.ts +37 -10
  1018. package/src/io/formats/design-tokens/project.ts +40 -9
  1019. package/src/io/formats/design-tokens/styles.ts +20 -9
  1020. package/src/io/formats/design-tokens/sync/apply.ts +130 -0
  1021. package/src/io/formats/design-tokens/sync/drift.ts +589 -0
  1022. package/src/io/formats/design-tokens/sync/files.ts +40 -0
  1023. package/src/io/formats/design-tokens/values.ts +15 -8
  1024. package/src/io/formats/drawio/edges.ts +65 -0
  1025. package/src/io/formats/drawio/export.ts +37 -14
  1026. package/src/io/formats/drawio/index.ts +2 -0
  1027. package/src/io/formats/drawio/warnings.ts +2 -2
  1028. package/src/io/formats/fig/export/index.ts +36 -3
  1029. package/src/io/formats/fig/export/patch/index.ts +12 -1
  1030. package/src/io/formats/fig/export/setup.ts +25 -15
  1031. package/src/io/formats/fig/export/variables.ts +17 -6
  1032. package/src/io/formats/fig/thumbnail-page.ts +4 -4
  1033. package/src/io/formats/html/import.ts +9 -1
  1034. package/src/io/formats/html/index.ts +14 -7
  1035. package/src/io/formats/html/vectors.ts +9 -2
  1036. package/src/io/formats/mermaid/layers.ts +2 -2
  1037. package/src/io/formats/pdf/document.ts +14 -4
  1038. package/src/io/formats/pdf/export.ts +1 -0
  1039. package/src/io/formats/pdf/prepare.ts +6 -6
  1040. package/src/io/formats/pen/imports.ts +5 -6
  1041. package/src/io/formats/pen/index.ts +41 -7
  1042. package/src/io/formats/raster/adjusted-images.ts +125 -0
  1043. package/src/io/formats/raster/headless.ts +3 -3
  1044. package/src/io/formats/raster/index.ts +6 -1
  1045. package/src/io/formats/raster/pixels.ts +7 -0
  1046. package/src/io/formats/raster/render.ts +24 -5
  1047. package/src/io/formats/svg/defs.ts +24 -80
  1048. package/src/io/formats/svg/effects.ts +131 -0
  1049. package/src/io/formats/svg/export.ts +295 -49
  1050. package/src/io/formats/svg/filter.ts +57 -0
  1051. package/src/io/formats/svg/grain.ts +249 -0
  1052. package/src/io/formats/svg/import.ts +6 -3
  1053. package/src/io/formats/svg/strokes.ts +2 -2
  1054. package/src/io/formats/svg/text/export.ts +10 -8
  1055. package/src/io/formats/svg/text/layout.ts +15 -5
  1056. package/src/io/formats/video/composite.ts +79 -0
  1057. package/src/io/formats/video/formats.ts +77 -0
  1058. package/src/io/formats/video/gif.ts +65 -0
  1059. package/src/io/formats/video/index.ts +30 -0
  1060. package/src/io/formats/video/plan.ts +116 -0
  1061. package/src/io/formats/video/record.ts +227 -0
  1062. package/src/io/formats/video/sink.ts +32 -0
  1063. package/src/io/formats/video/size.ts +25 -0
  1064. package/src/io/formats/video/webcodecs.ts +89 -0
  1065. package/src/io/formats.ts +66 -11
  1066. package/src/io/subgraph.ts +4 -1
  1067. package/src/io/types.ts +29 -10
  1068. package/src/kiwi/fig/session/options.ts +4 -1
  1069. package/src/layout/auto-layout-handles.ts +396 -0
  1070. package/src/layout/yoga-helpers.ts +8 -0
  1071. package/src/layout.ts +49 -1
  1072. package/src/lint/fixes.ts +12 -3
  1073. package/src/lint/index.ts +3 -1
  1074. package/src/lint/linter.ts +108 -11
  1075. package/src/lint/presets.ts +2 -0
  1076. package/src/lint/rules/design-memory.ts +97 -0
  1077. package/src/lint/rules/index.ts +6 -1
  1078. package/src/lint/rules/no-unbound-token-values.ts +73 -0
  1079. package/src/lint/types.ts +32 -0
  1080. package/src/node/video.ts +196 -0
  1081. package/src/pairdraw-api/comments.ts +6 -0
  1082. package/src/pairdraw-api/design-memory.ts +61 -0
  1083. package/src/pairdraw-api/index.ts +88 -9
  1084. package/src/pairdraw-api/nodes.ts +38 -0
  1085. package/src/pairdraw-api/variations.ts +109 -0
  1086. package/src/prototype/easing.ts +37 -0
  1087. package/src/prototype/frames.ts +9 -0
  1088. package/src/prototype/hit.ts +70 -0
  1089. package/src/prototype/index.ts +69 -0
  1090. package/src/prototype/pointer.ts +146 -0
  1091. package/src/prototype/reactions.ts +178 -0
  1092. package/src/prototype/scene.ts +116 -0
  1093. package/src/prototype/scenes.ts +256 -0
  1094. package/src/prototype/scroll.ts +190 -0
  1095. package/src/prototype/session.ts +188 -0
  1096. package/src/prototype/smart-animate/animation.ts +267 -0
  1097. package/src/prototype/smart-animate/match.ts +85 -0
  1098. package/src/prototype/snapshot.ts +60 -0
  1099. package/src/prototype/timeline.ts +400 -0
  1100. package/src/rpc/read-commands.ts +4 -4
  1101. package/src/rpc/variables-command.ts +2 -2
  1102. package/src/text/font/features.ts +27 -0
  1103. package/src/text/font/manager.ts +79 -1
  1104. package/src/text/font/provider.ts +26 -0
  1105. package/src/text/font/{status.ts → readiness.ts} +13 -9
  1106. package/src/text/index.ts +4 -1
  1107. package/src/text/prepare.ts +9 -4
  1108. package/src/text/replace-fonts.ts +171 -0
  1109. package/src/tools/analyze/responsive/index.ts +257 -0
  1110. package/src/tools/analyze/responsive/widths.ts +63 -0
  1111. package/src/tools/analyze.ts +4 -0
  1112. package/src/tools/codegen/token-sync.ts +98 -0
  1113. package/src/tools/codegen/tokens.ts +4 -2
  1114. package/src/tools/codegen.ts +1 -0
  1115. package/src/tools/comments.ts +6 -4
  1116. package/src/tools/component-catalog.ts +5 -3
  1117. package/src/tools/create/components.ts +4 -0
  1118. package/src/tools/create/html.ts +1 -3
  1119. package/src/tools/create/icons.ts +2 -1
  1120. package/src/tools/create/mermaid.ts +1 -0
  1121. package/src/tools/create/svg.ts +5 -1
  1122. package/src/tools/create/vector.ts +2 -2
  1123. package/src/tools/css/shorthand.ts +64 -0
  1124. package/src/tools/describe/index.ts +2 -8
  1125. package/src/tools/design-memory.ts +72 -0
  1126. package/src/tools/html-host.ts +5 -3
  1127. package/src/tools/image-ai/apply.ts +0 -2
  1128. package/src/tools/image-ai/generate.ts +2 -0
  1129. package/src/tools/image-ai/service.ts +5 -3
  1130. package/src/tools/index.ts +3 -0
  1131. package/src/tools/modify/effects.ts +1 -1
  1132. package/src/tools/modify/fonts.ts +34 -0
  1133. package/src/tools/modify/geometry.ts +16 -3
  1134. package/src/tools/modify/layout.ts +47 -13
  1135. package/src/tools/modify/matching.ts +14 -11
  1136. package/src/tools/modify/paint.ts +85 -5
  1137. package/src/tools/modify/reactions.ts +16 -8
  1138. package/src/tools/modify/text.ts +56 -15
  1139. package/src/tools/modify/update.ts +46 -2
  1140. package/src/tools/modify.ts +1 -0
  1141. package/src/tools/prompts/codegen.md +2 -1
  1142. package/src/tools/read/css.ts +365 -0
  1143. package/src/tools/read/fonts.ts +24 -2
  1144. package/src/tools/read/libraries.ts +1 -0
  1145. package/src/tools/read/reactions.ts +3 -2
  1146. package/src/tools/read/space.ts +3 -4
  1147. package/src/tools/read.ts +1 -0
  1148. package/src/tools/registry/core.ts +5 -2
  1149. package/src/tools/registry/extended.ts +28 -1
  1150. package/src/tools/schema.ts +42 -9
  1151. package/src/tools/script/host.ts +6 -3
  1152. package/src/tools/stock-photo.ts +1 -0
  1153. package/src/tools/structure/basic.ts +1 -0
  1154. package/src/tools/structure/batch.ts +12 -1
  1155. package/src/tools/structure/hierarchy.ts +4 -0
  1156. package/src/tools/structure/variations.ts +118 -0
  1157. package/src/tools/structure.ts +2 -0
  1158. package/src/tools/styles/types.ts +3 -4
  1159. package/src/tools/variables/collections.ts +1 -1
  1160. package/src/tools/variables/values.ts +16 -5
  1161. package/src/tools/vector/boolean.ts +4 -0
  1162. package/src/tools/vector/vectorize.ts +11 -4
  1163. package/src/tools/vector/video.ts +228 -0
  1164. package/src/tools/vector.ts +1 -0
  1165. package/src/tools/video-host.ts +20 -0
  1166. package/src/vector/vectorize/svg/gradients.ts +8 -5
  1167. package/src/vector/vectorize/svg/to-vectors.ts +48 -14
  1168. package/dist/text/font/status.d.ts +0 -28
  1169. package/dist/text/font/status.d.ts.map +0 -1
  1170. package/dist/text/font/status.js.map +0 -1
@@ -3,6 +3,8 @@ import { variableAlias } from "./variables/values.js";
3
3
  import { invalid, received } from "./accessors/text/messages.js";
4
4
  import { BLACK } from "@pairdraw/scene-graph/constants";
5
5
  import { IDENTITY_GRADIENT_TRANSFORM, gradientTransformRows } from "@pairdraw/scene-graph/gradient";
6
+ import { isEmptyObject } from "es-toolkit/predicate";
7
+ import { mapValues, pickBy } from "es-toolkit/object";
6
8
  import * as v from "valibot";
7
9
  //#region src/figma-api/paints.ts
8
10
  /** The paint types Figma's `fills` and `strokes` take, in the order its message lists them. */
@@ -30,8 +32,8 @@ const SCALE_MODES = [
30
32
  "CROP",
31
33
  "TILE"
32
34
  ];
33
- /** Pairdraw keeps no image filters; Figma reads every slider at 0 until one moves. */
34
- const NO_FILTERS = {
35
+ /** Figma reads every slider a paint or a script leaves out at 0. */
36
+ const UNADJUSTED_FILTERS = {
35
37
  exposure: 0,
36
38
  contrast: 0,
37
39
  saturation: 0,
@@ -187,6 +189,13 @@ function sceneTransform(value, field, site) {
187
189
  m12
188
190
  };
189
191
  }
192
+ function sceneFilters(filters) {
193
+ const moved = pickBy(filters ?? {}, Boolean);
194
+ return isEmptyObject(moved) ? {} : { filters: moved };
195
+ }
196
+ function figmaFilters(filters) {
197
+ return mapValues(UNADJUSTED_FILTERS, (unadjusted, slider) => filters?.[slider] ?? unadjusted);
198
+ }
190
199
  function sceneFill(paint, site) {
191
200
  const base = {
192
201
  visible: paint.visible ?? true,
@@ -217,7 +226,8 @@ function sceneFill(paint, site) {
217
226
  ...hash !== null && { imageHash: hash },
218
227
  ...imageTransform && { imageTransform },
219
228
  ...paint.rotation !== void 0 && { imageRotation: paint.rotation },
220
- ...paint.scalingFactor !== void 0 && { scale: paint.scalingFactor }
229
+ ...paint.scalingFactor !== void 0 && { scale: paint.scalingFactor },
230
+ ...sceneFilters(paint.filters)
221
231
  };
222
232
  }
223
233
  return {
@@ -264,7 +274,7 @@ function figmaMediaPaint(paint, type, base) {
264
274
  scaleMode,
265
275
  scalingFactor: scaleMode === "TILE" ? paint.scale ?? 1 : 1,
266
276
  ...!crop && { rotation: paint.imageRotation ?? 0 },
267
- filters: { ...NO_FILTERS }
277
+ filters: figmaFilters(paint.filters)
268
278
  };
269
279
  const transform = rows(crop ? paint.imageTransform : void 0);
270
280
  const hash = paint.imageHash ?? null;
@@ -1 +1 @@
1
- {"version":3,"file":"paints.js","names":[],"sources":["../../src/figma-api/paints.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type { BlendMode, Fill, GradientTransform, ImageScaleMode } from '@pairdraw/scene-graph'\nimport { BLACK } from '@pairdraw/scene-graph/constants'\nimport { gradientTransformRows, IDENTITY_GRADIENT_TRANSFORM } from '@pairdraw/scene-graph/gradient'\nimport type { Color, Vector } from '@pairdraw/scene-graph/primitives'\n\nimport { invalid, received } from './accessors/text/messages'\nimport { BLEND_MODES, issuePath } from './effects'\nimport type { FigmaTransform } from './types'\nimport { variableAlias, type FigmaVariableAlias } from './variables/values'\n\n/** The paint types Figma's `fills` and `strokes` take, in the order its message lists them. */\nconst PAINT_TYPES = [\n 'SOLID',\n 'SHADER',\n 'GRADIENT_LINEAR',\n 'GRADIENT_RADIAL',\n 'GRADIENT_ANGULAR',\n 'GRADIENT_DIAMOND',\n 'IMAGE',\n 'VIDEO'\n] as const\n\n/** Paint types Figma's plugin API takes that Pairdraw does not model yet. */\nconst UNSUPPORTED_PAINT_TYPES = new Set(['SHADER'])\n\nconst GRADIENT_TYPES = [\n 'GRADIENT_LINEAR',\n 'GRADIENT_RADIAL',\n 'GRADIENT_ANGULAR',\n 'GRADIENT_DIAMOND'\n] as const\n\nconst SCALE_MODES = ['FILL', 'FIT', 'CROP', 'TILE'] as const satisfies readonly ImageScaleMode[]\n\ntype ImageFilters = Record<\n 'exposure' | 'contrast' | 'saturation' | 'temperature' | 'tint' | 'highlights' | 'shadows',\n number\n>\n\n/** Pairdraw keeps no image filters; Figma reads every slider at 0 until one moves. */\nconst NO_FILTERS: ImageFilters = {\n exposure: 0,\n contrast: 0,\n saturation: 0,\n temperature: 0,\n tint: 0,\n highlights: 0,\n shadows: 0\n}\n\n/** Figma's videos are named by the SHA-1 of their bytes. */\nconst SHA1_HASH = /^[0-9a-f]{40}$/i\n\n/** Figma's message for a value that is none of `options`. */\nfunction invalidOption(options: readonly string[]): string {\n return `Invalid option: expected one of ${options.map((option) => `\"${option}\"`).join('|')}`\n}\n\nconst unitSchema = v.pipe(v.number(), v.minValue(0), v.maxValue(1))\nconst aliasSchema = v.object({ type: v.literal('VARIABLE_ALIAS'), id: v.string() })\nconst colorBindingSchema = v.optional(v.strictObject({ color: v.optional(aliasSchema) }))\n\nconst paintEntries = {\n visible: v.optional(v.boolean()),\n opacity: v.optional(unitSchema),\n blendMode: v.optional(v.picklist(BLEND_MODES, invalidOption(BLEND_MODES)))\n}\n\n// Figma checks a transform's rows itself, after the paint's other fields.\nconst transformSchema = v.optional(v.unknown())\n\n// Image filter sliders run from -1 to 1.\nconst filterSchema = v.optional(v.pipe(v.number(), v.minValue(-1), v.maxValue(1)))\n\nconst mediaEntries = {\n scaleMode: v.picklist(SCALE_MODES, invalidOption(SCALE_MODES)),\n scalingFactor: v.optional(v.number()),\n rotation: v.optional(v.number()),\n filters: v.optional(\n v.strictObject({\n exposure: filterSchema,\n contrast: filterSchema,\n saturation: filterSchema,\n temperature: filterSchema,\n tint: filterSchema,\n highlights: filterSchema,\n shadows: filterSchema\n })\n ),\n ...paintEntries\n}\n\nconst paintSchema = v.variant('type', [\n v.strictObject({\n type: v.literal('SOLID'),\n // A solid colour is RGB; Figma takes an alpha as the paint's opacity.\n color: v.strictObject({\n r: unitSchema,\n g: unitSchema,\n b: unitSchema,\n a: v.optional(unitSchema)\n }),\n ...paintEntries,\n boundVariables: colorBindingSchema\n }),\n v.strictObject({\n type: v.picklist(GRADIENT_TYPES),\n gradientTransform: transformSchema,\n gradientStops: v.array(\n v.strictObject({\n position: unitSchema,\n color: v.strictObject({ r: unitSchema, g: unitSchema, b: unitSchema, a: unitSchema }),\n boundVariables: colorBindingSchema\n })\n ),\n ...paintEntries\n }),\n v.strictObject({\n type: v.literal('IMAGE'),\n imageHash: v.nullable(v.string()),\n imageTransform: transformSchema,\n ...mediaEntries\n }),\n v.strictObject({\n type: v.literal('VIDEO'),\n videoHash: v.nullable(v.string()),\n videoTransform: transformSchema,\n ...mediaEntries\n })\n])\n\ntype ParsedPaint = v.InferOutput<typeof paintSchema>\n\ntype PaintBase = {\n readonly visible?: boolean\n readonly opacity?: number\n readonly blendMode?: BlendMode\n}\n\ntype ColorBinding = { readonly boundVariables?: { readonly color?: FigmaVariableAlias } }\n\ntype MediaFields = PaintBase & {\n readonly scaleMode: ImageScaleMode\n readonly scalingFactor?: number\n readonly rotation?: number\n readonly filters?: Partial<ImageFilters>\n}\n\n/** A paint Pairdraw models that Figma's plugin API has no type for, read as the model holds it. */\nexport type PairdrawPaint = Omit<Fill, 'type' | 'gradientTransform' | 'imageTransform'> & {\n readonly type: 'NOISE' | 'CUSTOM' | 'MESH'\n readonly gradientTransform?: FigmaTransform\n readonly imageTransform?: FigmaTransform\n}\n\n/**\n * A paint as Figma's plugin API gives and takes it (`Paint` in `@figma/plugin-typings`): a solid\n * colour is RGB with its alpha in the opacity, transforms are two rows of three, and an image or\n * video names its scale mode, rotation, and tile scaling as Figma does. Like Figma, the setters\n * refuse a pattern; Pairdraw's own paints read as {@link PairdrawPaint}.\n */\nexport type FigmaPaint =\n | (PaintBase &\n ColorBinding & {\n readonly type: 'SOLID'\n readonly color: Omit<Color, 'a'>\n })\n | (PaintBase & {\n readonly type: (typeof GRADIENT_TYPES)[number]\n readonly gradientTransform: FigmaTransform\n readonly gradientStops: ReadonlyArray<\n ColorBinding & { readonly position: number; readonly color: Color }\n >\n })\n | (MediaFields & {\n readonly type: 'IMAGE'\n readonly imageHash: string | null\n readonly imageTransform?: FigmaTransform\n })\n | (MediaFields & {\n readonly type: 'VIDEO'\n readonly videoHash: string | null\n readonly videoTransform?: FigmaTransform\n })\n | (PaintBase & {\n readonly type: 'PATTERN'\n readonly sourceNodeId: string\n readonly tileType: NonNullable<Fill['patternTileType']>\n readonly scalingFactor: number\n readonly spacing: Vector\n readonly horizontalAlignment: NonNullable<Fill['horizontalAlignment']>\n })\n | PairdrawPaint\n\ntype ReadBase = Required<PaintBase>\n\n/** What Figma calls the value each Valibot schema expects. */\nconst EXPECTED: Partial<Record<string, string>> = {\n strict_object: 'object',\n object: 'object',\n variant: 'object',\n array: 'array',\n number: 'number',\n string: 'string',\n boolean: 'boolean'\n}\n\n/** Where Figma reports an issue: a paint itself by its index, a field by its path. */\nfunction where(path: readonly v.IssuePathItem[]): string {\n if (path.length === 0) return ''\n const [first] = path\n if (path.length === 1 && typeof first.key === 'number') return ` at index ${first.key}`\n return ` at ${issuePath(path)}`\n}\n\n/** One of Figma's lines for a Valibot issue, as its paint validation words it. */\nfunction issueProblem(issue: v.BaseIssue<unknown>): string {\n const path = issue.path ?? []\n const last = path.at(-1)\n if (last?.origin === 'key') {\n if (issue.expected === 'never') {\n return `Unrecognized key: \"${String(last.key)}\"${where(path.slice(0, -1))}`\n }\n // Figma checks a missing field as undefined, which a choice refuses as an option.\n const problem = last.key === 'scaleMode' ? invalidOption(SCALE_MODES) : 'Required value missing'\n return `${problem}${where(path)}`\n }\n if (issue.type === 'picklist') return `${issue.message}${where(path)}`\n if (issue.type === 'max_value') {\n return `Too big: expected number to be <=${String(issue.requirement)}${where(path)}`\n }\n if (issue.type === 'min_value') {\n return `Too small: expected number to be >=${String(issue.requirement)}${where(path)}`\n }\n if (issue.input === undefined) return `Required value missing${where(path)}`\n const expected = EXPECTED[issue.type] ?? issue.expected ?? issue.type\n return `Expected ${expected}, received ${received(issue.input)}${where(path)}`\n}\n\n/** Figma's complaint about a paint type it does not take, or Pairdraw does not model. */\nfunction typeProblem(value: readonly unknown[]): string | null {\n for (const [index, paint] of value.entries()) {\n if (!v.is(v.object({ type: v.unknown() }), paint)) continue\n const { type } = paint\n if (typeof type === 'string' && UNSUPPORTED_PAINT_TYPES.has(type)) {\n return `${type} paints are not supported at [${index}].type`\n }\n if (!(PAINT_TYPES as readonly unknown[]).includes(type)) {\n return `Expected [${index}].type to be one of the following: ${PAINT_TYPES.join(', ')}`\n }\n }\n return null\n}\n\ntype TransformField = 'gradientTransform' | 'imageTransform' | 'videoTransform'\n\nfunction isRow(value: unknown): value is [number, number, number] {\n return (\n Array.isArray(value) &&\n value.length === 3 &&\n value.every((item) => typeof item === 'number' && Number.isFinite(item))\n )\n}\n\n/** Figma's complaint about `value` as a transform, or null when it is two rows of three numbers. */\nfunction transformProblem(value: unknown): string | null {\n if (value === undefined) return 'Required value missing'\n if (!Array.isArray(value))\n return `Expected array, received ${value === null ? 'null' : typeof value}`\n if (value.length < 2) return 'Too small: expected array to have exactly 2 items'\n if (value.length > 2) return 'Too big: expected array to have exactly 2 items'\n return value.every(isRow) ? null : 'Expected array of 3 numbers'\n}\n\n/** Where a paint at `index` in the list a script passes to `method` sets `property`. */\ntype PaintSite = { index: number; method: string; property: string }\n\n/**\n * The scene transform `value` a paint holds in `field`, which Figma requires of a gradient. Figma\n * takes only two rows of three numbers and throws the way its `fills` and `strokes` setters do.\n */\nfunction sceneTransform(\n value: unknown,\n field: TransformField,\n site: PaintSite\n): GradientTransform | undefined {\n if (value === undefined && field !== 'gradientTransform') return undefined\n const problem = transformProblem(value)\n if (problem) {\n const at = `[${site.index}].${field}`\n throw invalid(\n site.method,\n `Expected ${at} to be one of the following, but none matched:\\n ${problem} at ${at}`,\n site.property\n )\n }\n const [[m00, m01, m02], [m10, m11, m12]] = value as FigmaTransform\n return { m00, m01, m02, m10, m11, m12 }\n}\n\nfunction sceneFill(paint: ParsedPaint, site: PaintSite): Fill {\n const base = {\n visible: paint.visible ?? true,\n opacity: paint.opacity ?? 1,\n ...(paint.blendMode && { blendMode: paint.blendMode })\n }\n if (paint.type === 'SOLID') {\n const { r, g, b, a } = paint.color\n // Figma keeps a solid paint's alpha in its opacity, so a colour's alpha stands in for an\n // opacity left out, as `figma.util.solidPaint` gives it.\n return { type: 'SOLID', ...base, color: { r, g, b, a: 1 }, opacity: paint.opacity ?? a ?? 1 }\n }\n if (paint.type === 'IMAGE' || paint.type === 'VIDEO') {\n const [hash, imageTransform] =\n paint.type === 'IMAGE'\n ? [paint.imageHash, sceneTransform(paint.imageTransform, 'imageTransform', site)]\n : [paint.videoHash, sceneTransform(paint.videoTransform, 'videoTransform', site)]\n return {\n type: paint.type,\n ...base,\n color: { ...BLACK },\n imageScaleMode: paint.scaleMode,\n ...(hash !== null && { imageHash: hash }),\n ...(imageTransform && { imageTransform }),\n ...(paint.rotation !== undefined && { imageRotation: paint.rotation }),\n ...(paint.scalingFactor !== undefined && { scale: paint.scalingFactor })\n }\n }\n return {\n type: paint.type,\n ...base,\n color: { ...BLACK },\n gradientStops: paint.gradientStops.map(({ position, color }) => ({\n position,\n color: { ...color }\n })),\n gradientTransform: sceneTransform(paint.gradientTransform, 'gradientTransform', site)\n }\n}\n\n/**\n * Check `value` against Figma's paint shapes and convert it to scene paints. Throws Figma's\n * message for `method` setting `property`, listing every problem on its own line.\n */\nexport function parseFigmaPaints(value: unknown, method = 'set_fills', property = 'fills'): Fill[] {\n if (!Array.isArray(value)) {\n throw invalid(method, `Expected array, received ${received(value)}`, property)\n }\n const unsupported = typeProblem(value)\n if (unsupported) throw invalid(method, unsupported, property)\n const result = v.safeParse(v.array(paintSchema), value)\n if (!result.success) throw invalid(method, result.issues.map(issueProblem).join('\\n'), property)\n for (const paint of result.output) {\n if (paint.type === 'VIDEO' && paint.videoHash !== null && !SHA1_HASH.test(paint.videoHash)) {\n throw new Error(`in ${method}: Invalid SHA1 hash`)\n }\n }\n return result.output.map((paint, index) => sceneFill(paint, { index, method, property }))\n}\n\nfunction rows(transform: GradientTransform | undefined): FigmaTransform {\n return gradientTransformRows(transform ?? IDENTITY_GRADIENT_TRANSFORM)\n}\n\n/**\n * An image or video paint as Figma reads it. Outside crop mode it reads the identity transform, a\n * scaling factor of 1 unless tiled, and its rotation; a crop holds its own rotation, so it reads\n * none.\n */\nfunction figmaMediaPaint(paint: Fill, type: 'IMAGE' | 'VIDEO', base: ReadBase): FigmaPaint {\n const scaleMode = paint.imageScaleMode ?? 'FILL'\n const crop = scaleMode === 'CROP'\n const media = {\n ...base,\n scaleMode,\n scalingFactor: scaleMode === 'TILE' ? (paint.scale ?? 1) : 1,\n ...(!crop && { rotation: paint.imageRotation ?? 0 }),\n filters: { ...NO_FILTERS }\n }\n const transform = rows(crop ? paint.imageTransform : undefined)\n const hash = paint.imageHash ?? null\n return type === 'IMAGE'\n ? { type, ...media, imageTransform: transform, imageHash: hash }\n : { type, ...media, videoTransform: transform, videoHash: hash }\n}\n\nfunction figmaPatternPaint(paint: Fill, base: ReadBase): FigmaPaint {\n return {\n type: 'PATTERN',\n ...base,\n sourceNodeId: paint.sourceNodeId ?? '',\n tileType: paint.patternTileType ?? 'RECTANGULAR',\n scalingFactor: paint.scale ?? 1,\n spacing: { ...(paint.patternSpacing ?? { x: 0, y: 0 }) },\n horizontalAlignment: paint.horizontalAlignment ?? 'START'\n }\n}\n\nfunction pairdrawPaint(paint: Fill, type: PairdrawPaint['type']): PairdrawPaint {\n const { gradientTransform, imageTransform, ...rest } = paint\n return {\n ...structuredClone(rest),\n type,\n ...(gradientTransform && { gradientTransform: rows(gradientTransform) }),\n ...(imageTransform && { imageTransform: rows(imageTransform) })\n }\n}\n\n/** `paint` as Figma's plugin API reads it, its colour bound to `variableId` when given. */\nexport function toFigmaPaint(paint: Fill, variableId?: string): FigmaPaint {\n const base: ReadBase = {\n visible: paint.visible,\n opacity: paint.opacity,\n blendMode: paint.blendMode ?? 'NORMAL'\n }\n const { type } = paint\n if (type === 'SOLID') {\n const { r, g, b } = paint.color\n return {\n type,\n ...base,\n color: { r, g, b },\n boundVariables: variableId ? { color: variableAlias(variableId) } : {}\n }\n }\n if (type === 'IMAGE' || type === 'VIDEO') return figmaMediaPaint(paint, type, base)\n if (type === 'PATTERN') return figmaPatternPaint(paint, base)\n if (type === 'NOISE' || type === 'CUSTOM' || type === 'MESH') return pairdrawPaint(paint, type)\n return {\n type,\n ...base,\n gradientStops: (paint.gradientStops ?? []).map(({ position, color }) => ({\n position,\n color: { ...color }\n })),\n gradientTransform: rows(paint.gradientTransform)\n }\n}\n"],"mappings":";;;;;;;;AAaA,MAAM,cAAc;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAM,0CAA0B,IAAI,IAAI,CAAC,QAAQ,CAAC;AAElD,MAAM,iBAAiB;CACrB;CACA;CACA;CACA;AACF;AAEA,MAAM,cAAc;CAAC;CAAQ;CAAO;CAAQ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O,MAAM,IAAI;CAClF,IAAI,SAAS,WAAW,OAAO,kBAAkB,OAAO,IAAI;CAC5D,IAAI,SAAS,WAAW,SAAS,YAAY,SAAS,QAAQ,OAAO,cAAc,OAAO,IAAI;CAC9F,OAAO;EACL;EACA,GAAG;EACH,gBAAgB,MAAM,iBAAiB,CAAC,EAAA,CAAG,KAAK,EAAE,UAAU,aAAa;GACvE;GACA,OAAO,EAAE,GAAG,MAAM;EACpB,EAAE;EACF,mBAAmB,KAAK,MAAM,iBAAiB;CACjD;AACF"}
1
+ {"version":3,"file":"paints.js","names":[],"sources":["../../src/figma-api/paints.ts"],"sourcesContent":["import { mapValues, pickBy } from 'es-toolkit/object'\nimport { isEmptyObject } from 'es-toolkit/predicate'\nimport * as v from 'valibot'\n\nimport type {\n BlendMode,\n Fill,\n GradientTransform,\n ImageFilters as SceneImageFilters,\n ImageScaleMode\n} from '@pairdraw/scene-graph'\nimport { BLACK } from '@pairdraw/scene-graph/constants'\nimport { gradientTransformRows, IDENTITY_GRADIENT_TRANSFORM } from '@pairdraw/scene-graph/gradient'\nimport type { Color, Vector } from '@pairdraw/scene-graph/primitives'\n\nimport { invalid, received } from './accessors/text/messages'\nimport { BLEND_MODES, issuePath } from './effects'\nimport type { FigmaTransform } from './types'\nimport { variableAlias, type FigmaVariableAlias } from './variables/values'\n\n/** The paint types Figma's `fills` and `strokes` take, in the order its message lists them. */\nconst PAINT_TYPES = [\n 'SOLID',\n 'SHADER',\n 'GRADIENT_LINEAR',\n 'GRADIENT_RADIAL',\n 'GRADIENT_ANGULAR',\n 'GRADIENT_DIAMOND',\n 'IMAGE',\n 'VIDEO'\n] as const\n\n/** Paint types Figma's plugin API takes that Pairdraw does not model yet. */\nconst UNSUPPORTED_PAINT_TYPES = new Set(['SHADER'])\n\nconst GRADIENT_TYPES = [\n 'GRADIENT_LINEAR',\n 'GRADIENT_RADIAL',\n 'GRADIENT_ANGULAR',\n 'GRADIENT_DIAMOND'\n] as const\n\nconst SCALE_MODES = ['FILL', 'FIT', 'CROP', 'TILE'] as const satisfies readonly ImageScaleMode[]\n\ntype ImageFilters = Required<SceneImageFilters>\n\n/** Figma reads every slider a paint or a script leaves out at 0. */\nconst UNADJUSTED_FILTERS: ImageFilters = {\n exposure: 0,\n contrast: 0,\n saturation: 0,\n temperature: 0,\n tint: 0,\n highlights: 0,\n shadows: 0\n}\n\n/** Figma's videos are named by the SHA-1 of their bytes. */\nconst SHA1_HASH = /^[0-9a-f]{40}$/i\n\n/** Figma's message for a value that is none of `options`. */\nfunction invalidOption(options: readonly string[]): string {\n return `Invalid option: expected one of ${options.map((option) => `\"${option}\"`).join('|')}`\n}\n\nconst unitSchema = v.pipe(v.number(), v.minValue(0), v.maxValue(1))\nconst aliasSchema = v.object({ type: v.literal('VARIABLE_ALIAS'), id: v.string() })\nconst colorBindingSchema = v.optional(v.strictObject({ color: v.optional(aliasSchema) }))\n\nconst paintEntries = {\n visible: v.optional(v.boolean()),\n opacity: v.optional(unitSchema),\n blendMode: v.optional(v.picklist(BLEND_MODES, invalidOption(BLEND_MODES)))\n}\n\n// Figma checks a transform's rows itself, after the paint's other fields.\nconst transformSchema = v.optional(v.unknown())\n\n// Image filter sliders run from -1 to 1.\nconst filterSchema = v.optional(v.pipe(v.number(), v.minValue(-1), v.maxValue(1)))\n\nconst mediaEntries = {\n scaleMode: v.picklist(SCALE_MODES, invalidOption(SCALE_MODES)),\n scalingFactor: v.optional(v.number()),\n rotation: v.optional(v.number()),\n filters: v.optional(\n v.strictObject({\n exposure: filterSchema,\n contrast: filterSchema,\n saturation: filterSchema,\n temperature: filterSchema,\n tint: filterSchema,\n highlights: filterSchema,\n shadows: filterSchema\n })\n ),\n ...paintEntries\n}\n\nconst paintSchema = v.variant('type', [\n v.strictObject({\n type: v.literal('SOLID'),\n // A solid colour is RGB; Figma takes an alpha as the paint's opacity.\n color: v.strictObject({\n r: unitSchema,\n g: unitSchema,\n b: unitSchema,\n a: v.optional(unitSchema)\n }),\n ...paintEntries,\n boundVariables: colorBindingSchema\n }),\n v.strictObject({\n type: v.picklist(GRADIENT_TYPES),\n gradientTransform: transformSchema,\n gradientStops: v.array(\n v.strictObject({\n position: unitSchema,\n color: v.strictObject({ r: unitSchema, g: unitSchema, b: unitSchema, a: unitSchema }),\n boundVariables: colorBindingSchema\n })\n ),\n ...paintEntries\n }),\n v.strictObject({\n type: v.literal('IMAGE'),\n imageHash: v.nullable(v.string()),\n imageTransform: transformSchema,\n ...mediaEntries\n }),\n v.strictObject({\n type: v.literal('VIDEO'),\n videoHash: v.nullable(v.string()),\n videoTransform: transformSchema,\n ...mediaEntries\n })\n])\n\ntype ParsedPaint = v.InferOutput<typeof paintSchema>\n\ntype PaintBase = {\n readonly visible?: boolean\n readonly opacity?: number\n readonly blendMode?: BlendMode\n}\n\ntype ColorBinding = { readonly boundVariables?: { readonly color?: FigmaVariableAlias } }\n\ntype MediaFields = PaintBase & {\n readonly scaleMode: ImageScaleMode\n readonly scalingFactor?: number\n readonly rotation?: number\n readonly filters?: Partial<ImageFilters>\n}\n\n/** A paint Pairdraw models that Figma's plugin API has no type for, read as the model holds it. */\nexport type PairdrawPaint = Omit<Fill, 'type' | 'gradientTransform' | 'imageTransform'> & {\n readonly type: 'NOISE' | 'CUSTOM' | 'MESH'\n readonly gradientTransform?: FigmaTransform\n readonly imageTransform?: FigmaTransform\n}\n\n/**\n * A paint as Figma's plugin API gives and takes it (`Paint` in `@figma/plugin-typings`): a solid\n * colour is RGB with its alpha in the opacity, transforms are two rows of three, and an image or\n * video names its scale mode, rotation, and tile scaling as Figma does. Like Figma, the setters\n * refuse a pattern; Pairdraw's own paints read as {@link PairdrawPaint}.\n */\nexport type FigmaPaint =\n | (PaintBase &\n ColorBinding & {\n readonly type: 'SOLID'\n readonly color: Omit<Color, 'a'>\n })\n | (PaintBase & {\n readonly type: (typeof GRADIENT_TYPES)[number]\n readonly gradientTransform: FigmaTransform\n readonly gradientStops: ReadonlyArray<\n ColorBinding & { readonly position: number; readonly color: Color }\n >\n })\n | (MediaFields & {\n readonly type: 'IMAGE'\n readonly imageHash: string | null\n readonly imageTransform?: FigmaTransform\n })\n | (MediaFields & {\n readonly type: 'VIDEO'\n readonly videoHash: string | null\n readonly videoTransform?: FigmaTransform\n })\n | (PaintBase & {\n readonly type: 'PATTERN'\n readonly sourceNodeId: string\n readonly tileType: NonNullable<Fill['patternTileType']>\n readonly scalingFactor: number\n readonly spacing: Vector\n readonly horizontalAlignment: NonNullable<Fill['horizontalAlignment']>\n })\n | PairdrawPaint\n\ntype ReadBase = Required<PaintBase>\n\n/** What Figma calls the value each Valibot schema expects. */\nconst EXPECTED: Partial<Record<string, string>> = {\n strict_object: 'object',\n object: 'object',\n variant: 'object',\n array: 'array',\n number: 'number',\n string: 'string',\n boolean: 'boolean'\n}\n\n/** Where Figma reports an issue: a paint itself by its index, a field by its path. */\nfunction where(path: readonly v.IssuePathItem[]): string {\n if (path.length === 0) return ''\n const [first] = path\n if (path.length === 1 && typeof first.key === 'number') return ` at index ${first.key}`\n return ` at ${issuePath(path)}`\n}\n\n/** One of Figma's lines for a Valibot issue, as its paint validation words it. */\nfunction issueProblem(issue: v.BaseIssue<unknown>): string {\n const path = issue.path ?? []\n const last = path.at(-1)\n if (last?.origin === 'key') {\n if (issue.expected === 'never') {\n return `Unrecognized key: \"${String(last.key)}\"${where(path.slice(0, -1))}`\n }\n // Figma checks a missing field as undefined, which a choice refuses as an option.\n const problem = last.key === 'scaleMode' ? invalidOption(SCALE_MODES) : 'Required value missing'\n return `${problem}${where(path)}`\n }\n if (issue.type === 'picklist') return `${issue.message}${where(path)}`\n if (issue.type === 'max_value') {\n return `Too big: expected number to be <=${String(issue.requirement)}${where(path)}`\n }\n if (issue.type === 'min_value') {\n return `Too small: expected number to be >=${String(issue.requirement)}${where(path)}`\n }\n if (issue.input === undefined) return `Required value missing${where(path)}`\n const expected = EXPECTED[issue.type] ?? issue.expected ?? issue.type\n return `Expected ${expected}, received ${received(issue.input)}${where(path)}`\n}\n\n/** Figma's complaint about a paint type it does not take, or Pairdraw does not model. */\nfunction typeProblem(value: readonly unknown[]): string | null {\n for (const [index, paint] of value.entries()) {\n if (!v.is(v.object({ type: v.unknown() }), paint)) continue\n const { type } = paint\n if (typeof type === 'string' && UNSUPPORTED_PAINT_TYPES.has(type)) {\n return `${type} paints are not supported at [${index}].type`\n }\n if (!(PAINT_TYPES as readonly unknown[]).includes(type)) {\n return `Expected [${index}].type to be one of the following: ${PAINT_TYPES.join(', ')}`\n }\n }\n return null\n}\n\ntype TransformField = 'gradientTransform' | 'imageTransform' | 'videoTransform'\n\nfunction isRow(value: unknown): value is [number, number, number] {\n return (\n Array.isArray(value) &&\n value.length === 3 &&\n value.every((item) => typeof item === 'number' && Number.isFinite(item))\n )\n}\n\n/** Figma's complaint about `value` as a transform, or null when it is two rows of three numbers. */\nfunction transformProblem(value: unknown): string | null {\n if (value === undefined) return 'Required value missing'\n if (!Array.isArray(value))\n return `Expected array, received ${value === null ? 'null' : typeof value}`\n if (value.length < 2) return 'Too small: expected array to have exactly 2 items'\n if (value.length > 2) return 'Too big: expected array to have exactly 2 items'\n return value.every(isRow) ? null : 'Expected array of 3 numbers'\n}\n\n/** Where a paint at `index` in the list a script passes to `method` sets `property`. */\ntype PaintSite = { index: number; method: string; property: string }\n\n/**\n * The scene transform `value` a paint holds in `field`, which Figma requires of a gradient. Figma\n * takes only two rows of three numbers and throws the way its `fills` and `strokes` setters do.\n */\nfunction sceneTransform(\n value: unknown,\n field: TransformField,\n site: PaintSite\n): GradientTransform | undefined {\n if (value === undefined && field !== 'gradientTransform') return undefined\n const problem = transformProblem(value)\n if (problem) {\n const at = `[${site.index}].${field}`\n throw invalid(\n site.method,\n `Expected ${at} to be one of the following, but none matched:\\n ${problem} at ${at}`,\n site.property\n )\n }\n const [[m00, m01, m02], [m10, m11, m12]] = value as FigmaTransform\n return { m00, m01, m02, m10, m11, m12 }\n}\n\nfunction sceneFilters(filters: Partial<ImageFilters> | undefined): Pick<Fill, 'filters'> {\n const moved = pickBy(filters ?? {}, Boolean)\n return isEmptyObject(moved) ? {} : { filters: moved }\n}\n\nfunction figmaFilters(filters: SceneImageFilters | undefined): ImageFilters {\n return mapValues(UNADJUSTED_FILTERS, (unadjusted, slider) => filters?.[slider] ?? unadjusted)\n}\n\nfunction sceneFill(paint: ParsedPaint, site: PaintSite): Fill {\n const base = {\n visible: paint.visible ?? true,\n opacity: paint.opacity ?? 1,\n ...(paint.blendMode && { blendMode: paint.blendMode })\n }\n if (paint.type === 'SOLID') {\n const { r, g, b, a } = paint.color\n // Figma keeps a solid paint's alpha in its opacity, so a colour's alpha stands in for an\n // opacity left out, as `figma.util.solidPaint` gives it.\n return { type: 'SOLID', ...base, color: { r, g, b, a: 1 }, opacity: paint.opacity ?? a ?? 1 }\n }\n if (paint.type === 'IMAGE' || paint.type === 'VIDEO') {\n const [hash, imageTransform] =\n paint.type === 'IMAGE'\n ? [paint.imageHash, sceneTransform(paint.imageTransform, 'imageTransform', site)]\n : [paint.videoHash, sceneTransform(paint.videoTransform, 'videoTransform', site)]\n return {\n type: paint.type,\n ...base,\n color: { ...BLACK },\n imageScaleMode: paint.scaleMode,\n ...(hash !== null && { imageHash: hash }),\n ...(imageTransform && { imageTransform }),\n ...(paint.rotation !== undefined && { imageRotation: paint.rotation }),\n ...(paint.scalingFactor !== undefined && { scale: paint.scalingFactor }),\n ...sceneFilters(paint.filters)\n }\n }\n return {\n type: paint.type,\n ...base,\n color: { ...BLACK },\n gradientStops: paint.gradientStops.map(({ position, color }) => ({\n position,\n color: { ...color }\n })),\n gradientTransform: sceneTransform(paint.gradientTransform, 'gradientTransform', site)\n }\n}\n\n/**\n * Check `value` against Figma's paint shapes and convert it to scene paints. Throws Figma's\n * message for `method` setting `property`, listing every problem on its own line.\n */\nexport function parseFigmaPaints(value: unknown, method = 'set_fills', property = 'fills'): Fill[] {\n if (!Array.isArray(value)) {\n throw invalid(method, `Expected array, received ${received(value)}`, property)\n }\n const unsupported = typeProblem(value)\n if (unsupported) throw invalid(method, unsupported, property)\n const result = v.safeParse(v.array(paintSchema), value)\n if (!result.success) throw invalid(method, result.issues.map(issueProblem).join('\\n'), property)\n for (const paint of result.output) {\n if (paint.type === 'VIDEO' && paint.videoHash !== null && !SHA1_HASH.test(paint.videoHash)) {\n throw new Error(`in ${method}: Invalid SHA1 hash`)\n }\n }\n return result.output.map((paint, index) => sceneFill(paint, { index, method, property }))\n}\n\nfunction rows(transform: GradientTransform | undefined): FigmaTransform {\n return gradientTransformRows(transform ?? IDENTITY_GRADIENT_TRANSFORM)\n}\n\n/**\n * An image or video paint as Figma reads it. Outside crop mode it reads the identity transform, a\n * scaling factor of 1 unless tiled, and its rotation; a crop holds its own rotation, so it reads\n * none.\n */\nfunction figmaMediaPaint(paint: Fill, type: 'IMAGE' | 'VIDEO', base: ReadBase): FigmaPaint {\n const scaleMode = paint.imageScaleMode ?? 'FILL'\n const crop = scaleMode === 'CROP'\n const media = {\n ...base,\n scaleMode,\n scalingFactor: scaleMode === 'TILE' ? (paint.scale ?? 1) : 1,\n ...(!crop && { rotation: paint.imageRotation ?? 0 }),\n filters: figmaFilters(paint.filters)\n }\n const transform = rows(crop ? paint.imageTransform : undefined)\n const hash = paint.imageHash ?? null\n return type === 'IMAGE'\n ? { type, ...media, imageTransform: transform, imageHash: hash }\n : { type, ...media, videoTransform: transform, videoHash: hash }\n}\n\nfunction figmaPatternPaint(paint: Fill, base: ReadBase): FigmaPaint {\n return {\n type: 'PATTERN',\n ...base,\n sourceNodeId: paint.sourceNodeId ?? '',\n tileType: paint.patternTileType ?? 'RECTANGULAR',\n scalingFactor: paint.scale ?? 1,\n spacing: { ...(paint.patternSpacing ?? { x: 0, y: 0 }) },\n horizontalAlignment: paint.horizontalAlignment ?? 'START'\n }\n}\n\nfunction pairdrawPaint(paint: Fill, type: PairdrawPaint['type']): PairdrawPaint {\n const { gradientTransform, imageTransform, ...rest } = paint\n return {\n ...structuredClone(rest),\n type,\n ...(gradientTransform && { gradientTransform: rows(gradientTransform) }),\n ...(imageTransform && { imageTransform: rows(imageTransform) })\n }\n}\n\n/** `paint` as Figma's plugin API reads it, its colour bound to `variableId` when given. */\nexport function toFigmaPaint(paint: Fill, variableId?: string): FigmaPaint {\n const base: ReadBase = {\n visible: paint.visible,\n opacity: paint.opacity,\n blendMode: paint.blendMode ?? 'NORMAL'\n }\n const { type } = paint\n if (type === 'SOLID') {\n const { r, g, b } = paint.color\n return {\n type,\n ...base,\n color: { r, g, b },\n boundVariables: variableId ? { color: variableAlias(variableId) } : {}\n }\n }\n if (type === 'IMAGE' || type === 'VIDEO') return figmaMediaPaint(paint, type, base)\n if (type === 'PATTERN') return figmaPatternPaint(paint, base)\n if (type === 'NOISE' || type === 'CUSTOM' || type === 'MESH') return pairdrawPaint(paint, type)\n return {\n type,\n ...base,\n gradientStops: (paint.gradientStops ?? []).map(({ position, color }) => ({\n position,\n color: { ...color }\n })),\n gradientTransform: rows(paint.gradientTransform)\n }\n}\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,cAAc;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAM,0CAA0B,IAAI,IAAI,CAAC,QAAQ,CAAC;AAElD,MAAM,iBAAiB;CACrB;CACA;CACA;CACA;AACF;AAEA,MAAM,cAAc;CAAC;CAAQ;CAAO;CAAQ;AAAM;;AAKlD,MAAM,qBAAmC;CACvC,UAAU;CACV,UAAU;CACV,YAAY;CACZ,aAAa;CACb,MAAM;CACN,YAAY;CACZ,SAAS;AACX;;AAGA,MAAM,YAAY;;AAGlB,SAAS,cAAc,SAAoC;CACzD,OAAO,mCAAmC,QAAQ,KAAK,WAAW,IAAI,OAAO,EAAE,CAAC,CAAC,KAAK,GAAG;AAC3F;AAEA,MAAM,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAClE,MAAM,cAAc,EAAE,OAAO;CAAE,MAAM,EAAE,QAAQ,gBAAg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OAAO;EACL;EACA,GAAG;EACH,gBAAgB,MAAM,iBAAiB,CAAC,EAAA,CAAG,KAAK,EAAE,UAAU,aAAa;GACvE;GACA,OAAO,EAAE,GAAG,MAAM;EACpB,EAAE;EACF,mBAAmB,KAAK,MAAM,iBAAiB;CACjD;AACF"}
@@ -6,9 +6,9 @@ import { SceneGraph, SceneNode } from "@pairdraw/scene-graph";
6
6
  * one recorder for its lifetime, kept across APIs: a script that failed before its tool laid
7
7
  * out its edits leaves them for the next read to lay out.
8
8
  */
9
- declare function startPendingLayout(graph: SceneGraph): void;
9
+ declare function startPendingLayout(source: SceneGraph): void;
10
10
  /** Lays out the edits recorded since the last geometry read. */
11
- declare function flushPendingLayout(graph: SceneGraph): void;
11
+ declare function flushPendingLayout(source: SceneGraph): void;
12
12
  /**
13
13
  * Lays out the recorded edits before a script moves or sizes `node`, when that layout could change
14
14
  * where it lands, as Figma lays out a script's edits while it runs: the layer follows its frame's
@@ -16,7 +16,7 @@ declare function flushPendingLayout(graph: SceneGraph): void;
16
16
  * an auto layout places, lands the same either way, so its edits wait for the next read: a script
17
17
  * that builds many layers lays out once rather than once per layer.
18
18
  */
19
- declare function flushPendingLayoutBefore(graph: SceneGraph, node: SceneNode, { placesChildren }?: {
19
+ declare function flushPendingLayoutBefore(source: SceneGraph, node: SceneNode, { placesChildren }?: {
20
20
  placesChildren?: boolean;
21
21
  }): void;
22
22
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"pending-layout.d.ts","names":[],"sources":["../../src/figma-api/pending-layout.ts"],"mappings":";;;;;;;;iBAkCgB,mBAAmB,OAAO;;iBAS1B,mBAAmB,OAAO;;;;;;;;iBAoD1B,yBACd,OAAO,YACP,MAAM,aACJ;EAA4B"}
1
+ {"version":3,"file":"pending-layout.d.ts","names":[],"sources":["../../src/figma-api/pending-layout.ts"],"mappings":";;;;;;;;iBAmCgB,mBAAmB,QAAQ;;iBAU3B,mBAAmB,QAAQ;;;;;;;;iBAqD3B,yBACd,QAAQ,YACR,MAAM,aACJ;EAA4B"}
@@ -1,4 +1,5 @@
1
1
  import { createLayoutRunner } from "../layout/mutations.js";
2
+ import { underlyingGraph } from "./graph-ref.js";
2
3
  import { flushPendingComponentSync } from "./pending-sync.js";
3
4
  import { createSceneMutationImpact, recordSceneMutations } from "@pairdraw/scene-graph/mutation-impact";
4
5
  //#region src/figma-api/pending-layout.ts
@@ -15,7 +16,8 @@ function mergeImpact(into, from) {
15
16
  * one recorder for its lifetime, kept across APIs: a script that failed before its tool laid
16
17
  * out its edits leaves them for the next read to lay out.
17
18
  */
18
- function startPendingLayout(graph) {
19
+ function startPendingLayout(source) {
20
+ const graph = underlyingGraph(source);
19
21
  if (pendingByGraph.has(graph)) return;
20
22
  const pending = {
21
23
  impact: createSceneMutationImpact(),
@@ -25,7 +27,8 @@ function startPendingLayout(graph) {
25
27
  recordSceneMutations(graph, pending.impact, () => !pending.flushing && !graph.isApplyingLayout);
26
28
  }
27
29
  /** Lays out the edits recorded since the last geometry read. */
28
- function flushPendingLayout(graph) {
30
+ function flushPendingLayout(source) {
31
+ const graph = underlyingGraph(source);
29
32
  flushPendingComponentSync(graph);
30
33
  const pending = pendingByGraph.get(graph);
31
34
  if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return;
@@ -74,7 +77,8 @@ function editsReach(graph, impact, node) {
74
77
  * an auto layout places, lands the same either way, so its edits wait for the next read: a script
75
78
  * that builds many layers lays out once rather than once per layer.
76
79
  */
77
- function flushPendingLayoutBefore(graph, node, { placesChildren = false } = {}) {
80
+ function flushPendingLayoutBefore(source, node, { placesChildren = false } = {}) {
81
+ const graph = underlyingGraph(source);
78
82
  const pending = pendingByGraph.get(graph);
79
83
  if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return;
80
84
  if ((followsFrameSize(node) || placesChildren && graph.getChildren(node.id).some(followsFrameSize)) && editsReach(graph, pending.impact, node)) flushPendingLayout(graph);
@@ -1 +1 @@
1
- {"version":3,"file":"pending-layout.js","names":[],"sources":["../../src/figma-api/pending-layout.ts"],"sourcesContent":["import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport {\n createSceneMutationImpact,\n recordSceneMutations,\n type SceneMutationImpact\n} from '@pairdraw/scene-graph/mutation-impact'\n\nimport { createLayoutRunner } from '#core/layout/mutations'\n\nimport { flushPendingComponentSync } from './pending-sync'\n\ninterface PendingLayout {\n impact: SceneMutationImpact\n flushing: boolean\n}\n\nconst pendingByGraph = new WeakMap<SceneGraph, PendingLayout>()\n\nfunction clearImpact(impact: SceneMutationImpact): void {\n for (const ids of Object.values(impact)) ids.clear()\n}\n\nfunction mergeImpact(into: SceneMutationImpact, from: SceneMutationImpact): void {\n for (const key of Object.keys(into) as (keyof SceneMutationImpact)[]) {\n for (const id of from[key]) into[key].add(id)\n }\n}\n\n/**\n * Records the graph's edits so that reading geometry lays out what they touched first, as Figma\n * does: a script that fills a child and then reads its width sees the filled width. A graph has\n * one recorder for its lifetime, kept across APIs: a script that failed before its tool laid\n * out its edits leaves them for the next read to lay out.\n */\nexport function startPendingLayout(graph: SceneGraph): void {\n if (pendingByGraph.has(graph)) return\n const pending: PendingLayout = { impact: createSceneMutationImpact(), flushing: false }\n pendingByGraph.set(graph, pending)\n // Layout's own writes are its result, not new edits.\n recordSceneMutations(graph, pending.impact, () => !pending.flushing && !graph.isApplyingLayout)\n}\n\n/** Lays out the edits recorded since the last geometry read. */\nexport function flushPendingLayout(graph: SceneGraph): void {\n // Instances lay out what their components hold now.\n flushPendingComponentSync(graph)\n const pending = pendingByGraph.get(graph)\n if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return\n const impact = structuredClone(pending.impact)\n clearImpact(pending.impact)\n pending.flushing = true\n try {\n createLayoutRunner(() => graph).runLayoutForImpact(impact)\n } catch (error) {\n // The edits are still unlaid out, so the next read tries again.\n mergeImpact(pending.impact, impact)\n throw error\n } finally {\n pending.flushing = false\n }\n}\n\n/** Whether a frame resizing would move or stretch the layer: a constraint other than left or top. */\nfunction followsFrameSize(node: SceneNode): boolean {\n return node.horizontalConstraint !== 'MIN' || node.verticalConstraint !== 'MIN'\n}\n\n/** The layer and the layers above it, up to but not including its page. */\nfunction layoutChain(graph: SceneGraph, id: string): string[] {\n const chain: string[] = []\n for (let node = graph.getNode(id); node && node.type !== 'CANVAS';) {\n chain.push(node.id)\n node = node.parentId ? graph.getNode(node.parentId) : undefined\n }\n return chain\n}\n\n/**\n * Whether laying out the recorded edits could reach the layer: an edit sits in the same frame as\n * the layer, at any depth, since a layer that grows makes every Hug frame around it grow. Edits\n * in another top-level frame share only the page with it, and leave it where it is.\n */\nfunction editsReach(graph: SceneGraph, impact: SceneMutationImpact, node: SceneNode): boolean {\n const above = new Set(layoutChain(graph, node.id))\n const edited = [...impact.changedNodeIds, ...impact.currentParentIds, ...impact.previousParentIds]\n return edited.some((id) => layoutChain(graph, id).some((current) => above.has(current)))\n}\n\n/**\n * Lays out the recorded edits before a script moves or sizes `node`, when that layout could change\n * where it lands, as Figma lays out a script's edits while it runs: the layer follows its frame's\n * size, or a resize places its children from its own size. A layer pinned left and top, or one\n * an auto layout places, lands the same either way, so its edits wait for the next read: a script\n * that builds many layers lays out once rather than once per layer.\n */\nexport function flushPendingLayoutBefore(\n graph: SceneGraph,\n node: SceneNode,\n { placesChildren = false }: { placesChildren?: boolean } = {}\n): void {\n const pending = pendingByGraph.get(graph)\n if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return\n const depends =\n followsFrameSize(node) || (placesChildren && graph.getChildren(node.id).some(followsFrameSize))\n if (depends && editsReach(graph, pending.impact, node)) flushPendingLayout(graph)\n}\n"],"mappings":";;;;AAgBA,MAAM,iCAAiB,IAAI,QAAmC;AAE9D,SAAS,YAAY,QAAmC;CACtD,KAAK,MAAM,OAAO,OAAO,OAAO,MAAM,GAAG,IAAI,MAAM;AACrD;AAEA,SAAS,YAAY,MAA2B,MAAiC;CAC/E,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAChC,KAAK,MAA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AC,MAAM,OAAO,YAAY,OAAO,EAAE,CAAC,CAAC,MAAM,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC;AACzF;;;;;;;;AASA,SAAgB,yBACd,OACA,MACA,EAAE,iBAAiB,UAAwC,CAAC,GACtD;CACN,MAAM,UAAU,eAAe,IAAI,KAAK;CACxC,IAAI,CAAC,WAAW,QAAQ,YAAY,QAAQ,OAAO,eAAe,SAAS,GAAG;CAG9E,KADE,iBAAiB,IAAI,KAAM,kBAAkB,MAAM,YAAY,KAAK,EAAE,CAAC,CAAC,KAAK,gBAAgB,MAChF,WAAW,OAAO,QAAQ,QAAQ,IAAI,GAAG,mBAAmB,KAAK;AAClF"}
1
+ {"version":3,"file":"pending-layout.js","names":[],"sources":["../../src/figma-api/pending-layout.ts"],"sourcesContent":["import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport {\n createSceneMutationImpact,\n recordSceneMutations,\n type SceneMutationImpact\n} from '@pairdraw/scene-graph/mutation-impact'\n\nimport { createLayoutRunner } from '#core/layout/mutations'\n\nimport { underlyingGraph } from './graph-ref'\nimport { flushPendingComponentSync } from './pending-sync'\n\ninterface PendingLayout {\n impact: SceneMutationImpact\n flushing: boolean\n}\n\nconst pendingByGraph = new WeakMap<SceneGraph, PendingLayout>()\n\nfunction clearImpact(impact: SceneMutationImpact): void {\n for (const ids of Object.values(impact)) ids.clear()\n}\n\nfunction mergeImpact(into: SceneMutationImpact, from: SceneMutationImpact): void {\n for (const key of Object.keys(into) as (keyof SceneMutationImpact)[]) {\n for (const id of from[key]) into[key].add(id)\n }\n}\n\n/**\n * Records the graph's edits so that reading geometry lays out what they touched first, as Figma\n * does: a script that fills a child and then reads its width sees the filled width. A graph has\n * one recorder for its lifetime, kept across APIs: a script that failed before its tool laid\n * out its edits leaves them for the next read to lay out.\n */\nexport function startPendingLayout(source: SceneGraph): void {\n const graph = underlyingGraph(source)\n if (pendingByGraph.has(graph)) return\n const pending: PendingLayout = { impact: createSceneMutationImpact(), flushing: false }\n pendingByGraph.set(graph, pending)\n // Layout's own writes are its result, not new edits.\n recordSceneMutations(graph, pending.impact, () => !pending.flushing && !graph.isApplyingLayout)\n}\n\n/** Lays out the edits recorded since the last geometry read. */\nexport function flushPendingLayout(source: SceneGraph): void {\n const graph = underlyingGraph(source)\n // Instances lay out what their components hold now.\n flushPendingComponentSync(graph)\n const pending = pendingByGraph.get(graph)\n if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return\n const impact = structuredClone(pending.impact)\n clearImpact(pending.impact)\n pending.flushing = true\n try {\n createLayoutRunner(() => graph).runLayoutForImpact(impact)\n } catch (error) {\n // The edits are still unlaid out, so the next read tries again.\n mergeImpact(pending.impact, impact)\n throw error\n } finally {\n pending.flushing = false\n }\n}\n\n/** Whether a frame resizing would move or stretch the layer: a constraint other than left or top. */\nfunction followsFrameSize(node: SceneNode): boolean {\n return node.horizontalConstraint !== 'MIN' || node.verticalConstraint !== 'MIN'\n}\n\n/** The layer and the layers above it, up to but not including its page. */\nfunction layoutChain(graph: SceneGraph, id: string): string[] {\n const chain: string[] = []\n for (let node = graph.getNode(id); node && node.type !== 'CANVAS';) {\n chain.push(node.id)\n node = node.parentId ? graph.getNode(node.parentId) : undefined\n }\n return chain\n}\n\n/**\n * Whether laying out the recorded edits could reach the layer: an edit sits in the same frame as\n * the layer, at any depth, since a layer that grows makes every Hug frame around it grow. Edits\n * in another top-level frame share only the page with it, and leave it where it is.\n */\nfunction editsReach(graph: SceneGraph, impact: SceneMutationImpact, node: SceneNode): boolean {\n const above = new Set(layoutChain(graph, node.id))\n const edited = [...impact.changedNodeIds, ...impact.currentParentIds, ...impact.previousParentIds]\n return edited.some((id) => layoutChain(graph, id).some((current) => above.has(current)))\n}\n\n/**\n * Lays out the recorded edits before a script moves or sizes `node`, when that layout could change\n * where it lands, as Figma lays out a script's edits while it runs: the layer follows its frame's\n * size, or a resize places its children from its own size. A layer pinned left and top, or one\n * an auto layout places, lands the same either way, so its edits wait for the next read: a script\n * that builds many layers lays out once rather than once per layer.\n */\nexport function flushPendingLayoutBefore(\n source: SceneGraph,\n node: SceneNode,\n { placesChildren = false }: { placesChildren?: boolean } = {}\n): void {\n const graph = underlyingGraph(source)\n const pending = pendingByGraph.get(graph)\n if (!pending || pending.flushing || pending.impact.changedNodeIds.size === 0) return\n const depends =\n followsFrameSize(node) || (placesChildren && graph.getChildren(node.id).some(followsFrameSize))\n if (depends && editsReach(graph, pending.impact, node)) flushPendingLayout(graph)\n}\n"],"mappings":";;;;;AAiBA,MAAM,iCAAiB,IAAI,QAAmC;AAE9D,SAAS,YAAY,QAAmC;CACtD,KAAK,MAAM,OAAO,OAAO,OAAO,MAAM,GAAG,IAAI,MAAM;AACrD;AAEA,SAAS,YAAY,MAA2B,MAAiC;CAC/E,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAChC,KAAK,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;AAEhD;;;;;;;AAQA,SAAgB,mBAAmB,QAA0B;CAC3D,MAAM,QAAQ,gBAAgB,MAAM;CACpC,IAAI,eAAe,IAAI,KAAK,GAAG;CAC/B,MAAM,UAAyB;EAAE,QAAQ,0BAA0B;EAAG,UAAU;CAAM;CACtF,eAAe,IAAI,OAAO,OAAO;CAEjC,qBAAqB,OAAO,QAAQ,cAAc,CAAC,QAAQ,YAAY,CAAC,MAAM,gBAAgB;AAChG;;AAGA,SAAgB,mBAAmB,QAA0B;CAC3D,MAAM,QAAQ,gBAAgB,MAAM;CAEpC,0BAA0B,KAAK;CAC/B,MAAM,UAAU,eAAe,IAAI,KAAK;CACxC,IAAI,CAAC,WAAW,QAAQ,YAAY,QAAQ,OAAO,eAAe,SAAS,GAAG;CAC9E,MAAM,SAAS,gBAAgB,QAAQ,MAAM;CAC7C,YAAY,QAAQ,MAAM;CAC1B,QAAQ,WAAW;CACnB,IAAI;EACF,yBAAyB,KAAK,CAAC,CAAC,mBAAmB,MAAM;CAC3D,SAAS,OAAO;EAEd,YAAY,QAAQ,QAAQ,MAAM;EAClC,MAAM;CACR,UAAU;EACR,QAAQ,WAAW;CACrB;AACF;;AAGA,SAAS,iBAAiB,MAA0B;CAClD,OAAO,KAAK,yBAAyB,SAAS,KAAK,uBAAuB;AAC5E;;AAGA,SAAS,YAAY,OAAmB,IAAsB;CAC5D,MAAM,QAAkB,CAAC;CACzB,KAAK,IAAI,OAAO,MAAM,QAAQ,EAAE,GAAG,QAAQ,KAAK,SAAS,WAAW;EAClE,MAAM,KAAK,KAAK,EAAE;EAClB,OAAO,KAAK,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAA;CACxD;CACA,OAAO;AACT;;;;;;AAOA,SAAS,WAAW,OAAmB,QAA6B,MAA0B;CAC5F,MAAM,QAAQ,IAAI,IAAI,YAAY,OAAO,KAAK,EAAE,CAAC;CAEjD,OAAO;EADS,GAAG,OAAO;EAAgB,GAAG,OAAO;EAAkB,GAAG,OAAO;CACpE,CAAC,CAAC,MAAM,OAAO,YAAY,OAAO,EAAE,CAAC,CAAC,MAAM,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC;AACzF;;;;;;;;AASA,SAAgB,yBACd,QACA,MACA,EAAE,iBAAiB,UAAwC,CAAC,GACtD;CACN,MAAM,QAAQ,gBAAgB,MAAM;CACpC,MAAM,UAAU,eAAe,IAAI,KAAK;CACxC,IAAI,CAAC,WAAW,QAAQ,YAAY,QAAQ,OAAO,eAAe,SAAS,GAAG;CAG9E,KADE,iBAAiB,IAAI,KAAM,kBAAkB,MAAM,YAAY,KAAK,EAAE,CAAC,CAAC,KAAK,gBAAgB,MAChF,WAAW,OAAO,QAAQ,QAAQ,IAAI,GAAG,mBAAmB,KAAK;AAClF"}
@@ -13,7 +13,7 @@ declare function startPendingComponentSync(graph: SceneGraph, flush?: () => void
13
13
  * read or written, only when it is in an instance, as only those layers change. Edits inside a
14
14
  * component then sync once, when an instance is next read, not once per edit.
15
15
  */
16
- declare function flushPendingComponentSync(graph: SceneGraph, layerId?: string): void;
16
+ declare function flushPendingComponentSync(source: SceneGraph, layerId?: string): void;
17
17
  //#endregion
18
18
  export { flushPendingComponentSync, startPendingComponentSync };
19
19
  //# sourceMappingURL=pending-sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pending-sync.d.ts","names":[],"sources":["../../src/figma-api/pending-sync.ts"],"mappings":";;;;;;;;;iBAiBgB,0BAA0B,OAAO,YAAY;;;;;;iBAsC7C,0BAA0B,OAAO,YAAY"}
1
+ {"version":3,"file":"pending-sync.d.ts","names":[],"sources":["../../src/figma-api/pending-sync.ts"],"mappings":";;;;;;;;;iBAmBgB,0BAA0B,OAAO,YAAY;;;;;;iBAsC7C,0BAA0B,QAAQ,YAAY"}
@@ -1,4 +1,5 @@
1
1
  import { syncComponentsHolding } from "../editor/component-sync.js";
2
+ import { underlyingGraph } from "./graph-ref.js";
2
3
  import { createSceneMutationImpact, recordSceneMutations } from "@pairdraw/scene-graph/mutation-impact";
3
4
  //#region src/figma-api/pending-sync.ts
4
5
  const syncByGraph = /* @__PURE__ */ new WeakMap();
@@ -40,7 +41,8 @@ function startPendingComponentSync(graph, flush) {
40
41
  * read or written, only when it is in an instance, as only those layers change. Edits inside a
41
42
  * component then sync once, when an instance is next read, not once per edit.
42
43
  */
43
- function flushPendingComponentSync(graph, layerId) {
44
+ function flushPendingComponentSync(source, layerId) {
45
+ const graph = underlyingGraph(source);
44
46
  const flush = syncByGraph.get(graph);
45
47
  if (!flush) return;
46
48
  if (layerId !== void 0 && !graph.closest(layerId, (node) => node.type === "INSTANCE")) return;
@@ -1 +1 @@
1
- {"version":3,"file":"pending-sync.js","names":[],"sources":["../../src/figma-api/pending-sync.ts"],"sourcesContent":["import type { SceneGraph } from '@pairdraw/scene-graph'\nimport {\n createSceneMutationImpact,\n recordSceneMutations\n} from '@pairdraw/scene-graph/mutation-impact'\n\nimport { syncComponentsHolding } from '#core/editor/component-sync'\n\nconst syncByGraph = new WeakMap<SceneGraph, () => void>()\n\n/**\n * Makes reading a layer bring instances in line with the component edits made before it, as Figma\n * does at once: a script that recolors a component and then reads an instance sees the new color.\n * A host that already syncs instances after edits, such as the editor, passes its own `flush`,\n * which also lays out and redraws what it synced. Without one the graph records its edits itself,\n * for its lifetime, as `startPendingLayout` does.\n */\nexport function startPendingComponentSync(graph: SceneGraph, flush?: () => void): void {\n if (flush) {\n syncByGraph.set(graph, flush)\n return\n }\n if (syncByGraph.has(graph)) return\n const impact = createSceneMutationImpact()\n let syncing = false\n // Syncing writes the instances it updates, which are results, not edits; so do loading and layout.\n recordSceneMutations(\n graph,\n impact,\n () => !syncing && !graph.isApplyingImportedState && !graph.isApplyingLayout\n )\n syncByGraph.set(graph, () => {\n if (syncing || impact.changedNodeIds.size === 0) return\n const changed = [...impact.changedNodeIds]\n const leftParents = [...impact.previousParentIds]\n for (const recorded of Object.values(impact)) recorded.clear()\n syncing = true\n try {\n syncComponentsHolding(graph, [...changed, ...leftParents])\n } catch (error) {\n // The edits are still unsynced, so the next read tries again, as pending layout does.\n for (const id of changed) impact.changedNodeIds.add(id)\n for (const id of leftParents) impact.previousParentIds.add(id)\n throw error\n } finally {\n syncing = false\n }\n })\n}\n\n/**\n * Syncs the instances of the components edited since, before a read; given the layer about to be\n * read or written, only when it is in an instance, as only those layers change. Edits inside a\n * component then sync once, when an instance is next read, not once per edit.\n */\nexport function flushPendingComponentSync(graph: SceneGraph, layerId?: string): void {\n const flush = syncByGraph.get(graph)\n if (!flush) return\n if (layerId !== undefined && !graph.closest(layerId, (node) => node.type === 'INSTANCE')) return\n flush()\n}\n"],"mappings":";;;AAQA,MAAM,8BAAc,IAAI,QAAgC;;;;;;;;AASxD,SAAgB,0BAA0B,OAAmB,OAA0B;CACrF,IAAI,OAAO;EACT,YAAY,IAAI,OAAO,KAAK;EAC5B;CACF;CACA,IAAI,YAAY,IAAI,KAAK,GAAG;CAC5B,MAAM,SAAS,0BAA0B;CACzC,IAAI,UAAU;CAEd,qBACE,OACA,cACM,CAAC,WAAW,CAAC,MAAM,2BAA2B,CAAC,MAAM,gBAC7D;CACA,YAAY,IAAI,aAAa;EAC3B,IAAI,WAAW,OAAO,eAAe,SAAS,GAAG;EACjD,MAAM,UAAU,CAAC,GAAG,OAAO,cAAc;EACzC,MAAM,cAAc,CAAC,GAAG,OAAO,iBAAiB;EAChD,KAAK,MAAM,YAAY,OAAO,OAAO,MAAM,GAAG,SAAS,MAAM;EAC7D,UAAU;EACV,IAAI;GACF,sBAAsB,OAAO,CAAC,GAAG,SAAS,GAAG,WAAW,CAAC;EAC3D,SAAS,OAAO;GAEd,KAAK,MAAM,MAAM,SAAS,OAAO,eAAe,IAAI,EAAE;GACtD,KAAK,MAAM,MAAM,aAAa,OAAO,kBAAkB,IAAI,EAAE;GAC7D,MAAM;EACR,UAAU;GACR,UAAU;EACZ;CACF,CAAC;AACH;;;;;;AAOA,SAAgB,0BAA0B,OAAmB,SAAwB;CACnF,MAAM,QAAQ,YAAY,IAAI,KAAK;CACnC,IAAI,CAAC,OAAO;CACZ,IAAI,YAAY,KAAA,KAAa,CAAC,MAAM,QAAQ,UAAU,SAAS,KAAK,SAAS,UAAU,GAAG;CAC1F,MAAM;AACR"}
1
+ {"version":3,"file":"pending-sync.js","names":[],"sources":["../../src/figma-api/pending-sync.ts"],"sourcesContent":["import type { SceneGraph } from '@pairdraw/scene-graph'\nimport {\n createSceneMutationImpact,\n recordSceneMutations\n} from '@pairdraw/scene-graph/mutation-impact'\n\nimport { syncComponentsHolding } from '#core/editor/component-sync'\n\nimport { underlyingGraph } from './graph-ref'\n\nconst syncByGraph = new WeakMap<SceneGraph, () => void>()\n\n/**\n * Makes reading a layer bring instances in line with the component edits made before it, as Figma\n * does at once: a script that recolors a component and then reads an instance sees the new color.\n * A host that already syncs instances after edits, such as the editor, passes its own `flush`,\n * which also lays out and redraws what it synced. Without one the graph records its edits itself,\n * for its lifetime, as `startPendingLayout` does.\n */\nexport function startPendingComponentSync(graph: SceneGraph, flush?: () => void): void {\n if (flush) {\n syncByGraph.set(graph, flush)\n return\n }\n if (syncByGraph.has(graph)) return\n const impact = createSceneMutationImpact()\n let syncing = false\n // Syncing writes the instances it updates, which are results, not edits; so do loading and layout.\n recordSceneMutations(\n graph,\n impact,\n () => !syncing && !graph.isApplyingImportedState && !graph.isApplyingLayout\n )\n syncByGraph.set(graph, () => {\n if (syncing || impact.changedNodeIds.size === 0) return\n const changed = [...impact.changedNodeIds]\n const leftParents = [...impact.previousParentIds]\n for (const recorded of Object.values(impact)) recorded.clear()\n syncing = true\n try {\n syncComponentsHolding(graph, [...changed, ...leftParents])\n } catch (error) {\n // The edits are still unsynced, so the next read tries again, as pending layout does.\n for (const id of changed) impact.changedNodeIds.add(id)\n for (const id of leftParents) impact.previousParentIds.add(id)\n throw error\n } finally {\n syncing = false\n }\n })\n}\n\n/**\n * Syncs the instances of the components edited since, before a read; given the layer about to be\n * read or written, only when it is in an instance, as only those layers change. Edits inside a\n * component then sync once, when an instance is next read, not once per edit.\n */\nexport function flushPendingComponentSync(source: SceneGraph, layerId?: string): void {\n const graph = underlyingGraph(source)\n const flush = syncByGraph.get(graph)\n if (!flush) return\n if (layerId !== undefined && !graph.closest(layerId, (node) => node.type === 'INSTANCE')) return\n flush()\n}\n"],"mappings":";;;;AAUA,MAAM,8BAAc,IAAI,QAAgC;;;;;;;;AASxD,SAAgB,0BAA0B,OAAmB,OAA0B;CACrF,IAAI,OAAO;EACT,YAAY,IAAI,OAAO,KAAK;EAC5B;CACF;CACA,IAAI,YAAY,IAAI,KAAK,GAAG;CAC5B,MAAM,SAAS,0BAA0B;CACzC,IAAI,UAAU;CAEd,qBACE,OACA,cACM,CAAC,WAAW,CAAC,MAAM,2BAA2B,CAAC,MAAM,gBAC7D;CACA,YAAY,IAAI,aAAa;EAC3B,IAAI,WAAW,OAAO,eAAe,SAAS,GAAG;EACjD,MAAM,UAAU,CAAC,GAAG,OAAO,cAAc;EACzC,MAAM,cAAc,CAAC,GAAG,OAAO,iBAAiB;EAChD,KAAK,MAAM,YAAY,OAAO,OAAO,MAAM,GAAG,SAAS,MAAM;EAC7D,UAAU;EACV,IAAI;GACF,sBAAsB,OAAO,CAAC,GAAG,SAAS,GAAG,WAAW,CAAC;EAC3D,SAAS,OAAO;GAEd,KAAK,MAAM,MAAM,SAAS,OAAO,eAAe,IAAI,EAAE;GACtD,KAAK,MAAM,MAAM,aAAa,OAAO,kBAAkB,IAAI,EAAE;GAC7D,MAAM;EACR,UAAU;GACR,UAAU;EACZ;CACF,CAAC;AACH;;;;;;AAOA,SAAgB,0BAA0B,QAAoB,SAAwB;CACpF,MAAM,QAAQ,gBAAgB,MAAM;CACpC,MAAM,QAAQ,YAAY,IAAI,KAAK;CACnC,IAAI,CAAC,OAAO;CACZ,IAAI,YAAY,KAAA,KAAa,CAAC,MAAM,QAAQ,UAAU,SAAS,KAAK,SAAS,UAAU,GAAG;CAC1F,MAAM;AACR"}
@@ -12,7 +12,7 @@ import { FigmaInstanceOverride } from "./overrides.js";
12
12
  import { PluginDataMethods } from "./plugin-data.js";
13
13
  import { FigmaReaction } from "./reactions.js";
14
14
  import { FigmaFrameNode, FigmaInstanceNode } from "./node-types.js";
15
- import { ArcData, HyperlinkTarget, LayoutGrid, LayoutMode, NodeType, SceneGraph, SceneNode } from "@pairdraw/scene-graph";
15
+ import { ArcData, HyperlinkTarget, LayoutGrid, LayoutMode, NodeType, OverflowDirection, SceneGraph, SceneNode, ScrollBehavior } from "@pairdraw/scene-graph";
16
16
  import { ShapeWithTextType } from "@pairdraw/scene-graph/shape-with-text";
17
17
  import { GroupFitOptions } from "@pairdraw/scene-graph/group-bounds";
18
18
  import { Rect, Vector } from "@pairdraw/scene-graph/primitives";
@@ -66,6 +66,8 @@ declare class FigmaNodeProxy {
66
66
  devStatus: FigmaDevStatusValue | undefined;
67
67
  blendMode: string;
68
68
  clipsContent: boolean;
69
+ overflowDirection: OverflowDirection;
70
+ scrollBehavior: ScrollBehavior;
69
71
  cornerRadius: number | typeof MIXED;
70
72
  topLeftRadius: number;
71
73
  topRightRadius: number;
@@ -161,6 +163,7 @@ declare class FigmaNodeProxy {
161
163
  textStyleId: string | symbol;
162
164
  fillStyleId: string | symbol;
163
165
  textDecoration: SceneNode['textDecoration'] | symbol;
166
+ readonly openTypeFeatures: Record<string, boolean> | symbol;
164
167
  maxLines: number | null;
165
168
  listSpacing: number | symbol;
166
169
  paragraphSpacing: number | symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","names":[],"sources":["../../src/figma-api/proxy.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cA0DM;cAIO;cACA;cACA;;UAGI;EACf,OAAO,mBAAmB;EAC1B,cAAc,mBAAmB;;iBASnB,YAAY,KAAK,eAAe,MAAM;iBAItC,SAAS,KAAK,eAAe,iBAAiB;;iBAK9C,WAAW,KAAK,eAAe,iBAAiB;UAI/C;EACf,SAAS,aAAa;WACb;;WAEA,iBAAiB;;cAgBf;GACV;GACA,iBAAiB;GACjB,eAAe;WAEC;;WAEA,MAAM;EACf;WACS;EACT;EACA;WACS;WACA;EACT;EACA,mBAAmB;EACnB,SAAS,eAAe;EACxB,2BAA2B,eAAe;EAC1C,UAAU;WACD,mBAAmB;WACnB,qBAAqB;WACrB,sBAAsB;EAE/B,gBAAgB;EAChB,kBAAkB;EAClB,kBAAkB;EAClB;EACA;EACA;EACA,WAAW;EACX;EACA;EACA,8BAA8B;EAC9B;EACA;EACA;EACA;EACA;EAEA,YAAY;EACZ,sBAAsB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;IAAe;IAAoB;;EACnC;EACA;EACA;EACA;WACS,mBAAmB;;EAE5B;EACA;EACA;EACA;EACA;EACA,SAAS,SAAS;EAClB,sBAAsB;EACtB,eAAe;EACf,wBAAwB,eAAe,uBAAuB;EAC9D,iBAAiB,sCAAsC;EACvD,eAAe;EACf,eAAe;EACf,mBAAmB;EACnB,qBAAqB;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AAS;MAOT;MAIA,SAAS;MAMT,wBAAwB;MAUxB,YAAY,gBAAgB;;EAM1B,yBAAyB,QAAQ;MAInC,iBAAiB;EAQrB,kBAAkB;;EAWlB,kBAAkB;;EAUlB,cAAc,WAAW;MAWrB,UAAU;MAMV,YAAY;EAOhB,YAAY,OAAO;;;;;UAiBX;EAaR,YAAY,eAAe,OAAO;EAclC,SAAS;EAgBT;EAWA,QAAQ,YAAY,MAAM,6BAA6B;EAIvD,QAAQ,WAAW,MAAM,6BAA6B;EAItD,UAAU,WAAW,MAAM,6BAA6B;EASxD,aAAa,YAAY,MAAM,6BAA6B;EAS5D,oBAAoB;IAAY;MAAqB;EAWrD,OAAO,mBAAmB,wBAAmB;EAU7C"}
1
+ {"version":3,"file":"proxy.d.ts","names":[],"sources":["../../src/figma-api/proxy.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cA6DM;cAIO;cACA;cACA;;UAGI;EACf,OAAO,mBAAmB;EAC1B,cAAc,mBAAmB;;iBASnB,YAAY,KAAK,eAAe,MAAM;iBAItC,SAAS,KAAK,eAAe,iBAAiB;;iBAK9C,WAAW,KAAK,eAAe,iBAAiB;UAI/C;EACf,SAAS,aAAa;WACb;;WAEA,iBAAiB;;cAgBf;GACV;GACA,iBAAiB;GACjB,eAAe;WAEC;;WAEA,MAAM;EACf;WACS;EACT;EACA;WACS;WACA;EACT;EACA,mBAAmB;EACnB,SAAS,eAAe;EACxB,2BAA2B,eAAe;EAC1C,UAAU;WACD,mBAAmB;WACnB,qBAAqB;WACrB,sBAAsB;EAE/B,gBAAgB;EAChB,kBAAkB;EAClB,kBAAkB;EAClB;EACA;EACA;EACA,WAAW;EACX;EACA;EACA,mBAAmB;EACnB,gBAAgB;EAChB,8BAA8B;EAC9B;EACA;EACA;EACA;EACA;EAEA,YAAY;EACZ,sBAAsB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;IA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B,qBAAqB;EACrB,0BAA0B;EAC1B,qBAAqB;EACrB,qBAAqB;EACrB,0BAA0B;EAC1B,uBAAuB;EACvB,uBAAuB;EAEnB,YAAA,YAAY,OAAO,YAAY,KAAK;UAcxC;UAQA;EAOR,iBACE,eACA,oBACA,WAAU;EAKZ,iBAAiB,eAAe;MAI5B;MAIA,OAAO;MAOP;MAIA,SAAS;MAOT;MAIA,SAAS;MAMT,wBAAwB;MAUxB,YAAY,gBAAgB;;EAM1B,yBAAyB,QAAQ;MAInC,iBAAiB;EAQrB,kBAAkB;;EAWlB,kBAAkB;;EAUlB,cAAc,WAAW;MAWrB,UAAU;MAMV,YAAY;EAOhB,YAAY,OAAO;;;;;UAiBX;EAaR,YAAY,eAAe,OAAO;EAclC,SAAS;EAgBT;EAWA,QAAQ,YAAY,MAAM,6BAA6B;EAIvD,QAAQ,WAAW,MAAM,6BAA6B;EAItD,UAAU,WAAW,MAAM,6BAA6B;EASxD,aAAa,YAAY,MAAM,6BAA6B;EAS5D,oBAAoB;IAAY;MAAqB;EAWrD,OAAO,mBAAmB,wBAAmB;EAU7C"}
@@ -1,6 +1,7 @@
1
1
  import { getPageBackgrounds, setPageBackgrounds } from "./page-backgrounds.js";
2
2
  import { assertNodeEditable } from "../editor/capabilities.js";
3
3
  import { parseFigmaPaints, toFigmaPaint } from "./paints.js";
4
+ import { underlyingGraph } from "./graph-ref.js";
4
5
  import { flushPendingComponentSync } from "./pending-sync.js";
5
6
  import { fitGroupsAround, prepareFollowedFieldEdit } from "./accessor-utils.js";
6
7
  import { installInstanceOverrideAccessors } from "./overrides.js";
@@ -58,7 +59,7 @@ var FigmaNodeProxy = class {
58
59
  [INTERNAL_API];
59
60
  constructor(id, graph, api) {
60
61
  this[INTERNAL_ID] = id;
61
- this[INTERNAL_GRAPH] = graph;
62
+ this[INTERNAL_GRAPH] = underlyingGraph(graph);
62
63
  this[INTERNAL_API] = api;
63
64
  const type = graph.getNode(id)?.type;
64
65
  const internals = {
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","names":["Traversal.findAll","Traversal.findOne","Traversal.findChild","Traversal.findChildren","Traversal.findAllWithCriteria"],"sources":["../../src/figma-api/proxy.ts"],"sourcesContent":["import type {\n ArcData,\n HyperlinkTarget,\n SceneGraph,\n SceneNode,\n NodeType,\n LayoutGrid,\n LayoutMode\n} from '@pairdraw/scene-graph'\nimport { attachedConnectors } from '@pairdraw/scene-graph/connectors'\nimport type { GroupFitOptions } from '@pairdraw/scene-graph/group-bounds'\nimport { createsComponentCycle, recordInstanceOverride } from '@pairdraw/scene-graph/instances'\nimport type { Rect, Vector } from '@pairdraw/scene-graph/primitives'\nimport type { ShapeWithTextType } from '@pairdraw/scene-graph/shape-with-text'\nimport { slotPropertyId } from '@pairdraw/scene-graph/slots'\n\nimport { assertNodeEditable } from '#core/editor/capabilities'\nimport type { FigmaEffect } from '#core/figma-api/effects'\n\nimport { prepareFollowedFieldEdit, fitGroupsAround } from './accessor-utils'\nimport { installBasicNodeProxyAccessors } from './accessors/basic'\nimport { installConnectorNodeProxyAccessors } from './accessors/connector'\nimport { installLayoutNodeProxyAccessors } from './accessors/layout'\nimport { installReactionAccessors } from './accessors/reactions'\nimport { installShapeNodeProxyAccessors } from './accessors/shape'\nimport { installStickyNodeProxyAccessors, pluginChildren } from './accessors/sticky'\nimport { installStrokeNodeProxyAccessors } from './accessors/strokes'\nimport { installTextNodeProxyAccessors } from './accessors/text'\nimport { installTextRangeMethods, type TextRangeMethods } from './accessors/text/ranges'\nimport {\n installVariableModeNodeProxyAccessors,\n type VariableNodeMembers\n} from './accessors/variables'\nimport {\n installVectorNodeProxyAccessors,\n type FigmaVectorNetwork,\n type FigmaVectorPath\n} from './accessors/vector'\nimport { installVisualNodeProxyAccessors } from './accessors/visual'\nimport { installComponentPropertyAccessors } from './components'\nimport { installDevStatusAccessors, type FigmaDevStatusValue } from './dev-status'\nimport type { FigmaFontName } from './fonts/names'\nimport type { FigmaFrameNode, FigmaInstanceNode } from './node-types'\nimport { installInstanceOverrideAccessors, type FigmaInstanceOverride } from './overrides'\nimport { getPageBackgrounds, setPageBackgrounds } from './page-backgrounds'\nimport { parseFigmaPaints, toFigmaPaint, type FigmaPaint } from './paints'\nimport { flushPendingComponentSync } from './pending-sync'\nimport { installPluginDataMethods, type PluginDataMethods } from './plugin-data'\nimport type { FigmaReaction } from './reactions'\nimport { nodeProxyToJSON } from './serialization'\nimport { installShapeWithTextAccessors } from './shape-with-text'\nimport { installSlotAccessors, prepareSlotMove, prepareSlotRemoval } from './slots'\nimport type { FigmaLetterSpacing, FigmaLineHeight } from './text'\nimport * as TextProxy from './text'\nimport { containerTransform, setContainerTransform } from './transform'\nimport * as Traversal from './traversal'\nimport type { FigmaTransform } from './types'\n\nconst MIXED = Symbol('mixed')\n\nexport type { FigmaFont, FigmaFontName } from './fonts/names'\n\nexport const INTERNAL_ID = Symbol('id')\nexport const INTERNAL_GRAPH = Symbol('graph')\nexport const INTERNAL_API = Symbol('api')\n\n/** How a host loads pages as they are visited; see `FigmaAPIOptions`. */\nexport interface PageHost {\n load: (pageId: string) => Promise<void>\n pageOfNode?: (nodeId: string) => Promise<string | null>\n}\n\n/**\n * How each API loads a page's layers, a host's hook kept off `figma`, which has only Figma's\n * members. Without one every page is in memory.\n */\nconst pageHosts = new WeakMap<NodeProxyHost, PageHost>()\n\nexport function setPageHost(api: NodeProxyHost, host: PageHost): void {\n pageHosts.set(api, host)\n}\n\nexport function loadPage(api: NodeProxyHost, pageId: string): Promise<void> {\n return pageHosts.get(api)?.load(pageId) ?? Promise.resolve()\n}\n\n/** The page holding a layer not loaded yet, which loading that page brings in. */\nexport function pageOfNode(api: NodeProxyHost, nodeId: string): Promise<string | null> {\n return pageHosts.get(api)?.pageOfNode?.(nodeId) ?? Promise.resolve(null)\n}\n\nexport interface NodeProxyHost {\n wrapNode(id: string): FigmaNodeProxy\n readonly currentPageId: string\n /** How groups and booleans refit; booleans size to their result when a renderer is attached. */\n readonly groupFitOptions: GroupFitOptions\n}\n\nexport { MIXED }\n\n/** Figma refuses a move that would make a component contain itself. */\nfunction assertNoComponentCycle(\n graph: SceneGraph,\n parentId: string,\n childId: string,\n method: 'appendChild' | 'insertChild'\n): void {\n if (createsComponentCycle(graph, childId, parentId))\n throw new Error(`in ${method}: Cannot move node. Reparenting would create a component cycle`)\n}\n\nexport class FigmaNodeProxy {\n [INTERNAL_ID]: string;\n [INTERNAL_GRAPH]: SceneGraph;\n [INTERNAL_API]: NodeProxyHost\n\n declare readonly id: string\n /** A slot frame reads as `'SLOT'`, as Figma's `SlotNode` does. */\n declare readonly type: NodeType | 'SLOT'\n declare name: string\n declare readonly removed: boolean\n declare x: number\n declare y: number\n declare readonly width: number\n declare readonly height: number\n declare rotation: number\n declare relativeTransform: FigmaTransform\n declare resize: (width: number, height: number) => void\n declare resizeWithoutConstraints: (width: number, height: number) => void\n declare rescale: (scale: number) => void\n declare readonly absoluteTransform: FigmaTransform\n declare readonly absoluteBoundingBox: Rect\n declare readonly absoluteRenderBounds: Rect | null\n\n declare fills: readonly FigmaPaint[] | symbol\n declare strokes: readonly FigmaPaint[]\n declare effects: readonly FigmaEffect[]\n declare opacity: number\n declare visible: boolean\n declare locked: boolean\n declare devStatus: FigmaDevStatusValue | undefined\n declare blendMode: string\n declare clipsContent: boolean\n declare cornerRadius: number | typeof MIXED\n declare topLeftRadius: number\n declare topRightRadius: number\n declare bottomLeftRadius: number\n declare bottomRightRadius: number\n declare cornerSmoothing: number\n\n declare layoutMode: LayoutMode\n declare layoutGrids: readonly LayoutGrid[]\n declare primaryAxisAlignItems: string\n declare counterAxisAlignItems: string\n declare itemSpacing: number\n declare counterAxisSpacing: number\n declare paddingTop: number\n declare paddingRight: number\n declare paddingBottom: number\n declare paddingLeft: number\n declare layoutWrap: string\n declare primaryAxisSizingMode: string\n declare counterAxisSizingMode: string\n declare counterAxisAlignContent: string\n declare itemReverseZIndex: boolean\n declare strokesIncludedInLayout: boolean\n declare layoutPositioning: string\n declare layoutGrow: number\n declare layoutAlign: string\n declare layoutSizingHorizontal: string\n declare layoutSizingVertical: string\n declare constraints: { horizontal: string; vertical: string }\n declare minWidth: number | null\n declare maxWidth: number | null\n declare minHeight: number | null\n declare maxHeight: number | null\n declare readonly targetAspectRatio: Vector | null\n /** @deprecated Figma's alias for whether `targetAspectRatio` is set. */\n declare constrainProportions: boolean\n declare lockAspectRatio: () => void\n declare unlockAspectRatio: () => void\n declare pointCount: number\n declare innerRadius: number\n declare arcData: Readonly<ArcData>\n declare vectorPaths: readonly FigmaVectorPath[]\n declare vectorNetwork: FigmaVectorNetwork\n declare setVectorNetworkAsync: (vectorNetwork: FigmaVectorNetwork) => Promise<void>\n declare handleMirroring: SceneNode['handleMirroring'] | typeof MIXED\n declare getPluginData: PluginDataMethods['getPluginData']\n declare setPluginData: PluginDataMethods['setPluginData']\n declare getPluginDataKeys: PluginDataMethods['getPluginDataKeys']\n declare getSharedPluginData: PluginDataMethods['getSharedPluginData']\n declare setSharedPluginData: PluginDataMethods['setSharedPluginData']\n declare getSharedPluginDataKeys: PluginDataMethods['getSharedPluginDataKeys']\n declare readonly explicitVariableModes: VariableNodeMembers['explicitVariableModes']\n declare readonly resolvedVariableModes: VariableNodeMembers['resolvedVariableModes']\n declare setExplicitVariableModeForCollection: VariableNodeMembers['setExplicitVariableModeForCollection']\n declare clearExplicitVariableModeForCollection: VariableNodeMembers['clearExplicitVariableModeForCollection']\n declare readonly boundVariables: VariableNodeMembers['boundVariables']\n declare setBoundVariable: VariableNodeMembers['setBoundVariable']\n declare readonly overrides: FigmaInstanceOverride[] | undefined\n /** Prototype connections, in Figma's plugin shape; refused when the play cannot run them. */\n declare reactions: readonly FigmaReaction[]\n /** A sticky note's body or a shape's label, a sticky's author line, and whether it is wide. */\n declare readonly text: FigmaNodeProxy | undefined\n declare readonly authorName: string | undefined\n declare authorVisible: boolean | undefined\n declare isWideWidth: boolean | undefined\n declare shapeType: ShapeWithTextType | undefined\n /** On pages alone, as in Figma. */\n declare loadAsync: () => Promise<void>\n declare resetOverrides: () => void\n\n declare strokeWeight: number\n declare strokeAlign: string\n declare dashPattern: readonly number[]\n declare strokeCap: string\n declare strokeJoin: string\n declare strokeMiterLimit: number\n declare strokeTopWeight: number\n declare strokeBottomWeight: number\n declare strokeLeftWeight: number\n declare strokeRightWeight: number\n\n declare characters: string\n declare fontSize: number | symbol\n declare fontName: FigmaFontName | symbol\n declare fontWeight: number | symbol\n declare textAlignHorizontal: string\n declare textAlignVertical: string\n declare textAutoResize: string\n declare letterSpacing: FigmaLetterSpacing | symbol\n declare lineHeight: FigmaLineHeight | symbol\n declare textCase: SceneNode['textCase'] | symbol\n declare hyperlink: HyperlinkTarget | null | symbol\n declare textStyleId: string | symbol\n declare fillStyleId: string | symbol\n declare textDecoration: SceneNode['textDecoration'] | symbol\n declare maxLines: number | null\n declare listSpacing: number | symbol\n declare paragraphSpacing: number | symbol\n declare paragraphIndent: number | symbol\n declare hangingList: boolean\n declare textTruncation: string\n declare autoRename: boolean\n\n // Per-character and per-paragraph methods: accessors/text/ranges.ts.\n declare getStyledTextSegments: TextRangeMethods['getStyledTextSegments']\n declare getRangeAllFontNames: TextRangeMethods['getRangeAllFontNames']\n declare getRangeFontSize: TextRangeMethods['getRangeFontSize']\n declare setRangeFontSize: TextRangeMethods['setRangeFontSize']\n declare getRangeFontName: TextRangeMethods['getRangeFontName']\n declare setRangeFontName: TextRangeMethods['setRangeFontName']\n declare getRangeFontWeight: TextRangeMethods['getRangeFontWeight']\n declare getRangeFills: TextRangeMethods['getRangeFills']\n declare setRangeFills: TextRangeMethods['setRangeFills']\n declare getRangeLetterSpacing: TextRangeMethods['getRangeLetterSpacing']\n declare setRangeLetterSpacing: TextRangeMethods['setRangeLetterSpacing']\n declare getRangeLineHeight: TextRangeMethods['getRangeLineHeight']\n declare setRangeLineHeight: TextRangeMethods['setRangeLineHeight']\n declare getRangeTextDecoration: TextRangeMethods['getRangeTextDecoration']\n declare setRangeTextDecoration: TextRangeMethods['setRangeTextDecoration']\n declare getRangeTextDecorationStyle: TextRangeMethods['getRangeTextDecorationStyle']\n declare setRangeTextDecorationStyle: TextRangeMethods['setRangeTextDecorationStyle']\n declare getRangeTextDecorationOffset: TextRangeMethods['getRangeTextDecorationOffset']\n declare setRangeTextDecorationOffset: TextRangeMethods['setRangeTextDecorationOffset']\n declare getRangeTextDecorationThickness: TextRangeMethods['getRangeTextDecorationThickness']\n declare setRangeTextDecorationThickness: TextRangeMethods['setRangeTextDecorationThickness']\n declare getRangeTextDecorationColor: TextRangeMethods['getRangeTextDecorationColor']\n declare setRangeTextDecorationColor: TextRangeMethods['setRangeTextDecorationColor']\n declare getRangeTextDecorationSkipInk: TextRangeMethods['getRangeTextDecorationSkipInk']\n declare setRangeTextDecorationSkipInk: TextRangeMethods['setRangeTextDecorationSkipInk']\n declare getRangeOpenTypeFeatures: TextRangeMethods['getRangeOpenTypeFeatures']\n declare getRangeListOptions: TextRangeMethods['getRangeListOptions']\n declare setRangeListOptions: TextRangeMethods['setRangeListOptions']\n declare getRangeIndentation: TextRangeMethods['getRangeIndentation']\n declare setRangeIndentation: TextRangeMethods['setRangeIndentation']\n declare getRangeListSpacing: TextRangeMethods['getRangeListSpacing']\n declare setRangeListSpacing: TextRangeMethods['setRangeListSpacing']\n declare getRangeParagraphSpacing: TextRangeMethods['getRangeParagraphSpacing']\n declare setRangeParagraphSpacing: TextRangeMethods['setRangeParagraphSpacing']\n declare getRangeParagraphIndent: TextRangeMethods['getRangeParagraphIndent']\n declare setRangeParagraphIndent: TextRangeMethods['setRangeParagraphIndent']\n declare getRangeTextCase: TextRangeMethods['getRangeTextCase']\n declare setRangeTextCase: TextRangeMethods['setRangeTextCase']\n declare getRangeHyperlink: TextRangeMethods['getRangeHyperlink']\n declare setRangeHyperlink: TextRangeMethods['setRangeHyperlink']\n declare getRangeTextStyleId: TextRangeMethods['getRangeTextStyleId']\n declare setRangeTextStyleId: TextRangeMethods['setRangeTextStyleId']\n declare setRangeTextStyleIdAsync: TextRangeMethods['setRangeTextStyleIdAsync']\n declare getRangeFillStyleId: TextRangeMethods['getRangeFillStyleId']\n declare setRangeFillStyleId: TextRangeMethods['setRangeFillStyleId']\n declare setRangeFillStyleIdAsync: TextRangeMethods['setRangeFillStyleIdAsync']\n declare getRangeBoundVariable: TextRangeMethods['getRangeBoundVariable']\n declare setRangeBoundVariable: TextRangeMethods['setRangeBoundVariable']\n\n constructor(id: string, graph: SceneGraph, api: NodeProxyHost) {\n this[INTERNAL_ID] = id\n this[INTERNAL_GRAPH] = graph\n this[INTERNAL_API] = api\n const type = graph.getNode(id)?.type\n const internals = { id: INTERNAL_ID, graph: INTERNAL_GRAPH, api: INTERNAL_API }\n if (type === 'VECTOR') installVectorNodeProxyAccessors(this, internals, MIXED)\n if (type) installShapeNodeProxyAccessors(this, internals, type)\n // Figma loads a page's layers on demand in dynamic-page mode and has `loadAsync` on pages\n // alone, as the editor loads a page's layers when it is first visited.\n if (type === 'CANVAS')\n Object.defineProperty(this, 'loadAsync', { value: () => loadPage(api, id) })\n }\n\n private _update(changes: Partial<SceneNode>): void {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n const graph = this[INTERNAL_GRAPH]\n const id = this[INTERNAL_ID]\n graph.updateNode(id, changes)\n recordInstanceOverride(graph, id, Object.keys(changes))\n }\n\n private _raw(): SceneNode {\n flushPendingComponentSync(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n const n = this[INTERNAL_GRAPH].getNode(this[INTERNAL_ID])\n if (!n) throw new Error(`Node ${this[INTERNAL_ID]} has been removed`)\n return n\n }\n\n insertCharacters(\n start: number,\n characters: string,\n useStyle: TextProxy.InsertStyleSource = 'BEFORE'\n ): void {\n TextProxy.insertCharacters(this[INTERNAL_GRAPH], this._raw(), start, characters, useStyle)\n }\n\n deleteCharacters(start: number, end: number): void {\n TextProxy.deleteCharacters(this[INTERNAL_GRAPH], this._raw(), start, end)\n }\n\n get isMask(): boolean {\n return this._raw().isMask\n }\n\n set isMask(v: boolean) {\n prepareFollowedFieldEdit(this[INTERNAL_GRAPH], this._raw(), 'isMask', 'is-mask')\n this._update({ isMask: v })\n // A mask limits what its group spans.\n fitGroupsAround(this[INTERNAL_GRAPH], this._raw().parentId, this[INTERNAL_API].groupFitOptions)\n }\n\n get maskType(): string {\n return this._raw().maskType\n }\n\n set maskType(v: string) {\n prepareFollowedFieldEdit(this[INTERNAL_GRAPH], this._raw(), 'maskType', 'mask-type')\n this._update({ maskType: v as SceneNode['maskType'] })\n }\n\n // --- UI state ---\n\n get expanded(): boolean {\n return this._raw().expanded\n }\n\n set expanded(v: boolean) {\n this._update({ expanded: v })\n }\n\n // --- Components ---\n\n get backgrounds(): readonly FigmaPaint[] {\n // A page draws its background colour's alpha times the paint's opacity, which Figma reads as\n // the opacity alone.\n return Object.freeze(\n getPageBackgrounds(this._raw()).map((paint) =>\n toFigmaPaint({ ...paint, opacity: paint.opacity * paint.color.a })\n )\n )\n }\n\n set backgrounds(value: readonly FigmaPaint[]) {\n const fills = parseFigmaPaints(value, 'set_backgrounds', 'backgrounds')\n setPageBackgrounds(this[INTERNAL_GRAPH], this._raw(), fills)\n }\n\n /** The async form Figma requires in dynamic-page mode; same result as mainComponent. */\n async getMainComponentAsync(): Promise<FigmaNodeProxy | null> {\n return this.mainComponent\n }\n\n get mainComponent(): FigmaNodeProxy | null {\n const n = this._raw()\n if (!n.componentId) return null\n const comp = this[INTERNAL_GRAPH].getNode(n.componentId)\n if (!comp) return null\n return this[INTERNAL_API].wrapNode(comp.id)\n }\n\n createInstance(): FigmaInstanceNode {\n const n = this._raw()\n if (n.type !== 'COMPONENT') throw new Error('createInstance() can only be called on components')\n const pageId = this[INTERNAL_API].currentPageId\n const inst = this[INTERNAL_GRAPH].createInstance(n.id, pageId)\n if (!inst) throw new Error('Failed to create instance')\n // `wrapNode` cannot know the node's type; this one just built an instance.\n return this[INTERNAL_API].wrapNode(inst.id) as FigmaInstanceNode\n }\n\n /** Turns this instance into a frame that keeps its current content, like Figma's. */\n detachInstance(): FigmaFrameNode {\n const n = this._raw()\n if (n.type !== 'INSTANCE') throw new Error('detachInstance() can only be called on instances')\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n this[INTERNAL_GRAPH].detachInstance(n.id)\n // The node is a frame once detached, which `wrapNode` has no way to tell.\n return this[INTERNAL_API].wrapNode(n.id) as FigmaFrameNode\n }\n\n /** Points this instance at another component, as Figma's swapComponent does. */\n swapComponent(component: FigmaNodeProxy): void {\n const n = this._raw()\n if (n.type !== 'INSTANCE') throw new Error('swapComponent() can only be called on instances')\n const target = this[INTERNAL_GRAPH].getNode(component[INTERNAL_ID])\n if (target?.type !== 'COMPONENT') throw new Error('swapComponent() needs a component')\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n this[INTERNAL_GRAPH].swapInstanceComponent(n.id, target.id)\n }\n\n // --- Tree ---\n\n get parent(): FigmaNodeProxy | null {\n const n = this._raw()\n if (!n.parentId) return null\n return this[INTERNAL_API].wrapNode(n.parentId)\n }\n\n get children(): FigmaNodeProxy[] {\n flushPendingComponentSync(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n return pluginChildren(this[INTERNAL_GRAPH], this[INTERNAL_ID]).map((c) =>\n this[INTERNAL_API].wrapNode(c.id)\n )\n }\n\n appendChild(child: FigmaNodeProxy): void {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n assertNodeEditable(this[INTERNAL_GRAPH], child[INTERNAL_ID])\n assertNoComponentCycle(\n this[INTERNAL_GRAPH],\n this[INTERNAL_ID],\n child[INTERNAL_ID],\n 'appendChild'\n )\n prepareSlotMove(this[INTERNAL_GRAPH], this[INTERNAL_ID], child[INTERNAL_ID], 'appendChild')\n this._reparentAndFit(child[INTERNAL_ID])\n }\n\n /**\n * Moves a child here as Figma does: it keeps its transform into its container, so its `x`, `y`,\n * and rotation stay and it moves with its new parent. The groups it left and joined refit.\n */\n private _reparentAndFit(childId: string): void {\n const scene = this[INTERNAL_GRAPH]\n const child = scene.getNode(childId)\n if (!child) return\n const previousParentId = child.parentId\n const transform = containerTransform(child, scene)\n scene.reparentNode(childId, this[INTERNAL_ID])\n setContainerTransform(scene, child, transform)\n const options = this[INTERNAL_API].groupFitOptions\n fitGroupsAround(scene, previousParentId, options)\n fitGroupsAround(scene, this[INTERNAL_ID], options)\n }\n\n insertChild(index: number, child: FigmaNodeProxy): void {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n assertNodeEditable(this[INTERNAL_GRAPH], child[INTERNAL_ID])\n assertNoComponentCycle(\n this[INTERNAL_GRAPH],\n this[INTERNAL_ID],\n child[INTERNAL_ID],\n 'insertChild'\n )\n prepareSlotMove(this[INTERNAL_GRAPH], this[INTERNAL_ID], child[INTERNAL_ID], 'insertChild')\n this._reparentAndFit(child[INTERNAL_ID])\n this[INTERNAL_GRAPH].insertChildAt(child[INTERNAL_ID], this[INTERNAL_ID], index)\n }\n\n clone(): FigmaNodeProxy {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n const n = this._raw()\n const parentId = n.parentId ?? this[INTERNAL_API].currentPageId\n const cloned = this[INTERNAL_GRAPH].cloneTree(this[INTERNAL_ID], parentId)\n if (!cloned) throw new Error(`Failed to clone node ${this[INTERNAL_ID]}`)\n // A slot's copy is a plain frame: the slot binding belongs to the original alone.\n if (slotPropertyId(cloned))\n this[INTERNAL_GRAPH].updateNode(cloned.id, {\n componentPropertyReferences: cloned.componentPropertyReferences.filter(\n (reference) => reference.field !== 'SLOT_CONTENT'\n )\n })\n return this[INTERNAL_API].wrapNode(cloned.id)\n }\n\n remove(): void {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n prepareSlotRemoval(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n const parentId = this._raw().parentId\n // Connectors go with a layer they attach to, as Figma removes them.\n const attached = attachedConnectors(this[INTERNAL_GRAPH], [this[INTERNAL_ID]])\n this[INTERNAL_GRAPH].deleteNode(this[INTERNAL_ID])\n for (const connector of attached) this[INTERNAL_GRAPH].deleteNode(connector.id)\n fitGroupsAround(this[INTERNAL_GRAPH], parentId, this[INTERNAL_API].groupFitOptions)\n }\n\n findAll(callback?: (node: FigmaNodeProxy) => boolean): FigmaNodeProxy[] {\n return Traversal.findAll(this[INTERNAL_GRAPH], this[INTERNAL_API], this[INTERNAL_ID], callback)\n }\n\n findOne(callback: (node: FigmaNodeProxy) => boolean): FigmaNodeProxy | null {\n return Traversal.findOne(this[INTERNAL_GRAPH], this[INTERNAL_API], this[INTERNAL_ID], callback)\n }\n\n findChild(callback: (node: FigmaNodeProxy) => boolean): FigmaNodeProxy | null {\n return Traversal.findChild(\n this[INTERNAL_GRAPH],\n this[INTERNAL_API],\n this[INTERNAL_ID],\n callback\n )\n }\n\n findChildren(callback?: (node: FigmaNodeProxy) => boolean): FigmaNodeProxy[] {\n return Traversal.findChildren(\n this[INTERNAL_GRAPH],\n this[INTERNAL_API],\n this[INTERNAL_ID],\n callback\n )\n }\n\n findAllWithCriteria(criteria: { types?: string[] }): FigmaNodeProxy[] {\n return Traversal.findAllWithCriteria(\n this[INTERNAL_GRAPH],\n this[INTERNAL_API],\n this[INTERNAL_ID],\n criteria\n )\n }\n\n // --- Serialization ---\n\n toJSON(maxDepth?: number, currentDepth = 0): Record<string, unknown> {\n return nodeProxyToJSON(\n this[INTERNAL_GRAPH],\n this[INTERNAL_API],\n this[INTERNAL_ID],\n maxDepth,\n currentDepth\n )\n }\n\n toString(): string {\n const n = this._raw()\n return `[${n.type} \"${n.name}\" ${n.id}]`\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](): string {\n return this.toString()\n }\n}\n\ninstallBasicNodeProxyAccessors(FigmaNodeProxy.prototype, {\n id: INTERNAL_ID,\n graph: INTERNAL_GRAPH,\n api: INTERNAL_API\n})\n\ninstallVisualNodeProxyAccessors(\n FigmaNodeProxy.prototype,\n { id: INTERNAL_ID, graph: INTERNAL_GRAPH, api: INTERNAL_API },\n MIXED\n)\n\nconst proxyInternals = {\n id: INTERNAL_ID,\n graph: INTERNAL_GRAPH,\n api: INTERNAL_API\n}\n\ninstallStrokeNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallStickyNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallConnectorNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallTextNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals, MIXED)\ninstallTextRangeMethods(FigmaNodeProxy.prototype, proxyInternals, MIXED)\ninstallLayoutNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallVariableModeNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallReactionAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallPluginDataMethods(FigmaNodeProxy.prototype, proxyInternals)\ninstallComponentPropertyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallInstanceOverrideAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallSlotAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallDevStatusAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallShapeWithTextAccessors(FigmaNodeProxy.prototype, proxyInternals)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,QAAQ,OAAO,OAAO;AAI5B,MAAa,cAAc,OAAO,IAAI;AACtC,MAAa,iBAAiB,OAAO,OAAO;AAC5C,MAAa,eAAe,OAAO,KAAK;;;;;AAYxC,MAAM,4BAAY,IAAI,QAAiC;AAEvD,SAAgB,YAAY,KAAoB,MAAsB;CACpE,UAAU,IAAI,KAAK,IAAI;AACzB;AAEA,SAAgB,SAAS,KAAoB,QAA+B;CAC1E,OAAO,UAAU,IAAI,GAAG,CAAC,EAAE,KAAK,MAAM,KAAK,QAAQ,QAAQ;AAC7D;;AAGA,SAAgB,WAAW,KAAoB,QAAwC;CACrF,OAAO,UAAU,IAAI,GAAG,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CACP,KAAK;AACP,CAAC;AAED,gCACE,eAAe,WACf;CAAE,IAAI;CAAa,OAAO;CAAgB,KAAK;AAAa,GAC5D,KACF;AAEA,MAAM,iBAAiB;CACrB,IAAI;CACJ,OAAO;CACP,KAAK;AACP;AAEA,gCAAgC,eAAe,WAAW,cAAc;AACxE,gCAAgC,eAAe,WAAW,cAAc;AACxE,mCAAmC,eAAe,WAAW,cAAc;AAC3E,8BAA8B,eAAe,WAAW,gBAAgB,KAAK;AAC7E,wBAAwB,eAAe,WAAW,gBAAgB,KAAK;AACvE,gCAAgC,eAAe,WAAW,cAAc;AACxE,sCAAsC,eAAe,WAAW,cAAc;AAC9E,yBAAyB,eAAe,WAAW,cAAc;AACjE,yBAAyB,eAAe,WAAW,cAAc;AACjE,kCAAkC,eAAe,WAAW,cAAc;AAC1E,iCAAiC,eAAe,WAAW,cAAc;AACzE,qBAAqB,eAAe,WAAW,cAAc;AAC7D,0BAA0B,eAAe,WAAW,cAAc;AAClE,8BAA8B,eAAe,WAAW,cAAc"}
1
+ {"version":3,"file":"proxy.js","names":["Traversal.findAll","Traversal.findOne","Traversal.findChild","Traversal.findChildren","Traversal.findAllWithCriteria"],"sources":["../../src/figma-api/proxy.ts"],"sourcesContent":["import type {\n ArcData,\n HyperlinkTarget,\n SceneGraph,\n SceneNode,\n NodeType,\n LayoutGrid,\n LayoutMode,\n OverflowDirection,\n ScrollBehavior\n} from '@pairdraw/scene-graph'\nimport { attachedConnectors } from '@pairdraw/scene-graph/connectors'\nimport type { GroupFitOptions } from '@pairdraw/scene-graph/group-bounds'\nimport { createsComponentCycle, recordInstanceOverride } from '@pairdraw/scene-graph/instances'\nimport type { Rect, Vector } from '@pairdraw/scene-graph/primitives'\nimport type { ShapeWithTextType } from '@pairdraw/scene-graph/shape-with-text'\nimport { slotPropertyId } from '@pairdraw/scene-graph/slots'\n\nimport { assertNodeEditable } from '#core/editor/capabilities'\nimport type { FigmaEffect } from '#core/figma-api/effects'\n\nimport { prepareFollowedFieldEdit, fitGroupsAround } from './accessor-utils'\nimport { installBasicNodeProxyAccessors } from './accessors/basic'\nimport { installConnectorNodeProxyAccessors } from './accessors/connector'\nimport { installLayoutNodeProxyAccessors } from './accessors/layout'\nimport { installReactionAccessors } from './accessors/reactions'\nimport { installShapeNodeProxyAccessors } from './accessors/shape'\nimport { installStickyNodeProxyAccessors, pluginChildren } from './accessors/sticky'\nimport { installStrokeNodeProxyAccessors } from './accessors/strokes'\nimport { installTextNodeProxyAccessors } from './accessors/text'\nimport { installTextRangeMethods, type TextRangeMethods } from './accessors/text/ranges'\nimport {\n installVariableModeNodeProxyAccessors,\n type VariableNodeMembers\n} from './accessors/variables'\nimport {\n installVectorNodeProxyAccessors,\n type FigmaVectorNetwork,\n type FigmaVectorPath\n} from './accessors/vector'\nimport { installVisualNodeProxyAccessors } from './accessors/visual'\nimport { installComponentPropertyAccessors } from './components'\nimport { installDevStatusAccessors, type FigmaDevStatusValue } from './dev-status'\nimport type { FigmaFontName } from './fonts/names'\nimport { underlyingGraph } from './graph-ref'\nimport type { FigmaFrameNode, FigmaInstanceNode } from './node-types'\nimport { installInstanceOverrideAccessors, type FigmaInstanceOverride } from './overrides'\nimport { getPageBackgrounds, setPageBackgrounds } from './page-backgrounds'\nimport { parseFigmaPaints, toFigmaPaint, type FigmaPaint } from './paints'\nimport { flushPendingComponentSync } from './pending-sync'\nimport { installPluginDataMethods, type PluginDataMethods } from './plugin-data'\nimport type { FigmaReaction } from './reactions'\nimport { nodeProxyToJSON } from './serialization'\nimport { installShapeWithTextAccessors } from './shape-with-text'\nimport { installSlotAccessors, prepareSlotMove, prepareSlotRemoval } from './slots'\nimport type { FigmaLetterSpacing, FigmaLineHeight } from './text'\nimport * as TextProxy from './text'\nimport { containerTransform, setContainerTransform } from './transform'\nimport * as Traversal from './traversal'\nimport type { FigmaTransform } from './types'\n\nconst MIXED = Symbol('mixed')\n\nexport type { FigmaFont, FigmaFontName } from './fonts/names'\n\nexport const INTERNAL_ID = Symbol('id')\nexport const INTERNAL_GRAPH = Symbol('graph')\nexport const INTERNAL_API = Symbol('api')\n\n/** How a host loads pages as they are visited; see `FigmaAPIOptions`. */\nexport interface PageHost {\n load: (pageId: string) => Promise<void>\n pageOfNode?: (nodeId: string) => Promise<string | null>\n}\n\n/**\n * How each API loads a page's layers, a host's hook kept off `figma`, which has only Figma's\n * members. Without one every page is in memory.\n */\nconst pageHosts = new WeakMap<NodeProxyHost, PageHost>()\n\nexport function setPageHost(api: NodeProxyHost, host: PageHost): void {\n pageHosts.set(api, host)\n}\n\nexport function loadPage(api: NodeProxyHost, pageId: string): Promise<void> {\n return pageHosts.get(api)?.load(pageId) ?? Promise.resolve()\n}\n\n/** The page holding a layer not loaded yet, which loading that page brings in. */\nexport function pageOfNode(api: NodeProxyHost, nodeId: string): Promise<string | null> {\n return pageHosts.get(api)?.pageOfNode?.(nodeId) ?? Promise.resolve(null)\n}\n\nexport interface NodeProxyHost {\n wrapNode(id: string): FigmaNodeProxy\n readonly currentPageId: string\n /** How groups and booleans refit; booleans size to their result when a renderer is attached. */\n readonly groupFitOptions: GroupFitOptions\n}\n\nexport { MIXED }\n\n/** Figma refuses a move that would make a component contain itself. */\nfunction assertNoComponentCycle(\n graph: SceneGraph,\n parentId: string,\n childId: string,\n method: 'appendChild' | 'insertChild'\n): void {\n if (createsComponentCycle(graph, childId, parentId))\n throw new Error(`in ${method}: Cannot move node. Reparenting would create a component cycle`)\n}\n\nexport class FigmaNodeProxy {\n [INTERNAL_ID]: string;\n [INTERNAL_GRAPH]: SceneGraph;\n [INTERNAL_API]: NodeProxyHost\n\n declare readonly id: string\n /** A slot frame reads as `'SLOT'`, as Figma's `SlotNode` does. */\n declare readonly type: NodeType | 'SLOT'\n declare name: string\n declare readonly removed: boolean\n declare x: number\n declare y: number\n declare readonly width: number\n declare readonly height: number\n declare rotation: number\n declare relativeTransform: FigmaTransform\n declare resize: (width: number, height: number) => void\n declare resizeWithoutConstraints: (width: number, height: number) => void\n declare rescale: (scale: number) => void\n declare readonly absoluteTransform: FigmaTransform\n declare readonly absoluteBoundingBox: Rect\n declare readonly absoluteRenderBounds: Rect | null\n\n declare fills: readonly FigmaPaint[] | symbol\n declare strokes: readonly FigmaPaint[]\n declare effects: readonly FigmaEffect[]\n declare opacity: number\n declare visible: boolean\n declare locked: boolean\n declare devStatus: FigmaDevStatusValue | undefined\n declare blendMode: string\n declare clipsContent: boolean\n declare overflowDirection: OverflowDirection\n declare scrollBehavior: ScrollBehavior\n declare cornerRadius: number | typeof MIXED\n declare topLeftRadius: number\n declare topRightRadius: number\n declare bottomLeftRadius: number\n declare bottomRightRadius: number\n declare cornerSmoothing: number\n\n declare layoutMode: LayoutMode\n declare layoutGrids: readonly LayoutGrid[]\n declare primaryAxisAlignItems: string\n declare counterAxisAlignItems: string\n declare itemSpacing: number\n declare counterAxisSpacing: number\n declare paddingTop: number\n declare paddingRight: number\n declare paddingBottom: number\n declare paddingLeft: number\n declare layoutWrap: string\n declare primaryAxisSizingMode: string\n declare counterAxisSizingMode: string\n declare counterAxisAlignContent: string\n declare itemReverseZIndex: boolean\n declare strokesIncludedInLayout: boolean\n declare layoutPositioning: string\n declare layoutGrow: number\n declare layoutAlign: string\n declare layoutSizingHorizontal: string\n declare layoutSizingVertical: string\n declare constraints: { horizontal: string; vertical: string }\n declare minWidth: number | null\n declare maxWidth: number | null\n declare minHeight: number | null\n declare maxHeight: number | null\n declare readonly targetAspectRatio: Vector | null\n /** @deprecated Figma's alias for whether `targetAspectRatio` is set. */\n declare constrainProportions: boolean\n declare lockAspectRatio: () => void\n declare unlockAspectRatio: () => void\n declare pointCount: number\n declare innerRadius: number\n declare arcData: Readonly<ArcData>\n declare vectorPaths: readonly FigmaVectorPath[]\n declare vectorNetwork: FigmaVectorNetwork\n declare setVectorNetworkAsync: (vectorNetwork: FigmaVectorNetwork) => Promise<void>\n declare handleMirroring: SceneNode['handleMirroring'] | typeof MIXED\n declare getPluginData: PluginDataMethods['getPluginData']\n declare setPluginData: PluginDataMethods['setPluginData']\n declare getPluginDataKeys: PluginDataMethods['getPluginDataKeys']\n declare getSharedPluginData: PluginDataMethods['getSharedPluginData']\n declare setSharedPluginData: PluginDataMethods['setSharedPluginData']\n declare getSharedPluginDataKeys: PluginDataMethods['getSharedPluginDataKeys']\n declare readonly explicitVariableModes: VariableNodeMembers['explicitVariableModes']\n declare readonly resolvedVariableModes: VariableNodeMembers['resolvedVariableModes']\n declare setExplicitVariableModeForCollection: VariableNodeMembers['setExplicitVariableModeForCollection']\n declare clearExplicitVariableModeForCollection: VariableNodeMembers['clearExplicitVariableModeForCollection']\n declare readonly boundVariables: VariableNodeMembers['boundVariables']\n declare setBoundVariable: VariableNodeMembers['setBoundVariable']\n declare readonly overrides: FigmaInstanceOverride[] | undefined\n /** Prototype connections, in Figma's plugin shape; refused when the play cannot run them. */\n declare reactions: readonly FigmaReaction[]\n /** A sticky note's body or a shape's label, a sticky's author line, and whether it is wide. */\n declare readonly text: FigmaNodeProxy | undefined\n declare readonly authorName: string | undefined\n declare authorVisible: boolean | undefined\n declare isWideWidth: boolean | undefined\n declare shapeType: ShapeWithTextType | undefined\n /** On pages alone, as in Figma. */\n declare loadAsync: () => Promise<void>\n declare resetOverrides: () => void\n\n declare strokeWeight: number\n declare strokeAlign: string\n declare dashPattern: readonly number[]\n declare strokeCap: string\n declare strokeJoin: string\n declare strokeMiterLimit: number\n declare strokeTopWeight: number\n declare strokeBottomWeight: number\n declare strokeLeftWeight: number\n declare strokeRightWeight: number\n\n declare characters: string\n declare fontSize: number | symbol\n declare fontName: FigmaFontName | symbol\n declare fontWeight: number | symbol\n declare textAlignHorizontal: string\n declare textAlignVertical: string\n declare textAutoResize: string\n declare letterSpacing: FigmaLetterSpacing | symbol\n declare lineHeight: FigmaLineHeight | symbol\n declare textCase: SceneNode['textCase'] | symbol\n declare hyperlink: HyperlinkTarget | null | symbol\n declare textStyleId: string | symbol\n declare fillStyleId: string | symbol\n declare textDecoration: SceneNode['textDecoration'] | symbol\n declare readonly openTypeFeatures: Record<string, boolean> | symbol\n declare maxLines: number | null\n declare listSpacing: number | symbol\n declare paragraphSpacing: number | symbol\n declare paragraphIndent: number | symbol\n declare hangingList: boolean\n declare textTruncation: string\n declare autoRename: boolean\n\n // Per-character and per-paragraph methods: accessors/text/ranges.ts.\n declare getStyledTextSegments: TextRangeMethods['getStyledTextSegments']\n declare getRangeAllFontNames: TextRangeMethods['getRangeAllFontNames']\n declare getRangeFontSize: TextRangeMethods['getRangeFontSize']\n declare setRangeFontSize: TextRangeMethods['setRangeFontSize']\n declare getRangeFontName: TextRangeMethods['getRangeFontName']\n declare setRangeFontName: TextRangeMethods['setRangeFontName']\n declare getRangeFontWeight: TextRangeMethods['getRangeFontWeight']\n declare getRangeFills: TextRangeMethods['getRangeFills']\n declare setRangeFills: TextRangeMethods['setRangeFills']\n declare getRangeLetterSpacing: TextRangeMethods['getRangeLetterSpacing']\n declare setRangeLetterSpacing: TextRangeMethods['setRangeLetterSpacing']\n declare getRangeLineHeight: TextRangeMethods['getRangeLineHeight']\n declare setRangeLineHeight: TextRangeMethods['setRangeLineHeight']\n declare getRangeTextDecoration: TextRangeMethods['getRangeTextDecoration']\n declare setRangeTextDecoration: TextRangeMethods['setRangeTextDecoration']\n declare getRangeTextDecorationStyle: TextRangeMethods['getRangeTextDecorationStyle']\n declare setRangeTextDecorationStyle: TextRangeMethods['setRangeTextDecorationStyle']\n declare getRangeTextDecorationOffset: TextRangeMethods['getRangeTextDecorationOffset']\n declare setRangeTextDecorationOffset: TextRangeMethods['setRangeTextDecorationOffset']\n declare getRangeTextDecorationThickness: TextRangeMethods['getRangeTextDecorationThickness']\n declare setRangeTextDecorationThickness: TextRangeMethods['setRangeTextDecorationThickness']\n declare getRangeTextDecorationColor: TextRangeMethods['getRangeTextDecorationColor']\n declare setRangeTextDecorationColor: TextRangeMethods['setRangeTextDecorationColor']\n declare getRangeTextDecorationSkipInk: TextRangeMethods['getRangeTextDecorationSkipInk']\n declare setRangeTextDecorationSkipInk: TextRangeMethods['setRangeTextDecorationSkipInk']\n declare getRangeOpenTypeFeatures: TextRangeMethods['getRangeOpenTypeFeatures']\n declare getRangeListOptions: TextRangeMethods['getRangeListOptions']\n declare setRangeListOptions: TextRangeMethods['setRangeListOptions']\n declare getRangeIndentation: TextRangeMethods['getRangeIndentation']\n declare setRangeIndentation: TextRangeMethods['setRangeIndentation']\n declare getRangeListSpacing: TextRangeMethods['getRangeListSpacing']\n declare setRangeListSpacing: TextRangeMethods['setRangeListSpacing']\n declare getRangeParagraphSpacing: TextRangeMethods['getRangeParagraphSpacing']\n declare setRangeParagraphSpacing: TextRangeMethods['setRangeParagraphSpacing']\n declare getRangeParagraphIndent: TextRangeMethods['getRangeParagraphIndent']\n declare setRangeParagraphIndent: TextRangeMethods['setRangeParagraphIndent']\n declare getRangeTextCase: TextRangeMethods['getRangeTextCase']\n declare setRangeTextCase: TextRangeMethods['setRangeTextCase']\n declare getRangeHyperlink: TextRangeMethods['getRangeHyperlink']\n declare setRangeHyperlink: TextRangeMethods['setRangeHyperlink']\n declare getRangeTextStyleId: TextRangeMethods['getRangeTextStyleId']\n declare setRangeTextStyleId: TextRangeMethods['setRangeTextStyleId']\n declare setRangeTextStyleIdAsync: TextRangeMethods['setRangeTextStyleIdAsync']\n declare getRangeFillStyleId: TextRangeMethods['getRangeFillStyleId']\n declare setRangeFillStyleId: TextRangeMethods['setRangeFillStyleId']\n declare setRangeFillStyleIdAsync: TextRangeMethods['setRangeFillStyleIdAsync']\n declare getRangeBoundVariable: TextRangeMethods['getRangeBoundVariable']\n declare setRangeBoundVariable: TextRangeMethods['setRangeBoundVariable']\n\n constructor(id: string, graph: SceneGraph, api: NodeProxyHost) {\n this[INTERNAL_ID] = id\n this[INTERNAL_GRAPH] = underlyingGraph(graph)\n this[INTERNAL_API] = api\n const type = graph.getNode(id)?.type\n const internals = { id: INTERNAL_ID, graph: INTERNAL_GRAPH, api: INTERNAL_API }\n if (type === 'VECTOR') installVectorNodeProxyAccessors(this, internals, MIXED)\n if (type) installShapeNodeProxyAccessors(this, internals, type)\n // Figma loads a page's layers on demand in dynamic-page mode and has `loadAsync` on pages\n // alone, as the editor loads a page's layers when it is first visited.\n if (type === 'CANVAS')\n Object.defineProperty(this, 'loadAsync', { value: () => loadPage(api, id) })\n }\n\n private _update(changes: Partial<SceneNode>): void {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n const graph = this[INTERNAL_GRAPH]\n const id = this[INTERNAL_ID]\n graph.updateNode(id, changes)\n recordInstanceOverride(graph, id, Object.keys(changes))\n }\n\n private _raw(): SceneNode {\n flushPendingComponentSync(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n const n = this[INTERNAL_GRAPH].getNode(this[INTERNAL_ID])\n if (!n) throw new Error(`Node ${this[INTERNAL_ID]} has been removed`)\n return n\n }\n\n insertCharacters(\n start: number,\n characters: string,\n useStyle: TextProxy.InsertStyleSource = 'BEFORE'\n ): void {\n TextProxy.insertCharacters(this[INTERNAL_GRAPH], this._raw(), start, characters, useStyle)\n }\n\n deleteCharacters(start: number, end: number): void {\n TextProxy.deleteCharacters(this[INTERNAL_GRAPH], this._raw(), start, end)\n }\n\n get isMask(): boolean {\n return this._raw().isMask\n }\n\n set isMask(v: boolean) {\n prepareFollowedFieldEdit(this[INTERNAL_GRAPH], this._raw(), 'isMask', 'is-mask')\n this._update({ isMask: v })\n // A mask limits what its group spans.\n fitGroupsAround(this[INTERNAL_GRAPH], this._raw().parentId, this[INTERNAL_API].groupFitOptions)\n }\n\n get maskType(): string {\n return this._raw().maskType\n }\n\n set maskType(v: string) {\n prepareFollowedFieldEdit(this[INTERNAL_GRAPH], this._raw(), 'maskType', 'mask-type')\n this._update({ maskType: v as SceneNode['maskType'] })\n }\n\n // --- UI state ---\n\n get expanded(): boolean {\n return this._raw().expanded\n }\n\n set expanded(v: boolean) {\n this._update({ expanded: v })\n }\n\n // --- Components ---\n\n get backgrounds(): readonly FigmaPaint[] {\n // A page draws its background colour's alpha times the paint's opacity, which Figma reads as\n // the opacity alone.\n return Object.freeze(\n getPageBackgrounds(this._raw()).map((paint) =>\n toFigmaPaint({ ...paint, opacity: paint.opacity * paint.color.a })\n )\n )\n }\n\n set backgrounds(value: readonly FigmaPaint[]) {\n const fills = parseFigmaPaints(value, 'set_backgrounds', 'backgrounds')\n setPageBackgrounds(this[INTERNAL_GRAPH], this._raw(), fills)\n }\n\n /** The async form Figma requires in dynamic-page mode; same result as mainComponent. */\n async getMainComponentAsync(): Promise<FigmaNodeProxy | null> {\n return this.mainComponent\n }\n\n get mainComponent(): FigmaNodeProxy | null {\n const n = this._raw()\n if (!n.componentId) return null\n const comp = this[INTERNAL_GRAPH].getNode(n.componentId)\n if (!comp) return null\n return this[INTERNAL_API].wrapNode(comp.id)\n }\n\n createInstance(): FigmaInstanceNode {\n const n = this._raw()\n if (n.type !== 'COMPONENT') throw new Error('createInstance() can only be called on components')\n const pageId = this[INTERNAL_API].currentPageId\n const inst = this[INTERNAL_GRAPH].createInstance(n.id, pageId)\n if (!inst) throw new Error('Failed to create instance')\n // `wrapNode` cannot know the node's type; this one just built an instance.\n return this[INTERNAL_API].wrapNode(inst.id) as FigmaInstanceNode\n }\n\n /** Turns this instance into a frame that keeps its current content, like Figma's. */\n detachInstance(): FigmaFrameNode {\n const n = this._raw()\n if (n.type !== 'INSTANCE') throw new Error('detachInstance() can only be called on instances')\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n this[INTERNAL_GRAPH].detachInstance(n.id)\n // The node is a frame once detached, which `wrapNode` has no way to tell.\n return this[INTERNAL_API].wrapNode(n.id) as FigmaFrameNode\n }\n\n /** Points this instance at another component, as Figma's swapComponent does. */\n swapComponent(component: FigmaNodeProxy): void {\n const n = this._raw()\n if (n.type !== 'INSTANCE') throw new Error('swapComponent() can only be called on instances')\n const target = this[INTERNAL_GRAPH].getNode(component[INTERNAL_ID])\n if (target?.type !== 'COMPONENT') throw new Error('swapComponent() needs a component')\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n this[INTERNAL_GRAPH].swapInstanceComponent(n.id, target.id)\n }\n\n // --- Tree ---\n\n get parent(): FigmaNodeProxy | null {\n const n = this._raw()\n if (!n.parentId) return null\n return this[INTERNAL_API].wrapNode(n.parentId)\n }\n\n get children(): FigmaNodeProxy[] {\n flushPendingComponentSync(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n return pluginChildren(this[INTERNAL_GRAPH], this[INTERNAL_ID]).map((c) =>\n this[INTERNAL_API].wrapNode(c.id)\n )\n }\n\n appendChild(child: FigmaNodeProxy): void {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n assertNodeEditable(this[INTERNAL_GRAPH], child[INTERNAL_ID])\n assertNoComponentCycle(\n this[INTERNAL_GRAPH],\n this[INTERNAL_ID],\n child[INTERNAL_ID],\n 'appendChild'\n )\n prepareSlotMove(this[INTERNAL_GRAPH], this[INTERNAL_ID], child[INTERNAL_ID], 'appendChild')\n this._reparentAndFit(child[INTERNAL_ID])\n }\n\n /**\n * Moves a child here as Figma does: it keeps its transform into its container, so its `x`, `y`,\n * and rotation stay and it moves with its new parent. The groups it left and joined refit.\n */\n private _reparentAndFit(childId: string): void {\n const scene = this[INTERNAL_GRAPH]\n const child = scene.getNode(childId)\n if (!child) return\n const previousParentId = child.parentId\n const transform = containerTransform(child, scene)\n scene.reparentNode(childId, this[INTERNAL_ID])\n setContainerTransform(scene, child, transform)\n const options = this[INTERNAL_API].groupFitOptions\n fitGroupsAround(scene, previousParentId, options)\n fitGroupsAround(scene, this[INTERNAL_ID], options)\n }\n\n insertChild(index: number, child: FigmaNodeProxy): void {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n assertNodeEditable(this[INTERNAL_GRAPH], child[INTERNAL_ID])\n assertNoComponentCycle(\n this[INTERNAL_GRAPH],\n this[INTERNAL_ID],\n child[INTERNAL_ID],\n 'insertChild'\n )\n prepareSlotMove(this[INTERNAL_GRAPH], this[INTERNAL_ID], child[INTERNAL_ID], 'insertChild')\n this._reparentAndFit(child[INTERNAL_ID])\n this[INTERNAL_GRAPH].insertChildAt(child[INTERNAL_ID], this[INTERNAL_ID], index)\n }\n\n clone(): FigmaNodeProxy {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n const n = this._raw()\n const parentId = n.parentId ?? this[INTERNAL_API].currentPageId\n const cloned = this[INTERNAL_GRAPH].cloneTree(this[INTERNAL_ID], parentId)\n if (!cloned) throw new Error(`Failed to clone node ${this[INTERNAL_ID]}`)\n // A slot's copy is a plain frame: the slot binding belongs to the original alone.\n if (slotPropertyId(cloned))\n this[INTERNAL_GRAPH].updateNode(cloned.id, {\n componentPropertyReferences: cloned.componentPropertyReferences.filter(\n (reference) => reference.field !== 'SLOT_CONTENT'\n )\n })\n return this[INTERNAL_API].wrapNode(cloned.id)\n }\n\n remove(): void {\n assertNodeEditable(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n prepareSlotRemoval(this[INTERNAL_GRAPH], this[INTERNAL_ID])\n const parentId = this._raw().parentId\n // Connectors go with a layer they attach to, as Figma removes them.\n const attached = attachedConnectors(this[INTERNAL_GRAPH], [this[INTERNAL_ID]])\n this[INTERNAL_GRAPH].deleteNode(this[INTERNAL_ID])\n for (const connector of attached) this[INTERNAL_GRAPH].deleteNode(connector.id)\n fitGroupsAround(this[INTERNAL_GRAPH], parentId, this[INTERNAL_API].groupFitOptions)\n }\n\n findAll(callback?: (node: FigmaNodeProxy) => boolean): FigmaNodeProxy[] {\n return Traversal.findAll(this[INTERNAL_GRAPH], this[INTERNAL_API], this[INTERNAL_ID], callback)\n }\n\n findOne(callback: (node: FigmaNodeProxy) => boolean): FigmaNodeProxy | null {\n return Traversal.findOne(this[INTERNAL_GRAPH], this[INTERNAL_API], this[INTERNAL_ID], callback)\n }\n\n findChild(callback: (node: FigmaNodeProxy) => boolean): FigmaNodeProxy | null {\n return Traversal.findChild(\n this[INTERNAL_GRAPH],\n this[INTERNAL_API],\n this[INTERNAL_ID],\n callback\n )\n }\n\n findChildren(callback?: (node: FigmaNodeProxy) => boolean): FigmaNodeProxy[] {\n return Traversal.findChildren(\n this[INTERNAL_GRAPH],\n this[INTERNAL_API],\n this[INTERNAL_ID],\n callback\n )\n }\n\n findAllWithCriteria(criteria: { types?: string[] }): FigmaNodeProxy[] {\n return Traversal.findAllWithCriteria(\n this[INTERNAL_GRAPH],\n this[INTERNAL_API],\n this[INTERNAL_ID],\n criteria\n )\n }\n\n // --- Serialization ---\n\n toJSON(maxDepth?: number, currentDepth = 0): Record<string, unknown> {\n return nodeProxyToJSON(\n this[INTERNAL_GRAPH],\n this[INTERNAL_API],\n this[INTERNAL_ID],\n maxDepth,\n currentDepth\n )\n }\n\n toString(): string {\n const n = this._raw()\n return `[${n.type} \"${n.name}\" ${n.id}]`\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](): string {\n return this.toString()\n }\n}\n\ninstallBasicNodeProxyAccessors(FigmaNodeProxy.prototype, {\n id: INTERNAL_ID,\n graph: INTERNAL_GRAPH,\n api: INTERNAL_API\n})\n\ninstallVisualNodeProxyAccessors(\n FigmaNodeProxy.prototype,\n { id: INTERNAL_ID, graph: INTERNAL_GRAPH, api: INTERNAL_API },\n MIXED\n)\n\nconst proxyInternals = {\n id: INTERNAL_ID,\n graph: INTERNAL_GRAPH,\n api: INTERNAL_API\n}\n\ninstallStrokeNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallStickyNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallConnectorNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallTextNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals, MIXED)\ninstallTextRangeMethods(FigmaNodeProxy.prototype, proxyInternals, MIXED)\ninstallLayoutNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallVariableModeNodeProxyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallReactionAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallPluginDataMethods(FigmaNodeProxy.prototype, proxyInternals)\ninstallComponentPropertyAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallInstanceOverrideAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallSlotAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallDevStatusAccessors(FigmaNodeProxy.prototype, proxyInternals)\ninstallShapeWithTextAccessors(FigmaNodeProxy.prototype, proxyInternals)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,QAAQ,OAAO,OAAO;AAI5B,MAAa,cAAc,OAAO,IAAI;AACtC,MAAa,iBAAiB,OAAO,OAAO;AAC5C,MAAa,eAAe,OAAO,KAAK;;;;;AAYxC,MAAM,4BAAY,IAAI,QAAiC;AAEvD,SAAgB,YAAY,KAAoB,MAAsB;CACpE,UAAU,IAAI,KAAK,IAAI;AACzB;AAEA,SAAgB,SAAS,KAAoB,QAA+B;CAC1E,OAAO,UAAU,IAAI,GAAG,CAAC,EAAE,KAAK,MAAM,KAAK,QAAQ,QAAQ;AAC7D;;AAGA,SAAgB,WAAW,KAAoB,QAAwC;CACrF,OAAO,UAAU,IAAI,GAAG,CAAC,EAAE,aAAa,MAAM,KAAK,QAAQ,QAAQ,IAAI;AACzE;;AAYA,SAAS,uBACP,OACA,UACA,SACA,QACM;CACN,IAAI,sBAAsB,OAAO,SAAS,QAAQ,GAChD,MAAM,IAAI,MAAM,MAAM,OAAO,+DAA+D;AAChG;AAEA,IAAa,iBAAb,MAA4B;CAC1B,CAAC;CACD,CAAC;CACD,CAAC;CAyLD,YAAY,IAAY,OAAmB,KAAoB;EAC7D,KAAK,eAAe;EACpB,KAAK,kBAAkB,gBAAgB,KAAK;EAC5C,KAAK,gBAAgB;EACrB,MAAM,OAAO,MAAM,QAAQ,EAAE,CAAC,EAAE;EAChC,MAAM,YAAY;GAAE,IAAI;GAAa,OAAO;GAAgB,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