@motionscript/core 0.1.0-alpha.7 → 0.1.0-alpha.9

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 (1133) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -48
  4. package/README.md +91 -91
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.js.map +1 -1
  7. package/dist/assets/errors.js.map +1 -1
  8. package/dist/assets/index.js.map +1 -1
  9. package/dist/assets/manager.d.ts.map +1 -1
  10. package/dist/assets/manager.js +7 -5
  11. package/dist/assets/manager.js.map +1 -1
  12. package/dist/assets/manifest.js.map +1 -1
  13. package/dist/assets/record.js.map +1 -1
  14. package/dist/assets/scope.js.map +1 -1
  15. package/dist/attributes/audio/effects/chain.d.ts +73 -0
  16. package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
  17. package/dist/attributes/audio/effects/chain.js +67 -0
  18. package/dist/attributes/audio/effects/chain.js.map +1 -0
  19. package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
  20. package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
  21. package/dist/attributes/audio/{filters → effects}/implementations/echo.js +2 -2
  22. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -0
  23. package/dist/attributes/audio/effects/implementations/gain.d.ts +10 -0
  24. package/dist/attributes/audio/effects/implementations/gain.d.ts.map +1 -0
  25. package/dist/attributes/audio/{filters → effects}/implementations/gain.js +2 -2
  26. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -0
  27. package/dist/attributes/audio/effects/implementations/highpass.d.ts +12 -0
  28. package/dist/attributes/audio/effects/implementations/highpass.d.ts.map +1 -0
  29. package/dist/attributes/audio/{filters → effects}/implementations/highpass.js +2 -2
  30. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -0
  31. package/dist/attributes/audio/effects/implementations/lowpass.d.ts +12 -0
  32. package/dist/attributes/audio/effects/implementations/lowpass.d.ts.map +1 -0
  33. package/dist/attributes/audio/{filters → effects}/implementations/lowpass.js +2 -2
  34. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -0
  35. package/dist/attributes/audio/effects/implementations/tremolo.d.ts +12 -0
  36. package/dist/attributes/audio/effects/implementations/tremolo.d.ts.map +1 -0
  37. package/dist/attributes/audio/{filters → effects}/implementations/tremolo.js +2 -2
  38. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -0
  39. package/dist/attributes/audio/effects/index.d.ts +12 -0
  40. package/dist/attributes/audio/effects/index.d.ts.map +1 -0
  41. package/dist/attributes/audio/effects/index.js +4 -0
  42. package/dist/attributes/audio/effects/index.js.map +1 -0
  43. package/dist/attributes/audio/effects/registry.d.ts +36 -0
  44. package/dist/attributes/audio/effects/registry.d.ts.map +1 -0
  45. package/dist/attributes/audio/effects/registry.js +80 -0
  46. package/dist/attributes/audio/effects/registry.js.map +1 -0
  47. package/dist/attributes/audio/effects/union.d.ts +14 -0
  48. package/dist/attributes/audio/effects/union.d.ts.map +1 -0
  49. package/dist/attributes/audio/effects/union.js +24 -0
  50. package/dist/attributes/audio/effects/union.js.map +1 -0
  51. package/dist/attributes/audio/ramp.d.ts +103 -0
  52. package/dist/attributes/audio/ramp.d.ts.map +1 -0
  53. package/dist/attributes/audio/ramp.js +246 -0
  54. package/dist/attributes/audio/ramp.js.map +1 -0
  55. package/dist/attributes/audio/request.d.ts +24 -13
  56. package/dist/attributes/audio/request.d.ts.map +1 -1
  57. package/dist/attributes/audio/request.js +4 -3
  58. package/dist/attributes/audio/request.js.map +1 -1
  59. package/dist/attributes/audio/schedule.d.ts +21 -13
  60. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  61. package/dist/attributes/audio/schedule.js +42 -28
  62. package/dist/attributes/audio/schedule.js.map +1 -1
  63. package/dist/attributes/audio/sound.d.ts +15 -12
  64. package/dist/attributes/audio/sound.d.ts.map +1 -1
  65. package/dist/attributes/audio/sound.js +8 -10
  66. package/dist/attributes/audio/sound.js.map +1 -1
  67. package/dist/attributes/audio/transition.d.ts +33 -0
  68. package/dist/attributes/audio/transition.d.ts.map +1 -0
  69. package/dist/attributes/audio/transition.js +48 -0
  70. package/dist/attributes/audio/transition.js.map +1 -0
  71. package/dist/attributes/index.d.ts +4 -3
  72. package/dist/attributes/index.d.ts.map +1 -1
  73. package/dist/attributes/index.js +4 -7
  74. package/dist/attributes/index.js.map +1 -1
  75. package/dist/attributes/layout/alignment.js.map +1 -1
  76. package/dist/attributes/layout/index.js.map +1 -1
  77. package/dist/attributes/layout/insets.js.map +1 -1
  78. package/dist/attributes/layout/matrix2d.d.ts +2 -2
  79. package/dist/attributes/layout/matrix2d.js.map +1 -1
  80. package/dist/attributes/layout/size.js.map +1 -1
  81. package/dist/attributes/layout/space3d.js +1 -1
  82. package/dist/attributes/layout/space3d.js.map +1 -1
  83. package/dist/attributes/layout/transform3d.js.map +1 -1
  84. package/dist/attributes/layout/vector2.js.map +1 -1
  85. package/dist/attributes/layout/world-transform.js.map +1 -1
  86. package/dist/attributes/mask/boolean.js.map +1 -1
  87. package/dist/attributes/mask/mask.js.map +1 -1
  88. package/dist/attributes/properties/decorator.js.map +1 -1
  89. package/dist/attributes/properties/inputs.js.map +1 -1
  90. package/dist/attributes/properties/typed.d.ts +7 -7
  91. package/dist/attributes/properties/typed.d.ts.map +1 -1
  92. package/dist/attributes/properties/typed.js +6 -6
  93. package/dist/attributes/properties/typed.js.map +1 -1
  94. package/dist/attributes/render3d/orbit.js.map +1 -1
  95. package/dist/attributes/shape/corners/corner-radius.d.ts +1 -2
  96. package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
  97. package/dist/attributes/shape/corners/corner-radius.js +1 -2
  98. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  99. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  100. package/dist/attributes/shape/corners/corners.js.map +1 -1
  101. package/dist/attributes/shape/corners/index.js.map +1 -1
  102. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  103. package/dist/attributes/shape/effects/chain.d.ts +96 -409
  104. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  105. package/dist/attributes/shape/effects/chain.js +93 -283
  106. package/dist/attributes/shape/effects/chain.js.map +1 -1
  107. package/dist/attributes/shape/effects/effect-data.d.ts +1 -1
  108. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/ascii.d.ts +45 -13
  110. package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/ascii.js +29 -23
  112. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +32 -7
  114. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/bit-crush.js +17 -15
  116. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/block-displace.d.ts +46 -10
  118. package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/block-displace.js +21 -19
  120. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/bloom.d.ts +32 -7
  122. package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/bloom.js +17 -11
  124. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/blur.d.ts +16 -3
  126. package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/blur.js +13 -5
  128. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/bulge.d.ts +28 -9
  130. package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/bulge.js +15 -14
  132. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +21 -5
  134. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +15 -10
  136. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  137. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +96 -26
  138. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
  139. package/dist/attributes/shape/effects/implementations/color-adjustment.js +29 -26
  140. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  141. package/dist/attributes/shape/effects/implementations/curves.d.ts +20 -6
  142. package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
  143. package/dist/attributes/shape/effects/implementations/curves.js +26 -23
  144. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  145. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
  146. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
  147. package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
  148. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  149. package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
  150. package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
  151. package/dist/attributes/shape/effects/implementations/dither.js +26 -20
  152. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  153. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +46 -14
  154. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
  155. package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
  156. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  157. package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
  158. package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
  159. package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
  160. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  161. package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
  162. package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
  163. package/dist/attributes/shape/effects/implementations/edges.js +17 -14
  164. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  165. package/dist/attributes/shape/effects/implementations/glass.d.ts +76 -19
  166. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  167. package/dist/attributes/shape/effects/implementations/glass.js +28 -22
  168. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  169. package/dist/attributes/shape/effects/implementations/glow.d.ts +149 -42
  170. package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
  171. package/dist/attributes/shape/effects/implementations/glow.js +74 -72
  172. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  173. package/dist/attributes/shape/effects/implementations/grain.d.ts +43 -11
  174. package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
  175. package/dist/attributes/shape/effects/implementations/grain.js +21 -18
  176. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  177. package/dist/attributes/shape/effects/implementations/grayscale.d.ts +17 -3
  178. package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
  179. package/dist/attributes/shape/effects/implementations/grayscale.js +13 -5
  180. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  181. package/dist/attributes/shape/effects/implementations/halftone.d.ts +40 -9
  182. package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
  183. package/dist/attributes/shape/effects/implementations/halftone.js +20 -16
  184. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  185. package/dist/attributes/shape/effects/implementations/invert.d.ts +23 -5
  186. package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
  187. package/dist/attributes/shape/effects/implementations/invert.js +15 -10
  188. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  189. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +57 -18
  190. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
  191. package/dist/attributes/shape/effects/implementations/kaleidoscope.js +25 -22
  192. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  193. package/dist/attributes/shape/effects/implementations/lut.d.ts +34 -7
  194. package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
  195. package/dist/attributes/shape/effects/implementations/lut.js +20 -16
  196. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  197. package/dist/attributes/shape/effects/implementations/magnify.d.ts +27 -9
  198. package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
  199. package/dist/attributes/shape/effects/implementations/magnify.js +17 -14
  200. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  201. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +54 -19
  202. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
  203. package/dist/attributes/shape/effects/implementations/motion-blur.js +42 -20
  204. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  205. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +17 -3
  206. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
  207. package/dist/attributes/shape/effects/implementations/oil-paint.js +13 -9
  208. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  209. package/dist/attributes/shape/effects/implementations/outline.d.ts +28 -8
  210. package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
  211. package/dist/attributes/shape/effects/implementations/outline.js +18 -17
  212. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  213. package/dist/attributes/shape/effects/implementations/pixelate.d.ts +25 -6
  214. package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
  215. package/dist/attributes/shape/effects/implementations/pixelate.js +16 -14
  216. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  217. package/dist/attributes/shape/effects/implementations/posterize.d.ts +14 -3
  218. package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
  219. package/dist/attributes/shape/effects/implementations/posterize.js +13 -9
  220. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  221. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +91 -26
  222. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
  223. package/dist/attributes/shape/effects/implementations/progressive-blur.js +27 -28
  224. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  225. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +49 -10
  226. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
  227. package/dist/attributes/shape/effects/implementations/radial-blur.js +19 -20
  228. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  229. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +36 -6
  230. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
  231. package/dist/attributes/shape/effects/implementations/rgb-shift.js +16 -15
  232. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  233. package/dist/attributes/shape/effects/implementations/scanlines.d.ts +52 -11
  234. package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
  235. package/dist/attributes/shape/effects/implementations/scanlines.js +21 -18
  236. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  237. package/dist/attributes/shape/effects/implementations/scatter.d.ts +23 -9
  238. package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
  239. package/dist/attributes/shape/effects/implementations/scatter.js +15 -12
  240. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  241. package/dist/attributes/shape/effects/implementations/shader.d.ts +90 -34
  242. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  243. package/dist/attributes/shape/effects/implementations/shader.js +42 -26
  244. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  245. package/dist/attributes/shape/effects/implementations/sharpen.d.ts +23 -5
  246. package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
  247. package/dist/attributes/shape/effects/implementations/sharpen.js +16 -11
  248. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  249. package/dist/attributes/shape/effects/implementations/streak.d.ts +40 -9
  250. package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
  251. package/dist/attributes/shape/effects/implementations/streak.js +19 -16
  252. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  253. package/dist/attributes/shape/effects/implementations/threshold.d.ts +24 -5
  254. package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
  255. package/dist/attributes/shape/effects/implementations/threshold.js +17 -11
  256. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  257. package/dist/attributes/shape/effects/implementations/twirl.d.ts +35 -8
  258. package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
  259. package/dist/attributes/shape/effects/implementations/twirl.js +17 -16
  260. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  261. package/dist/attributes/shape/effects/implementations/vignette.d.ts +37 -7
  262. package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
  263. package/dist/attributes/shape/effects/implementations/vignette.js +19 -18
  264. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  265. package/dist/attributes/shape/effects/implementations/vintage.d.ts +24 -5
  266. package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
  267. package/dist/attributes/shape/effects/implementations/vintage.js +15 -10
  268. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  269. package/dist/attributes/shape/effects/implementations/wave.d.ts +61 -14
  270. package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
  271. package/dist/attributes/shape/effects/implementations/wave.js +26 -23
  272. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  273. package/dist/attributes/shape/effects/index.d.ts +4 -2
  274. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  275. package/dist/attributes/shape/effects/index.js +1 -1
  276. package/dist/attributes/shape/effects/index.js.map +1 -1
  277. package/dist/attributes/shape/effects/registry.d.ts +11 -0
  278. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  279. package/dist/attributes/shape/effects/registry.js +113 -102
  280. package/dist/attributes/shape/effects/registry.js.map +1 -1
  281. package/dist/attributes/shape/effects/spec.d.ts +229 -0
  282. package/dist/attributes/shape/effects/spec.d.ts.map +1 -0
  283. package/dist/attributes/shape/effects/spec.js +178 -0
  284. package/dist/attributes/shape/effects/spec.js.map +1 -0
  285. package/dist/attributes/shape/effects/union.js.map +1 -1
  286. package/dist/attributes/shape/fill/blend.js.map +1 -1
  287. package/dist/attributes/shape/fill/chain.d.ts +7 -9
  288. package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
  289. package/dist/attributes/shape/fill/chain.js +9 -11
  290. package/dist/attributes/shape/fill/chain.js.map +1 -1
  291. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  292. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  293. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  294. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  295. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  296. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  297. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  298. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  299. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  300. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  301. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  302. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  303. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  304. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  305. package/dist/attributes/shape/fill/implementations/shader.d.ts +27 -26
  306. package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
  307. package/dist/attributes/shape/fill/implementations/shader.js +20 -14
  308. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  309. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  310. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  311. package/dist/attributes/shape/fill/index.d.ts +1 -1
  312. package/dist/attributes/shape/fill/index.d.ts.map +1 -1
  313. package/dist/attributes/shape/fill/index.js.map +1 -1
  314. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  315. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  316. package/dist/attributes/shape/fill/registry.d.ts +1 -2
  317. package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
  318. package/dist/attributes/shape/fill/registry.js +1 -2
  319. package/dist/attributes/shape/fill/registry.js.map +1 -1
  320. package/dist/attributes/shape/fill/union.js.map +1 -1
  321. package/dist/attributes/shape/filters/chain.d.ts +2 -6
  322. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  323. package/dist/attributes/shape/filters/chain.js +1 -5
  324. package/dist/attributes/shape/filters/chain.js.map +1 -1
  325. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  326. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  327. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  328. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
  329. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
  330. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  331. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  332. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  333. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  334. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  335. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  336. package/dist/attributes/shape/filters/index.js.map +1 -1
  337. package/dist/attributes/shape/filters/registry.d.ts +1 -1
  338. package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
  339. package/dist/attributes/shape/filters/registry.js +3 -3
  340. package/dist/attributes/shape/filters/registry.js.map +1 -1
  341. package/dist/attributes/shape/filters/union.d.ts +2 -3
  342. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  343. package/dist/attributes/shape/filters/union.js.map +1 -1
  344. package/dist/attributes/shape/path/anchors.js.map +1 -1
  345. package/dist/attributes/shape/path/bezier.js.map +1 -1
  346. package/dist/attributes/shape/path/index.js.map +1 -1
  347. package/dist/attributes/shape/path/measure.js.map +1 -1
  348. package/dist/attributes/shape/path/morph.js.map +1 -1
  349. package/dist/attributes/shape/path/ops.js.map +1 -1
  350. package/dist/attributes/shape/path/types.js.map +1 -1
  351. package/dist/attributes/shape/path/walk.js.map +1 -1
  352. package/dist/attributes/shape/shaders/index.d.ts +2 -0
  353. package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
  354. package/dist/attributes/shape/shaders/index.js +2 -0
  355. package/dist/attributes/shape/shaders/index.js.map +1 -1
  356. package/dist/attributes/shape/shaders/language.d.ts +26 -0
  357. package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
  358. package/dist/attributes/shape/shaders/language.js +20 -0
  359. package/dist/attributes/shape/shaders/language.js.map +1 -0
  360. package/dist/attributes/shape/shaders/pack.d.ts +25 -11
  361. package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
  362. package/dist/attributes/shape/shaders/pack.js +9 -4
  363. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  364. package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
  365. package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
  366. package/dist/attributes/shape/shaders/resolve.js +3 -6
  367. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  368. package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
  369. package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
  370. package/dist/attributes/shape/shaders/uniforms.js +0 -0
  371. package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
  372. package/dist/attributes/shape/shadow/index.js.map +1 -1
  373. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  374. package/dist/attributes/shape/stroke/index.js.map +1 -1
  375. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  376. package/dist/attributes/shared/operators.js.map +1 -1
  377. package/dist/attributes/text/index.js.map +1 -1
  378. package/dist/attributes/text/ops.js.map +1 -1
  379. package/dist/attributes/text/types.js.map +1 -1
  380. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  381. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  382. package/dist/browser/chunks/chunk-7DB6BI27.js +6 -0
  383. package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
  384. package/dist/browser/chunks/chunk-IX53IFBD.js +13 -0
  385. package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
  386. package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
  387. package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
  388. package/dist/browser/component.js +1 -1
  389. package/dist/browser/experimental.js +1 -1
  390. package/dist/browser/experimental.js.map +4 -4
  391. package/dist/browser/index.js +1 -1
  392. package/dist/browser/index.js.map +2 -2
  393. package/dist/browser/manifest.json +1 -1
  394. package/dist/browser/sdk.js +1 -1
  395. package/dist/component.js.map +1 -1
  396. package/dist/components/builtins/audio/audio.d.ts +14 -5
  397. package/dist/components/builtins/audio/audio.d.ts.map +1 -1
  398. package/dist/components/builtins/audio/audio.js +10 -13
  399. package/dist/components/builtins/audio/audio.js.map +1 -1
  400. package/dist/components/builtins/geometry/composite.d.ts +3 -3
  401. package/dist/components/builtins/geometry/composite.js.map +1 -1
  402. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  403. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  404. package/dist/components/builtins/layout/layout.js.map +1 -1
  405. package/dist/components/builtins/media/media.d.ts +7 -7
  406. package/dist/components/builtins/media/media.d.ts.map +1 -1
  407. package/dist/components/builtins/media/media.js +4 -10
  408. package/dist/components/builtins/media/media.js.map +1 -1
  409. package/dist/components/builtins/providers/providers.js.map +1 -1
  410. package/dist/components/builtins/text/number-format.js.map +1 -1
  411. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  412. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  413. package/dist/components/builtins/text/text-layout.js.map +1 -1
  414. package/dist/components/builtins/text/text.d.ts +9 -9
  415. package/dist/components/builtins/text/text.d.ts.map +1 -1
  416. package/dist/components/builtins/text/text.js +3 -0
  417. package/dist/components/builtins/text/text.js.map +1 -1
  418. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  419. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  420. package/dist/components/builtins/three/three.js.map +1 -1
  421. package/dist/components/factory/api.d.ts +38 -11
  422. package/dist/components/factory/api.d.ts.map +1 -1
  423. package/dist/components/factory/api.js.map +1 -1
  424. package/dist/components/factory/clip-of.js.map +1 -1
  425. package/dist/components/factory/commands-for.js.map +1 -1
  426. package/dist/components/factory/component-audio.js.map +1 -1
  427. package/dist/components/factory/component2d.js.map +1 -1
  428. package/dist/components/factory/component3d.d.ts.map +1 -1
  429. package/dist/components/factory/component3d.js +11 -3
  430. package/dist/components/factory/component3d.js.map +1 -1
  431. package/dist/components/factory/factory.d.ts +3 -0
  432. package/dist/components/factory/factory.d.ts.map +1 -1
  433. package/dist/components/factory/factory.js +39 -5
  434. package/dist/components/factory/factory.js.map +1 -1
  435. package/dist/components/factory/timeline.js.map +1 -1
  436. package/dist/components/factory/type-def.js.map +1 -1
  437. package/dist/components/factory/types.js.map +1 -1
  438. package/dist/components/factory/views.js.map +1 -1
  439. package/dist/components/modules/aim.js.map +1 -1
  440. package/dist/components/modules/corners.js.map +1 -1
  441. package/dist/components/modules/flow.js.map +1 -1
  442. package/dist/components/modules/material.js.map +1 -1
  443. package/dist/components/modules/paint.js.map +1 -1
  444. package/dist/components/modules/shapes.js.map +1 -1
  445. package/dist/components/modules/text-layout.js.map +1 -1
  446. package/dist/components/modules/text-style.js.map +1 -1
  447. package/dist/components/modules/three-entries.js.map +1 -1
  448. package/dist/components/modules/view3d.js.map +1 -1
  449. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  450. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  451. package/dist/components/trees/2d/node-motion.js.map +1 -1
  452. package/dist/components/trees/2d/node-render.d.ts +1 -1
  453. package/dist/components/trees/2d/node-render.js +1 -1
  454. package/dist/components/trees/2d/node-render.js.map +1 -1
  455. package/dist/components/trees/2d/node-space.js.map +1 -1
  456. package/dist/components/trees/2d/node-transform.js.map +1 -1
  457. package/dist/components/trees/2d/node2d.d.ts +1 -1
  458. package/dist/components/trees/2d/node2d.js +1 -1
  459. package/dist/components/trees/2d/node2d.js.map +1 -1
  460. package/dist/components/trees/audio/index.js.map +1 -1
  461. package/dist/components/trees/audio/node-audio.d.ts +16 -9
  462. package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
  463. package/dist/components/trees/audio/node-audio.js +15 -11
  464. package/dist/components/trees/audio/node-audio.js.map +1 -1
  465. package/dist/components/trees/index.js.map +1 -1
  466. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  467. package/dist/components/trees/node/node-reactive.js.map +1 -1
  468. package/dist/components/trees/node/node-time.js.map +1 -1
  469. package/dist/components/trees/node/node-walk.js.map +1 -1
  470. package/dist/components/trees/node/node.js.map +1 -1
  471. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  472. package/dist/components/trees/three/node3d.js.map +1 -1
  473. package/dist/document/audio.js.map +1 -1
  474. package/dist/document/builtins.js.map +1 -1
  475. package/dist/document/command-traits.d.ts +12 -2
  476. package/dist/document/command-traits.d.ts.map +1 -1
  477. package/dist/document/command-traits.js +34 -6
  478. package/dist/document/command-traits.js.map +1 -1
  479. package/dist/document/deny-globals.js.map +1 -1
  480. package/dist/document/diff.js.map +1 -1
  481. package/dist/document/doc-index.js.map +1 -1
  482. package/dist/document/expression/compile.js.map +1 -1
  483. package/dist/document/expression/index.js.map +1 -1
  484. package/dist/document/expression/ops.js.map +1 -1
  485. package/dist/document/expression/parse.js.map +1 -1
  486. package/dist/document/expression/refs.js.map +1 -1
  487. package/dist/document/expression/types.js.map +1 -1
  488. package/dist/document/expression/walk.js.map +1 -1
  489. package/dist/document/index.d.ts +8 -0
  490. package/dist/document/index.d.ts.map +1 -1
  491. package/dist/document/index.js +4 -0
  492. package/dist/document/index.js.map +1 -1
  493. package/dist/document/migrate.d.ts +70 -0
  494. package/dist/document/migrate.d.ts.map +1 -0
  495. package/dist/document/migrate.js +202 -0
  496. package/dist/document/migrate.js.map +1 -0
  497. package/dist/document/missing-node.d.ts +27 -0
  498. package/dist/document/missing-node.d.ts.map +1 -0
  499. package/dist/document/missing-node.js +48 -0
  500. package/dist/document/missing-node.js.map +1 -0
  501. package/dist/document/node-decorator.js.map +1 -1
  502. package/dist/document/node-descriptor.d.ts +4 -0
  503. package/dist/document/node-descriptor.d.ts.map +1 -1
  504. package/dist/document/node-descriptor.js.map +1 -1
  505. package/dist/document/placement.d.ts +2 -1
  506. package/dist/document/placement.d.ts.map +1 -1
  507. package/dist/document/placement.js.map +1 -1
  508. package/dist/document/project.d.ts +2 -0
  509. package/dist/document/project.d.ts.map +1 -1
  510. package/dist/document/project.js +1 -0
  511. package/dist/document/project.js.map +1 -1
  512. package/dist/document/prop-evolution.d.ts +51 -0
  513. package/dist/document/prop-evolution.d.ts.map +1 -0
  514. package/dist/document/prop-evolution.js +83 -0
  515. package/dist/document/prop-evolution.js.map +1 -0
  516. package/dist/document/registry.d.ts +16 -0
  517. package/dist/document/registry.d.ts.map +1 -1
  518. package/dist/document/registry.js +30 -4
  519. package/dist/document/registry.js.map +1 -1
  520. package/dist/document/settled-index.d.ts +2 -0
  521. package/dist/document/settled-index.d.ts.map +1 -1
  522. package/dist/document/settled-index.js +5 -5
  523. package/dist/document/settled-index.js.map +1 -1
  524. package/dist/document/timeline-patch.d.ts +4 -0
  525. package/dist/document/timeline-patch.d.ts.map +1 -1
  526. package/dist/document/timeline-patch.js +28 -3
  527. package/dist/document/timeline-patch.js.map +1 -1
  528. package/dist/document/timeline.d.ts +45 -1
  529. package/dist/document/timeline.d.ts.map +1 -1
  530. package/dist/document/timeline.js +172 -42
  531. package/dist/document/timeline.js.map +1 -1
  532. package/dist/document/types.d.ts +14 -28
  533. package/dist/document/types.d.ts.map +1 -1
  534. package/dist/document/types.js.map +1 -1
  535. package/dist/document/validate.d.ts +17 -5
  536. package/dist/document/validate.d.ts.map +1 -1
  537. package/dist/document/validate.js +158 -21
  538. package/dist/document/validate.js.map +1 -1
  539. package/dist/document/vocabulary.d.ts +28 -0
  540. package/dist/document/vocabulary.d.ts.map +1 -0
  541. package/dist/document/vocabulary.js +42 -0
  542. package/dist/document/vocabulary.js.map +1 -0
  543. package/dist/experimental.d.ts +68 -8
  544. package/dist/experimental.d.ts.map +1 -1
  545. package/dist/experimental.js +22 -8
  546. package/dist/experimental.js.map +1 -1
  547. package/dist/index.js.map +1 -1
  548. package/dist/layout/bounds.js.map +1 -1
  549. package/dist/layout/constraints.js.map +1 -1
  550. package/dist/layout/flex.js.map +1 -1
  551. package/dist/layout/freeform.js.map +1 -1
  552. package/dist/layout/grid.js.map +1 -1
  553. package/dist/layout/index.js.map +1 -1
  554. package/dist/layout/item.js.map +1 -1
  555. package/dist/layout/ops.js.map +1 -1
  556. package/dist/layout/types.js.map +1 -1
  557. package/dist/platform/audio-sink.js.map +1 -1
  558. package/dist/platform/exporter.d.ts +13 -0
  559. package/dist/platform/exporter.d.ts.map +1 -1
  560. package/dist/platform/exporter.js.map +1 -1
  561. package/dist/platform/index.js.map +1 -1
  562. package/dist/platform/stepped-clock.js.map +1 -1
  563. package/dist/platform/storage-adapter.js.map +1 -1
  564. package/dist/platform/ticker.js.map +1 -1
  565. package/dist/project/config.js.map +1 -1
  566. package/dist/project/index.js.map +1 -1
  567. package/dist/project/tree.js.map +1 -1
  568. package/dist/props/host.js.map +1 -1
  569. package/dist/props/index.js.map +1 -1
  570. package/dist/props/observer.js.map +1 -1
  571. package/dist/props/slot.js.map +1 -1
  572. package/dist/renamed-scene-names.d.ts +1 -1
  573. package/dist/renamed-scene-names.d.ts.map +1 -1
  574. package/dist/renamed-scene-names.js +1 -1
  575. package/dist/renamed-scene-names.js.map +1 -1
  576. package/dist/render/canvas-render-context2d.d.ts +9 -0
  577. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  578. package/dist/render/canvas-render-context2d.js +10 -0
  579. package/dist/render/canvas-render-context2d.js.map +1 -1
  580. package/dist/render/clip-contains.js +1 -1
  581. package/dist/render/clip-contains.js.map +1 -1
  582. package/dist/render/clip.js.map +1 -1
  583. package/dist/render/descriptors/ellipse.js.map +1 -1
  584. package/dist/render/descriptors/line.js.map +1 -1
  585. package/dist/render/descriptors/path-builder.js.map +1 -1
  586. package/dist/render/descriptors/path.js.map +1 -1
  587. package/dist/render/descriptors/polygon.js.map +1 -1
  588. package/dist/render/descriptors/polygram.js.map +1 -1
  589. package/dist/render/descriptors/rect.js.map +1 -1
  590. package/dist/render/descriptors/richtext.js.map +1 -1
  591. package/dist/render/descriptors/shape.js.map +1 -1
  592. package/dist/render/descriptors/text.d.ts +2 -2
  593. package/dist/render/descriptors/text.js +2 -2
  594. package/dist/render/descriptors/text.js.map +1 -1
  595. package/dist/render/descriptors/transform.js.map +1 -1
  596. package/dist/render/graphics2d.js.map +1 -1
  597. package/dist/render/index.d.ts +2 -0
  598. package/dist/render/index.d.ts.map +1 -1
  599. package/dist/render/index.js +1 -0
  600. package/dist/render/index.js.map +1 -1
  601. package/dist/render/measure-context.js.map +1 -1
  602. package/dist/render/null-render-context.js.map +1 -1
  603. package/dist/render/render-context2d.d.ts +1 -1
  604. package/dist/render/render-context2d.js.map +1 -1
  605. package/dist/render/render-issue.d.ts +39 -0
  606. package/dist/render/render-issue.d.ts.map +1 -0
  607. package/dist/render/render-issue.js +29 -0
  608. package/dist/render/render-issue.js.map +1 -0
  609. package/dist/render/surface.d.ts +2 -2
  610. package/dist/render/surface.js.map +1 -1
  611. package/dist/render/text-defaults.js.map +1 -1
  612. package/dist/render/text-layout.js.map +1 -1
  613. package/dist/render3d/bounds3d.js.map +1 -1
  614. package/dist/render3d/builders.js.map +1 -1
  615. package/dist/render3d/camera.js.map +1 -1
  616. package/dist/render3d/fill3d.js.map +1 -1
  617. package/dist/render3d/geometry.js.map +1 -1
  618. package/dist/render3d/graphics3d.d.ts.map +1 -1
  619. package/dist/render3d/graphics3d.js +54 -5
  620. package/dist/render3d/graphics3d.js.map +1 -1
  621. package/dist/render3d/index.js.map +1 -1
  622. package/dist/render3d/inert.js.map +1 -1
  623. package/dist/render3d/light.js.map +1 -1
  624. package/dist/render3d/material.js.map +1 -1
  625. package/dist/render3d/matrix4.js.map +1 -1
  626. package/dist/render3d/render-context3d.js.map +1 -1
  627. package/dist/render3d/resources.js.map +1 -1
  628. package/dist/render3d/rounded-box.js.map +1 -1
  629. package/dist/render3d/scene-settings.js.map +1 -1
  630. package/dist/render3d/scene3d.js.map +1 -1
  631. package/dist/render3d/segments.js.map +1 -1
  632. package/dist/render3d/texture.js.map +1 -1
  633. package/dist/render3d/tracking.js.map +1 -1
  634. package/dist/render3d/transform.js.map +1 -1
  635. package/dist/render3d/vector3.js.map +1 -1
  636. package/dist/render3d/walk.js.map +1 -1
  637. package/dist/runtime/asset-refine.js +2 -1
  638. package/dist/runtime/asset-refine.js.map +1 -1
  639. package/dist/runtime/asset-timeline.d.ts +10 -0
  640. package/dist/runtime/asset-timeline.d.ts.map +1 -1
  641. package/dist/runtime/asset-timeline.js.map +1 -1
  642. package/dist/runtime/asset-update.d.ts.map +1 -1
  643. package/dist/runtime/asset-update.js +7 -0
  644. package/dist/runtime/asset-update.js.map +1 -1
  645. package/dist/runtime/audio-index.js.map +1 -1
  646. package/dist/runtime/builtin-context.js.map +1 -1
  647. package/dist/runtime/clip-instance.d.ts +3 -1
  648. package/dist/runtime/clip-instance.d.ts.map +1 -1
  649. package/dist/runtime/clip-instance.js +4 -0
  650. package/dist/runtime/clip-instance.js.map +1 -1
  651. package/dist/runtime/clip-store.d.ts.map +1 -1
  652. package/dist/runtime/clip-store.js +17 -2
  653. package/dist/runtime/clip-store.js.map +1 -1
  654. package/dist/runtime/engine.d.ts +5 -3
  655. package/dist/runtime/engine.d.ts.map +1 -1
  656. package/dist/runtime/engine.js +2 -1
  657. package/dist/runtime/engine.js.map +1 -1
  658. package/dist/runtime/frame-time.js.map +1 -1
  659. package/dist/runtime/index.js.map +1 -1
  660. package/dist/runtime/node-picking.js.map +1 -1
  661. package/dist/runtime/node-picking3d.js.map +1 -1
  662. package/dist/runtime/placement.js.map +1 -1
  663. package/dist/runtime/playback-controller.d.ts.map +1 -1
  664. package/dist/runtime/playback-controller.js +14 -4
  665. package/dist/runtime/playback-controller.js.map +1 -1
  666. package/dist/runtime/playback.js.map +1 -1
  667. package/dist/runtime/precompisition.js.map +1 -1
  668. package/dist/runtime/project-assets.js.map +1 -1
  669. package/dist/runtime/session.d.ts +7 -3
  670. package/dist/runtime/session.d.ts.map +1 -1
  671. package/dist/runtime/session.js +11 -4
  672. package/dist/runtime/session.js.map +1 -1
  673. package/dist/runtime/settle.js.map +1 -1
  674. package/dist/runtime/state-evaluator.js.map +1 -1
  675. package/dist/runtime/text-geometry.d.ts +1 -1
  676. package/dist/runtime/text-geometry.js.map +1 -1
  677. package/dist/sdk/index.d.ts +8 -6
  678. package/dist/sdk/index.d.ts.map +1 -1
  679. package/dist/sdk/index.js +10 -3
  680. package/dist/sdk/index.js.map +1 -1
  681. package/dist/tween/command-decorator.d.ts +7 -0
  682. package/dist/tween/command-decorator.d.ts.map +1 -1
  683. package/dist/tween/command-decorator.js +1 -0
  684. package/dist/tween/command-decorator.js.map +1 -1
  685. package/dist/tween/command.js.map +1 -1
  686. package/dist/tween/ease/constants.js.map +1 -1
  687. package/dist/tween/ease/curve.js.map +1 -1
  688. package/dist/tween/ease/describe.d.ts +2 -0
  689. package/dist/tween/ease/describe.d.ts.map +1 -1
  690. package/dist/tween/ease/describe.js +4 -0
  691. package/dist/tween/ease/describe.js.map +1 -1
  692. package/dist/tween/ease/spec.d.ts +31 -0
  693. package/dist/tween/ease/spec.d.ts.map +1 -0
  694. package/dist/tween/ease/spec.js +51 -0
  695. package/dist/tween/ease/spec.js.map +1 -0
  696. package/dist/tween/ease/type.js.map +1 -1
  697. package/dist/tween/index.d.ts +1 -0
  698. package/dist/tween/index.d.ts.map +1 -1
  699. package/dist/tween/index.js +1 -0
  700. package/dist/tween/index.js.map +1 -1
  701. package/dist/tween/inert.js.map +1 -1
  702. package/dist/tween/lerp.js.map +1 -1
  703. package/dist/tween/loop.js.map +1 -1
  704. package/dist/tween/prepare.js.map +1 -1
  705. package/dist/tween/stepper.js.map +1 -1
  706. package/dist/tween/to-command.js.map +1 -1
  707. package/dist/util/clamp.js.map +1 -1
  708. package/dist/util/context.js.map +1 -1
  709. package/dist/util/csv.js.map +1 -1
  710. package/dist/util/generateList.js.map +1 -1
  711. package/dist/util/index.js.map +1 -1
  712. package/dist/util/metrics.js.map +1 -1
  713. package/dist/util/random.js.map +1 -1
  714. package/dist/util/reference.js.map +1 -1
  715. package/dist/util/scheduler.js.map +1 -1
  716. package/package.json +2 -2
  717. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  718. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  719. package/dist/attributes/audio/filters/chain.js +0 -104
  720. package/dist/attributes/audio/filters/chain.js.map +0 -1
  721. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  722. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  723. package/dist/attributes/audio/filters/curve.js +0 -250
  724. package/dist/attributes/audio/filters/curve.js.map +0 -1
  725. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  726. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  727. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  728. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  729. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  730. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  731. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  732. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  733. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  734. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  735. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  736. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  737. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  738. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  739. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  740. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  741. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  742. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  743. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  744. package/dist/attributes/audio/filters/index.d.ts +0 -22
  745. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  746. package/dist/attributes/audio/filters/index.js +0 -8
  747. package/dist/attributes/audio/filters/index.js.map +0 -1
  748. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  749. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  750. package/dist/attributes/audio/filters/registry.js +0 -82
  751. package/dist/attributes/audio/filters/registry.js.map +0 -1
  752. package/dist/attributes/audio/filters/union.d.ts +0 -18
  753. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  754. package/dist/attributes/audio/filters/union.js +0 -28
  755. package/dist/attributes/audio/filters/union.js.map +0 -1
  756. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  757. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  758. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  759. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  760. package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
  761. package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
  762. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  763. package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
  764. package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
  765. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  766. package/dist/component/api.d.ts +0 -508
  767. package/dist/component/api.d.ts.map +0 -1
  768. package/dist/component/api.js +0 -4
  769. package/dist/component/api.js.map +0 -1
  770. package/dist/component/builtins/audio.d.ts +0 -26
  771. package/dist/component/builtins/audio.d.ts.map +0 -1
  772. package/dist/component/builtins/audio.js +0 -41
  773. package/dist/component/builtins/audio.js.map +0 -1
  774. package/dist/component/builtins/canvas3d.d.ts +0 -98
  775. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  776. package/dist/component/builtins/canvas3d.js +0 -21
  777. package/dist/component/builtins/canvas3d.js.map +0 -1
  778. package/dist/component/builtins/composite.d.ts +0 -56
  779. package/dist/component/builtins/composite.d.ts.map +0 -1
  780. package/dist/component/builtins/composite.js +0 -25
  781. package/dist/component/builtins/composite.js.map +0 -1
  782. package/dist/component/builtins/geometry.d.ts +0 -505
  783. package/dist/component/builtins/geometry.d.ts.map +0 -1
  784. package/dist/component/builtins/geometry.js +0 -107
  785. package/dist/component/builtins/geometry.js.map +0 -1
  786. package/dist/component/builtins/layout.d.ts +0 -88
  787. package/dist/component/builtins/layout.d.ts.map +0 -1
  788. package/dist/component/builtins/layout.js +0 -84
  789. package/dist/component/builtins/layout.js.map +0 -1
  790. package/dist/component/builtins/media.d.ts +0 -95
  791. package/dist/component/builtins/media.d.ts.map +0 -1
  792. package/dist/component/builtins/media.js +0 -149
  793. package/dist/component/builtins/media.js.map +0 -1
  794. package/dist/component/builtins/providers.d.ts +0 -23
  795. package/dist/component/builtins/providers.d.ts.map +0 -1
  796. package/dist/component/builtins/providers.js +0 -30
  797. package/dist/component/builtins/providers.js.map +0 -1
  798. package/dist/component/builtins/text.d.ts +0 -193
  799. package/dist/component/builtins/text.d.ts.map +0 -1
  800. package/dist/component/builtins/text.js +0 -113
  801. package/dist/component/builtins/text.js.map +0 -1
  802. package/dist/component/builtins/three.d.ts +0 -1085
  803. package/dist/component/builtins/three.d.ts.map +0 -1
  804. package/dist/component/builtins/three.js +0 -265
  805. package/dist/component/builtins/three.js.map +0 -1
  806. package/dist/component/clip-of.d.ts +0 -5
  807. package/dist/component/clip-of.d.ts.map +0 -1
  808. package/dist/component/clip-of.js +0 -33
  809. package/dist/component/clip-of.js.map +0 -1
  810. package/dist/component/commands-for.d.ts +0 -19
  811. package/dist/component/commands-for.d.ts.map +0 -1
  812. package/dist/component/commands-for.js +0 -5
  813. package/dist/component/commands-for.js.map +0 -1
  814. package/dist/component/component-audio.d.ts +0 -9
  815. package/dist/component/component-audio.d.ts.map +0 -1
  816. package/dist/component/component-audio.js +0 -18
  817. package/dist/component/component-audio.js.map +0 -1
  818. package/dist/component/component2d.d.ts +0 -9
  819. package/dist/component/component2d.d.ts.map +0 -1
  820. package/dist/component/component2d.js +0 -239
  821. package/dist/component/component2d.js.map +0 -1
  822. package/dist/component/component3d.d.ts +0 -9
  823. package/dist/component/component3d.d.ts.map +0 -1
  824. package/dist/component/component3d.js +0 -99
  825. package/dist/component/component3d.js.map +0 -1
  826. package/dist/component/factory.d.ts +0 -63
  827. package/dist/component/factory.d.ts.map +0 -1
  828. package/dist/component/factory.js +0 -313
  829. package/dist/component/factory.js.map +0 -1
  830. package/dist/component/modules/aim.d.ts +0 -30
  831. package/dist/component/modules/aim.d.ts.map +0 -1
  832. package/dist/component/modules/aim.js +0 -39
  833. package/dist/component/modules/aim.js.map +0 -1
  834. package/dist/component/modules/corners.d.ts +0 -13
  835. package/dist/component/modules/corners.d.ts.map +0 -1
  836. package/dist/component/modules/corners.js +0 -12
  837. package/dist/component/modules/corners.js.map +0 -1
  838. package/dist/component/modules/flow.d.ts +0 -26
  839. package/dist/component/modules/flow.d.ts.map +0 -1
  840. package/dist/component/modules/flow.js +0 -55
  841. package/dist/component/modules/flow.js.map +0 -1
  842. package/dist/component/modules/material.d.ts +0 -40
  843. package/dist/component/modules/material.d.ts.map +0 -1
  844. package/dist/component/modules/material.js +0 -75
  845. package/dist/component/modules/material.js.map +0 -1
  846. package/dist/component/modules/paint.d.ts +0 -71
  847. package/dist/component/modules/paint.d.ts.map +0 -1
  848. package/dist/component/modules/paint.js +0 -106
  849. package/dist/component/modules/paint.js.map +0 -1
  850. package/dist/component/modules/shapes.d.ts +0 -31
  851. package/dist/component/modules/shapes.d.ts.map +0 -1
  852. package/dist/component/modules/shapes.js +0 -43
  853. package/dist/component/modules/shapes.js.map +0 -1
  854. package/dist/component/modules/text-layout.d.ts +0 -26
  855. package/dist/component/modules/text-layout.d.ts.map +0 -1
  856. package/dist/component/modules/text-layout.js +0 -57
  857. package/dist/component/modules/text-layout.js.map +0 -1
  858. package/dist/component/modules/text-style.d.ts +0 -48
  859. package/dist/component/modules/text-style.d.ts.map +0 -1
  860. package/dist/component/modules/text-style.js +0 -63
  861. package/dist/component/modules/text-style.js.map +0 -1
  862. package/dist/component/modules/three-entries.d.ts +0 -23
  863. package/dist/component/modules/three-entries.d.ts.map +0 -1
  864. package/dist/component/modules/three-entries.js +0 -41
  865. package/dist/component/modules/three-entries.js.map +0 -1
  866. package/dist/component/modules/view3d.d.ts +0 -55
  867. package/dist/component/modules/view3d.d.ts.map +0 -1
  868. package/dist/component/modules/view3d.js +0 -160
  869. package/dist/component/modules/view3d.js.map +0 -1
  870. package/dist/component/timeline.d.ts +0 -22
  871. package/dist/component/timeline.d.ts.map +0 -1
  872. package/dist/component/timeline.js +0 -128
  873. package/dist/component/timeline.js.map +0 -1
  874. package/dist/component/type-def.d.ts +0 -26
  875. package/dist/component/type-def.d.ts.map +0 -1
  876. package/dist/component/type-def.js +0 -16
  877. package/dist/component/type-def.js.map +0 -1
  878. package/dist/component/types.d.ts +0 -91
  879. package/dist/component/types.d.ts.map +0 -1
  880. package/dist/component/types.js +0 -88
  881. package/dist/component/types.js.map +0 -1
  882. package/dist/component/views.d.ts +0 -121
  883. package/dist/component/views.d.ts.map +0 -1
  884. package/dist/component/views.js +0 -413
  885. package/dist/component/views.js.map +0 -1
  886. package/dist/document/withdraw.d.ts +0 -28
  887. package/dist/document/withdraw.d.ts.map +0 -1
  888. package/dist/document/withdraw.js +0 -61
  889. package/dist/document/withdraw.js.map +0 -1
  890. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  891. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  892. package/dist/jsx/jsx-dev-runtime.js +0 -3
  893. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  894. package/dist/jsx/jsx-runtime.d.ts +0 -27
  895. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  896. package/dist/jsx/jsx-runtime.js +0 -26
  897. package/dist/jsx/jsx-runtime.js.map +0 -1
  898. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  899. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  900. package/dist/nodes/2d/node-lifecycle.js +0 -264
  901. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  902. package/dist/nodes/2d/node-motion.d.ts +0 -56
  903. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  904. package/dist/nodes/2d/node-motion.js +0 -86
  905. package/dist/nodes/2d/node-motion.js.map +0 -1
  906. package/dist/nodes/2d/node-render.d.ts +0 -44
  907. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  908. package/dist/nodes/2d/node-render.js +0 -80
  909. package/dist/nodes/2d/node-render.js.map +0 -1
  910. package/dist/nodes/2d/node-space.d.ts +0 -63
  911. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  912. package/dist/nodes/2d/node-space.js +0 -131
  913. package/dist/nodes/2d/node-space.js.map +0 -1
  914. package/dist/nodes/2d/node-transform.d.ts +0 -55
  915. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  916. package/dist/nodes/2d/node-transform.js +0 -73
  917. package/dist/nodes/2d/node-transform.js.map +0 -1
  918. package/dist/nodes/2d/node2d.d.ts +0 -1111
  919. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  920. package/dist/nodes/2d/node2d.js +0 -1665
  921. package/dist/nodes/2d/node2d.js.map +0 -1
  922. package/dist/nodes/2d/paint-node.d.ts +0 -142
  923. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  924. package/dist/nodes/2d/paint-node.js +0 -232
  925. package/dist/nodes/2d/paint-node.js.map +0 -1
  926. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  927. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  928. package/dist/nodes/audio/audio-bus.js +0 -33
  929. package/dist/nodes/audio/audio-bus.js.map +0 -1
  930. package/dist/nodes/audio/index.d.ts +0 -4
  931. package/dist/nodes/audio/index.d.ts.map +0 -1
  932. package/dist/nodes/audio/index.js +0 -2
  933. package/dist/nodes/audio/index.js.map +0 -1
  934. package/dist/nodes/audio/node-audio.d.ts +0 -107
  935. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  936. package/dist/nodes/audio/node-audio.js +0 -179
  937. package/dist/nodes/audio/node-audio.js.map +0 -1
  938. package/dist/nodes/audio/sound-node.d.ts +0 -41
  939. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  940. package/dist/nodes/audio/sound-node.js +0 -71
  941. package/dist/nodes/audio/sound-node.js.map +0 -1
  942. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  943. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  944. package/dist/nodes/geometry/boolean-node.js +0 -81
  945. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  946. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  947. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  948. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  949. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  950. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  951. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  952. package/dist/nodes/geometry/box-path-node.js +0 -116
  953. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  954. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  955. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  956. package/dist/nodes/geometry/ellipse-node.js +0 -45
  957. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  958. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  959. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  960. package/dist/nodes/geometry/group-bounds.js +0 -87
  961. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  962. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  963. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  964. package/dist/nodes/geometry/mask-node.js +0 -66
  965. package/dist/nodes/geometry/mask-node.js.map +0 -1
  966. package/dist/nodes/geometry/path-node.d.ts +0 -26
  967. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  968. package/dist/nodes/geometry/path-node.js +0 -58
  969. package/dist/nodes/geometry/path-node.js.map +0 -1
  970. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  971. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  972. package/dist/nodes/geometry/polygon-node.js +0 -47
  973. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  974. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  975. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  976. package/dist/nodes/geometry/polygram-node.js +0 -52
  977. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  978. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  979. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  980. package/dist/nodes/geometry/rect-node.js +0 -56
  981. package/dist/nodes/geometry/rect-node.js.map +0 -1
  982. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  983. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  984. package/dist/nodes/geometry/shape-node.js +0 -140
  985. package/dist/nodes/geometry/shape-node.js.map +0 -1
  986. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  987. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  988. package/dist/nodes/geometry/shape-outline.js +0 -470
  989. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  990. package/dist/nodes/index.d.ts +0 -53
  991. package/dist/nodes/index.d.ts.map +0 -1
  992. package/dist/nodes/index.js +0 -35
  993. package/dist/nodes/index.js.map +0 -1
  994. package/dist/nodes/layout/camera-node.d.ts +0 -80
  995. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  996. package/dist/nodes/layout/camera-node.js +0 -153
  997. package/dist/nodes/layout/camera-node.js.map +0 -1
  998. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  999. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  1000. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  1001. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  1002. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  1003. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  1004. package/dist/nodes/layout/rotated-box.js +0 -76
  1005. package/dist/nodes/layout/rotated-box.js.map +0 -1
  1006. package/dist/nodes/media/video-node.d.ts +0 -229
  1007. package/dist/nodes/media/video-node.d.ts.map +0 -1
  1008. package/dist/nodes/media/video-node.js +0 -350
  1009. package/dist/nodes/media/video-node.js.map +0 -1
  1010. package/dist/nodes/node/declare-paints.d.ts +0 -19
  1011. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  1012. package/dist/nodes/node/declare-paints.js +0 -27
  1013. package/dist/nodes/node/declare-paints.js.map +0 -1
  1014. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  1015. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  1016. package/dist/nodes/node/node-editor-state.js +0 -23
  1017. package/dist/nodes/node/node-editor-state.js.map +0 -1
  1018. package/dist/nodes/node/node-reactive.d.ts +0 -89
  1019. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  1020. package/dist/nodes/node/node-reactive.js +0 -135
  1021. package/dist/nodes/node/node-reactive.js.map +0 -1
  1022. package/dist/nodes/node/node-time.d.ts +0 -39
  1023. package/dist/nodes/node/node-time.d.ts.map +0 -1
  1024. package/dist/nodes/node/node-time.js +0 -14
  1025. package/dist/nodes/node/node-time.js.map +0 -1
  1026. package/dist/nodes/node/node-walk.d.ts +0 -46
  1027. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  1028. package/dist/nodes/node/node-walk.js +0 -74
  1029. package/dist/nodes/node/node-walk.js.map +0 -1
  1030. package/dist/nodes/node/node.d.ts +0 -445
  1031. package/dist/nodes/node/node.d.ts.map +0 -1
  1032. package/dist/nodes/node/node.js +0 -745
  1033. package/dist/nodes/node/node.js.map +0 -1
  1034. package/dist/nodes/node/text-defaults.d.ts +0 -32
  1035. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  1036. package/dist/nodes/node/text-defaults.js +0 -37
  1037. package/dist/nodes/node/text-defaults.js.map +0 -1
  1038. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  1039. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  1040. package/dist/nodes/root/canvas2d-node.js +0 -264
  1041. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  1042. package/dist/nodes/root/provider-node.d.ts +0 -47
  1043. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  1044. package/dist/nodes/root/provider-node.js +0 -63
  1045. package/dist/nodes/root/provider-node.js.map +0 -1
  1046. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  1047. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  1048. package/dist/nodes/root/theme-provider-node.js +0 -43
  1049. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  1050. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  1051. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  1052. package/dist/nodes/text/default-text-style-node.js +0 -146
  1053. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  1054. package/dist/nodes/text/number-format.d.ts +0 -66
  1055. package/dist/nodes/text/number-format.d.ts.map +0 -1
  1056. package/dist/nodes/text/number-format.js +0 -227
  1057. package/dist/nodes/text/number-format.js.map +0 -1
  1058. package/dist/nodes/text/number-node.d.ts +0 -94
  1059. package/dist/nodes/text/number-node.d.ts.map +0 -1
  1060. package/dist/nodes/text/number-node.js +0 -86
  1061. package/dist/nodes/text/number-node.js.map +0 -1
  1062. package/dist/nodes/text/number-pattern.d.ts +0 -51
  1063. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  1064. package/dist/nodes/text/number-pattern.js +0 -77
  1065. package/dist/nodes/text/number-pattern.js.map +0 -1
  1066. package/dist/nodes/text/richtext-node.d.ts +0 -68
  1067. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  1068. package/dist/nodes/text/richtext-node.js +0 -78
  1069. package/dist/nodes/text/richtext-node.js.map +0 -1
  1070. package/dist/nodes/text/text-base.d.ts +0 -118
  1071. package/dist/nodes/text/text-base.d.ts.map +0 -1
  1072. package/dist/nodes/text/text-base.js +0 -153
  1073. package/dist/nodes/text/text-base.js.map +0 -1
  1074. package/dist/nodes/text/text-layout.d.ts +0 -87
  1075. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  1076. package/dist/nodes/text/text-layout.js +0 -368
  1077. package/dist/nodes/text/text-layout.js.map +0 -1
  1078. package/dist/nodes/text/text-node.d.ts +0 -84
  1079. package/dist/nodes/text/text-node.d.ts.map +0 -1
  1080. package/dist/nodes/text/text-node.js +0 -188
  1081. package/dist/nodes/text/text-node.js.map +0 -1
  1082. package/dist/nodes/text/text-selection.d.ts +0 -125
  1083. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  1084. package/dist/nodes/text/text-selection.js +0 -209
  1085. package/dist/nodes/text/text-selection.js.map +0 -1
  1086. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  1087. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  1088. package/dist/nodes/three/camera-nodes.js +0 -112
  1089. package/dist/nodes/three/camera-nodes.js.map +0 -1
  1090. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  1091. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  1092. package/dist/nodes/three/canvas3d-node.js +0 -486
  1093. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  1094. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  1095. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  1096. package/dist/nodes/three/drawable-nodes.js +0 -284
  1097. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  1098. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  1099. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  1100. package/dist/nodes/three/environment-nodes.js +0 -134
  1101. package/dist/nodes/three/environment-nodes.js.map +0 -1
  1102. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  1103. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  1104. package/dist/nodes/three/geometry-nodes.js +0 -322
  1105. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  1106. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  1107. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  1108. package/dist/nodes/three/grid-geometry3d.js +0 -114
  1109. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  1110. package/dist/nodes/three/group3d.d.ts +0 -23
  1111. package/dist/nodes/three/group3d.d.ts.map +0 -1
  1112. package/dist/nodes/three/group3d.js +0 -21
  1113. package/dist/nodes/three/group3d.js.map +0 -1
  1114. package/dist/nodes/three/light-nodes.d.ts +0 -120
  1115. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  1116. package/dist/nodes/three/light-nodes.js +0 -173
  1117. package/dist/nodes/three/light-nodes.js.map +0 -1
  1118. package/dist/nodes/three/mesh3d.d.ts +0 -117
  1119. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  1120. package/dist/nodes/three/mesh3d.js +0 -147
  1121. package/dist/nodes/three/mesh3d.js.map +0 -1
  1122. package/dist/nodes/three/node3d.d.ts +0 -230
  1123. package/dist/nodes/three/node3d.d.ts.map +0 -1
  1124. package/dist/nodes/three/node3d.js +0 -337
  1125. package/dist/nodes/three/node3d.js.map +0 -1
  1126. package/dist/render/descriptors/latex.d.ts +0 -6
  1127. package/dist/render/descriptors/latex.d.ts.map +0 -1
  1128. package/dist/render/descriptors/latex.js +0 -2
  1129. package/dist/render/descriptors/latex.js.map +0 -1
  1130. package/dist/tween/seekable.d.ts +0 -81
  1131. package/dist/tween/seekable.d.ts.map +0 -1
  1132. package/dist/tween/seekable.js +0 -137
  1133. package/dist/tween/seekable.js.map +0 -1
