@pairdraw/core 0.18.0 → 0.19.0-beta.1

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 (912) 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/css/read.js +1 -1
  408. package/dist/io/formats/design-tokens/decode.js +1 -1
  409. package/dist/io/formats/design-tokens/plan/index.js +4 -2
  410. package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
  411. package/dist/io/formats/design-tokens/plan/styles.d.ts +9 -1
  412. package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
  413. package/dist/io/formats/design-tokens/plan/styles.js +23 -3
  414. package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
  415. package/dist/io/formats/design-tokens/styles.d.ts +9 -1
  416. package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
  417. package/dist/io/formats/design-tokens/styles.js +41 -4
  418. package/dist/io/formats/design-tokens/styles.js.map +1 -1
  419. package/dist/io/formats/design-tokens/types.d.ts +5 -0
  420. package/dist/io/formats/design-tokens/types.d.ts.map +1 -1
  421. package/dist/io/formats/design-tokens/types.js +1 -0
  422. package/dist/io/formats/design-tokens/types.js.map +1 -1
  423. package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
  424. package/dist/io/formats/fig/export/setup.js +8 -4
  425. package/dist/io/formats/fig/export/setup.js.map +1 -1
  426. package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
  427. package/dist/io/formats/fig/export/variables.js +2 -2
  428. package/dist/io/formats/fig/export/variables.js.map +1 -1
  429. package/dist/io/formats/fig/index.d.ts +2 -2
  430. package/dist/io/formats/fig/index.js +2 -2
  431. package/dist/io/formats/fig/read.d.ts +9 -2
  432. package/dist/io/formats/fig/read.d.ts.map +1 -1
  433. package/dist/io/formats/fig/read.js +44 -20
  434. package/dist/io/formats/fig/read.js.map +1 -1
  435. package/dist/io/formats/html/index.d.ts.map +1 -1
  436. package/dist/io/formats/html/index.js +2 -6
  437. package/dist/io/formats/html/index.js.map +1 -1
  438. package/dist/io/formats/pdf/dom.d.ts.map +1 -1
  439. package/dist/io/formats/pdf/dom.js +65 -1
  440. package/dist/io/formats/pdf/dom.js.map +1 -1
  441. package/dist/io/formats/pdf/prepare.js +1 -1
  442. package/dist/io/formats/pen/fonts.d.ts +14 -0
  443. package/dist/io/formats/pen/fonts.d.ts.map +1 -0
  444. package/dist/io/formats/pen/fonts.js +39 -0
  445. package/dist/io/formats/pen/fonts.js.map +1 -0
  446. package/dist/io/formats/pen/index.d.ts.map +1 -1
  447. package/dist/io/formats/pen/index.js +25 -6
  448. package/dist/io/formats/pen/index.js.map +1 -1
  449. package/dist/io/formats/raster/headless.d.ts +2 -2
  450. package/dist/io/formats/raster/headless.d.ts.map +1 -1
  451. package/dist/io/formats/raster/headless.js +24 -13
  452. package/dist/io/formats/raster/headless.js.map +1 -1
  453. package/dist/io/formats/raster/index.d.ts +2 -2
  454. package/dist/io/formats/raster/index.js +2 -2
  455. package/dist/io/formats/raster/render.d.ts +7 -1
  456. package/dist/io/formats/raster/render.d.ts.map +1 -1
  457. package/dist/io/formats/raster/render.js +40 -6
  458. package/dist/io/formats/raster/render.js.map +1 -1
  459. package/dist/io/formats/svg/export.d.ts.map +1 -1
  460. package/dist/io/formats/svg/export.js +28 -24
  461. package/dist/io/formats/svg/export.js.map +1 -1
  462. package/dist/io/formats/svg/paths.d.ts +8 -2
  463. package/dist/io/formats/svg/paths.d.ts.map +1 -1
  464. package/dist/io/formats/svg/paths.js +11 -3
  465. package/dist/io/formats/svg/paths.js.map +1 -1
  466. package/dist/io/formats/svg/strokes.d.ts.map +1 -1
  467. package/dist/io/formats/svg/strokes.js +2 -5
  468. package/dist/io/formats/svg/strokes.js.map +1 -1
  469. package/dist/io/formats/svg/text/export.d.ts.map +1 -1
  470. package/dist/io/formats/svg/text/export.js +19 -1
  471. package/dist/io/formats/svg/text/export.js.map +1 -1
  472. package/dist/io/formats/svg/text/import.d.ts.map +1 -1
  473. package/dist/io/formats/svg/text/import.js +2 -1
  474. package/dist/io/formats/svg/text/import.js.map +1 -1
  475. package/dist/io/subgraph.d.ts.map +1 -1
  476. package/dist/io/subgraph.js +5 -2
  477. package/dist/io/subgraph.js.map +1 -1
  478. package/dist/kiwi/fig/population/client.d.ts.map +1 -1
  479. package/dist/kiwi/fig/population/client.js +63 -45
  480. package/dist/kiwi/fig/population/client.js.map +1 -1
  481. package/dist/kiwi/fig/population/delta.d.ts +34 -3
  482. package/dist/kiwi/fig/population/delta.d.ts.map +1 -1
  483. package/dist/kiwi/fig/population/delta.js +99 -16
  484. package/dist/kiwi/fig/population/delta.js.map +1 -1
  485. package/dist/kiwi/fig/population/edits.d.ts +51 -0
  486. package/dist/kiwi/fig/population/edits.d.ts.map +1 -0
  487. package/dist/kiwi/fig/population/edits.js +169 -0
  488. package/dist/kiwi/fig/population/edits.js.map +1 -0
  489. package/dist/kiwi/fig/session/archive/access.d.ts +3 -0
  490. package/dist/kiwi/fig/session/archive/access.d.ts.map +1 -1
  491. package/dist/kiwi/fig/session/archive/access.js +8 -1
  492. package/dist/kiwi/fig/session/archive/access.js.map +1 -1
  493. package/dist/kiwi/fig/session/archive/changes.d.ts +2 -1
  494. package/dist/kiwi/fig/session/archive/changes.d.ts.map +1 -1
  495. package/dist/kiwi/fig/session/archive/changes.js +12 -5
  496. package/dist/kiwi/fig/session/archive/changes.js.map +1 -1
  497. package/dist/kiwi/fig/session/document-state.d.ts +7 -1
  498. package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
  499. package/dist/kiwi/fig/session/document-state.js +16 -2
  500. package/dist/kiwi/fig/session/document-state.js.map +1 -1
  501. package/dist/kiwi/fig/session/protocol.d.ts +31 -3
  502. package/dist/kiwi/fig/session/protocol.d.ts.map +1 -1
  503. package/dist/kiwi/fig/session/worker.js +33 -8
  504. package/dist/kiwi/fig/session/worker.js.map +1 -1
  505. package/dist/layout/apply.d.ts +6 -1
  506. package/dist/layout/apply.d.ts.map +1 -1
  507. package/dist/layout/apply.js +39 -14
  508. package/dist/layout/apply.js.map +1 -1
  509. package/dist/layout/arrange/boxes.d.ts.map +1 -1
  510. package/dist/layout/arrange/boxes.js +31 -0
  511. package/dist/layout/arrange/boxes.js.map +1 -1
  512. package/dist/layout/flow-edges.d.ts +26 -0
  513. package/dist/layout/flow-edges.d.ts.map +1 -0
  514. package/dist/layout/flow-edges.js +105 -0
  515. package/dist/layout/flow-edges.js.map +1 -0
  516. package/dist/layout/grid.d.ts.map +1 -1
  517. package/dist/layout/grid.js +9 -5
  518. package/dist/layout/grid.js.map +1 -1
  519. package/dist/layout/text-auto-resize.d.ts.map +1 -1
  520. package/dist/layout/text-auto-resize.js +9 -4
  521. package/dist/layout/text-auto-resize.js.map +1 -1
  522. package/dist/layout/text-measurement.d.ts +15 -1
  523. package/dist/layout/text-measurement.d.ts.map +1 -1
  524. package/dist/layout/text-measurement.js +40 -4
  525. package/dist/layout/text-measurement.js.map +1 -1
  526. package/dist/layout/variables.d.ts +1 -1
  527. package/dist/layout.d.ts.map +1 -1
  528. package/dist/layout.js +35 -35
  529. package/dist/layout.js.map +1 -1
  530. package/dist/library/asset-keys.d.ts +3 -2
  531. package/dist/library/asset-keys.d.ts.map +1 -1
  532. package/dist/library/asset-keys.js +4 -3
  533. package/dist/library/asset-keys.js.map +1 -1
  534. package/dist/library/copied-references.d.ts +8 -3
  535. package/dist/library/copied-references.d.ts.map +1 -1
  536. package/dist/library/copied-references.js +15 -5
  537. package/dist/library/copied-references.js.map +1 -1
  538. package/dist/library/materialize.js +1 -1
  539. package/dist/library/materialize.js.map +1 -1
  540. package/dist/library/schema.js.map +1 -1
  541. package/dist/library/snapshot.d.ts.map +1 -1
  542. package/dist/library/snapshot.js +10 -2
  543. package/dist/library/snapshot.js.map +1 -1
  544. package/dist/pairdraw-api/variables.d.ts.map +1 -1
  545. package/dist/pairdraw-api/variables.js +0 -2
  546. package/dist/pairdraw-api/variables.js.map +1 -1
  547. package/dist/profiler/hud-controller.d.ts +4 -3
  548. package/dist/profiler/hud-controller.d.ts.map +1 -1
  549. package/dist/profiler/hud-controller.js +7 -5
  550. package/dist/profiler/hud-controller.js.map +1 -1
  551. package/dist/profiler/hud-renderer.d.ts +5 -2
  552. package/dist/profiler/hud-renderer.d.ts.map +1 -1
  553. package/dist/profiler/hud-renderer.js +8 -5
  554. package/dist/profiler/hud-renderer.js.map +1 -1
  555. package/dist/profiler/render-profiler.d.ts +3 -2
  556. package/dist/profiler/render-profiler.d.ts.map +1 -1
  557. package/dist/profiler/render-profiler.js +3 -2
  558. package/dist/profiler/render-profiler.js.map +1 -1
  559. package/dist/text/character-style.d.ts +11 -1
  560. package/dist/text/character-style.d.ts.map +1 -1
  561. package/dist/text/character-style.js +27 -5
  562. package/dist/text/character-style.js.map +1 -1
  563. package/dist/text/coverage.d.ts.map +1 -1
  564. package/dist/text/coverage.js +15 -16
  565. package/dist/text/coverage.js.map +1 -1
  566. package/dist/text/editor.d.ts.map +1 -1
  567. package/dist/text/editor.js +3 -8
  568. package/dist/text/editor.js.map +1 -1
  569. package/dist/text/fallbacks.d.ts +19 -2
  570. package/dist/text/fallbacks.d.ts.map +1 -1
  571. package/dist/text/fallbacks.js +63 -12
  572. package/dist/text/fallbacks.js.map +1 -1
  573. package/dist/text/font/catalog.d.ts +4 -0
  574. package/dist/text/font/catalog.d.ts.map +1 -1
  575. package/dist/text/font/catalog.js +8 -0
  576. package/dist/text/font/catalog.js.map +1 -1
  577. package/dist/text/font/collection.d.ts +13 -0
  578. package/dist/text/font/collection.d.ts.map +1 -0
  579. package/dist/text/font/collection.js +51 -0
  580. package/dist/text/font/collection.js.map +1 -0
  581. package/dist/text/font/faces.d.ts +2 -1
  582. package/dist/text/font/faces.d.ts.map +1 -1
  583. package/dist/text/font/faces.js +9 -5
  584. package/dist/text/font/faces.js.map +1 -1
  585. package/dist/text/font/glyphs.d.ts +14 -3
  586. package/dist/text/font/glyphs.d.ts.map +1 -1
  587. package/dist/text/font/glyphs.js +22 -5
  588. package/dist/text/font/glyphs.js.map +1 -1
  589. package/dist/text/font/local.js +2 -2
  590. package/dist/text/font/local.js.map +1 -1
  591. package/dist/text/font/manager.d.ts +36 -0
  592. package/dist/text/font/manager.d.ts.map +1 -1
  593. package/dist/text/font/manager.js +139 -19
  594. package/dist/text/font/manager.js.map +1 -1
  595. package/dist/text/font/style.d.ts +7 -2
  596. package/dist/text/font/style.d.ts.map +1 -1
  597. package/dist/text/font/style.js +31 -3
  598. package/dist/text/font/style.js.map +1 -1
  599. package/dist/text/index.d.ts +5 -4
  600. package/dist/text/index.js +5 -4
  601. package/dist/text/outlines.d.ts.map +1 -1
  602. package/dist/text/outlines.js +70 -70
  603. package/dist/text/outlines.js.map +1 -1
  604. package/dist/text/prepare.d.ts.map +1 -1
  605. package/dist/text/prepare.js +7 -1
  606. package/dist/text/prepare.js.map +1 -1
  607. package/dist/text/style-runs.d.ts +14 -2
  608. package/dist/text/style-runs.d.ts.map +1 -1
  609. package/dist/text/style-runs.js +22 -14
  610. package/dist/text/style-runs.js.map +1 -1
  611. package/dist/tools/analyze/overlaps/helpers.d.ts.map +1 -1
  612. package/dist/tools/analyze/overlaps/helpers.js +9 -1
  613. package/dist/tools/analyze/overlaps/helpers.js.map +1 -1
  614. package/dist/tools/analyze/overlaps/index.d.ts.map +1 -1
  615. package/dist/tools/analyze/overlaps/index.js +27 -5
  616. package/dist/tools/analyze/overlaps/index.js.map +1 -1
  617. package/dist/tools/codegen/component-map.js +3 -3
  618. package/dist/tools/codegen/component-map.js.map +1 -1
  619. package/dist/tools/create/basic.d.ts.map +1 -1
  620. package/dist/tools/create/basic.js +5 -4
  621. package/dist/tools/create/basic.js.map +1 -1
  622. package/dist/tools/create/html.d.ts.map +1 -1
  623. package/dist/tools/create/html.js +4 -2
  624. package/dist/tools/create/html.js.map +1 -1
  625. package/dist/tools/create/icons.d.ts.map +1 -1
  626. package/dist/tools/create/icons.js +3 -1
  627. package/dist/tools/create/icons.js.map +1 -1
  628. package/dist/tools/create/mermaid.d.ts.map +1 -1
  629. package/dist/tools/create/mermaid.js +2 -0
  630. package/dist/tools/create/mermaid.js.map +1 -1
  631. package/dist/tools/create/render.d.ts.map +1 -1
  632. package/dist/tools/create/render.js +2 -0
  633. package/dist/tools/create/render.js.map +1 -1
  634. package/dist/tools/create/script.js +3 -1
  635. package/dist/tools/create/script.js.map +1 -1
  636. package/dist/tools/create/svg.d.ts.map +1 -1
  637. package/dist/tools/create/svg.js +4 -1
  638. package/dist/tools/create/svg.js.map +1 -1
  639. package/dist/tools/create/vector.d.ts.map +1 -1
  640. package/dist/tools/create/vector.js +4 -4
  641. package/dist/tools/create/vector.js.map +1 -1
  642. package/dist/tools/image-ai/apply.js +1 -1
  643. package/dist/tools/image-ai/generate.d.ts.map +1 -1
  644. package/dist/tools/image-ai/generate.js +3 -0
  645. package/dist/tools/image-ai/generate.js.map +1 -1
  646. package/dist/tools/modify/matching.js +1 -1
  647. package/dist/tools/modify/reactions.d.ts +6 -0
  648. package/dist/tools/modify/reactions.d.ts.map +1 -0
  649. package/dist/tools/modify/reactions.js +35 -0
  650. package/dist/tools/modify/reactions.js.map +1 -0
  651. package/dist/tools/modify.d.ts +2 -1
  652. package/dist/tools/modify.js +2 -1
  653. package/dist/tools/read/components.js +20 -22
  654. package/dist/tools/read/components.js.map +1 -1
  655. package/dist/tools/read/fonts.js +1 -1
  656. package/dist/tools/read/fonts.js.map +1 -1
  657. package/dist/tools/read/libraries.d.ts.map +1 -1
  658. package/dist/tools/read/libraries.js +2 -0
  659. package/dist/tools/read/libraries.js.map +1 -1
  660. package/dist/tools/read/nodes.d.ts.map +1 -1
  661. package/dist/tools/read/nodes.js +38 -16
  662. package/dist/tools/read/nodes.js.map +1 -1
  663. package/dist/tools/read/pages.d.ts.map +1 -1
  664. package/dist/tools/read/pages.js +4 -3
  665. package/dist/tools/read/pages.js.map +1 -1
  666. package/dist/tools/read/query.js +1 -0
  667. package/dist/tools/read/query.js.map +1 -1
  668. package/dist/tools/read/reactions.d.ts +6 -0
  669. package/dist/tools/read/reactions.d.ts.map +1 -0
  670. package/dist/tools/read/reactions.js +24 -0
  671. package/dist/tools/read/reactions.js.map +1 -0
  672. package/dist/tools/read/space.js +1 -1
  673. package/dist/tools/read.d.ts +2 -1
  674. package/dist/tools/read.js +2 -1
  675. package/dist/tools/registry/extended.d.ts.map +1 -1
  676. package/dist/tools/registry/extended.js +4 -0
  677. package/dist/tools/registry/extended.js.map +1 -1
  678. package/dist/tools/schema.d.ts +6 -0
  679. package/dist/tools/schema.d.ts.map +1 -1
  680. package/dist/tools/schema.js +53 -9
  681. package/dist/tools/schema.js.map +1 -1
  682. package/dist/tools/stock-photo/apply.js +8 -9
  683. package/dist/tools/stock-photo/apply.js.map +1 -1
  684. package/dist/tools/structure/batch.d.ts.map +1 -1
  685. package/dist/tools/structure/batch.js +85 -90
  686. package/dist/tools/structure/batch.js.map +1 -1
  687. package/dist/vector/fill-geometry.d.ts +4 -1
  688. package/dist/vector/fill-geometry.d.ts.map +1 -1
  689. package/dist/vector/fill-geometry.js +8 -5
  690. package/dist/vector/fill-geometry.js.map +1 -1
  691. package/dist/vector/index.js +1 -1
  692. package/dist/vector/index.js.map +1 -1
  693. package/dist/vector/path-helpers.d.ts +1 -1
  694. package/dist/vector/path-helpers.d.ts.map +1 -1
  695. package/dist/vector/path-helpers.js +24 -7
  696. package/dist/vector/path-helpers.js.map +1 -1
  697. package/dist/vector/placement.js +1 -1
  698. package/dist/vector/placement.js.map +1 -1
  699. package/dist/vector/vectorize/preprocess.js +1 -1
  700. package/dist/vector/vectorize/preprocess.js.map +1 -1
  701. package/package.json +10 -10
  702. package/src/canvas/effects.ts +29 -33
  703. package/src/canvas/labels/hit-test.ts +6 -2
  704. package/src/canvas/labels/paragraph-cache.ts +2 -1
  705. package/src/canvas/labels/selection.ts +3 -3
  706. package/src/canvas/node-edit-overlay.ts +3 -2
  707. package/src/canvas/overlays/index.ts +0 -1
  708. package/src/canvas/overlays/selection.ts +4 -52
  709. package/src/canvas/region-hatch.ts +7 -2
  710. package/src/canvas/renderer/colors.ts +41 -26
  711. package/src/canvas/renderer/font-waiters.ts +25 -0
  712. package/src/canvas/renderer/fonts.ts +40 -17
  713. package/src/canvas/renderer/lifecycle.ts +8 -10
  714. package/src/canvas/renderer/methods.ts +9 -13
  715. package/src/canvas/renderer/paints.ts +0 -10
  716. package/src/canvas/renderer/pipeline.ts +29 -3
  717. package/src/canvas/renderer/retained-backing.ts +4 -4
  718. package/src/canvas/renderer/state.ts +1 -1
  719. package/src/canvas/renderer/tiles/controller.ts +8 -0
  720. package/src/canvas/renderer/tiles/surface-pool.ts +1 -1
  721. package/src/canvas/renderer/visual-bounds.ts +7 -6
  722. package/src/canvas/renderer.ts +39 -11
  723. package/src/canvas/rulers.ts +55 -26
  724. package/src/canvas/scene.ts +37 -16
  725. package/src/canvas/shadows/shape.ts +1 -1
  726. package/src/canvas/shadows/silhouette.ts +4 -2
  727. package/src/canvas/shadows.ts +4 -2
  728. package/src/canvas/text/derived.ts +0 -9
  729. package/src/canvas/text/emoji/raster.ts +14 -10
  730. package/src/canvas/text/font-families.ts +6 -0
  731. package/src/canvas/text/index.ts +0 -8
  732. package/src/canvas/text/layout/build.ts +35 -18
  733. package/src/canvas/text/layout/index.ts +15 -6
  734. package/src/canvas/text/layout/lines.ts +10 -4
  735. package/src/canvas/text/paragraph/index.ts +17 -8
  736. package/src/canvas/text/paragraph/inputs.ts +4 -2
  737. package/src/canvas/text/shape.ts +20 -31
  738. package/src/constants.ts +6 -1
  739. package/src/editor/bridges/clipboard.ts +1 -0
  740. package/src/editor/bridges/components.ts +2 -0
  741. package/src/editor/bridges/frames.ts +6 -4
  742. package/src/editor/bridges/structure.ts +1 -0
  743. package/src/editor/clipboard/detach.ts +3 -3
  744. package/src/editor/clipboard/paste/target.ts +2 -2
  745. package/src/editor/clipboard/snapshot.ts +7 -0
  746. package/src/editor/clipboard/variables.ts +20 -0
  747. package/src/editor/clipboard.ts +133 -14
  748. package/src/editor/component-sync.ts +28 -7
  749. package/src/editor/components/authoring/text-edit.ts +15 -2
  750. package/src/editor/components/authoring/visibility-edit.ts +11 -3
  751. package/src/editor/components/instances.ts +61 -11
  752. package/src/editor/components/properties.ts +10 -0
  753. package/src/editor/components/slots/authoring.ts +4 -1
  754. package/src/editor/create.ts +58 -8
  755. package/src/editor/guides.ts +27 -12
  756. package/src/editor/history/document-change.ts +115 -7
  757. package/src/editor/history/edit.ts +62 -14
  758. package/src/editor/history/position.ts +1 -4
  759. package/src/editor/history/sources.ts +25 -0
  760. package/src/editor/index.ts +3 -1
  761. package/src/editor/layout-mode.ts +20 -1
  762. package/src/editor/node-preview.ts +44 -8
  763. package/src/editor/nodes.ts +52 -12
  764. package/src/editor/nudge.ts +16 -2
  765. package/src/editor/pages.ts +100 -17
  766. package/src/editor/play/states.ts +0 -7
  767. package/src/editor/read-only/actions.ts +4 -0
  768. package/src/editor/selection/hit-test.ts +37 -4
  769. package/src/editor/shapes/pen.ts +6 -3
  770. package/src/editor/shapes.ts +2 -1
  771. package/src/editor/structure/auto-layout-wrap.ts +26 -0
  772. package/src/editor/structure/group/bounds.ts +22 -4
  773. package/src/editor/structure/rename.ts +2 -6
  774. package/src/editor/structure/reorder.ts +26 -8
  775. package/src/editor/structure.ts +88 -24
  776. package/src/editor/text/hyperlink.ts +2 -1
  777. package/src/editor/text/name.ts +51 -15
  778. package/src/editor/text/pending-layout.ts +42 -4
  779. package/src/editor/text/selection-style.ts +17 -3
  780. package/src/editor/text.ts +86 -4
  781. package/src/editor/types.ts +19 -0
  782. package/src/editor/undo.ts +21 -2
  783. package/src/editor/variable-bindings.ts +22 -2
  784. package/src/editor/variables.ts +10 -6
  785. package/src/editor/viewport.ts +55 -21
  786. package/src/editor/views/actions.ts +17 -7
  787. package/src/editor/views/present.ts +20 -11
  788. package/src/editor/views/types.ts +11 -5
  789. package/src/figma-api/accessor-utils.ts +4 -1
  790. package/src/figma-api/accessors/basic.ts +54 -18
  791. package/src/figma-api/accessors/layout.ts +46 -7
  792. package/src/figma-api/accessors/reactions.ts +29 -0
  793. package/src/figma-api/accessors/strokes.ts +28 -8
  794. package/src/figma-api/accessors/text/index.ts +4 -0
  795. package/src/figma-api/accessors/vector.ts +3 -1
  796. package/src/figma-api/accessors/visual.ts +25 -28
  797. package/src/figma-api/components.ts +9 -7
  798. package/src/figma-api/finite.ts +102 -0
  799. package/src/figma-api/fonts/list.ts +24 -0
  800. package/src/figma-api/index.ts +82 -12
  801. package/src/figma-api/overrides.ts +1 -1
  802. package/src/figma-api/pending-layout.ts +50 -1
  803. package/src/figma-api/pending-sync.ts +61 -0
  804. package/src/figma-api/proxy.ts +35 -2
  805. package/src/figma-api/reactions.ts +212 -0
  806. package/src/figma-api/render-bounds.ts +13 -4
  807. package/src/figma-api/serialization.ts +2 -2
  808. package/src/figma-api/slots.ts +12 -3
  809. package/src/figma-api/strokes.ts +16 -12
  810. package/src/figma-api/text/index.ts +9 -15
  811. package/src/figma-api/variables/variable.ts +3 -2
  812. package/src/geometry/figma.ts +9 -0
  813. package/src/geometry/index.ts +1 -0
  814. package/src/global.d.ts +6 -0
  815. package/src/icons/api.ts +27 -16
  816. package/src/icons/provider.ts +9 -20
  817. package/src/icons/schema.ts +31 -0
  818. package/src/icons/svg/presentation.ts +27 -3
  819. package/src/icons/svg/text.ts +1 -1
  820. package/src/icons/svg.ts +21 -19
  821. package/src/icons/types.ts +0 -14
  822. package/src/io/formats/design-tokens/plan/index.ts +7 -1
  823. package/src/io/formats/design-tokens/plan/styles.ts +40 -4
  824. package/src/io/formats/design-tokens/styles.ts +60 -3
  825. package/src/io/formats/design-tokens/types.ts +3 -0
  826. package/src/io/formats/fig/export/setup.ts +16 -14
  827. package/src/io/formats/fig/export/variables.ts +7 -8
  828. package/src/io/formats/fig/index.ts +1 -0
  829. package/src/io/formats/fig/read.ts +66 -23
  830. package/src/io/formats/html/index.ts +2 -6
  831. package/src/io/formats/pdf/dom.ts +96 -3
  832. package/src/io/formats/pen/fonts.ts +45 -0
  833. package/src/io/formats/pen/index.ts +30 -6
  834. package/src/io/formats/raster/headless.ts +31 -12
  835. package/src/io/formats/raster/index.ts +3 -0
  836. package/src/io/formats/raster/render.ts +62 -6
  837. package/src/io/formats/svg/export.ts +24 -25
  838. package/src/io/formats/svg/paths.ts +11 -2
  839. package/src/io/formats/svg/strokes.ts +8 -2
  840. package/src/io/formats/svg/text/export.ts +23 -0
  841. package/src/io/formats/svg/text/import.ts +2 -1
  842. package/src/io/subgraph.ts +3 -1
  843. package/src/kiwi/fig/population/client.ts +77 -43
  844. package/src/kiwi/fig/population/delta.ts +141 -18
  845. package/src/kiwi/fig/population/edits.ts +235 -0
  846. package/src/kiwi/fig/session/archive/access.ts +15 -0
  847. package/src/kiwi/fig/session/archive/changes.ts +27 -6
  848. package/src/kiwi/fig/session/document-state.ts +23 -1
  849. package/src/kiwi/fig/session/protocol.ts +26 -1
  850. package/src/kiwi/fig/session/worker.ts +38 -11
  851. package/src/layout/apply.ts +52 -10
  852. package/src/layout/arrange/boxes.ts +36 -0
  853. package/src/layout/flow-edges.ts +139 -0
  854. package/src/layout/grid.ts +14 -4
  855. package/src/layout/text-auto-resize.ts +13 -4
  856. package/src/layout/text-measurement.ts +46 -3
  857. package/src/layout.ts +60 -66
  858. package/src/library/asset-keys.ts +4 -3
  859. package/src/library/copied-references.ts +29 -5
  860. package/src/library/materialize.ts +1 -1
  861. package/src/library/schema.ts +1 -1
  862. package/src/library/snapshot.ts +11 -2
  863. package/src/pairdraw-api/variables.ts +1 -3
  864. package/src/profiler/hud-controller.ts +8 -6
  865. package/src/profiler/hud-renderer.ts +9 -6
  866. package/src/profiler/render-profiler.ts +4 -3
  867. package/src/text/character-style.ts +29 -9
  868. package/src/text/coverage.ts +17 -18
  869. package/src/text/editor.ts +3 -8
  870. package/src/text/fallbacks.ts +82 -15
  871. package/src/text/font/catalog.ts +10 -0
  872. package/src/text/font/collection.ts +60 -0
  873. package/src/text/font/faces.ts +9 -5
  874. package/src/text/font/glyphs.ts +29 -4
  875. package/src/text/font/local.ts +2 -2
  876. package/src/text/font/manager.ts +170 -32
  877. package/src/text/font/style.ts +52 -3
  878. package/src/text/index.ts +1 -0
  879. package/src/text/outlines.ts +105 -89
  880. package/src/text/prepare.ts +17 -0
  881. package/src/text/style-runs.ts +43 -16
  882. package/src/tools/analyze/overlaps/helpers.ts +18 -1
  883. package/src/tools/analyze/overlaps/index.ts +37 -6
  884. package/src/tools/codegen/component-map.ts +3 -3
  885. package/src/tools/create/basic.ts +6 -4
  886. package/src/tools/create/html.ts +3 -1
  887. package/src/tools/create/icons.ts +3 -1
  888. package/src/tools/create/mermaid.ts +2 -0
  889. package/src/tools/create/render.ts +2 -0
  890. package/src/tools/create/script.ts +5 -1
  891. package/src/tools/create/svg.ts +4 -1
  892. package/src/tools/create/vector.ts +4 -4
  893. package/src/tools/image-ai/generate.ts +3 -0
  894. package/src/tools/modify/reactions.ts +40 -0
  895. package/src/tools/modify.ts +1 -0
  896. package/src/tools/read/components.ts +28 -25
  897. package/src/tools/read/fonts.ts +1 -1
  898. package/src/tools/read/libraries.ts +3 -0
  899. package/src/tools/read/nodes.ts +47 -17
  900. package/src/tools/read/pages.ts +7 -4
  901. package/src/tools/read/query.ts +2 -0
  902. package/src/tools/read/reactions.ts +21 -0
  903. package/src/tools/read.ts +1 -0
  904. package/src/tools/registry/extended.ts +4 -0
  905. package/src/tools/schema.ts +68 -12
  906. package/src/tools/stock-photo/apply.ts +17 -5
  907. package/src/tools/structure/batch.ts +82 -101
  908. package/src/vector/fill-geometry.ts +11 -5
  909. package/src/vector/index.ts +1 -1
  910. package/src/vector/path-helpers.ts +34 -8
  911. package/src/vector/placement.ts +1 -1
  912. package/src/vector/vectorize/preprocess.ts +1 -1
