@pairdraw/core 0.18.0 → 0.19.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 (913) hide show
  1. package/dist/canvas/effects.d.ts +5 -11
  2. package/dist/canvas/effects.d.ts.map +1 -1
  3. package/dist/canvas/effects.js +25 -30
  4. package/dist/canvas/effects.js.map +1 -1
  5. package/dist/canvas/labels/hit-test.d.ts +5 -0
  6. package/dist/canvas/labels/hit-test.d.ts.map +1 -1
  7. package/dist/canvas/labels/hit-test.js +1 -1
  8. package/dist/canvas/labels/hit-test.js.map +1 -1
  9. package/dist/canvas/labels/paragraph-cache.d.ts.map +1 -1
  10. package/dist/canvas/labels/paragraph-cache.js +3 -2
  11. package/dist/canvas/labels/paragraph-cache.js.map +1 -1
  12. package/dist/canvas/labels/selection.js +3 -2
  13. package/dist/canvas/labels/selection.js.map +1 -1
  14. package/dist/canvas/labels/style.d.ts +1 -1
  15. package/dist/canvas/node-edit-overlay.js +2 -2
  16. package/dist/canvas/node-edit-overlay.js.map +1 -1
  17. package/dist/canvas/overlays/index.d.ts +2 -2
  18. package/dist/canvas/overlays/index.js +2 -2
  19. package/dist/canvas/overlays/selection.d.ts +1 -2
  20. package/dist/canvas/overlays/selection.d.ts.map +1 -1
  21. package/dist/canvas/overlays/selection.js +4 -37
  22. package/dist/canvas/overlays/selection.js.map +1 -1
  23. package/dist/canvas/region-hatch.js +3 -2
  24. package/dist/canvas/region-hatch.js.map +1 -1
  25. package/dist/canvas/renderer/colors.d.ts.map +1 -1
  26. package/dist/canvas/renderer/colors.js +36 -18
  27. package/dist/canvas/renderer/colors.js.map +1 -1
  28. package/dist/canvas/renderer/font-waiters.d.ts +9 -0
  29. package/dist/canvas/renderer/font-waiters.d.ts.map +1 -0
  30. package/dist/canvas/renderer/font-waiters.js +26 -0
  31. package/dist/canvas/renderer/font-waiters.js.map +1 -0
  32. package/dist/canvas/renderer/fonts.d.ts +4 -2
  33. package/dist/canvas/renderer/fonts.d.ts.map +1 -1
  34. package/dist/canvas/renderer/fonts.js +23 -9
  35. package/dist/canvas/renderer/fonts.js.map +1 -1
  36. package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
  37. package/dist/canvas/renderer/lifecycle.js +6 -9
  38. package/dist/canvas/renderer/lifecycle.js.map +1 -1
  39. package/dist/canvas/renderer/methods.d.ts +4 -5
  40. package/dist/canvas/renderer/methods.d.ts.map +1 -1
  41. package/dist/canvas/renderer/methods.js +1 -4
  42. package/dist/canvas/renderer/methods.js.map +1 -1
  43. package/dist/canvas/renderer/paints.d.ts.map +1 -1
  44. package/dist/canvas/renderer/paints.js +0 -6
  45. package/dist/canvas/renderer/paints.js.map +1 -1
  46. package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
  47. package/dist/canvas/renderer/pipeline.js +20 -2
  48. package/dist/canvas/renderer/pipeline.js.map +1 -1
  49. package/dist/canvas/renderer/retained-backing.js +4 -4
  50. package/dist/canvas/renderer/retained-backing.js.map +1 -1
  51. package/dist/canvas/renderer/state.js +1 -1
  52. package/dist/canvas/renderer/state.js.map +1 -1
  53. package/dist/canvas/renderer/tiles/controller.d.ts +2 -0
  54. package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
  55. package/dist/canvas/renderer/tiles/controller.js +8 -0
  56. package/dist/canvas/renderer/tiles/controller.js.map +1 -1
  57. package/dist/canvas/renderer/tiles/surface-pool.js +1 -1
  58. package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
  59. package/dist/canvas/renderer/visual-bounds.d.ts.map +1 -1
  60. package/dist/canvas/renderer/visual-bounds.js +7 -5
  61. package/dist/canvas/renderer/visual-bounds.js.map +1 -1
  62. package/dist/canvas/renderer.d.ts +22 -7
  63. package/dist/canvas/renderer.d.ts.map +1 -1
  64. package/dist/canvas/renderer.js +46 -11
  65. package/dist/canvas/renderer.js.map +1 -1
  66. package/dist/canvas/rulers.d.ts +8 -1
  67. package/dist/canvas/rulers.d.ts.map +1 -1
  68. package/dist/canvas/rulers.js +30 -5
  69. package/dist/canvas/rulers.js.map +1 -1
  70. package/dist/canvas/scene.d.ts +2 -1
  71. package/dist/canvas/scene.d.ts.map +1 -1
  72. package/dist/canvas/scene.js +30 -18
  73. package/dist/canvas/scene.js.map +1 -1
  74. package/dist/canvas/shadows/shape.js +1 -1
  75. package/dist/canvas/shadows/shape.js.map +1 -1
  76. package/dist/canvas/shadows/silhouette.d.ts.map +1 -1
  77. package/dist/canvas/shadows/silhouette.js +4 -2
  78. package/dist/canvas/shadows/silhouette.js.map +1 -1
  79. package/dist/canvas/shadows.d.ts.map +1 -1
  80. package/dist/canvas/shadows.js +3 -2
  81. package/dist/canvas/shadows.js.map +1 -1
  82. package/dist/canvas/text/derived.d.ts +1 -2
  83. package/dist/canvas/text/derived.d.ts.map +1 -1
  84. package/dist/canvas/text/derived.js +1 -7
  85. package/dist/canvas/text/derived.js.map +1 -1
  86. package/dist/canvas/text/emoji/index.js +1 -1
  87. package/dist/canvas/text/emoji/raster.d.ts.map +1 -1
  88. package/dist/canvas/text/emoji/raster.js +14 -10
  89. package/dist/canvas/text/emoji/raster.js.map +1 -1
  90. package/dist/canvas/text/font-families.d.ts.map +1 -1
  91. package/dist/canvas/text/font-families.js +5 -2
  92. package/dist/canvas/text/font-families.js.map +1 -1
  93. package/dist/canvas/text/index.d.ts +1 -3
  94. package/dist/canvas/text/index.d.ts.map +1 -1
  95. package/dist/canvas/text/index.js +1 -8
  96. package/dist/canvas/text/index.js.map +1 -1
  97. package/dist/canvas/text/layout/build.d.ts.map +1 -1
  98. package/dist/canvas/text/layout/build.js +25 -9
  99. package/dist/canvas/text/layout/build.js.map +1 -1
  100. package/dist/canvas/text/layout/index.d.ts.map +1 -1
  101. package/dist/canvas/text/layout/index.js +8 -4
  102. package/dist/canvas/text/layout/index.js.map +1 -1
  103. package/dist/canvas/text/layout/lines.js +5 -3
  104. package/dist/canvas/text/layout/lines.js.map +1 -1
  105. package/dist/canvas/text/paragraph/index.d.ts +5 -0
  106. package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
  107. package/dist/canvas/text/paragraph/index.js +16 -7
  108. package/dist/canvas/text/paragraph/index.js.map +1 -1
  109. package/dist/canvas/text/paragraph/inputs.d.ts +1 -1
  110. package/dist/canvas/text/paragraph/inputs.d.ts.map +1 -1
  111. package/dist/canvas/text/paragraph/inputs.js +9 -2
  112. package/dist/canvas/text/paragraph/inputs.js.map +1 -1
  113. package/dist/canvas/text/placed.js +1 -1
  114. package/dist/canvas/text/shape.d.ts +4 -3
  115. package/dist/canvas/text/shape.d.ts.map +1 -1
  116. package/dist/canvas/text/shape.js +9 -22
  117. package/dist/canvas/text/shape.js.map +1 -1
  118. package/dist/constants.d.ts +6 -2
  119. package/dist/constants.d.ts.map +1 -1
  120. package/dist/constants.js +6 -2
  121. package/dist/constants.js.map +1 -1
  122. package/dist/editor/bridges/clipboard.d.ts +1 -0
  123. package/dist/editor/bridges/clipboard.js +1 -0
  124. package/dist/editor/bridges/clipboard.js.map +1 -1
  125. package/dist/editor/bridges/components.d.ts +2 -0
  126. package/dist/editor/bridges/components.d.ts.map +1 -1
  127. package/dist/editor/bridges/components.js +2 -0
  128. package/dist/editor/bridges/components.js.map +1 -1
  129. package/dist/editor/bridges/frames.d.ts +4 -3
  130. package/dist/editor/bridges/frames.d.ts.map +1 -1
  131. package/dist/editor/bridges/frames.js +6 -4
  132. package/dist/editor/bridges/frames.js.map +1 -1
  133. package/dist/editor/bridges/structure.d.ts +1 -0
  134. package/dist/editor/bridges/structure.d.ts.map +1 -1
  135. package/dist/editor/bridges/structure.js +1 -0
  136. package/dist/editor/bridges/structure.js.map +1 -1
  137. package/dist/editor/clipboard/detach.js +2 -2
  138. package/dist/editor/clipboard/detach.js.map +1 -1
  139. package/dist/editor/clipboard/paste/properties.js +1 -1
  140. package/dist/editor/clipboard/paste/target.js +2 -2
  141. package/dist/editor/clipboard/paste/target.js.map +1 -1
  142. package/dist/editor/clipboard/snapshot.d.ts +3 -0
  143. package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
  144. package/dist/editor/clipboard/snapshot.js +2 -0
  145. package/dist/editor/clipboard/snapshot.js.map +1 -1
  146. package/dist/editor/clipboard/variables.d.ts.map +1 -1
  147. package/dist/editor/clipboard/variables.js +14 -1
  148. package/dist/editor/clipboard/variables.js.map +1 -1
  149. package/dist/editor/clipboard.d.ts +1 -0
  150. package/dist/editor/clipboard.d.ts.map +1 -1
  151. package/dist/editor/clipboard.js +122 -16
  152. package/dist/editor/clipboard.js.map +1 -1
  153. package/dist/editor/component-sync.d.ts +10 -1
  154. package/dist/editor/component-sync.d.ts.map +1 -1
  155. package/dist/editor/component-sync.js +25 -8
  156. package/dist/editor/component-sync.js.map +1 -1
  157. package/dist/editor/components/authoring/text-edit.d.ts.map +1 -1
  158. package/dist/editor/components/authoring/text-edit.js +11 -2
  159. package/dist/editor/components/authoring/text-edit.js.map +1 -1
  160. package/dist/editor/components/authoring/visibility-edit.d.ts.map +1 -1
  161. package/dist/editor/components/authoring/visibility-edit.js +7 -3
  162. package/dist/editor/components/authoring/visibility-edit.js.map +1 -1
  163. package/dist/editor/components/instances.d.ts +2 -0
  164. package/dist/editor/components/instances.d.ts.map +1 -1
  165. package/dist/editor/components/instances.js +37 -7
  166. package/dist/editor/components/instances.js.map +1 -1
  167. package/dist/editor/components/properties.d.ts.map +1 -1
  168. package/dist/editor/components/properties.js +3 -0
  169. package/dist/editor/components/properties.js.map +1 -1
  170. package/dist/editor/components/slots/authoring.js +2 -1
  171. package/dist/editor/components/slots/authoring.js.map +1 -1
  172. package/dist/editor/components.d.ts +2 -0
  173. package/dist/editor/components.d.ts.map +1 -1
  174. package/dist/editor/create.d.ts +17 -3
  175. package/dist/editor/create.d.ts.map +1 -1
  176. package/dist/editor/create.js +43 -6
  177. package/dist/editor/create.js.map +1 -1
  178. package/dist/editor/guides.d.ts.map +1 -1
  179. package/dist/editor/guides.js +20 -13
  180. package/dist/editor/guides.js.map +1 -1
  181. package/dist/editor/history/document-change.d.ts +19 -3
  182. package/dist/editor/history/document-change.d.ts.map +1 -1
  183. package/dist/editor/history/document-change.js +94 -8
  184. package/dist/editor/history/document-change.js.map +1 -1
  185. package/dist/editor/history/edit.d.ts.map +1 -1
  186. package/dist/editor/history/edit.js +56 -12
  187. package/dist/editor/history/edit.js.map +1 -1
  188. package/dist/editor/history/position.js +1 -4
  189. package/dist/editor/history/position.js.map +1 -1
  190. package/dist/editor/history/sources.d.ts +14 -0
  191. package/dist/editor/history/sources.d.ts.map +1 -0
  192. package/dist/editor/history/sources.js +24 -0
  193. package/dist/editor/history/sources.js.map +1 -0
  194. package/dist/editor/index.d.ts +2 -2
  195. package/dist/editor/index.js +1 -1
  196. package/dist/editor/layout-mode.d.ts.map +1 -1
  197. package/dist/editor/layout-mode.js +16 -1
  198. package/dist/editor/layout-mode.js.map +1 -1
  199. package/dist/editor/node-preview.d.ts.map +1 -1
  200. package/dist/editor/node-preview.js +26 -7
  201. package/dist/editor/node-preview.js.map +1 -1
  202. package/dist/editor/nodes.d.ts.map +1 -1
  203. package/dist/editor/nodes.js +33 -10
  204. package/dist/editor/nodes.js.map +1 -1
  205. package/dist/editor/nudge.d.ts.map +1 -1
  206. package/dist/editor/nudge.js +12 -2
  207. package/dist/editor/nudge.js.map +1 -1
  208. package/dist/editor/pages.d.ts +2 -1
  209. package/dist/editor/pages.d.ts.map +1 -1
  210. package/dist/editor/pages.js +94 -15
  211. package/dist/editor/pages.js.map +1 -1
  212. package/dist/editor/play/states.d.ts.map +1 -1
  213. package/dist/editor/play/states.js +0 -5
  214. package/dist/editor/play/states.js.map +1 -1
  215. package/dist/editor/read-only/actions.js +3 -0
  216. package/dist/editor/read-only/actions.js.map +1 -1
  217. package/dist/editor/selection/hit-test.d.ts +2 -1
  218. package/dist/editor/selection/hit-test.d.ts.map +1 -1
  219. package/dist/editor/selection/hit-test.js +29 -4
  220. package/dist/editor/selection/hit-test.js.map +1 -1
  221. package/dist/editor/selection.d.ts +2 -2
  222. package/dist/editor/selection.d.ts.map +1 -1
  223. package/dist/editor/shapes/pen.js +6 -2
  224. package/dist/editor/shapes/pen.js.map +1 -1
  225. package/dist/editor/shapes.d.ts.map +1 -1
  226. package/dist/editor/shapes.js +2 -1
  227. package/dist/editor/shapes.js.map +1 -1
  228. package/dist/editor/structure/auto-layout-wrap.d.ts.map +1 -1
  229. package/dist/editor/structure/auto-layout-wrap.js +12 -0
  230. package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
  231. package/dist/editor/structure/boolean.js +1 -1
  232. package/dist/editor/structure/group/bounds.d.ts +4 -2
  233. package/dist/editor/structure/group/bounds.d.ts.map +1 -1
  234. package/dist/editor/structure/group/bounds.js +17 -4
  235. package/dist/editor/structure/group/bounds.js.map +1 -1
  236. package/dist/editor/structure/rename.d.ts +2 -3
  237. package/dist/editor/structure/rename.d.ts.map +1 -1
  238. package/dist/editor/structure/rename.js +2 -5
  239. package/dist/editor/structure/rename.js.map +1 -1
  240. package/dist/editor/structure/reorder.d.ts.map +1 -1
  241. package/dist/editor/structure/reorder.js +20 -9
  242. package/dist/editor/structure/reorder.js.map +1 -1
  243. package/dist/editor/structure/state.js +1 -1
  244. package/dist/editor/structure.d.ts +1 -0
  245. package/dist/editor/structure.d.ts.map +1 -1
  246. package/dist/editor/structure.js +76 -20
  247. package/dist/editor/structure.js.map +1 -1
  248. package/dist/editor/text/hyperlink.d.ts.map +1 -1
  249. package/dist/editor/text/hyperlink.js +1 -1
  250. package/dist/editor/text/hyperlink.js.map +1 -1
  251. package/dist/editor/text/name.d.ts +13 -5
  252. package/dist/editor/text/name.d.ts.map +1 -1
  253. package/dist/editor/text/name.js +47 -17
  254. package/dist/editor/text/name.js.map +1 -1
  255. package/dist/editor/text/pending-layout.d.ts +2 -1
  256. package/dist/editor/text/pending-layout.d.ts.map +1 -1
  257. package/dist/editor/text/pending-layout.js +33 -6
  258. package/dist/editor/text/pending-layout.js.map +1 -1
  259. package/dist/editor/text/selection-style.d.ts +1 -0
  260. package/dist/editor/text/selection-style.d.ts.map +1 -1
  261. package/dist/editor/text/selection-style.js +16 -4
  262. package/dist/editor/text/selection-style.js.map +1 -1
  263. package/dist/editor/text.d.ts +5 -0
  264. package/dist/editor/text.d.ts.map +1 -1
  265. package/dist/editor/text.js +70 -3
  266. package/dist/editor/text.js.map +1 -1
  267. package/dist/editor/types.d.ts +18 -1
  268. package/dist/editor/types.d.ts.map +1 -1
  269. package/dist/editor/undo.d.ts.map +1 -1
  270. package/dist/editor/undo.js +14 -2
  271. package/dist/editor/undo.js.map +1 -1
  272. package/dist/editor/variable-bindings.d.ts.map +1 -1
  273. package/dist/editor/variable-bindings.js +21 -2
  274. package/dist/editor/variable-bindings.js.map +1 -1
  275. package/dist/editor/variables.d.ts +1 -1
  276. package/dist/editor/variables.d.ts.map +1 -1
  277. package/dist/editor/variables.js +7 -8
  278. package/dist/editor/variables.js.map +1 -1
  279. package/dist/editor/viewport.d.ts +11 -2
  280. package/dist/editor/viewport.d.ts.map +1 -1
  281. package/dist/editor/viewport.js +61 -21
  282. package/dist/editor/viewport.js.map +1 -1
  283. package/dist/editor/views/actions.d.ts.map +1 -1
  284. package/dist/editor/views/actions.js +13 -5
  285. package/dist/editor/views/actions.js.map +1 -1
  286. package/dist/editor/views/present.d.ts +6 -4
  287. package/dist/editor/views/present.d.ts.map +1 -1
  288. package/dist/editor/views/present.js +12 -10
  289. package/dist/editor/views/present.js.map +1 -1
  290. package/dist/editor/views/types.d.ts +11 -5
  291. package/dist/editor/views/types.d.ts.map +1 -1
  292. package/dist/figma-api/accessor-utils.d.ts.map +1 -1
  293. package/dist/figma-api/accessor-utils.js +4 -1
  294. package/dist/figma-api/accessor-utils.js.map +1 -1
  295. package/dist/figma-api/accessors/basic.d.ts.map +1 -1
  296. package/dist/figma-api/accessors/basic.js +41 -21
  297. package/dist/figma-api/accessors/basic.js.map +1 -1
  298. package/dist/figma-api/accessors/layout.d.ts.map +1 -1
  299. package/dist/figma-api/accessors/layout.js +37 -7
  300. package/dist/figma-api/accessors/layout.js.map +1 -1
  301. package/dist/figma-api/accessors/reactions.d.ts +11 -0
  302. package/dist/figma-api/accessors/reactions.d.ts.map +1 -0
  303. package/dist/figma-api/accessors/reactions.js +30 -0
  304. package/dist/figma-api/accessors/reactions.js.map +1 -0
  305. package/dist/figma-api/accessors/strokes.d.ts.map +1 -1
  306. package/dist/figma-api/accessors/strokes.js +12 -4
  307. package/dist/figma-api/accessors/strokes.js.map +1 -1
  308. package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
  309. package/dist/figma-api/accessors/text/index.js +3 -1
  310. package/dist/figma-api/accessors/text/index.js.map +1 -1
  311. package/dist/figma-api/accessors/vector.d.ts.map +1 -1
  312. package/dist/figma-api/accessors/vector.js +1 -1
  313. package/dist/figma-api/accessors/vector.js.map +1 -1
  314. package/dist/figma-api/accessors/visual.d.ts +6 -5
  315. package/dist/figma-api/accessors/visual.d.ts.map +1 -1
  316. package/dist/figma-api/accessors/visual.js +20 -17
  317. package/dist/figma-api/accessors/visual.js.map +1 -1
  318. package/dist/figma-api/components.d.ts.map +1 -1
  319. package/dist/figma-api/components.js +2 -1
  320. package/dist/figma-api/components.js.map +1 -1
  321. package/dist/figma-api/finite.d.ts +27 -0
  322. package/dist/figma-api/finite.d.ts.map +1 -0
  323. package/dist/figma-api/finite.js +69 -0
  324. package/dist/figma-api/finite.js.map +1 -0
  325. package/dist/figma-api/fonts/list.d.ts +13 -0
  326. package/dist/figma-api/fonts/list.d.ts.map +1 -0
  327. package/dist/figma-api/fonts/list.js +25 -0
  328. package/dist/figma-api/fonts/list.js.map +1 -0
  329. package/dist/figma-api/index.d.ts +21 -3
  330. package/dist/figma-api/index.d.ts.map +1 -1
  331. package/dist/figma-api/index.js +58 -13
  332. package/dist/figma-api/index.js.map +1 -1
  333. package/dist/figma-api/overrides.d.ts +6 -1
  334. package/dist/figma-api/overrides.d.ts.map +1 -1
  335. package/dist/figma-api/overrides.js +2 -2
  336. package/dist/figma-api/overrides.js.map +1 -1
  337. package/dist/figma-api/pending-layout.d.ts +12 -2
  338. package/dist/figma-api/pending-layout.d.ts.map +1 -1
  339. package/dist/figma-api/pending-layout.js +41 -1
  340. package/dist/figma-api/pending-layout.js.map +1 -1
  341. package/dist/figma-api/pending-sync.d.ts +19 -0
  342. package/dist/figma-api/pending-sync.d.ts.map +1 -0
  343. package/dist/figma-api/pending-sync.js +52 -0
  344. package/dist/figma-api/pending-sync.js.map +1 -0
  345. package/dist/figma-api/proxy.d.ts +15 -2
  346. package/dist/figma-api/proxy.d.ts.map +1 -1
  347. package/dist/figma-api/proxy.js +23 -3
  348. package/dist/figma-api/proxy.js.map +1 -1
  349. package/dist/figma-api/reactions.d.ts +104 -0
  350. package/dist/figma-api/reactions.d.ts.map +1 -0
  351. package/dist/figma-api/reactions.js +157 -0
  352. package/dist/figma-api/reactions.js.map +1 -0
  353. package/dist/figma-api/render-bounds.d.ts.map +1 -1
  354. package/dist/figma-api/render-bounds.js +4 -4
  355. package/dist/figma-api/render-bounds.js.map +1 -1
  356. package/dist/figma-api/serialization.js +2 -2
  357. package/dist/figma-api/serialization.js.map +1 -1
  358. package/dist/figma-api/slots.d.ts +7 -1
  359. package/dist/figma-api/slots.d.ts.map +1 -1
  360. package/dist/figma-api/slots.js +12 -4
  361. package/dist/figma-api/slots.js.map +1 -1
  362. package/dist/figma-api/strokes.d.ts +5 -2
  363. package/dist/figma-api/strokes.d.ts.map +1 -1
  364. package/dist/figma-api/strokes.js +12 -19
  365. package/dist/figma-api/strokes.js.map +1 -1
  366. package/dist/figma-api/text/bindings.js +1 -1
  367. package/dist/figma-api/text/index.d.ts +2 -3
  368. package/dist/figma-api/text/index.d.ts.map +1 -1
  369. package/dist/figma-api/text/index.js +2 -12
  370. package/dist/figma-api/text/index.js.map +1 -1
  371. package/dist/figma-api/variables/bindings.js +1 -1
  372. package/dist/figma-api/variables/variable.d.ts.map +1 -1
  373. package/dist/figma-api/variables/variable.js +2 -2
  374. package/dist/figma-api/variables/variable.js.map +1 -1
  375. package/dist/geometry/figma.d.ts +6 -1
  376. package/dist/geometry/figma.d.ts.map +1 -1
  377. package/dist/geometry/figma.js +8 -1
  378. package/dist/geometry/figma.js.map +1 -1
  379. package/dist/geometry/index.d.ts +2 -2
  380. package/dist/geometry/index.js +2 -2
  381. package/dist/icons/api.d.ts +3 -2
  382. package/dist/icons/api.d.ts.map +1 -1
  383. package/dist/icons/api.js +12 -12
  384. package/dist/icons/api.js.map +1 -1
  385. package/dist/icons/provider.d.ts +4 -3
  386. package/dist/icons/provider.d.ts.map +1 -1
  387. package/dist/icons/provider.js +6 -13
  388. package/dist/icons/provider.js.map +1 -1
  389. package/dist/icons/schema.d.ts +33 -1
  390. package/dist/icons/schema.d.ts.map +1 -1
  391. package/dist/icons/schema.js +30 -1
  392. package/dist/icons/schema.js.map +1 -1
  393. package/dist/icons/svg/presentation.d.ts +8 -1
  394. package/dist/icons/svg/presentation.d.ts.map +1 -1
  395. package/dist/icons/svg/presentation.js +21 -3
  396. package/dist/icons/svg/presentation.js.map +1 -1
  397. package/dist/icons/svg/text.js +1 -1
  398. package/dist/icons/svg/text.js.map +1 -1
  399. package/dist/icons/svg.d.ts +8 -3
  400. package/dist/icons/svg.d.ts.map +1 -1
  401. package/dist/icons/svg.js +15 -13
  402. package/dist/icons/svg.js.map +1 -1
  403. package/dist/icons/types.d.ts +1 -19
  404. package/dist/icons/types.d.ts.map +1 -1
  405. package/dist/index.d.ts +2 -2
  406. package/dist/index.js +1 -1
  407. package/dist/io/formats/design-tokens/apply.d.ts +1 -1
  408. package/dist/io/formats/design-tokens/css/read.js +1 -1
  409. package/dist/io/formats/design-tokens/decode.js +1 -1
  410. package/dist/io/formats/design-tokens/plan/index.js +4 -2
  411. package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
  412. package/dist/io/formats/design-tokens/plan/styles.d.ts +9 -1
  413. package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
  414. package/dist/io/formats/design-tokens/plan/styles.js +23 -3
  415. package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
  416. package/dist/io/formats/design-tokens/styles.d.ts +9 -1
  417. package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
  418. package/dist/io/formats/design-tokens/styles.js +41 -4
  419. package/dist/io/formats/design-tokens/styles.js.map +1 -1
  420. package/dist/io/formats/design-tokens/types.d.ts +5 -0
  421. package/dist/io/formats/design-tokens/types.d.ts.map +1 -1
  422. package/dist/io/formats/design-tokens/types.js +1 -0
  423. package/dist/io/formats/design-tokens/types.js.map +1 -1
  424. package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
  425. package/dist/io/formats/fig/export/setup.js +8 -4
  426. package/dist/io/formats/fig/export/setup.js.map +1 -1
  427. package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
  428. package/dist/io/formats/fig/export/variables.js +2 -2
  429. package/dist/io/formats/fig/export/variables.js.map +1 -1
  430. package/dist/io/formats/fig/index.d.ts +2 -2
  431. package/dist/io/formats/fig/index.js +2 -2
  432. package/dist/io/formats/fig/read.d.ts +9 -2
  433. package/dist/io/formats/fig/read.d.ts.map +1 -1
  434. package/dist/io/formats/fig/read.js +44 -20
  435. package/dist/io/formats/fig/read.js.map +1 -1
  436. package/dist/io/formats/html/index.d.ts.map +1 -1
  437. package/dist/io/formats/html/index.js +2 -6
  438. package/dist/io/formats/html/index.js.map +1 -1
  439. package/dist/io/formats/pdf/dom.d.ts.map +1 -1
  440. package/dist/io/formats/pdf/dom.js +65 -1
  441. package/dist/io/formats/pdf/dom.js.map +1 -1
  442. package/dist/io/formats/pdf/prepare.js +1 -1
  443. package/dist/io/formats/pen/fonts.d.ts +14 -0
  444. package/dist/io/formats/pen/fonts.d.ts.map +1 -0
  445. package/dist/io/formats/pen/fonts.js +39 -0
  446. package/dist/io/formats/pen/fonts.js.map +1 -0
  447. package/dist/io/formats/pen/index.d.ts.map +1 -1
  448. package/dist/io/formats/pen/index.js +25 -6
  449. package/dist/io/formats/pen/index.js.map +1 -1
  450. package/dist/io/formats/raster/headless.d.ts +2 -2
  451. package/dist/io/formats/raster/headless.d.ts.map +1 -1
  452. package/dist/io/formats/raster/headless.js +24 -13
  453. package/dist/io/formats/raster/headless.js.map +1 -1
  454. package/dist/io/formats/raster/index.d.ts +2 -2
  455. package/dist/io/formats/raster/index.js +2 -2
  456. package/dist/io/formats/raster/render.d.ts +7 -1
  457. package/dist/io/formats/raster/render.d.ts.map +1 -1
  458. package/dist/io/formats/raster/render.js +40 -6
  459. package/dist/io/formats/raster/render.js.map +1 -1
  460. package/dist/io/formats/svg/export.d.ts.map +1 -1
  461. package/dist/io/formats/svg/export.js +28 -24
  462. package/dist/io/formats/svg/export.js.map +1 -1
  463. package/dist/io/formats/svg/paths.d.ts +8 -2
  464. package/dist/io/formats/svg/paths.d.ts.map +1 -1
  465. package/dist/io/formats/svg/paths.js +11 -3
  466. package/dist/io/formats/svg/paths.js.map +1 -1
  467. package/dist/io/formats/svg/strokes.d.ts.map +1 -1
  468. package/dist/io/formats/svg/strokes.js +2 -5
  469. package/dist/io/formats/svg/strokes.js.map +1 -1
  470. package/dist/io/formats/svg/text/export.d.ts.map +1 -1
  471. package/dist/io/formats/svg/text/export.js +19 -1
  472. package/dist/io/formats/svg/text/export.js.map +1 -1
  473. package/dist/io/formats/svg/text/import.d.ts.map +1 -1
  474. package/dist/io/formats/svg/text/import.js +2 -1
  475. package/dist/io/formats/svg/text/import.js.map +1 -1
  476. package/dist/io/subgraph.d.ts.map +1 -1
  477. package/dist/io/subgraph.js +5 -2
  478. package/dist/io/subgraph.js.map +1 -1
  479. package/dist/kiwi/fig/population/client.d.ts.map +1 -1
  480. package/dist/kiwi/fig/population/client.js +63 -45
  481. package/dist/kiwi/fig/population/client.js.map +1 -1
  482. package/dist/kiwi/fig/population/delta.d.ts +34 -3
  483. package/dist/kiwi/fig/population/delta.d.ts.map +1 -1
  484. package/dist/kiwi/fig/population/delta.js +99 -16
  485. package/dist/kiwi/fig/population/delta.js.map +1 -1
  486. package/dist/kiwi/fig/population/edits.d.ts +51 -0
  487. package/dist/kiwi/fig/population/edits.d.ts.map +1 -0
  488. package/dist/kiwi/fig/population/edits.js +169 -0
  489. package/dist/kiwi/fig/population/edits.js.map +1 -0
  490. package/dist/kiwi/fig/session/archive/access.d.ts +3 -0
  491. package/dist/kiwi/fig/session/archive/access.d.ts.map +1 -1
  492. package/dist/kiwi/fig/session/archive/access.js +8 -1
  493. package/dist/kiwi/fig/session/archive/access.js.map +1 -1
  494. package/dist/kiwi/fig/session/archive/changes.d.ts +2 -1
  495. package/dist/kiwi/fig/session/archive/changes.d.ts.map +1 -1
  496. package/dist/kiwi/fig/session/archive/changes.js +12 -5
  497. package/dist/kiwi/fig/session/archive/changes.js.map +1 -1
  498. package/dist/kiwi/fig/session/document-state.d.ts +7 -1
  499. package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
  500. package/dist/kiwi/fig/session/document-state.js +16 -2
  501. package/dist/kiwi/fig/session/document-state.js.map +1 -1
  502. package/dist/kiwi/fig/session/protocol.d.ts +31 -3
  503. package/dist/kiwi/fig/session/protocol.d.ts.map +1 -1
  504. package/dist/kiwi/fig/session/worker.js +33 -8
  505. package/dist/kiwi/fig/session/worker.js.map +1 -1
  506. package/dist/layout/apply.d.ts +6 -1
  507. package/dist/layout/apply.d.ts.map +1 -1
  508. package/dist/layout/apply.js +39 -14
  509. package/dist/layout/apply.js.map +1 -1
  510. package/dist/layout/arrange/boxes.d.ts.map +1 -1
  511. package/dist/layout/arrange/boxes.js +31 -0
  512. package/dist/layout/arrange/boxes.js.map +1 -1
  513. package/dist/layout/flow-edges.d.ts +26 -0
  514. package/dist/layout/flow-edges.d.ts.map +1 -0
  515. package/dist/layout/flow-edges.js +105 -0
  516. package/dist/layout/flow-edges.js.map +1 -0
  517. package/dist/layout/grid.d.ts.map +1 -1
  518. package/dist/layout/grid.js +9 -5
  519. package/dist/layout/grid.js.map +1 -1
  520. package/dist/layout/text-auto-resize.d.ts.map +1 -1
  521. package/dist/layout/text-auto-resize.js +9 -4
  522. package/dist/layout/text-auto-resize.js.map +1 -1
  523. package/dist/layout/text-measurement.d.ts +15 -1
  524. package/dist/layout/text-measurement.d.ts.map +1 -1
  525. package/dist/layout/text-measurement.js +40 -4
  526. package/dist/layout/text-measurement.js.map +1 -1
  527. package/dist/layout/variables.d.ts +1 -1
  528. package/dist/layout.d.ts.map +1 -1
  529. package/dist/layout.js +35 -35
  530. package/dist/layout.js.map +1 -1
  531. package/dist/library/asset-keys.d.ts +3 -2
  532. package/dist/library/asset-keys.d.ts.map +1 -1
  533. package/dist/library/asset-keys.js +4 -3
  534. package/dist/library/asset-keys.js.map +1 -1
  535. package/dist/library/copied-references.d.ts +8 -3
  536. package/dist/library/copied-references.d.ts.map +1 -1
  537. package/dist/library/copied-references.js +15 -5
  538. package/dist/library/copied-references.js.map +1 -1
  539. package/dist/library/materialize.js +1 -1
  540. package/dist/library/materialize.js.map +1 -1
  541. package/dist/library/schema.js.map +1 -1
  542. package/dist/library/snapshot.d.ts.map +1 -1
  543. package/dist/library/snapshot.js +10 -2
  544. package/dist/library/snapshot.js.map +1 -1
  545. package/dist/pairdraw-api/variables.d.ts.map +1 -1
  546. package/dist/pairdraw-api/variables.js +0 -2
  547. package/dist/pairdraw-api/variables.js.map +1 -1
  548. package/dist/profiler/hud-controller.d.ts +4 -3
  549. package/dist/profiler/hud-controller.d.ts.map +1 -1
  550. package/dist/profiler/hud-controller.js +7 -5
  551. package/dist/profiler/hud-controller.js.map +1 -1
  552. package/dist/profiler/hud-renderer.d.ts +5 -2
  553. package/dist/profiler/hud-renderer.d.ts.map +1 -1
  554. package/dist/profiler/hud-renderer.js +8 -5
  555. package/dist/profiler/hud-renderer.js.map +1 -1
  556. package/dist/profiler/render-profiler.d.ts +3 -2
  557. package/dist/profiler/render-profiler.d.ts.map +1 -1
  558. package/dist/profiler/render-profiler.js +3 -2
  559. package/dist/profiler/render-profiler.js.map +1 -1
  560. package/dist/text/character-style.d.ts +11 -1
  561. package/dist/text/character-style.d.ts.map +1 -1
  562. package/dist/text/character-style.js +27 -5
  563. package/dist/text/character-style.js.map +1 -1
  564. package/dist/text/coverage.d.ts.map +1 -1
  565. package/dist/text/coverage.js +15 -16
  566. package/dist/text/coverage.js.map +1 -1
  567. package/dist/text/editor.d.ts.map +1 -1
  568. package/dist/text/editor.js +3 -8
  569. package/dist/text/editor.js.map +1 -1
  570. package/dist/text/fallbacks.d.ts +19 -2
  571. package/dist/text/fallbacks.d.ts.map +1 -1
  572. package/dist/text/fallbacks.js +63 -12
  573. package/dist/text/fallbacks.js.map +1 -1
  574. package/dist/text/font/catalog.d.ts +4 -0
  575. package/dist/text/font/catalog.d.ts.map +1 -1
  576. package/dist/text/font/catalog.js +8 -0
  577. package/dist/text/font/catalog.js.map +1 -1
  578. package/dist/text/font/collection.d.ts +13 -0
  579. package/dist/text/font/collection.d.ts.map +1 -0
  580. package/dist/text/font/collection.js +51 -0
  581. package/dist/text/font/collection.js.map +1 -0
  582. package/dist/text/font/faces.d.ts +2 -1
  583. package/dist/text/font/faces.d.ts.map +1 -1
  584. package/dist/text/font/faces.js +9 -5
  585. package/dist/text/font/faces.js.map +1 -1
  586. package/dist/text/font/glyphs.d.ts +14 -3
  587. package/dist/text/font/glyphs.d.ts.map +1 -1
  588. package/dist/text/font/glyphs.js +22 -5
  589. package/dist/text/font/glyphs.js.map +1 -1
  590. package/dist/text/font/local.js +2 -2
  591. package/dist/text/font/local.js.map +1 -1
  592. package/dist/text/font/manager.d.ts +36 -0
  593. package/dist/text/font/manager.d.ts.map +1 -1
  594. package/dist/text/font/manager.js +139 -19
  595. package/dist/text/font/manager.js.map +1 -1
  596. package/dist/text/font/style.d.ts +7 -2
  597. package/dist/text/font/style.d.ts.map +1 -1
  598. package/dist/text/font/style.js +31 -3
  599. package/dist/text/font/style.js.map +1 -1
  600. package/dist/text/index.d.ts +5 -4
  601. package/dist/text/index.js +5 -4
  602. package/dist/text/outlines.d.ts.map +1 -1
  603. package/dist/text/outlines.js +70 -70
  604. package/dist/text/outlines.js.map +1 -1
  605. package/dist/text/prepare.d.ts.map +1 -1
  606. package/dist/text/prepare.js +7 -1
  607. package/dist/text/prepare.js.map +1 -1
  608. package/dist/text/style-runs.d.ts +14 -2
  609. package/dist/text/style-runs.d.ts.map +1 -1
  610. package/dist/text/style-runs.js +22 -14
  611. package/dist/text/style-runs.js.map +1 -1
  612. package/dist/tools/analyze/overlaps/helpers.d.ts.map +1 -1
  613. package/dist/tools/analyze/overlaps/helpers.js +9 -1
  614. package/dist/tools/analyze/overlaps/helpers.js.map +1 -1
  615. package/dist/tools/analyze/overlaps/index.d.ts.map +1 -1
  616. package/dist/tools/analyze/overlaps/index.js +27 -5
  617. package/dist/tools/analyze/overlaps/index.js.map +1 -1
  618. package/dist/tools/codegen/component-map.js +3 -3
  619. package/dist/tools/codegen/component-map.js.map +1 -1
  620. package/dist/tools/create/basic.d.ts.map +1 -1
  621. package/dist/tools/create/basic.js +5 -4
  622. package/dist/tools/create/basic.js.map +1 -1
  623. package/dist/tools/create/html.d.ts.map +1 -1
  624. package/dist/tools/create/html.js +4 -2
  625. package/dist/tools/create/html.js.map +1 -1
  626. package/dist/tools/create/icons.d.ts.map +1 -1
  627. package/dist/tools/create/icons.js +3 -1
  628. package/dist/tools/create/icons.js.map +1 -1
  629. package/dist/tools/create/mermaid.d.ts.map +1 -1
  630. package/dist/tools/create/mermaid.js +2 -0
  631. package/dist/tools/create/mermaid.js.map +1 -1
  632. package/dist/tools/create/render.d.ts.map +1 -1
  633. package/dist/tools/create/render.js +2 -0
  634. package/dist/tools/create/render.js.map +1 -1
  635. package/dist/tools/create/script.js +3 -1
  636. package/dist/tools/create/script.js.map +1 -1
  637. package/dist/tools/create/svg.d.ts.map +1 -1
  638. package/dist/tools/create/svg.js +4 -1
  639. package/dist/tools/create/svg.js.map +1 -1
  640. package/dist/tools/create/vector.d.ts.map +1 -1
  641. package/dist/tools/create/vector.js +4 -4
  642. package/dist/tools/create/vector.js.map +1 -1
  643. package/dist/tools/image-ai/apply.js +1 -1
  644. package/dist/tools/image-ai/generate.d.ts.map +1 -1
  645. package/dist/tools/image-ai/generate.js +3 -0
  646. package/dist/tools/image-ai/generate.js.map +1 -1
  647. package/dist/tools/modify/matching.js +1 -1
  648. package/dist/tools/modify/reactions.d.ts +6 -0
  649. package/dist/tools/modify/reactions.d.ts.map +1 -0
  650. package/dist/tools/modify/reactions.js +35 -0
  651. package/dist/tools/modify/reactions.js.map +1 -0
  652. package/dist/tools/modify.d.ts +2 -1
  653. package/dist/tools/modify.js +2 -1
  654. package/dist/tools/read/components.js +20 -22
  655. package/dist/tools/read/components.js.map +1 -1
  656. package/dist/tools/read/fonts.js +1 -1
  657. package/dist/tools/read/fonts.js.map +1 -1
  658. package/dist/tools/read/libraries.d.ts.map +1 -1
  659. package/dist/tools/read/libraries.js +2 -0
  660. package/dist/tools/read/libraries.js.map +1 -1
  661. package/dist/tools/read/nodes.d.ts.map +1 -1
  662. package/dist/tools/read/nodes.js +38 -16
  663. package/dist/tools/read/nodes.js.map +1 -1
  664. package/dist/tools/read/pages.d.ts.map +1 -1
  665. package/dist/tools/read/pages.js +4 -3
  666. package/dist/tools/read/pages.js.map +1 -1
  667. package/dist/tools/read/query.js +1 -0
  668. package/dist/tools/read/query.js.map +1 -1
  669. package/dist/tools/read/reactions.d.ts +6 -0
  670. package/dist/tools/read/reactions.d.ts.map +1 -0
  671. package/dist/tools/read/reactions.js +24 -0
  672. package/dist/tools/read/reactions.js.map +1 -0
  673. package/dist/tools/read/space.js +1 -1
  674. package/dist/tools/read.d.ts +2 -1
  675. package/dist/tools/read.js +2 -1
  676. package/dist/tools/registry/extended.d.ts.map +1 -1
  677. package/dist/tools/registry/extended.js +4 -0
  678. package/dist/tools/registry/extended.js.map +1 -1
  679. package/dist/tools/schema.d.ts +6 -0
  680. package/dist/tools/schema.d.ts.map +1 -1
  681. package/dist/tools/schema.js +53 -9
  682. package/dist/tools/schema.js.map +1 -1
  683. package/dist/tools/stock-photo/apply.js +8 -9
  684. package/dist/tools/stock-photo/apply.js.map +1 -1
  685. package/dist/tools/structure/batch.d.ts.map +1 -1
  686. package/dist/tools/structure/batch.js +85 -90
  687. package/dist/tools/structure/batch.js.map +1 -1
  688. package/dist/vector/fill-geometry.d.ts +4 -1
  689. package/dist/vector/fill-geometry.d.ts.map +1 -1
  690. package/dist/vector/fill-geometry.js +8 -5
  691. package/dist/vector/fill-geometry.js.map +1 -1
  692. package/dist/vector/index.js +1 -1
  693. package/dist/vector/index.js.map +1 -1
  694. package/dist/vector/path-helpers.d.ts +1 -1
  695. package/dist/vector/path-helpers.d.ts.map +1 -1
  696. package/dist/vector/path-helpers.js +24 -7
  697. package/dist/vector/path-helpers.js.map +1 -1
  698. package/dist/vector/placement.js +1 -1
  699. package/dist/vector/placement.js.map +1 -1
  700. package/dist/vector/vectorize/preprocess.js +1 -1
  701. package/dist/vector/vectorize/preprocess.js.map +1 -1
  702. package/package.json +10 -10
  703. package/src/canvas/effects.ts +29 -33
  704. package/src/canvas/labels/hit-test.ts +6 -2
  705. package/src/canvas/labels/paragraph-cache.ts +2 -1
  706. package/src/canvas/labels/selection.ts +3 -3
  707. package/src/canvas/node-edit-overlay.ts +3 -2
  708. package/src/canvas/overlays/index.ts +0 -1
  709. package/src/canvas/overlays/selection.ts +4 -52
  710. package/src/canvas/region-hatch.ts +7 -2
  711. package/src/canvas/renderer/colors.ts +41 -26
  712. package/src/canvas/renderer/font-waiters.ts +25 -0
  713. package/src/canvas/renderer/fonts.ts +40 -17
  714. package/src/canvas/renderer/lifecycle.ts +8 -10
  715. package/src/canvas/renderer/methods.ts +9 -13
  716. package/src/canvas/renderer/paints.ts +0 -10
  717. package/src/canvas/renderer/pipeline.ts +29 -3
  718. package/src/canvas/renderer/retained-backing.ts +4 -4
  719. package/src/canvas/renderer/state.ts +1 -1
  720. package/src/canvas/renderer/tiles/controller.ts +8 -0
  721. package/src/canvas/renderer/tiles/surface-pool.ts +1 -1
  722. package/src/canvas/renderer/visual-bounds.ts +7 -6
  723. package/src/canvas/renderer.ts +39 -11
  724. package/src/canvas/rulers.ts +55 -26
  725. package/src/canvas/scene.ts +37 -16
  726. package/src/canvas/shadows/shape.ts +1 -1
  727. package/src/canvas/shadows/silhouette.ts +4 -2
  728. package/src/canvas/shadows.ts +4 -2
  729. package/src/canvas/text/derived.ts +0 -9
  730. package/src/canvas/text/emoji/raster.ts +14 -10
  731. package/src/canvas/text/font-families.ts +6 -0
  732. package/src/canvas/text/index.ts +0 -8
  733. package/src/canvas/text/layout/build.ts +35 -18
  734. package/src/canvas/text/layout/index.ts +15 -6
  735. package/src/canvas/text/layout/lines.ts +10 -4
  736. package/src/canvas/text/paragraph/index.ts +17 -8
  737. package/src/canvas/text/paragraph/inputs.ts +4 -2
  738. package/src/canvas/text/shape.ts +20 -31
  739. package/src/constants.ts +6 -1
  740. package/src/editor/bridges/clipboard.ts +1 -0
  741. package/src/editor/bridges/components.ts +2 -0
  742. package/src/editor/bridges/frames.ts +6 -4
  743. package/src/editor/bridges/structure.ts +1 -0
  744. package/src/editor/clipboard/detach.ts +3 -3
  745. package/src/editor/clipboard/paste/target.ts +2 -2
  746. package/src/editor/clipboard/snapshot.ts +7 -0
  747. package/src/editor/clipboard/variables.ts +20 -0
  748. package/src/editor/clipboard.ts +133 -14
  749. package/src/editor/component-sync.ts +28 -7
  750. package/src/editor/components/authoring/text-edit.ts +15 -2
  751. package/src/editor/components/authoring/visibility-edit.ts +11 -3
  752. package/src/editor/components/instances.ts +61 -11
  753. package/src/editor/components/properties.ts +10 -0
  754. package/src/editor/components/slots/authoring.ts +4 -1
  755. package/src/editor/create.ts +58 -8
  756. package/src/editor/guides.ts +27 -12
  757. package/src/editor/history/document-change.ts +115 -7
  758. package/src/editor/history/edit.ts +62 -14
  759. package/src/editor/history/position.ts +1 -4
  760. package/src/editor/history/sources.ts +25 -0
  761. package/src/editor/index.ts +3 -1
  762. package/src/editor/layout-mode.ts +20 -1
  763. package/src/editor/node-preview.ts +44 -8
  764. package/src/editor/nodes.ts +52 -12
  765. package/src/editor/nudge.ts +16 -2
  766. package/src/editor/pages.ts +100 -17
  767. package/src/editor/play/states.ts +0 -7
  768. package/src/editor/read-only/actions.ts +4 -0
  769. package/src/editor/selection/hit-test.ts +37 -4
  770. package/src/editor/shapes/pen.ts +6 -3
  771. package/src/editor/shapes.ts +2 -1
  772. package/src/editor/structure/auto-layout-wrap.ts +26 -0
  773. package/src/editor/structure/group/bounds.ts +22 -4
  774. package/src/editor/structure/rename.ts +2 -6
  775. package/src/editor/structure/reorder.ts +26 -8
  776. package/src/editor/structure.ts +88 -24
  777. package/src/editor/text/hyperlink.ts +2 -1
  778. package/src/editor/text/name.ts +51 -15
  779. package/src/editor/text/pending-layout.ts +42 -4
  780. package/src/editor/text/selection-style.ts +17 -3
  781. package/src/editor/text.ts +86 -4
  782. package/src/editor/types.ts +19 -0
  783. package/src/editor/undo.ts +21 -2
  784. package/src/editor/variable-bindings.ts +22 -2
  785. package/src/editor/variables.ts +10 -6
  786. package/src/editor/viewport.ts +55 -21
  787. package/src/editor/views/actions.ts +17 -7
  788. package/src/editor/views/present.ts +20 -11
  789. package/src/editor/views/types.ts +11 -5
  790. package/src/figma-api/accessor-utils.ts +4 -1
  791. package/src/figma-api/accessors/basic.ts +54 -18
  792. package/src/figma-api/accessors/layout.ts +46 -7
  793. package/src/figma-api/accessors/reactions.ts +29 -0
  794. package/src/figma-api/accessors/strokes.ts +28 -8
  795. package/src/figma-api/accessors/text/index.ts +4 -0
  796. package/src/figma-api/accessors/vector.ts +3 -1
  797. package/src/figma-api/accessors/visual.ts +25 -28
  798. package/src/figma-api/components.ts +9 -7
  799. package/src/figma-api/finite.ts +102 -0
  800. package/src/figma-api/fonts/list.ts +24 -0
  801. package/src/figma-api/index.ts +82 -12
  802. package/src/figma-api/overrides.ts +1 -1
  803. package/src/figma-api/pending-layout.ts +50 -1
  804. package/src/figma-api/pending-sync.ts +61 -0
  805. package/src/figma-api/proxy.ts +35 -2
  806. package/src/figma-api/reactions.ts +212 -0
  807. package/src/figma-api/render-bounds.ts +13 -4
  808. package/src/figma-api/serialization.ts +2 -2
  809. package/src/figma-api/slots.ts +12 -3
  810. package/src/figma-api/strokes.ts +16 -12
  811. package/src/figma-api/text/index.ts +9 -15
  812. package/src/figma-api/variables/variable.ts +3 -2
  813. package/src/geometry/figma.ts +9 -0
  814. package/src/geometry/index.ts +1 -0
  815. package/src/global.d.ts +6 -0
  816. package/src/icons/api.ts +27 -16
  817. package/src/icons/provider.ts +9 -20
  818. package/src/icons/schema.ts +31 -0
  819. package/src/icons/svg/presentation.ts +27 -3
  820. package/src/icons/svg/text.ts +1 -1
  821. package/src/icons/svg.ts +21 -19
  822. package/src/icons/types.ts +0 -14
  823. package/src/io/formats/design-tokens/plan/index.ts +7 -1
  824. package/src/io/formats/design-tokens/plan/styles.ts +40 -4
  825. package/src/io/formats/design-tokens/styles.ts +60 -3
  826. package/src/io/formats/design-tokens/types.ts +3 -0
  827. package/src/io/formats/fig/export/setup.ts +16 -14
  828. package/src/io/formats/fig/export/variables.ts +7 -8
  829. package/src/io/formats/fig/index.ts +1 -0
  830. package/src/io/formats/fig/read.ts +66 -23
  831. package/src/io/formats/html/index.ts +2 -6
  832. package/src/io/formats/pdf/dom.ts +96 -3
  833. package/src/io/formats/pen/fonts.ts +45 -0
  834. package/src/io/formats/pen/index.ts +30 -6
  835. package/src/io/formats/raster/headless.ts +31 -12
  836. package/src/io/formats/raster/index.ts +3 -0
  837. package/src/io/formats/raster/render.ts +62 -6
  838. package/src/io/formats/svg/export.ts +24 -25
  839. package/src/io/formats/svg/paths.ts +11 -2
  840. package/src/io/formats/svg/strokes.ts +8 -2
  841. package/src/io/formats/svg/text/export.ts +23 -0
  842. package/src/io/formats/svg/text/import.ts +2 -1
  843. package/src/io/subgraph.ts +3 -1
  844. package/src/kiwi/fig/population/client.ts +77 -43
  845. package/src/kiwi/fig/population/delta.ts +141 -18
  846. package/src/kiwi/fig/population/edits.ts +235 -0
  847. package/src/kiwi/fig/session/archive/access.ts +15 -0
  848. package/src/kiwi/fig/session/archive/changes.ts +27 -6
  849. package/src/kiwi/fig/session/document-state.ts +23 -1
  850. package/src/kiwi/fig/session/protocol.ts +26 -1
  851. package/src/kiwi/fig/session/worker.ts +38 -11
  852. package/src/layout/apply.ts +52 -10
  853. package/src/layout/arrange/boxes.ts +36 -0
  854. package/src/layout/flow-edges.ts +139 -0
  855. package/src/layout/grid.ts +14 -4
  856. package/src/layout/text-auto-resize.ts +13 -4
  857. package/src/layout/text-measurement.ts +46 -3
  858. package/src/layout.ts +60 -66
  859. package/src/library/asset-keys.ts +4 -3
  860. package/src/library/copied-references.ts +29 -5
  861. package/src/library/materialize.ts +1 -1
  862. package/src/library/schema.ts +1 -1
  863. package/src/library/snapshot.ts +11 -2
  864. package/src/pairdraw-api/variables.ts +1 -3
  865. package/src/profiler/hud-controller.ts +8 -6
  866. package/src/profiler/hud-renderer.ts +9 -6
  867. package/src/profiler/render-profiler.ts +4 -3
  868. package/src/text/character-style.ts +29 -9
  869. package/src/text/coverage.ts +17 -18
  870. package/src/text/editor.ts +3 -8
  871. package/src/text/fallbacks.ts +82 -15
  872. package/src/text/font/catalog.ts +10 -0
  873. package/src/text/font/collection.ts +60 -0
  874. package/src/text/font/faces.ts +9 -5
  875. package/src/text/font/glyphs.ts +29 -4
  876. package/src/text/font/local.ts +2 -2
  877. package/src/text/font/manager.ts +170 -32
  878. package/src/text/font/style.ts +52 -3
  879. package/src/text/index.ts +1 -0
  880. package/src/text/outlines.ts +105 -89
  881. package/src/text/prepare.ts +17 -0
  882. package/src/text/style-runs.ts +43 -16
  883. package/src/tools/analyze/overlaps/helpers.ts +18 -1
  884. package/src/tools/analyze/overlaps/index.ts +37 -6
  885. package/src/tools/codegen/component-map.ts +3 -3
  886. package/src/tools/create/basic.ts +6 -4
  887. package/src/tools/create/html.ts +3 -1
  888. package/src/tools/create/icons.ts +3 -1
  889. package/src/tools/create/mermaid.ts +2 -0
  890. package/src/tools/create/render.ts +2 -0
  891. package/src/tools/create/script.ts +5 -1
  892. package/src/tools/create/svg.ts +4 -1
  893. package/src/tools/create/vector.ts +4 -4
  894. package/src/tools/image-ai/generate.ts +3 -0
  895. package/src/tools/modify/reactions.ts +40 -0
  896. package/src/tools/modify.ts +1 -0
  897. package/src/tools/read/components.ts +28 -25
  898. package/src/tools/read/fonts.ts +1 -1
  899. package/src/tools/read/libraries.ts +3 -0
  900. package/src/tools/read/nodes.ts +47 -17
  901. package/src/tools/read/pages.ts +7 -4
  902. package/src/tools/read/query.ts +2 -0
  903. package/src/tools/read/reactions.ts +21 -0
  904. package/src/tools/read.ts +1 -0
  905. package/src/tools/registry/extended.ts +4 -0
  906. package/src/tools/schema.ts +68 -12
  907. package/src/tools/stock-photo/apply.ts +17 -5
  908. package/src/tools/structure/batch.ts +82 -101
  909. package/src/vector/fill-geometry.ts +11 -5
  910. package/src/vector/index.ts +1 -1
  911. package/src/vector/path-helpers.ts +34 -8
  912. package/src/vector/placement.ts +1 -1
  913. package/src/vector/vectorize/preprocess.ts +1 -1
