@open-pencil/scene-graph 0.17.0 → 0.18.0-beta.2

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 (986) hide show
  1. package/dist/arrow-caps.d.ts +14 -17
  2. package/dist/arrow-caps.d.ts.map +1 -1
  3. package/dist/arrow-caps.js +1 -2
  4. package/dist/asset-keys.d.ts +5 -8
  5. package/dist/asset-keys.d.ts.map +1 -1
  6. package/dist/asset-keys.js +2 -3
  7. package/dist/behaviours/index.d.ts +6 -4
  8. package/dist/behaviours/index.js +6 -4
  9. package/dist/behaviours/kinds.d.ts +38 -15
  10. package/dist/behaviours/kinds.d.ts.map +1 -1
  11. package/dist/behaviours/kinds.js +134 -12
  12. package/dist/behaviours/kinds.js.map +1 -1
  13. package/dist/behaviours/layers.d.ts +3 -6
  14. package/dist/behaviours/layers.d.ts.map +1 -1
  15. package/dist/behaviours/layers.js +1 -2
  16. package/dist/behaviours/listing.d.ts +58 -0
  17. package/dist/behaviours/listing.d.ts.map +1 -0
  18. package/dist/behaviours/listing.js +98 -0
  19. package/dist/behaviours/listing.js.map +1 -0
  20. package/dist/behaviours/model.d.ts +19 -16
  21. package/dist/behaviours/model.d.ts.map +1 -1
  22. package/dist/behaviours/model.js +14 -6
  23. package/dist/behaviours/model.js.map +1 -1
  24. package/dist/behaviours/schema.d.ts +150 -17
  25. package/dist/behaviours/schema.d.ts.map +1 -1
  26. package/dist/behaviours/schema.js +19 -5
  27. package/dist/behaviours/schema.js.map +1 -1
  28. package/dist/behaviours/spec.d.ts +3 -6
  29. package/dist/behaviours/spec.d.ts.map +1 -1
  30. package/dist/behaviours/spec.js +7 -4
  31. package/dist/behaviours/spec.js.map +1 -1
  32. package/dist/behaviours/transition.d.ts +20 -0
  33. package/dist/behaviours/transition.d.ts.map +1 -0
  34. package/dist/behaviours/transition.js +35 -0
  35. package/dist/behaviours/transition.js.map +1 -0
  36. package/dist/bindings.js +2 -3
  37. package/dist/blur.d.ts +35 -0
  38. package/dist/blur.d.ts.map +1 -0
  39. package/dist/blur.js +69 -0
  40. package/dist/blur.js.map +1 -0
  41. package/dist/buffered-events.d.ts +3 -6
  42. package/dist/buffered-events.d.ts.map +1 -1
  43. package/dist/buffered-events.js +1 -2
  44. package/dist/buffered-events.js.map +1 -1
  45. package/dist/checkpoint.d.ts +3 -6
  46. package/dist/checkpoint.d.ts.map +1 -1
  47. package/dist/checkpoint.js +4 -3
  48. package/dist/checkpoint.js.map +1 -1
  49. package/dist/clipping.d.ts +4 -7
  50. package/dist/clipping.d.ts.map +1 -1
  51. package/dist/clipping.js +4 -16
  52. package/dist/clipping.js.map +1 -1
  53. package/dist/color/contrast.d.ts +4 -7
  54. package/dist/color/contrast.d.ts.map +1 -1
  55. package/dist/color/contrast.js +2 -3
  56. package/dist/color/index.d.ts +21 -20
  57. package/dist/color/index.d.ts.map +1 -1
  58. package/dist/color/index.js +16 -27
  59. package/dist/color/index.js.map +1 -1
  60. package/dist/color/management.d.ts +50 -25
  61. package/dist/color/management.d.ts.map +1 -1
  62. package/dist/color/management.js +155 -151
  63. package/dist/color/management.js.map +1 -1
  64. package/dist/color/normalize.d.ts +1 -4
  65. package/dist/color/normalize.d.ts.map +1 -1
  66. package/dist/color/normalize.js +1 -2
  67. package/dist/color/okhcl.d.ts +36 -21
  68. package/dist/color/okhcl.d.ts.map +1 -1
  69. package/dist/color/okhcl.js +57 -42
  70. package/dist/color/okhcl.js.map +1 -1
  71. package/dist/color/schema.d.ts +6 -4
  72. package/dist/color/schema.d.ts.map +1 -1
  73. package/dist/color/schema.js +12 -4
  74. package/dist/color/schema.js.map +1 -1
  75. package/dist/comments/document.d.ts +3 -6
  76. package/dist/comments/document.d.ts.map +1 -1
  77. package/dist/comments/document.js +1 -2
  78. package/dist/comments/index.js +2 -2
  79. package/dist/comments/list.d.ts +5 -8
  80. package/dist/comments/list.d.ts.map +1 -1
  81. package/dist/comments/list.js +1 -2
  82. package/dist/comments/merge.d.ts +2 -5
  83. package/dist/comments/merge.d.ts.map +1 -1
  84. package/dist/comments/merge.js +1 -2
  85. package/dist/comments/schema.d.ts +2 -5
  86. package/dist/comments/schema.d.ts.map +1 -1
  87. package/dist/comments/schema.js +1 -2
  88. package/dist/comments/threads.d.ts +16 -19
  89. package/dist/comments/threads.d.ts.map +1 -1
  90. package/dist/comments/threads.js +8 -3
  91. package/dist/comments/threads.js.map +1 -1
  92. package/dist/components/exposure.d.ts +4 -7
  93. package/dist/components/exposure.d.ts.map +1 -1
  94. package/dist/components/exposure.js +1 -2
  95. package/dist/components/properties.d.ts +13 -16
  96. package/dist/components/properties.d.ts.map +1 -1
  97. package/dist/components/properties.js +3 -4
  98. package/dist/components/variants.d.ts +5 -8
  99. package/dist/components/variants.d.ts.map +1 -1
  100. package/dist/components/variants.js +1 -2
  101. package/dist/connectors/controls.d.ts +6 -9
  102. package/dist/connectors/controls.d.ts.map +1 -1
  103. package/dist/connectors/controls.js +2 -3
  104. package/dist/connectors/create.d.ts +3 -6
  105. package/dist/connectors/create.d.ts.map +1 -1
  106. package/dist/connectors/create.js +2 -3
  107. package/dist/connectors/elbow.js +0 -1
  108. package/dist/connectors/gaps.d.ts +1 -4
  109. package/dist/connectors/gaps.d.ts.map +1 -1
  110. package/dist/connectors/gaps.js +1 -2
  111. package/dist/connectors/hit.d.ts +1 -4
  112. package/dist/connectors/hit.d.ts.map +1 -1
  113. package/dist/connectors/hit.js +3 -4
  114. package/dist/connectors/index.d.ts +3 -3
  115. package/dist/connectors/index.js +6 -6
  116. package/dist/connectors/label.d.ts +4 -7
  117. package/dist/connectors/label.d.ts.map +1 -1
  118. package/dist/connectors/label.js +1 -2
  119. package/dist/connectors/layout.d.ts +8 -10
  120. package/dist/connectors/layout.d.ts.map +1 -1
  121. package/dist/connectors/layout.js +12 -10
  122. package/dist/connectors/layout.js.map +1 -1
  123. package/dist/connectors/pieces.d.ts +2 -5
  124. package/dist/connectors/pieces.d.ts.map +1 -1
  125. package/dist/connectors/pieces.js +3 -4
  126. package/dist/connectors/pieces.js.map +1 -1
  127. package/dist/connectors/route.d.ts +2 -5
  128. package/dist/connectors/route.d.ts.map +1 -1
  129. package/dist/connectors/route.js +4 -5
  130. package/dist/connectors/sides.d.ts +3 -6
  131. package/dist/connectors/sides.d.ts.map +1 -1
  132. package/dist/connectors/sides.js +2 -3
  133. package/dist/connectors/sublayers.d.ts +21 -24
  134. package/dist/connectors/sublayers.d.ts.map +1 -1
  135. package/dist/connectors/sublayers.js +3 -3
  136. package/dist/connectors/sublayers.js.map +1 -1
  137. package/dist/constants.d.ts +13 -16
  138. package/dist/constants.d.ts.map +1 -1
  139. package/dist/constants.js +1 -2
  140. package/dist/constraints.d.ts +6 -8
  141. package/dist/constraints.d.ts.map +1 -1
  142. package/dist/constraints.js +3 -3
  143. package/dist/constraints.js.map +1 -1
  144. package/dist/coordinate.d.ts +27 -29
  145. package/dist/coordinate.d.ts.map +1 -1
  146. package/dist/coordinate.js +19 -38
  147. package/dist/coordinate.js.map +1 -1
  148. package/dist/copy.d.ts +36 -24
  149. package/dist/copy.d.ts.map +1 -1
  150. package/dist/copy.js +33 -4
  151. package/dist/copy.js.map +1 -1
  152. package/dist/corners.d.ts +9 -9
  153. package/dist/corners.d.ts.map +1 -1
  154. package/dist/corners.js +4 -3
  155. package/dist/corners.js.map +1 -1
  156. package/dist/css/blend.d.ts +1 -4
  157. package/dist/css/blend.d.ts.map +1 -1
  158. package/dist/css/blend.js +1 -2
  159. package/dist/css/grid.d.ts +1 -4
  160. package/dist/css/grid.d.ts.map +1 -1
  161. package/dist/css/grid.js +3 -4
  162. package/dist/css/index.d.ts +2 -1
  163. package/dist/css/index.js +3 -2
  164. package/dist/css/layout.d.ts +7 -10
  165. package/dist/css/layout.d.ts.map +1 -1
  166. package/dist/css/layout.js +2 -3
  167. package/dist/css/motion.d.ts +9 -0
  168. package/dist/css/motion.d.ts.map +1 -0
  169. package/dist/css/motion.js +59 -0
  170. package/dist/css/motion.js.map +1 -0
  171. package/dist/css/shadows.d.ts +4 -6
  172. package/dist/css/shadows.d.ts.map +1 -1
  173. package/dist/css/shadows.js +9 -9
  174. package/dist/css/shadows.js.map +1 -1
  175. package/dist/css/text.d.ts +8 -11
  176. package/dist/css/text.d.ts.map +1 -1
  177. package/dist/css/text.js +1 -2
  178. package/dist/css/transform.d.ts +6 -9
  179. package/dist/css/transform.d.ts.map +1 -1
  180. package/dist/css/transform.js +2 -3
  181. package/dist/css/values.d.ts +11 -13
  182. package/dist/css/values.d.ts.map +1 -1
  183. package/dist/css/values.js +5 -6
  184. package/dist/css/values.js.map +1 -1
  185. package/dist/cubic.d.ts +11 -5
  186. package/dist/cubic.d.ts.map +1 -1
  187. package/dist/cubic.js +71 -3
  188. package/dist/cubic.js.map +1 -1
  189. package/dist/events.js +1 -2
  190. package/dist/export-format.d.ts +5 -8
  191. package/dist/export-format.d.ts.map +1 -1
  192. package/dist/export-format.js +4 -3
  193. package/dist/export-format.js.map +1 -1
  194. package/dist/export-scale.d.ts +4 -7
  195. package/dist/export-scale.d.ts.map +1 -1
  196. package/dist/export-scale.js +1 -2
  197. package/dist/fields/appearance.d.ts +3 -6
  198. package/dist/fields/appearance.d.ts.map +1 -1
  199. package/dist/fields/appearance.js +1 -2
  200. package/dist/fields/geometry.d.ts +2 -5
  201. package/dist/fields/geometry.d.ts.map +1 -1
  202. package/dist/fields/geometry.js +1 -2
  203. package/dist/fields/index.d.ts +2 -2
  204. package/dist/fields/index.js +3 -3
  205. package/dist/fields/layout.d.ts +5 -6
  206. package/dist/fields/layout.d.ts.map +1 -1
  207. package/dist/fields/layout.js +10 -3
  208. package/dist/fields/layout.js.map +1 -1
  209. package/dist/fields/text.d.ts +5 -8
  210. package/dist/fields/text.d.ts.map +1 -1
  211. package/dist/fields/text.js +1 -2
  212. package/dist/fig-compression.d.ts +3 -6
  213. package/dist/fig-compression.d.ts.map +1 -1
  214. package/dist/fig-compression.js +1 -2
  215. package/dist/figjam/index.js +1 -1
  216. package/dist/figjam/palette.d.ts +21 -23
  217. package/dist/figjam/palette.d.ts.map +1 -1
  218. package/dist/figjam/palette.js +3 -4
  219. package/dist/figjam/text.d.ts +10 -13
  220. package/dist/figjam/text.d.ts.map +1 -1
  221. package/dist/figjam/text.js +1 -2
  222. package/dist/font-style.d.ts +18 -18
  223. package/dist/font-style.d.ts.map +1 -1
  224. package/dist/font-style.js +12 -8
  225. package/dist/font-style.js.map +1 -1
  226. package/dist/generated/index.d.ts +35 -15
  227. package/dist/generated/index.d.ts.map +1 -1
  228. package/dist/generated/index.js +50 -12
  229. package/dist/generated/index.js.map +1 -1
  230. package/dist/generated/kind.d.ts +17 -6
  231. package/dist/generated/kind.d.ts.map +1 -1
  232. package/dist/generated/shape-with-text.d.ts +10 -13
  233. package/dist/generated/shape-with-text.d.ts.map +1 -1
  234. package/dist/generated/shape-with-text.js +3 -3
  235. package/dist/generated/shape-with-text.js.map +1 -1
  236. package/dist/generated/spec.d.ts +45 -0
  237. package/dist/generated/spec.d.ts.map +1 -0
  238. package/dist/generated/spec.js +281 -0
  239. package/dist/generated/spec.js.map +1 -0
  240. package/dist/generated/sticky.d.ts +23 -26
  241. package/dist/generated/sticky.d.ts.map +1 -1
  242. package/dist/generated/sticky.js +4 -4
  243. package/dist/generated/sticky.js.map +1 -1
  244. package/dist/geometry.d.ts +47 -68
  245. package/dist/geometry.d.ts.map +1 -1
  246. package/dist/geometry.js +53 -77
  247. package/dist/geometry.js.map +1 -1
  248. package/dist/gradient.d.ts +15 -18
  249. package/dist/gradient.d.ts.map +1 -1
  250. package/dist/gradient.js +1 -2
  251. package/dist/graph.d.ts +33 -11
  252. package/dist/graph.d.ts.map +1 -1
  253. package/dist/graph.js +85 -28
  254. package/dist/graph.js.map +1 -1
  255. package/dist/group-bounds.d.ts +15 -14
  256. package/dist/group-bounds.d.ts.map +1 -1
  257. package/dist/group-bounds.js +41 -12
  258. package/dist/group-bounds.js.map +1 -1
  259. package/dist/guides.d.ts +5 -8
  260. package/dist/guides.d.ts.map +1 -1
  261. package/dist/guides.js +2 -3
  262. package/dist/hit-test.d.ts +20 -12
  263. package/dist/hit-test.d.ts.map +1 -1
  264. package/dist/hit-test.js +69 -38
  265. package/dist/hit-test.js.map +1 -1
  266. package/dist/icons/fit.d.ts +2 -4
  267. package/dist/icons/fit.d.ts.map +1 -1
  268. package/dist/icons/fit.js +1 -2
  269. package/dist/icons/glyph.d.ts +3 -5
  270. package/dist/icons/glyph.d.ts.map +1 -1
  271. package/dist/icons/glyph.js +3 -4
  272. package/dist/icons/index.d.ts +1 -1
  273. package/dist/icons/index.js +2 -2
  274. package/dist/icons/model.d.ts +8 -11
  275. package/dist/icons/model.d.ts.map +1 -1
  276. package/dist/icons/model.js +1 -2
  277. package/dist/icons/schema.d.ts +8 -11
  278. package/dist/icons/schema.d.ts.map +1 -1
  279. package/dist/icons/schema.js +1 -2
  280. package/dist/ids.d.ts +2 -5
  281. package/dist/ids.d.ts.map +1 -1
  282. package/dist/ids.js +3 -4
  283. package/dist/images.d.ts +20 -21
  284. package/dist/images.d.ts.map +1 -1
  285. package/dist/images.js +7 -6
  286. package/dist/images.js.map +1 -1
  287. package/dist/index.d.ts +2 -2
  288. package/dist/index.js +3 -3
  289. package/dist/instances/assignments.js +1 -2
  290. package/dist/instances/content-marks.js +98 -0
  291. package/dist/instances/content-marks.js.map +1 -0
  292. package/dist/instances/content-size.js +2 -3
  293. package/dist/instances/copies.js +2 -3
  294. package/dist/instances/cycles.d.ts +3 -6
  295. package/dist/instances/cycles.d.ts.map +1 -1
  296. package/dist/instances/cycles.js +1 -2
  297. package/dist/instances/deleted.d.ts +23 -0
  298. package/dist/instances/deleted.d.ts.map +1 -0
  299. package/dist/instances/deleted.js +82 -0
  300. package/dist/instances/deleted.js.map +1 -0
  301. package/dist/instances/fields.d.ts +5 -8
  302. package/dist/instances/fields.d.ts.map +1 -1
  303. package/dist/instances/fields.js +11 -7
  304. package/dist/instances/fields.js.map +1 -1
  305. package/dist/instances/index.d.ts +21 -20
  306. package/dist/instances/index.d.ts.map +1 -1
  307. package/dist/instances/index.js +116 -20
  308. package/dist/instances/index.js.map +1 -1
  309. package/dist/instances/kept-overrides.js +4 -5
  310. package/dist/instances/lookup.d.ts +17 -0
  311. package/dist/instances/lookup.d.ts.map +1 -0
  312. package/dist/instances/lookup.js +48 -0
  313. package/dist/instances/lookup.js.map +1 -0
  314. package/dist/instances/main-component.d.ts +2 -5
  315. package/dist/instances/main-component.d.ts.map +1 -1
  316. package/dist/instances/main-component.js +1 -2
  317. package/dist/instances/matching.js +1 -2
  318. package/dist/instances/overrides.d.ts +23 -26
  319. package/dist/instances/overrides.d.ts.map +1 -1
  320. package/dist/instances/overrides.js +1 -2
  321. package/dist/instances/placement.js +3 -4
  322. package/dist/instances/protection.js +3 -4
  323. package/dist/instances/source-walk.js +1 -2
  324. package/dist/instances/swap.js +7 -8
  325. package/dist/instances/sync.js +91 -18
  326. package/dist/instances/sync.js.map +1 -1
  327. package/dist/instances/vector-geometry.js +2 -3
  328. package/dist/layout/aspect-ratio.d.ts +7 -9
  329. package/dist/layout/aspect-ratio.d.ts.map +1 -1
  330. package/dist/layout/aspect-ratio.js +1 -2
  331. package/dist/layout/flow.d.ts +13 -0
  332. package/dist/layout/flow.d.ts.map +1 -0
  333. package/dist/layout/flow.js +35 -0
  334. package/dist/layout/flow.js.map +1 -0
  335. package/dist/layout/guides.d.ts +13 -16
  336. package/dist/layout/guides.d.ts.map +1 -1
  337. package/dist/layout/guides.js +4 -5
  338. package/dist/layout/guides.js.map +1 -1
  339. package/dist/layout/index.d.ts +6 -4
  340. package/dist/layout/index.js +7 -5
  341. package/dist/layout/keywords.d.ts +7 -9
  342. package/dist/layout/keywords.d.ts.map +1 -1
  343. package/dist/layout/keywords.js +8 -3
  344. package/dist/layout/keywords.js.map +1 -1
  345. package/dist/layout/limits.d.ts +13 -16
  346. package/dist/layout/limits.d.ts.map +1 -1
  347. package/dist/layout/limits.js +1 -2
  348. package/dist/layout/sizing.d.ts +18 -12
  349. package/dist/layout/sizing.d.ts.map +1 -1
  350. package/dist/layout/sizing.js +18 -3
  351. package/dist/layout/sizing.js.map +1 -1
  352. package/dist/layout/spacing.d.ts +7 -4
  353. package/dist/layout/spacing.d.ts.map +1 -1
  354. package/dist/layout/spacing.js +11 -3
  355. package/dist/layout/spacing.js.map +1 -1
  356. package/dist/layout/stacking.d.ts +8 -0
  357. package/dist/layout/stacking.d.ts.map +1 -0
  358. package/dist/layout/stacking.js +12 -0
  359. package/dist/layout/stacking.js.map +1 -0
  360. package/dist/layout/strokes.d.ts +1 -4
  361. package/dist/layout/strokes.d.ts.map +1 -1
  362. package/dist/layout/strokes.js +1 -2
  363. package/dist/layout/writes.js +1 -2
  364. package/dist/layout/writes.js.map +1 -1
  365. package/dist/masks.d.ts +4 -7
  366. package/dist/masks.d.ts.map +1 -1
  367. package/dist/masks.js +1 -2
  368. package/dist/matrix.d.ts +3 -4
  369. package/dist/matrix.d.ts.map +1 -1
  370. package/dist/matrix.js +11 -3
  371. package/dist/matrix.js.map +1 -1
  372. package/dist/mesh/geometry.d.ts +80 -0
  373. package/dist/mesh/geometry.d.ts.map +1 -0
  374. package/dist/mesh/geometry.js +430 -0
  375. package/dist/mesh/geometry.js.map +1 -0
  376. package/dist/mesh/index.d.ts +4 -0
  377. package/dist/mesh/index.js +4 -0
  378. package/dist/mesh/model.d.ts +25 -0
  379. package/dist/mesh/model.d.ts.map +1 -0
  380. package/dist/mesh/model.js +39 -0
  381. package/dist/mesh/model.js.map +1 -0
  382. package/dist/mesh/schema.d.ts +188 -0
  383. package/dist/mesh/schema.d.ts.map +1 -0
  384. package/dist/mesh/schema.js +55 -0
  385. package/dist/mesh/schema.js.map +1 -0
  386. package/dist/motion/apply.d.ts +42 -0
  387. package/dist/motion/apply.d.ts.map +1 -0
  388. package/dist/motion/apply.js +98 -0
  389. package/dist/motion/apply.js.map +1 -0
  390. package/dist/motion/edit.d.ts +53 -0
  391. package/dist/motion/edit.d.ts.map +1 -0
  392. package/dist/motion/edit.js +125 -0
  393. package/dist/motion/edit.js.map +1 -0
  394. package/dist/motion/effects.js +86 -0
  395. package/dist/motion/effects.js.map +1 -0
  396. package/dist/motion/evaluate.d.ts +33 -0
  397. package/dist/motion/evaluate.d.ts.map +1 -0
  398. package/dist/motion/evaluate.js +160 -0
  399. package/dist/motion/evaluate.js.map +1 -0
  400. package/dist/motion/fields.d.ts +69 -0
  401. package/dist/motion/fields.d.ts.map +1 -0
  402. package/dist/motion/fields.js +132 -0
  403. package/dist/motion/fields.js.map +1 -0
  404. package/dist/motion/index.d.ts +16 -0
  405. package/dist/motion/index.js +15 -0
  406. package/dist/motion/keyable.d.ts +32 -0
  407. package/dist/motion/keyable.d.ts.map +1 -0
  408. package/dist/motion/keyable.js +120 -0
  409. package/dist/motion/keyable.js.map +1 -0
  410. package/dist/motion/outline.d.ts +35 -0
  411. package/dist/motion/outline.d.ts.map +1 -0
  412. package/dist/motion/outline.js +59 -0
  413. package/dist/motion/outline.js.map +1 -0
  414. package/dist/motion/presets/index.d.ts +20 -0
  415. package/dist/motion/presets/index.d.ts.map +1 -0
  416. package/dist/motion/presets/index.js +166 -0
  417. package/dist/motion/presets/index.js.map +1 -0
  418. package/dist/motion/presets/settings.d.ts +43 -0
  419. package/dist/motion/presets/settings.d.ts.map +1 -0
  420. package/dist/motion/presets/settings.js +254 -0
  421. package/dist/motion/presets/settings.js.map +1 -0
  422. package/dist/motion/presets/stagger.d.ts +69 -0
  423. package/dist/motion/presets/stagger.d.ts.map +1 -0
  424. package/dist/motion/presets/stagger.js +185 -0
  425. package/dist/motion/presets/stagger.js.map +1 -0
  426. package/dist/motion/schema.d.ts +185 -0
  427. package/dist/motion/schema.d.ts.map +1 -0
  428. package/dist/motion/schema.js +62 -0
  429. package/dist/motion/schema.js.map +1 -0
  430. package/dist/motion/segment.d.ts +25 -0
  431. package/dist/motion/segment.d.ts.map +1 -0
  432. package/dist/motion/segment.js +73 -0
  433. package/dist/motion/segment.js.map +1 -0
  434. package/dist/motion/spec.d.ts +26 -0
  435. package/dist/motion/spec.d.ts.map +1 -0
  436. package/dist/motion/spec.js +175 -0
  437. package/dist/motion/spec.js.map +1 -0
  438. package/dist/motion/timeline.d.ts +16 -0
  439. package/dist/motion/timeline.d.ts.map +1 -0
  440. package/dist/motion/timeline.js +53 -0
  441. package/dist/motion/timeline.js.map +1 -0
  442. package/dist/motion/types.d.ts +49 -0
  443. package/dist/motion/types.d.ts.map +1 -0
  444. package/dist/motion/variables.d.ts +9 -0
  445. package/dist/motion/variables.d.ts.map +1 -0
  446. package/dist/motion/variables.js +25 -0
  447. package/dist/motion/variables.js.map +1 -0
  448. package/dist/mutation-impact.d.ts +9 -10
  449. package/dist/mutation-impact.d.ts.map +1 -1
  450. package/dist/mutation-impact.js +19 -9
  451. package/dist/mutation-impact.js.map +1 -1
  452. package/dist/node-defaults.d.ts +15 -14
  453. package/dist/node-defaults.d.ts.map +1 -1
  454. package/dist/node-defaults.js +153 -55
  455. package/dist/node-defaults.js.map +1 -1
  456. package/dist/order-keys.d.ts +8 -9
  457. package/dist/order-keys.d.ts.map +1 -1
  458. package/dist/order-keys.js +10 -2
  459. package/dist/order-keys.js.map +1 -1
  460. package/dist/outline/flatten.d.ts +3 -6
  461. package/dist/outline/flatten.d.ts.map +1 -1
  462. package/dist/outline/flatten.js +3 -4
  463. package/dist/outline/heads.js +1 -2
  464. package/dist/outline/hit.d.ts +2 -5
  465. package/dist/outline/hit.d.ts.map +1 -1
  466. package/dist/outline/hit.js +5 -6
  467. package/dist/outline/index.js +3 -3
  468. package/dist/outline/point.d.ts +4 -7
  469. package/dist/outline/point.d.ts.map +1 -1
  470. package/dist/outline/point.js +2 -3
  471. package/dist/outline/shapes.d.ts +4 -7
  472. package/dist/outline/shapes.d.ts.map +1 -1
  473. package/dist/outline/shapes.js +2 -3
  474. package/dist/paints/index.d.ts +5 -3
  475. package/dist/paints/index.js +5 -3
  476. package/dist/paints/pattern.d.ts +6 -5
  477. package/dist/paints/pattern.d.ts.map +1 -1
  478. package/dist/paints/pattern.js +34 -3
  479. package/dist/paints/pattern.js.map +1 -1
  480. package/dist/paints/schema.d.ts +4 -7
  481. package/dist/paints/schema.d.ts.map +1 -1
  482. package/dist/paints/schema.js +3 -4
  483. package/dist/paints/shows.d.ts +4 -4
  484. package/dist/paints/shows.d.ts.map +1 -1
  485. package/dist/paints/shows.js +9 -3
  486. package/dist/paints/shows.js.map +1 -1
  487. package/dist/paints/solid.d.ts +8 -0
  488. package/dist/paints/solid.d.ts.map +1 -0
  489. package/dist/paints/solid.js +17 -0
  490. package/dist/paints/solid.js.map +1 -0
  491. package/dist/paints/stills.d.ts +74 -0
  492. package/dist/paints/stills.d.ts.map +1 -0
  493. package/dist/paints/stills.js +117 -0
  494. package/dist/paints/stills.js.map +1 -0
  495. package/dist/parse-path.d.ts +12 -9
  496. package/dist/parse-path.d.ts.map +1 -1
  497. package/dist/parse-path.js +13 -3
  498. package/dist/parse-path.js.map +1 -1
  499. package/dist/paths/arc.d.ts +6 -9
  500. package/dist/paths/arc.d.ts.map +1 -1
  501. package/dist/paths/arc.js +1 -2
  502. package/dist/paths/index.d.ts +1 -1
  503. package/dist/paths/index.js +1 -1
  504. package/dist/paths/network.d.ts +13 -16
  505. package/dist/paths/network.d.ts.map +1 -1
  506. package/dist/paths/network.js +1 -2
  507. package/dist/paths/sink.d.ts +5 -8
  508. package/dist/paths/sink.d.ts.map +1 -1
  509. package/dist/paths/sink.js +1 -2
  510. package/dist/paths/smooth-corners.d.ts +3 -6
  511. package/dist/paths/smooth-corners.d.ts.map +1 -1
  512. package/dist/paths/smooth-corners.js +1 -2
  513. package/dist/plugin-data/field.d.ts +15 -18
  514. package/dist/plugin-data/field.d.ts.map +1 -1
  515. package/dist/plugin-data/field.js +3 -2
  516. package/dist/plugin-data/field.js.map +1 -1
  517. package/dist/plugin-data/fields.d.ts +104 -11
  518. package/dist/plugin-data/fields.d.ts.map +1 -1
  519. package/dist/plugin-data/fields.js +43 -13
  520. package/dist/plugin-data/fields.js.map +1 -1
  521. package/dist/plugin-data/index.d.ts +2 -2
  522. package/dist/plugin-data/index.js +2 -2
  523. package/dist/polygon.d.ts +8 -8
  524. package/dist/polygon.d.ts.map +1 -1
  525. package/dist/polygon.js +7 -7
  526. package/dist/polygon.js.map +1 -1
  527. package/dist/preview.d.ts +3 -5
  528. package/dist/preview.d.ts.map +1 -1
  529. package/dist/preview.js +2 -3
  530. package/dist/primitives/index.d.ts +7 -9
  531. package/dist/primitives/index.d.ts.map +1 -1
  532. package/dist/primitives/index.js +1 -2
  533. package/dist/primitives/schema.d.ts +3 -6
  534. package/dist/primitives/schema.d.ts.map +1 -1
  535. package/dist/primitives/schema.js +1 -2
  536. package/dist/resize.d.ts +19 -14
  537. package/dist/resize.d.ts.map +1 -1
  538. package/dist/resize.js +38 -8
  539. package/dist/resize.js.map +1 -1
  540. package/dist/scaling/index.d.ts +2 -2
  541. package/dist/scaling/index.js +2 -2
  542. package/dist/scaling/node.d.ts +2 -4
  543. package/dist/scaling/node.d.ts.map +1 -1
  544. package/dist/scaling/node.js +30 -11
  545. package/dist/scaling/node.js.map +1 -1
  546. package/dist/scaling/snapshot.d.ts +5 -8
  547. package/dist/scaling/snapshot.d.ts.map +1 -1
  548. package/dist/scaling/snapshot.js +1 -2
  549. package/dist/scaling/tree.d.ts +6 -9
  550. package/dist/scaling/tree.d.ts.map +1 -1
  551. package/dist/scaling/tree.js +2 -3
  552. package/dist/shaders/index.d.ts +2 -3
  553. package/dist/shaders/index.js +2 -3
  554. package/dist/shaders/model.d.ts +54 -21
  555. package/dist/shaders/model.d.ts.map +1 -1
  556. package/dist/shaders/model.js +103 -35
  557. package/dist/shaders/model.js.map +1 -1
  558. package/dist/shaders/schema.d.ts +16 -9
  559. package/dist/shaders/schema.d.ts.map +1 -1
  560. package/dist/shaders/schema.js +12 -3
  561. package/dist/shaders/schema.js.map +1 -1
  562. package/dist/shape-with-text/document.js +264 -0
  563. package/dist/shape-with-text/document.js.map +1 -0
  564. package/dist/shape-with-text/fit.d.ts +6 -9
  565. package/dist/shape-with-text/fit.d.ts.map +1 -1
  566. package/dist/shape-with-text/fit.js +1 -2
  567. package/dist/shape-with-text/geometry.d.ts +16 -7
  568. package/dist/shape-with-text/geometry.d.ts.map +1 -1
  569. package/dist/shape-with-text/geometry.js +105 -46
  570. package/dist/shape-with-text/geometry.js.map +1 -1
  571. package/dist/shape-with-text/index.d.ts +2 -2
  572. package/dist/shape-with-text/index.js +3 -3
  573. package/dist/shape-with-text/kinds.d.ts +4 -7
  574. package/dist/shape-with-text/kinds.d.ts.map +1 -1
  575. package/dist/shape-with-text/kinds.js +1 -2
  576. package/dist/shared-style-index.d.ts +19 -0
  577. package/dist/shared-style-index.d.ts.map +1 -0
  578. package/dist/shared-style-index.js +71 -0
  579. package/dist/shared-style-index.js.map +1 -0
  580. package/dist/shared-styles.d.ts +18 -20
  581. package/dist/shared-styles.d.ts.map +1 -1
  582. package/dist/shared-styles.js +20 -12
  583. package/dist/shared-styles.js.map +1 -1
  584. package/dist/slides/drop.d.ts +29 -0
  585. package/dist/slides/drop.d.ts.map +1 -0
  586. package/dist/slides/drop.js +80 -0
  587. package/dist/slides/drop.js.map +1 -0
  588. package/dist/slides/index.d.ts +56 -0
  589. package/dist/slides/index.d.ts.map +1 -0
  590. package/dist/slides/index.js +137 -0
  591. package/dist/slides/index.js.map +1 -0
  592. package/dist/slides/motion.d.ts +71 -0
  593. package/dist/slides/motion.d.ts.map +1 -0
  594. package/dist/slides/motion.js +167 -0
  595. package/dist/slides/motion.js.map +1 -0
  596. package/dist/slides/playback.d.ts +62 -0
  597. package/dist/slides/playback.d.ts.map +1 -0
  598. package/dist/slides/playback.js +220 -0
  599. package/dist/slides/playback.js.map +1 -0
  600. package/dist/slides/types.d.ts +59 -0
  601. package/dist/slides/types.d.ts.map +1 -0
  602. package/dist/slides/types.js +38 -0
  603. package/dist/slides/types.js.map +1 -0
  604. package/dist/slots/authoring.d.ts +6 -9
  605. package/dist/slots/authoring.d.ts.map +1 -1
  606. package/dist/slots/authoring.js +2 -3
  607. package/dist/slots/content.d.ts +5 -8
  608. package/dist/slots/content.d.ts.map +1 -1
  609. package/dist/slots/content.js +4 -5
  610. package/dist/slots/frames.d.ts +7 -9
  611. package/dist/slots/frames.d.ts.map +1 -1
  612. package/dist/slots/frames.js +3 -4
  613. package/dist/slots/frames.js.map +1 -1
  614. package/dist/slots/index.js +1 -1
  615. package/dist/slots/limits.d.ts +4 -7
  616. package/dist/slots/limits.d.ts.map +1 -1
  617. package/dist/slots/limits.js +1 -2
  618. package/dist/snap.d.ts +4 -7
  619. package/dist/snap.d.ts.map +1 -1
  620. package/dist/snap.js +7 -8
  621. package/dist/source-metadata.d.ts +1 -4
  622. package/dist/source-metadata.d.ts.map +1 -1
  623. package/dist/source-metadata.js +1 -2
  624. package/dist/specs/index.d.ts +3 -0
  625. package/dist/specs/index.js +3 -0
  626. package/dist/specs/model.d.ts +20 -0
  627. package/dist/specs/model.d.ts.map +1 -0
  628. package/dist/specs/model.js +32 -0
  629. package/dist/specs/model.js.map +1 -0
  630. package/dist/specs/schema.d.ts +24 -0
  631. package/dist/specs/schema.d.ts.map +1 -0
  632. package/dist/specs/schema.js +32 -0
  633. package/dist/specs/schema.js.map +1 -0
  634. package/dist/statuses/impact.d.ts +2 -5
  635. package/dist/statuses/impact.d.ts.map +1 -1
  636. package/dist/statuses/impact.js +2 -3
  637. package/dist/statuses/index.d.ts +1 -1
  638. package/dist/statuses/index.js +2 -2
  639. package/dist/statuses/node.d.ts +4 -7
  640. package/dist/statuses/node.d.ts.map +1 -1
  641. package/dist/statuses/node.js +1 -2
  642. package/dist/statuses/schema.d.ts +7 -9
  643. package/dist/statuses/schema.d.ts.map +1 -1
  644. package/dist/statuses/schema.js +1 -2
  645. package/dist/statuses/workflow.d.ts +9 -12
  646. package/dist/statuses/workflow.d.ts.map +1 -1
  647. package/dist/statuses/workflow.js +2 -3
  648. package/dist/strokes.d.ts +8 -10
  649. package/dist/strokes.d.ts.map +1 -1
  650. package/dist/strokes.js +2 -3
  651. package/dist/text/auto-resize.d.ts +4 -6
  652. package/dist/text/auto-resize.d.ts.map +1 -1
  653. package/dist/text/auto-resize.js +1 -2
  654. package/dist/text/direction.d.ts +10 -10
  655. package/dist/text/direction.d.ts.map +1 -1
  656. package/dist/text/direction.js +13 -14
  657. package/dist/text/direction.js.map +1 -1
  658. package/dist/text/index.d.ts +3 -2
  659. package/dist/text/index.js +6 -5
  660. package/dist/text/lengths.d.ts +9 -12
  661. package/dist/text/lengths.d.ts.map +1 -1
  662. package/dist/text/lengths.js +1 -2
  663. package/dist/text/lists.d.ts +17 -13
  664. package/dist/text/lists.d.ts.map +1 -1
  665. package/dist/text/lists.js +15 -4
  666. package/dist/text/lists.js.map +1 -1
  667. package/dist/text/name.d.ts +19 -0
  668. package/dist/text/name.d.ts.map +1 -0
  669. package/dist/text/name.js +37 -0
  670. package/dist/text/name.js.map +1 -0
  671. package/dist/text/overflow.d.ts +5 -7
  672. package/dist/text/overflow.d.ts.map +1 -1
  673. package/dist/text/overflow.js +1 -2
  674. package/dist/text/paragraphs.d.ts +20 -23
  675. package/dist/text/paragraphs.d.ts.map +1 -1
  676. package/dist/text/paragraphs.js +8 -5
  677. package/dist/text/paragraphs.js.map +1 -1
  678. package/dist/text/path.js +1 -2
  679. package/dist/text/picture.d.ts +3 -6
  680. package/dist/text/picture.d.ts.map +1 -1
  681. package/dist/text/picture.js +2 -3
  682. package/dist/text/references.d.ts +3 -6
  683. package/dist/text/references.d.ts.map +1 -1
  684. package/dist/text/references.js +2 -4
  685. package/dist/text/references.js.map +1 -1
  686. package/dist/text/runs.d.ts +6 -9
  687. package/dist/text/runs.d.ts.map +1 -1
  688. package/dist/text/runs.js +1 -2
  689. package/dist/text/schema.d.ts +1 -4
  690. package/dist/text/schema.d.ts.map +1 -1
  691. package/dist/text/schema.js +1 -2
  692. package/dist/thumbnail.d.ts +20 -0
  693. package/dist/thumbnail.d.ts.map +1 -0
  694. package/dist/thumbnail.js +46 -0
  695. package/dist/thumbnail.js.map +1 -0
  696. package/dist/transfer/apply.d.ts +2 -5
  697. package/dist/transfer/apply.d.ts.map +1 -1
  698. package/dist/transfer/apply.js +16 -6
  699. package/dist/transfer/apply.js.map +1 -1
  700. package/dist/transfer/copied.d.ts +11 -9
  701. package/dist/transfer/copied.d.ts.map +1 -1
  702. package/dist/transfer/copied.js +5 -6
  703. package/dist/transfer/copied.js.map +1 -1
  704. package/dist/transfer/dependencies.d.ts +10 -10
  705. package/dist/transfer/dependencies.d.ts.map +1 -1
  706. package/dist/transfer/dependencies.js +21 -10
  707. package/dist/transfer/dependencies.js.map +1 -1
  708. package/dist/transfer/history.d.ts +1 -4
  709. package/dist/transfer/history.d.ts.map +1 -1
  710. package/dist/transfer/history.js +3 -2
  711. package/dist/transfer/history.js.map +1 -1
  712. package/dist/transfer/identity.js +19 -5
  713. package/dist/transfer/identity.js.map +1 -1
  714. package/dist/transfer/index.d.ts +5 -4
  715. package/dist/transfer/index.js +6 -5
  716. package/dist/transfer/library.d.ts +43 -0
  717. package/dist/transfer/library.d.ts.map +1 -0
  718. package/dist/transfer/library.js +122 -0
  719. package/dist/transfer/library.js.map +1 -0
  720. package/dist/transfer/nodes.d.ts +2 -5
  721. package/dist/transfer/nodes.d.ts.map +1 -1
  722. package/dist/transfer/nodes.js +15 -4
  723. package/dist/transfer/nodes.js.map +1 -1
  724. package/dist/transfer/plan.d.ts +11 -5
  725. package/dist/transfer/plan.d.ts.map +1 -1
  726. package/dist/transfer/plan.js +52 -8
  727. package/dist/transfer/plan.js.map +1 -1
  728. package/dist/transfer/references.js +1 -2
  729. package/dist/transfer/remove.d.ts +1 -4
  730. package/dist/transfer/remove.d.ts.map +1 -1
  731. package/dist/transfer/remove.js +8 -3
  732. package/dist/transfer/remove.js.map +1 -1
  733. package/dist/transfer/resources.d.ts +2 -5
  734. package/dist/transfer/resources.d.ts.map +1 -1
  735. package/dist/transfer/resources.js +3 -4
  736. package/dist/transfer/validation.js +9 -6
  737. package/dist/transfer/validation.js.map +1 -1
  738. package/dist/transfer/variables.d.ts +3 -6
  739. package/dist/transfer/variables.d.ts.map +1 -1
  740. package/dist/transfer/variables.js +4 -4
  741. package/dist/transfer/variables.js.map +1 -1
  742. package/dist/types.d.ts +261 -134
  743. package/dist/types.d.ts.map +1 -1
  744. package/dist/types.js +47 -3
  745. package/dist/types.js.map +1 -1
  746. package/dist/undo.d.ts +5 -8
  747. package/dist/undo.d.ts.map +1 -1
  748. package/dist/undo.js +9 -3
  749. package/dist/undo.js.map +1 -1
  750. package/dist/variables/bindings.d.ts +29 -25
  751. package/dist/variables/bindings.d.ts.map +1 -1
  752. package/dist/variables/bindings.js +184 -55
  753. package/dist/variables/bindings.js.map +1 -1
  754. package/dist/variables/corners.d.ts +1 -4
  755. package/dist/variables/corners.d.ts.map +1 -1
  756. package/dist/variables/corners.js +1 -2
  757. package/dist/variables/easing.d.ts +53 -0
  758. package/dist/variables/easing.d.ts.map +1 -0
  759. package/dist/variables/easing.js +321 -0
  760. package/dist/variables/easing.js.map +1 -0
  761. package/dist/variables/fields.d.ts +21 -14
  762. package/dist/variables/fields.d.ts.map +1 -1
  763. package/dist/variables/fields.js +24 -6
  764. package/dist/variables/fields.js.map +1 -1
  765. package/dist/variables/formula/check.d.ts +2 -5
  766. package/dist/variables/formula/check.d.ts.map +1 -1
  767. package/dist/variables/formula/check.js +2 -3
  768. package/dist/variables/formula/evaluate.d.ts +1 -4
  769. package/dist/variables/formula/evaluate.d.ts.map +1 -1
  770. package/dist/variables/formula/evaluate.js +3 -4
  771. package/dist/variables/formula/index.d.ts +8 -8
  772. package/dist/variables/formula/index.d.ts.map +1 -1
  773. package/dist/variables/formula/index.js +29 -13
  774. package/dist/variables/formula/index.js.map +1 -1
  775. package/dist/variables/formula/parse.js +5 -6
  776. package/dist/variables/formula/print.d.ts +2 -5
  777. package/dist/variables/formula/print.d.ts.map +1 -1
  778. package/dist/variables/formula/print.js +4 -5
  779. package/dist/variables/formula/schema.d.ts +2 -5
  780. package/dist/variables/formula/schema.d.ts.map +1 -1
  781. package/dist/variables/formula/schema.js +6 -7
  782. package/dist/variables/formula/signatures.d.ts +4 -7
  783. package/dist/variables/formula/signatures.d.ts.map +1 -1
  784. package/dist/variables/formula/signatures.js +1 -2
  785. package/dist/variables/formula/signatures.js.map +1 -1
  786. package/dist/variables/formula/tokens.d.ts +5 -8
  787. package/dist/variables/formula/tokens.d.ts.map +1 -1
  788. package/dist/variables/formula/tokens.js +1 -2
  789. package/dist/variables/formula/tree.d.ts +8 -11
  790. package/dist/variables/formula/tree.d.ts.map +1 -1
  791. package/dist/variables/formula/tree.js +1 -2
  792. package/dist/variables/formula/tree.js.map +1 -1
  793. package/dist/variables/index.d.ts +42 -27
  794. package/dist/variables/index.d.ts.map +1 -1
  795. package/dist/variables/index.js +78 -29
  796. package/dist/variables/index.js.map +1 -1
  797. package/dist/variables/lookup.d.ts +11 -7
  798. package/dist/variables/lookup.d.ts.map +1 -1
  799. package/dist/variables/lookup.js +25 -4
  800. package/dist/variables/lookup.js.map +1 -1
  801. package/dist/variables/motion.d.ts +43 -0
  802. package/dist/variables/motion.d.ts.map +1 -0
  803. package/dist/variables/motion.js +106 -0
  804. package/dist/variables/motion.js.map +1 -0
  805. package/dist/variables/paints.d.ts +25 -19
  806. package/dist/variables/paints.d.ts.map +1 -1
  807. package/dist/variables/paints.js +28 -15
  808. package/dist/variables/paints.js.map +1 -1
  809. package/dist/variables/resolution.d.ts +22 -19
  810. package/dist/variables/resolution.d.ts.map +1 -1
  811. package/dist/variables/resolution.js +23 -14
  812. package/dist/variables/resolution.js.map +1 -1
  813. package/dist/variables/schema.d.ts +62 -7
  814. package/dist/variables/schema.d.ts.map +1 -1
  815. package/dist/variables/schema.js +39 -5
  816. package/dist/variables/schema.js.map +1 -1
  817. package/dist/variables/style-bindings.d.ts +21 -0
  818. package/dist/variables/style-bindings.d.ts.map +1 -0
  819. package/dist/variables/style-bindings.js +82 -0
  820. package/dist/variables/style-bindings.js.map +1 -0
  821. package/dist/variables/subtree.js +1 -2
  822. package/dist/variables/text.d.ts +2 -5
  823. package/dist/variables/text.d.ts.map +1 -1
  824. package/dist/variables/text.js +3 -4
  825. package/dist/variables/token.d.ts +5 -8
  826. package/dist/variables/token.d.ts.map +1 -1
  827. package/dist/variables/token.js +1 -2
  828. package/dist/variables/units.js +3 -5
  829. package/dist/variables/units.js.map +1 -1
  830. package/dist/variables/value.d.ts +4 -7
  831. package/dist/variables/value.d.ts.map +1 -1
  832. package/dist/variables/value.js +4 -5
  833. package/dist/variant-name.d.ts +2 -5
  834. package/dist/variant-name.d.ts.map +1 -1
  835. package/dist/variant-name.js +1 -2
  836. package/dist/variant-properties.d.ts +4 -7
  837. package/dist/variant-properties.d.ts.map +1 -1
  838. package/dist/variant-properties.js +2 -3
  839. package/dist/vector-network.d.ts +17 -20
  840. package/dist/vector-network.d.ts.map +1 -1
  841. package/dist/vector-network.js +4 -5
  842. package/package.json +42 -5
  843. package/src/behaviours/index.ts +2 -0
  844. package/src/behaviours/kinds.ts +108 -2
  845. package/src/behaviours/listing.ts +142 -0
  846. package/src/behaviours/model.ts +23 -2
  847. package/src/behaviours/schema.ts +19 -2
  848. package/src/behaviours/spec.ts +5 -0
  849. package/src/behaviours/transition.ts +46 -0
  850. package/src/blur.ts +88 -0
  851. package/src/checkpoint.ts +2 -0
  852. package/src/clipping.ts +3 -4
  853. package/src/color/index.ts +15 -24
  854. package/src/color/management.ts +144 -168
  855. package/src/color/okhcl.ts +62 -43
  856. package/src/color/schema.ts +13 -0
  857. package/src/comments/threads.ts +8 -1
  858. package/src/connectors/layout.ts +10 -3
  859. package/src/connectors/sublayers.ts +2 -1
  860. package/src/constraints.ts +2 -1
  861. package/src/coordinate.ts +17 -25
  862. package/src/copy.ts +38 -0
  863. package/src/corners.ts +3 -0
  864. package/src/css/index.ts +1 -0
  865. package/src/css/motion.ts +51 -0
  866. package/src/css/shadows.ts +7 -6
  867. package/src/css/values.ts +7 -3
  868. package/src/cubic.ts +57 -1
  869. package/src/export-format.ts +11 -1
  870. package/src/fields/layout.ts +9 -0
  871. package/src/font-style.ts +20 -7
  872. package/src/generated/index.ts +58 -9
  873. package/src/generated/kind.ts +16 -2
  874. package/src/generated/shape-with-text.ts +1 -0
  875. package/src/generated/spec.ts +243 -0
  876. package/src/generated/sticky.ts +2 -1
  877. package/src/geometry.ts +52 -89
  878. package/src/graph.ts +93 -15
  879. package/src/group-bounds.ts +54 -13
  880. package/src/hit-test.ts +78 -33
  881. package/src/images.ts +4 -1
  882. package/src/instances/content-marks.ts +124 -0
  883. package/src/instances/deleted.ts +115 -0
  884. package/src/instances/fields.ts +9 -3
  885. package/src/instances/index.ts +165 -17
  886. package/src/instances/lookup.ts +61 -0
  887. package/src/instances/sync.ts +108 -11
  888. package/src/layout/flow.ts +36 -0
  889. package/src/layout/index.ts +2 -0
  890. package/src/layout/keywords.ts +7 -1
  891. package/src/layout/sizing.ts +30 -0
  892. package/src/layout/spacing.ts +12 -0
  893. package/src/layout/stacking.ts +14 -0
  894. package/src/matrix.ts +11 -1
  895. package/src/mesh/geometry.ts +422 -0
  896. package/src/mesh/index.ts +3 -0
  897. package/src/mesh/model.ts +50 -0
  898. package/src/mesh/schema.ts +81 -0
  899. package/src/motion/apply.ts +156 -0
  900. package/src/motion/edit.ts +148 -0
  901. package/src/motion/effects.ts +166 -0
  902. package/src/motion/evaluate.ts +181 -0
  903. package/src/motion/fields.ts +136 -0
  904. package/src/motion/index.ts +13 -0
  905. package/src/motion/keyable.ts +141 -0
  906. package/src/motion/outline.ts +72 -0
  907. package/src/motion/presets/index.ts +257 -0
  908. package/src/motion/presets/settings.ts +221 -0
  909. package/src/motion/presets/stagger.ts +242 -0
  910. package/src/motion/schema.ts +66 -0
  911. package/src/motion/segment.ts +83 -0
  912. package/src/motion/spec.ts +225 -0
  913. package/src/motion/timeline.ts +48 -0
  914. package/src/motion/types.ts +45 -0
  915. package/src/motion/variables.ts +33 -0
  916. package/src/mutation-impact.ts +23 -7
  917. package/src/node-defaults.ts +152 -53
  918. package/src/order-keys.ts +16 -2
  919. package/src/paints/index.ts +2 -0
  920. package/src/paints/pattern.ts +55 -0
  921. package/src/paints/shows.ts +9 -0
  922. package/src/paints/solid.ts +10 -0
  923. package/src/paints/stills.ts +186 -0
  924. package/src/parse-path.ts +15 -0
  925. package/src/plugin-data/field.ts +3 -0
  926. package/src/plugin-data/fields.ts +54 -4
  927. package/src/polygon.ts +6 -4
  928. package/src/resize.ts +32 -20
  929. package/src/scaling/index.ts +1 -1
  930. package/src/scaling/node.ts +43 -6
  931. package/src/shaders/index.ts +0 -1
  932. package/src/shaders/model.ts +133 -45
  933. package/src/shaders/schema.ts +13 -1
  934. package/src/shape-with-text/document.ts +170 -0
  935. package/src/shape-with-text/geometry.ts +98 -29
  936. package/src/shared-style-index.ts +106 -0
  937. package/src/shared-styles.ts +21 -14
  938. package/src/slides/drop.ts +94 -0
  939. package/src/slides/index.ts +133 -0
  940. package/src/slides/motion.ts +203 -0
  941. package/src/slides/playback.ts +242 -0
  942. package/src/slides/types.ts +94 -0
  943. package/src/slots/frames.ts +2 -3
  944. package/src/specs/index.ts +2 -0
  945. package/src/specs/model.ts +40 -0
  946. package/src/specs/schema.ts +43 -0
  947. package/src/text/direction.ts +13 -23
  948. package/src/text/index.ts +1 -0
  949. package/src/text/lists.ts +20 -7
  950. package/src/text/name.ts +39 -0
  951. package/src/text/paragraphs.ts +10 -3
  952. package/src/text/references.ts +3 -3
  953. package/src/thumbnail.ts +52 -0
  954. package/src/transfer/apply.ts +16 -3
  955. package/src/transfer/copied.ts +7 -2
  956. package/src/transfer/dependencies.ts +27 -12
  957. package/src/transfer/history.ts +2 -0
  958. package/src/transfer/identity.ts +34 -2
  959. package/src/transfer/index.ts +6 -0
  960. package/src/transfer/library.ts +177 -0
  961. package/src/transfer/nodes.ts +28 -0
  962. package/src/transfer/plan.ts +96 -10
  963. package/src/transfer/remove.ts +6 -2
  964. package/src/transfer/validation.ts +15 -7
  965. package/src/transfer/variables.ts +8 -2
  966. package/src/types.ts +182 -15
  967. package/src/undo.ts +10 -1
  968. package/src/variables/bindings.ts +292 -51
  969. package/src/variables/easing.ts +281 -0
  970. package/src/variables/fields.ts +30 -3
  971. package/src/variables/formula/index.ts +33 -14
  972. package/src/variables/formula/signatures.ts +6 -2
  973. package/src/variables/formula/tree.ts +3 -3
  974. package/src/variables/index.ts +90 -37
  975. package/src/variables/lookup.ts +25 -2
  976. package/src/variables/motion.ts +151 -0
  977. package/src/variables/paints.ts +29 -7
  978. package/src/variables/resolution.ts +26 -6
  979. package/src/variables/schema.ts +41 -0
  980. package/src/variables/style-bindings.ts +137 -0
  981. package/src/variables/units.ts +2 -3
  982. package/dist/shaders/still.d.ts +0 -18
  983. package/dist/shaders/still.d.ts.map +0 -1
  984. package/dist/shaders/still.js +0 -36
  985. package/dist/shaders/still.js.map +0 -1
  986. package/src/shaders/still.ts +0 -41
