@motionscript/core 0.1.0-alpha.6 → 0.1.0-alpha.8

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 (804) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/NOTICE +15 -14
  3. package/README.md +5 -7
  4. package/dist/assets/errors.js +4 -5
  5. package/dist/assets/errors.js.map +1 -1
  6. package/dist/assets/manager.d.ts.map +1 -1
  7. package/dist/assets/manager.js +7 -5
  8. package/dist/assets/manager.js.map +1 -1
  9. package/dist/assets/scope.d.ts +1 -1
  10. package/dist/assets/scope.d.ts.map +1 -1
  11. package/dist/assets/scope.js +1 -1
  12. package/dist/assets/scope.js.map +1 -1
  13. package/dist/attributes/audio/effects/chain.d.ts +73 -0
  14. package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
  15. package/dist/attributes/audio/effects/chain.js +67 -0
  16. package/dist/attributes/audio/effects/chain.js.map +1 -0
  17. package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
  18. package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
  19. package/dist/attributes/audio/effects/implementations/echo.js +11 -0
  20. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -0
  21. package/dist/attributes/audio/effects/implementations/gain.d.ts +10 -0
  22. package/dist/attributes/audio/effects/implementations/gain.d.ts.map +1 -0
  23. package/dist/attributes/audio/effects/implementations/gain.js +6 -0
  24. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -0
  25. package/dist/attributes/audio/effects/implementations/highpass.d.ts +12 -0
  26. package/dist/attributes/audio/effects/implementations/highpass.d.ts.map +1 -0
  27. package/dist/attributes/audio/effects/implementations/highpass.js +10 -0
  28. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -0
  29. package/dist/attributes/audio/effects/implementations/lowpass.d.ts +12 -0
  30. package/dist/attributes/audio/effects/implementations/lowpass.d.ts.map +1 -0
  31. package/dist/attributes/audio/effects/implementations/lowpass.js +10 -0
  32. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -0
  33. package/dist/attributes/audio/effects/implementations/tremolo.d.ts +12 -0
  34. package/dist/attributes/audio/effects/implementations/tremolo.d.ts.map +1 -0
  35. package/dist/attributes/audio/effects/implementations/tremolo.js +10 -0
  36. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -0
  37. package/dist/attributes/audio/effects/index.d.ts +12 -0
  38. package/dist/attributes/audio/effects/index.d.ts.map +1 -0
  39. package/dist/attributes/audio/effects/index.js +4 -0
  40. package/dist/attributes/audio/effects/index.js.map +1 -0
  41. package/dist/attributes/audio/effects/registry.d.ts +36 -0
  42. package/dist/attributes/audio/effects/registry.d.ts.map +1 -0
  43. package/dist/attributes/audio/effects/registry.js +80 -0
  44. package/dist/attributes/audio/effects/registry.js.map +1 -0
  45. package/dist/attributes/audio/effects/union.d.ts +14 -0
  46. package/dist/attributes/audio/effects/union.d.ts.map +1 -0
  47. package/dist/attributes/audio/effects/union.js +24 -0
  48. package/dist/attributes/audio/effects/union.js.map +1 -0
  49. package/dist/attributes/audio/ramp.d.ts +103 -0
  50. package/dist/attributes/audio/ramp.d.ts.map +1 -0
  51. package/dist/attributes/audio/ramp.js +246 -0
  52. package/dist/attributes/audio/ramp.js.map +1 -0
  53. package/dist/attributes/audio/request.d.ts +24 -13
  54. package/dist/attributes/audio/request.d.ts.map +1 -1
  55. package/dist/attributes/audio/request.js +4 -3
  56. package/dist/attributes/audio/request.js.map +1 -1
  57. package/dist/attributes/audio/schedule.d.ts +24 -31
  58. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  59. package/dist/attributes/audio/schedule.js +42 -28
  60. package/dist/attributes/audio/schedule.js.map +1 -1
  61. package/dist/attributes/audio/sound.d.ts +15 -12
  62. package/dist/attributes/audio/sound.d.ts.map +1 -1
  63. package/dist/attributes/audio/sound.js +8 -10
  64. package/dist/attributes/audio/sound.js.map +1 -1
  65. package/dist/attributes/audio/transition.d.ts +33 -0
  66. package/dist/attributes/audio/transition.d.ts.map +1 -0
  67. package/dist/attributes/audio/transition.js +48 -0
  68. package/dist/attributes/audio/transition.js.map +1 -0
  69. package/dist/attributes/index.d.ts +7 -8
  70. package/dist/attributes/index.d.ts.map +1 -1
  71. package/dist/attributes/index.js +6 -9
  72. package/dist/attributes/index.js.map +1 -1
  73. package/dist/attributes/layout/insets.d.ts +1 -1
  74. package/dist/attributes/layout/insets.js.map +1 -1
  75. package/dist/attributes/layout/matrix2d.d.ts +2 -2
  76. package/dist/attributes/layout/matrix2d.js.map +1 -1
  77. package/dist/attributes/layout/size.d.ts +1 -1
  78. package/dist/attributes/layout/size.js +1 -1
  79. package/dist/attributes/layout/size.js.map +1 -1
  80. package/dist/attributes/layout/space3d.js +1 -1
  81. package/dist/attributes/layout/space3d.js.map +1 -1
  82. package/dist/attributes/properties/decorator.d.ts +44 -11
  83. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  84. package/dist/attributes/properties/decorator.js +37 -9
  85. package/dist/attributes/properties/decorator.js.map +1 -1
  86. package/dist/attributes/properties/inputs.d.ts +1 -1
  87. package/dist/attributes/properties/inputs.js +1 -1
  88. package/dist/attributes/properties/inputs.js.map +1 -1
  89. package/dist/attributes/properties/typed.d.ts +24 -145
  90. package/dist/attributes/properties/typed.d.ts.map +1 -1
  91. package/dist/attributes/properties/typed.js +16 -112
  92. package/dist/attributes/properties/typed.js.map +1 -1
  93. package/dist/attributes/shape/corners/corner-radius.d.ts +2 -3
  94. package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
  95. package/dist/attributes/shape/corners/corner-radius.js +2 -3
  96. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  97. package/dist/attributes/shape/effects/chain.d.ts +96 -409
  98. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  99. package/dist/attributes/shape/effects/chain.js +93 -283
  100. package/dist/attributes/shape/effects/chain.js.map +1 -1
  101. package/dist/attributes/shape/effects/effect-data.d.ts +1 -1
  102. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  103. package/dist/attributes/shape/effects/implementations/ascii.d.ts +45 -13
  104. package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
  105. package/dist/attributes/shape/effects/implementations/ascii.js +29 -23
  106. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +32 -7
  108. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/bit-crush.js +17 -15
  110. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/block-displace.d.ts +46 -10
  112. package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/block-displace.js +21 -19
  114. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/bloom.d.ts +32 -7
  116. package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/bloom.js +17 -11
  118. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/blur.d.ts +16 -3
  120. package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/blur.js +13 -5
  122. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/bulge.d.ts +28 -9
  124. package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/bulge.js +15 -14
  126. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +21 -5
  128. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +15 -10
  130. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +96 -26
  132. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/color-adjustment.js +29 -26
  134. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/curves.d.ts +20 -6
  136. package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
  137. package/dist/attributes/shape/effects/implementations/curves.js +26 -23
  138. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  139. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
  140. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
  141. package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
  142. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  143. package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
  144. package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
  145. package/dist/attributes/shape/effects/implementations/dither.js +26 -20
  146. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  147. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +47 -15
  148. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
  149. package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
  150. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  151. package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
  152. package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
  153. package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
  154. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  155. package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
  156. package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
  157. package/dist/attributes/shape/effects/implementations/edges.js +17 -14
  158. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  159. package/dist/attributes/shape/effects/implementations/glass.d.ts +76 -19
  160. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  161. package/dist/attributes/shape/effects/implementations/glass.js +28 -22
  162. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  163. package/dist/attributes/shape/effects/implementations/glow.d.ts +149 -42
  164. package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
  165. package/dist/attributes/shape/effects/implementations/glow.js +74 -72
  166. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  167. package/dist/attributes/shape/effects/implementations/grain.d.ts +43 -11
  168. package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
  169. package/dist/attributes/shape/effects/implementations/grain.js +21 -18
  170. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  171. package/dist/attributes/shape/effects/implementations/grayscale.d.ts +17 -3
  172. package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
  173. package/dist/attributes/shape/effects/implementations/grayscale.js +13 -5
  174. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  175. package/dist/attributes/shape/effects/implementations/halftone.d.ts +40 -9
  176. package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
  177. package/dist/attributes/shape/effects/implementations/halftone.js +20 -16
  178. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  179. package/dist/attributes/shape/effects/implementations/invert.d.ts +23 -5
  180. package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
  181. package/dist/attributes/shape/effects/implementations/invert.js +15 -10
  182. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  183. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +57 -18
  184. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
  185. package/dist/attributes/shape/effects/implementations/kaleidoscope.js +25 -22
  186. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  187. package/dist/attributes/shape/effects/implementations/lut.d.ts +34 -7
  188. package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
  189. package/dist/attributes/shape/effects/implementations/lut.js +20 -16
  190. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  191. package/dist/attributes/shape/effects/implementations/magnify.d.ts +27 -9
  192. package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
  193. package/dist/attributes/shape/effects/implementations/magnify.js +17 -14
  194. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  195. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +54 -19
  196. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
  197. package/dist/attributes/shape/effects/implementations/motion-blur.js +42 -20
  198. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  199. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +17 -3
  200. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
  201. package/dist/attributes/shape/effects/implementations/oil-paint.js +13 -9
  202. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  203. package/dist/attributes/shape/effects/implementations/outline.d.ts +28 -8
  204. package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
  205. package/dist/attributes/shape/effects/implementations/outline.js +18 -17
  206. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  207. package/dist/attributes/shape/effects/implementations/pixelate.d.ts +25 -6
  208. package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
  209. package/dist/attributes/shape/effects/implementations/pixelate.js +16 -14
  210. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  211. package/dist/attributes/shape/effects/implementations/posterize.d.ts +14 -3
  212. package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
  213. package/dist/attributes/shape/effects/implementations/posterize.js +13 -9
  214. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  215. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +91 -26
  216. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
  217. package/dist/attributes/shape/effects/implementations/progressive-blur.js +27 -28
  218. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  219. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +49 -10
  220. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
  221. package/dist/attributes/shape/effects/implementations/radial-blur.js +19 -20
  222. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  223. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +36 -6
  224. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
  225. package/dist/attributes/shape/effects/implementations/rgb-shift.js +16 -15
  226. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  227. package/dist/attributes/shape/effects/implementations/scanlines.d.ts +52 -11
  228. package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
  229. package/dist/attributes/shape/effects/implementations/scanlines.js +21 -18
  230. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  231. package/dist/attributes/shape/effects/implementations/scatter.d.ts +23 -9
  232. package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
  233. package/dist/attributes/shape/effects/implementations/scatter.js +15 -12
  234. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  235. package/dist/attributes/shape/effects/implementations/shader.d.ts +90 -34
  236. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  237. package/dist/attributes/shape/effects/implementations/shader.js +42 -26
  238. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  239. package/dist/attributes/shape/effects/implementations/sharpen.d.ts +23 -5
  240. package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
  241. package/dist/attributes/shape/effects/implementations/sharpen.js +16 -11
  242. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  243. package/dist/attributes/shape/effects/implementations/streak.d.ts +40 -9
  244. package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
  245. package/dist/attributes/shape/effects/implementations/streak.js +19 -16
  246. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  247. package/dist/attributes/shape/effects/implementations/threshold.d.ts +24 -5
  248. package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
  249. package/dist/attributes/shape/effects/implementations/threshold.js +17 -11
  250. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  251. package/dist/attributes/shape/effects/implementations/twirl.d.ts +35 -8
  252. package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
  253. package/dist/attributes/shape/effects/implementations/twirl.js +17 -16
  254. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  255. package/dist/attributes/shape/effects/implementations/vignette.d.ts +37 -7
  256. package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
  257. package/dist/attributes/shape/effects/implementations/vignette.js +19 -18
  258. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  259. package/dist/attributes/shape/effects/implementations/vintage.d.ts +24 -5
  260. package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
  261. package/dist/attributes/shape/effects/implementations/vintage.js +15 -10
  262. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  263. package/dist/attributes/shape/effects/implementations/wave.d.ts +61 -14
  264. package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
  265. package/dist/attributes/shape/effects/implementations/wave.js +26 -23
  266. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  267. package/dist/attributes/shape/effects/index.d.ts +4 -2
  268. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  269. package/dist/attributes/shape/effects/index.js +1 -1
  270. package/dist/attributes/shape/effects/index.js.map +1 -1
  271. package/dist/attributes/shape/effects/registry.d.ts +11 -0
  272. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  273. package/dist/attributes/shape/effects/registry.js +113 -102
  274. package/dist/attributes/shape/effects/registry.js.map +1 -1
  275. package/dist/attributes/shape/effects/spec.d.ts +229 -0
  276. package/dist/attributes/shape/effects/spec.d.ts.map +1 -0
  277. package/dist/attributes/shape/effects/spec.js +178 -0
  278. package/dist/attributes/shape/effects/spec.js.map +1 -0
  279. package/dist/attributes/shape/fill/chain.d.ts +7 -9
  280. package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
  281. package/dist/attributes/shape/fill/chain.js +9 -11
  282. package/dist/attributes/shape/fill/chain.js.map +1 -1
  283. package/dist/attributes/shape/fill/color/parser.d.ts +1 -1
  284. package/dist/attributes/shape/fill/color/parser.js +1 -1
  285. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  286. package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -2
  287. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  288. package/dist/attributes/shape/fill/implementations/shader.d.ts +28 -27
  289. package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
  290. package/dist/attributes/shape/fill/implementations/shader.js +20 -14
  291. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  292. package/dist/attributes/shape/fill/implementations/video.d.ts +1 -1
  293. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  294. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  295. package/dist/attributes/shape/fill/index.d.ts +1 -1
  296. package/dist/attributes/shape/fill/index.d.ts.map +1 -1
  297. package/dist/attributes/shape/fill/index.js.map +1 -1
  298. package/dist/attributes/shape/fill/lerp.d.ts +1 -1
  299. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  300. package/dist/attributes/shape/fill/registry.d.ts +1 -2
  301. package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
  302. package/dist/attributes/shape/fill/registry.js +1 -2
  303. package/dist/attributes/shape/fill/registry.js.map +1 -1
  304. package/dist/attributes/shape/filters/chain.d.ts +3 -7
  305. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  306. package/dist/attributes/shape/filters/chain.js +2 -6
  307. package/dist/attributes/shape/filters/chain.js.map +1 -1
  308. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
  309. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
  310. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  311. package/dist/attributes/shape/filters/registry.d.ts +1 -1
  312. package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
  313. package/dist/attributes/shape/filters/registry.js +3 -3
  314. package/dist/attributes/shape/filters/registry.js.map +1 -1
  315. package/dist/attributes/shape/filters/union.d.ts +6 -6
  316. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  317. package/dist/attributes/shape/filters/union.js.map +1 -1
  318. package/dist/attributes/shape/path/ops.d.ts +1 -2
  319. package/dist/attributes/shape/path/ops.d.ts.map +1 -1
  320. package/dist/attributes/shape/path/ops.js.map +1 -1
  321. package/dist/attributes/shape/shaders/index.d.ts +2 -0
  322. package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
  323. package/dist/attributes/shape/shaders/index.js +2 -0
  324. package/dist/attributes/shape/shaders/index.js.map +1 -1
  325. package/dist/attributes/shape/shaders/language.d.ts +26 -0
  326. package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
  327. package/dist/attributes/shape/shaders/language.js +20 -0
  328. package/dist/attributes/shape/shaders/language.js.map +1 -0
  329. package/dist/attributes/shape/shaders/pack.d.ts +25 -11
  330. package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
  331. package/dist/attributes/shape/shaders/pack.js +9 -4
  332. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  333. package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
  334. package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
  335. package/dist/attributes/shape/shaders/resolve.js +3 -6
  336. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  337. package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
  338. package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
  339. package/dist/attributes/shape/shaders/uniforms.js +0 -0
  340. package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
  341. package/dist/attributes/shared/operators.d.ts +2 -2
  342. package/dist/attributes/shared/operators.js.map +1 -1
  343. package/dist/attributes/text/types.d.ts +2 -3
  344. package/dist/attributes/text/types.d.ts.map +1 -1
  345. package/dist/attributes/text/types.js.map +1 -1
  346. package/dist/browser/chunks/chunk-AOT33LMS.js +13 -0
  347. package/dist/browser/chunks/chunk-AOT33LMS.js.map +7 -0
  348. package/dist/browser/chunks/chunk-GKM6UZJR.js +6 -0
  349. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +7 -0
  350. package/dist/browser/chunks/chunk-LKUYVFU3.js +2 -0
  351. package/dist/browser/chunks/{chunk-DHB4COFY.js.map → chunk-LKUYVFU3.js.map} +4 -4
  352. package/dist/browser/chunks/chunk-ZRPZPWZU.js +3 -0
  353. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +7 -0
  354. package/dist/browser/component.js +1 -1
  355. package/dist/browser/component.js.map +4 -4
  356. package/dist/browser/experimental.js +1 -1
  357. package/dist/browser/experimental.js.map +4 -4
  358. package/dist/browser/index.js +1 -1
  359. package/dist/browser/index.js.map +4 -4
  360. package/dist/browser/manifest.json +2 -4
  361. package/dist/browser/sdk.js +1 -1
  362. package/dist/component.d.ts +10 -18
  363. package/dist/component.d.ts.map +1 -1
  364. package/dist/component.js +10 -17
  365. package/dist/component.js.map +1 -1
  366. package/dist/components/builtins/audio/audio.d.ts +62 -0
  367. package/dist/components/builtins/audio/audio.d.ts.map +1 -0
  368. package/dist/components/builtins/audio/audio.js +38 -0
  369. package/dist/components/builtins/audio/audio.js.map +1 -0
  370. package/dist/components/builtins/geometry/composite.d.ts +93 -0
  371. package/dist/components/builtins/geometry/composite.d.ts.map +1 -0
  372. package/dist/components/builtins/geometry/composite.js +25 -0
  373. package/dist/components/builtins/geometry/composite.js.map +1 -0
  374. package/dist/components/builtins/geometry/geometry.d.ts +921 -0
  375. package/dist/components/builtins/geometry/geometry.d.ts.map +1 -0
  376. package/dist/components/builtins/geometry/geometry.js +107 -0
  377. package/dist/components/builtins/geometry/geometry.js.map +1 -0
  378. package/dist/components/builtins/geometry/shape-outline.d.ts +93 -0
  379. package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -0
  380. package/dist/components/builtins/geometry/shape-outline.js +470 -0
  381. package/dist/components/builtins/geometry/shape-outline.js.map +1 -0
  382. package/dist/components/builtins/layout/layout.d.ts +186 -0
  383. package/dist/components/builtins/layout/layout.d.ts.map +1 -0
  384. package/dist/components/builtins/layout/layout.js +84 -0
  385. package/dist/components/builtins/layout/layout.js.map +1 -0
  386. package/dist/components/builtins/media/media.d.ts +240 -0
  387. package/dist/components/builtins/media/media.d.ts.map +1 -0
  388. package/dist/components/builtins/media/media.js +143 -0
  389. package/dist/components/builtins/media/media.js.map +1 -0
  390. package/dist/components/builtins/providers/providers.d.ts +47 -0
  391. package/dist/components/builtins/providers/providers.d.ts.map +1 -0
  392. package/dist/components/builtins/providers/providers.js +30 -0
  393. package/dist/components/builtins/providers/providers.js.map +1 -0
  394. package/dist/components/builtins/text/number-format.d.ts +66 -0
  395. package/dist/components/builtins/text/number-format.d.ts.map +1 -0
  396. package/dist/components/builtins/text/number-format.js +227 -0
  397. package/dist/components/builtins/text/number-format.js.map +1 -0
  398. package/dist/components/builtins/text/number-pattern.d.ts +51 -0
  399. package/dist/components/builtins/text/number-pattern.d.ts.map +1 -0
  400. package/dist/components/builtins/text/number-pattern.js +77 -0
  401. package/dist/components/builtins/text/number-pattern.js.map +1 -0
  402. package/dist/components/builtins/text/text-defaults.d.ts +32 -0
  403. package/dist/components/builtins/text/text-defaults.d.ts.map +1 -0
  404. package/dist/components/builtins/text/text-defaults.js +37 -0
  405. package/dist/components/builtins/text/text-defaults.js.map +1 -0
  406. package/dist/components/builtins/text/text-layout.d.ts +82 -0
  407. package/dist/components/builtins/text/text-layout.d.ts.map +1 -0
  408. package/dist/components/builtins/text/text-layout.js +331 -0
  409. package/dist/components/builtins/text/text-layout.js.map +1 -0
  410. package/dist/components/builtins/text/text.d.ts +409 -0
  411. package/dist/components/builtins/text/text.d.ts.map +1 -0
  412. package/dist/components/builtins/text/text.js +116 -0
  413. package/dist/components/builtins/text/text.js.map +1 -0
  414. package/dist/components/builtins/three/canvas3d.d.ts +245 -0
  415. package/dist/components/builtins/three/canvas3d.d.ts.map +1 -0
  416. package/dist/components/builtins/three/canvas3d.js +21 -0
  417. package/dist/components/builtins/three/canvas3d.js.map +1 -0
  418. package/dist/components/builtins/three/grid-geometry3d.d.ts +62 -0
  419. package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -0
  420. package/dist/components/builtins/three/grid-geometry3d.js +114 -0
  421. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -0
  422. package/dist/components/builtins/three/three.d.ts +1889 -0
  423. package/dist/components/builtins/three/three.d.ts.map +1 -0
  424. package/dist/components/builtins/three/three.js +305 -0
  425. package/dist/components/builtins/three/three.js.map +1 -0
  426. package/dist/components/factory/api.d.ts +543 -0
  427. package/dist/components/factory/api.d.ts.map +1 -0
  428. package/dist/components/factory/api.js +4 -0
  429. package/dist/components/factory/api.js.map +1 -0
  430. package/dist/components/factory/clip-of.d.ts +5 -0
  431. package/dist/components/factory/clip-of.d.ts.map +1 -0
  432. package/dist/components/factory/clip-of.js +33 -0
  433. package/dist/components/factory/clip-of.js.map +1 -0
  434. package/dist/components/factory/commands-for.d.ts +19 -0
  435. package/dist/components/factory/commands-for.d.ts.map +1 -0
  436. package/dist/components/factory/commands-for.js +5 -0
  437. package/dist/components/factory/commands-for.js.map +1 -0
  438. package/dist/components/factory/component-audio.d.ts +9 -0
  439. package/dist/components/factory/component-audio.d.ts.map +1 -0
  440. package/dist/components/factory/component-audio.js +18 -0
  441. package/dist/components/factory/component-audio.js.map +1 -0
  442. package/dist/components/factory/component2d.d.ts +8 -0
  443. package/dist/components/factory/component2d.d.ts.map +1 -0
  444. package/dist/components/factory/component2d.js +240 -0
  445. package/dist/components/factory/component2d.js.map +1 -0
  446. package/dist/components/factory/component3d.d.ts +9 -0
  447. package/dist/components/factory/component3d.d.ts.map +1 -0
  448. package/dist/components/factory/component3d.js +107 -0
  449. package/dist/components/factory/component3d.js.map +1 -0
  450. package/dist/components/factory/factory.d.ts +66 -0
  451. package/dist/components/factory/factory.d.ts.map +1 -0
  452. package/dist/components/factory/factory.js +347 -0
  453. package/dist/components/factory/factory.js.map +1 -0
  454. package/dist/components/factory/timeline.d.ts +22 -0
  455. package/dist/components/factory/timeline.d.ts.map +1 -0
  456. package/dist/components/factory/timeline.js +128 -0
  457. package/dist/components/factory/timeline.js.map +1 -0
  458. package/dist/components/factory/type-def.d.ts +26 -0
  459. package/dist/components/factory/type-def.d.ts.map +1 -0
  460. package/dist/components/factory/type-def.js +16 -0
  461. package/dist/components/factory/type-def.js.map +1 -0
  462. package/dist/components/factory/types.d.ts +91 -0
  463. package/dist/components/factory/types.d.ts.map +1 -0
  464. package/dist/components/factory/types.js +88 -0
  465. package/dist/components/factory/types.js.map +1 -0
  466. package/dist/components/factory/views.d.ts +121 -0
  467. package/dist/components/factory/views.d.ts.map +1 -0
  468. package/dist/components/factory/views.js +413 -0
  469. package/dist/components/factory/views.js.map +1 -0
  470. package/dist/components/modules/aim.d.ts +30 -0
  471. package/dist/components/modules/aim.d.ts.map +1 -0
  472. package/dist/components/modules/aim.js +39 -0
  473. package/dist/components/modules/aim.js.map +1 -0
  474. package/dist/components/modules/corners.d.ts +13 -0
  475. package/dist/components/modules/corners.d.ts.map +1 -0
  476. package/dist/components/modules/corners.js +12 -0
  477. package/dist/components/modules/corners.js.map +1 -0
  478. package/dist/components/modules/flow.d.ts +26 -0
  479. package/dist/components/modules/flow.d.ts.map +1 -0
  480. package/dist/components/modules/flow.js +57 -0
  481. package/dist/components/modules/flow.js.map +1 -0
  482. package/dist/components/modules/material.d.ts +40 -0
  483. package/dist/components/modules/material.d.ts.map +1 -0
  484. package/dist/components/modules/material.js +75 -0
  485. package/dist/components/modules/material.js.map +1 -0
  486. package/dist/components/modules/paint.d.ts +71 -0
  487. package/dist/components/modules/paint.d.ts.map +1 -0
  488. package/dist/components/modules/paint.js +106 -0
  489. package/dist/components/modules/paint.js.map +1 -0
  490. package/dist/components/modules/shapes.d.ts +31 -0
  491. package/dist/components/modules/shapes.d.ts.map +1 -0
  492. package/dist/components/modules/shapes.js +43 -0
  493. package/dist/components/modules/shapes.js.map +1 -0
  494. package/dist/components/modules/text-layout.d.ts +26 -0
  495. package/dist/components/modules/text-layout.d.ts.map +1 -0
  496. package/dist/components/modules/text-layout.js +57 -0
  497. package/dist/components/modules/text-layout.js.map +1 -0
  498. package/dist/components/modules/text-style.d.ts +48 -0
  499. package/dist/components/modules/text-style.d.ts.map +1 -0
  500. package/dist/components/modules/text-style.js +63 -0
  501. package/dist/components/modules/text-style.js.map +1 -0
  502. package/dist/components/modules/three-entries.d.ts +23 -0
  503. package/dist/components/modules/three-entries.d.ts.map +1 -0
  504. package/dist/components/modules/three-entries.js +41 -0
  505. package/dist/components/modules/three-entries.js.map +1 -0
  506. package/dist/components/modules/view3d.d.ts +59 -0
  507. package/dist/components/modules/view3d.d.ts.map +1 -0
  508. package/dist/components/modules/view3d.js +171 -0
  509. package/dist/components/modules/view3d.js.map +1 -0
  510. package/dist/components/trees/2d/group-bounds.d.ts +56 -0
  511. package/dist/components/trees/2d/group-bounds.d.ts.map +1 -0
  512. package/dist/components/trees/2d/group-bounds.js +87 -0
  513. package/dist/components/trees/2d/group-bounds.js.map +1 -0
  514. package/dist/components/trees/2d/node-lifecycle.d.ts +46 -0
  515. package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -0
  516. package/dist/components/trees/2d/node-lifecycle.js +264 -0
  517. package/dist/components/trees/2d/node-lifecycle.js.map +1 -0
  518. package/dist/components/trees/2d/node-motion.d.ts +56 -0
  519. package/dist/components/trees/2d/node-motion.d.ts.map +1 -0
  520. package/dist/components/trees/2d/node-motion.js +86 -0
  521. package/dist/components/trees/2d/node-motion.js.map +1 -0
  522. package/dist/components/trees/2d/node-render.d.ts +36 -0
  523. package/dist/components/trees/2d/node-render.d.ts.map +1 -0
  524. package/dist/components/trees/2d/node-render.js +67 -0
  525. package/dist/components/trees/2d/node-render.js.map +1 -0
  526. package/dist/components/trees/2d/node-space.d.ts +63 -0
  527. package/dist/components/trees/2d/node-space.d.ts.map +1 -0
  528. package/dist/components/trees/2d/node-space.js +131 -0
  529. package/dist/components/trees/2d/node-space.js.map +1 -0
  530. package/dist/components/trees/2d/node-transform.d.ts +55 -0
  531. package/dist/components/trees/2d/node-transform.d.ts.map +1 -0
  532. package/dist/components/trees/2d/node-transform.js +73 -0
  533. package/dist/components/trees/2d/node-transform.js.map +1 -0
  534. package/dist/components/trees/2d/node2d.d.ts +1020 -0
  535. package/dist/components/trees/2d/node2d.d.ts.map +1 -0
  536. package/dist/components/trees/2d/node2d.js +1481 -0
  537. package/dist/components/trees/2d/node2d.js.map +1 -0
  538. package/dist/components/trees/audio/index.d.ts +2 -0
  539. package/dist/components/trees/audio/index.d.ts.map +1 -0
  540. package/dist/components/trees/audio/index.js +2 -0
  541. package/dist/components/trees/audio/index.js.map +1 -0
  542. package/dist/components/trees/audio/node-audio.d.ts +116 -0
  543. package/dist/components/trees/audio/node-audio.d.ts.map +1 -0
  544. package/dist/components/trees/audio/node-audio.js +171 -0
  545. package/dist/components/trees/audio/node-audio.js.map +1 -0
  546. package/dist/components/trees/index.d.ts +10 -0
  547. package/dist/components/trees/index.d.ts.map +1 -0
  548. package/dist/components/trees/index.js +14 -0
  549. package/dist/components/trees/index.js.map +1 -0
  550. package/dist/components/trees/node/node-editor-state.d.ts +53 -0
  551. package/dist/components/trees/node/node-editor-state.d.ts.map +1 -0
  552. package/dist/components/trees/node/node-editor-state.js +23 -0
  553. package/dist/components/trees/node/node-editor-state.js.map +1 -0
  554. package/dist/components/trees/node/node-reactive.d.ts +89 -0
  555. package/dist/components/trees/node/node-reactive.d.ts.map +1 -0
  556. package/dist/components/trees/node/node-reactive.js +135 -0
  557. package/dist/components/trees/node/node-reactive.js.map +1 -0
  558. package/dist/components/trees/node/node-time.d.ts +39 -0
  559. package/dist/components/trees/node/node-time.d.ts.map +1 -0
  560. package/dist/components/trees/node/node-time.js +14 -0
  561. package/dist/components/trees/node/node-time.js.map +1 -0
  562. package/dist/components/trees/node/node-walk.d.ts +46 -0
  563. package/dist/components/trees/node/node-walk.d.ts.map +1 -0
  564. package/dist/components/trees/node/node-walk.js +74 -0
  565. package/dist/components/trees/node/node-walk.js.map +1 -0
  566. package/dist/components/trees/node/node.d.ts +401 -0
  567. package/dist/components/trees/node/node.d.ts.map +1 -0
  568. package/dist/components/trees/node/node.js +680 -0
  569. package/dist/components/trees/node/node.js.map +1 -0
  570. package/dist/components/trees/root/canvas2d-node.d.ts +163 -0
  571. package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -0
  572. package/dist/components/trees/root/canvas2d-node.js +216 -0
  573. package/dist/components/trees/root/canvas2d-node.js.map +1 -0
  574. package/dist/components/trees/three/node3d.d.ts +222 -0
  575. package/dist/components/trees/three/node3d.d.ts.map +1 -0
  576. package/dist/components/trees/three/node3d.js +289 -0
  577. package/dist/components/trees/three/node3d.js.map +1 -0
  578. package/dist/document/builtins.js +13 -13
  579. package/dist/document/builtins.js.map +1 -1
  580. package/dist/document/command-traits.d.ts +14 -4
  581. package/dist/document/command-traits.d.ts.map +1 -1
  582. package/dist/document/command-traits.js +35 -7
  583. package/dist/document/command-traits.js.map +1 -1
  584. package/dist/document/deny-globals.d.ts +2 -2
  585. package/dist/document/deny-globals.js +2 -2
  586. package/dist/document/deny-globals.js.map +1 -1
  587. package/dist/document/expression/index.d.ts +1 -1
  588. package/dist/document/expression/index.js +1 -1
  589. package/dist/document/expression/index.js.map +1 -1
  590. package/dist/document/expression/ops.js +1 -1
  591. package/dist/document/expression/ops.js.map +1 -1
  592. package/dist/document/index.d.ts +9 -2
  593. package/dist/document/index.d.ts.map +1 -1
  594. package/dist/document/index.js +5 -2
  595. package/dist/document/index.js.map +1 -1
  596. package/dist/document/migrate.d.ts +70 -0
  597. package/dist/document/migrate.d.ts.map +1 -0
  598. package/dist/document/migrate.js +202 -0
  599. package/dist/document/migrate.js.map +1 -0
  600. package/dist/document/missing-node.d.ts +27 -0
  601. package/dist/document/missing-node.d.ts.map +1 -0
  602. package/dist/document/missing-node.js +48 -0
  603. package/dist/document/missing-node.js.map +1 -0
  604. package/dist/document/node-decorator.d.ts +14 -10
  605. package/dist/document/node-decorator.d.ts.map +1 -1
  606. package/dist/document/node-decorator.js +14 -10
  607. package/dist/document/node-decorator.js.map +1 -1
  608. package/dist/document/node-descriptor.d.ts +7 -3
  609. package/dist/document/node-descriptor.d.ts.map +1 -1
  610. package/dist/document/node-descriptor.js.map +1 -1
  611. package/dist/document/placement.d.ts +2 -1
  612. package/dist/document/placement.d.ts.map +1 -1
  613. package/dist/document/placement.js.map +1 -1
  614. package/dist/document/project.d.ts +2 -0
  615. package/dist/document/project.d.ts.map +1 -1
  616. package/dist/document/project.js +1 -0
  617. package/dist/document/project.js.map +1 -1
  618. package/dist/document/prop-evolution.d.ts +51 -0
  619. package/dist/document/prop-evolution.d.ts.map +1 -0
  620. package/dist/document/prop-evolution.js +83 -0
  621. package/dist/document/prop-evolution.js.map +1 -0
  622. package/dist/document/registry.d.ts +39 -25
  623. package/dist/document/registry.d.ts.map +1 -1
  624. package/dist/document/registry.js +41 -21
  625. package/dist/document/registry.js.map +1 -1
  626. package/dist/document/settled-index.d.ts +2 -0
  627. package/dist/document/settled-index.d.ts.map +1 -1
  628. package/dist/document/settled-index.js +5 -5
  629. package/dist/document/settled-index.js.map +1 -1
  630. package/dist/document/timeline-patch.d.ts +4 -0
  631. package/dist/document/timeline-patch.d.ts.map +1 -1
  632. package/dist/document/timeline-patch.js +28 -3
  633. package/dist/document/timeline-patch.js.map +1 -1
  634. package/dist/document/timeline.d.ts +48 -4
  635. package/dist/document/timeline.d.ts.map +1 -1
  636. package/dist/document/timeline.js +174 -44
  637. package/dist/document/timeline.js.map +1 -1
  638. package/dist/document/types.d.ts +18 -32
  639. package/dist/document/types.d.ts.map +1 -1
  640. package/dist/document/types.js.map +1 -1
  641. package/dist/document/validate.d.ts +18 -6
  642. package/dist/document/validate.d.ts.map +1 -1
  643. package/dist/document/validate.js +158 -21
  644. package/dist/document/validate.js.map +1 -1
  645. package/dist/document/vocabulary.d.ts +28 -0
  646. package/dist/document/vocabulary.d.ts.map +1 -0
  647. package/dist/document/vocabulary.js +42 -0
  648. package/dist/document/vocabulary.js.map +1 -0
  649. package/dist/experimental.d.ts +79 -19
  650. package/dist/experimental.d.ts.map +1 -1
  651. package/dist/experimental.js +31 -17
  652. package/dist/experimental.js.map +1 -1
  653. package/dist/index.d.ts +10 -11
  654. package/dist/index.d.ts.map +1 -1
  655. package/dist/index.js +10 -11
  656. package/dist/index.js.map +1 -1
  657. package/dist/layout/types.d.ts +1 -1
  658. package/dist/layout/types.js.map +1 -1
  659. package/dist/platform/exporter.d.ts +13 -0
  660. package/dist/platform/exporter.d.ts.map +1 -1
  661. package/dist/platform/exporter.js.map +1 -1
  662. package/dist/props/host.d.ts +1 -1
  663. package/dist/props/host.js.map +1 -1
  664. package/dist/props/slot.d.ts +1 -1
  665. package/dist/props/slot.js +1 -1
  666. package/dist/props/slot.js.map +1 -1
  667. package/dist/renamed-scene-names.d.ts +1 -1
  668. package/dist/renamed-scene-names.d.ts.map +1 -1
  669. package/dist/renamed-scene-names.js +1 -1
  670. package/dist/renamed-scene-names.js.map +1 -1
  671. package/dist/render/canvas-render-context2d.d.ts +9 -0
  672. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  673. package/dist/render/canvas-render-context2d.js +10 -0
  674. package/dist/render/canvas-render-context2d.js.map +1 -1
  675. package/dist/render/clip-contains.js +1 -1
  676. package/dist/render/clip-contains.js.map +1 -1
  677. package/dist/render/clip.d.ts +1 -1
  678. package/dist/render/clip.js +1 -1
  679. package/dist/render/clip.js.map +1 -1
  680. package/dist/render/descriptors/rect.js.map +1 -1
  681. package/dist/render/descriptors/text.d.ts +13 -7
  682. package/dist/render/descriptors/text.d.ts.map +1 -1
  683. package/dist/render/descriptors/text.js +9 -3
  684. package/dist/render/descriptors/text.js.map +1 -1
  685. package/dist/render/index.d.ts +2 -0
  686. package/dist/render/index.d.ts.map +1 -1
  687. package/dist/render/index.js +1 -0
  688. package/dist/render/index.js.map +1 -1
  689. package/dist/render/render-context2d.d.ts +3 -3
  690. package/dist/render/render-context2d.js.map +1 -1
  691. package/dist/render/render-issue.d.ts +39 -0
  692. package/dist/render/render-issue.d.ts.map +1 -0
  693. package/dist/render/render-issue.js +29 -0
  694. package/dist/render/render-issue.js.map +1 -0
  695. package/dist/render/surface.d.ts +2 -2
  696. package/dist/render/surface.js.map +1 -1
  697. package/dist/render3d/builders.d.ts +1 -1
  698. package/dist/render3d/builders.js +1 -1
  699. package/dist/render3d/builders.js.map +1 -1
  700. package/dist/render3d/graphics3d.d.ts +13 -19
  701. package/dist/render3d/graphics3d.d.ts.map +1 -1
  702. package/dist/render3d/graphics3d.js +67 -24
  703. package/dist/render3d/graphics3d.js.map +1 -1
  704. package/dist/render3d/scene3d.d.ts +1 -1
  705. package/dist/render3d/scene3d.js +1 -1
  706. package/dist/render3d/scene3d.js.map +1 -1
  707. package/dist/render3d/texture.d.ts +2 -2
  708. package/dist/render3d/texture.d.ts.map +1 -1
  709. package/dist/render3d/texture.js.map +1 -1
  710. package/dist/render3d/vector3.d.ts +2 -2
  711. package/dist/render3d/vector3.js +2 -2
  712. package/dist/render3d/vector3.js.map +1 -1
  713. package/dist/runtime/asset-refine.d.ts +1 -1
  714. package/dist/runtime/asset-refine.d.ts.map +1 -1
  715. package/dist/runtime/asset-refine.js +3 -2
  716. package/dist/runtime/asset-refine.js.map +1 -1
  717. package/dist/runtime/asset-timeline.d.ts +10 -0
  718. package/dist/runtime/asset-timeline.d.ts.map +1 -1
  719. package/dist/runtime/asset-timeline.js.map +1 -1
  720. package/dist/runtime/asset-update.d.ts.map +1 -1
  721. package/dist/runtime/asset-update.js +8 -1
  722. package/dist/runtime/asset-update.js.map +1 -1
  723. package/dist/runtime/audio-index.d.ts +0 -11
  724. package/dist/runtime/audio-index.d.ts.map +1 -1
  725. package/dist/runtime/audio-index.js +0 -25
  726. package/dist/runtime/audio-index.js.map +1 -1
  727. package/dist/runtime/clip-instance.d.ts +6 -4
  728. package/dist/runtime/clip-instance.d.ts.map +1 -1
  729. package/dist/runtime/clip-instance.js +8 -4
  730. package/dist/runtime/clip-instance.js.map +1 -1
  731. package/dist/runtime/clip-store.d.ts +2 -3
  732. package/dist/runtime/clip-store.d.ts.map +1 -1
  733. package/dist/runtime/clip-store.js +34 -37
  734. package/dist/runtime/clip-store.js.map +1 -1
  735. package/dist/runtime/engine.d.ts +8 -6
  736. package/dist/runtime/engine.d.ts.map +1 -1
  737. package/dist/runtime/engine.js +4 -3
  738. package/dist/runtime/engine.js.map +1 -1
  739. package/dist/runtime/node-picking.d.ts +2 -2
  740. package/dist/runtime/node-picking.d.ts.map +1 -1
  741. package/dist/runtime/node-picking.js +3 -3
  742. package/dist/runtime/node-picking.js.map +1 -1
  743. package/dist/runtime/node-picking3d.d.ts +2 -2
  744. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  745. package/dist/runtime/node-picking3d.js +1 -1
  746. package/dist/runtime/node-picking3d.js.map +1 -1
  747. package/dist/runtime/playback-controller.d.ts +2 -2
  748. package/dist/runtime/playback-controller.d.ts.map +1 -1
  749. package/dist/runtime/playback-controller.js +15 -5
  750. package/dist/runtime/playback-controller.js.map +1 -1
  751. package/dist/runtime/session.d.ts +7 -3
  752. package/dist/runtime/session.d.ts.map +1 -1
  753. package/dist/runtime/session.js +11 -4
  754. package/dist/runtime/session.js.map +1 -1
  755. package/dist/runtime/state-evaluator.d.ts +2 -2
  756. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  757. package/dist/runtime/state-evaluator.js.map +1 -1
  758. package/dist/runtime/text-geometry.d.ts +2 -2
  759. package/dist/runtime/text-geometry.d.ts.map +1 -1
  760. package/dist/runtime/text-geometry.js +4 -5
  761. package/dist/runtime/text-geometry.js.map +1 -1
  762. package/dist/sdk/index.d.ts +50 -44
  763. package/dist/sdk/index.d.ts.map +1 -1
  764. package/dist/sdk/index.js +35 -29
  765. package/dist/sdk/index.js.map +1 -1
  766. package/dist/tween/command-decorator.d.ts +14 -9
  767. package/dist/tween/command-decorator.d.ts.map +1 -1
  768. package/dist/tween/command-decorator.js +3 -2
  769. package/dist/tween/command-decorator.js.map +1 -1
  770. package/dist/tween/command.d.ts +1 -1
  771. package/dist/tween/command.js.map +1 -1
  772. package/dist/tween/ease/describe.d.ts +2 -0
  773. package/dist/tween/ease/describe.d.ts.map +1 -1
  774. package/dist/tween/ease/describe.js +4 -0
  775. package/dist/tween/ease/describe.js.map +1 -1
  776. package/dist/tween/ease/spec.d.ts +31 -0
  777. package/dist/tween/ease/spec.d.ts.map +1 -0
  778. package/dist/tween/ease/spec.js +51 -0
  779. package/dist/tween/ease/spec.js.map +1 -0
  780. package/dist/tween/index.d.ts +3 -1
  781. package/dist/tween/index.d.ts.map +1 -1
  782. package/dist/tween/index.js +2 -1
  783. package/dist/tween/index.js.map +1 -1
  784. package/dist/tween/loop.d.ts +1 -1
  785. package/dist/tween/loop.js +1 -1
  786. package/dist/tween/loop.js.map +1 -1
  787. package/dist/util/reference.d.ts +6 -6
  788. package/dist/util/reference.js.map +1 -1
  789. package/package.json +3 -11
  790. package/dist/browser/chunks/chunk-2RIYH36X.js +0 -3
  791. package/dist/browser/chunks/chunk-2RIYH36X.js.map +0 -7
  792. package/dist/browser/chunks/chunk-DDJN3QII.js +0 -15
  793. package/dist/browser/chunks/chunk-DDJN3QII.js.map +0 -7
  794. package/dist/browser/chunks/chunk-DHB4COFY.js +0 -2
  795. package/dist/browser/chunks/chunk-EJDPYDQI.js +0 -5
  796. package/dist/browser/chunks/chunk-EJDPYDQI.js.map +0 -7
  797. package/dist/browser/chunks/chunk-SFNJRPBV.js +0 -2
  798. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +0 -7
  799. package/dist/browser/chunks/chunk-XAWE4EAK.js +0 -2
  800. package/dist/browser/chunks/chunk-XAWE4EAK.js.map +0 -7
  801. package/dist/browser/jsx-jsx-dev-runtime.js +0 -2
  802. package/dist/browser/jsx-jsx-dev-runtime.js.map +0 -7
  803. package/dist/browser/jsx-jsx-runtime.js +0 -2
  804. package/dist/browser/jsx-jsx-runtime.js.map +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"clip-contains.js","sourceRoot":"","sources":["../../src/render/clip-contains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AAEH,0DAA0D;AAC1D,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,IAAU,EAAE,KAAc,EAAE,SAAS,GAAG,CAAC;IAClE,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,WAAW,CAAC,GAAsB,EAAE,KAAc,EAAE,SAAS,GAAG,CAAC;IAC7E,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,uEAAuE;IACvE,0DAA0D;IAC1D,IAAI,OAAO,GAAuB,IAAI,CAAC;IAEvC,MAAM,KAAK,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AG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { Clip, ClipOp, ClipShapeOp } from \"./clip\";\r\nimport { withRectDescriptor } from \"./descriptors/rect\";\r\nimport { withEllipseDescriptor } from \"./descriptors/ellipse\";\r\nimport { withPolygonDescriptor } from \"./descriptors/polygon\";\r\nimport { withPolygramDescriptor } from \"./descriptors/polygram\";\r\nimport { withLineDescriptor } from \"./descriptors/line\";\r\nimport { cornerRadiusOps } from \"@/attributes/shape/corners/corner-radius\";\r\n\r\n/**\r\n * Point-in-region tests for {@link Clip}, used by node hit testing so a click\r\n * follows a shape's silhouette rather than its bounding box.\r\n *\r\n * Geometry only — no renderer, no CanvasKit — because a `Clip` is a declarative\r\n * record of primitives rather than a built path. That is what lets hit testing\r\n * live in `core` and share one outline definition with clipping and backdrop\r\n * effects: a shape declares its outline once, in `clipSelf()`, and both the\r\n * pixels and the grab region derive from it.\r\n *\r\n * Every point and every descriptor coordinate here is in **y-up author space**\r\n * (the space `Graphics2D`/`Clip` descriptors are written in; the renderer flips to\r\n * canvas y-down at draw time — see `flipPositionY`). Angles follow from that:\r\n * `startAngle`/`sweep` measure counter-clockwise from +x.\r\n */\r\n\r\n/** Guard against divide-by-zero on collapsed geometry. */\r\nconst EPS = 1e-9;\r\n\r\n/**\r\n * Whether `point` falls inside the region a {@link Clip} describes, within\r\n * `tolerance` scene units of its edge.\r\n *\r\n * Shape ops union; a `cut` subtracts the immediately preceding shape from\r\n * everything declared before it, mirroring how the renderer replays the op list.\r\n * `tolerance` widens each shape outward — including a cutter, which therefore\r\n * takes a slightly larger bite, keeping the test forgiving in both directions\r\n * rather than making a hole's rim unpickable.\r\n */\r\nexport function containsClip(clip: Clip, point: Vector2, tolerance = 0): boolean {\r\n return containsOps(clip.ops(), point, tolerance);\r\n}\r\n\r\n/** {@link containsClip} over a raw op list. */\r\nexport function containsOps(ops: readonly ClipOp[], point: Vector2, tolerance = 0): boolean {\r\n let inside = false;\r\n // The shape immediately preceding the current position, held back so a\r\n // following `cut` can subtract it instead of unioning it.\r\n let pending: ClipShapeOp | null = null;\r\n\r\n const flush = (): void => {\r\n if (pending && containsShape(pending, point, tolerance)) inside = true;\r\n pending = null;\r\n };\r\n\r\n for (const op of ops) {\r\n if (op.kind === \"cut\") {\r\n // The pending shape is the cutter: it never joins the union, and it\r\n // punches whatever was accumulated before it.\r\n if (pending && containsShape(pending, point, tolerance)) inside = false;\r\n pending = null;\r\n continue;\r\n }\r\n flush();\r\n pending = op;\r\n }\r\n flush();\r\n return inside;\r\n}\r\n\r\n/**\r\n * Dispatch one shape op to its own containment test, after undoing the shape's\r\n * local rotation/scale about its pivot — mirroring `BaseShape.applyShapeTransform`,\r\n * which bakes that same transform into the drawn path.\r\n */\r\nfunction containsShape(op: ClipShapeOp, point: Vector2, tolerance: number): boolean {\r\n switch (op.kind) {\r\n case \"rect\": {\r\n const s = withRectDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsRect(p, s.width, s.height, cornerRadiusOps.resolve(s.cornerRadius), tolerance);\r\n }\r\n case \"ellipse\": {\r\n const s = withEllipseDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsEllipse(p, s.width, s.height, s.ratio, s.sweep, s.startAngle, tolerance);\r\n }\r\n case \"polygon\": {\r\n const s = withPolygonDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsPolyline(p, polygonVertices(s.width, s.height, s.sides), true, tolerance);\r\n }\r\n case \"polygram\": {\r\n const s = withPolygramDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsPolyline(p, polygramVertices(s.width, s.height, s.sides, s.ratio), true, tolerance);\r\n }\r\n case \"line\": {\r\n const s = withLineDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n if (p === null || s.points.length === 0) return false;\r\n // As a clip region a polyline is filled with its contour implicitly\r\n // closed, whether or not `closed` was set — so test the enclosed area\r\n // first, then fall back to the band around the stroke itself.\r\n if (s.points.length >= 3 && containsPolyline(p, s.points, true, tolerance)) return true;\r\n return nearPolyline(p, s.points, s.closed, tolerance);\r\n }\r\n case \"path\": {\r\n // An arbitrary Bézier winding test is not worth carrying, and no\r\n // built-in shape emits a `path` clip — only a hand-built `Clip` can.\r\n // Fall back to the declared box.\r\n const s = op.state;\r\n const local = { x: point.x - (s.x ?? 0), y: point.y - (s.y ?? 0) };\r\n return containsRect(local, s.width ?? 0, s.height ?? 0, cornerRadiusOps.resolve(0), tolerance);\r\n }\r\n }\r\n}\r\n\r\n/** The positioning fields every shape descriptor resolves to. */\r\ninterface ShapePlacement {\r\n x: number;\r\n y: number;\r\n rotation: number;\r\n scale: number;\r\n pivot: unknown;\r\n}\r\n\r\n/**\r\n * Map `point` out of the shape's own `x`/`y`/`rotation`/`scale` (about its\r\n * pivot) and into the shape's un-transformed, centred frame. Returns `null` when\r\n * the scale is zero — the shape has collapsed and encloses nothing.\r\n */\r\nfunction toShapeLocal(point: Vector2, s: ShapePlacement, width: number, height: number): Vector2 | null {\r\n if (s.scale === 0) return null;\r\n const pivot = s.pivot as Vector2;\r\n // Pivot is normalised [-1, 1] about the shape centre, y-up here (the\r\n // renderer negates its y because it works in canvas space).\r\n const px = pivot.x * (width / 2);\r\n const py = pivot.y * (height / 2);\r\n // Relative to the pivot, in the parent's (unrotated) frame.\r\n const dx = point.x - (s.x + px);\r\n const dy = point.y - (s.y + py);\r\n // Undo the clockwise rotation: in y-up space the forward map is\r\n // (cos·x + sin·y, -sin·x + cos·y), so the inverse swaps the sine signs.\r\n const rad = (s.rotation * Math.PI) / 180;\r\n const cos = Math.cos(rad);\r\n const sin = Math.sin(rad);\r\n const rx = (cos * dx - sin * dy) / s.scale;\r\n const ry = (sin * dx + cos * dy) / s.scale;\r\n // Back to centre-relative: the pivot sits (px, py) from the centre.\r\n return { x: rx + px, y: ry + py };\r\n}\r\n\r\n// ─── Primitives ──────────────────────────────────────────────────────────────\r\n\r\ninterface Corners4 { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }\r\n\r\n/**\r\n * Axis-aligned box centred on the origin, with per-corner rounding. A corner is\r\n * only excluded when the point sits beyond that corner's quarter-circle, so a\r\n * plain rect (all radii 0) reduces to the box test exactly. `cornerStyle` is not\r\n * consulted: an `'angled'` chamfer cuts strictly inside the arc, so testing the\r\n * arc over-estimates by a sliver — the forgiving direction for a grab test.\r\n */\r\nfunction containsRect(p: Vector2, width: number, height: number, radius: Corners4, tolerance: number): boolean {\r\n const halfW = width / 2 + tolerance;\r\n const halfH = height / 2 + tolerance;\r\n if (Math.abs(p.x) > halfW || Math.abs(p.y) > halfH) return false;\r\n\r\n // Pick the corner the point is nearest and test its arc. Radii are clamped\r\n // the way any rounded-rect rasteriser clamps them: never past half the side.\r\n const maxR = Math.min(width, height) / 2;\r\n const r = Math.min(\r\n maxR,\r\n p.x <= 0\r\n ? (p.y >= 0 ? radius.topLeft : radius.bottomLeft)\r\n : (p.y >= 0 ? radius.topRight : radius.bottomRight),\r\n );\r\n if (r <= 0) return true;\r\n\r\n // Centre of that corner's arc, then the usual \"outside the quarter-circle\"\r\n // check — which only bites inside the corner square itself.\r\n const sx = Math.sign(p.x || 1);\r\n const sy = Math.sign(p.y || 1);\r\n const dx = p.x - sx * (width / 2 - r);\r\n const dy = p.y - sy * (height / 2 - r);\r\n if (Math.sign(dx || 1) !== sx || Math.sign(dy || 1) !== sy) return true;\r\n return dx * dx + dy * dy <= (r + tolerance) * (r + tolerance);\r\n}\r\n\r\n/**\r\n * Ellipse, honouring the same `ratio`/`sweep`/`startAngle` family the renderer\r\n * draws (see `EllipseShape.buildSVGPath`), so the grab region is the region that\r\n * was actually painted:\r\n *\r\n * - `ratio` ≤ 0 → solid disk, or a wedge for a partial sweep\r\n * - 0 < `ratio` < 1 → annulus / annular sector (the hole is not hittable)\r\n * - `ratio` ≥ 1 → the band has collapsed to the bare outer curve, so only\r\n * points near that curve hit\r\n */\r\nfunction containsEllipse(\r\n p: Vector2, width: number, height: number,\r\n ratio: number, sweep: number, startAngle: number,\r\n tolerance: number,\r\n): boolean {\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n if (rx <= 0 || ry <= 0) return false;\r\n\r\n const clamped = Math.max(0, Math.min(1, ratio));\r\n const full = Math.abs(sweep) >= 360;\r\n\r\n // Outside the outer curve (grown by tolerance) can never hit.\r\n if (norm(p, rx + tolerance, ry + tolerance) > 1) return false;\r\n\r\n if (clamped > 0) {\r\n const inner = norm(p, Math.max(EPS, rx * clamped - tolerance), Math.max(EPS, ry * clamped - tolerance));\r\n if (inner < 1) return false;\r\n }\r\n\r\n if (full) return true;\r\n return withinSweep(Math.atan2(p.y / ry, p.x / rx) * (180 / Math.PI), startAngle, sweep, p, tolerance);\r\n}\r\n\r\n/** Normalised radius of `p` on an ellipse of half-axes `rx`/`ry` (1 = on the curve). */\r\nfunction norm(p: Vector2, rx: number, ry: number): number {\r\n return Math.hypot(p.x / rx, p.y / ry);\r\n}\r\n\r\n/**\r\n * Whether `angleDeg` lies within the arc `[startAngle, startAngle + sweep]`,\r\n * with `tolerance` converted to angular slack at the point's own radius so\r\n * grab-slop widens the wedge's straight edges too. Handles negative sweeps.\r\n */\r\nfunction withinSweep(\r\n angleDeg: number, startAngle: number, sweep: number,\r\n p: Vector2, tolerance: number,\r\n): boolean {\r\n const lo = sweep >= 0 ? startAngle : startAngle + sweep;\r\n const span = Math.abs(sweep);\r\n // Near the centre every angle is within tolerance of the wedge.\r\n const radius = Math.hypot(p.x, p.y);\r\n if (radius <= tolerance) return true;\r\n const slack = tolerance > 0 ? (tolerance / Math.max(radius, EPS)) * (180 / Math.PI) : 0;\r\n let delta = (angleDeg - lo) % 360;\r\n if (delta < 0) delta += 360;\r\n // Accept the wrap-around side within slack as well.\r\n return delta <= span + slack || delta >= 360 - slack;\r\n}\r\n\r\n/**\r\n * Vertices of a regular polygon inscribed in `width`×`height`, y-up author\r\n * space. The renderer starts at the top vertex and steps clockwise in canvas\r\n * space; in y-up that is `+π/2` stepping negative.\r\n */\r\nexport function polygonVertices(width: number, height: number, sides: number): Vector2[] {\r\n const n = Math.max(3, Math.round(sides));\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n const step = (2 * Math.PI) / n;\r\n const out: Vector2[] = [];\r\n for (let i = 0; i < n; i++) {\r\n const a = Math.PI / 2 - i * step;\r\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) });\r\n }\r\n return out;\r\n}\r\n\r\n/** Vertices of a star polygon: outer radius 1 alternating with inner radius `ratio`. */\r\nexport function polygramVertices(width: number, height: number, sides: number, ratio: number): Vector2[] {\r\n const n = Math.max(3, Math.round(sides));\r\n const r = Math.max(0, Math.min(1, ratio));\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n const step = Math.PI / n;\r\n const out: Vector2[] = [];\r\n for (let i = 0; i < n * 2; i++) {\r\n const a = Math.PI / 2 - i * step;\r\n const k = i % 2 === 0 ? 1 : r;\r\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) });\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * Even-odd crossing test against a polygon, widened by `tolerance`: a point just\r\n * outside an edge still counts. `closed` also closes the last→first segment for\r\n * the tolerance band.\r\n */\r\nfunction containsPolyline(p: Vector2, verts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\r\n if (verts.length >= 3 && pointInPolygon(p, verts)) return true;\r\n return tolerance > 0 && nearPolyline(p, verts, closed, tolerance);\r\n}\r\n\r\n/** Even-odd crossing test against a closed polygon. No tolerance band. */\r\nexport function pointInPolygon(p: Vector2, verts: readonly Vector2[]): boolean {\r\n if (verts.length < 3) return false;\r\n let inside = false;\r\n for (let i = 0, j = verts.length - 1; i < verts.length; j = i++) {\r\n const a = verts[i];\r\n const b = verts[j];\r\n if ((a.y > p.y) !== (b.y > p.y) && p.x < ((b.x - a.x) * (p.y - a.y)) / (b.y - a.y) + a.x) {\r\n inside = !inside;\r\n }\r\n }\r\n return inside;\r\n}\r\n\r\n/** Whether `p` is within `tolerance` of any segment of the polyline. */\r\nexport function nearPolyline(p: Vector2, pts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\r\n if (pts.length === 0) return false;\r\n if (pts.length === 1) return Math.hypot(p.x - pts[0].x, p.y - pts[0].y) <= tolerance;\r\n const last = closed ? pts.length : pts.length - 1;\r\n for (let i = 0; i < last; i++) {\r\n if (distanceToSegment(p, pts[i], pts[(i + 1) % pts.length]) <= tolerance) return true;\r\n }\r\n return false;\r\n}\r\n\r\n/** Shortest distance from `p` to the segment `a`–`b`. */\r\nexport function distanceToSegment(p: Vector2, a: Vector2, b: Vector2): number {\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n const lenSq = dx * dx + dy * dy;\r\n if (lenSq <= EPS) return Math.hypot(p.x - a.x, p.y - a.y);\r\n let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq;\r\n t = t < 0 ? 0 : t > 1 ? 1 : t;\r\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));\r\n}\r\n"]}