@@ -1,8 +1,12 @@
1
1
  import { isEqual, pick, uniq } from 'es-toolkit'
2
2
 
3
- import type { SceneNode } from '@pairdraw/scene-graph'
3
+ import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
4
+ import { fitEnclosingGroups, redoGroupFit, undoGroupFit } from '@pairdraw/scene-graph/group-bounds'
5
+
6
+ import { groupFitOptions } from '#core/canvas/boolean'
4
7
 
5
8
  import { assertNodeEditable } from './capabilities'
9
+ import { restoreSources, type SourceSnapshots } from './history/sources'
6
10
  import type { EditorContext } from './types'
7
11
 
8
12
  export interface NodePreview {
@@ -12,6 +16,12 @@ export interface NodePreview {
12
16
  cancel: () => void
13
17
  }
14
18
 
19
+ /** Whether an auto layout frame places this layer, so the boxes of the groups above it are theirs. */
20
+ function placedByParent(graph: SceneGraph, id: string): boolean {
21
+ const parent = graph.getNode(graph.getNode(id)?.parentId ?? '')
22
+ return parent !== undefined && parent.layoutMode !== 'NONE'
23
+ }
24
+
15
25
  /** One owned numeric/property edit, including every node changed by its layout. */
16
26
  export function createNodePreviewActions(
17
27
  ctx: EditorContext,
@@ -29,7 +39,7 @@ export function createNodePreviewActions(
29
39
  const originals = new Map<string, Partial<SceneNode>>()
30
40
  const targets = new Set<string>()
31
41
  const layoutOnly = new Set<string>()
32
- const editedBefore = new Map<string, string[]>()
42
+ const sourcesBefore: SourceSnapshots = new Map()
33
43
  let closed = false
34
44
  let endInteraction: (() => void) | undefined
35
45
  const subscriptions: Array<() => void> = []
@@ -52,7 +62,7 @@ export function createNodePreviewActions(
52
62
  // own layout stops keeping geometry a file saved; cancel takes the marks back.
53
63
  function markEdited(node: SceneNode, changes: Partial<SceneNode>) {
54
64
  if (graph.isPreservingSourceMetadata) return
55
- if (!editedBefore.has(node.id)) editedBefore.set(node.id, node.source.editedFields)
65
+ if (!sourcesBefore.has(node.id)) sourcesBefore.set(node.id, structuredClone(node.source))
56
66
  node.source.editedFields = uniq([...node.source.editedFields, ...Object.keys(changes)])
57
67
  }
58
68
 
@@ -110,22 +120,48 @@ export function createNodePreviewActions(
110
120
  if (layoutOnly.has(edit.id)) graph.withLayoutMutations(update)
111
121
  else update()
112
122
  }
123
+ // Undo gives the previewed layers the marks they had before it; redo marks them again
124
+ // as the commit did.
125
+ if (direction === 'before') restoreSources(graph, sourcesBefore)
113
126
  ctx.requestRender()
114
127
  }
115
- ctx.undo.push({ label, forward: () => apply('after'), inverse: () => apply('before') })
116
- // Publish the complete preview delta, including layout children and implicit edits.
128
+ // Publish the complete preview delta, including the layout children and implicit edits,
129
+ // before recording it, so the step owns the marks this commit adds.
117
130
  apply('after')
131
+ // The preview moved the layers without fitting the groups around them, so the box each
132
+ // group takes follows here, inside the step that undo takes back.
133
+ const parents = uniq(
134
+ edits
135
+ .filter((edit) => !placedByParent(graph, edit.id))
136
+ .map((edit) => graph.getNode(edit.id)?.parentId ?? '')
137
+ ).filter((parentId) => parentId !== '')
138
+ const options = groupFitOptions(ctx.getRenderer(), graph)
139
+ const fits = parents
140
+ .map((parentId) => fitEnclosingGroups(graph, [parentId], options))
141
+ .filter((fit) => fit !== null)
142
+ for (const fit of fits) redoGroupFit(graph, fit)
143
+ ctx.undo.push({
144
+ label,
145
+ forward: () => {
146
+ apply('after')
147
+ for (const fit of fits) redoGroupFit(graph, fit)
148
+ },
149
+ inverse: () => {
150
+ for (const fit of fits) undoGroupFit(graph, fit)
151
+ apply('before')
152
+ }
153
+ })
118
154
  },
119
155
  cancel() {
120
156
  if (closed) return
121
157
  close()
122
158
  for (const [id, previous] of originals)
123
159
  graph.updateNodePreview(id, structuredClone(previous))
124
- for (const [id, fields] of editedBefore) {
160
+ // The marks go back without a node update: cancelling publishes no committed node edits.
161
+ for (const [id, source] of sourcesBefore) {
125
162
  const node = graph.getNode(id)
126
- if (node) node.source.editedFields = fields
163
+ if (node) node.source = structuredClone(source)
127
164
  }
128
- // Reconcile retained/tiled resources once; cancellation publishes no committed node edits.
129
165
  if (originals.size) ctx.requestRender()
130
166
  }
131
167
  }
@@ -1,10 +1,17 @@
1
1
  import { pick } from 'es-toolkit/object'
2
2
 
3
3
  import type { SceneNode } from '@pairdraw/scene-graph'
4
- import { findInstanceAncestor, recordInstanceOverride } from '@pairdraw/scene-graph/instances'
4
+ import { fitEnclosingGroups, redoGroupFit, undoGroupFit } from '@pairdraw/scene-graph/group-bounds'
5
+ import {
6
+ findInstanceAncestor,
7
+ instanceOverrideFields,
8
+ recordInstanceOverride
9
+ } from '@pairdraw/scene-graph/instances'
5
10
  import { cloneInstanceOverrideState } from '@pairdraw/scene-graph/instances/overrides'
6
11
  import { styleDetachmentChanges } from '@pairdraw/scene-graph/shared-styles'
12
+ import { strokeLineChanges } from '@pairdraw/scene-graph/strokes'
7
13
 
14
+ import { groupFitOptions } from '#core/canvas/boolean'
8
15
  import { textAutoResizeChanges } from '#core/layout/text-auto-resize'
9
16
  import { reconcileVariableLayouts } from '#core/layout/variables'
10
17
 
@@ -27,6 +34,15 @@ export function opacityFromBuffer(buffer: string): number {
27
34
  return Math.min(100, Math.max(0, percent)) / 100
28
35
  }
29
36
 
37
+ /** Fields whose change makes a frame take a new size of its own. */
38
+ const SIZE_DEPENDENT_FIELDS = ['primaryAxisSizing', 'counterAxisSizing', 'layoutMode'] as const
39
+
40
+ /** Whether an auto layout frame places this layer, so its own x and y do not stay where they are put. */
41
+ function layOutByParent(ctx: EditorContext, id: string): boolean {
42
+ const parent = ctx.graph.getNode(ctx.graph.getNode(id)?.parentId ?? '')
43
+ return parent !== undefined && parent.layoutMode !== 'NONE'
44
+ }
45
+
30
46
  export function createNodeActions(ctx: EditorContext) {
31
47
  // Function declarations below are hoisted, so the preview can wrap updateNode here.
32
48
  const previewActions = createNodePreviewActions(ctx, updateNode)
@@ -34,11 +50,14 @@ export function createNodeActions(ctx: EditorContext) {
34
50
  const nudgeActions = createNudgeActions(ctx)
35
51
  const variableBindingActions = createVariableBindingActions(ctx)
36
52
 
37
- function runChangedLayout(id: string, changes: Partial<SceneNode>) {
53
+ function runChangedLayout(id: string, changes: Partial<SceneNode>, fitGroups = false) {
38
54
  // A layer's modes reach the layers inside it.
39
55
  if (changes.variableModes)
40
56
  loadBoundFonts(ctx, reconcileVariableLayouts(ctx.graph, { subtrees: [id] }))
41
57
  if (changes.visible !== undefined) refitGroupsAroundLayers(ctx, [id])
58
+ // A group's box is its children's, so it follows a child that moves or resizes in any way,
59
+ // the plugin API's included, not only a drag the canvas committed.
60
+ if (fitGroups && !layOutByParent(ctx, id)) refitGroupsAroundLayers(ctx, [id])
42
61
  ctx.runLayoutForNode(id)
43
62
  }
44
63
 
@@ -49,11 +68,15 @@ export function createNodeActions(ctx: EditorContext) {
49
68
  // (path text is textAutoResize NONE so they don't collide today).
50
69
  const nextChanges = styleDetachmentChanges(node, {
51
70
  ...changes,
71
+ ...strokeLineChanges(node, changes),
52
72
  ...textAutoResizeChanges(node, changes),
53
73
  ...pathTextEditChanges(node, changes)
54
74
  })
75
+ const overridden = instanceOverrideFields(node, nextChanges)
55
76
  ctx.graph.updateNode(id, nextChanges)
56
- recordInstanceOverride(ctx.graph, id, Object.keys(nextChanges))
77
+ recordInstanceOverride(ctx.graph, id, overridden)
78
+ // The groups around the layer fit in the step that records the edit, so undo takes the box
79
+ // back with the layer. This call changes no step: a drag writes here between its own steps.
57
80
  runChangedLayout(id, nextChanges)
58
81
  }
59
82
 
@@ -78,6 +101,7 @@ export function createNodeActions(ctx: EditorContext) {
78
101
  // Same ordering rationale as updateNode: reflowed path-text glyphs win.
79
102
  const nextChanges = styleDetachmentChanges(node, {
80
103
  ...changes,
104
+ ...strokeLineChanges(node, changes),
81
105
  ...textAutoResizeChanges(node, changes),
82
106
  ...pathTextEditChanges(node, changes)
83
107
  })
@@ -85,27 +109,43 @@ export function createNodeActions(ctx: EditorContext) {
85
109
  const previousOverrides = owner
86
110
  ? cloneInstanceOverrideState(owner.instanceOverrides)
87
111
  : undefined
88
- const previous = pick(
89
- node,
90
- Object.keys(nextChanges) as (keyof SceneNode)[]
91
- ) as Partial<SceneNode>
112
+ // A frame whose sizing changes takes its own size with it: fixed keeps the size it had, so
113
+ // undoing the sizing has to put that size back too.
114
+ const restoreSize = SIZE_DEPENDENT_FIELDS.some((field) => field in nextChanges)
115
+ const previous = pick(node, [
116
+ ...(Object.keys(nextChanges) as (keyof SceneNode)[]),
117
+ ...(restoreSize ? (['width', 'height'] as const) : [])
118
+ ]) as Partial<SceneNode>
119
+ const overridden = instanceOverrideFields(node, nextChanges)
92
120
  ctx.graph.updateNode(id, nextChanges)
93
- recordInstanceOverride(ctx.graph, id, Object.keys(nextChanges))
94
- runChangedLayout(id, nextChanges)
121
+ recordInstanceOverride(ctx.graph, id, overridden)
122
+ runChangedLayout(id, nextChanges, false)
123
+ // A group's box follows its children, so the fit goes in this step: it moves the layer's own
124
+ // coordinates too, and undo has to put both back. A layer an auto layout frame places is
125
+ // positioned by that layout, so its groups' boxes are theirs to settle.
126
+ const fit = layOutByParent(ctx, id)
127
+ ? null
128
+ : fitEnclosingGroups(
129
+ ctx.graph,
130
+ [node.parentId ?? id],
131
+ groupFitOptions(ctx.getRenderer(), ctx.graph)
132
+ )
95
133
  ctx.undo.push({
96
134
  label,
97
135
  forward: () => {
98
136
  ctx.graph.updateNode(id, nextChanges)
99
- recordInstanceOverride(ctx.graph, id, Object.keys(nextChanges))
100
- runChangedLayout(id, nextChanges)
137
+ recordInstanceOverride(ctx.graph, id, overridden)
138
+ runChangedLayout(id, nextChanges, false)
139
+ if (fit) redoGroupFit(ctx.graph, fit)
101
140
  },
102
141
  inverse: () => {
142
+ if (fit) undoGroupFit(ctx.graph, fit)
103
143
  ctx.graph.updateNode(id, previous)
104
144
  if (owner && previousOverrides)
105
145
  ctx.graph.updateNode(owner.id, {
106
146
  instanceOverrides: cloneInstanceOverrideState(previousOverrides)
107
147
  })
108
- runChangedLayout(id, nextChanges)
148
+ runChangedLayout(id, nextChanges, false)
109
149
  }
110
150
  })
111
151
  ctx.requestRender()
@@ -52,6 +52,8 @@ export function createNudgeActions(ctx: EditorContext) {
52
52
  let nudgeOriginals: Map<string, Vector> | null = null
53
53
  let reorderOriginals: Map<string, string[]> | null = null
54
54
  let nudgeCommitTimer: ReturnType<typeof setTimeout> | null = null
55
+ /** Open from the first key press until the nudge records its step, which waits for a pause. */
56
+ let closeNudgeEdit: (() => void) | null = null
55
57
 
56
58
  function applyOrder(parentId: string, order: readonly string[]) {
57
59
  order.forEach((id, index) => ctx.graph.insertChildAt(id, parentId, index))
@@ -79,7 +81,16 @@ export function createNudgeActions(ctx: EditorContext) {
79
81
 
80
82
  function commitNudge() {
81
83
  nudgeCommitTimer = null
82
- commitReorder()
84
+ try {
85
+ commitReorder()
86
+ commitMove()
87
+ } finally {
88
+ closeNudgeEdit?.()
89
+ closeNudgeEdit = null
90
+ }
91
+ }
92
+
93
+ function commitMove() {
83
94
  if (!nudgeOriginals) return
84
95
  const originals = nudgeOriginals
85
96
  nudgeOriginals = null
@@ -140,6 +151,10 @@ export function createNudgeActions(ctx: EditorContext) {
140
151
  }
141
152
  if (movable.length === 0) return
142
153
 
154
+ // The step waits for the keys to pause: hold the edit open until then, so the unsaved-changes
155
+ // tracker takes the moves for that step's own.
156
+ closeNudgeEdit ??= ctx.undo.openEdit()
157
+
143
158
  const reordered = reorderInFlows(movable, dx, dy)
144
159
  const nudged = movable.filter((id) => !reordered.has(id))
145
160
 
@@ -157,7 +172,6 @@ export function createNudgeActions(ctx: EditorContext) {
157
172
  const node = ctx.graph.getNode(id)
158
173
  if (!node) continue
159
174
  ctx.graph.updateNode(id, { x: node.x + dx, y: node.y + dy })
160
- ctx.runLayoutForNode(id)
161
175
  }
162
176
 
163
177
  if (nudgeCommitTimer) clearTimeout(nudgeCommitTimer)
@@ -4,6 +4,8 @@ import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
4
4
  import { instanceMainComponent } from '@pairdraw/scene-graph/instances'
5
5
  import type { Color } from '@pairdraw/scene-graph/primitives'
6
6
 
7
+ import { restoreDeletedEntries } from '#core/editor/clipboard/history'
8
+ import { snapshotSubtree } from '#core/editor/history/subtree'
7
9
  import {
8
10
  getPageColor,
9
11
  setDefaultPageBackground,
@@ -13,7 +15,11 @@ import {
13
15
  canUseFigPopulationWorker,
14
16
  createFigPopulationWorker
15
17
  } from '#core/kiwi/fig/population/client'
16
- import { isReaderPagePending, recoverReaderPage } from '#core/kiwi/fig/session/document-state'
18
+ import {
19
+ isReaderPagePending,
20
+ pendingReaderPageOfNode,
21
+ recoverReaderPage
22
+ } from '#core/kiwi/fig/session/document-state'
17
23
  import { computeAllLayouts } from '#core/layout'
18
24
  import { fontManager } from '#core/text/font/manager'
19
25
  import { collectGraphFontRequirements } from '#core/text/requirements/collect'
@@ -114,6 +120,8 @@ export function createPageActions(ctx: EditorContext, drawing?: PageDrawing) {
114
120
  signal?: AbortSignal
115
121
  ): Promise<boolean | null> {
116
122
  throwIfAborted(signal)
123
+ // A page the reader has loaded, or one made here, has nothing to load.
124
+ if (!isReaderPagePending(ctx.graph, pageId)) return false
117
125
  const worker = populationWorker()
118
126
  const workerGeneration = populationWorkerGeneration
119
127
  const workerResult = worker ? await worker.populate(pageId, signal) : null
@@ -244,18 +252,23 @@ export function createPageActions(ctx: EditorContext, drawing?: PageDrawing) {
244
252
  if (prepared.generation !== pageSwitchGeneration) return false
245
253
  const page = ctx.graph.getNode(prepared.pageId)
246
254
  if (page?.type !== 'CANVAS') return false
255
+ return showPage(prepared.pageId)
256
+ }
247
257
 
248
- if (ctx.state.currentPageId !== prepared.pageId) {
249
- ctx.emitEditorEvent('page:leaving', ctx.state.currentPageId, prepared.pageId)
258
+ /** Puts a page on screen with nothing selected, saving the viewport of the one it leaves. */
259
+ function showPage(pageId: string): boolean {
260
+ if (ctx.graph.getNode(pageId)?.type !== 'CANVAS') return false
261
+ if (ctx.state.currentPageId !== pageId) {
262
+ ctx.emitEditorEvent('page:leaving', ctx.state.currentPageId, pageId)
250
263
  }
251
264
  pageViewportStore.saveCurrentPageViewport()
252
265
  const previousPageId = ctx.state.currentPageId
253
- ctx.state.currentPageId = prepared.pageId
266
+ ctx.state.currentPageId = pageId
254
267
  ctx.state.enteredContainerId = null
255
268
  ctx.setSelectedIds(new Set())
256
- pageViewportStore.restorePageViewport(prepared.pageId)
257
- if (previousPageId !== prepared.pageId) {
258
- ctx.emitEditorEvent('page:changed', prepared.pageId, previousPageId)
269
+ pageViewportStore.restorePageViewport(pageId)
270
+ if (previousPageId !== pageId) {
271
+ ctx.emitEditorEvent('page:changed', pageId, previousPageId)
259
272
  }
260
273
  ctx.requestRender()
261
274
  return true
@@ -269,6 +282,13 @@ export function createPageActions(ctx: EditorContext, drawing?: PageDrawing) {
269
282
  if (ctx.graph.getNode(pageId)?.type === 'CANVAS') await populatePage(pageId, null)
270
283
  }
271
284
 
285
+ /** The page holding a layer not in the document yet because its page has not loaded. */
286
+ function pageHoldingNode(nodeId: string): Promise<string | null> {
287
+ return ctx.graph.getNode(nodeId)
288
+ ? Promise.resolve(null)
289
+ : pendingReaderPageOfNode(ctx.graph, nodeId)
290
+ }
291
+
272
292
  async function prepareOffscreenPage(graph: SceneGraph, page: SceneNode): Promise<boolean> {
273
293
  const populated = await populatePage(page.id, null)
274
294
  if (populated === null || graph !== ctx.graph) return false
@@ -333,28 +353,72 @@ export function createPageActions(ctx: EditorContext, drawing?: PageDrawing) {
333
353
  pageViewportStore.clearPageViewports()
334
354
  }
335
355
 
356
+ /** Adds a page after the last one and shows it; one undo step, as in Figma. */
336
357
  function addPage(name?: string) {
337
358
  const pages = ctx.graph.getPages()
338
359
  const pageName = name ?? `Page ${pages.length + 1}`
339
360
  const page = ctx.graph.addPage(pageName)
340
361
  setDefaultPageBackground(ctx.graph, page, ctx.state.theme)
362
+ const previousPageId = ctx.state.currentPageId
363
+ const index = ctx.graph.getPages().findIndex((entry) => entry.id === page.id)
364
+ const entry = pageEntry(page.id, index)
341
365
  void switchPage(page.id)
366
+ ctx.undo.push({
367
+ label: 'Add page',
368
+ forward: () => {
369
+ restoreDeletedEntries(ctx, [entry])
370
+ showPage(page.id)
371
+ },
372
+ inverse: () => {
373
+ ctx.graph.deleteNode(page.id)
374
+ pageViewportStore.deletePageViewport(page.id)
375
+ showPage(previousPageId)
376
+ }
377
+ })
342
378
  return page.id
343
379
  }
344
380
 
345
- function deletePage(pageId: string) {
381
+ /** A page, its layers and its place in the list, as undo restores them. */
382
+ function pageEntry(pageId: string, index: number) {
383
+ return {
384
+ id: pageId,
385
+ parentId: ctx.graph.rootId,
386
+ index,
387
+ subtree: snapshotSubtree(ctx.graph, pageId)
388
+ }
389
+ }
390
+
391
+ /**
392
+ * Deletes a page with its layers, showing the page after it. Undo brings the page back whole
393
+ * at its place in the list, and redo deletes it again. A page the reader has not loaded is
394
+ * loaded first, so its layers come back too.
395
+ */
396
+ async function deletePage(pageId: string) {
346
397
  const pages = ctx.graph.getPages()
347
398
  if (pages.length <= 1) return
348
- const idx = pages.findIndex((p) => p.id === pageId)
349
- ctx.graph.deleteNode(pageId)
350
- pageViewportStore.deletePageViewport(pageId)
351
- if (ctx.state.currentPageId === pageId) {
352
- const newIdx = Math.min(idx, pages.length - 2)
353
- const remaining = ctx.graph.getPages()
354
- void switchPage(remaining[newIdx].id)
399
+ const index = pages.findIndex((page) => page.id === pageId)
400
+ if (index === -1) return
401
+ if (isReaderPagePending(ctx.graph, pageId)) await loadPageNodes(pageId)
402
+ if (ctx.graph.getNode(pageId)?.type !== 'CANVAS') return
403
+ const entry = pageEntry(pageId, index)
404
+ const previousPageId = ctx.state.currentPageId
405
+ const remaining = pages.filter((page) => page.id !== pageId)
406
+ const nextPageId = remaining[Math.min(index, remaining.length - 1)].id
407
+ const remove = () => {
408
+ ctx.graph.deleteNode(pageId)
409
+ pageViewportStore.deletePageViewport(pageId)
410
+ if (ctx.state.currentPageId === pageId) showPage(nextPageId)
355
411
  }
412
+ const restore = () => {
413
+ restoreDeletedEntries(ctx, [entry])
414
+ showPage(pageId)
415
+ }
416
+ remove()
417
+ ctx.undo.push({ label: 'Delete page', forward: remove, inverse: restore })
418
+ if (previousPageId !== pageId) showPage(previousPageId)
356
419
  }
357
420
 
421
+ /** Moves a page in the list; one undo step back to its place. */
358
422
  function movePage(pageId: string, index: number) {
359
423
  const pages = ctx.graph.getPages()
360
424
  const currentIndex = pages.findIndex((page) => page.id === pageId)
@@ -363,11 +427,29 @@ export function createPageActions(ctx: EditorContext, drawing?: PageDrawing) {
363
427
  const nextIndex = Math.max(0, Math.min(index, pages.length - 1))
364
428
  if (nextIndex === currentIndex) return
365
429
 
366
- ctx.graph.insertChildAt(pageId, ctx.graph.rootId, nextIndex)
430
+ const move = (to: number) => {
431
+ ctx.graph.insertChildAt(pageId, ctx.graph.rootId, to)
432
+ ctx.requestRender()
433
+ }
434
+ move(nextIndex)
435
+ ctx.undo.push({
436
+ label: 'Move page',
437
+ forward: () => move(nextIndex),
438
+ inverse: () => move(currentIndex)
439
+ })
367
440
  }
368
441
 
442
+ /** Renames a page; one undo step back to its name. */
369
443
  function renamePage(pageId: string, name: string) {
370
- ctx.graph.updateNode(pageId, { name })
444
+ const previous = ctx.graph.getNode(pageId)?.name
445
+ if (previous === undefined || previous === name) return
446
+ const rename = (next: string) => ctx.graph.updateNode(pageId, { name: next })
447
+ rename(name)
448
+ ctx.undo.push({
449
+ label: 'Rename page',
450
+ forward: () => rename(name),
451
+ inverse: () => rename(previous)
452
+ })
371
453
  }
372
454
 
373
455
  function setPageColor(color: Color) {
@@ -387,6 +469,7 @@ export function createPageActions(ctx: EditorContext, drawing?: PageDrawing) {
387
469
 
388
470
  return {
389
471
  loadPageNodes,
472
+ pageHoldingNode,
390
473
  preparePageNodes,
391
474
  pageSwitchCount,
392
475
  preparePage,
@@ -4,7 +4,6 @@ import {
4
4
  applyComponentPropertyValue,
5
5
  componentPropertyDefinitions
6
6
  } from '@pairdraw/scene-graph/components'
7
- import { resolvedPaintBindings } from '@pairdraw/scene-graph/variables'
8
7
 
9
8
  import { extractPageContext, findPageId } from '#core/io/subgraph'
10
9
  import { computeAllLayouts } from '#core/layout'
@@ -114,12 +113,6 @@ export function resolvePlayState(
114
113
  componentSets: true,
115
114
  shareTables: true
116
115
  })
117
- // A bound paint keeps the color it was saved with while the canvas draws the variable live, in
118
- // whatever mode is showing now; the copy takes what the canvas draws, variants included.
119
- for (const node of graph.getAllNodes()) {
120
- const paints = resolvedPaintBindings(graph, node)
121
- if (paints.fills || paints.strokes) graph.updateNode(node.id, paints)
122
- }
123
116
  const ordered = [...states].sort(([a], [b]) => a.split('/').length - b.split('/').length)
124
117
  for (const [path, state] of ordered) {
125
118
  const instance = findLayerByPath(graph, rootId, path)
@@ -6,6 +6,7 @@
6
6
  */
7
7
  export const READ_ONLY_ACTIONS: ReadonlySet<string> = new Set([
8
8
  // Reads
9
+ 'isSyncingComponents',
9
10
  'acceptingParent',
10
11
  'acceptsChildren',
11
12
  'canArrangeNodes',
@@ -17,6 +18,8 @@ export const READ_ONLY_ACTIONS: ReadonlySet<string> = new Set([
17
18
  'componentInstanceCount',
18
19
  'figCompression',
19
20
  'findVariantByValues',
21
+ // Applies component edits already made to their instances; it makes none of its own.
22
+ 'flushComponentSync',
20
23
  'getChildren',
21
24
  'getCollection',
22
25
  'getCollectionCount',
@@ -110,6 +113,7 @@ export const READ_ONLY_ACTIONS: ReadonlySet<string> = new Set([
110
113
  'preparePage',
111
114
  'preparePageNodes',
112
115
  'loadPageNodes',
116
+ 'pageHoldingNode',
113
117
  'revealNodes',
114
118
  'setZoomAroundPoint',
115
119
  'switchPage',
@@ -1,5 +1,6 @@
1
1
  import type { SceneNode } from '@pairdraw/scene-graph'
2
2
 
3
+ import type { SkiaRenderer } from '#core/canvas/renderer'
3
4
  import { LAYER_HIT_PAD } from '#core/constants'
4
5
  import type { EditorContext } from '#core/editor/types'
5
6
 
@@ -9,6 +10,11 @@ export function createSelectionHitTestActions(
9
10
  clearSelection: () => void
10
11
  ) {
11
12
  function hitTestAtPoint(cx: number, cy: number, deep = false): SceneNode | null {
13
+ return hitAt(cx, cy, deep, false)
14
+ }
15
+
16
+ /** As `hitTestAtPoint`, with locked layers hit (`locked`), as a right-click hits them. */
17
+ function hitAt(cx: number, cy: number, deep: boolean, locked: boolean): SceneNode | null {
12
18
  const renderer = ctx.getRenderer()
13
19
  if (!renderer) return null
14
20
  const pad = LAYER_HIT_PAD / ctx.state.zoom
@@ -17,16 +23,43 @@ export function createSelectionHitTestActions(
17
23
  const scope = ctx.state.enteredContainerId ?? ctx.state.currentPageId
18
24
  return deep
19
25
  ? ctx.graph.hitTestDeep(cx, cy, scope, pad)
20
- : ctx.graph.hitTestSelectable(cx, cy, scope, ctx.state.selectedIds, pad)
26
+ : ctx.graph.hitTestSelectable(cx, cy, scope, ctx.state.selectedIds, pad, locked)
27
+ }
28
+
29
+ /**
30
+ * A name drawn on a pane's overlay canvas, in draw order: a component's label, then a section
31
+ * title, then a frame title. A right-click hits a locked layer's name as it hits its body.
32
+ */
33
+ function labelAt(renderer: SkiaRenderer, cx: number, cy: number): SceneNode | null {
34
+ const preview = ctx.state.rotationPreview
35
+ const graph = ctx.graph
36
+ const filter = { locked: true }
37
+ if (typeof renderer.hitTestComponentLabel === 'function') {
38
+ const component = renderer.hitTestComponentLabel(graph, cx, cy, preview, filter)
39
+ if (component) return component
40
+ }
41
+ if (typeof renderer.hitTestSectionTitle === 'function') {
42
+ const section = renderer.hitTestSectionTitle(graph, cx, cy, preview, filter)
43
+ if (section) return section
44
+ }
45
+ return typeof renderer.hitTestFrameTitle === 'function'
46
+ ? renderer.hitTestFrameTitle(graph, cx, cy, preview, filter)
47
+ : null
21
48
  }
22
49
 
23
50
  /**
24
51
  * Selects what a right-click is over, as Figma does: the layer a click would select, or else the
25
- * frame or section whose empty area is under the point, which a click leaves for a marquee.
52
+ * frame or section whose empty area is under the point, which a click leaves for a marquee. A
53
+ * name above a frame, section, or component is part of that layer, read from `renderer` (the
54
+ * pane's overlay canvas; the editor's current canvas when omitted).
26
55
  */
27
- function selectAtPoint(cx: number, cy: number) {
56
+ function selectAtPoint(cx: number, cy: number, renderer?: SkiaRenderer | null) {
57
+ const labels = renderer === undefined ? ctx.getRenderer() : renderer
28
58
  const scopeId = ctx.state.enteredContainerId ?? ctx.state.currentPageId
29
- const hit = hitTestAtPoint(cx, cy) ?? ctx.graph.hitTestOpenContainer(cx, cy, scopeId)
59
+ const hit =
60
+ (labels ? labelAt(labels, cx, cy) : null) ??
61
+ hitAt(cx, cy, false, true) ??
62
+ ctx.graph.hitTestOpenContainer(cx, cy, scopeId)
30
63
  if (hit) {
31
64
  if (!ctx.state.selectedIds.has(hit.id)) select([hit.id])
32
65
  } else {
@@ -8,7 +8,7 @@ import type {
8
8
  import type { Vector } from '@pairdraw/scene-graph/primitives'
9
9
  import { cloneVectorNetwork } from '@pairdraw/scene-graph/vector-network'
10
10
 
11
- import { BLACK } from '#core/constants'
11
+ import { BLACK, PEN_CLOSE_MIN_POINTS } from '#core/constants'
12
12
  import { createVectorFromNetwork, type CreateShape } from '#core/editor/shapes/vector'
13
13
  import type { EditorContext, ResumedPath } from '#core/editor/types'
14
14
  import { vectorChangesFromPagePath } from '#core/vector'
@@ -201,13 +201,16 @@ export function createPenActions(
201
201
  return
202
202
  }
203
203
 
204
- if (closed && ps.pendingClose && ps.vertices.length > 2) {
204
+ if (closed && ps.vertices.length >= PEN_CLOSE_MIN_POINTS) {
205
205
  const prevIdx = ps.vertices.length - 1
206
+ // A press on the first point leaves the drag at the point being closed, which the closing
207
+ // segment arrives along; closing without one joins the points straight.
208
+ const drag = ps.pendingClose ? ps.dragTangent : null
206
209
  ps.segments.push({
207
210
  start: prevIdx,
208
211
  end: 0,
209
212
  tangentStart: { x: 0, y: 0 },
210
- tangentEnd: ps.dragTangent ?? { x: 0, y: 0 }
213
+ tangentEnd: drag ? { x: -drag.x, y: -drag.y } : { x: 0, y: 0 }
211
214
  })
212
215
  }
213
216
 
@@ -1,5 +1,6 @@
1
1
  import type { NodeType, SceneNode } from '@pairdraw/scene-graph'
2
2
  import { createShapeWithText } from '@pairdraw/scene-graph/generated'
3
+ import { defaultNodeName } from '@pairdraw/scene-graph/node-defaults'
3
4
 
4
5
  import { prepareSlotEdits } from './components/slots'
5
6
  import { restoreSubtree, snapshotSubtree } from './history/subtree'
@@ -8,7 +9,7 @@ import { newLayerDefaults } from './shapes/defaults'
8
9
  import { createFramePresetActions } from './shapes/frame-presets'
9
10
  import { createPenActions, type UpdateNodeWithUndo } from './shapes/pen'
10
11
  import { createPencilActions } from './shapes/pencil'
11
- import { defaultNodeName, nextNumberedName } from './structure/rename'
12
+ import { nextNumberedName } from './structure/rename'
12
13
  import type { EditorContext } from './types'
13
14
  export type { PenDragOptions } from './shapes/pen'
14
15
 
@@ -1,3 +1,5 @@
1
+ import { median } from 'es-toolkit'
2
+
1
3
  import type { LayoutMode, SceneNode } from '@pairdraw/scene-graph'
2
4
  import { getAxisAlignedBoundsInParent } from '@pairdraw/scene-graph/coordinate'
3
5
  import type { Rect } from '@pairdraw/scene-graph/primitives'
@@ -17,6 +19,29 @@ function captureGeometry(ctx: EditorContext, nodes: SceneNode[]): Map<string, Re
17
19
  return geometry
18
20
  }
19
21
 
22
+ /** The spacing the layers already have along `direction`, rounded, as Figma infers it. */
23
+ function inferGap(ctx: EditorContext, nodes: SceneNode[], direction: LayoutMode): number {
24
+ const horizontal = direction === 'HORIZONTAL'
25
+ const placed = nodes
26
+ .map((node) => ({
27
+ position: ctx.graph.getAbsolutePosition(node.id),
28
+ size: horizontal ? node.width : node.height
29
+ }))
30
+ .sort((a, b) =>
31
+ horizontal
32
+ ? a.position.x - b.position.x || a.position.y - b.position.y
33
+ : a.position.y - b.position.y || a.position.x - b.position.x
34
+ )
35
+ const gaps = placed
36
+ .slice(1)
37
+ .map((item, index) =>
38
+ horizontal
39
+ ? item.position.x - (placed[index].position.x + placed[index].size)
40
+ : item.position.y - (placed[index].position.y + placed[index].size)
41
+ )
42
+ return gaps.length > 0 ? Math.round(median(gaps)) : 0
43
+ }
44
+
20
45
  /**
21
46
  * Wrap sibling layers in a new auto layout frame; returns the frame, or null if they are not
22
47
  * siblings. The frame takes the slot of the topmost selected layer, as Figma places a new group,
@@ -43,6 +68,7 @@ export function wrapInAutoLayout(ctx: EditorContext, selectedNodes: SceneNode[])
43
68
  layoutMode: direction,
44
69
  primaryAxisSizing: 'HUG',
45
70
  counterAxisSizing: 'HUG',
71
+ itemSpacing: inferGap(ctx, selectedNodes, direction),
46
72
  primaryAxisAlign: 'MIN',
47
73
  counterAxisAlign: 'MIN',
48
74
  fills: []