@@ -1,20 +1,19 @@
1
1
  import { finiteNumberSchema, matrixSchema, vectorSchema } from "./schema.js";
2
- //#region src/primitives/index.d.ts
3
- interface GUID {
2
+ export interface GUID {
4
3
  sessionID: number;
5
4
  localID: number;
6
5
  }
7
- interface Color {
6
+ export interface Color {
8
7
  r: number;
9
8
  g: number;
10
9
  b: number;
11
10
  a: number;
12
11
  }
13
- interface Vector {
12
+ export interface Vector {
14
13
  x: number;
15
14
  y: number;
16
15
  }
17
- interface Matrix {
16
+ export interface Matrix {
18
17
  m00: number;
19
18
  m01: number;
20
19
  m02: number;
@@ -22,16 +21,15 @@ interface Matrix {
22
21
  m11: number;
23
22
  m12: number;
24
23
  }
25
- interface Size {
24
+ export interface Size {
26
25
  width: number;
27
26
  height: number;
28
27
  }
29
- interface Rect {
28
+ export interface Rect {
30
29
  x: number;
31
30
  y: number;
32
31
  width: number;
33
32
  height: number;
34
33
  }
35
- //#endregion
36
- export { Color, GUID, Matrix, Rect, Size, Vector, finiteNumberSchema, matrixSchema, vectorSchema };
34
+ export { finiteNumberSchema, matrixSchema, vectorSchema };
37
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/primitives/index.ts"],"mappings":";;UAAiB;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/primitives/index.ts"],"mappings":";iBAAiB;EACf;EACA;;iBAGe;EACf;EACA;EACA;EACA;;iBAGe;EACf;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;;iBAGe;EACf;EACA;EACA;EACA"}
@@ -1,2 +1 @@
1
- import { finiteNumberSchema, matrixSchema, vectorSchema } from "./schema.js";
2
- export { finiteNumberSchema, matrixSchema, vectorSchema };
1
+ export { finiteNumberSchema, matrixSchema, vectorSchema } from "./schema.js";
@@ -1,11 +1,10 @@
1
1
  import * as v from "valibot";
2
- //#region src/primitives/schema.d.ts
3
- declare const finiteNumberSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
4
- declare const vectorSchema: v.ObjectSchema<{
2
+ export declare const finiteNumberSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
3
+ export declare const vectorSchema: v.ObjectSchema<{
5
4
  readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
6
5
  readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
7
6
  }, undefined>;
8
- declare const matrixSchema: v.ObjectSchema<{
7
+ export declare const matrixSchema: v.ObjectSchema<{
9
8
  readonly m00: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
10
9
  readonly m01: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
11
10
  readonly m02: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
@@ -13,6 +12,4 @@ declare const matrixSchema: v.ObjectSchema<{
13
12
  readonly m11: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
14
13
  readonly m12: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
15
14
  }, undefined>;
16
- //#endregion
17
- export { finiteNumberSchema, matrixSchema, vectorSchema };
18
15
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/primitives/schema.ts"],"mappings":";;cAEa,oBAAkB,EAAA,yBAAA,EAAA,yBAAA,EAAA;cAElB,cAAY,EAAA;;;;cAEZ,cAAY,EAAA"}
1
+ {"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/primitives/schema.ts"],"mappings":";qBAEa,oBAAkB,EAAA,yBAAA,EAAA,yBAAA,EAAA;qBAElB,cAAY,EAAA;;;;qBAEZ,cAAY,EAAA"}
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- //#region src/primitives/schema.ts
2
+ // src/primitives/schema.ts
3
3
  const finiteNumberSchema = v.pipe(v.number(), v.finite());
4
4
  const vectorSchema = v.object({
5
5
  x: finiteNumberSchema,
@@ -13,7 +13,6 @@ const matrixSchema = v.object({
13
13
  m11: finiteNumberSchema,
14
14
  m12: finiteNumberSchema
15
15
  });
16
- //#endregion
17
16
  export { finiteNumberSchema, matrixSchema, vectorSchema };
18
17
 
19
18
  //# sourceMappingURL=schema.js.map
package/dist/resize.d.ts CHANGED
@@ -1,52 +1,57 @@
1
1
  import { Rect } from "./primitives/index.js";
2
2
  import { ConstraintType, SceneNode, VectorNetwork } from "./types.js";
3
- //#region src/resize.d.ts
4
3
  /**
5
4
  * Drag-start state a live resize re-scales from. Path text needs more than the
6
5
  * layout rect: its OUTSIDE stroke silhouettes and glyph outlines are baked
7
6
  * geometry that must scale with the node, and textPathBox is the layout box the
8
7
  * glyphs were reflowed against.
9
8
  */
10
- type ResizeSnapshot = Pick<SceneNode, 'type' | 'x' | 'y' | 'width' | 'height' | 'flipX' | 'flipY' | 'vectorNetwork' | 'fillGeometry' | 'strokeGeometry' | 'derivedTextGlyphs' | 'strokes' | 'textPathData' | 'textPathBox'>;
9
+ declare const RESIZE_SNAPSHOT_FIELDS: readonly ["type", "x", "y", "width", "height", "flipX", "flipY", "vectorNetwork", "fillGeometry", "strokeGeometry", "derivedTextGlyphs", "strokes", "textPathData", "textPathBox"];
10
+ export type ResizeSnapshot = Pick<SceneNode, (typeof RESIZE_SNAPSHOT_FIELDS)[number]>;
11
11
  interface ResizeGraph {
12
12
  readonly rootId: string;
13
13
  getNode(id: string): SceneNode | undefined;
14
14
  }
15
15
  /** A child's box after its parent resizes, and the axes on which it turned over. */
16
- type ConstrainedRect = Rect & {
16
+ export type ConstrainedRect = Rect & {
17
17
  flipsX?: boolean;
18
18
  flipsY?: boolean;
19
19
  };
20
20
  /** Keep a placed box's constrained edges or center when its content determines its size. */
21
- declare function resizedChildRect(placed: Rect, size: Pick<Rect, 'width' | 'height'>, horizontal: ConstraintType, vertical: ConstraintType): Rect;
21
+ export declare function resizedChildRect(placed: Rect, size: Pick<Rect, 'width' | 'height'>, horizontal: ConstraintType, vertical: ConstraintType): Rect;
22
22
  /**
23
23
  * A child's box after its parent resizes, by a handle, `resize()`, layout, or an instance taking
24
24
  * another size than its component, keeping a locked aspect ratio as Figma does.
25
25
  */
26
- declare function constrainedChildRect(child: Rect, parentBefore: Pick<Rect, 'width' | 'height'>, parentAfter: Pick<Rect, 'width' | 'height'>, horizontal: ConstraintType, vertical: ConstraintType, aspectRatio?: number | null): ConstrainedRect;
27
- declare function scaledChildRect(child: Rect, parentBefore: Pick<Rect, 'width' | 'height'>, parentAfter: Pick<Rect, 'width' | 'height'>): Rect;
28
- declare function scaleVectorNetworkForResize(vectorNetwork: VectorNetwork | null, originalWidth: number, originalHeight: number, width: number, height: number): VectorNetwork | null;
26
+ export declare function constrainedChildRect(child: Rect, parentBefore: Pick<Rect, 'width' | 'height'>, parentAfter: Pick<Rect, 'width' | 'height'>, horizontal: ConstraintType, vertical: ConstraintType, aspectRatio?: number | null): ConstrainedRect;
27
+ export declare function scaledChildRect(child: Rect, parentBefore: Pick<Rect, 'width' | 'height'>, parentAfter: Pick<Rect, 'width' | 'height'>): Rect;
28
+ export declare function scaleVectorNetworkForResize(vectorNetwork: VectorNetwork | null, originalWidth: number, originalHeight: number, width: number, height: number): VectorNetwork | null;
29
29
  /** Snapshot one node's resize-relevant state (rect + geometry that must scale with it). */
30
- declare function createResizeSnapshot(node: SceneNode): ResizeSnapshot;
30
+ export declare function createResizeSnapshot(node: SceneNode): ResizeSnapshot;
31
31
  /**
32
32
  * All geometry that must track a width/height change. Historically only
33
33
  * vectorNetwork + fillGeometry were updated — path-text strokeGeometry and
34
34
  * glyphs stayed at the pre-resize size, so shrinking a sticker made the white
35
35
  * OUTSIDE outlines look massively thick (DomeSticker resize bug).
36
36
  */
37
- declare function scaledGeometryChanges(orig: Pick<ResizeSnapshot, 'type' | 'vectorNetwork' | 'fillGeometry' | 'strokeGeometry' | 'derivedTextGlyphs' | 'strokes' | 'textPathData' | 'textPathBox'>, origWidth: number, origHeight: number, width: number, height: number): Partial<SceneNode>;
38
- declare function collectResizeDescendants(graph: ResizeGraph, rootId: string): Map<string, ResizeSnapshot> | null;
37
+ export declare function scaledGeometryChanges(orig: Pick<ResizeSnapshot, 'type' | 'vectorNetwork' | 'fillGeometry' | 'strokeGeometry' | 'derivedTextGlyphs' | 'strokes' | 'textPathData' | 'textPathBox'>, origWidth: number, origHeight: number, width: number, height: number): Partial<SceneNode>;
38
+ /**
39
+ * A node's resize state holding its own geometry rather than copies of it. It stays the state the
40
+ * resize began from only while nothing edits that geometry in place, as a resize plan does not:
41
+ * it writes new paths and outlines.
42
+ */
43
+ export declare function sharedResizeSnapshot(node: SceneNode): ResizeSnapshot;
44
+ export declare function collectResizeDescendants(graph: ResizeGraph, rootId: string, snapshot?: (node: SceneNode) => ResizeSnapshot): Map<string, ResizeSnapshot> | null;
39
45
  /**
40
46
  * The flips a child takes when its constraints place it from `from`, written only where they
41
47
  * differ from the ones it has now, so a drag that crosses back undoes its own turn.
42
48
  */
43
- declare function flipChanges(from: Pick<SceneNode, 'flipX' | 'flipY'>, current: Pick<SceneNode, 'flipX' | 'flipY'>, flipsX?: boolean, flipsY?: boolean): Partial<Pick<SceneNode, 'flipX' | 'flipY'>>;
49
+ export declare function flipChanges(from: Pick<SceneNode, 'flipX' | 'flipY'>, current: Pick<SceneNode, 'flipX' | 'flipY'>, flipsX?: boolean, flipsY?: boolean): Partial<Pick<SceneNode, 'flipX' | 'flipY'>>;
44
50
  type Size = Pick<Rect, 'width' | 'height'>;
45
51
  /**
46
52
  * Where the descendants of a layer go when it resizes from `rootBefore` to `rootAfter`, from the
47
53
  * places `originals` recorded.
48
54
  */
49
- declare function computeConstrainedResizeChanges(graph: ResizeGraph, rootId: string, rootBefore: Size, rootAfter: Size, originals: ReadonlyMap<string, ResizeSnapshot>): Map<string, Partial<SceneNode>>;
50
- //#endregion
51
- export { ConstrainedRect, ResizeSnapshot, collectResizeDescendants, computeConstrainedResizeChanges, constrainedChildRect, createResizeSnapshot, flipChanges, resizedChildRect, scaleVectorNetworkForResize, scaledChildRect, scaledGeometryChanges };
55
+ export declare function computeConstrainedResizeChanges(graph: ResizeGraph, rootId: string, rootBefore: Size, rootAfter: Size, originals: ReadonlyMap<string, ResizeSnapshot>): Map<string, Partial<SceneNode>>;
56
+ export {};
52
57
  //# sourceMappingURL=resize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resize.d.ts","names":[],"sources":["../src/resize.ts"],"mappings":";;;;;;;;;KAwBY,iBAAiB,KAC3B;UAiBQ;WACC;EACT,QAAQ,aAAa;;;KAeX,kBAAkB;EAAS;EAAkB;;;iBAkDzC,iBACd,QAAQ,MACR,MAAM,KAAK,2BACX,YAAY,gBACZ,UAAU,iBACT;;;;;iBA4Ba,qBACd,OAAO,MACP,cAAc,KAAK,2BACnB,aAAa,KAAK,2BAClB,YAAY,gBACZ,UAAU,gBACV,8BACC;iBAca,gBACd,OAAO,MACP,cAAc,KAAK,2BACnB,aAAa,KAAK,4BACjB;iBASa,4BACd,eAAe,sBACf,uBACA,wBACA,eACA,iBACC;;iBA6Ba,qBAAqB,MAAM,YAAY;;;;;;;iBAoDvC,sBACd,MAAM,KACJ,kJAUF,mBACA,oBACA,eACA,iBACC,QAAQ;iBAoFK,yBACd,OAAO,aACP,iBACC,YAAY;;;;;iBAwBC,YACd,MAAM,KAAK,+BACX,SAAS,KAAK,+BACd,kBACA,mBACC,QAAQ,KAAK;KASX,OAAO,KAAK;;;;;iBAmJD,gCACd,OAAO,aACP,gBACA,YAAY,MACZ,WAAW,MACX,WAAW,oBAAoB,kBAC9B,YAAY,QAAQ"}
1
+ {"version":3,"file":"resize.d.ts","names":[],"sources":["../src/resize.ts"],"mappings":";;;;;;;;cA0BM;YAiBM,iBAAiB,KAAK,mBAAmB;UAC3C;WACC;EACT,QAAQ,aAAa;;;YAeX,kBAAkB;EAAS;EAAkB;;;wBAkDzC,iBACd,QAAQ,MACR,MAAM,KAAK,2BACX,YAAY,gBACZ,UAAU,iBACT;;;;;wBA4Ba,qBACd,OAAO,MACP,cAAc,KAAK,2BACnB,aAAa,KAAK,2BAClB,YAAY,gBACZ,UAAU,gBACV,8BACC;wBAca,gBACd,OAAO,MACP,cAAc,KAAK,2BACnB,aAAa,KAAK,4BACjB;wBASa,4BACd,eAAe,sBACf,uBACA,wBACA,eACA,iBACC;;wBA6Ba,qBAAqB,MAAM,YAAY;;;;;;;wBAoDvC,sBACd,MAAM,KACJ,kJAUF,mBACA,oBACA,eACA,iBACC,QAAQ;;;;;;wBAyFK,qBAAqB,MAAM,YAAY;wBAIvC,yBACd,OAAO,aACP,gBACA,YAAW,MAAM,cAAc,iBAC9B,YAAY;;;;;wBAwBC,YACd,MAAM,KAAK,+BACX,SAAS,KAAK,+BACd,kBACA,mBACC,QAAQ,KAAK;KASX,OAAO,KAAK;;;;;wBAmJD,gCACd,OAAO,aACP,gBACA,YAAY,MACZ,WAAW,MACX,WAAW,oBAAoB,kBAC9B,YAAY,QAAQ"}
package/dist/resize.js CHANGED
@@ -1,12 +1,35 @@
1
- import Matrix from "./matrix.js";
2
- import { FITTED_CONTAINER_TYPES } from "./node-defaults.js";
1
+ import { pick } from "es-toolkit/object";
2
+ import { CONSTRAINT_PARENT_TYPES } from "./constraints.js";
3
3
  import { getNodeLocalMatrix } from "./coordinate.js";
4
4
  import { cloneVectorNetwork, copyDerivedGlyphs, copyGeometryPaths, copyStroke, copyStrokes, scaleGeometryPaths } from "./copy.js";
5
- import { CONSTRAINT_PARENT_TYPES } from "./constraints.js";
6
5
  import { groupFitChanges } from "./group-bounds.js";
7
6
  import { enforcedAspectRatio } from "./layout/aspect-ratio.js";
7
+ import Matrix from "./matrix.js";
8
+ import { FITTED_CONTAINER_TYPES } from "./node-defaults.js";
8
9
  import { followsPath } from "./text/path.js";
9
- //#region src/resize.ts
10
+ // src/resize.ts
11
+ /**
12
+ * Drag-start state a live resize re-scales from. Path text needs more than the
13
+ * layout rect: its OUTSIDE stroke silhouettes and glyph outlines are baked
14
+ * geometry that must scale with the node, and textPathBox is the layout box the
15
+ * glyphs were reflowed against.
16
+ */
17
+ const RESIZE_SNAPSHOT_FIELDS = [
18
+ "type",
19
+ "x",
20
+ "y",
21
+ "width",
22
+ "height",
23
+ "flipX",
24
+ "flipY",
25
+ "vectorNetwork",
26
+ "fillGeometry",
27
+ "strokeGeometry",
28
+ "derivedTextGlyphs",
29
+ "strokes",
30
+ "textPathData",
31
+ "textPathBox"
32
+ ];
10
33
  /**
11
34
  * Containers whose resize moves their children: the constraint parents, and groups and booleans,
12
35
  * which scale theirs.
@@ -253,7 +276,15 @@ function constrainedGeometryChanges(orig, current, box) {
253
276
  if (scalesGeometry(orig, box)) return scaledGeometryChanges(orig, orig.width, orig.height, box.width, box.height);
254
277
  return scalesGeometry(orig, current) ? snapshotGeometry(orig) : {};
255
278
  }
256
- function collectResizeDescendants(graph, rootId) {
279
+ /**
280
+ * A node's resize state holding its own geometry rather than copies of it. It stays the state the
281
+ * resize began from only while nothing edits that geometry in place, as a resize plan does not:
282
+ * it writes new paths and outlines.
283
+ */
284
+ function sharedResizeSnapshot(node) {
285
+ return pick(node, RESIZE_SNAPSHOT_FIELDS);
286
+ }
287
+ function collectResizeDescendants(graph, rootId, snapshot = createResizeSnapshot) {
257
288
  const root = graph.getNode(rootId);
258
289
  if (!root || !CONSTRAINT_CONTAINER_TYPES.has(root.type)) return null;
259
290
  const snapshots = /* @__PURE__ */ new Map();
@@ -263,7 +294,7 @@ function collectResizeDescendants(graph, rootId) {
263
294
  for (const childId of parent.childIds) {
264
295
  const child = graph.getNode(childId);
265
296
  if (!child) continue;
266
- snapshots.set(childId, createResizeSnapshot(child));
297
+ snapshots.set(childId, snapshot(child));
267
298
  collect(childId);
268
299
  }
269
300
  };
@@ -415,7 +446,6 @@ function computeConstrainedResizeChanges(graph, rootId, rootBefore, rootAfter, o
415
446
  placeChildren(plan, rootId, rootBefore, rootAfter);
416
447
  return plan.changes;
417
448
  }
418
- //#endregion
419
- export { collectResizeDescendants, computeConstrainedResizeChanges, constrainedChildRect, createResizeSnapshot, flipChanges, resizedChildRect, scaleVectorNetworkForResize, scaledChildRect, scaledGeometryChanges };
449
+ export { collectResizeDescendants, computeConstrainedResizeChanges, constrainedChildRect, createResizeSnapshot, flipChanges, resizedChildRect, scaleVectorNetworkForResize, scaledChildRect, scaledGeometryChanges, sharedResizeSnapshot };
420
450
 
421
451
  //# sourceMappingURL=resize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resize.js","names":[],"sources":["../src/resize.ts"],"sourcesContent":["import { CONSTRAINT_PARENT_TYPES } from './constraints'\nimport { getNodeLocalMatrix } from './coordinate'\nimport {\n cloneVectorNetwork,\n copyDerivedGlyphs,\n copyGeometryPaths,\n copyStroke,\n copyStrokes,\n scaleGeometryPaths\n} from './copy'\nimport { groupFitChanges } from './group-bounds'\nimport { enforcedAspectRatio } from './layout/aspect-ratio'\nimport Matrix, { type Mat3 } from './matrix'\nimport { FITTED_CONTAINER_TYPES } from './node-defaults'\nimport type { Rect } from './primitives'\nimport { followsPath } from './text/path'\nimport type { ConstraintType, DerivedTextGlyph, SceneNode, Stroke, VectorNetwork } from './types'\n\n/**\n * Drag-start state a live resize re-scales from. Path text needs more than the\n * layout rect: its OUTSIDE stroke silhouettes and glyph outlines are baked\n * geometry that must scale with the node, and textPathBox is the layout box the\n * glyphs were reflowed against.\n */\nexport type ResizeSnapshot = Pick<\n SceneNode,\n | 'type'\n | 'x'\n | 'y'\n | 'width'\n | 'height'\n | 'flipX'\n | 'flipY'\n | 'vectorNetwork'\n | 'fillGeometry'\n | 'strokeGeometry'\n | 'derivedTextGlyphs'\n | 'strokes'\n | 'textPathData'\n | 'textPathBox'\n>\n\ninterface ResizeGraph {\n readonly rootId: string\n getNode(id: string): SceneNode | undefined\n}\n\n/**\n * Containers whose resize moves their children: the constraint parents, and groups and booleans,\n * which scale theirs.\n */\nconst CONSTRAINT_CONTAINER_TYPES = new Set<SceneNode['type']>([\n ...CONSTRAINT_PARENT_TYPES,\n ...FITTED_CONTAINER_TYPES\n])\n\ntype AxisPlacement = { position: number; size: number; flipped?: boolean }\n\n/** A child's box after its parent resizes, and the axes on which it turned over. */\nexport type ConstrainedRect = Rect & { flipsX?: boolean; flipsY?: boolean }\n\n/**\n * Where a constraint places a child on one axis when its parent goes from `parentBefore` to\n * `parentAfter`, as Figma does (live-measured, #1060, #1816): Right and Left & right move or grow\n * it by the change in the parent's size rounded to whole pixels, Center by the change in its\n * rounded half, and Scale by the exact ratio. The child's own box is never rounded, so a resize\n * to the same size changes nothing. Left & right that would leave no size keeps the axis as it\n * was; past zero, the child turns over and its box runs back from the edge it was pinned to, as\n * the layer is mirrored in Figma.\n */\nfunction constrainedAxis(\n position: number,\n size: number,\n parentBefore: number,\n parentAfter: number,\n constraint: ConstraintType\n): AxisPlacement {\n const delta = Math.round(parentAfter) - Math.round(parentBefore)\n if (constraint === 'MAX') return { position: position + delta, size }\n if (constraint === 'CENTER') {\n return { position: position + Math.round(parentAfter / 2) - Math.round(parentBefore / 2), size }\n }\n if (constraint === 'STRETCH') {\n const stretched = size + delta\n if (stretched === 0) return { position, size }\n if (stretched > 0) return { position, size: stretched }\n return { position: position + stretched, size: -stretched, flipped: true }\n }\n if (constraint === 'SCALE' && parentBefore > 0) {\n const scale = parentAfter / parentBefore\n return { position: position * scale, size: size * scale }\n }\n return { position, size }\n}\n\nconst FLEXIBLE_CONSTRAINTS: ReadonlySet<ConstraintType> = new Set(['STRETCH', 'SCALE'])\n\n/** The axis at `size`, keeping the edge or centre its constraint pins where it was placed. */\nfunction resizedInPlace(\n placed: AxisPlacement,\n size: number,\n constraint: ConstraintType\n): AxisPlacement {\n if (constraint === 'MAX') return { position: placed.position + placed.size - size, size }\n if (constraint === 'CENTER') return { position: placed.position + (placed.size - size) / 2, size }\n return { position: placed.position, size }\n}\n\n/** Keep a placed box's constrained edges or center when its content determines its size. */\nexport function resizedChildRect(\n placed: Rect,\n size: Pick<Rect, 'width' | 'height'>,\n horizontal: ConstraintType,\n vertical: ConstraintType\n): Rect {\n const x = resizedInPlace({ position: placed.x, size: placed.width }, size.width, horizontal)\n const y = resizedInPlace({ position: placed.y, size: placed.height }, size.height, vertical)\n return { x: x.position, y: y.position, width: x.size, height: y.size }\n}\n\n/**\n * A locked aspect ratio holds when exactly one axis follows the parent, as in Figma: that axis\n * sizes the other. With both axes following the parent, or neither, the ratio gives way.\n */\nfunction keepLockedRatio(\n x: AxisPlacement,\n y: AxisPlacement,\n horizontal: ConstraintType,\n vertical: ConstraintType,\n aspectRatio: number | null\n): { x: AxisPlacement; y: AxisPlacement } {\n const flexibleX = FLEXIBLE_CONSTRAINTS.has(horizontal)\n if (aspectRatio === null || flexibleX === FLEXIBLE_CONSTRAINTS.has(vertical)) return { x, y }\n return flexibleX\n ? { x, y: resizedInPlace(y, x.size / aspectRatio, vertical) }\n : { x: resizedInPlace(x, y.size * aspectRatio, horizontal), y }\n}\n\n/**\n * A child's box after its parent resizes, by a handle, `resize()`, layout, or an instance taking\n * another size than its component, keeping a locked aspect ratio as Figma does.\n */\nexport function constrainedChildRect(\n child: Rect,\n parentBefore: Pick<Rect, 'width' | 'height'>,\n parentAfter: Pick<Rect, 'width' | 'height'>,\n horizontal: ConstraintType,\n vertical: ConstraintType,\n aspectRatio: number | null = null\n): ConstrainedRect {\n const { x, y } = keepLockedRatio(\n constrainedAxis(child.x, child.width, parentBefore.width, parentAfter.width, horizontal),\n constrainedAxis(child.y, child.height, parentBefore.height, parentAfter.height, vertical),\n horizontal,\n vertical,\n aspectRatio\n )\n const rect: ConstrainedRect = { x: x.position, y: y.position, width: x.size, height: y.size }\n if (x.flipped) rect.flipsX = true\n if (y.flipped) rect.flipsY = true\n return rect\n}\n\nexport function scaledChildRect(\n child: Rect,\n parentBefore: Pick<Rect, 'width' | 'height'>,\n parentAfter: Pick<Rect, 'width' | 'height'>\n): Rect {\n return constrainedChildRect(child, parentBefore, parentAfter, 'SCALE', 'SCALE')\n}\n\n/** How much a side grows; a flat side, as a straight line's, has nothing to scale along it. */\nfunction sideScale(original: number, size: number): number {\n return original > 0 ? size / original : 1\n}\n\nexport function scaleVectorNetworkForResize(\n vectorNetwork: VectorNetwork | null,\n originalWidth: number,\n originalHeight: number,\n width: number,\n height: number\n): VectorNetwork | null {\n if (!vectorNetwork || (originalWidth <= 0 && originalHeight <= 0)) return null\n\n const scaleX = sideScale(originalWidth, width)\n const scaleY = sideScale(originalHeight, height)\n if (scaleX === 1 && scaleY === 1) return null\n\n return {\n vertices: vectorNetwork.vertices.map((vertex) => ({\n ...vertex,\n x: vertex.x * scaleX,\n y: vertex.y * scaleY\n })),\n segments: vectorNetwork.segments.map((segment) => ({\n ...segment,\n tangentStart: {\n x: segment.tangentStart.x * scaleX,\n y: segment.tangentStart.y * scaleY\n },\n tangentEnd: {\n x: segment.tangentEnd.x * scaleX,\n y: segment.tangentEnd.y * scaleY\n }\n })),\n regions: vectorNetwork.regions\n }\n}\n\n/** Snapshot one node's resize-relevant state (rect + geometry that must scale with it). */\nexport function createResizeSnapshot(node: SceneNode): ResizeSnapshot {\n return {\n type: node.type,\n x: node.x,\n y: node.y,\n width: node.width,\n height: node.height,\n flipX: node.flipX,\n flipY: node.flipY,\n vectorNetwork: node.vectorNetwork ? cloneVectorNetwork(node.vectorNetwork) : null,\n fillGeometry: copyGeometryPaths(node.fillGeometry),\n strokeGeometry: copyGeometryPaths(node.strokeGeometry),\n derivedTextGlyphs: copyDerivedGlyphs(node.derivedTextGlyphs),\n strokes: copyStrokes(node.strokes),\n textPathData: node.textPathData ? structuredClone(node.textPathData) : null,\n textPathBox: node.textPathBox ? { ...node.textPathBox } : null\n }\n}\n\nfunction scaleDerivedGlyphs(\n glyphs: DerivedTextGlyph[] | null,\n sx: number,\n sy: number\n): DerivedTextGlyph[] | null {\n if (!glyphs?.length) return glyphs\n return glyphs.map((g) => ({\n ...g,\n x: g.x * sx,\n y: g.y * sy,\n scaleX: (g.scaleX ?? 1) * sx,\n scaleY: (g.scaleY ?? 1) * sy,\n commandsBlob: new Uint8Array(g.commandsBlob)\n }))\n}\n\nfunction hasPath(orig: Pick<ResizeSnapshot, 'vectorNetwork'>): boolean {\n return (orig.vectorNetwork?.segments.length ?? 0) > 0\n}\n\nfunction scaleStrokes(strokes: Stroke[], sx: number, sy: number): Stroke[] {\n if (strokes.length === 0) return strokes\n // Weight is a scalar; average scale is the usual 2D → 1D compromise.\n const weightScale = (Math.abs(sx) + Math.abs(sy)) / 2\n return strokes.map((s) => ({ ...copyStroke(s), weight: s.weight * weightScale }))\n}\n\n/**\n * All geometry that must track a width/height change. Historically only\n * vectorNetwork + fillGeometry were updated — path-text strokeGeometry and\n * glyphs stayed at the pre-resize size, so shrinking a sticker made the white\n * OUTSIDE outlines look massively thick (DomeSticker resize bug).\n */\nexport function scaledGeometryChanges(\n orig: Pick<\n ResizeSnapshot,\n | 'type'\n | 'vectorNetwork'\n | 'fillGeometry'\n | 'strokeGeometry'\n | 'derivedTextGlyphs'\n | 'strokes'\n | 'textPathData'\n | 'textPathBox'\n >,\n origWidth: number,\n origHeight: number,\n width: number,\n height: number\n): Partial<SceneNode> {\n if (origWidth <= 0 && origHeight <= 0) return {}\n // A straight line's other side still scales.\n const sx = sideScale(origWidth, width)\n const sy = sideScale(origHeight, height)\n if (sx === 1 && sy === 1) return {}\n\n const changes: Partial<SceneNode> = {}\n const resizedVN = scaleVectorNetworkForResize(\n orig.vectorNetwork,\n origWidth,\n origHeight,\n width,\n height\n )\n if (resizedVN) changes.vectorNetwork = resizedVN\n\n if (orig.fillGeometry.length > 0) {\n changes.fillGeometry = scaleGeometryPaths(orig.fillGeometry, sx, sy)\n }\n // A stroke keeps its weight through a resize, as in Figma, so a saved stroke outline goes where\n // the stroke can be drawn again at its weight: from a path, or from a shape's own outline.\n // Text and a vector with only its outline keep scaling the outline, which is all they have.\n const outlineOnly = orig.type === 'TEXT' || (orig.type === 'VECTOR' && !hasPath(orig))\n if (orig.strokeGeometry.length > 0) {\n changes.strokeGeometry = outlineOnly ? scaleGeometryPaths(orig.strokeGeometry, sx, sy) : []\n }\n // Path text scales with its path, including baked path text that kept only rotated glyphs;\n // other text reflows in the new box, so its glyphs are dropped.\n const pathText = followsPath(orig)\n if (pathText) {\n changes.derivedTextGlyphs = scaleDerivedGlyphs(orig.derivedTextGlyphs, sx, sy)\n // Keep the layout/selection box in sync with the scaled glyphs. reflow\n // overrides this when it applies; this covers the fallback where reflow\n // returns null (no path data) so the box doesn't carry a stale size.\n if (orig.textPathBox) {\n changes.textPathBox = {\n x: orig.textPathBox.x * sx,\n y: orig.textPathBox.y * sy,\n width: orig.textPathBox.width * sx,\n height: orig.textPathBox.height * sy\n }\n }\n }\n // Glyphs scaled as a picture take their strokes along; any other stroke keeps its weight, as\n // Figma reports it, even where only a scaled outline can draw it.\n if (orig.strokes.length > 0 && pathText) {\n changes.strokes = scaleStrokes(orig.strokes, sx, sy)\n }\n return changes\n}\n\n/** Copies of the geometry a resize may change, as the snapshot held it before the resize. */\nfunction snapshotGeometry(orig: ResizeSnapshot): Partial<SceneNode> {\n return {\n vectorNetwork: orig.vectorNetwork ? cloneVectorNetwork(orig.vectorNetwork) : null,\n fillGeometry: copyGeometryPaths(orig.fillGeometry),\n strokeGeometry: copyGeometryPaths(orig.strokeGeometry),\n derivedTextGlyphs: copyDerivedGlyphs(orig.derivedTextGlyphs),\n strokes: copyStrokes(orig.strokes),\n textPathBox: orig.textPathBox ? { ...orig.textPathBox } : null\n }\n}\n\n/** Whether a box of `size` scales the snapshot's geometry, a flat side left out. */\nfunction scalesGeometry(orig: ResizeSnapshot, size: Pick<Rect, 'width' | 'height'>): boolean {\n return sideScale(orig.width, size.width) !== 1 || sideScale(orig.height, size.height) !== 1\n}\n\n/**\n * A child's geometry for its constrained `box`, scaled from the snapshot. At a box that scales\n * nothing, after an earlier frame of the same drag scaled it, the child takes its snapshot\n * geometry again, as nothing else would undo that scaling.\n */\nfunction constrainedGeometryChanges(\n orig: ResizeSnapshot,\n current: Pick<SceneNode, 'width' | 'height'>,\n box: Pick<Rect, 'width' | 'height'>\n): Partial<SceneNode> {\n if (scalesGeometry(orig, box))\n return scaledGeometryChanges(orig, orig.width, orig.height, box.width, box.height)\n return scalesGeometry(orig, current) ? snapshotGeometry(orig) : {}\n}\n\nexport function collectResizeDescendants(\n graph: ResizeGraph,\n rootId: string\n): Map<string, ResizeSnapshot> | null {\n const root = graph.getNode(rootId)\n if (!root || !CONSTRAINT_CONTAINER_TYPES.has(root.type)) return null\n const snapshots = new Map<string, ResizeSnapshot>()\n\n const collect = (parentId: string) => {\n const parent = graph.getNode(parentId)\n if (!parent) return\n for (const childId of parent.childIds) {\n const child = graph.getNode(childId)\n if (!child) continue\n snapshots.set(childId, createResizeSnapshot(child))\n collect(childId)\n }\n }\n\n collect(rootId)\n return snapshots.size > 0 ? snapshots : null\n}\n\n/**\n * The flips a child takes when its constraints place it from `from`, written only where they\n * differ from the ones it has now, so a drag that crosses back undoes its own turn.\n */\nexport function flipChanges(\n from: Pick<SceneNode, 'flipX' | 'flipY'>,\n current: Pick<SceneNode, 'flipX' | 'flipY'>,\n flipsX = false,\n flipsY = false\n): Partial<Pick<SceneNode, 'flipX' | 'flipY'>> {\n const changes: Partial<Pick<SceneNode, 'flipX' | 'flipY'>> = {}\n const flipX = from.flipX !== flipsX\n const flipY = from.flipY !== flipsY\n if (flipX !== current.flipX) changes.flipX = flipX\n if (flipY !== current.flipY) changes.flipY = flipY\n return changes\n}\n\ntype Size = Pick<Rect, 'width' | 'height'>\n\n/** One constrained resize: the graph, where each layer was when it began, and what it changes. */\ninterface ResizePlan {\n graph: ResizeGraph\n originals: ReadonlyMap<string, ResizeSnapshot>\n changes: Map<string, Partial<SceneNode>>\n}\n\n/** The layer as the resize found it, or as the resize leaves it with its changes so far. */\nfunction startOf(plan: ResizePlan, id: string): SceneNode | undefined {\n const node = plan.graph.getNode(id)\n const original = plan.originals.get(id)\n return node && original ? { ...node, ...original } : node\n}\n\nfunction plannedOf(plan: ResizePlan, id: string): SceneNode | undefined {\n const node = startOf(plan, id)\n const changes = plan.changes.get(id)\n return node && changes ? { ...node, ...changes } : node\n}\n\nfunction mergeChanges(plan: ResizePlan, id: string, changes: Partial<SceneNode>) {\n plan.changes.set(id, { ...plan.changes.get(id), ...changes })\n}\n\n/** Writes where a layer's constraints put it, then places its own children. */\nfunction placeConstrained(\n plan: ResizePlan,\n child: SceneNode,\n original: ResizeSnapshot,\n rect: ConstrainedRect,\n toParent: Mat3 | null\n) {\n const { flipsX, flipsY, ...box } = rect\n const position = toParent ? Matrix.mapPoint(toParent, box) : box\n plan.changes.set(child.id, {\n ...box,\n ...position,\n ...flipChanges(original, child, flipsX, flipsY),\n ...constrainedGeometryChanges(original, child, box)\n })\n // The final pass sees layout containers after layout has resolved HUG/FILL sizing.\n placeChildren(plan, child.id, original, child.layoutMode === 'NONE' ? box : child)\n}\n\n/**\n * Places the layers in a group or boolean whose frame resized. The group owns no constraints: each\n * layer in it keeps its place in the frame by its own, through nested groups, and the groups then\n * fit around them, as in Figma (live, #1835). A layer is placed in the frame's space and written\n * back in its group's.\n */\nfunction placeGroupedLayers(\n plan: ResizePlan,\n group: SceneNode,\n toFrame: Mat3,\n frameBefore: Size,\n frameAfter: Size\n) {\n for (const childId of group.childIds) {\n const child = plan.graph.getNode(childId)\n const original = plan.originals.get(childId)\n const start = startOf(plan, childId)\n if (!child || !original || !start) continue\n if (FITTED_CONTAINER_TYPES.has(child.type)) {\n const inner = Matrix.multiply(toFrame, getNodeLocalMatrix(start))\n placeGroupedLayers(plan, start, inner, frameBefore, frameAfter)\n continue\n }\n const inFrame = Matrix.mapPoint(toFrame, original)\n const rect = constrainedChildRect(\n { ...inFrame, width: original.width, height: original.height },\n frameBefore,\n frameAfter,\n child.horizontalConstraint,\n child.verticalConstraint,\n enforcedAspectRatio(child)\n )\n placeConstrained(plan, child, original, rect, Matrix.invert(toFrame))\n }\n fitPlannedGroup(plan, group.id)\n}\n\nconst PLACEMENT_KEYS = ['x', 'y', 'width', 'height'] as const\n\n/**\n * Fits a group to its layers where the resize put them, when any of them moved: a boolean's box\n * is its result's, which only the renderer measures, so one whose operands stay keeps its box. A\n * drag places from the start each time, so the group's box is always written.\n */\nfunction fitPlannedGroup(plan: ResizePlan, groupId: string) {\n const group = plannedOf(plan, groupId)\n if (!group) return\n const { x, y, width, height } = group\n mergeChanges(plan, groupId, { x, y, width, height })\n const moved = group.childIds.some((id) => {\n const start = startOf(plan, id)\n const planned = plannedOf(plan, id)\n return start && planned && PLACEMENT_KEYS.some((key) => start[key] !== planned[key])\n })\n if (!moved) return\n const reader = { rootId: plan.graph.rootId, getNode: (id: string) => plannedOf(plan, id) }\n const children = group.childIds.flatMap((id) => reader.getNode(id) ?? [])\n const fit = groupFitChanges(reader, group, children)\n for (const [id, changes] of fit ?? []) mergeChanges(plan, id, changes)\n}\n\n/**\n * Places the children of a layer that went from `parentBefore` to `parentAfter`: a frame's by their\n * constraints, the layers in its groups and booleans by theirs, a group's or boolean's own scaled.\n */\nfunction placeChildren(plan: ResizePlan, parentId: string, parentBefore: Size, parentAfter: Size) {\n const parent = plan.graph.getNode(parentId)\n if (!parent) return\n const scalesChildren = FITTED_CONTAINER_TYPES.has(parent.type)\n for (const childId of parent.childIds) {\n const original = plan.originals.get(childId)\n const child = plan.graph.getNode(childId)\n if (!original || !child) continue\n const isInFlow = parent.layoutMode !== 'NONE' && child.layoutPositioning !== 'ABSOLUTE'\n if (isInFlow) {\n placeChildren(plan, childId, original, child)\n continue\n }\n if (!scalesChildren && FITTED_CONTAINER_TYPES.has(child.type)) {\n const start = { ...child, ...original }\n placeGroupedLayers(plan, start, getNodeLocalMatrix(start), parentBefore, parentAfter)\n continue\n }\n const rect: ConstrainedRect = scalesChildren\n ? scaledChildRect(original, parentBefore, parentAfter)\n : constrainedChildRect(\n original,\n parentBefore,\n parentAfter,\n child.horizontalConstraint,\n child.verticalConstraint,\n enforcedAspectRatio(child)\n )\n placeConstrained(plan, child, original, rect, null)\n }\n}\n\n/**\n * Where the descendants of a layer go when it resizes from `rootBefore` to `rootAfter`, from the\n * places `originals` recorded.\n */\nexport function computeConstrainedResizeChanges(\n graph: ResizeGraph,\n rootId: string,\n rootBefore: Size,\n rootAfter: Size,\n originals: ReadonlyMap<string, ResizeSnapshot>\n): Map<string, Partial<SceneNode>> {\n const plan: ResizePlan = { graph, originals, changes: new Map() }\n placeChildren(plan, rootId, rootBefore, rootAfter)\n return plan.changes\n}\n"],"mappings":";;;;;;;;;;;;;AAmDA,MAAM,6CAA6B,IAAI,IAAuB,CAC5D,GAAG,yBACH,GAAG,sBACL,C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B;CAChG,MAAM,SAAS,KAAK,MAAM,QAAQ,QAAQ;CAC1C,IAAI,CAAC,QAAQ;CACb,MAAM,iBAAiB,uBAAuB,IAAI,OAAO,IAAI;CAC7D,KAAK,MAAM,WAAW,OAAO,UAAU;EACrC,MAAM,WAAW,KAAK,UAAU,IAAI,OAAO;EAC3C,MAAM,QAAQ,KAAK,MAAM,QAAQ,OAAO;EACxC,IAAI,CAAC,YAAY,CAAC,OAAO;EAEzB,IADiB,OAAO,eAAe,UAAU,MAAM,sBAAsB,YAC/D;GACZ,cAAc,MAAM,SAAS,UAAU,KAAK;GAC5C;EACF;EACA,IAAI,CAAC,kBAAkB,uBAAuB,IAAI,MAAM,IAAI,GAAG;GAC7D,MAAM,QAAQ;IAAE,GAAG;IAAO,GAAG;GAAS;GACtC,mBAAmB,MAAM,OAAO,mBAAmB,KAAK,GAAG,cAAc,WAAW;GACpF;EACF;EAWA,iBAAiB,MAAM,OAAO,UAVA,iBAC1B,gBAAgB,UAAU,cAAc,WAAW,IACnD,qBACE,UACA,cACA,aACA,MAAM,sBACN,MAAM,oBACN,oBAAoB,KAAK,CAC3B,GAC0C,IAAI;CACpD;AACF;;;;;AAMA,SAAgB,gCACd,OACA,QACA,YACA,WACA,WACiC;CACjC,MAAM,OAAmB;EAAE;EAAO;EAAW,yBAAS,IAAI,IAAI;CAAE;CAChE,cAAc,MAAM,QAAQ,YAAY,SAAS;CACjD,OAAO,KAAK;AACd"}
1
+ {"version":3,"file":"resize.js","names":[],"sources":["../src/resize.ts"],"sourcesContent":["import { pick } from 'es-toolkit/object'\n\nimport { CONSTRAINT_PARENT_TYPES } from './constraints'\nimport { getNodeLocalMatrix } from './coordinate'\nimport {\n cloneVectorNetwork,\n copyDerivedGlyphs,\n copyGeometryPaths,\n copyStroke,\n copyStrokes,\n scaleGeometryPaths\n} from './copy'\nimport { groupFitChanges } from './group-bounds'\nimport { enforcedAspectRatio } from './layout/aspect-ratio'\nimport Matrix, { type Mat3 } from './matrix'\nimport { FITTED_CONTAINER_TYPES } from './node-defaults'\nimport type { Rect } from './primitives'\nimport { followsPath } from './text/path'\nimport type { ConstraintType, DerivedTextGlyph, SceneNode, Stroke, VectorNetwork } from './types'\n\n/**\n * Drag-start state a live resize re-scales from. Path text needs more than the\n * layout rect: its OUTSIDE stroke silhouettes and glyph outlines are baked\n * geometry that must scale with the node, and textPathBox is the layout box the\n * glyphs were reflowed against.\n */\nconst RESIZE_SNAPSHOT_FIELDS = [\n 'type',\n 'x',\n 'y',\n 'width',\n 'height',\n 'flipX',\n 'flipY',\n 'vectorNetwork',\n 'fillGeometry',\n 'strokeGeometry',\n 'derivedTextGlyphs',\n 'strokes',\n 'textPathData',\n 'textPathBox'\n] as const satisfies readonly (keyof SceneNode)[]\n\nexport type ResizeSnapshot = Pick<SceneNode, (typeof RESIZE_SNAPSHOT_FIELDS)[number]>\ninterface ResizeGraph {\n readonly rootId: string\n getNode(id: string): SceneNode | undefined\n}\n\n/**\n * Containers whose resize moves their children: the constraint parents, and groups and booleans,\n * which scale theirs.\n */\nconst CONSTRAINT_CONTAINER_TYPES = new Set<SceneNode['type']>([\n ...CONSTRAINT_PARENT_TYPES,\n ...FITTED_CONTAINER_TYPES\n])\n\ntype AxisPlacement = { position: number; size: number; flipped?: boolean }\n\n/** A child's box after its parent resizes, and the axes on which it turned over. */\nexport type ConstrainedRect = Rect & { flipsX?: boolean; flipsY?: boolean }\n\n/**\n * Where a constraint places a child on one axis when its parent goes from `parentBefore` to\n * `parentAfter`, as Figma does (live-measured, #1060, #1816): Right and Left & right move or grow\n * it by the change in the parent's size rounded to whole pixels, Center by the change in its\n * rounded half, and Scale by the exact ratio. The child's own box is never rounded, so a resize\n * to the same size changes nothing. Left & right that would leave no size keeps the axis as it\n * was; past zero, the child turns over and its box runs back from the edge it was pinned to, as\n * the layer is mirrored in Figma.\n */\nfunction constrainedAxis(\n position: number,\n size: number,\n parentBefore: number,\n parentAfter: number,\n constraint: ConstraintType\n): AxisPlacement {\n const delta = Math.round(parentAfter) - Math.round(parentBefore)\n if (constraint === 'MAX') return { position: position + delta, size }\n if (constraint === 'CENTER') {\n return { position: position + Math.round(parentAfter / 2) - Math.round(parentBefore / 2), size }\n }\n if (constraint === 'STRETCH') {\n const stretched = size + delta\n if (stretched === 0) return { position, size }\n if (stretched > 0) return { position, size: stretched }\n return { position: position + stretched, size: -stretched, flipped: true }\n }\n if (constraint === 'SCALE' && parentBefore > 0) {\n const scale = parentAfter / parentBefore\n return { position: position * scale, size: size * scale }\n }\n return { position, size }\n}\n\nconst FLEXIBLE_CONSTRAINTS: ReadonlySet<ConstraintType> = new Set(['STRETCH', 'SCALE'])\n\n/** The axis at `size`, keeping the edge or centre its constraint pins where it was placed. */\nfunction resizedInPlace(\n placed: AxisPlacement,\n size: number,\n constraint: ConstraintType\n): AxisPlacement {\n if (constraint === 'MAX') return { position: placed.position + placed.size - size, size }\n if (constraint === 'CENTER') return { position: placed.position + (placed.size - size) / 2, size }\n return { position: placed.position, size }\n}\n\n/** Keep a placed box's constrained edges or center when its content determines its size. */\nexport function resizedChildRect(\n placed: Rect,\n size: Pick<Rect, 'width' | 'height'>,\n horizontal: ConstraintType,\n vertical: ConstraintType\n): Rect {\n const x = resizedInPlace({ position: placed.x, size: placed.width }, size.width, horizontal)\n const y = resizedInPlace({ position: placed.y, size: placed.height }, size.height, vertical)\n return { x: x.position, y: y.position, width: x.size, height: y.size }\n}\n\n/**\n * A locked aspect ratio holds when exactly one axis follows the parent, as in Figma: that axis\n * sizes the other. With both axes following the parent, or neither, the ratio gives way.\n */\nfunction keepLockedRatio(\n x: AxisPlacement,\n y: AxisPlacement,\n horizontal: ConstraintType,\n vertical: ConstraintType,\n aspectRatio: number | null\n): { x: AxisPlacement; y: AxisPlacement } {\n const flexibleX = FLEXIBLE_CONSTRAINTS.has(horizontal)\n if (aspectRatio === null || flexibleX === FLEXIBLE_CONSTRAINTS.has(vertical)) return { x, y }\n return flexibleX\n ? { x, y: resizedInPlace(y, x.size / aspectRatio, vertical) }\n : { x: resizedInPlace(x, y.size * aspectRatio, horizontal), y }\n}\n\n/**\n * A child's box after its parent resizes, by a handle, `resize()`, layout, or an instance taking\n * another size than its component, keeping a locked aspect ratio as Figma does.\n */\nexport function constrainedChildRect(\n child: Rect,\n parentBefore: Pick<Rect, 'width' | 'height'>,\n parentAfter: Pick<Rect, 'width' | 'height'>,\n horizontal: ConstraintType,\n vertical: ConstraintType,\n aspectRatio: number | null = null\n): ConstrainedRect {\n const { x, y } = keepLockedRatio(\n constrainedAxis(child.x, child.width, parentBefore.width, parentAfter.width, horizontal),\n constrainedAxis(child.y, child.height, parentBefore.height, parentAfter.height, vertical),\n horizontal,\n vertical,\n aspectRatio\n )\n const rect: ConstrainedRect = { x: x.position, y: y.position, width: x.size, height: y.size }\n if (x.flipped) rect.flipsX = true\n if (y.flipped) rect.flipsY = true\n return rect\n}\n\nexport function scaledChildRect(\n child: Rect,\n parentBefore: Pick<Rect, 'width' | 'height'>,\n parentAfter: Pick<Rect, 'width' | 'height'>\n): Rect {\n return constrainedChildRect(child, parentBefore, parentAfter, 'SCALE', 'SCALE')\n}\n\n/** How much a side grows; a flat side, as a straight line's, has nothing to scale along it. */\nfunction sideScale(original: number, size: number): number {\n return original > 0 ? size / original : 1\n}\n\nexport function scaleVectorNetworkForResize(\n vectorNetwork: VectorNetwork | null,\n originalWidth: number,\n originalHeight: number,\n width: number,\n height: number\n): VectorNetwork | null {\n if (!vectorNetwork || (originalWidth <= 0 && originalHeight <= 0)) return null\n\n const scaleX = sideScale(originalWidth, width)\n const scaleY = sideScale(originalHeight, height)\n if (scaleX === 1 && scaleY === 1) return null\n\n return {\n vertices: vectorNetwork.vertices.map((vertex) => ({\n ...vertex,\n x: vertex.x * scaleX,\n y: vertex.y * scaleY\n })),\n segments: vectorNetwork.segments.map((segment) => ({\n ...segment,\n tangentStart: {\n x: segment.tangentStart.x * scaleX,\n y: segment.tangentStart.y * scaleY\n },\n tangentEnd: {\n x: segment.tangentEnd.x * scaleX,\n y: segment.tangentEnd.y * scaleY\n }\n })),\n regions: vectorNetwork.regions\n }\n}\n\n/** Snapshot one node's resize-relevant state (rect + geometry that must scale with it). */\nexport function createResizeSnapshot(node: SceneNode): ResizeSnapshot {\n return {\n type: node.type,\n x: node.x,\n y: node.y,\n width: node.width,\n height: node.height,\n flipX: node.flipX,\n flipY: node.flipY,\n vectorNetwork: node.vectorNetwork ? cloneVectorNetwork(node.vectorNetwork) : null,\n fillGeometry: copyGeometryPaths(node.fillGeometry),\n strokeGeometry: copyGeometryPaths(node.strokeGeometry),\n derivedTextGlyphs: copyDerivedGlyphs(node.derivedTextGlyphs),\n strokes: copyStrokes(node.strokes),\n textPathData: node.textPathData ? structuredClone(node.textPathData) : null,\n textPathBox: node.textPathBox ? { ...node.textPathBox } : null\n }\n}\n\nfunction scaleDerivedGlyphs(\n glyphs: DerivedTextGlyph[] | null,\n sx: number,\n sy: number\n): DerivedTextGlyph[] | null {\n if (!glyphs?.length) return glyphs\n return glyphs.map((g) => ({\n ...g,\n x: g.x * sx,\n y: g.y * sy,\n scaleX: (g.scaleX ?? 1) * sx,\n scaleY: (g.scaleY ?? 1) * sy,\n commandsBlob: new Uint8Array(g.commandsBlob)\n }))\n}\n\nfunction hasPath(orig: Pick<ResizeSnapshot, 'vectorNetwork'>): boolean {\n return (orig.vectorNetwork?.segments.length ?? 0) > 0\n}\n\nfunction scaleStrokes(strokes: Stroke[], sx: number, sy: number): Stroke[] {\n if (strokes.length === 0) return strokes\n // Weight is a scalar; average scale is the usual 2D → 1D compromise.\n const weightScale = (Math.abs(sx) + Math.abs(sy)) / 2\n return strokes.map((s) => ({ ...copyStroke(s), weight: s.weight * weightScale }))\n}\n\n/**\n * All geometry that must track a width/height change. Historically only\n * vectorNetwork + fillGeometry were updated — path-text strokeGeometry and\n * glyphs stayed at the pre-resize size, so shrinking a sticker made the white\n * OUTSIDE outlines look massively thick (DomeSticker resize bug).\n */\nexport function scaledGeometryChanges(\n orig: Pick<\n ResizeSnapshot,\n | 'type'\n | 'vectorNetwork'\n | 'fillGeometry'\n | 'strokeGeometry'\n | 'derivedTextGlyphs'\n | 'strokes'\n | 'textPathData'\n | 'textPathBox'\n >,\n origWidth: number,\n origHeight: number,\n width: number,\n height: number\n): Partial<SceneNode> {\n if (origWidth <= 0 && origHeight <= 0) return {}\n // A straight line's other side still scales.\n const sx = sideScale(origWidth, width)\n const sy = sideScale(origHeight, height)\n if (sx === 1 && sy === 1) return {}\n\n const changes: Partial<SceneNode> = {}\n const resizedVN = scaleVectorNetworkForResize(\n orig.vectorNetwork,\n origWidth,\n origHeight,\n width,\n height\n )\n if (resizedVN) changes.vectorNetwork = resizedVN\n\n if (orig.fillGeometry.length > 0) {\n changes.fillGeometry = scaleGeometryPaths(orig.fillGeometry, sx, sy)\n }\n // A stroke keeps its weight through a resize, as in Figma, so a saved stroke outline goes where\n // the stroke can be drawn again at its weight: from a path, or from a shape's own outline.\n // Text and a vector with only its outline keep scaling the outline, which is all they have.\n const outlineOnly = orig.type === 'TEXT' || (orig.type === 'VECTOR' && !hasPath(orig))\n if (orig.strokeGeometry.length > 0) {\n changes.strokeGeometry = outlineOnly ? scaleGeometryPaths(orig.strokeGeometry, sx, sy) : []\n }\n // Path text scales with its path, including baked path text that kept only rotated glyphs;\n // other text reflows in the new box, so its glyphs are dropped.\n const pathText = followsPath(orig)\n if (pathText) {\n changes.derivedTextGlyphs = scaleDerivedGlyphs(orig.derivedTextGlyphs, sx, sy)\n // Keep the layout/selection box in sync with the scaled glyphs. reflow\n // overrides this when it applies; this covers the fallback where reflow\n // returns null (no path data) so the box doesn't carry a stale size.\n if (orig.textPathBox) {\n changes.textPathBox = {\n x: orig.textPathBox.x * sx,\n y: orig.textPathBox.y * sy,\n width: orig.textPathBox.width * sx,\n height: orig.textPathBox.height * sy\n }\n }\n }\n // Glyphs scaled as a picture take their strokes along; any other stroke keeps its weight, as\n // Figma reports it, even where only a scaled outline can draw it.\n if (orig.strokes.length > 0 && pathText) {\n changes.strokes = scaleStrokes(orig.strokes, sx, sy)\n }\n return changes\n}\n\n/** Copies of the geometry a resize may change, as the snapshot held it before the resize. */\nfunction snapshotGeometry(orig: ResizeSnapshot): Partial<SceneNode> {\n return {\n vectorNetwork: orig.vectorNetwork ? cloneVectorNetwork(orig.vectorNetwork) : null,\n fillGeometry: copyGeometryPaths(orig.fillGeometry),\n strokeGeometry: copyGeometryPaths(orig.strokeGeometry),\n derivedTextGlyphs: copyDerivedGlyphs(orig.derivedTextGlyphs),\n strokes: copyStrokes(orig.strokes),\n textPathBox: orig.textPathBox ? { ...orig.textPathBox } : null\n }\n}\n\n/** Whether a box of `size` scales the snapshot's geometry, a flat side left out. */\nfunction scalesGeometry(orig: ResizeSnapshot, size: Pick<Rect, 'width' | 'height'>): boolean {\n return sideScale(orig.width, size.width) !== 1 || sideScale(orig.height, size.height) !== 1\n}\n\n/**\n * A child's geometry for its constrained `box`, scaled from the snapshot. At a box that scales\n * nothing, after an earlier frame of the same drag scaled it, the child takes its snapshot\n * geometry again, as nothing else would undo that scaling.\n */\nfunction constrainedGeometryChanges(\n orig: ResizeSnapshot,\n current: Pick<SceneNode, 'width' | 'height'>,\n box: Pick<Rect, 'width' | 'height'>\n): Partial<SceneNode> {\n if (scalesGeometry(orig, box))\n return scaledGeometryChanges(orig, orig.width, orig.height, box.width, box.height)\n return scalesGeometry(orig, current) ? snapshotGeometry(orig) : {}\n}\n\n/**\n * A node's resize state holding its own geometry rather than copies of it. It stays the state the\n * resize began from only while nothing edits that geometry in place, as a resize plan does not:\n * it writes new paths and outlines.\n */\nexport function sharedResizeSnapshot(node: SceneNode): ResizeSnapshot {\n return pick(node, RESIZE_SNAPSHOT_FIELDS)\n}\n\nexport function collectResizeDescendants(\n graph: ResizeGraph,\n rootId: string,\n snapshot: (node: SceneNode) => ResizeSnapshot = createResizeSnapshot\n): Map<string, ResizeSnapshot> | null {\n const root = graph.getNode(rootId)\n if (!root || !CONSTRAINT_CONTAINER_TYPES.has(root.type)) return null\n const snapshots = new Map<string, ResizeSnapshot>()\n\n const collect = (parentId: string) => {\n const parent = graph.getNode(parentId)\n if (!parent) return\n for (const childId of parent.childIds) {\n const child = graph.getNode(childId)\n if (!child) continue\n snapshots.set(childId, snapshot(child))\n collect(childId)\n }\n }\n\n collect(rootId)\n return snapshots.size > 0 ? snapshots : null\n}\n\n/**\n * The flips a child takes when its constraints place it from `from`, written only where they\n * differ from the ones it has now, so a drag that crosses back undoes its own turn.\n */\nexport function flipChanges(\n from: Pick<SceneNode, 'flipX' | 'flipY'>,\n current: Pick<SceneNode, 'flipX' | 'flipY'>,\n flipsX = false,\n flipsY = false\n): Partial<Pick<SceneNode, 'flipX' | 'flipY'>> {\n const changes: Partial<Pick<SceneNode, 'flipX' | 'flipY'>> = {}\n const flipX = from.flipX !== flipsX\n const flipY = from.flipY !== flipsY\n if (flipX !== current.flipX) changes.flipX = flipX\n if (flipY !== current.flipY) changes.flipY = flipY\n return changes\n}\n\ntype Size = Pick<Rect, 'width' | 'height'>\n\n/** One constrained resize: the graph, where each layer was when it began, and what it changes. */\ninterface ResizePlan {\n graph: ResizeGraph\n originals: ReadonlyMap<string, ResizeSnapshot>\n changes: Map<string, Partial<SceneNode>>\n}\n\n/** The layer as the resize found it, or as the resize leaves it with its changes so far. */\nfunction startOf(plan: ResizePlan, id: string): SceneNode | undefined {\n const node = plan.graph.getNode(id)\n const original = plan.originals.get(id)\n return node && original ? { ...node, ...original } : node\n}\n\nfunction plannedOf(plan: ResizePlan, id: string): SceneNode | undefined {\n const node = startOf(plan, id)\n const changes = plan.changes.get(id)\n return node && changes ? { ...node, ...changes } : node\n}\n\nfunction mergeChanges(plan: ResizePlan, id: string, changes: Partial<SceneNode>) {\n plan.changes.set(id, { ...plan.changes.get(id), ...changes })\n}\n\n/** Writes where a layer's constraints put it, then places its own children. */\nfunction placeConstrained(\n plan: ResizePlan,\n child: SceneNode,\n original: ResizeSnapshot,\n rect: ConstrainedRect,\n toParent: Mat3 | null\n) {\n const { flipsX, flipsY, ...box } = rect\n const position = toParent ? Matrix.mapPoint(toParent, box) : box\n plan.changes.set(child.id, {\n ...box,\n ...position,\n ...flipChanges(original, child, flipsX, flipsY),\n ...constrainedGeometryChanges(original, child, box)\n })\n // The final pass sees layout containers after layout has resolved HUG/FILL sizing.\n placeChildren(plan, child.id, original, child.layoutMode === 'NONE' ? box : child)\n}\n\n/**\n * Places the layers in a group or boolean whose frame resized. The group owns no constraints: each\n * layer in it keeps its place in the frame by its own, through nested groups, and the groups then\n * fit around them, as in Figma (live, #1835). A layer is placed in the frame's space and written\n * back in its group's.\n */\nfunction placeGroupedLayers(\n plan: ResizePlan,\n group: SceneNode,\n toFrame: Mat3,\n frameBefore: Size,\n frameAfter: Size\n) {\n for (const childId of group.childIds) {\n const child = plan.graph.getNode(childId)\n const original = plan.originals.get(childId)\n const start = startOf(plan, childId)\n if (!child || !original || !start) continue\n if (FITTED_CONTAINER_TYPES.has(child.type)) {\n const inner = Matrix.multiply(toFrame, getNodeLocalMatrix(start))\n placeGroupedLayers(plan, start, inner, frameBefore, frameAfter)\n continue\n }\n const inFrame = Matrix.mapPoint(toFrame, original)\n const rect = constrainedChildRect(\n { ...inFrame, width: original.width, height: original.height },\n frameBefore,\n frameAfter,\n child.horizontalConstraint,\n child.verticalConstraint,\n enforcedAspectRatio(child)\n )\n placeConstrained(plan, child, original, rect, Matrix.invert(toFrame))\n }\n fitPlannedGroup(plan, group.id)\n}\n\nconst PLACEMENT_KEYS = ['x', 'y', 'width', 'height'] as const\n\n/**\n * Fits a group to its layers where the resize put them, when any of them moved: a boolean's box\n * is its result's, which only the renderer measures, so one whose operands stay keeps its box. A\n * drag places from the start each time, so the group's box is always written.\n */\nfunction fitPlannedGroup(plan: ResizePlan, groupId: string) {\n const group = plannedOf(plan, groupId)\n if (!group) return\n const { x, y, width, height } = group\n mergeChanges(plan, groupId, { x, y, width, height })\n const moved = group.childIds.some((id) => {\n const start = startOf(plan, id)\n const planned = plannedOf(plan, id)\n return start && planned && PLACEMENT_KEYS.some((key) => start[key] !== planned[key])\n })\n if (!moved) return\n const reader = { rootId: plan.graph.rootId, getNode: (id: string) => plannedOf(plan, id) }\n const children = group.childIds.flatMap((id) => reader.getNode(id) ?? [])\n const fit = groupFitChanges(reader, group, children)\n for (const [id, changes] of fit ?? []) mergeChanges(plan, id, changes)\n}\n\n/**\n * Places the children of a layer that went from `parentBefore` to `parentAfter`: a frame's by their\n * constraints, the layers in its groups and booleans by theirs, a group's or boolean's own scaled.\n */\nfunction placeChildren(plan: ResizePlan, parentId: string, parentBefore: Size, parentAfter: Size) {\n const parent = plan.graph.getNode(parentId)\n if (!parent) return\n const scalesChildren = FITTED_CONTAINER_TYPES.has(parent.type)\n for (const childId of parent.childIds) {\n const original = plan.originals.get(childId)\n const child = plan.graph.getNode(childId)\n if (!original || !child) continue\n const isInFlow = parent.layoutMode !== 'NONE' && child.layoutPositioning !== 'ABSOLUTE'\n if (isInFlow) {\n placeChildren(plan, childId, original, child)\n continue\n }\n if (!scalesChildren && FITTED_CONTAINER_TYPES.has(child.type)) {\n const start = { ...child, ...original }\n placeGroupedLayers(plan, start, getNodeLocalMatrix(start), parentBefore, parentAfter)\n continue\n }\n const rect: ConstrainedRect = scalesChildren\n ? scaledChildRect(original, parentBefore, parentAfter)\n : constrainedChildRect(\n original,\n parentBefore,\n parentAfter,\n child.horizontalConstraint,\n child.verticalConstraint,\n enforcedAspectRatio(child)\n )\n placeConstrained(plan, child, original, rect, null)\n }\n}\n\n/**\n * Where the descendants of a layer go when it resizes from `rootBefore` to `rootAfter`, from the\n * places `originals` recorded.\n */\nexport function computeConstrainedResizeChanges(\n graph: ResizeGraph,\n rootId: string,\n rootBefore: Size,\n rootAfter: Size,\n originals: ReadonlyMap<string, ResizeSnapshot>\n): Map<string, Partial<SceneNode>> {\n const plan: ResizePlan = { graph, originals, changes: new Map() }\n placeChildren(plan, rootId, rootBefore, rootAfter)\n return plan.changes\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0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.js";
2
2
  import { MIN_RESCALE, RescaleOptions, rescaleNodeChanges, rescaleNodeTree, rescaleTargets, scaleRoots } from "./tree.js";
3
3
  import { ScaleSnapshot, scaledSnapshotChanges, snapshotScale } from "./snapshot.js";
4
- export { MIN_RESCALE, type RescaleOptions, type ScaleSnapshot, rescaleNodeChanges, rescaleNodeTree, rescaleTargets, scaleNodeChanges, scaleRoots, scaledSnapshotChanges, snapshotScale };
4
+ export { MIN_RESCALE, type RescaleOptions, type ScaleSnapshot, rescaleNodeChanges, rescaleNodeTree, rescaleTargets, scaleNodeChanges, scaleRoots, scaledSnapshotChanges, scaledTextStyleLengths, snapshotScale };
@@ -1,4 +1,4 @@
1
- import { scaleNodeChanges } from "./node.js";
1
+ import { scaleNodeChanges, scaledTextStyleLengths } from "./node.js";
2
2
  import { MIN_RESCALE, rescaleNodeChanges, rescaleNodeTree, rescaleTargets, scaleRoots } from "./tree.js";
3
3
  import { scaledSnapshotChanges, snapshotScale } from "./snapshot.js";
4
- export { MIN_RESCALE, rescaleNodeChanges, rescaleNodeTree, rescaleTargets, scaleNodeChanges, scaleRoots, scaledSnapshotChanges, snapshotScale };
4
+ export { MIN_RESCALE, rescaleNodeChanges, rescaleNodeTree, rescaleTargets, scaleNodeChanges, scaleRoots, scaledSnapshotChanges, scaledTextStyleLengths, snapshotScale };
@@ -1,6 +1,4 @@
1
1
  import { SceneNode } from "../types.js";
2
- //#region src/scaling/node.d.ts
3
- declare function scaleNodeChanges(node: SceneNode, scale: number, scalePosition: boolean): Partial<SceneNode>;
4
- //#endregion
5
- export { scaleNodeChanges };
2
+ export declare function scaledTextStyleLengths<Values extends object>(values: Values, scale: number): Values;
3
+ export declare function scaleNodeChanges(node: SceneNode, scale: number, scalePosition: boolean): Partial<SceneNode>;
6
4
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","names":[],"sources":["../../src/scaling/node.ts"],"mappings":";;iBAiJgB,iBACd,MAAM,WACN,eACA,yBACC,QAAQ"}
1
+ {"version":3,"file":"node.d.ts","names":[],"sources":["../../src/scaling/node.ts"],"mappings":";wBAuFgB,uBAAuB,uBACrC,QAAQ,QACR,gBACC;wBAiGa,iBACd,MAAM,WACN,eACA,yBACC,QAAQ"}
@@ -1,8 +1,9 @@
1
- import { scaledTextLength } from "../text/lengths.js";
1
+ import { pick } from "es-toolkit/object";
2
2
  import { cloneVectorNetwork, copyDerivedGlyphs, scaleGeometryPaths } from "../copy.js";
3
- import { followsPath } from "../text/path.js";
3
+ import { scaledTextLength } from "../text/lengths.js";
4
4
  import { TEXT_PARAGRAPH_SPACING_FIELDS } from "../text/paragraphs.js";
5
- //#region src/scaling/node.ts
5
+ import { followsPath } from "../text/path.js";
6
+ // src/scaling/node.ts
6
7
  function scaledOptional(value, scale) {
7
8
  return value == null ? null : value * scale;
8
9
  }
@@ -43,6 +44,30 @@ function scaledFills(fills, scale) {
43
44
  } : void 0
44
45
  }));
45
46
  }
47
+ const TEXT_STYLE_LENGTH_FIELDS = [
48
+ "fontSize",
49
+ "lineHeight",
50
+ "letterSpacing",
51
+ "paragraphSpacing",
52
+ "paragraphIndent",
53
+ "listSpacing"
54
+ ];
55
+ const TEXT_STYLE_LENGTHS = new Set(TEXT_STYLE_LENGTH_FIELDS);
56
+ function isTextStyleLength(field) {
57
+ return TEXT_STYLE_LENGTHS.has(field);
58
+ }
59
+ function isTextLength(value) {
60
+ return typeof value === "object" && value !== null && "unit" in value && "value" in value;
61
+ }
62
+ function lengthAtScale(value, scale) {
63
+ if (typeof value === "number") return value * scale;
64
+ return isTextLength(value) ? scaledTextLength(value, scale) : value;
65
+ }
66
+ function scaledTextStyleLengths(values, scale) {
67
+ const scaled = { ...values };
68
+ for (const [field, value] of Object.entries(values)) if (isTextStyleLength(field)) Object.assign(scaled, { [field]: lengthAtScale(value, scale) });
69
+ return scaled;
70
+ }
46
71
  function scaledStyleRuns(styleRuns, scale) {
47
72
  return styleRuns.map((run) => ({
48
73
  ...structuredClone(run),
@@ -130,15 +155,10 @@ function scaleNodeChanges(node, scale, scalePosition) {
130
155
  topRightRadius: node.topRightRadius * scale,
131
156
  bottomRightRadius: node.bottomRightRadius * scale,
132
157
  bottomLeftRadius: node.bottomLeftRadius * scale,
133
- fontSize: node.fontSize * scale,
134
- letterSpacing: scaledTextLength(node.letterSpacing, scale),
135
- lineHeight: node.lineHeight && scaledTextLength(node.lineHeight, scale),
158
+ ...scaledTextStyleLengths(pick(node, TEXT_STYLE_LENGTH_FIELDS), scale),
136
159
  textDecorationThickness: scaledOptional(node.textDecorationThickness, scale),
137
160
  textUnderlineOffset: scaledOptional(node.textUnderlineOffset, scale),
138
161
  styleRuns: scaledStyleRuns(node.styleRuns, scale),
139
- listSpacing: node.listSpacing * scale,
140
- paragraphSpacing: node.paragraphSpacing * scale,
141
- paragraphIndent: node.paragraphIndent * scale,
142
162
  textParagraphs: scaledParagraphStyles(node.textParagraphs, scale),
143
163
  derivedTextHeight: scaledOptional(node.derivedTextHeight, scale),
144
164
  itemSpacing: node.itemSpacing * scale,
@@ -168,7 +188,6 @@ function scaleNodeChanges(node, scale, scalePosition) {
168
188
  ...scaledPathText(node, scale)
169
189
  };
170
190
  }
171
- //#endregion
172
- export { scaleNodeChanges };
191
+ export { isTextStyleLength, scaleNodeChanges, scaledTextStyleLengths };
173
192
 
174
193
  //# sourceMappingURL=node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","names":[],"sources":["../../src/scaling/node.ts"],"sourcesContent":["import { cloneVectorNetwork, copyDerivedGlyphs, scaleGeometryPaths } from '../copy'\nimport { scaledTextLength } from '../text/lengths'\nimport { TEXT_PARAGRAPH_SPACING_FIELDS } from '../text/paragraphs'\nimport { followsPath } from '../text/path'\nimport {\n type Effect,\n type Fill,\n type GridTrack,\n type LayoutGrid,\n type SceneNode,\n type Stroke,\n type StyleRun,\n type TextParagraphStyle\n} from '../types'\n\nfunction scaledOptional(value: number | null, scale: number): number | null {\n return value == null ? null : value * scale\n}\n\nfunction scaledStrokes(strokes: readonly Stroke[], scale: number): Stroke[] {\n return strokes.map((stroke) => ({\n ...structuredClone(stroke),\n weight: stroke.weight * scale,\n dashPattern: stroke.dashPattern?.map((value) => value * scale)\n }))\n}\n\nfunction scaledEffects(effects: readonly Effect[], scale: number): Effect[] {\n return effects.map((effect) => ({\n ...structuredClone(effect),\n offset: { x: effect.offset.x * scale, y: effect.offset.y * scale },\n radius: effect.radius * scale,\n spread: effect.spread * scale,\n ...(effect.progressive\n ? {\n progressive: {\n ...structuredClone(effect.progressive),\n startRadius: effect.progressive.startRadius * scale\n }\n }\n : {})\n }))\n}\n\nfunction scaledFills(fills: readonly Fill[], scale: number): Fill[] {\n return fills.map((fill) => ({\n ...structuredClone(fill),\n scale: fill.scale == null ? undefined : fill.scale * scale,\n spacing: fill.spacing == null ? undefined : fill.spacing * scale,\n patternSpacing: fill.patternSpacing\n ? { x: fill.patternSpacing.x * scale, y: fill.patternSpacing.y * scale }\n : undefined,\n noiseSize: fill.noiseSize\n ? { x: fill.noiseSize.x * scale, y: fill.noiseSize.y * scale }\n : undefined\n }))\n}\n\nfunction scaledStyleRuns(styleRuns: readonly StyleRun[], scale: number): StyleRun[] {\n return styleRuns.map((run) => ({\n ...structuredClone(run),\n style: {\n ...structuredClone(run.style),\n fontSize: run.style.fontSize == null ? undefined : run.style.fontSize * scale,\n letterSpacing: run.style.letterSpacing && scaledTextLength(run.style.letterSpacing, scale),\n lineHeight: run.style.lineHeight && scaledTextLength(run.style.lineHeight, scale),\n textDecorationThickness: scaledOptional(run.style.textDecorationThickness ?? null, scale),\n textUnderlineOffset: scaledOptional(run.style.textUnderlineOffset ?? null, scale)\n }\n }))\n}\n\nfunction scaledParagraphStyles(\n paragraphs: readonly TextParagraphStyle[],\n scale: number\n): TextParagraphStyle[] {\n return paragraphs.map((style) => {\n const scaled = { ...style }\n for (const field of TEXT_PARAGRAPH_SPACING_FIELDS) {\n const value = style[field]\n if (value !== undefined) scaled[field] = value * scale\n }\n return scaled\n })\n}\n\nfunction scaledLayoutGrids(grids: readonly LayoutGrid[], scale: number): LayoutGrid[] {\n return grids.map((grid) => ({\n ...structuredClone(grid),\n offset: grid.offset == null ? undefined : grid.offset * scale,\n sectionSize: grid.sectionSize == null ? undefined : grid.sectionSize * scale,\n gutterSize: grid.gutterSize == null ? undefined : grid.gutterSize * scale\n }))\n}\n\nfunction scaledGridTracks(tracks: readonly GridTrack[], scale: number): GridTrack[] {\n return tracks.map((track) => ({\n ...track,\n value: track.sizing === 'FIXED' ? track.value * scale : track.value\n }))\n}\n\nfunction scaledVectorNetwork(node: SceneNode, scale: number): SceneNode['vectorNetwork'] {\n if (!node.vectorNetwork) return null\n const network = cloneVectorNetwork(node.vectorNetwork)\n for (const vertex of network.vertices) {\n vertex.x *= scale\n vertex.y *= scale\n }\n for (const segment of network.segments) {\n segment.tangentStart.x *= scale\n segment.tangentStart.y *= scale\n segment.tangentEnd.x *= scale\n segment.tangentEnd.y *= scale\n }\n // A region's own paints scale as the layer's do.\n for (const region of network.regions) {\n if (region.fills) region.fills = scaledFills(region.fills, scale)\n }\n return network\n}\n\nfunction scaledPathText(node: SceneNode, scale: number): Partial<SceneNode> {\n if (!node.textPathData && !followsPath(node)) {\n return {}\n }\n const box = node.textPathBox\n return {\n derivedTextGlyphs:\n copyDerivedGlyphs(node.derivedTextGlyphs)?.map((glyph) => ({\n ...glyph,\n x: glyph.x * scale,\n y: glyph.y * scale,\n fontSize: glyph.fontSize * scale,\n ...(glyph.advance === undefined ? {} : { advance: glyph.advance * scale })\n })) ?? null,\n textPathBox: box && {\n x: box.x * scale,\n y: box.y * scale,\n width: box.width * scale,\n height: box.height * scale\n }\n }\n}\n\nexport function scaleNodeChanges(\n node: SceneNode,\n scale: number,\n scalePosition: boolean\n): Partial<SceneNode> {\n return {\n x: scalePosition ? node.x * scale : node.x,\n y: scalePosition ? node.y * scale : node.y,\n width: node.width * scale,\n height: node.height * scale,\n minWidth: scaledOptional(node.minWidth, scale),\n maxWidth: scaledOptional(node.maxWidth, scale),\n minHeight: scaledOptional(node.minHeight, scale),\n maxHeight: scaledOptional(node.maxHeight, scale),\n cornerRadius: node.cornerRadius * scale,\n topLeftRadius: node.topLeftRadius * scale,\n topRightRadius: node.topRightRadius * scale,\n bottomRightRadius: node.bottomRightRadius * scale,\n bottomLeftRadius: node.bottomLeftRadius * scale,\n fontSize: node.fontSize * scale,\n letterSpacing: scaledTextLength(node.letterSpacing, scale),\n lineHeight: node.lineHeight && scaledTextLength(node.lineHeight, scale),\n textDecorationThickness: scaledOptional(node.textDecorationThickness, scale),\n textUnderlineOffset: scaledOptional(node.textUnderlineOffset, scale),\n styleRuns: scaledStyleRuns(node.styleRuns, scale),\n listSpacing: node.listSpacing * scale,\n paragraphSpacing: node.paragraphSpacing * scale,\n paragraphIndent: node.paragraphIndent * scale,\n textParagraphs: scaledParagraphStyles(node.textParagraphs, scale),\n derivedTextHeight: scaledOptional(node.derivedTextHeight, scale),\n itemSpacing: node.itemSpacing * scale,\n counterAxisSpacing: node.counterAxisSpacing === null ? null : node.counterAxisSpacing * scale,\n paddingTop: node.paddingTop * scale,\n paddingRight: node.paddingRight * scale,\n paddingBottom: node.paddingBottom * scale,\n paddingLeft: node.paddingLeft * scale,\n gridColumnGap: node.gridColumnGap * scale,\n gridRowGap: node.gridRowGap * scale,\n gridTemplateColumns: scaledGridTracks(node.gridTemplateColumns, scale),\n gridTemplateRows: scaledGridTracks(node.gridTemplateRows, scale),\n strokes: scaledStrokes(node.strokes, scale),\n strokeWeight: node.strokeWeight * scale,\n dashPattern: node.dashPattern.map((value) => value * scale),\n borderTopWeight: node.borderTopWeight * scale,\n borderRightWeight: node.borderRightWeight * scale,\n borderBottomWeight: node.borderBottomWeight * scale,\n borderLeftWeight: node.borderLeftWeight * scale,\n strokeMiterLimit: node.strokeMiterLimit,\n effects: scaledEffects(node.effects, scale),\n fills: scaledFills(node.fills, scale),\n layoutGrids: scaledLayoutGrids(node.layoutGrids, scale),\n vectorNetwork: scaledVectorNetwork(node, scale),\n fillGeometry: scaleGeometryPaths(node.fillGeometry, scale, scale),\n strokeGeometry: scaleGeometryPaths(node.strokeGeometry, scale, scale),\n ...scaledPathText(node, scale)\n }\n}\n"],"mappings":";;;;;AAeA,SAAS,eAAe,OAAsB,OAA8B;CAC1E,OAAO,SAAS,OAAO,OAAO,QAAQ;AACxC;AAEA,SAAS,cAAc,SAA4B,OAAyB;CAC1E,OAAO,QAAQ,KAAK,YAAY;EAC9B,GAAG,gBAAgB,MAAM;EACzB,QAAQ,OAAO,SAAS;EACxB,aAAa,OAAO,aAAa,KAAK,UAAU,QAAQ,KAAK;CAC/D,EAAE;AACJ;AAEA,SAAS,cAAc,SAA4B,OAAyB;CAC1E,OAAO,QAAQ,KAAK,YAAY;EAC9B,GAAG,gBAAgB,MAAM;EACzB,QAAQ;GAAE,GAAG,OAAO,OAAO,IAAI;GAAO,GAAG,OAAO,OAAO,IAAI;EAAM;EACjE,QAAQ,OAAO,SAAS;EACxB,QAAQ,OAAO,SAAS;EACxB,GAAI,OAAO,cACP,EACE,aAAa;GACX,GAAG,gBAAgB,OAAO,WAAW;GACrC,aAAa,OAAO,YAAY,cAAc;EAChD,EACF,IACA,CAAC;CACP,EAAE;AACJ;AAEA,SAAS,YAAY,OAAwB,OAAuB;CAClE,OAAO,MAAM,KAAK,UAAU;EAC1B,GAAG,gBAAgB,IAAI;EACvB,OAAO,KAAK,SAAS,OAAO,KAAA,IAAY,KAAK,QAAQ;EACrD,SAAS,KAAK,WAAW,OAAO,KAAA,IAAY,KAAK,UAAU;EAC3D,gBAAgB,KAAK,iBACjB;GAAE,GAAG,KAAK,eAAe,IAAI;GAAO,GAAG,KAAK,eAAe,IAAI;EAAM,IACrE,KAAA;EACJ,WAAW,KAAK,YACZ;GAAE,GAAG,KAAK,UAAU,IAAI;GAAO,GAAG,KAAK,UAAU,IAAI;EAAM,IAC3D,KAAA;CACN,EAAE;AACJ;AAEA,SAAS,gBAAgB,WAAgC,OAA2B;C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mB,KAAK,gBAAgB,OAAO,KAAK;EACpE,GAAG,eAAe,MAAM,KAAK;CAC/B;AACF"}
1
+ {"version":3,"file":"node.js","names":[],"sources":["../../src/scaling/node.ts"],"sourcesContent":["import { pick } from 'es-toolkit/object'\n\nimport { cloneVectorNetwork, copyDerivedGlyphs, scaleGeometryPaths } from '../copy'\nimport { scaledTextLength } from '../text/lengths'\nimport { TEXT_PARAGRAPH_SPACING_FIELDS } from '../text/paragraphs'\nimport { followsPath } from '../text/path'\nimport {\n type Effect,\n type Fill,\n type GridTrack,\n type LayoutGrid,\n type SceneNode,\n type Stroke,\n type StyleRun,\n type TextLength,\n type TextParagraphStyle\n} from '../types'\n\nfunction scaledOptional(value: number | null, scale: number): number | null {\n return value == null ? null : value * scale\n}\n\nfunction scaledStrokes(strokes: readonly Stroke[], scale: number): Stroke[] {\n return strokes.map((stroke) => ({\n ...structuredClone(stroke),\n weight: stroke.weight * scale,\n dashPattern: stroke.dashPattern?.map((value) => value * scale)\n }))\n}\n\nfunction scaledEffects(effects: readonly Effect[], scale: number): Effect[] {\n return effects.map((effect) => ({\n ...structuredClone(effect),\n offset: { x: effect.offset.x * scale, y: effect.offset.y * scale },\n radius: effect.radius * scale,\n spread: effect.spread * scale,\n ...(effect.progressive\n ? {\n progressive: {\n ...structuredClone(effect.progressive),\n startRadius: effect.progressive.startRadius * scale\n }\n }\n : {})\n }))\n}\n\nfunction scaledFills(fills: readonly Fill[], scale: number): Fill[] {\n return fills.map((fill) => ({\n ...structuredClone(fill),\n scale: fill.scale == null ? undefined : fill.scale * scale,\n spacing: fill.spacing == null ? undefined : fill.spacing * scale,\n patternSpacing: fill.patternSpacing\n ? { x: fill.patternSpacing.x * scale, y: fill.patternSpacing.y * scale }\n : undefined,\n noiseSize: fill.noiseSize\n ? { x: fill.noiseSize.x * scale, y: fill.noiseSize.y * scale }\n : undefined\n }))\n}\n\nconst TEXT_STYLE_LENGTH_FIELDS = [\n 'fontSize',\n 'lineHeight',\n 'letterSpacing',\n 'paragraphSpacing',\n 'paragraphIndent',\n 'listSpacing'\n] as const satisfies readonly (keyof SceneNode)[]\n\nconst TEXT_STYLE_LENGTHS: ReadonlySet<string> = new Set(TEXT_STYLE_LENGTH_FIELDS)\n\nexport function isTextStyleLength(field: string): boolean {\n return TEXT_STYLE_LENGTHS.has(field)\n}\n\nfunction isTextLength(value: unknown): value is TextLength {\n return typeof value === 'object' && value !== null && 'unit' in value && 'value' in value\n}\n\nfunction lengthAtScale(value: unknown, scale: number): unknown {\n if (typeof value === 'number') {\n return value * scale\n }\n return isTextLength(value) ? scaledTextLength(value, scale) : value\n}\n\nexport function scaledTextStyleLengths<Values extends object>(\n values: Values,\n scale: number\n): Values {\n const scaled = { ...values }\n for (const [field, value] of Object.entries(values)) {\n if (isTextStyleLength(field)) {\n Object.assign(scaled, { [field]: lengthAtScale(value, scale) })\n }\n }\n return scaled\n}\n\nfunction scaledStyleRuns(styleRuns: readonly StyleRun[], scale: number): StyleRun[] {\n return styleRuns.map((run) => ({\n ...structuredClone(run),\n style: {\n ...structuredClone(run.style),\n fontSize: run.style.fontSize == null ? undefined : run.style.fontSize * scale,\n letterSpacing: run.style.letterSpacing && scaledTextLength(run.style.letterSpacing, scale),\n lineHeight: run.style.lineHeight && scaledTextLength(run.style.lineHeight, scale),\n textDecorationThickness: scaledOptional(run.style.textDecorationThickness ?? null, scale),\n textUnderlineOffset: scaledOptional(run.style.textUnderlineOffset ?? null, scale)\n }\n }))\n}\n\nfunction scaledParagraphStyles(\n paragraphs: readonly TextParagraphStyle[],\n scale: number\n): TextParagraphStyle[] {\n return paragraphs.map((style) => {\n const scaled = { ...style }\n for (const field of TEXT_PARAGRAPH_SPACING_FIELDS) {\n const value = style[field]\n if (value !== undefined) scaled[field] = value * scale\n }\n return scaled\n })\n}\n\nfunction scaledLayoutGrids(grids: readonly LayoutGrid[], scale: number): LayoutGrid[] {\n return grids.map((grid) => ({\n ...structuredClone(grid),\n offset: grid.offset == null ? undefined : grid.offset * scale,\n sectionSize: grid.sectionSize == null ? undefined : grid.sectionSize * scale,\n gutterSize: grid.gutterSize == null ? undefined : grid.gutterSize * scale\n }))\n}\n\nfunction scaledGridTracks(tracks: readonly GridTrack[], scale: number): GridTrack[] {\n return tracks.map((track) => ({\n ...track,\n value: track.sizing === 'FIXED' ? track.value * scale : track.value\n }))\n}\n\nfunction scaledVectorNetwork(node: SceneNode, scale: number): SceneNode['vectorNetwork'] {\n if (!node.vectorNetwork) return null\n const network = cloneVectorNetwork(node.vectorNetwork)\n for (const vertex of network.vertices) {\n vertex.x *= scale\n vertex.y *= scale\n }\n for (const segment of network.segments) {\n segment.tangentStart.x *= scale\n segment.tangentStart.y *= scale\n segment.tangentEnd.x *= scale\n segment.tangentEnd.y *= scale\n }\n // A region's own paints scale as the layer's do.\n for (const region of network.regions) {\n if (region.fills) region.fills = scaledFills(region.fills, scale)\n }\n return network\n}\n\nfunction scaledPathText(node: SceneNode, scale: number): Partial<SceneNode> {\n if (!node.textPathData && !followsPath(node)) {\n return {}\n }\n const box = node.textPathBox\n return {\n derivedTextGlyphs:\n copyDerivedGlyphs(node.derivedTextGlyphs)?.map((glyph) => ({\n ...glyph,\n x: glyph.x * scale,\n y: glyph.y * scale,\n fontSize: glyph.fontSize * scale,\n ...(glyph.advance === undefined ? {} : { advance: glyph.advance * scale })\n })) ?? null,\n textPathBox: box && {\n x: box.x * scale,\n y: box.y * scale,\n width: box.width * scale,\n height: box.height * scale\n }\n }\n}\n\nexport function scaleNodeChanges(\n node: SceneNode,\n scale: number,\n scalePosition: boolean\n): Partial<SceneNode> {\n return {\n x: scalePosition ? node.x * scale : node.x,\n y: scalePosition ? node.y * scale : node.y,\n width: node.width * scale,\n height: node.height * scale,\n minWidth: scaledOptional(node.minWidth, scale),\n maxWidth: scaledOptional(node.maxWidth, scale),\n minHeight: scaledOptional(node.minHeight, scale),\n maxHeight: scaledOptional(node.maxHeight, scale),\n cornerRadius: node.cornerRadius * scale,\n topLeftRadius: node.topLeftRadius * scale,\n topRightRadius: node.topRightRadius * scale,\n bottomRightRadius: node.bottomRightRadius * scale,\n bottomLeftRadius: node.bottomLeftRadius * scale,\n ...scaledTextStyleLengths(pick(node, TEXT_STYLE_LENGTH_FIELDS), scale),\n textDecorationThickness: scaledOptional(node.textDecorationThickness, scale),\n textUnderlineOffset: scaledOptional(node.textUnderlineOffset, scale),\n styleRuns: scaledStyleRuns(node.styleRuns, scale),\n textParagraphs: scaledParagraphStyles(node.textParagraphs, scale),\n derivedTextHeight: scaledOptional(node.derivedTextHeight, scale),\n itemSpacing: node.itemSpacing * scale,\n counterAxisSpacing: node.counterAxisSpacing === null ? null : node.counterAxisSpacing * scale,\n paddingTop: node.paddingTop * scale,\n paddingRight: node.paddingRight * scale,\n paddingBottom: node.paddingBottom * scale,\n paddingLeft: node.paddingLeft * scale,\n gridColumnGap: node.gridColumnGap * scale,\n gridRowGap: node.gridRowGap * scale,\n gridTemplateColumns: scaledGridTracks(node.gridTemplateColumns, scale),\n gridTemplateRows: scaledGridTracks(node.gridTemplateRows, scale),\n strokes: scaledStrokes(node.strokes, scale),\n strokeWeight: node.strokeWeight * scale,\n dashPattern: node.dashPattern.map((value) => value * scale),\n borderTopWeight: node.borderTopWeight * scale,\n borderRightWeight: node.borderRightWeight * scale,\n borderBottomWeight: node.borderBottomWeight * scale,\n borderLeftWeight: node.borderLeftWeight * scale,\n strokeMiterLimit: node.strokeMiterLimit,\n effects: scaledEffects(node.effects, scale),\n fills: scaledFills(node.fills, scale),\n layoutGrids: scaledLayoutGrids(node.layoutGrids, scale),\n vectorNetwork: scaledVectorNetwork(node, scale),\n fillGeometry: scaleGeometryPaths(node.fillGeometry, scale, scale),\n strokeGeometry: scaleGeometryPaths(node.strokeGeometry, scale, scale),\n ...scaledPathText(node, scale)\n }\n}\n"],"mappings":";;;;;;AAkBA,SAAS,eAAe,OAAsB,OAA8B;CAC1E,OAAO,SAAS,OAAO,OAAO,QAAQ;AACxC;AAEA,SAAS,cAAc,SAA4B,O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AAmB;EAC1C,kBAAkB,KAAK;EACvB,SAAS,cAAc,KAAK,SAAS,KAAK;EAC1C,OAAO,YAAY,KAAK,OAAO,KAAK;EACpC,aAAa,kBAAkB,KAAK,aAAa,KAAK;EACtD,eAAe,oBAAoB,MAAM,KAAK;EAC9C,cAAc,mBAAmB,KAAK,cAAc,OAAO,KAAK;EAChE,gBAAgB,mBAAmB,KAAK,gBAAgB,OAAO,KAAK;EACpE,GAAG,eAAe,MAAM,KAAK;CAC/B;AACF"}
@@ -1,25 +1,22 @@
1
- import { Vector } from "../primitives/index.js";
1
+ import { SelectionPlacement } from "../coordinate.js";
2
2
  import { SceneGraph } from "../graph.js";
3
+ import { Vector } from "../primitives/index.js";
3
4
  import { SceneNode } from "../types.js";
4
- import { SelectionPlacement } from "../coordinate.js";
5
- //#region src/scaling/snapshot.d.ts
6
5
  /**
7
6
  * The layers a Scale edit changes, as they were when it began, so every step of a drag or a
8
7
  * scrubbed field scales from the same start rather than from its own last preview.
9
8
  */
10
- interface ScaleSnapshot {
9
+ export interface ScaleSnapshot {
11
10
  /** Each scaled root's place in its parent and on the canvas, by ID. */
12
11
  roots: Map<string, SelectionPlacement>;
13
12
  /** Every layer the edit changes, roots first; locked layers inside are left out. */
14
13
  nodes: Map<string, SceneNode>;
15
14
  }
16
15
  /** Records the roots and the layers inside them that Figma's Scale tool changes. */
17
- declare function snapshotScale(graph: SceneGraph, roots: readonly SceneNode[]): ScaleSnapshot;
16
+ export declare function snapshotScale(graph: SceneGraph, roots: readonly SceneNode[]): ScaleSnapshot;
18
17
  /**
19
18
  * What scaling the snapshot evenly by `scale` about a canvas point writes to each layer: its
20
19
  * lengths, and for a root its place, so the point stays put and the root keeps its angle.
21
20
  */
22
- declare function scaledSnapshotChanges(graph: SceneGraph, snapshot: ScaleSnapshot, scale: number, anchor: Vector): Map<string, Partial<SceneNode>>;
23
- //#endregion
24
- export { ScaleSnapshot, scaledSnapshotChanges, snapshotScale };
21
+ export declare function scaledSnapshotChanges(graph: SceneGraph, snapshot: ScaleSnapshot, scale: number, anchor: Vector): Map<string, Partial<SceneNode>>;
25
22
  //# sourceMappingURL=snapshot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.d.ts","names":[],"sources":["../../src/scaling/snapshot.ts"],"mappings":";;;;;;;;;UAUiB;;EAEf,OAAO,YAAY;;EAEnB,OAAO,YAAY;;;iBAIL,cAAc,OAAO,YAAY,gBAAgB,cAAc;;;;;iBAc/D,sBACd,OAAO,YACP,UAAU,eACV,eACA,QAAQ,SACP,YAAY,QAAQ"}
1
+ {"version":3,"file":"snapshot.d.ts","names":[],"sources":["../../src/scaling/snapshot.ts"],"mappings":";;;;;;;;iBAUiB;;EAEf,OAAO,YAAY;;EAEnB,OAAO,YAAY;;;wBAIL,cAAc,OAAO,YAAY,gBAAgB,cAAc;;;;;wBAc/D,sBACd,OAAO,YACP,UAAU,eACV,eACA,QAAQ,SACP,YAAY,QAAQ"}