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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (791) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -49
  4. package/README.md +91 -91
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.js.map +1 -1
  7. package/dist/assets/errors.js.map +1 -1
  8. package/dist/assets/index.js.map +1 -1
  9. package/dist/assets/manager.js.map +1 -1
  10. package/dist/assets/manifest.js.map +1 -1
  11. package/dist/assets/record.js.map +1 -1
  12. package/dist/assets/scope.js.map +1 -1
  13. package/dist/attributes/audio/effects/chain.js.map +1 -1
  14. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -1
  15. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -1
  16. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -1
  17. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -1
  18. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -1
  19. package/dist/attributes/audio/effects/index.js.map +1 -1
  20. package/dist/attributes/audio/effects/registry.js.map +1 -1
  21. package/dist/attributes/audio/effects/union.js.map +1 -1
  22. package/dist/attributes/audio/ramp.js.map +1 -1
  23. package/dist/attributes/audio/request.js.map +1 -1
  24. package/dist/attributes/audio/schedule.js.map +1 -1
  25. package/dist/attributes/audio/sound.js.map +1 -1
  26. package/dist/attributes/audio/transition.js.map +1 -1
  27. package/dist/attributes/index.js.map +1 -1
  28. package/dist/attributes/layout/alignment.js.map +1 -1
  29. package/dist/attributes/layout/index.js.map +1 -1
  30. package/dist/attributes/layout/insets.js.map +1 -1
  31. package/dist/attributes/layout/matrix2d.js.map +1 -1
  32. package/dist/attributes/layout/size.js.map +1 -1
  33. package/dist/attributes/layout/space3d.js.map +1 -1
  34. package/dist/attributes/layout/transform3d.js.map +1 -1
  35. package/dist/attributes/layout/vector2.js.map +1 -1
  36. package/dist/attributes/layout/world-transform.js.map +1 -1
  37. package/dist/attributes/mask/boolean.js.map +1 -1
  38. package/dist/attributes/mask/mask.js.map +1 -1
  39. package/dist/attributes/properties/decorator.js.map +1 -1
  40. package/dist/attributes/properties/inputs.js.map +1 -1
  41. package/dist/attributes/properties/typed.js.map +1 -1
  42. package/dist/attributes/render3d/orbit.js.map +1 -1
  43. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  44. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  45. package/dist/attributes/shape/corners/corners.js.map +1 -1
  46. package/dist/attributes/shape/corners/index.js.map +1 -1
  47. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  48. package/dist/attributes/shape/effects/chain.js.map +1 -1
  49. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  50. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  51. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  52. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  53. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  54. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  55. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  56. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  57. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  58. package/dist/attributes/shape/effects/implementations/curves.d.ts +2 -2
  59. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  60. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  61. package/dist/attributes/shape/effects/implementations/dither.d.ts +2 -2
  62. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  63. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  64. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  65. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  66. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  67. package/dist/attributes/shape/effects/implementations/glow.d.ts +4 -4
  68. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  69. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  70. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  71. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  72. package/dist/attributes/shape/effects/implementations/invert.d.ts +2 -2
  73. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  74. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  75. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  76. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  77. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  78. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  79. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  80. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  81. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  82. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  83. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  84. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  85. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  86. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  87. package/dist/attributes/shape/effects/implementations/shader.d.ts +2 -2
  88. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  96. package/dist/attributes/shape/effects/index.js.map +1 -1
  97. package/dist/attributes/shape/effects/registry.js.map +1 -1
  98. package/dist/attributes/shape/effects/spec.js.map +1 -1
  99. package/dist/attributes/shape/effects/union.js.map +1 -1
  100. package/dist/attributes/shape/fill/blend.js.map +1 -1
  101. package/dist/attributes/shape/fill/chain.js.map +1 -1
  102. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  103. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  104. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  105. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  106. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  107. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  108. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  109. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  110. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  111. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  112. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  113. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  114. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  115. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  116. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  117. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  118. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  119. package/dist/attributes/shape/fill/index.js.map +1 -1
  120. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  121. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  122. package/dist/attributes/shape/fill/registry.js.map +1 -1
  123. package/dist/attributes/shape/fill/union.js.map +1 -1
  124. package/dist/attributes/shape/filters/chain.js.map +1 -1
  125. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  126. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  127. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  128. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  129. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  130. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  131. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  132. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  133. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  134. package/dist/attributes/shape/filters/index.js.map +1 -1
  135. package/dist/attributes/shape/filters/registry.js.map +1 -1
  136. package/dist/attributes/shape/filters/union.js.map +1 -1
  137. package/dist/attributes/shape/path/anchors.js.map +1 -1
  138. package/dist/attributes/shape/path/bezier.js.map +1 -1
  139. package/dist/attributes/shape/path/index.js.map +1 -1
  140. package/dist/attributes/shape/path/measure.js.map +1 -1
  141. package/dist/attributes/shape/path/morph.js.map +1 -1
  142. package/dist/attributes/shape/path/ops.js.map +1 -1
  143. package/dist/attributes/shape/path/types.js.map +1 -1
  144. package/dist/attributes/shape/path/walk.js.map +1 -1
  145. package/dist/attributes/shape/shaders/index.js.map +1 -1
  146. package/dist/attributes/shape/shaders/language.js.map +1 -1
  147. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  148. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  149. package/dist/attributes/shape/shadow/index.js.map +1 -1
  150. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  151. package/dist/attributes/shape/stroke/index.js.map +1 -1
  152. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  153. package/dist/attributes/shared/operators.js.map +1 -1
  154. package/dist/attributes/text/index.js.map +1 -1
  155. package/dist/attributes/text/ops.js.map +1 -1
  156. package/dist/attributes/text/types.js.map +1 -1
  157. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  158. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  159. package/dist/browser/chunks/{chunk-GKM6UZJR.js → chunk-7DB6BI27.js} +2 -2
  160. package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
  161. package/dist/browser/chunks/{chunk-AOT33LMS.js → chunk-IX53IFBD.js} +2 -2
  162. package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
  163. package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
  164. package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
  165. package/dist/browser/component.js +1 -1
  166. package/dist/browser/experimental.js +1 -1
  167. package/dist/browser/experimental.js.map +1 -1
  168. package/dist/browser/index.js +1 -1
  169. package/dist/browser/index.js.map +1 -1
  170. package/dist/browser/sdk.js +1 -1
  171. package/dist/component.js.map +1 -1
  172. package/dist/components/builtins/audio/audio.js.map +1 -1
  173. package/dist/components/builtins/geometry/composite.js.map +1 -1
  174. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  175. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  176. package/dist/components/builtins/layout/layout.js.map +1 -1
  177. package/dist/components/builtins/media/media.js.map +1 -1
  178. package/dist/components/builtins/providers/providers.js.map +1 -1
  179. package/dist/components/builtins/text/number-format.js.map +1 -1
  180. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  181. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  182. package/dist/components/builtins/text/text-layout.js.map +1 -1
  183. package/dist/components/builtins/text/text.d.ts +9 -9
  184. package/dist/components/builtins/text/text.js.map +1 -1
  185. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  186. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  187. package/dist/components/builtins/three/three.js.map +1 -1
  188. package/dist/components/factory/api.js.map +1 -1
  189. package/dist/components/factory/clip-of.js.map +1 -1
  190. package/dist/components/factory/commands-for.js.map +1 -1
  191. package/dist/components/factory/component-audio.js.map +1 -1
  192. package/dist/components/factory/component2d.js.map +1 -1
  193. package/dist/components/factory/component3d.js.map +1 -1
  194. package/dist/components/factory/factory.js.map +1 -1
  195. package/dist/components/factory/timeline.js.map +1 -1
  196. package/dist/components/factory/type-def.js.map +1 -1
  197. package/dist/components/factory/types.js.map +1 -1
  198. package/dist/components/factory/views.js.map +1 -1
  199. package/dist/components/modules/aim.js.map +1 -1
  200. package/dist/components/modules/corners.js.map +1 -1
  201. package/dist/components/modules/flow.js.map +1 -1
  202. package/dist/components/modules/material.js.map +1 -1
  203. package/dist/components/modules/paint.js.map +1 -1
  204. package/dist/components/modules/shapes.js.map +1 -1
  205. package/dist/components/modules/text-layout.js.map +1 -1
  206. package/dist/components/modules/text-style.d.ts +1 -1
  207. package/dist/components/modules/text-style.js.map +1 -1
  208. package/dist/components/modules/three-entries.js.map +1 -1
  209. package/dist/components/modules/view3d.js.map +1 -1
  210. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  211. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  212. package/dist/components/trees/2d/node-motion.js.map +1 -1
  213. package/dist/components/trees/2d/node-render.js.map +1 -1
  214. package/dist/components/trees/2d/node-space.js.map +1 -1
  215. package/dist/components/trees/2d/node-transform.js.map +1 -1
  216. package/dist/components/trees/2d/node2d.js.map +1 -1
  217. package/dist/components/trees/audio/index.js.map +1 -1
  218. package/dist/components/trees/audio/node-audio.js.map +1 -1
  219. package/dist/components/trees/index.js.map +1 -1
  220. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  221. package/dist/components/trees/node/node-reactive.js.map +1 -1
  222. package/dist/components/trees/node/node-time.js.map +1 -1
  223. package/dist/components/trees/node/node-walk.js.map +1 -1
  224. package/dist/components/trees/node/node.js.map +1 -1
  225. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  226. package/dist/components/trees/three/node3d.js.map +1 -1
  227. package/dist/document/audio.js.map +1 -1
  228. package/dist/document/builtins.js.map +1 -1
  229. package/dist/document/command-traits.js.map +1 -1
  230. package/dist/document/deny-globals.js.map +1 -1
  231. package/dist/document/diff.js.map +1 -1
  232. package/dist/document/doc-index.js.map +1 -1
  233. package/dist/document/expression/compile.js.map +1 -1
  234. package/dist/document/expression/index.js.map +1 -1
  235. package/dist/document/expression/ops.js.map +1 -1
  236. package/dist/document/expression/parse.js.map +1 -1
  237. package/dist/document/expression/refs.js.map +1 -1
  238. package/dist/document/expression/types.js.map +1 -1
  239. package/dist/document/expression/walk.js.map +1 -1
  240. package/dist/document/index.js.map +1 -1
  241. package/dist/document/migrate.js.map +1 -1
  242. package/dist/document/missing-node.js.map +1 -1
  243. package/dist/document/node-decorator.js.map +1 -1
  244. package/dist/document/node-descriptor.js.map +1 -1
  245. package/dist/document/placement.js.map +1 -1
  246. package/dist/document/project.js.map +1 -1
  247. package/dist/document/prop-evolution.js.map +1 -1
  248. package/dist/document/registry.js.map +1 -1
  249. package/dist/document/settled-index.js.map +1 -1
  250. package/dist/document/timeline-patch.js.map +1 -1
  251. package/dist/document/timeline.js.map +1 -1
  252. package/dist/document/types.js.map +1 -1
  253. package/dist/document/validate.js.map +1 -1
  254. package/dist/document/vocabulary.js.map +1 -1
  255. package/dist/experimental.d.ts.map +1 -1
  256. package/dist/experimental.js.map +1 -1
  257. package/dist/index.js.map +1 -1
  258. package/dist/layout/bounds.js.map +1 -1
  259. package/dist/layout/constraints.js.map +1 -1
  260. package/dist/layout/flex.js.map +1 -1
  261. package/dist/layout/freeform.js.map +1 -1
  262. package/dist/layout/grid.js.map +1 -1
  263. package/dist/layout/index.js.map +1 -1
  264. package/dist/layout/item.js.map +1 -1
  265. package/dist/layout/ops.js.map +1 -1
  266. package/dist/layout/types.js.map +1 -1
  267. package/dist/platform/audio-sink.js.map +1 -1
  268. package/dist/platform/exporter.js.map +1 -1
  269. package/dist/platform/index.js.map +1 -1
  270. package/dist/platform/stepped-clock.js.map +1 -1
  271. package/dist/platform/storage-adapter.js.map +1 -1
  272. package/dist/platform/ticker.js.map +1 -1
  273. package/dist/project/config.js.map +1 -1
  274. package/dist/project/index.js.map +1 -1
  275. package/dist/project/tree.js.map +1 -1
  276. package/dist/props/host.js.map +1 -1
  277. package/dist/props/index.js.map +1 -1
  278. package/dist/props/observer.js.map +1 -1
  279. package/dist/props/slot.js.map +1 -1
  280. package/dist/renamed-scene-names.js.map +1 -1
  281. package/dist/render/canvas-render-context2d.js.map +1 -1
  282. package/dist/render/clip-contains.js.map +1 -1
  283. package/dist/render/clip.js.map +1 -1
  284. package/dist/render/descriptors/ellipse.js.map +1 -1
  285. package/dist/render/descriptors/line.js.map +1 -1
  286. package/dist/render/descriptors/path-builder.js.map +1 -1
  287. package/dist/render/descriptors/path.js.map +1 -1
  288. package/dist/render/descriptors/polygon.js.map +1 -1
  289. package/dist/render/descriptors/polygram.js.map +1 -1
  290. package/dist/render/descriptors/rect.js.map +1 -1
  291. package/dist/render/descriptors/richtext.js.map +1 -1
  292. package/dist/render/descriptors/shape.js.map +1 -1
  293. package/dist/render/descriptors/text.js.map +1 -1
  294. package/dist/render/descriptors/transform.js.map +1 -1
  295. package/dist/render/graphics2d.js.map +1 -1
  296. package/dist/render/index.js.map +1 -1
  297. package/dist/render/measure-context.js.map +1 -1
  298. package/dist/render/null-render-context.js.map +1 -1
  299. package/dist/render/render-context2d.js.map +1 -1
  300. package/dist/render/render-issue.js.map +1 -1
  301. package/dist/render/surface.js.map +1 -1
  302. package/dist/render/text-defaults.js.map +1 -1
  303. package/dist/render/text-layout.js.map +1 -1
  304. package/dist/render3d/bounds3d.js.map +1 -1
  305. package/dist/render3d/builders.js.map +1 -1
  306. package/dist/render3d/camera.js.map +1 -1
  307. package/dist/render3d/fill3d.js.map +1 -1
  308. package/dist/render3d/geometry.js.map +1 -1
  309. package/dist/render3d/graphics3d.js.map +1 -1
  310. package/dist/render3d/index.js.map +1 -1
  311. package/dist/render3d/inert.js.map +1 -1
  312. package/dist/render3d/light.js.map +1 -1
  313. package/dist/render3d/material.js.map +1 -1
  314. package/dist/render3d/matrix4.js.map +1 -1
  315. package/dist/render3d/render-context3d.js.map +1 -1
  316. package/dist/render3d/resources.js.map +1 -1
  317. package/dist/render3d/rounded-box.js.map +1 -1
  318. package/dist/render3d/scene-settings.js.map +1 -1
  319. package/dist/render3d/scene3d.js.map +1 -1
  320. package/dist/render3d/segments.js.map +1 -1
  321. package/dist/render3d/texture.js.map +1 -1
  322. package/dist/render3d/tracking.js.map +1 -1
  323. package/dist/render3d/transform.js.map +1 -1
  324. package/dist/render3d/vector3.js.map +1 -1
  325. package/dist/render3d/walk.js.map +1 -1
  326. package/dist/runtime/asset-refine.js.map +1 -1
  327. package/dist/runtime/asset-timeline.js.map +1 -1
  328. package/dist/runtime/asset-update.js.map +1 -1
  329. package/dist/runtime/audio-index.js.map +1 -1
  330. package/dist/runtime/builtin-context.js.map +1 -1
  331. package/dist/runtime/clip-instance.js.map +1 -1
  332. package/dist/runtime/clip-store.js.map +1 -1
  333. package/dist/runtime/engine.js.map +1 -1
  334. package/dist/runtime/frame-time.js.map +1 -1
  335. package/dist/runtime/index.js.map +1 -1
  336. package/dist/runtime/node-picking.js.map +1 -1
  337. package/dist/runtime/node-picking3d.js.map +1 -1
  338. package/dist/runtime/placement.js.map +1 -1
  339. package/dist/runtime/playback-controller.js.map +1 -1
  340. package/dist/runtime/playback.js.map +1 -1
  341. package/dist/runtime/precompisition.js.map +1 -1
  342. package/dist/runtime/project-assets.js.map +1 -1
  343. package/dist/runtime/session.js.map +1 -1
  344. package/dist/runtime/settle.js.map +1 -1
  345. package/dist/runtime/state-evaluator.js.map +1 -1
  346. package/dist/runtime/text-geometry.js.map +1 -1
  347. package/dist/sdk/index.js.map +1 -1
  348. package/dist/tween/command-decorator.js.map +1 -1
  349. package/dist/tween/command.js.map +1 -1
  350. package/dist/tween/ease/constants.js.map +1 -1
  351. package/dist/tween/ease/curve.js.map +1 -1
  352. package/dist/tween/ease/describe.js.map +1 -1
  353. package/dist/tween/ease/spec.js.map +1 -1
  354. package/dist/tween/ease/type.js.map +1 -1
  355. package/dist/tween/index.js.map +1 -1
  356. package/dist/tween/inert.js.map +1 -1
  357. package/dist/tween/lerp.js.map +1 -1
  358. package/dist/tween/loop.js.map +1 -1
  359. package/dist/tween/prepare.js.map +1 -1
  360. package/dist/tween/stepper.js.map +1 -1
  361. package/dist/tween/to-command.js.map +1 -1
  362. package/dist/util/clamp.js.map +1 -1
  363. package/dist/util/context.js.map +1 -1
  364. package/dist/util/csv.js.map +1 -1
  365. package/dist/util/generateList.js.map +1 -1
  366. package/dist/util/index.js.map +1 -1
  367. package/dist/util/metrics.js.map +1 -1
  368. package/dist/util/random.js.map +1 -1
  369. package/dist/util/reference.js.map +1 -1
  370. package/dist/util/scheduler.js.map +1 -1
  371. package/package.json +1 -1
  372. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  373. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  374. package/dist/attributes/audio/filters/chain.js +0 -104
  375. package/dist/attributes/audio/filters/chain.js.map +0 -1
  376. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  377. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  378. package/dist/attributes/audio/filters/curve.js +0 -250
  379. package/dist/attributes/audio/filters/curve.js.map +0 -1
  380. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  381. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  382. package/dist/attributes/audio/filters/implementations/echo.js +0 -11
  383. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  384. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  385. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  386. package/dist/attributes/audio/filters/implementations/gain.js +0 -6
  387. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  388. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  389. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  390. package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
  391. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  392. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  393. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  394. package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
  395. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  396. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  397. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  398. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  399. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  400. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  401. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  402. package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
  403. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  404. package/dist/attributes/audio/filters/index.d.ts +0 -22
  405. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  406. package/dist/attributes/audio/filters/index.js +0 -8
  407. package/dist/attributes/audio/filters/index.js.map +0 -1
  408. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  409. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  410. package/dist/attributes/audio/filters/registry.js +0 -82
  411. package/dist/attributes/audio/filters/registry.js.map +0 -1
  412. package/dist/attributes/audio/filters/union.d.ts +0 -18
  413. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  414. package/dist/attributes/audio/filters/union.js +0 -28
  415. package/dist/attributes/audio/filters/union.js.map +0 -1
  416. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  417. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  418. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  419. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  420. package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
  421. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
  422. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  423. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  424. package/dist/component/api.d.ts +0 -508
  425. package/dist/component/api.d.ts.map +0 -1
  426. package/dist/component/api.js +0 -4
  427. package/dist/component/api.js.map +0 -1
  428. package/dist/component/builtins/audio.d.ts +0 -26
  429. package/dist/component/builtins/audio.d.ts.map +0 -1
  430. package/dist/component/builtins/audio.js +0 -41
  431. package/dist/component/builtins/audio.js.map +0 -1
  432. package/dist/component/builtins/canvas3d.d.ts +0 -98
  433. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  434. package/dist/component/builtins/canvas3d.js +0 -21
  435. package/dist/component/builtins/canvas3d.js.map +0 -1
  436. package/dist/component/builtins/composite.d.ts +0 -56
  437. package/dist/component/builtins/composite.d.ts.map +0 -1
  438. package/dist/component/builtins/composite.js +0 -25
  439. package/dist/component/builtins/composite.js.map +0 -1
  440. package/dist/component/builtins/geometry.d.ts +0 -505
  441. package/dist/component/builtins/geometry.d.ts.map +0 -1
  442. package/dist/component/builtins/geometry.js +0 -107
  443. package/dist/component/builtins/geometry.js.map +0 -1
  444. package/dist/component/builtins/layout.d.ts +0 -88
  445. package/dist/component/builtins/layout.d.ts.map +0 -1
  446. package/dist/component/builtins/layout.js +0 -84
  447. package/dist/component/builtins/layout.js.map +0 -1
  448. package/dist/component/builtins/media.d.ts +0 -95
  449. package/dist/component/builtins/media.d.ts.map +0 -1
  450. package/dist/component/builtins/media.js +0 -149
  451. package/dist/component/builtins/media.js.map +0 -1
  452. package/dist/component/builtins/providers.d.ts +0 -23
  453. package/dist/component/builtins/providers.d.ts.map +0 -1
  454. package/dist/component/builtins/providers.js +0 -30
  455. package/dist/component/builtins/providers.js.map +0 -1
  456. package/dist/component/builtins/text.d.ts +0 -193
  457. package/dist/component/builtins/text.d.ts.map +0 -1
  458. package/dist/component/builtins/text.js +0 -113
  459. package/dist/component/builtins/text.js.map +0 -1
  460. package/dist/component/builtins/three.d.ts +0 -1085
  461. package/dist/component/builtins/three.d.ts.map +0 -1
  462. package/dist/component/builtins/three.js +0 -265
  463. package/dist/component/builtins/three.js.map +0 -1
  464. package/dist/component/clip-of.d.ts +0 -5
  465. package/dist/component/clip-of.d.ts.map +0 -1
  466. package/dist/component/clip-of.js +0 -33
  467. package/dist/component/clip-of.js.map +0 -1
  468. package/dist/component/commands-for.d.ts +0 -19
  469. package/dist/component/commands-for.d.ts.map +0 -1
  470. package/dist/component/commands-for.js +0 -5
  471. package/dist/component/commands-for.js.map +0 -1
  472. package/dist/component/component-audio.d.ts +0 -9
  473. package/dist/component/component-audio.d.ts.map +0 -1
  474. package/dist/component/component-audio.js +0 -18
  475. package/dist/component/component-audio.js.map +0 -1
  476. package/dist/component/component2d.d.ts +0 -9
  477. package/dist/component/component2d.d.ts.map +0 -1
  478. package/dist/component/component2d.js +0 -239
  479. package/dist/component/component2d.js.map +0 -1
  480. package/dist/component/component3d.d.ts +0 -9
  481. package/dist/component/component3d.d.ts.map +0 -1
  482. package/dist/component/component3d.js +0 -99
  483. package/dist/component/component3d.js.map +0 -1
  484. package/dist/component/factory.d.ts +0 -63
  485. package/dist/component/factory.d.ts.map +0 -1
  486. package/dist/component/factory.js +0 -313
  487. package/dist/component/factory.js.map +0 -1
  488. package/dist/component/modules/aim.d.ts +0 -30
  489. package/dist/component/modules/aim.d.ts.map +0 -1
  490. package/dist/component/modules/aim.js +0 -39
  491. package/dist/component/modules/aim.js.map +0 -1
  492. package/dist/component/modules/corners.d.ts +0 -13
  493. package/dist/component/modules/corners.d.ts.map +0 -1
  494. package/dist/component/modules/corners.js +0 -12
  495. package/dist/component/modules/corners.js.map +0 -1
  496. package/dist/component/modules/flow.d.ts +0 -26
  497. package/dist/component/modules/flow.d.ts.map +0 -1
  498. package/dist/component/modules/flow.js +0 -55
  499. package/dist/component/modules/flow.js.map +0 -1
  500. package/dist/component/modules/material.d.ts +0 -40
  501. package/dist/component/modules/material.d.ts.map +0 -1
  502. package/dist/component/modules/material.js +0 -75
  503. package/dist/component/modules/material.js.map +0 -1
  504. package/dist/component/modules/paint.d.ts +0 -71
  505. package/dist/component/modules/paint.d.ts.map +0 -1
  506. package/dist/component/modules/paint.js +0 -106
  507. package/dist/component/modules/paint.js.map +0 -1
  508. package/dist/component/modules/shapes.d.ts +0 -31
  509. package/dist/component/modules/shapes.d.ts.map +0 -1
  510. package/dist/component/modules/shapes.js +0 -43
  511. package/dist/component/modules/shapes.js.map +0 -1
  512. package/dist/component/modules/text-layout.d.ts +0 -26
  513. package/dist/component/modules/text-layout.d.ts.map +0 -1
  514. package/dist/component/modules/text-layout.js +0 -57
  515. package/dist/component/modules/text-layout.js.map +0 -1
  516. package/dist/component/modules/text-style.d.ts +0 -48
  517. package/dist/component/modules/text-style.d.ts.map +0 -1
  518. package/dist/component/modules/text-style.js +0 -63
  519. package/dist/component/modules/text-style.js.map +0 -1
  520. package/dist/component/modules/three-entries.d.ts +0 -23
  521. package/dist/component/modules/three-entries.d.ts.map +0 -1
  522. package/dist/component/modules/three-entries.js +0 -41
  523. package/dist/component/modules/three-entries.js.map +0 -1
  524. package/dist/component/modules/view3d.d.ts +0 -55
  525. package/dist/component/modules/view3d.d.ts.map +0 -1
  526. package/dist/component/modules/view3d.js +0 -160
  527. package/dist/component/modules/view3d.js.map +0 -1
  528. package/dist/component/timeline.d.ts +0 -22
  529. package/dist/component/timeline.d.ts.map +0 -1
  530. package/dist/component/timeline.js +0 -128
  531. package/dist/component/timeline.js.map +0 -1
  532. package/dist/component/type-def.d.ts +0 -26
  533. package/dist/component/type-def.d.ts.map +0 -1
  534. package/dist/component/type-def.js +0 -16
  535. package/dist/component/type-def.js.map +0 -1
  536. package/dist/component/types.d.ts +0 -91
  537. package/dist/component/types.d.ts.map +0 -1
  538. package/dist/component/types.js +0 -88
  539. package/dist/component/types.js.map +0 -1
  540. package/dist/component/views.d.ts +0 -121
  541. package/dist/component/views.d.ts.map +0 -1
  542. package/dist/component/views.js +0 -413
  543. package/dist/component/views.js.map +0 -1
  544. package/dist/document/withdraw.d.ts +0 -28
  545. package/dist/document/withdraw.d.ts.map +0 -1
  546. package/dist/document/withdraw.js +0 -61
  547. package/dist/document/withdraw.js.map +0 -1
  548. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  549. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  550. package/dist/jsx/jsx-dev-runtime.js +0 -3
  551. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  552. package/dist/jsx/jsx-runtime.d.ts +0 -27
  553. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  554. package/dist/jsx/jsx-runtime.js +0 -26
  555. package/dist/jsx/jsx-runtime.js.map +0 -1
  556. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  557. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  558. package/dist/nodes/2d/node-lifecycle.js +0 -264
  559. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  560. package/dist/nodes/2d/node-motion.d.ts +0 -56
  561. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  562. package/dist/nodes/2d/node-motion.js +0 -86
  563. package/dist/nodes/2d/node-motion.js.map +0 -1
  564. package/dist/nodes/2d/node-render.d.ts +0 -44
  565. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  566. package/dist/nodes/2d/node-render.js +0 -80
  567. package/dist/nodes/2d/node-render.js.map +0 -1
  568. package/dist/nodes/2d/node-space.d.ts +0 -63
  569. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  570. package/dist/nodes/2d/node-space.js +0 -131
  571. package/dist/nodes/2d/node-space.js.map +0 -1
  572. package/dist/nodes/2d/node-transform.d.ts +0 -55
  573. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  574. package/dist/nodes/2d/node-transform.js +0 -73
  575. package/dist/nodes/2d/node-transform.js.map +0 -1
  576. package/dist/nodes/2d/node2d.d.ts +0 -1111
  577. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  578. package/dist/nodes/2d/node2d.js +0 -1665
  579. package/dist/nodes/2d/node2d.js.map +0 -1
  580. package/dist/nodes/2d/paint-node.d.ts +0 -142
  581. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  582. package/dist/nodes/2d/paint-node.js +0 -232
  583. package/dist/nodes/2d/paint-node.js.map +0 -1
  584. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  585. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  586. package/dist/nodes/audio/audio-bus.js +0 -33
  587. package/dist/nodes/audio/audio-bus.js.map +0 -1
  588. package/dist/nodes/audio/index.d.ts +0 -4
  589. package/dist/nodes/audio/index.d.ts.map +0 -1
  590. package/dist/nodes/audio/index.js +0 -2
  591. package/dist/nodes/audio/index.js.map +0 -1
  592. package/dist/nodes/audio/node-audio.d.ts +0 -107
  593. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  594. package/dist/nodes/audio/node-audio.js +0 -179
  595. package/dist/nodes/audio/node-audio.js.map +0 -1
  596. package/dist/nodes/audio/sound-node.d.ts +0 -41
  597. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  598. package/dist/nodes/audio/sound-node.js +0 -71
  599. package/dist/nodes/audio/sound-node.js.map +0 -1
  600. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  601. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  602. package/dist/nodes/geometry/boolean-node.js +0 -81
  603. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  604. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  605. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  606. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  607. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  608. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  609. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  610. package/dist/nodes/geometry/box-path-node.js +0 -116
  611. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  612. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  613. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  614. package/dist/nodes/geometry/ellipse-node.js +0 -45
  615. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  616. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  617. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  618. package/dist/nodes/geometry/group-bounds.js +0 -87
  619. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  620. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  621. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  622. package/dist/nodes/geometry/mask-node.js +0 -66
  623. package/dist/nodes/geometry/mask-node.js.map +0 -1
  624. package/dist/nodes/geometry/path-node.d.ts +0 -26
  625. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  626. package/dist/nodes/geometry/path-node.js +0 -58
  627. package/dist/nodes/geometry/path-node.js.map +0 -1
  628. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  629. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  630. package/dist/nodes/geometry/polygon-node.js +0 -47
  631. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  632. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  633. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  634. package/dist/nodes/geometry/polygram-node.js +0 -52
  635. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  636. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  637. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  638. package/dist/nodes/geometry/rect-node.js +0 -56
  639. package/dist/nodes/geometry/rect-node.js.map +0 -1
  640. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  641. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  642. package/dist/nodes/geometry/shape-node.js +0 -140
  643. package/dist/nodes/geometry/shape-node.js.map +0 -1
  644. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  645. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  646. package/dist/nodes/geometry/shape-outline.js +0 -470
  647. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  648. package/dist/nodes/index.d.ts +0 -53
  649. package/dist/nodes/index.d.ts.map +0 -1
  650. package/dist/nodes/index.js +0 -35
  651. package/dist/nodes/index.js.map +0 -1
  652. package/dist/nodes/layout/camera-node.d.ts +0 -80
  653. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  654. package/dist/nodes/layout/camera-node.js +0 -153
  655. package/dist/nodes/layout/camera-node.js.map +0 -1
  656. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  657. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  658. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  659. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  660. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  661. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  662. package/dist/nodes/layout/rotated-box.js +0 -76
  663. package/dist/nodes/layout/rotated-box.js.map +0 -1
  664. package/dist/nodes/media/video-node.d.ts +0 -229
  665. package/dist/nodes/media/video-node.d.ts.map +0 -1
  666. package/dist/nodes/media/video-node.js +0 -350
  667. package/dist/nodes/media/video-node.js.map +0 -1
  668. package/dist/nodes/node/declare-paints.d.ts +0 -19
  669. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  670. package/dist/nodes/node/declare-paints.js +0 -27
  671. package/dist/nodes/node/declare-paints.js.map +0 -1
  672. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  673. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  674. package/dist/nodes/node/node-editor-state.js +0 -23
  675. package/dist/nodes/node/node-editor-state.js.map +0 -1
  676. package/dist/nodes/node/node-reactive.d.ts +0 -89
  677. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  678. package/dist/nodes/node/node-reactive.js +0 -135
  679. package/dist/nodes/node/node-reactive.js.map +0 -1
  680. package/dist/nodes/node/node-time.d.ts +0 -39
  681. package/dist/nodes/node/node-time.d.ts.map +0 -1
  682. package/dist/nodes/node/node-time.js +0 -14
  683. package/dist/nodes/node/node-time.js.map +0 -1
  684. package/dist/nodes/node/node-walk.d.ts +0 -46
  685. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  686. package/dist/nodes/node/node-walk.js +0 -74
  687. package/dist/nodes/node/node-walk.js.map +0 -1
  688. package/dist/nodes/node/node.d.ts +0 -445
  689. package/dist/nodes/node/node.d.ts.map +0 -1
  690. package/dist/nodes/node/node.js +0 -745
  691. package/dist/nodes/node/node.js.map +0 -1
  692. package/dist/nodes/node/text-defaults.d.ts +0 -32
  693. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  694. package/dist/nodes/node/text-defaults.js +0 -37
  695. package/dist/nodes/node/text-defaults.js.map +0 -1
  696. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  697. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  698. package/dist/nodes/root/canvas2d-node.js +0 -264
  699. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  700. package/dist/nodes/root/provider-node.d.ts +0 -47
  701. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  702. package/dist/nodes/root/provider-node.js +0 -63
  703. package/dist/nodes/root/provider-node.js.map +0 -1
  704. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  705. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  706. package/dist/nodes/root/theme-provider-node.js +0 -43
  707. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  708. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  709. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  710. package/dist/nodes/text/default-text-style-node.js +0 -146
  711. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  712. package/dist/nodes/text/number-format.d.ts +0 -66
  713. package/dist/nodes/text/number-format.d.ts.map +0 -1
  714. package/dist/nodes/text/number-format.js +0 -227
  715. package/dist/nodes/text/number-format.js.map +0 -1
  716. package/dist/nodes/text/number-node.d.ts +0 -94
  717. package/dist/nodes/text/number-node.d.ts.map +0 -1
  718. package/dist/nodes/text/number-node.js +0 -86
  719. package/dist/nodes/text/number-node.js.map +0 -1
  720. package/dist/nodes/text/number-pattern.d.ts +0 -51
  721. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  722. package/dist/nodes/text/number-pattern.js +0 -77
  723. package/dist/nodes/text/number-pattern.js.map +0 -1
  724. package/dist/nodes/text/richtext-node.d.ts +0 -68
  725. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  726. package/dist/nodes/text/richtext-node.js +0 -78
  727. package/dist/nodes/text/richtext-node.js.map +0 -1
  728. package/dist/nodes/text/text-base.d.ts +0 -118
  729. package/dist/nodes/text/text-base.d.ts.map +0 -1
  730. package/dist/nodes/text/text-base.js +0 -153
  731. package/dist/nodes/text/text-base.js.map +0 -1
  732. package/dist/nodes/text/text-layout.d.ts +0 -87
  733. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  734. package/dist/nodes/text/text-layout.js +0 -368
  735. package/dist/nodes/text/text-layout.js.map +0 -1
  736. package/dist/nodes/text/text-node.d.ts +0 -84
  737. package/dist/nodes/text/text-node.d.ts.map +0 -1
  738. package/dist/nodes/text/text-node.js +0 -188
  739. package/dist/nodes/text/text-node.js.map +0 -1
  740. package/dist/nodes/text/text-selection.d.ts +0 -125
  741. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  742. package/dist/nodes/text/text-selection.js +0 -209
  743. package/dist/nodes/text/text-selection.js.map +0 -1
  744. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  745. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  746. package/dist/nodes/three/camera-nodes.js +0 -112
  747. package/dist/nodes/three/camera-nodes.js.map +0 -1
  748. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  749. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  750. package/dist/nodes/three/canvas3d-node.js +0 -486
  751. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  752. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  753. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  754. package/dist/nodes/three/drawable-nodes.js +0 -284
  755. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  756. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  757. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  758. package/dist/nodes/three/environment-nodes.js +0 -134
  759. package/dist/nodes/three/environment-nodes.js.map +0 -1
  760. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  761. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  762. package/dist/nodes/three/geometry-nodes.js +0 -322
  763. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  764. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  765. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  766. package/dist/nodes/three/grid-geometry3d.js +0 -114
  767. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  768. package/dist/nodes/three/group3d.d.ts +0 -23
  769. package/dist/nodes/three/group3d.d.ts.map +0 -1
  770. package/dist/nodes/three/group3d.js +0 -21
  771. package/dist/nodes/three/group3d.js.map +0 -1
  772. package/dist/nodes/three/light-nodes.d.ts +0 -120
  773. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  774. package/dist/nodes/three/light-nodes.js +0 -173
  775. package/dist/nodes/three/light-nodes.js.map +0 -1
  776. package/dist/nodes/three/mesh3d.d.ts +0 -117
  777. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  778. package/dist/nodes/three/mesh3d.js +0 -147
  779. package/dist/nodes/three/mesh3d.js.map +0 -1
  780. package/dist/nodes/three/node3d.d.ts +0 -230
  781. package/dist/nodes/three/node3d.d.ts.map +0 -1
  782. package/dist/nodes/three/node3d.js +0 -337
  783. package/dist/nodes/three/node3d.js.map +0 -1
  784. package/dist/render/descriptors/latex.d.ts +0 -6
  785. package/dist/render/descriptors/latex.d.ts.map +0 -1
  786. package/dist/render/descriptors/latex.js +0 -2
  787. package/dist/render/descriptors/latex.js.map +0 -1
  788. package/dist/tween/seekable.d.ts +0 -81
  789. package/dist/tween/seekable.d.ts.map +0 -1
  790. package/dist/tween/seekable.js +0 -137
  791. package/dist/tween/seekable.js.map +0 -1
