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

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 (904) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +48 -0
  4. package/README.md +93 -72
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.d.ts +9 -0
  7. package/dist/assets/catalog.d.ts.map +1 -1
  8. package/dist/assets/catalog.js +11 -0
  9. package/dist/assets/catalog.js.map +1 -1
  10. package/dist/assets/errors.d.ts.map +1 -1
  11. package/dist/assets/errors.js +8 -3
  12. package/dist/assets/errors.js.map +1 -1
  13. package/dist/assets/index.js.map +1 -1
  14. package/dist/assets/manager.d.ts +26 -1
  15. package/dist/assets/manager.d.ts.map +1 -1
  16. package/dist/assets/manager.js +79 -4
  17. package/dist/assets/manager.js.map +1 -1
  18. package/dist/assets/manifest.js.map +1 -1
  19. package/dist/assets/record.js.map +1 -1
  20. package/dist/assets/scope.d.ts +3 -3
  21. package/dist/assets/scope.d.ts.map +1 -1
  22. package/dist/assets/scope.js.map +1 -1
  23. package/dist/attributes/audio/filters/chain.d.ts +1 -1
  24. package/dist/attributes/audio/filters/chain.js.map +1 -1
  25. package/dist/attributes/audio/filters/curve.d.ts +8 -8
  26. package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
  27. package/dist/attributes/audio/filters/curve.js +20 -19
  28. package/dist/attributes/audio/filters/curve.js.map +1 -1
  29. package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
  30. package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
  31. package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
  32. package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
  33. package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
  34. package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
  35. package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
  36. package/dist/attributes/audio/filters/index.d.ts +1 -1
  37. package/dist/attributes/audio/filters/index.d.ts.map +1 -1
  38. package/dist/attributes/audio/filters/index.js +1 -1
  39. package/dist/attributes/audio/filters/index.js.map +1 -1
  40. package/dist/attributes/audio/filters/registry.js.map +1 -1
  41. package/dist/attributes/audio/filters/union.js.map +1 -1
  42. package/dist/attributes/audio/request.d.ts +17 -2
  43. package/dist/attributes/audio/request.d.ts.map +1 -1
  44. package/dist/attributes/audio/request.js.map +1 -1
  45. package/dist/attributes/audio/schedule.d.ts +4 -2
  46. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  47. package/dist/attributes/audio/schedule.js +15 -8
  48. package/dist/attributes/audio/schedule.js.map +1 -1
  49. package/dist/attributes/audio/sound.d.ts +4 -2
  50. package/dist/attributes/audio/sound.d.ts.map +1 -1
  51. package/dist/attributes/audio/sound.js +8 -4
  52. package/dist/attributes/audio/sound.js.map +1 -1
  53. package/dist/attributes/index.js.map +1 -1
  54. package/dist/attributes/layout/alignment.js +1 -1
  55. package/dist/attributes/layout/alignment.js.map +1 -1
  56. package/dist/attributes/layout/index.js.map +1 -1
  57. package/dist/attributes/layout/insets.js.map +1 -1
  58. package/dist/attributes/layout/matrix2d.js.map +1 -1
  59. package/dist/attributes/layout/size.js.map +1 -1
  60. package/dist/attributes/layout/transform3d.js.map +1 -1
  61. package/dist/attributes/layout/vector2.js.map +1 -1
  62. package/dist/attributes/layout/world-transform.js.map +1 -1
  63. package/dist/attributes/mask/boolean.js.map +1 -1
  64. package/dist/attributes/mask/mask.js.map +1 -1
  65. package/dist/attributes/properties/decorator.d.ts +3 -1
  66. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  67. package/dist/attributes/properties/decorator.js.map +1 -1
  68. package/dist/attributes/properties/inputs.js.map +1 -1
  69. package/dist/attributes/properties/typed.d.ts +9 -2
  70. package/dist/attributes/properties/typed.d.ts.map +1 -1
  71. package/dist/attributes/properties/typed.js +15 -1
  72. package/dist/attributes/properties/typed.js.map +1 -1
  73. package/dist/attributes/render3d/orbit.d.ts +8 -8
  74. package/dist/attributes/render3d/orbit.js +7 -7
  75. package/dist/attributes/render3d/orbit.js.map +1 -1
  76. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  77. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  78. package/dist/attributes/shape/corners/corners.js.map +1 -1
  79. package/dist/attributes/shape/corners/index.js.map +1 -1
  80. package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
  81. package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
  82. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  83. package/dist/attributes/shape/effects/chain.d.ts +28 -120
  84. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  85. package/dist/attributes/shape/effects/chain.js +16 -88
  86. package/dist/attributes/shape/effects/chain.js.map +1 -1
  87. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  88. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
  96. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  97. package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
  98. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  99. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  100. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  101. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  102. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  103. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  104. package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
  105. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  106. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  108. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  110. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  112. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
  114. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  116. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  118. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  120. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  122. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  124. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  126. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/shader.js +15 -8
  128. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  130. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  132. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  134. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  136. package/dist/attributes/shape/effects/index.d.ts +2 -6
  137. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  138. package/dist/attributes/shape/effects/index.js.map +1 -1
  139. package/dist/attributes/shape/effects/registry.d.ts +23 -6
  140. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  141. package/dist/attributes/shape/effects/registry.js +44 -10
  142. package/dist/attributes/shape/effects/registry.js.map +1 -1
  143. package/dist/attributes/shape/effects/union.d.ts +2 -6
  144. package/dist/attributes/shape/effects/union.d.ts.map +1 -1
  145. package/dist/attributes/shape/effects/union.js.map +1 -1
  146. package/dist/attributes/shape/fill/blend.js.map +1 -1
  147. package/dist/attributes/shape/fill/chain.js.map +1 -1
  148. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  149. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  150. package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
  151. package/dist/attributes/shape/fill/color/parser.js +81 -44
  152. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  153. package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
  154. package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
  155. package/dist/attributes/shape/fill/gradient-stops.js +65 -0
  156. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
  157. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  158. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  159. package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
  160. package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
  161. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  162. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  163. package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
  164. package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
  165. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  166. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  167. package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
  168. package/dist/attributes/shape/fill/implementations/image.js +5 -4
  169. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  170. package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
  171. package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
  172. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  173. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  174. package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
  175. package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
  176. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  177. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  178. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  179. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  180. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  181. package/dist/attributes/shape/fill/index.js.map +1 -1
  182. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  183. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  184. package/dist/attributes/shape/fill/registry.js.map +1 -1
  185. package/dist/attributes/shape/fill/union.js.map +1 -1
  186. package/dist/attributes/shape/filters/chain.d.ts +4 -10
  187. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  188. package/dist/attributes/shape/filters/chain.js +1 -13
  189. package/dist/attributes/shape/filters/chain.js.map +1 -1
  190. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  191. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  192. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  193. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  194. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  195. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  196. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  197. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  198. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  199. package/dist/attributes/shape/filters/index.d.ts +1 -1
  200. package/dist/attributes/shape/filters/index.js.map +1 -1
  201. package/dist/attributes/shape/filters/registry.d.ts +2 -2
  202. package/dist/attributes/shape/filters/registry.js +3 -3
  203. package/dist/attributes/shape/filters/registry.js.map +1 -1
  204. package/dist/attributes/shape/filters/union.d.ts +6 -7
  205. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  206. package/dist/attributes/shape/filters/union.js.map +1 -1
  207. package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
  208. package/dist/attributes/shape/path/anchors.js +12 -5
  209. package/dist/attributes/shape/path/anchors.js.map +1 -1
  210. package/dist/attributes/shape/path/bezier.js.map +1 -1
  211. package/dist/attributes/shape/path/index.js.map +1 -1
  212. package/dist/attributes/shape/path/measure.js.map +1 -1
  213. package/dist/attributes/shape/path/morph.d.ts.map +1 -1
  214. package/dist/attributes/shape/path/morph.js +16 -4
  215. package/dist/attributes/shape/path/morph.js.map +1 -1
  216. package/dist/attributes/shape/path/ops.js.map +1 -1
  217. package/dist/attributes/shape/path/types.js.map +1 -1
  218. package/dist/attributes/shape/path/walk.js.map +1 -1
  219. package/dist/attributes/shape/shaders/index.js.map +1 -1
  220. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  221. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  222. package/dist/attributes/shape/shadow/index.js.map +1 -1
  223. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  224. package/dist/attributes/shape/stroke/index.d.ts +2 -2
  225. package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
  226. package/dist/attributes/shape/stroke/index.js +1 -1
  227. package/dist/attributes/shape/stroke/index.js.map +1 -1
  228. package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
  229. package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
  230. package/dist/attributes/shape/stroke/stroke.js +22 -2
  231. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  232. package/dist/attributes/shared/operators.js.map +1 -1
  233. package/dist/attributes/text/index.js.map +1 -1
  234. package/dist/attributes/text/ops.d.ts +6 -0
  235. package/dist/attributes/text/ops.d.ts.map +1 -1
  236. package/dist/attributes/text/ops.js +1 -0
  237. package/dist/attributes/text/ops.js.map +1 -1
  238. package/dist/attributes/text/types.js.map +1 -1
  239. package/dist/browser/chunks/chunk-2RIYH36X.js +3 -0
  240. package/dist/browser/chunks/chunk-2RIYH36X.js.map +7 -0
  241. package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
  242. package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
  243. package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
  244. package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
  245. package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
  246. package/dist/browser/chunks/chunk-EJDPYDQI.js.map +7 -0
  247. package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
  248. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
  249. package/dist/browser/chunks/chunk-XAWE4EAK.js +2 -0
  250. package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
  251. package/dist/browser/component.js +1 -1
  252. package/dist/browser/component.js.map +4 -4
  253. package/dist/browser/experimental.js +2 -0
  254. package/dist/browser/experimental.js.map +7 -0
  255. package/dist/browser/index.js +1 -1
  256. package/dist/browser/index.js.map +4 -4
  257. package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
  258. package/dist/browser/jsx-jsx-runtime.js +1 -1
  259. package/dist/browser/manifest.json +4 -2
  260. package/dist/browser/sdk.js +1 -1
  261. package/dist/component/api.d.ts +508 -0
  262. package/dist/component/api.d.ts.map +1 -0
  263. package/dist/component/api.js +4 -0
  264. package/dist/component/api.js.map +1 -0
  265. package/dist/component/builtins/audio.d.ts +26 -0
  266. package/dist/component/builtins/audio.d.ts.map +1 -0
  267. package/dist/component/builtins/audio.js +41 -0
  268. package/dist/component/builtins/audio.js.map +1 -0
  269. package/dist/component/builtins/canvas3d.d.ts +98 -0
  270. package/dist/component/builtins/canvas3d.d.ts.map +1 -0
  271. package/dist/component/builtins/canvas3d.js +21 -0
  272. package/dist/component/builtins/canvas3d.js.map +1 -0
  273. package/dist/component/builtins/composite.d.ts +56 -0
  274. package/dist/component/builtins/composite.d.ts.map +1 -0
  275. package/dist/component/builtins/composite.js +25 -0
  276. package/dist/component/builtins/composite.js.map +1 -0
  277. package/dist/component/builtins/geometry.d.ts +505 -0
  278. package/dist/component/builtins/geometry.d.ts.map +1 -0
  279. package/dist/component/builtins/geometry.js +107 -0
  280. package/dist/component/builtins/geometry.js.map +1 -0
  281. package/dist/component/builtins/layout.d.ts +88 -0
  282. package/dist/component/builtins/layout.d.ts.map +1 -0
  283. package/dist/component/builtins/layout.js +84 -0
  284. package/dist/component/builtins/layout.js.map +1 -0
  285. package/dist/component/builtins/media.d.ts +95 -0
  286. package/dist/component/builtins/media.d.ts.map +1 -0
  287. package/dist/component/builtins/media.js +149 -0
  288. package/dist/component/builtins/media.js.map +1 -0
  289. package/dist/component/builtins/providers.d.ts +23 -0
  290. package/dist/component/builtins/providers.d.ts.map +1 -0
  291. package/dist/component/builtins/providers.js +30 -0
  292. package/dist/component/builtins/providers.js.map +1 -0
  293. package/dist/component/builtins/text.d.ts +193 -0
  294. package/dist/component/builtins/text.d.ts.map +1 -0
  295. package/dist/component/builtins/text.js +113 -0
  296. package/dist/component/builtins/text.js.map +1 -0
  297. package/dist/component/builtins/three.d.ts +1085 -0
  298. package/dist/component/builtins/three.d.ts.map +1 -0
  299. package/dist/component/builtins/three.js +265 -0
  300. package/dist/component/builtins/three.js.map +1 -0
  301. package/dist/component/clip-of.d.ts +5 -0
  302. package/dist/component/clip-of.d.ts.map +1 -0
  303. package/dist/component/clip-of.js +33 -0
  304. package/dist/component/clip-of.js.map +1 -0
  305. package/dist/component/commands-for.d.ts +19 -0
  306. package/dist/component/commands-for.d.ts.map +1 -0
  307. package/dist/component/commands-for.js +5 -0
  308. package/dist/component/commands-for.js.map +1 -0
  309. package/dist/component/component-audio.d.ts +9 -0
  310. package/dist/component/component-audio.d.ts.map +1 -0
  311. package/dist/component/component-audio.js +18 -0
  312. package/dist/component/component-audio.js.map +1 -0
  313. package/dist/component/component2d.d.ts +9 -0
  314. package/dist/component/component2d.d.ts.map +1 -0
  315. package/dist/component/component2d.js +239 -0
  316. package/dist/component/component2d.js.map +1 -0
  317. package/dist/component/component3d.d.ts +9 -0
  318. package/dist/component/component3d.d.ts.map +1 -0
  319. package/dist/component/component3d.js +99 -0
  320. package/dist/component/component3d.js.map +1 -0
  321. package/dist/component/factory.d.ts +63 -0
  322. package/dist/component/factory.d.ts.map +1 -0
  323. package/dist/component/factory.js +313 -0
  324. package/dist/component/factory.js.map +1 -0
  325. package/dist/component/modules/aim.d.ts +30 -0
  326. package/dist/component/modules/aim.d.ts.map +1 -0
  327. package/dist/component/modules/aim.js +39 -0
  328. package/dist/component/modules/aim.js.map +1 -0
  329. package/dist/component/modules/corners.d.ts +13 -0
  330. package/dist/component/modules/corners.d.ts.map +1 -0
  331. package/dist/component/modules/corners.js +12 -0
  332. package/dist/component/modules/corners.js.map +1 -0
  333. package/dist/component/modules/flow.d.ts +26 -0
  334. package/dist/component/modules/flow.d.ts.map +1 -0
  335. package/dist/component/modules/flow.js +55 -0
  336. package/dist/component/modules/flow.js.map +1 -0
  337. package/dist/component/modules/material.d.ts +40 -0
  338. package/dist/component/modules/material.d.ts.map +1 -0
  339. package/dist/component/modules/material.js +75 -0
  340. package/dist/component/modules/material.js.map +1 -0
  341. package/dist/component/modules/paint.d.ts +71 -0
  342. package/dist/component/modules/paint.d.ts.map +1 -0
  343. package/dist/component/modules/paint.js +106 -0
  344. package/dist/component/modules/paint.js.map +1 -0
  345. package/dist/component/modules/shapes.d.ts +31 -0
  346. package/dist/component/modules/shapes.d.ts.map +1 -0
  347. package/dist/component/modules/shapes.js +43 -0
  348. package/dist/component/modules/shapes.js.map +1 -0
  349. package/dist/component/modules/text-layout.d.ts +26 -0
  350. package/dist/component/modules/text-layout.d.ts.map +1 -0
  351. package/dist/component/modules/text-layout.js +57 -0
  352. package/dist/component/modules/text-layout.js.map +1 -0
  353. package/dist/component/modules/text-style.d.ts +48 -0
  354. package/dist/component/modules/text-style.d.ts.map +1 -0
  355. package/dist/component/modules/text-style.js +63 -0
  356. package/dist/component/modules/text-style.js.map +1 -0
  357. package/dist/component/modules/three-entries.d.ts +23 -0
  358. package/dist/component/modules/three-entries.d.ts.map +1 -0
  359. package/dist/component/modules/three-entries.js +41 -0
  360. package/dist/component/modules/three-entries.js.map +1 -0
  361. package/dist/component/modules/view3d.d.ts +55 -0
  362. package/dist/component/modules/view3d.d.ts.map +1 -0
  363. package/dist/component/modules/view3d.js +160 -0
  364. package/dist/component/modules/view3d.js.map +1 -0
  365. package/dist/component/timeline.d.ts +22 -0
  366. package/dist/component/timeline.d.ts.map +1 -0
  367. package/dist/component/timeline.js +128 -0
  368. package/dist/component/timeline.js.map +1 -0
  369. package/dist/component/type-def.d.ts +26 -0
  370. package/dist/component/type-def.d.ts.map +1 -0
  371. package/dist/component/type-def.js +16 -0
  372. package/dist/component/type-def.js.map +1 -0
  373. package/dist/component/types.d.ts +91 -0
  374. package/dist/component/types.d.ts.map +1 -0
  375. package/dist/component/types.js +88 -0
  376. package/dist/component/types.js.map +1 -0
  377. package/dist/component/views.d.ts +121 -0
  378. package/dist/component/views.d.ts.map +1 -0
  379. package/dist/component/views.js +413 -0
  380. package/dist/component/views.js.map +1 -0
  381. package/dist/component.d.ts +4 -5
  382. package/dist/component.d.ts.map +1 -1
  383. package/dist/component.js +3 -5
  384. package/dist/component.js.map +1 -1
  385. package/dist/document/audio.d.ts +10 -2
  386. package/dist/document/audio.d.ts.map +1 -1
  387. package/dist/document/audio.js +45 -4
  388. package/dist/document/audio.js.map +1 -1
  389. package/dist/document/builtins.d.ts.map +1 -1
  390. package/dist/document/builtins.js +15 -39
  391. package/dist/document/builtins.js.map +1 -1
  392. package/dist/document/command-traits.d.ts +1 -1
  393. package/dist/document/command-traits.js +16 -1
  394. package/dist/document/command-traits.js.map +1 -1
  395. package/dist/document/deny-globals.js.map +1 -1
  396. package/dist/document/diff.d.ts.map +1 -1
  397. package/dist/document/diff.js +3 -3
  398. package/dist/document/diff.js.map +1 -1
  399. package/dist/document/doc-index.d.ts +2 -2
  400. package/dist/document/doc-index.d.ts.map +1 -1
  401. package/dist/document/doc-index.js +3 -3
  402. package/dist/document/doc-index.js.map +1 -1
  403. package/dist/document/expression/compile.d.ts.map +1 -1
  404. package/dist/document/expression/compile.js +8 -5
  405. package/dist/document/expression/compile.js.map +1 -1
  406. package/dist/document/expression/index.js.map +1 -1
  407. package/dist/document/expression/ops.js +1 -1
  408. package/dist/document/expression/ops.js.map +1 -1
  409. package/dist/document/expression/parse.d.ts.map +1 -1
  410. package/dist/document/expression/parse.js +15 -6
  411. package/dist/document/expression/parse.js.map +1 -1
  412. package/dist/document/expression/refs.d.ts +1 -1
  413. package/dist/document/expression/refs.js +1 -1
  414. package/dist/document/expression/refs.js.map +1 -1
  415. package/dist/document/expression/types.js.map +1 -1
  416. package/dist/document/expression/walk.d.ts.map +1 -1
  417. package/dist/document/expression/walk.js +2 -1
  418. package/dist/document/expression/walk.js.map +1 -1
  419. package/dist/document/index.d.ts +2 -0
  420. package/dist/document/index.d.ts.map +1 -1
  421. package/dist/document/index.js +2 -0
  422. package/dist/document/index.js.map +1 -1
  423. package/dist/document/node-decorator.js.map +1 -1
  424. package/dist/document/node-descriptor.d.ts +25 -0
  425. package/dist/document/node-descriptor.d.ts.map +1 -1
  426. package/dist/document/node-descriptor.js.map +1 -1
  427. package/dist/document/placement.d.ts +70 -0
  428. package/dist/document/placement.d.ts.map +1 -0
  429. package/dist/document/placement.js +83 -0
  430. package/dist/document/placement.js.map +1 -0
  431. package/dist/document/project.d.ts +2 -2
  432. package/dist/document/project.d.ts.map +1 -1
  433. package/dist/document/project.js.map +1 -1
  434. package/dist/document/registry.d.ts +23 -11
  435. package/dist/document/registry.d.ts.map +1 -1
  436. package/dist/document/registry.js +46 -19
  437. package/dist/document/registry.js.map +1 -1
  438. package/dist/document/settled-index.d.ts +49 -0
  439. package/dist/document/settled-index.d.ts.map +1 -0
  440. package/dist/document/settled-index.js +247 -0
  441. package/dist/document/settled-index.js.map +1 -0
  442. package/dist/document/timeline-patch.js.map +1 -1
  443. package/dist/document/timeline.d.ts +100 -19
  444. package/dist/document/timeline.d.ts.map +1 -1
  445. package/dist/document/timeline.js +290 -42
  446. package/dist/document/timeline.js.map +1 -1
  447. package/dist/document/types.d.ts +12 -12
  448. package/dist/document/types.d.ts.map +1 -1
  449. package/dist/document/types.js +2 -2
  450. package/dist/document/types.js.map +1 -1
  451. package/dist/document/validate.d.ts +2 -2
  452. package/dist/document/validate.d.ts.map +1 -1
  453. package/dist/document/validate.js +37 -31
  454. package/dist/document/validate.js.map +1 -1
  455. package/dist/document/withdraw.d.ts +28 -0
  456. package/dist/document/withdraw.d.ts.map +1 -0
  457. package/dist/document/withdraw.js +61 -0
  458. package/dist/document/withdraw.js.map +1 -0
  459. package/dist/experimental.d.ts +22 -0
  460. package/dist/experimental.d.ts.map +1 -0
  461. package/dist/experimental.js +20 -0
  462. package/dist/experimental.js.map +1 -0
  463. package/dist/index.d.ts +10 -0
  464. package/dist/index.d.ts.map +1 -1
  465. package/dist/index.js +10 -0
  466. package/dist/index.js.map +1 -1
  467. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  468. package/dist/jsx/jsx-runtime.d.ts +9 -1
  469. package/dist/jsx/jsx-runtime.d.ts.map +1 -1
  470. package/dist/jsx/jsx-runtime.js +13 -3
  471. package/dist/jsx/jsx-runtime.js.map +1 -1
  472. package/dist/layout/bounds.d.ts +0 -1
  473. package/dist/layout/bounds.d.ts.map +1 -1
  474. package/dist/layout/bounds.js.map +1 -1
  475. package/dist/layout/constraints.js.map +1 -1
  476. package/dist/layout/flex.d.ts +4 -2
  477. package/dist/layout/flex.d.ts.map +1 -1
  478. package/dist/layout/flex.js +27 -11
  479. package/dist/layout/flex.js.map +1 -1
  480. package/dist/layout/freeform.js.map +1 -1
  481. package/dist/layout/grid.js.map +1 -1
  482. package/dist/layout/index.js.map +1 -1
  483. package/dist/layout/item.js.map +1 -1
  484. package/dist/layout/ops.d.ts +6 -0
  485. package/dist/layout/ops.d.ts.map +1 -1
  486. package/dist/layout/ops.js +6 -0
  487. package/dist/layout/ops.js.map +1 -1
  488. package/dist/layout/types.js.map +1 -1
  489. package/dist/nodes/2d/node-lifecycle.js.map +1 -1
  490. package/dist/nodes/2d/node-motion.js.map +1 -1
  491. package/dist/nodes/2d/node-render.d.ts +3 -3
  492. package/dist/nodes/2d/node-render.d.ts.map +1 -1
  493. package/dist/nodes/2d/node-render.js.map +1 -1
  494. package/dist/nodes/2d/node-transform.js.map +1 -1
  495. package/dist/nodes/2d/node2d.d.ts +115 -3
  496. package/dist/nodes/2d/node2d.d.ts.map +1 -1
  497. package/dist/nodes/2d/node2d.js +180 -28
  498. package/dist/nodes/2d/node2d.js.map +1 -1
  499. package/dist/nodes/2d/paint-node.d.ts +27 -0
  500. package/dist/nodes/2d/paint-node.d.ts.map +1 -1
  501. package/dist/nodes/2d/paint-node.js +42 -0
  502. package/dist/nodes/2d/paint-node.js.map +1 -1
  503. package/dist/nodes/audio/audio-bus.js.map +1 -1
  504. package/dist/nodes/audio/index.d.ts +2 -2
  505. package/dist/nodes/audio/index.d.ts.map +1 -1
  506. package/dist/nodes/audio/index.js +0 -2
  507. package/dist/nodes/audio/index.js.map +1 -1
  508. package/dist/nodes/audio/node-audio.js.map +1 -1
  509. package/dist/nodes/audio/sound-node.d.ts +4 -3
  510. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  511. package/dist/nodes/audio/sound-node.js +4 -1
  512. package/dist/nodes/audio/sound-node.js.map +1 -1
  513. package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
  514. package/dist/nodes/geometry/bounds-shape-node.js +2 -2
  515. package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
  516. package/dist/nodes/geometry/box-path-node.d.ts +3 -3
  517. package/dist/nodes/geometry/box-path-node.js +2 -2
  518. package/dist/nodes/geometry/box-path-node.js.map +1 -1
  519. package/dist/nodes/geometry/ellipse-node.js.map +1 -1
  520. package/dist/nodes/geometry/group-bounds.d.ts +2 -2
  521. package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
  522. package/dist/nodes/geometry/group-bounds.js +1 -2
  523. package/dist/nodes/geometry/group-bounds.js.map +1 -1
  524. package/dist/nodes/geometry/path-node.d.ts.map +1 -1
  525. package/dist/nodes/geometry/path-node.js +6 -0
  526. package/dist/nodes/geometry/path-node.js.map +1 -1
  527. package/dist/nodes/geometry/polygon-node.js.map +1 -1
  528. package/dist/nodes/geometry/polygram-node.js.map +1 -1
  529. package/dist/nodes/geometry/rect-node.js.map +1 -1
  530. package/dist/nodes/geometry/shape-node.js.map +1 -1
  531. package/dist/nodes/geometry/shape-outline.d.ts +2 -2
  532. package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
  533. package/dist/nodes/geometry/shape-outline.js +2 -13
  534. package/dist/nodes/geometry/shape-outline.js.map +1 -1
  535. package/dist/nodes/index.d.ts +40 -33
  536. package/dist/nodes/index.d.ts.map +1 -1
  537. package/dist/nodes/index.js +17 -36
  538. package/dist/nodes/index.js.map +1 -1
  539. package/dist/nodes/layout/camera-node.d.ts +9 -0
  540. package/dist/nodes/layout/camera-node.d.ts.map +1 -1
  541. package/dist/nodes/layout/camera-node.js +38 -3
  542. package/dist/nodes/layout/camera-node.js.map +1 -1
  543. package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
  544. package/dist/nodes/layout/orbit-camera-node.js +1 -1
  545. package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
  546. package/dist/nodes/layout/rotated-box.js.map +1 -1
  547. package/dist/nodes/media/video-node.d.ts.map +1 -1
  548. package/dist/nodes/media/video-node.js +2 -0
  549. package/dist/nodes/media/video-node.js.map +1 -1
  550. package/dist/nodes/node/declare-paints.js.map +1 -1
  551. package/dist/nodes/node/node-editor-state.js.map +1 -1
  552. package/dist/nodes/node/node-reactive.js.map +1 -1
  553. package/dist/nodes/node/node-time.d.ts +3 -3
  554. package/dist/nodes/node/node-time.d.ts.map +1 -1
  555. package/dist/nodes/node/node-time.js +1 -1
  556. package/dist/nodes/node/node-time.js.map +1 -1
  557. package/dist/nodes/node/node-walk.js.map +1 -1
  558. package/dist/nodes/node/node.d.ts +12 -4
  559. package/dist/nodes/node/node.d.ts.map +1 -1
  560. package/dist/nodes/node/node.js +67 -27
  561. package/dist/nodes/node/node.js.map +1 -1
  562. package/dist/nodes/node/text-defaults.d.ts +10 -12
  563. package/dist/nodes/node/text-defaults.d.ts.map +1 -1
  564. package/dist/nodes/node/text-defaults.js +10 -12
  565. package/dist/nodes/node/text-defaults.js.map +1 -1
  566. package/dist/nodes/{scene → root}/canvas2d-node.d.ts +4 -3
  567. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
  568. package/dist/nodes/{scene → root}/canvas2d-node.js +5 -2
  569. package/dist/nodes/root/canvas2d-node.js.map +1 -0
  570. package/dist/nodes/root/provider-node.d.ts.map +1 -0
  571. package/dist/nodes/root/provider-node.js.map +1 -0
  572. package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
  573. package/dist/nodes/root/theme-provider-node.js.map +1 -0
  574. package/dist/nodes/text/default-text-style-node.d.ts +5 -2
  575. package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
  576. package/dist/nodes/text/default-text-style-node.js +10 -4
  577. package/dist/nodes/text/default-text-style-node.js.map +1 -1
  578. package/dist/nodes/text/number-format.d.ts +1 -1
  579. package/dist/nodes/text/number-format.js +1 -1
  580. package/dist/nodes/text/number-format.js.map +1 -1
  581. package/dist/nodes/text/number-node.js.map +1 -1
  582. package/dist/nodes/text/number-pattern.js.map +1 -1
  583. package/dist/nodes/text/richtext-node.d.ts +0 -5
  584. package/dist/nodes/text/richtext-node.d.ts.map +1 -1
  585. package/dist/nodes/text/richtext-node.js +6 -72
  586. package/dist/nodes/text/richtext-node.js.map +1 -1
  587. package/dist/nodes/text/text-base.d.ts +5 -22
  588. package/dist/nodes/text/text-base.d.ts.map +1 -1
  589. package/dist/nodes/text/text-base.js +13 -364
  590. package/dist/nodes/text/text-base.js.map +1 -1
  591. package/dist/nodes/text/text-layout.d.ts +87 -0
  592. package/dist/nodes/text/text-layout.d.ts.map +1 -0
  593. package/dist/nodes/text/text-layout.js +368 -0
  594. package/dist/nodes/text/text-layout.js.map +1 -0
  595. package/dist/nodes/text/text-node.js.map +1 -1
  596. package/dist/nodes/text/text-selection.js.map +1 -1
  597. package/dist/nodes/three/camera-nodes.d.ts +21 -3
  598. package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
  599. package/dist/nodes/three/camera-nodes.js +42 -1
  600. package/dist/nodes/three/camera-nodes.js.map +1 -1
  601. package/dist/nodes/three/canvas3d-node.d.ts +32 -7
  602. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  603. package/dist/nodes/three/canvas3d-node.js +50 -2
  604. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  605. package/dist/nodes/three/drawable-nodes.d.ts +25 -11
  606. package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
  607. package/dist/nodes/three/drawable-nodes.js +43 -13
  608. package/dist/nodes/three/drawable-nodes.js.map +1 -1
  609. package/dist/nodes/three/environment-nodes.d.ts +9 -3
  610. package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
  611. package/dist/nodes/three/environment-nodes.js.map +1 -1
  612. package/dist/nodes/three/geometry-nodes.d.ts +2 -2
  613. package/dist/nodes/three/geometry-nodes.js +2 -2
  614. package/dist/nodes/three/geometry-nodes.js.map +1 -1
  615. package/dist/nodes/three/grid-geometry3d.js.map +1 -1
  616. package/dist/nodes/three/group3d.js.map +1 -1
  617. package/dist/nodes/three/light-nodes.d.ts.map +1 -1
  618. package/dist/nodes/three/light-nodes.js +3 -3
  619. package/dist/nodes/three/light-nodes.js.map +1 -1
  620. package/dist/nodes/three/mesh3d.js.map +1 -1
  621. package/dist/nodes/three/node3d.d.ts +48 -0
  622. package/dist/nodes/three/node3d.d.ts.map +1 -1
  623. package/dist/nodes/three/node3d.js +53 -3
  624. package/dist/nodes/three/node3d.js.map +1 -1
  625. package/dist/platform/audio-sink.d.ts +2 -2
  626. package/dist/platform/audio-sink.d.ts.map +1 -1
  627. package/dist/platform/audio-sink.js.map +1 -1
  628. package/dist/platform/exporter.d.ts +13 -8
  629. package/dist/platform/exporter.d.ts.map +1 -1
  630. package/dist/platform/exporter.js.map +1 -1
  631. package/dist/platform/index.d.ts +1 -1
  632. package/dist/platform/index.d.ts.map +1 -1
  633. package/dist/platform/index.js.map +1 -1
  634. package/dist/platform/stepped-clock.js.map +1 -1
  635. package/dist/platform/storage-adapter.d.ts +12 -6
  636. package/dist/platform/storage-adapter.d.ts.map +1 -1
  637. package/dist/platform/storage-adapter.js +4 -0
  638. package/dist/platform/storage-adapter.js.map +1 -1
  639. package/dist/platform/ticker.d.ts +6 -0
  640. package/dist/platform/ticker.d.ts.map +1 -1
  641. package/dist/platform/ticker.js +6 -0
  642. package/dist/platform/ticker.js.map +1 -1
  643. package/dist/project/config.js.map +1 -1
  644. package/dist/project/index.js.map +1 -1
  645. package/dist/project/tree.d.ts +3 -3
  646. package/dist/project/tree.d.ts.map +1 -1
  647. package/dist/project/tree.js.map +1 -1
  648. package/dist/props/host.js.map +1 -1
  649. package/dist/props/index.js.map +1 -1
  650. package/dist/props/observer.js.map +1 -1
  651. package/dist/props/slot.js.map +1 -1
  652. package/dist/renamed-scene-names.d.ts +17 -0
  653. package/dist/renamed-scene-names.d.ts.map +1 -0
  654. package/dist/renamed-scene-names.js +9 -0
  655. package/dist/renamed-scene-names.js.map +1 -0
  656. package/dist/render/canvas-render-context2d.d.ts +2 -2
  657. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  658. package/dist/render/canvas-render-context2d.js.map +1 -1
  659. package/dist/render/clip-contains.js.map +1 -1
  660. package/dist/render/clip.js.map +1 -1
  661. package/dist/render/descriptors/ellipse.js.map +1 -1
  662. package/dist/render/descriptors/latex.js.map +1 -1
  663. package/dist/render/descriptors/line.js.map +1 -1
  664. package/dist/render/descriptors/path-builder.js.map +1 -1
  665. package/dist/render/descriptors/path.js.map +1 -1
  666. package/dist/render/descriptors/polygon.js.map +1 -1
  667. package/dist/render/descriptors/polygram.js.map +1 -1
  668. package/dist/render/descriptors/rect.js.map +1 -1
  669. package/dist/render/descriptors/richtext.js.map +1 -1
  670. package/dist/render/descriptors/shape.d.ts +12 -0
  671. package/dist/render/descriptors/shape.d.ts.map +1 -1
  672. package/dist/render/descriptors/shape.js.map +1 -1
  673. package/dist/render/descriptors/text.d.ts +2 -2
  674. package/dist/render/descriptors/text.js +2 -2
  675. package/dist/render/descriptors/text.js.map +1 -1
  676. package/dist/render/descriptors/transform.d.ts +2 -2
  677. package/dist/render/descriptors/transform.d.ts.map +1 -1
  678. package/dist/render/descriptors/transform.js.map +1 -1
  679. package/dist/render/graphics2d.d.ts +3 -3
  680. package/dist/render/graphics2d.d.ts.map +1 -1
  681. package/dist/render/graphics2d.js +1 -1
  682. package/dist/render/graphics2d.js.map +1 -1
  683. package/dist/render/index.js.map +1 -1
  684. package/dist/render/measure-context.js.map +1 -1
  685. package/dist/render/null-render-context.js.map +1 -1
  686. package/dist/render/render-context2d.d.ts +2 -2
  687. package/dist/render/render-context2d.d.ts.map +1 -1
  688. package/dist/render/render-context2d.js.map +1 -1
  689. package/dist/render/surface.js.map +1 -1
  690. package/dist/render/text-defaults.js.map +1 -1
  691. package/dist/render/text-layout.js.map +1 -1
  692. package/dist/render3d/bounds3d.d.ts.map +1 -1
  693. package/dist/render3d/bounds3d.js +4 -2
  694. package/dist/render3d/bounds3d.js.map +1 -1
  695. package/dist/render3d/builders.js.map +1 -1
  696. package/dist/render3d/camera.d.ts +6 -0
  697. package/dist/render3d/camera.d.ts.map +1 -1
  698. package/dist/render3d/camera.js +5 -3
  699. package/dist/render3d/camera.js.map +1 -1
  700. package/dist/render3d/fill3d.d.ts +2 -9
  701. package/dist/render3d/fill3d.d.ts.map +1 -1
  702. package/dist/render3d/fill3d.js +2 -13
  703. package/dist/render3d/fill3d.js.map +1 -1
  704. package/dist/render3d/geometry.d.ts +8 -1
  705. package/dist/render3d/geometry.d.ts.map +1 -1
  706. package/dist/render3d/geometry.js.map +1 -1
  707. package/dist/render3d/graphics3d.d.ts +8 -4
  708. package/dist/render3d/graphics3d.d.ts.map +1 -1
  709. package/dist/render3d/graphics3d.js +18 -10
  710. package/dist/render3d/graphics3d.js.map +1 -1
  711. package/dist/render3d/index.d.ts +1 -1
  712. package/dist/render3d/index.js +1 -1
  713. package/dist/render3d/index.js.map +1 -1
  714. package/dist/render3d/inert.d.ts +14 -0
  715. package/dist/render3d/inert.d.ts.map +1 -0
  716. package/dist/render3d/inert.js +62 -0
  717. package/dist/render3d/inert.js.map +1 -0
  718. package/dist/render3d/light.js.map +1 -1
  719. package/dist/render3d/material.d.ts +10 -5
  720. package/dist/render3d/material.d.ts.map +1 -1
  721. package/dist/render3d/material.js.map +1 -1
  722. package/dist/render3d/matrix4.js.map +1 -1
  723. package/dist/render3d/render-context3d.js.map +1 -1
  724. package/dist/render3d/resources.js.map +1 -1
  725. package/dist/render3d/rounded-box.js.map +1 -1
  726. package/dist/render3d/scene-settings.d.ts +23 -4
  727. package/dist/render3d/scene-settings.d.ts.map +1 -1
  728. package/dist/render3d/scene-settings.js.map +1 -1
  729. package/dist/render3d/scene3d.d.ts +11 -0
  730. package/dist/render3d/scene3d.d.ts.map +1 -1
  731. package/dist/render3d/scene3d.js +39 -6
  732. package/dist/render3d/scene3d.js.map +1 -1
  733. package/dist/render3d/segments.js.map +1 -1
  734. package/dist/render3d/texture.d.ts +9 -0
  735. package/dist/render3d/texture.d.ts.map +1 -1
  736. package/dist/render3d/texture.js +13 -0
  737. package/dist/render3d/texture.js.map +1 -1
  738. package/dist/render3d/tracking.js.map +1 -1
  739. package/dist/render3d/transform.d.ts +1 -1
  740. package/dist/render3d/transform.js.map +1 -1
  741. package/dist/render3d/vector3.d.ts +18 -1
  742. package/dist/render3d/vector3.d.ts.map +1 -1
  743. package/dist/render3d/vector3.js +27 -0
  744. package/dist/render3d/vector3.js.map +1 -1
  745. package/dist/render3d/walk.d.ts +1 -1
  746. package/dist/render3d/walk.d.ts.map +1 -1
  747. package/dist/render3d/walk.js +5 -1
  748. package/dist/render3d/walk.js.map +1 -1
  749. package/dist/runtime/asset-refine.js.map +1 -1
  750. package/dist/runtime/asset-timeline.js.map +1 -1
  751. package/dist/runtime/asset-update.js.map +1 -1
  752. package/dist/runtime/audio-index.js.map +1 -1
  753. package/dist/runtime/builtin-context.js.map +1 -1
  754. package/dist/runtime/clip-instance.d.ts +9 -4
  755. package/dist/runtime/clip-instance.d.ts.map +1 -1
  756. package/dist/runtime/clip-instance.js +27 -9
  757. package/dist/runtime/clip-instance.js.map +1 -1
  758. package/dist/runtime/clip-store.d.ts +18 -0
  759. package/dist/runtime/clip-store.d.ts.map +1 -1
  760. package/dist/runtime/clip-store.js +97 -0
  761. package/dist/runtime/clip-store.js.map +1 -1
  762. package/dist/runtime/engine.d.ts +5 -0
  763. package/dist/runtime/engine.d.ts.map +1 -1
  764. package/dist/runtime/engine.js +2 -0
  765. package/dist/runtime/engine.js.map +1 -1
  766. package/dist/runtime/frame-time.d.ts +31 -0
  767. package/dist/runtime/frame-time.d.ts.map +1 -0
  768. package/dist/runtime/frame-time.js +29 -0
  769. package/dist/runtime/frame-time.js.map +1 -0
  770. package/dist/runtime/index.d.ts +1 -0
  771. package/dist/runtime/index.d.ts.map +1 -1
  772. package/dist/runtime/index.js +1 -0
  773. package/dist/runtime/index.js.map +1 -1
  774. package/dist/runtime/node-picking.d.ts +44 -3
  775. package/dist/runtime/node-picking.d.ts.map +1 -1
  776. package/dist/runtime/node-picking.js +124 -10
  777. package/dist/runtime/node-picking.js.map +1 -1
  778. package/dist/runtime/node-picking3d.d.ts +13 -5
  779. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  780. package/dist/runtime/node-picking3d.js +10 -2
  781. package/dist/runtime/node-picking3d.js.map +1 -1
  782. package/dist/runtime/placement.d.ts.map +1 -1
  783. package/dist/runtime/placement.js +4 -5
  784. package/dist/runtime/placement.js.map +1 -1
  785. package/dist/runtime/playback-controller.d.ts +31 -2
  786. package/dist/runtime/playback-controller.d.ts.map +1 -1
  787. package/dist/runtime/playback-controller.js +63 -6
  788. package/dist/runtime/playback-controller.js.map +1 -1
  789. package/dist/runtime/playback.js.map +1 -1
  790. package/dist/runtime/precompisition.js.map +1 -1
  791. package/dist/runtime/project-assets.js.map +1 -1
  792. package/dist/runtime/session.d.ts +9 -7
  793. package/dist/runtime/session.d.ts.map +1 -1
  794. package/dist/runtime/session.js +12 -4
  795. package/dist/runtime/session.js.map +1 -1
  796. package/dist/runtime/settle.js.map +1 -1
  797. package/dist/runtime/state-evaluator.d.ts +1 -1
  798. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  799. package/dist/runtime/state-evaluator.js +4 -3
  800. package/dist/runtime/state-evaluator.js.map +1 -1
  801. package/dist/runtime/text-geometry.d.ts.map +1 -1
  802. package/dist/runtime/text-geometry.js +7 -3
  803. package/dist/runtime/text-geometry.js.map +1 -1
  804. package/dist/sdk/index.d.ts +50 -25
  805. package/dist/sdk/index.d.ts.map +1 -1
  806. package/dist/sdk/index.js +52 -42
  807. package/dist/sdk/index.js.map +1 -1
  808. package/dist/tween/command-decorator.d.ts +2 -0
  809. package/dist/tween/command-decorator.d.ts.map +1 -1
  810. package/dist/tween/command-decorator.js.map +1 -1
  811. package/dist/tween/command.d.ts +12 -0
  812. package/dist/tween/command.d.ts.map +1 -1
  813. package/dist/tween/command.js +14 -0
  814. package/dist/tween/command.js.map +1 -1
  815. package/dist/tween/ease/constants.d.ts.map +1 -1
  816. package/dist/tween/ease/constants.js +8 -5
  817. package/dist/tween/ease/constants.js.map +1 -1
  818. package/dist/tween/ease/curve.d.ts.map +1 -1
  819. package/dist/tween/ease/curve.js +4 -3
  820. package/dist/tween/ease/curve.js.map +1 -1
  821. package/dist/tween/ease/describe.d.ts +15 -0
  822. package/dist/tween/ease/describe.d.ts.map +1 -0
  823. package/dist/tween/ease/describe.js +37 -0
  824. package/dist/tween/ease/describe.js.map +1 -0
  825. package/dist/tween/ease/type.js.map +1 -1
  826. package/dist/tween/index.js.map +1 -1
  827. package/dist/tween/inert.js.map +1 -1
  828. package/dist/tween/lerp.js.map +1 -1
  829. package/dist/tween/loop.js.map +1 -1
  830. package/dist/tween/prepare.d.ts +3 -3
  831. package/dist/tween/prepare.js +3 -3
  832. package/dist/tween/prepare.js.map +1 -1
  833. package/dist/tween/seekable.d.ts +1 -1
  834. package/dist/tween/seekable.js.map +1 -1
  835. package/dist/tween/stepper.js.map +1 -1
  836. package/dist/tween/to-command.js.map +1 -1
  837. package/dist/util/clamp.js.map +1 -1
  838. package/dist/util/context.js.map +1 -1
  839. package/dist/util/csv.js.map +1 -1
  840. package/dist/util/generateList.js.map +1 -1
  841. package/dist/util/index.js.map +1 -1
  842. package/dist/util/metrics.d.ts +1 -1
  843. package/dist/util/metrics.js +1 -1
  844. package/dist/util/metrics.js.map +1 -1
  845. package/dist/util/random.js.map +1 -1
  846. package/dist/util/reference.js.map +1 -1
  847. package/dist/util/scheduler.js.map +1 -1
  848. package/package.json +7 -1
  849. package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
  850. package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
  851. package/dist/attributes/shape/effects/implementations/displace.js +0 -30
  852. package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
  853. package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
  854. package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
  855. package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
  856. package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
  857. package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
  858. package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
  859. package/dist/attributes/shape/effects/implementations/texture.js +0 -25
  860. package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
  861. package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
  862. package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
  863. package/dist/attributes/shape/effects/implementations/trails.js +0 -22
  864. package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
  865. package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
  866. package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
  867. package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
  868. package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
  869. package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
  870. package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
  871. package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
  872. package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
  873. package/dist/nodes/geometry/dot-grid-node.js +0 -142
  874. package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
  875. package/dist/nodes/geometry/grid-lines.d.ts +0 -101
  876. package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
  877. package/dist/nodes/geometry/grid-lines.js +0 -128
  878. package/dist/nodes/geometry/grid-lines.js.map +0 -1
  879. package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
  880. package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
  881. package/dist/nodes/geometry/grid-pattern-node.js +0 -172
  882. package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
  883. package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
  884. package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
  885. package/dist/nodes/geometry/line-grid-node.js +0 -127
  886. package/dist/nodes/geometry/line-grid-node.js.map +0 -1
  887. package/dist/nodes/geometry/line-node.d.ts +0 -58
  888. package/dist/nodes/geometry/line-node.d.ts.map +0 -1
  889. package/dist/nodes/geometry/line-node.js +0 -123
  890. package/dist/nodes/geometry/line-node.js.map +0 -1
  891. package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
  892. package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
  893. package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
  894. package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
  895. package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
  896. package/dist/nodes/scene/canvas2d-node.js.map +0 -1
  897. package/dist/nodes/scene/provider-node.d.ts.map +0 -1
  898. package/dist/nodes/scene/provider-node.js.map +0 -1
  899. package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
  900. package/dist/nodes/scene/theme-provider-node.js.map +0 -1
  901. /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
  902. /package/dist/nodes/{scene → root}/provider-node.js +0 -0
  903. /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
  904. /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"playback-controller.js","sourceRoot":"","sources":["../../src/runtime/playback-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa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AED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { AssetManager } from \"../assets/manager\";\nimport { MeasureContext2D } from \"../render/measure-context\";\nimport { CanvasRenderContext2D } from \"../render/canvas-render-context2d\";\nimport { asTextBlockSource } from \"../render/text-layout\";\nimport { StateEvaluator } from \"./state-evaluator\";\nimport { renderSettled, SETTLE_PASSES, type SettleOutcome } from \"./settle\";\nimport { NodeState, TreeState, WaveformInfo, nodePath } from \"@/project/tree\";\nimport { AudioRequest } from \"@/attributes/audio/request\";\nimport { StorageAdapter } from \"../platform/storage-adapter\";\nimport { BuildError, AssetTimeline, AssetTimelineResult, type AssetTimelineProfile } from \"./asset-timeline\";\nimport { ClipStore, DEFAULT_PRECOMP_BUDGET_MS } from \"./clip-store\";\nimport type { AssetDecl } from \"@/assets/scope\";\nimport { yieldToScheduler } from \"@/util/scheduler\";\nimport { Ticker, TimeCallback } from \"@/platform/ticker\";\nimport { AudioSink } from \"@/platform/audio-sink\";\nimport { AssetCatalog } from \"@/assets/catalog\";\nimport { AssetNotLoadedError } from \"@/assets/errors\";\nimport type { AssetRecord } from \"@/assets/record\";\nimport { Size2D } from \"@/attributes/layout/size\";\nimport { Node } from \"@/nodes/node/node\";\nimport { Node2D } from \"@/nodes/2d/node2d\";\nimport type { NodeEditorStates } from \"@/nodes/node/node-editor-state\";\nimport type { ProjectDocument } from \"@/document/project\";\nimport type { Registry } from \"@/document/registry\";\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { NodeBox, collectBoxes, nodeAt, nodeBoxAt, parentPlanePointAt, pickNode, projectNode3DAt } from \"./node-picking\";\nimport type { Node3DFrame } from \"./node-picking3d\";\nimport type { Vector3 } from \"@/render3d/vector3\";\nimport { NodeTextLayout, nodeTextLayout } from \"./text-geometry\";\nimport { spanFrames, spansCovering, trackFrameCount, type TrackSpan } from \"./placement\";\n\n/**\n * Transient prop values layered over a node's evaluated state — see\n * {@link PlaybackController.setNodeOverride}. Keys are prop names the node\n * accepts (`x`, `y`, `rotation`, `width`, …).\n */\nexport type NodeOverride = Record<string, unknown>;\n\n/** Dependencies injected into `PlaybackController` at construction time. */\nexport type ControllerParams = {\n /** The project to play, its fps and viewport resolved — see `Session`. */\n project: ProjectDocument;\n /** The vocabulary its clips compile against. */\n registry: Registry;\n renderContext: CanvasRenderContext2D;\n measurer: MeasureContext2D;\n storageAdapter: StorageAdapter;\n masterClock: Ticker;\n audioDevice: AudioSink;\n assets: AssetCatalog;\n /**\n * Wall-clock ms the background discovery may run before yielding. Defaults\n * to {@link DEFAULT_PRECOMP_BUDGET_MS}; `0` in tests yields between every\n * sample interval, making preemption deterministic.\n */\n precompBudgetMs?: number;\n precompProfile?: AssetTimelineProfile;\n /**\n * Called each time background discovery lands another track. Passed at\n * construction so a fast first track can't publish before the caller attaches.\n */\n onPrecompProgress?: (result: AssetTimelineResult) => void;\n};\n\n/**\n * Orchestrates playback of a project document.\n *\n * On construction it discovers what frame 0 needs, then streams the rest of the\n * project's asset timeline in behind the first paint. Every clock tick:\n *\n * 1. Loads assets required at the current frame (`AssetManager.loadAt`).\n * 2. Evaluates the tracks on screen and lays them out (`StateEvaluator`).\n * 3. Renders the frame to the render context.\n * 4. Prefetches assets for upcoming frames.\n */\nexport class PlaybackController {\n private renderContext: CanvasRenderContext2D;\n private measurer: MeasureContext2D;\n private storageAdapter: StorageAdapter;\n private masterClock: Ticker;\n private stateEvaluator: StateEvaluator;\n private assetManager: AssetManager;\n private audioDevice: AudioSink;\n /**\n * Held rather than merely handed on, because {@link recoverMissingAsset} has\n * to build a record for a source no pass declared, from what the catalog\n * knows of it.\n */\n private readonly assetCatalog: AssetCatalog;\n /**\n * Called synchronously at the end of every frame this controller paints, on\n * the same task as the draw — for a host drawing *over* the canvas (a\n * selection box, a caret) that must measure the tree for the frame just\n * drawn rather than poll and trail a fast scrub. Called after the draw, so a\n * throwing listener is never mistaken for a render failure.\n */\n onFramePainted?: (frame: number) => void;\n\n /** Set by dispose(); once true the controller must never touch its (now-freed) render context again. */\n private disposed = false;\n /** One background pass at a time — see {@link startBackgroundPrecomp}. */\n private precompRunning = false;\n /**\n * Whether a frame has ever been drawn. Every render pass but {@link repaint}\n * loads the frame's assets first, so this is what `repaint` waits on before\n * it will draw one of its own.\n */\n private hasPainted = false;\n /**\n * Monotonic token bumped by every seek / tick / swap. A render pass captures\n * it at entry and bails before painting if a newer pass has begun, so a\n * superseded seek never stamps its stale frame over a newer one.\n */\n private seekGeneration = 0;\n private readonly precompBudgetMs: number;\n private readonly onPrecompProgress?: (result: AssetTimelineResult) => void;\n readonly fps: number;\n readonly viewport: Size2D;\n private readonly precomper: AssetTimeline;\n /** The one build per track that discovery, the evaluator and the editor API share. */\n private readonly store: ClipStore;\n /**\n * Transient prop values re-applied after every state evaluation, keyed by\n * structural path so they survive a rebuild. See {@link setNodeOverride}.\n */\n private readonly overrides = new Map<string, NodeOverride>();\n /** Latest assembled precomp result. */\n precomp: AssetTimelineResult;\n\n /** Every track's span on the project timeline, in document order. */\n get spans(): readonly TrackSpan[] {\n return this.precomp.tracks.map((track, index) => ({\n id: track.id,\n index,\n startFrame: track.startFrame,\n endFrame: track.startFrame + track.frameCount - 1,\n }));\n }\n\n get totalFrames(): number {\n return this.precomp.totalFrames;\n }\n\n /** Total playback duration in seconds. */\n get totalDuration(): number {\n return this.precomp.totalDuration;\n }\n\n /** The track the editor API reads from — see `StateEvaluator.currentTrackId`. */\n get currentTrackId(): string | null {\n return this.stateEvaluator.currentTrackId;\n }\n\n /**\n * Errors collected while discovering tracks, plus any thrown while\n * *drawing* — one list, because a consumer showing them has the same thing\n * to say about both: this frame is not what the document says.\n */\n get buildErrors(): BuildError[] {\n if (this.renderErrors.length === 0) return this.precomp.buildErrors;\n return [...this.precomp.buildErrors, ...this.renderErrors];\n }\n\n /**\n * Errors thrown by a render pass, deduplicated by message. A render throwing\n * happens per frame, at pointer rate while scrubbing, and left to propagate\n * it was an unhandled rejection and a canvas that simply stopped drawing.\n */\n private readonly renderErrors: BuildError[] = [];\n\n /** Called when {@link renderErrors} gains an entry. Set by the host. */\n onRenderError?: (errors: BuildError[]) => void;\n\n /**\n * Record a draw-time failure and tell the host, once per distinct message.\n * Swallowing it is the point: one bad frame must not take down the clock loop.\n */\n private captureRenderError(error: unknown, frame?: number): void {\n const e = error instanceof Error ? error : new Error(String(error));\n // A frame can reach for an asset no pass declared — an override previewing\n // an edit puts a picture on a node the rebuild that would declare it has\n // not run yet. The error names the source, so load it and paint again.\n if (frame !== undefined && this.recoverMissingAsset(e, frame)) return;\n if (this.renderErrors.some((prior) => prior.message === e.message)) return;\n this.renderErrors.push({\n trackId: this.stateEvaluator.currentTrackId ?? \"\",\n message: e.message,\n stack: e.stack,\n });\n this.onRenderError?.(this.buildErrors);\n }\n\n /**\n * Widen the drawing track's index by what the draw found missing, so the next\n * visit to this frame loads it ahead. The owner is the node the error names,\n * or else whoever declared the source elsewhere in the clip.\n */\n private learnMissingAsset(error: AssetNotLoadedError, frame: number): void {\n const decl = declOf(error, this.assetCatalog);\n if (!decl) return;\n for (const trackId of [...this.stateEvaluator.activeTrackIds].reverse()) {\n const instance = this.store.instanceOf(trackId);\n const track = this.precomp.tracks.find((t) => t.id === trackId);\n if (!instance || !track) continue;\n let ownerKey: string | undefined;\n if (error.nodeId !== undefined) {\n instance.forEachOwner((node, key) => {\n if (ownerKey === undefined && node.id === error.nodeId) ownerKey = key;\n });\n }\n ownerKey ??= this.store.ownersOf(trackId, error.src).values().next().value;\n if (ownerKey === undefined) continue;\n const next = this.precomper.learn(trackId, ownerKey, decl, Math.floor(frame) - track.startFrame);\n if (next !== this.precomp) this.adoptPrecomp(next);\n return;\n }\n }\n\n /**\n * Sources already tried by {@link recoverMissingAsset}, so a picture that\n * genuinely cannot be fetched is reported rather than re-fetched every frame\n * of a drag. Cleared by {@link clearRenderErrors}.\n */\n private readonly rescuedAssets = new Set<string>();\n\n /**\n * Load an asset a frame reached for but nothing had declared, then paint that\n * frame again. Deliberately narrow: only {@link AssetNotLoadedError}, only a\n * source the catalog can describe, and only once per source.\n */\n private recoverMissingAsset(error: Error, frame: number): boolean {\n if (!(error instanceof AssetNotLoadedError)) return false;\n // Audio is fetched on demand by the audio device, not through the storage adapter.\n if (error.assetType === \"audio\") return false;\n const token = `${error.assetType}:${error.src}`;\n if (this.rescuedAssets.has(token)) return false;\n this.rescuedAssets.add(token);\n // Once per source, like the rescue: a source that never loads would otherwise republish every frame.\n this.learnMissingAsset(error, frame);\n\n const record = this.recordFor(error.assetType, error.src, frame);\n if (!record) return false;\n\n void this.storageAdapter.loadAsset(error.src, record)\n .then(() => {\n if (this.disposed) return;\n this.renderAt(this.stateEvaluator.currentFrame);\n this.settleTrailing();\n })\n .catch((cause) => {\n if (this.disposed) return;\n // No `frame`, so it cannot come back through here a second time.\n this.captureRenderError(\n new Error(`${error.message}\\n\\nLoading it directly also failed: ${String(cause)}`),\n );\n });\n return true;\n }\n\n /**\n * A one-frame record describing `src` well enough to load it, from the\n * catalog's own metadata — or `null` when the catalog has never heard of it.\n */\n private recordFor(type: AssetNotLoadedError[\"assetType\"], src: string, frame: number): AssetRecord | null {\n try {\n if (type === \"font\") {\n // 400 is what an unsuffixed font key assumes.\n return {\n type: \"font\", src, startFrame: frame, endFrame: frame,\n fontFamily: src, fontWeight: 400,\n };\n }\n if (type === \"image\") {\n // Throws for a source the catalog has never heard of.\n this.assetCatalog.getImageMeta(src);\n return { type: \"image\", src, startFrame: frame, endFrame: frame };\n }\n this.assetCatalog.getVideoMeta(src);\n return {\n type: \"video\", src, startFrame: frame, endFrame: frame,\n trimStart: 0, trimEnd: this.assetCatalog.getVideoDuration(src),\n };\n } catch {\n return null;\n }\n }\n\n /** Forget draw-time errors — called when what they were about is replaced. */\n clearRenderErrors(): void {\n this.rescuedAssets.clear();\n if (this.renderErrors.length === 0) return;\n this.renderErrors.length = 0;\n this.onRenderError?.(this.buildErrors);\n }\n\n constructor(params: ControllerParams) {\n const { project } = params;\n if (project.fps === undefined || project.viewport === undefined) {\n throw new Error(\"PlaybackController takes a project whose fps and viewport are resolved — see Session.\");\n }\n this.renderContext = params.renderContext;\n this.measurer = params.measurer;\n this.masterClock = params.masterClock;\n this.storageAdapter = params.storageAdapter;\n this.audioDevice = params.audioDevice;\n this.fps = project.fps;\n this.viewport = project.viewport;\n this.precompBudgetMs = params.precompBudgetMs ?? DEFAULT_PRECOMP_BUDGET_MS;\n this.onPrecompProgress = params.onPrecompProgress;\n this.assetCatalog = params.assets;\n\n const scope = {\n registry: params.registry,\n viewport: this.viewport,\n fps: this.fps,\n assets: params.assets,\n measurer: this.measurer,\n };\n this.store = new ClipStore(project, scope, {\n profile: params.precompProfile,\n // Nothing is resident before the manager exists, which is what the first build should see.\n isReady: (key) => this.assetManager?.isReady(key) ?? false,\n });\n this.precomper = new AssetTimeline(project, scope, { store: this.store });\n // Only what frame 0 needs — the rest streams in behind the first paint,\n // so time-to-first-frame is O(the tracks on screen), not O(the project).\n this.precomp = this.precomper.ensureCovering(0);\n this.stateEvaluator = new StateEvaluator(project, scope, this.store);\n this.assetManager = new AssetManager(this.precomp, this.storageAdapter, this.audioDevice);\n\n this.masterClock.setDuration(this.totalDuration);\n\n this.masterClock.onPlay((t, speed, reverse) => {\n this.audioDevice.play(t, speed, reverse);\n this.storageAdapter.setPlaying(true);\n });\n this.masterClock.onPause(() => {\n this.audioDevice.stop();\n this.storageAdapter.setPlaying(false);\n });\n this.masterClock.onTick(async (currentTime: number) => {\n // A tick is also a render pass: claim a generation so a stale paused\n // seek can't paint after the clock has moved on (and vice-versa).\n const gen = ++this.seekGeneration;\n const frame = this.fps * currentTime;\n if (frame >= this.totalFrames) this.masterClock.pause();\n this.discoverThrough(frame);\n await this.loadFrame(frame);\n if (!this.isCurrent(gen)) return;\n this.audioDevice.syncTo(currentTime);\n this.renderAt(frame);\n this.assetManager.prefetch(frame);\n this.trimAround(frame);\n });\n\n this.startBackgroundPrecomp();\n }\n\n /**\n * Discover the remaining tracks off the critical path, republishing the\n * asset timeline as each one lands. Deferred behind a yield so the first\n * frame paints before this starts competing for the main thread.\n */\n private startBackgroundPrecomp(): void {\n if (this.precompRunning || this.disposed || this.precomp.complete) return;\n this.precompRunning = true;\n void (async () => {\n try {\n await yieldToScheduler();\n // Looped: a document swapped in during the pass's last step has\n // no yield left for the pass to notice it by.\n while (!this.disposed && !this.precomp.complete) {\n const final = await this.precomper.runAsync({\n budgetMs: this.precompBudgetMs,\n isCancelled: () => this.disposed,\n onProgress: result => this.adoptPrecomp(result),\n });\n if (this.disposed) return;\n if (!this.precomp.complete) this.adoptPrecomp(final);\n }\n } finally {\n this.precompRunning = false;\n }\n })();\n }\n\n /**\n * Swap in a newly assembled result. `setPrecomp` resets the asset manager's\n * audio signature, which is what reschedules audio a new result changed.\n */\n private adoptPrecomp(next: AssetTimelineResult): void {\n if (this.disposed) return;\n this.precomp = next;\n this.assetManager.setPrecomp(next);\n this.masterClock.setDuration(this.totalDuration);\n this.onPrecompProgress?.(next);\n }\n\n /**\n * Discover the tracks covering `frame` before anything loads or draws it — a\n * track nobody discovered has no asset windows, so its frame would reach for\n * decodes nothing loaded. Cheap once they are: this runs on every tick.\n */\n private discoverThrough(frame: number): void {\n const next = this.precomper.ensureCovering(Math.floor(frame));\n if (next !== this.precomp) this.adoptPrecomp(next);\n }\n\n /**\n * Load `frame`'s assets and the layout gates of every track covering it —\n * a face must be resident before text measures, whatever its window says.\n */\n private async loadFrame(frame: number): Promise<void> {\n const gates: AssetRecord[] = [];\n for (const span of spansCovering(this.store.spans, Math.floor(frame))) {\n for (const record of this.store.layoutGates(span.id)) {\n if (!this.assetManager.isReady(record.src)) gates.push(record);\n }\n }\n if (gates.length === 0) {\n await this.assetManager.loadAt(frame);\n return;\n }\n await Promise.all([this.assetManager.loadAt(frame), this.assetManager.loadRecords(gates)]);\n }\n\n /** Keep built trees near the playhead only; a released track keeps what discovery found. */\n private trimAround(frame: number): void {\n if (Math.abs(frame - this.lastTrimFrame) < this.fps) return;\n this.lastTrimFrame = frame;\n this.store.trim(Math.floor(frame), Math.ceil(TRIM_HORIZON_SECONDS * this.fps));\n }\n\n private lastTrimFrame = 0;\n\n get isPlaying(): boolean {\n return this.masterClock.isPlaying;\n }\n\n /** Current playback position in seconds. */\n get currentTime(): number {\n return this.masterClock.currentTime;\n }\n\n /** Current playback position in frames (float). */\n get currentFrame(): number {\n return this.masterClock.currentTime * this.fps;\n }\n\n /** Register a callback that fires on every clock tick with the current time. */\n onTime(cb: TimeCallback): void {\n this.masterClock.onTime(cb);\n }\n\n /** Register a callback that fires when playback starts. */\n onPlay(cb: () => void): void {\n this.masterClock.onPlay(() => cb());\n }\n\n /** Register a callback that fires when playback pauses. */\n onPause(cb: () => void): void {\n this.masterClock.onPause(cb);\n }\n\n /** True while `gen` is still the latest seek/tick and the controller is alive. */\n private isCurrent(gen: number): boolean {\n return !this.disposed && gen === this.seekGeneration;\n }\n\n /** Evaluate the tracks on screen, lay them out, and render `frame`. */\n private renderAt(frame: number): void {\n // A disposed controller's CanvasKit surface is freed; an in-flight seek\n // (StrictMode double-mount, HMR) can resolve after dispose().\n if (this.disposed) return;\n this.hasPainted = true;\n this.renders++;\n try {\n // A track whose compile measured a face before it loaded builds again, now that it has.\n this.store.settleGates(spansCovering(this.store.spans, Math.floor(frame)).map((span) => span.id));\n // Evaluation and layout are inside the guard too: a command can throw\n // at a time, and a missing font throws while measuring.\n this.stateEvaluator.stateAt(frame);\n // After evaluation, before layout: an override beats what the document\n // evaluated to, and the layout pass that follows sees it.\n this.applyOverrides();\n this.stateEvaluator.layout(this.measurer);\n this.renderContext.execute(() => {\n this.stateEvaluator.render(this.renderContext);\n });\n } catch (error) {\n this.captureRenderError(error, frame);\n }\n this.announcePaint(frame);\n }\n\n /** Tell {@link onFramePainted} a frame has landed, without letting a listener take the render loop down. */\n private announcePaint(frame: number): void {\n if (!this.onFramePainted) return;\n try {\n this.onFramePainted(Math.floor(frame));\n } catch (error) {\n console.error(\"[PlaybackController] onFramePainted listener threw:\", error);\n }\n }\n\n /**\n * Jump to `frame`, pausing playback first. Waits for required assets to\n * load before rendering, then prefetches upcoming frames.\n */\n async seek(frame: number): Promise<void> {\n if (this.disposed) return;\n const gen = ++this.seekGeneration;\n this.paintInFlight = gen;\n try {\n const clamped = Math.max(0, Math.min(frame, this.totalFrames));\n this.masterClock.pause();\n this.discoverThrough(clamped);\n this.masterClock.seek(clamped / this.fps);\n await this.loadFrame(clamped);\n if (!this.isCurrent(gen)) return;\n // A cold seek can land on a video frame or an image no draw has asked\n // for yet: the render asks, the adapter warms, the frame paints again.\n if (await this.settle(() => this.renderAt(clamped), gen) === \"superseded\") return;\n this.assetManager.prefetch(clamped);\n this.trimAround(clamped);\n } finally {\n this.paintLanded(gen);\n }\n }\n\n /**\n * Swap in a new document without rebuilding the backend.\n *\n * A track whose clip is unchanged keeps its tree and its discovery; one whose\n * clip patches in place re-declares only the owners the edit can reach, and\n * republishes the asset timeline only when that changed it. **The swap does not\n * paint**: it loads the frame's assets first, and the canvas keeps the last\n * complete frame until then — strictly better than a current frame with a\n * hole where an added picture has not arrived. See {@link pendingSwap}.\n */\n setProject(next: ProjectDocument): void {\n if (this.disposed) return;\n // Claimed before anything is touched, so a seek parked on a yield unwinds\n // rather than painting into a timeline that moved under it.\n const gen = ++this.seekGeneration;\n\n this.precomper.setProject(next);\n this.stateEvaluator.setProject(next);\n // Adopts only when the swap changed what is published — an edit no declaration read changes nothing.\n this.discoverThrough(this.currentFrame);\n this.clearRenderErrors();\n this.masterClock.setDuration(this.totalDuration);\n\n // The timeline may now be shorter than where the playhead sat.\n const frame = Math.min(this.currentFrame, Math.max(0, this.totalFrames - 1));\n this.pendingSwap = gen;\n this.paintInFlight = gen;\n this.lastReplacePaint = this.loadAndRepaint(frame, gen);\n this.startBackgroundPrecomp();\n }\n\n /** Resolves when the paint {@link setProject} scheduled has landed — for a caller that swaps in order to read the result. */\n whenReplaced(): Promise<void> {\n return this.lastReplacePaint;\n }\n\n private lastReplacePaint: Promise<void> = Promise.resolve();\n\n /**\n * The generation claimed by the swap whose paint has not landed yet, or `0`.\n *\n * {@link repaint} stands down while this names the current generation: the\n * swap is loading the frame's assets and owes a paint that reads every\n * override as it stands when it lands. A generation rather than a flag,\n * because a seek can supersede the swap, and a flag nobody cleared would\n * leave `repaint` disabled for the rest of the session.\n */\n private pendingSwap = 0;\n\n /** Load `frame`'s assets, then paint — abandoning both if a newer pass began. */\n private async loadAndRepaint(frame: number, gen: number): Promise<void> {\n try {\n try {\n await this.loadFrame(frame);\n } catch (err) {\n console.error(\"[PlaybackController] swap asset load failed:\", err);\n return;\n }\n await this.settle(() => this.renderAt(frame), gen);\n } finally {\n // Only this swap's claim is released: a newer one has written its own.\n if (this.pendingSwap === gen) this.pendingSwap = 0;\n this.paintLanded(gen);\n }\n }\n\n /** Reposition the clock to `frame` without interrupting playback. */\n seekWhilePlaying(frame: number): void {\n // Invalidate any in-flight paused seek so its late render can't paint over\n // the live playback position.\n ++this.seekGeneration;\n const clamped = Math.max(0, Math.min(frame, this.totalFrames));\n this.masterClock.seek(clamped / this.fps);\n }\n\n /**\n * Capture the current frame as a base-64 PNG data URL. Renders afresh — the\n * drawing buffer may have been cleared since the last tick — and loads the\n * frame's assets first, so the capture is right whatever the caller did\n * before it.\n */\n async screenshot(): Promise<string | undefined> {\n const frame = this.stateEvaluator.currentFrame;\n const gen = ++this.seekGeneration;\n this.paintInFlight = gen;\n try {\n await this.loadFrame(frame);\n if (!this.isCurrent(gen)) return undefined;\n // A capture is kept, not glanced at, so it waits for the upgrades a preview paints behind.\n if (await this.settle(() => this.renderAt(frame), gen, true) === \"superseded\") return undefined;\n return this.renderContext.screenshot();\n } finally {\n this.paintLanded(gen);\n }\n }\n\n /** {@link renderSettled} against this controller's generation, warning when a frame never settles. */\n private async settle(render: () => void, gen: number, upgrades = false): Promise<SettleOutcome> {\n const adapter = upgrades ? settlingUpgrades(this.storageAdapter) : this.storageAdapter;\n const outcome = await renderSettled(render, adapter, () => this.isCurrent(gen));\n if (outcome === \"exhausted\") {\n console.warn(`[PlaybackController] frame ${this.stateEvaluator.currentFrame} still had decodes pending after ${SETTLE_PASSES} passes`);\n }\n return outcome;\n }\n\n /**\n * The generation of the seek, swap or screenshot still on its way to its\n * paint, or `0`. A repaint behind decodes leaves that paint to it — see\n * {@link settleTrailing}.\n */\n private paintInFlight = 0;\n\n /** Bumped by every render, so a repaint owed to a landed upgrade can tell whether one has happened since. */\n private renders = 0;\n\n /** {@link renders} when an upgrade landed with a paint in flight, or `null`. */\n private repaintOwedSince: number | null = null;\n\n /** Release `gen`'s claim — unless a newer paint has claimed since — and repaint behind what it drew. */\n private paintLanded(gen: number): void {\n if (this.paintInFlight !== gen || this.disposed) return;\n this.paintInFlight = 0;\n if (this.repaintOwedSince !== null) {\n const stale = this.renders === this.repaintOwedSince;\n this.repaintOwedSince = null;\n if (stale && !this.isPlaying) this.renderAt(this.stateEvaluator.currentFrame);\n }\n this.settleTrailing();\n }\n\n /**\n * The current track's node tree, with each node's frame range on the project\n * timeline and its waveforms attached. Used by the timeline UI. `null` before\n * any track is built.\n */\n getTreeState(): TreeState | null {\n const instance = this.stateEvaluator.currentInstance;\n if (!instance) return null;\n const track = this.precomp.tracks.find(t => t.id === this.stateEvaluator.currentTrackId);\n const trackStart = track?.startFrame ?? 0;\n const frameCount = track?.frameCount ?? trackFrameCount(instance.duration, this.fps);\n\n const bars = new Map<string, { startFrame: number; endFrame: number }>();\n const pathOfOwner = new Map<string, string>();\n instance.forEachOwner((_node, ownerKey, span, path) => {\n pathOfOwner.set(ownerKey, path);\n const frames = spanFrames(span, this.fps, frameCount);\n if (frames) {\n bars.set(path, { startFrame: trackStart + frames.startFrame, endFrame: trackStart + frames.endFrame });\n }\n });\n const waveformsByPath = waveformsByOwner(track?.audioRequests ?? [], pathOfOwner);\n return nodeToTreeState(instance.canvas, \"\", bars, waveformsByPath);\n }\n\n getNodeState(nodeId: string): NodeState | null {\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return null;\n const node = findNode(canvas, nodeId);\n if (!node) return null;\n return { id: node.id, type: node.className, properties: node.properties };\n }\n\n // ---- Direct manipulation ----------------------------------------------\n // Where a node's pixels are, what is under a point, and a write path fast\n // enough for a drag. See `runtime/node-picking.ts` for the geometry.\n\n /**\n * The on-screen box of one node at the current frame, or `null` when the path\n * does not resolve. See {@link NodeBox}.\n *\n * @param path Structural path from {@link TreeState.path}.\n */\n getNodeBox(path: string): NodeBox | null {\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return null;\n // Through `nodeBoxAt`, so a path naming a mesh inside a `Canvas3D`\n // resolves too — see `node-picking3d.ts`.\n return nodeBoxAt(canvas, path);\n }\n\n /**\n * The node's **own** props at a structural path — what it holds right now,\n * in its own coordinate space, the space {@link setNodeOverride} writes into —\n * or `null` when the path doesn't resolve.\n */\n getNodePropsAt(path: string): NodeState[\"properties\"] | null {\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return null;\n const node = nodeAt(canvas, path);\n return node ? node.properties : null;\n }\n\n /** Every visible node's box in draw order — one tree walk instead of N {@link getNodeBox} calls. */\n getNodeBoxes(): NodeBox[] {\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return [];\n const out: NodeBox[] = [];\n collectBoxes(canvas, \"\", out, true);\n return out;\n }\n\n /**\n * Project points around the `Node3D` at `path`, or `null` when the path\n * doesn't resolve to one. See {@link Node3DFrame}.\n */\n projectNode3D(\n path: string,\n parentPoints: readonly Vector3[],\n localPoints: readonly Vector3[],\n ): Node3DFrame | null {\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return null;\n return projectNode3DAt(canvas, path, parentPoints, localPoints);\n }\n\n /**\n * Where a viewport point lands on the plane the node at `path` is positioned\n * in, in that plane's own y-up frame — see {@link parentPlanePointAt}.\n */\n parentPlanePoint(path: string, point: Vector2): Vector2 | null {\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return null;\n return parentPlanePointAt(canvas, path, point);\n }\n\n /**\n * Where a Text node's caret slots landed on screen, or `null` when the path\n * doesn't resolve, the node isn't text, or the measurer has no caret model.\n * See {@link NodeTextLayout}.\n */\n getTextLayout(path: string): NodeTextLayout | null {\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return null;\n const node = findNodeByPath(canvas, path);\n return node instanceof Node2D\n ? this.textLayoutOf(node, path)\n : null;\n }\n\n /** `node`'s caret slots in viewport space, or `null` when this controller's measurer keeps no glyph positions. */\n private textLayoutOf(node: Node2D, path: string): NodeTextLayout | null {\n const source = asTextBlockSource(this.measurer);\n return source ? nodeTextLayout(node, path, source) : null;\n }\n\n /**\n * The topmost node under a viewport-space point (origin at the viewport\n * centre, y-up), or `null`. `tolerance` is grab-slop in **scene units** —\n * the host's pixel slop divided by its preview zoom. See {@link pickNode}.\n */\n pickNode(point: Vector2, tolerance = 0): NodeBox | null {\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return null;\n return pickNode(canvas, point, tolerance);\n }\n\n /**\n * Layer transient prop values over a node, on top of whatever the document\n * evaluates to, re-applied after every evaluation until cleared — for an\n * editor dragging a node at pointer rate without rebuilding anything. Not\n * persistence: the host commits the value to its document on drop and\n * clears the override.\n *\n * @param path Structural path from {@link TreeState.path}.\n * @param props Props the node accepts. Merged over any existing override.\n */\n setNodeOverride(path: string, props: NodeOverride): void {\n const existing = this.overrides.get(path);\n this.overrides.set(path, existing ? { ...existing, ...props } : { ...props });\n this.applyOverrides();\n }\n\n /**\n * Drop one node's overrides, or all of them when `path` is omitted, and\n * repaint so the node snaps back to what the document says.\n *\n * Rebuilds the current track's tree to do it: an override was written\n * straight onto a live prop, and the timeline only restores what its own\n * commands write. Cheap enough for a pointer-up, which is the only place it\n * belongs.\n *\n * @param path Structural path, as {@link setNodeOverride} takes — not an id,\n * since a node a composite built for itself has no authored one to name.\n */\n clearNodeOverrides(path?: string): void {\n const cleared = path === undefined\n ? (this.overrides.size > 0 && (this.overrides.clear(), true))\n : this.overrides.delete(path);\n if (!cleared) return;\n this.stateEvaluator.rebuild();\n // Through `repaint` for both of its guards — see there.\n this.repaint();\n }\n\n /** Hidden/locked state for one track's nodes. Not authored, so it rides beside the document. */\n setEditorStates(trackId: string, states: NodeEditorStates | undefined): void {\n this.stateEvaluator.setEditorStates(trackId, states);\n this.repaint();\n }\n\n /**\n * Re-lay-out and repaint the current frame. Cheap enough for a pointer-rate\n * drag loop: `stateAt` early-returns for the frame already current.\n *\n * Does nothing **before the first frame has been drawn** — its assets have\n * not been loaded, and the last complete frame is a blank surface, which is\n * what should stay up — **nor between a swap and its paint**, which owes a\n * paint of its own. See {@link pendingSwap}.\n */\n repaint(): void {\n if (!this.hasPainted) return;\n if (this.pendingSwap !== 0 && this.isCurrent(this.pendingSwap)) return;\n this.renderAt(this.stateEvaluator.currentFrame);\n this.settleTrailing();\n }\n\n /**\n * Repaint a paused frame as the decodes its draw asked for land — one it could\n * not draw at all, and an upgrade of one it drew below demand, which no paint\n * waits for. Never while playing: the next tick picks them up. A seek, swap or\n * screenshot still on its way paints for itself, and once more when it lands\n * if an upgrade arrived after its render.\n */\n private settleTrailing(): void {\n if (this.trailingSettle || this.disposed || this.isPlaying || !this.hasBackgroundDecodes()) return;\n void this.repaintBehindDecodes().catch((error) => {\n console.error(\"[PlaybackController] background decode failed:\", error);\n });\n }\n\n private trailingSettle = false;\n\n private hasBackgroundDecodes(): boolean {\n return this.storageAdapter.hasPendingDecodes() || this.storageAdapter.hasPendingUpgrades();\n }\n\n private async repaintBehindDecodes(): Promise<void> {\n // Released in `finally` on the same turn as the return, so a paint landing\n // right after this gives up can start the next one.\n this.trailingSettle = true;\n try {\n for (let pass = 0; pass < SETTLE_PASSES && this.hasBackgroundDecodes(); pass++) {\n const [decoded, upgraded] = await Promise.all([\n this.storageAdapter.warmPendingDecodes(),\n this.storageAdapter.warmPendingUpgrades(),\n ]);\n if (!(decoded || upgraded) || this.disposed || this.isPlaying) return;\n if (this.paintInFlight !== 0) {\n this.repaintOwedSince = this.renders;\n return;\n }\n this.renderAt(this.stateEvaluator.currentFrame);\n }\n } finally {\n this.trailingSettle = false;\n }\n }\n\n /** Write every held override onto its node. No-op when none are set. */\n private applyOverrides(): void {\n if (this.overrides.size === 0) return;\n const canvas = this.stateEvaluator.currentCanvas;\n if (!canvas) return;\n for (const [path, props] of this.overrides) {\n findNodeByPath(canvas, path)?.set(props as never);\n }\n }\n\n play(speed: number = 1, reverse: boolean = false): void {\n if (this.currentFrame >= this.totalFrames) {\n this.seek(0).then(() => this.masterClock.play(speed, reverse)).catch(() => { });\n return;\n }\n this.masterClock.play(speed, reverse);\n }\n\n pause(): void {\n this.masterClock.pause();\n }\n\n setMuted(muted: boolean): void {\n this.audioDevice.setMuted(muted);\n }\n\n dispose(): void {\n this.disposed = true;\n this.masterClock.dispose();\n this.audioDevice.dispose();\n this.stateEvaluator.dispose();\n this.store.dispose();\n this.assetManager.dispose();\n }\n}\n\n/** How far from the playhead a built tree is kept, in seconds. */\nconst TRIM_HORIZON_SECONDS = 30;\n\n/** `adapter`, settling upgrades alongside what a frame needs — for a paint that is kept rather than shown. */\nfunction settlingUpgrades(adapter: StorageAdapter): Pick<StorageAdapter, \"warmPendingDecodes\"> {\n return {\n async warmPendingDecodes() {\n const [decoded, upgraded] = await Promise.all([adapter.warmPendingDecodes(), adapter.warmPendingUpgrades()]);\n return decoded || upgraded;\n },\n };\n}\n\n/** What a missing-asset error says was needed, as a declaration. */\nfunction declOf(error: AssetNotLoadedError, catalog: AssetCatalog): AssetDecl | undefined {\n switch (error.assetType) {\n case \"image\":\n return { type: \"image\", src: error.src };\n case \"font\":\n return { type: \"font\", family: error.src, weight: 400 };\n case \"video\":\n try {\n return { type: \"video\", src: error.src, trimStart: 0, trimEnd: catalog.getVideoDuration(error.src) };\n } catch {\n return undefined;\n }\n default:\n return undefined;\n }\n}\n\n// Every Node2D is a container (children may be empty); kept for callers that\n// want an explicit \"has children\" check.\nexport function isParentNode(node: Node2D): boolean {\n return node.children.length > 0;\n}\n\n/**\n * `node` and its subtree as {@link TreeState}, indexed over the authored child\n * list — the same one every other structural-path walk reads, so selection,\n * bars and `getNodeBox` share one set of paths.\n */\nfunction nodeToTreeState(\n node: Node,\n path: string,\n bars: ReadonlyMap<string, { startFrame: number; endFrame: number }>,\n waveformsByPath: ReadonlyMap<string, WaveformInfo[]>,\n): TreeState {\n const state: TreeState = {\n id: node.id,\n path,\n type: node.className,\n children: node._allChildren.map((c, i) => nodeToTreeState(c, nodePath(path, i), bars, waveformsByPath)),\n };\n const waveform = waveformsByPath.get(path);\n if (waveform && waveform.length > 0) state.waveform = waveform;\n const bar = bars.get(path);\n if (bar) {\n state.startFrame = bar.startFrame;\n state.endFrame = bar.endFrame;\n }\n return state;\n}\n\n/**\n * Group a track's audio requests into per-node waveform entries, keyed by the\n * structural path their owner has in the tree right now. A request whose owner\n * is not in the tree has no bar to land on.\n */\nfunction waveformsByOwner(\n requests: readonly AudioRequest[],\n pathOfOwner: ReadonlyMap<string, string>,\n): Map<string, WaveformInfo[]> {\n const byPath = new Map<string, WaveformInfo[]>();\n for (const req of requests) {\n const path = req.ownerId !== undefined ? pathOfOwner.get(req.ownerId) : \"\";\n if (path === undefined) continue;\n const info: WaveformInfo = {\n src: req.src,\n startTime: req.startAt,\n endTime: Number.isFinite(req.endAt) ? req.endAt : null,\n };\n const list = byPath.get(path);\n if (list) list.push(info);\n else byPath.set(path, [info]);\n }\n return byPath;\n}\n\n/** The node at a structural path (`\"\"` = root, `\"0.2\"` = third child of the first), walking the authored list. */\nfunction findNodeByPath(root: Node2D, path: string): Node | null {\n if (path === \"\") return root;\n let node: Node = root;\n for (const seg of path.split(\".\")) {\n const next = node._allChildren[Number(seg)];\n if (!next) return null;\n node = next;\n }\n return node;\n}\n\nfunction findNode(root: Node, id: string): Node | null {\n if (root.id === id) return root;\n\n for (const child of root._allChildren) {\n const found = findNode(child, id);\n if (found) return found;\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"playback-controller.js","sourceRoot":"","sources":["../../src/runtime/playback-controller.ts"],"names":[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CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,GAAG,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,QAAQ,CAAC,IAAU,EAAE,EAAU;IACpC,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAEhC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IAC5B,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { AssetManager } from \"../assets/manager\";\r\nimport { MeasureContext2D } from \"../render/measure-context\";\r\nimport { CanvasRenderContext2D } from \"../render/canvas-render-context2d\";\r\nimport { asTextBlockSource } from \"../render/text-layout\";\r\nimport { StateEvaluator } from \"./state-evaluator\";\r\nimport { renderSettled, SETTLE_PASSES, type SettleOutcome } from \"./settle\";\r\nimport { NodeState, TreeState, WaveformInfo, nodePath } from \"@/project/tree\";\r\nimport { AudioRequest } from \"@/attributes/audio/request\";\r\nimport { StorageAdapter } from \"../platform/storage-adapter\";\r\nimport { BuildError, AssetTimeline, AssetTimelineResult, type AssetTimelineProfile } from \"./asset-timeline\";\r\nimport { ClipStore, DEFAULT_PRECOMP_BUDGET_MS } from \"./clip-store\";\r\nimport type { AssetDecl } from \"@/assets/scope\";\r\nimport { yieldToScheduler } from \"@/util/scheduler\";\r\nimport { Ticker, TimeCallback } from \"@/platform/ticker\";\r\nimport { AudioSink } from \"@/platform/audio-sink\";\r\nimport { AssetCatalog } from \"@/assets/catalog\";\r\nimport { AssetNotLoadedError } from \"@/assets/errors\";\r\nimport type { AssetRecord } from \"@/assets/record\";\r\nimport { Size2D } from \"@/attributes/layout/size\";\r\nimport { Node } from \"@/nodes/node/node\";\r\nimport { Node2D, type NodeHandle } from \"@/nodes/2d/node2d\";\r\nimport type { NodeEditorStates } from \"@/nodes/node/node-editor-state\";\r\nimport type { ProjectDocument } from \"@/document/project\";\r\nimport type { Registry } from \"@/document/registry\";\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { NodeBox, childPlanePointAt, collectBoxes, handleValueAt, nodeAt, nodeBoxAt, nodeHandlesAt, parentPlanePointAt, pickNode, projectNode3DAt, reparentPlacementAt, type ReparentPlacement } from \"./node-picking\";\r\nimport type { Node3DFrame } from \"./node-picking3d\";\r\nimport type { Vector3 } from \"@/render3d/vector3\";\r\nimport { NodeTextLayout, nodeTextLayout } from \"./text-geometry\";\r\nimport { spanFrames, spansCovering, trackFrameCount, type TrackSpan } from \"./placement\";\r\nimport { clipFrameToTime, clipTimeToFrame } from \"./frame-time\";\r\n\r\n/**\r\n * Transient prop values layered over a node's evaluated state — see\r\n * {@link PlaybackController.setNodeOverride}. Keys are prop names the node\r\n * accepts (`x`, `y`, `rotation`, `width`, …).\r\n */\r\nexport type NodeOverride = Record<string, unknown>;\r\n\r\n/** Dependencies injected into `PlaybackController` at construction time. */\r\nexport type ControllerParams = {\r\n /** The project to play, its fps and viewport resolved — see `Session`. */\r\n project: ProjectDocument;\r\n /** The vocabulary its clips compile against. */\r\n registry: Registry;\r\n renderContext: CanvasRenderContext2D;\r\n measurer: MeasureContext2D;\r\n storageAdapter: StorageAdapter;\r\n masterClock: Ticker;\r\n audioDevice: AudioSink;\r\n assets: AssetCatalog;\r\n /**\r\n * Wall-clock ms the background discovery may run before yielding. Defaults\r\n * to {@link DEFAULT_PRECOMP_BUDGET_MS}; `0` in tests yields between every\r\n * sample interval, making preemption deterministic.\r\n */\r\n precompBudgetMs?: number;\r\n precompProfile?: AssetTimelineProfile;\r\n /**\r\n * Called each time background discovery lands another track. Passed at\r\n * construction so a fast first track can't publish before the caller attaches.\r\n */\r\n onPrecompProgress?: (result: AssetTimelineResult) => void;\r\n};\r\n\r\n/**\r\n * Orchestrates playback of a project document.\r\n *\r\n * On construction it discovers what frame 0 needs, then streams the rest of the\r\n * project's asset timeline in behind the first paint. Every clock tick:\r\n *\r\n * 1. Loads assets required at the current frame (`AssetManager.loadAt`).\r\n * 2. Evaluates the tracks on screen and lays them out (`StateEvaluator`).\r\n * 3. Renders the frame to the render context.\r\n * 4. Prefetches assets for upcoming frames.\r\n */\r\nexport class PlaybackController {\r\n private renderContext: CanvasRenderContext2D;\r\n private measurer: MeasureContext2D;\r\n private storageAdapter: StorageAdapter;\r\n private masterClock: Ticker;\r\n private stateEvaluator: StateEvaluator;\r\n private assetManager: AssetManager;\r\n private audioDevice: AudioSink;\r\n /**\r\n * Held rather than merely handed on, because {@link recoverMissingAsset} has\r\n * to build a record for a source no pass declared, from what the catalog\r\n * knows of it.\r\n */\r\n private readonly assetCatalog: AssetCatalog;\r\n /**\r\n * Called synchronously at the end of every frame this controller paints, on\r\n * the same task as the draw — for a host drawing *over* the canvas (a\r\n * selection box, a caret) that must measure the tree for the frame just\r\n * drawn rather than poll and trail a fast scrub. Called after the draw, so a\r\n * throwing listener is never mistaken for a render failure.\r\n */\r\n onFramePainted?: (frame: number) => void;\r\n\r\n /** Set by dispose(); once true the controller must never touch its (now-freed) render context again. */\r\n private disposed = false;\r\n /** One background pass at a time — see {@link startBackgroundPrecomp}. */\r\n private precompRunning = false;\r\n /**\r\n * Whether a frame has ever been drawn. Every render pass but {@link repaint}\r\n * loads the frame's assets first, so this is what `repaint` waits on before\r\n * it will draw one of its own.\r\n */\r\n private hasPainted = false;\r\n /**\r\n * Monotonic token bumped by every seek / tick / swap. A render pass captures\r\n * it at entry and bails before painting if a newer pass has begun, so a\r\n * superseded seek never stamps its stale frame over a newer one.\r\n */\r\n private seekGeneration = 0;\r\n private readonly precompBudgetMs: number;\r\n private readonly onPrecompProgress?: (result: AssetTimelineResult) => void;\r\n readonly fps: number;\r\n readonly viewport: Size2D;\r\n private readonly precomper: AssetTimeline;\r\n /** The one build per track that discovery, the evaluator and the editor API share. */\r\n private readonly store: ClipStore;\r\n /**\r\n * Transient prop values re-applied after every state evaluation, keyed by\r\n * structural path so they survive a rebuild. See {@link setNodeOverride}.\r\n */\r\n private readonly overrides = new Map<string, NodeOverride>();\r\n /** Latest assembled precomp result. */\r\n precomp: AssetTimelineResult;\r\n\r\n /** Every track's span on the project timeline, in document order. */\r\n get spans(): readonly TrackSpan[] {\r\n return this.precomp.tracks.map((track, index) => ({\r\n id: track.id,\r\n index,\r\n startFrame: track.startFrame,\r\n endFrame: track.startFrame + track.frameCount - 1,\r\n }));\r\n }\r\n\r\n get totalFrames(): number {\r\n return this.precomp.totalFrames;\r\n }\r\n\r\n /** Total playback duration in seconds. */\r\n get totalDuration(): number {\r\n return this.precomp.totalDuration;\r\n }\r\n\r\n /** The track the editor API reads from — see `StateEvaluator.currentTrackId`. */\r\n get currentTrackId(): string | null {\r\n return this.stateEvaluator.currentTrackId;\r\n }\r\n\r\n /**\r\n * Errors collected while discovering tracks, plus any thrown while\r\n * *drawing* — one list, because a consumer showing them has the same thing\r\n * to say about both: this frame is not what the document says.\r\n */\r\n get buildErrors(): BuildError[] {\r\n if (this.renderErrors.length === 0) return this.precomp.buildErrors;\r\n return [...this.precomp.buildErrors, ...this.renderErrors];\r\n }\r\n\r\n /**\r\n * Errors thrown by a render pass, deduplicated by message. A render throwing\r\n * happens per frame, at pointer rate while scrubbing, and left to propagate\r\n * it was an unhandled rejection and a canvas that simply stopped drawing.\r\n */\r\n private readonly renderErrors: BuildError[] = [];\r\n\r\n /** Called when {@link renderErrors} gains an entry. Set by the host. */\r\n onRenderError?: (errors: BuildError[]) => void;\r\n\r\n /**\r\n * Record a draw-time failure and tell the host, once per distinct message.\r\n * Swallowing it is the point: one bad frame must not take down the clock loop.\r\n */\r\n private captureRenderError(error: unknown, frame?: number): void {\r\n const e = error instanceof Error ? error : new Error(String(error));\r\n // A frame can reach for an asset no pass declared — an override previewing\r\n // an edit puts a picture on a node the rebuild that would declare it has\r\n // not run yet. The error names the source, so load it and paint again.\r\n if (frame !== undefined && this.recoverMissingAsset(e, frame)) return;\r\n if (this.renderErrors.some((prior) => prior.message === e.message)) return;\r\n this.renderErrors.push({\r\n trackId: this.stateEvaluator.currentTrackId ?? \"\",\r\n message: e.message,\r\n stack: e.stack,\r\n });\r\n this.onRenderError?.(this.buildErrors);\r\n }\r\n\r\n /**\r\n * Widen the drawing track's index by what the draw found missing, so the next\r\n * visit to this frame loads it ahead. The owner is the node the error names,\r\n * or else whoever declared the source elsewhere in the clip.\r\n */\r\n private learnMissingAsset(error: AssetNotLoadedError, frame: number): void {\r\n const decl = declOf(error, this.assetCatalog);\r\n if (!decl) return;\r\n for (const trackId of [...this.stateEvaluator.activeTrackIds].reverse()) {\r\n const instance = this.store.instanceOf(trackId);\r\n const track = this.precomp.tracks.find((t) => t.id === trackId);\r\n if (!instance || !track) continue;\r\n let ownerKey: string | undefined;\r\n if (error.nodeId !== undefined) {\r\n instance.forEachOwner((node, key) => {\r\n if (ownerKey === undefined && node.id === error.nodeId) ownerKey = key;\r\n });\r\n }\r\n ownerKey ??= this.store.ownersOf(trackId, error.src).values().next().value;\r\n if (ownerKey === undefined) continue;\r\n const next = this.precomper.learn(trackId, ownerKey, decl, Math.floor(frame) - track.startFrame);\r\n if (next !== this.precomp) this.adoptPrecomp(next);\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * Sources already tried by {@link recoverMissingAsset}, so a picture that\r\n * genuinely cannot be fetched is reported rather than re-fetched every frame\r\n * of a drag. Cleared by {@link clearRenderErrors}.\r\n */\r\n private readonly rescuedAssets = new Set<string>();\r\n\r\n /**\r\n * Load an asset a frame reached for but nothing had declared, then paint that\r\n * frame again. Deliberately narrow: only {@link AssetNotLoadedError}, only a\r\n * source the catalog can describe, and only once per source.\r\n */\r\n private recoverMissingAsset(error: Error, frame: number): boolean {\r\n if (!(error instanceof AssetNotLoadedError)) return false;\r\n // Audio is fetched on demand by the audio device, not through the storage adapter.\r\n if (error.assetType === \"audio\") return false;\r\n const token = `${error.assetType}:${error.src}`;\r\n if (this.rescuedAssets.has(token)) return false;\r\n this.rescuedAssets.add(token);\r\n // Once per source, like the rescue: a source that never loads would otherwise republish every frame.\r\n this.learnMissingAsset(error, frame);\r\n\r\n const record = this.recordFor(error.assetType, error.src, frame);\r\n if (!record) return false;\r\n\r\n void this.storageAdapter.loadAsset(error.src, record)\r\n .then(() => {\r\n if (this.disposed) return;\r\n this.renderAt(this.stateEvaluator.currentFrame);\r\n this.settleTrailing();\r\n })\r\n .catch((cause) => {\r\n if (this.disposed) return;\r\n // No `frame`, so it cannot come back through here a second time.\r\n this.captureRenderError(\r\n new Error(`${error.message}\\n\\nLoading it directly also failed: ${String(cause)}`),\r\n );\r\n });\r\n return true;\r\n }\r\n\r\n /**\r\n * A one-frame record describing `src` well enough to load it, from the\r\n * catalog's own metadata — or `null` when the catalog has never heard of it.\r\n */\r\n private recordFor(type: AssetNotLoadedError[\"assetType\"], src: string, frame: number): AssetRecord | null {\r\n try {\r\n if (type === \"font\") {\r\n // 400 is what an unsuffixed font key assumes.\r\n return {\r\n type: \"font\", src, startFrame: frame, endFrame: frame,\r\n fontFamily: src, fontWeight: 400,\r\n };\r\n }\r\n if (type === \"image\") {\r\n // Throws for a source the catalog has never heard of.\r\n this.assetCatalog.getImageMeta(src);\r\n return { type: \"image\", src, startFrame: frame, endFrame: frame };\r\n }\r\n this.assetCatalog.getVideoMeta(src);\r\n return {\r\n type: \"video\", src, startFrame: frame, endFrame: frame,\r\n trimStart: 0, trimEnd: this.assetCatalog.getVideoDuration(src),\r\n };\r\n } catch {\r\n return null;\r\n }\r\n }\r\n\r\n /** Forget draw-time errors — called when what they were about is replaced. */\r\n clearRenderErrors(): void {\r\n this.rescuedAssets.clear();\r\n if (this.renderErrors.length === 0) return;\r\n this.renderErrors.length = 0;\r\n this.onRenderError?.(this.buildErrors);\r\n }\r\n\r\n constructor(params: ControllerParams) {\r\n const { project } = params;\r\n if (project.fps === undefined || project.viewport === undefined) {\r\n throw new Error(\"PlaybackController takes a project whose fps and viewport are resolved — see Session.\");\r\n }\r\n this.renderContext = params.renderContext;\r\n this.measurer = params.measurer;\r\n this.masterClock = params.masterClock;\r\n this.storageAdapter = params.storageAdapter;\r\n this.audioDevice = params.audioDevice;\r\n this.fps = project.fps;\r\n this.viewport = project.viewport;\r\n this.precompBudgetMs = params.precompBudgetMs ?? DEFAULT_PRECOMP_BUDGET_MS;\r\n this.onPrecompProgress = params.onPrecompProgress;\r\n this.assetCatalog = params.assets;\r\n\r\n const scope = {\r\n registry: params.registry,\r\n viewport: this.viewport,\r\n fps: this.fps,\r\n assets: params.assets,\r\n measurer: this.measurer,\r\n };\r\n this.store = new ClipStore(project, scope, {\r\n profile: params.precompProfile,\r\n // Nothing is resident before the manager exists, which is what the first build should see.\r\n isReady: (key) => this.assetManager?.isReady(key) ?? false,\r\n });\r\n this.precomper = new AssetTimeline(project, scope, { store: this.store });\r\n // Only what frame 0 needs — the rest streams in behind the first paint,\r\n // so time-to-first-frame is O(the tracks on screen), not O(the project).\r\n this.precomp = this.precomper.ensureCovering(0);\r\n this.stateEvaluator = new StateEvaluator(project, scope, this.store);\r\n this.assetManager = new AssetManager(\r\n this.precomp, this.storageAdapter, this.audioDevice,\r\n (error) => this.captureRenderError(error),\r\n );\r\n\r\n this.masterClock.setDuration(this.totalDuration);\r\n\r\n this.masterClock.onPlay((t, speed, reverse) => {\r\n this.audioDevice.play(t, speed, reverse);\r\n this.storageAdapter.setPlaying(true);\r\n });\r\n this.masterClock.onPause(() => {\r\n this.audioDevice.stop();\r\n this.storageAdapter.setPlaying(false);\r\n });\r\n this.masterClock.onTick(async (currentTime: number) => {\r\n // A tick is also a render pass: claim a generation so a stale paused\r\n // seek can't paint after the clock has moved on (and vice-versa).\r\n const gen = ++this.seekGeneration;\r\n const frame = clipTimeToFrame(currentTime, this.fps);\r\n if (frame >= this.totalFrames) this.masterClock.pause();\r\n this.discoverThrough(frame);\r\n await this.loadFrame(frame);\r\n if (!this.isCurrent(gen)) return;\r\n this.audioDevice.syncTo(currentTime);\r\n this.renderAt(frame);\r\n this.assetManager.prefetch(frame);\r\n this.trimAround(frame);\r\n });\r\n\r\n this.startBackgroundPrecomp();\r\n }\r\n\r\n /**\r\n * Discover the remaining tracks off the critical path, republishing the\r\n * asset timeline as each one lands. Deferred behind a yield so the first\r\n * frame paints before this starts competing for the main thread.\r\n */\r\n private startBackgroundPrecomp(): void {\r\n if (this.precompRunning || this.disposed || this.precomp.complete) return;\r\n this.precompRunning = true;\r\n void (async () => {\r\n try {\r\n await yieldToScheduler();\r\n // Looped: a document swapped in during the pass's last step has\r\n // no yield left for the pass to notice it by.\r\n while (!this.disposed && !this.precomp.complete) {\r\n const final = await this.precomper.runAsync({\r\n budgetMs: this.precompBudgetMs,\r\n isCancelled: () => this.disposed,\r\n onProgress: result => this.adoptPrecomp(result),\r\n });\r\n if (this.disposed) return;\r\n if (!this.precomp.complete) this.adoptPrecomp(final);\r\n }\r\n } finally {\r\n this.precompRunning = false;\r\n }\r\n })();\r\n }\r\n\r\n /**\r\n * Swap in a newly assembled result. `setPrecomp` resets the asset manager's\r\n * audio signature, which is what reschedules audio a new result changed.\r\n */\r\n private adoptPrecomp(next: AssetTimelineResult): void {\r\n if (this.disposed) return;\r\n this.precomp = next;\r\n this.assetManager.setPrecomp(next);\r\n this.masterClock.setDuration(this.totalDuration);\r\n this.onPrecompProgress?.(next);\r\n }\r\n\r\n /**\r\n * Discover the tracks covering `frame` before anything loads or draws it — a\r\n * track nobody discovered has no asset windows, so its frame would reach for\r\n * decodes nothing loaded. Cheap once they are: this runs on every tick.\r\n */\r\n private discoverThrough(frame: number): void {\r\n const next = this.precomper.ensureCovering(Math.floor(frame));\r\n if (next !== this.precomp) this.adoptPrecomp(next);\r\n }\r\n\r\n /**\r\n * Load `frame`'s assets and the layout gates of every track covering it —\r\n * a face must be resident before text measures, whatever its window says.\r\n */\r\n private async loadFrame(frame: number): Promise<void> {\r\n const gates: AssetRecord[] = [];\r\n for (const span of spansCovering(this.store.spans, Math.floor(frame))) {\r\n for (const record of this.store.layoutGates(span.id)) {\r\n if (!this.assetManager.isReady(record.src)) gates.push(record);\r\n }\r\n }\r\n if (gates.length === 0) {\r\n await this.assetManager.loadAt(frame);\r\n return;\r\n }\r\n await Promise.all([this.assetManager.loadAt(frame), this.assetManager.loadRecords(gates)]);\r\n }\r\n\r\n /** Keep built trees near the playhead only; a released track keeps what discovery found. */\r\n private trimAround(frame: number): void {\r\n if (Math.abs(frame - this.lastTrimFrame) < this.fps) return;\r\n this.lastTrimFrame = frame;\r\n this.store.trim(Math.floor(frame), Math.ceil(TRIM_HORIZON_SECONDS * this.fps));\r\n }\r\n\r\n private lastTrimFrame = 0;\r\n\r\n get isPlaying(): boolean {\r\n return this.masterClock.isPlaying;\r\n }\r\n\r\n /** Current playback position in seconds. */\r\n get currentTime(): number {\r\n return this.masterClock.currentTime;\r\n }\r\n\r\n /** Current playback position in frames (float). */\r\n get currentFrame(): number {\r\n return clipTimeToFrame(this.masterClock.currentTime, this.fps);\r\n }\r\n\r\n /** Register a callback that fires on every clock tick with the current time. */\r\n onTime(cb: TimeCallback): void {\r\n this.masterClock.onTime(cb);\r\n }\r\n\r\n /** Register a callback that fires when playback starts. */\r\n onPlay(cb: () => void): void {\r\n this.masterClock.onPlay(() => cb());\r\n }\r\n\r\n /** Register a callback that fires when playback pauses. */\r\n onPause(cb: () => void): void {\r\n this.masterClock.onPause(cb);\r\n }\r\n\r\n /** True while `gen` is still the latest seek/tick and the controller is alive. */\r\n private isCurrent(gen: number): boolean {\r\n return !this.disposed && gen === this.seekGeneration;\r\n }\r\n\r\n /** Evaluate the tracks on screen, lay them out, and render `frame`. */\r\n private renderAt(frame: number): void {\r\n // A disposed controller's CanvasKit surface is freed; an in-flight seek\r\n // (StrictMode double-mount, HMR) can resolve after dispose().\r\n if (this.disposed) return;\r\n this.hasPainted = true;\r\n this.renders++;\r\n try {\r\n // A track whose compile measured a face before it loaded builds again, now that it has.\r\n this.store.settleGates(spansCovering(this.store.spans, Math.floor(frame)).map((span) => span.id));\r\n // Evaluation and layout are inside the guard too: a command can throw\r\n // at a time, and a missing font throws while measuring.\r\n this.stateEvaluator.stateAt(frame);\r\n // After evaluation, before layout: an override beats what the document\r\n // evaluated to, and the layout pass that follows sees it.\r\n this.applyOverrides();\r\n this.stateEvaluator.layout(this.measurer);\r\n this.renderContext.execute(() => {\r\n this.stateEvaluator.render(this.renderContext);\r\n });\r\n } catch (error) {\r\n this.captureRenderError(error, frame);\r\n }\r\n this.announcePaint(frame);\r\n }\r\n\r\n /** Tell {@link onFramePainted} a frame has landed, without letting a listener take the render loop down. */\r\n private announcePaint(frame: number): void {\r\n if (!this.onFramePainted) return;\r\n try {\r\n this.onFramePainted(Math.floor(frame));\r\n } catch (error) {\r\n console.error(\"[PlaybackController] onFramePainted listener threw:\", error);\r\n }\r\n }\r\n\r\n /**\r\n * Jump to `frame`, pausing playback first. Waits for required assets to\r\n * load before rendering, then prefetches upcoming frames.\r\n */\r\n async seek(frame: number): Promise<void> {\r\n if (this.disposed) return;\r\n const gen = ++this.seekGeneration;\r\n this.paintInFlight = gen;\r\n try {\r\n const clamped = Math.max(0, Math.min(frame, this.totalFrames));\r\n this.masterClock.pause();\r\n this.discoverThrough(clamped);\r\n this.masterClock.seek(clipFrameToTime(clamped, this.fps));\r\n await this.loadFrame(clamped);\r\n if (!this.isCurrent(gen)) return;\r\n // A cold seek can land on a video frame or an image no draw has asked\r\n // for yet: the render asks, the adapter warms, the frame paints again.\r\n if (await this.settle(() => this.renderAt(clamped), gen) === \"superseded\") return;\r\n this.assetManager.prefetch(clamped);\r\n this.trimAround(clamped);\r\n } finally {\r\n this.paintLanded(gen);\r\n }\r\n }\r\n\r\n /**\r\n * Swap in a new document without rebuilding the backend.\r\n *\r\n * A track whose clip is unchanged keeps its tree and its discovery; one whose\r\n * clip patches in place re-declares only the owners the edit can reach, and\r\n * republishes the asset timeline only when that changed it. **The swap does not\r\n * paint**: it loads the frame's assets first, and the canvas keeps the last\r\n * complete frame until then — strictly better than a current frame with a\r\n * hole where an added picture has not arrived. See {@link pendingSwap}.\r\n */\r\n setProject(next: ProjectDocument): void {\r\n if (this.disposed) return;\r\n // Claimed before anything is touched, so a seek parked on a yield unwinds\r\n // rather than painting into a timeline that moved under it.\r\n const gen = ++this.seekGeneration;\r\n\r\n this.precomper.setProject(next);\r\n this.stateEvaluator.setProject(next);\r\n // Adopts only when the swap changed what is published — an edit no declaration read changes nothing.\r\n this.discoverThrough(this.currentFrame);\r\n this.clearRenderErrors();\r\n this.masterClock.setDuration(this.totalDuration);\r\n\r\n // The timeline may now be shorter than where the playhead sat.\r\n const frame = Math.min(this.currentFrame, Math.max(0, this.totalFrames - 1));\r\n this.pendingSwap = gen;\r\n this.paintInFlight = gen;\r\n this.lastReplacePaint = this.loadAndRepaint(frame, gen);\r\n this.startBackgroundPrecomp();\r\n }\r\n\r\n /**\r\n * The catalog this controller builds against changed in place: build every\r\n * track again and repaint, as a swap to the same document would if it could\r\n * tell. A clip that failed for want of an entry the catalog now has builds,\r\n * and one measured against an old size is measured again.\r\n */\r\n reconcileCatalog(): void {\r\n if (this.disposed) return;\r\n this.store.reset();\r\n this.setProject(this.store.project);\r\n }\r\n\r\n /** Resolves when the paint {@link setProject} scheduled has landed — for a caller that swaps in order to read the result. */\r\n whenReplaced(): Promise<void> {\r\n return this.lastReplacePaint;\r\n }\r\n\r\n private lastReplacePaint: Promise<void> = Promise.resolve();\r\n\r\n /**\r\n * The generation claimed by the swap whose paint has not landed yet, or `0`.\r\n *\r\n * {@link repaint} stands down while this names the current generation: the\r\n * swap is loading the frame's assets and owes a paint that reads every\r\n * override as it stands when it lands. A generation rather than a flag,\r\n * because a seek can supersede the swap, and a flag nobody cleared would\r\n * leave `repaint` disabled for the rest of the session.\r\n */\r\n private pendingSwap = 0;\r\n\r\n /** Load `frame`'s assets, then paint — abandoning both if a newer pass began. */\r\n private async loadAndRepaint(frame: number, gen: number): Promise<void> {\r\n try {\r\n try {\r\n await this.loadFrame(frame);\r\n } catch (err) {\r\n console.error(\"[PlaybackController] swap asset load failed:\", err);\r\n return;\r\n }\r\n await this.settle(() => this.renderAt(frame), gen);\r\n } finally {\r\n // Only this swap's claim is released: a newer one has written its own.\r\n if (this.pendingSwap === gen) this.pendingSwap = 0;\r\n this.paintLanded(gen);\r\n }\r\n }\r\n\r\n /** Reposition the clock to `frame` without interrupting playback. */\r\n seekWhilePlaying(frame: number): void {\r\n // Invalidate any in-flight paused seek so its late render can't paint over\r\n // the live playback position.\r\n ++this.seekGeneration;\r\n const clamped = Math.max(0, Math.min(frame, this.totalFrames));\r\n this.masterClock.seek(clipFrameToTime(clamped, this.fps));\r\n }\r\n\r\n /**\r\n * Capture the current frame as a base-64 PNG data URL. Renders afresh — the\r\n * drawing buffer may have been cleared since the last tick — and loads the\r\n * frame's assets first, so the capture is right whatever the caller did\r\n * before it.\r\n */\r\n async screenshot(): Promise<string | undefined> {\r\n const frame = this.stateEvaluator.currentFrame;\r\n const gen = ++this.seekGeneration;\r\n this.paintInFlight = gen;\r\n try {\r\n await this.loadFrame(frame);\r\n if (!this.isCurrent(gen)) return undefined;\r\n // A capture is kept, not glanced at, so it waits for the upgrades a preview paints behind.\r\n if (await this.settle(() => this.renderAt(frame), gen, true) === \"superseded\") return undefined;\r\n return this.renderContext.screenshot();\r\n } finally {\r\n this.paintLanded(gen);\r\n }\r\n }\r\n\r\n /** {@link renderSettled} against this controller's generation, warning when a frame never settles. */\r\n private async settle(render: () => void, gen: number, upgrades = false): Promise<SettleOutcome> {\r\n const adapter = upgrades ? settlingUpgrades(this.storageAdapter) : this.storageAdapter;\r\n const outcome = await renderSettled(render, adapter, () => this.isCurrent(gen));\r\n if (outcome === \"exhausted\") {\r\n console.warn(`[PlaybackController] frame ${this.stateEvaluator.currentFrame} still had decodes pending after ${SETTLE_PASSES} passes`);\r\n }\r\n return outcome;\r\n }\r\n\r\n /**\r\n * The generation of the seek, swap or screenshot still on its way to its\r\n * paint, or `0`. A repaint behind decodes leaves that paint to it — see\r\n * {@link settleTrailing}.\r\n */\r\n private paintInFlight = 0;\r\n\r\n /** Bumped by every render, so a repaint owed to a landed upgrade can tell whether one has happened since. */\r\n private renders = 0;\r\n\r\n /** {@link renders} when an upgrade landed with a paint in flight, or `null`. */\r\n private repaintOwedSince: number | null = null;\r\n\r\n /** Release `gen`'s claim — unless a newer paint has claimed since — and repaint behind what it drew. */\r\n private paintLanded(gen: number): void {\r\n if (this.paintInFlight !== gen || this.disposed) return;\r\n this.paintInFlight = 0;\r\n if (this.repaintOwedSince !== null) {\r\n const stale = this.renders === this.repaintOwedSince;\r\n this.repaintOwedSince = null;\r\n if (stale && !this.isPlaying) this.renderAt(this.stateEvaluator.currentFrame);\r\n }\r\n this.settleTrailing();\r\n }\r\n\r\n /**\r\n * The current track's node tree, with each node's frame range on the project\r\n * timeline and its waveforms attached. Used by the timeline UI. `null` before\r\n * any track is built.\r\n */\r\n getTreeState(): TreeState | null {\r\n const instance = this.stateEvaluator.currentInstance;\r\n if (!instance) return null;\r\n const track = this.precomp.tracks.find(t => t.id === this.stateEvaluator.currentTrackId);\r\n const trackStart = track?.startFrame ?? 0;\r\n const frameCount = track?.frameCount ?? trackFrameCount(instance.duration, this.fps);\r\n\r\n const bars = new Map<string, { startFrame: number; endFrame: number }>();\r\n const pathOfOwner = new Map<string, string>();\r\n instance.forEachOwner((_node, ownerKey, span, path) => {\r\n pathOfOwner.set(ownerKey, path);\r\n const frames = spanFrames(span, this.fps, frameCount);\r\n if (frames) {\r\n bars.set(path, { startFrame: trackStart + frames.startFrame, endFrame: trackStart + frames.endFrame });\r\n }\r\n });\r\n const waveformsByPath = waveformsByOwner(track?.audioRequests ?? [], pathOfOwner);\r\n return nodeToTreeState(instance.canvas, \"\", bars, waveformsByPath);\r\n }\r\n\r\n getNodeState(nodeId: string): NodeState | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n const node = findNode(canvas, nodeId);\r\n if (!node) return null;\r\n return { id: node.id, type: node.className, properties: node.properties };\r\n }\r\n\r\n /**\r\n * What a document node of the current track holds before any command has\r\n * acted on it, whatever frame is showing and whether or not it is on screen:\r\n * the props an editor shows for the node itself, where {@link getNodeState}\r\n * is the node at this frame. `null` when the track holds no such row.\r\n */\r\n getNodeInitialProps(nodeId: string): NodeState[\"properties\"] | null {\r\n return this.stateEvaluator.currentInstance?.baselineProps(nodeId) ?? null;\r\n }\r\n\r\n // ---- Direct manipulation ----------------------------------------------\r\n // Where a node's pixels are, what is under a point, and a write path fast\r\n // enough for a drag. See `runtime/node-picking.ts` for the geometry.\r\n\r\n /**\r\n * The on-screen box of one node at the current frame, or `null` when the path\r\n * does not resolve. See {@link NodeBox}.\r\n *\r\n * @param path Structural path from {@link TreeState.path}.\r\n */\r\n getNodeBox(path: string): NodeBox | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n // Through `nodeBoxAt`, so a path naming a mesh inside a `Canvas3D`\r\n // resolves too — see `node-picking3d.ts`.\r\n return nodeBoxAt(canvas, path);\r\n }\r\n\r\n /**\r\n * The node's **own** props at a structural path — what it holds right now,\r\n * in its own coordinate space, the space {@link setNodeOverride} writes into —\r\n * or `null` when the path doesn't resolve.\r\n */\r\n getNodePropsAt(path: string): NodeState[\"properties\"] | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n const node = nodeAt(canvas, path);\r\n return node ? node.properties : null;\r\n }\r\n\r\n /** Every visible node's box in draw order — one tree walk instead of N {@link getNodeBox} calls. */\r\n getNodeBoxes(): NodeBox[] {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return [];\r\n const out: NodeBox[] = [];\r\n collectBoxes(canvas, \"\", out, true);\r\n return out;\r\n }\r\n\r\n /**\r\n * Project points around the `Node3D` at `path`, or `null` when the path\r\n * doesn't resolve to one. See {@link Node3DFrame}.\r\n */\r\n projectNode3D(\r\n path: string,\r\n parentPoints: readonly Vector3[],\r\n localPoints: readonly Vector3[],\r\n ): Node3DFrame | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n return projectNode3DAt(canvas, path, parentPoints, localPoints);\r\n }\r\n\r\n /**\r\n * Where a viewport point lands on the plane the node at `path` is positioned\r\n * in, in that plane's own y-up frame — see {@link parentPlanePointAt}.\r\n */\r\n parentPlanePoint(path: string, point: Vector2): Vector2 | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n return parentPlanePointAt(canvas, path, point);\r\n }\r\n\r\n /**\r\n * Where a viewport point lands in the coordinates the node at `path`\r\n * positions its children in, or `null` when those are pixels — see\r\n * {@link childPlanePointAt}.\r\n */\r\n childPlanePoint(path: string, point: Vector2): Vector2 | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n return childPlanePointAt(canvas, path, point);\r\n }\r\n\r\n /**\r\n * What keeps the node at `path` looking as it does once it moves under the\r\n * node at `parentPath` — see {@link reparentPlacementAt}.\r\n */\r\n reparentPlacement(path: string, parentPath: string, offsets: readonly Vector2[]): ReparentPlacement | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n return reparentPlacementAt(canvas, path, parentPath, offsets);\r\n }\r\n\r\n /** The points an editor may drag on the node at `path`, in viewport space — see {@link nodeHandlesAt}. */\r\n nodeHandles(path: string): NodeHandle[] | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n return nodeHandlesAt(canvas, path);\r\n }\r\n\r\n /** The value of `prop` that puts its handle under a viewport point — see {@link handleValueAt}. */\r\n handleValue(path: string, prop: string, point: Vector2): Vector2 | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n return handleValueAt(canvas, path, prop, point);\r\n }\r\n\r\n /**\r\n * Where a Text node's caret slots landed on screen, or `null` when the path\r\n * doesn't resolve, the node isn't text, or the measurer has no caret model.\r\n * See {@link NodeTextLayout}.\r\n */\r\n getTextLayout(path: string): NodeTextLayout | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n const node = findNodeByPath(canvas, path);\r\n return node instanceof Node2D\r\n ? this.textLayoutOf(node, path)\r\n : null;\r\n }\r\n\r\n /** `node`'s caret slots in viewport space, or `null` when this controller's measurer keeps no glyph positions. */\r\n private textLayoutOf(node: Node2D, path: string): NodeTextLayout | null {\r\n const source = asTextBlockSource(this.measurer);\r\n return source ? nodeTextLayout(node, path, source) : null;\r\n }\r\n\r\n /**\r\n * The topmost node under a viewport-space point (origin at the viewport\r\n * centre, y-up), or `null`. `tolerance` is grab-slop in **scene units** —\r\n * the host's pixel slop divided by its preview zoom. See {@link pickNode}.\r\n */\r\n pickNode(point: Vector2, tolerance = 0): NodeBox | null {\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return null;\r\n return pickNode(canvas, point, tolerance);\r\n }\r\n\r\n /**\r\n * Layer transient prop values over a node, on top of whatever the document\r\n * evaluates to, re-applied after every evaluation until cleared — for an\r\n * editor dragging a node at pointer rate without rebuilding anything. Not\r\n * persistence: the host commits the value to its document on drop and\r\n * clears the override.\r\n *\r\n * @param path Structural path from {@link TreeState.path}.\r\n * @param props Props the node accepts. Merged over any existing override.\r\n */\r\n setNodeOverride(path: string, props: NodeOverride): void {\r\n const existing = this.overrides.get(path);\r\n this.overrides.set(path, existing ? { ...existing, ...props } : { ...props });\r\n this.applyOverrides();\r\n }\r\n\r\n /**\r\n * Drop one node's overrides, or all of them when `path` is omitted, and\r\n * repaint so the node snaps back to what the document says.\r\n *\r\n * Rebuilds the current track's tree to do it: an override was written\r\n * straight onto a live prop, and the timeline only restores what its own\r\n * commands write. Cheap enough for a pointer-up, which is the only place it\r\n * belongs.\r\n *\r\n * @param path Structural path, as {@link setNodeOverride} takes — not an id,\r\n * since a node a composite built for itself has no authored one to name.\r\n */\r\n clearNodeOverrides(path?: string): void {\r\n const cleared = path === undefined\r\n ? (this.overrides.size > 0 && (this.overrides.clear(), true))\r\n : this.overrides.delete(path);\r\n if (!cleared) return;\r\n this.stateEvaluator.rebuild();\r\n // Through `repaint` for both of its guards — see there.\r\n this.repaint();\r\n }\r\n\r\n /** Hidden/locked state for one track's nodes. Not authored, so it rides beside the document. */\r\n setEditorStates(trackId: string, states: NodeEditorStates | undefined): void {\r\n this.stateEvaluator.setEditorStates(trackId, states);\r\n this.repaint();\r\n }\r\n\r\n /**\r\n * Re-lay-out and repaint the current frame. Cheap enough for a pointer-rate\r\n * drag loop: `stateAt` early-returns for the frame already current.\r\n *\r\n * Does nothing **before the first frame has been drawn** — its assets have\r\n * not been loaded, and the last complete frame is a blank surface, which is\r\n * what should stay up — **nor between a swap and its paint**, which owes a\r\n * paint of its own. See {@link pendingSwap}.\r\n */\r\n repaint(): void {\r\n if (!this.hasPainted) return;\r\n if (this.pendingSwap !== 0 && this.isCurrent(this.pendingSwap)) return;\r\n this.renderAt(this.stateEvaluator.currentFrame);\r\n this.settleTrailing();\r\n }\r\n\r\n /**\r\n * Repaint a paused frame as the decodes its draw asked for land — one it could\r\n * not draw at all, and an upgrade of one it drew below demand, which no paint\r\n * waits for. Never while playing: the next tick picks them up. A seek, swap or\r\n * screenshot still on its way paints for itself, and once more when it lands\r\n * if an upgrade arrived after its render.\r\n */\r\n private settleTrailing(): void {\r\n if (this.trailingSettle || this.disposed || this.isPlaying || !this.hasBackgroundDecodes()) return;\r\n void this.repaintBehindDecodes().catch((error) => {\r\n console.error(\"[PlaybackController] background decode failed:\", error);\r\n });\r\n }\r\n\r\n private trailingSettle = false;\r\n\r\n private hasBackgroundDecodes(): boolean {\r\n return this.storageAdapter.hasPendingDecodes() || this.storageAdapter.hasPendingUpgrades();\r\n }\r\n\r\n private async repaintBehindDecodes(): Promise<void> {\r\n // Released in `finally` on the same turn as the return, so a paint landing\r\n // right after this gives up can start the next one.\r\n this.trailingSettle = true;\r\n try {\r\n for (let pass = 0; pass < SETTLE_PASSES && this.hasBackgroundDecodes(); pass++) {\r\n const [decoded, upgraded] = await Promise.all([\r\n this.storageAdapter.warmPendingDecodes(),\r\n this.storageAdapter.warmPendingUpgrades(),\r\n ]);\r\n if (!(decoded || upgraded) || this.disposed || this.isPlaying) return;\r\n if (this.paintInFlight !== 0) {\r\n this.repaintOwedSince = this.renders;\r\n return;\r\n }\r\n this.renderAt(this.stateEvaluator.currentFrame);\r\n }\r\n } finally {\r\n this.trailingSettle = false;\r\n }\r\n }\r\n\r\n /** Write every held override onto its node. No-op when none are set. */\r\n private applyOverrides(): void {\r\n if (this.overrides.size === 0) return;\r\n const canvas = this.stateEvaluator.currentCanvas;\r\n if (!canvas) return;\r\n for (const [path, props] of this.overrides) {\r\n findNodeByPath(canvas, path)?.set(props as never);\r\n }\r\n }\r\n\r\n play(speed: number = 1, reverse: boolean = false): void {\r\n if (this.currentFrame >= this.totalFrames) {\r\n this.seek(0).then(() => this.masterClock.play(speed, reverse)).catch(() => { });\r\n return;\r\n }\r\n this.masterClock.play(speed, reverse);\r\n }\r\n\r\n pause(): void {\r\n this.masterClock.pause();\r\n }\r\n\r\n setMuted(muted: boolean): void {\r\n this.audioDevice.setMuted(muted);\r\n }\r\n\r\n dispose(): void {\r\n this.disposed = true;\r\n this.masterClock.dispose();\r\n this.audioDevice.dispose();\r\n this.stateEvaluator.dispose();\r\n this.store.dispose();\r\n this.assetManager.dispose();\r\n }\r\n}\r\n\r\n/** How far from the playhead a built tree is kept, in seconds. */\r\nconst TRIM_HORIZON_SECONDS = 30;\r\n\r\n/** `adapter`, settling upgrades alongside what a frame needs — for a paint that is kept rather than shown. */\r\nfunction settlingUpgrades(adapter: StorageAdapter): Pick<StorageAdapter, \"warmPendingDecodes\"> {\r\n return {\r\n async warmPendingDecodes() {\r\n const [decoded, upgraded] = await Promise.all([adapter.warmPendingDecodes(), adapter.warmPendingUpgrades()]);\r\n return decoded || upgraded;\r\n },\r\n };\r\n}\r\n\r\n/** What a missing-asset error says was needed, as a declaration. */\r\nfunction declOf(error: AssetNotLoadedError, catalog: AssetCatalog): AssetDecl | undefined {\r\n switch (error.assetType) {\r\n case \"image\":\r\n return { type: \"image\", src: error.src };\r\n case \"font\":\r\n return { type: \"font\", family: error.src, weight: 400 };\r\n case \"video\":\r\n try {\r\n return { type: \"video\", src: error.src, trimStart: 0, trimEnd: catalog.getVideoDuration(error.src) };\r\n } catch {\r\n return undefined;\r\n }\r\n default:\r\n return undefined;\r\n }\r\n}\r\n\r\n// Every Node2D is a container (children may be empty); kept for callers that\r\n// want an explicit \"has children\" check.\r\nexport function isParentNode(node: Node2D): boolean {\r\n return node.children.length > 0;\r\n}\r\n\r\n/**\r\n * `node` and its subtree as {@link TreeState}, indexed over the authored child\r\n * list — the same one every other structural-path walk reads, so selection,\r\n * bars and `getNodeBox` share one set of paths.\r\n */\r\nfunction nodeToTreeState(\r\n node: Node,\r\n path: string,\r\n bars: ReadonlyMap<string, { startFrame: number; endFrame: number }>,\r\n waveformsByPath: ReadonlyMap<string, WaveformInfo[]>,\r\n): TreeState {\r\n const state: TreeState = {\r\n id: node.id,\r\n path,\r\n type: node.className,\r\n children: node._allChildren.map((c, i) => nodeToTreeState(c, nodePath(path, i), bars, waveformsByPath)),\r\n };\r\n const waveform = waveformsByPath.get(path);\r\n if (waveform && waveform.length > 0) state.waveform = waveform;\r\n const bar = bars.get(path);\r\n if (bar) {\r\n state.startFrame = bar.startFrame;\r\n state.endFrame = bar.endFrame;\r\n }\r\n return state;\r\n}\r\n\r\n/**\r\n * Group a track's audio requests into per-node waveform entries, keyed by the\r\n * structural path their owner has in the tree right now. A request whose owner\r\n * is not in the tree has no bar to land on.\r\n */\r\nfunction waveformsByOwner(\r\n requests: readonly AudioRequest[],\r\n pathOfOwner: ReadonlyMap<string, string>,\r\n): Map<string, WaveformInfo[]> {\r\n const byPath = new Map<string, WaveformInfo[]>();\r\n for (const req of requests) {\r\n const path = req.ownerId !== undefined ? pathOfOwner.get(req.ownerId) : \"\";\r\n if (path === undefined) continue;\r\n const info: WaveformInfo = {\r\n src: req.src,\r\n startTime: req.startAt,\r\n endTime: Number.isFinite(req.endAt) ? req.endAt : null,\r\n };\r\n const list = byPath.get(path);\r\n if (list) list.push(info);\r\n else byPath.set(path, [info]);\r\n }\r\n return byPath;\r\n}\r\n\r\n/** The node at a structural path (`\"\"` = root, `\"0.2\"` = third child of the first), walking the authored list. */\r\nfunction findNodeByPath(root: Node2D, path: string): Node | null {\r\n if (path === \"\") return root;\r\n let node: Node = root;\r\n for (const seg of path.split(\".\")) {\r\n const next = node._allChildren[Number(seg)];\r\n if (!next) return null;\r\n node = next;\r\n }\r\n return node;\r\n}\r\n\r\nfunction findNode(root: Node, id: string): Node | null {\r\n if (root.id === id) return root;\r\n\r\n for (const child of root._allChildren) {\r\n const found = findNode(child, id);\r\n if (found) return found;\r\n }\r\n\r\n return null;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"playback.js","sourceRoot":"","sources":["../../src/runtime/playback.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,QAAQ;IAEY;IAD7B,4DAA4D;IAC5D,YAA6B,UAA8B;QAA9B,eAAU,GAAV,UAAU,CAAoB;IAAI,CAAC;IAEhE,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;IACrC,CAAC;IAED,+BAA+B;IAC/B,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,OAAO,GAAG,KAAK;QAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,KAAa;QACnB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,QAAQ,CAAC,KAAc;QACnB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,+CAA+C;IAC/C,MAAM,CAAC,QAAsB;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,QAAoB;QACvB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,QAAoB;QACxB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACJ","sourcesContent":["import { TimeCallback } from \"@/platform/ticker\";\nimport { PlaybackController } from \"./playback-controller\";\n\n/**\n * Realtime transport over a `Session`.\n *\n * Reached as `session.playback`, and **`null` when the environment has no\n * clock** — a headless export has no wall clock to sync to. That is deliberately\n * an absence rather than a no-op: a UI wants to ask whether a transport exists\n * (and hide its scrub bar if not) rather than call `play()` into a void.\n *\n * Thin on purpose. Everything here is `PlaybackController`'s; this exists so\n * that \"what a session is\" and \"what is currently playing it\" are separable, and\n * so the transport half can simply not exist where it makes no sense.\n */\nexport class Playback {\n /** @internal — constructed by `Session`, never directly. */\n constructor(private readonly controller: PlaybackController) { }\n\n get isPlaying(): boolean {\n return this.controller.isPlaying;\n }\n\n /** The playhead, in frames. */\n get frame(): number {\n return this.controller.currentFrame;\n }\n\n play(speed = 1, reverse = false): void {\n this.controller.play(speed, reverse);\n }\n\n pause(): void {\n this.controller.pause();\n }\n\n /**\n * Move the playhead while playing, without the await a paused scrub needs.\n * Use `Session.seekFrame` when paused — it resolves once the frame is drawn.\n */\n seekFrame(frame: number): void {\n this.controller.seekWhilePlaying(frame);\n }\n\n setMuted(muted: boolean): void {\n this.controller.setMuted(muted);\n }\n\n /** Fires as the playhead moves, in seconds. */\n onTime(callback: TimeCallback): void {\n this.controller.onTime(callback);\n }\n\n onPlay(callback: () => void): void {\n this.controller.onPlay(callback);\n }\n\n onPause(callback: () => void): void {\n this.controller.onPause(callback);\n }\n}\n"]}