@@ -65,9 +65,8 @@ type NonFilterEffect = MagnifyEffect | GlassEffect | MotionBlurEffect | OutlineE
65
65
  export type EffectAdjustment = Exclude<NodeEffect, NonFilterEffect>;
66
66
  /**
67
67
  * Discriminated union of pixel filters — the filters valid on both image and
68
- * video fills. Each is realised either as a single CanvasKit image filter
69
- * applied via `paint.setImageFilter`, or — for the ones that resample pixel
70
- * *positions* — as a lens shader wrapping the fill's own shader.
68
+ * video fills. Each is realised either as a per-pixel colour filter, or — for
69
+ * the ones that resample pixel *positions* — as a lens pass over the fill.
71
70
  */
72
71
  export type MediaAdjustment = ExposureFilter | BlurFilter | GrayscaleFilter | AlphaFilter | ColorMatrixFilter | CurvesFilter | ColorAdjustmentFilter | EffectAdjustment;
73
72
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"union.d.ts","sourceRoot":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MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,KAAK,eAAe,GACd,aAAa,GACb,WAAW,GACX,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,UAAU,GACV,UAAU,GACV,eAAe,GACf,YAAY,GACZ,qBAAqB,CAAC;AAE5B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACrB,cAAc,GACd,UAAU,GACV,eAAe,GACf,WAAW,GACX,iBAAiB,GACjB,YAAY,GACZ,qBAAqB,GACrB,gBAAgB,CAAC;AAEvB;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GACzB,mBAAmB,GACnB,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"union.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/union.ts"],"names":[],"mappings":"","sourcesContent":["import type { AlphaFilter } from \"./implementations/alpha\";\r\nimport type { BlurFilter } from \"./implementations/blur\";\r\nimport type { ColorAdjustmentFilter } from \"./implementations/color-adjustment\";\r\nimport type { ColorMatrixFilter } from \"./implementations/color-matrix\";\r\nimport type { CurvesFilter } from \"./implementations/curves\";\r\nimport type { ExposureFilter } from \"./implementations/exposure\";\r\nimport type { GrayscaleFilter } from \"./implementations/grayscale\";\r\nimport type { PosterizeTimeFilter } from \"./implementations/posterize-time\";\r\nimport type { VideoEchoFilter } from \"./implementations/echo\";\r\n\r\nimport type { NodeEffect } from \"../effects/union\";\r\nimport type { BlurEffect } from \"../effects/implementations/blur\";\r\nimport type { GrayscaleEffect } from \"../effects/implementations/grayscale\";\r\nimport type { CurvesEffect } from \"../effects/implementations/curves\";\r\nimport type { ColorAdjustmentEffect } from \"../effects/implementations/color-adjustment\";\r\nimport type { MagnifyEffect } from \"../effects/implementations/magnify\";\r\nimport type { MotionBlurEffect } from \"../effects/implementations/motion-blur\";\r\nimport type { OutlineEffect } from \"../effects/implementations/outline\";\r\nimport type { DropShadowEffect } from \"@/attributes/shape/effects/implementations/drop-shadow\";\r\nimport type { GlowEffect } from \"../effects/implementations/glow\";\r\nimport type { GlassEffect } from \"../effects/implementations/glass\";\r\n\r\n/**\r\n * The node effects that are **not** media filters, and why.\r\n *\r\n * Everything else in {@link NodeEffect} is a function of the pixels it is\r\n * given, so it means exactly the same thing applied to a node's rendered\r\n * content or to one fill layer's own pixels — and the renderer already runs\r\n * both through a single handler registry. This is the exception list, so a new\r\n * effect becomes a filter by default rather than by remembering to add it.\r\n *\r\n * Two reasons land here:\r\n *\r\n * - **Needs something a fill layer doesn't have.** `magnify` and `glass` sample\r\n * the backdrop beneath the node — glass is a slab you see *through*, and a\r\n * node's own paint is not something there is anything behind; `motionBlur` and\r\n * `trails` are derived from the node's sampled velocity. A fill has no\r\n * backdrop and no motion of its own.\r\n * - **Draws outside the silhouette.** `outline` paints a ring around the\r\n * content, which the shape path a fill is clipped to would cut away, and\r\n * `glow` bleeds past it in every direction — a glow clipped to the thing that\r\n * cast it is not a dimmer glow, it is no glow at all. (`bloom` stays: it is\r\n * the contained version of the same idea, which is what makes it the right\r\n * one to reach for on a fill.)\r\n *\r\n * `blur`, `grayscale`, `curves` and `colorAdjustment` are excluded for a third,\r\n * bookkeeping reason: they already have a dedicated filter type below, sharing\r\n * the same fields and the same renderer handler.\r\n */\r\ntype NonFilterEffect =\r\n | MagnifyEffect\r\n | GlassEffect\r\n | MotionBlurEffect\r\n | OutlineEffect\r\n | DropShadowEffect\r\n | GlowEffect\r\n | BlurEffect\r\n | GrayscaleEffect\r\n | CurvesEffect\r\n | ColorAdjustmentEffect;\r\n\r\n/**\r\n * Node effects usable as a media filter — i.e. applied to one image/video\r\n * fill's own pixels rather than to a node and everything under it.\r\n *\r\n * This is what lets a background image be oil-painted, dithered or posterized\r\n * without wrapping it in a node whose effect would also hit its children:\r\n *\r\n * Rect({\r\n * fill: Fills.image('bg.jpg', { filters: Adjustments.oilPaint(4) }),\r\n * children: [Text({ text: \"still sharp\" })],\r\n * })\r\n *\r\n * The effects carry a `mode` field that means nothing here (a fill has no\r\n * backdrop); the {@link VideoAdjustmentChain} builders drop it, and the renderer ignores\r\n * it on this path.\r\n */\r\nexport type EffectAdjustment = Exclude<NodeEffect, NonFilterEffect>;\r\n\r\n/**\r\n * Discriminated union of pixel filters — the filters valid on both image and\r\n * video fills. Each is realised either as a single CanvasKit image filter\r\n * applied via `paint.setImageFilter`, or — for the ones that resample pixel\r\n * *positions* — as a lens shader wrapping the fill's own shader.\r\n */\r\nexport type MediaAdjustment =\r\n | ExposureFilter\r\n | BlurFilter\r\n | GrayscaleFilter\r\n | AlphaFilter\r\n | ColorMatrixFilter\r\n | CurvesFilter\r\n | ColorAdjustmentFilter\r\n | EffectAdjustment;\r\n\r\n/**\r\n * Discriminated union of video-only filters — temporal/multi-frame effects that\r\n * are meaningless on a still image (a single frame has no time axis and no\r\n * previous frames). Consumed outside the pixel `setImageFilter` path.\r\n */\r\nexport type VideoOnlyAdjustment =\r\n | PosterizeTimeFilter\r\n | VideoEchoFilter;\r\n"]}
1
+ {"version":3,"file":"union.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/union.ts"],"names":[],"mappings":"","sourcesContent":["import type { AlphaFilter } from \"./implementations/alpha\";\nimport type { BlurFilter } from \"./implementations/blur\";\nimport type { ColorAdjustmentFilter } from \"./implementations/color-adjustment\";\nimport type { ColorMatrixFilter } from \"./implementations/color-matrix\";\nimport type { CurvesFilter } from \"./implementations/curves\";\nimport type { ExposureFilter } from \"./implementations/exposure\";\nimport type { GrayscaleFilter } from \"./implementations/grayscale\";\nimport type { PosterizeTimeFilter } from \"./implementations/posterize-time\";\nimport type { VideoEchoFilter } from \"./implementations/echo\";\n\nimport type { NodeEffect } from \"../effects/union\";\nimport type { BlurEffect } from \"../effects/implementations/blur\";\nimport type { GrayscaleEffect } from \"../effects/implementations/grayscale\";\nimport type { CurvesEffect } from \"../effects/implementations/curves\";\nimport type { ColorAdjustmentEffect } from \"../effects/implementations/color-adjustment\";\nimport type { MagnifyEffect } from \"../effects/implementations/magnify\";\nimport type { MotionBlurEffect } from \"../effects/implementations/motion-blur\";\nimport type { OutlineEffect } from \"../effects/implementations/outline\";\nimport type { DropShadowEffect } from \"@/attributes/shape/effects/implementations/drop-shadow\";\nimport type { GlowEffect } from \"../effects/implementations/glow\";\nimport type { GlassEffect } from \"../effects/implementations/glass\";\n\n/**\n * The node effects that are **not** media filters, and why.\n *\n * Everything else in {@link NodeEffect} is a function of the pixels it is\n * given, so it means exactly the same thing applied to a node's rendered\n * content or to one fill layer's own pixels — and the renderer already runs\n * both through a single handler registry. This is the exception list, so a new\n * effect becomes a filter by default rather than by remembering to add it.\n *\n * Two reasons land here:\n *\n * - **Needs something a fill layer doesn't have.** `magnify` and `glass` sample\n * the backdrop beneath the node — glass is a slab you see *through*, and a\n * node's own paint is not something there is anything behind; `motionBlur` and\n * `trails` are derived from the node's sampled velocity. A fill has no\n * backdrop and no motion of its own.\n * - **Draws outside the silhouette.** `outline` paints a ring around the\n * content, which the shape path a fill is clipped to would cut away, and\n * `glow` bleeds past it in every direction — a glow clipped to the thing that\n * cast it is not a dimmer glow, it is no glow at all. (`bloom` stays: it is\n * the contained version of the same idea, which is what makes it the right\n * one to reach for on a fill.)\n *\n * `blur`, `grayscale`, `curves` and `colorAdjustment` are excluded for a third,\n * bookkeeping reason: they already have a dedicated filter type below, sharing\n * the same fields and the same renderer handler.\n */\ntype NonFilterEffect =\n | MagnifyEffect\n | GlassEffect\n | MotionBlurEffect\n | OutlineEffect\n | DropShadowEffect\n | GlowEffect\n | BlurEffect\n | GrayscaleEffect\n | CurvesEffect\n | ColorAdjustmentEffect;\n\n/**\n * Node effects usable as a media filter — i.e. applied to one image/video\n * fill's own pixels rather than to a node and everything under it.\n *\n * This is what lets a background image be oil-painted, dithered or posterized\n * without wrapping it in a node whose effect would also hit its children:\n *\n * Rect({\n * fill: Fills.image('bg.jpg', { filters: Adjustments.oilPaint(4) }),\n * children: [Text({ text: \"still sharp\" })],\n * })\n *\n * The effects carry a `mode` field that means nothing here (a fill has no\n * backdrop); the {@link VideoAdjustmentChain} builders drop it, and the renderer ignores\n * it on this path.\n */\nexport type EffectAdjustment = Exclude<NodeEffect, NonFilterEffect>;\n\n/**\n * Discriminated union of pixel filters — the filters valid on both image and\n * video fills. Each is realised either as a per-pixel colour filter, or — for\n * the ones that resample pixel *positions* — as a lens pass over the fill.\n */\nexport type MediaAdjustment =\n | ExposureFilter\n | BlurFilter\n | GrayscaleFilter\n | AlphaFilter\n | ColorMatrixFilter\n | CurvesFilter\n | ColorAdjustmentFilter\n | EffectAdjustment;\n\n/**\n * Discriminated union of video-only filters — temporal/multi-frame effects that\n * are meaningless on a still image (a single frame has no time axis and no\n * previous frames). Consumed outside the pixel `setImageFilter` path.\n */\nexport type VideoOnlyAdjustment =\n | PosterizeTimeFilter\n | VideoEchoFilter;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"anchors.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/anchors.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE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,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;YACxE,EAAE;SACL,CAAC;IACN,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,YAAY,CAChC,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,EAC5B,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,KAAK,EACvB,EAAE,CAAC,KAAK,EACR,CAAC,CACJ,CAAC;IACF,OAAO;QACH,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACtC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;QACpE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE;KACrC,CAAC;AACN,CAAC","sourcesContent":["/**\r\n * The editable vector model — subpaths of anchors, each carrying the two bezier\r\n * handles that govern the segments either side of it — and the unit box it is\r\n * quoted against. Figma's vector model, and what a person actually drags.\r\n *\r\n * The **second** of the two boundaries where geometry is deliberately flattened\r\n * to one curve type. An arc has no handles to drag, so it becomes cubics on the\r\n * way in — a conversion, where it used to be a truncation: `A` was missing from\r\n * the old parser's letter list, so it stopped dead at the first arc and\r\n * everything after it disappeared. Real-world icons draw their rounded joins\r\n * with arcs, so pasting one in lost most of the shape.\r\n *\r\n * **The coordinate space is the node's own box**: `x` and `y` run -0.5 to +0.5\r\n * across its width and height, y pointing *down* the way SVG's does. Resizing is\r\n * then an ordinary width/height drag, because the geometry is a fraction of the\r\n * box rather than a pixel count inside it — no gizmo code has to know a path\r\n * from a rect. Points *may* sit outside it: a point dragged past an edge is\r\n * honest about where it was dropped, and {@link normalize} pulls the\r\n * box back around the geometry once, on the way out of an edit.\r\n */\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport { arcSweepToCubics, cubicAxis, cubicExtrema, quadToCubic, splitCubicAt } from \"./bezier\";\r\nimport { contours, segmentArc } from \"./walk\";\r\nimport type { Extents } from \"@/layout/bounds\";\r\nimport type { Cubic, PathAnchor, PathContour, PathNormalization, PathSubpath, VectorPath } from \"./types\";\r\n\r\n/** An empty path, as the value an unset `data` field resolves to. */\r\nexport const EMPTY_PATH_DATA = \"\";\r\n\r\n// ── Reading ────────────────────────────────────────────────────────────────\r\n\r\n/** Whether two points are the same to within serialization noise. */\r\nfunction samePoint(a: Vector2, b: Vector2): boolean {\r\n return Math.abs(a.x - b.x) < 1e-6 && Math.abs(a.y - b.y) < 1e-6;\r\n}\r\n\r\n/**\r\n * Marks a subpath closed, folding a duplicated last anchor into the first.\r\n *\r\n * A `d` string that ends `… L 0 0 Z` — which every serializer that closes\r\n * explicitly produces, ours included when a closing segment carries handles —\r\n * names the start point twice: once as the last `L`/`C` target and once\r\n * implicitly by `Z`. Left alone, the round trip would grow an anchor on every\r\n * load, which is the kind of drift that only shows up after a file has been\r\n * opened a hundred times.\r\n */\r\nfunction closeSubpath(subpath: PathSubpath): void {\r\n subpath.closed = true;\r\n const { anchors } = subpath;\r\n if (anchors.length < 2) return;\r\n const first = anchors[0];\r\n const last = anchors[anchors.length - 1];\r\n if (!samePoint(first.point, last.point)) return;\r\n // The closing segment's own curvature belongs to the join, so the duplicate's\r\n // in-handle becomes the first anchor's.\r\n first.inHandle = last.inHandle;\r\n anchors.pop();\r\n}\r\n\r\n/** A copy of a point of the memoized contour — the model is edited in place. */\r\nconst copy = (v: Vector2): Vector2 => ({ x: v.x, y: v.y });\r\n\r\nfunction contourToSubpath(contour: PathContour): PathSubpath {\r\n // Every point and handle is copied out of the memoized contour: `contours`\r\n // shares its result between callers, and an editor moves these in place.\r\n const anchors: PathAnchor[] = [\r\n { point: copy(contour.start), inHandle: null, outHandle: null },\r\n ];\r\n const curve = (cubic: Cubic) => {\r\n anchors[anchors.length - 1].outHandle = copy(cubic.c1);\r\n anchors.push({ point: copy(cubic.p1), inHandle: copy(cubic.c2), outHandle: null });\r\n };\r\n\r\n for (const segment of contour.segments) {\r\n switch (segment.kind) {\r\n case \"line\":\r\n // Both handles stay null, which is what draws a straight segment.\r\n anchors.push({ point: copy(segment.to), inHandle: null, outHandle: null });\r\n break;\r\n case \"cubic\":\r\n curve({ p0: segment.from, c1: segment.c1, c2: segment.c2, p1: segment.to });\r\n break;\r\n case \"quad\":\r\n curve(quadToCubic(segment.from, segment.c, segment.to));\r\n break;\r\n case \"arc\": {\r\n const arc = segmentArc(segment);\r\n for (const cubic of arcSweepToCubics(arc, arc.theta1, arc.theta1 + arc.dtheta)) {\r\n curve(cubic);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const subpath: PathSubpath = { anchors, closed: false };\r\n if (contour.closed) closeSubpath(subpath);\r\n return subpath;\r\n}\r\n\r\n/**\r\n * Any {@link PathData} as the editable model.\r\n *\r\n * Takes `PathData`, not a string. The old entry point took only a string and\r\n * every caller had to guard — `typeof data === \"string\" ? data : \"\"` — which\r\n * meant a node animating its `data` drew *nothing* for the whole tween, because\r\n * a morph hands over a `PathCommand[]` at every `t` strictly between 0 and 1.\r\n */\r\nexport function anchors(d: PathData | null | undefined): VectorPath {\r\n return contours(d)\r\n .map(contourToSubpath)\r\n .filter((subpath) => subpath.anchors.length > 0);\r\n}\r\n\r\n// ── Writing ────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * How many decimals a stored coordinate keeps.\r\n *\r\n * The space is the unit box, so a coordinate is a fraction of the node's size:\r\n * five decimals is sub-pixel on a 10,000px node and keeps the string short\r\n * enough that a path is a sane thing to hold in a JSON column. It also makes the\r\n * round trip *stable* — a drag that lands where it started re-serializes to the\r\n * identical string, which is what lets an editor tell \"nothing changed\" from\r\n * \"changed by a rounding error\".\r\n */\r\nconst COORD_PRECISION = 5;\r\n\r\nfunction fmt(value: number): string {\r\n if (!Number.isFinite(value)) return \"0\";\r\n const rounded = Number(value.toFixed(COORD_PRECISION));\r\n // `-0` serializes as \"0\": the two are the same point, and a sign that flips\r\n // with the wind would make the \"did anything change\" comparison lie.\r\n return String(rounded === 0 ? 0 : rounded);\r\n}\r\n\r\n/**\r\n * What one segment between two anchors *is* — a line, or a cubic and its\r\n * controls.\r\n *\r\n * The decision lived twice, once per output format: `segmentData` wrote it as a\r\n * `d` string and `pushSegment` as a `PathCommand`, with the same rule about a\r\n * missing handle standing in as its own anchor written out both times.\r\n */\r\nfunction segmentBetween(from: PathAnchor, to: PathAnchor):\r\n | { line: true; to: Vector2 }\r\n | { line: false; c1: Vector2; c2: Vector2; to: Vector2 } {\r\n if (from.outHandle === null && to.inHandle === null) {\r\n return { line: true, to: to.point };\r\n }\r\n // A missing handle stands in as its own anchor, which is the degenerate cubic\r\n // that draws as a straight pull towards the other end — the same thing every\r\n // vector editor means by \"one side of this segment is a curve\".\r\n return {\r\n line: false,\r\n c1: from.outHandle ?? from.point,\r\n c2: to.inHandle ?? to.point,\r\n to: to.point,\r\n };\r\n}\r\n\r\n/**\r\n * Serializes the model back to a `d` string.\r\n *\r\n * Only `M`, `L`, `C` and `Z` are emitted — the four commands the editor can\r\n * round-trip — so what is stored is always what can be edited.\r\n */\r\nexport function fromAnchors(path: VectorPath): string {\r\n const parts: string[] = [];\r\n for (const { anchors, closed } of path) {\r\n if (anchors.length === 0) continue;\r\n parts.push(`M ${fmt(anchors[0].point.x)} ${fmt(anchors[0].point.y)}`);\r\n for (let i = 1; i < anchors.length; i++) {\r\n const segment = segmentBetween(anchors[i - 1], anchors[i]);\r\n parts.push(segment.line\r\n ? `L ${fmt(segment.to.x)} ${fmt(segment.to.y)}`\r\n : `C ${fmt(segment.c1.x)} ${fmt(segment.c1.y)} ${fmt(segment.c2.x)} ${fmt(segment.c2.y)} ${fmt(segment.to.x)} ${fmt(segment.to.y)}`);\r\n }\r\n if (closed) {\r\n if (anchors.length > 1) {\r\n const join = segmentBetween(anchors[anchors.length - 1], anchors[0]);\r\n // A straight closing segment is what `Z` already draws, so emitting\r\n // it as well would add the duplicate anchor `closeSubpath` undoes.\r\n if (!join.line) {\r\n parts.push(`C ${fmt(join.c1.x)} ${fmt(join.c1.y)} ${fmt(join.c2.x)} ${fmt(join.c2.y)} ${fmt(join.to.x)} ${fmt(join.to.y)}`);\r\n }\r\n }\r\n parts.push(\"Z\");\r\n }\r\n }\r\n return parts.join(\" \");\r\n}\r\n\r\nconst identity = (point: Vector2): Vector2 => point;\r\n\r\n/**\r\n * The model as drawable commands, with a transform folded into the same pass.\r\n *\r\n * Every caller needs one — unit box → the node's laid-out pixels, and y-down →\r\n * the renderer's y-up — and doing it here means one allocation per frame instead\r\n * of two, on a list rebuilt every time the node repaints.\r\n */\r\nexport function anchorCommands(\r\n path: VectorPath,\r\n transform: (point: Vector2) => Vector2 = identity,\r\n): PathCommand[] {\r\n const out: PathCommand[] = [];\r\n const emit = (from: PathAnchor, to: PathAnchor) => {\r\n const segment = segmentBetween(from, to);\r\n const end = transform(segment.to);\r\n if (segment.line) {\r\n out.push({ type: \"L\", x: end.x, y: end.y });\r\n return;\r\n }\r\n const c1 = transform(segment.c1);\r\n const c2 = transform(segment.c2);\r\n out.push({ type: \"C\", x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: end.x, y: end.y });\r\n };\r\n\r\n for (const { anchors, closed } of path) {\r\n if (anchors.length === 0) continue;\r\n const start = transform(anchors[0].point);\r\n out.push({ type: \"M\", x: start.x, y: start.y });\r\n for (let i = 1; i < anchors.length; i++) emit(anchors[i - 1], anchors[i]);\r\n if (closed) {\r\n if (anchors.length > 1) {\r\n const from = anchors[anchors.length - 1];\r\n const to = anchors[0];\r\n if (from.outHandle !== null || to.inHandle !== null) emit(from, to);\r\n }\r\n out.push({ type: \"Z\" });\r\n }\r\n }\r\n return out;\r\n}\r\n\r\n// ── Measuring ──────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * The path's tight bounding box, or `null` when it has no points.\r\n *\r\n * Tight, not the handle polygon's hull: a cubic's own extrema are solved for,\r\n * because the handles can sit a long way outside the curve and a box derived\r\n * from them would leave a visible gap between a normalized shape and the edge of\r\n * its node.\r\n */\r\nexport function anchorBounds(path: VectorPath): Extents | null {\r\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\r\n let seen = false;\r\n\r\n const includeX = (x: number) => { seen = true; if (x < minX) minX = x; if (x > maxX) maxX = x; };\r\n const includeY = (y: number) => { seen = true; if (y < minY) minY = y; if (y > maxY) maxY = y; };\r\n\r\n for (const { anchors, closed } of path) {\r\n for (const anchor of anchors) {\r\n includeX(anchor.point.x);\r\n includeY(anchor.point.y);\r\n }\r\n // The closing join exists only with a second anchor to join: the writers\r\n // emit none for a lone one (`M x y Z` draws nothing), so its self-loop\r\n // must not widen the box either.\r\n const last = closed && anchors.length > 1 ? anchors.length : anchors.length - 1;\r\n for (let i = 0; i < last; i++) {\r\n const from = anchors[i];\r\n const to = anchors[(i + 1) % anchors.length];\r\n if (from.outHandle === null && to.inHandle === null) continue;\r\n const c1 = from.outHandle ?? from.point;\r\n const c2 = to.inHandle ?? to.point;\r\n for (const t of cubicExtrema(from.point.x, c1.x, c2.x, to.point.x)) {\r\n includeX(cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x));\r\n }\r\n for (const t of cubicExtrema(from.point.y, c1.y, c2.y, to.point.y)) {\r\n includeY(cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y));\r\n }\r\n }\r\n }\r\n\r\n return seen ? { minX, minY, maxX, maxY } : null;\r\n}\r\n\r\n// ── Transforming ───────────────────────────────────────────────────────────\r\n\r\n/** Applies `fn` to every point and handle, returning a new path. */\r\nexport function map(path: VectorPath, fn: (point: Vector2) => Vector2): VectorPath {\r\n return path.map((subpath) => ({\r\n closed: subpath.closed,\r\n anchors: subpath.anchors.map((anchor) => ({\r\n point: fn(anchor.point),\r\n inHandle: anchor.inHandle ? fn(anchor.inHandle) : null,\r\n outHandle: anchor.outHandle ? fn(anchor.outHandle) : null,\r\n })),\r\n }));\r\n}\r\n\r\n/**\r\n * The turn-and-scale about `start` that carries `end` onto `to` — how `moveTo`\r\n * fits a path aimed at another node. Where `start` and `end` coincide there is\r\n * no chord to turn, so it translates instead.\r\n */\r\nexport function endFit(start: Vector2, end: Vector2, to: Vector2): (point: Vector2) => Vector2 {\r\n const cx = end.x - start.x;\r\n const cy = end.y - start.y;\r\n const chord = cx * cx + cy * cy;\r\n if (chord < 1e-12) {\r\n const dx = to.x - end.x;\r\n const dy = to.y - end.y;\r\n return (p) => ({ x: p.x + dx, y: p.y + dy });\r\n }\r\n // (to - start) / (end - start) as complex numbers: a rotation and a uniform scale.\r\n const tx = to.x - start.x;\r\n const ty = to.y - start.y;\r\n const re = (tx * cx + ty * cy) / chord;\r\n const im = (ty * cx - tx * cy) / chord;\r\n return (p) => {\r\n const ux = p.x - start.x;\r\n const uy = p.y - start.y;\r\n return { x: start.x + re * ux - im * uy, y: start.y + im * ux + re * uy };\r\n };\r\n}\r\n\r\n/** Whether a path would draw anything at all. */\r\nexport function isEmpty(path: VectorPath): boolean {\r\n return path.every((subpath) => subpath.anchors.length < 2);\r\n}\r\n\r\n/**\r\n * The unit box's extent — the node's own layout rect, as a fraction of itself.\r\n *\r\n * Exported because two very different callers need the same half: a renderer\r\n * scales by the extent (1 unit = the node's full width), and an editor projects\r\n * a screen point into it.\r\n */\r\nexport const PATH_UNIT_EXTENT = 1;\r\n\r\n/** Half of {@link PATH_UNIT_EXTENT} — the distance from the centre to an edge. */\r\nexport const PATH_UNIT_HALF = PATH_UNIT_EXTENT / 2;\r\n\r\n/**\r\n * The box a path's coordinates are already quoted against — the node's own\r\n * frame, as {@link PATH_UNIT_HALF} either side of centre.\r\n */\r\nexport const UNIT_PATH_BOX: Extents = {\r\n minX: -PATH_UNIT_HALF,\r\n minY: -PATH_UNIT_HALF,\r\n maxX: PATH_UNIT_HALF,\r\n maxY: PATH_UNIT_HALF,\r\n};\r\n\r\n/**\r\n * Pulls the unit box back around the geometry.\r\n *\r\n * What an editor runs on the way *out* of a path edit, and the reason a node\r\n * whose points were dragged all over the canvas still ends up with a selection\r\n * box that hugs it. The caller pairs it with the node's own size and position:\r\n * the box grows by `scaleX`/`scaleY` and moves by `centerX`/`centerY` scaled\r\n * into the node's parent, so the drawing doesn't shift on screen while its frame\r\n * changes underneath it.\r\n */\r\nexport function normalize(path: VectorPath): PathNormalization {\r\n const bounds = anchorBounds(path);\r\n if (!bounds) return { path, scaleX: 1, scaleY: 1, centerX: 0, centerY: 0 };\r\n return fitToBox(path, bounds);\r\n}\r\n\r\n/**\r\n * Re-quotes a path against `box` — the general form of\r\n * {@link normalize}, which is this with the geometry's own bounds.\r\n *\r\n * The two callers want the same arithmetic for opposite reasons. A canvas editor\r\n * fits the box to the drawing on the way out, so a node drawn in a corner of its\r\n * frame ends up with a frame that hugs it. An appearance dialog lets the frame\r\n * be **stated** instead — dragged wider than the drawing to leave a margin, or\r\n * slid so the drawing sits off-centre — and then fits to that.\r\n *\r\n * A degenerate axis — every point on one line, which is a perfectly reasonable\r\n * thing to draw — keeps its scale at 1 rather than dividing by zero, so a flat\r\n * path stays where it is instead of becoming NaN.\r\n */\r\nexport function fitToBox(path: VectorPath, box: Extents): PathNormalization {\r\n const width = box.maxX - box.minX;\r\n const height = box.maxY - box.minY;\r\n const centerX = (box.minX + box.maxX) / 2;\r\n const centerY = (box.minY + box.maxY) / 2;\r\n const scaleX = width > 1e-9 ? width / PATH_UNIT_EXTENT : 1;\r\n const scaleY = height > 1e-9 ? height / PATH_UNIT_EXTENT : 1;\r\n\r\n return {\r\n path: map(path, (p) => ({\r\n x: (p.x - centerX) / scaleX,\r\n y: (p.y - centerY) / scaleY,\r\n })),\r\n scaleX,\r\n scaleY,\r\n centerX,\r\n centerY,\r\n };\r\n}\r\n\r\n/** Moves every point and handle by the same delta. */\r\nexport function translate(path: VectorPath, delta: Vector2): VectorPath {\r\n return map(path, (p) => ({ x: p.x + delta.x, y: p.y + delta.y }));\r\n}\r\n\r\n/**\r\n * A point on the segment between two anchors, at parameter `t`.\r\n *\r\n * An editor needs it twice over: to find where on a segment a click landed (so a\r\n * double-click can insert an anchor there), and to draw the preview of the\r\n * anchor that insertion would create.\r\n */\r\nexport function pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2 {\r\n if (from.outHandle === null && to.inHandle === null) {\r\n return {\r\n x: from.point.x + (to.point.x - from.point.x) * t,\r\n y: from.point.y + (to.point.y - from.point.y) * t,\r\n };\r\n }\r\n const c1 = from.outHandle ?? from.point;\r\n const c2 = to.inHandle ?? to.point;\r\n return {\r\n x: cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x),\r\n y: cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y),\r\n };\r\n}\r\n\r\n/**\r\n * Splits the segment between two anchors at `t`, returning the three anchors\r\n * that replace them — the two ends with their outer handles shortened, and the\r\n * new anchor in the middle carrying both halves of the split tangent.\r\n *\r\n * De Casteljau, which is what makes the insertion *invisible*: the curve through\r\n * the new point is the same curve, so double-clicking a segment adds somewhere\r\n * to grab rather than changing the shape under the pointer.\r\n */\r\nexport function split(\r\n from: PathAnchor, to: PathAnchor, t: number,\r\n): { from: PathAnchor; middle: PathAnchor; to: PathAnchor } {\r\n if (from.outHandle === null && to.inHandle === null) {\r\n return {\r\n from,\r\n middle: { point: pointOn(from, to, t), inHandle: null, outHandle: null },\r\n to,\r\n };\r\n }\r\n\r\n const { left, right } = splitCubicAt(\r\n from.point,\r\n from.outHandle ?? from.point,\r\n to.inHandle ?? to.point,\r\n to.point,\r\n t,\r\n );\r\n return {\r\n from: { ...from, outHandle: left.cp1 },\r\n middle: { point: left.to, inHandle: left.cp2, outHandle: right.cp1 },\r\n to: { ...to, inHandle: right.cp2 },\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"anchors.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/anchors.ts"],"names":[],"mappings":"AAsB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AC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;YACxE,EAAE;SACL,CAAC;IACN,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,YAAY,CAChC,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,EAC5B,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,KAAK,EACvB,EAAE,CAAC,KAAK,EACR,CAAC,CACJ,CAAC;IACF,OAAO;QACH,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACtC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;QACpE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE;KACrC,CAAC;AACN,CAAC","sourcesContent":["/**\n * The editable vector model — subpaths of anchors, each carrying the two bezier\n * handles that govern the segments either side of it — and the unit box it is\n * quoted against. Figma's vector model, and what a person actually drags.\n *\n * The **second** of the two boundaries where geometry is deliberately flattened\n * to one curve type. An arc has no handles to drag, so it becomes cubics on the\n * way in — a conversion, where it used to be a truncation: `A` was missing from\n * the old parser's letter list, so it stopped dead at the first arc and\n * everything after it disappeared. Real-world icons draw their rounded joins\n * with arcs, so pasting one in lost most of the shape.\n *\n * **The coordinate space is the node's own box**: `x` and `y` run -0.5 to +0.5\n * across its width and height, y pointing *down* the way SVG's does. Resizing is\n * then an ordinary width/height drag, because the geometry is a fraction of the\n * box rather than a pixel count inside it — no gizmo code has to know a path\n * from a rect. Points *may* sit outside it: a point dragged past an edge is\n * honest about where it was dropped, and {@link normalize} pulls the\n * box back around the geometry once, on the way out of an edit.\n */\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { arcSweepToCubics, cubicAxis, cubicExtrema, quadToCubic, splitCubicAt } from \"./bezier\";\nimport { contours, segmentArc } from \"./walk\";\nimport type { Extents } from \"@/layout/bounds\";\nimport type { Cubic, PathAnchor, PathContour, PathNormalization, PathSubpath, VectorPath } from \"./types\";\n\n/** An empty path, as the value an unset `data` field resolves to. */\nexport const EMPTY_PATH_DATA = \"\";\n\n// ── Reading ────────────────────────────────────────────────────────────────\n\n/** Whether two points are the same to within serialization noise. */\nfunction samePoint(a: Vector2, b: Vector2): boolean {\n return Math.abs(a.x - b.x) < 1e-6 && Math.abs(a.y - b.y) < 1e-6;\n}\n\n/**\n * Marks a subpath closed, folding a duplicated last anchor into the first.\n *\n * A `d` string that ends `… L 0 0 Z` — which every serializer that closes\n * explicitly produces, ours included when a closing segment carries handles —\n * names the start point twice: once as the last `L`/`C` target and once\n * implicitly by `Z`. Left alone, the round trip would grow an anchor on every\n * load, which is the kind of drift that only shows up after a file has been\n * opened a hundred times.\n */\nfunction closeSubpath(subpath: PathSubpath): void {\n subpath.closed = true;\n const { anchors } = subpath;\n if (anchors.length < 2) return;\n const first = anchors[0];\n const last = anchors[anchors.length - 1];\n if (!samePoint(first.point, last.point)) return;\n // The closing segment's own curvature belongs to the join, so the duplicate's\n // in-handle becomes the first anchor's.\n first.inHandle = last.inHandle;\n anchors.pop();\n}\n\n/** A copy of a point of the memoized contour — the model is edited in place. */\nconst copy = (v: Vector2): Vector2 => ({ x: v.x, y: v.y });\n\nfunction contourToSubpath(contour: PathContour): PathSubpath {\n // Every point and handle is copied out of the memoized contour: `contours`\n // shares its result between callers, and an editor moves these in place.\n const anchors: PathAnchor[] = [\n { point: copy(contour.start), inHandle: null, outHandle: null },\n ];\n const curve = (cubic: Cubic) => {\n anchors[anchors.length - 1].outHandle = copy(cubic.c1);\n anchors.push({ point: copy(cubic.p1), inHandle: copy(cubic.c2), outHandle: null });\n };\n\n for (const segment of contour.segments) {\n switch (segment.kind) {\n case \"line\":\n // Both handles stay null, which is what draws a straight segment.\n anchors.push({ point: copy(segment.to), inHandle: null, outHandle: null });\n break;\n case \"cubic\":\n curve({ p0: segment.from, c1: segment.c1, c2: segment.c2, p1: segment.to });\n break;\n case \"quad\":\n curve(quadToCubic(segment.from, segment.c, segment.to));\n break;\n case \"arc\": {\n const arc = segmentArc(segment);\n for (const cubic of arcSweepToCubics(arc, arc.theta1, arc.theta1 + arc.dtheta)) {\n curve(cubic);\n }\n break;\n }\n }\n }\n\n const subpath: PathSubpath = { anchors, closed: false };\n if (contour.closed) closeSubpath(subpath);\n return subpath;\n}\n\n/**\n * Any {@link PathData} as the editable model.\n *\n * Takes `PathData`, not a string. The old entry point took only a string and\n * every caller had to guard — `typeof data === \"string\" ? data : \"\"` — which\n * meant a node animating its `data` drew *nothing* for the whole tween, because\n * a morph hands over a `PathCommand[]` at every `t` strictly between 0 and 1.\n */\nexport function anchors(d: PathData | null | undefined): VectorPath {\n return contours(d)\n .map(contourToSubpath)\n .filter((subpath) => subpath.anchors.length > 0);\n}\n\n// ── Writing ────────────────────────────────────────────────────────────────\n\n/**\n * How many decimals a stored coordinate keeps.\n *\n * The space is the unit box, so a coordinate is a fraction of the node's size:\n * five decimals is sub-pixel on a 10,000px node and keeps the string short\n * enough that a path is a sane thing to hold in a JSON column. It also makes the\n * round trip *stable* — a drag that lands where it started re-serializes to the\n * identical string, which is what lets an editor tell \"nothing changed\" from\n * \"changed by a rounding error\".\n */\nconst COORD_PRECISION = 5;\n\nfunction fmt(value: number): string {\n if (!Number.isFinite(value)) return \"0\";\n const rounded = Number(value.toFixed(COORD_PRECISION));\n // `-0` serializes as \"0\": the two are the same point, and a sign that flips\n // with the wind would make the \"did anything change\" comparison lie.\n return String(rounded === 0 ? 0 : rounded);\n}\n\n/**\n * What one segment between two anchors *is* — a line, or a cubic and its\n * controls.\n *\n * The decision lived twice, once per output format: `segmentData` wrote it as a\n * `d` string and `pushSegment` as a `PathCommand`, with the same rule about a\n * missing handle standing in as its own anchor written out both times.\n */\nfunction segmentBetween(from: PathAnchor, to: PathAnchor):\n | { line: true; to: Vector2 }\n | { line: false; c1: Vector2; c2: Vector2; to: Vector2 } {\n if (from.outHandle === null && to.inHandle === null) {\n return { line: true, to: to.point };\n }\n // A missing handle stands in as its own anchor, which is the degenerate cubic\n // that draws as a straight pull towards the other end — the same thing every\n // vector editor means by \"one side of this segment is a curve\".\n return {\n line: false,\n c1: from.outHandle ?? from.point,\n c2: to.inHandle ?? to.point,\n to: to.point,\n };\n}\n\n/**\n * Serializes the model back to a `d` string.\n *\n * Only `M`, `L`, `C` and `Z` are emitted — the four commands the editor can\n * round-trip — so what is stored is always what can be edited.\n */\nexport function fromAnchors(path: VectorPath): string {\n const parts: string[] = [];\n for (const { anchors, closed } of path) {\n if (anchors.length === 0) continue;\n parts.push(`M ${fmt(anchors[0].point.x)} ${fmt(anchors[0].point.y)}`);\n for (let i = 1; i < anchors.length; i++) {\n const segment = segmentBetween(anchors[i - 1], anchors[i]);\n parts.push(segment.line\n ? `L ${fmt(segment.to.x)} ${fmt(segment.to.y)}`\n : `C ${fmt(segment.c1.x)} ${fmt(segment.c1.y)} ${fmt(segment.c2.x)} ${fmt(segment.c2.y)} ${fmt(segment.to.x)} ${fmt(segment.to.y)}`);\n }\n if (closed) {\n if (anchors.length > 1) {\n const join = segmentBetween(anchors[anchors.length - 1], anchors[0]);\n // A straight closing segment is what `Z` already draws, so emitting\n // it as well would add the duplicate anchor `closeSubpath` undoes.\n if (!join.line) {\n parts.push(`C ${fmt(join.c1.x)} ${fmt(join.c1.y)} ${fmt(join.c2.x)} ${fmt(join.c2.y)} ${fmt(join.to.x)} ${fmt(join.to.y)}`);\n }\n }\n parts.push(\"Z\");\n }\n }\n return parts.join(\" \");\n}\n\nconst identity = (point: Vector2): Vector2 => point;\n\n/**\n * The model as drawable commands, with a transform folded into the same pass.\n *\n * Every caller needs one — unit box → the node's laid-out pixels, and y-down →\n * the renderer's y-up — and doing it here means one allocation per frame instead\n * of two, on a list rebuilt every time the node repaints.\n */\nexport function anchorCommands(\n path: VectorPath,\n transform: (point: Vector2) => Vector2 = identity,\n): PathCommand[] {\n const out: PathCommand[] = [];\n const emit = (from: PathAnchor, to: PathAnchor) => {\n const segment = segmentBetween(from, to);\n const end = transform(segment.to);\n if (segment.line) {\n out.push({ type: \"L\", x: end.x, y: end.y });\n return;\n }\n const c1 = transform(segment.c1);\n const c2 = transform(segment.c2);\n out.push({ type: \"C\", x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: end.x, y: end.y });\n };\n\n for (const { anchors, closed } of path) {\n if (anchors.length === 0) continue;\n const start = transform(anchors[0].point);\n out.push({ type: \"M\", x: start.x, y: start.y });\n for (let i = 1; i < anchors.length; i++) emit(anchors[i - 1], anchors[i]);\n if (closed) {\n if (anchors.length > 1) {\n const from = anchors[anchors.length - 1];\n const to = anchors[0];\n if (from.outHandle !== null || to.inHandle !== null) emit(from, to);\n }\n out.push({ type: \"Z\" });\n }\n }\n return out;\n}\n\n// ── Measuring ──────────────────────────────────────────────────────────────\n\n/**\n * The path's tight bounding box, or `null` when it has no points.\n *\n * Tight, not the handle polygon's hull: a cubic's own extrema are solved for,\n * because the handles can sit a long way outside the curve and a box derived\n * from them would leave a visible gap between a normalized shape and the edge of\n * its node.\n */\nexport function anchorBounds(path: VectorPath): Extents | null {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n let seen = false;\n\n const includeX = (x: number) => { seen = true; if (x < minX) minX = x; if (x > maxX) maxX = x; };\n const includeY = (y: number) => { seen = true; if (y < minY) minY = y; if (y > maxY) maxY = y; };\n\n for (const { anchors, closed } of path) {\n for (const anchor of anchors) {\n includeX(anchor.point.x);\n includeY(anchor.point.y);\n }\n // The closing join exists only with a second anchor to join: the writers\n // emit none for a lone one (`M x y Z` draws nothing), so its self-loop\n // must not widen the box either.\n const last = closed && anchors.length > 1 ? anchors.length : anchors.length - 1;\n for (let i = 0; i < last; i++) {\n const from = anchors[i];\n const to = anchors[(i + 1) % anchors.length];\n if (from.outHandle === null && to.inHandle === null) continue;\n const c1 = from.outHandle ?? from.point;\n const c2 = to.inHandle ?? to.point;\n for (const t of cubicExtrema(from.point.x, c1.x, c2.x, to.point.x)) {\n includeX(cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x));\n }\n for (const t of cubicExtrema(from.point.y, c1.y, c2.y, to.point.y)) {\n includeY(cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y));\n }\n }\n }\n\n return seen ? { minX, minY, maxX, maxY } : null;\n}\n\n// ── Transforming ───────────────────────────────────────────────────────────\n\n/** Applies `fn` to every point and handle, returning a new path. */\nexport function map(path: VectorPath, fn: (point: Vector2) => Vector2): VectorPath {\n return path.map((subpath) => ({\n closed: subpath.closed,\n anchors: subpath.anchors.map((anchor) => ({\n point: fn(anchor.point),\n inHandle: anchor.inHandle ? fn(anchor.inHandle) : null,\n outHandle: anchor.outHandle ? fn(anchor.outHandle) : null,\n })),\n }));\n}\n\n/**\n * The turn-and-scale about `start` that carries `end` onto `to` — how `moveTo`\n * fits a path aimed at another node. Where `start` and `end` coincide there is\n * no chord to turn, so it translates instead.\n */\nexport function endFit(start: Vector2, end: Vector2, to: Vector2): (point: Vector2) => Vector2 {\n const cx = end.x - start.x;\n const cy = end.y - start.y;\n const chord = cx * cx + cy * cy;\n if (chord < 1e-12) {\n const dx = to.x - end.x;\n const dy = to.y - end.y;\n return (p) => ({ x: p.x + dx, y: p.y + dy });\n }\n // (to - start) / (end - start) as complex numbers: a rotation and a uniform scale.\n const tx = to.x - start.x;\n const ty = to.y - start.y;\n const re = (tx * cx + ty * cy) / chord;\n const im = (ty * cx - tx * cy) / chord;\n return (p) => {\n const ux = p.x - start.x;\n const uy = p.y - start.y;\n return { x: start.x + re * ux - im * uy, y: start.y + im * ux + re * uy };\n };\n}\n\n/** Whether a path would draw anything at all. */\nexport function isEmpty(path: VectorPath): boolean {\n return path.every((subpath) => subpath.anchors.length < 2);\n}\n\n/**\n * The unit box's extent — the node's own layout rect, as a fraction of itself.\n *\n * Exported because two very different callers need the same half: a renderer\n * scales by the extent (1 unit = the node's full width), and an editor projects\n * a screen point into it.\n */\nexport const PATH_UNIT_EXTENT = 1;\n\n/** Half of {@link PATH_UNIT_EXTENT} — the distance from the centre to an edge. */\nexport const PATH_UNIT_HALF = PATH_UNIT_EXTENT / 2;\n\n/**\n * The box a path's coordinates are already quoted against — the node's own\n * frame, as {@link PATH_UNIT_HALF} either side of centre.\n */\nexport const UNIT_PATH_BOX: Extents = {\n minX: -PATH_UNIT_HALF,\n minY: -PATH_UNIT_HALF,\n maxX: PATH_UNIT_HALF,\n maxY: PATH_UNIT_HALF,\n};\n\n/**\n * Pulls the unit box back around the geometry.\n *\n * What an editor runs on the way *out* of a path edit, and the reason a node\n * whose points were dragged all over the canvas still ends up with a selection\n * box that hugs it. The caller pairs it with the node's own size and position:\n * the box grows by `scaleX`/`scaleY` and moves by `centerX`/`centerY` scaled\n * into the node's parent, so the drawing doesn't shift on screen while its frame\n * changes underneath it.\n */\nexport function normalize(path: VectorPath): PathNormalization {\n const bounds = anchorBounds(path);\n if (!bounds) return { path, scaleX: 1, scaleY: 1, centerX: 0, centerY: 0 };\n return fitToBox(path, bounds);\n}\n\n/**\n * Re-quotes a path against `box` — the general form of\n * {@link normalize}, which is this with the geometry's own bounds.\n *\n * The two callers want the same arithmetic for opposite reasons. A canvas editor\n * fits the box to the drawing on the way out, so a node drawn in a corner of its\n * frame ends up with a frame that hugs it. An appearance dialog lets the frame\n * be **stated** instead — dragged wider than the drawing to leave a margin, or\n * slid so the drawing sits off-centre — and then fits to that.\n *\n * A degenerate axis — every point on one line, which is a perfectly reasonable\n * thing to draw — keeps its scale at 1 rather than dividing by zero, so a flat\n * path stays where it is instead of becoming NaN.\n */\nexport function fitToBox(path: VectorPath, box: Extents): PathNormalization {\n const width = box.maxX - box.minX;\n const height = box.maxY - box.minY;\n const centerX = (box.minX + box.maxX) / 2;\n const centerY = (box.minY + box.maxY) / 2;\n const scaleX = width > 1e-9 ? width / PATH_UNIT_EXTENT : 1;\n const scaleY = height > 1e-9 ? height / PATH_UNIT_EXTENT : 1;\n\n return {\n path: map(path, (p) => ({\n x: (p.x - centerX) / scaleX,\n y: (p.y - centerY) / scaleY,\n })),\n scaleX,\n scaleY,\n centerX,\n centerY,\n };\n}\n\n/** Moves every point and handle by the same delta. */\nexport function translate(path: VectorPath, delta: Vector2): VectorPath {\n return map(path, (p) => ({ x: p.x + delta.x, y: p.y + delta.y }));\n}\n\n/**\n * A point on the segment between two anchors, at parameter `t`.\n *\n * An editor needs it twice over: to find where on a segment a click landed (so a\n * double-click can insert an anchor there), and to draw the preview of the\n * anchor that insertion would create.\n */\nexport function pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2 {\n if (from.outHandle === null && to.inHandle === null) {\n return {\n x: from.point.x + (to.point.x - from.point.x) * t,\n y: from.point.y + (to.point.y - from.point.y) * t,\n };\n }\n const c1 = from.outHandle ?? from.point;\n const c2 = to.inHandle ?? to.point;\n return {\n x: cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x),\n y: cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y),\n };\n}\n\n/**\n * Splits the segment between two anchors at `t`, returning the three anchors\n * that replace them — the two ends with their outer handles shortened, and the\n * new anchor in the middle carrying both halves of the split tangent.\n *\n * De Casteljau, which is what makes the insertion *invisible*: the curve through\n * the new point is the same curve, so double-clicking a segment adds somewhere\n * to grab rather than changing the shape under the pointer.\n */\nexport function split(\n from: PathAnchor, to: PathAnchor, t: number,\n): { from: PathAnchor; middle: PathAnchor; to: PathAnchor } {\n if (from.outHandle === null && to.inHandle === null) {\n return {\n from,\n middle: { point: pointOn(from, to, t), inHandle: null, outHandle: null },\n to,\n };\n }\n\n const { left, right } = splitCubicAt(\n from.point,\n from.outHandle ?? from.point,\n to.inHandle ?? to.point,\n to.point,\n t,\n );\n return {\n from: { ...from, outHandle: left.cp1 },\n middle: { point: left.to, inHandle: left.cp2, outHandle: right.cp1 },\n to: { ...to, inHandle: right.cp2 },\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"bezier.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/bezier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAInE;;;;;;;;;;;;;;GAcG;AAEH,iGAAiG;AACjG,MAAM,kBAAkB,GAAqC,IAAI,GAAG,CAAC;IACjE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CACzC,CAAC,CAAC;AAIH;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAyB;IACvD,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,OAAe;IAChE,OAAO,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC;AACjC,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,QAAQ,CAAC,CAAU,EAAE,CAAU;IAC3C,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;IAC/E,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CA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,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;IACzD,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;IACxD,OAAO;QACH,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACrB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;KACxB,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAc,EAAE,KAAa;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACxB,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC;IAChE,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC9C,OAAO,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACpD,CAAC;AAED,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand } from \"@/render/descriptors/path\";\r\nimport type { ArcParams, Cubic } from \"./types\";\r\n\r\n/**\r\n * Shared Bézier, arc and path-geometry primitives.\r\n *\r\n * Everything under `shape/path/` that evaluates, splits, measures or bounds a\r\n * curve reaches for these rather than carrying its own copy. That used to be an\r\n * aspiration this file's header stated and only three of seven callers honoured:\r\n * De Casteljau existed three times, quad→cubic and cubic evaluation twice each,\r\n * and the arc's endpoint→center conversion twice — once returning a sampler and\r\n * once returning cubics, differing in nothing else.\r\n *\r\n * Two evaluation styles are provided:\r\n * - Scalar (`cubicAxis` / `quadAxis`) — evaluate a single axis. Cheaper when you\r\n * already have loose x/y numbers and want to avoid allocating a {@link Vector2}.\r\n * - Vector (`cubicPoint` / `quadPoint`) — evaluate both axes into a {@link Vector2}.\r\n */\r\n\r\n/** SVG curve commands whose tangent feeds the reflected control point of a following S/s/T/t. */\r\nconst SMOOTH_CURVE_TYPES: ReadonlySet<PathCommand[\"type\"]> = new Set([\r\n \"C\", \"c\", \"S\", \"s\", \"Q\", \"q\", \"T\", \"t\",\r\n]);\r\n\r\n\r\n\r\n/**\r\n * True when a command's trailing control point should be remembered so the next\r\n * smooth command (S/s/T/t) can reflect it. Per the SVG spec, if the previous\r\n * command was not one of these, the implied control point is the current point.\r\n */\r\nexport function isSmoothCurveType(type: PathCommand[\"type\"]): boolean {\r\n return SMOOTH_CURVE_TYPES.has(type);\r\n}\r\n\r\n/** Reflect a control point through the current point: `2 * current - control`. */\r\nexport function reflectControlPoint(current: number, control: number): number {\r\n return 2 * current - control;\r\n}\r\n\r\n/** Euclidean distance between two points. */\r\nexport function distance(a: Vector2, b: Vector2): number {\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n return Math.sqrt(dx * dx + dy * dy);\r\n}\r\n\r\n/** Evaluate one axis of a cubic Bézier at parameter `t` (0..1). */\r\nexport function cubicAxis(t: number, p0: number, p1: number, p2: number, p3: number): number {\r\n const u = 1 - t;\r\n return u * u * u * p0 + 3 * u * u * t * p1 + 3 * u * t * t * p2 + t * t * t * p3;\r\n}\r\n\r\n/** Evaluate one axis of a quadratic Bézier at parameter `t` (0..1). */\r\nexport function quadAxis(t: number, p0: number, p1: number, p2: number): number {\r\n const u = 1 - t;\r\n return u * u * p0 + 2 * u * t * p1 + t * t * p2;\r\n}\r\n\r\n/** Evaluate a cubic Bézier at parameter `t` (0..1) into a {@link Vector2}. */\r\nexport function cubicPoint(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: number): Vector2 {\r\n return {\r\n x: cubicAxis(t, p0.x, p1.x, p2.x, p3.x),\r\n y: cubicAxis(t, p0.y, p1.y, p2.y, p3.y),\r\n };\r\n}\r\n\r\n/** Evaluate a quadratic Bézier at parameter `t` (0..1) into a {@link Vector2}. */\r\nexport function quadPoint(p0: Vector2, p1: Vector2, p2: Vector2, t: number): Vector2 {\r\n return {\r\n x: quadAxis(t, p0.x, p1.x, p2.x),\r\n y: quadAxis(t, p0.y, p1.y, p2.y),\r\n };\r\n}\r\n\r\n/**\r\n * Approximate the arc length of a parametric curve by sampling it into a polyline\r\n * and summing the segment distances. More `steps` trade speed for accuracy.\r\n */\r\nexport function sampleCurveLength(pointAt: (t: number) => Vector2, steps = 32): number {\r\n let length = 0;\r\n let prev = pointAt(0);\r\n for (let i = 1; i <= steps; i++) {\r\n const next = pointAt(i / steps);\r\n length += distance(prev, next);\r\n prev = next;\r\n }\r\n return length;\r\n}\r\n\r\n/**\r\n * Binary-search the curve parameter `t` whose arc length from the start equals\r\n * `targetDist`. Used to find exactly where a curve should be cut. The curve is\r\n * re-sampled on each probe, so this is intentionally simple rather than fast;\r\n * 20 iterations give sub-pixel precision for typical path lengths.\r\n */\r\nexport function paramAtDistance(\r\n pointAt: (t: number) => Vector2,\r\n targetDist: number,\r\n totalLen: number,\r\n): number {\r\n if (totalLen === 0 || targetDist <= 0) return 0;\r\n if (targetDist >= totalLen) return 1;\r\n\r\n let lo = 0, hi = 1;\r\n for (let i = 0; i < 20; i++) {\r\n const mid = (lo + hi) / 2;\r\n let len = 0;\r\n let prev = pointAt(0);\r\n const steps = 16;\r\n for (let j = 1; j <= steps; j++) {\r\n const p = pointAt(mid * j / steps);\r\n len += distance(prev, p);\r\n prev = p;\r\n }\r\n if (len < targetDist) lo = mid;\r\n else hi = mid;\r\n }\r\n return (lo + hi) / 2;\r\n}\r\n\r\n// --- Degree conversion -----------------------------------------------------\r\n\r\n/** A straight line as a cubic: controls sit on the line at 1/3 and 2/3. */\r\nexport function lineToCubic(from: Vector2, to: Vector2): Cubic {\r\n return {\r\n p0: from,\r\n c1: lerpVector2(from, to, 1 / 3),\r\n c2: lerpVector2(from, to, 2 / 3),\r\n p1: to,\r\n };\r\n}\r\n\r\n/** Elevate a quadratic Bézier to the equivalent cubic (exact, not an approximation). */\r\nexport function quadToCubic(from: Vector2, cp: Vector2, to: Vector2): Cubic {\r\n return {\r\n p0: from,\r\n c1: { x: from.x + (2 / 3) * (cp.x - from.x), y: from.y + (2 / 3) * (cp.y - from.y) },\r\n c2: { x: to.x + (2 / 3) * (cp.x - to.x), y: to.y + (2 / 3) * (cp.y - to.y) },\r\n p1: to,\r\n };\r\n}\r\n\r\n// --- De Casteljau splitting ---\r\n// Splitting a Bézier at parameter `t` yields two sub-curves that together trace\r\n// the exact same shape, so trimming preserves curvature instead of polylining it.\r\n\r\nexport function splitCubicAt(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: number) {\r\n const a = lerpVector2(p0, p1, t);\r\n const b = lerpVector2(p1, p2, t);\r\n const c = lerpVector2(p2, p3, t);\r\n const d = lerpVector2(a, b, t);\r\n const e = lerpVector2(b, c, t);\r\n const f = lerpVector2(d, e, t);\r\n return {\r\n left: { from: p0, cp1: a, cp2: d, to: f },\r\n right: { from: f, cp1: e, cp2: c, to: p3 },\r\n };\r\n}\r\n\r\n/** The sub-cubic spanning parameters `t0..t1` of the original cubic. */\r\nexport function extractCubicRange(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t0: number, t1: number) {\r\n if (t0 === 0) return splitCubicAt(p0, p1, p2, p3, t1).left;\r\n const { right } = splitCubicAt(p0, p1, p2, p3, t0);\r\n const adj = (t1 - t0) / (1 - t0);\r\n return splitCubicAt(right.from, right.cp1, right.cp2, right.to, adj).left;\r\n}\r\n\r\nexport function splitQuadAt(p0: Vector2, p1: Vector2, p2: Vector2, t: number) {\r\n const a = lerpVector2(p0, p1, t);\r\n const b = lerpVector2(p1, p2, t);\r\n const c = lerpVector2(a, b, t);\r\n return {\r\n left: { from: p0, cp: a, to: c },\r\n right: { from: c, cp: b, to: p2 },\r\n };\r\n}\r\n\r\n/** The sub-quadratic spanning parameters `t0..t1` of the original quadratic. */\r\nexport function extractQuadRange(p0: Vector2, p1: Vector2, p2: Vector2, t0: number, t1: number) {\r\n if (t0 === 0) return splitQuadAt(p0, p1, p2, t1).left;\r\n const { right } = splitQuadAt(p0, p1, p2, t0);\r\n const adj = (t1 - t0) / (1 - t0);\r\n return splitQuadAt(right.from, right.cp, right.to, adj).left;\r\n}\r\n\r\n// --- Extrema ---------------------------------------------------------------\r\n\r\n/** The `t` values in (0, 1) where a cubic's one-dimensional derivative is zero. */\r\nexport function cubicExtrema(p0: number, p1: number, p2: number, p3: number): number[] {\r\n // B'(t) = 3[(p1−p0)(1−t)² + 2(p2−p1)t(1−t) + (p3−p2)t²], written as at² + bt + c.\r\n const a = -p0 + 3 * p1 - 3 * p2 + p3;\r\n const b = 2 * (p0 - 2 * p1 + p2);\r\n const c = p1 - p0;\r\n const roots: number[] = [];\r\n const push = (t: number) => {\r\n if (t > 0 && t < 1) roots.push(t);\r\n };\r\n if (Math.abs(a) < 1e-12) {\r\n if (Math.abs(b) > 1e-12) push(-c / b);\r\n return roots;\r\n }\r\n const disc = b * b - 4 * a * c;\r\n if (disc < 0) return roots;\r\n const root = Math.sqrt(disc);\r\n push((-b + root) / (2 * a));\r\n push((-b - root) / (2 * a));\r\n return roots;\r\n}\r\n\r\n/** The `t` value in (0, 1) where a quadratic's one-dimensional derivative is zero. */\r\nexport function quadExtrema(p0: number, p1: number, p2: number): number[] {\r\n // B'(t) = 2[(p1−p0)(1−t) + (p2−p1)t] = 0.\r\n const denominator = p0 - 2 * p1 + p2;\r\n if (Math.abs(denominator) < 1e-12) return [];\r\n const t = (p0 - p1) / denominator;\r\n return t > 0 && t < 1 ? [t] : [];\r\n}\r\n\r\n// --- Arc endpoint-to-center conversion -------------------------------------\r\n\r\nfunction angleBetween(ux: number, uy: number, vx: number, vy: number): number {\r\n const dot = ux * vx + uy * vy;\r\n const len = Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy);\r\n let angle = Math.acos(Math.max(-1, Math.min(1, dot / len)));\r\n if (ux * vy - uy * vx < 0) angle = -angle;\r\n return angle;\r\n}\r\n\r\n\r\n/**\r\n * The endpoint→center conversion of an SVG `A` command.\r\n *\r\n * Returned as the ellipse's own parameters rather than as a sampler, because the\r\n * two things that need an arc want different halves of it: flattening wants\r\n * points, and bounding wants the angles where each axis turns around. A sampler\r\n * alone forces the second to guess.\r\n */\r\nexport function arcParams(\r\n from: Vector2, to: Vector2,\r\n rxRaw: number, ryRaw: number, rotation: number, largeArc: 0 | 1, sweep: 0 | 1,\r\n): ArcParams {\r\n const phi = rotation * Math.PI / 180;\r\n const cosPhi = Math.cos(phi), sinPhi = Math.sin(phi);\r\n\r\n const dx = (from.x - to.x) / 2;\r\n const dy = (from.y - to.y) / 2;\r\n const x1p = cosPhi * dx + sinPhi * dy;\r\n const y1p = -sinPhi * dx + cosPhi * dy;\r\n\r\n let rx = Math.abs(rxRaw), ry = Math.abs(ryRaw);\r\n const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);\r\n if (lambda > 1) {\r\n const s = Math.sqrt(lambda);\r\n rx *= s;\r\n ry *= s;\r\n }\r\n\r\n const rx2 = rx * rx, ry2 = ry * ry;\r\n const x1p2 = x1p * x1p, y1p2 = y1p * y1p;\r\n const sq = Math.max(0, (rx2 * ry2 - rx2 * y1p2 - ry2 * x1p2) / (rx2 * y1p2 + ry2 * x1p2));\r\n const sign = (largeArc === sweep) ? -1 : 1;\r\n const cxp = sign * Math.sqrt(sq) * (rx * y1p / ry);\r\n const cyp = sign * Math.sqrt(sq) * -(ry * x1p / rx);\r\n\r\n const cx = cosPhi * cxp - sinPhi * cyp + (from.x + to.x) / 2;\r\n const cy = sinPhi * cxp + cosPhi * cyp + (from.y + to.y) / 2;\r\n\r\n const theta1 = angleBetween(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);\r\n let dtheta = angleBetween((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);\r\n if (sweep === 0 && dtheta > 0) dtheta -= 2 * Math.PI;\r\n if (sweep === 1 && dtheta < 0) dtheta += 2 * Math.PI;\r\n\r\n return { cx, cy, rx, ry, phi, theta1, dtheta };\r\n}\r\n\r\n/** The point on an arc at ellipse angle `theta`. */\r\nexport function arcPointAtAngle(arc: ArcParams, theta: number): Vector2 {\r\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\r\n const cosT = Math.cos(theta), sinT = Math.sin(theta);\r\n return {\r\n x: cosPhi * arc.rx * cosT - sinPhi * arc.ry * sinT + arc.cx,\r\n y: sinPhi * arc.rx * cosT + cosPhi * arc.ry * sinT + arc.cy,\r\n };\r\n}\r\n\r\n/** A parametric function tracing the arc from its start (`t=0`) to its end (`t=1`). */\r\nexport function arcPointFunction(arc: ArcParams): (t: number) => Vector2 {\r\n return (t: number) => arcPointAtAngle(arc, arc.theta1 + t * arc.dtheta);\r\n}\r\n\r\n/** The derivative of {@link arcPointAtAngle} with respect to `theta`. */\r\nfunction arcDerivativeAtAngle(arc: ArcParams, theta: number): Vector2 {\r\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\r\n const cosT = Math.cos(theta), sinT = Math.sin(theta);\r\n return {\r\n x: -arc.rx * cosPhi * sinT - arc.ry * sinPhi * cosT,\r\n y: -arc.rx * sinPhi * sinT + arc.ry * cosPhi * cosT,\r\n };\r\n}\r\n\r\n/**\r\n * The arc's `theta0..theta1` span as cubics — the one place an arc is\r\n * approximated.\r\n *\r\n * Split so no piece spans more than 90°, which is the standard bound: the\r\n * `(4/3)·tan(Δ/4)` construction is exact at both endpoints and at the midpoint,\r\n * and its worst-case radial error over a quarter turn is about 2.7e-4 of the\r\n * radius. There were two implementations of this before — one splitting by\r\n * angle, one fitting sampled points with a \"catmull-rom-like\" guess — and only\r\n * the first was worth keeping.\r\n */\r\nexport function arcSweepToCubics(arc: ArcParams, theta0: number, theta1: number): Cubic[] {\r\n const sweep = theta1 - theta0;\r\n if (Math.abs(sweep) < 1e-12) return [];\r\n const pieces = Math.max(1, Math.ceil(Math.abs(sweep) / (Math.PI / 2)));\r\n const step = sweep / pieces;\r\n const alpha = (4 / 3) * Math.tan(step / 4);\r\n\r\n const cubics: Cubic[] = [];\r\n for (let i = 0; i < pieces; i++) {\r\n const a0 = theta0 + step * i;\r\n const a1 = a0 + step;\r\n const p0 = arcPointAtAngle(arc, a0);\r\n const p1 = arcPointAtAngle(arc, a1);\r\n const d0 = arcDerivativeAtAngle(arc, a0);\r\n const d1 = arcDerivativeAtAngle(arc, a1);\r\n cubics.push({\r\n p0,\r\n c1: { x: p0.x + alpha * d0.x, y: p0.y + alpha * d0.y },\r\n c2: { x: p1.x - alpha * d1.x, y: p1.y - alpha * d1.y },\r\n p1,\r\n });\r\n }\r\n return cubics;\r\n}\r\n\r\n/**\r\n * The ellipse angles at which each axis turns around — the candidates an exact\r\n * bounding box tests against the swept range.\r\n */\r\nexport function arcAxisAngles(arc: ArcParams): { x: number[]; y: number[] } {\r\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\r\n // dx/dθ = 0 and dy/dθ = 0, each giving one angle and its antipode.\r\n const tx = Math.atan2(-arc.ry * sinPhi, arc.rx * cosPhi);\r\n const ty = Math.atan2(arc.ry * cosPhi, arc.rx * sinPhi);\r\n return {\r\n x: [tx, tx + Math.PI],\r\n y: [ty, ty + Math.PI],\r\n };\r\n}\r\n\r\n/**\r\n * Whether ellipse angle `theta` lies within the arc's swept range.\r\n *\r\n * Compared as a distance travelled in the sweep's own direction rather than as\r\n * an interval, because `theta1 + dtheta` routinely leaves `[-π, π]` and an\r\n * interval test would then reject the very angles that are inside it.\r\n */\r\nexport function arcContainsAngle(arc: ArcParams, theta: number): boolean {\r\n const TAU = Math.PI * 2;\r\n const forward = arc.dtheta >= 0;\r\n const delta = forward ? theta - arc.theta1 : arc.theta1 - theta;\r\n const travelled = ((delta % TAU) + TAU) % TAU;\r\n return travelled <= Math.abs(arc.dtheta) + 1e-9;\r\n}\r\n\r\n/** Re-exported so curve math and point lerping live behind a single import. */\r\nexport { lerpVector2 };\r\n"]}
1
+ {"version":3,"file":"bezier.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/bezier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAInE;;;;;;;;;;;;;;GAcG;AAEH,iGAAiG;AACjG,MAAM,kBAAkB,GAAqC,IAAI,GAAG,CAAC;IACjE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CACzC,CAAC,CAAC;AAIH;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAyB;IACvD,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,OAAe;IAChE,OAAO,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC;AACjC,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,QAAQ,CAAC,CAAU,EAAE,CAAU;IAC3C,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,EAA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AG,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7D,mEAAmE;IACnE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;IACzD,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;IACxD,OAAO;QACH,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACrB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;KACxB,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAc,EAAE,KAAa;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACxB,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC;IAChE,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC9C,OAAO,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACpD,CAAC;AAED,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand } from \"@/render/descriptors/path\";\nimport type { ArcParams, Cubic } from \"./types\";\n\n/**\n * Shared Bézier, arc and path-geometry primitives.\n *\n * Everything under `shape/path/` that evaluates, splits, measures or bounds a\n * curve reaches for these rather than carrying its own copy. That used to be an\n * aspiration this file's header stated and only three of seven callers honoured:\n * De Casteljau existed three times, quad→cubic and cubic evaluation twice each,\n * and the arc's endpoint→center conversion twice — once returning a sampler and\n * once returning cubics, differing in nothing else.\n *\n * Two evaluation styles are provided:\n * - Scalar (`cubicAxis` / `quadAxis`) — evaluate a single axis. Cheaper when you\n * already have loose x/y numbers and want to avoid allocating a {@link Vector2}.\n * - Vector (`cubicPoint` / `quadPoint`) — evaluate both axes into a {@link Vector2}.\n */\n\n/** SVG curve commands whose tangent feeds the reflected control point of a following S/s/T/t. */\nconst SMOOTH_CURVE_TYPES: ReadonlySet<PathCommand[\"type\"]> = new Set([\n \"C\", \"c\", \"S\", \"s\", \"Q\", \"q\", \"T\", \"t\",\n]);\n\n\n\n/**\n * True when a command's trailing control point should be remembered so the next\n * smooth command (S/s/T/t) can reflect it. Per the SVG spec, if the previous\n * command was not one of these, the implied control point is the current point.\n */\nexport function isSmoothCurveType(type: PathCommand[\"type\"]): boolean {\n return SMOOTH_CURVE_TYPES.has(type);\n}\n\n/** Reflect a control point through the current point: `2 * current - control`. */\nexport function reflectControlPoint(current: number, control: number): number {\n return 2 * current - control;\n}\n\n/** Euclidean distance between two points. */\nexport function distance(a: Vector2, b: Vector2): number {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/** Evaluate one axis of a cubic Bézier at parameter `t` (0..1). */\nexport function cubicAxis(t: number, p0: number, p1: number, p2: number, p3: number): number {\n const u = 1 - t;\n return u * u * u * p0 + 3 * u * u * t * p1 + 3 * u * t * t * p2 + t * t * t * p3;\n}\n\n/** Evaluate one axis of a quadratic Bézier at parameter `t` (0..1). */\nexport function quadAxis(t: number, p0: number, p1: number, p2: number): number {\n const u = 1 - t;\n return u * u * p0 + 2 * u * t * p1 + t * t * p2;\n}\n\n/** Evaluate a cubic Bézier at parameter `t` (0..1) into a {@link Vector2}. */\nexport function cubicPoint(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: number): Vector2 {\n return {\n x: cubicAxis(t, p0.x, p1.x, p2.x, p3.x),\n y: cubicAxis(t, p0.y, p1.y, p2.y, p3.y),\n };\n}\n\n/** Evaluate a quadratic Bézier at parameter `t` (0..1) into a {@link Vector2}. */\nexport function quadPoint(p0: Vector2, p1: Vector2, p2: Vector2, t: number): Vector2 {\n return {\n x: quadAxis(t, p0.x, p1.x, p2.x),\n y: quadAxis(t, p0.y, p1.y, p2.y),\n };\n}\n\n/**\n * Approximate the arc length of a parametric curve by sampling it into a polyline\n * and summing the segment distances. More `steps` trade speed for accuracy.\n */\nexport function sampleCurveLength(pointAt: (t: number) => Vector2, steps = 32): number {\n let length = 0;\n let prev = pointAt(0);\n for (let i = 1; i <= steps; i++) {\n const next = pointAt(i / steps);\n length += distance(prev, next);\n prev = next;\n }\n return length;\n}\n\n/**\n * Binary-search the curve parameter `t` whose arc length from the start equals\n * `targetDist`. Used to find exactly where a curve should be cut. The curve is\n * re-sampled on each probe, so this is intentionally simple rather than fast;\n * 20 iterations give sub-pixel precision for typical path lengths.\n */\nexport function paramAtDistance(\n pointAt: (t: number) => Vector2,\n targetDist: number,\n totalLen: number,\n): number {\n if (totalLen === 0 || targetDist <= 0) return 0;\n if (targetDist >= totalLen) return 1;\n\n let lo = 0, hi = 1;\n for (let i = 0; i < 20; i++) {\n const mid = (lo + hi) / 2;\n let len = 0;\n let prev = pointAt(0);\n const steps = 16;\n for (let j = 1; j <= steps; j++) {\n const p = pointAt(mid * j / steps);\n len += distance(prev, p);\n prev = p;\n }\n if (len < targetDist) lo = mid;\n else hi = mid;\n }\n return (lo + hi) / 2;\n}\n\n// --- Degree conversion -----------------------------------------------------\n\n/** A straight line as a cubic: controls sit on the line at 1/3 and 2/3. */\nexport function lineToCubic(from: Vector2, to: Vector2): Cubic {\n return {\n p0: from,\n c1: lerpVector2(from, to, 1 / 3),\n c2: lerpVector2(from, to, 2 / 3),\n p1: to,\n };\n}\n\n/** Elevate a quadratic Bézier to the equivalent cubic (exact, not an approximation). */\nexport function quadToCubic(from: Vector2, cp: Vector2, to: Vector2): Cubic {\n return {\n p0: from,\n c1: { x: from.x + (2 / 3) * (cp.x - from.x), y: from.y + (2 / 3) * (cp.y - from.y) },\n c2: { x: to.x + (2 / 3) * (cp.x - to.x), y: to.y + (2 / 3) * (cp.y - to.y) },\n p1: to,\n };\n}\n\n// --- De Casteljau splitting ---\n// Splitting a Bézier at parameter `t` yields two sub-curves that together trace\n// the exact same shape, so trimming preserves curvature instead of polylining it.\n\nexport function splitCubicAt(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: number) {\n const a = lerpVector2(p0, p1, t);\n const b = lerpVector2(p1, p2, t);\n const c = lerpVector2(p2, p3, t);\n const d = lerpVector2(a, b, t);\n const e = lerpVector2(b, c, t);\n const f = lerpVector2(d, e, t);\n return {\n left: { from: p0, cp1: a, cp2: d, to: f },\n right: { from: f, cp1: e, cp2: c, to: p3 },\n };\n}\n\n/** The sub-cubic spanning parameters `t0..t1` of the original cubic. */\nexport function extractCubicRange(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t0: number, t1: number) {\n if (t0 === 0) return splitCubicAt(p0, p1, p2, p3, t1).left;\n const { right } = splitCubicAt(p0, p1, p2, p3, t0);\n const adj = (t1 - t0) / (1 - t0);\n return splitCubicAt(right.from, right.cp1, right.cp2, right.to, adj).left;\n}\n\nexport function splitQuadAt(p0: Vector2, p1: Vector2, p2: Vector2, t: number) {\n const a = lerpVector2(p0, p1, t);\n const b = lerpVector2(p1, p2, t);\n const c = lerpVector2(a, b, t);\n return {\n left: { from: p0, cp: a, to: c },\n right: { from: c, cp: b, to: p2 },\n };\n}\n\n/** The sub-quadratic spanning parameters `t0..t1` of the original quadratic. */\nexport function extractQuadRange(p0: Vector2, p1: Vector2, p2: Vector2, t0: number, t1: number) {\n if (t0 === 0) return splitQuadAt(p0, p1, p2, t1).left;\n const { right } = splitQuadAt(p0, p1, p2, t0);\n const adj = (t1 - t0) / (1 - t0);\n return splitQuadAt(right.from, right.cp, right.to, adj).left;\n}\n\n// --- Extrema ---------------------------------------------------------------\n\n/** The `t` values in (0, 1) where a cubic's one-dimensional derivative is zero. */\nexport function cubicExtrema(p0: number, p1: number, p2: number, p3: number): number[] {\n // B'(t) = 3[(p1−p0)(1−t)² + 2(p2−p1)t(1−t) + (p3−p2)t²], written as at² + bt + c.\n const a = -p0 + 3 * p1 - 3 * p2 + p3;\n const b = 2 * (p0 - 2 * p1 + p2);\n const c = p1 - p0;\n const roots: number[] = [];\n const push = (t: number) => {\n if (t > 0 && t < 1) roots.push(t);\n };\n if (Math.abs(a) < 1e-12) {\n if (Math.abs(b) > 1e-12) push(-c / b);\n return roots;\n }\n const disc = b * b - 4 * a * c;\n if (disc < 0) return roots;\n const root = Math.sqrt(disc);\n push((-b + root) / (2 * a));\n push((-b - root) / (2 * a));\n return roots;\n}\n\n/** The `t` value in (0, 1) where a quadratic's one-dimensional derivative is zero. */\nexport function quadExtrema(p0: number, p1: number, p2: number): number[] {\n // B'(t) = 2[(p1−p0)(1−t) + (p2−p1)t] = 0.\n const denominator = p0 - 2 * p1 + p2;\n if (Math.abs(denominator) < 1e-12) return [];\n const t = (p0 - p1) / denominator;\n return t > 0 && t < 1 ? [t] : [];\n}\n\n// --- Arc endpoint-to-center conversion -------------------------------------\n\nfunction angleBetween(ux: number, uy: number, vx: number, vy: number): number {\n const dot = ux * vx + uy * vy;\n const len = Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy);\n let angle = Math.acos(Math.max(-1, Math.min(1, dot / len)));\n if (ux * vy - uy * vx < 0) angle = -angle;\n return angle;\n}\n\n\n/**\n * The endpoint→center conversion of an SVG `A` command.\n *\n * Returned as the ellipse's own parameters rather than as a sampler, because the\n * two things that need an arc want different halves of it: flattening wants\n * points, and bounding wants the angles where each axis turns around. A sampler\n * alone forces the second to guess.\n */\nexport function arcParams(\n from: Vector2, to: Vector2,\n rxRaw: number, ryRaw: number, rotation: number, largeArc: 0 | 1, sweep: 0 | 1,\n): ArcParams {\n const phi = rotation * Math.PI / 180;\n const cosPhi = Math.cos(phi), sinPhi = Math.sin(phi);\n\n const dx = (from.x - to.x) / 2;\n const dy = (from.y - to.y) / 2;\n const x1p = cosPhi * dx + sinPhi * dy;\n const y1p = -sinPhi * dx + cosPhi * dy;\n\n let rx = Math.abs(rxRaw), ry = Math.abs(ryRaw);\n const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);\n if (lambda > 1) {\n const s = Math.sqrt(lambda);\n rx *= s;\n ry *= s;\n }\n\n const rx2 = rx * rx, ry2 = ry * ry;\n const x1p2 = x1p * x1p, y1p2 = y1p * y1p;\n const sq = Math.max(0, (rx2 * ry2 - rx2 * y1p2 - ry2 * x1p2) / (rx2 * y1p2 + ry2 * x1p2));\n const sign = (largeArc === sweep) ? -1 : 1;\n const cxp = sign * Math.sqrt(sq) * (rx * y1p / ry);\n const cyp = sign * Math.sqrt(sq) * -(ry * x1p / rx);\n\n const cx = cosPhi * cxp - sinPhi * cyp + (from.x + to.x) / 2;\n const cy = sinPhi * cxp + cosPhi * cyp + (from.y + to.y) / 2;\n\n const theta1 = angleBetween(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);\n let dtheta = angleBetween((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);\n if (sweep === 0 && dtheta > 0) dtheta -= 2 * Math.PI;\n if (sweep === 1 && dtheta < 0) dtheta += 2 * Math.PI;\n\n return { cx, cy, rx, ry, phi, theta1, dtheta };\n}\n\n/** The point on an arc at ellipse angle `theta`. */\nexport function arcPointAtAngle(arc: ArcParams, theta: number): Vector2 {\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\n const cosT = Math.cos(theta), sinT = Math.sin(theta);\n return {\n x: cosPhi * arc.rx * cosT - sinPhi * arc.ry * sinT + arc.cx,\n y: sinPhi * arc.rx * cosT + cosPhi * arc.ry * sinT + arc.cy,\n };\n}\n\n/** A parametric function tracing the arc from its start (`t=0`) to its end (`t=1`). */\nexport function arcPointFunction(arc: ArcParams): (t: number) => Vector2 {\n return (t: number) => arcPointAtAngle(arc, arc.theta1 + t * arc.dtheta);\n}\n\n/** The derivative of {@link arcPointAtAngle} with respect to `theta`. */\nfunction arcDerivativeAtAngle(arc: ArcParams, theta: number): Vector2 {\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\n const cosT = Math.cos(theta), sinT = Math.sin(theta);\n return {\n x: -arc.rx * cosPhi * sinT - arc.ry * sinPhi * cosT,\n y: -arc.rx * sinPhi * sinT + arc.ry * cosPhi * cosT,\n };\n}\n\n/**\n * The arc's `theta0..theta1` span as cubics — the one place an arc is\n * approximated.\n *\n * Split so no piece spans more than 90°, which is the standard bound: the\n * `(4/3)·tan(Δ/4)` construction is exact at both endpoints and at the midpoint,\n * and its worst-case radial error over a quarter turn is about 2.7e-4 of the\n * radius. There were two implementations of this before — one splitting by\n * angle, one fitting sampled points with a \"catmull-rom-like\" guess — and only\n * the first was worth keeping.\n */\nexport function arcSweepToCubics(arc: ArcParams, theta0: number, theta1: number): Cubic[] {\n const sweep = theta1 - theta0;\n if (Math.abs(sweep) < 1e-12) return [];\n const pieces = Math.max(1, Math.ceil(Math.abs(sweep) / (Math.PI / 2)));\n const step = sweep / pieces;\n const alpha = (4 / 3) * Math.tan(step / 4);\n\n const cubics: Cubic[] = [];\n for (let i = 0; i < pieces; i++) {\n const a0 = theta0 + step * i;\n const a1 = a0 + step;\n const p0 = arcPointAtAngle(arc, a0);\n const p1 = arcPointAtAngle(arc, a1);\n const d0 = arcDerivativeAtAngle(arc, a0);\n const d1 = arcDerivativeAtAngle(arc, a1);\n cubics.push({\n p0,\n c1: { x: p0.x + alpha * d0.x, y: p0.y + alpha * d0.y },\n c2: { x: p1.x - alpha * d1.x, y: p1.y - alpha * d1.y },\n p1,\n });\n }\n return cubics;\n}\n\n/**\n * The ellipse angles at which each axis turns around — the candidates an exact\n * bounding box tests against the swept range.\n */\nexport function arcAxisAngles(arc: ArcParams): { x: number[]; y: number[] } {\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\n // dx/dθ = 0 and dy/dθ = 0, each giving one angle and its antipode.\n const tx = Math.atan2(-arc.ry * sinPhi, arc.rx * cosPhi);\n const ty = Math.atan2(arc.ry * cosPhi, arc.rx * sinPhi);\n return {\n x: [tx, tx + Math.PI],\n y: [ty, ty + Math.PI],\n };\n}\n\n/**\n * Whether ellipse angle `theta` lies within the arc's swept range.\n *\n * Compared as a distance travelled in the sweep's own direction rather than as\n * an interval, because `theta1 + dtheta` routinely leaves `[-π, π]` and an\n * interval test would then reject the very angles that are inside it.\n */\nexport function arcContainsAngle(arc: ArcParams, theta: number): boolean {\n const TAU = Math.PI * 2;\n const forward = arc.dtheta >= 0;\n const delta = forward ? theta - arc.theta1 : arc.theta1 - theta;\n const travelled = ((delta % TAU) + TAU) % TAU;\n return travelled <= Math.abs(arc.dtheta) + 1e-9;\n}\n\n/** Re-exported so curve math and point lerping live behind a single import. */\nexport { lerpVector2 };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/**\r\n * Path geometry.\r\n *\r\n * One value — {@link pathOps} — carries every operation: parsing, the contour\r\n * normal form, bounds, length, sampling, dashing, trimming, morphing, and the\r\n * editable anchor model with its unit box. The free functions this used to\r\n * export (`calculatePathLength`, `applyDashPattern`, `extractSubpath`,\r\n * `createPathSampler`, `measurePathData`, `parsePathString`, `toPathCommands`,\r\n * `lerpPath`, `buildMorph`, `sampleMorph`, `toCubicSubpaths`) are those methods\r\n * now; each carried its own copy of the SVG pen walk, and the copies disagreed.\r\n */\r\nexport { pathOps } from \"./ops\";\r\nexport { EMPTY_PATH_DATA, PATH_UNIT_EXTENT, PATH_UNIT_HALF, UNIT_PATH_BOX } from \"./anchors\";\r\nexport type * from \"./types\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/**\n * Path geometry.\n *\n * One value — {@link pathOps} — carries every operation: parsing, the contour\n * normal form, bounds, length, sampling, dashing, trimming, morphing, and the\n * editable anchor model with its unit box. The free functions this used to\n * export (`calculatePathLength`, `applyDashPattern`, `extractSubpath`,\n * `createPathSampler`, `measurePathData`, `parsePathString`, `toPathCommands`,\n * `lerpPath`, `buildMorph`, `sampleMorph`, `toCubicSubpaths`) are those methods\n * now; each carried its own copy of the SVG pen walk, and the copies disagreed.\n */\nexport { pathOps } from \"./ops\";\nexport { EMPTY_PATH_DATA, PATH_UNIT_EXTENT, PATH_UNIT_HALF, UNIT_PATH_BOX } from \"./anchors\";\nexport type * from \"./types\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/measure.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKjF,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;A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,GAAG,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3F,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAElF,IAAI,SAAS,EAAE,CAAC;gBACZ,MAAM,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC3C,SAAS,GAAG,KAAK,CAAC;YACtB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC9C,WAAW,GAAG,MAAM,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["/**\r\n * Arc length, and everything measured in it: total length, the sampler, dashing\r\n * and trimming.\r\n *\r\n * Separate from the normal form because it is the expensive half of path\r\n * geometry and most callers never need it — bounding a path solves extrema in\r\n * closed form, and `Path.measure` / `Text.measure` run on every layout pass. So\r\n * flattening happens here, on demand.\r\n *\r\n * **One resolution.** There used to be three — 20 steps for\r\n * `length`, 32 for the trim segments, 50 for the sampler and the\r\n * dash walker — and `dash` combined two of them, scaling its dash\r\n * cycle against a length measured at 20 while walking the path at 50. Sharing\r\n * one number makes `length(d) === sampler(d).length` an invariant rather than a\r\n * coincidence.\r\n */\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport { distance } from \"./bezier\";\r\nimport { contourSegments, contours, segmentPointAt, segmentSplit } from \"./walk\";\r\nimport type {\r\n ContourMetric, PathContour, PathFrame, PathMetric, PathSampler, PathSegment, SegmentMetric,\r\n} from \"./types\";\r\n\r\n/** Line segments each curve is flattened into. */\r\nexport const SAMPLE_STEPS = 50;\r\n\r\nfunction flatten(segment: PathSegment): Vector2[] {\r\n // A line is already a polyline. Skipping the loop matters: a polygon path is\r\n // all lines, and 50 collinear samples per edge is pure waste.\r\n if (segment.kind === \"line\") return [segment.from, segment.to];\r\n const points: Vector2[] = [segment.from];\r\n for (let i = 1; i < SAMPLE_STEPS; i++) points.push(segmentPointAt(segment, i / SAMPLE_STEPS));\r\n points.push(segment.to);\r\n return points;\r\n}\r\n\r\nexport function measureSegment(segment: PathSegment): SegmentMetric {\r\n const points = flatten(segment);\r\n const cumulative: number[] = [0];\r\n let total = 0;\r\n for (let i = 1; i < points.length; i++) {\r\n total += distance(points[i - 1], points[i]);\r\n cumulative.push(total);\r\n }\r\n return { segment, points, cumulative, length: total };\r\n}\r\n\r\nexport function measureContours(contours: PathContour[]): PathMetric {\r\n let total = 0;\r\n const measured = contours.map((contour) => {\r\n const metrics = contourSegments(contour).map(measureSegment);\r\n const length = metrics.reduce((sum, m) => sum + m.length, 0);\r\n total += length;\r\n return { contour, metrics, length };\r\n });\r\n return { contours: measured, length: total };\r\n}\r\n\r\n/**\r\n * The parameter `t` at arc-length distance `d` into a segment.\r\n *\r\n * Read off the flattened table rather than binary-searched: the table is already\r\n * built, and a search that re-samples the curve on every probe cost 320 point\r\n * evaluations per query to answer the same question less consistently — its\r\n * answer disagreed with the sampler's, which read the same curve off a polyline.\r\n */\r\nexport function paramAtDist(metric: SegmentMetric, d: number): number {\r\n const { cumulative, length } = metric;\r\n if (length <= 0) return 0;\r\n if (d <= 0) return 0;\r\n if (d >= length) return 1;\r\n\r\n let lo = 0;\r\n let hi = cumulative.length - 1;\r\n while (lo < hi - 1) {\r\n const mid = (lo + hi) >> 1;\r\n if (cumulative[mid] <= d) lo = mid;\r\n else hi = mid;\r\n }\r\n const span = cumulative[hi] - cumulative[lo];\r\n const within = span > 0 ? (d - cumulative[lo]) / span : 0;\r\n const steps = cumulative.length - 1;\r\n return (lo + within) / steps;\r\n}\r\n\r\nexport function length(d: PathData | null | undefined): number {\r\n return measureContours(contours(d)).length;\r\n}\r\n\r\n/**\r\n * Build a {@link PathSampler} from any {@link PathData}.\r\n *\r\n * The tangent is the chord of the flattened segment the distance lands in, not\r\n * the curve's analytic derivative. Less exact, and deliberately kept: every\r\n * glyph on every text-on-path is placed with it, so changing it is a visual\r\n * change that deserves its own commit rather than a side effect of this one.\r\n */\r\nexport function sampler(d: PathData): PathSampler {\r\n const metric = measureContours(contours(d));\r\n\r\n // One point list across every contour. The jump from one contour's end to the\r\n // next one's start carries no length — text does not flow across it, matching\r\n // SVG `textPath` — so it is recorded as a zero-length step rather than a gap\r\n // in the table.\r\n const points: Vector2[] = [];\r\n const cumulative: number[] = [];\r\n let total = 0;\r\n for (const contourMetric of metric.contours) {\r\n const first = contourMetric.metrics[0]?.segment.from ?? contourMetric.contour.start;\r\n points.push(first);\r\n cumulative.push(total);\r\n for (const segmentMetric of contourMetric.metrics) {\r\n for (let i = 1; i < segmentMetric.points.length; i++) {\r\n total += distance(segmentMetric.points[i - 1], segmentMetric.points[i]);\r\n points.push(segmentMetric.points[i]);\r\n cumulative.push(total);\r\n }\r\n }\r\n }\r\n\r\n let cursor = 0; // last segment index used, for the monotonic fast path.\r\n\r\n const frameAt = (d: number): PathFrame | null => {\r\n if (total <= 0 || points.length < 2) return null;\r\n const target = Math.max(0, Math.min(total, d));\r\n\r\n // Reset the cursor if the caller stepped backwards.\r\n if (cumulative[cursor] > target) cursor = 0;\r\n // Advance to the step containing `target`, skipping the zero-length steps\r\n // that bridge contours so we land on real geometry.\r\n while (\r\n cursor < points.length - 2 &&\r\n (cumulative[cursor + 1] < target || cumulative[cursor + 1] === cumulative[cursor])\r\n ) {\r\n cursor++;\r\n }\r\n\r\n const a = points[cursor];\r\n const b = points[cursor + 1];\r\n const segStart = cumulative[cursor];\r\n const segLen = cumulative[cursor + 1] - segStart;\r\n const t = segLen > 0 ? (target - segStart) / segLen : 0;\r\n\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n const segDist = Math.hypot(dx, dy);\r\n // Degenerate step: fall back to the point with no meaningful tangent.\r\n const tx = segDist > 0 ? dx / segDist : 1;\r\n const ty = segDist > 0 ? dy / segDist : 0;\r\n\r\n return { x: a.x + dx * t, y: a.y + dy * t, tx, ty };\r\n };\r\n\r\n return { length: total, frameAt };\r\n}\r\n\r\n/** A contour's flattened polyline. */\r\nfunction contourPoints(metric: ContourMetric): Vector2[] {\r\n const first = metric.metrics[0]?.segment.from ?? metric.contour.start;\r\n const points: Vector2[] = [first];\r\n for (const segment of metric.metrics) {\r\n for (let i = 1; i < segment.points.length; i++) points.push(segment.points[i]);\r\n }\r\n return points;\r\n}\r\n\r\n/**\r\n * Walks a flattened subpath at constant speed, emitting `M`/`L` commands for the\r\n * \"on\" runs of the dash pattern. `scaledDash` alternates on/off lengths starting\r\n * with \"on\"; the index wraps so the pattern repeats along the whole subpath, and\r\n * `offset` is how far into it the subpath starts. A zero-length dash is a dot:\r\n * a run a sliver long along the path, so the cap drawn on it has a direction —\r\n * including the dots an open subpath is fit to start and end on.\r\n */\r\nfunction dashSubpath(points: Vector2[], scaledDash: number[], offset: number, closed: boolean): string {\r\n if (points.length < 2) return '';\r\n\r\n const cycle = scaledDash.reduce((a, b) => a + b, 0);\r\n const sliver = cycle * 1e-4;\r\n const tolerance = cycle * 1e-9;\r\n const into = ((offset % cycle) + cycle) % cycle;\r\n let dashIndex = 0;\r\n let passed = 0;\r\n while (passed + scaledDash[dashIndex] <= into) {\r\n if (scaledDash[dashIndex] === 0 && into - passed <= tolerance) break;\r\n passed += scaledDash[dashIndex];\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n if (dashIndex === 0) break;\r\n }\r\n\r\n const parts: string[] = [];\r\n let remaining = scaledDash[dashIndex] - (into - passed); // Distance left in the current dash segment.\r\n let isOn = dashIndex % 2 === 0; // Whether we're currently drawing (on) or skipping (off).\r\n let needMove = true; // Whether the next \"on\" run still needs an opening M.\r\n let last: { point: Vector2; x: number; y: number } | null = null;\r\n\r\n for (let i = 1; i < points.length; i++) {\r\n const p0 = points[i - 1];\r\n const p1 = points[i];\r\n const dx = p1.x - p0.x;\r\n const dy = p1.y - p0.y;\r\n const segLen = distance(p0, p1);\r\n\r\n if (segLen === 0) continue;\r\n last = { point: p1, x: dx / segLen, y: dy / segLen };\r\n\r\n let walked = 0;\r\n\r\n while (walked < segLen) {\r\n const available = segLen - walked;\r\n\r\n if (remaining >= available) {\r\n if (isOn) {\r\n if (needMove) {\r\n const t = walked / segLen;\r\n parts.push(`M ${p0.x + t * dx} ${p0.y + t * dy}`);\r\n needMove = false;\r\n }\r\n parts.push(`L ${p1.x} ${p1.y}`);\r\n }\r\n remaining -= available;\r\n walked = segLen;\r\n\r\n if (remaining <= tolerance) {\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n isOn = !isOn;\r\n remaining = scaledDash[dashIndex];\r\n if (isOn) needMove = true;\r\n }\r\n } else {\r\n const endT = (walked + remaining) / segLen;\r\n const endX = p0.x + endT * dx;\r\n const endY = p0.y + endT * dy;\r\n\r\n if (isOn) {\r\n if (needMove) {\r\n const startT = walked / segLen;\r\n parts.push(`M ${p0.x + startT * dx} ${p0.y + startT * dy}`);\r\n needMove = false;\r\n }\r\n const reach = remaining > 0 ? 0 : sliver / segLen;\r\n parts.push(`L ${endX + reach * dx} ${endY + reach * dy}`);\r\n }\r\n\r\n walked += remaining;\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n isOn = !isOn;\r\n remaining = scaledDash[dashIndex];\r\n if (isOn) needMove = true;\r\n }\r\n }\r\n }\r\n\r\n if (!closed && isOn && remaining <= tolerance && last) {\r\n const { point, x, y } = last;\r\n parts.push(`M ${point.x} ${point.y} L ${point.x - x * sliver} ${point.y - y * sliver}`);\r\n }\r\n\r\n return parts.join(' ');\r\n}\r\n\r\n/**\r\n * How far `pattern` is stretched to fit one contour of a path `total` long —\r\n * the renderer's rule as well as {@link dash}'s. A closed contour is fit with\r\n * the rest of the path, to whole cycles of `total`; an open one is fit alone to\r\n * whole cycles less the final gap, so it starts and ends on a dash. An odd\r\n * pattern alternates across cycles, has no final gap to drop, and fits as\r\n * closed. `null` when there is nothing to fit.\r\n */\r\nexport function dashScale(\r\n pattern: number[],\r\n contour: { length: number; closed: boolean },\r\n total: number,\r\n): number | null {\r\n const cycle = pattern.reduce((a, b) => a + b, 0);\r\n if (cycle <= 0 || total <= 0) return null;\r\n if (!contour.closed && contour.length > 0 && pattern.length % 2 === 0) {\r\n const lastGap = pattern[pattern.length - 1];\r\n const span = Math.max(1, Math.round((contour.length + lastGap) / cycle)) * cycle - lastGap;\r\n if (span > 0) return contour.length / span;\r\n }\r\n return total / (Math.max(1, Math.round(total / cycle)) * cycle);\r\n}\r\n\r\n/**\r\n * Converts path geometry into a dashed SVG path string, each contour fit by\r\n * {@link dashScale} and starting `offset` into the pattern, as the renderer\r\n * dashes a stroke.\r\n *\r\n * @param d The path to dash.\r\n * @param dash Alternating on/off lengths (e.g. `[4, 2]` = 4 on, 2 off).\r\n * @returns An SVG path `d` string containing only the visible dash segments,\r\n * or `''` when there is nothing to draw.\r\n */\r\nexport function dash(d: PathData | null | undefined, dash: number[], offset = 0): string {\r\n if (!dash || dash.length === 0) return '';\r\n\r\n const metric = measureContours(contours(d));\r\n const runs: string[] = [];\r\n for (const contour of metric.contours) {\r\n const scale = dashScale(dash, { length: contour.length, closed: contour.contour.closed }, metric.length);\r\n if (scale === null) return '';\r\n const run = dashSubpath(\r\n contourPoints(contour), dash.map(value => value * scale), offset * scale, contour.contour.closed,\r\n );\r\n if (run) runs.push(run);\r\n }\r\n return runs.join(' ');\r\n}\r\n\r\n/**\r\n * The portion of `d` between the normalized arc-length fractions `start` and\r\n * `end` (both 0..1), as a fresh command list.\r\n *\r\n * A full `0..1` range or an empty path is returned unchanged; an empty or\r\n * inverted range returns `[]`.\r\n */\r\nexport function trim(d: PathData, start: number, end: number): PathData {\r\n if (start === 0 && end === 1) return d;\r\n\r\n const s = Math.max(0, Math.min(1, start));\r\n const e = Math.max(s, Math.min(1, end));\r\n if (s === 0 && e === 1) return d;\r\n if (s >= e) return [];\r\n\r\n const metric = measureContours(contours(d));\r\n if (metric.length === 0) return d;\r\n\r\n const startDist = s * metric.length;\r\n const endDist = e * metric.length;\r\n\r\n const result: PathCommand[] = [];\r\n let accumulated = 0;\r\n\r\n for (const contour of metric.contours) {\r\n // Each contour opens its own `M`. Sharing one across all of them — which\r\n // is what a single flat segment list did — draws a line across the gap\r\n // between two contours that the source never had.\r\n let needsMove = true;\r\n\r\n for (const metricEntry of contour.metrics) {\r\n const { segment, length } = metricEntry;\r\n const segEnd = accumulated + length;\r\n if (length === 0 || segEnd <= startDist || accumulated >= endDist) {\r\n accumulated = segEnd;\r\n continue;\r\n }\r\n\r\n const t0 = accumulated < startDist ? paramAtDist(metricEntry, startDist - accumulated) : 0;\r\n const t1 = segEnd > endDist ? paramAtDist(metricEntry, endDist - accumulated) : 1;\r\n\r\n if (needsMove) {\r\n const p = segmentPointAt(segment, t0);\r\n result.push({ type: \"M\", x: p.x, y: p.y });\r\n needsMove = false;\r\n }\r\n result.push(...segmentSplit(segment, t0, t1));\r\n accumulated = segEnd;\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/measure.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKjF,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,SAAS,OAAO,CAAC,OAAoB;IACjC,6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AAC,WAAW,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3F,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAElF,IAAI,SAAS,EAAE,CAAC;gBACZ,MAAM,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC3C,SAAS,GAAG,KAAK,CAAC;YACtB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC9C,WAAW,GAAG,MAAM,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Arc length, and everything measured in it: total length, the sampler, dashing\n * and trimming.\n *\n * Separate from the normal form because it is the expensive half of path\n * geometry and most callers never need it — bounding a path solves extrema in\n * closed form, and `Path.measure` / `Text.measure` run on every layout pass. So\n * flattening happens here, on demand.\n *\n * **One resolution.** There used to be three — 20 steps for\n * `length`, 32 for the trim segments, 50 for the sampler and the\n * dash walker — and `dash` combined two of them, scaling its dash\n * cycle against a length measured at 20 while walking the path at 50. Sharing\n * one number makes `length(d) === sampler(d).length` an invariant rather than a\n * coincidence.\n */\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { distance } from \"./bezier\";\nimport { contourSegments, contours, segmentPointAt, segmentSplit } from \"./walk\";\nimport type {\n ContourMetric, PathContour, PathFrame, PathMetric, PathSampler, PathSegment, SegmentMetric,\n} from \"./types\";\n\n/** Line segments each curve is flattened into. */\nexport const SAMPLE_STEPS = 50;\n\nfunction flatten(segment: PathSegment): Vector2[] {\n // A line is already a polyline. Skipping the loop matters: a polygon path is\n // all lines, and 50 collinear samples per edge is pure waste.\n if (segment.kind === \"line\") return [segment.from, segment.to];\n const points: Vector2[] = [segment.from];\n for (let i = 1; i < SAMPLE_STEPS; i++) points.push(segmentPointAt(segment, i / SAMPLE_STEPS));\n points.push(segment.to);\n return points;\n}\n\nexport function measureSegment(segment: PathSegment): SegmentMetric {\n const points = flatten(segment);\n const cumulative: number[] = [0];\n let total = 0;\n for (let i = 1; i < points.length; i++) {\n total += distance(points[i - 1], points[i]);\n cumulative.push(total);\n }\n return { segment, points, cumulative, length: total };\n}\n\nexport function measureContours(contours: PathContour[]): PathMetric {\n let total = 0;\n const measured = contours.map((contour) => {\n const metrics = contourSegments(contour).map(measureSegment);\n const length = metrics.reduce((sum, m) => sum + m.length, 0);\n total += length;\n return { contour, metrics, length };\n });\n return { contours: measured, length: total };\n}\n\n/**\n * The parameter `t` at arc-length distance `d` into a segment.\n *\n * Read off the flattened table rather than binary-searched: the table is already\n * built, and a search that re-samples the curve on every probe cost 320 point\n * evaluations per query to answer the same question less consistently — its\n * answer disagreed with the sampler's, which read the same curve off a polyline.\n */\nexport function paramAtDist(metric: SegmentMetric, d: number): number {\n const { cumulative, length } = metric;\n if (length <= 0) return 0;\n if (d <= 0) return 0;\n if (d >= length) return 1;\n\n let lo = 0;\n let hi = cumulative.length - 1;\n while (lo < hi - 1) {\n const mid = (lo + hi) >> 1;\n if (cumulative[mid] <= d) lo = mid;\n else hi = mid;\n }\n const span = cumulative[hi] - cumulative[lo];\n const within = span > 0 ? (d - cumulative[lo]) / span : 0;\n const steps = cumulative.length - 1;\n return (lo + within) / steps;\n}\n\nexport function length(d: PathData | null | undefined): number {\n return measureContours(contours(d)).length;\n}\n\n/**\n * Build a {@link PathSampler} from any {@link PathData}.\n *\n * The tangent is the chord of the flattened segment the distance lands in, not\n * the curve's analytic derivative. Less exact, and deliberately kept: every\n * glyph on every text-on-path is placed with it, so changing it is a visual\n * change that deserves its own commit rather than a side effect of this one.\n */\nexport function sampler(d: PathData): PathSampler {\n const metric = measureContours(contours(d));\n\n // One point list across every contour. The jump from one contour's end to the\n // next one's start carries no length — text does not flow across it, matching\n // SVG `textPath` — so it is recorded as a zero-length step rather than a gap\n // in the table.\n const points: Vector2[] = [];\n const cumulative: number[] = [];\n let total = 0;\n for (const contourMetric of metric.contours) {\n const first = contourMetric.metrics[0]?.segment.from ?? contourMetric.contour.start;\n points.push(first);\n cumulative.push(total);\n for (const segmentMetric of contourMetric.metrics) {\n for (let i = 1; i < segmentMetric.points.length; i++) {\n total += distance(segmentMetric.points[i - 1], segmentMetric.points[i]);\n points.push(segmentMetric.points[i]);\n cumulative.push(total);\n }\n }\n }\n\n let cursor = 0; // last segment index used, for the monotonic fast path.\n\n const frameAt = (d: number): PathFrame | null => {\n if (total <= 0 || points.length < 2) return null;\n const target = Math.max(0, Math.min(total, d));\n\n // Reset the cursor if the caller stepped backwards.\n if (cumulative[cursor] > target) cursor = 0;\n // Advance to the step containing `target`, skipping the zero-length steps\n // that bridge contours so we land on real geometry.\n while (\n cursor < points.length - 2 &&\n (cumulative[cursor + 1] < target || cumulative[cursor + 1] === cumulative[cursor])\n ) {\n cursor++;\n }\n\n const a = points[cursor];\n const b = points[cursor + 1];\n const segStart = cumulative[cursor];\n const segLen = cumulative[cursor + 1] - segStart;\n const t = segLen > 0 ? (target - segStart) / segLen : 0;\n\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const segDist = Math.hypot(dx, dy);\n // Degenerate step: fall back to the point with no meaningful tangent.\n const tx = segDist > 0 ? dx / segDist : 1;\n const ty = segDist > 0 ? dy / segDist : 0;\n\n return { x: a.x + dx * t, y: a.y + dy * t, tx, ty };\n };\n\n return { length: total, frameAt };\n}\n\n/** A contour's flattened polyline. */\nfunction contourPoints(metric: ContourMetric): Vector2[] {\n const first = metric.metrics[0]?.segment.from ?? metric.contour.start;\n const points: Vector2[] = [first];\n for (const segment of metric.metrics) {\n for (let i = 1; i < segment.points.length; i++) points.push(segment.points[i]);\n }\n return points;\n}\n\n/**\n * Walks a flattened subpath at constant speed, emitting `M`/`L` commands for the\n * \"on\" runs of the dash pattern. `scaledDash` alternates on/off lengths starting\n * with \"on\"; the index wraps so the pattern repeats along the whole subpath, and\n * `offset` is how far into it the subpath starts. A zero-length dash is a dot:\n * a run a sliver long along the path, so the cap drawn on it has a direction —\n * including the dots an open subpath is fit to start and end on.\n */\nfunction dashSubpath(points: Vector2[], scaledDash: number[], offset: number, closed: boolean): string {\n if (points.length < 2) return '';\n\n const cycle = scaledDash.reduce((a, b) => a + b, 0);\n const sliver = cycle * 1e-4;\n const tolerance = cycle * 1e-9;\n const into = ((offset % cycle) + cycle) % cycle;\n let dashIndex = 0;\n let passed = 0;\n while (passed + scaledDash[dashIndex] <= into) {\n if (scaledDash[dashIndex] === 0 && into - passed <= tolerance) break;\n passed += scaledDash[dashIndex];\n dashIndex = (dashIndex + 1) % scaledDash.length;\n if (dashIndex === 0) break;\n }\n\n const parts: string[] = [];\n let remaining = scaledDash[dashIndex] - (into - passed); // Distance left in the current dash segment.\n let isOn = dashIndex % 2 === 0; // Whether we're currently drawing (on) or skipping (off).\n let needMove = true; // Whether the next \"on\" run still needs an opening M.\n let last: { point: Vector2; x: number; y: number } | null = null;\n\n for (let i = 1; i < points.length; i++) {\n const p0 = points[i - 1];\n const p1 = points[i];\n const dx = p1.x - p0.x;\n const dy = p1.y - p0.y;\n const segLen = distance(p0, p1);\n\n if (segLen === 0) continue;\n last = { point: p1, x: dx / segLen, y: dy / segLen };\n\n let walked = 0;\n\n while (walked < segLen) {\n const available = segLen - walked;\n\n if (remaining >= available) {\n if (isOn) {\n if (needMove) {\n const t = walked / segLen;\n parts.push(`M ${p0.x + t * dx} ${p0.y + t * dy}`);\n needMove = false;\n }\n parts.push(`L ${p1.x} ${p1.y}`);\n }\n remaining -= available;\n walked = segLen;\n\n if (remaining <= tolerance) {\n dashIndex = (dashIndex + 1) % scaledDash.length;\n isOn = !isOn;\n remaining = scaledDash[dashIndex];\n if (isOn) needMove = true;\n }\n } else {\n const endT = (walked + remaining) / segLen;\n const endX = p0.x + endT * dx;\n const endY = p0.y + endT * dy;\n\n if (isOn) {\n if (needMove) {\n const startT = walked / segLen;\n parts.push(`M ${p0.x + startT * dx} ${p0.y + startT * dy}`);\n needMove = false;\n }\n const reach = remaining > 0 ? 0 : sliver / segLen;\n parts.push(`L ${endX + reach * dx} ${endY + reach * dy}`);\n }\n\n walked += remaining;\n dashIndex = (dashIndex + 1) % scaledDash.length;\n isOn = !isOn;\n remaining = scaledDash[dashIndex];\n if (isOn) needMove = true;\n }\n }\n }\n\n if (!closed && isOn && remaining <= tolerance && last) {\n const { point, x, y } = last;\n parts.push(`M ${point.x} ${point.y} L ${point.x - x * sliver} ${point.y - y * sliver}`);\n }\n\n return parts.join(' ');\n}\n\n/**\n * How far `pattern` is stretched to fit one contour of a path `total` long —\n * the renderer's rule as well as {@link dash}'s. A closed contour is fit with\n * the rest of the path, to whole cycles of `total`; an open one is fit alone to\n * whole cycles less the final gap, so it starts and ends on a dash. An odd\n * pattern alternates across cycles, has no final gap to drop, and fits as\n * closed. `null` when there is nothing to fit.\n */\nexport function dashScale(\n pattern: number[],\n contour: { length: number; closed: boolean },\n total: number,\n): number | null {\n const cycle = pattern.reduce((a, b) => a + b, 0);\n if (cycle <= 0 || total <= 0) return null;\n if (!contour.closed && contour.length > 0 && pattern.length % 2 === 0) {\n const lastGap = pattern[pattern.length - 1];\n const span = Math.max(1, Math.round((contour.length + lastGap) / cycle)) * cycle - lastGap;\n if (span > 0) return contour.length / span;\n }\n return total / (Math.max(1, Math.round(total / cycle)) * cycle);\n}\n\n/**\n * Converts path geometry into a dashed SVG path string, each contour fit by\n * {@link dashScale} and starting `offset` into the pattern, as the renderer\n * dashes a stroke.\n *\n * @param d The path to dash.\n * @param dash Alternating on/off lengths (e.g. `[4, 2]` = 4 on, 2 off).\n * @returns An SVG path `d` string containing only the visible dash segments,\n * or `''` when there is nothing to draw.\n */\nexport function dash(d: PathData | null | undefined, dash: number[], offset = 0): string {\n if (!dash || dash.length === 0) return '';\n\n const metric = measureContours(contours(d));\n const runs: string[] = [];\n for (const contour of metric.contours) {\n const scale = dashScale(dash, { length: contour.length, closed: contour.contour.closed }, metric.length);\n if (scale === null) return '';\n const run = dashSubpath(\n contourPoints(contour), dash.map(value => value * scale), offset * scale, contour.contour.closed,\n );\n if (run) runs.push(run);\n }\n return runs.join(' ');\n}\n\n/**\n * The portion of `d` between the normalized arc-length fractions `start` and\n * `end` (both 0..1), as a fresh command list.\n *\n * A full `0..1` range or an empty path is returned unchanged; an empty or\n * inverted range returns `[]`.\n */\nexport function trim(d: PathData, start: number, end: number): PathData {\n if (start === 0 && end === 1) return d;\n\n const s = Math.max(0, Math.min(1, start));\n const e = Math.max(s, Math.min(1, end));\n if (s === 0 && e === 1) return d;\n if (s >= e) return [];\n\n const metric = measureContours(contours(d));\n if (metric.length === 0) return d;\n\n const startDist = s * metric.length;\n const endDist = e * metric.length;\n\n const result: PathCommand[] = [];\n let accumulated = 0;\n\n for (const contour of metric.contours) {\n // Each contour opens its own `M`. Sharing one across all of them — which\n // is what a single flat segment list did — draws a line across the gap\n // between two contours that the source never had.\n let needsMove = true;\n\n for (const metricEntry of contour.metrics) {\n const { segment, length } = metricEntry;\n const segEnd = accumulated + length;\n if (length === 0 || segEnd <= startDist || accumulated >= endDist) {\n accumulated = segEnd;\n continue;\n }\n\n const t0 = accumulated < startDist ? paramAtDist(metricEntry, startDist - accumulated) : 0;\n const t1 = segEnd > endDist ? paramAtDist(metricEntry, endDist - accumulated) : 1;\n\n if (needsMove) {\n const p = segmentPointAt(segment, t0);\n result.push({ type: \"M\", x: p.x, y: p.y });\n needsMove = false;\n }\n result.push(...segmentSplit(segment, t0, t1));\n accumulated = segEnd;\n }\n }\n\n return result;\n}\n"]}