@@ -6,6 +6,7 @@ import type { RenderColorSpace, ResolvedRenderColor } from '@pairdraw/scene-grap
6
6
  import type { Color, Vector } from '@pairdraw/scene-graph/primitives'
7
7
  import { slotPropertyId } from '@pairdraw/scene-graph/slots'
8
8
 
9
+ import { ResourceCache } from '#core/cache/resource'
9
10
  /* eslint-disable max-lines -- SkiaRenderer facade owns CanvasKit state and delegates domain drawing */
10
11
  import {
11
12
  DEFAULT_SELECTION_THEME,
@@ -16,6 +17,7 @@ import {
16
17
  COMPONENT_SET_DASH,
17
18
  COMPONENT_SET_DASH_GAP,
18
19
  COMPONENT_SET_BORDER_WIDTH,
20
+ EFFECT_FILTER_CACHE_ENTRIES,
19
21
  IS_BROWSER
20
22
  } from '#core/constants'
21
23
  import type { EditorState } from '#core/editor/types'
@@ -106,14 +108,23 @@ export class SkiaRenderer {
106
108
  linearDodgeBlender: Blender | null = null
107
109
  declare strokePaint: Paint
108
110
  declare selectionPaint: Paint
109
- declare parentOutlinePaint: Paint
110
111
  declare snapPaint: Paint
111
112
  declare auxFill: Paint
112
113
  declare auxStroke: Paint
113
114
  declare opacityPaint: Paint
114
115
  declare effectLayerPaint: Paint
115
- imageFilterCache = new Map<string, ImageFilter | null>()
116
- maskFilterCache = new Map<number, MaskFilter | null>()
116
+ /**
117
+ * Effect filters by their parameters. Bounded: a blur or shadow slider emits a new value every
118
+ * step of a drag, and each filter holds a CanvasKit handle.
119
+ */
120
+ imageFilterCache = new ResourceCache<string, ImageFilter>({
121
+ maxEntries: EFFECT_FILTER_CACHE_ENTRIES,
122
+ dispose: (filter) => filter.delete()
123
+ })
124
+ maskFilterCache = new ResourceCache<number, MaskFilter>({
125
+ maxEntries: EFFECT_FILTER_CACHE_ENTRIES,
126
+ dispose: (filter) => filter.delete()
127
+ })
117
128
  _tmpColor = new Float32Array(4)
118
129
  _tmpRect = new Float32Array(4)
119
130
  textFont: Font | null = null
@@ -123,6 +134,8 @@ export class SkiaRenderer {
123
134
  valueFont: Font | null = null
124
135
  sectionTitleFont: Font | null = null
125
136
  componentLabelFont: Font | null = null
137
+ /** The profiler HUD's text, made with the other chrome fonts and freed with them. */
138
+ hudFont: Font | null = null
126
139
  fontMgr: FontMgr | null = null
127
140
  fontProvider: TypefaceFontProvider | null = null
128
141
  fontsLoaded = false
@@ -229,6 +242,11 @@ export class SkiaRenderer {
229
242
  /** Selection chrome, set from editor state each frame through {@link setSelectionTheme}. */
230
243
  selectionTheme: SelectionTheme = DEFAULT_SELECTION_THEME
231
244
  pageId: string | null = null
245
+ /**
246
+ * The one page layer this canvas shows, with its descendants, clipped to its bounds, as a
247
+ * presentation shows only its slide; null draws every layer of the page.
248
+ */
249
+ sceneScopeId: string | null = null
232
250
  /** Status labels drawn in the last label pass; clicks on them open the status menu. */
233
251
  statusLabels: PlacedStatusLabel[] = []
234
252
 
@@ -266,7 +284,6 @@ export class SkiaRenderer {
266
284
  declare drawSelection: RendererDomainMethods['drawSelection']
267
285
  declare drawNodeSelection: RendererDomainMethods['drawNodeSelection']
268
286
  declare drawSelectionLabels: RendererDomainMethods['drawSelectionLabels']
269
- declare drawParentFrameOutlines: RendererDomainMethods['drawParentFrameOutlines']
270
287
  declare drawNodeOutline: RendererDomainMethods['drawNodeOutline']
271
288
  declare drawGroupBounds: RendererDomainMethods['drawGroupBounds']
272
289
  declare getRotatedCorners: RendererDomainMethods['getRotatedCorners']
@@ -429,6 +446,14 @@ export class SkiaRenderer {
429
446
  return this.destroyed
430
447
  }
431
448
 
449
+ /**
450
+ * Resolves once this canvas has its fonts, so text draws, or when the canvas is destroyed
451
+ * before them: an export through it then has to use the headless renderer (`fontsLoaded`).
452
+ */
453
+ whenFontsLoaded(): Promise<void> {
454
+ return RendererFonts.waitForFonts(this)
455
+ }
456
+
432
457
  async loadFonts(onFallbackFontsLoaded?: () => void): Promise<void> {
433
458
  await RendererFonts.loadFonts(this, onFallbackFontsLoaded)
434
459
  }
@@ -453,7 +478,7 @@ export class SkiaRenderer {
453
478
  this.tiledScene.destroy()
454
479
  // Live textures belong to the old surface's context, so they go before it does.
455
480
  releaseLiveImages(this)
456
- this.surface.delete()
481
+ this.surface.dispose()
457
482
  this.surface = surface
458
483
  this.sceneBackingAllocationFailed = false
459
484
  this.invalidateScenePicture()
@@ -548,7 +573,8 @@ export class SkiaRenderer {
548
573
  graph: SceneGraph,
549
574
  canvasX: number,
550
575
  canvasY: number,
551
- preview?: RenderOverlays['rotationPreview']
576
+ preview?: RenderOverlays['rotationPreview'],
577
+ filter: Pick<LabelHitTest.LabelHitOptions, 'locked'> = {}
552
578
  ): SceneNode | null {
553
579
  return LabelHitTest.hitTestSectionTitle(
554
580
  graph,
@@ -558,7 +584,7 @@ export class SkiaRenderer {
558
584
  this.pageId ?? graph.rootId,
559
585
  this.sectionTitleFont,
560
586
  this.labelCache,
561
- labelHitOptions(this, graph, preview)
587
+ { ...labelHitOptions(this, graph, preview), ...filter }
562
588
  )
563
589
  }
564
590
 
@@ -566,7 +592,8 @@ export class SkiaRenderer {
566
592
  graph: SceneGraph,
567
593
  canvasX: number,
568
594
  canvasY: number,
569
- preview?: RenderOverlays['rotationPreview']
595
+ preview?: RenderOverlays['rotationPreview'],
596
+ filter: Pick<LabelHitTest.LabelHitOptions, 'locked'> = {}
570
597
  ): SceneNode | null {
571
598
  return LabelHitTest.hitTestComponentLabel(
572
599
  graph,
@@ -576,7 +603,7 @@ export class SkiaRenderer {
576
603
  this.pageId ?? graph.rootId,
577
604
  this.componentLabelFont,
578
605
  this.labelCache,
579
- labelHitOptions(this, graph, preview)
606
+ { ...labelHitOptions(this, graph, preview), ...filter }
580
607
  )
581
608
  }
582
609
 
@@ -584,7 +611,8 @@ export class SkiaRenderer {
584
611
  graph: SceneGraph,
585
612
  canvasX: number,
586
613
  canvasY: number,
587
- preview?: RenderOverlays['rotationPreview']
614
+ preview?: RenderOverlays['rotationPreview'],
615
+ filter: Pick<LabelHitTest.LabelHitOptions, 'locked'> = {}
588
616
  ): SceneNode | null {
589
617
  return LabelHitTest.hitTestFrameTitle(
590
618
  graph,
@@ -594,7 +622,7 @@ export class SkiaRenderer {
594
622
  this.pageId ?? graph.rootId,
595
623
  this.labelFont,
596
624
  this.labelCache,
597
- labelHitOptions(this, graph, preview)
625
+ { ...labelHitOptions(this, graph, preview), ...filter }
598
626
  )
599
627
  }
600
628
 
@@ -161,40 +161,26 @@ export function drawRulers(
161
161
  canvas.drawRect(r.ck.LTRBRect(Math.max(R, selBounds.sx1), 0, selBounds.sx2, R), r.rulerHlPaint)
162
162
  canvas.drawRect(r.ck.LTRBRect(0, Math.max(R, selBounds.sy1), R, selBounds.sy2), r.rulerHlPaint)
163
163
 
164
- drawRulerBadge(
164
+ drawEdgeBadges(
165
165
  r,
166
166
  canvas,
167
167
  font,
168
- Math.round((selBounds.sx1 - r.panX) / r.zoom).toString(),
169
- Math.max(R, selBounds.sx1),
170
- 0,
168
+ [
169
+ rulerEdgeLabel((selBounds.sx1 - r.panX) / r.zoom),
170
+ rulerEdgeLabel((selBounds.sx2 - r.panX) / r.zoom)
171
+ ],
172
+ [Math.max(R, selBounds.sx1), selBounds.sx2],
171
173
  'horizontal'
172
174
  )
173
- drawRulerBadge(
175
+ drawEdgeBadges(
174
176
  r,
175
177
  canvas,
176
178
  font,
177
- Math.round((selBounds.sx2 - r.panX) / r.zoom).toString(),
178
- selBounds.sx2,
179
- 0,
180
- 'horizontal'
181
- )
182
- drawRulerBadge(
183
- r,
184
- canvas,
185
- font,
186
- Math.round((selBounds.sy1 - r.panY) / r.zoom).toString(),
187
- 0,
188
- Math.max(R, selBounds.sy1),
189
- 'vertical'
190
- )
191
- drawRulerBadge(
192
- r,
193
- canvas,
194
- font,
195
- Math.round((selBounds.sy2 - r.panY) / r.zoom).toString(),
196
- 0,
197
- selBounds.sy2,
179
+ [
180
+ rulerEdgeLabel((selBounds.sy1 - r.panY) / r.zoom),
181
+ rulerEdgeLabel((selBounds.sy2 - r.panY) / r.zoom)
182
+ ],
183
+ [Math.max(R, selBounds.sy1), selBounds.sy2],
198
184
  'vertical'
199
185
  )
200
186
  }
@@ -295,6 +281,44 @@ function drawGuideRulerPositions(
295
281
  }
296
282
  }
297
283
 
284
+ /** The space kept between a selection's two edge badges on one ruler. */
285
+ const EDGE_BADGE_GAP = 2
286
+
287
+ /**
288
+ * Where a selection's two edge badges sit along a ruler, centered on their edges unless they would
289
+ * overlap, as they do on a narrow selection: then they part evenly about the space between them.
290
+ */
291
+ export function separatedBadgeCenters(
292
+ edges: readonly [number, number],
293
+ widths: readonly [number, number]
294
+ ): [number, number] {
295
+ const [near, far] = edges
296
+ const overlap = near + widths[0] / 2 + EDGE_BADGE_GAP - (far - widths[1] / 2)
297
+ if (overlap <= 0) return [near, far]
298
+ return [near - overlap / 2, far + overlap / 2]
299
+ }
300
+
301
+ /** A selection's two edge badges on one ruler, kept apart when the selection is narrow. */
302
+ function drawEdgeBadges(
303
+ r: SkiaRenderer,
304
+ canvas: Canvas,
305
+ font: InstanceType<CanvasKit['Font']>,
306
+ labels: readonly [string, string],
307
+ edges: readonly [number, number],
308
+ axis: 'horizontal' | 'vertical'
309
+ ): void {
310
+ const width = (label: string) => {
311
+ const glyphs = font.getGlyphIDs(label)
312
+ const widths = font.getGlyphWidths(glyphs)
313
+ return widths.reduce((sum, w) => sum + w, 0) + RULER_BADGE_PADDING * 2
314
+ }
315
+ const [near, far] = separatedBadgeCenters(edges, [width(labels[0]), width(labels[1])])
316
+ const at = (center: number): [number, number] =>
317
+ axis === 'horizontal' ? [center, 0] : [0, center]
318
+ drawRulerBadge(r, canvas, font, labels[0], ...at(near), axis)
319
+ drawRulerBadge(r, canvas, font, labels[1], ...at(far), axis)
320
+ }
321
+
298
322
  export function drawRulerBadge(
299
323
  r: SkiaRenderer,
300
324
  canvas: Canvas,
@@ -358,6 +382,11 @@ export function rulerStep(r: SkiaRenderer): number {
358
382
  return 10 * magnitude
359
383
  }
360
384
 
385
+ /** A selection edge on the ruler, to three decimals at any zoom, as Figma labels it (8000.375). */
386
+ export function rulerEdgeLabel(value: number): string {
387
+ return String(Math.round(value * 1000) / 1000 + 0)
388
+ }
389
+
361
390
  export function rulerLabel(value: number): string {
362
391
  return Math.round(value).toString()
363
392
  }
@@ -14,9 +14,11 @@ import {
14
14
  hasTrimmedShaft,
15
15
  trimArrowShafts
16
16
  } from '@pairdraw/scene-graph/arrow-caps'
17
+ import { blurSigma } from '@pairdraw/scene-graph/geometry'
18
+ import { drawnChildIds } from '@pairdraw/scene-graph/layout'
17
19
  import Matrix from '@pairdraw/scene-graph/matrix'
18
20
  import type { Color } from '@pairdraw/scene-graph/primitives'
19
- import { textLinesOverflow } from '@pairdraw/scene-graph/text'
21
+ import { textLinesReach, textVerticalOffset } from '@pairdraw/scene-graph/text'
20
22
 
21
23
  import { createSceneGeometry, nodeOrientationMatrix, projectedNode } from '#core/geometry'
22
24
  import { shownText } from '#core/text/case'
@@ -32,7 +34,7 @@ import { isOpenVectorNetwork } from '#core/vector/connectivity'
32
34
 
33
35
  import { needsIsolatedBlendLayer, setPaintBlendMode } from './blend'
34
36
  import { renderBooleanOperation } from './boolean'
35
- import { blurSigma, hasReducibleEffects } from './effects'
37
+ import { hasReducibleEffects } from './effects'
36
38
  import { drawVectorMultiStyleFills, paintFills } from './fills'
37
39
  import { drawLayoutGrids } from './layout-grids'
38
40
  import { renderMaskedChildIds } from './masks'
@@ -45,7 +47,7 @@ import {
45
47
  import { mapVisualBounds, subtreeVisualBounds } from './renderer/visual-bounds'
46
48
  import { drawShaderEffectChain } from './shaders/effect'
47
49
  import { isolatesInnerShadows, renderLayerShadows } from './shadows'
48
- import { isLayerContainer } from './shadows/silhouette'
50
+ import { isLayerContainer, silhouetteBounds } from './shadows/silhouette'
49
51
  import {
50
52
  configureStrokePaint,
51
53
  drawArrowHeads,
@@ -60,7 +62,7 @@ import {
60
62
  import { drawLineStroke } from './strokes/line'
61
63
  import { drawOutlinedDashes } from './strokes/outlined-dashes'
62
64
  import { drawDashedRectStroke, strokeDashesByOutline, strokeSideWeights } from './strokes/sides'
63
- import { textVerticalOffset, withTextParagraph } from './text'
65
+ import { withTextParagraph } from './text'
64
66
  import { drawTextLayout } from './text/decorations'
65
67
  import {
66
68
  canDrawSavedText,
@@ -108,11 +110,12 @@ function isCulled(
108
110
  node.clipsContent)
109
111
  if (!canCull || hasOverflowPathTextPaint(node)) return false
110
112
  // Text lines past a fixed-size box still draw, as in Figma.
111
- const linesOverflow = textLinesOverflow(node)
113
+ const linesReach = textLinesReach(node)
114
+ const linesOutOfBox = linesReach.minY < 0 || linesReach.maxY > node.height
112
115
 
113
116
  const vp = r.worldViewport
114
117
  if (hasTransformedAncestor) {
115
- if (linesOverflow > 0) return false
118
+ if (linesOutOfBox) return false
116
119
  const bounds = createSceneGeometry(graph, preview).bounds(node)
117
120
  return (
118
121
  bounds.x > vp.x + vp.w ||
@@ -122,7 +125,8 @@ function isCulled(
122
125
  )
123
126
  }
124
127
  const bw = node.width
125
- const bh = node.height + linesOverflow
128
+ const bh =
129
+ node.height + Math.max(0, linesReach.maxY - node.height) + Math.max(0, -linesReach.minY) * 0
126
130
  if (projectedNode(node, preview).rotation !== 0) {
127
131
  const diag = Math.hypot(bw, bh)
128
132
  const { x: cx, y: cy } = createSceneGeometry(graph, preview).toWorld(node, {
@@ -180,12 +184,14 @@ function renderMaskNodeContent(
180
184
  const layered = node.opacity < 1 || blur !== undefined
181
185
  if (layered) {
182
186
  const padding = (blur?.radius ?? 0) * 2
187
+ // A fixed-size text's lines run past its box, and the mask covers them where they draw.
188
+ const reach = textLinesReach(node)
183
189
  r.opacityPaint.setAlphaf(node.opacity)
184
190
  r.opacityPaint.setBlendMode(r.ck.BlendMode.SrcOver)
185
191
  r.opacityPaint.setImageFilter(blur ? r.getCachedBlur(blurSigma(blur.radius)) : null)
186
192
  canvas.saveLayer(
187
193
  r.opacityPaint,
188
- r.ck.LTRBRect(-padding, -padding, node.width + padding, node.height + padding)
194
+ r.ck.LTRBRect(-padding, reach.minY - padding, node.width + padding, reach.maxY + padding)
189
195
  )
190
196
  r.opacityPaint.setImageFilter(null)
191
197
  }
@@ -205,7 +211,7 @@ function opaqueFills(node: SceneNode): SceneNode {
205
211
  }
206
212
  }
207
213
 
208
- function renderChildIds(
214
+ export function renderChildIds(
209
215
  r: SkiaRenderer,
210
216
  canvas: Canvas,
211
217
  graph: SceneGraph,
@@ -231,7 +237,19 @@ function renderChildIds(
231
237
  (childId) => {
232
238
  const child = graph.getNode(childId)
233
239
  if (!child) return null
234
- return { x: child.x, y: child.y, width: child.width, height: child.height }
240
+ // A mask covers what its silhouette does: a text's lines run past a fixed-size box.
241
+ const silhouette = silhouetteBounds(graph, child, false) ?? {
242
+ x: 0,
243
+ y: 0,
244
+ width: child.width,
245
+ height: child.height
246
+ }
247
+ return {
248
+ x: child.x + silhouette.x,
249
+ y: child.y + silhouette.y,
250
+ width: silhouette.width,
251
+ height: silhouette.height
252
+ }
235
253
  }
236
254
  )
237
255
  }
@@ -249,13 +267,14 @@ function renderChildren(
249
267
  if (node.type === 'BOOLEAN_OPERATION') return
250
268
  const isClippableContainer =
251
269
  node.type === 'FRAME' || node.type === 'COMPONENT' || node.type === 'INSTANCE'
252
- if (isClippableContainer && node.clipsContent && node.childIds.length > 0) {
270
+ const childIds = drawnChildIds(node)
271
+ if (isClippableContainer && node.clipsContent && childIds.length > 0) {
253
272
  canvas.save()
254
273
  r.clipNodeShape(canvas, node)
255
- renderChildIds(r, canvas, graph, node.childIds, overlays, absX, absY, hasTransformedAncestor)
274
+ renderChildIds(r, canvas, graph, childIds, overlays, absX, absY, hasTransformedAncestor)
256
275
  canvas.restore()
257
276
  } else {
258
- renderChildIds(r, canvas, graph, node.childIds, overlays, absX, absY, hasTransformedAncestor)
277
+ renderChildIds(r, canvas, graph, childIds, overlays, absX, absY, hasTransformedAncestor)
259
278
  }
260
279
  }
261
280
  export function renderNodeSelf(
@@ -398,14 +417,16 @@ export function renderNode(
398
417
 
399
418
  r.effectLayerPaint.setImageFilter(r.getCachedBlur(blurSigma(layerBlur.radius)))
400
419
  const blurPadding = layerBlur.radius * 2
420
+ // A fixed-size box lets its lines run past it, and the blur covers them where they draw.
421
+ const linesReach = textLinesReach(node)
401
422
  canvas.saveLayer(
402
423
  r.effectLayerPaint,
403
424
  viewportLayerBounds(r, graph, node, blurPadding, overlays.rotationPreview) ??
404
425
  r.ck.LTRBRect(
405
426
  -blurPadding,
406
- -blurPadding,
427
+ linesReach.minY - blurPadding,
407
428
  node.width + blurPadding,
408
- node.height + blurPadding
429
+ linesReach.maxY + blurPadding
409
430
  )
410
431
  )
411
432
  }
@@ -668,7 +689,7 @@ export function renderShape(
668
689
  }
669
690
  return
670
691
  } finally {
671
- surface.delete()
692
+ surface.dispose()
672
693
  }
673
694
  }
674
695
 
@@ -1,9 +1,9 @@
1
1
  import type { Canvas, Path } from 'canvaskit-wasm'
2
2
 
3
3
  import type { BlendMode, ShadowEffect, SceneNode, Stroke } from '@pairdraw/scene-graph'
4
+ import { blurSigma } from '@pairdraw/scene-graph/geometry'
4
5
 
5
6
  import { setPaintBlendMode } from '#core/canvas/blend'
6
- import { blurSigma } from '#core/canvas/effects'
7
7
  import type { SkiaRenderer } from '#core/canvas/renderer'
8
8
  import { drawOutline, makeNodeShapePath, nodeHasRadius, withNodeOutline } from '#core/canvas/shapes'
9
9
  import { sideStrokeRRects, strokeAlignShare } from '#core/canvas/strokes/sides'
@@ -4,6 +4,7 @@ import type { Fill, NodeType, SceneGraph, SceneNode, Stroke } from '@pairdraw/sc
4
4
  import { strokeOverflow as strokeReach } from '@pairdraw/scene-graph/geometry'
5
5
  import Matrix from '@pairdraw/scene-graph/matrix'
6
6
  import type { Rect } from '@pairdraw/scene-graph/primitives'
7
+ import { textLinesReach } from '@pairdraw/scene-graph/text'
7
8
 
8
9
  import { paintBooleanOperation } from '#core/canvas/boolean'
9
10
  import { renderMaskedChildIds } from '#core/canvas/masks'
@@ -274,11 +275,12 @@ export function silhouetteBounds(
274
275
  includeChildren: boolean
275
276
  ): Rect | null {
276
277
  const overflow = strokeOverflow(node)
278
+ const lines = textLinesReach(node)
277
279
  const own: Rect = {
278
280
  x: -overflow,
279
- y: -overflow,
281
+ y: lines.minY - overflow,
280
282
  width: node.width + overflow * 2,
281
- height: node.height + overflow * 2
283
+ height: lines.maxY - lines.minY + overflow * 2
282
284
  }
283
285
  if (!includeChildren || !isLayerContainer(node)) return own
284
286
  return unionRect(own, childrenBounds(graph, node))
@@ -1,13 +1,14 @@
1
1
  import type { Canvas, ImageFilter } from 'canvaskit-wasm'
2
2
 
3
3
  import type { BlendMode, ShadowEffect, SceneGraph, SceneNode } from '@pairdraw/scene-graph'
4
+ import { blurSigma } from '@pairdraw/scene-graph/geometry'
4
5
  import Matrix from '@pairdraw/scene-graph/matrix'
5
6
 
6
7
  import { nodeOrientationMatrix } from '#core/geometry'
7
8
 
8
9
  import { needsIsolatedBlendLayer, setPaintBlendMode } from './blend'
9
10
  import { makeBooleanOperationPath } from './boolean'
10
- import { blurSigma, renderNoiseEffects } from './effects'
11
+ import { renderNoiseEffects } from './effects'
11
12
  import type { SkiaRenderer } from './renderer'
12
13
  import {
13
14
  castsFromOwnShape,
@@ -128,7 +129,8 @@ function drawSilhouetteDropShadow(
128
129
  canvas.restore()
129
130
  paint.delete()
130
131
  if (morphology) {
131
- filter.delete()
132
+ // The filter built with the morphology is ours; a zero sigma hands back none.
133
+ filter?.delete()
132
134
  morphology.delete()
133
135
  }
134
136
  }
@@ -47,12 +47,6 @@ export function snapDerivedGlyphBaseline(y: number): number {
47
47
  return Math.round(y)
48
48
  }
49
49
 
50
- export function shouldUseHardDerivedGlyphCoverage(
51
- node: Pick<SceneNode, 'fontSize' | 'fontWeight'>
52
- ): boolean {
53
- return node.fontSize === 20 && node.fontWeight === 400
54
- }
55
-
56
50
  /**
57
51
  * Path-text glyphs carry non-zero Figma `Glyph.rotation` (radians). Used to
58
52
  * disable axis-aligned assumptions (baseline snap, underline decorations).
@@ -349,15 +343,12 @@ export function drawDerivedText(
349
343
  const path = paintsLayerSpace ? layerSpaceGlyphPath(r, emPath, glyph, glyphY) : emPath
350
344
  canvas.save()
351
345
  if (!paintsLayerSpace) applyGlyphEmTransform(canvas, glyph, glyphY)
352
- const shouldUseHardCoverage = shouldUseHardDerivedGlyphCoverage(node)
353
- if (shouldUseHardCoverage) r.fillPaint.setAntiAlias(false)
354
346
  const character = glyph.firstCharacter ?? markerCharacters.get(index)
355
347
  const run =
356
348
  character === undefined
357
349
  ? undefined
358
350
  : node.styleRuns.find((run) => character >= run.start && character < run.start + run.length)
359
351
  drawGlyphOutline(r, canvas, path, savedTextEligible ? run?.style.fills : undefined)
360
- if (shouldUseHardCoverage) r.fillPaint.setAntiAlias(true)
361
352
  if (path !== emPath) path.delete()
362
353
  canvas.restore()
363
354
  }
@@ -1,6 +1,7 @@
1
1
  import type { CanvasKit, Image, TypefaceFontProvider } from 'canvaskit-wasm'
2
2
 
3
3
  import { NOTO_COLOR_EMOJI_FAMILY } from '#core/text/emoji'
4
+ import { makeParagraphBuilder } from '#core/text/font/collection'
4
5
 
5
6
  /** Emoji are drawn from square images this many pixels wide, as Figma draws its own. */
6
7
  export const EMOJI_IMAGE_SIZE = 160
@@ -48,8 +49,6 @@ export function rasterizeNotoEmoji(
48
49
  provider: TypefaceFontProvider,
49
50
  text: string
50
51
  ): Image | null {
51
- const surface = ck.MakeSurface(EMOJI_IMAGE_SIZE, EMOJI_IMAGE_SIZE)
52
- if (!surface) return null
53
52
  const style = new ck.ParagraphStyle({
54
53
  textStyle: {
55
54
  fontFamilies: [NOTO_COLOR_EMOJI_FAMILY],
@@ -57,7 +56,7 @@ export function rasterizeNotoEmoji(
57
56
  color: ck.BLACK
58
57
  }
59
58
  })
60
- const builder = ck.ParagraphBuilder.MakeFromFontProvider(style, provider)
59
+ const builder = makeParagraphBuilder(ck, style, provider)
61
60
  try {
62
61
  builder.addText(text)
63
62
  const paragraph = builder.build()
@@ -66,17 +65,22 @@ export function rasterizeNotoEmoji(
66
65
  const advance = paragraph.getMaxIntrinsicWidth()
67
66
  if (advance <= 0) return null
68
67
  const scale = EMOJI_IMAGE_SIZE / advance
69
- const canvas = surface.getCanvas()
70
- canvas.clear(ck.TRANSPARENT)
71
- canvas.translate(0, (EMOJI_IMAGE_SIZE - paragraph.getHeight() * scale) / 2)
72
- canvas.scale(scale, scale)
73
- canvas.drawParagraph(paragraph, 0, 0)
74
- return surface.makeImageSnapshot()
68
+ const surface = ck.MakeSurface(EMOJI_IMAGE_SIZE, EMOJI_IMAGE_SIZE)
69
+ if (!surface) return null
70
+ try {
71
+ const canvas = surface.getCanvas()
72
+ canvas.clear(ck.TRANSPARENT)
73
+ canvas.translate(0, (EMOJI_IMAGE_SIZE - paragraph.getHeight() * scale) / 2)
74
+ canvas.scale(scale, scale)
75
+ canvas.drawParagraph(paragraph, 0, 0)
76
+ return surface.makeImageSnapshot()
77
+ } finally {
78
+ surface.dispose()
79
+ }
75
80
  } finally {
76
81
  paragraph.delete()
77
82
  }
78
83
  } finally {
79
84
  builder.delete()
80
- surface.delete()
81
85
  }
82
86
  }
@@ -45,6 +45,11 @@ export function drawnFontVariations(font: DrawnFontAxes): FontVariation[] {
45
45
  ]
46
46
  : font.variations
47
47
  const axes = new Map([...named, ...set].map(({ axis, value }) => [axis, value]))
48
+ // A family with no face loaded is drawn in its fallbacks, and a variable fallback takes the
49
+ // text's weight on its axis unless the text sets one, rather than emboldening its default one.
50
+ if (!axes.has('wght') && !loadedFace(font.family, font.weight, font.italic, font.style)) {
51
+ axes.set('wght', font.weight)
52
+ }
48
53
  return [...axes].map(([axis, value]) => ({ axis, value }))
49
54
  }
50
55
 
@@ -83,6 +88,7 @@ export function loadedFace(
83
88
  italic: boolean,
84
89
  style = faceLoadKey(weight, italic)
85
90
  ): LoadedFace | null {
91
+ if (!fontManager.isLoaded(family)) return null
86
92
  if (fontManager.isStyleLoaded(family, style)) return { weight, italic, style }
87
93
  for (const slant of [italic, !italic]) {
88
94
  for (const candidate of fontWeightMatchOrder(weight)) {
@@ -241,11 +241,3 @@ export function buildTextPicture(r: TextRenderer, node: SceneNode): Uint8Array |
241
241
  picture.delete()
242
242
  return bytes ?? null
243
243
  }
244
-
245
- /** Offset that places laid-out text of `contentHeight` in the node box by vertical alignment. */
246
- export function textVerticalOffset(node: SceneNode, contentHeight: number): number {
247
- const available = Math.max(0, node.height - contentHeight)
248
- if (node.textAlignVertical === 'CENTER') return available / 2
249
- if (node.textAlignVertical === 'BOTTOM') return available
250
- return 0
251
- }