package/README.md CHANGED
@@ -1,91 +1,91 @@
1
- # @motionscript/core
2
-
3
- The engine-agnostic animation library at the heart of [Motion Script](https://motionscript.dev).
4
- It defines what a scene is — a JSON document of nodes and commands — and how a
5
- project of them evolves over time: the scene graph, props and tweens, flow
6
- layout and the runtime that plays it, independent of any rendering backend and
7
- with zero dependencies.
8
-
9
- ```ts
10
- import type { CompositionDocument } from '@motionscript/core';
11
-
12
- // A scene is data: a tree of nodes, then commands placed at times.
13
- const doc: CompositionDocument = {
14
- kind: 'composition',
15
- nodes: [
16
- { id: 'card', type: 'rect', parentId: null, layerOrder: 0,
17
- props: { width: 400, height: 400, fill: 'white', cornerRadius: 20 } },
18
- { id: 'lens', type: 'ellipse', parentId: 'card', layerOrder: 0,
19
- props: { width: 350, height: 350, fill: 'black' } },
20
- ],
21
- commands: [
22
- // Slide the lens 300px over 3 seconds.
23
- { id: 'slide', type: 'to', targetId: 'lens', at: 0, duration: 3, args: { x: 300 } },
24
- ],
25
- };
26
- ```
27
-
28
- A host plays it with `engine.open({ document: doc })`. A frame is a pure
29
- function of its time, so a seek costs the same in either direction.
30
-
31
- ## What's in here
32
-
33
- - **Documents**: `StillDocument`, `CompositionDocument` and `AudioDocument`, the
34
- `ProjectDocument` that lays them on tracks, the validator, the expression
35
- language, and the per-engine `Registry` that turns a node key into a class.
36
- - **Runtime**: `Engine` and `Session`, which open a document on a platform and
37
- play, seek and export it.
38
- - **Nodes**: the scene graph (`Rect`, `Ellipse`, `Text`, `RichText`, `Video`,
39
- paths, 3D, audio, and more) with attributes for fills, gradients, filters, and
40
- WGSL shader effects. A custom node is a component registered with the engine,
41
- and any document it opens can name it.
42
- - **Tweens**: interpolation and easing for animating attributes over time.
43
- - **Layout**: `flowOps`, the flow layout every 2D node runs on its children:
44
- freeform, runs (wrapped or not) and grid.
45
- - **Project / render / platform / assets**: the abstractions a renderer and a
46
- platform implement to turn a scene graph into pixels, audio, and exported
47
- video: `RenderContext2D`/`RenderContext3D` (implemented by the WebGPU renderer
48
- [`@motionscript/renderer`](https://github.com/motionscript-dev/motionscript/tree/main/packages/renderer)) and the `platform` seams (filled
49
- in by [`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser)).
50
-
51
- This package has no rendering backend of its own. Pair it with
52
- [`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser) (WebGPU) or build your own backend
53
- against the `platform`/`render` abstractions.
54
-
55
- ## Docs
56
-
57
- Contributor documentation for this package lives in [`docs/`](https://github.com/motionscript-dev/motionscript/tree/main/packages/core/docs):
58
-
59
- - [Module tour](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/overview.md): what each directory of `src` holds, what may
60
- import what, validation, and what each barrel exports.
61
- - [Registry](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/registry.md): the per-engine vocabulary and the built-in keys.
62
- - [Variables and expressions](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/expressions.md): the expression grammar,
63
- its closed function library, node references and cycles.
64
- - [Timeline](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/timeline.md): compile, seek, presence, incremental patching
65
- and the time conventions.
66
- - [Commands, tweens and easing](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/commands.md): command shapes, `args`,
67
- easing, loops and command traits.
68
- - Also: [scene graph](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/scene-graph.md), [attributes](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/attributes.md),
69
- [layout and text](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/layout-and-text.md), [assets](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/assets.md) and the
70
- [project document](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/project-document.md).
71
-
72
- ## Usage
73
-
74
- ```bash
75
- npm install @motionscript/core
76
- ```
77
-
78
- See the [docs](https://motionscript.dev/docs) for the full feature set and API
79
- reference.
80
-
81
- ## Development
82
-
83
- From the monorepo root:
84
-
85
- ```bash
86
- pnpm --filter @motionscript/core build # eslint, then tsc, then the browser bundle
87
- pnpm --filter @motionscript/core test # vitest
88
- pnpm --filter @motionscript/core lint
89
- pnpm --filter @motionscript/core typecheck
90
- ```
91
-
1
+ # @motionscript/core
2
+
3
+ The engine-agnostic animation library at the heart of [Motion Script](https://motionscript.dev).
4
+ It defines what a scene is — a JSON document of nodes and commands — and how a
5
+ project of them evolves over time: the scene graph, props and tweens, flow
6
+ layout and the runtime that plays it, independent of any rendering backend and
7
+ with zero dependencies.
8
+
9
+ ```ts
10
+ import type { CompositionDocument } from '@motionscript/core';
11
+
12
+ // A scene is data: a tree of nodes, then commands placed at times.
13
+ const doc: CompositionDocument = {
14
+ kind: 'composition',
15
+ nodes: [
16
+ { id: 'card', type: 'rect', parentId: null, layerOrder: 0,
17
+ props: { width: 400, height: 400, fill: 'white', cornerRadius: 20 } },
18
+ { id: 'lens', type: 'ellipse', parentId: 'card', layerOrder: 0,
19
+ props: { width: 350, height: 350, fill: 'black' } },
20
+ ],
21
+ commands: [
22
+ // Slide the lens 300px over 3 seconds.
23
+ { id: 'slide', type: 'to', targetId: 'lens', at: 0, duration: 3, args: { x: 300 } },
24
+ ],
25
+ };
26
+ ```
27
+
28
+ A host plays it with `engine.open({ document: doc })`. A frame is a pure
29
+ function of its time, so a seek costs the same in either direction.
30
+
31
+ ## What's in here
32
+
33
+ - **Documents**: `StillDocument`, `CompositionDocument` and `AudioDocument`, the
34
+ `ProjectDocument` that lays them on tracks, the validator, the expression
35
+ language, and the per-engine `Registry` that turns a node key into a class.
36
+ - **Runtime**: `Engine` and `Session`, which open a document on a platform and
37
+ play, seek and export it.
38
+ - **Nodes**: the scene graph (`Rect`, `Ellipse`, `Text`, `RichText`, `Video`,
39
+ paths, 3D, audio, and more) with attributes for fills, gradients, filters, and
40
+ WGSL shader effects. A custom node is a component registered with the engine,
41
+ and any document it opens can name it.
42
+ - **Tweens**: interpolation and easing for animating attributes over time.
43
+ - **Layout**: `flowOps`, the flow layout every 2D node runs on its children:
44
+ freeform, runs (wrapped or not) and grid.
45
+ - **Project / render / platform / assets**: the abstractions a renderer and a
46
+ platform implement to turn a scene graph into pixels, audio, and exported
47
+ video: `RenderContext2D`/`RenderContext3D` (implemented by the WebGPU renderer
48
+ [`@motionscript/renderer`](https://github.com/motionscript-dev/motionscript/tree/main/packages/renderer)) and the `platform` seams (filled
49
+ in by [`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser)).
50
+
51
+ This package has no rendering backend of its own. Pair it with
52
+ [`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser) (WebGPU) or build your own backend
53
+ against the `platform`/`render` abstractions.
54
+
55
+ ## Docs
56
+
57
+ Contributor documentation for this package lives in [`docs/`](https://github.com/motionscript-dev/motionscript/tree/main/packages/core/docs):
58
+
59
+ - [Module tour](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/overview.md): what each directory of `src` holds, what may
60
+ import what, validation, and what each barrel exports.
61
+ - [Registry](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/registry.md): the per-engine vocabulary and the built-in keys.
62
+ - [Variables and expressions](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/expressions.md): the expression grammar,
63
+ its closed function library, node references and cycles.
64
+ - [Timeline](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/timeline.md): compile, seek, presence, incremental patching
65
+ and the time conventions.
66
+ - [Commands, tweens and easing](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/commands.md): command shapes, `args`,
67
+ easing, loops and command traits.
68
+ - Also: [scene graph](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/scene-graph.md), [attributes](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/attributes.md),
69
+ [layout and text](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/layout-and-text.md), [assets](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/assets.md) and the
70
+ [project document](https://github.com/motionscript-dev/motionscript/blob/main/packages/core/docs/project-document.md).
71
+
72
+ ## Usage
73
+
74
+ ```bash
75
+ npm install @motionscript/core
76
+ ```
77
+
78
+ See the [docs](https://motionscript.dev/docs) for the full feature set and API
79
+ reference.
80
+
81
+ ## Development
82
+
83
+ From the monorepo root:
84
+
85
+ ```bash
86
+ pnpm --filter @motionscript/core build # eslint, then tsc, then the browser bundle
87
+ pnpm --filter @motionscript/core test # vitest
88
+ pnpm --filter @motionscript/core lint
89
+ pnpm --filter @motionscript/core typecheck
90
+ ```
91
+
@@ -1 +1 @@
1
- {"version":3,"file":"asset-index.js","sourceRoot":"","sources":["../../src/assets/asset-index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAC;AA0BnD,MAAM,SAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,OAAO,UAAU;IACnB,YAAY,UAAkB;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED,QAAQ,CAAC,QAAgB,EAAE,QAAiC;QACxD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,QAAQ;YAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAExD,MAAM,IAAI,GAAkB,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,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AC,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;YACP,OAAO,CAAC,CAAC,UAAU,KAAM,CAAc,CAAC,UAAU,CAAC;QACvD,KAAK,QAAQ;YACT,OAAO,CAAC,CAAC,IAAI,KAAM,CAAc,CAAC,IAAI,CAAC;QAC3C;YACI,OAAO,IAAI,CAAC;IACpB,CAAC;AACL,CAAC","sourcesContent":["import type { AssetRecord } from \"./record\";\r\nimport { assetKey, type AssetDecl } from \"./scope\";\r\n\r\nexport interface AssetSegment {\r\n key: string;\r\n decl: AssetDecl;\r\n startFrame: number;\r\n /** Inclusive. `Infinity` runs to the clip's end. */\r\n endFrame: number;\r\n}\r\n\r\nexport interface AssetDelta {\r\n /** Keys whose record appeared, disappeared, or changed window or content. */\r\n readonly keys: ReadonlySet<string>;\r\n}\r\n\r\ninterface OwnerSegments {\r\n declared: Map<string, AssetSegment[]>;\r\n /** Found missing at draw time rather than declared; cleared by the owner's next `setOwner`. */\r\n learned: Map<string, AssetSegment[]>;\r\n}\r\n\r\ninterface KeyEntry {\r\n record: AssetRecord;\r\n layout: boolean;\r\n}\r\n\r\nconst NO_OWNERS: ReadonlySet<string> = new Set();\r\n\r\n/**\r\n * One clip's asset windows, per owner, in clip-local frames.\r\n *\r\n * Owners replace their segments wholesale, and a key's record — the union window\r\n * over every owner that needs it — is recomputed only for the keys an update\r\n * touched. The records keep today's {@link AssetRecord} shape so the manager,\r\n * exporter and mixer read them unchanged.\r\n */\r\nexport class AssetIndex {\r\n constructor(frameCount: number) {\r\n this._frameCount = Math.max(0, frameCount);\r\n }\r\n\r\n setOwner(ownerKey: string, segments: readonly AssetSegment[]): AssetDelta {\r\n const touched = new Set<string>();\r\n const previous = this._owners.get(ownerKey);\r\n if (previous) this._unlink(ownerKey, previous, touched);\r\n\r\n const next: OwnerSegments = { declared: new Map(), learned: new Map() };\r\n for (const segment of segments) {\r\n if (!(segment.endFrame >= segment.startFrame)) continue;\r\n appendSegment(next.declared, { ...segment });\r\n }\r\n if (next.declared.size > 0) {\r\n this._owners.set(ownerKey, next);\r\n this._link(ownerKey, next, touched);\r\n } else {\r\n this._owners.delete(ownerKey);\r\n }\r\n return this._refresh(touched);\r\n }\r\n\r\n removeOwner(ownerKey: string): AssetDelta {\r\n const previous = this._owners.get(ownerKey);\r\n if (!previous) return { keys: new Set() };\r\n const touched = new Set<string>();\r\n this._unlink(ownerKey, previous, touched);\r\n this._owners.delete(ownerKey);\r\n return this._refresh(touched);\r\n }\r\n\r\n learn(ownerKey: string, decl: AssetDecl, frame: number): AssetDelta {\r\n const key = assetKey(decl);\r\n let owner = this._owners.get(ownerKey);\r\n if (!owner) {\r\n owner = { declared: new Map(), learned: new Map() };\r\n this._owners.set(ownerKey, owner);\r\n }\r\n const list = owner.learned.get(key) ?? [];\r\n const at = list.findIndex((s) => frame >= s.startFrame - 1 && frame <= s.endFrame + 1);\r\n if (at < 0) {\r\n list.push({ key, decl, startFrame: frame, endFrame: frame });\r\n } else {\r\n // Replaced rather than widened in place: `segmentsOf` hands these out.\r\n const hit = list[at];\r\n list[at] = {\r\n ...hit,\r\n startFrame: Math.min(hit.startFrame, frame),\r\n endFrame: Math.max(hit.endFrame, frame),\r\n };\r\n }\r\n owner.learned.set(key, list);\r\n let owners = this._byKey.get(key);\r\n if (!owners) this._byKey.set(key, (owners = new Set()));\r\n owners.add(ownerKey);\r\n return this._refresh(new Set([key]));\r\n }\r\n\r\n setFrameCount(frameCount: number): AssetDelta {\r\n const next = Math.max(0, frameCount);\r\n if (next === this._frameCount) return { keys: new Set() };\r\n this._frameCount = next;\r\n return this._refresh(new Set(this._byKey.keys()));\r\n }\r\n\r\n owners(key: string): ReadonlySet<string> {\r\n return this._byKey.get(key) ?? NO_OWNERS;\r\n }\r\n\r\n /** Declared segments, then learned ones. */\r\n segmentsOf(ownerKey: string): readonly AssetSegment[] {\r\n const owner = this._owners.get(ownerKey);\r\n if (!owner) return [];\r\n const out: AssetSegment[] = [];\r\n for (const list of owner.declared.values()) out.push(...list);\r\n for (const list of owner.learned.values()) out.push(...list);\r\n return out;\r\n }\r\n\r\n /** Declared segments only — what a partial re-declaration keeps the front of. */\r\n declaredSegmentsOf(ownerKey: string): readonly AssetSegment[] {\r\n const owner = this._owners.get(ownerKey);\r\n if (!owner) return [];\r\n const out: AssetSegment[] = [];\r\n for (const list of owner.declared.values()) out.push(...list);\r\n return out;\r\n }\r\n\r\n ownerKeys(): IterableIterator<string> {\r\n return this._owners.keys();\r\n }\r\n\r\n records(): ReadonlyMap<string, AssetRecord> {\r\n return this._records;\r\n }\r\n\r\n /** Fonts, and loaders any owner declared with `gate: \"layout\"`. */\r\n layoutGates(): readonly AssetRecord[] {\r\n if (this._layoutGates === null) {\r\n const gates: AssetRecord[] = [];\r\n for (const entry of this._entries.values()) {\r\n if (entry.layout) gates.push(entry.record);\r\n }\r\n this._layoutGates = gates;\r\n }\r\n return this._layoutGates;\r\n }\r\n\r\n private _frameCount: number;\r\n private readonly _owners = new Map<string, OwnerSegments>();\r\n private readonly _byKey = new Map<string, Set<string>>();\r\n private readonly _entries = new Map<string, KeyEntry>();\r\n private readonly _records = new Map<string, AssetRecord>();\r\n private _layoutGates: AssetRecord[] | null = null;\r\n\r\n private _link(ownerKey: string, owner: OwnerSegments, touched: Set<string>): void {\r\n for (const key of owner.declared.keys()) {\r\n let owners = this._byKey.get(key);\r\n if (!owners) this._byKey.set(key, (owners = new Set()));\r\n owners.add(ownerKey);\r\n touched.add(key);\r\n }\r\n }\r\n\r\n private _unlink(ownerKey: string, owner: OwnerSegments, touched: Set<string>): void {\r\n for (const map of [owner.declared, owner.learned]) {\r\n for (const key of map.keys()) {\r\n const owners = this._byKey.get(key);\r\n if (owners) {\r\n owners.delete(ownerKey);\r\n if (owners.size === 0) this._byKey.delete(key);\r\n }\r\n touched.add(key);\r\n }\r\n }\r\n }\r\n\r\n private _refresh(keys: ReadonlySet<string>): AssetDelta {\r\n const changed = new Set<string>();\r\n for (const key of keys) {\r\n const previous = this._entries.get(key);\r\n const next = this._compute(key);\r\n if (next === undefined) {\r\n if (previous === undefined) continue;\r\n this._entries.delete(key);\r\n this._records.delete(key);\r\n } else if (previous !== undefined && previous.layout === next.layout && sameRecord(previous.record, next.record)) {\r\n continue;\r\n } else {\r\n this._entries.set(key, next);\r\n this._records.set(key, next.record);\r\n }\r\n changed.add(key);\r\n }\r\n if (changed.size > 0) this._layoutGates = null;\r\n return { keys: changed };\r\n }\r\n\r\n private _compute(key: string): KeyEntry | undefined {\r\n const owners = this._byKey.get(key);\r\n if (!owners) return undefined;\r\n const last = this._frameCount - 1;\r\n let first: AssetSegment | undefined;\r\n let start = Infinity;\r\n let end = -Infinity;\r\n let layoutLoader = false;\r\n\r\n const visit = (list: AssetSegment[] | undefined): void => {\r\n if (!list) return;\r\n for (const segment of list) {\r\n const from = Math.max(0, segment.startFrame);\r\n const to = Math.min(last, segment.endFrame);\r\n if (to < from) continue;\r\n // The earliest segment speaks for the key.\r\n if (from < start) {\r\n start = from;\r\n first = segment;\r\n }\r\n if (to > end) end = to;\r\n if (segment.decl.type === \"loader\" && segment.decl.gate === \"layout\") layoutLoader = true;\r\n }\r\n };\r\n for (const ownerKey of owners) {\r\n const owner = this._owners.get(ownerKey);\r\n if (!owner) continue;\r\n visit(owner.declared.get(key));\r\n visit(owner.learned.get(key));\r\n }\r\n\r\n if (first === undefined) return undefined;\r\n return {\r\n record: recordOf(first.decl, start, end),\r\n layout: first.decl.type === \"font\" || layoutLoader,\r\n };\r\n }\r\n}\r\n\r\nfunction appendSegment(map: Map<string, AssetSegment[]>, segment: AssetSegment): void {\r\n const list = map.get(segment.key);\r\n if (list) list.push(segment);\r\n else map.set(segment.key, [segment]);\r\n}\r\n\r\nfunction recordOf(decl: AssetDecl, startFrame: number, endFrame: number): AssetRecord {\r\n switch (decl.type) {\r\n case \"image\":\r\n return { type: \"image\", startFrame, endFrame, src: decl.src };\r\n case \"video\":\r\n return {\r\n type: \"video\", startFrame, endFrame, src: decl.src,\r\n trimStart: decl.trimStart, trimEnd: decl.trimEnd,\r\n };\r\n case \"font\":\r\n return { type: \"font\", startFrame, endFrame, fontWeight: decl.weight, fontFamily: decl.family, src: decl.family };\r\n case \"loader\":\r\n return { type: \"loader\", src: decl.key, startFrame, endFrame, load: decl.load };\r\n }\r\n}\r\n\r\nfunction sameRecord(a: AssetRecord, b: AssetRecord): boolean {\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 return a.fontWeight === (b as typeof a).fontWeight;\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
+ {"version":3,"file":"asset-index.js","sourceRoot":"","sources":["../../src/assets/asset-index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAC;AA0BnD,MAAM,SAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,OAAO,UAAU;IACnB,YAAY,UAAkB;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED,QAAQ,CAAC,QAAgB,EAAE,QAAiC;QACxD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,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,EAAE,CAAC;IACxF,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAC,CAAc,EAAE,CAAc;IAC9C,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;YACP,OAAO,CAAC,CAAC,UAAU,KAAM,CAAc,CAAC,UAAU,CAAC;QACvD,KAAK,QAAQ;YACT,OAAO,CAAC,CAAC,IAAI,KAAM,CAAc,CAAC,IAAI,CAAC;QAC3C;YACI,OAAO,IAAI,CAAC;IACpB,CAAC;AACL,CAAC","sourcesContent":["import type { AssetRecord } from \"./record\";\nimport { assetKey, type AssetDecl } from \"./scope\";\n\nexport interface AssetSegment {\n key: string;\n decl: AssetDecl;\n startFrame: number;\n /** Inclusive. `Infinity` runs to the clip's end. */\n endFrame: number;\n}\n\nexport interface AssetDelta {\n /** Keys whose record appeared, disappeared, or changed window or content. */\n readonly keys: ReadonlySet<string>;\n}\n\ninterface OwnerSegments {\n declared: Map<string, AssetSegment[]>;\n /** Found missing at draw time rather than declared; cleared by the owner's next `setOwner`. */\n learned: Map<string, AssetSegment[]>;\n}\n\ninterface KeyEntry {\n record: AssetRecord;\n layout: boolean;\n}\n\nconst NO_OWNERS: ReadonlySet<string> = new Set();\n\n/**\n * One clip's asset windows, per owner, in clip-local frames.\n *\n * Owners replace their segments wholesale, and a key's record — the union window\n * over every owner that needs it — is recomputed only for the keys an update\n * touched. The records keep today's {@link AssetRecord} shape so the manager,\n * exporter and mixer read them unchanged.\n */\nexport class AssetIndex {\n constructor(frameCount: number) {\n this._frameCount = Math.max(0, frameCount);\n }\n\n setOwner(ownerKey: string, segments: readonly AssetSegment[]): AssetDelta {\n const touched = new Set<string>();\n const previous = this._owners.get(ownerKey);\n if (previous) this._unlink(ownerKey, previous, touched);\n\n const next: OwnerSegments = { declared: new Map(), learned: new Map() };\n for (const segment of segments) {\n if (!(segment.endFrame >= segment.startFrame)) continue;\n appendSegment(next.declared, { ...segment });\n }\n if (next.declared.size > 0) {\n this._owners.set(ownerKey, next);\n this._link(ownerKey, next, touched);\n } else {\n this._owners.delete(ownerKey);\n }\n return this._refresh(touched);\n }\n\n removeOwner(ownerKey: string): AssetDelta {\n const previous = this._owners.get(ownerKey);\n if (!previous) return { keys: new Set() };\n const touched = new Set<string>();\n this._unlink(ownerKey, previous, touched);\n this._owners.delete(ownerKey);\n return this._refresh(touched);\n }\n\n learn(ownerKey: string, decl: AssetDecl, frame: number): AssetDelta {\n const key = assetKey(decl);\n let owner = this._owners.get(ownerKey);\n if (!owner) {\n owner = { declared: new Map(), learned: new Map() };\n this._owners.set(ownerKey, owner);\n }\n const list = owner.learned.get(key) ?? [];\n const at = list.findIndex((s) => frame >= s.startFrame - 1 && frame <= s.endFrame + 1);\n if (at < 0) {\n list.push({ key, decl, startFrame: frame, endFrame: frame });\n } else {\n // Replaced rather than widened in place: `segmentsOf` hands these out.\n const hit = list[at];\n list[at] = {\n ...hit,\n startFrame: Math.min(hit.startFrame, frame),\n endFrame: Math.max(hit.endFrame, frame),\n };\n }\n owner.learned.set(key, list);\n let owners = this._byKey.get(key);\n if (!owners) this._byKey.set(key, (owners = new Set()));\n owners.add(ownerKey);\n return this._refresh(new Set([key]));\n }\n\n setFrameCount(frameCount: number): AssetDelta {\n const next = Math.max(0, frameCount);\n if (next === this._frameCount) return { keys: new Set() };\n this._frameCount = next;\n return this._refresh(new Set(this._byKey.keys()));\n }\n\n owners(key: string): ReadonlySet<string> {\n return this._byKey.get(key) ?? NO_OWNERS;\n }\n\n /** Declared segments, then learned ones. */\n segmentsOf(ownerKey: string): readonly AssetSegment[] {\n const owner = this._owners.get(ownerKey);\n if (!owner) return [];\n const out: AssetSegment[] = [];\n for (const list of owner.declared.values()) out.push(...list);\n for (const list of owner.learned.values()) out.push(...list);\n return out;\n }\n\n /** Declared segments only — what a partial re-declaration keeps the front of. */\n declaredSegmentsOf(ownerKey: string): readonly AssetSegment[] {\n const owner = this._owners.get(ownerKey);\n if (!owner) return [];\n const out: AssetSegment[] = [];\n for (const list of owner.declared.values()) out.push(...list);\n return out;\n }\n\n ownerKeys(): IterableIterator<string> {\n return this._owners.keys();\n }\n\n records(): ReadonlyMap<string, AssetRecord> {\n return this._records;\n }\n\n /** Fonts, and loaders any owner declared with `gate: \"layout\"`. */\n layoutGates(): readonly AssetRecord[] {\n if (this._layoutGates === null) {\n const gates: AssetRecord[] = [];\n for (const entry of this._entries.values()) {\n if (entry.layout) gates.push(entry.record);\n }\n this._layoutGates = gates;\n }\n return this._layoutGates;\n }\n\n private _frameCount: number;\n private readonly _owners = new Map<string, OwnerSegments>();\n private readonly _byKey = new Map<string, Set<string>>();\n private readonly _entries = new Map<string, KeyEntry>();\n private readonly _records = new Map<string, AssetRecord>();\n private _layoutGates: AssetRecord[] | null = null;\n\n private _link(ownerKey: string, owner: OwnerSegments, touched: Set<string>): void {\n for (const key of owner.declared.keys()) {\n let owners = this._byKey.get(key);\n if (!owners) this._byKey.set(key, (owners = new Set()));\n owners.add(ownerKey);\n touched.add(key);\n }\n }\n\n private _unlink(ownerKey: string, owner: OwnerSegments, touched: Set<string>): void {\n for (const map of [owner.declared, owner.learned]) {\n for (const key of map.keys()) {\n const owners = this._byKey.get(key);\n if (owners) {\n owners.delete(ownerKey);\n if (owners.size === 0) this._byKey.delete(key);\n }\n touched.add(key);\n }\n }\n }\n\n private _refresh(keys: ReadonlySet<string>): AssetDelta {\n const changed = new Set<string>();\n for (const key of keys) {\n const previous = this._entries.get(key);\n const next = this._compute(key);\n if (next === undefined) {\n if (previous === undefined) continue;\n this._entries.delete(key);\n this._records.delete(key);\n } else if (previous !== undefined && previous.layout === next.layout && sameRecord(previous.record, next.record)) {\n continue;\n } else {\n this._entries.set(key, next);\n this._records.set(key, next.record);\n }\n changed.add(key);\n }\n if (changed.size > 0) this._layoutGates = null;\n return { keys: changed };\n }\n\n private _compute(key: string): KeyEntry | undefined {\n const owners = this._byKey.get(key);\n if (!owners) return undefined;\n const last = this._frameCount - 1;\n let first: AssetSegment | undefined;\n let start = Infinity;\n let end = -Infinity;\n let layoutLoader = false;\n\n const visit = (list: AssetSegment[] | undefined): void => {\n if (!list) return;\n for (const segment of list) {\n const from = Math.max(0, segment.startFrame);\n const to = Math.min(last, segment.endFrame);\n if (to < from) continue;\n // The earliest segment speaks for the key.\n if (from < start) {\n start = from;\n first = segment;\n }\n if (to > end) end = to;\n if (segment.decl.type === \"loader\" && segment.decl.gate === \"layout\") layoutLoader = true;\n }\n };\n for (const ownerKey of owners) {\n const owner = this._owners.get(ownerKey);\n if (!owner) continue;\n visit(owner.declared.get(key));\n visit(owner.learned.get(key));\n }\n\n if (first === undefined) return undefined;\n return {\n record: recordOf(first.decl, start, end),\n layout: first.decl.type === \"font\" || layoutLoader,\n };\n }\n}\n\nfunction appendSegment(map: Map<string, AssetSegment[]>, segment: AssetSegment): void {\n const list = map.get(segment.key);\n if (list) list.push(segment);\n else map.set(segment.key, [segment]);\n}\n\nfunction recordOf(decl: AssetDecl, startFrame: number, endFrame: number): AssetRecord {\n switch (decl.type) {\n case \"image\":\n return { type: \"image\", startFrame, endFrame, src: decl.src };\n case \"video\":\n return {\n type: \"video\", startFrame, endFrame, src: decl.src,\n trimStart: decl.trimStart, trimEnd: decl.trimEnd,\n };\n case \"font\":\n return { type: \"font\", startFrame, endFrame, fontWeight: decl.weight, fontFamily: decl.family, src: decl.family };\n case \"loader\":\n return { type: \"loader\", src: decl.key, startFrame, endFrame, load: decl.load };\n }\n}\n\nfunction sameRecord(a: AssetRecord, b: AssetRecord): boolean {\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 return a.fontWeight === (b as typeof a).fontWeight;\n case \"loader\":\n return a.load === (b as typeof a).load;\n default:\n return true;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/assets/catalog.ts"],"names":[],"mappings":"AAuEA;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAoB;IACT;IAApB,YAAoB,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;IAAI,CAAC;IAEhD;;;;;;;OAOG;IACH,SAAS,CAAC,QAAuB;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;OAUG;IACK,YAAY,CAAC,GAAW;QAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,YAAY,CAAC,GAAW;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,kFAAkF,CAAC,CAAC;QAC7I,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,YAAY,CAAC,GAAW;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAA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YAAE,OAAO,KAAK,CAAC,QAAQ,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC,QAAQ,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,kFAAkF,CAAC,CAAC;IACtI,CAAC;IAED,YAAY,CAAC,GAAW;QACpB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACjD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { type AudioMeta, type FontMeta, type ImageMeta, AssetManifest, type VideoMeta } from \"./manifest\";\r\n\r\n/**\r\n * What a scene can ask about the assets available to it.\r\n *\r\n * Strictly read-only, and strictly about *metadata*: dimensions, durations, and\r\n * the font faces a family resolves to. Nothing here loads anything — that is\r\n * the {@link AssetManager}'s job, driven by what nodes declare into an\r\n * {@link AssetScope}. Reachable from any node as `node.assets` and from a\r\n * scene generator as `stage.assets`.\r\n *\r\n * **Every lookup throws on a miss rather than returning `undefined`.** A missing\r\n * asset is a typo or a deleted file, and it is worth finding out during the\r\n * precomp pass (where it surfaces as a `BuildError` in the errors panel) rather\r\n * than at playback as a shape that silently fails to paint.\r\n *\r\n * An interface so a host can supply its own — a test double, or a catalog\r\n * backed by something other than a static manifest. {@link ManifestAssetCatalog}\r\n * is the implementation the runtime builds from the project's asset manifest.\r\n */\r\nexport interface AssetCatalog {\r\n /**\r\n * Metadata for an image.\r\n * @throws If the image is not in the manifest.\r\n */\r\n getImageMeta(src: string): ImageMeta;\r\n\r\n /**\r\n * Metadata for a video.\r\n * @throws If the video is not in the manifest.\r\n */\r\n getVideoMeta(src: string): VideoMeta;\r\n\r\n /**\r\n * Metadata for an audio track.\r\n * @throws If the audio file is not in the manifest.\r\n */\r\n getAudioMeta(src: string): AudioMeta;\r\n\r\n /**\r\n * Metadata for a single font face, by its `family@weight` lookup key.\r\n * @throws If the key is not in the manifest.\r\n */\r\n getFontMeta(key: string): FontMeta;\r\n\r\n /**\r\n * Every face registered for a family, across all weights and slants — what\r\n * the renderer registers so its font matcher can resolve any requested\r\n * weight to the nearest available file. Empty if the family is unknown.\r\n */\r\n getFontFamilyMetas(fontFamily: string): FontMeta[];\r\n\r\n /** Playback duration of a video, in seconds. */\r\n getVideoDuration(src: string): number;\r\n\r\n /** Playback duration of an audio file, in seconds. */\r\n getAudioDuration(src: string): number;\r\n\r\n /**\r\n * Duration of any *playable* source — an audio file, or a video whose audio\r\n * track is being played. Resolves against audio first and falls back to\r\n * video, so a video `src` can drive a `Sound` without a duplicate audio-only\r\n * manifest entry.\r\n * @throws If `src` is in neither manifest.\r\n */\r\n getMediaDuration(src: string): number;\r\n\r\n /** An image's intrinsic pixel dimensions. */\r\n getImageSize(src: string): { width: number; height: number };\r\n}\r\n\r\n/**\r\n * The {@link AssetCatalog} the runtime builds: a query engine over a static\r\n * {@link AssetManifest}.\r\n *\r\n * @example\r\n * ```ts\r\n * const catalog = new ManifestAssetCatalog(manifest);\r\n * catalog.getImageSize(\"hero-banner.png\"); // { width: 1920, height: 1080 }\r\n * ```\r\n */\r\nexport class ManifestAssetCatalog implements AssetCatalog {\r\n constructor(private manifest: AssetManifest) { }\r\n\r\n /**\r\n * Point this catalog at `manifest`, in place.\r\n *\r\n * A session hands one catalog to the controller, the clip store and every\r\n * node's `assets`, so replacing the catalog object would leave all of them on\r\n * the old one. Reconciling the manifest it reads keeps a manifest change\r\n * visible to everything already built.\r\n */\r\n reconcile(manifest: AssetManifest): void {\r\n this.manifest = manifest;\r\n }\r\n\r\n /**\r\n * Normalize a caller-supplied asset `src` into the manifest's lookup key.\r\n * The manifest stores image/video/audio keys as the file's path relative\r\n * to the scanned public folder, using forward slashes with no leading\r\n * `./` or `/`.\r\n * Scene authors write `src` in whichever equivalent form is natural — a\r\n * bare filename, `\"./sub/file.png\"`, `\"/sub/file.png\"`, or a\r\n * Windows-authored backslash path — so normalize all of them to the same\r\n * key. Font lookups are keyed by `family@weight`, not a path, so they\r\n * don't go through this.\r\n */\r\n private normalizeKey(src: string): string {\r\n return src.replace(/\\\\/g, '/').replace(/^\\.\\//, '').replace(/^\\/+/, '');\r\n }\r\n\r\n getImageMeta(src: string): ImageMeta {\r\n const meta = this.manifest.image[this.normalizeKey(src)];\r\n if (!meta) throw new Error(`Image asset not found: \"${src}\". Check the file exists in your public folder and the src matches its filename.`);\r\n return meta;\r\n }\r\n\r\n getVideoMeta(src: string): VideoMeta {\r\n const meta = this.manifest.video[this.normalizeKey(src)];\r\n if (!meta) throw new Error(`Video asset not found: \"${src}\". Check the file exists in your public folder and the src matches its filename.`);\r\n return meta;\r\n }\r\n\r\n getAudioMeta(src: string): AudioMeta {\r\n const meta = this.manifest.audio[this.normalizeKey(src)];\r\n if (!meta) throw new Error(`No audio metadata for src: ${src}`);\r\n return meta;\r\n }\r\n\r\n getFontMeta(key: string): FontMeta {\r\n const meta = this.manifest.font[key];\r\n if (!meta) throw new Error(`No font metadata for key: ${key}`);\r\n return meta;\r\n }\r\n\r\n getFontFamilyMetas(fontFamily: string): FontMeta[] {\r\n return Object.values(this.manifest.font).filter(meta => meta.fontFamily === fontFamily);\r\n }\r\n\r\n getVideoDuration(src: string): number {\r\n return this.getVideoMeta(src).duration;\r\n }\r\n\r\n getAudioDuration(src: string): number {\r\n return this.getAudioMeta(src).duration;\r\n }\r\n\r\n getMediaDuration(src: string): number {\r\n const key = this.normalizeKey(src);\r\n const audio = this.manifest.audio[key];\r\n if (audio) return audio.duration;\r\n const video = this.manifest.video[key];\r\n if (video) return video.duration;\r\n throw new Error(`Audio asset not found: \"${src}\". Check the file exists in your public folder and the src matches its filename.`);\r\n }\r\n\r\n getImageSize(src: string): { width: number; height: number } {\r\n const { width, height } = this.getImageMeta(src);\r\n return { width, height };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"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,KAAK,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { type AudioMeta, type FontMeta, type ImageMeta, AssetManifest, type VideoMeta } from \"./manifest\";\n\n/**\n * What a scene can ask about the assets available to it.\n *\n * Strictly read-only, and strictly about *metadata*: dimensions, durations, and\n * the font faces a family resolves to. Nothing here loads anything — that is\n * the {@link AssetManager}'s job, driven by what nodes declare into an\n * {@link AssetScope}. Reachable from any node as `node.assets` and from a\n * scene generator as `stage.assets`.\n *\n * **Every lookup throws on a miss rather than returning `undefined`.** A missing\n * asset is a typo or a deleted file, and it is worth finding out during the\n * precomp pass (where it surfaces as a `BuildError` in the errors panel) rather\n * than at playback as a shape that silently fails to paint.\n *\n * An interface so a host can supply its own — a test double, or a catalog\n * backed by something other than a static manifest. {@link ManifestAssetCatalog}\n * is the implementation the runtime builds from the project's asset manifest.\n */\nexport interface AssetCatalog {\n /**\n * Metadata for an image.\n * @throws If the image is not in the manifest.\n */\n getImageMeta(src: string): ImageMeta;\n\n /**\n * Metadata for a video.\n * @throws If the video is not in the manifest.\n */\n getVideoMeta(src: string): VideoMeta;\n\n /**\n * Metadata for an audio track.\n * @throws If the audio file is not in the manifest.\n */\n getAudioMeta(src: string): AudioMeta;\n\n /**\n * Metadata for a single font face, by its `family@weight` lookup key.\n * @throws If the key is not in the manifest.\n */\n getFontMeta(key: string): FontMeta;\n\n /**\n * Every face registered for a family, across all weights and slants — what\n * the renderer registers so its font matcher can resolve any requested\n * weight to the nearest available file. Empty if the family is unknown.\n */\n getFontFamilyMetas(fontFamily: string): FontMeta[];\n\n /** Playback duration of a video, in seconds. */\n getVideoDuration(src: string): number;\n\n /** Playback duration of an audio file, in seconds. */\n getAudioDuration(src: string): number;\n\n /**\n * Duration of any *playable* source — an audio file, or a video whose audio\n * track is being played. Resolves against audio first and falls back to\n * video, so a video `src` can drive a `Sound` without a duplicate audio-only\n * manifest entry.\n * @throws If `src` is in neither manifest.\n */\n getMediaDuration(src: string): number;\n\n /** An image's intrinsic pixel dimensions. */\n getImageSize(src: string): { width: number; height: number };\n}\n\n/**\n * The {@link AssetCatalog} the runtime builds: a query engine over a static\n * {@link AssetManifest}.\n *\n * @example\n * ```ts\n * const catalog = new ManifestAssetCatalog(manifest);\n * catalog.getImageSize(\"hero-banner.png\"); // { width: 1920, height: 1080 }\n * ```\n */\nexport class ManifestAssetCatalog implements AssetCatalog {\n constructor(private manifest: AssetManifest) { }\n\n /**\n * Point this catalog at `manifest`, in place.\n *\n * A session hands one catalog to the controller, the clip store and every\n * node's `assets`, so replacing the catalog object would leave all of them on\n * the old one. Reconciling the manifest it reads keeps a manifest change\n * visible to everything already built.\n */\n reconcile(manifest: AssetManifest): void {\n this.manifest = manifest;\n }\n\n /**\n * Normalize a caller-supplied asset `src` into the manifest's lookup key.\n * The manifest stores image/video/audio keys as the file's path relative\n * to the scanned public folder, using forward slashes with no leading\n * `./` or `/`.\n * Scene authors write `src` in whichever equivalent form is natural — a\n * bare filename, `\"./sub/file.png\"`, `\"/sub/file.png\"`, or a\n * Windows-authored backslash path — so normalize all of them to the same\n * key. Font lookups are keyed by `family@weight`, not a path, so they\n * don't go through this.\n */\n private normalizeKey(src: string): string {\n return src.replace(/\\\\/g, '/').replace(/^\\.\\//, '').replace(/^\\/+/, '');\n }\n\n getImageMeta(src: string): ImageMeta {\n const meta = this.manifest.image[this.normalizeKey(src)];\n if (!meta) throw new Error(`Image asset not found: \"${src}\". Check the file exists in your public folder and the src matches its filename.`);\n return meta;\n }\n\n getVideoMeta(src: string): VideoMeta {\n const meta = this.manifest.video[this.normalizeKey(src)];\n if (!meta) throw new Error(`Video asset not found: \"${src}\". Check the file exists in your public folder and the src matches its filename.`);\n return meta;\n }\n\n getAudioMeta(src: string): AudioMeta {\n const meta = this.manifest.audio[this.normalizeKey(src)];\n if (!meta) throw new Error(`No audio metadata for src: ${src}`);\n return meta;\n }\n\n getFontMeta(key: string): FontMeta {\n const meta = this.manifest.font[key];\n if (!meta) throw new Error(`No font metadata for key: ${key}`);\n return meta;\n }\n\n getFontFamilyMetas(fontFamily: string): FontMeta[] {\n return Object.values(this.manifest.font).filter(meta => meta.fontFamily === fontFamily);\n }\n\n getVideoDuration(src: string): number {\n return this.getVideoMeta(src).duration;\n }\n\n getAudioDuration(src: string): number {\n return this.getAudioMeta(src).duration;\n }\n\n getMediaDuration(src: string): number {\n const key = this.normalizeKey(src);\n const audio = this.manifest.audio[key];\n if (audio) return audio.duration;\n const video = this.manifest.video[key];\n if (video) return video.duration;\n throw new Error(`Audio asset not found: \"${src}\". Check the file exists in your public folder and the src matches its filename.`);\n }\n\n getImageSize(src: string): { width: number; height: number } {\n const { width, height } = this.getImageMeta(src);\n return { width, height };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/assets/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACjC,SAAS,CAAY;IACrB,GAAG,CAAS;IACrB,6EAA6E;IAC7E,MAAM,CAAU;IAEhB,YAAY,SAAoB,EAAE,GAAW,EAAE,IAAa;QACxD,KAAK,CAAC,GAAG,SAAS,WAAW,GAAG,mBAAmB,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAED,sFAAsF;AACtF,SAAS,WAAW,CAAC,SAAoB;IACrC,IAAI,SAAS,KAAK,OAAO;QAAE,OAAO,yGAAyG,CAAC;IAC5I,OAAO,2DAA2D,SAAS,iEAAiE,CAAC;AACjJ,CAAC","sourcesContent":["import type { AssetType } from \"./record\";\r\n\r\n/**\r\n * A frame reached for an asset that was never loaded.\r\n *\r\n * This is the counterweight to declared asset tracking. A node states what it\r\n * needs from `Node.declareAssets`; if it\r\n * misses something, the renderer finds nothing when it goes to paint. The old\r\n * inference pass could not really get this wrong — it discovered assets *from*\r\n * the draw calls, so anything drawn was by construction requested — and the\r\n * fills were written to match: a missing decode returned `false` and the layer\r\n * was quietly skipped.\r\n *\r\n * Under declarations that leniency is the wrong default. A skipped layer is a\r\n * frame that renders *almost* right, with a photo missing or a heading in the\r\n * fallback face, on a node that may only appear seconds in and only on a cold\r\n * load. Throwing turns a silent visual gap into a located failure: during precomp\r\n * it is caught per scene and surfaces as a `BuildError` in the errors panel, and\r\n * at playback it stops the frame rather than shipping a wrong one.\r\n *\r\n * It means \"declared but not loaded, or never declared\". It deliberately does\r\n * **not** cover a *time-varying* miss — a video frame the decode window has not\r\n * reached yet is an asset that loaded fine, and `warmPendingVideo` already exists\r\n * to settle those; those paths still paint the nearest decoded frame.\r\n */\r\nexport class AssetNotLoadedError extends Error {\r\n readonly assetType: AssetType;\r\n readonly src: string;\r\n /** The innermost drawing node, stamped by `Node2D.render` on the way out. */\r\n nodeId?: string;\r\n\r\n constructor(assetType: AssetType, src: string, hint?: string) {\r\n super(`${assetType} asset \"${src}\" is not loaded. ` + (hint ?? declareHint(assetType)));\r\n this.name = \"AssetNotLoadedError\";\r\n this.assetType = assetType;\r\n this.src = src;\r\n }\r\n}\r\n\r\n/** How to declare an asset of `assetType`: the scope method, or a command's sound. */\r\nfunction declareHint(assetType: AssetType): string {\r\n if (assetType === \"audio\") return \"Play it from a command (`timeline.sound(...)`), so the asset timeline loads it before this frame draws.\";\r\n return `Declare it from the node's declareAssets() (e.g. assets.${assetType}(...)), so the asset timeline loads it before this frame draws.`;\r\n}\r\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/assets/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACjC,SAAS,CAAY;IACrB,GAAG,CAAS;IACrB,6EAA6E;IAC7E,MAAM,CAAU;IAEhB,YAAY,SAAoB,EAAE,GAAW,EAAE,IAAa;QACxD,KAAK,CAAC,GAAG,SAAS,WAAW,GAAG,mBAAmB,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAED,sFAAsF;AACtF,SAAS,WAAW,CAAC,SAAoB;IACrC,IAAI,SAAS,KAAK,OAAO;QAAE,OAAO,yGAAyG,CAAC;IAC5I,OAAO,2DAA2D,SAAS,iEAAiE,CAAC;AACjJ,CAAC","sourcesContent":["import type { AssetType } from \"./record\";\n\n/**\n * A frame reached for an asset that was never loaded.\n *\n * This is the counterweight to declared asset tracking. A node states what it\n * needs from `Node.declareAssets`; if it\n * misses something, the renderer finds nothing when it goes to paint. The old\n * inference pass could not really get this wrong — it discovered assets *from*\n * the draw calls, so anything drawn was by construction requested — and the\n * fills were written to match: a missing decode returned `false` and the layer\n * was quietly skipped.\n *\n * Under declarations that leniency is the wrong default. A skipped layer is a\n * frame that renders *almost* right, with a photo missing or a heading in the\n * fallback face, on a node that may only appear seconds in and only on a cold\n * load. Throwing turns a silent visual gap into a located failure: during precomp\n * it is caught per scene and surfaces as a `BuildError` in the errors panel, and\n * at playback it stops the frame rather than shipping a wrong one.\n *\n * It means \"declared but not loaded, or never declared\". It deliberately does\n * **not** cover a *time-varying* miss — a video frame the decode window has not\n * reached yet is an asset that loaded fine, and `warmPendingVideo` already exists\n * to settle those; those paths still paint the nearest decoded frame.\n */\nexport class AssetNotLoadedError extends Error {\n readonly assetType: AssetType;\n readonly src: string;\n /** The innermost drawing node, stamped by `Node2D.render` on the way out. */\n nodeId?: string;\n\n constructor(assetType: AssetType, src: string, hint?: string) {\n super(`${assetType} asset \"${src}\" is not loaded. ` + (hint ?? declareHint(assetType)));\n this.name = \"AssetNotLoadedError\";\n this.assetType = assetType;\n this.src = src;\n }\n}\n\n/** How to declare an asset of `assetType`: the scope method, or a command's sound. */\nfunction declareHint(assetType: AssetType): string {\n if (assetType === \"audio\") return \"Play it from a command (`timeline.sound(...)`), so the asset timeline loads it before this frame draws.\";\n return `Declare it from the node's declareAssets() (e.g. assets.${assetType}(...)), so the asset timeline loads it before this frame draws.`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AACA,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAGlE,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK5D,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/** @internal */ export type { AssetCatalog } from \"./catalog\";\r\n/** @internal */ export { ManifestAssetCatalog } from \"./catalog\";\r\n/** @internal */ export type { ImageMeta, VideoMeta, AudioMeta, FontMeta, AssetMeta, AssetManifest } from \"./manifest\";\r\nexport type { AssetScope, AssetDecl, AssetGate } from \"./scope\";\r\n/** @internal */ export { AssetDeclaration } from \"./scope\";\r\n// `AssetRecord` joins these because `StorageAdapter.loadAsset` takes one on an\r\n// exported abstract class — a subclass outside this package could not otherwise\r\n// name the parameter type it is obliged to accept.\r\n/** @internal */ export type { LoaderFn, Disposer, AssetRecord } from \"./record\";\r\n/** @internal */ export { AssetNotLoadedError } from \"./errors\";\r\n/** @internal */ export { AssetManager } from \"./manager\";"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AACA,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAGlE,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK5D,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/** @internal */ export type { AssetCatalog } from \"./catalog\";\n/** @internal */ export { ManifestAssetCatalog } from \"./catalog\";\n/** @internal */ export type { ImageMeta, VideoMeta, AudioMeta, FontMeta, AssetMeta, AssetManifest } from \"./manifest\";\nexport type { AssetScope, AssetDecl, AssetGate } from \"./scope\";\n/** @internal */ export { AssetDeclaration } from \"./scope\";\n// `AssetRecord` joins these because `StorageAdapter.loadAsset` takes one on an\n// exported abstract class — a subclass outside this package could not otherwise\n// name the parameter type it is obliged to accept.\n/** @internal */ export type { LoaderFn, Disposer, AssetRecord } from \"./record\";\n/** @internal */ export { AssetNotLoadedError } from \"./errors\";\n/** @internal */ export { AssetManager } from \"./manager\";"]}
@@ -1 +1 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/assets/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM9D;;;GAGG;AACH,MAAM,OAAO,YAAY;IAuCA;IAtCb,OAAO,CAAsB;IACpB,cAAc,CAAiB;IAC/B,WAAW,CAAY;IAExC,sFAAsF;IAC9E,mBAAmB,GAAkB,EAAE,CAAC;IACxC,aAAa,GAA+B,IAAI,GAAG,EAAE,CAAC;IACtD,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IACzD;;;;;;;OAOG;IACK,WAAW,GAAG,IAAI,GAAG,EAAmB,CAAC;IACjD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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,YAAY,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AAChV,CAAC;AAED,yDAAyD;AACzD,SAAS,MAAM,CAAC,GAAwB;IACpC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,OAAO,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,0FAA0F;AAC1F,SAAS,cAAc,CAAC,IAA6B;IACjD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,sEAAsE;AACtE,SAAS,SAAS,CAAC,CAAsB,EAAE,CAAsB;IAC7D,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC;QAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { AudioRequest, busStopKey } from \"@/attributes/audio/request\";\r\nimport { effectsKey } from \"@/attributes/audio/effects/union\";\r\nimport { paramKey } from \"@/attributes/audio/ramp\";\r\nimport { transitionKey } from \"@/attributes/audio/transition\";\r\nimport { AssetRecord, Disposer, LoaderFn } from \"@/assets/record\";\r\nimport { AudioSink } from \"@/platform/audio-sink\";\r\nimport { StorageAdapter } from \"@/platform/storage-adapter\";\r\nimport { AssetTrack, AssetTimelineResult } from \"@/runtime/asset-timeline\";\r\n\r\n/**\r\n * Coordinates asset loading and audio synchronization during playback.\r\n * Wraps a {@link AssetTimelineResult} and delegates storage/audio work to platform adapters.\r\n */\r\nexport class AssetManager {\r\n private precomp: AssetTimelineResult;\r\n private readonly storageAdapter: StorageAdapter;\r\n private readonly audioDevice: AudioSink;\r\n\r\n /** `null` after a swap: whatever the device holds belongs to the previous precomp. */\r\n private lastAudioRequestKey: string | null = \"\";\r\n private lastAudioSrcs: ReadonlySet<string> | null = new Set();\r\n private audioFetching = new Map<string, Promise<void>>();\r\n /**\r\n * Sources whose fetch or decode failed, with why, so they are not fetched\r\n * again every sync. A source leaves when no request in the window names it\r\n * any more — and, once it has been reported, when a new precomp arrives —\r\n * so the next time it is wanted it is tried afresh. One that failed quietly\r\n * (see {@link AudioRequest.optional}) is kept across a precomp: a video with\r\n * no audio track would otherwise be fetched whole on every edit.\r\n */\r\n private audioFailed = new Map<string, unknown>();\r\n /** The failed sources already reported to {@link onError}. */\r\n private audioReported = new Set<string>();\r\n /** Sources a request in the last window asked for by name, not as a picture's own sound. */\r\n private audioRequired: ReadonlySet<string> = new Set();\r\n /** Keys of the loaders a track measures against, which no window may evict. */\r\n private layoutGateKeys: ReadonlySet<string>;\r\n private disposed = false;\r\n\r\n /** Disposers for loaders whose load has resolved, keyed by loader key. */\r\n private loaderDisposers = new Map<string, Disposer>();\r\n /** In-flight loader runs, keyed by loader key, to dedupe concurrent calls. */\r\n private loaderInFlight = new Map<string, Promise<void>>();\r\n\r\n /**\r\n * @param onError Told once per source when audio a request asked for cannot\r\n * be fetched or decoded. Defaults to `console.error`.\r\n */\r\n constructor(\r\n precomp: AssetTimelineResult,\r\n storageAdapter: StorageAdapter,\r\n audioDevice: AudioSink,\r\n private readonly onError: (error: Error) => void = (error) => console.error(`[AssetManager] ${error.message}`),\r\n ) {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n this.storageAdapter = storageAdapter;\r\n this.audioDevice = audioDevice;\r\n }\r\n\r\n // ─── Public surface ───────────────────────────────────────────────────────\r\n\r\n /**\r\n * Swap in a new precomp result (a document swap). The manager keeps its\r\n * warm loader disposers and in-flight audio fetches so a single-track edit\r\n * doesn't re-fetch unchanged assets; the next loadAt/syncAudio picks up the\r\n * new asset windows. Resetting the audio signature forces a reschedule so a\r\n * changed track's audio is re-evaluated against the new timeline — including\r\n * into an empty window, which is how removed audio stops.\r\n */\r\n setPrecomp(precomp: AssetTimelineResult): void {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n for (const src of this.audioReported) this.audioFailed.delete(src);\r\n this.audioReported.clear();\r\n this.lastAudioRequestKey = null;\r\n this.lastAudioSrcs = null;\r\n }\r\n\r\n /**\r\n * Blocking load for seek and initial render. Waits for every asset whose\r\n * cacheAt <= frame and endFrame >= frame to be ready, then schedules audio.\r\n */\r\n async loadAt(frame: number): Promise<void> {\r\n const jobs: Promise<void>[] = [];\r\n\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n const job = this.syncLoader(key, track, frame);\r\n if (job) jobs.push(job);\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n jobs.push(this.storageAdapter.loadAsset(key, track.record));\r\n }\r\n }\r\n\r\n await Promise.all(jobs);\r\n if (this.audioDevice.schedulesAudio) this.syncAudio(frame);\r\n }\r\n\r\n /** Whether `key` — a loader key or a stored asset's — is resident now. */\r\n isReady(key: string): boolean {\r\n return this.loaderDisposers.has(key) || this.storageAdapter.isLoaded(key);\r\n }\r\n\r\n /**\r\n * Load `records` whatever their windows say — for layout gates, which must be\r\n * resident before a track measures regardless of the frame being drawn.\r\n */\r\n async loadRecords(records: readonly AssetRecord[]): Promise<void> {\r\n await Promise.all(records.map((record) => record.type === 'loader'\r\n ? this.runLoader(record.src, record.load)\r\n : this.storageAdapter.loadAsset(record.src, record)));\r\n }\r\n\r\n /**\r\n * Non-blocking incremental prefetch called after each render tick. Fires\r\n * loads for assets whose cacheAt window has been reached without blocking.\r\n */\r\n prefetch(frame: number): void {\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n this.syncLoader(key, track, frame)?.catch(err => {\r\n console.error(`[AssetManager] loader failed for ${key}:`, err);\r\n });\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n this.storageAdapter.loadAsset(key, track.record).catch(err => {\r\n console.error(`[AssetManager] prefetch failed for ${key}:`, err);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Drive a single loader track toward the state `frame` requires. If `frame`\r\n * is inside the loader's `[cacheAt, discardAt]` window, run its callback\r\n * (deduped — at most one in-flight run, skipped once loaded) and return the\r\n * pending job, if any. If `frame` is outside the window and the loader was\r\n * loaded, dispose it. Returns the in-flight load promise so a blocking\r\n * caller can await it; `undefined` when there's nothing to wait for.\r\n */\r\n private syncLoader(key: string, track: AssetTrack, frame: number): Promise<void> | undefined {\r\n if (track.record.type !== 'loader') return undefined;\r\n const discardAt = track.discardAt ?? Infinity;\r\n const inWindow = track.cacheAt <= frame && frame <= discardAt;\r\n\r\n if (!inWindow) {\r\n // A layout gate is loaded by `loadRecords` whatever frame is drawn, so\r\n // its window says nothing about when it may go: disposing it here made\r\n // `isReady` false and the next frame load it again.\r\n if (this.layoutGateKeys.has(key)) return undefined;\r\n const dispose = this.loaderDisposers.get(key);\r\n if (dispose) {\r\n this.loaderDisposers.delete(key);\r\n dispose();\r\n }\r\n return undefined;\r\n }\r\n\r\n return this.runLoader(key, track.record.load);\r\n }\r\n\r\n /** Run a loader unless it is resident or already running. */\r\n private runLoader(key: string, load: LoaderFn): Promise<void> | undefined {\r\n // Already loaded for this window, or a run is already in flight.\r\n if (this.loaderDisposers.has(key)) return undefined;\r\n const existing = this.loaderInFlight.get(key);\r\n if (existing) return existing;\r\n\r\n const job = load()\r\n .then(disposer => {\r\n // A loader that resolves nothing is keeping its result resident on\r\n // purpose (see `LoaderFn`). Recording a no-op disposer rather than\r\n // skipping the entry is what keeps `loaderDisposers.has(key)` the\r\n // single \"already loaded\" test for both kinds.\r\n this.loaderDisposers.set(key, disposer ?? NO_DISPOSE);\r\n })\r\n .finally(() => {\r\n this.loaderInFlight.delete(key);\r\n });\r\n this.loaderInFlight.set(key, job);\r\n return job;\r\n }\r\n\r\n /** Run every outstanding loader disposer and clear loader state. */\r\n dispose(): void {\r\n for (const dispose of this.loaderDisposers.values()) dispose();\r\n this.loaderDisposers.clear();\r\n this.loaderInFlight.clear();\r\n this.disposed = true;\r\n }\r\n\r\n /**\r\n * Push the current audio working set to the AudioSink. Called after each\r\n * render tick so the device stays in sync with the tracks' audio requests.\r\n */\r\n syncAudio(frame: number): void {\r\n const currentTime = frame / this.precomp.fps;\r\n\r\n const inWindow: AudioRequest[] = [];\r\n const srcs = new Set<string>();\r\n const required = new Set<string>();\r\n const seen = new Set<string>();\r\n\r\n /** Admit `req` if it overlaps the scheduling window, shifted by its owner's offset. */\r\n const consider = (req: AudioRequest, offsetSecs: number): void => {\r\n const globalStart = offsetSecs + req.startAt;\r\n const globalEnd = offsetSecs + req.endAt;\r\n\r\n if (globalEnd < currentTime || globalStart > currentTime + 10) return;\r\n // Ahead of the dedupe: the flag is not part of a request's identity.\r\n if (!req.optional) required.add(req.src);\r\n\r\n const stableId = stableKey(req, offsetSecs);\r\n if (seen.has(stableId)) return;\r\n seen.add(stableId);\r\n\r\n inWindow.push({\r\n ...req,\r\n id: stableId,\r\n startAt: globalStart,\r\n endAt: globalEnd,\r\n // A bus's span is in its request's seconds, so it moves with it.\r\n ...(req.bus && {\r\n bus: req.bus.map((s) => ({ ...s, startAt: offsetSecs + s.startAt, endAt: offsetSecs + s.endAt })),\r\n }),\r\n });\r\n srcs.add(req.src);\r\n };\r\n\r\n for (const track of this.precomp.tracks) {\r\n const offsetSecs = track.startFrame / this.precomp.fps;\r\n for (const req of track.audioRequests) consider(req, offsetSecs);\r\n }\r\n\r\n this.audioRequired = required;\r\n for (const src of srcs) {\r\n if (!this.audioDevice.has(src) && !this.audioFetching.has(src) && !this.audioFailed.has(src)) {\r\n const job = this.storageAdapter.fetchAudioData(src)\r\n .then(data => this.audioDevice.append(src, data))\r\n .catch(cause => this.failAudio(src, cause))\r\n .finally(() => this.audioFetching.delete(src));\r\n this.audioFetching.set(src, job);\r\n }\r\n }\r\n // A failed source nothing asks for any more is forgotten, so wanting it\r\n // again later tries it afresh; one that failed quietly is reported when\r\n // a request that asks for its sound arrives.\r\n for (const [src, cause] of this.audioFailed) {\r\n if (!srcs.has(src)) {\r\n this.audioFailed.delete(src);\r\n this.audioReported.delete(src);\r\n } else if (required.has(src)) {\r\n this.reportAudio(src, cause);\r\n }\r\n }\r\n\r\n const requestKey = audioSignature(inWindow);\r\n if (requestKey !== this.lastAudioRequestKey) {\r\n this.audioDevice.schedule(inWindow);\r\n this.lastAudioRequestKey = requestKey;\r\n }\r\n if (this.lastAudioSrcs === null || !setsEqual(this.lastAudioSrcs, srcs)) {\r\n this.audioDevice.retain(srcs);\r\n this.lastAudioSrcs = srcs;\r\n }\r\n }\r\n\r\n /** Record that `src` could not be loaded, and say so if a request asked for its sound. */\r\n private failAudio(src: string, cause: unknown): void {\r\n if (this.disposed) return;\r\n this.audioFailed.set(src, cause);\r\n if (this.audioRequired.has(src)) this.reportAudio(src, cause);\r\n }\r\n\r\n /** Say that `src` could not be loaded, once, until it is wanted afresh. */\r\n private reportAudio(src: string, cause: unknown): void {\r\n if (this.audioReported.has(src)) return;\r\n this.audioReported.add(src);\r\n const message = cause instanceof Error ? cause.message : String(cause);\r\n this.onError(new Error(`audio \"${src}\" could not be loaded: ${message}`, { cause }));\r\n }\r\n}\r\n\r\n// ─── Helpers ──────────────────────────────────────────────────────────────────\r\n\r\n/** Every layout-gate key any track of `precomp` declares. */\r\nfunction layoutGatesOf(precomp: AssetTimelineResult): ReadonlySet<string> {\r\n const keys = new Set<string>();\r\n for (const track of precomp.tracks) for (const key of track.layoutGates ?? []) keys.add(key);\r\n return keys;\r\n}\r\n\r\n/** Stand-in for a loader that resolved nothing — see the note in {@link AssetManager.syncLoader}. */\r\nconst NO_DISPOSE: Disposer = () => { };\r\n\r\n/**\r\n * Produce a deterministic string key that uniquely identifies an audio request's\r\n * playback identity. Includes the effect chain, the ramps and the transitions so\r\n * editing any of them changes the id — the device then stops the stale source and\r\n * rebuilds the graph instead of reusing the old one.\r\n *\r\n * The bus chain is in for the same reason: re-routing a clip to a different bus,\r\n * or changing a bus's level or its span, changes what it sounds like without\r\n * changing anything else here — so leaving it out would keep the stale graph.\r\n */\r\nfunction stableKey(req: AudioRequest, clipOffsetSecs: number): string {\r\n return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? \"_\"}|${req.loop ? 1 : 0}|${paramKey(req.volume)}|${paramKey(req.speed)}|${req.sourceLength ?? \"_\"}|${effectsKey(req.effects)}|${transitionKey(req.transitionIn)}|${transitionKey(req.transitionOut)}|${busKey(req.bus)}`;\r\n}\r\n\r\n/** The bus chain's contribution to {@link stableKey}. */\r\nfunction busKey(bus: AudioRequest[\"bus\"]): string {\r\n if (!bus || bus.length === 0) return \"\";\r\n return bus.map(busStopKey).join(\">\");\r\n}\r\n\r\n/** Produce a stable hash of the active audio request set to detect scheduling changes. */\r\nfunction audioSignature(reqs: readonly AudioRequest[]): string {\r\n if (reqs.length === 0) return \"\";\r\n return reqs.map(r => r.id).sort().join(\"\\n\");\r\n}\r\n\r\n/** Shallow equality check for two string sets (order-independent). */\r\nfunction setsEqual(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\r\n if (a.size !== b.size) return false;\r\n for (const v of a) if (!b.has(v)) return false;\r\n return true;\r\n}\r\n"]}
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/assets/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM9D;;;GAGG;AACH,MAAM,OAAO,YAAY;IAuCA;IAtCb,OAAO,CAAsB;IACpB,cAAc,CAAiB;IAC/B,WAAW,CAAY;IAExC,sFAAsF;IAC9E,mBAAmB,GAAkB,EAAE,CAAC;IACxC,aAAa,GAA+B,IAAI,GAAG,EAAE,CAAC;IACtD,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IACzD;;;;;;;OAOG;IACK,WAAW,GAAG,IAAI,GAAG,EAAmB,CAAC;IACjD,8DAA8D;IACtD,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAC1C,4FAA4F;IACpF,aAAa,GAAwB,IAAI,GAAG,EAAE,CAAC;IACvD,+EAA+E;IACvE,cAAc,CAAsB;IACpC,QAAQ,GAAG,KAAK,CAAC;IAEzB,0EAA0E;IAClE,eAAe,GAAG,IAAI,GAAG,EAAoB,CAAC;IACtD,8EAA8E;IACtE,cAAc,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE1D;;;OAGG;IACH,YACI,OAA4B,EAC5B,cAA8B,EAC9B,WAAsB,EACL,UAAkC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC;QAA7F,YAAO,GAAP,OAAO,CAAsF;QAE9G,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC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1F,SAAS,cAAc,CAAC,IAA6B;IACjD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,sEAAsE;AACtE,SAAS,SAAS,CAAC,CAAsB,EAAE,CAAsB;IAC7D,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC;QAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { AudioRequest, busStopKey } from \"@/attributes/audio/request\";\nimport { effectsKey } from \"@/attributes/audio/effects/union\";\nimport { paramKey } from \"@/attributes/audio/ramp\";\nimport { transitionKey } from \"@/attributes/audio/transition\";\nimport { AssetRecord, Disposer, LoaderFn } from \"@/assets/record\";\nimport { AudioSink } from \"@/platform/audio-sink\";\nimport { StorageAdapter } from \"@/platform/storage-adapter\";\nimport { AssetTrack, AssetTimelineResult } from \"@/runtime/asset-timeline\";\n\n/**\n * Coordinates asset loading and audio synchronization during playback.\n * Wraps a {@link AssetTimelineResult} and delegates storage/audio work to platform adapters.\n */\nexport class AssetManager {\n private precomp: AssetTimelineResult;\n private readonly storageAdapter: StorageAdapter;\n private readonly audioDevice: AudioSink;\n\n /** `null` after a swap: whatever the device holds belongs to the previous precomp. */\n private lastAudioRequestKey: string | null = \"\";\n private lastAudioSrcs: ReadonlySet<string> | null = new Set();\n private audioFetching = new Map<string, Promise<void>>();\n /**\n * Sources whose fetch or decode failed, with why, so they are not fetched\n * again every sync. A source leaves when no request in the window names it\n * any more — and, once it has been reported, when a new precomp arrives —\n * so the next time it is wanted it is tried afresh. One that failed quietly\n * (see {@link AudioRequest.optional}) is kept across a precomp: a video with\n * no audio track would otherwise be fetched whole on every edit.\n */\n private audioFailed = new Map<string, unknown>();\n /** The failed sources already reported to {@link onError}. */\n private audioReported = new Set<string>();\n /** Sources a request in the last window asked for by name, not as a picture's own sound. */\n private audioRequired: ReadonlySet<string> = new Set();\n /** Keys of the loaders a track measures against, which no window may evict. */\n private layoutGateKeys: ReadonlySet<string>;\n private disposed = false;\n\n /** Disposers for loaders whose load has resolved, keyed by loader key. */\n private loaderDisposers = new Map<string, Disposer>();\n /** In-flight loader runs, keyed by loader key, to dedupe concurrent calls. */\n private loaderInFlight = new Map<string, Promise<void>>();\n\n /**\n * @param onError Told once per source when audio a request asked for cannot\n * be fetched or decoded. Defaults to `console.error`.\n */\n constructor(\n precomp: AssetTimelineResult,\n storageAdapter: StorageAdapter,\n audioDevice: AudioSink,\n private readonly onError: (error: Error) => void = (error) => console.error(`[AssetManager] ${error.message}`),\n ) {\n this.precomp = precomp;\n this.layoutGateKeys = layoutGatesOf(precomp);\n this.storageAdapter = storageAdapter;\n this.audioDevice = audioDevice;\n }\n\n // ─── Public surface ───────────────────────────────────────────────────────\n\n /**\n * Swap in a new precomp result (a document swap). The manager keeps its\n * warm loader disposers and in-flight audio fetches so a single-track edit\n * doesn't re-fetch unchanged assets; the next loadAt/syncAudio picks up the\n * new asset windows. Resetting the audio signature forces a reschedule so a\n * changed track's audio is re-evaluated against the new timeline — including\n * into an empty window, which is how removed audio stops.\n */\n setPrecomp(precomp: AssetTimelineResult): void {\n this.precomp = precomp;\n this.layoutGateKeys = layoutGatesOf(precomp);\n for (const src of this.audioReported) this.audioFailed.delete(src);\n this.audioReported.clear();\n this.lastAudioRequestKey = null;\n this.lastAudioSrcs = null;\n }\n\n /**\n * Blocking load for seek and initial render. Waits for every asset whose\n * cacheAt <= frame and endFrame >= frame to be ready, then schedules audio.\n */\n async loadAt(frame: number): Promise<void> {\n const jobs: Promise<void>[] = [];\n\n for (const [key, track] of this.precomp.assets) {\n if (track.record.type === 'loader') {\n const job = this.syncLoader(key, track, frame);\n if (job) jobs.push(job);\n continue;\n }\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\n jobs.push(this.storageAdapter.loadAsset(key, track.record));\n }\n }\n\n await Promise.all(jobs);\n if (this.audioDevice.schedulesAudio) this.syncAudio(frame);\n }\n\n /** Whether `key` — a loader key or a stored asset's — is resident now. */\n isReady(key: string): boolean {\n return this.loaderDisposers.has(key) || this.storageAdapter.isLoaded(key);\n }\n\n /**\n * Load `records` whatever their windows say — for layout gates, which must be\n * resident before a track measures regardless of the frame being drawn.\n */\n async loadRecords(records: readonly AssetRecord[]): Promise<void> {\n await Promise.all(records.map((record) => record.type === 'loader'\n ? this.runLoader(record.src, record.load)\n : this.storageAdapter.loadAsset(record.src, record)));\n }\n\n /**\n * Non-blocking incremental prefetch called after each render tick. Fires\n * loads for assets whose cacheAt window has been reached without blocking.\n */\n prefetch(frame: number): void {\n for (const [key, track] of this.precomp.assets) {\n if (track.record.type === 'loader') {\n this.syncLoader(key, track, frame)?.catch(err => {\n console.error(`[AssetManager] loader failed for ${key}:`, err);\n });\n continue;\n }\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\n this.storageAdapter.loadAsset(key, track.record).catch(err => {\n console.error(`[AssetManager] prefetch failed for ${key}:`, err);\n });\n }\n }\n }\n\n /**\n * Drive a single loader track toward the state `frame` requires. If `frame`\n * is inside the loader's `[cacheAt, discardAt]` window, run its callback\n * (deduped — at most one in-flight run, skipped once loaded) and return the\n * pending job, if any. If `frame` is outside the window and the loader was\n * loaded, dispose it. Returns the in-flight load promise so a blocking\n * caller can await it; `undefined` when there's nothing to wait for.\n */\n private syncLoader(key: string, track: AssetTrack, frame: number): Promise<void> | undefined {\n if (track.record.type !== 'loader') return undefined;\n const discardAt = track.discardAt ?? Infinity;\n const inWindow = track.cacheAt <= frame && frame <= discardAt;\n\n if (!inWindow) {\n // A layout gate is loaded by `loadRecords` whatever frame is drawn, so\n // its window says nothing about when it may go: disposing it here made\n // `isReady` false and the next frame load it again.\n if (this.layoutGateKeys.has(key)) return undefined;\n const dispose = this.loaderDisposers.get(key);\n if (dispose) {\n this.loaderDisposers.delete(key);\n dispose();\n }\n return undefined;\n }\n\n return this.runLoader(key, track.record.load);\n }\n\n /** Run a loader unless it is resident or already running. */\n private runLoader(key: string, load: LoaderFn): Promise<void> | undefined {\n // Already loaded for this window, or a run is already in flight.\n if (this.loaderDisposers.has(key)) return undefined;\n const existing = this.loaderInFlight.get(key);\n if (existing) return existing;\n\n const job = load()\n .then(disposer => {\n // A loader that resolves nothing is keeping its result resident on\n // purpose (see `LoaderFn`). Recording a no-op disposer rather than\n // skipping the entry is what keeps `loaderDisposers.has(key)` the\n // single \"already loaded\" test for both kinds.\n this.loaderDisposers.set(key, disposer ?? NO_DISPOSE);\n })\n .finally(() => {\n this.loaderInFlight.delete(key);\n });\n this.loaderInFlight.set(key, job);\n return job;\n }\n\n /** Run every outstanding loader disposer and clear loader state. */\n dispose(): void {\n for (const dispose of this.loaderDisposers.values()) dispose();\n this.loaderDisposers.clear();\n this.loaderInFlight.clear();\n this.disposed = true;\n }\n\n /**\n * Push the current audio working set to the AudioSink. Called after each\n * render tick so the device stays in sync with the tracks' audio requests.\n */\n syncAudio(frame: number): void {\n const currentTime = frame / this.precomp.fps;\n\n const inWindow: AudioRequest[] = [];\n const srcs = new Set<string>();\n const required = new Set<string>();\n const seen = new Set<string>();\n\n /** Admit `req` if it overlaps the scheduling window, shifted by its owner's offset. */\n const consider = (req: AudioRequest, offsetSecs: number): void => {\n const globalStart = offsetSecs + req.startAt;\n const globalEnd = offsetSecs + req.endAt;\n\n if (globalEnd < currentTime || globalStart > currentTime + 10) return;\n // Ahead of the dedupe: the flag is not part of a request's identity.\n if (!req.optional) required.add(req.src);\n\n const stableId = stableKey(req, offsetSecs);\n if (seen.has(stableId)) return;\n seen.add(stableId);\n\n inWindow.push({\n ...req,\n id: stableId,\n startAt: globalStart,\n endAt: globalEnd,\n // A bus's span is in its request's seconds, so it moves with it.\n ...(req.bus && {\n bus: req.bus.map((s) => ({ ...s, startAt: offsetSecs + s.startAt, endAt: offsetSecs + s.endAt })),\n }),\n });\n srcs.add(req.src);\n };\n\n for (const track of this.precomp.tracks) {\n const offsetSecs = track.startFrame / this.precomp.fps;\n for (const req of track.audioRequests) consider(req, offsetSecs);\n }\n\n this.audioRequired = required;\n for (const src of srcs) {\n if (!this.audioDevice.has(src) && !this.audioFetching.has(src) && !this.audioFailed.has(src)) {\n const job = this.storageAdapter.fetchAudioData(src)\n .then(data => this.audioDevice.append(src, data))\n .catch(cause => this.failAudio(src, cause))\n .finally(() => this.audioFetching.delete(src));\n this.audioFetching.set(src, job);\n }\n }\n // A failed source nothing asks for any more is forgotten, so wanting it\n // again later tries it afresh; one that failed quietly is reported when\n // a request that asks for its sound arrives.\n for (const [src, cause] of this.audioFailed) {\n if (!srcs.has(src)) {\n this.audioFailed.delete(src);\n this.audioReported.delete(src);\n } else if (required.has(src)) {\n this.reportAudio(src, cause);\n }\n }\n\n const requestKey = audioSignature(inWindow);\n if (requestKey !== this.lastAudioRequestKey) {\n this.audioDevice.schedule(inWindow);\n this.lastAudioRequestKey = requestKey;\n }\n if (this.lastAudioSrcs === null || !setsEqual(this.lastAudioSrcs, srcs)) {\n this.audioDevice.retain(srcs);\n this.lastAudioSrcs = srcs;\n }\n }\n\n /** Record that `src` could not be loaded, and say so if a request asked for its sound. */\n private failAudio(src: string, cause: unknown): void {\n if (this.disposed) return;\n this.audioFailed.set(src, cause);\n if (this.audioRequired.has(src)) this.reportAudio(src, cause);\n }\n\n /** Say that `src` could not be loaded, once, until it is wanted afresh. */\n private reportAudio(src: string, cause: unknown): void {\n if (this.audioReported.has(src)) return;\n this.audioReported.add(src);\n const message = cause instanceof Error ? cause.message : String(cause);\n this.onError(new Error(`audio \"${src}\" could not be loaded: ${message}`, { cause }));\n }\n}\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\n/** Every layout-gate key any track of `precomp` declares. */\nfunction layoutGatesOf(precomp: AssetTimelineResult): ReadonlySet<string> {\n const keys = new Set<string>();\n for (const track of precomp.tracks) for (const key of track.layoutGates ?? []) keys.add(key);\n return keys;\n}\n\n/** Stand-in for a loader that resolved nothing — see the note in {@link AssetManager.syncLoader}. */\nconst NO_DISPOSE: Disposer = () => { };\n\n/**\n * Produce a deterministic string key that uniquely identifies an audio request's\n * playback identity. Includes the effect chain, the ramps and the transitions so\n * editing any of them changes the id — the device then stops the stale source and\n * rebuilds the graph instead of reusing the old one.\n *\n * The bus chain is in for the same reason: re-routing a clip to a different bus,\n * or changing a bus's level or its span, changes what it sounds like without\n * changing anything else here — so leaving it out would keep the stale graph.\n */\nfunction stableKey(req: AudioRequest, clipOffsetSecs: number): string {\n return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? \"_\"}|${req.loop ? 1 : 0}|${paramKey(req.volume)}|${paramKey(req.speed)}|${req.sourceLength ?? \"_\"}|${effectsKey(req.effects)}|${transitionKey(req.transitionIn)}|${transitionKey(req.transitionOut)}|${busKey(req.bus)}`;\n}\n\n/** The bus chain's contribution to {@link stableKey}. */\nfunction busKey(bus: AudioRequest[\"bus\"]): string {\n if (!bus || bus.length === 0) return \"\";\n return bus.map(busStopKey).join(\">\");\n}\n\n/** Produce a stable hash of the active audio request set to detect scheduling changes. */\nfunction audioSignature(reqs: readonly AudioRequest[]): string {\n if (reqs.length === 0) return \"\";\n return reqs.map(r => r.id).sort().join(\"\\n\");\n}\n\n/** Shallow equality check for two string sets (order-independent). */\nfunction setsEqual(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\n if (a.size !== b.size) return false;\n for (const v of a) if (!b.has(v)) return false;\n return true;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/assets/manifest.ts"],"names":[],"mappings":"","sourcesContent":["/** Static metadata for an image asset, captured at build time. */\r\nexport interface ImageMeta {\r\n width: number;\r\n height: number;\r\n sizeBytes: number;\r\n src: string;\r\n}\r\n\r\n/** Static metadata for a video asset, captured at build time. */\r\nexport interface VideoMeta {\r\n width: number;\r\n height: number;\r\n duration: number; // in seconds\r\n sizeBytes: number;\r\n src: string;\r\n}\r\n\r\n/** Static metadata for an audio asset, captured at build time. */\r\nexport interface AudioMeta {\r\n duration: number; // in seconds\r\n sizeBytes: number;\r\n src: string;\r\n}\r\n\r\n/** Static metadata for a font face, captured at build time. */\r\nexport interface FontMeta {\r\n fontFamily: string;\r\n fontWeight: number;\r\n src: string;\r\n sizeBytes: number;\r\n}\r\n\r\n/** Discriminated union of all asset metadata shapes. */\r\nexport type AssetMeta = ImageMeta | VideoMeta | AudioMeta | FontMeta;\r\n\r\n/** Build-time asset manifest keyed by source path (images/videos/audio) or family@weight (fonts). */\r\nexport interface AssetManifest {\r\n image: Record<string, ImageMeta>;\r\n video: Record<string, VideoMeta>;\r\n audio: Record<string, AudioMeta>;\r\n font: Record<string, FontMeta>;\r\n}"]}
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/assets/manifest.ts"],"names":[],"mappings":"","sourcesContent":["/** Static metadata for an image asset, captured at build time. */\nexport interface ImageMeta {\n width: number;\n height: number;\n sizeBytes: number;\n src: string;\n}\n\n/** Static metadata for a video asset, captured at build time. */\nexport interface VideoMeta {\n width: number;\n height: number;\n duration: number; // in seconds\n sizeBytes: number;\n src: string;\n}\n\n/** Static metadata for an audio asset, captured at build time. */\nexport interface AudioMeta {\n duration: number; // in seconds\n sizeBytes: number;\n src: string;\n}\n\n/** Static metadata for a font face, captured at build time. */\nexport interface FontMeta {\n fontFamily: string;\n fontWeight: number;\n src: string;\n sizeBytes: number;\n}\n\n/** Discriminated union of all asset metadata shapes. */\nexport type AssetMeta = ImageMeta | VideoMeta | AudioMeta | FontMeta;\n\n/** Build-time asset manifest keyed by source path (images/videos/audio) or family@weight (fonts). */\nexport interface AssetManifest {\n image: Record<string, ImageMeta>;\n video: Record<string, VideoMeta>;\n audio: Record<string, AudioMeta>;\n font: Record<string, FontMeta>;\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/assets/record.ts"],"names":[],"mappings":"","sourcesContent":["export type AssetType = 'image' | 'font' | 'video' | 'audio' | 'loader';\r\n\r\n/** Frees whatever a {@link LoaderFn} loaded. Called when its window is evicted. */\r\nexport type Disposer = () => void;\r\n\r\n/**\r\n * An opaque async load owned by the declaring package. Runs the load and\r\n * optionally resolves a {@link Disposer} that frees it. The core never inspects\r\n * what was loaded — this is how a component package (e.g. the code component's\r\n * Shiki highlighter) loads its own resources without core depending on it.\r\n *\r\n * Resolving nothing means \"keep it resident\": a syntax grammar or a 3D runtime is\r\n * cheap to hold and expensive to re-fetch, so most loaders have nothing to free.\r\n * Resolving a `Disposer` opts into eviction when the frame window closes.\r\n */\r\nexport type LoaderFn = () => Promise<void | Disposer>;\r\n\r\n// ─── Cached entry types ───────────────────────────────────────────────────────\r\n\r\n/** The frame window one asset is needed over. */\r\ninterface BaseAssetRecord {\r\n type: AssetType;\r\n /** First frame at which this asset is needed. */\r\n startFrame: number;\r\n /** Last frame at which this asset is needed. */\r\n endFrame: number;\r\n src: string;\r\n}\r\n\r\nexport interface ImageRecord extends BaseAssetRecord {\r\n type: 'image';\r\n}\r\n\r\nexport interface FontRecord extends BaseAssetRecord {\r\n type: 'font';\r\n fontWeight: number;\r\n fontFamily: string;\r\n}\r\n\r\nexport interface VideoRecord extends BaseAssetRecord {\r\n type: 'video';\r\n trimStart: number; // seconds; default 0\r\n trimEnd: number; // seconds; default is end of video (manifest duration)\r\n}\r\n\r\nexport interface AudioRecord extends BaseAssetRecord {\r\n type: 'audio';\r\n trimStart: number; // seconds; default 0\r\n trimEnd: number; // seconds; default is end of audio (manifest duration)\r\n}\r\n\r\n/**\r\n * A generic, opaque async load tracked on the timeline like any other asset.\r\n * Unlike images/fonts/etc. it isn't dispatched by {@link StorageAdapter}; the\r\n * {@link AssetManager} runs {@link load} directly when the frame window opens\r\n * and calls the returned {@link Disposer} when it evicts. `src` is the dedupe\r\n * key (e.g. `lang:java|github-dark`).\r\n */\r\nexport interface LoaderRecord extends BaseAssetRecord {\r\n type: 'loader';\r\n load: LoaderFn;\r\n}\r\n\r\n/** Union of all per-type cached entry shapes. */\r\nexport type AssetRecord = ImageRecord | FontRecord | VideoRecord | AudioRecord | LoaderRecord;"]}
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/assets/record.ts"],"names":[],"mappings":"","sourcesContent":["export type AssetType = 'image' | 'font' | 'video' | 'audio' | 'loader';\n\n/** Frees whatever a {@link LoaderFn} loaded. Called when its window is evicted. */\nexport type Disposer = () => void;\n\n/**\n * An opaque async load owned by the declaring package. Runs the load and\n * optionally resolves a {@link Disposer} that frees it. The core never inspects\n * what was loaded — this is how a component package (e.g. the code component's\n * Shiki highlighter) loads its own resources without core depending on it.\n *\n * Resolving nothing means \"keep it resident\": a syntax grammar or a 3D runtime is\n * cheap to hold and expensive to re-fetch, so most loaders have nothing to free.\n * Resolving a `Disposer` opts into eviction when the frame window closes.\n */\nexport type LoaderFn = () => Promise<void | Disposer>;\n\n// ─── Cached entry types ───────────────────────────────────────────────────────\n\n/** The frame window one asset is needed over. */\ninterface BaseAssetRecord {\n type: AssetType;\n /** First frame at which this asset is needed. */\n startFrame: number;\n /** Last frame at which this asset is needed. */\n endFrame: number;\n src: string;\n}\n\nexport interface ImageRecord extends BaseAssetRecord {\n type: 'image';\n}\n\nexport interface FontRecord extends BaseAssetRecord {\n type: 'font';\n fontWeight: number;\n fontFamily: string;\n}\n\nexport interface VideoRecord extends BaseAssetRecord {\n type: 'video';\n trimStart: number; // seconds; default 0\n trimEnd: number; // seconds; default is end of video (manifest duration)\n}\n\nexport interface AudioRecord extends BaseAssetRecord {\n type: 'audio';\n trimStart: number; // seconds; default 0\n trimEnd: number; // seconds; default is end of audio (manifest duration)\n}\n\n/**\n * A generic, opaque async load tracked on the timeline like any other asset.\n * Unlike images/fonts/etc. it isn't dispatched by {@link StorageAdapter}; the\n * {@link AssetManager} runs {@link load} directly when the frame window opens\n * and calls the returned {@link Disposer} when it evicts. `src` is the dedupe\n * key (e.g. `lang:java|github-dark`).\n */\nexport interface LoaderRecord extends BaseAssetRecord {\n type: 'loader';\n load: LoaderFn;\n}\n\n/** Union of all per-type cached entry shapes. */\nexport type AssetRecord = ImageRecord | FontRecord | VideoRecord | AudioRecord | LoaderRecord;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/assets/scope.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAgChE;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAe;IACpC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACR,OAAO,IAAI,CAAC,GAAG,CAAC;QACpB,KAAK,MAAM;YACP,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,KAAK,QAAQ;YACT,OAAO,IAAI,CAAC,GAAG,CAAC;IACxB,CAAC;AACL,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,eAAe,CAAC,MAAmC;IAC/D,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9E,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;IACnE,OAAO,GAAG,CAAC;AACf,CAAC;AASD;;;;;GAKG;AACH,MA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AED,OAAO,CAAC,OAA8B;QAClC,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,IAAU;QACd,IAAI,CAAC,SAAS,KAAK,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;YAC5D,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAEgB,QAAQ,CAA0B;IAClC,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC/C,SAAS,CAAwB;CAC5C","sourcesContent":["import type { AssetCatalog } from \"./catalog\";\r\nimport type { LoaderFn } from \"./record\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport { declareFill } from \"@/attributes/shape/fill/registry\";\r\nimport { declareEffect } from \"@/attributes/shape/effects/registry\";\r\nimport { declareTree } from \"@/components/trees/node/node-walk\";\r\n\r\n/** Whether an asset has to be resident before layout measures, or only before a frame draws. */\r\nexport type AssetGate = \"layout\" | \"render\";\r\n\r\nexport type AssetDecl =\r\n | { type: \"image\"; src: string }\r\n | { type: \"video\"; src: string; trimStart: number; trimEnd: number }\r\n | { type: \"font\"; family: string; weight: number }\r\n | { type: \"loader\"; key: string; load: LoaderFn; gate: AssetGate };\r\n\r\n/**\r\n * What a node's `declareAssets` states its needs into.\r\n *\r\n * A declaration must be a pure function of the props and context it reads — never\r\n * `layoutBounds`, never `time`, no writes — because the runtime re-runs it only\r\n * when something it read changes. Declarations dedupe by {@link assetKey}.\r\n */\r\nexport interface AssetScope {\r\n readonly catalog: AssetCatalog;\r\n image(src: string): void;\r\n video(src: string, trim?: { start?: number; end?: number }): void;\r\n /** Gates layout: text is measured against the face. */\r\n font(family: string, weight?: number | string): void;\r\n /** `gate` defaults to `\"render\"`; pass `\"layout\"` for a load measurement depends on. */\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void;\r\n fill(fills: FillResolved | readonly FillResolved[]): void;\r\n effects(effects: readonly NodeEffect[]): void;\r\n /** A detached subtree this node draws (a `Tex.surface` node source), declared as part of this node. */\r\n subtree(node: Node): void;\r\n}\r\n\r\n/**\r\n * Fonts key by family alone: `loadFont` registers every weight of a family at once\r\n * and a variable weight renders through `fontVariations`, so a weight in the key\r\n * would mint an entry per frame of a weight tween.\r\n */\r\nexport function assetKey(decl: AssetDecl): string {\r\n switch (decl.type) {\r\n case \"image\":\r\n case \"video\":\r\n return decl.src;\r\n case \"font\":\r\n return decl.family;\r\n case \"loader\":\r\n return decl.key;\r\n }\r\n}\r\n\r\n/** Anything unparseable lands on 400, which is what an unspecified weight means anyway. */\r\nexport function normalizeWeight(weight: number | string | undefined): number {\r\n if (typeof weight === \"number\") return Number.isFinite(weight) ? weight : 400;\r\n if (typeof weight === \"string\") return parseInt(weight, 10) || 400;\r\n return 400;\r\n}\r\n\r\nexport interface AssetDeclarationOptions {\r\n /** Binds a detached subtree (catalog, context, clock) before it declares. */\r\n bindSubtree?: (node: Node) => void;\r\n /** Replaces the default {@link declareTree} walk over a subtree. */\r\n onSubtree?: (node: Node, scope: AssetScope) => void;\r\n}\r\n\r\n/**\r\n * The {@link AssetScope} that collects: one declaration pass, keyed and validated.\r\n *\r\n * Unknown images and videos throw here, so a typo surfaces against the node that\r\n * declared it rather than as a picture that never paints.\r\n */\r\nexport class AssetDeclaration implements AssetScope {\r\n readonly catalog: AssetCatalog;\r\n\r\n constructor(catalog: AssetCatalog, options: AssetDeclarationOptions = {}) {\r\n this.catalog = catalog;\r\n this._options = options;\r\n }\r\n\r\n get declarations(): ReadonlyMap<string, AssetDecl> {\r\n return this._decls;\r\n }\r\n\r\n // An empty `src` is an unset media slot — it paints the checkerboard, not a\r\n // missing asset — so it declares nothing.\r\n image(src: string): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getImageMeta(src);\r\n this._decls.set(src, { type: \"image\", src });\r\n }\r\n\r\n video(src: string, trim?: { start?: number; end?: number }): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getVideoMeta(src);\r\n this._decls.set(src, {\r\n type: \"video\",\r\n src,\r\n trimStart: trim?.start ?? 0,\r\n trimEnd: trim?.end ?? this.catalog.getVideoDuration(src),\r\n });\r\n }\r\n\r\n font(family: string, weight?: number | string): void {\r\n if (!family || this._decls.has(family)) return;\r\n this._decls.set(family, { type: \"font\", family, weight: normalizeWeight(weight) });\r\n }\r\n\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void {\r\n const gate = options?.gate ?? \"render\";\r\n const existing = this._decls.get(key);\r\n if (existing === undefined) {\r\n this._decls.set(key, { type: \"loader\", key, load, gate });\r\n return;\r\n }\r\n if (existing.type !== \"loader\") return;\r\n if (existing.load !== load && process.env.NODE_ENV !== \"production\") {\r\n console.warn(\r\n `[assets] Loader \"${key}\" was declared with a different load function; the first is kept. ` +\r\n `Hoist the function so every declaration of the key hands over the same one.`,\r\n );\r\n }\r\n // Layout is the stricter gate, so it wins whichever declaration asked first.\r\n if (gate === \"layout\" && existing.gate !== \"layout\") {\r\n this._decls.set(key, { ...existing, gate });\r\n }\r\n }\r\n\r\n fill(fills: FillResolved | readonly FillResolved[]): void {\r\n if (!fills) return;\r\n if (!Array.isArray(fills)) {\r\n declareFill(fills as FillResolved, this);\r\n return;\r\n }\r\n for (const fill of fills as readonly FillResolved[]) declareFill(fill, this);\r\n }\r\n\r\n effects(effects: readonly NodeEffect[]): void {\r\n if (!effects) return;\r\n for (const effect of effects) declareEffect(effect, this);\r\n }\r\n\r\n subtree(node: Node): void {\r\n this._subtrees ??= new Set();\r\n if (this._subtrees.has(node)) return;\r\n this._subtrees.add(node);\r\n this._options.bindSubtree?.(node);\r\n if (this._options.onSubtree) this._options.onSubtree(node, this);\r\n else declareTree(node, this);\r\n }\r\n\r\n private readonly _options: AssetDeclarationOptions;\r\n private readonly _decls = new Map<string, AssetDecl>();\r\n private _subtrees: Set<Node> | undefined;\r\n}\r\n"]}
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/assets/scope.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAgChE;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAe;IACpC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACR,OAAO,IAAI,CAAC,GAAG,CAAC;QACpB,KAAK,MAAM;YACP,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,KAAK,QAAQ;YACT,OAAO,IAAI,CAAC,GAAG,CAAC;IACxB,CAAC;AACL,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,eAAe,CAAC,MAAmC;IAC/D,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9E,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;IACnE,OAAO,GAAG,CAA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AAE,IAAI,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,CAAC,OAA8B;QAClC,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,IAAU;QACd,IAAI,CAAC,SAAS,KAAK,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;YAC5D,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAEgB,QAAQ,CAA0B;IAClC,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC/C,SAAS,CAAwB;CAC5C","sourcesContent":["import type { AssetCatalog } from \"./catalog\";\nimport type { LoaderFn } from \"./record\";\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\nimport type { Node } from \"@/components/trees/node/node\";\nimport { declareFill } from \"@/attributes/shape/fill/registry\";\nimport { declareEffect } from \"@/attributes/shape/effects/registry\";\nimport { declareTree } from \"@/components/trees/node/node-walk\";\n\n/** Whether an asset has to be resident before layout measures, or only before a frame draws. */\nexport type AssetGate = \"layout\" | \"render\";\n\nexport type AssetDecl =\n | { type: \"image\"; src: string }\n | { type: \"video\"; src: string; trimStart: number; trimEnd: number }\n | { type: \"font\"; family: string; weight: number }\n | { type: \"loader\"; key: string; load: LoaderFn; gate: AssetGate };\n\n/**\n * What a node's `declareAssets` states its needs into.\n *\n * A declaration must be a pure function of the props and context it reads — never\n * `layoutBounds`, never `time`, no writes — because the runtime re-runs it only\n * when something it read changes. Declarations dedupe by {@link assetKey}.\n */\nexport interface AssetScope {\n readonly catalog: AssetCatalog;\n image(src: string): void;\n video(src: string, trim?: { start?: number; end?: number }): void;\n /** Gates layout: text is measured against the face. */\n font(family: string, weight?: number | string): void;\n /** `gate` defaults to `\"render\"`; pass `\"layout\"` for a load measurement depends on. */\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void;\n fill(fills: FillResolved | readonly FillResolved[]): void;\n effects(effects: readonly NodeEffect[]): void;\n /** A detached subtree this node draws (a `Tex.surface` node source), declared as part of this node. */\n subtree(node: Node): void;\n}\n\n/**\n * Fonts key by family alone: `loadFont` registers every weight of a family at once\n * and a variable weight renders through `fontVariations`, so a weight in the key\n * would mint an entry per frame of a weight tween.\n */\nexport function assetKey(decl: AssetDecl): string {\n switch (decl.type) {\n case \"image\":\n case \"video\":\n return decl.src;\n case \"font\":\n return decl.family;\n case \"loader\":\n return decl.key;\n }\n}\n\n/** Anything unparseable lands on 400, which is what an unspecified weight means anyway. */\nexport function normalizeWeight(weight: number | string | undefined): number {\n if (typeof weight === \"number\") return Number.isFinite(weight) ? weight : 400;\n if (typeof weight === \"string\") return parseInt(weight, 10) || 400;\n return 400;\n}\n\nexport interface AssetDeclarationOptions {\n /** Binds a detached subtree (catalog, context, clock) before it declares. */\n bindSubtree?: (node: Node) => void;\n /** Replaces the default {@link declareTree} walk over a subtree. */\n onSubtree?: (node: Node, scope: AssetScope) => void;\n}\n\n/**\n * The {@link AssetScope} that collects: one declaration pass, keyed and validated.\n *\n * Unknown images and videos throw here, so a typo surfaces against the node that\n * declared it rather than as a picture that never paints.\n */\nexport class AssetDeclaration implements AssetScope {\n readonly catalog: AssetCatalog;\n\n constructor(catalog: AssetCatalog, options: AssetDeclarationOptions = {}) {\n this.catalog = catalog;\n this._options = options;\n }\n\n get declarations(): ReadonlyMap<string, AssetDecl> {\n return this._decls;\n }\n\n // An empty `src` is an unset media slot — it paints the checkerboard, not a\n // missing asset — so it declares nothing.\n image(src: string): void {\n if (!src || this._decls.has(src)) return;\n this.catalog.getImageMeta(src);\n this._decls.set(src, { type: \"image\", src });\n }\n\n video(src: string, trim?: { start?: number; end?: number }): void {\n if (!src || this._decls.has(src)) return;\n this.catalog.getVideoMeta(src);\n this._decls.set(src, {\n type: \"video\",\n src,\n trimStart: trim?.start ?? 0,\n trimEnd: trim?.end ?? this.catalog.getVideoDuration(src),\n });\n }\n\n font(family: string, weight?: number | string): void {\n if (!family || this._decls.has(family)) return;\n this._decls.set(family, { type: \"font\", family, weight: normalizeWeight(weight) });\n }\n\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void {\n const gate = options?.gate ?? \"render\";\n const existing = this._decls.get(key);\n if (existing === undefined) {\n this._decls.set(key, { type: \"loader\", key, load, gate });\n return;\n }\n if (existing.type !== \"loader\") return;\n if (existing.load !== load && process.env.NODE_ENV !== \"production\") {\n console.warn(\n `[assets] Loader \"${key}\" was declared with a different load function; the first is kept. ` +\n `Hoist the function so every declaration of the key hands over the same one.`,\n );\n }\n // Layout is the stricter gate, so it wins whichever declaration asked first.\n if (gate === \"layout\" && existing.gate !== \"layout\") {\n this._decls.set(key, { ...existing, gate });\n }\n }\n\n fill(fills: FillResolved | readonly FillResolved[]): void {\n if (!fills) return;\n if (!Array.isArray(fills)) {\n declareFill(fills as FillResolved, this);\n return;\n }\n for (const fill of fills as readonly FillResolved[]) declareFill(fill, this);\n }\n\n effects(effects: readonly NodeEffect[]): void {\n if (!effects) return;\n for (const effect of effects) declareEffect(effect, this);\n }\n\n subtree(node: Node): void {\n this._subtrees ??= new Set();\n if (this._subtrees.has(node)) return;\n this._subtrees.add(node);\n this._options.bindSubtree?.(node);\n if (this._options.onSubtree) this._options.onSubtree(node, this);\n else declareTree(node, this);\n }\n\n private readonly _options: AssetDeclarationOptions;\n private readonly _decls = new Map<string, AssetDecl>();\n private _subtrees: Set<Node> | undefined;\n}\n"]}