@pairdraw/core 0.19.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1031) hide show
  1. package/dist/ai/providers.d.ts +6 -0
  2. package/dist/ai/providers.d.ts.map +1 -1
  3. package/dist/ai/providers.js.map +1 -1
  4. package/dist/cache/resource.d.ts +8 -1
  5. package/dist/cache/resource.d.ts.map +1 -1
  6. package/dist/cache/resource.js +18 -0
  7. package/dist/cache/resource.js.map +1 -1
  8. package/dist/canvas/effects.d.ts +6 -4
  9. package/dist/canvas/effects.d.ts.map +1 -1
  10. package/dist/canvas/effects.js +37 -34
  11. package/dist/canvas/effects.js.map +1 -1
  12. package/dist/canvas/fills.d.ts.map +1 -1
  13. package/dist/canvas/fills.js +12 -8
  14. package/dist/canvas/fills.js.map +1 -1
  15. package/dist/canvas/images/adjustments.d.ts +18 -0
  16. package/dist/canvas/images/adjustments.d.ts.map +1 -0
  17. package/dist/canvas/images/adjustments.js +184 -0
  18. package/dist/canvas/images/adjustments.js.map +1 -0
  19. package/dist/canvas/images/previews.d.ts +1 -1
  20. package/dist/canvas/images/sampling.d.ts +13 -0
  21. package/dist/canvas/images/sampling.d.ts.map +1 -0
  22. package/dist/canvas/images/sampling.js +49 -0
  23. package/dist/canvas/images/sampling.js.map +1 -0
  24. package/dist/canvas/index.d.ts +2 -2
  25. package/dist/canvas/masks.d.ts +1 -1
  26. package/dist/canvas/masks.d.ts.map +1 -1
  27. package/dist/canvas/masks.js.map +1 -1
  28. package/dist/canvas/noise/render.d.ts +15 -0
  29. package/dist/canvas/noise/render.d.ts.map +1 -0
  30. package/dist/canvas/noise/render.js +56 -0
  31. package/dist/canvas/noise/render.js.map +1 -0
  32. package/dist/canvas/noise/shader.d.ts +43 -0
  33. package/dist/canvas/noise/shader.d.ts.map +1 -0
  34. package/dist/canvas/noise/shader.js +161 -0
  35. package/dist/canvas/noise/shader.js.map +1 -0
  36. package/dist/canvas/noise/table.d.ts +13 -0
  37. package/dist/canvas/noise/table.d.ts.map +1 -0
  38. package/dist/canvas/noise/table.js +408 -0
  39. package/dist/canvas/noise/table.js.map +1 -0
  40. package/dist/canvas/noise/tile.d.ts +22 -0
  41. package/dist/canvas/noise/tile.d.ts.map +1 -0
  42. package/dist/canvas/noise/tile.js +73 -0
  43. package/dist/canvas/noise/tile.js.map +1 -0
  44. package/dist/canvas/outline-stroke.js +1 -1
  45. package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
  46. package/dist/canvas/overlays/auto-layout-hover.js +31 -71
  47. package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
  48. package/dist/canvas/overlays/index.d.ts +2 -2
  49. package/dist/canvas/overlays/index.js +2 -2
  50. package/dist/canvas/overlays/selection.d.ts +1 -2
  51. package/dist/canvas/overlays/selection.d.ts.map +1 -1
  52. package/dist/canvas/overlays/selection.js +2 -9
  53. package/dist/canvas/overlays/selection.js.map +1 -1
  54. package/dist/canvas/renderer/chunks/index.d.ts +1 -1
  55. package/dist/canvas/renderer/fonts.d.ts.map +1 -1
  56. package/dist/canvas/renderer/fonts.js +2 -0
  57. package/dist/canvas/renderer/fonts.js.map +1 -1
  58. package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
  59. package/dist/canvas/renderer/lifecycle.js +6 -0
  60. package/dist/canvas/renderer/lifecycle.js.map +1 -1
  61. package/dist/canvas/renderer/methods.d.ts +0 -1
  62. package/dist/canvas/renderer/methods.d.ts.map +1 -1
  63. package/dist/canvas/renderer/methods.js +1 -4
  64. package/dist/canvas/renderer/methods.js.map +1 -1
  65. package/dist/canvas/renderer/overlay-pass.d.ts.map +1 -1
  66. package/dist/canvas/renderer/overlay-pass.js +0 -1
  67. package/dist/canvas/renderer/overlay-pass.js.map +1 -1
  68. package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
  69. package/dist/canvas/renderer/pipeline.js +13 -2
  70. package/dist/canvas/renderer/pipeline.js.map +1 -1
  71. package/dist/canvas/renderer/play-scenes.d.ts +13 -0
  72. package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
  73. package/dist/canvas/renderer/play-scenes.js +40 -0
  74. package/dist/canvas/renderer/play-scenes.js.map +1 -0
  75. package/dist/canvas/renderer/tiles/cache.d.ts +19 -1
  76. package/dist/canvas/renderer/tiles/cache.d.ts.map +1 -1
  77. package/dist/canvas/renderer/tiles/cache.js +32 -1
  78. package/dist/canvas/renderer/tiles/cache.js.map +1 -1
  79. package/dist/canvas/renderer/tiles/controller.d.ts +11 -0
  80. package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
  81. package/dist/canvas/renderer/tiles/controller.js +18 -1
  82. package/dist/canvas/renderer/tiles/controller.js.map +1 -1
  83. package/dist/canvas/renderer/tiles/index.d.ts +2 -2
  84. package/dist/canvas/renderer/tiles/planner.d.ts +1 -1
  85. package/dist/canvas/renderer/types.d.ts +18 -4
  86. package/dist/canvas/renderer/types.d.ts.map +1 -1
  87. package/dist/canvas/renderer/visual-bounds.d.ts +1 -1
  88. package/dist/canvas/renderer/visual-bounds.js +1 -1
  89. package/dist/canvas/renderer.d.ts +22 -3
  90. package/dist/canvas/renderer.d.ts.map +1 -1
  91. package/dist/canvas/renderer.js +29 -1
  92. package/dist/canvas/renderer.js.map +1 -1
  93. package/dist/canvas/scene.d.ts +2 -1
  94. package/dist/canvas/scene.d.ts.map +1 -1
  95. package/dist/canvas/scene.js +41 -9
  96. package/dist/canvas/scene.js.map +1 -1
  97. package/dist/canvas/shadows/silhouette.js +1 -1
  98. package/dist/canvas/texture.d.ts +20 -0
  99. package/dist/canvas/texture.d.ts.map +1 -0
  100. package/dist/canvas/texture.js +100 -0
  101. package/dist/canvas/texture.js.map +1 -0
  102. package/dist/clipboard.js +16 -5
  103. package/dist/clipboard.js.map +1 -1
  104. package/dist/constants.d.ts +5 -1
  105. package/dist/constants.d.ts.map +1 -1
  106. package/dist/constants.js +5 -1
  107. package/dist/constants.js.map +1 -1
  108. package/dist/design-jsx/index.d.ts +2 -2
  109. package/dist/design-jsx/index.js +2 -2
  110. package/dist/design-jsx/renderer.d.ts +3 -2
  111. package/dist/design-jsx/renderer.d.ts.map +1 -1
  112. package/dist/design-jsx/renderer.js +2 -2
  113. package/dist/design-jsx/renderer.js.map +1 -1
  114. package/dist/design-memory/check.d.ts +90 -0
  115. package/dist/design-memory/check.d.ts.map +1 -0
  116. package/dist/design-memory/check.js +281 -0
  117. package/dist/design-memory/check.js.map +1 -0
  118. package/dist/design-memory/describe.d.ts +37 -0
  119. package/dist/design-memory/describe.d.ts.map +1 -0
  120. package/dist/design-memory/describe.js +52 -0
  121. package/dist/design-memory/describe.js.map +1 -0
  122. package/dist/design-memory/distil.d.ts +22 -0
  123. package/dist/design-memory/distil.d.ts.map +1 -0
  124. package/dist/design-memory/distil.js +54 -0
  125. package/dist/design-memory/distil.js.map +1 -0
  126. package/dist/design-memory/document.d.ts +12 -0
  127. package/dist/design-memory/document.d.ts.map +1 -0
  128. package/dist/design-memory/document.js +64 -0
  129. package/dist/design-memory/document.js.map +1 -0
  130. package/dist/design-memory/guard.d.ts +48 -0
  131. package/dist/design-memory/guard.d.ts.map +1 -0
  132. package/dist/design-memory/guard.js +105 -0
  133. package/dist/design-memory/guard.js.map +1 -0
  134. package/dist/design-memory/index.d.ts +9 -0
  135. package/dist/design-memory/index.js +9 -0
  136. package/dist/design-memory/refusal.d.ts +32 -0
  137. package/dist/design-memory/refusal.d.ts.map +1 -0
  138. package/dist/design-memory/refusal.js +68 -0
  139. package/dist/design-memory/refusal.js.map +1 -0
  140. package/dist/design-memory/rules.d.ts +63 -0
  141. package/dist/design-memory/rules.d.ts.map +1 -0
  142. package/dist/design-memory/rules.js +224 -0
  143. package/dist/design-memory/rules.js.map +1 -0
  144. package/dist/design-memory/values.d.ts +28 -0
  145. package/dist/design-memory/values.d.ts.map +1 -0
  146. package/dist/design-memory/values.js +160 -0
  147. package/dist/design-memory/values.js.map +1 -0
  148. package/dist/editor/alignment.js +1 -1
  149. package/dist/editor/bridges/components.d.ts +2 -0
  150. package/dist/editor/bridges/components.d.ts.map +1 -1
  151. package/dist/editor/bridges/components.js +2 -0
  152. package/dist/editor/bridges/components.js.map +1 -1
  153. package/dist/editor/bridges/undo.d.ts +1 -1
  154. package/dist/editor/clipboard/assets.js +1 -1
  155. package/dist/editor/clipboard/export.d.ts.map +1 -1
  156. package/dist/editor/clipboard/export.js +16 -2
  157. package/dist/editor/clipboard/export.js.map +1 -1
  158. package/dist/editor/clipboard/placement.d.ts +1 -1
  159. package/dist/editor/clipboard/placement.js +1 -1
  160. package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
  161. package/dist/editor/clipboard/snapshot.js +12 -4
  162. package/dist/editor/clipboard/snapshot.js.map +1 -1
  163. package/dist/editor/clipboard.d.ts.map +1 -1
  164. package/dist/editor/clipboard.js +2 -7
  165. package/dist/editor/clipboard.js.map +1 -1
  166. package/dist/editor/color-space.d.ts.map +1 -1
  167. package/dist/editor/color-space.js +33 -38
  168. package/dist/editor/color-space.js.map +1 -1
  169. package/dist/editor/components/instances.d.ts +2 -0
  170. package/dist/editor/components/instances.d.ts.map +1 -1
  171. package/dist/editor/components/instances.js +22 -1
  172. package/dist/editor/components/instances.js.map +1 -1
  173. package/dist/editor/components.d.ts +2 -0
  174. package/dist/editor/components.d.ts.map +1 -1
  175. package/dist/editor/connectors/attach.js +1 -1
  176. package/dist/editor/create.d.ts +36 -8
  177. package/dist/editor/create.d.ts.map +1 -1
  178. package/dist/editor/create.js +26 -61
  179. package/dist/editor/create.js.map +1 -1
  180. package/dist/editor/design-memory.d.ts +11 -0
  181. package/dist/editor/design-memory.d.ts.map +1 -0
  182. package/dist/editor/design-memory.js +40 -0
  183. package/dist/editor/design-memory.js.map +1 -0
  184. package/dist/editor/design-tokens.d.ts +4 -0
  185. package/dist/editor/design-tokens.d.ts.map +1 -1
  186. package/dist/editor/design-tokens.js +30 -1
  187. package/dist/editor/design-tokens.js.map +1 -1
  188. package/dist/editor/document-colors.d.ts +23 -0
  189. package/dist/editor/document-colors.d.ts.map +1 -0
  190. package/dist/editor/document-colors.js +53 -0
  191. package/dist/editor/document-colors.js.map +1 -0
  192. package/dist/editor/eyedropper.d.ts +47 -0
  193. package/dist/editor/eyedropper.d.ts.map +1 -0
  194. package/dist/editor/eyedropper.js +168 -0
  195. package/dist/editor/eyedropper.js.map +1 -0
  196. package/dist/editor/fonts.d.ts +9 -0
  197. package/dist/editor/fonts.d.ts.map +1 -0
  198. package/dist/editor/fonts.js +14 -0
  199. package/dist/editor/fonts.js.map +1 -0
  200. package/dist/editor/history/atomic-tool.d.ts +9 -2
  201. package/dist/editor/history/atomic-tool.d.ts.map +1 -1
  202. package/dist/editor/history/atomic-tool.js +6 -0
  203. package/dist/editor/history/atomic-tool.js.map +1 -1
  204. package/dist/editor/history/capture.d.ts +13 -0
  205. package/dist/editor/history/capture.d.ts.map +1 -0
  206. package/dist/editor/history/capture.js +28 -0
  207. package/dist/editor/history/capture.js.map +1 -0
  208. package/dist/editor/history/document-change.d.ts.map +1 -1
  209. package/dist/editor/history/document-change.js +2 -22
  210. package/dist/editor/history/document-change.js.map +1 -1
  211. package/dist/editor/history/edit.d.ts +7 -0
  212. package/dist/editor/history/edit.d.ts.map +1 -1
  213. package/dist/editor/history/edit.js +6 -3
  214. package/dist/editor/history/edit.js.map +1 -1
  215. package/dist/editor/history/subtree.d.ts +9 -0
  216. package/dist/editor/history/subtree.d.ts.map +1 -1
  217. package/dist/editor/history/subtree.js +12 -2
  218. package/dist/editor/history/subtree.js.map +1 -1
  219. package/dist/editor/index.d.ts +4 -2
  220. package/dist/editor/index.js +4 -2
  221. package/dist/editor/nudge.js +1 -1
  222. package/dist/editor/nudge.js.map +1 -1
  223. package/dist/editor/pages.d.ts +7 -5
  224. package/dist/editor/pages.d.ts.map +1 -1
  225. package/dist/editor/pages.js +35 -25
  226. package/dist/editor/pages.js.map +1 -1
  227. package/dist/editor/play/states.d.ts +3 -1
  228. package/dist/editor/play/states.d.ts.map +1 -1
  229. package/dist/editor/play/states.js +1 -1
  230. package/dist/editor/play/states.js.map +1 -1
  231. package/dist/editor/read-only/actions.js +6 -0
  232. package/dist/editor/read-only/actions.js.map +1 -1
  233. package/dist/editor/render-requests.d.ts +18 -0
  234. package/dist/editor/render-requests.d.ts.map +1 -0
  235. package/dist/editor/render-requests.js +76 -0
  236. package/dist/editor/render-requests.js.map +1 -0
  237. package/dist/editor/scale/rescale.d.ts +1 -1
  238. package/dist/editor/selection/container.d.ts +2 -0
  239. package/dist/editor/selection/container.d.ts.map +1 -1
  240. package/dist/editor/selection/container.js +17 -1
  241. package/dist/editor/selection/container.js.map +1 -1
  242. package/dist/editor/selection/navigation.js +7 -4
  243. package/dist/editor/selection/navigation.js.map +1 -1
  244. package/dist/editor/selection/overlays.d.ts.map +1 -1
  245. package/dist/editor/selection/overlays.js +1 -1
  246. package/dist/editor/selection/overlays.js.map +1 -1
  247. package/dist/editor/selection/read.d.ts +6 -2
  248. package/dist/editor/selection.d.ts +9 -2
  249. package/dist/editor/selection.d.ts.map +1 -1
  250. package/dist/editor/shapes/with-text.d.ts.map +1 -1
  251. package/dist/editor/shapes/with-text.js +2 -5
  252. package/dist/editor/shapes/with-text.js.map +1 -1
  253. package/dist/editor/structure/auto-layout-wrap.js +1 -1
  254. package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
  255. package/dist/editor/structure/boolean.d.ts +2 -3
  256. package/dist/editor/structure/boolean.d.ts.map +1 -1
  257. package/dist/editor/structure/boolean.js.map +1 -1
  258. package/dist/editor/structure/group/bounds.d.ts.map +1 -1
  259. package/dist/editor/structure/group/bounds.js +1 -3
  260. package/dist/editor/structure/group/bounds.js.map +1 -1
  261. package/dist/editor/structure/outline-stroke.js +3 -3
  262. package/dist/editor/structure/outline-stroke.js.map +1 -1
  263. package/dist/editor/structure/reorder.d.ts.map +1 -1
  264. package/dist/editor/structure/reorder.js +7 -14
  265. package/dist/editor/structure/reorder.js.map +1 -1
  266. package/dist/editor/structure/state.js +1 -1
  267. package/dist/editor/structure/state.js.map +1 -1
  268. package/dist/editor/structure.d.ts +1 -2
  269. package/dist/editor/structure.d.ts.map +1 -1
  270. package/dist/editor/structure.js +3 -3
  271. package/dist/editor/structure.js.map +1 -1
  272. package/dist/editor/tool-registry.d.ts.map +1 -1
  273. package/dist/editor/tool-registry.js +2 -1
  274. package/dist/editor/tool-registry.js.map +1 -1
  275. package/dist/editor/types.d.ts +9 -2
  276. package/dist/editor/types.d.ts.map +1 -1
  277. package/dist/editor/variables.d.ts.map +1 -1
  278. package/dist/editor/variables.js +57 -1
  279. package/dist/editor/variables.js.map +1 -1
  280. package/dist/editor/variations/create.d.ts +28 -0
  281. package/dist/editor/variations/create.d.ts.map +1 -0
  282. package/dist/editor/variations/create.js +176 -0
  283. package/dist/editor/variations/create.js.map +1 -0
  284. package/dist/editor/variations/pick.d.ts +16 -0
  285. package/dist/editor/variations/pick.d.ts.map +1 -0
  286. package/dist/editor/variations/pick.js +23 -0
  287. package/dist/editor/variations/pick.js.map +1 -0
  288. package/dist/editor/variations.d.ts +28 -0
  289. package/dist/editor/variations.d.ts.map +1 -0
  290. package/dist/editor/variations.js +88 -0
  291. package/dist/editor/variations.js.map +1 -0
  292. package/dist/figma-api/accessors/reactions.d.ts.map +1 -1
  293. package/dist/figma-api/accessors/reactions.js +4 -1
  294. package/dist/figma-api/accessors/reactions.js.map +1 -1
  295. package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
  296. package/dist/figma-api/accessors/text/index.js +7 -1
  297. package/dist/figma-api/accessors/text/index.js.map +1 -1
  298. package/dist/figma-api/accessors/text/opentype.d.ts +17 -0
  299. package/dist/figma-api/accessors/text/opentype.d.ts.map +1 -0
  300. package/dist/figma-api/accessors/text/opentype.js +28 -0
  301. package/dist/figma-api/accessors/text/opentype.js.map +1 -0
  302. package/dist/figma-api/accessors/visual.d.ts.map +1 -1
  303. package/dist/figma-api/accessors/visual.js +33 -0
  304. package/dist/figma-api/accessors/visual.js.map +1 -1
  305. package/dist/figma-api/effects.d.ts +79 -3
  306. package/dist/figma-api/effects.d.ts.map +1 -1
  307. package/dist/figma-api/effects.js +150 -9
  308. package/dist/figma-api/effects.js.map +1 -1
  309. package/dist/figma-api/fonts/loaded.d.ts +3 -1
  310. package/dist/figma-api/fonts/loaded.d.ts.map +1 -1
  311. package/dist/figma-api/fonts/loaded.js +8 -1
  312. package/dist/figma-api/fonts/loaded.js.map +1 -1
  313. package/dist/figma-api/index.d.ts +18 -0
  314. package/dist/figma-api/index.d.ts.map +1 -1
  315. package/dist/figma-api/index.js +19 -1
  316. package/dist/figma-api/index.js.map +1 -1
  317. package/dist/figma-api/overrides.d.ts +13 -1
  318. package/dist/figma-api/overrides.d.ts.map +1 -1
  319. package/dist/figma-api/overrides.js +196 -4
  320. package/dist/figma-api/overrides.js.map +1 -1
  321. package/dist/figma-api/paints.d.ts +3 -3
  322. package/dist/figma-api/paints.d.ts.map +1 -1
  323. package/dist/figma-api/paints.js +14 -4
  324. package/dist/figma-api/paints.js.map +1 -1
  325. package/dist/figma-api/proxy.d.ts +4 -1
  326. package/dist/figma-api/proxy.d.ts.map +1 -1
  327. package/dist/figma-api/proxy.js +1 -1
  328. package/dist/figma-api/proxy.js.map +1 -1
  329. package/dist/figma-api/reactions.d.ts +41 -13
  330. package/dist/figma-api/reactions.d.ts.map +1 -1
  331. package/dist/figma-api/reactions.js +113 -31
  332. package/dist/figma-api/reactions.js.map +1 -1
  333. package/dist/figma-api/render-bounds.js +1 -1
  334. package/dist/figma-api/serialization.d.ts.map +1 -1
  335. package/dist/figma-api/serialization.js +2 -1
  336. package/dist/figma-api/serialization.js.map +1 -1
  337. package/dist/figma-api/shape-details.d.ts +26 -0
  338. package/dist/figma-api/shape-details.d.ts.map +1 -0
  339. package/dist/figma-api/shape-details.js +28 -0
  340. package/dist/figma-api/shape-details.js.map +1 -0
  341. package/dist/figma-api/shape-with-text.js +2 -5
  342. package/dist/figma-api/shape-with-text.js.map +1 -1
  343. package/dist/figma-api/surface.d.ts +7 -4
  344. package/dist/figma-api/surface.d.ts.map +1 -1
  345. package/dist/figma-api/surface.js +7 -2
  346. package/dist/figma-api/surface.js.map +1 -1
  347. package/dist/figma-api/transform.d.ts +1 -1
  348. package/dist/geometry/figma.d.ts +1 -1
  349. package/dist/geometry/image-crop.d.ts +1 -1
  350. package/dist/geometry/image-crop.js +1 -1
  351. package/dist/icons/svg.js +1 -1
  352. package/dist/icons/svg.js.map +1 -1
  353. package/dist/index.d.ts +4 -2
  354. package/dist/index.js +4 -2
  355. package/dist/io/formats/boolean-path.d.ts +19 -0
  356. package/dist/io/formats/boolean-path.d.ts.map +1 -0
  357. package/dist/io/formats/boolean-path.js +47 -0
  358. package/dist/io/formats/boolean-path.js.map +1 -0
  359. package/dist/io/formats/design-tokens/decode.js +1 -1
  360. package/dist/io/formats/design-tokens/index.d.ts +4 -1
  361. package/dist/io/formats/design-tokens/index.js +4 -1
  362. package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
  363. package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
  364. package/dist/io/formats/design-tokens/plan/changes.js +1 -1
  365. package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
  366. package/dist/io/formats/design-tokens/project.d.ts +17 -2
  367. package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
  368. package/dist/io/formats/design-tokens/project.js +29 -8
  369. package/dist/io/formats/design-tokens/project.js.map +1 -1
  370. package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
  371. package/dist/io/formats/design-tokens/styles.js.map +1 -1
  372. package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
  373. package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
  374. package/dist/io/formats/design-tokens/sync/apply.js +73 -0
  375. package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
  376. package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
  377. package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
  378. package/dist/io/formats/design-tokens/sync/drift.js +391 -0
  379. package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
  380. package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
  381. package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
  382. package/dist/io/formats/design-tokens/sync/files.js +35 -0
  383. package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
  384. package/dist/io/formats/drawio/edges.d.ts +7 -1
  385. package/dist/io/formats/drawio/edges.d.ts.map +1 -1
  386. package/dist/io/formats/drawio/edges.js +54 -1
  387. package/dist/io/formats/drawio/edges.js.map +1 -1
  388. package/dist/io/formats/drawio/export.d.ts.map +1 -1
  389. package/dist/io/formats/drawio/export.js +19 -2
  390. package/dist/io/formats/drawio/export.js.map +1 -1
  391. package/dist/io/formats/drawio/index.d.ts.map +1 -1
  392. package/dist/io/formats/drawio/index.js +2 -1
  393. package/dist/io/formats/drawio/index.js.map +1 -1
  394. package/dist/io/formats/drawio/label.js +1 -1
  395. package/dist/io/formats/drawio/paint.js +1 -1
  396. package/dist/io/formats/drawio/placement.d.ts +1 -1
  397. package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
  398. package/dist/io/formats/fig/export/patch/index.js +5 -0
  399. package/dist/io/formats/fig/export/patch/index.js.map +1 -1
  400. package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
  401. package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
  402. package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
  403. package/dist/io/formats/html/import.d.ts.map +1 -1
  404. package/dist/io/formats/html/import.js +3 -1
  405. package/dist/io/formats/html/import.js.map +1 -1
  406. package/dist/io/formats/html/index.d.ts +2 -2
  407. package/dist/io/formats/html/index.d.ts.map +1 -1
  408. package/dist/io/formats/html/index.js +6 -4
  409. package/dist/io/formats/html/index.js.map +1 -1
  410. package/dist/io/formats/html/layers.d.ts +7 -4
  411. package/dist/io/formats/html/layers.d.ts.map +1 -1
  412. package/dist/io/formats/html/layers.js +4 -1
  413. package/dist/io/formats/html/layers.js.map +1 -1
  414. package/dist/io/formats/html/vectors.d.ts +2 -1
  415. package/dist/io/formats/html/vectors.d.ts.map +1 -1
  416. package/dist/io/formats/html/vectors.js +3 -2
  417. package/dist/io/formats/html/vectors.js.map +1 -1
  418. package/dist/io/formats/mermaid/styles.js +1 -1
  419. package/dist/io/formats/pdf/document.d.ts +3 -1
  420. package/dist/io/formats/pdf/document.d.ts.map +1 -1
  421. package/dist/io/formats/pdf/document.js +6 -3
  422. package/dist/io/formats/pdf/document.js.map +1 -1
  423. package/dist/io/formats/pdf/dom.d.ts +6 -1
  424. package/dist/io/formats/pdf/dom.d.ts.map +1 -1
  425. package/dist/io/formats/pdf/dom.js +9 -22
  426. package/dist/io/formats/pdf/dom.js.map +1 -1
  427. package/dist/io/formats/pdf/export.js +1 -1
  428. package/dist/io/formats/pdf/export.js.map +1 -1
  429. package/dist/io/formats/pdf/prepare.d.ts +1 -1
  430. package/dist/io/formats/pen/imports.d.ts +4 -1
  431. package/dist/io/formats/pen/imports.d.ts.map +1 -1
  432. package/dist/io/formats/pen/imports.js.map +1 -1
  433. package/dist/io/formats/pen/index.d.ts.map +1 -1
  434. package/dist/io/formats/pen/index.js +31 -3
  435. package/dist/io/formats/pen/index.js.map +1 -1
  436. package/dist/io/formats/pptx/export.js +1 -1
  437. package/dist/io/formats/pptx/geometry.d.ts +1 -1
  438. package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
  439. package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
  440. package/dist/io/formats/raster/adjusted-images.js +118 -0
  441. package/dist/io/formats/raster/adjusted-images.js.map +1 -0
  442. package/dist/io/formats/raster/headless.d.ts +11 -1
  443. package/dist/io/formats/raster/headless.d.ts.map +1 -1
  444. package/dist/io/formats/raster/headless.js +4 -4
  445. package/dist/io/formats/raster/headless.js.map +1 -1
  446. package/dist/io/formats/raster/index.d.ts +2 -2
  447. package/dist/io/formats/raster/pixels.d.ts +7 -1
  448. package/dist/io/formats/raster/pixels.d.ts.map +1 -1
  449. package/dist/io/formats/raster/pixels.js.map +1 -1
  450. package/dist/io/formats/raster/render.d.ts.map +1 -1
  451. package/dist/io/formats/raster/render.js +4 -0
  452. package/dist/io/formats/raster/render.js.map +1 -1
  453. package/dist/io/formats/svg/defs.d.ts +5 -6
  454. package/dist/io/formats/svg/defs.d.ts.map +1 -1
  455. package/dist/io/formats/svg/defs.js +4 -54
  456. package/dist/io/formats/svg/defs.js.map +1 -1
  457. package/dist/io/formats/svg/effects.d.ts +16 -0
  458. package/dist/io/formats/svg/effects.d.ts.map +1 -0
  459. package/dist/io/formats/svg/effects.js +126 -0
  460. package/dist/io/formats/svg/effects.js.map +1 -0
  461. package/dist/io/formats/svg/export.d.ts +7 -1
  462. package/dist/io/formats/svg/export.d.ts.map +1 -1
  463. package/dist/io/formats/svg/export.js +224 -50
  464. package/dist/io/formats/svg/export.js.map +1 -1
  465. package/dist/io/formats/svg/filter.d.ts +27 -0
  466. package/dist/io/formats/svg/filter.d.ts.map +1 -0
  467. package/dist/io/formats/svg/filter.js +44 -0
  468. package/dist/io/formats/svg/filter.js.map +1 -0
  469. package/dist/io/formats/svg/grain.d.ts +26 -0
  470. package/dist/io/formats/svg/grain.d.ts.map +1 -0
  471. package/dist/io/formats/svg/grain.js +298 -0
  472. package/dist/io/formats/svg/grain.js.map +1 -0
  473. package/dist/io/formats/svg/strokes.d.ts +1 -1
  474. package/dist/io/formats/svg/strokes.d.ts.map +1 -1
  475. package/dist/io/formats/svg/strokes.js +1 -2
  476. package/dist/io/formats/svg/strokes.js.map +1 -1
  477. package/dist/io/formats/svg/text/import.js +1 -1
  478. package/dist/io/formats/svg/text/layout.d.ts +5 -2
  479. package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
  480. package/dist/io/formats/svg/text/layout.js +6 -3
  481. package/dist/io/formats/svg/text/layout.js.map +1 -1
  482. package/dist/io/formats/video/composite.d.ts +18 -0
  483. package/dist/io/formats/video/composite.d.ts.map +1 -0
  484. package/dist/io/formats/video/composite.js +79 -0
  485. package/dist/io/formats/video/composite.js.map +1 -0
  486. package/dist/io/formats/video/formats.d.ts +29 -0
  487. package/dist/io/formats/video/formats.d.ts.map +1 -0
  488. package/dist/io/formats/video/formats.js +43 -0
  489. package/dist/io/formats/video/formats.js.map +1 -0
  490. package/dist/io/formats/video/gif.d.ts +13 -0
  491. package/dist/io/formats/video/gif.d.ts.map +1 -0
  492. package/dist/io/formats/video/gif.js +56 -0
  493. package/dist/io/formats/video/gif.js.map +1 -0
  494. package/dist/io/formats/video/index.d.ts +9 -0
  495. package/dist/io/formats/video/index.js +9 -0
  496. package/dist/io/formats/video/plan.d.ts +64 -0
  497. package/dist/io/formats/video/plan.d.ts.map +1 -0
  498. package/dist/io/formats/video/plan.js +90 -0
  499. package/dist/io/formats/video/plan.js.map +1 -0
  500. package/dist/io/formats/video/record.d.ts +36 -0
  501. package/dist/io/formats/video/record.d.ts.map +1 -0
  502. package/dist/io/formats/video/record.js +154 -0
  503. package/dist/io/formats/video/record.js.map +1 -0
  504. package/dist/io/formats/video/sink.d.ts +29 -0
  505. package/dist/io/formats/video/sink.d.ts.map +1 -0
  506. package/dist/io/formats/video/sink.js +16 -0
  507. package/dist/io/formats/video/sink.js.map +1 -0
  508. package/dist/io/formats/video/size.d.ts +19 -0
  509. package/dist/io/formats/video/size.d.ts.map +1 -0
  510. package/dist/io/formats/video/size.js +26 -0
  511. package/dist/io/formats/video/size.js.map +1 -0
  512. package/dist/io/formats/video/webcodecs.d.ts +18 -0
  513. package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
  514. package/dist/io/formats/video/webcodecs.js +74 -0
  515. package/dist/io/formats/video/webcodecs.js.map +1 -0
  516. package/dist/io/formats.d.ts.map +1 -1
  517. package/dist/io/formats.js +40 -11
  518. package/dist/io/formats.js.map +1 -1
  519. package/dist/io/types.d.ts +19 -4
  520. package/dist/io/types.d.ts.map +1 -1
  521. package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
  522. package/dist/layout/apply.d.ts.map +1 -1
  523. package/dist/layout/apply.js +50 -12
  524. package/dist/layout/apply.js.map +1 -1
  525. package/dist/layout/auto-layout-handles.d.ts +66 -0
  526. package/dist/layout/auto-layout-handles.d.ts.map +1 -0
  527. package/dist/layout/auto-layout-handles.js +291 -0
  528. package/dist/layout/auto-layout-handles.js.map +1 -0
  529. package/dist/layout/derived.d.ts +7 -1
  530. package/dist/layout/derived.d.ts.map +1 -1
  531. package/dist/layout/derived.js +11 -1
  532. package/dist/layout/derived.js.map +1 -1
  533. package/dist/layout/grid.d.ts +7 -2
  534. package/dist/layout/grid.d.ts.map +1 -1
  535. package/dist/layout/grid.js +27 -9
  536. package/dist/layout/grid.js.map +1 -1
  537. package/dist/layout/mutations.d.ts +1 -0
  538. package/dist/layout/mutations.d.ts.map +1 -1
  539. package/dist/layout/mutations.js +10 -0
  540. package/dist/layout/mutations.js.map +1 -1
  541. package/dist/layout/strokes.d.ts +9 -1
  542. package/dist/layout/strokes.d.ts.map +1 -1
  543. package/dist/layout/strokes.js +12 -1
  544. package/dist/layout/strokes.js.map +1 -1
  545. package/dist/layout/yoga-helpers.d.ts +3 -1
  546. package/dist/layout/yoga-helpers.d.ts.map +1 -1
  547. package/dist/layout/yoga-helpers.js +16 -2
  548. package/dist/layout/yoga-helpers.js.map +1 -1
  549. package/dist/layout.d.ts +3 -2
  550. package/dist/layout.d.ts.map +1 -1
  551. package/dist/layout.js +73 -39
  552. package/dist/layout.js.map +1 -1
  553. package/dist/lint/fixes.d.ts.map +1 -1
  554. package/dist/lint/fixes.js +9 -3
  555. package/dist/lint/fixes.js.map +1 -1
  556. package/dist/lint/index.d.ts +3 -2
  557. package/dist/lint/index.js +2 -1
  558. package/dist/lint/linter.d.ts +13 -0
  559. package/dist/lint/linter.d.ts.map +1 -1
  560. package/dist/lint/linter.js +123 -9
  561. package/dist/lint/linter.js.map +1 -1
  562. package/dist/lint/presets.d.ts.map +1 -1
  563. package/dist/lint/presets.js +2 -0
  564. package/dist/lint/presets.js.map +1 -1
  565. package/dist/lint/rules/design-memory.d.ts +15 -0
  566. package/dist/lint/rules/design-memory.d.ts.map +1 -0
  567. package/dist/lint/rules/design-memory.js +90 -0
  568. package/dist/lint/rules/design-memory.js.map +1 -0
  569. package/dist/lint/rules/effect-style-required.js +1 -0
  570. package/dist/lint/rules/effect-style-required.js.map +1 -1
  571. package/dist/lint/rules/index.d.ts +6 -5
  572. package/dist/lint/rules/index.d.ts.map +1 -1
  573. package/dist/lint/rules/index.js +6 -2
  574. package/dist/lint/rules/index.js.map +1 -1
  575. package/dist/lint/rules/no-unbound-token-values.d.ts +6 -0
  576. package/dist/lint/rules/no-unbound-token-values.d.ts.map +1 -0
  577. package/dist/lint/rules/no-unbound-token-values.js +79 -0
  578. package/dist/lint/rules/no-unbound-token-values.js.map +1 -0
  579. package/dist/lint/rules/text-style-required.js +1 -0
  580. package/dist/lint/rules/text-style-required.js.map +1 -1
  581. package/dist/lint/types.d.ts +32 -2
  582. package/dist/lint/types.d.ts.map +1 -1
  583. package/dist/node/video.d.ts +12 -0
  584. package/dist/node/video.d.ts.map +1 -0
  585. package/dist/node/video.js +206 -0
  586. package/dist/node/video.js.map +1 -0
  587. package/dist/pairdraw-api/design-memory.d.ts +19 -0
  588. package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
  589. package/dist/pairdraw-api/design-memory.js +39 -0
  590. package/dist/pairdraw-api/design-memory.js.map +1 -0
  591. package/dist/pairdraw-api/index.d.ts +45 -1
  592. package/dist/pairdraw-api/index.d.ts.map +1 -1
  593. package/dist/pairdraw-api/index.js +55 -2
  594. package/dist/pairdraw-api/index.js.map +1 -1
  595. package/dist/pairdraw-api/nodes.d.ts +12 -1
  596. package/dist/pairdraw-api/nodes.d.ts.map +1 -1
  597. package/dist/pairdraw-api/nodes.js +28 -1
  598. package/dist/pairdraw-api/nodes.js.map +1 -1
  599. package/dist/pairdraw-api/variations.d.ts +48 -0
  600. package/dist/pairdraw-api/variations.d.ts.map +1 -0
  601. package/dist/pairdraw-api/variations.js +76 -0
  602. package/dist/pairdraw-api/variations.js.map +1 -0
  603. package/dist/prototype/easing.d.ts +13 -0
  604. package/dist/prototype/easing.d.ts.map +1 -0
  605. package/dist/prototype/easing.js +36 -0
  606. package/dist/prototype/easing.js.map +1 -0
  607. package/dist/prototype/frames.d.ts +10 -0
  608. package/dist/prototype/frames.d.ts.map +1 -0
  609. package/dist/prototype/frames.js +12 -0
  610. package/dist/prototype/frames.js.map +1 -0
  611. package/dist/prototype/hit.d.ts +17 -0
  612. package/dist/prototype/hit.d.ts.map +1 -0
  613. package/dist/prototype/hit.js +45 -0
  614. package/dist/prototype/hit.js.map +1 -0
  615. package/dist/prototype/index.d.ts +14 -0
  616. package/dist/prototype/index.js +14 -0
  617. package/dist/prototype/pointer.d.ts +63 -0
  618. package/dist/prototype/pointer.d.ts.map +1 -0
  619. package/dist/prototype/pointer.js +104 -0
  620. package/dist/prototype/pointer.js.map +1 -0
  621. package/dist/prototype/reactions.d.ts +45 -0
  622. package/dist/prototype/reactions.d.ts.map +1 -0
  623. package/dist/prototype/reactions.js +122 -0
  624. package/dist/prototype/reactions.js.map +1 -0
  625. package/dist/prototype/scene.d.ts +35 -0
  626. package/dist/prototype/scene.d.ts.map +1 -0
  627. package/dist/prototype/scene.js +86 -0
  628. package/dist/prototype/scene.js.map +1 -0
  629. package/dist/prototype/scenes.d.ts +81 -0
  630. package/dist/prototype/scenes.d.ts.map +1 -0
  631. package/dist/prototype/scenes.js +175 -0
  632. package/dist/prototype/scenes.js.map +1 -0
  633. package/dist/prototype/scroll.d.ts +48 -0
  634. package/dist/prototype/scroll.d.ts.map +1 -0
  635. package/dist/prototype/scroll.js +159 -0
  636. package/dist/prototype/scroll.js.map +1 -0
  637. package/dist/prototype/session.d.ts +71 -0
  638. package/dist/prototype/session.d.ts.map +1 -0
  639. package/dist/prototype/session.js +135 -0
  640. package/dist/prototype/session.js.map +1 -0
  641. package/dist/prototype/smart-animate/animation.d.ts +34 -0
  642. package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
  643. package/dist/prototype/smart-animate/animation.js +212 -0
  644. package/dist/prototype/smart-animate/animation.js.map +1 -0
  645. package/dist/prototype/smart-animate/match.d.ts +24 -0
  646. package/dist/prototype/smart-animate/match.d.ts.map +1 -0
  647. package/dist/prototype/smart-animate/match.js +72 -0
  648. package/dist/prototype/smart-animate/match.js.map +1 -0
  649. package/dist/prototype/snapshot.d.ts +19 -0
  650. package/dist/prototype/snapshot.d.ts.map +1 -0
  651. package/dist/prototype/snapshot.js +56 -0
  652. package/dist/prototype/snapshot.js.map +1 -0
  653. package/dist/prototype/timeline.d.ts +132 -0
  654. package/dist/prototype/timeline.d.ts.map +1 -0
  655. package/dist/prototype/timeline.js +260 -0
  656. package/dist/prototype/timeline.js.map +1 -0
  657. package/dist/rpc/commands.d.ts +2 -2
  658. package/dist/rpc/index.d.ts +2 -2
  659. package/dist/rpc/read-commands.d.ts +18 -8
  660. package/dist/rpc/read-commands.d.ts.map +1 -1
  661. package/dist/rpc/read-commands.js +18 -9
  662. package/dist/rpc/read-commands.js.map +1 -1
  663. package/dist/text/font/faces.d.ts +12 -1
  664. package/dist/text/font/faces.d.ts.map +1 -1
  665. package/dist/text/font/faces.js +15 -1
  666. package/dist/text/font/faces.js.map +1 -1
  667. package/dist/text/font/features.d.ts +9 -0
  668. package/dist/text/font/features.d.ts.map +1 -0
  669. package/dist/text/font/features.js +27 -0
  670. package/dist/text/font/features.js.map +1 -0
  671. package/dist/text/font/manager.d.ts +12 -0
  672. package/dist/text/font/manager.d.ts.map +1 -1
  673. package/dist/text/font/manager.js +66 -12
  674. package/dist/text/font/manager.js.map +1 -1
  675. package/dist/text/index.d.ts +11 -9
  676. package/dist/text/index.js +4 -2
  677. package/dist/text/replace-fonts.d.ts +41 -0
  678. package/dist/text/replace-fonts.d.ts.map +1 -0
  679. package/dist/text/replace-fonts.js +121 -0
  680. package/dist/text/replace-fonts.js.map +1 -0
  681. package/dist/tools/analyze/responsive/index.d.ts +15 -0
  682. package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
  683. package/dist/tools/analyze/responsive/index.js +203 -0
  684. package/dist/tools/analyze/responsive/index.js.map +1 -0
  685. package/dist/tools/analyze.d.ts +2 -1
  686. package/dist/tools/analyze.js +2 -1
  687. package/dist/tools/codegen/token-sync.d.ts +7 -0
  688. package/dist/tools/codegen/token-sync.d.ts.map +1 -0
  689. package/dist/tools/codegen/token-sync.js +85 -0
  690. package/dist/tools/codegen/token-sync.js.map +1 -0
  691. package/dist/tools/codegen/tokens.d.ts +1 -1
  692. package/dist/tools/codegen.d.ts +2 -1
  693. package/dist/tools/codegen.js +2 -1
  694. package/dist/tools/create/basic.js +1 -1
  695. package/dist/tools/create/behaviours.js +1 -1
  696. package/dist/tools/create/components.d.ts.map +1 -1
  697. package/dist/tools/create/components.js +4 -0
  698. package/dist/tools/create/components.js.map +1 -1
  699. package/dist/tools/create/html.js +3 -2
  700. package/dist/tools/create/html.js.map +1 -1
  701. package/dist/tools/create/icons.d.ts.map +1 -1
  702. package/dist/tools/create/icons.js +2 -1
  703. package/dist/tools/create/icons.js.map +1 -1
  704. package/dist/tools/create/mermaid.js +2 -1
  705. package/dist/tools/create/mermaid.js.map +1 -1
  706. package/dist/tools/create/render.js +1 -1
  707. package/dist/tools/create/svg.js +2 -1
  708. package/dist/tools/create/svg.js.map +1 -1
  709. package/dist/tools/create/vector.js +1 -1
  710. package/dist/tools/design-memory.d.ts +8 -0
  711. package/dist/tools/design-memory.d.ts.map +1 -0
  712. package/dist/tools/design-memory.js +68 -0
  713. package/dist/tools/design-memory.js.map +1 -0
  714. package/dist/tools/image-ai/generate.d.ts.map +1 -1
  715. package/dist/tools/image-ai/generate.js +3 -1
  716. package/dist/tools/image-ai/generate.js.map +1 -1
  717. package/dist/tools/index.d.ts +2 -1
  718. package/dist/tools/index.js +2 -1
  719. package/dist/tools/modify/fonts.d.ts +6 -0
  720. package/dist/tools/modify/fonts.d.ts.map +1 -0
  721. package/dist/tools/modify/fonts.js +27 -0
  722. package/dist/tools/modify/fonts.js.map +1 -0
  723. package/dist/tools/modify/layout.d.ts.map +1 -1
  724. package/dist/tools/modify/layout.js +1 -0
  725. package/dist/tools/modify/layout.js.map +1 -1
  726. package/dist/tools/modify/paint.js +1 -1
  727. package/dist/tools/modify/reactions.d.ts.map +1 -1
  728. package/dist/tools/modify/reactions.js +3 -3
  729. package/dist/tools/modify/reactions.js.map +1 -1
  730. package/dist/tools/modify/text.d.ts.map +1 -1
  731. package/dist/tools/modify/text.js +26 -5
  732. package/dist/tools/modify/text.js.map +1 -1
  733. package/dist/tools/modify/update.d.ts +10 -1
  734. package/dist/tools/modify/update.d.ts.map +1 -1
  735. package/dist/tools/modify/update.js +34 -3
  736. package/dist/tools/modify/update.js.map +1 -1
  737. package/dist/tools/modify.d.ts +2 -1
  738. package/dist/tools/modify.js +2 -1
  739. package/dist/tools/read/fonts.d.ts.map +1 -1
  740. package/dist/tools/read/fonts.js +17 -2
  741. package/dist/tools/read/fonts.js.map +1 -1
  742. package/dist/tools/read/libraries.js +2 -1
  743. package/dist/tools/read/libraries.js.map +1 -1
  744. package/dist/tools/read/nodes.d.ts.map +1 -1
  745. package/dist/tools/read/nodes.js.map +1 -1
  746. package/dist/tools/read/space.d.ts +3 -1
  747. package/dist/tools/read/space.d.ts.map +1 -1
  748. package/dist/tools/read/space.js +4 -3
  749. package/dist/tools/read/space.js.map +1 -1
  750. package/dist/tools/registry/core.d.ts +1 -1
  751. package/dist/tools/registry/core.d.ts.map +1 -1
  752. package/dist/tools/registry/core.js +3 -1
  753. package/dist/tools/registry/core.js.map +1 -1
  754. package/dist/tools/registry/extended.d.ts.map +1 -1
  755. package/dist/tools/registry/extended.js +16 -1
  756. package/dist/tools/registry/extended.js.map +1 -1
  757. package/dist/tools/schema.d.ts +18 -2
  758. package/dist/tools/schema.d.ts.map +1 -1
  759. package/dist/tools/schema.js +1 -1
  760. package/dist/tools/schema.js.map +1 -1
  761. package/dist/tools/stock-photo.js +1 -0
  762. package/dist/tools/stock-photo.js.map +1 -1
  763. package/dist/tools/structure/basic.d.ts.map +1 -1
  764. package/dist/tools/structure/basic.js +1 -0
  765. package/dist/tools/structure/basic.js.map +1 -1
  766. package/dist/tools/structure/batch.d.ts.map +1 -1
  767. package/dist/tools/structure/batch.js +22 -1
  768. package/dist/tools/structure/batch.js.map +1 -1
  769. package/dist/tools/structure/hierarchy.d.ts.map +1 -1
  770. package/dist/tools/structure/hierarchy.js +4 -0
  771. package/dist/tools/structure/hierarchy.js.map +1 -1
  772. package/dist/tools/structure/variations.d.ts +8 -0
  773. package/dist/tools/structure/variations.d.ts.map +1 -0
  774. package/dist/tools/structure/variations.js +106 -0
  775. package/dist/tools/structure/variations.js.map +1 -0
  776. package/dist/tools/structure.d.ts +2 -1
  777. package/dist/tools/structure.js +2 -1
  778. package/dist/tools/styles/types.d.ts +2 -4
  779. package/dist/tools/styles/types.d.ts.map +1 -1
  780. package/dist/tools/styles/types.js.map +1 -1
  781. package/dist/tools/vector/boolean.d.ts.map +1 -1
  782. package/dist/tools/vector/boolean.js +4 -0
  783. package/dist/tools/vector/boolean.js.map +1 -1
  784. package/dist/tools/vector/path.d.ts.map +1 -1
  785. package/dist/tools/vector/path.js +39 -7
  786. package/dist/tools/vector/path.js.map +1 -1
  787. package/dist/tools/vector/vectorize.js +1 -0
  788. package/dist/tools/vector/vectorize.js.map +1 -1
  789. package/dist/tools/vector/video.d.ts +6 -0
  790. package/dist/tools/vector/video.d.ts.map +1 -0
  791. package/dist/tools/vector/video.js +133 -0
  792. package/dist/tools/vector/video.js.map +1 -0
  793. package/dist/tools/vector.d.ts +2 -1
  794. package/dist/tools/vector.js +2 -1
  795. package/dist/tools/video-host.d.ts +12 -0
  796. package/dist/tools/video-host.d.ts.map +1 -0
  797. package/dist/tools/video-host.js +19 -0
  798. package/dist/tools/video-host.js.map +1 -0
  799. package/dist/vector/point-transform.d.ts +1 -1
  800. package/dist/vector/vectorize/svg/to-vectors.d.ts +1 -1
  801. package/dist/xpath.d.ts +3 -0
  802. package/dist/xpath.d.ts.map +1 -1
  803. package/dist/xpath.js +3 -1
  804. package/dist/xpath.js.map +1 -1
  805. package/package.json +31 -9
  806. package/src/ai/providers.ts +2 -0
  807. package/src/cache/resource.ts +24 -1
  808. package/src/canvas/effects.ts +47 -50
  809. package/src/canvas/fills.ts +19 -15
  810. package/src/canvas/images/adjustments.ts +203 -0
  811. package/src/canvas/images/sampling.ts +88 -0
  812. package/src/canvas/index.ts +1 -0
  813. package/src/canvas/masks.ts +1 -1
  814. package/src/canvas/noise/render.ts +75 -0
  815. package/src/canvas/noise/shader.ts +161 -0
  816. package/src/canvas/noise/table.ts +91 -0
  817. package/src/canvas/noise/tile.ts +94 -0
  818. package/src/canvas/overlays/auto-layout-hover.ts +47 -65
  819. package/src/canvas/overlays/index.ts +0 -1
  820. package/src/canvas/overlays/selection.ts +1 -12
  821. package/src/canvas/renderer/fonts.ts +2 -0
  822. package/src/canvas/renderer/lifecycle.ts +6 -0
  823. package/src/canvas/renderer/methods.ts +0 -9
  824. package/src/canvas/renderer/overlay-pass.ts +0 -1
  825. package/src/canvas/renderer/pipeline.ts +19 -2
  826. package/src/canvas/renderer/play-scenes.ts +51 -0
  827. package/src/canvas/renderer/tiles/cache.ts +54 -1
  828. package/src/canvas/renderer/tiles/controller.ts +30 -1
  829. package/src/canvas/renderer/types.ts +18 -3
  830. package/src/canvas/renderer.ts +40 -4
  831. package/src/canvas/scene.ts +65 -9
  832. package/src/canvas/texture.ts +136 -0
  833. package/src/clipboard.ts +23 -10
  834. package/src/constants.ts +6 -0
  835. package/src/design-jsx/index.ts +1 -1
  836. package/src/design-jsx/renderer.ts +1 -1
  837. package/src/design-memory/check.ts +376 -0
  838. package/src/design-memory/describe.ts +77 -0
  839. package/src/design-memory/distil.ts +69 -0
  840. package/src/design-memory/document.ts +80 -0
  841. package/src/design-memory/guard.ts +157 -0
  842. package/src/design-memory/index.ts +8 -0
  843. package/src/design-memory/refusal.ts +90 -0
  844. package/src/design-memory/rules.ts +274 -0
  845. package/src/design-memory/values.ts +179 -0
  846. package/src/editor/bridges/components.ts +2 -0
  847. package/src/editor/clipboard/export.ts +24 -7
  848. package/src/editor/clipboard/snapshot.ts +21 -4
  849. package/src/editor/clipboard.ts +4 -14
  850. package/src/editor/color-space.ts +47 -38
  851. package/src/editor/components/instances.ts +31 -0
  852. package/src/editor/create.ts +39 -71
  853. package/src/editor/design-memory.ts +39 -0
  854. package/src/editor/design-tokens.ts +41 -2
  855. package/src/editor/document-colors.ts +65 -0
  856. package/src/editor/eyedropper.ts +198 -0
  857. package/src/editor/fonts.ts +19 -0
  858. package/src/editor/history/atomic-tool.ts +29 -1
  859. package/src/editor/history/capture.ts +19 -0
  860. package/src/editor/history/document-change.ts +5 -17
  861. package/src/editor/history/edit.ts +16 -2
  862. package/src/editor/history/subtree.ts +13 -2
  863. package/src/editor/index.ts +11 -0
  864. package/src/editor/nudge.ts +1 -1
  865. package/src/editor/pages.ts +40 -29
  866. package/src/editor/play/states.ts +1 -1
  867. package/src/editor/read-only/actions.ts +6 -0
  868. package/src/editor/render-requests.ts +83 -0
  869. package/src/editor/selection/container.ts +24 -1
  870. package/src/editor/selection/navigation.ts +8 -6
  871. package/src/editor/selection/overlays.ts +1 -0
  872. package/src/editor/shapes/with-text.ts +2 -5
  873. package/src/editor/structure/auto-layout-wrap.ts +1 -1
  874. package/src/editor/structure/boolean.ts +1 -3
  875. package/src/editor/structure/group/bounds.ts +1 -5
  876. package/src/editor/structure/outline-stroke.ts +3 -3
  877. package/src/editor/structure/reorder.ts +8 -14
  878. package/src/editor/structure/state.ts +1 -1
  879. package/src/editor/structure.ts +5 -8
  880. package/src/editor/tool-registry.ts +2 -1
  881. package/src/editor/types.ts +8 -1
  882. package/src/editor/variables.ts +74 -2
  883. package/src/editor/variations/create.ts +235 -0
  884. package/src/editor/variations/pick.ts +35 -0
  885. package/src/editor/variations.ts +110 -0
  886. package/src/figma-api/accessors/reactions.ts +11 -1
  887. package/src/figma-api/accessors/text/index.ts +17 -1
  888. package/src/figma-api/accessors/text/opentype.ts +33 -0
  889. package/src/figma-api/accessors/visual.ts +55 -2
  890. package/src/figma-api/compatibility.ts +5 -2
  891. package/src/figma-api/effects.ts +143 -5
  892. package/src/figma-api/fonts/loaded.ts +9 -0
  893. package/src/figma-api/index.ts +35 -0
  894. package/src/figma-api/overrides.ts +295 -3
  895. package/src/figma-api/paints.ts +24 -9
  896. package/src/figma-api/proxy.ts +6 -1
  897. package/src/figma-api/reactions.ts +130 -32
  898. package/src/figma-api/serialization.ts +2 -1
  899. package/src/figma-api/shape-details.ts +50 -0
  900. package/src/figma-api/shape-with-text.ts +2 -5
  901. package/src/figma-api/surface.ts +7 -2
  902. package/src/global.d.ts +31 -0
  903. package/src/icons/svg.ts +3 -1
  904. package/src/io/formats/boolean-path.ts +60 -0
  905. package/src/io/formats/design-tokens/index.ts +21 -0
  906. package/src/io/formats/design-tokens/plan/changes.ts +4 -1
  907. package/src/io/formats/design-tokens/project.ts +40 -9
  908. package/src/io/formats/design-tokens/styles.ts +10 -2
  909. package/src/io/formats/design-tokens/sync/apply.ts +130 -0
  910. package/src/io/formats/design-tokens/sync/drift.ts +587 -0
  911. package/src/io/formats/design-tokens/sync/files.ts +40 -0
  912. package/src/io/formats/drawio/edges.ts +65 -0
  913. package/src/io/formats/drawio/export.ts +37 -14
  914. package/src/io/formats/drawio/index.ts +5 -1
  915. package/src/io/formats/fig/export/patch/index.ts +8 -0
  916. package/src/io/formats/fig/thumbnail-page.ts +4 -4
  917. package/src/io/formats/html/import.ts +9 -1
  918. package/src/io/formats/html/index.ts +14 -7
  919. package/src/io/formats/html/layers.ts +11 -2
  920. package/src/io/formats/html/vectors.ts +8 -2
  921. package/src/io/formats/pdf/document.ts +14 -4
  922. package/src/io/formats/pdf/dom.ts +10 -18
  923. package/src/io/formats/pdf/export.ts +1 -1
  924. package/src/io/formats/pen/imports.ts +5 -6
  925. package/src/io/formats/pen/index.ts +36 -5
  926. package/src/io/formats/raster/adjusted-images.ts +125 -0
  927. package/src/io/formats/raster/headless.ts +3 -3
  928. package/src/io/formats/raster/index.ts +6 -1
  929. package/src/io/formats/raster/pixels.ts +7 -0
  930. package/src/io/formats/raster/render.ts +12 -1
  931. package/src/io/formats/svg/defs.ts +14 -73
  932. package/src/io/formats/svg/effects.ts +131 -0
  933. package/src/io/formats/svg/export.ts +371 -64
  934. package/src/io/formats/svg/filter.ts +47 -0
  935. package/src/io/formats/svg/grain.ts +249 -0
  936. package/src/io/formats/svg/strokes.ts +2 -2
  937. package/src/io/formats/svg/text/layout.ts +13 -3
  938. package/src/io/formats/video/composite.ts +79 -0
  939. package/src/io/formats/video/formats.ts +77 -0
  940. package/src/io/formats/video/gif.ts +65 -0
  941. package/src/io/formats/video/index.ts +30 -0
  942. package/src/io/formats/video/plan.ts +116 -0
  943. package/src/io/formats/video/record.ts +227 -0
  944. package/src/io/formats/video/sink.ts +32 -0
  945. package/src/io/formats/video/size.ts +25 -0
  946. package/src/io/formats/video/webcodecs.ts +89 -0
  947. package/src/io/formats.ts +59 -11
  948. package/src/io/types.ts +29 -10
  949. package/src/layout/apply.ts +87 -21
  950. package/src/layout/auto-layout-handles.ts +396 -0
  951. package/src/layout/derived.ts +14 -0
  952. package/src/layout/grid.ts +33 -9
  953. package/src/layout/mutations.ts +13 -1
  954. package/src/layout/strokes.ts +12 -0
  955. package/src/layout/yoga-helpers.ts +18 -1
  956. package/src/layout.ts +96 -49
  957. package/src/lint/fixes.ts +12 -3
  958. package/src/lint/index.ts +3 -1
  959. package/src/lint/linter.ts +124 -12
  960. package/src/lint/presets.ts +2 -0
  961. package/src/lint/rules/design-memory.ts +97 -0
  962. package/src/lint/rules/effect-style-required.ts +2 -0
  963. package/src/lint/rules/index.ts +6 -1
  964. package/src/lint/rules/no-unbound-token-values.ts +73 -0
  965. package/src/lint/rules/text-style-required.ts +2 -0
  966. package/src/lint/types.ts +40 -0
  967. package/src/node/video.ts +196 -0
  968. package/src/pairdraw-api/design-memory.ts +61 -0
  969. package/src/pairdraw-api/index.ts +81 -0
  970. package/src/pairdraw-api/nodes.ts +38 -0
  971. package/src/pairdraw-api/variations.ts +109 -0
  972. package/src/prototype/easing.ts +37 -0
  973. package/src/prototype/frames.ts +9 -0
  974. package/src/prototype/hit.ts +70 -0
  975. package/src/prototype/index.ts +69 -0
  976. package/src/prototype/pointer.ts +146 -0
  977. package/src/prototype/reactions.ts +178 -0
  978. package/src/prototype/scene.ts +116 -0
  979. package/src/prototype/scenes.ts +256 -0
  980. package/src/prototype/scroll.ts +190 -0
  981. package/src/prototype/session.ts +188 -0
  982. package/src/prototype/smart-animate/animation.ts +267 -0
  983. package/src/prototype/smart-animate/match.ts +85 -0
  984. package/src/prototype/snapshot.ts +60 -0
  985. package/src/prototype/timeline.ts +400 -0
  986. package/src/rpc/index.ts +1 -0
  987. package/src/rpc/read-commands.ts +40 -23
  988. package/src/text/font/faces.ts +22 -0
  989. package/src/text/font/features.ts +27 -0
  990. package/src/text/font/manager.ts +88 -12
  991. package/src/text/index.ts +2 -0
  992. package/src/text/replace-fonts.ts +171 -0
  993. package/src/tools/analyze/responsive/index.ts +264 -0
  994. package/src/tools/analyze.ts +2 -0
  995. package/src/tools/codegen/token-sync.ts +98 -0
  996. package/src/tools/codegen.ts +1 -0
  997. package/src/tools/create/components.ts +4 -0
  998. package/src/tools/create/html.ts +1 -0
  999. package/src/tools/create/icons.ts +1 -0
  1000. package/src/tools/create/mermaid.ts +1 -0
  1001. package/src/tools/create/svg.ts +1 -0
  1002. package/src/tools/design-memory.ts +72 -0
  1003. package/src/tools/image-ai/generate.ts +2 -0
  1004. package/src/tools/index.ts +1 -0
  1005. package/src/tools/modify/fonts.ts +34 -0
  1006. package/src/tools/modify/layout.ts +5 -0
  1007. package/src/tools/modify/reactions.ts +15 -8
  1008. package/src/tools/modify/text.ts +42 -5
  1009. package/src/tools/modify/update.ts +46 -2
  1010. package/src/tools/modify.ts +1 -0
  1011. package/src/tools/read/fonts.ts +24 -2
  1012. package/src/tools/read/libraries.ts +1 -0
  1013. package/src/tools/read/nodes.ts +0 -1
  1014. package/src/tools/read/space.ts +3 -2
  1015. package/src/tools/registry/core.ts +3 -1
  1016. package/src/tools/registry/extended.ts +28 -1
  1017. package/src/tools/schema.ts +28 -4
  1018. package/src/tools/stock-photo.ts +1 -0
  1019. package/src/tools/structure/basic.ts +1 -0
  1020. package/src/tools/structure/batch.ts +34 -1
  1021. package/src/tools/structure/hierarchy.ts +4 -0
  1022. package/src/tools/structure/variations.ts +118 -0
  1023. package/src/tools/structure.ts +2 -0
  1024. package/src/tools/styles/types.ts +3 -4
  1025. package/src/tools/vector/boolean.ts +4 -0
  1026. package/src/tools/vector/path.ts +30 -6
  1027. package/src/tools/vector/vectorize.ts +1 -0
  1028. package/src/tools/vector/video.ts +228 -0
  1029. package/src/tools/vector.ts +1 -0
  1030. package/src/tools/video-host.ts +18 -0
  1031. package/src/xpath.ts +6 -1