1
+ {"version":3,"file":"playback.js","sourceRoot":"","sources":["../../src/runtime/playback.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,QAAQ;IAEY;IAD7B,4DAA4D;IAC5D,YAA6B,UAA8B;QAA9B,eAAU,GAAV,UAAU,CAAoB;IAAI,CAAC;IAEhE,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;IACrC,CAAC;IAED,+BAA+B;IAC/B,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,OAAO,GAAG,KAAK;QAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,KAAa;QACnB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,QAAQ,CAAC,KAAc;QACnB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,+CAA+C;IAC/C,MAAM,CAAC,QAAsB;QACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,QAAoB;QACvB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,QAAoB;QACxB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACJ","sourcesContent":["import { TimeCallback } from \"@/platform/ticker\";\r\nimport { PlaybackController } from \"./playback-controller\";\r\n\r\n/**\r\n * Realtime transport over a `Session`.\r\n *\r\n * Reached as `session.playback`, and **`null` when the environment has no\r\n * clock** — a headless export has no wall clock to sync to. That is deliberately\r\n * an absence rather than a no-op: a UI wants to ask whether a transport exists\r\n * (and hide its scrub bar if not) rather than call `play()` into a void.\r\n *\r\n * Thin on purpose. Everything here is `PlaybackController`'s; this exists so\r\n * that \"what a session is\" and \"what is currently playing it\" are separable, and\r\n * so the transport half can simply not exist where it makes no sense.\r\n */\r\nexport class Playback {\r\n /** @internal — constructed by `Session`, never directly. */\r\n constructor(private readonly controller: PlaybackController) { }\r\n\r\n get isPlaying(): boolean {\r\n return this.controller.isPlaying;\r\n }\r\n\r\n /** The playhead, in frames. */\r\n get frame(): number {\r\n return this.controller.currentFrame;\r\n }\r\n\r\n play(speed = 1, reverse = false): void {\r\n this.controller.play(speed, reverse);\r\n }\r\n\r\n pause(): void {\r\n this.controller.pause();\r\n }\r\n\r\n /**\r\n * Move the playhead while playing, without the await a paused scrub needs.\r\n * Use `Session.seekFrame` when paused — it resolves once the frame is drawn.\r\n */\r\n seekFrame(frame: number): void {\r\n this.controller.seekWhilePlaying(frame);\r\n }\r\n\r\n setMuted(muted: boolean): void {\r\n this.controller.setMuted(muted);\r\n }\r\n\r\n /** Fires as the playhead moves, in seconds. */\r\n onTime(callback: TimeCallback): void {\r\n this.controller.onTime(callback);\r\n }\r\n\r\n onPlay(callback: () => void): void {\r\n this.controller.onPlay(callback);\r\n }\r\n\r\n onPause(callback: () => void): void {\r\n this.controller.onPause(callback);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"precompisition.js","sourceRoot":"","sources":["../../src/runtime/precompisition.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,0BAA0B,GAS7B,MAAM,kBAAkB,CAAC;AAE1B,mFAAmF;AAEnF,oDAAoD;AACpD,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC;AAWrC,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,0BAA0B,CAAC","sourcesContent":["import {\n AssetTimeline,\n createAssetTimelineProfile,\n type AssetTimelineOptions,\n type AssetTimelinePhase,\n type AssetTimelineProfile,\n type AssetTimelineResult,\n type AssetTimelineTimings,\n type TrackAssets,\n type TrackAssetsProfile,\n type TrackAssetsTiming,\n} from \"./asset-timeline\";\n\n// The names this module had before it became `asset-timeline`, kept for one alpha.\n\n/** @deprecated Renamed to {@link AssetTimeline}. */\nexport const Precomp = AssetTimeline;\n/** @deprecated Renamed to {@link AssetTimeline}. */\nexport type Precomp = AssetTimeline;\n/** @deprecated Renamed to {@link AssetTimelineResult}. */\nexport type PrecompResult = AssetTimelineResult;\n/** @deprecated Renamed to {@link TrackAssets}. */\nexport type TrackPrecomp = TrackAssets;\n/** @deprecated Renamed to {@link AssetTimelineOptions}. */\nexport type PrecompOptions = AssetTimelineOptions;\n/** @deprecated Renamed to {@link AssetTimelineProfile}. */\nexport type PrecompProfile = AssetTimelineProfile;\n/** @deprecated Renamed to {@link createAssetTimelineProfile}. */\nexport const createPrecompProfile = createAssetTimelineProfile;\n/** @deprecated Renamed to {@link AssetTimelinePhase}. */\nexport type PrecompPhase = AssetTimelinePhase;\n/** @deprecated Renamed to {@link AssetTimelineTimings}. */\nexport type PrecompTimings = AssetTimelineTimings;\n/** @deprecated Renamed to {@link TrackAssetsTiming}. */\nexport type TrackPrecompTiming = TrackAssetsTiming;\n/** @deprecated Renamed to {@link TrackAssetsProfile}. */\nexport type TrackPrecompProfile = TrackAssetsProfile;\n"]}
1
+ {"version":3,"file":"precompisition.js","sourceRoot":"","sources":["../../src/runtime/precompisition.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,0BAA0B,GAS7B,MAAM,kBAAkB,CAAC;AAE1B,mFAAmF;AAEnF,oDAAoD;AACpD,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC;AAWrC,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,0BAA0B,CAAC","sourcesContent":["import {\r\n AssetTimeline,\r\n createAssetTimelineProfile,\r\n type AssetTimelineOptions,\r\n type AssetTimelinePhase,\r\n type AssetTimelineProfile,\r\n type AssetTimelineResult,\r\n type AssetTimelineTimings,\r\n type TrackAssets,\r\n type TrackAssetsProfile,\r\n type TrackAssetsTiming,\r\n} from \"./asset-timeline\";\r\n\r\n// The names this module had before it became `asset-timeline`, kept for one alpha.\r\n\r\n/** @deprecated Renamed to {@link AssetTimeline}. */\r\nexport const Precomp = AssetTimeline;\r\n/** @deprecated Renamed to {@link AssetTimeline}. */\r\nexport type Precomp = AssetTimeline;\r\n/** @deprecated Renamed to {@link AssetTimelineResult}. */\r\nexport type PrecompResult = AssetTimelineResult;\r\n/** @deprecated Renamed to {@link TrackAssets}. */\r\nexport type TrackPrecomp = TrackAssets;\r\n/** @deprecated Renamed to {@link AssetTimelineOptions}. */\r\nexport type PrecompOptions = AssetTimelineOptions;\r\n/** @deprecated Renamed to {@link AssetTimelineProfile}. */\r\nexport type PrecompProfile = AssetTimelineProfile;\r\n/** @deprecated Renamed to {@link createAssetTimelineProfile}. */\r\nexport const createPrecompProfile = createAssetTimelineProfile;\r\n/** @deprecated Renamed to {@link AssetTimelinePhase}. */\r\nexport type PrecompPhase = AssetTimelinePhase;\r\n/** @deprecated Renamed to {@link AssetTimelineTimings}. */\r\nexport type PrecompTimings = AssetTimelineTimings;\r\n/** @deprecated Renamed to {@link TrackAssetsTiming}. */\r\nexport type TrackPrecompTiming = TrackAssetsTiming;\r\n/** @deprecated Renamed to {@link TrackAssetsProfile}. */\r\nexport type TrackPrecompProfile = TrackAssetsProfile;\r\n"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AAO,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AACpG,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAc,EAAE,CAAc;IACrD,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IACrH,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACb,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,MAAM,CAAC,GAAG,CAAa,CAAC;YACxB,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC;QAClE,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACV,MAAM,CAAC,GAAG,CAAa,CAAC;YACxB,OAAO,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,CAAC;QAC1E,CAAC;QACD,KAAK,QAAQ;YACT,OAAO,CAAC,CAAC,IAAI,KAAM,CAAc,CAAC,IAAI,CAAC;QAC3C;YACI,OAAO,IAAI,CAAC;IACpB,CAAC;AACL,CAAC","sourcesContent":["import type { AssetCatalog } from \"@/assets/catalog\";\nimport type { AssetRecord, ImageRecord, VideoRecord } from \"@/assets/record\";\n\n/**\n * A single asset's position on the project timeline together with the\n * load/evict windows the asset manager uses to keep memory bounded.\n */\nexport interface AssetTrack {\n record: AssetRecord;\n /** Frame at which loading should begin; larger decodes get more lead time. Always <= startFrame. */\n cacheAt: number;\n /** Frame after which it may be evicted, or null to keep it (fonts). Always >= endFrame when set. */\n discardAt: number | null;\n}\n\n/** What one track contributes: its clip-local records, and where the track starts. */\nexport interface TrackRecords {\n id: string;\n startFrame: number;\n records: ReadonlyMap<string, AssetRecord>;\n}\n\n/**\n * Every track's asset records merged onto the project timeline, kept up to date\n * key by key.\n *\n * An edit to one track touches the keys that track's records changed, so the\n * cost of republishing follows the edit rather than the project. The map handed\n * out is replaced, never mutated, so a result already published stays as it was.\n */\nexport class ProjectAssets {\n constructor(private readonly _fps: number, private readonly _catalog: AssetCatalog) { }\n\n /** The merged map for `tracks` — the same object as last time when nothing in it changed. */\n update(tracks: readonly TrackRecords[]): ReadonlyMap<string, AssetTrack> {\n const touched = new Set<string>();\n const live = new Set<string>();\n for (const track of tracks) {\n live.add(track.id);\n const prior = this._tracks.get(track.id);\n if (prior && prior.records === track.records && prior.startFrame === track.startFrame) continue;\n const moved = !prior || prior.startFrame !== track.startFrame;\n for (const [key, record] of track.records) {\n const before = prior?.records.get(key);\n if (moved || !before || !sameRecord(before, record)) touched.add(key);\n this._holders(key).add(track.id);\n }\n if (prior) {\n for (const key of prior.records.keys()) {\n if (track.records.has(key)) continue;\n touched.add(key);\n this._release(key, track.id);\n }\n }\n this._tracks.set(track.id, { id: track.id, startFrame: track.startFrame, records: track.records });\n }\n for (const [id, prior] of this._tracks) {\n if (live.has(id)) continue;\n this._tracks.delete(id);\n for (const key of prior.records.keys()) {\n touched.add(key);\n this._release(key, id);\n }\n }\n\n let next: Map<string, AssetTrack> | undefined;\n for (const key of touched) {\n const entry = this._entryOf(key);\n const current = this._map.get(key);\n if (entry === undefined) {\n if (current === undefined) continue;\n next ??= new Map(this._map);\n next.delete(key);\n } else if (current === undefined || !sameTrack(current, entry)) {\n next ??= new Map(this._map);\n next.set(key, entry);\n }\n }\n if (next) this._map = next;\n return this._map;\n }\n\n private readonly _tracks = new Map<string, TrackRecords>();\n private readonly _byKey = new Map<string, Set<string>>();\n private _map: ReadonlyMap<string, AssetTrack> = new Map();\n\n private _holders(key: string): Set<string> {\n let holders = this._byKey.get(key);\n if (!holders) this._byKey.set(key, (holders = new Set()));\n return holders;\n }\n\n private _release(key: string, trackId: string): void {\n const holders = this._byKey.get(key);\n if (!holders) return;\n holders.delete(trackId);\n if (holders.size === 0) this._byKey.delete(key);\n }\n\n private _entryOf(key: string): AssetTrack | undefined {\n const holders = this._byKey.get(key);\n if (!holders) return undefined;\n let merged: AssetRecord | undefined;\n for (const id of holders) {\n const track = this._tracks.get(id)!;\n const record = track.records.get(key);\n if (record) merged = mergeRecord(merged, shiftRecord(record, track.startFrame));\n }\n return merged && assetTrackOf(merged, this._fps, this._catalog);\n }\n}\n\n/** Shift an asset record's frame range onto the project timeline by `offset`. */\nfunction shiftRecord(record: AssetRecord, offset: number): AssetRecord {\n if (offset === 0) return record;\n return { ...record, startFrame: record.startFrame + offset, endFrame: record.endFrame + offset };\n}\n\n/** Union two records of one key, so an asset several tracks use resolves to one window over all of it. */\nfunction mergeRecord(existing: AssetRecord | undefined, record: AssetRecord): AssetRecord {\n if (!existing) return record;\n return {\n ...existing,\n startFrame: Math.min(existing.startFrame, record.startFrame),\n endFrame: Math.max(existing.endFrame, record.endFrame),\n } as AssetRecord;\n}\n\n/**\n * The source's intrinsic decode, off the catalog: what a full decode costs, which\n * is what lead time scales with. Nothing for a source the catalog cannot size.\n */\nfunction intrinsicMB(record: ImageRecord | VideoRecord, catalog: AssetCatalog): number {\n let size: { width: number; height: number };\n try {\n size = record.type === \"image\" ? catalog.getImageMeta(record.src) : catalog.getVideoMeta(record.src);\n } catch {\n return 0;\n }\n if (!(size.width > 0) && !(size.height > 0)) return 0;\n return decodedMB(size.width, size.height);\n}\n\n/** Frames of lead time per decoded megabyte, clamped — a 4K image gets ~64, a thumbnail the minimum. */\nconst LEADS_PER_MB = 2;\nconst MIN_LEAD = 2;\nconst MAX_LEAD = 120;\n/** Frames an asset outlives its last use, for backward-scrub headroom. */\nconst TAIL_FRAMES = 30;\n\nfunction decodedMB(width: number, height: number): number {\n return (width * height * 4) / (1024 * 1024);\n}\n\nfunction leadFrames(mb: number): number {\n return Math.min(MAX_LEAD, Math.max(MIN_LEAD, Math.round(mb * LEADS_PER_MB)));\n}\n\n/** Size-proportional lead time for images and video; fonts pinned from frame 0 and never evicted. */\nfunction assetTrackOf(entry: AssetRecord, fps: number, catalog: AssetCatalog): AssetTrack | undefined {\n switch (entry.type) {\n case \"image\": {\n const lead = leadFrames(intrinsicMB(entry, catalog));\n return { record: entry, cacheAt: Math.max(0, entry.startFrame - lead), discardAt: entry.endFrame + TAIL_FRAMES };\n }\n case \"video\": {\n // Heavier to decode than an image: double the lead, plus a second\n // so a short clip still gets real headroom.\n const lead = Math.min(MAX_LEAD, leadFrames(intrinsicMB(entry, catalog)) * 2 + Math.round(fps));\n return { record: entry, cacheAt: Math.max(0, entry.startFrame - lead), discardAt: entry.endFrame + TAIL_FRAMES };\n }\n case \"font\":\n return { record: entry, cacheAt: 0, discardAt: null };\n case \"loader\":\n // Cheap and needed for the whole span it is requested over.\n return { record: entry, cacheAt: Math.max(0, entry.startFrame - MAX_LEAD), discardAt: entry.endFrame + TAIL_FRAMES };\n default:\n return undefined;\n }\n}\n\nfunction sameTrack(a: AssetTrack, b: AssetTrack): boolean {\n return a.cacheAt === b.cacheAt && a.discardAt === b.discardAt && sameRecord(a.record, b.record);\n}\n\nexport function sameRecord(a: AssetRecord, b: AssetRecord): boolean {\n if (a === b) return true;\n if (a.type !== b.type || a.src !== b.src || a.startFrame !== b.startFrame || a.endFrame !== b.endFrame) return false;\n switch (a.type) {\n case \"video\": {\n const v = b as typeof a;\n return a.trimStart === v.trimStart && a.trimEnd === v.trimEnd;\n }\n case \"font\": {\n const v = b as typeof a;\n return a.fontWeight === v.fontWeight && a.fontFamily === v.fontFamily;\n }\n case \"loader\":\n return a.load === (b as typeof a).load;\n default:\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"project-assets.js","sourceR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SAAS,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AACpG,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAc,EAAE,CAAc;IACrD,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IACrH,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACb,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,MAAM,CAAC,GAAG,CAAa,CAAC;YACxB,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC;QAClE,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACV,MAAM,CAAC,GAAG,CAAa,CAAC;YACxB,OAAO,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,CAAC;QAC1E,CAAC;QACD,KAAK,QAAQ;YACT,OAAO,CAAC,CAAC,IAAI,KAAM,CAAc,CAAC,IAAI,CAAC;QAC3C;YACI,OAAO,IAAI,CAAC;IACpB,CAAC;AACL,CAAC","sourcesContent":["import type { AssetCatalog } from \"@/assets/catalog\";\r\nimport type { AssetRecord, ImageRecord, VideoRecord } from \"@/assets/record\";\r\n\r\n/**\r\n * A single asset's position on the project timeline together with the\r\n * load/evict windows the asset manager uses to keep memory bounded.\r\n */\r\nexport interface AssetTrack {\r\n record: AssetRecord;\r\n /** Frame at which loading should begin; larger decodes get more lead time. Always <= startFrame. */\r\n cacheAt: number;\r\n /** Frame after which it may be evicted, or null to keep it (fonts). Always >= endFrame when set. */\r\n discardAt: number | null;\r\n}\r\n\r\n/** What one track contributes: its clip-local records, and where the track starts. */\r\nexport interface TrackRecords {\r\n id: string;\r\n startFrame: number;\r\n records: ReadonlyMap<string, AssetRecord>;\r\n}\r\n\r\n/**\r\n * Every track's asset records merged onto the project timeline, kept up to date\r\n * key by key.\r\n *\r\n * An edit to one track touches the keys that track's records changed, so the\r\n * cost of republishing follows the edit rather than the project. The map handed\r\n * out is replaced, never mutated, so a result already published stays as it was.\r\n */\r\nexport class ProjectAssets {\r\n constructor(private readonly _fps: number, private readonly _catalog: AssetCatalog) { }\r\n\r\n /** The merged map for `tracks` — the same object as last time when nothing in it changed. */\r\n update(tracks: readonly TrackRecords[]): ReadonlyMap<string, AssetTrack> {\r\n const touched = new Set<string>();\r\n const live = new Set<string>();\r\n for (const track of tracks) {\r\n live.add(track.id);\r\n const prior = this._tracks.get(track.id);\r\n if (prior && prior.records === track.records && prior.startFrame === track.startFrame) continue;\r\n const moved = !prior || prior.startFrame !== track.startFrame;\r\n for (const [key, record] of track.records) {\r\n const before = prior?.records.get(key);\r\n if (moved || !before || !sameRecord(before, record)) touched.add(key);\r\n this._holders(key).add(track.id);\r\n }\r\n if (prior) {\r\n for (const key of prior.records.keys()) {\r\n if (track.records.has(key)) continue;\r\n touched.add(key);\r\n this._release(key, track.id);\r\n }\r\n }\r\n this._tracks.set(track.id, { id: track.id, startFrame: track.startFrame, records: track.records });\r\n }\r\n for (const [id, prior] of this._tracks) {\r\n if (live.has(id)) continue;\r\n this._tracks.delete(id);\r\n for (const key of prior.records.keys()) {\r\n touched.add(key);\r\n this._release(key, id);\r\n }\r\n }\r\n\r\n let next: Map<string, AssetTrack> | undefined;\r\n for (const key of touched) {\r\n const entry = this._entryOf(key);\r\n const current = this._map.get(key);\r\n if (entry === undefined) {\r\n if (current === undefined) continue;\r\n next ??= new Map(this._map);\r\n next.delete(key);\r\n } else if (current === undefined || !sameTrack(current, entry)) {\r\n next ??= new Map(this._map);\r\n next.set(key, entry);\r\n }\r\n }\r\n if (next) this._map = next;\r\n return this._map;\r\n }\r\n\r\n private readonly _tracks = new Map<string, TrackRecords>();\r\n private readonly _byKey = new Map<string, Set<string>>();\r\n private _map: ReadonlyMap<string, AssetTrack> = new Map();\r\n\r\n private _holders(key: string): Set<string> {\r\n let holders = this._byKey.get(key);\r\n if (!holders) this._byKey.set(key, (holders = new Set()));\r\n return holders;\r\n }\r\n\r\n private _release(key: string, trackId: string): void {\r\n const holders = this._byKey.get(key);\r\n if (!holders) return;\r\n holders.delete(trackId);\r\n if (holders.size === 0) this._byKey.delete(key);\r\n }\r\n\r\n private _entryOf(key: string): AssetTrack | undefined {\r\n const holders = this._byKey.get(key);\r\n if (!holders) return undefined;\r\n let merged: AssetRecord | undefined;\r\n for (const id of holders) {\r\n const track = this._tracks.get(id)!;\r\n const record = track.records.get(key);\r\n if (record) merged = mergeRecord(merged, shiftRecord(record, track.startFrame));\r\n }\r\n return merged && assetTrackOf(merged, this._fps, this._catalog);\r\n }\r\n}\r\n\r\n/** Shift an asset record's frame range onto the project timeline by `offset`. */\r\nfunction shiftRecord(record: AssetRecord, offset: number): AssetRecord {\r\n if (offset === 0) return record;\r\n return { ...record, startFrame: record.startFrame + offset, endFrame: record.endFrame + offset };\r\n}\r\n\r\n/** Union two records of one key, so an asset several tracks use resolves to one window over all of it. */\r\nfunction mergeRecord(existing: AssetRecord | undefined, record: AssetRecord): AssetRecord {\r\n if (!existing) return record;\r\n return {\r\n ...existing,\r\n startFrame: Math.min(existing.startFrame, record.startFrame),\r\n endFrame: Math.max(existing.endFrame, record.endFrame),\r\n } as AssetRecord;\r\n}\r\n\r\n/**\r\n * The source's intrinsic decode, off the catalog: what a full decode costs, which\r\n * is what lead time scales with. Nothing for a source the catalog cannot size.\r\n */\r\nfunction intrinsicMB(record: ImageRecord | VideoRecord, catalog: AssetCatalog): number {\r\n let size: { width: number; height: number };\r\n try {\r\n size = record.type === \"image\" ? catalog.getImageMeta(record.src) : catalog.getVideoMeta(record.src);\r\n } catch {\r\n return 0;\r\n }\r\n if (!(size.width > 0) && !(size.height > 0)) return 0;\r\n return decodedMB(size.width, size.height);\r\n}\r\n\r\n/** Frames of lead time per decoded megabyte, clamped — a 4K image gets ~64, a thumbnail the minimum. */\r\nconst LEADS_PER_MB = 2;\r\nconst MIN_LEAD = 2;\r\nconst MAX_LEAD = 120;\r\n/** Frames an asset outlives its last use, for backward-scrub headroom. */\r\nconst TAIL_FRAMES = 30;\r\n\r\nfunction decodedMB(width: number, height: number): number {\r\n return (width * height * 4) / (1024 * 1024);\r\n}\r\n\r\nfunction leadFrames(mb: number): number {\r\n return Math.min(MAX_LEAD, Math.max(MIN_LEAD, Math.round(mb * LEADS_PER_MB)));\r\n}\r\n\r\n/** Size-proportional lead time for images and video; fonts pinned from frame 0 and never evicted. */\r\nfunction assetTrackOf(entry: AssetRecord, fps: number, catalog: AssetCatalog): AssetTrack | undefined {\r\n switch (entry.type) {\r\n case \"image\": {\r\n const lead = leadFrames(intrinsicMB(entry, catalog));\r\n return { record: entry, cacheAt: Math.max(0, entry.startFrame - lead), discardAt: entry.endFrame + TAIL_FRAMES };\r\n }\r\n case \"video\": {\r\n // Heavier to decode than an image: double the lead, plus a second\r\n // so a short clip still gets real headroom.\r\n const lead = Math.min(MAX_LEAD, leadFrames(intrinsicMB(entry, catalog)) * 2 + Math.round(fps));\r\n return { record: entry, cacheAt: Math.max(0, entry.startFrame - lead), discardAt: entry.endFrame + TAIL_FRAMES };\r\n }\r\n case \"font\":\r\n return { record: entry, cacheAt: 0, discardAt: null };\r\n case \"loader\":\r\n // Cheap and needed for the whole span it is requested over.\r\n return { record: entry, cacheAt: Math.max(0, entry.startFrame - MAX_LEAD), discardAt: entry.endFrame + TAIL_FRAMES };\r\n default:\r\n return undefined;\r\n }\r\n}\r\n\r\nfunction sameTrack(a: AssetTrack, b: AssetTrack): boolean {\r\n return a.cacheAt === b.cacheAt && a.discardAt === b.discardAt && sameRecord(a.record, b.record);\r\n}\r\n\r\nexport function sameRecord(a: AssetRecord, b: AssetRecord): boolean {\r\n if (a === b) return true;\r\n if (a.type !== b.type || a.src !== b.src || a.startFrame !== b.startFrame || a.endFrame !== b.endFrame) return false;\r\n switch (a.type) {\r\n case \"video\": {\r\n const v = b as typeof a;\r\n return a.trimStart === v.trimStart && a.trimEnd === v.trimEnd;\r\n }\r\n case \"font\": {\r\n const v = b as typeof a;\r\n return a.fontWeight === v.fontWeight && a.fontFamily === v.fontFamily;\r\n }\r\n case \"loader\":\r\n return a.load === (b as typeof a).load;\r\n default:\r\n return true;\r\n }\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Size2D } from "../attributes/layout/size.js";
2
2
  import { type ProjectDocument } from "../document/project.js";
3
- import type { SceneDocument } from "../document/types.js";
3
+ import type { VisualDocument } from "../document/types.js";
4
4
  import { ExportStillRequest, ExportVideoRequest, ExportedStill } from "../platform/exporter.js";
5
5
  import { Engine, EngineRenderContext } from "./engine.js";
6
6
  import { Playback } from "./playback.js";
@@ -8,8 +8,8 @@ import { PlaybackController } from "./playback-controller.js";
8
8
  import { AssetTimelineResult } from "./asset-timeline.js";
9
9
  /** What to open: a project, or a lone still or composition as the one track of a project around it. */
10
10
  export interface SessionSource {
11
- document: ProjectDocument | SceneDocument;
12
- /** The output's size and rate. A lone scene document carries neither; these also win over a project's own. */
11
+ document: ProjectDocument | VisualDocument;
12
+ /** The output's size and rate. A lone clip document carries neither; these also win over a project's own. */
13
13
  viewport?: Size2D;
14
14
  fps?: number;
15
15
  }
@@ -71,16 +71,18 @@ export declare class Session {
71
71
  * The output's size and rate cannot change under a live surface; a document
72
72
  * that asks for different ones needs a session of its own.
73
73
  */
74
- replace(document: ProjectDocument | SceneDocument): void;
74
+ replace(document: ProjectDocument | VisualDocument): void;
75
75
  /** Encode one frame. */
76
76
  image(options?: Partial<Omit<ExportStillRequest, "project" | "registry">>): Promise<ExportedStill>;
77
- /** Encode the whole timeline. */
77
+ /** Encode the timeline, or the `frames` of it a request names. */
78
78
  export(options?: Omit<ExportVideoRequest, "project" | "registry">): Promise<Uint8Array | void>;
79
79
  dispose(): void;
80
80
  /** Called before anything that measures or paints, because another session may have written it since. */
81
81
  private applyGlobals;
82
+ /** The output settings this session was opened with, which win over any document it plays. */
83
+ private readonly _override;
82
84
  private _project;
83
- private _catalog;
85
+ private readonly _catalog;
84
86
  private readonly _storage;
85
87
  private readonly _renderContext;
86
88
  private readonly _controller;
@@ -93,7 +95,7 @@ export declare class Session {
93
95
  * nothing downstream has to — every host that renders a document goes through
94
96
  * this, so they cannot disagree about which size wins.
95
97
  */
96
- export declare function resolveProjectDocument(document: ProjectDocument | SceneDocument, override: {
98
+ export declare function resolveProjectDocument(document: ProjectDocument | VisualDocument, override: {
97
99
  viewport?: Size2D;
98
100
  fps?: number;
99
101
  }, fallback: {
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/runtime/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIlD,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAIvD,uGAAuG;AACvG,MAAM,WAAW,aAAa;IAC1B,QAAQ,EAAE,eAAe,GAAG,aAAa,CAAC;IAC1C,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,MA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aAAa,CAAC;IAWtG,kEAAkE;IAClE,MAAM,CAAC,OAAO,GAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,UAAU,CAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAUlG,OAAO,IAAI,IAAI;IAMf,yGAAyG;IACzG,OAAO,CAAC,YAAY;IAIpB,8FAA8F;IAC9F,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAChE,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsB;IACrD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAa;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAClC,QAAQ,EAAE,eAAe,GAAG,cAAc,EAC1C,QAAQ,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EAC7C,QAAQ,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC5C,eAAe,CASjB"}
@@ -3,6 +3,7 @@ import { setTheme } from "../attributes/shape/fill/color/parser.js";
3
3
  import { asProjectDocument } from "../document/project.js";
4
4
  import { assertValidProjectDocument } from "../document/validate.js";
5
5
  import { Playback } from "./playback.js";
6
+ import { clipTimeToFrame } from "./frame-time.js";
6
7
  import { PlaybackController } from "./playback-controller.js";
7
8
  import { SteppedClock } from "../platform/stepped-clock.js";
8
9
  /**
@@ -24,13 +25,18 @@ export class Session {
24
25
  /** @internal — created by `Engine.open`, never directly. */
25
26
  constructor(engine, options) {
26
27
  this.engine = engine;
28
+ this._override = { viewport: options.viewport, fps: options.fps };
27
29
  this._project = resolveProjectDocument(options.document, options, engine);
28
30
  this.viewport = this._project.viewport;
29
31
  this.fps = this._project.fps;
30
32
  this._catalog = new ManifestAssetCatalog(engine.manifest);
33
+ // One catalog for the session's life, reconciled in place: the controller,
34
+ // its clip store and every node's `assets` hold this object, so a new one
35
+ // would reach only the storage adapter.
31
36
  this._unsubscribe = engine._onManifestChange((manifest) => {
32
- this._catalog = new ManifestAssetCatalog(manifest);
37
+ this._catalog.reconcile(manifest);
33
38
  this._storage.setCatalog(this._catalog);
39
+ this._controller.reconcileCatalog();
34
40
  });
35
41
  const deps = { catalog: this._catalog, viewport: this.viewport, fps: this.fps };
36
42
  this._storage = engine.platform.createStorageAdapter(deps);
@@ -90,7 +96,7 @@ export class Session {
90
96
  }
91
97
  /** Move the playhead, in seconds. Resolves once the frame is drawn. */
92
98
  async seek(seconds) {
93
- await this.seekFrame(Math.round(seconds * this.fps));
99
+ await this.seekFrame(Math.round(clipTimeToFrame(seconds, this.fps)));
94
100
  }
95
101
  async seekFrame(frame) {
96
102
  this.applyGlobals();
@@ -107,7 +113,7 @@ export class Session {
107
113
  * that asks for different ones needs a session of its own.
108
114
  */
109
115
  replace(document) {
110
- const next = resolveProjectDocument(document, {}, this);
116
+ const next = resolveProjectDocument(document, this._override, this);
111
117
  if (next.fps !== this.fps || next.viewport.width !== this.viewport.width
112
118
  || next.viewport.height !== this.viewport.height) {
113
119
  throw new Error(`Cannot replace a ${this.viewport.width}×${this.viewport.height} @ ${this.fps}fps document with a ` +
@@ -128,7 +134,7 @@ export class Session {
128
134
  manifest: options.manifest ?? this.engine.manifest,
129
135
  });
130
136
  }
131
- /** Encode the whole timeline. */
137
+ /** Encode the timeline, or the `frames` of it a request names. */
132
138
  export(options = {}) {
133
139
  this.applyGlobals();
134
140
  return this.engine.exporter.exportVideo({
@@ -147,6 +153,8 @@ export class Session {
147
153
  applyGlobals() {
148
154
  setTheme(this._project.theme);
149
155
  }
156
+ /** The output settings this session was opened with, which win over any document it plays. */
157
+ _override;
150
158
  _project;
151
159
  _catalog;
152
160
  _storage;