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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1133) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -48
  4. package/README.md +91 -91
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.js.map +1 -1
  7. package/dist/assets/errors.js.map +1 -1
  8. package/dist/assets/index.js.map +1 -1
  9. package/dist/assets/manager.d.ts.map +1 -1
  10. package/dist/assets/manager.js +7 -5
  11. package/dist/assets/manager.js.map +1 -1
  12. package/dist/assets/manifest.js.map +1 -1
  13. package/dist/assets/record.js.map +1 -1
  14. package/dist/assets/scope.js.map +1 -1
  15. package/dist/attributes/audio/effects/chain.d.ts +73 -0
  16. package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
  17. package/dist/attributes/audio/effects/chain.js +67 -0
  18. package/dist/attributes/audio/effects/chain.js.map +1 -0
  19. package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
  20. package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
  21. package/dist/attributes/audio/{filters → effects}/implementations/echo.js +2 -2
  22. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -0
  23. package/dist/attributes/audio/effects/implementations/gain.d.ts +10 -0
  24. package/dist/attributes/audio/effects/implementations/gain.d.ts.map +1 -0
  25. package/dist/attributes/audio/{filters → effects}/implementations/gain.js +2 -2
  26. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -0
  27. package/dist/attributes/audio/effects/implementations/highpass.d.ts +12 -0
  28. package/dist/attributes/audio/effects/implementations/highpass.d.ts.map +1 -0
  29. package/dist/attributes/audio/{filters → effects}/implementations/highpass.js +2 -2
  30. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -0
  31. package/dist/attributes/audio/effects/implementations/lowpass.d.ts +12 -0
  32. package/dist/attributes/audio/effects/implementations/lowpass.d.ts.map +1 -0
  33. package/dist/attributes/audio/{filters → effects}/implementations/lowpass.js +2 -2
  34. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -0
  35. package/dist/attributes/audio/effects/implementations/tremolo.d.ts +12 -0
  36. package/dist/attributes/audio/effects/implementations/tremolo.d.ts.map +1 -0
  37. package/dist/attributes/audio/{filters → effects}/implementations/tremolo.js +2 -2
  38. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -0
  39. package/dist/attributes/audio/effects/index.d.ts +12 -0
  40. package/dist/attributes/audio/effects/index.d.ts.map +1 -0
  41. package/dist/attributes/audio/effects/index.js +4 -0
  42. package/dist/attributes/audio/effects/index.js.map +1 -0
  43. package/dist/attributes/audio/effects/registry.d.ts +36 -0
  44. package/dist/attributes/audio/effects/registry.d.ts.map +1 -0
  45. package/dist/attributes/audio/effects/registry.js +80 -0
  46. package/dist/attributes/audio/effects/registry.js.map +1 -0
  47. package/dist/attributes/audio/effects/union.d.ts +14 -0
  48. package/dist/attributes/audio/effects/union.d.ts.map +1 -0
  49. package/dist/attributes/audio/effects/union.js +24 -0
  50. package/dist/attributes/audio/effects/union.js.map +1 -0
  51. package/dist/attributes/audio/ramp.d.ts +103 -0
  52. package/dist/attributes/audio/ramp.d.ts.map +1 -0
  53. package/dist/attributes/audio/ramp.js +246 -0
  54. package/dist/attributes/audio/ramp.js.map +1 -0
  55. package/dist/attributes/audio/request.d.ts +24 -13
  56. package/dist/attributes/audio/request.d.ts.map +1 -1
  57. package/dist/attributes/audio/request.js +4 -3
  58. package/dist/attributes/audio/request.js.map +1 -1
  59. package/dist/attributes/audio/schedule.d.ts +21 -13
  60. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  61. package/dist/attributes/audio/schedule.js +42 -28
  62. package/dist/attributes/audio/schedule.js.map +1 -1
  63. package/dist/attributes/audio/sound.d.ts +15 -12
  64. package/dist/attributes/audio/sound.d.ts.map +1 -1
  65. package/dist/attributes/audio/sound.js +8 -10
  66. package/dist/attributes/audio/sound.js.map +1 -1
  67. package/dist/attributes/audio/transition.d.ts +33 -0
  68. package/dist/attributes/audio/transition.d.ts.map +1 -0
  69. package/dist/attributes/audio/transition.js +48 -0
  70. package/dist/attributes/audio/transition.js.map +1 -0
  71. package/dist/attributes/index.d.ts +4 -3
  72. package/dist/attributes/index.d.ts.map +1 -1
  73. package/dist/attributes/index.js +4 -7
  74. package/dist/attributes/index.js.map +1 -1
  75. package/dist/attributes/layout/alignment.js.map +1 -1
  76. package/dist/attributes/layout/index.js.map +1 -1
  77. package/dist/attributes/layout/insets.js.map +1 -1
  78. package/dist/attributes/layout/matrix2d.d.ts +2 -2
  79. package/dist/attributes/layout/matrix2d.js.map +1 -1
  80. package/dist/attributes/layout/size.js.map +1 -1
  81. package/dist/attributes/layout/space3d.js +1 -1
  82. package/dist/attributes/layout/space3d.js.map +1 -1
  83. package/dist/attributes/layout/transform3d.js.map +1 -1
  84. package/dist/attributes/layout/vector2.js.map +1 -1
  85. package/dist/attributes/layout/world-transform.js.map +1 -1
  86. package/dist/attributes/mask/boolean.js.map +1 -1
  87. package/dist/attributes/mask/mask.js.map +1 -1
  88. package/dist/attributes/properties/decorator.js.map +1 -1
  89. package/dist/attributes/properties/inputs.js.map +1 -1
  90. package/dist/attributes/properties/typed.d.ts +7 -7
  91. package/dist/attributes/properties/typed.d.ts.map +1 -1
  92. package/dist/attributes/properties/typed.js +6 -6
  93. package/dist/attributes/properties/typed.js.map +1 -1
  94. package/dist/attributes/render3d/orbit.js.map +1 -1
  95. package/dist/attributes/shape/corners/corner-radius.d.ts +1 -2
  96. package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
  97. package/dist/attributes/shape/corners/corner-radius.js +1 -2
  98. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  99. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  100. package/dist/attributes/shape/corners/corners.js.map +1 -1
  101. package/dist/attributes/shape/corners/index.js.map +1 -1
  102. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  103. package/dist/attributes/shape/effects/chain.d.ts +96 -409
  104. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  105. package/dist/attributes/shape/effects/chain.js +93 -283
  106. package/dist/attributes/shape/effects/chain.js.map +1 -1
  107. package/dist/attributes/shape/effects/effect-data.d.ts +1 -1
  108. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/ascii.d.ts +45 -13
  110. package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/ascii.js +29 -23
  112. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +32 -7
  114. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/bit-crush.js +17 -15
  116. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/block-displace.d.ts +46 -10
  118. package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/block-displace.js +21 -19
  120. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/bloom.d.ts +32 -7
  122. package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/bloom.js +17 -11
  124. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/blur.d.ts +16 -3
  126. package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/blur.js +13 -5
  128. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/bulge.d.ts +28 -9
  130. package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/bulge.js +15 -14
  132. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +21 -5
  134. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +15 -10
  136. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  137. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +96 -26
  138. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
  139. package/dist/attributes/shape/effects/implementations/color-adjustment.js +29 -26
  140. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  141. package/dist/attributes/shape/effects/implementations/curves.d.ts +20 -6
  142. package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
  143. package/dist/attributes/shape/effects/implementations/curves.js +26 -23
  144. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  145. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
  146. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
  147. package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
  148. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  149. package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
  150. package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
  151. package/dist/attributes/shape/effects/implementations/dither.js +26 -20
  152. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  153. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +46 -14
  154. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
  155. package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
  156. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  157. package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
  158. package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
  159. package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
  160. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  161. package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
  162. package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
  163. package/dist/attributes/shape/effects/implementations/edges.js +17 -14
  164. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  165. package/dist/attributes/shape/effects/implementations/glass.d.ts +76 -19
  166. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  167. package/dist/attributes/shape/effects/implementations/glass.js +28 -22
  168. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  169. package/dist/attributes/shape/effects/implementations/glow.d.ts +149 -42
  170. package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
  171. package/dist/attributes/shape/effects/implementations/glow.js +74 -72
  172. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  173. package/dist/attributes/shape/effects/implementations/grain.d.ts +43 -11
  174. package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
  175. package/dist/attributes/shape/effects/implementations/grain.js +21 -18
  176. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  177. package/dist/attributes/shape/effects/implementations/grayscale.d.ts +17 -3
  178. package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
  179. package/dist/attributes/shape/effects/implementations/grayscale.js +13 -5
  180. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  181. package/dist/attributes/shape/effects/implementations/halftone.d.ts +40 -9
  182. package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
  183. package/dist/attributes/shape/effects/implementations/halftone.js +20 -16
  184. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  185. package/dist/attributes/shape/effects/implementations/invert.d.ts +23 -5
  186. package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
  187. package/dist/attributes/shape/effects/implementations/invert.js +15 -10
  188. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  189. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +57 -18
  190. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
  191. package/dist/attributes/shape/effects/implementations/kaleidoscope.js +25 -22
  192. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  193. package/dist/attributes/shape/effects/implementations/lut.d.ts +34 -7
  194. package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
  195. package/dist/attributes/shape/effects/implementations/lut.js +20 -16
  196. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  197. package/dist/attributes/shape/effects/implementations/magnify.d.ts +27 -9
  198. package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
  199. package/dist/attributes/shape/effects/implementations/magnify.js +17 -14
  200. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  201. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +54 -19
  202. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
  203. package/dist/attributes/shape/effects/implementations/motion-blur.js +42 -20
  204. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  205. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +17 -3
  206. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
  207. package/dist/attributes/shape/effects/implementations/oil-paint.js +13 -9
  208. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  209. package/dist/attributes/shape/effects/implementations/outline.d.ts +28 -8
  210. package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
  211. package/dist/attributes/shape/effects/implementations/outline.js +18 -17
  212. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  213. package/dist/attributes/shape/effects/implementations/pixelate.d.ts +25 -6
  214. package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
  215. package/dist/attributes/shape/effects/implementations/pixelate.js +16 -14
  216. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  217. package/dist/attributes/shape/effects/implementations/posterize.d.ts +14 -3
  218. package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
  219. package/dist/attributes/shape/effects/implementations/posterize.js +13 -9
  220. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  221. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +91 -26
  222. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
  223. package/dist/attributes/shape/effects/implementations/progressive-blur.js +27 -28
  224. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  225. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +49 -10
  226. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
  227. package/dist/attributes/shape/effects/implementations/radial-blur.js +19 -20
  228. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  229. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +36 -6
  230. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
  231. package/dist/attributes/shape/effects/implementations/rgb-shift.js +16 -15
  232. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  233. package/dist/attributes/shape/effects/implementations/scanlines.d.ts +52 -11
  234. package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
  235. package/dist/attributes/shape/effects/implementations/scanlines.js +21 -18
  236. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  237. package/dist/attributes/shape/effects/implementations/scatter.d.ts +23 -9
  238. package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
  239. package/dist/attributes/shape/effects/implementations/scatter.js +15 -12
  240. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  241. package/dist/attributes/shape/effects/implementations/shader.d.ts +90 -34
  242. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  243. package/dist/attributes/shape/effects/implementations/shader.js +42 -26
  244. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  245. package/dist/attributes/shape/effects/implementations/sharpen.d.ts +23 -5
  246. package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
  247. package/dist/attributes/shape/effects/implementations/sharpen.js +16 -11
  248. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  249. package/dist/attributes/shape/effects/implementations/streak.d.ts +40 -9
  250. package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
  251. package/dist/attributes/shape/effects/implementations/streak.js +19 -16
  252. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  253. package/dist/attributes/shape/effects/implementations/threshold.d.ts +24 -5
  254. package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
  255. package/dist/attributes/shape/effects/implementations/threshold.js +17 -11
  256. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  257. package/dist/attributes/shape/effects/implementations/twirl.d.ts +35 -8
  258. package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
  259. package/dist/attributes/shape/effects/implementations/twirl.js +17 -16
  260. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  261. package/dist/attributes/shape/effects/implementations/vignette.d.ts +37 -7
  262. package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
  263. package/dist/attributes/shape/effects/implementations/vignette.js +19 -18
  264. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  265. package/dist/attributes/shape/effects/implementations/vintage.d.ts +24 -5
  266. package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
  267. package/dist/attributes/shape/effects/implementations/vintage.js +15 -10
  268. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  269. package/dist/attributes/shape/effects/implementations/wave.d.ts +61 -14
  270. package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
  271. package/dist/attributes/shape/effects/implementations/wave.js +26 -23
  272. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  273. package/dist/attributes/shape/effects/index.d.ts +4 -2
  274. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  275. package/dist/attributes/shape/effects/index.js +1 -1
  276. package/dist/attributes/shape/effects/index.js.map +1 -1
  277. package/dist/attributes/shape/effects/registry.d.ts +11 -0
  278. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  279. package/dist/attributes/shape/effects/registry.js +113 -102
  280. package/dist/attributes/shape/effects/registry.js.map +1 -1
  281. package/dist/attributes/shape/effects/spec.d.ts +229 -0
  282. package/dist/attributes/shape/effects/spec.d.ts.map +1 -0
  283. package/dist/attributes/shape/effects/spec.js +178 -0
  284. package/dist/attributes/shape/effects/spec.js.map +1 -0
  285. package/dist/attributes/shape/effects/union.js.map +1 -1
  286. package/dist/attributes/shape/fill/blend.js.map +1 -1
  287. package/dist/attributes/shape/fill/chain.d.ts +7 -9
  288. package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
  289. package/dist/attributes/shape/fill/chain.js +9 -11
  290. package/dist/attributes/shape/fill/chain.js.map +1 -1
  291. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  292. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  293. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  294. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  295. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  296. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  297. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  298. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  299. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  300. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  301. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  302. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  303. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  304. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  305. package/dist/attributes/shape/fill/implementations/shader.d.ts +27 -26
  306. package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
  307. package/dist/attributes/shape/fill/implementations/shader.js +20 -14
  308. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  309. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  310. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  311. package/dist/attributes/shape/fill/index.d.ts +1 -1
  312. package/dist/attributes/shape/fill/index.d.ts.map +1 -1
  313. package/dist/attributes/shape/fill/index.js.map +1 -1
  314. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  315. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  316. package/dist/attributes/shape/fill/registry.d.ts +1 -2
  317. package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
  318. package/dist/attributes/shape/fill/registry.js +1 -2
  319. package/dist/attributes/shape/fill/registry.js.map +1 -1
  320. package/dist/attributes/shape/fill/union.js.map +1 -1
  321. package/dist/attributes/shape/filters/chain.d.ts +2 -6
  322. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  323. package/dist/attributes/shape/filters/chain.js +1 -5
  324. package/dist/attributes/shape/filters/chain.js.map +1 -1
  325. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  326. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  327. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  328. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
  329. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
  330. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  331. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  332. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  333. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  334. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  335. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  336. package/dist/attributes/shape/filters/index.js.map +1 -1
  337. package/dist/attributes/shape/filters/registry.d.ts +1 -1
  338. package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
  339. package/dist/attributes/shape/filters/registry.js +3 -3
  340. package/dist/attributes/shape/filters/registry.js.map +1 -1
  341. package/dist/attributes/shape/filters/union.d.ts +2 -3
  342. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  343. package/dist/attributes/shape/filters/union.js.map +1 -1
  344. package/dist/attributes/shape/path/anchors.js.map +1 -1
  345. package/dist/attributes/shape/path/bezier.js.map +1 -1
  346. package/dist/attributes/shape/path/index.js.map +1 -1
  347. package/dist/attributes/shape/path/measure.js.map +1 -1
  348. package/dist/attributes/shape/path/morph.js.map +1 -1
  349. package/dist/attributes/shape/path/ops.js.map +1 -1
  350. package/dist/attributes/shape/path/types.js.map +1 -1
  351. package/dist/attributes/shape/path/walk.js.map +1 -1
  352. package/dist/attributes/shape/shaders/index.d.ts +2 -0
  353. package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
  354. package/dist/attributes/shape/shaders/index.js +2 -0
  355. package/dist/attributes/shape/shaders/index.js.map +1 -1
  356. package/dist/attributes/shape/shaders/language.d.ts +26 -0
  357. package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
  358. package/dist/attributes/shape/shaders/language.js +20 -0
  359. package/dist/attributes/shape/shaders/language.js.map +1 -0
  360. package/dist/attributes/shape/shaders/pack.d.ts +25 -11
  361. package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
  362. package/dist/attributes/shape/shaders/pack.js +9 -4
  363. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  364. package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
  365. package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
  366. package/dist/attributes/shape/shaders/resolve.js +3 -6
  367. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  368. package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
  369. package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
  370. package/dist/attributes/shape/shaders/uniforms.js +0 -0
  371. package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
  372. package/dist/attributes/shape/shadow/index.js.map +1 -1
  373. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  374. package/dist/attributes/shape/stroke/index.js.map +1 -1
  375. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  376. package/dist/attributes/shared/operators.js.map +1 -1
  377. package/dist/attributes/text/index.js.map +1 -1
  378. package/dist/attributes/text/ops.js.map +1 -1
  379. package/dist/attributes/text/types.js.map +1 -1
  380. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  381. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  382. package/dist/browser/chunks/chunk-7DB6BI27.js +6 -0
  383. package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
  384. package/dist/browser/chunks/chunk-IX53IFBD.js +13 -0
  385. package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
  386. package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
  387. package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
  388. package/dist/browser/component.js +1 -1
  389. package/dist/browser/experimental.js +1 -1
  390. package/dist/browser/experimental.js.map +4 -4
  391. package/dist/browser/index.js +1 -1
  392. package/dist/browser/index.js.map +2 -2
  393. package/dist/browser/manifest.json +1 -1
  394. package/dist/browser/sdk.js +1 -1
  395. package/dist/component.js.map +1 -1
  396. package/dist/components/builtins/audio/audio.d.ts +14 -5
  397. package/dist/components/builtins/audio/audio.d.ts.map +1 -1
  398. package/dist/components/builtins/audio/audio.js +10 -13
  399. package/dist/components/builtins/audio/audio.js.map +1 -1
  400. package/dist/components/builtins/geometry/composite.d.ts +3 -3
  401. package/dist/components/builtins/geometry/composite.js.map +1 -1
  402. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  403. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  404. package/dist/components/builtins/layout/layout.js.map +1 -1
  405. package/dist/components/builtins/media/media.d.ts +7 -7
  406. package/dist/components/builtins/media/media.d.ts.map +1 -1
  407. package/dist/components/builtins/media/media.js +4 -10
  408. package/dist/components/builtins/media/media.js.map +1 -1
  409. package/dist/components/builtins/providers/providers.js.map +1 -1
  410. package/dist/components/builtins/text/number-format.js.map +1 -1
  411. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  412. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  413. package/dist/components/builtins/text/text-layout.js.map +1 -1
  414. package/dist/components/builtins/text/text.d.ts +9 -9
  415. package/dist/components/builtins/text/text.d.ts.map +1 -1
  416. package/dist/components/builtins/text/text.js +3 -0
  417. package/dist/components/builtins/text/text.js.map +1 -1
  418. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  419. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  420. package/dist/components/builtins/three/three.js.map +1 -1
  421. package/dist/components/factory/api.d.ts +38 -11
  422. package/dist/components/factory/api.d.ts.map +1 -1
  423. package/dist/components/factory/api.js.map +1 -1
  424. package/dist/components/factory/clip-of.js.map +1 -1
  425. package/dist/components/factory/commands-for.js.map +1 -1
  426. package/dist/components/factory/component-audio.js.map +1 -1
  427. package/dist/components/factory/component2d.js.map +1 -1
  428. package/dist/components/factory/component3d.d.ts.map +1 -1
  429. package/dist/components/factory/component3d.js +11 -3
  430. package/dist/components/factory/component3d.js.map +1 -1
  431. package/dist/components/factory/factory.d.ts +3 -0
  432. package/dist/components/factory/factory.d.ts.map +1 -1
  433. package/dist/components/factory/factory.js +39 -5
  434. package/dist/components/factory/factory.js.map +1 -1
  435. package/dist/components/factory/timeline.js.map +1 -1
  436. package/dist/components/factory/type-def.js.map +1 -1
  437. package/dist/components/factory/types.js.map +1 -1
  438. package/dist/components/factory/views.js.map +1 -1
  439. package/dist/components/modules/aim.js.map +1 -1
  440. package/dist/components/modules/corners.js.map +1 -1
  441. package/dist/components/modules/flow.js.map +1 -1
  442. package/dist/components/modules/material.js.map +1 -1
  443. package/dist/components/modules/paint.js.map +1 -1
  444. package/dist/components/modules/shapes.js.map +1 -1
  445. package/dist/components/modules/text-layout.js.map +1 -1
  446. package/dist/components/modules/text-style.js.map +1 -1
  447. package/dist/components/modules/three-entries.js.map +1 -1
  448. package/dist/components/modules/view3d.js.map +1 -1
  449. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  450. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  451. package/dist/components/trees/2d/node-motion.js.map +1 -1
  452. package/dist/components/trees/2d/node-render.d.ts +1 -1
  453. package/dist/components/trees/2d/node-render.js +1 -1
  454. package/dist/components/trees/2d/node-render.js.map +1 -1
  455. package/dist/components/trees/2d/node-space.js.map +1 -1
  456. package/dist/components/trees/2d/node-transform.js.map +1 -1
  457. package/dist/components/trees/2d/node2d.d.ts +1 -1
  458. package/dist/components/trees/2d/node2d.js +1 -1
  459. package/dist/components/trees/2d/node2d.js.map +1 -1
  460. package/dist/components/trees/audio/index.js.map +1 -1
  461. package/dist/components/trees/audio/node-audio.d.ts +16 -9
  462. package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
  463. package/dist/components/trees/audio/node-audio.js +15 -11
  464. package/dist/components/trees/audio/node-audio.js.map +1 -1
  465. package/dist/components/trees/index.js.map +1 -1
  466. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  467. package/dist/components/trees/node/node-reactive.js.map +1 -1
  468. package/dist/components/trees/node/node-time.js.map +1 -1
  469. package/dist/components/trees/node/node-walk.js.map +1 -1
  470. package/dist/components/trees/node/node.js.map +1 -1
  471. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  472. package/dist/components/trees/three/node3d.js.map +1 -1
  473. package/dist/document/audio.js.map +1 -1
  474. package/dist/document/builtins.js.map +1 -1
  475. package/dist/document/command-traits.d.ts +12 -2
  476. package/dist/document/command-traits.d.ts.map +1 -1
  477. package/dist/document/command-traits.js +34 -6
  478. package/dist/document/command-traits.js.map +1 -1
  479. package/dist/document/deny-globals.js.map +1 -1
  480. package/dist/document/diff.js.map +1 -1
  481. package/dist/document/doc-index.js.map +1 -1
  482. package/dist/document/expression/compile.js.map +1 -1
  483. package/dist/document/expression/index.js.map +1 -1
  484. package/dist/document/expression/ops.js.map +1 -1
  485. package/dist/document/expression/parse.js.map +1 -1
  486. package/dist/document/expression/refs.js.map +1 -1
  487. package/dist/document/expression/types.js.map +1 -1
  488. package/dist/document/expression/walk.js.map +1 -1
  489. package/dist/document/index.d.ts +8 -0
  490. package/dist/document/index.d.ts.map +1 -1
  491. package/dist/document/index.js +4 -0
  492. package/dist/document/index.js.map +1 -1
  493. package/dist/document/migrate.d.ts +70 -0
  494. package/dist/document/migrate.d.ts.map +1 -0
  495. package/dist/document/migrate.js +202 -0
  496. package/dist/document/migrate.js.map +1 -0
  497. package/dist/document/missing-node.d.ts +27 -0
  498. package/dist/document/missing-node.d.ts.map +1 -0
  499. package/dist/document/missing-node.js +48 -0
  500. package/dist/document/missing-node.js.map +1 -0
  501. package/dist/document/node-decorator.js.map +1 -1
  502. package/dist/document/node-descriptor.d.ts +4 -0
  503. package/dist/document/node-descriptor.d.ts.map +1 -1
  504. package/dist/document/node-descriptor.js.map +1 -1
  505. package/dist/document/placement.d.ts +2 -1
  506. package/dist/document/placement.d.ts.map +1 -1
  507. package/dist/document/placement.js.map +1 -1
  508. package/dist/document/project.d.ts +2 -0
  509. package/dist/document/project.d.ts.map +1 -1
  510. package/dist/document/project.js +1 -0
  511. package/dist/document/project.js.map +1 -1
  512. package/dist/document/prop-evolution.d.ts +51 -0
  513. package/dist/document/prop-evolution.d.ts.map +1 -0
  514. package/dist/document/prop-evolution.js +83 -0
  515. package/dist/document/prop-evolution.js.map +1 -0
  516. package/dist/document/registry.d.ts +16 -0
  517. package/dist/document/registry.d.ts.map +1 -1
  518. package/dist/document/registry.js +30 -4
  519. package/dist/document/registry.js.map +1 -1
  520. package/dist/document/settled-index.d.ts +2 -0
  521. package/dist/document/settled-index.d.ts.map +1 -1
  522. package/dist/document/settled-index.js +5 -5
  523. package/dist/document/settled-index.js.map +1 -1
  524. package/dist/document/timeline-patch.d.ts +4 -0
  525. package/dist/document/timeline-patch.d.ts.map +1 -1
  526. package/dist/document/timeline-patch.js +28 -3
  527. package/dist/document/timeline-patch.js.map +1 -1
  528. package/dist/document/timeline.d.ts +45 -1
  529. package/dist/document/timeline.d.ts.map +1 -1
  530. package/dist/document/timeline.js +172 -42
  531. package/dist/document/timeline.js.map +1 -1
  532. package/dist/document/types.d.ts +14 -28
  533. package/dist/document/types.d.ts.map +1 -1
  534. package/dist/document/types.js.map +1 -1
  535. package/dist/document/validate.d.ts +17 -5
  536. package/dist/document/validate.d.ts.map +1 -1
  537. package/dist/document/validate.js +158 -21
  538. package/dist/document/validate.js.map +1 -1
  539. package/dist/document/vocabulary.d.ts +28 -0
  540. package/dist/document/vocabulary.d.ts.map +1 -0
  541. package/dist/document/vocabulary.js +42 -0
  542. package/dist/document/vocabulary.js.map +1 -0
  543. package/dist/experimental.d.ts +68 -8
  544. package/dist/experimental.d.ts.map +1 -1
  545. package/dist/experimental.js +22 -8
  546. package/dist/experimental.js.map +1 -1
  547. package/dist/index.js.map +1 -1
  548. package/dist/layout/bounds.js.map +1 -1
  549. package/dist/layout/constraints.js.map +1 -1
  550. package/dist/layout/flex.js.map +1 -1
  551. package/dist/layout/freeform.js.map +1 -1
  552. package/dist/layout/grid.js.map +1 -1
  553. package/dist/layout/index.js.map +1 -1
  554. package/dist/layout/item.js.map +1 -1
  555. package/dist/layout/ops.js.map +1 -1
  556. package/dist/layout/types.js.map +1 -1
  557. package/dist/platform/audio-sink.js.map +1 -1
  558. package/dist/platform/exporter.d.ts +13 -0
  559. package/dist/platform/exporter.d.ts.map +1 -1
  560. package/dist/platform/exporter.js.map +1 -1
  561. package/dist/platform/index.js.map +1 -1
  562. package/dist/platform/stepped-clock.js.map +1 -1
  563. package/dist/platform/storage-adapter.js.map +1 -1
  564. package/dist/platform/ticker.js.map +1 -1
  565. package/dist/project/config.js.map +1 -1
  566. package/dist/project/index.js.map +1 -1
  567. package/dist/project/tree.js.map +1 -1
  568. package/dist/props/host.js.map +1 -1
  569. package/dist/props/index.js.map +1 -1
  570. package/dist/props/observer.js.map +1 -1
  571. package/dist/props/slot.js.map +1 -1
  572. package/dist/renamed-scene-names.d.ts +1 -1
  573. package/dist/renamed-scene-names.d.ts.map +1 -1
  574. package/dist/renamed-scene-names.js +1 -1
  575. package/dist/renamed-scene-names.js.map +1 -1
  576. package/dist/render/canvas-render-context2d.d.ts +9 -0
  577. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  578. package/dist/render/canvas-render-context2d.js +10 -0
  579. package/dist/render/canvas-render-context2d.js.map +1 -1
  580. package/dist/render/clip-contains.js +1 -1
  581. package/dist/render/clip-contains.js.map +1 -1
  582. package/dist/render/clip.js.map +1 -1
  583. package/dist/render/descriptors/ellipse.js.map +1 -1
  584. package/dist/render/descriptors/line.js.map +1 -1
  585. package/dist/render/descriptors/path-builder.js.map +1 -1
  586. package/dist/render/descriptors/path.js.map +1 -1
  587. package/dist/render/descriptors/polygon.js.map +1 -1
  588. package/dist/render/descriptors/polygram.js.map +1 -1
  589. package/dist/render/descriptors/rect.js.map +1 -1
  590. package/dist/render/descriptors/richtext.js.map +1 -1
  591. package/dist/render/descriptors/shape.js.map +1 -1
  592. package/dist/render/descriptors/text.d.ts +2 -2
  593. package/dist/render/descriptors/text.js +2 -2
  594. package/dist/render/descriptors/text.js.map +1 -1
  595. package/dist/render/descriptors/transform.js.map +1 -1
  596. package/dist/render/graphics2d.js.map +1 -1
  597. package/dist/render/index.d.ts +2 -0
  598. package/dist/render/index.d.ts.map +1 -1
  599. package/dist/render/index.js +1 -0
  600. package/dist/render/index.js.map +1 -1
  601. package/dist/render/measure-context.js.map +1 -1
  602. package/dist/render/null-render-context.js.map +1 -1
  603. package/dist/render/render-context2d.d.ts +1 -1
  604. package/dist/render/render-context2d.js.map +1 -1
  605. package/dist/render/render-issue.d.ts +39 -0
  606. package/dist/render/render-issue.d.ts.map +1 -0
  607. package/dist/render/render-issue.js +29 -0
  608. package/dist/render/render-issue.js.map +1 -0
  609. package/dist/render/surface.d.ts +2 -2
  610. package/dist/render/surface.js.map +1 -1
  611. package/dist/render/text-defaults.js.map +1 -1
  612. package/dist/render/text-layout.js.map +1 -1
  613. package/dist/render3d/bounds3d.js.map +1 -1
  614. package/dist/render3d/builders.js.map +1 -1
  615. package/dist/render3d/camera.js.map +1 -1
  616. package/dist/render3d/fill3d.js.map +1 -1
  617. package/dist/render3d/geometry.js.map +1 -1
  618. package/dist/render3d/graphics3d.d.ts.map +1 -1
  619. package/dist/render3d/graphics3d.js +54 -5
  620. package/dist/render3d/graphics3d.js.map +1 -1
  621. package/dist/render3d/index.js.map +1 -1
  622. package/dist/render3d/inert.js.map +1 -1
  623. package/dist/render3d/light.js.map +1 -1
  624. package/dist/render3d/material.js.map +1 -1
  625. package/dist/render3d/matrix4.js.map +1 -1
  626. package/dist/render3d/render-context3d.js.map +1 -1
  627. package/dist/render3d/resources.js.map +1 -1
  628. package/dist/render3d/rounded-box.js.map +1 -1
  629. package/dist/render3d/scene-settings.js.map +1 -1
  630. package/dist/render3d/scene3d.js.map +1 -1
  631. package/dist/render3d/segments.js.map +1 -1
  632. package/dist/render3d/texture.js.map +1 -1
  633. package/dist/render3d/tracking.js.map +1 -1
  634. package/dist/render3d/transform.js.map +1 -1
  635. package/dist/render3d/vector3.js.map +1 -1
  636. package/dist/render3d/walk.js.map +1 -1
  637. package/dist/runtime/asset-refine.js +2 -1
  638. package/dist/runtime/asset-refine.js.map +1 -1
  639. package/dist/runtime/asset-timeline.d.ts +10 -0
  640. package/dist/runtime/asset-timeline.d.ts.map +1 -1
  641. package/dist/runtime/asset-timeline.js.map +1 -1
  642. package/dist/runtime/asset-update.d.ts.map +1 -1
  643. package/dist/runtime/asset-update.js +7 -0
  644. package/dist/runtime/asset-update.js.map +1 -1
  645. package/dist/runtime/audio-index.js.map +1 -1
  646. package/dist/runtime/builtin-context.js.map +1 -1
  647. package/dist/runtime/clip-instance.d.ts +3 -1
  648. package/dist/runtime/clip-instance.d.ts.map +1 -1
  649. package/dist/runtime/clip-instance.js +4 -0
  650. package/dist/runtime/clip-instance.js.map +1 -1
  651. package/dist/runtime/clip-store.d.ts.map +1 -1
  652. package/dist/runtime/clip-store.js +17 -2
  653. package/dist/runtime/clip-store.js.map +1 -1
  654. package/dist/runtime/engine.d.ts +5 -3
  655. package/dist/runtime/engine.d.ts.map +1 -1
  656. package/dist/runtime/engine.js +2 -1
  657. package/dist/runtime/engine.js.map +1 -1
  658. package/dist/runtime/frame-time.js.map +1 -1
  659. package/dist/runtime/index.js.map +1 -1
  660. package/dist/runtime/node-picking.js.map +1 -1
  661. package/dist/runtime/node-picking3d.js.map +1 -1
  662. package/dist/runtime/placement.js.map +1 -1
  663. package/dist/runtime/playback-controller.d.ts.map +1 -1
  664. package/dist/runtime/playback-controller.js +14 -4
  665. package/dist/runtime/playback-controller.js.map +1 -1
  666. package/dist/runtime/playback.js.map +1 -1
  667. package/dist/runtime/precompisition.js.map +1 -1
  668. package/dist/runtime/project-assets.js.map +1 -1
  669. package/dist/runtime/session.d.ts +7 -3
  670. package/dist/runtime/session.d.ts.map +1 -1
  671. package/dist/runtime/session.js +11 -4
  672. package/dist/runtime/session.js.map +1 -1
  673. package/dist/runtime/settle.js.map +1 -1
  674. package/dist/runtime/state-evaluator.js.map +1 -1
  675. package/dist/runtime/text-geometry.d.ts +1 -1
  676. package/dist/runtime/text-geometry.js.map +1 -1
  677. package/dist/sdk/index.d.ts +8 -6
  678. package/dist/sdk/index.d.ts.map +1 -1
  679. package/dist/sdk/index.js +10 -3
  680. package/dist/sdk/index.js.map +1 -1
  681. package/dist/tween/command-decorator.d.ts +7 -0
  682. package/dist/tween/command-decorator.d.ts.map +1 -1
  683. package/dist/tween/command-decorator.js +1 -0
  684. package/dist/tween/command-decorator.js.map +1 -1
  685. package/dist/tween/command.js.map +1 -1
  686. package/dist/tween/ease/constants.js.map +1 -1
  687. package/dist/tween/ease/curve.js.map +1 -1
  688. package/dist/tween/ease/describe.d.ts +2 -0
  689. package/dist/tween/ease/describe.d.ts.map +1 -1
  690. package/dist/tween/ease/describe.js +4 -0
  691. package/dist/tween/ease/describe.js.map +1 -1
  692. package/dist/tween/ease/spec.d.ts +31 -0
  693. package/dist/tween/ease/spec.d.ts.map +1 -0
  694. package/dist/tween/ease/spec.js +51 -0
  695. package/dist/tween/ease/spec.js.map +1 -0
  696. package/dist/tween/ease/type.js.map +1 -1
  697. package/dist/tween/index.d.ts +1 -0
  698. package/dist/tween/index.d.ts.map +1 -1
  699. package/dist/tween/index.js +1 -0
  700. package/dist/tween/index.js.map +1 -1
  701. package/dist/tween/inert.js.map +1 -1
  702. package/dist/tween/lerp.js.map +1 -1
  703. package/dist/tween/loop.js.map +1 -1
  704. package/dist/tween/prepare.js.map +1 -1
  705. package/dist/tween/stepper.js.map +1 -1
  706. package/dist/tween/to-command.js.map +1 -1
  707. package/dist/util/clamp.js.map +1 -1
  708. package/dist/util/context.js.map +1 -1
  709. package/dist/util/csv.js.map +1 -1
  710. package/dist/util/generateList.js.map +1 -1
  711. package/dist/util/index.js.map +1 -1
  712. package/dist/util/metrics.js.map +1 -1
  713. package/dist/util/random.js.map +1 -1
  714. package/dist/util/reference.js.map +1 -1
  715. package/dist/util/scheduler.js.map +1 -1
  716. package/package.json +2 -2
  717. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  718. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  719. package/dist/attributes/audio/filters/chain.js +0 -104
  720. package/dist/attributes/audio/filters/chain.js.map +0 -1
  721. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  722. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  723. package/dist/attributes/audio/filters/curve.js +0 -250
  724. package/dist/attributes/audio/filters/curve.js.map +0 -1
  725. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  726. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  727. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  728. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  729. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  730. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  731. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  732. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  733. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  734. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  735. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  736. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  737. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  738. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  739. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  740. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  741. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  742. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  743. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  744. package/dist/attributes/audio/filters/index.d.ts +0 -22
  745. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  746. package/dist/attributes/audio/filters/index.js +0 -8
  747. package/dist/attributes/audio/filters/index.js.map +0 -1
  748. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  749. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  750. package/dist/attributes/audio/filters/registry.js +0 -82
  751. package/dist/attributes/audio/filters/registry.js.map +0 -1
  752. package/dist/attributes/audio/filters/union.d.ts +0 -18
  753. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  754. package/dist/attributes/audio/filters/union.js +0 -28
  755. package/dist/attributes/audio/filters/union.js.map +0 -1
  756. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  757. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  758. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  759. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  760. package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
  761. package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
  762. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  763. package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
  764. package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
  765. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  766. package/dist/component/api.d.ts +0 -508
  767. package/dist/component/api.d.ts.map +0 -1
  768. package/dist/component/api.js +0 -4
  769. package/dist/component/api.js.map +0 -1
  770. package/dist/component/builtins/audio.d.ts +0 -26
  771. package/dist/component/builtins/audio.d.ts.map +0 -1
  772. package/dist/component/builtins/audio.js +0 -41
  773. package/dist/component/builtins/audio.js.map +0 -1
  774. package/dist/component/builtins/canvas3d.d.ts +0 -98
  775. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  776. package/dist/component/builtins/canvas3d.js +0 -21
  777. package/dist/component/builtins/canvas3d.js.map +0 -1
  778. package/dist/component/builtins/composite.d.ts +0 -56
  779. package/dist/component/builtins/composite.d.ts.map +0 -1
  780. package/dist/component/builtins/composite.js +0 -25
  781. package/dist/component/builtins/composite.js.map +0 -1
  782. package/dist/component/builtins/geometry.d.ts +0 -505
  783. package/dist/component/builtins/geometry.d.ts.map +0 -1
  784. package/dist/component/builtins/geometry.js +0 -107
  785. package/dist/component/builtins/geometry.js.map +0 -1
  786. package/dist/component/builtins/layout.d.ts +0 -88
  787. package/dist/component/builtins/layout.d.ts.map +0 -1
  788. package/dist/component/builtins/layout.js +0 -84
  789. package/dist/component/builtins/layout.js.map +0 -1
  790. package/dist/component/builtins/media.d.ts +0 -95
  791. package/dist/component/builtins/media.d.ts.map +0 -1
  792. package/dist/component/builtins/media.js +0 -149
  793. package/dist/component/builtins/media.js.map +0 -1
  794. package/dist/component/builtins/providers.d.ts +0 -23
  795. package/dist/component/builtins/providers.d.ts.map +0 -1
  796. package/dist/component/builtins/providers.js +0 -30
  797. package/dist/component/builtins/providers.js.map +0 -1
  798. package/dist/component/builtins/text.d.ts +0 -193
  799. package/dist/component/builtins/text.d.ts.map +0 -1
  800. package/dist/component/builtins/text.js +0 -113
  801. package/dist/component/builtins/text.js.map +0 -1
  802. package/dist/component/builtins/three.d.ts +0 -1085
  803. package/dist/component/builtins/three.d.ts.map +0 -1
  804. package/dist/component/builtins/three.js +0 -265
  805. package/dist/component/builtins/three.js.map +0 -1
  806. package/dist/component/clip-of.d.ts +0 -5
  807. package/dist/component/clip-of.d.ts.map +0 -1
  808. package/dist/component/clip-of.js +0 -33
  809. package/dist/component/clip-of.js.map +0 -1
  810. package/dist/component/commands-for.d.ts +0 -19
  811. package/dist/component/commands-for.d.ts.map +0 -1
  812. package/dist/component/commands-for.js +0 -5
  813. package/dist/component/commands-for.js.map +0 -1
  814. package/dist/component/component-audio.d.ts +0 -9
  815. package/dist/component/component-audio.d.ts.map +0 -1
  816. package/dist/component/component-audio.js +0 -18
  817. package/dist/component/component-audio.js.map +0 -1
  818. package/dist/component/component2d.d.ts +0 -9
  819. package/dist/component/component2d.d.ts.map +0 -1
  820. package/dist/component/component2d.js +0 -239
  821. package/dist/component/component2d.js.map +0 -1
  822. package/dist/component/component3d.d.ts +0 -9
  823. package/dist/component/component3d.d.ts.map +0 -1
  824. package/dist/component/component3d.js +0 -99
  825. package/dist/component/component3d.js.map +0 -1
  826. package/dist/component/factory.d.ts +0 -63
  827. package/dist/component/factory.d.ts.map +0 -1
  828. package/dist/component/factory.js +0 -313
  829. package/dist/component/factory.js.map +0 -1
  830. package/dist/component/modules/aim.d.ts +0 -30
  831. package/dist/component/modules/aim.d.ts.map +0 -1
  832. package/dist/component/modules/aim.js +0 -39
  833. package/dist/component/modules/aim.js.map +0 -1
  834. package/dist/component/modules/corners.d.ts +0 -13
  835. package/dist/component/modules/corners.d.ts.map +0 -1
  836. package/dist/component/modules/corners.js +0 -12
  837. package/dist/component/modules/corners.js.map +0 -1
  838. package/dist/component/modules/flow.d.ts +0 -26
  839. package/dist/component/modules/flow.d.ts.map +0 -1
  840. package/dist/component/modules/flow.js +0 -55
  841. package/dist/component/modules/flow.js.map +0 -1
  842. package/dist/component/modules/material.d.ts +0 -40
  843. package/dist/component/modules/material.d.ts.map +0 -1
  844. package/dist/component/modules/material.js +0 -75
  845. package/dist/component/modules/material.js.map +0 -1
  846. package/dist/component/modules/paint.d.ts +0 -71
  847. package/dist/component/modules/paint.d.ts.map +0 -1
  848. package/dist/component/modules/paint.js +0 -106
  849. package/dist/component/modules/paint.js.map +0 -1
  850. package/dist/component/modules/shapes.d.ts +0 -31
  851. package/dist/component/modules/shapes.d.ts.map +0 -1
  852. package/dist/component/modules/shapes.js +0 -43
  853. package/dist/component/modules/shapes.js.map +0 -1
  854. package/dist/component/modules/text-layout.d.ts +0 -26
  855. package/dist/component/modules/text-layout.d.ts.map +0 -1
  856. package/dist/component/modules/text-layout.js +0 -57
  857. package/dist/component/modules/text-layout.js.map +0 -1
  858. package/dist/component/modules/text-style.d.ts +0 -48
  859. package/dist/component/modules/text-style.d.ts.map +0 -1
  860. package/dist/component/modules/text-style.js +0 -63
  861. package/dist/component/modules/text-style.js.map +0 -1
  862. package/dist/component/modules/three-entries.d.ts +0 -23
  863. package/dist/component/modules/three-entries.d.ts.map +0 -1
  864. package/dist/component/modules/three-entries.js +0 -41
  865. package/dist/component/modules/three-entries.js.map +0 -1
  866. package/dist/component/modules/view3d.d.ts +0 -55
  867. package/dist/component/modules/view3d.d.ts.map +0 -1
  868. package/dist/component/modules/view3d.js +0 -160
  869. package/dist/component/modules/view3d.js.map +0 -1
  870. package/dist/component/timeline.d.ts +0 -22
  871. package/dist/component/timeline.d.ts.map +0 -1
  872. package/dist/component/timeline.js +0 -128
  873. package/dist/component/timeline.js.map +0 -1
  874. package/dist/component/type-def.d.ts +0 -26
  875. package/dist/component/type-def.d.ts.map +0 -1
  876. package/dist/component/type-def.js +0 -16
  877. package/dist/component/type-def.js.map +0 -1
  878. package/dist/component/types.d.ts +0 -91
  879. package/dist/component/types.d.ts.map +0 -1
  880. package/dist/component/types.js +0 -88
  881. package/dist/component/types.js.map +0 -1
  882. package/dist/component/views.d.ts +0 -121
  883. package/dist/component/views.d.ts.map +0 -1
  884. package/dist/component/views.js +0 -413
  885. package/dist/component/views.js.map +0 -1
  886. package/dist/document/withdraw.d.ts +0 -28
  887. package/dist/document/withdraw.d.ts.map +0 -1
  888. package/dist/document/withdraw.js +0 -61
  889. package/dist/document/withdraw.js.map +0 -1
  890. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  891. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  892. package/dist/jsx/jsx-dev-runtime.js +0 -3
  893. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  894. package/dist/jsx/jsx-runtime.d.ts +0 -27
  895. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  896. package/dist/jsx/jsx-runtime.js +0 -26
  897. package/dist/jsx/jsx-runtime.js.map +0 -1
  898. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  899. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  900. package/dist/nodes/2d/node-lifecycle.js +0 -264
  901. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  902. package/dist/nodes/2d/node-motion.d.ts +0 -56
  903. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  904. package/dist/nodes/2d/node-motion.js +0 -86
  905. package/dist/nodes/2d/node-motion.js.map +0 -1
  906. package/dist/nodes/2d/node-render.d.ts +0 -44
  907. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  908. package/dist/nodes/2d/node-render.js +0 -80
  909. package/dist/nodes/2d/node-render.js.map +0 -1
  910. package/dist/nodes/2d/node-space.d.ts +0 -63
  911. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  912. package/dist/nodes/2d/node-space.js +0 -131
  913. package/dist/nodes/2d/node-space.js.map +0 -1
  914. package/dist/nodes/2d/node-transform.d.ts +0 -55
  915. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  916. package/dist/nodes/2d/node-transform.js +0 -73
  917. package/dist/nodes/2d/node-transform.js.map +0 -1
  918. package/dist/nodes/2d/node2d.d.ts +0 -1111
  919. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  920. package/dist/nodes/2d/node2d.js +0 -1665
  921. package/dist/nodes/2d/node2d.js.map +0 -1
  922. package/dist/nodes/2d/paint-node.d.ts +0 -142
  923. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  924. package/dist/nodes/2d/paint-node.js +0 -232
  925. package/dist/nodes/2d/paint-node.js.map +0 -1
  926. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  927. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  928. package/dist/nodes/audio/audio-bus.js +0 -33
  929. package/dist/nodes/audio/audio-bus.js.map +0 -1
  930. package/dist/nodes/audio/index.d.ts +0 -4
  931. package/dist/nodes/audio/index.d.ts.map +0 -1
  932. package/dist/nodes/audio/index.js +0 -2
  933. package/dist/nodes/audio/index.js.map +0 -1
  934. package/dist/nodes/audio/node-audio.d.ts +0 -107
  935. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  936. package/dist/nodes/audio/node-audio.js +0 -179
  937. package/dist/nodes/audio/node-audio.js.map +0 -1
  938. package/dist/nodes/audio/sound-node.d.ts +0 -41
  939. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  940. package/dist/nodes/audio/sound-node.js +0 -71
  941. package/dist/nodes/audio/sound-node.js.map +0 -1
  942. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  943. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  944. package/dist/nodes/geometry/boolean-node.js +0 -81
  945. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  946. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  947. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  948. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  949. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  950. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  951. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  952. package/dist/nodes/geometry/box-path-node.js +0 -116
  953. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  954. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  955. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  956. package/dist/nodes/geometry/ellipse-node.js +0 -45
  957. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  958. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  959. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  960. package/dist/nodes/geometry/group-bounds.js +0 -87
  961. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  962. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  963. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  964. package/dist/nodes/geometry/mask-node.js +0 -66
  965. package/dist/nodes/geometry/mask-node.js.map +0 -1
  966. package/dist/nodes/geometry/path-node.d.ts +0 -26
  967. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  968. package/dist/nodes/geometry/path-node.js +0 -58
  969. package/dist/nodes/geometry/path-node.js.map +0 -1
  970. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  971. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  972. package/dist/nodes/geometry/polygon-node.js +0 -47
  973. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  974. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  975. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  976. package/dist/nodes/geometry/polygram-node.js +0 -52
  977. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  978. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  979. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  980. package/dist/nodes/geometry/rect-node.js +0 -56
  981. package/dist/nodes/geometry/rect-node.js.map +0 -1
  982. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  983. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  984. package/dist/nodes/geometry/shape-node.js +0 -140
  985. package/dist/nodes/geometry/shape-node.js.map +0 -1
  986. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  987. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  988. package/dist/nodes/geometry/shape-outline.js +0 -470
  989. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  990. package/dist/nodes/index.d.ts +0 -53
  991. package/dist/nodes/index.d.ts.map +0 -1
  992. package/dist/nodes/index.js +0 -35
  993. package/dist/nodes/index.js.map +0 -1
  994. package/dist/nodes/layout/camera-node.d.ts +0 -80
  995. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  996. package/dist/nodes/layout/camera-node.js +0 -153
  997. package/dist/nodes/layout/camera-node.js.map +0 -1
  998. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  999. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  1000. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  1001. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  1002. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  1003. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  1004. package/dist/nodes/layout/rotated-box.js +0 -76
  1005. package/dist/nodes/layout/rotated-box.js.map +0 -1
  1006. package/dist/nodes/media/video-node.d.ts +0 -229
  1007. package/dist/nodes/media/video-node.d.ts.map +0 -1
  1008. package/dist/nodes/media/video-node.js +0 -350
  1009. package/dist/nodes/media/video-node.js.map +0 -1
  1010. package/dist/nodes/node/declare-paints.d.ts +0 -19
  1011. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  1012. package/dist/nodes/node/declare-paints.js +0 -27
  1013. package/dist/nodes/node/declare-paints.js.map +0 -1
  1014. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  1015. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  1016. package/dist/nodes/node/node-editor-state.js +0 -23
  1017. package/dist/nodes/node/node-editor-state.js.map +0 -1
  1018. package/dist/nodes/node/node-reactive.d.ts +0 -89
  1019. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  1020. package/dist/nodes/node/node-reactive.js +0 -135
  1021. package/dist/nodes/node/node-reactive.js.map +0 -1
  1022. package/dist/nodes/node/node-time.d.ts +0 -39
  1023. package/dist/nodes/node/node-time.d.ts.map +0 -1
  1024. package/dist/nodes/node/node-time.js +0 -14
  1025. package/dist/nodes/node/node-time.js.map +0 -1
  1026. package/dist/nodes/node/node-walk.d.ts +0 -46
  1027. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  1028. package/dist/nodes/node/node-walk.js +0 -74
  1029. package/dist/nodes/node/node-walk.js.map +0 -1
  1030. package/dist/nodes/node/node.d.ts +0 -445
  1031. package/dist/nodes/node/node.d.ts.map +0 -1
  1032. package/dist/nodes/node/node.js +0 -745
  1033. package/dist/nodes/node/node.js.map +0 -1
  1034. package/dist/nodes/node/text-defaults.d.ts +0 -32
  1035. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  1036. package/dist/nodes/node/text-defaults.js +0 -37
  1037. package/dist/nodes/node/text-defaults.js.map +0 -1
  1038. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  1039. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  1040. package/dist/nodes/root/canvas2d-node.js +0 -264
  1041. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  1042. package/dist/nodes/root/provider-node.d.ts +0 -47
  1043. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  1044. package/dist/nodes/root/provider-node.js +0 -63
  1045. package/dist/nodes/root/provider-node.js.map +0 -1
  1046. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  1047. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  1048. package/dist/nodes/root/theme-provider-node.js +0 -43
  1049. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  1050. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  1051. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  1052. package/dist/nodes/text/default-text-style-node.js +0 -146
  1053. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  1054. package/dist/nodes/text/number-format.d.ts +0 -66
  1055. package/dist/nodes/text/number-format.d.ts.map +0 -1
  1056. package/dist/nodes/text/number-format.js +0 -227
  1057. package/dist/nodes/text/number-format.js.map +0 -1
  1058. package/dist/nodes/text/number-node.d.ts +0 -94
  1059. package/dist/nodes/text/number-node.d.ts.map +0 -1
  1060. package/dist/nodes/text/number-node.js +0 -86
  1061. package/dist/nodes/text/number-node.js.map +0 -1
  1062. package/dist/nodes/text/number-pattern.d.ts +0 -51
  1063. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  1064. package/dist/nodes/text/number-pattern.js +0 -77
  1065. package/dist/nodes/text/number-pattern.js.map +0 -1
  1066. package/dist/nodes/text/richtext-node.d.ts +0 -68
  1067. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  1068. package/dist/nodes/text/richtext-node.js +0 -78
  1069. package/dist/nodes/text/richtext-node.js.map +0 -1
  1070. package/dist/nodes/text/text-base.d.ts +0 -118
  1071. package/dist/nodes/text/text-base.d.ts.map +0 -1
  1072. package/dist/nodes/text/text-base.js +0 -153
  1073. package/dist/nodes/text/text-base.js.map +0 -1
  1074. package/dist/nodes/text/text-layout.d.ts +0 -87
  1075. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  1076. package/dist/nodes/text/text-layout.js +0 -368
  1077. package/dist/nodes/text/text-layout.js.map +0 -1
  1078. package/dist/nodes/text/text-node.d.ts +0 -84
  1079. package/dist/nodes/text/text-node.d.ts.map +0 -1
  1080. package/dist/nodes/text/text-node.js +0 -188
  1081. package/dist/nodes/text/text-node.js.map +0 -1
  1082. package/dist/nodes/text/text-selection.d.ts +0 -125
  1083. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  1084. package/dist/nodes/text/text-selection.js +0 -209
  1085. package/dist/nodes/text/text-selection.js.map +0 -1
  1086. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  1087. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  1088. package/dist/nodes/three/camera-nodes.js +0 -112
  1089. package/dist/nodes/three/camera-nodes.js.map +0 -1
  1090. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  1091. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  1092. package/dist/nodes/three/canvas3d-node.js +0 -486
  1093. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  1094. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  1095. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  1096. package/dist/nodes/three/drawable-nodes.js +0 -284
  1097. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  1098. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  1099. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  1100. package/dist/nodes/three/environment-nodes.js +0 -134
  1101. package/dist/nodes/three/environment-nodes.js.map +0 -1
  1102. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  1103. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  1104. package/dist/nodes/three/geometry-nodes.js +0 -322
  1105. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  1106. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  1107. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  1108. package/dist/nodes/three/grid-geometry3d.js +0 -114
  1109. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  1110. package/dist/nodes/three/group3d.d.ts +0 -23
  1111. package/dist/nodes/three/group3d.d.ts.map +0 -1
  1112. package/dist/nodes/three/group3d.js +0 -21
  1113. package/dist/nodes/three/group3d.js.map +0 -1
  1114. package/dist/nodes/three/light-nodes.d.ts +0 -120
  1115. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  1116. package/dist/nodes/three/light-nodes.js +0 -173
  1117. package/dist/nodes/three/light-nodes.js.map +0 -1
  1118. package/dist/nodes/three/mesh3d.d.ts +0 -117
  1119. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  1120. package/dist/nodes/three/mesh3d.js +0 -147
  1121. package/dist/nodes/three/mesh3d.js.map +0 -1
  1122. package/dist/nodes/three/node3d.d.ts +0 -230
  1123. package/dist/nodes/three/node3d.d.ts.map +0 -1
  1124. package/dist/nodes/three/node3d.js +0 -337
  1125. package/dist/nodes/three/node3d.js.map +0 -1
  1126. package/dist/render/descriptors/latex.d.ts +0 -6
  1127. package/dist/render/descriptors/latex.d.ts.map +0 -1
  1128. package/dist/render/descriptors/latex.js +0 -2
  1129. package/dist/render/descriptors/latex.js.map +0 -1
  1130. package/dist/tween/seekable.d.ts +0 -81
  1131. package/dist/tween/seekable.d.ts.map +0 -1
  1132. package/dist/tween/seekable.js +0 -137
  1133. package/dist/tween/seekable.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAsD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAW,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAe,MA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AAC;YACf,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,oFAAoF;QACpF,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;CACJ;AAED,cAAc,CAAC,IAAI,EAAE;IACjB,EAAE,EAAE,OAAO,EAAE;IACb,OAAO,EAAE,OAAO,EAAE;IAClB,UAAU,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { _observer, PropSlot } from \"@/props/slot\";\r\nimport { STRUCTURE_SLOT } from \"@/props/observer\";\r\nimport { PropHost, type PropCells } from \"@/props/host\";\r\nimport { EasingFunction } from \"@/tween/ease/type\";\r\nimport { toCommand } from \"@/tween/to-command\";\r\nimport { makeCommand, type Command, type CommandArgs, type CommandTarget } from \"@/tween/command\";\r\nimport { prepareNumericCellTween } from \"@/tween/prepare\";\r\nimport { inertCommand, inertStepper } from \"@/tween/inert\";\r\nimport { TweenStepper } from \"@/tween/stepper\";\r\nimport { RefTarget } from \"@/util/reference\";\r\nimport { Context, ContextMap } from \"@/util/context\";\r\nimport { AssetCatalog } from \"@/assets/catalog\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport { declareMembers, getPropertyMeta, PropOptions } from \"@/attributes/properties/decorator\";\r\nimport {\r\n applyProp,\r\n applySnapshotLayer,\r\n collectProperties,\r\n popState,\r\n restoreAnimated,\r\n saveState,\r\n} from \"./node-reactive\";\r\nimport type { PropLayer } from \"./node-reactive\";\r\nimport { advanceNodeTime, createNodeTime, type MutableNodeTime, type NodeTime } from \"@/components/trees/node/node-time\";\r\nimport type { PropInputs } from \"@/attributes/properties/inputs\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\nexport type { NodeTime } from \"@/components/trees/node/node-time\";\r\nexport type { PropInput, PropInputs } from \"@/attributes/properties/inputs\";\r\n\r\n/** Which scene graph a node belongs to. See {@link Node.dimension}. */\r\nexport type NodeDimension = \"2d\" | \"3d\" | \"audio\";\r\n\r\n/** Where a node of each dimension is allowed to live, for the mismatch error. */\r\nconst HOSTS_OF: Record<NodeDimension, string> = {\r\n \"2d\": \"2D nodes go in the 2D tree, or inside a Canvas3D as a HUD over its scene.\",\r\n \"3d\": \"Put 3D nodes inside a Canvas3D, which is the one node that holds both.\",\r\n audio: \"Put audio nodes under an AudioBus, or directly on the scene root.\",\r\n};\r\n\r\nexport interface NodeMetadata<T extends Node> {\r\n /**\r\n * Handle written with this node at construction. Typed as {@link RefTarget}\r\n * rather than `Reference<T>` so a ref declared as one of `T`'s *supertypes*\r\n * is accepted (`createRef<Node2D>()` on a `<Rect>`) — see the note there\r\n * for why that direction is the sound one.\r\n */\r\n ref?: RefTarget<T>;\r\n}\r\n\r\nexport type NodeConfig<T extends Node, P> = PropInputs<P> & NodeMetadata<T>;\r\n\r\n/**\r\n * Everything {@link Node.attach} needs to put a subtree into a live scene.\r\n *\r\n * The three things tree membership supplies, and the only three: what assets are\r\n * available, what context the ancestors provide, and where the playhead is.\r\n */\r\nexport interface AttachScope {\r\n /** Metadata for the assets this scene may declare. */\r\n assets: AssetCatalog;\r\n /** The token map the parent provides to this node. */\r\n context: ContextMap;\r\n /** Clip-relative time, in seconds. */\r\n time: number;\r\n}\r\n\r\n/**\r\n * A `children` child: a single {@link Node}, an arbitrarily-nested array of\r\n * children, or a falsy value. Nesting is allowed so `.map()` results can be\r\n * dropped straight in as a child, and falsy values are allowed so\r\n * `condition && Rect({ … })` works — the constructor flattens\r\n * (`.flat(Infinity)`) and filters out everything but `Node` instances.\r\n */\r\nexport type NodeChildren = Node | false | null | undefined | NodeChildren[];\r\n\r\n/**\r\n * The props every node has, in either dimension.\r\n *\r\n * Deliberately tiny. Everything that reads as \"a box on a page\" — `x`/`y`,\r\n * `width`/`height`, `padding`, `flex`, anchors, `opacity` — lives on\r\n * {@link Node2DProps}, and everything that reads as \"a thing in space\" —\r\n * `position`, `quaternion`, `castShadow` — lives on `Node3DProps`, because a\r\n * prop that means nothing for half the tree is worse than no prop at all.\r\n */\r\nexport interface NodeProps {\r\n children: NodeChildren;\r\n /**\r\n * Seeds {@link Node.id}. A document's `NodeSpec.id` supplies it — see\r\n * `Registry.instantiate` — so an instantiated node answers to the identity\r\n * its row was authored under. Left out, the node falls back to a UUID, which\r\n * is what every hand-written `new Rect({…})` and component call gets.\r\n */\r\n id?: string;\r\n /**\r\n * The handle a node is *referenced by*, as against {@link NodeProps.id},\r\n * which addresses it. `\"=[card.x]\"` in any prop reads the `x` of the node\r\n * keyed `card` — see `NodeSpec.key`.\r\n *\r\n * Optional and never generated — a node has one only because an author wrote\r\n * one, which is what makes it safe to point a formula at — and unique per\r\n * document, which `document/validate.ts` enforces.\r\n */\r\n key?: string;\r\n}\r\n\r\n/**\r\n * The dimension-agnostic base of the scene graph: tree, identity, reactive\r\n * properties, commands, context, clock, asset declaration, teardown. Nothing\r\n * about *where* a node is or *how* it draws — that's {@link Node2D} / `Node3D`.\r\n * They meet only at `Canvas3D`; mixing them anywhere else throws (see\r\n * {@link acceptsChild}).\r\n *\r\n * Subclasses call {@link initProps} from their own constructor rather than the\r\n * base doing it: a subclass's field initializers only run *after* `super()`\r\n * returns, so applying `property` defaults any earlier would write into cells\r\n * that don't exist yet.\r\n */\r\nexport abstract class Node<P extends NodeProps = NodeProps> implements PropHost {\r\n /**\r\n * Which scene graph this node belongs to.\r\n *\r\n * A getter rather than a field so it is answerable from the prototype during\r\n * construction, before any subclass field initializer has run.\r\n */\r\n abstract get dimension(): NodeDimension;\r\n\r\n /** The trees this type takes children from, answerable from the prototype as {@link dimension} is. */\r\n get _childTrees(): readonly NodeDimension[] {\r\n return [this.dimension];\r\n }\r\n\r\n constructor(props?: NodeConfig<any, P>) {\r\n // Retain the raw props (see _props doc) so a provider's provideContext can\r\n // read which keys the author passed. Captured before any default\r\n // application so it reflects exactly what the author passed. The object is\r\n // retained by reference, so a subclass expanding prop sugar in place\r\n // afterwards (`size`, `transform3D`) is reflected here too.\r\n this._props = props;\r\n // Neither is a property: identity does not tween, so neither has any\r\n // business in the table `set()`, `to()` and the baseline restore walk\r\n // iterate.\r\n const identity = props as { id?: string; key?: string } | undefined;\r\n this.key = identity?.key;\r\n // Nullish, never falsy: `\"\"` is the scene root's real id, not a missing\r\n // one (`checkRootShape` in document/validate.ts defines the root as the\r\n // row holding it), and a UUID in its place would have the host's tree\r\n // report a root no document row mentions.\r\n this.id = identity?.id ?? crypto.randomUUID();\r\n }\r\n\r\n /** See {@link NodeProps.key}. */\r\n key?: string;\r\n\r\n private _hidden = false;\r\n private _locked = false;\r\n\r\n /**\r\n * Hidden by the editor — no paint, no pick, no layout slot. See\r\n * {@link NodeEditorState.hidden}.\r\n */\r\n get hidden(): boolean {\r\n return this._hidden;\r\n }\r\n\r\n /** Locked by the editor — unpickable, but drawn. See {@link NodeEditorState.locked}. */\r\n get locked(): boolean {\r\n return this._locked;\r\n }\r\n\r\n /**\r\n * @internal — written only by `applyEditorStates`, which owns both flags for\r\n * the whole tree. Not a setter pair, so a caller cannot set one and leave the\r\n * other holding a previous frame's answer.\r\n */\r\n _setEditorState(hidden: boolean, locked: boolean): void {\r\n this._hidden = hidden;\r\n this._locked = locked;\r\n }\r\n\r\n /**\r\n * Fire the `ref` and apply every declared property, reading\r\n * initial values from `props`.\r\n *\r\n * Called by the concrete constructor ({@link Node2D}'s, `Node3D`'s) rather\r\n * than by this one, because a subclass's field initializers run *after*\r\n * `super()` returns: doing this here would apply props while the cells those\r\n * props write into are still `undefined`.\r\n */\r\n protected initProps(props?: NodeConfig<any, P>): void {\r\n if (props?.ref) {\r\n props.ref(this as any);\r\n }\r\n\r\n // Apply every declared property, reading initial values from props.\r\n for (const meta of getPropertyMeta(this)) {\r\n const propsVal = props ? (props as any)[meta.key] : undefined;\r\n const initial = propsVal !== undefined ? propsVal : meta.default;\r\n this.applyProp(meta.key, initial, meta.options);\r\n }\r\n }\r\n\r\n /**\r\n * Adopt the `children` prop. Called by the concrete constructor after its own\r\n * defaults are in place, so a child never lands in a tree whose parent has not\r\n * finished sizing itself.\r\n */\r\n protected adoptChildrenProp(props?: NodeConfig<any, P>): void {\r\n if (props && (props as any).children) {\r\n const raw = Array.isArray((props as any).children) ? (props as any).children : [(props as any).children];\r\n const flat = (raw as unknown[]).flat(Infinity)\r\n .filter((c: unknown): c is Node => c instanceof Node);\r\n if (flat.length > 0) this._addChildren(flat);\r\n }\r\n }\r\n\r\n /**\r\n * Whether `child` may be adopted by this node.\r\n *\r\n * A node holds children of its own dimension; the places the trees meet are\r\n * `Canvas3D`, which takes 2D and 3D, and `Canvas2D`, which takes 2D and\r\n * audio. Both partition what they accept. Rejecting the mix here rather than\r\n * letting it through is deliberate: a `Box3D` parented to a `Rect` would be\r\n * silently skipped by both the layout walk and the 3D walk, and would simply\r\n * never appear.\r\n */\r\n protected acceptsChild(child: Node): boolean {\r\n return child.dimension === this.dimension;\r\n }\r\n\r\n /** Throw if `child` cannot go here: by its tree, by what this node takes, or by where the child says it goes. */\r\n protected assertAcceptsChild(child: Node): void {\r\n if (!this.acceptsChild(child)) {\r\n const why = child.dimension === this.dimension ? this._childRule() : HOSTS_OF[child.dimension];\r\n throw new TypeError(`${this.className} (${this.dimension}) cannot hold ${child.className} (${child.dimension}).${why ? ` ${why}` : \"\"}`);\r\n }\r\n const refusal = child._parentRefusal(this);\r\n if (refusal) throw new TypeError(refusal);\r\n }\r\n\r\n /** What this node takes, for the error when it refuses a child of its own tree. */\r\n protected _childRule(): string {\r\n return \"\";\r\n }\r\n\r\n /** Why this node cannot go inside `parent`, or `null`: only a node that names its parents refuses one. */\r\n _parentRefusal(_parent: Node): string | null {\r\n return null;\r\n }\r\n\r\n private _assets: AssetCatalog | null = null;\r\n protected _parent: Node | null = null;\r\n\r\n /**\r\n * Whether this node is in a live scene tree. Gates measure/layout/render,\r\n * asset declaration and every command — checked at the handful of places\r\n * the framework dispatches from, not per method.\r\n */\r\n private _mounted = false;\r\n\r\n /** See {@link _mounted}. */\r\n get mounted(): boolean {\r\n return this._mounted;\r\n }\r\n\r\n get parent(): Node | null {\r\n if (_observer !== null) _observer.read(this._structureSlot());\r\n return this._parent;\r\n }\r\n\r\n get assets(): AssetCatalog {\r\n if (!this._assets) throw new Error(\"Assets not bound — this node is not attached to a scene. See Node.attach().\");\r\n return this._assets;\r\n }\r\n\r\n /** Token→value map pushed down from ancestor providers, bound by {@link attach}. */\r\n private _context: ContextMap = ContextMap.EMPTY;\r\n /** True once {@link attach} has reached this node. */\r\n private _contextBound = false;\r\n\r\n /** Raw constructor props, retained so {@link provideContext} can see which keys were explicitly passed. Kept through {@link dispose} so a reused instance re-derives context on the next attach. */\r\n protected _props?: NodeConfig<any, P>;\r\n\r\n /** Read the nearest ancestor provider's value for `ctx` (or its default). */\r\n useContext<T>(ctx: Context<T>): T {\r\n return this._context.get(ctx);\r\n }\r\n\r\n /** Assigned in the constructor — see {@link NodeProps.id}. */\r\n readonly id: string;\r\n\r\n /**\r\n * The slots behind this node's `property` fields. See {@link PropCells}.\r\n *\r\n * @internal — the authoring surface is the declared props themselves, plus\r\n * `set()`/`to()`/`captureProps()`.\r\n */\r\n __cells?: PropCells;\r\n\r\n protected _children: Node[] = [];\r\n\r\n /**\r\n * Flatten a constructor's raw `children` prop into the `Node` instances it\r\n * contains, without mutating or adding them — the same normalisation the\r\n * constructor applies before adding them, exposed standalone so\r\n * {@link applyDefaultSize} overrides can inspect children's own resolved\r\n * `width`/`height` *before* they're attached (children are constructed,\r\n * defaults and all, before being passed in as props).\r\n */\r\n protected static flattenChildrenProp(props: { children?: unknown } | undefined): Node[] {\r\n const childProp = props ? props.children : undefined;\r\n if (!childProp) return [];\r\n const raw = Array.isArray(childProp) ? childProp : [childProp];\r\n return (raw as unknown[]).flat(Infinity).filter((c: unknown): c is Node => c instanceof Node);\r\n }\r\n\r\n // ---- Reactive properties ----------------------------------------------\r\n\r\n /**\r\n * Declare a prop on this node. Creates a {@link PropSlot}-backed accessor\r\n * for `field`, applies an initial value (callback → binding; otherwise\r\n * constant), and registers optional tween/mapper metadata used by `set()`\r\n * and `to()`.\r\n *\r\n * Subsequent calls for the same field reuse the existing slot and act as\r\n * a value assignment, so subclasses can override a parent's default by\r\n * calling applyProp again without losing the slot or its bindings.\r\n */\r\n protected applyProp<Ext, Int = Ext>(\r\n field: string,\r\n initial: Ext | (() => Ext) | undefined,\r\n options?: PropOptions<Ext, Int>,\r\n ): void {\r\n applyProp(this, field, initial, options);\r\n }\r\n\r\n /** @internal Hot-path prop write (mapper- and binding-aware). Public-but-underscored like `_prepareStep` so reactive companions in this directory can call it; not part of the authoring surface. */\r\n _writeProp(field: string, value: unknown): void {\r\n if (value === undefined) return;\r\n const slot = this.__cells?.slots.get(field);\r\n if (!slot) return;\r\n const mapper = this.__cells?.mappers?.get(field);\r\n if (typeof value === \"function\") {\r\n const extFn = value as () => any;\r\n if (mapper) {\r\n // A binding that reads `undefined` — a node reference to a node that is\r\n // not there — leaves the prop as a node built without it, and never\r\n // reaches the mapper, which holds the shape the prop's readers go through.\r\n let unset: { value: unknown } | undefined;\r\n slot.bind(() => {\r\n const read = extFn();\r\n return read === undefined\r\n ? (unset ??= { value: this._unsetValue(field, mapper) }).value\r\n : mapper(read, slot.get());\r\n });\r\n } else {\r\n slot.bind(extFn);\r\n }\r\n } else {\r\n slot.set(mapper ? mapper(value, slot.get()) : value);\r\n }\r\n }\r\n\r\n get properties(): P {\r\n return collectProperties(this) as P;\r\n }\r\n\r\n /**\r\n * This node's **class** name, for a message or a host's type column. Not an\r\n * authored identity — those are {@link id} and {@link key}, and nothing in\r\n * the document model is called a name any more. Nor is it the registry key a\r\n * document writes in `NodeSpec.type`: a minifier is free to rename a class.\r\n */\r\n get className(): string {\r\n return this.constructor.name;\r\n }\r\n\r\n set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\r\n const slots = this.__cells?.slots;\r\n if (!slots) return;\r\n // Iterate the caller's keys (usually 1–3) rather than every registered\r\n // prop (15+): set() runs in the per-frame hot path. Only keys backed by\r\n // a slot are written; unknown keys are ignored — which is also what\r\n // lets a subclass distribute its own sugar (2D's `size`, `transform3D`)\r\n // into real keys and then delegate here.\r\n for (const key in props) {\r\n const val = (props as any)[key];\r\n if (val !== undefined && slots.has(key)) this._writeProp(key, val);\r\n }\r\n }\r\n\r\n to<D extends Partial<P> = Partial<P>>(args: CommandArgs<D> & { duration: number }): Command<P> {\r\n return toCommand<P>(this, args.data ?? {}, args.duration, args.easing);\r\n }\r\n\r\n /**\r\n * Build a {@link Command} from a pure function of normalized time — an\r\n * animation this node can be *evaluated* at, not only run through. The pair\r\n * to {@link to}, for the built-in commands whose values at `t` are not a prop\r\n * list, and what a component command's timeline lowers to.\r\n *\r\n * Snapshot whatever the animation starts from *outside* `at`: reading a prop\r\n * inside it would re-read the value the command is itself writing.\r\n */\r\n protected command<Props = P>(\r\n at: (t: number) => Partial<Props>,\r\n duration: number = 1,\r\n easing?: EasingFunction,\r\n ): Command<Props> {\r\n if (!this._mounted) return inertCommand<Props>(this, duration);\r\n return makeCommand<Props>(\r\n this as unknown as CommandTarget<Props>,\r\n at,\r\n duration,\r\n easing,\r\n );\r\n }\r\n\r\n /**\r\n * Resolve a single `to()` step into a flat {@link TweenStepper} — all the\r\n * per-key setup (mapper, numeric-vs-custom routing) happens once here, then\r\n * `advance(dt)` is allocation-free. Used by both a chain's iterator path and\r\n * the batched `parallel` path.\r\n *\r\n * A subclass with positional sugar of its own (2D's `size` and anchors)\r\n * expands `to` in place and then delegates here.\r\n */\r\n _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\r\n if (!this._mounted) return inertStepper(duration);\r\n // A tween runs in stored space, so the destination is mapped once, here,\r\n // and every step after it is a stored value written to the slot as it is.\r\n // Writing a step through the setter would map it a second time, which only\r\n // an idempotent mapper survives.\r\n const numCells: PropSlot<number>[] = [];\r\n const numFrom: number[] = [];\r\n const numEnd: number[] = [];\r\n const customLerps: Array<(t: number) => void> = [];\r\n const stringSnaps: Array<[PropSlot<string>, string]> = [];\r\n\r\n for (const key of Object.keys(to)) {\r\n const slot = this.__cells?.slots.get(key);\r\n if (!slot) continue;\r\n const extVal = (to as any)[key];\r\n const mapper = this.__cells?.mappers?.get(key);\r\n const targetVal = mapper ? mapper(extVal, (this as any)[key]) : extVal;\r\n const tweenFn = this.__cells?.tweens?.get(key);\r\n if (tweenFn) {\r\n const from = (this as any)[key];\r\n customLerps.push((t) => {\r\n slot.set(tweenFn(from, targetVal, t));\r\n });\r\n } else if (typeof targetVal === 'number') {\r\n numCells.push(slot as PropSlot<number>);\r\n numFrom.push((this as any)[key] as number);\r\n numEnd.push(targetVal as number);\r\n } else if (typeof targetVal === 'string') {\r\n stringSnaps.push([slot as PropSlot<string>, targetVal]);\r\n }\r\n }\r\n\r\n const lerp = prepareNumericCellTween(numCells, numFrom, numEnd);\r\n const hasCustom = customLerps.length > 0;\r\n const hasSnaps = stringSnaps.length > 0;\r\n\r\n const apply = (t: number): void => {\r\n const easedT = easing ? easing(t) : t;\r\n lerp(easedT);\r\n if (hasCustom) for (const fn of customLerps) fn(easedT);\r\n // A discrete prop has nothing between its endpoints, so it snaps at\r\n // the end rather than interpolating. Applied here rather than only in\r\n // `advance` because a `seek` past the end has, by definition, reached\r\n // that end — leaving it out meant `seek(duration)` and running to\r\n // `duration` produced different nodes, and only the second was right.\r\n if (hasSnaps && t >= 1) for (const [slot, val] of stringSnaps) slot.set(val);\r\n };\r\n\r\n let elapsed = 0;\r\n return {\r\n // Tracks `elapsed`, so a seek and a subsequent advance agree about\r\n // where the tween is. Without it, seeking forward then advancing\r\n // rewound to `dt`.\r\n seek: (e: number) => {\r\n elapsed = e;\r\n apply(duration > 0 ? Math.min(e / duration, 1) : 1);\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n if (elapsed < duration) {\r\n apply(elapsed / duration);\r\n return false;\r\n }\r\n apply(1);\r\n return true;\r\n },\r\n };\r\n }\r\n\r\n /** What a node constructed without `field` holds: its declared default, through the mapper. */\r\n private _unsetValue(field: string, mapper: (ext: any, prev?: any) => any): unknown {\r\n const declared = getPropertyMeta(this).find((meta) => meta.key === field)?.default;\r\n const initial = typeof declared === \"function\" ? declared() : declared;\r\n return initial === undefined ? undefined : mapper(initial, undefined);\r\n }\r\n\r\n // ---- State stack (save / restore) -------------------------------------\r\n // A per-node LIFO stack of property snapshots, mirroring Motion Canvas's\r\n // node.save()/restore(). `save()` pushes a snapshot of every declared prop;\r\n // `restore()` pops the most recent one and either snaps to it (no duration)\r\n // or tweens the numeric props back to it over `duration`.\r\n\r\n /** @internal LIFO stack of save() snapshot layers. Underscore-internal so the prop companion can read it; not authoring surface. */\r\n _stateStack: PropLayer[] = [];\r\n\r\n /**\r\n * Push a snapshot of this node's current state onto its save stack.\r\n *\r\n * Every reactive prop (`x`, `y`, `scale`, `opacity`, `fill`, …) is captured,\r\n * preserving reactive bindings — a prop bound to `() => other().x` is saved\r\n * as the binding, not just its resolved value, so {@link restore} re-binds\r\n * it rather than freezing the value. Calls stack: each `save()` pushes a new\r\n * layer, and each {@link restore} pops the most recent one.\r\n *\r\n * @example\r\n * node.save();\r\n * node.moveTo({ data: { x: 200, y: 0 }, duration: 1 });\r\n * node.restore({ duration: 1 }); // animate back to where it was saved\r\n */\r\n save(): void {\r\n saveState(this);\r\n }\r\n\r\n /**\r\n * Pop the most recent {@link save} snapshot and roll this node back to it.\r\n *\r\n * Called with no `duration` (or `0`), every prop is reapplied instantly —\r\n * plain values are set, reactive bindings are re-bound. Called with a\r\n * positive `duration`, the numeric props (and any with a custom `tween`)\r\n * animate toward their saved values over that many seconds; once the tween\r\n * finishes the full snapshot is reapplied, which re-binds any reactive props\r\n * and snaps non-tweenable props (e.g. strings) to their saved values.\r\n *\r\n * A no-op (returns immediately) if there is nothing on the stack.\r\n */\r\n restore(): void;\r\n restore(args: CommandArgs<Record<string, never>> & { duration: number }): Command<Record<string, never>>;\r\n restore(args?: CommandArgs<Record<string, never>>): void | Command<Record<string, never>> {\r\n const layer = popState(this);\r\n const duration = args?.duration;\r\n if (duration === undefined || duration <= 0) {\r\n if (layer) applySnapshotLayer(this, layer);\r\n return;\r\n }\r\n return restoreAnimated(this, layer, duration, args?.easing);\r\n }\r\n\r\n // ---- Clock ------------------------------------------------------------\r\n\r\n protected _time: MutableNodeTime = createNodeTime();\r\n\r\n /** This node's place on the scene clock. See {@link NodeTime}. */\r\n public get time(): NodeTime {\r\n if (_observer !== null) _observer.clock?.(this);\r\n return this._time;\r\n }\r\n\r\n /**\r\n * Advance **this node's** clock to `total` clip-seconds and sample its\r\n * derived render state.\r\n *\r\n * Per-node, not per-subtree: {@link attach} already recurses, so a recursive\r\n * advance here would re-advance every descendant once per ancestor.\r\n *\r\n * Sampling happens here, not at render: this runs on every advanced frame in\r\n * every playback path (forward, scrub, precomp), whereas `render` runs only\r\n * for displayed frames. Sampling per-frame is what makes velocity correct on\r\n * the first frame after a scrub/rewind, where sampling only at render time\r\n * read zero. The advance loop runs before `generator.next()` (so audio\r\n * scheduling in generator bodies reads the right time), which means x/y here\r\n * still hold the previous frame's value — velocity therefore trails the\r\n * rendered position by one frame. That lag is constant and identical forward\r\n * vs. scrub, and imperceptible for motion blur.\r\n */\r\n private _advanceOwnTime(total: number): void {\r\n advanceNodeTime(this._time, total);\r\n this._sample();\r\n }\r\n\r\n /**\r\n * Sample this node's own derived render state for the current frame. Nothing\r\n * to derive in the general case; {@link Node2D} samples its motion here.\r\n *\r\n * @internal The per-node half of `sampleTree` — a walk, not a node method.\r\n */\r\n _sample(): void { }\r\n\r\n /**\r\n * Record this node's current position as the motion history's previous\r\n * frame, stamped `at`, deriving no velocity.\r\n *\r\n * @internal The per-node half of `primeMotionTree`.\r\n */\r\n _primeMotion(at: number): void { }\r\n\r\n // ---- Attachment -------------------------------------------------------\r\n\r\n /**\r\n * Put this subtree into the scene: mark it mounted, bind the asset catalog\r\n * and inherited context, advance its clock to `scope.time`.\r\n *\r\n * Safe and cheap to call every frame — an unchanged catalog/context\r\n * short-circuits, and {@link resolveContext} fires only on first attach.\r\n *\r\n * @internal Driven by `ClipInstance` per frame, and by {@link add} for a mid-frame subtree.\r\n */\r\n attach(scope: AttachScope): void {\r\n const first = !this._mounted;\r\n this._mounted = true;\r\n\r\n if (this._assets !== scope.assets) this._assets = scope.assets;\r\n\r\n const next = this.provideContext(scope.context);\r\n // Unchanged map, already bound, and not this instance's first attach ⇒\r\n // the whole subtree already holds `next` and the walk below would be pure\r\n // repetition of the context half. The time half still has to run.\r\n const contextChanged = !this._contextBound || this._context !== next;\r\n if (contextChanged) {\r\n this._context = next;\r\n this._contextBound = true;\r\n }\r\n if (first) this.resolveContext(next);\r\n\r\n this._advanceOwnTime(scope.time);\r\n\r\n if (this._children.length === 0) return;\r\n const childScope = next === scope.context ? scope : { ...scope, context: next };\r\n for (const child of this._children) child.attach(childScope);\r\n }\r\n\r\n /**\r\n * Take this subtree out of the scene. Not a teardown — props/children/bindings\r\n * stay, so it can be attached elsewhere (`reparent`). {@link dispose} tears down.\r\n *\r\n * @internal Driven by {@link remove}/{@link clear}.\r\n */\r\n detach(): void {\r\n if (!this._mounted) return;\r\n this._mounted = false;\r\n for (const child of this._children) child.detach();\r\n }\r\n\r\n /** The scope this node was last attached with, for handing to a late child. */\r\n private _currentScope(): AttachScope | null {\r\n return this._assets && this._contextBound\r\n ? { assets: this._assets, context: this._context, time: this._time.total }\r\n : null;\r\n }\r\n\r\n /** Attach `child` if this node is itself attached; otherwise leave it for the walk. */\r\n /** @internal Shared with `Node2D.addChildAt`, which splices rather than pushes. */\r\n protected _attachChild(child: Node): void {\r\n if (!this._mounted) return;\r\n const scope = this._currentScope();\r\n if (scope) child.attach(scope);\r\n }\r\n\r\n // ---- Context lifecycle ------------------------------------------------\r\n\r\n /**\r\n * Apply inherited context **values** to this node, once, after it's linked\r\n * into the tree and ancestor providers have resolved: a component's\r\n * `inherit` entries. Runs exactly once per instance.\r\n */\r\n protected resolveContext(ctx: ContextMap): void { }\r\n\r\n /**\r\n * The {@link ContextMap} handed to descendants: a component's `provide`\r\n * adds its tokens. The base passes the parent's map through unchanged.\r\n */\r\n protected provideContext(parent: ContextMap): ContextMap {\r\n return parent;\r\n }\r\n\r\n /**\r\n * Bind `node`'s asset catalog, context and clock without making it a child —\r\n * for a node used purely as a pixel source (`Tex.surface`), laid out on\r\n * demand rather than sitting in the tree.\r\n */\r\n protected attachDetached(node: Node): void {\r\n const scope = this._currentScope();\r\n if (scope) node.attach(scope);\r\n }\r\n\r\n /**\r\n * Declare what this node draws from its props and inherited context alone —\r\n * never `layoutBounds` or the clock. The runtime records what this reads and\r\n * calls it again only when one of those props is written, so anything else it\r\n * depends on is a change nobody will ask about.\r\n */\r\n declareAssets(assets: AssetScope): void { }\r\n\r\n get children(): Node[] {\r\n if (_observer !== null) _observer.read(this._structureSlot());\r\n return this._children;\r\n }\r\n\r\n /**\r\n * Every child, both dimensions, unfiltered — unlike {@link children}, which\r\n * a {@link Node2D} filters to its own kind. Used where index has to match\r\n * the authored tree (picking), since filtering would renumber it.\r\n */\r\n get _allChildren(): readonly Node[] {\r\n if (_observer !== null) _observer.read(this._structureSlot());\r\n return this._children;\r\n }\r\n\r\n /**\r\n * Add children — a node, an array, or a nested mix; falsy entries\r\n * (`cond && node`) are dropped. A child of the other dimension throws —\r\n * see {@link acceptsChild}.\r\n */\r\n add(child: NodeChildren): void {\r\n if (child instanceof Node) {\r\n this._addChild(child);\r\n return;\r\n }\r\n const flat = Node.flattenChildrenProp({ children: child });\r\n if (flat.length > 0) this._addChildren(flat);\r\n }\r\n\r\n /** Remove children — same shapes as {@link add}. Not a child of this one is a no-op. */\r\n remove(child: NodeChildren): void {\r\n if (child instanceof Node) {\r\n this._removeChild(child);\r\n return;\r\n }\r\n for (const node of Node.flattenChildrenProp({ children: child })) {\r\n this._removeChild(node);\r\n }\r\n }\r\n\r\n /** Remove every child, detaching each (see {@link remove}). */\r\n clear(): void {\r\n for (const child of this._children) {\r\n if (_observer !== null) this._structureChanged(child);\r\n child._parent = null;\r\n child.detach();\r\n }\r\n this._children.length = 0;\r\n }\r\n\r\n /**\r\n * Insert `child` at `index` among this node's children.\r\n *\r\n * On {@link Node} rather than {@link Node2D} because it is tree machinery —\r\n * `ClipTimeline.syncPresence` reaches for it on whatever a spec's\r\n * `parentId` names, which since audio joined the graph is not always a 2D\r\n * node. `Node2D` overrides it for the animated insert, which measures the\r\n * child off-tree and so needs a laid-out one.\r\n */\r\n addChildAt(args: CommandArgs<{ child: Node; index: number }>): void | Command<Record<string, never>> {\r\n const { child, index } = args.data as { child: Node; index: number };\r\n this.assertAcceptsChild(child);\r\n this._insertChildAt(child, index);\r\n }\r\n\r\n /** @internal Shared with `Node2D.addChildAt`'s instant branch. */\r\n protected _insertChildAt(child: Node, index: number): void {\r\n if (_observer !== null) this._structureChanged(child);\r\n this._children.splice(index, 0, child);\r\n child._parent = this;\r\n this._attachChild(child);\r\n }\r\n\r\n /**\r\n * @internal The pseudo-slot {@link children} and {@link parent} report to an\r\n * observer. Allocated on first observation, so a tree nobody observes carries none.\r\n */\r\n _structureSlot(): PropSlot<null> {\r\n return this._structure ??= new PropSlot<null>(null, this, STRUCTURE_SLOT);\r\n }\r\n\r\n /** @internal Report a child entering or leaving this node — its parent link changes with it. Call only while observed. */\r\n _structureChanged(child: Node | null): void {\r\n _observer!.write(this._structureSlot());\r\n if (child) _observer!.write(child._structureSlot());\r\n }\r\n\r\n private _structure: PropSlot<null> | null = null;\r\n\r\n private _addChild(child: Node): void {\r\n this.assertAcceptsChild(child);\r\n if (_observer !== null) this._structureChanged(child);\r\n this._children.push(child);\r\n child._parent = this;\r\n this._attachChild(child);\r\n }\r\n\r\n private _addChildren(children: Node[]): void {\r\n for (const child of children) this.assertAcceptsChild(child);\r\n if (_observer !== null) for (const child of children) this._structureChanged(child);\r\n this._children.push(...children);\r\n for (const child of children) child._parent = this;\r\n for (const child of children) this._attachChild(child);\r\n }\r\n\r\n private _removeChild(child: Node): void {\r\n const i = this._children.indexOf(child);\r\n if (i < 0) return;\r\n if (_observer !== null) this._structureChanged(child);\r\n const [removed] = this._children.splice(i, 1);\r\n if (removed) {\r\n removed._parent = null;\r\n removed.detach();\r\n }\r\n }\r\n\r\n dispose(): void {\r\n if (this.__cells) {\r\n for (const slot of this.__cells.slots.values()) {\r\n slot.dispose();\r\n }\r\n }\r\n this.__cells = undefined;\r\n this._assets = null;\r\n this._mounted = false;\r\n // _props is retained (authored identity) so provideContext still works after reuse.\r\n this._context = ContextMap.EMPTY;\r\n this._contextBound = false;\r\n }\r\n}\r\n\r\ndeclareMembers(Node, {\r\n to: command(),\r\n restore: command(),\r\n addChildAt: command({ args: [\"child\", \"index\"] }),\r\n});\r\n"]}
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAsD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAW,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAe,MAAM,mCAAmC,CAAC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AAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,oFAAoF;QACpF,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;CACJ;AAED,cAAc,CAAC,IAAI,EAAE;IACjB,EAAE,EAAE,OAAO,EAAE;IACb,OAAO,EAAE,OAAO,EAAE;IAClB,UAAU,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { _observer, PropSlot } from \"@/props/slot\";\nimport { STRUCTURE_SLOT } from \"@/props/observer\";\nimport { PropHost, type PropCells } from \"@/props/host\";\nimport { EasingFunction } from \"@/tween/ease/type\";\nimport { toCommand } from \"@/tween/to-command\";\nimport { makeCommand, type Command, type CommandArgs, type CommandTarget } from \"@/tween/command\";\nimport { prepareNumericCellTween } from \"@/tween/prepare\";\nimport { inertCommand, inertStepper } from \"@/tween/inert\";\nimport { TweenStepper } from \"@/tween/stepper\";\nimport { RefTarget } from \"@/util/reference\";\nimport { Context, ContextMap } from \"@/util/context\";\nimport { AssetCatalog } from \"@/assets/catalog\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport { declareMembers, getPropertyMeta, PropOptions } from \"@/attributes/properties/decorator\";\nimport {\n applyProp,\n applySnapshotLayer,\n collectProperties,\n popState,\n restoreAnimated,\n saveState,\n} from \"./node-reactive\";\nimport type { PropLayer } from \"./node-reactive\";\nimport { advanceNodeTime, createNodeTime, type MutableNodeTime, type NodeTime } from \"@/components/trees/node/node-time\";\nimport type { PropInputs } from \"@/attributes/properties/inputs\";\nimport { command } from \"@/tween/command-decorator\";\n\nexport type { NodeTime } from \"@/components/trees/node/node-time\";\nexport type { PropInput, PropInputs } from \"@/attributes/properties/inputs\";\n\n/** Which scene graph a node belongs to. See {@link Node.dimension}. */\nexport type NodeDimension = \"2d\" | \"3d\" | \"audio\";\n\n/** Where a node of each dimension is allowed to live, for the mismatch error. */\nconst HOSTS_OF: Record<NodeDimension, string> = {\n \"2d\": \"2D nodes go in the 2D tree, or inside a Canvas3D as a HUD over its scene.\",\n \"3d\": \"Put 3D nodes inside a Canvas3D, which is the one node that holds both.\",\n audio: \"Put audio nodes under an AudioBus, or directly on the scene root.\",\n};\n\nexport interface NodeMetadata<T extends Node> {\n /**\n * Handle written with this node at construction. Typed as {@link RefTarget}\n * rather than `Reference<T>` so a ref declared as one of `T`'s *supertypes*\n * is accepted (`createRef<Node2D>()` on a `<Rect>`) — see the note there\n * for why that direction is the sound one.\n */\n ref?: RefTarget<T>;\n}\n\nexport type NodeConfig<T extends Node, P> = PropInputs<P> & NodeMetadata<T>;\n\n/**\n * Everything {@link Node.attach} needs to put a subtree into a live scene.\n *\n * The three things tree membership supplies, and the only three: what assets are\n * available, what context the ancestors provide, and where the playhead is.\n */\nexport interface AttachScope {\n /** Metadata for the assets this scene may declare. */\n assets: AssetCatalog;\n /** The token map the parent provides to this node. */\n context: ContextMap;\n /** Clip-relative time, in seconds. */\n time: number;\n}\n\n/**\n * A `children` child: a single {@link Node}, an arbitrarily-nested array of\n * children, or a falsy value. Nesting is allowed so `.map()` results can be\n * dropped straight in as a child, and falsy values are allowed so\n * `condition && Rect({ … })` works — the constructor flattens\n * (`.flat(Infinity)`) and filters out everything but `Node` instances.\n */\nexport type NodeChildren = Node | false | null | undefined | NodeChildren[];\n\n/**\n * The props every node has, in either dimension.\n *\n * Deliberately tiny. Everything that reads as \"a box on a page\" — `x`/`y`,\n * `width`/`height`, `padding`, `flex`, anchors, `opacity` — lives on\n * {@link Node2DProps}, and everything that reads as \"a thing in space\" —\n * `position`, `quaternion`, `castShadow` — lives on `Node3DProps`, because a\n * prop that means nothing for half the tree is worse than no prop at all.\n */\nexport interface NodeProps {\n children: NodeChildren;\n /**\n * Seeds {@link Node.id}. A document's `NodeSpec.id` supplies it — see\n * `Registry.instantiate` — so an instantiated node answers to the identity\n * its row was authored under. Left out, the node falls back to a UUID, which\n * is what every hand-written `new Rect({…})` and component call gets.\n */\n id?: string;\n /**\n * The handle a node is *referenced by*, as against {@link NodeProps.id},\n * which addresses it. `\"=[card.x]\"` in any prop reads the `x` of the node\n * keyed `card` — see `NodeSpec.key`.\n *\n * Optional and never generated — a node has one only because an author wrote\n * one, which is what makes it safe to point a formula at — and unique per\n * document, which `document/validate.ts` enforces.\n */\n key?: string;\n}\n\n/**\n * The dimension-agnostic base of the scene graph: tree, identity, reactive\n * properties, commands, context, clock, asset declaration, teardown. Nothing\n * about *where* a node is or *how* it draws — that's {@link Node2D} / `Node3D`.\n * They meet only at `Canvas3D`; mixing them anywhere else throws (see\n * {@link acceptsChild}).\n *\n * Subclasses call {@link initProps} from their own constructor rather than the\n * base doing it: a subclass's field initializers only run *after* `super()`\n * returns, so applying `property` defaults any earlier would write into cells\n * that don't exist yet.\n */\nexport abstract class Node<P extends NodeProps = NodeProps> implements PropHost {\n /**\n * Which scene graph this node belongs to.\n *\n * A getter rather than a field so it is answerable from the prototype during\n * construction, before any subclass field initializer has run.\n */\n abstract get dimension(): NodeDimension;\n\n /** The trees this type takes children from, answerable from the prototype as {@link dimension} is. */\n get _childTrees(): readonly NodeDimension[] {\n return [this.dimension];\n }\n\n constructor(props?: NodeConfig<any, P>) {\n // Retain the raw props (see _props doc) so a provider's provideContext can\n // read which keys the author passed. Captured before any default\n // application so it reflects exactly what the author passed. The object is\n // retained by reference, so a subclass expanding prop sugar in place\n // afterwards (`size`, `transform3D`) is reflected here too.\n this._props = props;\n // Neither is a property: identity does not tween, so neither has any\n // business in the table `set()`, `to()` and the baseline restore walk\n // iterate.\n const identity = props as { id?: string; key?: string } | undefined;\n this.key = identity?.key;\n // Nullish, never falsy: `\"\"` is the scene root's real id, not a missing\n // one (`checkRootShape` in document/validate.ts defines the root as the\n // row holding it), and a UUID in its place would have the host's tree\n // report a root no document row mentions.\n this.id = identity?.id ?? crypto.randomUUID();\n }\n\n /** See {@link NodeProps.key}. */\n key?: string;\n\n private _hidden = false;\n private _locked = false;\n\n /**\n * Hidden by the editor — no paint, no pick, no layout slot. See\n * {@link NodeEditorState.hidden}.\n */\n get hidden(): boolean {\n return this._hidden;\n }\n\n /** Locked by the editor — unpickable, but drawn. See {@link NodeEditorState.locked}. */\n get locked(): boolean {\n return this._locked;\n }\n\n /**\n * @internal — written only by `applyEditorStates`, which owns both flags for\n * the whole tree. Not a setter pair, so a caller cannot set one and leave the\n * other holding a previous frame's answer.\n */\n _setEditorState(hidden: boolean, locked: boolean): void {\n this._hidden = hidden;\n this._locked = locked;\n }\n\n /**\n * Fire the `ref` and apply every declared property, reading\n * initial values from `props`.\n *\n * Called by the concrete constructor ({@link Node2D}'s, `Node3D`'s) rather\n * than by this one, because a subclass's field initializers run *after*\n * `super()` returns: doing this here would apply props while the cells those\n * props write into are still `undefined`.\n */\n protected initProps(props?: NodeConfig<any, P>): void {\n if (props?.ref) {\n props.ref(this as any);\n }\n\n // Apply every declared property, reading initial values from props.\n for (const meta of getPropertyMeta(this)) {\n const propsVal = props ? (props as any)[meta.key] : undefined;\n const initial = propsVal !== undefined ? propsVal : meta.default;\n this.applyProp(meta.key, initial, meta.options);\n }\n }\n\n /**\n * Adopt the `children` prop. Called by the concrete constructor after its own\n * defaults are in place, so a child never lands in a tree whose parent has not\n * finished sizing itself.\n */\n protected adoptChildrenProp(props?: NodeConfig<any, P>): void {\n if (props && (props as any).children) {\n const raw = Array.isArray((props as any).children) ? (props as any).children : [(props as any).children];\n const flat = (raw as unknown[]).flat(Infinity)\n .filter((c: unknown): c is Node => c instanceof Node);\n if (flat.length > 0) this._addChildren(flat);\n }\n }\n\n /**\n * Whether `child` may be adopted by this node.\n *\n * A node holds children of its own dimension; the places the trees meet are\n * `Canvas3D`, which takes 2D and 3D, and `Canvas2D`, which takes 2D and\n * audio. Both partition what they accept. Rejecting the mix here rather than\n * letting it through is deliberate: a `Box3D` parented to a `Rect` would be\n * silently skipped by both the layout walk and the 3D walk, and would simply\n * never appear.\n */\n protected acceptsChild(child: Node): boolean {\n return child.dimension === this.dimension;\n }\n\n /** Throw if `child` cannot go here: by its tree, by what this node takes, or by where the child says it goes. */\n protected assertAcceptsChild(child: Node): void {\n if (!this.acceptsChild(child)) {\n const why = child.dimension === this.dimension ? this._childRule() : HOSTS_OF[child.dimension];\n throw new TypeError(`${this.className} (${this.dimension}) cannot hold ${child.className} (${child.dimension}).${why ? ` ${why}` : \"\"}`);\n }\n const refusal = child._parentRefusal(this);\n if (refusal) throw new TypeError(refusal);\n }\n\n /** What this node takes, for the error when it refuses a child of its own tree. */\n protected _childRule(): string {\n return \"\";\n }\n\n /** Why this node cannot go inside `parent`, or `null`: only a node that names its parents refuses one. */\n _parentRefusal(_parent: Node): string | null {\n return null;\n }\n\n private _assets: AssetCatalog | null = null;\n protected _parent: Node | null = null;\n\n /**\n * Whether this node is in a live scene tree. Gates measure/layout/render,\n * asset declaration and every command — checked at the handful of places\n * the framework dispatches from, not per method.\n */\n private _mounted = false;\n\n /** See {@link _mounted}. */\n get mounted(): boolean {\n return this._mounted;\n }\n\n get parent(): Node | null {\n if (_observer !== null) _observer.read(this._structureSlot());\n return this._parent;\n }\n\n get assets(): AssetCatalog {\n if (!this._assets) throw new Error(\"Assets not bound — this node is not attached to a scene. See Node.attach().\");\n return this._assets;\n }\n\n /** Token→value map pushed down from ancestor providers, bound by {@link attach}. */\n private _context: ContextMap = ContextMap.EMPTY;\n /** True once {@link attach} has reached this node. */\n private _contextBound = false;\n\n /** Raw constructor props, retained so {@link provideContext} can see which keys were explicitly passed. Kept through {@link dispose} so a reused instance re-derives context on the next attach. */\n protected _props?: NodeConfig<any, P>;\n\n /** Read the nearest ancestor provider's value for `ctx` (or its default). */\n useContext<T>(ctx: Context<T>): T {\n return this._context.get(ctx);\n }\n\n /** Assigned in the constructor — see {@link NodeProps.id}. */\n readonly id: string;\n\n /**\n * The slots behind this node's `property` fields. See {@link PropCells}.\n *\n * @internal — the authoring surface is the declared props themselves, plus\n * `set()`/`to()`/`captureProps()`.\n */\n __cells?: PropCells;\n\n protected _children: Node[] = [];\n\n /**\n * Flatten a constructor's raw `children` prop into the `Node` instances it\n * contains, without mutating or adding them — the same normalisation the\n * constructor applies before adding them, exposed standalone so\n * {@link applyDefaultSize} overrides can inspect children's own resolved\n * `width`/`height` *before* they're attached (children are constructed,\n * defaults and all, before being passed in as props).\n */\n protected static flattenChildrenProp(props: { children?: unknown } | undefined): Node[] {\n const childProp = props ? props.children : undefined;\n if (!childProp) return [];\n const raw = Array.isArray(childProp) ? childProp : [childProp];\n return (raw as unknown[]).flat(Infinity).filter((c: unknown): c is Node => c instanceof Node);\n }\n\n // ---- Reactive properties ----------------------------------------------\n\n /**\n * Declare a prop on this node. Creates a {@link PropSlot}-backed accessor\n * for `field`, applies an initial value (callback → binding; otherwise\n * constant), and registers optional tween/mapper metadata used by `set()`\n * and `to()`.\n *\n * Subsequent calls for the same field reuse the existing slot and act as\n * a value assignment, so subclasses can override a parent's default by\n * calling applyProp again without losing the slot or its bindings.\n */\n protected applyProp<Ext, Int = Ext>(\n field: string,\n initial: Ext | (() => Ext) | undefined,\n options?: PropOptions<Ext, Int>,\n ): void {\n applyProp(this, field, initial, options);\n }\n\n /** @internal Hot-path prop write (mapper- and binding-aware). Public-but-underscored like `_prepareStep` so reactive companions in this directory can call it; not part of the authoring surface. */\n _writeProp(field: string, value: unknown): void {\n if (value === undefined) return;\n const slot = this.__cells?.slots.get(field);\n if (!slot) return;\n const mapper = this.__cells?.mappers?.get(field);\n if (typeof value === \"function\") {\n const extFn = value as () => any;\n if (mapper) {\n // A binding that reads `undefined` — a node reference to a node that is\n // not there — leaves the prop as a node built without it, and never\n // reaches the mapper, which holds the shape the prop's readers go through.\n let unset: { value: unknown } | undefined;\n slot.bind(() => {\n const read = extFn();\n return read === undefined\n ? (unset ??= { value: this._unsetValue(field, mapper) }).value\n : mapper(read, slot.get());\n });\n } else {\n slot.bind(extFn);\n }\n } else {\n slot.set(mapper ? mapper(value, slot.get()) : value);\n }\n }\n\n get properties(): P {\n return collectProperties(this) as P;\n }\n\n /**\n * This node's **class** name, for a message or a host's type column. Not an\n * authored identity — those are {@link id} and {@link key}, and nothing in\n * the document model is called a name any more. Nor is it the registry key a\n * document writes in `NodeSpec.type`: a minifier is free to rename a class.\n */\n get className(): string {\n return this.constructor.name;\n }\n\n set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\n const slots = this.__cells?.slots;\n if (!slots) return;\n // Iterate the caller's keys (usually 1–3) rather than every registered\n // prop (15+): set() runs in the per-frame hot path. Only keys backed by\n // a slot are written; unknown keys are ignored — which is also what\n // lets a subclass distribute its own sugar (2D's `size`, `transform3D`)\n // into real keys and then delegate here.\n for (const key in props) {\n const val = (props as any)[key];\n if (val !== undefined && slots.has(key)) this._writeProp(key, val);\n }\n }\n\n to<D extends Partial<P> = Partial<P>>(args: CommandArgs<D> & { duration: number }): Command<P> {\n return toCommand<P>(this, args.data ?? {}, args.duration, args.easing);\n }\n\n /**\n * Build a {@link Command} from a pure function of normalized time — an\n * animation this node can be *evaluated* at, not only run through. The pair\n * to {@link to}, for the built-in commands whose values at `t` are not a prop\n * list, and what a component command's timeline lowers to.\n *\n * Snapshot whatever the animation starts from *outside* `at`: reading a prop\n * inside it would re-read the value the command is itself writing.\n */\n protected command<Props = P>(\n at: (t: number) => Partial<Props>,\n duration: number = 1,\n easing?: EasingFunction,\n ): Command<Props> {\n if (!this._mounted) return inertCommand<Props>(this, duration);\n return makeCommand<Props>(\n this as unknown as CommandTarget<Props>,\n at,\n duration,\n easing,\n );\n }\n\n /**\n * Resolve a single `to()` step into a flat {@link TweenStepper} — all the\n * per-key setup (mapper, numeric-vs-custom routing) happens once here, then\n * `advance(dt)` is allocation-free. Used by both a chain's iterator path and\n * the batched `parallel` path.\n *\n * A subclass with positional sugar of its own (2D's `size` and anchors)\n * expands `to` in place and then delegates here.\n */\n _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\n if (!this._mounted) return inertStepper(duration);\n // A tween runs in stored space, so the destination is mapped once, here,\n // and every step after it is a stored value written to the slot as it is.\n // Writing a step through the setter would map it a second time, which only\n // an idempotent mapper survives.\n const numCells: PropSlot<number>[] = [];\n const numFrom: number[] = [];\n const numEnd: number[] = [];\n const customLerps: Array<(t: number) => void> = [];\n const stringSnaps: Array<[PropSlot<string>, string]> = [];\n\n for (const key of Object.keys(to)) {\n const slot = this.__cells?.slots.get(key);\n if (!slot) continue;\n const extVal = (to as any)[key];\n const mapper = this.__cells?.mappers?.get(key);\n const targetVal = mapper ? mapper(extVal, (this as any)[key]) : extVal;\n const tweenFn = this.__cells?.tweens?.get(key);\n if (tweenFn) {\n const from = (this as any)[key];\n customLerps.push((t) => {\n slot.set(tweenFn(from, targetVal, t));\n });\n } else if (typeof targetVal === 'number') {\n numCells.push(slot as PropSlot<number>);\n numFrom.push((this as any)[key] as number);\n numEnd.push(targetVal as number);\n } else if (typeof targetVal === 'string') {\n stringSnaps.push([slot as PropSlot<string>, targetVal]);\n }\n }\n\n const lerp = prepareNumericCellTween(numCells, numFrom, numEnd);\n const hasCustom = customLerps.length > 0;\n const hasSnaps = stringSnaps.length > 0;\n\n const apply = (t: number): void => {\n const easedT = easing ? easing(t) : t;\n lerp(easedT);\n if (hasCustom) for (const fn of customLerps) fn(easedT);\n // A discrete prop has nothing between its endpoints, so it snaps at\n // the end rather than interpolating. Applied here rather than only in\n // `advance` because a `seek` past the end has, by definition, reached\n // that end — leaving it out meant `seek(duration)` and running to\n // `duration` produced different nodes, and only the second was right.\n if (hasSnaps && t >= 1) for (const [slot, val] of stringSnaps) slot.set(val);\n };\n\n let elapsed = 0;\n return {\n // Tracks `elapsed`, so a seek and a subsequent advance agree about\n // where the tween is. Without it, seeking forward then advancing\n // rewound to `dt`.\n seek: (e: number) => {\n elapsed = e;\n apply(duration > 0 ? Math.min(e / duration, 1) : 1);\n },\n advance: (dt: number): boolean => {\n elapsed += dt;\n if (elapsed < duration) {\n apply(elapsed / duration);\n return false;\n }\n apply(1);\n return true;\n },\n };\n }\n\n /** What a node constructed without `field` holds: its declared default, through the mapper. */\n private _unsetValue(field: string, mapper: (ext: any, prev?: any) => any): unknown {\n const declared = getPropertyMeta(this).find((meta) => meta.key === field)?.default;\n const initial = typeof declared === \"function\" ? declared() : declared;\n return initial === undefined ? undefined : mapper(initial, undefined);\n }\n\n // ---- State stack (save / restore) -------------------------------------\n // A per-node LIFO stack of property snapshots, mirroring Motion Canvas's\n // node.save()/restore(). `save()` pushes a snapshot of every declared prop;\n // `restore()` pops the most recent one and either snaps to it (no duration)\n // or tweens the numeric props back to it over `duration`.\n\n /** @internal LIFO stack of save() snapshot layers. Underscore-internal so the prop companion can read it; not authoring surface. */\n _stateStack: PropLayer[] = [];\n\n /**\n * Push a snapshot of this node's current state onto its save stack.\n *\n * Every reactive prop (`x`, `y`, `scale`, `opacity`, `fill`, …) is captured,\n * preserving reactive bindings — a prop bound to `() => other().x` is saved\n * as the binding, not just its resolved value, so {@link restore} re-binds\n * it rather than freezing the value. Calls stack: each `save()` pushes a new\n * layer, and each {@link restore} pops the most recent one.\n *\n * @example\n * node.save();\n * node.moveTo({ data: { x: 200, y: 0 }, duration: 1 });\n * node.restore({ duration: 1 }); // animate back to where it was saved\n */\n save(): void {\n saveState(this);\n }\n\n /**\n * Pop the most recent {@link save} snapshot and roll this node back to it.\n *\n * Called with no `duration` (or `0`), every prop is reapplied instantly —\n * plain values are set, reactive bindings are re-bound. Called with a\n * positive `duration`, the numeric props (and any with a custom `tween`)\n * animate toward their saved values over that many seconds; once the tween\n * finishes the full snapshot is reapplied, which re-binds any reactive props\n * and snaps non-tweenable props (e.g. strings) to their saved values.\n *\n * A no-op (returns immediately) if there is nothing on the stack.\n */\n restore(): void;\n restore(args: CommandArgs<Record<string, never>> & { duration: number }): Command<Record<string, never>>;\n restore(args?: CommandArgs<Record<string, never>>): void | Command<Record<string, never>> {\n const layer = popState(this);\n const duration = args?.duration;\n if (duration === undefined || duration <= 0) {\n if (layer) applySnapshotLayer(this, layer);\n return;\n }\n return restoreAnimated(this, layer, duration, args?.easing);\n }\n\n // ---- Clock ------------------------------------------------------------\n\n protected _time: MutableNodeTime = createNodeTime();\n\n /** This node's place on the scene clock. See {@link NodeTime}. */\n public get time(): NodeTime {\n if (_observer !== null) _observer.clock?.(this);\n return this._time;\n }\n\n /**\n * Advance **this node's** clock to `total` clip-seconds and sample its\n * derived render state.\n *\n * Per-node, not per-subtree: {@link attach} already recurses, so a recursive\n * advance here would re-advance every descendant once per ancestor.\n *\n * Sampling happens here, not at render: this runs on every advanced frame in\n * every playback path (forward, scrub, precomp), whereas `render` runs only\n * for displayed frames. Sampling per-frame is what makes velocity correct on\n * the first frame after a scrub/rewind, where sampling only at render time\n * read zero. The advance loop runs before `generator.next()` (so audio\n * scheduling in generator bodies reads the right time), which means x/y here\n * still hold the previous frame's value — velocity therefore trails the\n * rendered position by one frame. That lag is constant and identical forward\n * vs. scrub, and imperceptible for motion blur.\n */\n private _advanceOwnTime(total: number): void {\n advanceNodeTime(this._time, total);\n this._sample();\n }\n\n /**\n * Sample this node's own derived render state for the current frame. Nothing\n * to derive in the general case; {@link Node2D} samples its motion here.\n *\n * @internal The per-node half of `sampleTree` — a walk, not a node method.\n */\n _sample(): void { }\n\n /**\n * Record this node's current position as the motion history's previous\n * frame, stamped `at`, deriving no velocity.\n *\n * @internal The per-node half of `primeMotionTree`.\n */\n _primeMotion(at: number): void { }\n\n // ---- Attachment -------------------------------------------------------\n\n /**\n * Put this subtree into the scene: mark it mounted, bind the asset catalog\n * and inherited context, advance its clock to `scope.time`.\n *\n * Safe and cheap to call every frame — an unchanged catalog/context\n * short-circuits, and {@link resolveContext} fires only on first attach.\n *\n * @internal Driven by `ClipInstance` per frame, and by {@link add} for a mid-frame subtree.\n */\n attach(scope: AttachScope): void {\n const first = !this._mounted;\n this._mounted = true;\n\n if (this._assets !== scope.assets) this._assets = scope.assets;\n\n const next = this.provideContext(scope.context);\n // Unchanged map, already bound, and not this instance's first attach ⇒\n // the whole subtree already holds `next` and the walk below would be pure\n // repetition of the context half. The time half still has to run.\n const contextChanged = !this._contextBound || this._context !== next;\n if (contextChanged) {\n this._context = next;\n this._contextBound = true;\n }\n if (first) this.resolveContext(next);\n\n this._advanceOwnTime(scope.time);\n\n if (this._children.length === 0) return;\n const childScope = next === scope.context ? scope : { ...scope, context: next };\n for (const child of this._children) child.attach(childScope);\n }\n\n /**\n * Take this subtree out of the scene. Not a teardown — props/children/bindings\n * stay, so it can be attached elsewhere (`reparent`). {@link dispose} tears down.\n *\n * @internal Driven by {@link remove}/{@link clear}.\n */\n detach(): void {\n if (!this._mounted) return;\n this._mounted = false;\n for (const child of this._children) child.detach();\n }\n\n /** The scope this node was last attached with, for handing to a late child. */\n private _currentScope(): AttachScope | null {\n return this._assets && this._contextBound\n ? { assets: this._assets, context: this._context, time: this._time.total }\n : null;\n }\n\n /** Attach `child` if this node is itself attached; otherwise leave it for the walk. */\n /** @internal Shared with `Node2D.addChildAt`, which splices rather than pushes. */\n protected _attachChild(child: Node): void {\n if (!this._mounted) return;\n const scope = this._currentScope();\n if (scope) child.attach(scope);\n }\n\n // ---- Context lifecycle ------------------------------------------------\n\n /**\n * Apply inherited context **values** to this node, once, after it's linked\n * into the tree and ancestor providers have resolved: a component's\n * `inherit` entries. Runs exactly once per instance.\n */\n protected resolveContext(ctx: ContextMap): void { }\n\n /**\n * The {@link ContextMap} handed to descendants: a component's `provide`\n * adds its tokens. The base passes the parent's map through unchanged.\n */\n protected provideContext(parent: ContextMap): ContextMap {\n return parent;\n }\n\n /**\n * Bind `node`'s asset catalog, context and clock without making it a child —\n * for a node used purely as a pixel source (`Tex.surface`), laid out on\n * demand rather than sitting in the tree.\n */\n protected attachDetached(node: Node): void {\n const scope = this._currentScope();\n if (scope) node.attach(scope);\n }\n\n /**\n * Declare what this node draws from its props and inherited context alone —\n * never `layoutBounds` or the clock. The runtime records what this reads and\n * calls it again only when one of those props is written, so anything else it\n * depends on is a change nobody will ask about.\n */\n declareAssets(assets: AssetScope): void { }\n\n get children(): Node[] {\n if (_observer !== null) _observer.read(this._structureSlot());\n return this._children;\n }\n\n /**\n * Every child, both dimensions, unfiltered — unlike {@link children}, which\n * a {@link Node2D} filters to its own kind. Used where index has to match\n * the authored tree (picking), since filtering would renumber it.\n */\n get _allChildren(): readonly Node[] {\n if (_observer !== null) _observer.read(this._structureSlot());\n return this._children;\n }\n\n /**\n * Add children — a node, an array, or a nested mix; falsy entries\n * (`cond && node`) are dropped. A child of the other dimension throws —\n * see {@link acceptsChild}.\n */\n add(child: NodeChildren): void {\n if (child instanceof Node) {\n this._addChild(child);\n return;\n }\n const flat = Node.flattenChildrenProp({ children: child });\n if (flat.length > 0) this._addChildren(flat);\n }\n\n /** Remove children — same shapes as {@link add}. Not a child of this one is a no-op. */\n remove(child: NodeChildren): void {\n if (child instanceof Node) {\n this._removeChild(child);\n return;\n }\n for (const node of Node.flattenChildrenProp({ children: child })) {\n this._removeChild(node);\n }\n }\n\n /** Remove every child, detaching each (see {@link remove}). */\n clear(): void {\n for (const child of this._children) {\n if (_observer !== null) this._structureChanged(child);\n child._parent = null;\n child.detach();\n }\n this._children.length = 0;\n }\n\n /**\n * Insert `child` at `index` among this node's children.\n *\n * On {@link Node} rather than {@link Node2D} because it is tree machinery —\n * `ClipTimeline.syncPresence` reaches for it on whatever a spec's\n * `parentId` names, which since audio joined the graph is not always a 2D\n * node. `Node2D` overrides it for the animated insert, which measures the\n * child off-tree and so needs a laid-out one.\n */\n addChildAt(args: CommandArgs<{ child: Node; index: number }>): void | Command<Record<string, never>> {\n const { child, index } = args.data as { child: Node; index: number };\n this.assertAcceptsChild(child);\n this._insertChildAt(child, index);\n }\n\n /** @internal Shared with `Node2D.addChildAt`'s instant branch. */\n protected _insertChildAt(child: Node, index: number): void {\n if (_observer !== null) this._structureChanged(child);\n this._children.splice(index, 0, child);\n child._parent = this;\n this._attachChild(child);\n }\n\n /**\n * @internal The pseudo-slot {@link children} and {@link parent} report to an\n * observer. Allocated on first observation, so a tree nobody observes carries none.\n */\n _structureSlot(): PropSlot<null> {\n return this._structure ??= new PropSlot<null>(null, this, STRUCTURE_SLOT);\n }\n\n /** @internal Report a child entering or leaving this node — its parent link changes with it. Call only while observed. */\n _structureChanged(child: Node | null): void {\n _observer!.write(this._structureSlot());\n if (child) _observer!.write(child._structureSlot());\n }\n\n private _structure: PropSlot<null> | null = null;\n\n private _addChild(child: Node): void {\n this.assertAcceptsChild(child);\n if (_observer !== null) this._structureChanged(child);\n this._children.push(child);\n child._parent = this;\n this._attachChild(child);\n }\n\n private _addChildren(children: Node[]): void {\n for (const child of children) this.assertAcceptsChild(child);\n if (_observer !== null) for (const child of children) this._structureChanged(child);\n this._children.push(...children);\n for (const child of children) child._parent = this;\n for (const child of children) this._attachChild(child);\n }\n\n private _removeChild(child: Node): void {\n const i = this._children.indexOf(child);\n if (i < 0) return;\n if (_observer !== null) this._structureChanged(child);\n const [removed] = this._children.splice(i, 1);\n if (removed) {\n removed._parent = null;\n removed.detach();\n }\n }\n\n dispose(): void {\n if (this.__cells) {\n for (const slot of this.__cells.slots.values()) {\n slot.dispose();\n }\n }\n this.__cells = undefined;\n this._assets = null;\n this._mounted = false;\n // _props is retained (authored identity) so provideContext still works after reuse.\n this._context = ContextMap.EMPTY;\n this._contextBound = false;\n }\n}\n\ndeclareMembers(Node, {\n to: command(),\n restore: command(),\n addChildAt: command({ args: [\"child\", \"index\"] }),\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"canvas2d-node.js","sourceRoot":"","sources":["../../../../src/components/trees/root/canvas2d-node.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AI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;IACxE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IACtF,MAAM,EAAE,OAAO,EAAE;IACjB,SAAS,EAAE,OAAO,EAAE;CACvB,CAAC,CAAC","sourcesContent":["import { RenderContext2D, RenderPass2D } from \"@/render/render-context2d\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { Clip } from \"@/render/clip\";\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport { lerpLookAt, type LookAt, type SpaceCamera } from \"@/attributes/layout/space3d\";\r\nimport { NO_PROJECTION_3D, type Projection3D } from \"@/attributes/layout/matrix2d\";\r\nimport { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { FlowMode, FlowProps, FlowSettings, GapSize } from \"@/layout/types\";\r\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport { CameraScope, Node2D, NodeConfig, Node2DProps } from \"@/components/trees/2d/node2d\";\r\nimport { spaceRootFrame } from \"@/components/trees/2d/node-space\";\r\nimport type { Node, NodeDimension } from \"@/components/trees/node/node\";\r\nimport { NodeAudio } from \"@/components/trees/audio/node-audio\";\r\nimport { declareMembers, property } from \"@/attributes/properties/decorator\";\r\nimport { alignmentProperty, fillProperty, flowProperty } from \"@/attributes/properties/typed\";\r\n\r\n/** @internal */\r\nexport interface Canvas2DProps extends Node2DProps, FlowProps {\r\n /**\r\n * Background fill layer(s). Each item can be a CSS color string, a fill\r\n * prop object, an already-resolved fill, or a {@link FillChain} from the\r\n * `Fills` builder. Painted behind the scene's children.\r\n */\r\n fill: Fill;\r\n /**\r\n * Overlay layer(s) — same loose values as {@link fill}, but painted *over*\r\n * the fill **and** the children (clipped to the viewport). Use for textures\r\n * laid across the whole scene, e.g. a VHS-grain image or video.\r\n */\r\n overlay: Fill;\r\n /** Camera magnification factor. Values > 1 zoom in; < 1 zoom out. */\r\n zoom: number;\r\n /**\r\n * World-space point that maps to the centre of the viewport. In a\r\n * {@link space3D} it is also what the camera orbits, and `z` puts it in\r\n * depth — the same sense as a node's `depth`, so a negative `z` flies in.\r\n */\r\n lookAt: LookAt;\r\n /** Rotation of the camera view in degrees (clockwise). */\r\n heading: number;\r\n /**\r\n * Place the children in one 3D space seen through this camera, rather than\r\n * each projecting through a perspective of its own. Their `depth` and tilt\r\n * are then positions and turns in that space, and siblings paint far to\r\n * near. A switch rather than something read off the camera's numbers, so\r\n * turning it on can never jump a tween.\r\n *\r\n * While it is on, `perspective` is the camera's distance from {@link lookAt}\r\n * at `dolly: 0` — CSS's convention, so that plane draws 1:1 and `0` is a\r\n * parallel projection — and the stage's own tilt and depth are unused.\r\n */\r\n space3D: boolean;\r\n /** Degrees about the vertical axis through {@link lookAt}. 0 is head-on; positive moves the camera to the right. Same as `Camera3D`. */\r\n orbit: number;\r\n /** Degrees above the layers. Positive looks down on them. Same as `Camera3D`. */\r\n elevation: number;\r\n /** Px the camera has moved in toward {@link lookAt}. Inert with no perspective, as depth is. */\r\n dolly: number;\r\n}\r\n\r\n/**\r\n * The single root container every clip document builds into.\r\n *\r\n * A `Canvas2D` is a plain {@link Node2D} that doubles as the clip's layout frame\r\n * and camera. It lays its children out (flex `horizontal`/`vertical` or\r\n * `freeform`, with `gap`, `align`, `padding`) and paints a scene-wide background\r\n * (`fill`) and `overlay` — *and* views those laid-out children through a viewport\r\n * transform (`zoom`, `lookAt`, `heading`).\r\n *\r\n * Unlike a {@link Rect} it is **not a shape**: it has no stroke, shadow, corner,\r\n * or `start`/`end` props. It carries only the scene-wide concerns — background\r\n * paint, child layout, and camera — so `stage.fill`, `stage.flow`, etc. read\r\n * the root directly without exposing per-shape geometry the scene root never has.\r\n *\r\n * Its layout props are the arrangement {@link Node2D} lays its children out by,\r\n * the same as a {@link Rect}'s — see {@link flowArrangement}.\r\n */\r\n/** @internal */\r\nexport class Canvas2D extends Node2D<Canvas2DProps> {\r\n\r\n // ---- Background paint -------------------------------------------------\r\n // Author-facing paint props. Like Rect, the declared type is the loose\r\n // `Fill` so assignment (`this.fill = 'red'`) and reads share one type; the\r\n // property accessor stores the *resolved* value via the mapper.\r\n declare fill: Fill;\r\n declare overlay: Fill;\r\n\r\n // ---- Layout container -------------------------------------------------\r\n declare flow: FlowMode;\r\n declare readonly gap: GapSize;\r\n declare readonly wrap: boolean;\r\n // `undefined` means \"follow `gap`\", not \"missing\" — see FlowProps.crossGap.\r\n declare readonly crossGap: number | undefined;\r\n declare readonly columns: number;\r\n // Declared loose as `Alignment` (covers `this.align = 'center'`); the\r\n // accessor stores the resolved per-axis `Vector2` pivot. See Rect.\r\n declare align: Alignment;\r\n\r\n // ---- Camera -----------------------------------------------------------\r\n /** Camera magnification factor (default: 1). */\r\n declare zoom: number;\r\n /** World-space focus point (default: {x:0, y:0}). */\r\n declare lookAt: LookAt;\r\n /** Camera view rotation in degrees (default: 0). */\r\n declare heading: number;\r\n declare space3D: boolean;\r\n declare orbit: number;\r\n declare elevation: number;\r\n declare dolly: number;\r\n\r\n constructor(props: NodeConfig<Canvas2D, Canvas2DProps>) {\r\n super(props);\r\n }\r\n\r\n // ---- Camera motion commands -------------------------------------------\r\n // Mirror the Camera node's viewport commands.\r\n\r\n /** Animate `zoom`. Values > 1 zoom in; < 1 zoom out. */\r\n zoomTo(args: CommandArgs<{ zoom: number }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Pan — animate `lookAt`, the world-space point mapped to the viewport center. `z` moves it in depth. */\r\n panTo(args: CommandArgs<{ lookAt: LookAt }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /**\r\n * Swing the camera round {@link lookAt}. The argument names are the ones the\r\n * 3D components' `orbitTo` takes, less `zoom`: here that is the lens, not a\r\n * distance, and it has a command of its own.\r\n */\r\n orbitTo(args: CommandArgs<{ orbit?: number; elevation?: number }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Move the camera in toward {@link lookAt} (positive) or back out. */\r\n dollyTo(args: CommandArgs<{ dolly: number }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the view rotation (`heading`), in degrees clockwise. */\r\n headingTo(args: CommandArgs<{ heading: number }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n fillTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<Canvas2DProps> {\r\n const from = this.fill as FillResolved[];\r\n const target = fillOps.resolve(args.data as Fill);\r\n const lerp = args.lerp ?? fillOps.lerp;\r\n return this.command<Canvas2DProps>(t => ({ fill: lerp(from, target, t) }) as Partial<Canvas2DProps>, args.duration, args.easing);\r\n }\r\n\r\n overlayTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<Canvas2DProps> {\r\n const from = this.overlay as FillResolved[];\r\n const target = fillOps.resolve(args.data as Fill);\r\n const lerp = args.lerp ?? fillOps.lerp;\r\n return this.command<Canvas2DProps>(t => ({ overlay: lerp(from, target, t) }) as Partial<Canvas2DProps>, args.duration, args.easing);\r\n }\r\n\r\n // ---- Layout -----------------------------------------------------------\r\n\r\n protected override flowArrangement(): FlowSettings {\r\n return this;\r\n }\r\n\r\n // ---- Drawing ----------------------------------------------------------\r\n\r\n // The viewport-sized background box behind the children.\r\n private shapeGraphics(): Graphics2D {\r\n return new Graphics2D().rect({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n });\r\n }\r\n\r\n protected override renderSelf(draw: RenderContext2D): void {\r\n const fill = this.fill as FillResolved[];\r\n if (fill.length === 0) return;\r\n draw.draw(this.shapeGraphics().fill(fill));\r\n }\r\n\r\n // Overlay over fill + children, clipped to the viewport silhouette.\r\n protected override renderOverlay(ctx: RenderContext2D): void {\r\n const overlay = this.overlay as FillResolved[];\r\n if (overlay.length === 0) return;\r\n ctx.draw(this.shapeGraphics().fill(overlay));\r\n }\r\n\r\n /**\r\n * Accept audio children as well as 2D ones.\r\n *\r\n * The scene root is where the two trees meet, mirroring `Canvas3D` — and for\r\n * the same reason it is *this* node: a composition already carries both\r\n * halves of a clip, so a voiceover belongs in the document that shows the\r\n * picture it is narrating rather than in a second document beside it.\r\n *\r\n * Nothing partitions them by hand. `Node2D.children` already filters to its\r\n * own kind, so layout and render skip the audio subtree for free, and the\r\n * audio declaration walk reads the unfiltered list.\r\n */\r\n protected override acceptsChild(child: Node): boolean {\r\n return child.dimension === \"2d\" || child.dimension === \"audio\";\r\n }\r\n\r\n override get _childTrees(): readonly NodeDimension[] {\r\n return [\"2d\", \"audio\"];\r\n }\r\n\r\n /** This node's children in the audio tree. */\r\n get childrenAudio(): NodeAudio[] {\r\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\r\n }\r\n\r\n // The world container, not a shape, so it declares its own `fill`/`overlay`.\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n assets.fill(this.fill as FillResolved[]);\r\n assets.fill(this.overlay as FillResolved[]);\r\n }\r\n\r\n // The viewport outline — used for `clip` and as the area backdrop effects\r\n // are confined to.\r\n protected override clipSelf(): Clip {\r\n return new Clip().rect({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n });\r\n }\r\n\r\n // ---- Rendering --------------------------------------------------------\r\n\r\n // Children are laid out by the flow engine; here we view that laid-out\r\n // world through the camera viewport transform, the same way the Camera node\r\n // does. When the camera is at rest (zoom 1, no heading, origin at 0) this is\r\n // the identity, so a plain layout root pays nothing extra.\r\n // Non-null exactly when renderChildren below opens a camera, so a consumer\r\n // reproducing the render transform (node picking) inserts the same scope in\r\n // the same place — and skips it on the at-rest fast path, where the renderer\r\n // pushes nothing at all.\r\n override _cameraScope(): CameraScope | null {\r\n if (this.space3D) return null;\r\n if (this.zoom === 1 && this.heading === 0 && this.lookAt.x === 0 && this.lookAt.y === 0) return null;\r\n return { lookAt: this.lookAt, zoom: this.zoom, heading: this.heading };\r\n }\r\n\r\n override _spaceCamera(): SpaceCamera | null {\r\n if (!this.space3D) return null;\r\n const rect = this.layoutBounds;\r\n return {\r\n perspective: this.perspective,\r\n orbit: this.orbit,\r\n elevation: this.elevation,\r\n dolly: this.dolly,\r\n lookAt: this.lookAt,\r\n zoom: this.zoom,\r\n heading: this.heading,\r\n viewportX: rect?.x ?? 0,\r\n viewportY: -(rect?.y ?? 0),\r\n };\r\n }\r\n\r\n // In a space the stage's own tilt and depth would turn the whole scene as\r\n // one flat card; its `perspective` is the camera's instead.\r\n protected override _projection(): Projection3D {\r\n return this.space3D ? NO_PROJECTION_3D : super._projection();\r\n }\r\n\r\n protected override renderChildren(ctx: RenderPass2D): void {\r\n const camera = this._spaceCamera();\r\n if (camera) {\r\n this._renderInSpace(ctx, spaceRootFrame(this, camera));\r\n return;\r\n }\r\n if (this.zoom === 1 && this.heading === 0 && this.lookAt.x === 0 && this.lookAt.y === 0) {\r\n super.renderChildren(ctx);\r\n return;\r\n }\r\n\r\n const rect = this.layoutBounds;\r\n const w = rect?.width ?? 0;\r\n const h = rect?.height ?? 0;\r\n const cx = rect?.x ?? 0;\r\n const cy = rect?.y ?? 0;\r\n\r\n ctx.beginCamera(\r\n { x: cx, y: -cy, width: w, height: h },\r\n this.lookAt,\r\n this.zoom,\r\n this.heading,\r\n );\r\n\r\n for (const child of this._children) if (child instanceof Node2D) child.render(ctx);\r\n\r\n ctx.endCamera();\r\n }\r\n}\r\n\r\ndeclareMembers(Canvas2D, {\r\n fill: fillProperty(),\r\n overlay: fillProperty(),\r\n flow: flowProperty(),\r\n gap: property({ default: 0 }),\r\n wrap: property({ default: false }),\r\n crossGap: property({ default: undefined }),\r\n columns: property({ default: 1 }),\r\n align: alignmentProperty(),\r\n zoom: property({ default: 1 }),\r\n lookAt: property({ default: { x: 0, y: 0 }, tween: lerpLookAt }),\r\n heading: property({ default: 0 }),\r\n space3D: property({ default: false }),\r\n orbit: property({ default: 0 }),\r\n elevation: property({ default: 0 }),\r\n dolly: property({ default: 0 }),\r\n\r\n zoomTo: command({ args: [{ key: \"zoom\", kind: \"number\", min: 0.01, step: 0.1, unit: \"×\" }] }),\r\n panTo: command({ args: [{ key: \"lookAt\", kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" }, z: { kind: \"number\" } } }] }),\r\n orbitTo: command({ args: [{ key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" }, { key: \"elevation\", kind: \"number\", step: 1, unit: \"°\" }] }),\r\n dollyTo: command({ args: [{ key: \"dolly\", kind: \"number\", step: 10 }] }),\r\n headingTo: command({ args: [{ key: \"heading\", kind: \"number\", step: 1, unit: \"°\" }] }),\r\n fillTo: command(),\r\n overlayTo: command(),\r\n});\r\n"]}
1
+ {"version":3,"file":"canvas2d-node.js","sourceRoot":"","sources":["../../../../src/components/trees/root/canvas2d-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAiC,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAqB,M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EAAE,OAAO,EAAE;IACjB,SAAS,EAAE,OAAO,EAAE;CACvB,CAAC,CAAC","sourcesContent":["import { RenderContext2D, RenderPass2D } from \"@/render/render-context2d\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { Clip } from \"@/render/clip\";\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\nimport { lerpLookAt, type LookAt, type SpaceCamera } from \"@/attributes/layout/space3d\";\nimport { NO_PROJECTION_3D, type Projection3D } from \"@/attributes/layout/matrix2d\";\nimport { Alignment } from \"@/attributes/layout/alignment\";\nimport type { FlowMode, FlowProps, FlowSettings, GapSize } from \"@/layout/types\";\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { Fill } from \"@/attributes/shape/fill/chain\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport { CameraScope, Node2D, NodeConfig, Node2DProps } from \"@/components/trees/2d/node2d\";\nimport { spaceRootFrame } from \"@/components/trees/2d/node-space\";\nimport type { Node, NodeDimension } from \"@/components/trees/node/node\";\nimport { NodeAudio } from \"@/components/trees/audio/node-audio\";\nimport { declareMembers, property } from \"@/attributes/properties/decorator\";\nimport { alignmentProperty, fillProperty, flowProperty } from \"@/attributes/properties/typed\";\n\n/** @internal */\nexport interface Canvas2DProps extends Node2DProps, FlowProps {\n /**\n * Background fill layer(s). Each item can be a CSS color string, a fill\n * prop object, an already-resolved fill, or a {@link FillChain} from the\n * `Fills` builder. Painted behind the scene's children.\n */\n fill: Fill;\n /**\n * Overlay layer(s) — same loose values as {@link fill}, but painted *over*\n * the fill **and** the children (clipped to the viewport). Use for textures\n * laid across the whole scene, e.g. a VHS-grain image or video.\n */\n overlay: Fill;\n /** Camera magnification factor. Values > 1 zoom in; < 1 zoom out. */\n zoom: number;\n /**\n * World-space point that maps to the centre of the viewport. In a\n * {@link space3D} it is also what the camera orbits, and `z` puts it in\n * depth — the same sense as a node's `depth`, so a negative `z` flies in.\n */\n lookAt: LookAt;\n /** Rotation of the camera view in degrees (clockwise). */\n heading: number;\n /**\n * Place the children in one 3D space seen through this camera, rather than\n * each projecting through a perspective of its own. Their `depth` and tilt\n * are then positions and turns in that space, and siblings paint far to\n * near. A switch rather than something read off the camera's numbers, so\n * turning it on can never jump a tween.\n *\n * While it is on, `perspective` is the camera's distance from {@link lookAt}\n * at `dolly: 0` — CSS's convention, so that plane draws 1:1 and `0` is a\n * parallel projection — and the stage's own tilt and depth are unused.\n */\n space3D: boolean;\n /** Degrees about the vertical axis through {@link lookAt}. 0 is head-on; positive moves the camera to the right. Same as `Camera3D`. */\n orbit: number;\n /** Degrees above the layers. Positive looks down on them. Same as `Camera3D`. */\n elevation: number;\n /** Px the camera has moved in toward {@link lookAt}. Inert with no perspective, as depth is. */\n dolly: number;\n}\n\n/**\n * The single root container every clip document builds into.\n *\n * A `Canvas2D` is a plain {@link Node2D} that doubles as the clip's layout frame\n * and camera. It lays its children out (flex `horizontal`/`vertical` or\n * `freeform`, with `gap`, `align`, `padding`) and paints a scene-wide background\n * (`fill`) and `overlay` — *and* views those laid-out children through a viewport\n * transform (`zoom`, `lookAt`, `heading`).\n *\n * Unlike a {@link Rect} it is **not a shape**: it has no stroke, shadow, corner,\n * or `start`/`end` props. It carries only the scene-wide concerns — background\n * paint, child layout, and camera — so `stage.fill`, `stage.flow`, etc. read\n * the root directly without exposing per-shape geometry the scene root never has.\n *\n * Its layout props are the arrangement {@link Node2D} lays its children out by,\n * the same as a {@link Rect}'s — see {@link flowArrangement}.\n */\n/** @internal */\nexport class Canvas2D extends Node2D<Canvas2DProps> {\n\n // ---- Background paint -------------------------------------------------\n // Author-facing paint props. Like Rect, the declared type is the loose\n // `Fill` so assignment (`this.fill = 'red'`) and reads share one type; the\n // property accessor stores the *resolved* value via the mapper.\n declare fill: Fill;\n declare overlay: Fill;\n\n // ---- Layout container -------------------------------------------------\n declare flow: FlowMode;\n declare readonly gap: GapSize;\n declare readonly wrap: boolean;\n // `undefined` means \"follow `gap`\", not \"missing\" — see FlowProps.crossGap.\n declare readonly crossGap: number | undefined;\n declare readonly columns: number;\n // Declared loose as `Alignment` (covers `this.align = 'center'`); the\n // accessor stores the resolved per-axis `Vector2` pivot. See Rect.\n declare align: Alignment;\n\n // ---- Camera -----------------------------------------------------------\n /** Camera magnification factor (default: 1). */\n declare zoom: number;\n /** World-space focus point (default: {x:0, y:0}). */\n declare lookAt: LookAt;\n /** Camera view rotation in degrees (default: 0). */\n declare heading: number;\n declare space3D: boolean;\n declare orbit: number;\n declare elevation: number;\n declare dolly: number;\n\n constructor(props: NodeConfig<Canvas2D, Canvas2DProps>) {\n super(props);\n }\n\n // ---- Camera motion commands -------------------------------------------\n // Mirror the Camera node's viewport commands.\n\n /** Animate `zoom`. Values > 1 zoom in; < 1 zoom out. */\n zoomTo(args: CommandArgs<{ zoom: number }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Pan — animate `lookAt`, the world-space point mapped to the viewport center. `z` moves it in depth. */\n panTo(args: CommandArgs<{ lookAt: LookAt }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n /**\n * Swing the camera round {@link lookAt}. The argument names are the ones the\n * 3D components' `orbitTo` takes, less `zoom`: here that is the lens, not a\n * distance, and it has a command of its own.\n */\n orbitTo(args: CommandArgs<{ orbit?: number; elevation?: number }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Move the camera in toward {@link lookAt} (positive) or back out. */\n dollyTo(args: CommandArgs<{ dolly: number }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Animate the view rotation (`heading`), in degrees clockwise. */\n headingTo(args: CommandArgs<{ heading: number }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n fillTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<Canvas2DProps> {\n const from = this.fill as FillResolved[];\n const target = fillOps.resolve(args.data as Fill);\n const lerp = args.lerp ?? fillOps.lerp;\n return this.command<Canvas2DProps>(t => ({ fill: lerp(from, target, t) }) as Partial<Canvas2DProps>, args.duration, args.easing);\n }\n\n overlayTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<Canvas2DProps> {\n const from = this.overlay as FillResolved[];\n const target = fillOps.resolve(args.data as Fill);\n const lerp = args.lerp ?? fillOps.lerp;\n return this.command<Canvas2DProps>(t => ({ overlay: lerp(from, target, t) }) as Partial<Canvas2DProps>, args.duration, args.easing);\n }\n\n // ---- Layout -----------------------------------------------------------\n\n protected override flowArrangement(): FlowSettings {\n return this;\n }\n\n // ---- Drawing ----------------------------------------------------------\n\n // The viewport-sized background box behind the children.\n private shapeGraphics(): Graphics2D {\n return new Graphics2D().rect({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n });\n }\n\n protected override renderSelf(draw: RenderContext2D): void {\n const fill = this.fill as FillResolved[];\n if (fill.length === 0) return;\n draw.draw(this.shapeGraphics().fill(fill));\n }\n\n // Overlay over fill + children, clipped to the viewport silhouette.\n protected override renderOverlay(ctx: RenderContext2D): void {\n const overlay = this.overlay as FillResolved[];\n if (overlay.length === 0) return;\n ctx.draw(this.shapeGraphics().fill(overlay));\n }\n\n /**\n * Accept audio children as well as 2D ones.\n *\n * The scene root is where the two trees meet, mirroring `Canvas3D` — and for\n * the same reason it is *this* node: a composition already carries both\n * halves of a clip, so a voiceover belongs in the document that shows the\n * picture it is narrating rather than in a second document beside it.\n *\n * Nothing partitions them by hand. `Node2D.children` already filters to its\n * own kind, so layout and render skip the audio subtree for free, and the\n * audio declaration walk reads the unfiltered list.\n */\n protected override acceptsChild(child: Node): boolean {\n return child.dimension === \"2d\" || child.dimension === \"audio\";\n }\n\n override get _childTrees(): readonly NodeDimension[] {\n return [\"2d\", \"audio\"];\n }\n\n /** This node's children in the audio tree. */\n get childrenAudio(): NodeAudio[] {\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\n }\n\n // The world container, not a shape, so it declares its own `fill`/`overlay`.\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets);\n assets.fill(this.fill as FillResolved[]);\n assets.fill(this.overlay as FillResolved[]);\n }\n\n // The viewport outline — used for `clip` and as the area backdrop effects\n // are confined to.\n protected override clipSelf(): Clip {\n return new Clip().rect({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n });\n }\n\n // ---- Rendering --------------------------------------------------------\n\n // Children are laid out by the flow engine; here we view that laid-out\n // world through the camera viewport transform, the same way the Camera node\n // does. When the camera is at rest (zoom 1, no heading, origin at 0) this is\n // the identity, so a plain layout root pays nothing extra.\n // Non-null exactly when renderChildren below opens a camera, so a consumer\n // reproducing the render transform (node picking) inserts the same scope in\n // the same place — and skips it on the at-rest fast path, where the renderer\n // pushes nothing at all.\n override _cameraScope(): CameraScope | null {\n if (this.space3D) return null;\n if (this.zoom === 1 && this.heading === 0 && this.lookAt.x === 0 && this.lookAt.y === 0) return null;\n return { lookAt: this.lookAt, zoom: this.zoom, heading: this.heading };\n }\n\n override _spaceCamera(): SpaceCamera | null {\n if (!this.space3D) return null;\n const rect = this.layoutBounds;\n return {\n perspective: this.perspective,\n orbit: this.orbit,\n elevation: this.elevation,\n dolly: this.dolly,\n lookAt: this.lookAt,\n zoom: this.zoom,\n heading: this.heading,\n viewportX: rect?.x ?? 0,\n viewportY: -(rect?.y ?? 0),\n };\n }\n\n // In a space the stage's own tilt and depth would turn the whole scene as\n // one flat card; its `perspective` is the camera's instead.\n protected override _projection(): Projection3D {\n return this.space3D ? NO_PROJECTION_3D : super._projection();\n }\n\n protected override renderChildren(ctx: RenderPass2D): void {\n const camera = this._spaceCamera();\n if (camera) {\n this._renderInSpace(ctx, spaceRootFrame(this, camera));\n return;\n }\n if (this.zoom === 1 && this.heading === 0 && this.lookAt.x === 0 && this.lookAt.y === 0) {\n super.renderChildren(ctx);\n return;\n }\n\n const rect = this.layoutBounds;\n const w = rect?.width ?? 0;\n const h = rect?.height ?? 0;\n const cx = rect?.x ?? 0;\n const cy = rect?.y ?? 0;\n\n ctx.beginCamera(\n { x: cx, y: -cy, width: w, height: h },\n this.lookAt,\n this.zoom,\n this.heading,\n );\n\n for (const child of this._children) if (child instanceof Node2D) child.render(ctx);\n\n ctx.endCamera();\n }\n}\n\ndeclareMembers(Canvas2D, {\n fill: fillProperty(),\n overlay: fillProperty(),\n flow: flowProperty(),\n gap: property({ default: 0 }),\n wrap: property({ default: false }),\n crossGap: property({ default: undefined }),\n columns: property({ default: 1 }),\n align: alignmentProperty(),\n zoom: property({ default: 1 }),\n lookAt: property({ default: { x: 0, y: 0 }, tween: lerpLookAt }),\n heading: property({ default: 0 }),\n space3D: property({ default: false }),\n orbit: property({ default: 0 }),\n elevation: property({ default: 0 }),\n dolly: property({ default: 0 }),\n\n zoomTo: command({ args: [{ key: \"zoom\", kind: \"number\", min: 0.01, step: 0.1, unit: \"×\" }] }),\n panTo: command({ args: [{ key: \"lookAt\", kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" }, z: { kind: \"number\" } } }] }),\n orbitTo: command({ args: [{ key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" }, { key: \"elevation\", kind: \"number\", step: 1, unit: \"°\" }] }),\n dollyTo: command({ args: [{ key: \"dolly\", kind: \"number\", step: 10 }] }),\n headingTo: command({ args: [{ key: \"heading\", kind: \"number\", step: 1, unit: \"°\" }] }),\n fillTo: command(),\n overlayTo: command(),\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node3d.js","sourceRoot":"","sources":["../../../../src/components/trees/three/node3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,E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AAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { declareMembers, property } from \"@/attributes/properties/decorator\";\r\nimport { optionalVector3Property, quaternionProperty } from \"@/attributes/properties/typed\";\r\nimport {\r\n resolveVector3,\r\n type Euler3, type EulerOrder, type Quaternion, type Vector3, type Vector3Input,\r\n} from \"@/render3d/vector3\";\r\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\r\nimport { Scene3D } from \"@/render3d/scene3d\";\r\nimport { declare3DResources } from \"@/render3d/tracking\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport type { Shadow3D, Transform3D } from \"@/render3d/transform\";\r\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/components/trees/node/node\";\r\nimport type { Command, CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { TweenStepper } from \"@/tween/stepper\";\r\n\r\nexport interface Node3DProps extends NodeProps {\r\n /** Position in the parent's local space. A scalar sets all three axes. */\r\n position: Vector3Input;\r\n /** Position on one axis. The same names 2D uses, one dimension over. */\r\n x: number;\r\n y: number;\r\n z: number;\r\n /**\r\n * Euler rotation in **degrees**, matching 2D `rotation`. Ignored when\r\n * {@link quaternion} is set.\r\n */\r\n rotation: Vector3Input | Euler3;\r\n /** Rotation about one axis, in **degrees**. Same names as 2D's. */\r\n rotationX: number;\r\n rotationY: number;\r\n rotationZ: number;\r\n /** The order the Euler axes are applied in. Default `\"XYZ\"`. */\r\n rotationOrder: EulerOrder;\r\n /**\r\n * Rotation as a unit quaternion. Wins over {@link rotation} — use it for\r\n * tumbles where Euler interpolation would gimbal.\r\n */\r\n quaternion: Quaternion;\r\n /** Per-axis scale; a scalar scales uniformly. Default 1. */\r\n scale: Vector3Input;\r\n scaleX: number;\r\n scaleY: number;\r\n scaleZ: number;\r\n /**\r\n * World-space point to orient toward, applied after {@link position}. Wins\r\n * over both {@link rotation} and {@link quaternion}.\r\n */\r\n lookAt: Vector3Input | undefined;\r\n /** Hide without removing — the cached renderer object stays alive. */\r\n visible: boolean;\r\n /**\r\n * Shadow participation. Default `true`, so turning shadows on for the scene\r\n * turns them on. Pass `false` to opt out, or `\"cast\"`/`\"receive\"` for one half.\r\n */\r\n shadow: Shadow3D;\r\n /** Draw-order override, for tuning transparent sorting. */\r\n renderOrder: number;\r\n}\r\n\r\n/**\r\n * A 3D parent's own coordinates for where its children sit: the units of a\r\n * graph, say. Position only, as a `ChildPlane` is in 2D: a child keeps its\r\n * size, turn and scale. Answered by the parent ({@link Node3D._spaceOf}, or\r\n * `Canvas3D._spaceOf` for a child of the viewport itself).\r\n */\r\nexport interface ChildSpace3D {\r\n /** A child's `x`/`y`/`z` as a point in the parent's local space. */\r\n toLocal(x: number, y: number, z: number): Vector3;\r\n}\r\n\r\n/** A parent that may place its 3D children in coordinates of its own: a `Node3D`, or a 3D viewport. */\r\ninterface SpaceHolder3D {\r\n _spaceOf(child: Node3D | null): ChildSpace3D | null;\r\n}\r\n\r\n/**\r\n * The coordinates `node`'s parent places it by, or `null` when they are the\r\n * parent's local space. The parent may be a 3D node or the viewport holding it.\r\n */\r\n/** @internal */\r\nexport function parentSpaceOf(node: Node3D): ChildSpace3D | null {\r\n const parent = node.parent as Partial<SpaceHolder3D> | null;\r\n return typeof parent?._spaceOf === \"function\" ? parent._spaceOf(node) : null;\r\n}\r\n\r\n/** The three axis props each vector prop distributes into, in order. */\r\nconst VECTOR_SUGAR: Readonly<Record<string, readonly [string, string, string]>> = {\r\n position: [\"x\", \"y\", \"z\"],\r\n rotation: [\"rotationX\", \"rotationY\", \"rotationZ\"],\r\n scale: [\"scaleX\", \"scaleY\", \"scaleZ\"],\r\n};\r\n\r\n/**\r\n * A thing in 3D space — the root of the 3D scene graph.\r\n *\r\n * The sibling of {@link Node2D}: same tree, same props, same `to()`/`set()`/\r\n * `save()`/`restore()`, same refs, context and per-node clock, all inherited from\r\n * {@link Node}. What differs is the only thing that genuinely differs between the\r\n * two — how a node is placed and how it draws. There is no `width`, no `padding`,\r\n * no anchor and no flex here, because none of them mean anything for a mesh; a 3D\r\n * node's whole placement is its transform.\r\n *\r\n * Canvas3D({\r\n * children: [\r\n * Camera3D({ orbit: 30, elevation: 18, distance: 6 }),\r\n * AmbientLight3D({ intensity: 0.4 }),\r\n * Group3D({ ref: rig, children: [Box3D({ width: 2, cornerRadius: 0.15, fill: \"tomato\" })] }),\r\n * ],\r\n * })\r\n *\r\n * rig().to({ data: { rotationY: 360, y: 1 }, duration: 2 });\r\n *\r\n * ── Axes are scalars, and vectors are sugar over them ─────────────────────────\r\n * `x`, `y`, `z`, `rotationX/Y/Z` and `scaleX/Y/Z` are the real props, and they\r\n * are named exactly what 2D names them. `position`, `rotation` and `scale` are\r\n * distributed into those three, the way `Node2D` already distributes `size` into\r\n * `width`/`height` — so both spellings tween identically and there is one source\r\n * of truth for where a node is. That is what makes `to({ y: 3 })` work: with a\r\n * single vector prop it would have had nothing to interpolate on the other two\r\n * axes, which is exactly the trap that made every 3D scene restate coordinates it\r\n * did not mean to change.\r\n *\r\n * A `Node3D` only ever lives under a `Canvas3D` — the one node that holds both\r\n * dimensions. Parenting one to a `Rect` throws rather than silently drawing\r\n * nothing (see {@link Node.acceptsChild}). Every 3D node type is a\r\n * `component3d`, which lowers onto this class and draws from its `render`.\r\n */\r\nexport class Node3D<P extends Node3DProps = Node3DProps> extends Node<P> {\r\n get dimension(): NodeDimension { return \"3d\"; }\r\n\r\n declare x: number;\r\n declare y: number;\r\n declare z: number;\r\n\r\n declare rotationX: number;\r\n declare rotationY: number;\r\n declare rotationZ: number;\r\n declare rotationOrder: EulerOrder;\r\n\r\n declare quaternion: Quaternion;\r\n\r\n declare scaleX: number;\r\n declare scaleY: number;\r\n declare scaleZ: number;\r\n\r\n declare lookAt: Vector3Input | undefined;\r\n declare visible: boolean;\r\n declare shadow: Shadow3D;\r\n declare renderOrder: number;\r\n\r\n constructor(props?: NodeConfig<any, P>) {\r\n super(props);\r\n // Distributed before `initProps`, which only ever applies keys that are\r\n // registered props — a `position` left in the bag would be dropped.\r\n this.initProps(distributeVectors(props) as NodeConfig<any, P>);\r\n this.adoptChildrenProp(props);\r\n }\r\n\r\n /** Animate the position, whichever axes are given; the rest stay where they are. */\r\n moveTo(args: CommandArgs<{ x?: number; y?: number; z?: number }> & { duration: number }): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the Euler rotation, in degrees, whichever axes are given. */\r\n rotateTo(\r\n args: CommandArgs<{ rotationX?: number; rotationY?: number; rotationZ?: number }> & { duration: number },\r\n ): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the scale: `scale` on every axis, and any axis given beside it on that one. */\r\n scaleTo(\r\n args: CommandArgs<{ scale?: number; scaleX?: number; scaleY?: number; scaleZ?: number }> & { duration: number },\r\n ): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** This node's position, composed from the axis props. */\r\n get position(): Vector3 {\r\n return { x: this.x, y: this.y, z: this.z };\r\n }\r\n set position(value: Vector3Input) {\r\n this.set({ position: value } as never);\r\n }\r\n\r\n /** This node's Euler rotation in degrees, composed from the axis props. */\r\n get rotation(): Euler3 {\r\n return { x: this.rotationX, y: this.rotationY, z: this.rotationZ, order: this.rotationOrder };\r\n }\r\n set rotation(value: Vector3Input | Euler3) {\r\n this.set({ rotation: value } as never);\r\n }\r\n\r\n /** This node's scale, composed from the axis props. */\r\n get scale(): Vector3 {\r\n return { x: this.scaleX, y: this.scaleY, z: this.scaleZ };\r\n }\r\n set scale(value: Vector3Input) {\r\n this.set({ scale: value } as never);\r\n }\r\n\r\n /**\r\n * Distribute the vector sugar into axis props, then write as usual.\r\n *\r\n * Same shape as `Node2D.set`'s handling of `size`, and for the same reason:\r\n * `position` has no slot of its own, so it has to become three writes\r\n * before the generic loop runs. An explicitly stated axis in the same call\r\n * wins over the vector, which is what lets `{ position: p, y: 0 }` mean what\r\n * it reads like.\r\n */\r\n override set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\r\n super.set(distributeVectors(props) as typeof props);\r\n }\r\n\r\n /**\r\n * The tween half of the same rule. Expanded here rather than in the command\r\n * so `to({ position: [...] })` and `to({ x, y, z })` produce identical\r\n * steppers — one interpolating path, whichever way it was written.\r\n */\r\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\r\n return super._prepareStep(distributeVectors(to) as Partial<P>, duration, easing);\r\n }\r\n\r\n /**\r\n * This node's placement, as the renderer's own vocabulary.\r\n *\r\n * Sampled fresh every frame from the prop slots, so a tween moves the object\r\n * without anything here caching state between frames.\r\n *\r\n * `quaternion` is only emitted when it has been set away from identity: it\r\n * wins over `rotation` in a {@link Transform3D}, so always sending it would\r\n * make `rotation` silently do nothing.\r\n */\r\n protected transform3D(): Transform3D {\r\n const quaternion = this.quaternion as unknown as Quaternion;\r\n const identityQuaternion =\r\n quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;\r\n const space = parentSpaceOf(this);\r\n return {\r\n position: space ? space.toLocal(this.x, this.y, this.z) : this.position,\r\n rotation: this.rotation,\r\n quaternion: identityQuaternion ? undefined : quaternion,\r\n scale: this.scale,\r\n lookAt: this.lookAt,\r\n visible: this.visible,\r\n shadow: this.shadow,\r\n renderOrder: this.renderOrder,\r\n };\r\n }\r\n\r\n /**\r\n * The coordinates `child`'s `x`/`y`/`z` are in, or `null` (the default) when\r\n * they are this node's local space. A `null` child is one not here yet.\r\n */\r\n /** @internal */\r\n _spaceOf(_child: Node3D | null): ChildSpace3D | null {\r\n return null;\r\n }\r\n\r\n /**\r\n * The transform that goes on this node's *group* — the scope its children\r\n * nest inside. Defaults to this node's own placement, which is right for\r\n * everything that lives at its own origin.\r\n *\r\n * A camera answers identity and places itself instead: three aims a\r\n * camera's -Z at `lookAt` but a plain group's +Z, so hanging a camera's\r\n * placement on its group would point the shot backwards.\r\n */\r\n protected groupTransform(): Transform3D {\r\n return this.transform3D();\r\n }\r\n\r\n /**\r\n * Draw this node's own contribution to the scene — a `ctx.draw(graphics3D)`\r\n * for something with geometry, a `ctx.light(...)` for a light, nothing at all\r\n * for a plain {@link Group3D}. Children are recorded after it, nested inside\r\n * this node's transform.\r\n */\r\n protected renderSelf(ctx: RenderContext3D): void { }\r\n\r\n /**\r\n * Record this node and its subtree into `ctx`.\r\n *\r\n * An invisible node still opens its scope: `visible: false` is a renderer-side\r\n * flag on a live object rather than a removal, which is what lets a node be\r\n * hidden and shown again without its GPU resources being rebuilt. Skipping the\r\n * walk here would instead sweep the whole subtree out of the cache.\r\n */\r\n render(ctx: RenderContext3D): void {\r\n // The editor's flag folds into `visible` rather than adding a second one:\r\n // the 3D side already has exactly this concept, honoured by the picking\r\n // walk, and two flags meaning \"do not show this\" would be two places to\r\n // ask. Still opens its scope — see the note above on why an invisible\r\n // node keeps its cached renderer object.\r\n if (this.hidden) {\r\n ctx.begin({ id: this.id, transform: { ...this.groupTransform(), visible: false } });\r\n ctx.end();\r\n return;\r\n }\r\n ctx.begin({ id: this.id, transform: this.groupTransform() });\r\n this.renderSelf(ctx);\r\n for (const child of this._children) {\r\n if (child instanceof Node3D) child.render(ctx);\r\n }\r\n ctx.end();\r\n }\r\n\r\n /**\r\n * What {@link renderSelf} records, never {@link render}: the placement lives on\r\n * the group scope, so moving a node does not change what it declares.\r\n */\r\n declareAssets(assets: AssetScope): void {\r\n if (this.renderSelf === Node3D.prototype.renderSelf) return;\r\n const scene = new Scene3D();\r\n this.renderSelf(scene);\r\n declare3DResources(scene, assets);\r\n }\r\n}\r\n\r\ndeclareMembers(Node3D, {\r\n x: property({ default: 0 }),\r\n y: property({ default: 0 }),\r\n z: property({ default: 0 }),\r\n rotationX: property({ default: 0 }),\r\n rotationY: property({ default: 0 }),\r\n rotationZ: property({ default: 0 }),\r\n rotationOrder: property({ default: \"XYZ\" }),\r\n quaternion: quaternionProperty(),\r\n scaleX: property({ default: 1 }),\r\n scaleY: property({ default: 1 }),\r\n scaleZ: property({ default: 1 }),\r\n lookAt: optionalVector3Property(\"snap\"),\r\n visible: property({ default: true }),\r\n shadow: property({ default: true }),\r\n renderOrder: property({ default: 0 }),\r\n\r\n moveTo: command({ args: [\"x\", \"y\", \"z\"] }),\r\n rotateTo: command({ args: [\"rotationX\", \"rotationY\", \"rotationZ\"] }),\r\n scaleTo: command({\r\n args: [{ key: \"scale\", kind: \"number\", min: 0, step: 0.05, unit: \"×\" }, \"scaleX\", \"scaleY\", \"scaleZ\"],\r\n }),\r\n});\r\n\r\n/**\r\n * Expand `position`/`rotation`/`scale` in a prop bag into their axis props.\r\n *\r\n * Returns the bag untouched when it names none of them, so the common write path\r\n * allocates nothing. A **binding** expands into three bindings that each resolve\r\n * the vector and take one component — so `position={() => lift()}` stays a\r\n * binding, and one thunk driving all three axes is still read once per axis per\r\n * frame rather than being frozen at bind time.\r\n */\r\nfunction distributeVectors<T extends object>(props: T | undefined): T | undefined {\r\n if (!props) return props;\r\n\r\n let out: Record<string, unknown> | undefined;\r\n\r\n for (const key in VECTOR_SUGAR) {\r\n const value = (props as Record<string, unknown>)[key];\r\n if (value === undefined) continue;\r\n\r\n out ??= { ...(props as Record<string, unknown>) };\r\n delete out[key];\r\n\r\n const axes = VECTOR_SUGAR[key];\r\n\r\n if (typeof value === \"function\") {\r\n const read = value as () => Vector3Input;\r\n for (let i = 0; i < 3; i++) {\r\n const axis = axes[i];\r\n if (out[axis] !== undefined) continue;\r\n out[axis] = () => componentOf(resolveVector3(read()), i);\r\n }\r\n continue;\r\n }\r\n\r\n const vector = resolveVector3(value as Vector3Input);\r\n for (let i = 0; i < 3; i++) {\r\n const axis = axes[i];\r\n if (out[axis] === undefined) out[axis] = componentOf(vector, i);\r\n }\r\n\r\n // `order` rides on an Euler and has nowhere else to go.\r\n if (key === \"rotation\") {\r\n const order = (value as Euler3).order;\r\n if (order !== undefined && out.rotationOrder === undefined) out.rotationOrder = order;\r\n }\r\n }\r\n\r\n return (out as T) ?? props;\r\n}\r\n\r\n/** `data` without the keys left unstated, so a tween never aims an axis at `undefined`. */\r\nfunction stated<T extends object>(data: T | undefined): Partial<T> {\r\n const out: Partial<T> = {};\r\n for (const key in data) if (data[key] !== undefined) out[key] = data[key];\r\n return out;\r\n}\r\n\r\nfunction componentOf(vector: Vector3, index: number): number {\r\n return index === 0 ? vector.x : index === 1 ? vector.y : vector.z;\r\n}\r\n"]}
1
+ {"version":3,"file":"node3d.js","sourceRoot":"","sources":["../../../../src/components/trees/three/node3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EACH,cAAc,GAEjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,IAAI,EAAuD,MAAM,8BAA8B,CAAC;AAEzG,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAgEpD;;;GAGG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,IAAY;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAuC,CAAC;IAC5D,OAAO,OAAO,MAAM,EAAE,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjF,CAAC;AAED,wEAAwE;AACxE,MAAM,YAAY,GAAgE;IAC9E,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACzB,QAAQ,EAAE,CAA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AQ,GAAS,IAAI,KAAK,CAAC;AAC/B,CAAC;AAED,2FAA2F;AAC3F,SAAS,MAAM,CAAmB,IAAmB;IACjD,MAAM,GAAG,GAAe,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,IAAI;QAAE,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1E,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,MAAe,EAAE,KAAa;IAC/C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { declareMembers, property } from \"@/attributes/properties/decorator\";\nimport { optionalVector3Property, quaternionProperty } from \"@/attributes/properties/typed\";\nimport {\n resolveVector3,\n type Euler3, type EulerOrder, type Quaternion, type Vector3, type Vector3Input,\n} from \"@/render3d/vector3\";\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\nimport { Scene3D } from \"@/render3d/scene3d\";\nimport { declare3DResources } from \"@/render3d/tracking\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport type { Shadow3D, Transform3D } from \"@/render3d/transform\";\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/components/trees/node/node\";\nimport type { Command, CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport type { TweenStepper } from \"@/tween/stepper\";\n\nexport interface Node3DProps extends NodeProps {\n /** Position in the parent's local space. A scalar sets all three axes. */\n position: Vector3Input;\n /** Position on one axis. The same names 2D uses, one dimension over. */\n x: number;\n y: number;\n z: number;\n /**\n * Euler rotation in **degrees**, matching 2D `rotation`. Ignored when\n * {@link quaternion} is set.\n */\n rotation: Vector3Input | Euler3;\n /** Rotation about one axis, in **degrees**. Same names as 2D's. */\n rotationX: number;\n rotationY: number;\n rotationZ: number;\n /** The order the Euler axes are applied in. Default `\"XYZ\"`. */\n rotationOrder: EulerOrder;\n /**\n * Rotation as a unit quaternion. Wins over {@link rotation} — use it for\n * tumbles where Euler interpolation would gimbal.\n */\n quaternion: Quaternion;\n /** Per-axis scale; a scalar scales uniformly. Default 1. */\n scale: Vector3Input;\n scaleX: number;\n scaleY: number;\n scaleZ: number;\n /**\n * World-space point to orient toward, applied after {@link position}. Wins\n * over both {@link rotation} and {@link quaternion}.\n */\n lookAt: Vector3Input | undefined;\n /** Hide without removing — the cached renderer object stays alive. */\n visible: boolean;\n /**\n * Shadow participation. Default `true`, so turning shadows on for the scene\n * turns them on. Pass `false` to opt out, or `\"cast\"`/`\"receive\"` for one half.\n */\n shadow: Shadow3D;\n /** Draw-order override, for tuning transparent sorting. */\n renderOrder: number;\n}\n\n/**\n * A 3D parent's own coordinates for where its children sit: the units of a\n * graph, say. Position only, as a `ChildPlane` is in 2D: a child keeps its\n * size, turn and scale. Answered by the parent ({@link Node3D._spaceOf}, or\n * `Canvas3D._spaceOf` for a child of the viewport itself).\n */\nexport interface ChildSpace3D {\n /** A child's `x`/`y`/`z` as a point in the parent's local space. */\n toLocal(x: number, y: number, z: number): Vector3;\n}\n\n/** A parent that may place its 3D children in coordinates of its own: a `Node3D`, or a 3D viewport. */\ninterface SpaceHolder3D {\n _spaceOf(child: Node3D | null): ChildSpace3D | null;\n}\n\n/**\n * The coordinates `node`'s parent places it by, or `null` when they are the\n * parent's local space. The parent may be a 3D node or the viewport holding it.\n */\n/** @internal */\nexport function parentSpaceOf(node: Node3D): ChildSpace3D | null {\n const parent = node.parent as Partial<SpaceHolder3D> | null;\n return typeof parent?._spaceOf === \"function\" ? parent._spaceOf(node) : null;\n}\n\n/** The three axis props each vector prop distributes into, in order. */\nconst VECTOR_SUGAR: Readonly<Record<string, readonly [string, string, string]>> = {\n position: [\"x\", \"y\", \"z\"],\n rotation: [\"rotationX\", \"rotationY\", \"rotationZ\"],\n scale: [\"scaleX\", \"scaleY\", \"scaleZ\"],\n};\n\n/**\n * A thing in 3D space — the root of the 3D scene graph.\n *\n * The sibling of {@link Node2D}: same tree, same props, same `to()`/`set()`/\n * `save()`/`restore()`, same refs, context and per-node clock, all inherited from\n * {@link Node}. What differs is the only thing that genuinely differs between the\n * two — how a node is placed and how it draws. There is no `width`, no `padding`,\n * no anchor and no flex here, because none of them mean anything for a mesh; a 3D\n * node's whole placement is its transform.\n *\n * Canvas3D({\n * children: [\n * Camera3D({ orbit: 30, elevation: 18, distance: 6 }),\n * AmbientLight3D({ intensity: 0.4 }),\n * Group3D({ ref: rig, children: [Box3D({ width: 2, cornerRadius: 0.15, fill: \"tomato\" })] }),\n * ],\n * })\n *\n * rig().to({ data: { rotationY: 360, y: 1 }, duration: 2 });\n *\n * ── Axes are scalars, and vectors are sugar over them ─────────────────────────\n * `x`, `y`, `z`, `rotationX/Y/Z` and `scaleX/Y/Z` are the real props, and they\n * are named exactly what 2D names them. `position`, `rotation` and `scale` are\n * distributed into those three, the way `Node2D` already distributes `size` into\n * `width`/`height` — so both spellings tween identically and there is one source\n * of truth for where a node is. That is what makes `to({ y: 3 })` work: with a\n * single vector prop it would have had nothing to interpolate on the other two\n * axes, which is exactly the trap that made every 3D scene restate coordinates it\n * did not mean to change.\n *\n * A `Node3D` only ever lives under a `Canvas3D` — the one node that holds both\n * dimensions. Parenting one to a `Rect` throws rather than silently drawing\n * nothing (see {@link Node.acceptsChild}). Every 3D node type is a\n * `component3d`, which lowers onto this class and draws from its `render`.\n */\nexport class Node3D<P extends Node3DProps = Node3DProps> extends Node<P> {\n get dimension(): NodeDimension { return \"3d\"; }\n\n declare x: number;\n declare y: number;\n declare z: number;\n\n declare rotationX: number;\n declare rotationY: number;\n declare rotationZ: number;\n declare rotationOrder: EulerOrder;\n\n declare quaternion: Quaternion;\n\n declare scaleX: number;\n declare scaleY: number;\n declare scaleZ: number;\n\n declare lookAt: Vector3Input | undefined;\n declare visible: boolean;\n declare shadow: Shadow3D;\n declare renderOrder: number;\n\n constructor(props?: NodeConfig<any, P>) {\n super(props);\n // Distributed before `initProps`, which only ever applies keys that are\n // registered props — a `position` left in the bag would be dropped.\n this.initProps(distributeVectors(props) as NodeConfig<any, P>);\n this.adoptChildrenProp(props);\n }\n\n /** Animate the position, whichever axes are given; the rest stay where they are. */\n moveTo(args: CommandArgs<{ x?: number; y?: number; z?: number }> & { duration: number }): Command<P> {\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\n }\n\n /** Animate the Euler rotation, in degrees, whichever axes are given. */\n rotateTo(\n args: CommandArgs<{ rotationX?: number; rotationY?: number; rotationZ?: number }> & { duration: number },\n ): Command<P> {\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\n }\n\n /** Animate the scale: `scale` on every axis, and any axis given beside it on that one. */\n scaleTo(\n args: CommandArgs<{ scale?: number; scaleX?: number; scaleY?: number; scaleZ?: number }> & { duration: number },\n ): Command<P> {\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\n }\n\n /** This node's position, composed from the axis props. */\n get position(): Vector3 {\n return { x: this.x, y: this.y, z: this.z };\n }\n set position(value: Vector3Input) {\n this.set({ position: value } as never);\n }\n\n /** This node's Euler rotation in degrees, composed from the axis props. */\n get rotation(): Euler3 {\n return { x: this.rotationX, y: this.rotationY, z: this.rotationZ, order: this.rotationOrder };\n }\n set rotation(value: Vector3Input | Euler3) {\n this.set({ rotation: value } as never);\n }\n\n /** This node's scale, composed from the axis props. */\n get scale(): Vector3 {\n return { x: this.scaleX, y: this.scaleY, z: this.scaleZ };\n }\n set scale(value: Vector3Input) {\n this.set({ scale: value } as never);\n }\n\n /**\n * Distribute the vector sugar into axis props, then write as usual.\n *\n * Same shape as `Node2D.set`'s handling of `size`, and for the same reason:\n * `position` has no slot of its own, so it has to become three writes\n * before the generic loop runs. An explicitly stated axis in the same call\n * wins over the vector, which is what lets `{ position: p, y: 0 }` mean what\n * it reads like.\n */\n override set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\n super.set(distributeVectors(props) as typeof props);\n }\n\n /**\n * The tween half of the same rule. Expanded here rather than in the command\n * so `to({ position: [...] })` and `to({ x, y, z })` produce identical\n * steppers — one interpolating path, whichever way it was written.\n */\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\n return super._prepareStep(distributeVectors(to) as Partial<P>, duration, easing);\n }\n\n /**\n * This node's placement, as the renderer's own vocabulary.\n *\n * Sampled fresh every frame from the prop slots, so a tween moves the object\n * without anything here caching state between frames.\n *\n * `quaternion` is only emitted when it has been set away from identity: it\n * wins over `rotation` in a {@link Transform3D}, so always sending it would\n * make `rotation` silently do nothing.\n */\n protected transform3D(): Transform3D {\n const quaternion = this.quaternion as unknown as Quaternion;\n const identityQuaternion =\n quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;\n const space = parentSpaceOf(this);\n return {\n position: space ? space.toLocal(this.x, this.y, this.z) : this.position,\n rotation: this.rotation,\n quaternion: identityQuaternion ? undefined : quaternion,\n scale: this.scale,\n lookAt: this.lookAt,\n visible: this.visible,\n shadow: this.shadow,\n renderOrder: this.renderOrder,\n };\n }\n\n /**\n * The coordinates `child`'s `x`/`y`/`z` are in, or `null` (the default) when\n * they are this node's local space. A `null` child is one not here yet.\n */\n /** @internal */\n _spaceOf(_child: Node3D | null): ChildSpace3D | null {\n return null;\n }\n\n /**\n * The transform that goes on this node's *group* — the scope its children\n * nest inside. Defaults to this node's own placement, which is right for\n * everything that lives at its own origin.\n *\n * A camera answers identity and places itself instead: three aims a\n * camera's -Z at `lookAt` but a plain group's +Z, so hanging a camera's\n * placement on its group would point the shot backwards.\n */\n protected groupTransform(): Transform3D {\n return this.transform3D();\n }\n\n /**\n * Draw this node's own contribution to the scene — a `ctx.draw(graphics3D)`\n * for something with geometry, a `ctx.light(...)` for a light, nothing at all\n * for a plain {@link Group3D}. Children are recorded after it, nested inside\n * this node's transform.\n */\n protected renderSelf(ctx: RenderContext3D): void { }\n\n /**\n * Record this node and its subtree into `ctx`.\n *\n * An invisible node still opens its scope: `visible: false` is a renderer-side\n * flag on a live object rather than a removal, which is what lets a node be\n * hidden and shown again without its GPU resources being rebuilt. Skipping the\n * walk here would instead sweep the whole subtree out of the cache.\n */\n render(ctx: RenderContext3D): void {\n // The editor's flag folds into `visible` rather than adding a second one:\n // the 3D side already has exactly this concept, honoured by the picking\n // walk, and two flags meaning \"do not show this\" would be two places to\n // ask. Still opens its scope — see the note above on why an invisible\n // node keeps its cached renderer object.\n if (this.hidden) {\n ctx.begin({ id: this.id, transform: { ...this.groupTransform(), visible: false } });\n ctx.end();\n return;\n }\n ctx.begin({ id: this.id, transform: this.groupTransform() });\n this.renderSelf(ctx);\n for (const child of this._children) {\n if (child instanceof Node3D) child.render(ctx);\n }\n ctx.end();\n }\n\n /**\n * What {@link renderSelf} records, never {@link render}: the placement lives on\n * the group scope, so moving a node does not change what it declares.\n */\n declareAssets(assets: AssetScope): void {\n if (this.renderSelf === Node3D.prototype.renderSelf) return;\n const scene = new Scene3D();\n this.renderSelf(scene);\n declare3DResources(scene, assets);\n }\n}\n\ndeclareMembers(Node3D, {\n x: property({ default: 0 }),\n y: property({ default: 0 }),\n z: property({ default: 0 }),\n rotationX: property({ default: 0 }),\n rotationY: property({ default: 0 }),\n rotationZ: property({ default: 0 }),\n rotationOrder: property({ default: \"XYZ\" }),\n quaternion: quaternionProperty(),\n scaleX: property({ default: 1 }),\n scaleY: property({ default: 1 }),\n scaleZ: property({ default: 1 }),\n lookAt: optionalVector3Property(\"snap\"),\n visible: property({ default: true }),\n shadow: property({ default: true }),\n renderOrder: property({ default: 0 }),\n\n moveTo: command({ args: [\"x\", \"y\", \"z\"] }),\n rotateTo: command({ args: [\"rotationX\", \"rotationY\", \"rotationZ\"] }),\n scaleTo: command({\n args: [{ key: \"scale\", kind: \"number\", min: 0, step: 0.05, unit: \"×\" }, \"scaleX\", \"scaleY\", \"scaleZ\"],\n }),\n});\n\n/**\n * Expand `position`/`rotation`/`scale` in a prop bag into their axis props.\n *\n * Returns the bag untouched when it names none of them, so the common write path\n * allocates nothing. A **binding** expands into three bindings that each resolve\n * the vector and take one component — so `position={() => lift()}` stays a\n * binding, and one thunk driving all three axes is still read once per axis per\n * frame rather than being frozen at bind time.\n */\nfunction distributeVectors<T extends object>(props: T | undefined): T | undefined {\n if (!props) return props;\n\n let out: Record<string, unknown> | undefined;\n\n for (const key in VECTOR_SUGAR) {\n const value = (props as Record<string, unknown>)[key];\n if (value === undefined) continue;\n\n out ??= { ...(props as Record<string, unknown>) };\n delete out[key];\n\n const axes = VECTOR_SUGAR[key];\n\n if (typeof value === \"function\") {\n const read = value as () => Vector3Input;\n for (let i = 0; i < 3; i++) {\n const axis = axes[i];\n if (out[axis] !== undefined) continue;\n out[axis] = () => componentOf(resolveVector3(read()), i);\n }\n continue;\n }\n\n const vector = resolveVector3(value as Vector3Input);\n for (let i = 0; i < 3; i++) {\n const axis = axes[i];\n if (out[axis] === undefined) out[axis] = componentOf(vector, i);\n }\n\n // `order` rides on an Euler and has nowhere else to go.\n if (key === \"rotation\") {\n const order = (value as Euler3).order;\n if (order !== undefined && out.rotationOrder === undefined) out.rotationOrder = order;\n }\n }\n\n return (out as T) ?? props;\n}\n\n/** `data` without the keys left unstated, so a tween never aims an axis at `undefined`. */\nfunction stated<T extends object>(data: T | undefined): Partial<T> {\n const out: Partial<T> = {};\n for (const key in data) if (data[key] !== undefined) out[key] = data[key];\n return out;\n}\n\nfunction componentOf(vector: Vector3, index: number): number {\n return index === 0 ? vector.x : index === 1 ? vector.y : vector.z;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/document/audio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eA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AC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;SAC7D,CAAC,CAAC;IACP,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC1C,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvE,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import type { AudioDocument, ClipDocument, CommandSpec, CompositionDocument, NodeSpec, TimedNodeSpec, VisualDocument } from \"./types\";\r\nimport { isAudioDocument, isStillDocument, nodeSpan } from \"./types\";\r\n\r\n/**\r\n * The id the authored root bus is rewritten to.\r\n *\r\n * Namespaced like every other synthesized id in the document layer, so it can\r\n * never collide with one a document authored itself.\r\n */\r\nconst AUDIO_ROOT_ID = \"@bus\";\r\n\r\n/** The root bus when an audio document doesn't author one explicitly. */\r\nfunction defaultRootBus(): NodeSpec {\r\n return { id: AUDIO_ROOT_ID, type: \"audioBus\", parentId: null, layerOrder: 0, props: {} };\r\n}\r\n\r\n/** The root a lowered audio clip hangs from. Draws nothing; lays out once. */\r\nfunction clipRoot(): NodeSpec {\r\n return { id: \"\", type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\r\n}\r\n\r\n/**\r\n * An audio document, as the composition it already is.\r\n *\r\n * There is no second evaluator for sound, and this is what keeps it that way:\r\n * an audio clip is compiled, seeked and restored by `ClipTimeline` like any\r\n * other, so a bus fade and a rectangle's fade cannot drift because there is only\r\n * one machine running them.\r\n *\r\n * The only thing that has to be arranged is the root. An audio document's own\r\n * root is a bus, but a clip's root is always a `Canvas2D` — so the bus\r\n * becomes that canvas's single audio child under {@link AUDIO_ROOT_ID}, and\r\n * every `targetId: null` / `parentId: null` is rewritten to name it. The canvas\r\n * draws nothing and lays out an empty box once, which is the whole cost of a\r\n * clip that is only sound.\r\n */\r\nexport function loweredAudioDocument(doc: AudioDocument): CompositionDocument {\r\n const nodes: TimedNodeSpec[] = [clipRoot()];\r\n if (!doc.nodes.some(isRootBus)) nodes.push(defaultRootBus());\r\n for (const spec of doc.nodes) nodes.push(reparent(spec));\r\n\r\n return {\r\n kind: \"composition\",\r\n duration: doc.duration,\r\n variables: doc.variables,\r\n nodes,\r\n commands: doc.commands.map(retarget),\r\n };\r\n}\r\n\r\n/** The row an audio document means as its root bus. */\r\nfunction isRootBus(spec: NodeSpec): boolean {\r\n return spec.id === \"\" && spec.type === \"audioBus\";\r\n}\r\n\r\n/** A node spec with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\r\nfunction reparent(spec: TimedNodeSpec): TimedNodeSpec {\r\n if (isRootBus(spec)) return { ...spec, id: AUDIO_ROOT_ID, parentId: null };\r\n // `null` is the document's own convention for \"the root\"; `\"\"` is the same\r\n // row named by id, which `checkTree` also resolves. Both mean the bus.\r\n if (spec.parentId === null || spec.parentId === \"\") return { ...spec, parentId: AUDIO_ROOT_ID };\r\n return spec;\r\n}\r\n\r\n/** A command with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\r\nfunction retarget(command: CommandSpec): CommandSpec {\r\n if (command.targetId === null || command.targetId === \"\") {\r\n return { ...command, targetId: AUDIO_ROOT_ID };\r\n }\r\n return command;\r\n}\r\n\r\nexport { AUDIO_ROOT_ID };\r\n\r\n/**\r\n * A `sound` or `video` row with no `play` command of its own plays as it did\r\n * before sound came only from commands: a sound over its span (open-ended, to\r\n * its own end), a video once per segment, or over its span while it plays.\r\n */\r\nexport function withPlayedSounds(doc: CompositionDocument): CompositionDocument {\r\n const played = new Set(doc.commands.filter((c) => c.type === \"play\").map((c) => c.targetId));\r\n const added: CommandSpec[] = [];\r\n for (const spec of doc.nodes) {\r\n if ((spec.type !== \"sound\" && spec.type !== \"video\") || played.has(spec.id)) continue;\r\n const { start, end } = nodeSpan(spec);\r\n const segments = spec.type === \"video\" ? (spec.props as { segments?: unknown }).segments : undefined;\r\n if (Array.isArray(segments) && segments.length > 0) {\r\n (segments as { at: number; from: number; duration: number; speed?: number; volume?: number }[]).forEach((segment, i) => {\r\n added.push({\r\n // An endless segment plays to the source's end: a command has no endless length.\r\n id: `@play:${spec.id}:${i}`, type: \"play\", targetId: spec.id, at: start + segment.at,\r\n duration: Number.isFinite(segment.duration) ? segment.duration : 0,\r\n args: {\r\n from: segment.from,\r\n ...(segment.speed !== undefined && { speed: segment.speed }),\r\n ...(segment.volume !== undefined && { volume: segment.volume }),\r\n },\r\n });\r\n });\r\n continue;\r\n }\r\n added.push({\r\n id: `@play:${spec.id}`, type: \"play\", targetId: spec.id, at: start,\r\n duration: Number.isFinite(end) ? end - start : 0, args: {},\r\n });\r\n }\r\n return added.length === 0 ? doc : { ...doc, commands: [...doc.commands, ...added] };\r\n}\r\n\r\n/** A clip as its timeline builds it: an audio document lowered to the composition it is, its sounds played. */\r\nexport function clipDocument(doc: ClipDocument): VisualDocument {\r\n const lowered = isAudioDocument(doc) ? loweredAudioDocument(doc) : doc;\r\n return isStillDocument(lowered) ? lowered : withPlayedSounds(lowered);\r\n}\r\n"]}
1
+ {"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/document/audio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErE;;;;;GAKG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,yEAAyE;AACzE,SAAS,cAAc;IACnB,OAAO,EA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KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC1C,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvE,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import type { AudioDocument, ClipDocument, CommandSpec, CompositionDocument, NodeSpec, TimedNodeSpec, VisualDocument } from \"./types\";\nimport { isAudioDocument, isStillDocument, nodeSpan } from \"./types\";\n\n/**\n * The id the authored root bus is rewritten to.\n *\n * Namespaced like every other synthesized id in the document layer, so it can\n * never collide with one a document authored itself.\n */\nconst AUDIO_ROOT_ID = \"@bus\";\n\n/** The root bus when an audio document doesn't author one explicitly. */\nfunction defaultRootBus(): NodeSpec {\n return { id: AUDIO_ROOT_ID, type: \"audioBus\", parentId: null, layerOrder: 0, props: {} };\n}\n\n/** The root a lowered audio clip hangs from. Draws nothing; lays out once. */\nfunction clipRoot(): NodeSpec {\n return { id: \"\", type: \"canvas2d\", parentId: null, layerOrder: 0, props: {} };\n}\n\n/**\n * An audio document, as the composition it already is.\n *\n * There is no second evaluator for sound, and this is what keeps it that way:\n * an audio clip is compiled, seeked and restored by `ClipTimeline` like any\n * other, so a bus fade and a rectangle's fade cannot drift because there is only\n * one machine running them.\n *\n * The only thing that has to be arranged is the root. An audio document's own\n * root is a bus, but a clip's root is always a `Canvas2D` — so the bus\n * becomes that canvas's single audio child under {@link AUDIO_ROOT_ID}, and\n * every `targetId: null` / `parentId: null` is rewritten to name it. The canvas\n * draws nothing and lays out an empty box once, which is the whole cost of a\n * clip that is only sound.\n */\nexport function loweredAudioDocument(doc: AudioDocument): CompositionDocument {\n const nodes: TimedNodeSpec[] = [clipRoot()];\n if (!doc.nodes.some(isRootBus)) nodes.push(defaultRootBus());\n for (const spec of doc.nodes) nodes.push(reparent(spec));\n\n return {\n kind: \"composition\",\n duration: doc.duration,\n variables: doc.variables,\n nodes,\n commands: doc.commands.map(retarget),\n };\n}\n\n/** The row an audio document means as its root bus. */\nfunction isRootBus(spec: NodeSpec): boolean {\n return spec.id === \"\" && spec.type === \"audioBus\";\n}\n\n/** A node spec with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\nfunction reparent(spec: TimedNodeSpec): TimedNodeSpec {\n if (isRootBus(spec)) return { ...spec, id: AUDIO_ROOT_ID, parentId: null };\n // `null` is the document's own convention for \"the root\"; `\"\"` is the same\n // row named by id, which `checkTree` also resolves. Both mean the bus.\n if (spec.parentId === null || spec.parentId === \"\") return { ...spec, parentId: AUDIO_ROOT_ID };\n return spec;\n}\n\n/** A command with the implicit root resolved to {@link AUDIO_ROOT_ID}. */\nfunction retarget(command: CommandSpec): CommandSpec {\n if (command.targetId === null || command.targetId === \"\") {\n return { ...command, targetId: AUDIO_ROOT_ID };\n }\n return command;\n}\n\nexport { AUDIO_ROOT_ID };\n\n/**\n * A `sound` or `video` row with no `play` command of its own plays as it did\n * before sound came only from commands: a sound over its span (open-ended, to\n * its own end), a video once per segment, or over its span while it plays.\n */\nexport function withPlayedSounds(doc: CompositionDocument): CompositionDocument {\n const played = new Set(doc.commands.filter((c) => c.type === \"play\").map((c) => c.targetId));\n const added: CommandSpec[] = [];\n for (const spec of doc.nodes) {\n if ((spec.type !== \"sound\" && spec.type !== \"video\") || played.has(spec.id)) continue;\n const { start, end } = nodeSpan(spec);\n const segments = spec.type === \"video\" ? (spec.props as { segments?: unknown }).segments : undefined;\n if (Array.isArray(segments) && segments.length > 0) {\n (segments as { at: number; from: number; duration: number; speed?: number; volume?: number }[]).forEach((segment, i) => {\n added.push({\n // An endless segment plays to the source's end: a command has no endless length.\n id: `@play:${spec.id}:${i}`, type: \"play\", targetId: spec.id, at: start + segment.at,\n duration: Number.isFinite(segment.duration) ? segment.duration : 0,\n args: {\n from: segment.from,\n ...(segment.speed !== undefined && { speed: segment.speed }),\n ...(segment.volume !== undefined && { volume: segment.volume }),\n },\n });\n });\n continue;\n }\n added.push({\n id: `@play:${spec.id}`, type: \"play\", targetId: spec.id, at: start,\n duration: Number.isFinite(end) ? end - start : 0, args: {},\n });\n }\n return added.length === 0 ? doc : { ...doc, commands: [...doc.commands, ...added] };\n}\n\n/** A clip as its timeline builds it: an audio document lowered to the composition it is, its sounds played. */\nexport function clipDocument(doc: ClipDocument): VisualDocument {\n const lowered = isAudioDocument(doc) ? loweredAudioDocument(doc) : doc;\n return isStillDocument(lowered) ? lowered : withPlayedSounds(lowered);\n}\n"]}