@@ -1,19 +1,37 @@
1
- import { configureAbsoluteChild, createYogaNode, mapGridTrack } from "./yoga-helpers.js";
2
- import { applyContentInsets, applyStrokeMargins } from "./strokes.js";
1
+ import { keepsSavedFrameSize } from "./derived.js";
2
+ import { applyMinMaxConstraints, configureAbsoluteChild, createYogaNode, mapGridTrack } from "./yoga-helpers.js";
3
+ import { applyContentInsets, applyStrokeMargins, contentInsetsSize } from "./strokes.js";
4
+ import { ownAxisSizing } from "./axis-sizing.js";
3
5
  import { resolveNodeLayoutDirection } from "@pairdraw/scene-graph/text/direction";
4
6
  import { layoutSizing } from "@pairdraw/scene-graph/layout";
5
7
  import { Direction, Display, Gutter } from "yoga-layout";
6
8
  //#region src/layout/grid.ts
7
- function configureAsGrid(yogaNode, node, direction) {
9
+ /**
10
+ * A grid frame that hugs an axis has no space to share out, so its fractional tracks take their
11
+ * content's size there and the frame keeps the smallest box around them, as Figma hugs a grid.
12
+ */
13
+ function gridTracksForAxis(node, axis) {
14
+ const tracks = axis === "width" ? node.gridTemplateColumns : node.gridTemplateRows;
15
+ if (ownAxisSizing(node, axis) !== "HUG") return tracks;
16
+ return tracks.map((track) => track.sizing === "FR" ? {
17
+ sizing: "AUTO",
18
+ value: 0
19
+ } : track);
20
+ }
21
+ function configureAsGrid(graph, yogaNode, node, direction) {
8
22
  yogaNode.setDisplay(Display.Grid);
9
23
  yogaNode.setDirection(direction === "RTL" ? Direction.RTL : Direction.LTR);
10
- yogaNode.setWidth(node.width);
11
- if (node.gridTemplateRows.length > 0 || node.height > 0) yogaNode.setHeight(node.height);
12
- if (node.gridTemplateColumns.length > 0) yogaNode.setGridTemplateColumns(node.gridTemplateColumns.map(mapGridTrack));
13
- if (node.gridTemplateRows.length > 0) yogaNode.setGridTemplateRows(node.gridTemplateRows.map(mapGridTrack));
24
+ const insets = keepsSavedFrameSize(graph, node) ? null : contentInsetsSize(node);
25
+ if (ownAxisSizing(node, "width") !== "HUG") yogaNode.setWidth(insets ? Math.max(node.width, insets.width) : node.width);
26
+ if (ownAxisSizing(node, "height") !== "HUG") {
27
+ if (node.gridTemplateRows.length > 0 || node.height > 0) yogaNode.setHeight(insets ? Math.max(node.height, insets.height) : node.height);
28
+ }
29
+ if (node.gridTemplateColumns.length > 0) yogaNode.setGridTemplateColumns(gridTracksForAxis(node, "width").map(mapGridTrack));
30
+ if (node.gridTemplateRows.length > 0) yogaNode.setGridTemplateRows(gridTracksForAxis(node, "height").map(mapGridTrack));
14
31
  yogaNode.setGap(Gutter.Column, node.gridColumnGap);
15
32
  yogaNode.setGap(Gutter.Row, node.gridRowGap);
16
33
  applyContentInsets(yogaNode, node);
34
+ applyMinMaxConstraints(yogaNode, node);
17
35
  }
18
36
  function createGridChildNode(graph, child) {
19
37
  const yogaChild = createYogaNode();
@@ -40,7 +58,7 @@ function createGridChildNode(graph, child) {
40
58
  function buildGridTree(graph, frame, inheritedDirection) {
41
59
  const root = createYogaNode();
42
60
  const direction = resolveNodeLayoutDirection(frame, inheritedDirection);
43
- configureAsGrid(root, frame, direction);
61
+ configureAsGrid(graph, root, frame, direction);
44
62
  const children = graph.getChildren(frame.id);
45
63
  for (const child of children) if (child.layoutPositioning === "ABSOLUTE") {
46
64
  const yogaChild = createYogaNode();
@@ -58,6 +76,6 @@ function buildGridTree(graph, frame, inheritedDirection) {
58
76
  return root;
59
77
  }
60
78
  //#endregion
61
- export { buildGridTree, createGridChildNode };
79
+ export { buildGridTree, createGridChildNode, gridTracksForAxis };
62
80
 
63
81
  //# sourceMappingURL=grid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grid.js","names":[],"sources":["../../src/layout/grid.ts"],"sourcesContent":["import { Direction, Display, Gutter, type Node as YogaNode } from 'yoga-layout'\n\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { layoutSizing } from '@pairdraw/scene-graph/layout'\nimport { resolveNodeLayoutDirection } from '@pairdraw/scene-graph/text/direction'\n\nimport { applyContentInsets, applyStrokeMargins } from './strokes'\nimport { configureAbsoluteChild, createYogaNode, mapGridTrack } from './yoga-helpers'\n\nfunction configureAsGrid(\n yogaNode: YogaNode,\n node: SceneNode,\n direction: Exclude<SceneNode['layoutDirection'], 'AUTO'>\n): void {\n yogaNode.setDisplay(Display.Grid)\n yogaNode.setDirection(direction === 'RTL' ? Direction.RTL : Direction.LTR)\n yogaNode.setWidth(node.width)\n if (node.gridTemplateRows.length > 0 || node.height > 0) {\n yogaNode.setHeight(node.height)\n }\n\n if (node.gridTemplateColumns.length > 0) {\n yogaNode.setGridTemplateColumns(node.gridTemplateColumns.map(mapGridTrack))\n }\n if (node.gridTemplateRows.length > 0) {\n yogaNode.setGridTemplateRows(node.gridTemplateRows.map(mapGridTrack))\n }\n\n yogaNode.setGap(Gutter.Column, node.gridColumnGap)\n yogaNode.setGap(Gutter.Row, node.gridRowGap)\n\n applyContentInsets(yogaNode, node)\n}\n\nexport function createGridChildNode(graph: SceneGraph, child: SceneNode): YogaNode {\n const yogaChild = createYogaNode()\n if (!child.visible) {\n yogaChild.setDisplay(Display.None)\n } else {\n const pos = child.gridPosition\n if (pos) {\n // A span from an explicit line ends N lines on; from an auto line it is CSS\n // `grid-column: span N`, which Yoga places by itself.\n if (pos.column > 0) {\n yogaChild.setGridColumnStart(pos.column)\n yogaChild.setGridColumnEndSpan(pos.columnSpan)\n } else if (pos.columnSpan > 1) {\n yogaChild.setGridColumnStartSpan(pos.columnSpan)\n }\n if (pos.row > 0) {\n yogaChild.setGridRowStart(pos.row)\n yogaChild.setGridRowEndSpan(pos.rowSpan)\n } else if (pos.rowSpan > 1) {\n yogaChild.setGridRowStartSpan(pos.rowSpan)\n }\n }\n // Each axis fills its cell on its own, as in Figma: grow for width, stretch for height.\n if (layoutSizing(graph, child, 'HORIZONTAL') === 'FILL') yogaChild.setWidthStretch()\n else yogaChild.setWidth(child.width)\n if (layoutSizing(graph, child, 'VERTICAL') === 'FILL') yogaChild.setHeightStretch()\n else yogaChild.setHeight(child.height)\n }\n return yogaChild\n}\n\nexport function buildGridTree(\n graph: SceneGraph,\n frame: SceneNode,\n inheritedDirection: 'LTR' | 'RTL'\n): YogaNode {\n const root = createYogaNode()\n const direction = resolveNodeLayoutDirection(frame, inheritedDirection)\n configureAsGrid(root, frame, direction)\n\n const children = graph.getChildren(frame.id)\n for (const child of children) {\n if (child.layoutPositioning === 'ABSOLUTE') {\n const yogaChild = createYogaNode()\n configureAbsoluteChild(yogaChild, child)\n root.insertChild(yogaChild, root.getChildCount())\n } else {\n const yogaChild = createGridChildNode(graph, child)\n applyStrokeMargins(yogaChild, child, frame)\n if (\n child.layoutMode === 'GRID' ||\n child.layoutMode === 'HORIZONTAL' ||\n child.layoutMode === 'VERTICAL'\n ) {\n const childDirection = resolveNodeLayoutDirection(child, direction)\n yogaChild.setDirection(childDirection === 'RTL' ? Direction.RTL : Direction.LTR)\n }\n root.insertChild(yogaChild, root.getChildCount())\n }\n }\n\n return root\n}\n"],"mappings":";;;;;;AASA,SAAS,gBACP,UACA,MACA,WACM;CACN,SAAS,WAAW,QAAQ,IAAI;CAChC,SAAS,aAAa,cAAc,QAAQ,UAAU,MAAM,UAAU,GAAG;CACzE,SAAS,SAAS,KAAK,KAAK;CAC5B,IAAI,KAAK,iBAAiB,SAAS,KAAK,KAAK,SAAS,GACpD,SAAS,UAAU,KAAK,MAAM;CAGhC,IAAI,KAAK,oBAAoB,SAAS,GACpC,SAAS,uBAAuB,KAAK,oBAAoB,IAAI,YAAY,CAAC;CAE5E,IAAI,KAAK,iBAAiB,SAAS,GACjC,SAAS,oBAAoB,KAAK,iBAAiB,IAAI,YAAY,CAAC;CAGtE,SAAS,OAAO,OAAO,QAAQ,KAAK,aAAa;CACjD,SAAS,OAAO,OAAO,KAAK,KAAK,UAAU;CAE3C,mBAAmB,UAAU,IAAI;AACnC;AAEA,SAAgB,oBAAoB,OAAmB,OAA4B;CACjF,MAAM,YAAY,eAAe;CACjC,IAAI,CAAC,MAAM,SACT,UAAU,WAAW,QAAQ,IAAI;MAC5B;EACL,MAAM,MAAM,MAAM;EAClB,IAAI,KAAK;GAGP,IAAI,IAAI,SAAS,GAAG;IAClB,UAAU,mBAAmB,IAAI,MAAM;IACvC,UAAU,qBAAqB,IAAI,UAAU;GAC/C,OAAO,IAAI,IAAI,aAAa,GAC1B,UAAU,uBAAuB,IAAI,UAAU;GAEjD,IAAI,IAAI,MAAM,GAAG;IACf,UAAU,gBAAgB,IAAI,GAAG;IACjC,UAAU,kBAAkB,IAAI,OAAO;GACzC,OAAO,IAAI,IAAI,UAAU,GACvB,UAAU,oBAAoB,IAAI,OAAO;EAE7C;EAEA,IAAI,aAAa,OAAO,OAAO,YAAY,MAAM,QAAQ,UAAU,gBAAgB;OAC9E,UAAU,SAAS,MAAM,KAAK;EACnC,IAAI,aAAa,OAAO,OAAO,UAAU,MAAM,QAAQ,UAAU,iBAAiB;OAC7E,UAAU,UAAU,MAAM,MAAM;CACvC;CACA,OAAO;AACT;AAEA,SAAgB,cACd,OACA,OACA,oBACU;CACV,MAAM,OAAO,eAAe;CAC5B,MAAM,YAAY,2BAA2B,OAAO,kBAAkB;CACtE,gBAAgB,MAAM,OAAO,SAAS;CAEtC,MAAM,WAAW,MAAM,YAAY,MAAM,EAAE;CAC3C,KAAK,MAAM,SAAS,UAClB,IAAI,MAAM,sBAAsB,YAAY;EAC1C,MAAM,YAAY,eAAe;EACjC,uBAAuB,WAAW,KAAK;EACvC,KAAK,YAAY,WAAW,KAAK,cAAc,CAAC;CAClD,OAAO;EACL,MAAM,YAAY,oBAAoB,OAAO,KAAK;EAClD,mBAAmB,WAAW,OAAO,KAAK;EAC1C,IACE,MAAM,eAAe,UACrB,MAAM,eAAe,gBACrB,MAAM,eAAe,YACrB;GACA,MAAM,iBAAiB,2BAA2B,OAAO,SAAS;GAClE,UAAU,aAAa,mBAAmB,QAAQ,UAAU,MAAM,UAAU,GAAG;EACjF;EACA,KAAK,YAAY,WAAW,KAAK,cAAc,CAAC;CAClD;CAGF,OAAO;AACT"}
1
+ {"version":3,"file":"grid.js","names":[],"sources":["../../src/layout/grid.ts"],"sourcesContent":["import { Direction, Display, Gutter, type Node as YogaNode } from 'yoga-layout'\n\nimport type { GridTrack, SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { layoutSizing } from '@pairdraw/scene-graph/layout'\nimport { resolveNodeLayoutDirection } from '@pairdraw/scene-graph/text/direction'\n\nimport { ownAxisSizing } from './axis-sizing'\nimport { keepsSavedFrameSize } from './derived'\nimport { applyContentInsets, applyStrokeMargins, contentInsetsSize } from './strokes'\nimport {\n applyMinMaxConstraints,\n configureAbsoluteChild,\n createYogaNode,\n mapGridTrack\n} from './yoga-helpers'\n\n/**\n * A grid frame that hugs an axis has no space to share out, so its fractional tracks take their\n * content's size there and the frame keeps the smallest box around them, as Figma hugs a grid.\n */\nexport function gridTracksForAxis(node: SceneNode, axis: 'width' | 'height'): GridTrack[] {\n const tracks = axis === 'width' ? node.gridTemplateColumns : node.gridTemplateRows\n if (ownAxisSizing(node, axis) !== 'HUG') return tracks\n return tracks.map((track) => (track.sizing === 'FR' ? { sizing: 'AUTO', value: 0 } : track))\n}\n\nfunction configureAsGrid(\n graph: SceneGraph,\n yogaNode: YogaNode,\n node: SceneNode,\n direction: Exclude<SceneNode['layoutDirection'], 'AUTO'>\n): void {\n yogaNode.setDisplay(Display.Grid)\n yogaNode.setDirection(direction === 'RTL' ? Direction.RTL : Direction.LTR)\n const insets = keepsSavedFrameSize(graph, node) ? null : contentInsetsSize(node)\n if (ownAxisSizing(node, 'width') !== 'HUG') {\n yogaNode.setWidth(insets ? Math.max(node.width, insets.width) : node.width)\n }\n if (ownAxisSizing(node, 'height') !== 'HUG') {\n if (node.gridTemplateRows.length > 0 || node.height > 0) {\n yogaNode.setHeight(insets ? Math.max(node.height, insets.height) : node.height)\n }\n }\n\n if (node.gridTemplateColumns.length > 0) {\n yogaNode.setGridTemplateColumns(gridTracksForAxis(node, 'width').map(mapGridTrack))\n }\n if (node.gridTemplateRows.length > 0) {\n yogaNode.setGridTemplateRows(gridTracksForAxis(node, 'height').map(mapGridTrack))\n }\n\n yogaNode.setGap(Gutter.Column, node.gridColumnGap)\n yogaNode.setGap(Gutter.Row, node.gridRowGap)\n\n applyContentInsets(yogaNode, node)\n applyMinMaxConstraints(yogaNode, node)\n}\n\nexport function createGridChildNode(graph: SceneGraph, child: SceneNode): YogaNode {\n const yogaChild = createYogaNode()\n if (!child.visible) {\n yogaChild.setDisplay(Display.None)\n } else {\n const pos = child.gridPosition\n if (pos) {\n // A span from an explicit line ends N lines on; from an auto line it is CSS\n // `grid-column: span N`, which Yoga places by itself.\n if (pos.column > 0) {\n yogaChild.setGridColumnStart(pos.column)\n yogaChild.setGridColumnEndSpan(pos.columnSpan)\n } else if (pos.columnSpan > 1) {\n yogaChild.setGridColumnStartSpan(pos.columnSpan)\n }\n if (pos.row > 0) {\n yogaChild.setGridRowStart(pos.row)\n yogaChild.setGridRowEndSpan(pos.rowSpan)\n } else if (pos.rowSpan > 1) {\n yogaChild.setGridRowStartSpan(pos.rowSpan)\n }\n }\n // Each axis fills its cell on its own, as in Figma: grow for width, stretch for height.\n if (layoutSizing(graph, child, 'HORIZONTAL') === 'FILL') yogaChild.setWidthStretch()\n else yogaChild.setWidth(child.width)\n if (layoutSizing(graph, child, 'VERTICAL') === 'FILL') yogaChild.setHeightStretch()\n else yogaChild.setHeight(child.height)\n }\n return yogaChild\n}\n\nexport function buildGridTree(\n graph: SceneGraph,\n frame: SceneNode,\n inheritedDirection: 'LTR' | 'RTL'\n): YogaNode {\n const root = createYogaNode()\n const direction = resolveNodeLayoutDirection(frame, inheritedDirection)\n configureAsGrid(graph, root, frame, direction)\n\n const children = graph.getChildren(frame.id)\n for (const child of children) {\n if (child.layoutPositioning === 'ABSOLUTE') {\n const yogaChild = createYogaNode()\n configureAbsoluteChild(yogaChild, child)\n root.insertChild(yogaChild, root.getChildCount())\n } else {\n const yogaChild = createGridChildNode(graph, child)\n applyStrokeMargins(yogaChild, child, frame)\n if (\n child.layoutMode === 'GRID' ||\n child.layoutMode === 'HORIZONTAL' ||\n child.layoutMode === 'VERTICAL'\n ) {\n const childDirection = resolveNodeLayoutDirection(child, direction)\n yogaChild.setDirection(childDirection === 'RTL' ? Direction.RTL : Direction.LTR)\n }\n root.insertChild(yogaChild, root.getChildCount())\n }\n }\n\n return root\n}\n"],"mappings":"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"}
@@ -3,6 +3,7 @@ import { SceneMutationImpact } from "@pairdraw/scene-graph/mutation-impact";
3
3
  //#region src/layout/mutations.d.ts
4
4
  declare function createLayoutRunner(getGraph: () => SceneGraph): {
5
5
  runLayoutForNode: (id: string) => void;
6
+ runLayoutForParents: (parentIds: Iterable<string>) => void;
6
7
  runLayoutForImpact: (impact: SceneMutationImpact) => boolean;
7
8
  runMutationWithLayout: <T>(operation: () => T | Promise<T>, fallbackId?: string, beforeLayout?: (result: T, impact: SceneMutationImpact) => Promise<void> | void) => Promise<T>;
8
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.d.ts","names":[],"sources":["../../src/layout/mutations.ts"],"mappings":";;;iBAYgB,mBAAmB,gBAAgB;EACnB,mBAAA;EA6CM,qBAAA,QAAA;EAhBC,wBAAA,GAAC,iBACnB,IAAI,QAAQ,IAAE,qBACZ,gBACH,QAAQ,GAAG,QAAQ,wBAAwB,yBAC1D,QAAQ"}
1
+ {"version":3,"file":"mutations.d.ts","names":[],"sources":["../../src/layout/mutations.ts"],"mappings":";;;iBAYgB,mBAAmB,gBAAgB;EACnB,mBAAA;EAqBU,sBAAA,WAAA;EAoCJ,qBAAA,QAAA;EAhBC,wBAAA,GAAC,iBACnB,IAAI,QAAQ,IAAE,qBACZ,gBACH,QAAQ,GAAG,QAAQ,wBAAwB,yBAC1D,QAAQ"}
@@ -15,6 +15,15 @@ function createLayoutRunner(getGraph) {
15
15
  parent = parent.parentId ? graph.getNode(parent.parentId) : void 0;
16
16
  }
17
17
  }
18
+ /**
19
+ * Lays out the parents whose children were added, removed, reordered, shown, or hidden. Only an
20
+ * auto layout places its children, so other parents are skipped: laying out a page reaches every
21
+ * frame on it. Hugging auto layout ancestors still follow, as `runLayoutForNode` walks up.
22
+ */
23
+ function runLayoutForParents(parentIds) {
24
+ const graph = getGraph();
25
+ for (const id of uniq([...parentIds])) if (graph.getNode(id)?.layoutMode !== "NONE") runLayoutForNode(id);
26
+ }
18
27
  function compactLayoutScope(impact) {
19
28
  const graph = getGraph();
20
29
  const candidates = new Set(mutationLayoutScopeIds(impact).filter((id) => graph.getNode(id)));
@@ -63,6 +72,7 @@ function createLayoutRunner(getGraph) {
63
72
  }
64
73
  return {
65
74
  runLayoutForNode,
75
+ runLayoutForParents,
66
76
  runLayoutForImpact,
67
77
  runMutationWithLayout
68
78
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.js","names":[],"sources":["../../src/layout/mutations.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\n\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { connectorsAffectedBy, layoutConnector } from '@pairdraw/scene-graph/connectors'\nimport {\n collectSceneMutation,\n mutationLayoutScopeIds,\n type SceneMutationImpact\n} from '@pairdraw/scene-graph/mutation-impact'\n\nimport { computeAllLayouts, computeLayout } from '#core/layout'\n\nexport function createLayoutRunner(getGraph: () => SceneGraph) {\n function runLayoutForNode(id: string) {\n const graph = getGraph()\n const node = graph.getNode(id)\n if (!node) return\n\n computeAllLayouts(graph, id)\n\n let parent = node.parentId ? graph.getNode(node.parentId) : undefined\n while (parent) {\n if (parent.layoutMode !== 'NONE') {\n computeLayout(graph, parent.id)\n }\n parent = parent.parentId ? graph.getNode(parent.parentId) : undefined\n }\n }\n\n function compactLayoutScope(impact: SceneMutationImpact): string[] {\n const graph = getGraph()\n const candidates = new Set(mutationLayoutScopeIds(impact).filter((id) => graph.getNode(id)))\n return [...candidates].filter((id) => {\n let parentId = graph.getNode(id)?.parentId ?? null\n while (parentId) {\n if (candidates.has(parentId)) return false\n parentId = graph.getNode(parentId)?.parentId ?? null\n }\n return true\n })\n }\n\n async function runMutationWithLayout<T>(\n operation: () => T | Promise<T>,\n fallbackId?: string,\n beforeLayout?: (result: T, impact: SceneMutationImpact) => Promise<void> | void\n ): Promise<T> {\n const graph = getGraph()\n const { result, impact } = await collectSceneMutation(graph, operation)\n await beforeLayout?.(result, impact)\n if (!runLayoutForImpact(impact) && fallbackId) computeAllLayouts(graph, fallbackId)\n return result\n }\n\n /**\n * Lays out what an edit touched, and routes again the connectors it moved; returns whether\n * there was anything to lay out.\n */\n function runLayoutForImpact(impact: SceneMutationImpact): boolean {\n const scopeIds = compactLayoutScope(impact)\n for (const id of scopeIds) runLayoutForNode(id)\n routeConnectors(impact)\n return scopeIds.length > 0\n }\n\n /**\n * Routes the connectors an edit moved. One created together with the layers it joins, as a\n * paste makes it, keeps the route it came with; one that joins layers already there routes to\n * them.\n */\n function routeConnectors(impact: SceneMutationImpact) {\n const graph = getGraph()\n const created = impact.createdNodeIds\n const joinsExisting = (connector: SceneNode) =>\n [connector.connectorStart?.nodeId, connector.connectorEnd?.nodeId].some(\n (id) => id && !created.has(id) && graph.getNode(id)\n )\n const connectors = [\n ...connectorsAffectedBy(graph, impact.changedNodeIds),\n ...[...created].flatMap((id) => {\n const node = graph.getNode(id)\n return node?.type === 'CONNECTOR' && joinsExisting(node) ? [node] : []\n })\n ]\n graph.withLayoutMutations(() => {\n for (const connector of uniq(connectors)) layoutConnector(graph, connector)\n })\n }\n\n return { runLayoutForNode, runLayoutForImpact, runMutationWithLayout }\n}\n"],"mappings":";;;;;AAYA,SAAgB,mBAAmB,UAA4B;CAC7D,SAAS,iBAAiB,IAAY;EACpC,MAAM,QAAQ,SAAS;EACvB,MAAM,OAAO,MAAM,QAAQ,EAAE;EAC7B,IAAI,CAAC,MAAM;EAEX,kBAAkB,OAAO,EAAE;EAE3B,IAAI,SAAS,KAAK,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAA;EAC5D,OAAO,QAAQ;GACb,IAAI,OAAO,eAAe,QACxB,cAAc,OAAO,OAAO,EAAE;GAEhC,SAAS,OAAO,WAAW,MAAM,QAAQ,OAAO,QAAQ,IAAI,KAAA;EAC9D;CACF;CAEA,SAAS,mBAAmB,QAAuC;EACjE,MAAM,QAAQ,SAAS;EACvB,MAAM,aAAa,IAAI,IAAI,uBAAuB,MAAM,CAAC,CAAC,QAAQ,OAAO,MAAM,QAAQ,EAAE,CAAC,CAAC;EAC3F,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,QAAQ,OAAO;GACpC,IAAI,WAAW,MAAM,QAAQ,EAAE,CAAC,EAAE,YAAY;GAC9C,OAAO,UAAU;IACf,IAAI,WAAW,IAAI,QAAQ,GAAG,OAAO;IACrC,WAAW,MAAM,QAAQ,QAAQ,CAAC,EAAE,YAAY;GAClD;GACA,OAAO;EACT,CAAC;CACH;CAEA,eAAe,sBACb,WACA,YACA,cACY;EACZ,MAAM,QAAQ,SAAS;EACvB,MAAM,EAAE,QAAQ,WAAW,MAAM,qBAAqB,OAAO,SAAS;EACtE,MAAM,eAAe,QAAQ,MAAM;EACnC,IAAI,CAAC,mBAAmB,MAAM,KAAK,YAAY,kBAAkB,OAAO,UAAU;EAClF,OAAO;CACT;;;;;CAMA,SAAS,mBAAmB,QAAsC;EAChE,MAAM,WAAW,mBAAmB,MAAM;EAC1C,KAAK,MAAM,MAAM,UAAU,iBAAiB,EAAE;EAC9C,gBAAgB,MAAM;EACtB,OAAO,SAAS,SAAS;CAC3B;;;;;;CAOA,SAAS,gBAAgB,QAA6B;EACpD,MAAM,QAAQ,SAAS;EACvB,MAAM,UAAU,OAAO;EACvB,MAAM,iBAAiB,cACrB,CAAC,UAAU,gBAAgB,QAAQ,UAAU,cAAc,MAAM,CAAC,CAAC,MAChE,OAAO,MAAM,CAAC,QAAQ,IAAI,EAAE,KAAK,MAAM,QAAQ,EAAE,CACpD;EACF,MAAM,aAAa,CACjB,GAAG,qBAAqB,OAAO,OAAO,cAAc,GACpD,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,SAAS,OAAO;GAC9B,MAAM,OAAO,MAAM,QAAQ,EAAE;GAC7B,OAAO,MAAM,SAAS,eAAe,cAAc,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC;EACvE,CAAC,CACH;EACA,MAAM,0BAA0B;GAC9B,KAAK,MAAM,aAAa,KAAK,UAAU,GAAG,gBAAgB,OAAO,SAAS;EAC5E,CAAC;CACH;CAEA,OAAO;EAAE;EAAkB;EAAoB;CAAsB;AACvE"}
1
+ {"version":3,"file":"mutations.js","names":[],"sources":["../../src/layout/mutations.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\n\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { connectorsAffectedBy, layoutConnector } from '@pairdraw/scene-graph/connectors'\nimport {\n collectSceneMutation,\n mutationLayoutScopeIds,\n type SceneMutationImpact\n} from '@pairdraw/scene-graph/mutation-impact'\n\nimport { computeAllLayouts, computeLayout } from '#core/layout'\n\nexport function createLayoutRunner(getGraph: () => SceneGraph) {\n function runLayoutForNode(id: string) {\n const graph = getGraph()\n const node = graph.getNode(id)\n if (!node) return\n\n computeAllLayouts(graph, id)\n\n let parent = node.parentId ? graph.getNode(node.parentId) : undefined\n while (parent) {\n if (parent.layoutMode !== 'NONE') {\n computeLayout(graph, parent.id)\n }\n parent = parent.parentId ? graph.getNode(parent.parentId) : undefined\n }\n }\n\n /**\n * Lays out the parents whose children were added, removed, reordered, shown, or hidden. Only an\n * auto layout places its children, so other parents are skipped: laying out a page reaches every\n * frame on it. Hugging auto layout ancestors still follow, as `runLayoutForNode` walks up.\n */\n function runLayoutForParents(parentIds: Iterable<string>) {\n const graph = getGraph()\n for (const id of uniq([...parentIds])) {\n if (graph.getNode(id)?.layoutMode !== 'NONE') runLayoutForNode(id)\n }\n }\n\n function compactLayoutScope(impact: SceneMutationImpact): string[] {\n const graph = getGraph()\n const candidates = new Set(mutationLayoutScopeIds(impact).filter((id) => graph.getNode(id)))\n return [...candidates].filter((id) => {\n let parentId = graph.getNode(id)?.parentId ?? null\n while (parentId) {\n if (candidates.has(parentId)) return false\n parentId = graph.getNode(parentId)?.parentId ?? null\n }\n return true\n })\n }\n\n async function runMutationWithLayout<T>(\n operation: () => T | Promise<T>,\n fallbackId?: string,\n beforeLayout?: (result: T, impact: SceneMutationImpact) => Promise<void> | void\n ): Promise<T> {\n const graph = getGraph()\n const { result, impact } = await collectSceneMutation(graph, operation)\n await beforeLayout?.(result, impact)\n if (!runLayoutForImpact(impact) && fallbackId) computeAllLayouts(graph, fallbackId)\n return result\n }\n\n /**\n * Lays out what an edit touched, and routes again the connectors it moved; returns whether\n * there was anything to lay out.\n */\n function runLayoutForImpact(impact: SceneMutationImpact): boolean {\n const scopeIds = compactLayoutScope(impact)\n for (const id of scopeIds) runLayoutForNode(id)\n routeConnectors(impact)\n return scopeIds.length > 0\n }\n\n /**\n * Routes the connectors an edit moved. One created together with the layers it joins, as a\n * paste makes it, keeps the route it came with; one that joins layers already there routes to\n * them.\n */\n function routeConnectors(impact: SceneMutationImpact) {\n const graph = getGraph()\n const created = impact.createdNodeIds\n const joinsExisting = (connector: SceneNode) =>\n [connector.connectorStart?.nodeId, connector.connectorEnd?.nodeId].some(\n (id) => id && !created.has(id) && graph.getNode(id)\n )\n const connectors = [\n ...connectorsAffectedBy(graph, impact.changedNodeIds),\n ...[...created].flatMap((id) => {\n const node = graph.getNode(id)\n return node?.type === 'CONNECTOR' && joinsExisting(node) ? [node] : []\n })\n ]\n graph.withLayoutMutations(() => {\n for (const connector of uniq(connectors)) layoutConnector(graph, connector)\n })\n }\n\n return { runLayoutForNode, runLayoutForParents, runLayoutForImpact, runMutationWithLayout }\n}\n"],"mappings":";;;;;AAYA,SAAgB,mBAAmB,UAA4B;CAC7D,SAAS,iBAAiB,IAAY;EACpC,MAAM,QAAQ,SAAS;EACvB,MAAM,OAAO,MAAM,QAAQ,EAAE;EAC7B,IAAI,CAAC,MAAM;EAEX,kBAAkB,OAAO,EAAE;EAE3B,IAAI,SAAS,KAAK,WAAW,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAA;EAC5D,OAAO,QAAQ;GACb,IAAI,OAAO,eAAe,QACxB,cAAc,OAAO,OAAO,EAAE;GAEhC,SAAS,OAAO,WAAW,MAAM,QAAQ,OAAO,QAAQ,IAAI,KAAA;EAC9D;CACF;;;;;;CAOA,SAAS,oBAAoB,WAA6B;EACxD,MAAM,QAAQ,SAAS;EACvB,KAAK,MAAM,MAAM,KAAK,CAAC,GAAG,SAAS,CAAC,GAClC,IAAI,MAAM,QAAQ,EAAE,CAAC,EAAE,eAAe,QAAQ,iBAAiB,EAAE;CAErE;CAEA,SAAS,mBAAmB,QAAuC;EACjE,MAAM,QAAQ,SAAS;EACvB,MAAM,aAAa,IAAI,IAAI,uBAAuB,MAAM,CAAC,CAAC,QAAQ,OAAO,MAAM,QAAQ,EAAE,CAAC,CAAC;EAC3F,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,QAAQ,OAAO;GACpC,IAAI,WAAW,MAAM,QAAQ,EAAE,CAAC,EAAE,YAAY;GAC9C,OAAO,UAAU;IACf,IAAI,WAAW,IAAI,QAAQ,GAAG,OAAO;IACrC,WAAW,MAAM,QAAQ,QAAQ,CAAC,EAAE,YAAY;GAClD;GACA,OAAO;EACT,CAAC;CACH;CAEA,eAAe,sBACb,WACA,YACA,cACY;EACZ,MAAM,QAAQ,SAAS;EACvB,MAAM,EAAE,QAAQ,WAAW,MAAM,qBAAqB,OAAO,SAAS;EACtE,MAAM,eAAe,QAAQ,MAAM;EACnC,IAAI,CAAC,mBAAmB,MAAM,KAAK,YAAY,kBAAkB,OAAO,UAAU;EAClF,OAAO;CACT;;;;;CAMA,SAAS,mBAAmB,QAAsC;EAChE,MAAM,WAAW,mBAAmB,MAAM;EAC1C,KAAK,MAAM,MAAM,UAAU,iBAAiB,EAAE;EAC9C,gBAAgB,MAAM;EACtB,OAAO,SAAS,SAAS;CAC3B;;;;;;CAOA,SAAS,gBAAgB,QAA6B;EACpD,MAAM,QAAQ,SAAS;EACvB,MAAM,UAAU,OAAO;EACvB,MAAM,iBAAiB,cACrB,CAAC,UAAU,gBAAgB,QAAQ,UAAU,cAAc,MAAM,CAAC,CAAC,MAChE,OAAO,MAAM,CAAC,QAAQ,IAAI,EAAE,KAAK,MAAM,QAAQ,EAAE,CACpD;EACF,MAAM,aAAa,CACjB,GAAG,qBAAqB,OAAO,OAAO,cAAc,GACpD,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,SAAS,OAAO;GAC9B,MAAM,OAAO,MAAM,QAAQ,EAAE;GAC7B,OAAO,MAAM,SAAS,eAAe,cAAc,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC;EACvE,CAAC,CACH;EACA,MAAM,0BAA0B;GAC9B,KAAK,MAAM,aAAa,KAAK,UAAU,GAAG,gBAAgB,OAAO,SAAS;EAC5E,CAAC;CACH;CAEA,OAAO;EAAE;EAAkB;EAAqB;EAAoB;CAAsB;AAC5F"}
@@ -3,6 +3,14 @@ import { Node } from "yoga-layout";
3
3
  //#region src/layout/strokes.d.ts
4
4
  /** Insets a layout container's content by its padding and, with strokes included, its stroke. */
5
5
  declare function applyContentInsets(yogaNode: Node, node: SceneNode): void;
6
+ /**
7
+ * The room a horizontal and vertical layout frame's padding and included inside strokes take,
8
+ * which is the smallest size it holds even when set smaller, as Figma grows such a frame.
9
+ */
10
+ declare function contentInsetsSize(node: SceneNode): {
11
+ width: number;
12
+ height: number;
13
+ };
6
14
  /**
7
15
  * With strokes included in its parent's layout, the part of a child's stroke that falls outside
8
16
  * its box takes room beside it, so neighbours and a hugging parent clear the stroke.
@@ -14,5 +22,5 @@ declare function applyStrokeMargins(yogaChild: Node, child: SceneNode, parent: S
14
22
  */
15
23
  declare function strokeRoom(parent: SceneNode, children: readonly SceneNode[], axis: 'width' | 'height'): number;
16
24
  //#endregion
17
- export { applyContentInsets, applyStrokeMargins, strokeRoom };
25
+ export { applyContentInsets, applyStrokeMargins, contentInsetsSize, strokeRoom };
18
26
  //# sourceMappingURL=strokes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strokes.d.ts","names":[],"sources":["../../src/layout/strokes.ts"],"mappings":";;;;iBAmEgB,mBAAmB,UAAU,MAAU,MAAM;;;;;iBAY7C,mBAAmB,WAAW,MAAU,OAAO,WAAW,QAAQ;;;;;iBAWlE,WACd,QAAQ,WACR,mBAAmB,aACnB"}
1
+ {"version":3,"file":"strokes.d.ts","names":[],"sources":["../../src/layout/strokes.ts"],"mappings":";;;;iBAmEgB,mBAAmB,UAAU,MAAU,MAAM;;;;;iBAY7C,kBAAkB,MAAM;EAAc;EAAe;;;;;;iBAYrD,mBAAmB,WAAW,MAAU,OAAO,WAAW,QAAQ;;;;;iBAWlE,WACd,QAAQ,WACR,mBAAmB,aACnB"}
@@ -69,6 +69,17 @@ function applyContentInsets(yogaNode, node) {
69
69
  applyStrokeBorders(yogaNode, node);
70
70
  }
71
71
  /**
72
+ * The room a horizontal and vertical layout frame's padding and included inside strokes take,
73
+ * which is the smallest size it holds even when set smaller, as Figma grows such a frame.
74
+ */
75
+ function contentInsetsSize(node) {
76
+ const inside = node.strokesIncludedInLayout ? strokeExtent(node, "inside") : null;
77
+ return {
78
+ width: node.paddingLeft + node.paddingRight + (inside ? inside[1] + inside[3] : 0),
79
+ height: node.paddingTop + node.paddingBottom + (inside ? inside[0] + inside[2] : 0)
80
+ };
81
+ }
82
+ /**
72
83
  * With strokes included in its parent's layout, the part of a child's stroke that falls outside
73
84
  * its box takes room beside it, so neighbours and a hugging parent clear the stroke.
74
85
  */
@@ -91,6 +102,6 @@ function strokeRoom(parent, children, axis) {
91
102
  return room;
92
103
  }
93
104
  //#endregion
94
- export { applyContentInsets, applyStrokeMargins, strokeRoom };
105
+ export { applyContentInsets, applyStrokeMargins, contentInsetsSize, strokeRoom };
95
106
 
96
107
  //# sourceMappingURL=strokes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"strokes.js","names":[],"sources":["../../src/layout/strokes.ts"],"sourcesContent":["import { Edge, type Node as YogaNode } from 'yoga-layout'\n\nimport type { SceneNode, Stroke } from '@pairdraw/scene-graph'\n\n/** Widths on each side of a layer, in Yoga's edge order: top, right, bottom, left. */\ntype Sides = [number, number, number, number]\n\nconst EDGES = [Edge.Top, Edge.Right, Edge.Bottom, Edge.Left] as const\n\n/** The share of a stroke's weight that lies outside the layer it outlines. */\nfunction outsideShare(align: Stroke['align']): number {\n if (align === 'OUTSIDE') return 1\n if (align === 'CENTER') return 0.5\n return 0\n}\n\n/**\n * How far a layer's visible strokes reach into (`inside`) or out of (`outside`) its box on each\n * side, the widest stroke deciding. Sides with weights of their own use them for every stroke.\n */\nfunction strokeExtent(node: SceneNode, part: 'inside' | 'outside'): Sides | null {\n const strokes = node.strokes.filter((stroke) => stroke.visible)\n if (strokes.length === 0) return null\n const extent: Sides = [0, 0, 0, 0]\n for (const stroke of strokes) {\n const outside = outsideShare(stroke.align)\n const share = part === 'outside' ? outside : 1 - outside\n const weights = node.independentStrokeWeights\n ? [\n node.borderTopWeight,\n node.borderRightWeight,\n node.borderBottomWeight,\n node.borderLeftWeight\n ]\n : [stroke.weight, stroke.weight, stroke.weight, stroke.weight]\n for (const [side, weight] of weights.entries()) {\n extent[side] = Math.max(extent[side], Math.max(0, weight) * share)\n }\n }\n return extent.some((width) => width > 0) ? extent : null\n}\n\n/**\n * Whether a child's strokes take room in its parent's auto layout. Text strokes follow its glyphs\n * rather than its box, and a child out of the flow is placed where it is.\n */\nfunction strokeTakesRoom(child: SceneNode, parent: SceneNode): boolean {\n return (\n parent.strokesIncludedInLayout &&\n child.type !== 'TEXT' &&\n child.visible &&\n child.layoutPositioning !== 'ABSOLUTE'\n )\n}\n\n/**\n * With strokes included in its layout, an auto layout frame lays its content out inside the part\n * of its own stroke that falls within its box, as CSS `box-sizing: border-box` does with a border.\n */\nfunction applyStrokeBorders(yogaNode: YogaNode, node: SceneNode): void {\n if (!node.strokesIncludedInLayout) return\n const inside = strokeExtent(node, 'inside')\n if (!inside) return\n for (const [side, edge] of EDGES.entries()) yogaNode.setBorder(edge, inside[side])\n}\n\n/** Insets a layout container's content by its padding and, with strokes included, its stroke. */\nexport function applyContentInsets(yogaNode: YogaNode, node: SceneNode): void {\n yogaNode.setPadding(Edge.Top, node.paddingTop)\n yogaNode.setPadding(Edge.Right, node.paddingRight)\n yogaNode.setPadding(Edge.Bottom, node.paddingBottom)\n yogaNode.setPadding(Edge.Left, node.paddingLeft)\n applyStrokeBorders(yogaNode, node)\n}\n\n/**\n * With strokes included in its parent's layout, the part of a child's stroke that falls outside\n * its box takes room beside it, so neighbours and a hugging parent clear the stroke.\n */\nexport function applyStrokeMargins(yogaChild: YogaNode, child: SceneNode, parent: SceneNode): void {\n if (!strokeTakesRoom(child, parent)) return\n const outside = strokeExtent(child, 'outside')\n if (!outside) return\n for (const [side, edge] of EDGES.entries()) yogaChild.setMargin(edge, outside[side])\n}\n\n/**\n * The room strokes take along one axis of a frame laid out with them included: its own stroke\n * inside its box on both ends, and the stroke outside each child's box.\n */\nexport function strokeRoom(\n parent: SceneNode,\n children: readonly SceneNode[],\n axis: 'width' | 'height'\n): number {\n if (!parent.strokesIncludedInLayout) return 0\n const [start, end] = axis === 'width' ? [3, 1] : [0, 2]\n const across = (sides: Sides | null) => (sides ? sides[start] + sides[end] : 0)\n let room = across(strokeExtent(parent, 'inside'))\n for (const child of children) {\n if (strokeTakesRoom(child, parent)) room += across(strokeExtent(child, 'outside'))\n }\n return room\n}\n"],"mappings":";;AAOA,MAAM,QAAQ;CAAC,KAAK;CAAK,KAAK;CAAO,KAAK;CAAQ,KAAK;AAAI;;AAG3D,SAAS,aAAa,OAAgC;CACpD,IAAI,UAAU,WAAW,OAAO;CAChC,IAAI,UAAU,UAAU,OAAO;CAC/B,OAAO;AACT;;;;;AAMA,SAAS,aAAa,MAAiB,MAA0C;CAC/E,MAAM,UAAU,KAAK,QAAQ,QAAQ,WAAW,OAAO,OAAO;CAC9D,IAAI,QAAQ,WAAW,GAAG,OAAO;CACjC,MAAM,SAAgB;EAAC;EAAG;EAAG;EAAG;CAAC;CACjC,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,UAAU,aAAa,OAAO,KAAK;EACzC,MAAM,QAAQ,SAAS,YAAY,UAAU,IAAI;EACjD,MAAM,UAAU,KAAK,2BACjB;GACE,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,IACA;GAAC,OAAO;GAAQ,OAAO;GAAQ,OAAO;GAAQ,OAAO;EAAM;EAC/D,KAAK,MAAM,CAAC,MAAM,WAAW,QAAQ,QAAQ,GAC3C,OAAO,QAAQ,KAAK,IAAI,OAAO,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,KAAK;CAErE;CACA,OAAO,OAAO,MAAM,UAAU,QAAQ,CAAC,IAAI,SAAS;AACtD;;;;;AAMA,SAAS,gBAAgB,OAAkB,QAA4B;CACrE,OACE,OAAO,2BACP,MAAM,SAAS,UACf,MAAM,WACN,MAAM,sBAAsB;AAEhC;;;;;AAMA,SAAS,mBAAmB,UAAoB,MAAuB;CACrE,IAAI,CAAC,KAAK,yBAAyB;CACnC,MAAM,SAAS,aAAa,MAAM,QAAQ;CAC1C,IAAI,CAAC,QAAQ;CACb,KAAK,MAAM,CAAC,MAAM,SAAS,MAAM,QAAQ,GAAG,SAAS,UAAU,MAAM,OAAO,KAAK;AACnF;;AAGA,SAAgB,mBAAmB,UAAoB,MAAuB;CAC5E,SAAS,WAAW,KAAK,KAAK,KAAK,UAAU;CAC7C,SAAS,WAAW,KAAK,OAAO,KAAK,YAAY;CACjD,SAAS,WAAW,KAAK,QAAQ,KAAK,aAAa;CACnD,SAAS,WAAW,KAAK,MAAM,KAAK,WAAW;CAC/C,mBAAmB,UAAU,IAAI;AACnC;;;;;AAMA,SAAgB,mBAAmB,WAAqB,OAAkB,QAAyB;CACjG,IAAI,CAAC,gBAAgB,OAAO,MAAM,GAAG;CACrC,MAAM,UAAU,aAAa,OAAO,SAAS;CAC7C,IAAI,CAAC,SAAS;CACd,KAAK,MAAM,CAAC,MAAM,SAAS,MAAM,QAAQ,GAAG,UAAU,UAAU,MAAM,QAAQ,KAAK;AACrF;;;;;AAMA,SAAgB,WACd,QACA,UACA,MACQ;CACR,IAAI,CAAC,OAAO,yBAAyB,OAAO;CAC5C,MAAM,CAAC,OAAO,OAAO,SAAS,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;CACtD,MAAM,UAAU,UAAyB,QAAQ,MAAM,SAAS,MAAM,OAAO;CAC7E,IAAI,OAAO,OAAO,aAAa,QAAQ,QAAQ,CAAC;CAChD,KAAK,MAAM,SAAS,UAClB,IAAI,gBAAgB,OAAO,MAAM,GAAG,QAAQ,OAAO,aAAa,OAAO,SAAS,CAAC;CAEnF,OAAO;AACT"}
1
+ {"version":3,"file":"strokes.js","names":[],"sources":["../../src/layout/strokes.ts"],"sourcesContent":["import { Edge, type Node as YogaNode } from 'yoga-layout'\n\nimport type { SceneNode, Stroke } from '@pairdraw/scene-graph'\n\n/** Widths on each side of a layer, in Yoga's edge order: top, right, bottom, left. */\ntype Sides = [number, number, number, number]\n\nconst EDGES = [Edge.Top, Edge.Right, Edge.Bottom, Edge.Left] as const\n\n/** The share of a stroke's weight that lies outside the layer it outlines. */\nfunction outsideShare(align: Stroke['align']): number {\n if (align === 'OUTSIDE') return 1\n if (align === 'CENTER') return 0.5\n return 0\n}\n\n/**\n * How far a layer's visible strokes reach into (`inside`) or out of (`outside`) its box on each\n * side, the widest stroke deciding. Sides with weights of their own use them for every stroke.\n */\nfunction strokeExtent(node: SceneNode, part: 'inside' | 'outside'): Sides | null {\n const strokes = node.strokes.filter((stroke) => stroke.visible)\n if (strokes.length === 0) return null\n const extent: Sides = [0, 0, 0, 0]\n for (const stroke of strokes) {\n const outside = outsideShare(stroke.align)\n const share = part === 'outside' ? outside : 1 - outside\n const weights = node.independentStrokeWeights\n ? [\n node.borderTopWeight,\n node.borderRightWeight,\n node.borderBottomWeight,\n node.borderLeftWeight\n ]\n : [stroke.weight, stroke.weight, stroke.weight, stroke.weight]\n for (const [side, weight] of weights.entries()) {\n extent[side] = Math.max(extent[side], Math.max(0, weight) * share)\n }\n }\n return extent.some((width) => width > 0) ? extent : null\n}\n\n/**\n * Whether a child's strokes take room in its parent's auto layout. Text strokes follow its glyphs\n * rather than its box, and a child out of the flow is placed where it is.\n */\nfunction strokeTakesRoom(child: SceneNode, parent: SceneNode): boolean {\n return (\n parent.strokesIncludedInLayout &&\n child.type !== 'TEXT' &&\n child.visible &&\n child.layoutPositioning !== 'ABSOLUTE'\n )\n}\n\n/**\n * With strokes included in its layout, an auto layout frame lays its content out inside the part\n * of its own stroke that falls within its box, as CSS `box-sizing: border-box` does with a border.\n */\nfunction applyStrokeBorders(yogaNode: YogaNode, node: SceneNode): void {\n if (!node.strokesIncludedInLayout) return\n const inside = strokeExtent(node, 'inside')\n if (!inside) return\n for (const [side, edge] of EDGES.entries()) yogaNode.setBorder(edge, inside[side])\n}\n\n/** Insets a layout container's content by its padding and, with strokes included, its stroke. */\nexport function applyContentInsets(yogaNode: YogaNode, node: SceneNode): void {\n yogaNode.setPadding(Edge.Top, node.paddingTop)\n yogaNode.setPadding(Edge.Right, node.paddingRight)\n yogaNode.setPadding(Edge.Bottom, node.paddingBottom)\n yogaNode.setPadding(Edge.Left, node.paddingLeft)\n applyStrokeBorders(yogaNode, node)\n}\n\n/**\n * The room a horizontal and vertical layout frame's padding and included inside strokes take,\n * which is the smallest size it holds even when set smaller, as Figma grows such a frame.\n */\nexport function contentInsetsSize(node: SceneNode): { width: number; height: number } {\n const inside = node.strokesIncludedInLayout ? strokeExtent(node, 'inside') : null\n return {\n width: node.paddingLeft + node.paddingRight + (inside ? inside[1] + inside[3] : 0),\n height: node.paddingTop + node.paddingBottom + (inside ? inside[0] + inside[2] : 0)\n }\n}\n\n/**\n * With strokes included in its parent's layout, the part of a child's stroke that falls outside\n * its box takes room beside it, so neighbours and a hugging parent clear the stroke.\n */\nexport function applyStrokeMargins(yogaChild: YogaNode, child: SceneNode, parent: SceneNode): void {\n if (!strokeTakesRoom(child, parent)) return\n const outside = strokeExtent(child, 'outside')\n if (!outside) return\n for (const [side, edge] of EDGES.entries()) yogaChild.setMargin(edge, outside[side])\n}\n\n/**\n * The room strokes take along one axis of a frame laid out with them included: its own stroke\n * inside its box on both ends, and the stroke outside each child's box.\n */\nexport function strokeRoom(\n parent: SceneNode,\n children: readonly SceneNode[],\n axis: 'width' | 'height'\n): number {\n if (!parent.strokesIncludedInLayout) return 0\n const [start, end] = axis === 'width' ? [3, 1] : [0, 2]\n const across = (sides: Sides | null) => (sides ? sides[start] + sides[end] : 0)\n let room = across(strokeExtent(parent, 'inside'))\n for (const child of children) {\n if (strokeTakesRoom(child, parent)) room += across(strokeExtent(child, 'outside'))\n }\n return room\n}\n"],"mappings":";;AAOA,MAAM,QAAQ;CAAC,KAAK;CAAK,KAAK;CAAO,KAAK;CAAQ,KAAK;AAAI;;AAG3D,SAAS,aAAa,OAAgC;CACpD,IAAI,UAAU,WAAW,OAAO;CAChC,IAAI,UAAU,UAAU,OAAO;CAC/B,OAAO;AACT;;;;;AAMA,SAAS,aAAa,MAAiB,MAA0C;CAC/E,MAAM,UAAU,KAAK,QAAQ,QAAQ,WAAW,OAAO,OAAO;CAC9D,IAAI,QAAQ,WAAW,GAAG,OAAO;CACjC,MAAM,SAAgB;EAAC;EAAG;EAAG;EAAG;CAAC;CACjC,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,UAAU,aAAa,OAAO,KAAK;EACzC,MAAM,QAAQ,SAAS,YAAY,UAAU,IAAI;EACjD,MAAM,UAAU,KAAK,2BACjB;GACE,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,IACA;GAAC,OAAO;GAAQ,OAAO;GAAQ,OAAO;GAAQ,OAAO;EAAM;EAC/D,KAAK,MAAM,CAAC,MAAM,WAAW,QAAQ,QAAQ,GAC3C,OAAO,QAAQ,KAAK,IAAI,OAAO,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,KAAK;CAErE;CACA,OAAO,OAAO,MAAM,UAAU,QAAQ,CAAC,IAAI,SAAS;AACtD;;;;;AAMA,SAAS,gBAAgB,OAAkB,QAA4B;CACrE,OACE,OAAO,2BACP,MAAM,SAAS,UACf,MAAM,WACN,MAAM,sBAAsB;AAEhC;;;;;AAMA,SAAS,mBAAmB,UAAoB,MAAuB;CACrE,IAAI,CAAC,KAAK,yBAAyB;CACnC,MAAM,SAAS,aAAa,MAAM,QAAQ;CAC1C,IAAI,CAAC,QAAQ;CACb,KAAK,MAAM,CAAC,MAAM,SAAS,MAAM,QAAQ,GAAG,SAAS,UAAU,MAAM,OAAO,KAAK;AACnF;;AAGA,SAAgB,mBAAmB,UAAoB,MAAuB;CAC5E,SAAS,WAAW,KAAK,KAAK,KAAK,UAAU;CAC7C,SAAS,WAAW,KAAK,OAAO,KAAK,YAAY;CACjD,SAAS,WAAW,KAAK,QAAQ,KAAK,aAAa;CACnD,SAAS,WAAW,KAAK,MAAM,KAAK,WAAW;CAC/C,mBAAmB,UAAU,IAAI;AACnC;;;;;AAMA,SAAgB,kBAAkB,MAAoD;CACpF,MAAM,SAAS,KAAK,0BAA0B,aAAa,MAAM,QAAQ,IAAI;CAC7E,OAAO;EACL,OAAO,KAAK,cAAc,KAAK,gBAAgB,SAAS,OAAO,KAAK,OAAO,KAAK;EAChF,QAAQ,KAAK,aAAa,KAAK,iBAAiB,SAAS,OAAO,KAAK,OAAO,KAAK;CACnF;AACF;;;;;AAMA,SAAgB,mBAAmB,WAAqB,OAAkB,QAAyB;CACjG,IAAI,CAAC,gBAAgB,OAAO,MAAM,GAAG;CACrC,MAAM,UAAU,aAAa,OAAO,SAAS;CAC7C,IAAI,CAAC,SAAS;CACd,KAAK,MAAM,CAAC,MAAM,SAAS,MAAM,QAAQ,GAAG,UAAU,UAAU,MAAM,QAAQ,KAAK;AACrF;;;;;AAMA,SAAgB,WACd,QACA,UACA,MACQ;CACR,IAAI,CAAC,OAAO,yBAAyB,OAAO;CAC5C,MAAM,CAAC,OAAO,OAAO,SAAS,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;CACtD,MAAM,UAAU,UAAyB,QAAQ,MAAM,SAAS,MAAM,OAAO;CAC7E,IAAI,OAAO,OAAO,aAAa,QAAQ,QAAQ,CAAC;CAChD,KAAK,MAAM,SAAS,UAClB,IAAI,gBAAgB,OAAO,MAAM,GAAG,QAAQ,OAAO,aAAa,OAAO,SAAS,CAAC;CAEnF,OAAO;AACT"}
@@ -1,6 +1,8 @@
1
1
  import { GridTrack, SceneGraph, SceneNode } from "@pairdraw/scene-graph";
2
2
  import { Align, GridTrackType, Justify, Node } from "yoga-layout";
3
3
  //#region src/layout/yoga-helpers.d.ts
4
+ /** Yoga nodes created and not yet freed by `freeYogaTree`. */
5
+ declare function liveYogaNodeCount(): number;
4
6
  declare function createYogaNode(): Node;
5
7
  declare function configureAbsoluteChild(yogaChild: Node, child: SceneNode): void;
6
8
  declare function configureNonTextLeaf(yogaChild: Node, child: SceneNode, isRow: boolean, stretchCross: boolean): void;
@@ -22,5 +24,5 @@ declare function mapAlignSelf(alignSelf: string): Align | null;
22
24
  /** The axis a frame's auto layout parent stretches it along, if any. */
23
25
  declare function parentStretchedAxis(graph: SceneGraph, frame: SceneNode): 'width' | 'height' | null;
24
26
  //#endregion
25
- export { applyLockedAspectRatio, applyMinMaxConstraints, configureAbsoluteChild, configureNonTextLeaf, createYogaNode, freeYogaTree, mapAlign, mapAlignSelf, mapGridTrack, mapJustify, parentStretchedAxis };
27
+ export { applyLockedAspectRatio, applyMinMaxConstraints, configureAbsoluteChild, configureNonTextLeaf, createYogaNode, freeYogaTree, liveYogaNodeCount, mapAlign, mapAlignSelf, mapGridTrack, mapJustify, parentStretchedAxis };
26
28
  //# sourceMappingURL=yoga-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"yoga-helpers.d.ts","names":[],"sources":["../../src/layout/yoga-helpers.ts"],"mappings":";;;iBAegB,kBAAkB;iBAIlB,uBAAuB,WAAW,MAAU,OAAO;iBAQnD,qBACd,WAAW,MACX,OAAO,WACP,gBACA;;;;;;iBA2Bc,uBACd,UAAU,MACV,MAAM,WACN,QAAQ;iBAmBM,uBAAuB,UAAU,MAAU,MAAM;iBAOjD,aAAa,OAAO;EAAc,MAAM;EAAe;;iBAWvD,aAAa,MAAM;iBAOnB,WAAW,gBAAgB;iBAe3B,SAAS,gBAAgB;iBAezB,aAAa,oBAAoB;;iBAkBjC,oBACd,OAAO,YACP,OAAO"}
1
+ {"version":3,"file":"yoga-helpers.d.ts","names":[],"sources":["../../src/layout/yoga-helpers.ts"],"mappings":";;;;iBAuBgB;iBAIA,kBAAkB;iBAKlB,uBAAuB,WAAW,MAAU,OAAO;iBAQnD,qBACd,WAAW,MACX,OAAO,WACP,gBACA;;;;;;iBA2Bc,uBACd,UAAU,MACV,MAAM,WACN,QAAQ;iBAmBM,uBAAuB,UAAU,MAAU,MAAM;iBAOjD,aAAa,OAAO;EAAc,MAAM;EAAe;;iBAWvD,aAAa,MAAM;iBAWnB,WAAW,gBAAgB;iBAe3B,SAAS,gBAAgB;iBAezB,aAAa,oBAAoB;;iBAkBjC,oBACd,OAAO,YACP,OAAO"}
@@ -3,7 +3,18 @@ import Yoga, { Align, Edge, GridTrackType, Justify, PositionType } from "yoga-la
3
3
  //#region src/layout/yoga-helpers.ts
4
4
  const yogaConfig = Yoga.Config.create();
5
5
  yogaConfig.setPointScaleFactor(0);
6
+ /**
7
+ * Yoga nodes built and not freed yet. Yoga's nodes live in WebAssembly memory the caller owns, so a
8
+ * pass that leaves its tree behind holds that memory and the nodes it holds; a test reads this to
9
+ * see one freed on every path.
10
+ */
11
+ let liveYogaNodes = 0;
12
+ /** Yoga nodes created and not yet freed by `freeYogaTree`. */
13
+ function liveYogaNodeCount() {
14
+ return liveYogaNodes;
15
+ }
6
16
  function createYogaNode() {
17
+ liveYogaNodes += 1;
7
18
  return Yoga.Node.create(yogaConfig);
8
19
  }
9
20
  function configureAbsoluteChild(yogaChild, child) {
@@ -76,7 +87,10 @@ function mapGridTrack(track) {
76
87
  }
77
88
  function freeYogaTree(node) {
78
89
  for (let i = node.getChildCount() - 1; i >= 0; i--) freeYogaTree(node.getChild(i));
79
- if ("free" in node) node.free();
90
+ if ("free" in node && typeof node.free === "function") {
91
+ node.free();
92
+ liveYogaNodes -= 1;
93
+ }
80
94
  }
81
95
  function mapJustify(align) {
82
96
  switch (align) {
@@ -115,6 +129,6 @@ function parentStretchedAxis(graph, frame) {
115
129
  return parent.layoutMode === "VERTICAL" ? "width" : "height";
116
130
  }
117
131
  //#endregion
118
- export { applyLockedAspectRatio, applyMinMaxConstraints, configureAbsoluteChild, configureNonTextLeaf, createYogaNode, freeYogaTree, mapAlign, mapAlignSelf, mapGridTrack, mapJustify, parentStretchedAxis };
132
+ export { applyLockedAspectRatio, applyMinMaxConstraints, configureAbsoluteChild, configureNonTextLeaf, createYogaNode, freeYogaTree, liveYogaNodeCount, mapAlign, mapAlignSelf, mapGridTrack, mapJustify, parentStretchedAxis };
119
133
 
120
134
  //# sourceMappingURL=yoga-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"yoga-helpers.js","names":[],"sources":["../../src/layout/yoga-helpers.ts"],"sourcesContent":["import Yoga, {\n Align,\n Edge,\n GridTrackType,\n Justify,\n PositionType,\n type Node as YogaNode\n} from 'yoga-layout'\n\nimport type { GridTrack, SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { enforcedAspectRatio, layoutSizingInParent } from '@pairdraw/scene-graph/layout'\n\nconst yogaConfig = Yoga.Config.create()\nyogaConfig.setPointScaleFactor(0)\n\nexport function createYogaNode(): YogaNode {\n return Yoga.Node.create(yogaConfig)\n}\n\nexport function configureAbsoluteChild(yogaChild: YogaNode, child: SceneNode): void {\n yogaChild.setPositionType(PositionType.Absolute)\n yogaChild.setPosition(Edge.Left, child.x)\n yogaChild.setPosition(Edge.Top, child.y)\n yogaChild.setWidth(child.width)\n yogaChild.setHeight(child.height)\n}\n\nexport function configureNonTextLeaf(\n yogaChild: YogaNode,\n child: SceneNode,\n isRow: boolean,\n stretchCross: boolean\n): void {\n const w = child.width\n const h = child.height\n\n if (child.layoutGrow > 0) {\n yogaChild.setFlexGrow(child.layoutGrow)\n if (!stretchCross) {\n if (isRow) yogaChild.setHeight(h)\n else yogaChild.setWidth(w)\n }\n } else {\n if (isRow) {\n yogaChild.setWidth(w)\n if (!stretchCross) yogaChild.setHeight(h)\n } else {\n yogaChild.setHeight(h)\n if (!stretchCross) yogaChild.setWidth(w)\n }\n }\n}\n\n/**\n * A locked aspect ratio sizes the axis Fill does not drive, as Figma lays it out: Fill along the\n * parent's primary axis drives when set, else Fill across it, and the other axis follows even past\n * the parent's edge. An axis that hugs keeps its own size.\n */\nexport function applyLockedAspectRatio(\n yogaNode: YogaNode,\n node: SceneNode,\n parent: SceneNode\n): void {\n const ratio = enforcedAspectRatio(node)\n if (ratio === null) return\n const width = layoutSizingInParent(parent, node, 'HORIZONTAL')\n const height = layoutSizingInParent(parent, node, 'VERTICAL')\n const primaryIsWidth = parent.layoutMode !== 'VERTICAL'\n const primary = primaryIsWidth ? width : height\n const cross = primaryIsWidth ? height : width\n let drivesWidth: boolean\n if (primary === 'FILL') drivesWidth = primaryIsWidth\n else if (cross === 'FILL') drivesWidth = !primaryIsWidth\n else return\n if ((drivesWidth ? height : width) === 'HUG') return\n yogaNode.setAspectRatio(ratio)\n if (drivesWidth) yogaNode.setHeight('auto')\n else yogaNode.setWidth('auto')\n}\n\nexport function applyMinMaxConstraints(yogaNode: YogaNode, node: SceneNode): void {\n if (node.minWidth != null) yogaNode.setMinWidth(node.minWidth)\n if (node.maxWidth != null) yogaNode.setMaxWidth(node.maxWidth)\n if (node.minHeight != null) yogaNode.setMinHeight(node.minHeight)\n if (node.maxHeight != null) yogaNode.setMaxHeight(node.maxHeight)\n}\n\nexport function mapGridTrack(track: GridTrack): { type: GridTrackType; value: number } {\n switch (track.sizing) {\n case 'FR':\n return { type: GridTrackType.Fr, value: track.value }\n case 'FIXED':\n return { type: GridTrackType.Points, value: track.value }\n default:\n return { type: GridTrackType.Auto, value: 0 }\n }\n}\n\nexport function freeYogaTree(node: YogaNode): void {\n for (let i = node.getChildCount() - 1; i >= 0; i--) {\n freeYogaTree(node.getChild(i))\n }\n if ('free' in node) (node as { free(): void }).free()\n}\n\nexport function mapJustify(align: string): Justify {\n switch (align) {\n case 'CENTER':\n return Justify.Center\n case 'MAX':\n return Justify.FlexEnd\n case 'SPACE_BETWEEN':\n return Justify.SpaceBetween\n case 'SPACE_AROUND':\n return Justify.SpaceAround\n default:\n return Justify.FlexStart\n }\n}\n\nexport function mapAlign(align: string): Align {\n switch (align) {\n case 'CENTER':\n return Align.Center\n case 'MAX':\n return Align.FlexEnd\n case 'STRETCH':\n return Align.Stretch\n case 'BASELINE':\n return Align.Baseline\n default:\n return Align.FlexStart\n }\n}\n\nexport function mapAlignSelf(alignSelf: string): Align | null {\n switch (alignSelf) {\n case 'MIN':\n return Align.FlexStart\n case 'CENTER':\n return Align.Center\n case 'MAX':\n return Align.FlexEnd\n case 'STRETCH':\n return Align.Stretch\n case 'BASELINE':\n return Align.Baseline\n default:\n return null\n }\n}\n\n/** The axis a frame's auto layout parent stretches it along, if any. */\nexport function parentStretchedAxis(\n graph: SceneGraph,\n frame: SceneNode\n): 'width' | 'height' | null {\n const parent = frame.parentId ? graph.getNode(frame.parentId) : undefined\n if (!parent || frame.layoutPositioning === 'ABSOLUTE') return null\n if (parent.layoutMode !== 'HORIZONTAL' && parent.layoutMode !== 'VERTICAL') return null\n const stretched =\n frame.layoutAlignSelf === 'STRETCH' ||\n (frame.layoutAlignSelf === 'AUTO' && parent.counterAxisAlign === 'STRETCH')\n if (!stretched) return null\n return parent.layoutMode === 'VERTICAL' ? 'width' : 'height'\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"yoga-helpers.js","names":[],"sources":["../../src/layout/yoga-helpers.ts"],"sourcesContent":["import Yoga, {\n Align,\n Edge,\n GridTrackType,\n Justify,\n PositionType,\n type Node as YogaNode\n} from 'yoga-layout'\n\nimport type { GridTrack, SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { enforcedAspectRatio, layoutSizingInParent } from '@pairdraw/scene-graph/layout'\n\nconst yogaConfig = Yoga.Config.create()\nyogaConfig.setPointScaleFactor(0)\n\n/**\n * Yoga nodes built and not freed yet. Yoga's nodes live in WebAssembly memory the caller owns, so a\n * pass that leaves its tree behind holds that memory and the nodes it holds; a test reads this to\n * see one freed on every path.\n */\nlet liveYogaNodes = 0\n\n/** Yoga nodes created and not yet freed by `freeYogaTree`. */\nexport function liveYogaNodeCount(): number {\n return liveYogaNodes\n}\n\nexport function createYogaNode(): YogaNode {\n liveYogaNodes += 1\n return Yoga.Node.create(yogaConfig)\n}\n\nexport function configureAbsoluteChild(yogaChild: YogaNode, child: SceneNode): void {\n yogaChild.setPositionType(PositionType.Absolute)\n yogaChild.setPosition(Edge.Left, child.x)\n yogaChild.setPosition(Edge.Top, child.y)\n yogaChild.setWidth(child.width)\n yogaChild.setHeight(child.height)\n}\n\nexport function configureNonTextLeaf(\n yogaChild: YogaNode,\n child: SceneNode,\n isRow: boolean,\n stretchCross: boolean\n): void {\n const w = child.width\n const h = child.height\n\n if (child.layoutGrow > 0) {\n yogaChild.setFlexGrow(child.layoutGrow)\n if (!stretchCross) {\n if (isRow) yogaChild.setHeight(h)\n else yogaChild.setWidth(w)\n }\n } else {\n if (isRow) {\n yogaChild.setWidth(w)\n if (!stretchCross) yogaChild.setHeight(h)\n } else {\n yogaChild.setHeight(h)\n if (!stretchCross) yogaChild.setWidth(w)\n }\n }\n}\n\n/**\n * A locked aspect ratio sizes the axis Fill does not drive, as Figma lays it out: Fill along the\n * parent's primary axis drives when set, else Fill across it, and the other axis follows even past\n * the parent's edge. An axis that hugs keeps its own size.\n */\nexport function applyLockedAspectRatio(\n yogaNode: YogaNode,\n node: SceneNode,\n parent: SceneNode\n): void {\n const ratio = enforcedAspectRatio(node)\n if (ratio === null) return\n const width = layoutSizingInParent(parent, node, 'HORIZONTAL')\n const height = layoutSizingInParent(parent, node, 'VERTICAL')\n const primaryIsWidth = parent.layoutMode !== 'VERTICAL'\n const primary = primaryIsWidth ? width : height\n const cross = primaryIsWidth ? height : width\n let drivesWidth: boolean\n if (primary === 'FILL') drivesWidth = primaryIsWidth\n else if (cross === 'FILL') drivesWidth = !primaryIsWidth\n else return\n if ((drivesWidth ? height : width) === 'HUG') return\n yogaNode.setAspectRatio(ratio)\n if (drivesWidth) yogaNode.setHeight('auto')\n else yogaNode.setWidth('auto')\n}\n\nexport function applyMinMaxConstraints(yogaNode: YogaNode, node: SceneNode): void {\n if (node.minWidth != null) yogaNode.setMinWidth(node.minWidth)\n if (node.maxWidth != null) yogaNode.setMaxWidth(node.maxWidth)\n if (node.minHeight != null) yogaNode.setMinHeight(node.minHeight)\n if (node.maxHeight != null) yogaNode.setMaxHeight(node.maxHeight)\n}\n\nexport function mapGridTrack(track: GridTrack): { type: GridTrackType; value: number } {\n switch (track.sizing) {\n case 'FR':\n return { type: GridTrackType.Fr, value: track.value }\n case 'FIXED':\n return { type: GridTrackType.Points, value: track.value }\n default:\n return { type: GridTrackType.Auto, value: 0 }\n }\n}\n\nexport function freeYogaTree(node: YogaNode): void {\n for (let i = node.getChildCount() - 1; i >= 0; i--) {\n freeYogaTree(node.getChild(i))\n }\n // Wasm-backed nodes carry `free`, which `yoga-layout`'s type leaves out.\n if ('free' in node && typeof node.free === 'function') {\n node.free()\n liveYogaNodes -= 1\n }\n}\n\nexport function mapJustify(align: string): Justify {\n switch (align) {\n case 'CENTER':\n return Justify.Center\n case 'MAX':\n return Justify.FlexEnd\n case 'SPACE_BETWEEN':\n return Justify.SpaceBetween\n case 'SPACE_AROUND':\n return Justify.SpaceAround\n default:\n return Justify.FlexStart\n }\n}\n\nexport function mapAlign(align: string): Align {\n switch (align) {\n case 'CENTER':\n return Align.Center\n case 'MAX':\n return Align.FlexEnd\n case 'STRETCH':\n return Align.Stretch\n case 'BASELINE':\n return Align.Baseline\n default:\n return Align.FlexStart\n }\n}\n\nexport function mapAlignSelf(alignSelf: string): Align | null {\n switch (alignSelf) {\n case 'MIN':\n return Align.FlexStart\n case 'CENTER':\n return Align.Center\n case 'MAX':\n return Align.FlexEnd\n case 'STRETCH':\n return Align.Stretch\n case 'BASELINE':\n return Align.Baseline\n default:\n return null\n }\n}\n\n/** The axis a frame's auto layout parent stretches it along, if any. */\nexport function parentStretchedAxis(\n graph: SceneGraph,\n frame: SceneNode\n): 'width' | 'height' | null {\n const parent = frame.parentId ? graph.getNode(frame.parentId) : undefined\n if (!parent || frame.layoutPositioning === 'ABSOLUTE') return null\n if (parent.layoutMode !== 'HORIZONTAL' && parent.layoutMode !== 'VERTICAL') return null\n const stretched =\n frame.layoutAlignSelf === 'STRETCH' ||\n (frame.layoutAlignSelf === 'AUTO' && parent.counterAxisAlign === 'STRETCH')\n if (!stretched) return null\n return parent.layoutMode === 'VERTICAL' ? 'width' : 'height'\n}\n"],"mappings":"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"}
package/dist/layout.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { sizeAutoResizingText } from "./layout/text-auto-resize.js";
2
- import { TextMeasurer, estimateTextSize, getTextMeasurer, installTextMeasurer, setTextMeasurer } from "./layout/text-measurement.js";
2
+ import { AutoLayoutDragChanges, AutoLayoutDragInput, AutoLayoutGapHandle, AutoLayoutHandle, AutoLayoutHandleHit, AutoLayoutHandleLayout, AutoLayoutHandleRect, AutoLayoutPaddingHandle, AutoLayoutPaddingSide, autoLayoutDragChanges, autoLayoutDragValue, hitAutoLayoutHandle, measureAutoLayoutHandles } from "./layout/auto-layout-handles.js";
3
+ import { TextMeasurer, estimateTextSize, getTextMeasurer, installTextMeasurer, measureTextForLayout, setTextMeasurer } from "./layout/text-measurement.js";
3
4
  import { SceneGraph } from "@pairdraw/scene-graph";
4
5
  //#region src/layout.d.ts
5
6
  declare function computeLayout(graph: SceneGraph, frameId: string): void;
@@ -16,5 +17,5 @@ declare function routeUnroutedConnectors(graph: SceneGraph, rootId: string): voi
16
17
  */
17
18
  declare function layoutAuthoredNodes(graph: SceneGraph, rootIds: Iterable<string>): void;
18
19
  //#endregion
19
- export { type TextMeasurer, computeAllLayouts, computeLayout, estimateTextSize, getTextMeasurer, installTextMeasurer, layoutAuthoredNodes, routeUnroutedConnectors, setTextMeasurer, sizeAutoResizingText };
20
+ export { AutoLayoutDragChanges, AutoLayoutDragInput, AutoLayoutGapHandle, AutoLayoutHandle, AutoLayoutHandleHit, AutoLayoutHandleLayout, AutoLayoutHandleRect, AutoLayoutPaddingHandle, AutoLayoutPaddingSide, type TextMeasurer, autoLayoutDragChanges, autoLayoutDragValue, computeAllLayouts, computeLayout, estimateTextSize, getTextMeasurer, hitAutoLayoutHandle, installTextMeasurer, layoutAuthoredNodes, measureAutoLayoutHandles, measureTextForLayout, routeUnroutedConnectors, setTextMeasurer, sizeAutoResizingText };
20
21
  //# sourceMappingURL=layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","names":[],"sources":["../src/layout.ts"],"mappings":";;;;iBA2DgB,cAAc,OAAO,YAAY;iBAqCjC,kBAAkB,OAAO,YAAY;;;;;iBAgBrC,wBAAwB,OAAO,YAAY;;;;;;iBAe3C,oBAAoB,OAAO,YAAY,SAAS"}
1
+ {"version":3,"file":"layout.d.ts","names":[],"sources":["../src/layout.ts"],"mappings":";;;;;iBAkEgB,cAAc,OAAO,YAAY;iBA2CjC,kBAAkB,OAAO,YAAY;;;;;iBAgBrC,wBAAwB,OAAO,YAAY;;;;;;iBAe3C,oBAAoB,OAAO,YAAY,SAAS"}
package/dist/layout.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { autoWidthWrapWidth, estimateTextSize, getTextMeasurer, installTextMeasurer, measureAutoWidthText, measureTextForLayout, setTextMeasurer } from "./layout/text-measurement.js";
2
- import { keepsSavedLayout, usesDetachedDerivedLayout } from "./layout/derived.js";
2
+ import { autoLayoutDragChanges, autoLayoutDragValue, hitAutoLayoutHandle, measureAutoLayoutHandles } from "./layout/auto-layout-handles.js";
3
+ import { keepsSavedFrameSize, keepsSavedLayout, usesDetachedDerivedLayout } from "./layout/derived.js";
3
4
  import { applyLockedAspectRatio, applyMinMaxConstraints, configureAbsoluteChild, configureNonTextLeaf, createYogaNode, freeYogaTree, mapAlignSelf, mapGridTrack, parentStretchedAxis } from "./layout/yoga-helpers.js";
4
5
  import { insertFlowBox, setFlexFlow, setFlowEdges } from "./layout/flow-edges.js";
6
+ import { applyContentInsets, applyStrokeMargins, contentInsetsSize, strokeRoom } from "./layout/strokes.js";
5
7
  import { applyYogaLayout } from "./layout/apply.js";
6
8
  import { asFlatLeaf, asLaidOutIn, fillKeepsSizeInHuggingParent, heldHugAxis, ownAxisSizing, setCrossAxisSizing, setMainAxisSizing } from "./layout/axis-sizing.js";
7
9
  import { applyEffectiveGeneratedTextLayout } from "./layout/effective-generated-text.js";
8
- import { applyContentInsets, applyStrokeMargins, strokeRoom } from "./layout/strokes.js";
9
- import { buildGridTree, createGridChildNode } from "./layout/grid.js";
10
+ import { buildGridTree, createGridChildNode, gridTracksForAxis } from "./layout/grid.js";
10
11
  import { sizeAutoResizingText } from "./layout/text-auto-resize.js";
11
12
  import { fitShapeWithTextFrame } from "./layout/shape-with-text.js";
12
13
  import { connectorSublayers, layoutConnector } from "@pairdraw/scene-graph/connectors";
@@ -30,10 +31,14 @@ function computeLayoutInternal(graph, frameId) {
30
31
  fitShapeWithTextFrame(graph, frame);
31
32
  const rootDirection = resolveComputedLayoutDirection(graph, frame);
32
33
  const yogaDirection = rootDirection === "RTL" ? Direction.RTL : Direction.LTR;
33
- const yogaRoot = frame.layoutMode === "GRID" ? buildGridTree(graph, frame, rootDirection) : buildYogaTree(graph, frame, rootDirection);
34
- yogaRoot.calculateLayout(void 0, void 0, yogaDirection);
35
- applyYogaLayout(graph, frame, yogaRoot, computeLayoutInternal);
36
- freeYogaTree(yogaRoot);
34
+ let yogaRoot = null;
35
+ try {
36
+ yogaRoot = frame.layoutMode === "GRID" ? buildGridTree(graph, frame, rootDirection) : buildYogaTree(graph, frame, rootDirection);
37
+ yogaRoot.calculateLayout(void 0, void 0, yogaDirection);
38
+ applyYogaLayout(graph, frame, yogaRoot, computeLayoutInternal);
39
+ } finally {
40
+ if (yogaRoot) freeYogaTree(yogaRoot);
41
+ }
37
42
  }
38
43
  function resolveComputedLayoutDirection(graph, node) {
39
44
  const parent = node.parentId ? graph.getNode(node.parentId) : null;
@@ -97,22 +102,30 @@ function preservesImportedInstanceLayout(node) {
97
102
  function buildYogaTree(graph, frame, inheritedDirection) {
98
103
  const root = createYogaNode();
99
104
  const direction = resolveNodeLayoutDirection(frame, inheritedDirection);
105
+ const insets = keepsSavedFrameSize(graph, frame) ? null : contentInsetsSize(frame);
106
+ const width = insets ? Math.max(frame.width, insets.width) : frame.width;
107
+ const height = insets ? Math.max(frame.height, insets.height) : frame.height;
100
108
  if (frame.primaryAxisSizing === "FIXED") {
101
- if (frame.layoutMode === "HORIZONTAL") root.setWidth(frame.width);
102
- else root.setHeight(frame.height);
109
+ if (frame.layoutMode === "HORIZONTAL") root.setWidth(width);
110
+ else root.setHeight(height);
103
111
  }
104
112
  if (frame.counterAxisSizing === "FIXED") {
105
- if (frame.layoutMode === "HORIZONTAL") root.setHeight(frame.height);
106
- else root.setWidth(frame.width);
113
+ if (frame.layoutMode === "HORIZONTAL") root.setHeight(height);
114
+ else root.setWidth(width);
107
115
  }
108
116
  const stretchedAxis = parentStretchedAxis(graph, frame);
109
- if (stretchedAxis === "width") root.setWidth(frame.width);
110
- if (stretchedAxis === "height") root.setHeight(frame.height);
117
+ if (stretchedAxis === "width") root.setWidth(width);
118
+ if (stretchedAxis === "height") root.setHeight(height);
111
119
  const heldAxis = heldHugAxis(graph, frame);
112
- if (heldAxis === "width") root.setWidth(frame.width);
113
- if (heldAxis === "height") root.setHeight(frame.height);
120
+ if (heldAxis === "width") root.setWidth(width);
121
+ if (heldAxis === "height") root.setHeight(height);
114
122
  configureFlexContainer(root, frame, direction);
115
- insertFlexChildren(root, frame, graph, direction, 1);
123
+ try {
124
+ insertFlexChildren(root, frame, graph, direction, 1);
125
+ } catch (error) {
126
+ freeYogaTree(root);
127
+ throw error;
128
+ }
116
129
  return root;
117
130
  }
118
131
  function configureFlexContainer(yogaNode, node, direction) {
@@ -122,32 +135,43 @@ function configureFlexContainer(yogaNode, node, direction) {
122
135
  applyContentInsets(yogaNode, node);
123
136
  applyMinMaxConstraints(yogaNode, node);
124
137
  }
125
- function configureChildAsGrid(yogaChild, child, parent, graph, inheritedDirection) {
126
- const direction = resolveNodeLayoutDirection(child, inheritedDirection);
127
- yogaChild.setDisplay(Display.Grid);
128
- yogaChild.setDirection(direction === "RTL" ? Direction.RTL : Direction.LTR);
129
- if (child.gridTemplateColumns.length > 0) yogaChild.setGridTemplateColumns(child.gridTemplateColumns.map(mapGridTrack));
130
- if (child.gridTemplateRows.length > 0) yogaChild.setGridTemplateRows(child.gridTemplateRows.map(mapGridTrack));
131
- yogaChild.setGap(Gutter.Column, child.gridColumnGap);
132
- yogaChild.setGap(Gutter.Row, child.gridRowGap);
133
- applyContentInsets(yogaChild, child);
138
+ /**
139
+ * A grid child's box in its flex parent: grow takes the free space, a fixed size is stored, and
140
+ * an axis the grid hugs takes its tracks' size there, as configureAsGrid lays it out.
141
+ */
142
+ function applyGridChildBox(yogaChild, child, parent) {
134
143
  const isParentRow = parent.layoutMode === "HORIZONTAL";
135
144
  const stretchCross = child.layoutAlignSelf !== "AUTO" ? child.layoutAlignSelf === "STRETCH" : parent.counterAxisAlign === "STRETCH";
145
+ const hugWidth = ownAxisSizing(child, "width") === "HUG";
146
+ const hugHeight = ownAxisSizing(child, "height") === "HUG";
136
147
  if (child.layoutGrow > 0) {
137
148
  yogaChild.setFlexGrow(child.layoutGrow);
138
149
  yogaChild.setFlexShrink(1);
139
150
  yogaChild.setFlexBasis(0);
140
- if (!stretchCross) {
141
- if (isParentRow) yogaChild.setHeight(child.height);
142
- else yogaChild.setWidth(child.width);
143
- }
144
- } else if (isParentRow) {
145
- yogaChild.setWidth(child.width);
146
- if (!stretchCross) yogaChild.setHeight(child.height);
147
- } else {
148
- if (child.gridTemplateRows.length > 0) yogaChild.setHeight(child.height);
149
- if (!stretchCross) yogaChild.setWidth(child.width);
151
+ if (stretchCross) return;
152
+ if (isParentRow) {
153
+ if (!hugHeight) yogaChild.setHeight(child.height);
154
+ } else if (!hugWidth) yogaChild.setWidth(child.width);
155
+ return;
156
+ }
157
+ if (isParentRow) {
158
+ if (!hugWidth) yogaChild.setWidth(child.width);
159
+ if (!stretchCross && !hugHeight) yogaChild.setHeight(child.height);
160
+ return;
150
161
  }
162
+ if (child.gridTemplateRows.length > 0 && !hugHeight) yogaChild.setHeight(child.height);
163
+ if (!stretchCross && !hugWidth) yogaChild.setWidth(child.width);
164
+ }
165
+ function configureChildAsGrid(yogaChild, child, parent, graph, inheritedDirection) {
166
+ const direction = resolveNodeLayoutDirection(child, inheritedDirection);
167
+ yogaChild.setDisplay(Display.Grid);
168
+ yogaChild.setDirection(direction === "RTL" ? Direction.RTL : Direction.LTR);
169
+ if (child.gridTemplateColumns.length > 0) yogaChild.setGridTemplateColumns(gridTracksForAxis(child, "width").map(mapGridTrack));
170
+ if (child.gridTemplateRows.length > 0) yogaChild.setGridTemplateRows(gridTracksForAxis(child, "height").map(mapGridTrack));
171
+ yogaChild.setGap(Gutter.Column, child.gridColumnGap);
172
+ yogaChild.setGap(Gutter.Row, child.gridRowGap);
173
+ applyContentInsets(yogaChild, child);
174
+ applyGridChildBox(yogaChild, child, parent);
151
175
  const selfAlign = mapAlignSelf(child.layoutAlignSelf);
152
176
  if (selfAlign != null) yogaChild.setAlignSelf(selfAlign);
153
177
  applyLockedAspectRatio(yogaChild, child, parent);
@@ -220,6 +244,7 @@ function insertFlexChildren(yogaParent, parent, graph, direction, depth) {
220
244
  const flow = [];
221
245
  for (const child of graph.getChildren(parent.id).map((node) => asLaidOutIn(graph, node, parent))) {
222
246
  const yogaChild = createYogaNode();
247
+ box.insertChild(yogaChild, box.getChildCount());
223
248
  if (child.layoutPositioning === "ABSOLUTE") configureAbsoluteChild(yogaChild, child);
224
249
  else if (!child.visible) yogaChild.setDisplay(Display.None);
225
250
  else {
@@ -229,7 +254,6 @@ function insertFlexChildren(yogaParent, parent, graph, direction, depth) {
229
254
  flow.push(yogaChild);
230
255
  }
231
256
  applyStrokeMargins(yogaChild, child, parent);
232
- box.insertChild(yogaChild, box.getChildCount());
233
257
  }
234
258
  setFlowEdges(yogaParent, box, parent, flow, direction);
235
259
  }
@@ -266,7 +290,13 @@ function configureTextLeafWithoutMeasurer(yogaChild, child, parent, fixedDerived
266
290
  }
267
291
  return;
268
292
  }
269
- if (child.textAutoResize !== "HEIGHT") return;
293
+ if (child.textAutoResize !== "HEIGHT") {
294
+ if (child.width > 0 && child.height > 0) {
295
+ yogaChild.setWidth(child.width);
296
+ yogaChild.setHeight(child.height);
297
+ }
298
+ return;
299
+ }
270
300
  const growsWidth = configureGrowingText(yogaChild, child, parent, fixedDerivedMainAxis);
271
301
  const isRow = parent.layoutMode === "HORIZONTAL";
272
302
  const measurementWidth = fixedDerivedMainAxis ? child.derivedLayout?.width ?? child.width : child.width;
@@ -281,7 +311,7 @@ function configureChildAsLeaf(yogaChild, node, parent, graph) {
281
311
  const stretchCross = child.layoutAlignSelf !== "AUTO" ? child.layoutAlignSelf === "STRETCH" : parent.counterAxisAlign === "STRETCH";
282
312
  const isText = child.type === "TEXT";
283
313
  const textMeasurer = getTextMeasurer();
284
- const needsMeasureFunc = isText && textMeasurer && child.textAutoResize !== "NONE";
314
+ const needsMeasureFunc = isText && textMeasurer && growsText(child);
285
315
  const fixedDerivedMainAxis = isRow ? derivedGrowingLeafFitsParent(graph, parent, child, "width") : derivedGrowingLeafFitsParent(graph, parent, child, "height");
286
316
  if (fixedDerivedMainAxis) {
287
317
  if (isRow) yogaChild.setWidth(child.derivedLayout?.width ?? child.width);
@@ -301,6 +331,10 @@ function configureChildAsLeaf(yogaChild, node, parent, graph) {
301
331
  applyLockedAspectRatio(yogaChild, child, parent);
302
332
  applyMinMaxConstraints(yogaChild, child);
303
333
  }
334
+ /** Whether layout measures a text to size it, which only the two growing modes need. */
335
+ function growsText(node) {
336
+ return node.textAutoResize === "WIDTH_AND_HEIGHT" || node.textAutoResize === "HEIGHT";
337
+ }
304
338
  function configureTextLeaf(yogaChild, child, parent, fixedDerivedMainAxis = false) {
305
339
  const autoResize = child.textAutoResize;
306
340
  const isRow = parent.layoutMode === "HORIZONTAL";
@@ -351,6 +385,6 @@ function configureTextLeaf(yogaChild, child, parent, fixedDerivedMainAxis = fals
351
385
  }
352
386
  }
353
387
  //#endregion
354
- export { computeAllLayouts, computeLayout, estimateTextSize, getTextMeasurer, installTextMeasurer, layoutAuthoredNodes, routeUnroutedConnectors, setTextMeasurer, sizeAutoResizingText };
388
+ export { autoLayoutDragChanges, autoLayoutDragValue, computeAllLayouts, computeLayout, estimateTextSize, getTextMeasurer, hitAutoLayoutHandle, installTextMeasurer, layoutAuthoredNodes, measureAutoLayoutHandles, measureTextForLayout, routeUnroutedConnectors, setTextMeasurer, sizeAutoResizingText };
355
389
 
356
390
  //# sourceMappingURL=layout.js.map