1
+ {"version":3,"file":"clip-contains.js","sourceRoot":"","sources":["../../src/render/clip-contains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;;;;;;;;;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C,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;IACtD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { Clip, ClipOp, ClipShapeOp } from \"./clip\";\r\nimport { withRectDescriptor } from \"./descriptors/rect\";\r\nimport { withEllipseDescriptor } from \"./descriptors/ellipse\";\r\nimport { withPolygonDescriptor } from \"./descriptors/polygon\";\r\nimport { withPolygramDescriptor } from \"./descriptors/polygram\";\r\nimport { withLineDescriptor } from \"./descriptors/line\";\r\nimport { cornerRadiusOps } from \"@/attributes/shape/corners/corner-radius\";\r\n\r\n/**\r\n * Point-in-region tests for {@link Clip}, used by node hit testing so a click\r\n * follows a shape's silhouette rather than its bounding box.\r\n *\r\n * Geometry only — no renderer — because a `Clip` is a declarative\r\n * record of primitives rather than a built path. That is what lets hit testing\r\n * live in `core` and share one outline definition with clipping and backdrop\r\n * effects: a shape declares its outline once, in `clipSelf()`, and both the\r\n * pixels and the grab region derive from it.\r\n *\r\n * Every point and every descriptor coordinate here is in **y-up author space**\r\n * (the space `Graphics2D`/`Clip` descriptors are written in; the renderer flips to\r\n * canvas y-down at draw time — see `flipPositionY`). Angles follow from that:\r\n * `startAngle`/`sweep` measure counter-clockwise from +x.\r\n */\r\n\r\n/** Guard against divide-by-zero on collapsed geometry. */\r\nconst EPS = 1e-9;\r\n\r\n/**\r\n * Whether `point` falls inside the region a {@link Clip} describes, within\r\n * `tolerance` scene units of its edge.\r\n *\r\n * Shape ops union; a `cut` subtracts the immediately preceding shape from\r\n * everything declared before it, mirroring how the renderer replays the op list.\r\n * `tolerance` widens each shape outward — including a cutter, which therefore\r\n * takes a slightly larger bite, keeping the test forgiving in both directions\r\n * rather than making a hole's rim unpickable.\r\n */\r\nexport function containsClip(clip: Clip, point: Vector2, tolerance = 0): boolean {\r\n return containsOps(clip.ops(), point, tolerance);\r\n}\r\n\r\n/** {@link containsClip} over a raw op list. */\r\nexport function containsOps(ops: readonly ClipOp[], point: Vector2, tolerance = 0): boolean {\r\n let inside = false;\r\n // The shape immediately preceding the current position, held back so a\r\n // following `cut` can subtract it instead of unioning it.\r\n let pending: ClipShapeOp | null = null;\r\n\r\n const flush = (): void => {\r\n if (pending && containsShape(pending, point, tolerance)) inside = true;\r\n pending = null;\r\n };\r\n\r\n for (const op of ops) {\r\n if (op.kind === \"cut\") {\r\n // The pending shape is the cutter: it never joins the union, and it\r\n // punches whatever was accumulated before it.\r\n if (pending && containsShape(pending, point, tolerance)) inside = false;\r\n pending = null;\r\n continue;\r\n }\r\n flush();\r\n pending = op;\r\n }\r\n flush();\r\n return inside;\r\n}\r\n\r\n/**\r\n * Dispatch one shape op to its own containment test, after undoing the shape's\r\n * local rotation/scale about its pivot — mirroring `BaseShape.applyShapeTransform`,\r\n * which bakes that same transform into the drawn path.\r\n */\r\nfunction containsShape(op: ClipShapeOp, point: Vector2, tolerance: number): boolean {\r\n switch (op.kind) {\r\n case \"rect\": {\r\n const s = withRectDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsRect(p, s.width, s.height, cornerRadiusOps.resolve(s.cornerRadius), tolerance);\r\n }\r\n case \"ellipse\": {\r\n const s = withEllipseDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsEllipse(p, s.width, s.height, s.ratio, s.sweep, s.startAngle, tolerance);\r\n }\r\n case \"polygon\": {\r\n const s = withPolygonDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsPolyline(p, polygonVertices(s.width, s.height, s.sides), true, tolerance);\r\n }\r\n case \"polygram\": {\r\n const s = withPolygramDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsPolyline(p, polygramVertices(s.width, s.height, s.sides, s.ratio), true, tolerance);\r\n }\r\n case \"line\": {\r\n const s = withLineDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n if (p === null || s.points.length === 0) return false;\r\n // As a clip region a polyline is filled with its contour implicitly\r\n // closed, whether or not `closed` was set — so test the enclosed area\r\n // first, then fall back to the band around the stroke itself.\r\n if (s.points.length >= 3 && containsPolyline(p, s.points, true, tolerance)) return true;\r\n return nearPolyline(p, s.points, s.closed, tolerance);\r\n }\r\n case \"path\": {\r\n // An arbitrary Bézier winding test is not worth carrying, and no\r\n // built-in shape emits a `path` clip — only a hand-built `Clip` can.\r\n // Fall back to the declared box.\r\n const s = op.state;\r\n const local = { x: point.x - (s.x ?? 0), y: point.y - (s.y ?? 0) };\r\n return containsRect(local, s.width ?? 0, s.height ?? 0, cornerRadiusOps.resolve(0), tolerance);\r\n }\r\n }\r\n}\r\n\r\n/** The positioning fields every shape descriptor resolves to. */\r\ninterface ShapePlacement {\r\n x: number;\r\n y: number;\r\n rotation: number;\r\n scale: number;\r\n pivot: unknown;\r\n}\r\n\r\n/**\r\n * Map `point` out of the shape's own `x`/`y`/`rotation`/`scale` (about its\r\n * pivot) and into the shape's un-transformed, centred frame. Returns `null` when\r\n * the scale is zero — the shape has collapsed and encloses nothing.\r\n */\r\nfunction toShapeLocal(point: Vector2, s: ShapePlacement, width: number, height: number): Vector2 | null {\r\n if (s.scale === 0) return null;\r\n const pivot = s.pivot as Vector2;\r\n // Pivot is normalised [-1, 1] about the shape centre, y-up here (the\r\n // renderer negates its y because it works in canvas space).\r\n const px = pivot.x * (width / 2);\r\n const py = pivot.y * (height / 2);\r\n // Relative to the pivot, in the parent's (unrotated) frame.\r\n const dx = point.x - (s.x + px);\r\n const dy = point.y - (s.y + py);\r\n // Undo the clockwise rotation: in y-up space the forward map is\r\n // (cos·x + sin·y, -sin·x + cos·y), so the inverse swaps the sine signs.\r\n const rad = (s.rotation * Math.PI) / 180;\r\n const cos = Math.cos(rad);\r\n const sin = Math.sin(rad);\r\n const rx = (cos * dx - sin * dy) / s.scale;\r\n const ry = (sin * dx + cos * dy) / s.scale;\r\n // Back to centre-relative: the pivot sits (px, py) from the centre.\r\n return { x: rx + px, y: ry + py };\r\n}\r\n\r\n// ─── Primitives ──────────────────────────────────────────────────────────────\r\n\r\ninterface Corners4 { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }\r\n\r\n/**\r\n * Axis-aligned box centred on the origin, with per-corner rounding. A corner is\r\n * only excluded when the point sits beyond that corner's quarter-circle, so a\r\n * plain rect (all radii 0) reduces to the box test exactly. `cornerStyle` is not\r\n * consulted: an `'angled'` chamfer cuts strictly inside the arc, so testing the\r\n * arc over-estimates by a sliver — the forgiving direction for a grab test.\r\n */\r\nfunction containsRect(p: Vector2, width: number, height: number, radius: Corners4, tolerance: number): boolean {\r\n const halfW = width / 2 + tolerance;\r\n const halfH = height / 2 + tolerance;\r\n if (Math.abs(p.x) > halfW || Math.abs(p.y) > halfH) return false;\r\n\r\n // Pick the corner the point is nearest and test its arc. Radii are clamped\r\n // the way any rounded-rect rasteriser clamps them: never past half the side.\r\n const maxR = Math.min(width, height) / 2;\r\n const r = Math.min(\r\n maxR,\r\n p.x <= 0\r\n ? (p.y >= 0 ? radius.topLeft : radius.bottomLeft)\r\n : (p.y >= 0 ? radius.topRight : radius.bottomRight),\r\n );\r\n if (r <= 0) return true;\r\n\r\n // Centre of that corner's arc, then the usual \"outside the quarter-circle\"\r\n // check — which only bites inside the corner square itself.\r\n const sx = Math.sign(p.x || 1);\r\n const sy = Math.sign(p.y || 1);\r\n const dx = p.x - sx * (width / 2 - r);\r\n const dy = p.y - sy * (height / 2 - r);\r\n if (Math.sign(dx || 1) !== sx || Math.sign(dy || 1) !== sy) return true;\r\n return dx * dx + dy * dy <= (r + tolerance) * (r + tolerance);\r\n}\r\n\r\n/**\r\n * Ellipse, honouring the same `ratio`/`sweep`/`startAngle` family the renderer\r\n * draws (see `EllipseShape.buildSVGPath`), so the grab region is the region that\r\n * was actually painted:\r\n *\r\n * - `ratio` ≤ 0 → solid disk, or a wedge for a partial sweep\r\n * - 0 < `ratio` < 1 → annulus / annular sector (the hole is not hittable)\r\n * - `ratio` ≥ 1 → the band has collapsed to the bare outer curve, so only\r\n * points near that curve hit\r\n */\r\nfunction containsEllipse(\r\n p: Vector2, width: number, height: number,\r\n ratio: number, sweep: number, startAngle: number,\r\n tolerance: number,\r\n): boolean {\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n if (rx <= 0 || ry <= 0) return false;\r\n\r\n const clamped = Math.max(0, Math.min(1, ratio));\r\n const full = Math.abs(sweep) >= 360;\r\n\r\n // Outside the outer curve (grown by tolerance) can never hit.\r\n if (norm(p, rx + tolerance, ry + tolerance) > 1) return false;\r\n\r\n if (clamped > 0) {\r\n const inner = norm(p, Math.max(EPS, rx * clamped - tolerance), Math.max(EPS, ry * clamped - tolerance));\r\n if (inner < 1) return false;\r\n }\r\n\r\n if (full) return true;\r\n return withinSweep(Math.atan2(p.y / ry, p.x / rx) * (180 / Math.PI), startAngle, sweep, p, tolerance);\r\n}\r\n\r\n/** Normalised radius of `p` on an ellipse of half-axes `rx`/`ry` (1 = on the curve). */\r\nfunction norm(p: Vector2, rx: number, ry: number): number {\r\n return Math.hypot(p.x / rx, p.y / ry);\r\n}\r\n\r\n/**\r\n * Whether `angleDeg` lies within the arc `[startAngle, startAngle + sweep]`,\r\n * with `tolerance` converted to angular slack at the point's own radius so\r\n * grab-slop widens the wedge's straight edges too. Handles negative sweeps.\r\n */\r\nfunction withinSweep(\r\n angleDeg: number, startAngle: number, sweep: number,\r\n p: Vector2, tolerance: number,\r\n): boolean {\r\n const lo = sweep >= 0 ? startAngle : startAngle + sweep;\r\n const span = Math.abs(sweep);\r\n // Near the centre every angle is within tolerance of the wedge.\r\n const radius = Math.hypot(p.x, p.y);\r\n if (radius <= tolerance) return true;\r\n const slack = tolerance > 0 ? (tolerance / Math.max(radius, EPS)) * (180 / Math.PI) : 0;\r\n let delta = (angleDeg - lo) % 360;\r\n if (delta < 0) delta += 360;\r\n // Accept the wrap-around side within slack as well.\r\n return delta <= span + slack || delta >= 360 - slack;\r\n}\r\n\r\n/**\r\n * Vertices of a regular polygon inscribed in `width`×`height`, y-up author\r\n * space. The renderer starts at the top vertex and steps clockwise in canvas\r\n * space; in y-up that is `+π/2` stepping negative.\r\n */\r\nexport function polygonVertices(width: number, height: number, sides: number): Vector2[] {\r\n const n = Math.max(3, Math.round(sides));\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n const step = (2 * Math.PI) / n;\r\n const out: Vector2[] = [];\r\n for (let i = 0; i < n; i++) {\r\n const a = Math.PI / 2 - i * step;\r\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) });\r\n }\r\n return out;\r\n}\r\n\r\n/** Vertices of a star polygon: outer radius 1 alternating with inner radius `ratio`. */\r\nexport function polygramVertices(width: number, height: number, sides: number, ratio: number): Vector2[] {\r\n const n = Math.max(3, Math.round(sides));\r\n const r = Math.max(0, Math.min(1, ratio));\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n const step = Math.PI / n;\r\n const out: Vector2[] = [];\r\n for (let i = 0; i < n * 2; i++) {\r\n const a = Math.PI / 2 - i * step;\r\n const k = i % 2 === 0 ? 1 : r;\r\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) });\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * Even-odd crossing test against a polygon, widened by `tolerance`: a point just\r\n * outside an edge still counts. `closed` also closes the last→first segment for\r\n * the tolerance band.\r\n */\r\nfunction containsPolyline(p: Vector2, verts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\r\n if (verts.length >= 3 && pointInPolygon(p, verts)) return true;\r\n return tolerance > 0 && nearPolyline(p, verts, closed, tolerance);\r\n}\r\n\r\n/** Even-odd crossing test against a closed polygon. No tolerance band. */\r\nexport function pointInPolygon(p: Vector2, verts: readonly Vector2[]): boolean {\r\n if (verts.length < 3) return false;\r\n let inside = false;\r\n for (let i = 0, j = verts.length - 1; i < verts.length; j = i++) {\r\n const a = verts[i];\r\n const b = verts[j];\r\n if ((a.y > p.y) !== (b.y > p.y) && p.x < ((b.x - a.x) * (p.y - a.y)) / (b.y - a.y) + a.x) {\r\n inside = !inside;\r\n }\r\n }\r\n return inside;\r\n}\r\n\r\n/** Whether `p` is within `tolerance` of any segment of the polyline. */\r\nexport function nearPolyline(p: Vector2, pts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\r\n if (pts.length === 0) return false;\r\n if (pts.length === 1) return Math.hypot(p.x - pts[0].x, p.y - pts[0].y) <= tolerance;\r\n const last = closed ? pts.length : pts.length - 1;\r\n for (let i = 0; i < last; i++) {\r\n if (distanceToSegment(p, pts[i], pts[(i + 1) % pts.length]) <= tolerance) return true;\r\n }\r\n return false;\r\n}\r\n\r\n/** Shortest distance from `p` to the segment `a`–`b`. */\r\nexport function distanceToSegment(p: Vector2, a: Vector2, b: Vector2): number {\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n const lenSq = dx * dx + dy * dy;\r\n if (lenSq <= EPS) return Math.hypot(p.x - a.x, p.y - a.y);\r\n let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq;\r\n t = t < 0 ? 0 : t > 1 ? 1 : t;\r\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));\r\n}\r\n"]}
@@ -55,7 +55,7 @@ export type ClipOp = ClipShapeOp | {
55
55
  * ...draw clipped content...
56
56
  * ctx.endClip();
57
57
  *
58
- * A `Clip` carries no paint — it's purely the outline. It's what a `ShapeNode`
58
+ * A `Clip` carries no paint — it's purely the outline. It's what a shape
59
59
  * returns from `clipSelf()` to describe both its `clip` boundary and the
60
60
  * silhouette its backdrop effects (blur, magnify, …) are confined to, so a
61
61
  * single definition drives every clip the node needs.
@@ -15,7 +15,7 @@ import { PathBuilder } from "./descriptors/path-builder.js";
15
15
  * ...draw clipped content...
16
16
  * ctx.endClip();
17
17
  *
18
- * A `Clip` carries no paint — it's purely the outline. It's what a `ShapeNode`
18
+ * A `Clip` carries no paint — it's purely the outline. It's what a shape
19
19
  * returns from `clipSelf()` to describe both its `clip` boundary and the
20
20
  * silhouette its backdrop effects (blur, magnify, …) are confined to, so a
21
21
  * single definition drives every clip the node needs.
@@ -1 +1 @@
1
- {"version":3,"file":"clip.js","sourceRoot":"","sources":["../../src/render/clip.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAuBzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,IAAI;IACL,IAAI,GAAa,EAAE,CAAC;IAE5B,4EAA4E;IAE5E,IAAI,CAAC,KAA+C;QAChD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,KAAkD;QACtD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mFAAmF;IACnF,IAAI,CAAC,KAAuC;QACxC,MAAM,QAAQ,GAAG,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5E,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,KAAyB;QAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,KAAkD;QACtD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAmD;QACxD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E;;;;OAIG;IACH,GAAG;QACC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E,6EAA6E;IAC7E,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACtD,CAAC;CACJ","sourcesContent":["import type { RectState } from \"./descriptors/rect\";\r\nimport type { EllipseState } from \"./descriptors/ellipse\";\r\nimport type { PathState } from \"./descriptors/path\";\r\nimport type { LineState } from \"./descriptors/line\";\r\nimport type { PolygonState } from \"./descriptors/polygon\";\r\nimport type { PolygramState } from \"./descriptors/polygram\";\r\nimport type { ShapeAlignmentInput } from \"./descriptors/shape\";\r\nimport { PathBuilder } from \"./descriptors/path-builder\";\r\n\r\n/**\r\n * The shape ops a {@link Clip} can record — the same geometry primitives a\r\n * {@link Graphics2D} can draw, minus text/image (which have no clippable outline).\r\n * Each carries the partial descriptor state for that shape.\r\n */\r\nexport type ClipShapeOp =\r\n | { kind: \"rect\"; state: Partial<RectState> & ShapeAlignmentInput }\r\n | { kind: \"ellipse\"; state: Partial<EllipseState> & ShapeAlignmentInput }\r\n | { kind: \"path\"; state: Partial<PathState> }\r\n | { kind: \"line\"; state: Partial<LineState> }\r\n | { kind: \"polygon\"; state: Partial<PolygonState> & ShapeAlignmentInput }\r\n | { kind: \"polygram\"; state: Partial<PolygramState> & ShapeAlignmentInput };\r\n\r\n/**\r\n * A single recorded op in a {@link Clip}. Shape ops add geometry to the clip\r\n * region; `cut` subtracts the last-declared shape from the ones before it. The\r\n * renderer replays this list into a single clip path via\r\n * `RenderContext2D.beginClip()`.\r\n */\r\nexport type ClipOp = ClipShapeOp | { kind: \"cut\" };\r\n\r\n/**\r\n * A renderer-agnostic, chainable clip-region builder — `Graphics2D` for clipping.\r\n *\r\n * `Clip` records a sequence of shape declarations (and optional `cut()`s) that\r\n * the renderer unions into a single clip path. Multiple shapes combine, so a\r\n * clip can be any compound silhouette, not just a single rect or ellipse:\r\n *\r\n * const c = new Clip()\r\n * .rect({ width: 200, height: 120, cornerRadius: 16 })\r\n * .ellipse({ x: 80, width: 60, height: 60 }) // unions with the rect\r\n * .ellipse({ x: -80, width: 40, height: 40 })\r\n * .cut(); // punches the last hole\r\n * ctx.beginClip(c);\r\n * ...draw clipped content...\r\n * ctx.endClip();\r\n *\r\n * A `Clip` carries no paint — it's purely the outline. It's what a `ShapeNode`\r\n * returns from `clipSelf()` to describe both its `clip` boundary and the\r\n * silhouette its backdrop effects (blur, magnify, …) are confined to, so a\r\n * single definition drives every clip the node needs.\r\n */\r\nexport class Clip {\r\n private _ops: ClipOp[] = [];\r\n\r\n // ─── Shapes ──────────────────────────────────────────────────────────────\r\n\r\n rect(state: Partial<RectState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"rect\", state });\r\n return this;\r\n }\r\n\r\n ellipse(state: Partial<EllipseState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"ellipse\", state });\r\n return this;\r\n }\r\n\r\n /** Add a vector path to the clip region, from a `PathState` or a `PathBuilder`. */\r\n path(state: Partial<PathState> | PathBuilder): this {\r\n const resolved = state instanceof PathBuilder ? state.toPathState() : state;\r\n this._ops.push({ kind: \"path\", state: resolved });\r\n return this;\r\n }\r\n\r\n line(state: Partial<LineState>): this {\r\n this._ops.push({ kind: \"line\", state });\r\n return this;\r\n }\r\n\r\n polygon(state: Partial<PolygonState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygon\", state });\r\n return this;\r\n }\r\n\r\n polygram(state: Partial<PolygramState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygram\", state });\r\n return this;\r\n }\r\n\r\n // ─── Compositing ─────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Use the last-declared shape as a cutter: union the shapes before it and\r\n * subtract that last shape, punching a hole in the clip region. Mirrors\r\n * {@link Graphics2D.cut}.\r\n */\r\n cut(): this {\r\n this._ops.push({ kind: \"cut\" });\r\n return this;\r\n }\r\n\r\n // ─── Consumption ─────────────────────────────────────────────────────────\r\n\r\n /** The recorded ops, in order. Consumed by `RenderContext2D.beginClip()`. */\r\n ops(): readonly ClipOp[] {\r\n return this._ops;\r\n }\r\n\r\n /** True when no shape op has been recorded — the clip region is empty. */\r\n isEmpty(): boolean {\r\n return !this._ops.some((op) => op.kind !== \"cut\");\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"clip.js","sourceRoot":"","sources":["../../src/render/clip.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAA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EAA4E;IAE5E;;;;OAIG;IACH,GAAG;QACC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E,6EAA6E;IAC7E,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACtD,CAAC;CACJ","sourcesContent":["import type { RectState } from \"./descriptors/rect\";\r\nimport type { EllipseState } from \"./descriptors/ellipse\";\r\nimport type { PathState } from \"./descriptors/path\";\r\nimport type { LineState } from \"./descriptors/line\";\r\nimport type { PolygonState } from \"./descriptors/polygon\";\r\nimport type { PolygramState } from \"./descriptors/polygram\";\r\nimport type { ShapeAlignmentInput } from \"./descriptors/shape\";\r\nimport { PathBuilder } from \"./descriptors/path-builder\";\r\n\r\n/**\r\n * The shape ops a {@link Clip} can record — the same geometry primitives a\r\n * {@link Graphics2D} can draw, minus text/image (which have no clippable outline).\r\n * Each carries the partial descriptor state for that shape.\r\n */\r\nexport type ClipShapeOp =\r\n | { kind: \"rect\"; state: Partial<RectState> & ShapeAlignmentInput }\r\n | { kind: \"ellipse\"; state: Partial<EllipseState> & ShapeAlignmentInput }\r\n | { kind: \"path\"; state: Partial<PathState> }\r\n | { kind: \"line\"; state: Partial<LineState> }\r\n | { kind: \"polygon\"; state: Partial<PolygonState> & ShapeAlignmentInput }\r\n | { kind: \"polygram\"; state: Partial<PolygramState> & ShapeAlignmentInput };\r\n\r\n/**\r\n * A single recorded op in a {@link Clip}. Shape ops add geometry to the clip\r\n * region; `cut` subtracts the last-declared shape from the ones before it. The\r\n * renderer replays this list into a single clip path via\r\n * `RenderContext2D.beginClip()`.\r\n */\r\nexport type ClipOp = ClipShapeOp | { kind: \"cut\" };\r\n\r\n/**\r\n * A renderer-agnostic, chainable clip-region builder — `Graphics2D` for clipping.\r\n *\r\n * `Clip` records a sequence of shape declarations (and optional `cut()`s) that\r\n * the renderer unions into a single clip path. Multiple shapes combine, so a\r\n * clip can be any compound silhouette, not just a single rect or ellipse:\r\n *\r\n * const c = new Clip()\r\n * .rect({ width: 200, height: 120, cornerRadius: 16 })\r\n * .ellipse({ x: 80, width: 60, height: 60 }) // unions with the rect\r\n * .ellipse({ x: -80, width: 40, height: 40 })\r\n * .cut(); // punches the last hole\r\n * ctx.beginClip(c);\r\n * ...draw clipped content...\r\n * ctx.endClip();\r\n *\r\n * A `Clip` carries no paint — it's purely the outline. It's what a shape\r\n * returns from `clipSelf()` to describe both its `clip` boundary and the\r\n * silhouette its backdrop effects (blur, magnify, …) are confined to, so a\r\n * single definition drives every clip the node needs.\r\n */\r\nexport class Clip {\r\n private _ops: ClipOp[] = [];\r\n\r\n // ─── Shapes ──────────────────────────────────────────────────────────────\r\n\r\n rect(state: Partial<RectState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"rect\", state });\r\n return this;\r\n }\r\n\r\n ellipse(state: Partial<EllipseState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"ellipse\", state });\r\n return this;\r\n }\r\n\r\n /** Add a vector path to the clip region, from a `PathState` or a `PathBuilder`. */\r\n path(state: Partial<PathState> | PathBuilder): this {\r\n const resolved = state instanceof PathBuilder ? state.toPathState() : state;\r\n this._ops.push({ kind: \"path\", state: resolved });\r\n return this;\r\n }\r\n\r\n line(state: Partial<LineState>): this {\r\n this._ops.push({ kind: \"line\", state });\r\n return this;\r\n }\r\n\r\n polygon(state: Partial<PolygonState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygon\", state });\r\n return this;\r\n }\r\n\r\n polygram(state: Partial<PolygramState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygram\", state });\r\n return this;\r\n }\r\n\r\n // ─── Compositing ─────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Use the last-declared shape as a cutter: union the shapes before it and\r\n * subtract that last shape, punching a hole in the clip region. Mirrors\r\n * {@link Graphics2D.cut}.\r\n */\r\n cut(): this {\r\n this._ops.push({ kind: \"cut\" });\r\n return this;\r\n }\r\n\r\n // ─── Consumption ─────────────────────────────────────────────────────────\r\n\r\n /** The recorded ops, in order. Consumed by `RenderContext2D.beginClip()`. */\r\n ops(): readonly ClipOp[] {\r\n return this._ops;\r\n }\r\n\r\n /** True when no shape op has been recorded — the clip region is empty. */\r\n isEmpty(): boolean {\r\n return !this._ops.some((op) => op.kind !== \"cut\");\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../src/render/descriptors/rect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,kBAAkB,CAAC,UAAoD;IACnF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\n\r\nexport interface RectState extends ShapeState {\r\n width: number;\r\n height: number;\r\n // Accepts loose input or an already-resolved value (both are part of\r\n // RectCornerRadius/RectCornerStyle): the node resolves via its @property\r\n // mapper, and the renderer re-resolves idempotently.\r\n cornerRadius: RectCornerRadius;\r\n cornerStyle: RectCornerStyle;\r\n}\r\n\r\nexport function withRectDescriptor(descriptor: Partial<RectState> & ShapeAlignmentInput): RectState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../src/render/descriptors/rect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,kBAAkB,CAAC,UAAoD;IACnF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\n\r\nexport interface RectState extends ShapeState {\r\n width: number;\r\n height: number;\r\n // Accepts loose input or an already-resolved value (both are part of\r\n // RectCornerRadius/RectCornerStyle): the node resolves via its property\r\n // mapper, and the renderer re-resolves idempotently.\r\n cornerRadius: RectCornerRadius;\r\n cornerStyle: RectCornerStyle;\r\n}\r\n\r\nexport function withRectDescriptor(descriptor: Partial<RectState> & ShapeAlignmentInput): RectState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
@@ -4,18 +4,24 @@ import { StrokeResolved } from "../../attributes/shape/stroke/stroke.js";
4
4
  import { PathData } from "./path.js";
5
5
  import { ShapeAlignmentInput, ShapeState } from "./shape.js";
6
6
  /**
7
- * One contiguous piece of a Text node split at selection boundaries. Pieces
7
+ * The size a segmented block's pieces shape at on an `'autofit'` node: the
8
+ * size the layout probes with, since no single piece can be asked for the
9
+ * size the block settles on.
10
+ */
11
+ export declare const AUTOFIT_PROBE_SIZE = 100;
12
+ /**
13
+ * One contiguous piece of a Text node split at run boundaries. Pieces
8
14
  * carry their effective shaping inputs (`text` plus the five font fields) and
9
15
  * draw-time overrides applied per shaped run: `opacity` folded into the paint
10
16
  * alpha, an optional `fill`/`stroke` override (falls back to the node's when
11
17
  * omitted), and a transform applied about the run's centered position.
12
18
  *
13
- * Present only when a Text node has active selections; otherwise the node
14
- * renders as a single string with no segments (unchanged behavior).
19
+ * Present only when a Text node has styled runs or a reveal window; otherwise
20
+ * the node renders as a single string with no segments.
15
21
  *
16
22
  * **Every shaping field is stated, none inherited at draw time.** `fontFamily`,
17
23
  * `fontSize` and `fontStyle` joined `fontWeight` and `letterSpacing` here so a
18
- * selection can change the *face* of a run and not only its weight — which is
24
+ * run can change its *face* and not only its weight — which is
19
25
  * what an editor built on this needs to offer per-character styling at all. The
20
26
  * paragraph builder already takes all five per run (it is what `RichText` sets),
21
27
  * so the cost of the three is a wider segment and nothing else.
@@ -51,7 +57,7 @@ export interface TextSegment {
51
57
  *
52
58
  * The caret model can describe a segmented block exactly as long as this holds
53
59
  * of every piece: differently-styled runs are still one paragraph, laid out and
54
- * measured together, so Skia's own rects for each character are where the glyphs
60
+ * measured together, so the shaper's own rects for each character are where the glyphs
55
61
  * are. A piece that is *moved*, turned or scaled about its own centre is not in
56
62
  * that paragraph's space any more, and a slot measured from it would point at
57
63
  * where the character would have been. See `textBlockLayout`, which is the one
@@ -88,7 +94,7 @@ export interface TextState extends ShapeState {
88
94
  width: number;
89
95
  height: number;
90
96
  /**
91
- * Per-piece overrides when the node has active text selections. When set,
97
+ * Per-piece overrides when the node has styled runs. When set,
92
98
  * the renderer shapes these pieces together (one paragraph) and paints each
93
99
  * shaped run with its piece's overrides instead of the node's single fill.
94
100
  */
@@ -128,7 +134,7 @@ export interface TextState extends ShapeState {
128
134
  *
129
135
  * Exported so the **measure** path enforces the same policy from the same
130
136
  * definition. Shaping a paragraph to measure it happens before any op is
131
- * validated, and Skia reads `.length` off every family name — so text with no
137
+ * validated, and the shaper reads `.length` off every family name — so text with no
132
138
  * family used to die inside the wasm with `Cannot read properties of undefined`,
133
139
  * naming no scene, node or prop, while the identical case at draw time produced
134
140
  * the message above. One policy, two verdicts, and the useless one came first.
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/render/descriptors/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAqE,MAAM,SAAS,CAAC;AAG7H;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,+EAA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,17 @@
1
1
  import { resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from "./shape.js";
2
- import { hostTextFamily } from "../../nodes/node/text-defaults.js";
2
+ import { hostTextFamily } from "../../components/builtins/text/text-defaults.js";
3
+ /**
4
+ * The size a segmented block's pieces shape at on an `'autofit'` node: the
5
+ * size the layout probes with, since no single piece can be asked for the
6
+ * size the block settles on.
7
+ */
8
+ export const AUTOFIT_PROBE_SIZE = 100;
3
9
  /**
4
10
  * Whether `segment` only *styles* its characters — no transform of its own.
5
11
  *
6
12
  * The caret model can describe a segmented block exactly as long as this holds
7
13
  * of every piece: differently-styled runs are still one paragraph, laid out and
8
- * measured together, so Skia's own rects for each character are where the glyphs
14
+ * measured together, so the shaper's own rects for each character are where the glyphs
9
15
  * are. A piece that is *moved*, turned or scaled about its own centre is not in
10
16
  * that paragraph's space any more, and a slot measured from it would point at
11
17
  * where the character would have been. See `textBlockLayout`, which is the one
@@ -42,7 +48,7 @@ export function isStyleOnlySegment(segment) {
42
48
  *
43
49
  * Exported so the **measure** path enforces the same policy from the same
44
50
  * definition. Shaping a paragraph to measure it happens before any op is
45
- * validated, and Skia reads `.length` off every family name — so text with no
51
+ * validated, and the shaper reads `.length` off every family name — so text with no
46
52
  * family used to die inside the wasm with `Cannot read properties of undefined`,
47
53
  * naming no scene, node or prop, while the identical case at draw time produced
48
54
  * the message above. One policy, two verdicts, and the useless one came first.
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/render/descriptors/text.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC7H,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AA8C5D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACnD,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,KAAK,CAA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AAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAC/B,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE;QAC3B,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,EAAE;QACnC,UAAU,EAAE,iBAAiB,CAAC,UAAU,CAAC;QACzC,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,GAAG;QACxC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,CAAC;QAC5C,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,CAAC;QACtC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,QAAQ;QACnD,cAAc,EAAE,UAAU,CAAC,cAAc,IAAI,MAAM;QACnD,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,KAAK;QAC9B,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,EAAE;QACzC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI;KAChC,CAAC;AACN,CAAC","sourcesContent":["import type { FontStyle, TextAlign, TextDecoration, VerticalAlign } from \"@/attributes/text/types\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport { PathData } from \"./path\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\nimport { hostTextFamily } from \"@/nodes/node/text-defaults\";\r\n\r\n/**\r\n * One contiguous piece of a Text node split at selection boundaries. Pieces\r\n * carry their effective shaping inputs (`text` plus the five font fields) and\r\n * draw-time overrides applied per shaped run: `opacity` folded into the paint\r\n * alpha, an optional `fill`/`stroke` override (falls back to the node's when\r\n * omitted), and a transform applied about the run's centered position.\r\n *\r\n * Present only when a Text node has active selections; otherwise the node\r\n * renders as a single string with no segments (unchanged behavior).\r\n *\r\n * **Every shaping field is stated, none inherited at draw time.** `fontFamily`,\r\n * `fontSize` and `fontStyle` joined `fontWeight` and `letterSpacing` here so a\r\n * selection can change the *face* of a run and not only its weight — which is\r\n * what an editor built on this needs to offer per-character styling at all. The\r\n * paragraph builder already takes all five per run (it is what `RichText` sets),\r\n * so the cost of the three is a wider segment and nothing else.\r\n *\r\n * They are optional only so an older caller's segments still lay out: absent\r\n * means \"the node's own\", resolved where the paragraph is built rather than\r\n * left for the renderer to guess.\r\n */\r\nexport interface TextSegment {\r\n text: string;\r\n /** Override family for this piece; falls back to the node's when undefined. */\r\n fontFamily?: string;\r\n /** Override size for this piece; falls back to the node's when undefined. */\r\n fontSize?: number;\r\n /** Override slant for this piece; falls back to the node's when undefined. */\r\n fontStyle?: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n /** Override decoration for this piece; falls back to the node's when undefined. */\r\n textDecoration?: TextDecoration;\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n /** Override fill for this piece; falls back to the node's fill when undefined. */\r\n fill?: FillResolved[];\r\n /** Override stroke for this piece; falls back to the node's stroke when undefined. */\r\n stroke?: StrokeResolved[];\r\n}\r\n\r\n/**\r\n * Whether `segment` only *styles* its characters — no transform of its own.\r\n *\r\n * The caret model can describe a segmented block exactly as long as this holds\r\n * of every piece: differently-styled runs are still one paragraph, laid out and\r\n * measured together, so Skia's own rects for each character are where the glyphs\r\n * are. A piece that is *moved*, turned or scaled about its own centre is not in\r\n * that paragraph's space any more, and a slot measured from it would point at\r\n * where the character would have been. See `textBlockLayout`, which is the one\r\n * caller and turns a false here into \"no caret model for this shape\".\r\n */\r\nexport function isStyleOnlySegment(segment: TextSegment): boolean {\r\n return segment.x === 0 && segment.y === 0\r\n && segment.scale === 1 && segment.rotation === 0;\r\n}\r\n\r\nexport interface TextState extends ShapeState {\r\n text: string;\r\n /**\r\n * A named typography preset to shape against — `theme.typography`'s key, the\r\n * same one a `Text` node's `variant` prop selects.\r\n *\r\n * A node reads its variant once, at bind; a drawn op has no bind step, so it\r\n * is resolved at draw alongside the inherited defaults (see\r\n * `applyGraphicsTextDefaults`). It sits *between* the two: above the\r\n * enclosing `<DefaultTextStyle>`, below anything the op states itself.\r\n *\r\n * Optional, and unresolved names are ignored rather than an error — a scene\r\n * that renames a preset should lose the styling, not fail to draw.\r\n */\r\n variant?: string;\r\n fontSize: number | 'autofit';\r\n fontFamily: string;\r\n fontWeight: number;\r\n fontStyle: FontStyle;\r\n letterSpacing: number;\r\n lineHeight: number;\r\n textAlign: TextAlign;\r\n /** Where the block sits in a box taller or shorter than it; only a `height` gives it one. */\r\n verticalAlign: VerticalAlign;\r\n textDecoration: TextDecoration;\r\n wrap: boolean;\r\n minFontSize: number;\r\n width: number;\r\n height: number;\r\n /**\r\n * Per-piece overrides when the node has active text selections. When set,\r\n * the renderer shapes these pieces together (one paragraph) and paints each\r\n * shaped run with its piece's overrides instead of the node's single fill.\r\n */\r\n segments?: TextSegment[];\r\n /**\r\n * When set, the text is wrapped around this path (text-on-path) instead of\r\n * laid out as straight lines: each glyph is positioned and rotated to follow\r\n * the path, centered on its baseline, and glyphs past the path end are\r\n * clipped. Mutually exclusive with `segments` in v1.\r\n */\r\n path?: PathData | null;\r\n}\r\n\r\n\r\n/**\r\n * The family this text is set in — the last rung of the cascade, and the only\r\n * one that can refuse.\r\n *\r\n * It used to fall back to `\"Arial\"`, which is the wrong shape of answer for a\r\n * renderer whose whole job is that the picture is the one that was asked for:\r\n * substituting a face the *engine* picked produces text in a typeface the author\r\n * never chose, at metrics they never measured, in a frame that looks finished,\r\n * and hides a font that was never declared and so never loaded.\r\n *\r\n * What it falls back to instead is {@link hostTextFamily} — a face the\r\n * **application** named, once, at its composition root, out of the fonts it\r\n * actually vendors. That is a different bargain: a host that ships a typeface\r\n * registers it in every manifest, so a chart axis that nobody styled comes out\r\n * in it and paints glyphs, while the engine still refuses to invent a face of\r\n * its own. A host that declares nothing gets the error below, which is the right\r\n * answer for a headless render whose fonts all come from a manifest.\r\n *\r\n * By the time an op reaches here the whole ladder above has been walked — the op\r\n * or prop itself, a `variant` preset, the enclosing `<DefaultTextStyle>`, then\r\n * the theme's `default` typography preset — so this is only ever reached when\r\n * every one of them was silent. The message names them because \"no font family\"\r\n * is not actionable and \"set one on the text, on a DefaultTextStyle, or as the\r\n * theme's default preset\" is.\r\n *\r\n * Exported so the **measure** path enforces the same policy from the same\r\n * definition. Shaping a paragraph to measure it happens before any op is\r\n * validated, and Skia reads `.length` off every family name — so text with no\r\n * family used to die inside the wasm with `Cannot read properties of undefined`,\r\n * naming no scene, node or prop, while the identical case at draw time produced\r\n * the message above. One policy, two verdicts, and the useless one came first.\r\n */\r\nexport function requireFontFamily(descriptor: { fontFamily?: string; text?: string }): string {\r\n const family = descriptor.fontFamily;\r\n if (typeof family === \"string\" && family !== \"\") return family;\r\n const host = hostTextFamily();\r\n if (host !== \"\") return host;\r\n const text = descriptor.text ? ` drawing \"${descriptor.text.slice(0, 32)}\"` : \"\";\r\n throw new Error(\r\n `Text${text} has no fontFamily. Set one on the text itself, on an `\r\n + `enclosing <DefaultTextStyle>, or as the theme's \\`default\\` typography `\r\n + `preset — there is no fallback face.`,\r\n );\r\n}\r\n\r\nexport function withTextDescriptor(descriptor: Partial<TextState> & ShapeAlignmentInput): TextState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n text: descriptor.text ?? \"\",\r\n fontSize: descriptor.fontSize ?? 48,\r\n fontFamily: requireFontFamily(descriptor),\r\n fontWeight: descriptor.fontWeight ?? 400,\r\n fontStyle: descriptor.fontStyle ?? 'normal',\r\n letterSpacing: descriptor.letterSpacing ?? 0,\r\n lineHeight: descriptor.lineHeight ?? 0,\r\n textAlign: descriptor.textAlign ?? 'center',\r\n verticalAlign: descriptor.verticalAlign ?? 'center',\r\n textDecoration: descriptor.textDecoration ?? 'none',\r\n wrap: descriptor.wrap ?? false,\r\n minFontSize: descriptor.minFontSize ?? 12,\r\n width: descriptor.width ?? 0,\r\n height: descriptor.height ?? 0,\r\n segments: descriptor.segments,\r\n path: descriptor.path ?? null,\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/render/descriptors/text.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC7H,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AA8CtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACnD,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC;WAClC,OAAO,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC;AACzD,CAAC;AA+CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkD;IAChF,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC;IACrC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK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SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,CAAC;QAC5C,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,CAAC;QACtC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,QAAQ;QACnD,cAAc,EAAE,UAAU,CAAC,cAAc,IAAI,MAAM;QACnD,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,KAAK;QAC9B,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,EAAE;QACzC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI;KAChC,CAAC;AACN,CAAC","sourcesContent":["import type { FontStyle, TextAlign, TextDecoration, VerticalAlign } from \"@/attributes/text/types\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport { PathData } from \"./path\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\nimport { hostTextFamily } from \"@/components/builtins/text/text-defaults\";\r\n\r\n/**\r\n * The size a segmented block's pieces shape at on an `'autofit'` node: the\r\n * size the layout probes with, since no single piece can be asked for the\r\n * size the block settles on.\r\n */\r\nexport const AUTOFIT_PROBE_SIZE = 100;\r\n\r\n/**\r\n * One contiguous piece of a Text node split at run boundaries. Pieces\r\n * carry their effective shaping inputs (`text` plus the five font fields) and\r\n * draw-time overrides applied per shaped run: `opacity` folded into the paint\r\n * alpha, an optional `fill`/`stroke` override (falls back to the node's when\r\n * omitted), and a transform applied about the run's centered position.\r\n *\r\n * Present only when a Text node has styled runs or a reveal window; otherwise\r\n * the node renders as a single string with no segments.\r\n *\r\n * **Every shaping field is stated, none inherited at draw time.** `fontFamily`,\r\n * `fontSize` and `fontStyle` joined `fontWeight` and `letterSpacing` here so a\r\n * run can change its *face* and not only its weight — which is\r\n * what an editor built on this needs to offer per-character styling at all. The\r\n * paragraph builder already takes all five per run (it is what `RichText` sets),\r\n * so the cost of the three is a wider segment and nothing else.\r\n *\r\n * They are optional only so an older caller's segments still lay out: absent\r\n * means \"the node's own\", resolved where the paragraph is built rather than\r\n * left for the renderer to guess.\r\n */\r\nexport interface TextSegment {\r\n text: string;\r\n /** Override family for this piece; falls back to the node's when undefined. */\r\n fontFamily?: string;\r\n /** Override size for this piece; falls back to the node's when undefined. */\r\n fontSize?: number;\r\n /** Override slant for this piece; falls back to the node's when undefined. */\r\n fontStyle?: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n /** Override decoration for this piece; falls back to the node's when undefined. */\r\n textDecoration?: TextDecoration;\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n /** Override fill for this piece; falls back to the node's fill when undefined. */\r\n fill?: FillResolved[];\r\n /** Override stroke for this piece; falls back to the node's stroke when undefined. */\r\n stroke?: StrokeResolved[];\r\n}\r\n\r\n/**\r\n * Whether `segment` only *styles* its characters — no transform of its own.\r\n *\r\n * The caret model can describe a segmented block exactly as long as this holds\r\n * of every piece: differently-styled runs are still one paragraph, laid out and\r\n * measured together, so the shaper's own rects for each character are where the glyphs\r\n * are. A piece that is *moved*, turned or scaled about its own centre is not in\r\n * that paragraph's space any more, and a slot measured from it would point at\r\n * where the character would have been. See `textBlockLayout`, which is the one\r\n * caller and turns a false here into \"no caret model for this shape\".\r\n */\r\nexport function isStyleOnlySegment(segment: TextSegment): boolean {\r\n return segment.x === 0 && segment.y === 0\r\n && segment.scale === 1 && segment.rotation === 0;\r\n}\r\n\r\nexport interface TextState extends ShapeState {\r\n text: string;\r\n /**\r\n * A named typography preset to shape against — `theme.typography`'s key, the\r\n * same one a `Text` node's `variant` prop selects.\r\n *\r\n * A node reads its variant once, at bind; a drawn op has no bind step, so it\r\n * is resolved at draw alongside the inherited defaults (see\r\n * `applyGraphicsTextDefaults`). It sits *between* the two: above the\r\n * enclosing `<DefaultTextStyle>`, below anything the op states itself.\r\n *\r\n * Optional, and unresolved names are ignored rather than an error — a scene\r\n * that renames a preset should lose the styling, not fail to draw.\r\n */\r\n variant?: string;\r\n fontSize: number | 'autofit';\r\n fontFamily: string;\r\n fontWeight: number;\r\n fontStyle: FontStyle;\r\n letterSpacing: number;\r\n lineHeight: number;\r\n textAlign: TextAlign;\r\n /** Where the block sits in a box taller or shorter than it; only a `height` gives it one. */\r\n verticalAlign: VerticalAlign;\r\n textDecoration: TextDecoration;\r\n wrap: boolean;\r\n minFontSize: number;\r\n width: number;\r\n height: number;\r\n /**\r\n * Per-piece overrides when the node has styled runs. When set,\r\n * the renderer shapes these pieces together (one paragraph) and paints each\r\n * shaped run with its piece's overrides instead of the node's single fill.\r\n */\r\n segments?: TextSegment[];\r\n /**\r\n * When set, the text is wrapped around this path (text-on-path) instead of\r\n * laid out as straight lines: each glyph is positioned and rotated to follow\r\n * the path, centered on its baseline, and glyphs past the path end are\r\n * clipped. Mutually exclusive with `segments` in v1.\r\n */\r\n path?: PathData | null;\r\n}\r\n\r\n\r\n/**\r\n * The family this text is set in — the last rung of the cascade, and the only\r\n * one that can refuse.\r\n *\r\n * It used to fall back to `\"Arial\"`, which is the wrong shape of answer for a\r\n * renderer whose whole job is that the picture is the one that was asked for:\r\n * substituting a face the *engine* picked produces text in a typeface the author\r\n * never chose, at metrics they never measured, in a frame that looks finished,\r\n * and hides a font that was never declared and so never loaded.\r\n *\r\n * What it falls back to instead is {@link hostTextFamily} — a face the\r\n * **application** named, once, at its composition root, out of the fonts it\r\n * actually vendors. That is a different bargain: a host that ships a typeface\r\n * registers it in every manifest, so a chart axis that nobody styled comes out\r\n * in it and paints glyphs, while the engine still refuses to invent a face of\r\n * its own. A host that declares nothing gets the error below, which is the right\r\n * answer for a headless render whose fonts all come from a manifest.\r\n *\r\n * By the time an op reaches here the whole ladder above has been walked — the op\r\n * or prop itself, a `variant` preset, the enclosing `<DefaultTextStyle>`, then\r\n * the theme's `default` typography preset — so this is only ever reached when\r\n * every one of them was silent. The message names them because \"no font family\"\r\n * is not actionable and \"set one on the text, on a DefaultTextStyle, or as the\r\n * theme's default preset\" is.\r\n *\r\n * Exported so the **measure** path enforces the same policy from the same\r\n * definition. Shaping a paragraph to measure it happens before any op is\r\n * validated, and the shaper reads `.length` off every family name — so text with no\r\n * family used to die inside the wasm with `Cannot read properties of undefined`,\r\n * naming no scene, node or prop, while the identical case at draw time produced\r\n * the message above. One policy, two verdicts, and the useless one came first.\r\n */\r\nexport function requireFontFamily(descriptor: { fontFamily?: string; text?: string }): string {\r\n const family = descriptor.fontFamily;\r\n if (typeof family === \"string\" && family !== \"\") return family;\r\n const host = hostTextFamily();\r\n if (host !== \"\") return host;\r\n const text = descriptor.text ? ` drawing \"${descriptor.text.slice(0, 32)}\"` : \"\";\r\n throw new Error(\r\n `Text${text} has no fontFamily. Set one on the text itself, on an `\r\n + `enclosing <DefaultTextStyle>, or as the theme's \\`default\\` typography `\r\n + `preset — there is no fallback face.`,\r\n );\r\n}\r\n\r\nexport function withTextDescriptor(descriptor: Partial<TextState> & ShapeAlignmentInput): TextState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n text: descriptor.text ?? \"\",\r\n fontSize: descriptor.fontSize ?? 48,\r\n fontFamily: requireFontFamily(descriptor),\r\n fontWeight: descriptor.fontWeight ?? 400,\r\n fontStyle: descriptor.fontStyle ?? 'normal',\r\n letterSpacing: descriptor.letterSpacing ?? 0,\r\n lineHeight: descriptor.lineHeight ?? 0,\r\n textAlign: descriptor.textAlign ?? 'center',\r\n verticalAlign: descriptor.verticalAlign ?? 'center',\r\n textDecoration: descriptor.textDecoration ?? 'none',\r\n wrap: descriptor.wrap ?? false,\r\n minFontSize: descriptor.minFontSize ?? 12,\r\n width: descriptor.width ?? 0,\r\n height: descriptor.height ?? 0,\r\n segments: descriptor.segments,\r\n path: descriptor.path ?? null,\r\n };\r\n}\r\n"]}
@@ -22,4 +22,6 @@ export { caretCount } from './text-layout.js';
22
22
  export type { TextBlockLayout, TextBlockLine, TextBlockSource } from './text-layout.js';
23
23
  /** @internal */ export { NullRenderContext } from './null-render-context.js';
24
24
  export type { RenderSurface } from './surface.js';
25
+ export { RenderBackendError, isFatalRenderIssue, renderIssueKey, toRenderIssue } from './render-issue.js';
26
+ export type { RenderIssue, RenderIssueKind } from './render-issue.js';
25
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,cAAc,uBAAuB,CAAC;AACvD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AAEpD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,wBAAwB,CAAC;AAGxD,gBAAgB,CAAC,cAAc,yBAAyB,CAAC;AACzD,gBAAgB,CAAC,cAAc,qBAAqB,CAAC;AAErD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,4BAA4B,CAAC;AAC5D,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,uBAAuB,CAAC;AACvD,gBAAgB,CAAC,cAAc,wBAAwB,CAAC;AAExD,gBAAgB,CAAC,OAAO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E,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvG,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
@@ -17,4 +17,5 @@
17
17
  // `getTextLayout`, so they are part of the editor-facing surface.
18
18
  export { caretCount } from './text-layout.js';
19
19
  /** @internal */ export { NullRenderContext } from './null-render-context.js';
20
+ export { RenderBackendError, isFatalRenderIssue, renderIssueKey, toRenderIssue } from './render-issue.js';
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,cAAc,uBAAuB,CAAC;AACvD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AAEpD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,wBAAwB,CAAC;AAGxD,gBAAgB,CAAC,cAAc,yBAAyB,CAAC;AACzD,gBAAgB,CAAC,cAAc,qBAAqB,CAAC;AAErD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,4BAA4B,CAAC;AAC5D,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,uBAAuB,CAAC;AACvD,gBAAgB,CAAC,cAAc,wBAAwB,CAAC;AAExD,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG3D,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE/C,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIjK,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEnF,iFAAiF;AACjF,kEAAkE;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["/** @internal */ export * from './descriptors/ellipse';\r\n/** @internal */ export * from './descriptors/rect';\r\n\r\n/** @internal */ export * from './descriptors/text';\r\n/** @internal */ export * from './descriptors/richtext';\r\n\r\n\r\n/** @internal */ export * from './descriptors/transform';\r\n/** @internal */ export * from './descriptors/shape';\r\n\r\n/** @internal */ export * from './descriptors/path';\r\n/** @internal */ export * from './descriptors/path-builder';\r\n/** @internal */ export * from './descriptors/line';\r\n/** @internal */ export * from './descriptors/polygon';\r\n/** @internal */ export * from './descriptors/polygram';\r\n\r\n/** @internal */ export { Graphics2D } from './graphics2d';\r\n/** @internal */ export type { GraphicsOp, GraphicsShapeOp, GraphicsTransform } from './graphics2d';\r\n\r\n/** @internal */ export { Clip } from './clip';\r\n/** @internal */ export type { ClipOp, ClipShapeOp } from './clip';\r\n/** @internal */ export { containsClip, containsOps, pointInPolygon, nearPolyline, distanceToSegment, polygonVertices, polygramVertices } from './clip-contains';\r\n\r\n/** @internal */ export type { RenderContext2D, RenderPass2D } from './render-context2d';\r\n/** @internal */ export type { SpaceRect, SpaceRects, NodeRenderState, EffectTarget, RasterizedSurface } from './render-context2d';\r\n/** @internal */ export { CanvasRenderContext2D } from './canvas-render-context2d';\r\n/** @internal */ export type { MeasureContext2D } from \"./measure-context\";\r\n// Public rather than internal: a host drawing its own text caret reads these off\r\n// `getTextLayout`, so they are part of the editor-facing surface.\r\nexport { caretCount } from './text-layout';\r\nexport type { TextBlockLayout, TextBlockLine, TextBlockSource } from './text-layout';\r\n/** @internal */ export { NullRenderContext } from './null-render-context';\r\n\r\nexport type { RenderSurface } from './surface';\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,cAAc,uBAAuB,CAAC;AACvD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AAEpD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,wBAAwB,CAAC;AAGxD,gBAAgB,CAAC,cAAc,yBAAyB,CAAC;AACzD,gBAAgB,CAAC,cAAc,qBAAqB,CAAC;AAErD,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,4BAA4B,CAAC;AAC5D,gBAAgB,CAAC,cAAc,oBAAoB,CAAC;AACpD,gBAAgB,CAAC,cAAc,uBAAuB,CAAC;AACvD,gBAAgB,CAAC,cAAc,wBAAwB,CAAC;AAExD,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG3D,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE/C,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIjK,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEnF,iFAAiF;AACjF,kEAAkE;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["/** @internal */ export * from './descriptors/ellipse';\r\n/** @internal */ export * from './descriptors/rect';\r\n\r\n/** @internal */ export * from './descriptors/text';\r\n/** @internal */ export * from './descriptors/richtext';\r\n\r\n\r\n/** @internal */ export * from './descriptors/transform';\r\n/** @internal */ export * from './descriptors/shape';\r\n\r\n/** @internal */ export * from './descriptors/path';\r\n/** @internal */ export * from './descriptors/path-builder';\r\n/** @internal */ export * from './descriptors/line';\r\n/** @internal */ export * from './descriptors/polygon';\r\n/** @internal */ export * from './descriptors/polygram';\r\n\r\n/** @internal */ export { Graphics2D } from './graphics2d';\r\n/** @internal */ export type { GraphicsOp, GraphicsShapeOp, GraphicsTransform } from './graphics2d';\r\n\r\n/** @internal */ export { Clip } from './clip';\r\n/** @internal */ export type { ClipOp, ClipShapeOp } from './clip';\r\n/** @internal */ export { containsClip, containsOps, pointInPolygon, nearPolyline, distanceToSegment, polygonVertices, polygramVertices } from './clip-contains';\r\n\r\n/** @internal */ export type { RenderContext2D, RenderPass2D } from './render-context2d';\r\n/** @internal */ export type { SpaceRect, SpaceRects, NodeRenderState, EffectTarget, RasterizedSurface } from './render-context2d';\r\n/** @internal */ export { CanvasRenderContext2D } from './canvas-render-context2d';\r\n/** @internal */ export type { MeasureContext2D } from \"./measure-context\";\r\n// Public rather than internal: a host drawing its own text caret reads these off\r\n// `getTextLayout`, so they are part of the editor-facing surface.\r\nexport { caretCount } from './text-layout';\r\nexport type { TextBlockLayout, TextBlockLine, TextBlockSource } from './text-layout';\r\n/** @internal */ export { NullRenderContext } from './null-render-context';\r\n\r\nexport type { RenderSurface } from './surface';\r\nexport { RenderBackendError, isFatalRenderIssue, renderIssueKey, toRenderIssue } from './render-issue';\r\nexport type { RenderIssue, RenderIssueKind } from './render-issue';\r\n"]}
@@ -167,7 +167,7 @@ export interface RenderContext2D extends MeasureContext2D {
167
167
  * Returns `null` when the backend cannot measure this — the default, so a
168
168
  * backend that never needed glyph positions keeps working, and for cases no
169
169
  * caret model fits: text-on-path (glyphs follow a curve, not a line box) and
170
- * a block with active selection segments.
170
+ * a block drawn in styled segments.
171
171
  */
172
172
  layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null;
173
173
  /**
@@ -210,7 +210,7 @@ export interface RenderContext2D extends MeasureContext2D {
210
210
  * - `'backdrop'` — warps/filters the canvas content already painted *beneath*
211
211
  * the node, clipped to the active silhouette clip, so the node's own edges
212
212
  * stay sharp (Figma-style). Used for backdrop-flagged filters (blur,
213
- * grayscale, pixelate, …), magnify, backdrop posterize, and backdrop SkSL.
213
+ * grayscale, pixelate, …), magnify, backdrop posterize, and backdrop shader.
214
214
  *
215
215
  * The renderer decides per effect whether to compose it as an `ImageFilter`
216
216
  * or run it as a snapshot/redraw shader — callers never route by effect type.
@@ -259,7 +259,7 @@ export interface RenderContext2D extends MeasureContext2D {
259
259
  * True for anything that actually paints, since a fill with `space:'parent'`
260
260
  * resolves against them. A context that only inspects *what* would be drawn
261
261
  * never looks at them, and computing them costs an object allocation per node
262
- * per frame. Nodes check this before doing that work; see `Node2D.beforeRender`.
262
+ * per frame. Nodes check this before doing that work; see `Node2D.renderState`.
263
263
  */
264
264
  readonly readsSpaceRects: boolean;
265
265
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"render-context2d.js","sourceRoot":"","sources":["../../src/render/render-context2d.ts"],"names":[],"mappings":"","sourcesContent":["import type { FontStyle, TextStyle } from \"@/attributes/text/types\";\r\nimport type { TransformState } from \"./descriptors/transform\";\r\nimport type { MeasureContext2D } from \"./measure-context\";\r\nimport type { TextState } from \"./descriptors/text\";\r\nimport type { TextBlockLayout } from \"./text-layout\";\r\nimport type { Graphics2D } from \"./graphics2d\";\r\nimport type { Clip } from \"./clip\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Size2D } from \"@/attributes/layout/size\";\r\n\r\n/**\r\n * Where an effect scope draws: `'foreground'` warps/filters the node's *own*\r\n * content (its fill, stroke and children), `'backdrop'` warps/filters the canvas\r\n * content already painted *beneath* the node (clipped to its silhouette). See\r\n * {@link RenderContext2D.beginEffects}.\r\n */\r\nexport type EffectTarget = \"foreground\" | \"backdrop\";\r\n\r\n/**\r\n * Pixels produced by {@link RenderContext2D.rasterize}: RGBA8888,\r\n * unpremultiplied, top-down (canvas row order). `width`/`height` are **device**\r\n * px, so they reflect the pixel ratio the renderer actually used rather than the\r\n * logical size that was asked for.\r\n */\r\nexport interface RasterizedSurface {\r\n pixels: Uint8Array;\r\n width: number;\r\n height: number;\r\n}\r\n\r\n/**\r\n * A bounding box in the current node's local space (origin = the node's\r\n * layout-cell centre, the same space shapes are drawn in). `left/top` use the\r\n * canvas convention (y down).\r\n */\r\nexport interface SpaceRect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n}\r\n\r\n/**\r\n * Reference rects a fill can resolve against, supplied per-node at `begin()`.\r\n * `local` is derived from the drawn shapes themselves and `global` (the\r\n * viewport) is computed by the renderer from the surface size, so only the\r\n * parent frame is passed here.\r\n */\r\nexport interface SpaceRects {\r\n /** The parent node's content rect, in this node's local space. */\r\n parent?: SpaceRect;\r\n}\r\n\r\n/**\r\n * Per-node state supplied to {@link RenderContext2D.begin} for the duration of a\r\n * node's draw scope. Carries the node identity and gradient-space `rects` plus\r\n * the node's per-frame motion, sampled at render time. Motion-driven effects\r\n * (e.g. motion blur) read the current node's `velocity` from this state instead\r\n * of being authored with a fixed direction.\r\n *\r\n * Velocity fields are `0`/`{0,0}` when the motion is unknown — the first frame a\r\n * node renders, or after a time discontinuity (scrub/seek) where no trustworthy\r\n * delta exists.\r\n */\r\nexport interface NodeRenderState {\r\n /** Stable node identifier. */\r\n id: string;\r\n /** Parent / viewport rects in this node's local space. */\r\n rects: SpaceRects;\r\n /** How long this node has existed, in seconds (`NodeTime.elapsed`). */\r\n elapsed: number;\r\n /** The frame delta, in seconds, used to derive displacement from velocity. */\r\n dt: number;\r\n /** Translational velocity in px/sec, world space (y-down). `{0,0}` when unknown. */\r\n velocity: Vector2;\r\n /** Heading of `velocity` in degrees (`atan2(vy, vx)`). `0` when unknown. */\r\n direction: number;\r\n /** Magnitude of `velocity` in px/sec. `0` when unknown. */\r\n speed: number;\r\n /** Rotational velocity in degrees/sec. `0` when unknown. Reserved for radial motion blur. */\r\n angularVelocity: number;\r\n /** Scale velocity in scale-units/sec. `0` when unknown. Reserved for zoom motion blur. */\r\n scaleVelocity: number;\r\n}\r\n\r\n/**\r\n * The drawing surface a `Node2D` paints into — **the whole of what a node may\r\n * ask of a renderer, and nothing else.**\r\n *\r\n * Shapes are never declared directly on the context: they are built with a\r\n * {@link Graphics2D} command list and submitted via {@link draw}. Multiple\r\n * shapes chained on one `Graphics2D` before a paint call are combined into a\r\n * single surface and painted together:\r\n *\r\n * ctx.draw(new Graphics2D().ellipse(...).rect(...).fill(...)); // shared surface\r\n *\r\n * On top of that it carries text measurement — it extends {@link MeasureContext2D}, so\r\n * a node measures and draws through one object — and the higher-level scoping\r\n * operations: transforms, masks, clips, camera, boolean ops, effect scopes.\r\n * `begin(state)` / `end()` bracket each node's draw call so the context can\r\n * track which node is active.\r\n *\r\n * **An interface, with `CanvasRenderContext2D` as its one base class.** What a\r\n * node calls and what a *host* calls are different lists: `execute`,\r\n * `screenshot`, `unmount` and `dispose` drive a render pass and have no business\r\n * being reachable from inside one. Splitting them is what keeps this surface\r\n * the size it is. Every real backend still extends the class, which preserves\r\n * the `draw` to `drawGraphics` invariant that gives them all one implementation\r\n * of text-default resolution.\r\n *\r\n * `RenderContext3D` is its sibling, not its subclass: the two share no members,\r\n * because a 3D scene is described with lights, a camera and meshes rather than\r\n * with paths and paint.\r\n */\r\nexport interface RenderContext2D extends MeasureContext2D {\r\n measureText(\r\n text: string,\r\n fontSize: number,\r\n fontFamily: string,\r\n fontWeight?: number,\r\n letterSpacing?: number,\r\n fontStyle?: FontStyle,\r\n ): Size2D;\r\n\r\n // ---- Inherited text-style defaults ------------------------------------\r\n // `<DefaultTextStyle>` reaches a `Text`/`RichText` node through the context\r\n // map, applied once when the node binds. A raw `Graphics2D` has no node to\r\n // bind, so it inherits the same defaults here instead — pushed around a\r\n // subtree's draw scope, and folded into each `text`/`richText` op by\r\n // `draw()`. Same vocabulary (`TextStyle`), same precedence, two channels.\r\n\r\n /**\r\n * Set text-style defaults for everything drawn until the matching\r\n * {@link popTextStyle} — the drawn-graphics half of `<DefaultTextStyle>`.\r\n *\r\n * `style` is **merged** onto the defaults already in effect, per key, so\r\n * nesting accumulates the way the node channel does: an outer scope's\r\n * `fontFamily` and an inner scope's `fontSize` both apply, and a key set by\r\n * both takes the inner value. Values are resolved (a tweened `fontSize`\r\n * arrives as this frame's number), not callbacks.\r\n *\r\n * Pass `null` to open a scope that inherits **nothing** — not the enclosing\r\n * defaults and not the project's `theme.typography.default`. That is for a\r\n * node whose text is its own vocabulary rather than the document's: `Code`\r\n * does it so a scene-wide serif face doesn't reflow a monospaced code block.\r\n *\r\n * Always pair with `popTextStyle()` in a `finally`; the stack is shared with\r\n * every sibling drawn afterwards.\r\n */\r\n pushTextStyle(style: TextStyle | null): void;\r\n\r\n /** Close the innermost scope opened by {@link pushTextStyle}. */\r\n popTextStyle(): void;\r\n\r\n /**\r\n * The text-style defaults in effect right now: the innermost\r\n * {@link pushTextStyle} scope, or the project's `theme.typography.default`\r\n * when no scope is open — the same preset a `Text` node falls back to, so a\r\n * drawn label and a node label agree on the project's base typography.\r\n */\r\n readonly defaultTextStyle: TextStyle;\r\n\r\n /**\r\n * Replay a built `Graphics2D` against this context.\r\n *\r\n * Resolves the ambient text defaults onto the op list before handing it to\r\n * the backend, which is what keeps the real renderer and the precomp asset\r\n * walk agreeing on which font an under-specified `text` op shapes with: a\r\n * family that one resolves and the other does not is a font that never loads\r\n * and glyphs that never paint.\r\n */\r\n draw(graphics: Graphics2D): void;\r\n\r\n /**\r\n * Lay `state` out the way it would be drawn and report where every character\r\n * landed — see {@link TextBlockLayout} for the space and the caret model.\r\n *\r\n * This is what makes on-canvas text editing possible: glyph positions live\r\n * in the backend's shaper, so a host drawing its own caret and selection has\r\n * no way to compute them, and anything it approximates in the DOM disagrees\r\n * with the render as soon as the font, the line height or the wrapping does.\r\n *\r\n * Takes the whole {@link TextState} rather than a handful of font fields\r\n * because the resolution a caret has to agree with lives in the backend:\r\n * `'autofit'` picks a size from the box, `wrap` turns the width into a wrap\r\n * limit, and `textAlign` places the lines within it. Handing over the same\r\n * descriptor that gets drawn is what keeps the two from drifting apart.\r\n *\r\n * Returns `null` when the backend cannot measure this — the default, so a\r\n * backend that never needed glyph positions keeps working, and for cases no\r\n * caret model fits: text-on-path (glyphs follow a curve, not a line box) and\r\n * a block with active selection segments.\r\n */\r\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null;\r\n\r\n /**\r\n * Push a transform (position, rotation, scale, opacity, …) and return the\r\n * context so subsequent draw calls are issued in the transformed space. The\r\n * transform is popped when `end()` is called for the node that pushed it.\r\n */\r\n transform(state: Partial<TransformState>): RenderContext2D;\r\n\r\n /**\r\n * Open a boolean-path collection scope. Shapes drawn until `endBoolean()`\r\n * are gathered (fills/strokes suppressed) and combined with `op`. After\r\n * `endBoolean()` the merged path is left as the active surface, so a\r\n * paint-only `Graphics2D` (`new Graphics2D().fill(...).stroke(...)`)\r\n * submitted via `draw()` styles the combined result.\r\n */\r\n beginBoolean(op: BooleanOperation): void;\r\n endBoolean(): void;\r\n\r\n // Mask scope (imperative) — used by MaskGroup and other node-level callers\r\n // that manage the scope with explicit begin/apply/end:\r\n //\r\n // beginMask({ mode, inverted })\r\n // <render mask child> // child draws its own Graphics2D\r\n // applyMask()\r\n // <render content children> // children draw their own Graphics2D\r\n // endMask()\r\n //\r\n // The chain-friendly form lives on `Graphics2D` (`.mask().applyMask().endMask()`)\r\n // for inline use within a single `draw()`.\r\n //\r\n // For `vector` mode the mask child's path is collected and used as a\r\n // clipPath; fills/strokes are suppressed. For `alpha` and `luminance`\r\n // the mask is rendered into an offscreen layer and combined with content\r\n // via blend modes.\r\n beginMask(options?: MaskOptions): void;\r\n applyMask(): void;\r\n endMask(): void;\r\n\r\n /**\r\n * Push a clip region built from a {@link Clip} command list. The clip's\r\n * shapes are unioned (with `cut()`s subtracted) into a single path and\r\n * intersected with the active clip, so children are confined to that\r\n * compound outline — any silhouette, not just a rect or ellipse. Used both\r\n * for a node's `clip` boundary and to confine backdrop effects (blur,\r\n * magnify) to the node's exact shape. Paired with `endClip()`.\r\n */\r\n beginClip(clip: Clip): void;\r\n /** Pop the most-recently pushed clip region. */\r\n endClip(): void;\r\n\r\n /**\r\n * Open an effect scope over the node, applying `effects` to either the node's\r\n * own content or the content beneath it. Paired with {@link endEffects}.\r\n *\r\n * `target`:\r\n * - `'foreground'` — warps/filters the node's *own* drawing (its fill, stroke\r\n * and children captured between begin/end), like blur. Used for bulge and\r\n * foreground posterize.\r\n * - `'backdrop'` — warps/filters the canvas content already painted *beneath*\r\n * the node, clipped to the active silhouette clip, so the node's own edges\r\n * stay sharp (Figma-style). Used for backdrop-flagged filters (blur,\r\n * grayscale, pixelate, …), magnify, backdrop posterize, and backdrop SkSL.\r\n *\r\n * The renderer decides per effect whether to compose it as an `ImageFilter`\r\n * or run it as a snapshot/redraw shader — callers never route by effect type.\r\n * `width`/`height` are the node's logical size, for size-relative effects\r\n * (e.g. pixelate) and shader lens boxes.\r\n */\r\n beginEffects(effects: NodeEffect[], target: EffectTarget, width: number, height: number): void;\r\n endEffects(): void;\r\n\r\n /**\r\n * Draw `draw` into an offscreen buffer instead of onto the canvas, and hand\r\n * back its pixels. The buffer is `width` × `height` **logical** px with its\r\n * origin at the centre, matching the space a node draws in — so `draw` can be\r\n * an ordinary `render()` call on a node subtree and needs no special casing.\r\n *\r\n * This is what backs `Tex.surface`: `Canvas3D` rasterizes each of its 2D\r\n * sources through here, then hands the pixels to the 3D backend as a texture.\r\n * It runs *inside* the frame that consumes it, so a scrubbed frame is\r\n * identical to a played one.\r\n *\r\n * Returns `null` when the backend cannot rasterize offscreen — the material\r\n * then renders without that map. `pixelRatio` is a ceiling on the buffer's\r\n * device-pixel scale, not a guarantee; the renderer may clamp it.\r\n */\r\n rasterize(\r\n width: number,\r\n height: number,\r\n draw: () => void,\r\n pixelRatio?: number,\r\n ): RasterizedSurface | null;\r\n\r\n /**\r\n * Push a camera viewport. Clips to `viewport` (canvas-space, centred\r\n * coords) and applies the inverse camera transform so children render as\r\n * seen through the lens. `heading` rotates the world counter to the camera\r\n * angle. Paired with `endCamera()`.\r\n *\r\n * @param viewport Bounding rect of the camera node in canvas space.\r\n * @param lookAt World-space point the camera looks at.\r\n * @param zoom Uniform scale applied around `lookAt`.\r\n * @param heading Camera rotation in degrees.\r\n */\r\n beginCamera(viewport: { x: number; y: number; width: number; height: number }, lookAt: Vector2, zoom: number, heading: number): void;\r\n endCamera(): void;\r\n\r\n /**\r\n * Whether this context ever reads `NodeRenderState.rects`.\r\n *\r\n * True for anything that actually paints, since a fill with `space:'parent'`\r\n * resolves against them. A context that only inspects *what* would be drawn\r\n * never looks at them, and computing them costs an object allocation per node\r\n * per frame. Nodes check this before doing that work; see `Node2D.beforeRender`.\r\n */\r\n readonly readsSpaceRects: boolean;\r\n\r\n /**\r\n * Whether this context only cares about *visible* output.\r\n *\r\n * True for anything that paints: a subtree at zero opacity contributes no\r\n * pixels, so walking it produces draw calls the rasterizer will discard.\r\n *\r\n * A context that inspects rather than paints sets this `false`, and that is\r\n * the whole reason this is a capability rather than an unconditional check:\r\n * such a walk exists to discover which images, videos, fonts and effects a\r\n * frame *references* — regardless of whether they can be seen. An invisible\r\n * node's font still has to load, because it may fade in two frames later and\r\n * glyphs that were never registered never paint. Skipping it there is not an\r\n * optimisation, it is a missing asset.\r\n *\r\n * Same shape and same reasoning as {@link readsSpaceRects}: the context\r\n * declares what it needs, and nodes check before doing work that would be\r\n * thrown away. See `Node2D.render`.\r\n */\r\n readonly drawsVisibleOnly: boolean;\r\n\r\n}\r\n\r\n/**\r\n * A render *pass*: a {@link RenderContext2D} plus the per-node scope bracket the\r\n * walk opens around each node.\r\n *\r\n * Split off from the drawing surface because the two have different callers.\r\n * `begin`/`end` are `Node2D.render`'s, once per node, and they push onto a stack\r\n * every fill with `space:'parent'` and every motion-driven effect reads back\r\n * from. A custom node's `renderSelf` calling one would open a scope nothing\r\n * closes — and since `renderSelf` is handed a {@link RenderContext2D}, it now\r\n * cannot.\r\n *\r\n * Every backend implements this; a host driving a render pass holds one.\r\n *\r\n * @internal\r\n */\r\nexport interface RenderPass2D extends RenderContext2D {\r\n /**\r\n * Open a node draw scope. Must be paired with `end()`, also when the scope\r\n * throws. Pushes the node's id and {@link NodeRenderState} (gradient-space\r\n * rects + per-frame motion) for the duration of the scope.\r\n */\r\n begin(state: NodeRenderState): void;\r\n\r\n /** Close the innermost node draw scope opened by `begin()`. */\r\n end(): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"render-context2d.js","sourceRoot":"","sources":["../../src/render/render-context2d.ts"],"names":[],"mappings":"","sourcesContent":["import type { FontStyle, TextStyle } from \"@/attributes/text/types\";\r\nimport type { TransformState } from \"./descriptors/transform\";\r\nimport type { MeasureContext2D } from \"./measure-context\";\r\nimport type { TextState } from \"./descriptors/text\";\r\nimport type { TextBlockLayout } from \"./text-layout\";\r\nimport type { Graphics2D } from \"./graphics2d\";\r\nimport type { Clip } from \"./clip\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Size2D } from \"@/attributes/layout/size\";\r\n\r\n/**\r\n * Where an effect scope draws: `'foreground'` warps/filters the node's *own*\r\n * content (its fill, stroke and children), `'backdrop'` warps/filters the canvas\r\n * content already painted *beneath* the node (clipped to its silhouette). See\r\n * {@link RenderContext2D.beginEffects}.\r\n */\r\nexport type EffectTarget = \"foreground\" | \"backdrop\";\r\n\r\n/**\r\n * Pixels produced by {@link RenderContext2D.rasterize}: RGBA8888,\r\n * unpremultiplied, top-down (canvas row order). `width`/`height` are **device**\r\n * px, so they reflect the pixel ratio the renderer actually used rather than the\r\n * logical size that was asked for.\r\n */\r\nexport interface RasterizedSurface {\r\n pixels: Uint8Array;\r\n width: number;\r\n height: number;\r\n}\r\n\r\n/**\r\n * A bounding box in the current node's local space (origin = the node's\r\n * layout-cell centre, the same space shapes are drawn in). `left/top` use the\r\n * canvas convention (y down).\r\n */\r\nexport interface SpaceRect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n}\r\n\r\n/**\r\n * Reference rects a fill can resolve against, supplied per-node at `begin()`.\r\n * `local` is derived from the drawn shapes themselves and `global` (the\r\n * viewport) is computed by the renderer from the surface size, so only the\r\n * parent frame is passed here.\r\n */\r\nexport interface SpaceRects {\r\n /** The parent node's content rect, in this node's local space. */\r\n parent?: SpaceRect;\r\n}\r\n\r\n/**\r\n * Per-node state supplied to {@link RenderContext2D.begin} for the duration of a\r\n * node's draw scope. Carries the node identity and gradient-space `rects` plus\r\n * the node's per-frame motion, sampled at render time. Motion-driven effects\r\n * (e.g. motion blur) read the current node's `velocity` from this state instead\r\n * of being authored with a fixed direction.\r\n *\r\n * Velocity fields are `0`/`{0,0}` when the motion is unknown — the first frame a\r\n * node renders, or after a time discontinuity (scrub/seek) where no trustworthy\r\n * delta exists.\r\n */\r\nexport interface NodeRenderState {\r\n /** Stable node identifier. */\r\n id: string;\r\n /** Parent / viewport rects in this node's local space. */\r\n rects: SpaceRects;\r\n /** How long this node has existed, in seconds (`NodeTime.elapsed`). */\r\n elapsed: number;\r\n /** The frame delta, in seconds, used to derive displacement from velocity. */\r\n dt: number;\r\n /** Translational velocity in px/sec, world space (y-down). `{0,0}` when unknown. */\r\n velocity: Vector2;\r\n /** Heading of `velocity` in degrees (`atan2(vy, vx)`). `0` when unknown. */\r\n direction: number;\r\n /** Magnitude of `velocity` in px/sec. `0` when unknown. */\r\n speed: number;\r\n /** Rotational velocity in degrees/sec. `0` when unknown. Reserved for radial motion blur. */\r\n angularVelocity: number;\r\n /** Scale velocity in scale-units/sec. `0` when unknown. Reserved for zoom motion blur. */\r\n scaleVelocity: number;\r\n}\r\n\r\n/**\r\n * The drawing surface a `Node2D` paints into — **the whole of what a node may\r\n * ask of a renderer, and nothing else.**\r\n *\r\n * Shapes are never declared directly on the context: they are built with a\r\n * {@link Graphics2D} command list and submitted via {@link draw}. Multiple\r\n * shapes chained on one `Graphics2D` before a paint call are combined into a\r\n * single surface and painted together:\r\n *\r\n * ctx.draw(new Graphics2D().ellipse(...).rect(...).fill(...)); // shared surface\r\n *\r\n * On top of that it carries text measurement — it extends {@link MeasureContext2D}, so\r\n * a node measures and draws through one object — and the higher-level scoping\r\n * operations: transforms, masks, clips, camera, boolean ops, effect scopes.\r\n * `begin(state)` / `end()` bracket each node's draw call so the context can\r\n * track which node is active.\r\n *\r\n * **An interface, with `CanvasRenderContext2D` as its one base class.** What a\r\n * node calls and what a *host* calls are different lists: `execute`,\r\n * `screenshot`, `unmount` and `dispose` drive a render pass and have no business\r\n * being reachable from inside one. Splitting them is what keeps this surface\r\n * the size it is. Every real backend still extends the class, which preserves\r\n * the `draw` to `drawGraphics` invariant that gives them all one implementation\r\n * of text-default resolution.\r\n *\r\n * `RenderContext3D` is its sibling, not its subclass: the two share no members,\r\n * because a 3D scene is described with lights, a camera and meshes rather than\r\n * with paths and paint.\r\n */\r\nexport interface RenderContext2D extends MeasureContext2D {\r\n measureText(\r\n text: string,\r\n fontSize: number,\r\n fontFamily: string,\r\n fontWeight?: number,\r\n letterSpacing?: number,\r\n fontStyle?: FontStyle,\r\n ): Size2D;\r\n\r\n // ---- Inherited text-style defaults ------------------------------------\r\n // `<DefaultTextStyle>` reaches a `Text`/`RichText` node through the context\r\n // map, applied once when the node binds. A raw `Graphics2D` has no node to\r\n // bind, so it inherits the same defaults here instead — pushed around a\r\n // subtree's draw scope, and folded into each `text`/`richText` op by\r\n // `draw()`. Same vocabulary (`TextStyle`), same precedence, two channels.\r\n\r\n /**\r\n * Set text-style defaults for everything drawn until the matching\r\n * {@link popTextStyle} — the drawn-graphics half of `<DefaultTextStyle>`.\r\n *\r\n * `style` is **merged** onto the defaults already in effect, per key, so\r\n * nesting accumulates the way the node channel does: an outer scope's\r\n * `fontFamily` and an inner scope's `fontSize` both apply, and a key set by\r\n * both takes the inner value. Values are resolved (a tweened `fontSize`\r\n * arrives as this frame's number), not callbacks.\r\n *\r\n * Pass `null` to open a scope that inherits **nothing** — not the enclosing\r\n * defaults and not the project's `theme.typography.default`. That is for a\r\n * node whose text is its own vocabulary rather than the document's: `Code`\r\n * does it so a scene-wide serif face doesn't reflow a monospaced code block.\r\n *\r\n * Always pair with `popTextStyle()` in a `finally`; the stack is shared with\r\n * every sibling drawn afterwards.\r\n */\r\n pushTextStyle(style: TextStyle | null): void;\r\n\r\n /** Close the innermost scope opened by {@link pushTextStyle}. */\r\n popTextStyle(): void;\r\n\r\n /**\r\n * The text-style defaults in effect right now: the innermost\r\n * {@link pushTextStyle} scope, or the project's `theme.typography.default`\r\n * when no scope is open — the same preset a `Text` node falls back to, so a\r\n * drawn label and a node label agree on the project's base typography.\r\n */\r\n readonly defaultTextStyle: TextStyle;\r\n\r\n /**\r\n * Replay a built `Graphics2D` against this context.\r\n *\r\n * Resolves the ambient text defaults onto the op list before handing it to\r\n * the backend, which is what keeps the real renderer and the precomp asset\r\n * walk agreeing on which font an under-specified `text` op shapes with: a\r\n * family that one resolves and the other does not is a font that never loads\r\n * and glyphs that never paint.\r\n */\r\n draw(graphics: Graphics2D): void;\r\n\r\n /**\r\n * Lay `state` out the way it would be drawn and report where every character\r\n * landed — see {@link TextBlockLayout} for the space and the caret model.\r\n *\r\n * This is what makes on-canvas text editing possible: glyph positions live\r\n * in the backend's shaper, so a host drawing its own caret and selection has\r\n * no way to compute them, and anything it approximates in the DOM disagrees\r\n * with the render as soon as the font, the line height or the wrapping does.\r\n *\r\n * Takes the whole {@link TextState} rather than a handful of font fields\r\n * because the resolution a caret has to agree with lives in the backend:\r\n * `'autofit'` picks a size from the box, `wrap` turns the width into a wrap\r\n * limit, and `textAlign` places the lines within it. Handing over the same\r\n * descriptor that gets drawn is what keeps the two from drifting apart.\r\n *\r\n * Returns `null` when the backend cannot measure this — the default, so a\r\n * backend that never needed glyph positions keeps working, and for cases no\r\n * caret model fits: text-on-path (glyphs follow a curve, not a line box) and\r\n * a block drawn in styled segments.\r\n */\r\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null;\r\n\r\n /**\r\n * Push a transform (position, rotation, scale, opacity, …) and return the\r\n * context so subsequent draw calls are issued in the transformed space. The\r\n * transform is popped when `end()` is called for the node that pushed it.\r\n */\r\n transform(state: Partial<TransformState>): RenderContext2D;\r\n\r\n /**\r\n * Open a boolean-path collection scope. Shapes drawn until `endBoolean()`\r\n * are gathered (fills/strokes suppressed) and combined with `op`. After\r\n * `endBoolean()` the merged path is left as the active surface, so a\r\n * paint-only `Graphics2D` (`new Graphics2D().fill(...).stroke(...)`)\r\n * submitted via `draw()` styles the combined result.\r\n */\r\n beginBoolean(op: BooleanOperation): void;\r\n endBoolean(): void;\r\n\r\n // Mask scope (imperative) — used by MaskGroup and other node-level callers\r\n // that manage the scope with explicit begin/apply/end:\r\n //\r\n // beginMask({ mode, inverted })\r\n // <render mask child> // child draws its own Graphics2D\r\n // applyMask()\r\n // <render content children> // children draw their own Graphics2D\r\n // endMask()\r\n //\r\n // The chain-friendly form lives on `Graphics2D` (`.mask().applyMask().endMask()`)\r\n // for inline use within a single `draw()`.\r\n //\r\n // For `vector` mode the mask child's path is collected and used as a\r\n // clipPath; fills/strokes are suppressed. For `alpha` and `luminance`\r\n // the mask is rendered into an offscreen layer and combined with content\r\n // via blend modes.\r\n beginMask(options?: MaskOptions): void;\r\n applyMask(): void;\r\n endMask(): void;\r\n\r\n /**\r\n * Push a clip region built from a {@link Clip} command list. The clip's\r\n * shapes are unioned (with `cut()`s subtracted) into a single path and\r\n * intersected with the active clip, so children are confined to that\r\n * compound outline — any silhouette, not just a rect or ellipse. Used both\r\n * for a node's `clip` boundary and to confine backdrop effects (blur,\r\n * magnify) to the node's exact shape. Paired with `endClip()`.\r\n */\r\n beginClip(clip: Clip): void;\r\n /** Pop the most-recently pushed clip region. */\r\n endClip(): void;\r\n\r\n /**\r\n * Open an effect scope over the node, applying `effects` to either the node's\r\n * own content or the content beneath it. Paired with {@link endEffects}.\r\n *\r\n * `target`:\r\n * - `'foreground'` — warps/filters the node's *own* drawing (its fill, stroke\r\n * and children captured between begin/end), like blur. Used for bulge and\r\n * foreground posterize.\r\n * - `'backdrop'` — warps/filters the canvas content already painted *beneath*\r\n * the node, clipped to the active silhouette clip, so the node's own edges\r\n * stay sharp (Figma-style). Used for backdrop-flagged filters (blur,\r\n * grayscale, pixelate, …), magnify, backdrop posterize, and backdrop shader.\r\n *\r\n * The renderer decides per effect whether to compose it as an `ImageFilter`\r\n * or run it as a snapshot/redraw shader — callers never route by effect type.\r\n * `width`/`height` are the node's logical size, for size-relative effects\r\n * (e.g. pixelate) and shader lens boxes.\r\n */\r\n beginEffects(effects: NodeEffect[], target: EffectTarget, width: number, height: number): void;\r\n endEffects(): void;\r\n\r\n /**\r\n * Draw `draw` into an offscreen buffer instead of onto the canvas, and hand\r\n * back its pixels. The buffer is `width` × `height` **logical** px with its\r\n * origin at the centre, matching the space a node draws in — so `draw` can be\r\n * an ordinary `render()` call on a node subtree and needs no special casing.\r\n *\r\n * This is what backs `Tex.surface`: `Canvas3D` rasterizes each of its 2D\r\n * sources through here, then hands the pixels to the 3D backend as a texture.\r\n * It runs *inside* the frame that consumes it, so a scrubbed frame is\r\n * identical to a played one.\r\n *\r\n * Returns `null` when the backend cannot rasterize offscreen — the material\r\n * then renders without that map. `pixelRatio` is a ceiling on the buffer's\r\n * device-pixel scale, not a guarantee; the renderer may clamp it.\r\n */\r\n rasterize(\r\n width: number,\r\n height: number,\r\n draw: () => void,\r\n pixelRatio?: number,\r\n ): RasterizedSurface | null;\r\n\r\n /**\r\n * Push a camera viewport. Clips to `viewport` (canvas-space, centred\r\n * coords) and applies the inverse camera transform so children render as\r\n * seen through the lens. `heading` rotates the world counter to the camera\r\n * angle. Paired with `endCamera()`.\r\n *\r\n * @param viewport Bounding rect of the camera node in canvas space.\r\n * @param lookAt World-space point the camera looks at.\r\n * @param zoom Uniform scale applied around `lookAt`.\r\n * @param heading Camera rotation in degrees.\r\n */\r\n beginCamera(viewport: { x: number; y: number; width: number; height: number }, lookAt: Vector2, zoom: number, heading: number): void;\r\n endCamera(): void;\r\n\r\n /**\r\n * Whether this context ever reads `NodeRenderState.rects`.\r\n *\r\n * True for anything that actually paints, since a fill with `space:'parent'`\r\n * resolves against them. A context that only inspects *what* would be drawn\r\n * never looks at them, and computing them costs an object allocation per node\r\n * per frame. Nodes check this before doing that work; see `Node2D.renderState`.\r\n */\r\n readonly readsSpaceRects: boolean;\r\n\r\n /**\r\n * Whether this context only cares about *visible* output.\r\n *\r\n * True for anything that paints: a subtree at zero opacity contributes no\r\n * pixels, so walking it produces draw calls the rasterizer will discard.\r\n *\r\n * A context that inspects rather than paints sets this `false`, and that is\r\n * the whole reason this is a capability rather than an unconditional check:\r\n * such a walk exists to discover which images, videos, fonts and effects a\r\n * frame *references* — regardless of whether they can be seen. An invisible\r\n * node's font still has to load, because it may fade in two frames later and\r\n * glyphs that were never registered never paint. Skipping it there is not an\r\n * optimisation, it is a missing asset.\r\n *\r\n * Same shape and same reasoning as {@link readsSpaceRects}: the context\r\n * declares what it needs, and nodes check before doing work that would be\r\n * thrown away. See `Node2D.render`.\r\n */\r\n readonly drawsVisibleOnly: boolean;\r\n\r\n}\r\n\r\n/**\r\n * A render *pass*: a {@link RenderContext2D} plus the per-node scope bracket the\r\n * walk opens around each node.\r\n *\r\n * Split off from the drawing surface because the two have different callers.\r\n * `begin`/`end` are `Node2D.render`'s, once per node, and they push onto a stack\r\n * every fill with `space:'parent'` and every motion-driven effect reads back\r\n * from. A custom node's `renderSelf` calling one would open a scope nothing\r\n * closes — and since `renderSelf` is handed a {@link RenderContext2D}, it now\r\n * cannot.\r\n *\r\n * Every backend implements this; a host driving a render pass holds one.\r\n *\r\n * @internal\r\n */\r\nexport interface RenderPass2D extends RenderContext2D {\r\n /**\r\n * Open a node draw scope. Must be paired with `end()`, also when the scope\r\n * throws. Pushes the node's id and {@link NodeRenderState} (gradient-space\r\n * rects + per-frame motion) for the duration of the scope.\r\n */\r\n begin(state: NodeRenderState): void;\r\n\r\n /** Close the innermost node draw scope opened by `begin()`. */\r\n end(): void;\r\n}\r\n"]}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * What a render issue is about:
3
+ *
4
+ * - `missing`: a feature the backend does not draw (`feature` names it).
5
+ * - `shader`: a user shader that does not compile, or one that is not WGSL (an SkSL shader from an old document).
6
+ * - `params`: a shader's uniforms and its `struct Params` disagree (a value with no member, a member with no value).
7
+ * - `gpu`: a WebGPU validation or out-of-memory error.
8
+ * - `device-lost`: the GPU device was lost; the backend is drawing on a new one.
9
+ * - `crashed`: the backend itself failed and draws nothing more on this page.
10
+ */
11
+ export type RenderIssueKind = "missing" | "shader" | "params" | "gpu" | "device-lost" | "crashed";
12
+ /** Something a frame drew without throwing but not as the document says. */
13
+ export interface RenderIssue {
14
+ kind: RenderIssueKind;
15
+ message: string;
16
+ /** What is affected, as the backend names it (`blend:color-dodge`, `text:path`, `fill:shader`). */
17
+ feature?: string;
18
+ /** The node it was found on, when the backend knows. */
19
+ nodeId?: string;
20
+ }
21
+ /** A backend's issue as a typed one; a bare string is the shader message backends reported before issues were typed. */
22
+ export declare function toRenderIssue(issue: RenderIssue | string): RenderIssue;
23
+ /** One key per kind, feature and node: what an issue list is deduplicated by. */
24
+ export declare function renderIssueKey(issue: RenderIssue): string;
25
+ /**
26
+ * The backend lost what it draws with while a render was under way, so the
27
+ * frames already drawn cannot be trusted. Thrown by exports and stills on a
28
+ * `device-lost` or `crashed` issue; `retryable` says whether the same render
29
+ * can simply run again (the backend recovered on a new device).
30
+ */
31
+ export declare class RenderBackendError extends Error {
32
+ readonly issue: RenderIssue;
33
+ readonly name = "RenderBackendError";
34
+ readonly retryable: boolean;
35
+ constructor(issue: RenderIssue);
36
+ }
37
+ /** Whether an issue means the frames drawn around it are not to be trusted. */
38
+ export declare function isFatalRenderIssue(issue: RenderIssue): boolean;
39
+ //# sourceMappingURL=render-issue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-issue.d.ts","sourceRoot":"","sources":["../../src/render/render-issue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,aAAa,GAAG,SAAS,CAAC;AAElG,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wHAAwH;AACxH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,WAAW,CAEtE;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAI7B,QAAQ,CAAC,KAAK,EAAE,WAAW;IAHvC,SAAkB,IAAI,wBAAwB;IAC9C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;gBAEP,KAAK,EAAE,WAAW;CAI1C;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE9D"}