@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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAuB,MAAM,cAAc,CAAC","sourcesContent":["export { NodeAudio, busPathOf, busPathTo, findBusById, structuralPathOf, type NodeAudioProps } from \"./node-audio\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAuB,MAAM,cAAc,CAAC","sourcesContent":["export { NodeAudio, busPathOf, busPathTo, findBusById, structuralPathOf, type NodeAudioProps } from \"./node-audio\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node-audio.js","sourceRoot":"","sources":["../../../../src/components/trees/audio/node-audio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOzF,OAAO,EAAE,IAAI,EAAuD,MAAM,8BAA8B,CAAC;AAmBzG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,SAAqD,SAAQ,IAAO;IAC7E,IAAI,SAAS,KAAoB,OAAO,OAAO,CAAC,CAAC,CAAC;IASlD,YAAY,KAA0B;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,oEAAoE;QACpE,uEAAuE;QACvE,4DAA4D;QAC5D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,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,OAAO,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { declareMembers, property } from \"@/attributes/properties/decorator\";\r\nimport { audioEffectsProperty, audioParamProperty } from \"@/attributes/properties/typed\";\r\nimport { type AudioEffectsInput } from \"@/attributes/audio/effects/chain\";\r\nimport type { AudioEffect } from \"@/attributes/audio/effects/union\";\r\nimport type { Param } from \"@/attributes/audio/ramp\";\r\nimport type { AudioTransition } from \"@/attributes/audio/transition\";\r\nimport type { AudioBusStop } from \"@/attributes/audio/request\";\r\nimport type { NodeSpan } from \"@/document/types\";\r\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/components/trees/node/node\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { TweenStepper } from \"@/tween/stepper\";\r\n\r\nexport interface NodeAudioProps extends NodeProps {\r\n /** Linear gain. 1 leaves the signal alone, 0 silences it. */\r\n volume: Param;\r\n /** Stereo position: -1 hard left, 0 centre, +1 hard right. */\r\n pan: Param;\r\n /** Silence this node and, on a bus, everything under it. */\r\n mute: boolean;\r\n /** Effects applied in array order, index 0 closest to the source. */\r\n effects: AudioEffectsInput;\r\n /** A fade over its first `duration` seconds, on top of `volume`. */\r\n transitionIn: AudioTransition | undefined;\r\n /** A fade over its last `duration` seconds, on top of `volume`. */\r\n transitionOut: AudioTransition | undefined;\r\n}\r\n\r\n/**\r\n * The third scene graph: things that make sound.\r\n *\r\n * Sibling to `Node2D` and `Node3D`, and thin for the same reason they are thick\r\n * — a node that makes sound has no box and no place in space, so it inherits the\r\n * tree, identity, props, commands, context and clock from {@link Node} and adds\r\n * only what every audible thing has: a level, a position in the stereo field, a\r\n * mute, an effect chain, and how it enters and leaves.\r\n *\r\n * Two concrete kinds, and no more: `SoundNode` is a leaf that plays a file, and\r\n * `AudioBus` is a group that everything beneath it feeds. That is the whole\r\n * vocabulary of a mixer, and it is deliberately the same shape as the visual\r\n * trees — a group node and a drawing node — because the thing being described is\r\n * the same: what exists, and what is under what.\r\n *\r\n * ### Levels are ramps, not tweens\r\n *\r\n * `volume` and `pan` are {@link Param}, so a fade is a ramp (`ramp(1, 0, 1)`)\r\n * or a `transitionOut` rather than a `to()`. That is not a\r\n * limitation being worked around, it is what the two mechanisms mean: a tween\r\n * writes a prop once per *frame*, while sound is scheduled once, ahead of\r\n * time, and then runs at 48 kHz. A per-frame write reaches the graph on the one\r\n * frame that built the request and never again — so a `to({ volume })` would\r\n * read as animated on the timeline and render flat. `_prepareStep` refuses it\r\n * instead.\r\n */\r\nexport class NodeAudio<P extends NodeAudioProps = NodeAudioProps> extends Node<P> {\r\n get dimension(): NodeDimension { return \"audio\"; }\r\n\r\n declare volume: Param;\r\n declare pan: Param;\r\n declare mute: boolean;\r\n declare effects: AudioEffectsInput;\r\n declare transitionIn: AudioTransition | undefined;\r\n declare transitionOut: AudioTransition | undefined;\r\n\r\n constructor(props?: NodeConfig<any, P>) {\r\n super(props);\r\n // Deferred to here rather than run by `super()`: a subclass's field\r\n // initializers only run once `super()` has returned, so applying props\r\n // any earlier would write into cells that do not exist yet.\r\n this.initProps(props);\r\n this.adoptChildrenProp(props);\r\n }\r\n\r\n /** This node's children in the audio tree. */\r\n get childrenAudio(): NodeAudio[] {\r\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\r\n }\r\n\r\n /**\r\n * This bus's identity in the platform's graph: one chain, which everything\r\n * under it feeds.\r\n *\r\n * The authored id, and the structural path for a bus built in code rather\r\n * than from a document row. Neither answer alone works, and being wrong is\r\n * silent either way — the string reaches `AssetManager.stableKey`, so one\r\n * that changes re-fetches and re-schedules every clip on the bus. A document\r\n * row's id is fixed for the document's life, while its child index moves as\r\n * `syncPresence` adds and removes siblings; a code-built bus has no authored\r\n * id, but its parent builds it in the same slot every time.\r\n *\r\n * @internal\r\n */\r\n get _busId(): string {\r\n const authored = this._props?.id;\r\n return `bus:${typeof authored === \"string\" ? authored : structuralPathOf(this)}`;\r\n }\r\n\r\n /**\r\n * Refuse a tween on a level, naming the curve that does work.\r\n *\r\n * Loud rather than silent because the failure is otherwise invisible: the\r\n * command runs its full duration, the timeline draws a bar, and the render\r\n * is at one flat level. See the class docblock for why the two mechanisms\r\n * cannot agree.\r\n */\r\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\r\n for (const key of TWEEN_REFUSED) {\r\n if (!(key in to)) continue;\r\n throw new TypeError(\r\n `${this.className}: \"${key}\" cannot be tweened — an audio param is scheduled once, ` +\r\n `not written per frame, so a tween on it would render flat. Automate it with a ` +\r\n `ramp instead: ${key}: ramp(1, 0, 1), or transitionOut: { duration: 1 }.`,\r\n );\r\n }\r\n return super._prepareStep(to, duration, easing);\r\n }\r\n}\r\n\r\ndeclareMembers(NodeAudio, {\r\n volume: audioParamProperty({ default: 1 }),\r\n pan: audioParamProperty({ default: 0 }),\r\n mute: property({ default: false }),\r\n effects: audioEffectsProperty(),\r\n transitionIn: property({ default: undefined }),\r\n transitionOut: property({ default: undefined }),\r\n});\r\n\r\nconst TWEEN_REFUSED = [\"volume\", \"pan\", \"speed\"] as const;\r\n\r\n/**\r\n * The buses a node feeds, **source-adjacent first**.\r\n *\r\n * Walks up the audio ancestors only: the walk stops at the first non-audio\r\n * parent, which is the `Canvas2D` scene root, because a scene root is not a bus\r\n * — it has no level of its own and nothing to mix.\r\n */\r\nexport function busPathOf(node: NodeAudio, spanOf: SpanOf): AudioBusStop[] | undefined {\r\n const stops: AudioBusStop[] = [];\r\n let parent = node.parent;\r\n while (parent instanceof NodeAudio) {\r\n stops.push(stopOf(parent, spanOf));\r\n parent = parent.parent;\r\n }\r\n return stops.length > 0 ? stops : undefined;\r\n}\r\n\r\n/** {@link busPathOf}, with `bus` itself as the first stop. */\r\nexport function busPathTo(bus: NodeAudio, spanOf: SpanOf): AudioBusStop[] {\r\n return [stopOf(bus, spanOf), ...(busPathOf(bus, spanOf) ?? [])];\r\n}\r\n\r\n/** When a node is in the tree, in clip seconds: the span a bus stop carries. */\r\nexport type SpanOf = (node: Node) => Readonly<NodeSpan>;\r\n\r\n/**\r\n * The bus in `from`'s scene with node id `id`, or `null`.\r\n *\r\n * What lets something outside the audio tree feed a bus — a `Video`, whose audio\r\n * is welded to its picture and so cannot be parented under one. It names the bus\r\n * by the same id a `SoundNode` under that bus writes in its `parentId`, because\r\n * it is asking the same question: which bus. A `key` would be a second\r\n * vocabulary for it, and an optional one.\r\n */\r\nexport function findBusById(from: Node, id: string): NodeAudio | null {\r\n let root: Node = from;\r\n while (root.parent) root = root.parent;\r\n return searchBus(root, id);\r\n}\r\n\r\nfunction searchBus(node: Node, id: string): NodeAudio | null {\r\n if (node instanceof NodeAudio && node.id === id) return node;\r\n for (const child of node._allChildren) {\r\n const found = searchBus(child, id);\r\n if (found) return found;\r\n }\r\n return null;\r\n}\r\n\r\n/** One bus, flattened to the plain data a platform builds its chain from. */\r\nfunction stopOf(bus: NodeAudio, spanOf: SpanOf): AudioBusStop {\r\n const effects = bus.effects as unknown as AudioEffect[];\r\n const span = spanOf(bus);\r\n return {\r\n id: bus._busId,\r\n volume: bus.volume,\r\n pan: bus.pan,\r\n mute: bus.mute,\r\n ...(effects.length > 0 ? { effects } : {}),\r\n ...(bus.transitionIn ? { transitionIn: bus.transitionIn } : {}),\r\n ...(bus.transitionOut ? { transitionOut: bus.transitionOut } : {}),\r\n startAt: span.start,\r\n endAt: span.end,\r\n };\r\n}\r\n\r\n/**\r\n * A node's child-index path from the root of its tree, joined with \".\".\r\n *\r\n * The same identity `nodePath` gives the runtime, computed bottom-up because a\r\n * node declaring its audio knows its parents and not its index in a\r\n * walk. Stable across a rebuild for an unchanged tree, which is the property\r\n * both a bus id and a clip's request id need.\r\n */\r\nexport function structuralPathOf(node: Node): string {\r\n const parts: string[] = [];\r\n let current: Node | null = node;\r\n while (current) {\r\n const parent: Node | null = current.parent;\r\n if (!parent) break;\r\n parts.push(String(parent._allChildren.indexOf(current)));\r\n current = parent;\r\n }\r\n return parts.reverse().join(\".\");\r\n}\r\n"]}
1
+ {"version":3,"file":"node-audio.js","sourceRoot":"","sources":["../../../../src/components/trees/audio/node-audio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOzF,OAAO,EAAE,IAAI,EAAuD,MAAM,8BAA8B,CAAC;AAmBzG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,SAAqD,SAAQ,IAAO;IAC7E,IAAI,SAAS,KAAoB,OAAO,OAAO,CAAC,CAAC,CAAC;IASlD,YAAY,KAA0B;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,oEAAoE;QACpE,uEAAuE;QACvE,4DAA4D;QAC5D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,8CAA8C;IAC9C,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAkB,EAAE,CAAC,CAAC,YAAY,SAAS,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,MAAM;QACN,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACjC,OAAO,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACrF,CAAC;IAED;;;;;;;OAOG;IACM,YAAY,CAAC,EAAc,EAAE,QAAg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C,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,OAAO,EAAE,IAAI,CAAC,KAAK;QACnB,KAAK,EAAE,IAAI,CAAC,GAAG;KAClB,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAU;IACvC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,GAAgB,IAAI,CAAC;IAChC,OAAO,OAAO,EAAE,CAAC;QACb,MAAM,MAAM,GAAgB,OAAO,CAAC,MAAM,CAAC;QAC3C,IAAI,CAAC,MAAM;YAAE,MAAM;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,OAAO,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { declareMembers, property } from \"@/attributes/properties/decorator\";\nimport { audioEffectsProperty, audioParamProperty } from \"@/attributes/properties/typed\";\nimport { type AudioEffectsInput } from \"@/attributes/audio/effects/chain\";\nimport type { AudioEffect } from \"@/attributes/audio/effects/union\";\nimport type { Param } from \"@/attributes/audio/ramp\";\nimport type { AudioTransition } from \"@/attributes/audio/transition\";\nimport type { AudioBusStop } from \"@/attributes/audio/request\";\nimport type { NodeSpan } from \"@/document/types\";\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/components/trees/node/node\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport type { TweenStepper } from \"@/tween/stepper\";\n\nexport interface NodeAudioProps extends NodeProps {\n /** Linear gain. 1 leaves the signal alone, 0 silences it. */\n volume: Param;\n /** Stereo position: -1 hard left, 0 centre, +1 hard right. */\n pan: Param;\n /** Silence this node and, on a bus, everything under it. */\n mute: boolean;\n /** Effects applied in array order, index 0 closest to the source. */\n effects: AudioEffectsInput;\n /** A fade over its first `duration` seconds, on top of `volume`. */\n transitionIn: AudioTransition | undefined;\n /** A fade over its last `duration` seconds, on top of `volume`. */\n transitionOut: AudioTransition | undefined;\n}\n\n/**\n * The third scene graph: things that make sound.\n *\n * Sibling to `Node2D` and `Node3D`, and thin for the same reason they are thick\n * — a node that makes sound has no box and no place in space, so it inherits the\n * tree, identity, props, commands, context and clock from {@link Node} and adds\n * only what every audible thing has: a level, a position in the stereo field, a\n * mute, an effect chain, and how it enters and leaves.\n *\n * Two concrete kinds, and no more: `SoundNode` is a leaf that plays a file, and\n * `AudioBus` is a group that everything beneath it feeds. That is the whole\n * vocabulary of a mixer, and it is deliberately the same shape as the visual\n * trees — a group node and a drawing node — because the thing being described is\n * the same: what exists, and what is under what.\n *\n * ### Levels are ramps, not tweens\n *\n * `volume` and `pan` are {@link Param}, so a fade is a ramp (`ramp(1, 0, 1)`)\n * or a `transitionOut` rather than a `to()`. That is not a\n * limitation being worked around, it is what the two mechanisms mean: a tween\n * writes a prop once per *frame*, while sound is scheduled once, ahead of\n * time, and then runs at 48 kHz. A per-frame write reaches the graph on the one\n * frame that built the request and never again — so a `to({ volume })` would\n * read as animated on the timeline and render flat. `_prepareStep` refuses it\n * instead.\n */\nexport class NodeAudio<P extends NodeAudioProps = NodeAudioProps> extends Node<P> {\n get dimension(): NodeDimension { return \"audio\"; }\n\n declare volume: Param;\n declare pan: Param;\n declare mute: boolean;\n declare effects: AudioEffectsInput;\n declare transitionIn: AudioTransition | undefined;\n declare transitionOut: AudioTransition | undefined;\n\n constructor(props?: NodeConfig<any, P>) {\n super(props);\n // Deferred to here rather than run by `super()`: a subclass's field\n // initializers only run once `super()` has returned, so applying props\n // any earlier would write into cells that do not exist yet.\n this.initProps(props);\n this.adoptChildrenProp(props);\n }\n\n /** This node's children in the audio tree. */\n get childrenAudio(): NodeAudio[] {\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\n }\n\n /**\n * This bus's identity in the platform's graph: one chain, which everything\n * under it feeds.\n *\n * The authored id, and the structural path for a bus built in code rather\n * than from a document row. Neither answer alone works, and being wrong is\n * silent either way — the string reaches `AssetManager.stableKey`, so one\n * that changes re-fetches and re-schedules every clip on the bus. A document\n * row's id is fixed for the document's life, while its child index moves as\n * `syncPresence` adds and removes siblings; a code-built bus has no authored\n * id, but its parent builds it in the same slot every time.\n *\n * @internal\n */\n get _busId(): string {\n const authored = this._props?.id;\n return `bus:${typeof authored === \"string\" ? authored : structuralPathOf(this)}`;\n }\n\n /**\n * Refuse a tween on a level, naming the curve that does work.\n *\n * Loud rather than silent because the failure is otherwise invisible: the\n * command runs its full duration, the timeline draws a bar, and the render\n * is at one flat level. See the class docblock for why the two mechanisms\n * cannot agree.\n */\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\n for (const key of TWEEN_REFUSED) {\n if (!(key in to)) continue;\n throw new TypeError(\n `${this.className}: \"${key}\" cannot be tweened — an audio param is scheduled once, ` +\n `not written per frame, so a tween on it would render flat. Automate it with a ` +\n `ramp instead: ${key}: ramp(1, 0, 1), or transitionOut: { duration: 1 }.`,\n );\n }\n return super._prepareStep(to, duration, easing);\n }\n}\n\ndeclareMembers(NodeAudio, {\n volume: audioParamProperty({ default: 1 }),\n pan: audioParamProperty({ default: 0 }),\n mute: property({ default: false }),\n effects: audioEffectsProperty(),\n transitionIn: property({ default: undefined }),\n transitionOut: property({ default: undefined }),\n});\n\nconst TWEEN_REFUSED = [\"volume\", \"pan\", \"speed\"] as const;\n\n/**\n * The buses a node feeds, **source-adjacent first**.\n *\n * Walks up the audio ancestors only: the walk stops at the first non-audio\n * parent, which is the `Canvas2D` scene root, because a scene root is not a bus\n * — it has no level of its own and nothing to mix.\n */\nexport function busPathOf(node: NodeAudio, spanOf: SpanOf): AudioBusStop[] | undefined {\n const stops: AudioBusStop[] = [];\n let parent = node.parent;\n while (parent instanceof NodeAudio) {\n stops.push(stopOf(parent, spanOf));\n parent = parent.parent;\n }\n return stops.length > 0 ? stops : undefined;\n}\n\n/** {@link busPathOf}, with `bus` itself as the first stop. */\nexport function busPathTo(bus: NodeAudio, spanOf: SpanOf): AudioBusStop[] {\n return [stopOf(bus, spanOf), ...(busPathOf(bus, spanOf) ?? [])];\n}\n\n/** When a node is in the tree, in clip seconds: the span a bus stop carries. */\nexport type SpanOf = (node: Node) => Readonly<NodeSpan>;\n\n/**\n * The bus in `from`'s scene with node id `id`, or `null`.\n *\n * What lets something outside the audio tree feed a bus — a `Video`, whose audio\n * is welded to its picture and so cannot be parented under one. It names the bus\n * by the same id a `SoundNode` under that bus writes in its `parentId`, because\n * it is asking the same question: which bus. A `key` would be a second\n * vocabulary for it, and an optional one.\n */\nexport function findBusById(from: Node, id: string): NodeAudio | null {\n let root: Node = from;\n while (root.parent) root = root.parent;\n return searchBus(root, id);\n}\n\nfunction searchBus(node: Node, id: string): NodeAudio | null {\n if (node instanceof NodeAudio && node.id === id) return node;\n for (const child of node._allChildren) {\n const found = searchBus(child, id);\n if (found) return found;\n }\n return null;\n}\n\n/** One bus, flattened to the plain data a platform builds its chain from. */\nfunction stopOf(bus: NodeAudio, spanOf: SpanOf): AudioBusStop {\n const effects = bus.effects as unknown as AudioEffect[];\n const span = spanOf(bus);\n return {\n id: bus._busId,\n volume: bus.volume,\n pan: bus.pan,\n mute: bus.mute,\n ...(effects.length > 0 ? { effects } : {}),\n ...(bus.transitionIn ? { transitionIn: bus.transitionIn } : {}),\n ...(bus.transitionOut ? { transitionOut: bus.transitionOut } : {}),\n startAt: span.start,\n endAt: span.end,\n };\n}\n\n/**\n * A node's child-index path from the root of its tree, joined with \".\".\n *\n * The same identity `nodePath` gives the runtime, computed bottom-up because a\n * node declaring its audio knows its parents and not its index in a\n * walk. Stable across a rebuild for an unchanged tree, which is the property\n * both a bus id and a clip's request id need.\n */\nexport function structuralPathOf(node: Node): string {\n const parts: string[] = [];\n let current: Node | null = node;\n while (current) {\n const parent: Node | null = current.parent;\n if (!parent) break;\n parts.push(String(parent._allChildren.indexOf(current)));\n current = parent;\n }\n return parts.reverse().join(\".\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/trees/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAE5B,6EAA6E;AAC7E,+CAA+C;AAC/C,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,cAAc,sBAAsB,CAAC;AAErC,qGAAqG;AACrG,uDAAuD;AACvD,cAAc,SAAS,CAAC;AAExB,KAAK;AACL,cAAc,gBAAgB,CAAC","sourcesContent":["// The two halves of the tree: the dimension-agnostic base, and its 2D side.\r\nexport * from \"./node/node\";\r\nexport * from \"./2d/node2d\";\r\nexport type { NodeTime } from \"./node/node-time\";\r\n// The per-frame subtree traversals the runtime drives. Free functions rather\r\n// than node methods — see the module docblock.\r\n/** @internal */ export { primeMotionTree, sampleTree } from \"./node/node-walk\";\r\nexport { applyEditorStates } from \"./node/node-editor-state\";\r\n\r\nexport type { NodeEditorState, NodeEditorStates } from \"./node/node-editor-state\";\r\nexport * from \"./root/canvas2d-node\";\r\n\r\n// The node types themselves are components (`components/builtins/*`), their props types beside them.\r\n// Audio — the third tree: a bus groups, a sound plays.\r\nexport * from \"./audio\";\r\n\r\n// 3D\r\nexport * from \"./three/node3d\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/trees/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAE5B,6EAA6E;AAC7E,+CAA+C;AAC/C,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,cAAc,sBAAsB,CAAC;AAErC,qGAAqG;AACrG,uDAAuD;AACvD,cAAc,SAAS,CAAC;AAExB,KAAK;AACL,cAAc,gBAAgB,CAAC","sourcesContent":["// The two halves of the tree: the dimension-agnostic base, and its 2D side.\nexport * from \"./node/node\";\nexport * from \"./2d/node2d\";\nexport type { NodeTime } from \"./node/node-time\";\n// The per-frame subtree traversals the runtime drives. Free functions rather\n// than node methods — see the module docblock.\n/** @internal */ export { primeMotionTree, sampleTree } from \"./node/node-walk\";\nexport { applyEditorStates } from \"./node/node-editor-state\";\n\nexport type { NodeEditorState, NodeEditorStates } from \"./node/node-editor-state\";\nexport * from \"./root/canvas2d-node\";\n\n// The node types themselves are components (`components/builtins/*`), their props types beside them.\n// Audio — the third tree: a bus groups, a sound plays.\nexport * from \"./audio\";\n\n// 3D\nexport * from \"./three/node3d\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node-editor-state.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-editor-state.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAU,EAAE,MAAoC;IAC9E,MAAM,IAAI,GAAG,CAAC,IAAU,EAAQ,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;QACrE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { Node } from \"./node\";\r\n\r\n/**\r\n * What an editor says about one node, as against what the document says.\r\n *\r\n * Neither of these is a prop. They are not authored values, they do not tween,\r\n * they are not part of the scene's meaning — an exported frame is the same\r\n * whether or not the person who made it had a layer folded away. They are the\r\n * editor's view of the tree, so they arrive on the side and are applied over it.\r\n */\r\nexport interface NodeEditorState {\r\n /**\r\n * Hide the node and everything under it: no paint, no pick, and no layout\r\n * slot — a hidden child of a row gives up its cell and its gap, the way\r\n * `display: none` does rather than `visibility: hidden`.\r\n *\r\n * The node **stays in the tree**. Dropping it instead would renumber every\r\n * later sibling's structural path, which is what a host's boxes, its\r\n * lifespans and its picking are all keyed on.\r\n */\r\n hidden?: boolean;\r\n /**\r\n * Take the node out of reach of the pointer while leaving the picture\r\n * untouched — Figma's padlock.\r\n *\r\n * Not the opposite of {@link hidden} and not a weaker form of it. A locked\r\n * node still draws, still lays out, and still confines its children; what it\r\n * declines is being the *answer* to a pick. Its children stay pickable,\r\n * because locking a group is about the group.\r\n */\r\n locked?: boolean;\r\n}\r\n\r\n/**\r\n * Editor state for a whole tree, keyed by {@link Node.key}.\r\n *\r\n * A record rather than a list: the walk that applies it asks once per node, and\r\n * a host with a thousand-node scene should not pay a scan for each.\r\n */\r\nexport type NodeEditorStates = Record<string, NodeEditorState>;\r\n\r\n/**\r\n * Push `states` onto the tree under `root`.\r\n *\r\n * Resolved onto the nodes rather than consulted from them, so `render` and the\r\n * pick walk read a local field instead of probing a record they would first have\r\n * to reach the scene to find. Called once per frame from `ClipInstance.attach`, which\r\n * is after the tree is built and before it is laid out — a node that appeared\r\n * this frame therefore gets its state on the same frame it appears.\r\n *\r\n * A node with no `key`, or a key the record does not mention, is reset rather\r\n * than left alone: the record is the whole truth about editor state, so a key\r\n * dropped from it is a node unhidden.\r\n */\r\nexport function applyEditorStates(root: Node, states: NodeEditorStates | undefined): void {\r\n const walk = (node: Node): void => {\r\n const state = node.key !== undefined ? states?.[node.key] : undefined;\r\n node._setEditorState(state?.hidden === true, state?.locked === true);\r\n for (const child of node._allChildren) walk(child);\r\n };\r\n walk(root);\r\n}\r\n"]}
1
+ {"version":3,"file":"node-editor-state.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-editor-state.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAU,EAAE,MAAoC;IAC9E,MAAM,IAAI,GAAG,CAAC,IAAU,EAAQ,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;QACrE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { Node } from \"./node\";\n\n/**\n * What an editor says about one node, as against what the document says.\n *\n * Neither of these is a prop. They are not authored values, they do not tween,\n * they are not part of the scene's meaning — an exported frame is the same\n * whether or not the person who made it had a layer folded away. They are the\n * editor's view of the tree, so they arrive on the side and are applied over it.\n */\nexport interface NodeEditorState {\n /**\n * Hide the node and everything under it: no paint, no pick, and no layout\n * slot — a hidden child of a row gives up its cell and its gap, the way\n * `display: none` does rather than `visibility: hidden`.\n *\n * The node **stays in the tree**. Dropping it instead would renumber every\n * later sibling's structural path, which is what a host's boxes, its\n * lifespans and its picking are all keyed on.\n */\n hidden?: boolean;\n /**\n * Take the node out of reach of the pointer while leaving the picture\n * untouched — Figma's padlock.\n *\n * Not the opposite of {@link hidden} and not a weaker form of it. A locked\n * node still draws, still lays out, and still confines its children; what it\n * declines is being the *answer* to a pick. Its children stay pickable,\n * because locking a group is about the group.\n */\n locked?: boolean;\n}\n\n/**\n * Editor state for a whole tree, keyed by {@link Node.key}.\n *\n * A record rather than a list: the walk that applies it asks once per node, and\n * a host with a thousand-node scene should not pay a scan for each.\n */\nexport type NodeEditorStates = Record<string, NodeEditorState>;\n\n/**\n * Push `states` onto the tree under `root`.\n *\n * Resolved onto the nodes rather than consulted from them, so `render` and the\n * pick walk read a local field instead of probing a record they would first have\n * to reach the scene to find. Called once per frame from `ClipInstance.attach`, which\n * is after the tree is built and before it is laid out — a node that appeared\n * this frame therefore gets its state on the same frame it appears.\n *\n * A node with no `key`, or a key the record does not mention, is reset rather\n * than left alone: the record is the whole truth about editor state, so a key\n * dropped from it is a node unhidden.\n */\nexport function applyEditorStates(root: Node, states: NodeEditorStates | undefined): void {\n const walk = (node: Node): void => {\n const state = node.key !== undefined ? states?.[node.key] : undefined;\n node._setEditorState(state?.hidden === true, state?.locked === true);\n for (const child of node._allChildren) walk(child);\n };\n walk(root);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node-reactive.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AA2B7D;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAM,IAAkB,EAAE,KAAa,EAAE,OAA+B;IAChG,MAAM,IAAI,GAAG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E,QAAQ,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;QAC3B,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;YAAE,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC,EAAE,MAAM,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { PropSlot, PropSnapshot } from \"@/props/slot\";\r\nimport { ensureCells, PropHost, TweenFn } from \"@/props/host\";\r\nimport { EasingFunction } from \"@/tween/ease/type\";\r\nimport { driveCommand, type Command } from \"@/tween/command\";\r\nimport { TweenStepper } from \"@/tween/stepper\";\r\nimport { PropOptions } from \"@/attributes/properties/decorator\";\r\n\r\n/**\r\n * Companion implementation of {@link Node2D}'s property machinery and its\r\n * save/restore state stack. The bodies live here as free functions over a\r\n * narrow {@link ReactiveHost} so `node.ts` keeps only thin delegators (and the\r\n * hot-path `set`/`_writeProp`, which stay inline on the class). Mirrors the\r\n * existing `getPropSlot(host, name)` pattern in `props/host.ts`.\r\n */\r\n\r\n/**\r\n * The slice of a {@link Node2D} these helpers touch: the {@link PropHost} maps\r\n * plus the internal write/tween seams. `_writeProp` and `_prepareStep` remain\r\n * methods on `Node2D`; the helpers call back through them so subclass behaviour\r\n * and the inline hot path are preserved.\r\n */\r\n/** @internal */\r\nexport interface ReactiveHost extends PropHost {\r\n readonly id: string;\r\n _writeProp(field: string, value: unknown): void;\r\n _prepareStep(to: Record<string, unknown>, duration: number, easing?: EasingFunction): TweenStepper;\r\n /** LIFO stack of save() snapshot layers; owned as an instance field on Node2D. */\r\n _stateStack: Map<string, PropSnapshot<any>>[];\r\n}\r\n\r\n/**\r\n * Create the {@link PropSlot} + accessor for a freshly-declared prop and register\r\n * its tween/mapper metadata. Extracted from `Node2D._registerProp`; defines the\r\n * getter/setter on `host` so writes route through `host._writeProp`\r\n * (mapper-aware, binding-aware).\r\n */\r\n/** @internal */\r\nexport function registerProp<Int>(host: ReactiveHost, field: string, options?: PropOptions<any, Int>): void {\r\n const slot = new PropSlot<Int>(undefined as unknown as Int, host, field);\r\n const cells = ensureCells(host);\r\n cells.slots.set(field, slot);\r\n if (options?.tween) {\r\n (cells.tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\r\n }\r\n if (options?.mapper) {\r\n (cells.mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\r\n }\r\n Object.defineProperty(host, field, {\r\n get: () => slot.get(),\r\n set: (value: any) => host._writeProp(field, value),\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n}\r\n\r\n/**\r\n * Apply (or re-apply) a prop's initial value plus optional tween/mapper. A first\r\n * call creates the cell via {@link registerProp}; a subsequent call for the same\r\n * field reuses the cell and only refines its tween/mapper (so a subclass can\r\n * override a parent default without losing the cell or its bindings), then\r\n * writes the value. Extracted from `Node2D.applyProp`.\r\n */\r\n/** @internal */\r\nexport function applyProp<Ext, Int = Ext>(\r\n host: ReactiveHost,\r\n field: string,\r\n initial: Ext | (() => Ext) | undefined,\r\n options?: PropOptions<Ext, Int>,\r\n): void {\r\n const existing = host.__cells?.slots.get(field);\r\n if (!existing) {\r\n registerProp<Int>(host, field, options);\r\n } else if (options) {\r\n // Allow subclasses to refine tween/mapper on an inherited field.\r\n if (options.tween) {\r\n (ensureCells(host).tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\r\n }\r\n if (options.mapper) {\r\n (ensureCells(host).mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\r\n }\r\n }\r\n host._writeProp(field, initial);\r\n}\r\n\r\n/** Snapshot every registered prop's current value/binding into a plain object. */\r\n/** @internal */\r\nexport function collectProperties(host: ReactiveHost): Record<string, any> {\r\n const result: Record<string, any> = {};\r\n if (host.__cells) {\r\n for (const key of host.__cells.slots.keys()) {\r\n result[key] = (host as any)[key];\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n// ---- State stack (save / restore) -----------------------------------------\r\n\r\n/**\r\n * Every declared prop of a node, captured as the value **or binding** its slot\r\n * holds — see {@link Node2D.captureProps}, which is the public way to make one.\r\n *\r\n * Keyed by prop name. Opaque on purpose: what a slot holds is the *mapped*,\r\n * internal form, and reading it out to write back through `set` is exactly the\r\n * round-trip a layer exists to avoid.\r\n */\r\nexport type PropLayer = Map<string, PropSnapshot<any>>;\r\n\r\n/** Snapshot every prop slot (value or binding) into a fresh layer. */\r\n/** @internal */\r\nexport function captureLayer(host: ReactiveHost): PropLayer {\r\n const layer: PropLayer = new Map();\r\n const slots = host.__cells?.slots;\r\n if (!slots) return layer;\r\n for (const [key, slot] of slots) {\r\n layer.set(key, slot.snapshot());\r\n }\r\n return layer;\r\n}\r\n\r\n/** Push a snapshot of every prop slot (value or binding) onto the stack. */\r\n/** @internal */\r\nexport function saveState(host: ReactiveHost): void {\r\n if (!host.__cells) return;\r\n host._stateStack.push(captureLayer(host));\r\n}\r\n\r\n/** Pop the top snapshot layer, or `undefined` if the stack is empty. */\r\n/** @internal */\r\nexport function popState(host: ReactiveHost): PropLayer | undefined {\r\n return host._stateStack.pop();\r\n}\r\n\r\n/** Instantly reapply a snapshot layer to every captured slot. */\r\n/** @internal */\r\nexport function applySnapshotLayer(host: ReactiveHost, layer: PropLayer): void {\r\n const slots = host.__cells?.slots;\r\n if (!slots) return;\r\n for (const [key, snap] of layer) {\r\n slots.get(key)?.restoreFrom(snap);\r\n }\r\n}\r\n\r\n/**\r\n * Animated restore: tween the numeric / custom-tweenable props toward their\r\n * saved resolved values, then reapply the full snapshot so bindings are\r\n * restored (not frozen at the tween's landing value) and non-tweened props snap.\r\n *\r\n * A {@link Command} rather than a generator: `_prepareStep`'s stepper already\r\n * drives the tween as a pure function of elapsed time, so `driveCommand` wraps\r\n * it directly and fires the snapshot reapply exactly at `t === 1` — the same\r\n * \"commit at the end, restore what came before below it\" shape\r\n * `packages/components/code`'s `runTransition` uses.\r\n *\r\n * `_prepareStep` is called **lazily, on the command's first evaluation**, not\r\n * when this function runs — it snapshots each prop's `from` off the *live*\r\n * node, and a generator's body (what this replaces) never ran a line until the\r\n * caller's first `.next()` either. Building it eagerly would snapshot whatever\r\n * the node happened to hold at `restore()`-call time instead of at first-drive\r\n * time, which can differ if the caller does more to the node in between.\r\n */\r\n/** @internal */\r\nexport function restoreAnimated(\r\n host: ReactiveHost,\r\n layer: PropLayer | undefined,\r\n duration: number,\r\n easing?: EasingFunction,\r\n): Command<Record<string, never>> {\r\n let stepper: TweenStepper | null = null;\r\n\r\n return driveCommand(duration, (t) => {\r\n if (!stepper) {\r\n // `to()` reads each snapshot's resolved `value` (correct even for a\r\n // bound slot), so the node animates back to where it *was*.\r\n const target: Record<string, unknown> = {};\r\n if (layer) {\r\n for (const [key, snap] of layer) {\r\n target[key] = snap.value;\r\n }\r\n }\r\n stepper = host._prepareStep(target, duration);\r\n }\r\n stepper.seek(t * duration);\r\n if (layer && t >= 1) applySnapshotLayer(host, layer);\r\n }, easing);\r\n}\r\n"]}
1
+ {"version":3,"file":"node-reactive.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AA2B7D;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAM,IAAkB,EAAE,KAAa,EAAE,OAA+B;IAChG,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAM,SAA2B,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7B,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACjB,CAAC,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,EAA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ureCells, PropHost, TweenFn } from \"@/props/host\";\nimport { EasingFunction } from \"@/tween/ease/type\";\nimport { driveCommand, type Command } from \"@/tween/command\";\nimport { TweenStepper } from \"@/tween/stepper\";\nimport { PropOptions } from \"@/attributes/properties/decorator\";\n\n/**\n * Companion implementation of {@link Node2D}'s property machinery and its\n * save/restore state stack. The bodies live here as free functions over a\n * narrow {@link ReactiveHost} so `node.ts` keeps only thin delegators (and the\n * hot-path `set`/`_writeProp`, which stay inline on the class). Mirrors the\n * existing `getPropSlot(host, name)` pattern in `props/host.ts`.\n */\n\n/**\n * The slice of a {@link Node2D} these helpers touch: the {@link PropHost} maps\n * plus the internal write/tween seams. `_writeProp` and `_prepareStep` remain\n * methods on `Node2D`; the helpers call back through them so subclass behaviour\n * and the inline hot path are preserved.\n */\n/** @internal */\nexport interface ReactiveHost extends PropHost {\n readonly id: string;\n _writeProp(field: string, value: unknown): void;\n _prepareStep(to: Record<string, unknown>, duration: number, easing?: EasingFunction): TweenStepper;\n /** LIFO stack of save() snapshot layers; owned as an instance field on Node2D. */\n _stateStack: Map<string, PropSnapshot<any>>[];\n}\n\n/**\n * Create the {@link PropSlot} + accessor for a freshly-declared prop and register\n * its tween/mapper metadata. Extracted from `Node2D._registerProp`; defines the\n * getter/setter on `host` so writes route through `host._writeProp`\n * (mapper-aware, binding-aware).\n */\n/** @internal */\nexport function registerProp<Int>(host: ReactiveHost, field: string, options?: PropOptions<any, Int>): void {\n const slot = new PropSlot<Int>(undefined as unknown as Int, host, field);\n const cells = ensureCells(host);\n cells.slots.set(field, slot);\n if (options?.tween) {\n (cells.tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\n }\n if (options?.mapper) {\n (cells.mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\n }\n Object.defineProperty(host, field, {\n get: () => slot.get(),\n set: (value: any) => host._writeProp(field, value),\n enumerable: true,\n configurable: true,\n });\n}\n\n/**\n * Apply (or re-apply) a prop's initial value plus optional tween/mapper. A first\n * call creates the cell via {@link registerProp}; a subsequent call for the same\n * field reuses the cell and only refines its tween/mapper (so a subclass can\n * override a parent default without losing the cell or its bindings), then\n * writes the value. Extracted from `Node2D.applyProp`.\n */\n/** @internal */\nexport function applyProp<Ext, Int = Ext>(\n host: ReactiveHost,\n field: string,\n initial: Ext | (() => Ext) | undefined,\n options?: PropOptions<Ext, Int>,\n): void {\n const existing = host.__cells?.slots.get(field);\n if (!existing) {\n registerProp<Int>(host, field, options);\n } else if (options) {\n // Allow subclasses to refine tween/mapper on an inherited field.\n if (options.tween) {\n (ensureCells(host).tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\n }\n if (options.mapper) {\n (ensureCells(host).mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\n }\n }\n host._writeProp(field, initial);\n}\n\n/** Snapshot every registered prop's current value/binding into a plain object. */\n/** @internal */\nexport function collectProperties(host: ReactiveHost): Record<string, any> {\n const result: Record<string, any> = {};\n if (host.__cells) {\n for (const key of host.__cells.slots.keys()) {\n result[key] = (host as any)[key];\n }\n }\n return result;\n}\n\n// ---- State stack (save / restore) -----------------------------------------\n\n/**\n * Every declared prop of a node, captured as the value **or binding** its slot\n * holds — see {@link Node2D.captureProps}, which is the public way to make one.\n *\n * Keyed by prop name. Opaque on purpose: what a slot holds is the *mapped*,\n * internal form, and reading it out to write back through `set` is exactly the\n * round-trip a layer exists to avoid.\n */\nexport type PropLayer = Map<string, PropSnapshot<any>>;\n\n/** Snapshot every prop slot (value or binding) into a fresh layer. */\n/** @internal */\nexport function captureLayer(host: ReactiveHost): PropLayer {\n const layer: PropLayer = new Map();\n const slots = host.__cells?.slots;\n if (!slots) return layer;\n for (const [key, slot] of slots) {\n layer.set(key, slot.snapshot());\n }\n return layer;\n}\n\n/** Push a snapshot of every prop slot (value or binding) onto the stack. */\n/** @internal */\nexport function saveState(host: ReactiveHost): void {\n if (!host.__cells) return;\n host._stateStack.push(captureLayer(host));\n}\n\n/** Pop the top snapshot layer, or `undefined` if the stack is empty. */\n/** @internal */\nexport function popState(host: ReactiveHost): PropLayer | undefined {\n return host._stateStack.pop();\n}\n\n/** Instantly reapply a snapshot layer to every captured slot. */\n/** @internal */\nexport function applySnapshotLayer(host: ReactiveHost, layer: PropLayer): void {\n const slots = host.__cells?.slots;\n if (!slots) return;\n for (const [key, snap] of layer) {\n slots.get(key)?.restoreFrom(snap);\n }\n}\n\n/**\n * Animated restore: tween the numeric / custom-tweenable props toward their\n * saved resolved values, then reapply the full snapshot so bindings are\n * restored (not frozen at the tween's landing value) and non-tweened props snap.\n *\n * A {@link Command} rather than a generator: `_prepareStep`'s stepper already\n * drives the tween as a pure function of elapsed time, so `driveCommand` wraps\n * it directly and fires the snapshot reapply exactly at `t === 1` — the same\n * \"commit at the end, restore what came before below it\" shape\n * `packages/components/code`'s `runTransition` uses.\n *\n * `_prepareStep` is called **lazily, on the command's first evaluation**, not\n * when this function runs — it snapshots each prop's `from` off the *live*\n * node, and a generator's body (what this replaces) never ran a line until the\n * caller's first `.next()` either. Building it eagerly would snapshot whatever\n * the node happened to hold at `restore()`-call time instead of at first-drive\n * time, which can differ if the caller does more to the node in between.\n */\n/** @internal */\nexport function restoreAnimated(\n host: ReactiveHost,\n layer: PropLayer | undefined,\n duration: number,\n easing?: EasingFunction,\n): Command<Record<string, never>> {\n let stepper: TweenStepper | null = null;\n\n return driveCommand(duration, (t) => {\n if (!stepper) {\n // `to()` reads each snapshot's resolved `value` (correct even for a\n // bound slot), so the node animates back to where it *was*.\n const target: Record<string, unknown> = {};\n if (layer) {\n for (const [key, snap] of layer) {\n target[key] = snap.value;\n }\n }\n stepper = host._prepareStep(target, duration);\n }\n stepper.seek(t * duration);\n if (layer && t >= 1) applySnapshotLayer(host, layer);\n }, easing);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node-time.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-time.ts"],"names":[],"mappings":"AAoCA,iEAAiE;AACjE,MAAM,UAAU,cAAc;IAC1B,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACjE,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,IAAqB,EAAE,KAAa;IAChE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzC,CAAC","sourcesContent":["/**\r\n * A node's place on the scene's clock, read via `node.time`.\r\n *\r\n * Advanced once per frame by `Node.attach`, and consumed by motion sampling,\r\n * the render context's `elapsed`, and anything a node's own `tick()` derives\r\n * from time.\r\n *\r\n * `creation` is seeded on the node's **first** advance rather than at\r\n * construction, so `elapsed` measures how long a node has been *in the scene* —\r\n * which is what an entrance animation, a video's playhead and a per-node\r\n * dissolve all actually mean. A node built during the generator's third second\r\n * and added then reads `elapsed === 0` on its first frame.\r\n */\r\nexport interface NodeTime {\r\n /** Seconds since the clip started. */\r\n readonly total: number;\r\n /** The clip time at which this node was first advanced. */\r\n readonly creation: number;\r\n /** How long this node has existed: `total - creation`. */\r\n readonly elapsed: number;\r\n}\r\n\r\n/**\r\n * The writable form the runtime advances. Nodes hand out {@link NodeTime}, which\r\n * is the same shape with every field read-only.\r\n *\r\n * @internal\r\n */\r\nexport interface MutableNodeTime {\r\n total: number;\r\n creation: number;\r\n elapsed: number;\r\n /** Whether {@link advanceNodeTime} has seeded `creation` yet. */\r\n started: boolean;\r\n}\r\n\r\n/** The zeroed holder a node keeps for its lifetime. @internal */\r\nexport function createNodeTime(): MutableNodeTime {\r\n return { total: 0, creation: 0, elapsed: 0, started: false };\r\n}\r\n\r\n/** Advance `time` to `total` clip-seconds, seeding `creation` on first tick. @internal */\r\nexport function advanceNodeTime(time: MutableNodeTime, total: number): void {\r\n if (!time.started) {\r\n time.creation = total;\r\n time.started = true;\r\n }\r\n time.total = total;\r\n time.elapsed = total - time.creation;\r\n}\r\n"]}
1
+ {"version":3,"file":"node-time.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-time.ts"],"names":[],"mappings":"AAoCA,iEAAiE;AACjE,MAAM,UAAU,cAAc;IAC1B,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACjE,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,IAAqB,EAAE,KAAa;IAChE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzC,CAAC","sourcesContent":["/**\n * A node's place on the scene's clock, read via `node.time`.\n *\n * Advanced once per frame by `Node.attach`, and consumed by motion sampling,\n * the render context's `elapsed`, and anything a node's own `tick()` derives\n * from time.\n *\n * `creation` is seeded on the node's **first** advance rather than at\n * construction, so `elapsed` measures how long a node has been *in the scene* —\n * which is what an entrance animation, a video's playhead and a per-node\n * dissolve all actually mean. A node built during the generator's third second\n * and added then reads `elapsed === 0` on its first frame.\n */\nexport interface NodeTime {\n /** Seconds since the clip started. */\n readonly total: number;\n /** The clip time at which this node was first advanced. */\n readonly creation: number;\n /** How long this node has existed: `total - creation`. */\n readonly elapsed: number;\n}\n\n/**\n * The writable form the runtime advances. Nodes hand out {@link NodeTime}, which\n * is the same shape with every field read-only.\n *\n * @internal\n */\nexport interface MutableNodeTime {\n total: number;\n creation: number;\n elapsed: number;\n /** Whether {@link advanceNodeTime} has seeded `creation` yet. */\n started: boolean;\n}\n\n/** The zeroed holder a node keeps for its lifetime. @internal */\nexport function createNodeTime(): MutableNodeTime {\n return { total: 0, creation: 0, elapsed: 0, started: false };\n}\n\n/** Advance `time` to `total` clip-seconds, seeding `creation` on first tick. @internal */\nexport function advanceNodeTime(time: MutableNodeTime, total: number): void {\n if (!time.started) {\n time.creation = total;\n time.started = true;\n }\n time.total = total;\n time.elapsed = total - time.creation;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node-walk.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-walk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAU,EAAE,KAAiB;IACrD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAAC,IAAU,EAAE,KAAiB;IACrD,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO;IAC1B,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAU,EAAE,KAAyC;IAC9E,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,WAAW,CAAC,IAAU,EAAE,IAAY,EAAE,KAAyC;IACpF,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO;IAC1B,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACjG,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAU,EAAE,IAAU;IAC9C,IAAwD,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAU;IACjC,IAAI,CAAC,OAAO,EAAE,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;QAAE,UAAU,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAU,EAAE,EAAU;IAClD,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACtB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;QAAE,eAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { nodePath } from \"@/project/tree\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport type { Node } from \"./node\";\r\n\r\n/**\r\n * The subtree traversals the runtime drives, as free functions over a {@link Node}:\r\n * what is left on `Node` is what a node *is*, and what is here is what the engine\r\n * *does to* one. Every walk stops at an unmounted node — see {@link Node.mounted}.\r\n *\r\n * @internal\r\n */\r\n\r\n/**\r\n * Declare one node's own assets — never its children's, so each node's\r\n * declarations stay attributable to it.\r\n */\r\nexport function declareNode(node: Node, scope: AssetScope): void {\r\n node.declareAssets(scope);\r\n}\r\n\r\n/** {@link declareNode} over `root` and every mounted descendant, in every dimension. */\r\nexport function declareTree(root: Node, scope: AssetScope): void {\r\n if (!root.mounted) return;\r\n declareNode(root, scope);\r\n const children = root._allChildren;\r\n for (let i = 0; i < children.length; i++) declareTree(children[i], scope);\r\n}\r\n\r\n/**\r\n * Visit `root` and every mounted descendant with its structural path.\r\n *\r\n * Indexed over every dimension's children, so a path does not shift when a sibling\r\n * of another dimension comes or goes the way a filtered `children` index would.\r\n */\r\nexport function forEachOwner(root: Node, visit: (node: Node, path: string) => void): void {\r\n visitOwners(root, \"\", visit);\r\n}\r\n\r\nfunction visitOwners(node: Node, path: string, visit: (node: Node, path: string) => void): void {\r\n if (!node.mounted) return;\r\n visit(node, path);\r\n const children = node._allChildren;\r\n for (let i = 0; i < children.length; i++) visitOwners(children[i], nodePath(path, i), visit);\r\n}\r\n\r\n/**\r\n * Bind `node` with `host`'s catalog, context and clock without adopting it — what a\r\n * runtime passes as `AssetDeclaration`'s `bindSubtree` for a `Tex.surface` source.\r\n */\r\nexport function bindDetached(host: Node, node: Node): void {\r\n (host as unknown as { attachDetached(node: Node): void }).attachDetached(node);\r\n}\r\n\r\n/**\r\n * Sample every node's derived render state (currently motion) for this frame.\r\n *\r\n * Normally done by `attach` as it advances the clock; this is the seam for the\r\n * priming path, which needs the same state seeded without moving time (see\r\n * `StateEvaluator.resetSlot`).\r\n */\r\nexport function sampleTree(node: Node): void {\r\n node._sample();\r\n for (const child of node.children) sampleTree(child);\r\n}\r\n\r\n/**\r\n * Record the subtree's current positions as the motion history's previous frame,\r\n * stamped `at`, deriving no velocity.\r\n *\r\n * The driven path calls this with the props evaluated one frame back, so the\r\n * {@link sampleTree} that follows measures against the timeline rather than\r\n * against wherever the playhead happened to be.\r\n */\r\nexport function primeMotionTree(node: Node, at: number): void {\r\n node._primeMotion(at);\r\n for (const child of node.children) primeMotionTree(child, at);\r\n}\r\n"]}
1
+ {"version":3,"file":"node-walk.js","sourceRoot":"","sources":["../../../../src/components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D,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAU;IACjC,IAAI,CAAC,OAAO,EAAE,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;QAAE,UAAU,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAU,EAAE,EAAU;IAClD,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACtB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;QAAE,eAAe,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { nodePath } from \"@/project/tree\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport type { Node } from \"./node\";\n\n/**\n * The subtree traversals the runtime drives, as free functions over a {@link Node}:\n * what is left on `Node` is what a node *is*, and what is here is what the engine\n * *does to* one. Every walk stops at an unmounted node — see {@link Node.mounted}.\n *\n * @internal\n */\n\n/**\n * Declare one node's own assets — never its children's, so each node's\n * declarations stay attributable to it.\n */\nexport function declareNode(node: Node, scope: AssetScope): void {\n node.declareAssets(scope);\n}\n\n/** {@link declareNode} over `root` and every mounted descendant, in every dimension. */\nexport function declareTree(root: Node, scope: AssetScope): void {\n if (!root.mounted) return;\n declareNode(root, scope);\n const children = root._allChildren;\n for (let i = 0; i < children.length; i++) declareTree(children[i], scope);\n}\n\n/**\n * Visit `root` and every mounted descendant with its structural path.\n *\n * Indexed over every dimension's children, so a path does not shift when a sibling\n * of another dimension comes or goes the way a filtered `children` index would.\n */\nexport function forEachOwner(root: Node, visit: (node: Node, path: string) => void): void {\n visitOwners(root, \"\", visit);\n}\n\nfunction visitOwners(node: Node, path: string, visit: (node: Node, path: string) => void): void {\n if (!node.mounted) return;\n visit(node, path);\n const children = node._allChildren;\n for (let i = 0; i < children.length; i++) visitOwners(children[i], nodePath(path, i), visit);\n}\n\n/**\n * Bind `node` with `host`'s catalog, context and clock without adopting it — what a\n * runtime passes as `AssetDeclaration`'s `bindSubtree` for a `Tex.surface` source.\n */\nexport function bindDetached(host: Node, node: Node): void {\n (host as unknown as { attachDetached(node: Node): void }).attachDetached(node);\n}\n\n/**\n * Sample every node's derived render state (currently motion) for this frame.\n *\n * Normally done by `attach` as it advances the clock; this is the seam for the\n * priming path, which needs the same state seeded without moving time (see\n * `StateEvaluator.resetSlot`).\n */\nexport function sampleTree(node: Node): void {\n node._sample();\n for (const child of node.children) sampleTree(child);\n}\n\n/**\n * Record the subtree's current positions as the motion history's previous frame,\n * stamped `at`, deriving no velocity.\n *\n * The driven path calls this with the props evaluated one frame back, so the\n * {@link sampleTree} that follows measures against the timeline rather than\n * against wherever the playhead happened to be.\n */\nexport function primeMotionTree(node: Node, at: number): void {\n node._primeMotion(at);\n for (const child of node.children) primeMotionTree(child, at);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAsD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAW,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAe,MAAM,mCAAmC,CAAC;AACjG,OAAO,EACH,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,SAAS,GACZ,MAAM,iBAAiB,CAAC;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C;YACnB,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,oFAAoF;QACpF,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;CACJ;AAED,cAAc,CAAC,IAAI,EAAE;IACjB,EAAE,EAAE,OAAO,EAAE;IACb,OAAO,EAAE,OAAO,EAAE;IAClB,UAAU,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { _observer, PropSlot } from \"@/props/slot\";\r\nimport { STRUCTURE_SLOT } from \"@/props/observer\";\r\nimport { PropHost, type PropCells } from \"@/props/host\";\r\nimport { EasingFunction } from \"@/tween/ease/type\";\r\nimport { toCommand } from \"@/tween/to-command\";\r\nimport { makeCommand, type Command, type CommandArgs, type CommandTarget } from \"@/tween/command\";\r\nimport { prepareNumericCellTween } from \"@/tween/prepare\";\r\nimport { inertCommand, inertStepper } from \"@/tween/inert\";\r\nimport { TweenStepper } from \"@/tween/stepper\";\r\nimport { RefTarget } from \"@/util/reference\";\r\nimport { Context, ContextMap } from \"@/util/context\";\r\nimport { AssetCatalog } from \"@/assets/catalog\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport { declareMembers, getPropertyMeta, PropOptions } from \"@/attributes/properties/decorator\";\r\nimport {\r\n applyProp,\r\n applySnapshotLayer,\r\n collectProperties,\r\n popState,\r\n restoreAnimated,\r\n saveState,\r\n} from \"./node-reactive\";\r\nimport type { PropLayer } from \"./node-reactive\";\r\nimport { advanceNodeTime, createNodeTime, type MutableNodeTime, type NodeTime } from \"@/components/trees/node/node-time\";\r\nimport type { PropInputs } from \"@/attributes/properties/inputs\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\nexport type { NodeTime } from \"@/components/trees/node/node-time\";\r\nexport type { PropInput, PropInputs } from \"@/attributes/properties/inputs\";\r\n\r\n/** Which scene graph a node belongs to. See {@link Node.dimension}. */\r\nexport type NodeDimension = \"2d\" | \"3d\" | \"audio\";\r\n\r\n/** Where a node of each dimension is allowed to live, for the mismatch error. */\r\nconst HOSTS_OF: Record<NodeDimension, string> = {\r\n \"2d\": \"2D nodes go in the 2D tree, or inside a Canvas3D as a HUD over its scene.\",\r\n \"3d\": \"Put 3D nodes inside a Canvas3D, which is the one node that holds both.\",\r\n audio: \"Put audio nodes under an AudioBus, or directly on the scene root.\",\r\n};\r\n\r\nexport interface NodeMetadata<T extends Node> {\r\n /**\r\n * Handle written with this node at construction. Typed as {@link RefTarget}\r\n * rather than `Reference<T>` so a ref declared as one of `T`'s *supertypes*\r\n * is accepted (`createRef<Node2D>()` on a `<Rect>`) — see the note there\r\n * for why that direction is the sound one.\r\n */\r\n ref?: RefTarget<T>;\r\n}\r\n\r\nexport type NodeConfig<T extends Node, P> = PropInputs<P> & NodeMetadata<T>;\r\n\r\n/**\r\n * Everything {@link Node.attach} needs to put a subtree into a live scene.\r\n *\r\n * The three things tree membership supplies, and the only three: what assets are\r\n * available, what context the ancestors provide, and where the playhead is.\r\n */\r\nexport interface AttachScope {\r\n /** Metadata for the assets this scene may declare. */\r\n assets: AssetCatalog;\r\n /** The token map the parent provides to this node. */\r\n context: ContextMap;\r\n /** Clip-relative time, in seconds. */\r\n time: number;\r\n}\r\n\r\n/**\r\n * A `children` child: a single {@link Node}, an arbitrarily-nested array of\r\n * children, or a falsy value. Nesting is allowed so `.map()` results can be\r\n * dropped straight in as a child, and falsy values are allowed so\r\n * `condition && Rect({ … })` works — the constructor flattens\r\n * (`.flat(Infinity)`) and filters out everything but `Node` instances.\r\n */\r\nexport type NodeChildren = Node | false | null | undefined | NodeChildren[];\r\n\r\n/**\r\n * The props every node has, in either dimension.\r\n *\r\n * Deliberately tiny. Everything that reads as \"a box on a page\" — `x`/`y`,\r\n * `width`/`height`, `padding`, `flex`, anchors, `opacity` — lives on\r\n * {@link Node2DProps}, and everything that reads as \"a thing in space\" —\r\n * `position`, `quaternion`, `castShadow` — lives on `Node3DProps`, because a\r\n * prop that means nothing for half the tree is worse than no prop at all.\r\n */\r\nexport interface NodeProps {\r\n children: NodeChildren;\r\n /**\r\n * Seeds {@link Node.id}. A document's `NodeSpec.id` supplies it — see\r\n * `Registry.instantiate` — so an instantiated node answers to the identity\r\n * its row was authored under. Left out, the node falls back to a UUID, which\r\n * is what every hand-written `new Rect({…})` and component call gets.\r\n */\r\n id?: string;\r\n /**\r\n * The handle a node is *referenced by*, as against {@link NodeProps.id},\r\n * which addresses it. `\"=[card.x]\"` in any prop reads the `x` of the node\r\n * keyed `card` — see `NodeSpec.key`.\r\n *\r\n * Optional and never generated — a node has one only because an author wrote\r\n * one, which is what makes it safe to point a formula at — and unique per\r\n * document, which `document/validate.ts` enforces.\r\n */\r\n key?: string;\r\n}\r\n\r\n/**\r\n * The dimension-agnostic base of the scene graph: tree, identity, reactive\r\n * properties, commands, context, clock, asset declaration, teardown. Nothing\r\n * about *where* a node is or *how* it draws — that's {@link Node2D} / `Node3D`.\r\n * They meet only at `Canvas3D`; mixing them anywhere else throws (see\r\n * {@link acceptsChild}).\r\n *\r\n * Subclasses call {@link initProps} from their own constructor rather than the\r\n * base doing it: a subclass's field initializers only run *after* `super()`\r\n * returns, so applying `property` defaults any earlier would write into cells\r\n * that don't exist yet.\r\n */\r\nexport abstract class Node<P extends NodeProps = NodeProps> implements PropHost {\r\n /**\r\n * Which scene graph this node belongs to.\r\n *\r\n * A getter rather than a field so it is answerable from the prototype during\r\n * construction, before any subclass field initializer has run.\r\n */\r\n abstract get dimension(): NodeDimension;\r\n\r\n /** The trees this type takes children from, answerable from the prototype as {@link dimension} is. */\r\n get _childTrees(): readonly NodeDimension[] {\r\n return [this.dimension];\r\n }\r\n\r\n constructor(props?: NodeConfig<any, P>) {\r\n // Retain the raw props (see _props doc) so a provider's provideContext can\r\n // read which keys the author passed. Captured before any default\r\n // application so it reflects exactly what the author passed. The object is\r\n // retained by reference, so a subclass expanding prop sugar in place\r\n // afterwards (`size`, `transform3D`) is reflected here too.\r\n this._props = props;\r\n // Neither is a property: identity does not tween, so neither has any\r\n // business in the table `set()`, `to()` and the baseline restore walk\r\n // iterate.\r\n const identity = props as { id?: string; key?: string } | undefined;\r\n this.key = identity?.key;\r\n // Nullish, never falsy: `\"\"` is the scene root's real id, not a missing\r\n // one (`checkRootShape` in document/validate.ts defines the root as the\r\n // row holding it), and a UUID in its place would have the host's tree\r\n // report a root no document row mentions.\r\n this.id = identity?.id ?? crypto.randomUUID();\r\n }\r\n\r\n /** See {@link NodeProps.key}. */\r\n key?: string;\r\n\r\n private _hidden = false;\r\n private _locked = false;\r\n\r\n /**\r\n * Hidden by the editor — no paint, no pick, no layout slot. See\r\n * {@link NodeEditorState.hidden}.\r\n */\r\n get hidden(): boolean {\r\n return this._hidden;\r\n }\r\n\r\n /** Locked by the editor — unpickable, but drawn. See {@link NodeEditorState.locked}. */\r\n get locked(): boolean {\r\n return this._locked;\r\n }\r\n\r\n /**\r\n * @internal — written only by `applyEditorStates`, which owns both flags for\r\n * the whole tree. Not a setter pair, so a caller cannot set one and leave the\r\n * other holding a previous frame's answer.\r\n */\r\n _setEditorState(hidden: boolean, locked: boolean): void {\r\n this._hidden = hidden;\r\n this._locked = locked;\r\n }\r\n\r\n /**\r\n * Fire the `ref` and apply every declared property, reading\r\n * initial values from `props`.\r\n *\r\n * Called by the concrete constructor ({@link Node2D}'s, `Node3D`'s) rather\r\n * than by this one, because a subclass's field initializers run *after*\r\n * `super()` returns: doing this here would apply props while the cells those\r\n * props write into are still `undefined`.\r\n */\r\n protected initProps(props?: NodeConfig<any, P>): void {\r\n if (props?.ref) {\r\n props.ref(this as any);\r\n }\r\n\r\n // Apply every declared property, reading initial values from props.\r\n for (const meta of getPropertyMeta(this)) {\r\n const propsVal = props ? (props as any)[meta.key] : undefined;\r\n const initial = propsVal !== undefined ? propsVal : meta.default;\r\n this.applyProp(meta.key, initial, meta.options);\r\n }\r\n }\r\n\r\n /**\r\n * Adopt the `children` prop. Called by the concrete constructor after its own\r\n * defaults are in place, so a child never lands in a tree whose parent has not\r\n * finished sizing itself.\r\n */\r\n protected adoptChildrenProp(props?: NodeConfig<any, P>): void {\r\n if (props && (props as any).children) {\r\n const raw = Array.isArray((props as any).children) ? (props as any).children : [(props as any).children];\r\n const flat = (raw as unknown[]).flat(Infinity)\r\n .filter((c: unknown): c is Node => c instanceof Node);\r\n if (flat.length > 0) this._addChildren(flat);\r\n }\r\n }\r\n\r\n /**\r\n * Whether `child` may be adopted by this node.\r\n *\r\n * A node holds children of its own dimension; the places the trees meet are\r\n * `Canvas3D`, which takes 2D and 3D, and `Canvas2D`, which takes 2D and\r\n * audio. Both partition what they accept. Rejecting the mix here rather than\r\n * letting it through is deliberate: a `Box3D` parented to a `Rect` would be\r\n * silently skipped by both the layout walk and the 3D walk, and would simply\r\n * never appear.\r\n */\r\n protected acceptsChild(child: Node): boolean {\r\n return child.dimension === this.dimension;\r\n }\r\n\r\n /** Throw if `child` cannot go here: by its tree, by what this node takes, or by where the child says it goes. */\r\n protected assertAcceptsChild(child: Node): void {\r\n if (!this.acceptsChild(child)) {\r\n const why = child.dimension === this.dimension ? this._childRule() : HOSTS_OF[child.dimension];\r\n throw new TypeError(`${this.className} (${this.dimension}) cannot hold ${child.className} (${child.dimension}).${why ? ` ${why}` : \"\"}`);\r\n }\r\n const refusal = child._parentRefusal(this);\r\n if (refusal) throw new TypeError(refusal);\r\n }\r\n\r\n /** What this node takes, for the error when it refuses a child of its own tree. */\r\n protected _childRule(): string {\r\n return \"\";\r\n }\r\n\r\n /** Why this node cannot go inside `parent`, or `null`: only a node that names its parents refuses one. */\r\n _parentRefusal(_parent: Node): string | null {\r\n return null;\r\n }\r\n\r\n private _assets: AssetCatalog | null = null;\r\n protected _parent: Node | null = null;\r\n\r\n /**\r\n * Whether this node is in a live scene tree. Gates measure/layout/render,\r\n * asset declaration and every command — checked at the handful of places\r\n * the framework dispatches from, not per method.\r\n */\r\n private _mounted = false;\r\n\r\n /** See {@link _mounted}. */\r\n get mounted(): boolean {\r\n return this._mounted;\r\n }\r\n\r\n get parent(): Node | null {\r\n if (_observer !== null) _observer.read(this._structureSlot());\r\n return this._parent;\r\n }\r\n\r\n get assets(): AssetCatalog {\r\n if (!this._assets) throw new Error(\"Assets not bound — this node is not attached to a scene. See Node.attach().\");\r\n return this._assets;\r\n }\r\n\r\n /** Token→value map pushed down from ancestor providers, bound by {@link attach}. */\r\n private _context: ContextMap = ContextMap.EMPTY;\r\n /** True once {@link attach} has reached this node. */\r\n private _contextBound = false;\r\n\r\n /** Raw constructor props, retained so {@link provideContext} can see which keys were explicitly passed. Kept through {@link dispose} so a reused instance re-derives context on the next attach. */\r\n protected _props?: NodeConfig<any, P>;\r\n\r\n /** Read the nearest ancestor provider's value for `ctx` (or its default). */\r\n useContext<T>(ctx: Context<T>): T {\r\n return this._context.get(ctx);\r\n }\r\n\r\n /** Assigned in the constructor — see {@link NodeProps.id}. */\r\n readonly id: string;\r\n\r\n /**\r\n * The slots behind this node's `property` fields. See {@link PropCells}.\r\n *\r\n * @internal — the authoring surface is the declared props themselves, plus\r\n * `set()`/`to()`/`captureProps()`.\r\n */\r\n __cells?: PropCells;\r\n\r\n protected _children: Node[] = [];\r\n\r\n /**\r\n * Flatten a constructor's raw `children` prop into the `Node` instances it\r\n * contains, without mutating or adding them — the same normalisation the\r\n * constructor applies before adding them, exposed standalone so\r\n * {@link applyDefaultSize} overrides can inspect children's own resolved\r\n * `width`/`height` *before* they're attached (children are constructed,\r\n * defaults and all, before being passed in as props).\r\n */\r\n protected static flattenChildrenProp(props: { children?: unknown } | undefined): Node[] {\r\n const childProp = props ? props.children : undefined;\r\n if (!childProp) return [];\r\n const raw = Array.isArray(childProp) ? childProp : [childProp];\r\n return (raw as unknown[]).flat(Infinity).filter((c: unknown): c is Node => c instanceof Node);\r\n }\r\n\r\n // ---- Reactive properties ----------------------------------------------\r\n\r\n /**\r\n * Declare a prop on this node. Creates a {@link PropSlot}-backed accessor\r\n * for `field`, applies an initial value (callback → binding; otherwise\r\n * constant), and registers optional tween/mapper metadata used by `set()`\r\n * and `to()`.\r\n *\r\n * Subsequent calls for the same field reuse the existing slot and act as\r\n * a value assignment, so subclasses can override a parent's default by\r\n * calling applyProp again without losing the slot or its bindings.\r\n */\r\n protected applyProp<Ext, Int = Ext>(\r\n field: string,\r\n initial: Ext | (() => Ext) | undefined,\r\n options?: PropOptions<Ext, Int>,\r\n ): void {\r\n applyProp(this, field, initial, options);\r\n }\r\n\r\n /** @internal Hot-path prop write (mapper- and binding-aware). Public-but-underscored like `_prepareStep` so reactive companions in this directory can call it; not part of the authoring surface. */\r\n _writeProp(field: string, value: unknown): void {\r\n if (value === undefined) return;\r\n const slot = this.__cells?.slots.get(field);\r\n if (!slot) return;\r\n const mapper = this.__cells?.mappers?.get(field);\r\n if (typeof value === \"function\") {\r\n const extFn = value as () => any;\r\n if (mapper) {\r\n // A binding that reads `undefined` — a node reference to a node that is\r\n // not there — leaves the prop as a node built without it, and never\r\n // reaches the mapper, which holds the shape the prop's readers go through.\r\n let unset: { value: unknown } | undefined;\r\n slot.bind(() => {\r\n const read = extFn();\r\n return read === undefined\r\n ? (unset ??= { value: this._unsetValue(field, mapper) }).value\r\n : mapper(read, slot.get());\r\n });\r\n } else {\r\n slot.bind(extFn);\r\n }\r\n } else {\r\n slot.set(mapper ? mapper(value, slot.get()) : value);\r\n }\r\n }\r\n\r\n get properties(): P {\r\n return collectProperties(this) as P;\r\n }\r\n\r\n /**\r\n * This node's **class** name, for a message or a host's type column. Not an\r\n * authored identity — those are {@link id} and {@link key}, and nothing in\r\n * the document model is called a name any more. Nor is it the registry key a\r\n * document writes in `NodeSpec.type`: a minifier is free to rename a class.\r\n */\r\n get className(): string {\r\n return this.constructor.name;\r\n }\r\n\r\n set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\r\n const slots = this.__cells?.slots;\r\n if (!slots) return;\r\n // Iterate the caller's keys (usually 1–3) rather than every registered\r\n // prop (15+): set() runs in the per-frame hot path. Only keys backed by\r\n // a slot are written; unknown keys are ignored — which is also what\r\n // lets a subclass distribute its own sugar (2D's `size`, `transform3D`)\r\n // into real keys and then delegate here.\r\n for (const key in props) {\r\n const val = (props as any)[key];\r\n if (val !== undefined && slots.has(key)) this._writeProp(key, val);\r\n }\r\n }\r\n\r\n to<D extends Partial<P> = Partial<P>>(args: CommandArgs<D> & { duration: number }): Command<P> {\r\n return toCommand<P>(this, args.data ?? {}, args.duration, args.easing);\r\n }\r\n\r\n /**\r\n * Build a {@link Command} from a pure function of normalized time — an\r\n * animation this node can be *evaluated* at, not only run through. The pair\r\n * to {@link to}, for the built-in commands whose values at `t` are not a prop\r\n * list, and what a component command's timeline lowers to.\r\n *\r\n * Snapshot whatever the animation starts from *outside* `at`: reading a prop\r\n * inside it would re-read the value the command is itself writing.\r\n */\r\n protected command<Props = P>(\r\n at: (t: number) => Partial<Props>,\r\n duration: number = 1,\r\n easing?: EasingFunction,\r\n ): Command<Props> {\r\n if (!this._mounted) return inertCommand<Props>(this, duration);\r\n return makeCommand<Props>(\r\n this as unknown as CommandTarget<Props>,\r\n at,\r\n duration,\r\n easing,\r\n );\r\n }\r\n\r\n /**\r\n * Resolve a single `to()` step into a flat {@link TweenStepper} — all the\r\n * per-key setup (mapper, numeric-vs-custom routing) happens once here, then\r\n * `advance(dt)` is allocation-free. Used by both a chain's iterator path and\r\n * the batched `parallel` path.\r\n *\r\n * A subclass with positional sugar of its own (2D's `size` and anchors)\r\n * expands `to` in place and then delegates here.\r\n */\r\n _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\r\n if (!this._mounted) return inertStepper(duration);\r\n // A tween runs in stored space, so the destination is mapped once, here,\r\n // and every step after it is a stored value written to the slot as it is.\r\n // Writing a step through the setter would map it a second time, which only\r\n // an idempotent mapper survives.\r\n const numCells: PropSlot<number>[] = [];\r\n const numFrom: number[] = [];\r\n const numEnd: number[] = [];\r\n const customLerps: Array<(t: number) => void> = [];\r\n const stringSnaps: Array<[PropSlot<string>, string]> = [];\r\n\r\n for (const key of Object.keys(to)) {\r\n const slot = this.__cells?.slots.get(key);\r\n if (!slot) continue;\r\n const extVal = (to as any)[key];\r\n const mapper = this.__cells?.mappers?.get(key);\r\n const targetVal = mapper ? mapper(extVal, (this as any)[key]) : extVal;\r\n const tweenFn = this.__cells?.tweens?.get(key);\r\n if (tweenFn) {\r\n const from = (this as any)[key];\r\n customLerps.push((t) => {\r\n slot.set(tweenFn(from, targetVal, t));\r\n });\r\n } else if (typeof targetVal === 'number') {\r\n numCells.push(slot as PropSlot<number>);\r\n numFrom.push((this as any)[key] as number);\r\n numEnd.push(targetVal as number);\r\n } else if (typeof targetVal === 'string') {\r\n stringSnaps.push([slot as PropSlot<string>, targetVal]);\r\n }\r\n }\r\n\r\n const lerp = prepareNumericCellTween(numCells, numFrom, numEnd);\r\n const hasCustom = customLerps.length > 0;\r\n const hasSnaps = stringSnaps.length > 0;\r\n\r\n const apply = (t: number): void => {\r\n const easedT = easing ? easing(t) : t;\r\n lerp(easedT);\r\n if (hasCustom) for (const fn of customLerps) fn(easedT);\r\n // A discrete prop has nothing between its endpoints, so it snaps at\r\n // the end rather than interpolating. Applied here rather than only in\r\n // `advance` because a `seek` past the end has, by definition, reached\r\n // that end — leaving it out meant `seek(duration)` and running to\r\n // `duration` produced different nodes, and only the second was right.\r\n if (hasSnaps && t >= 1) for (const [slot, val] of stringSnaps) slot.set(val);\r\n };\r\n\r\n let elapsed = 0;\r\n return {\r\n // Tracks `elapsed`, so a seek and a subsequent advance agree about\r\n // where the tween is. Without it, seeking forward then advancing\r\n // rewound to `dt`.\r\n seek: (e: number) => {\r\n elapsed = e;\r\n apply(duration > 0 ? Math.min(e / duration, 1) : 1);\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n if (elapsed < duration) {\r\n apply(elapsed / duration);\r\n return false;\r\n }\r\n apply(1);\r\n return true;\r\n },\r\n };\r\n }\r\n\r\n /** What a node constructed without `field` holds: its declared default, through the mapper. */\r\n private _unsetValue(field: string, mapper: (ext: any, prev?: any) => any): unknown {\r\n const declared = getPropertyMeta(this).find((meta) => meta.key === field)?.default;\r\n const initial = typeof declared === \"function\" ? declared() : declared;\r\n return initial === undefined ? undefined : mapper(initial, undefined);\r\n }\r\n\r\n // ---- State stack (save / restore) -------------------------------------\r\n // A per-node LIFO stack of property snapshots, mirroring Motion Canvas's\r\n // node.save()/restore(). `save()` pushes a snapshot of every declared prop;\r\n // `restore()` pops the most recent one and either snaps to it (no duration)\r\n // or tweens the numeric props back to it over `duration`.\r\n\r\n /** @internal LIFO stack of save() snapshot layers. Underscore-internal so the prop companion can read it; not authoring surface. */\r\n _stateStack: PropLayer[] = [];\r\n\r\n /**\r\n * Push a snapshot of this node's current state onto its save stack.\r\n *\r\n * Every reactive prop (`x`, `y`, `scale`, `opacity`, `fill`, …) is captured,\r\n * preserving reactive bindings — a prop bound to `() => other().x` is saved\r\n * as the binding, not just its resolved value, so {@link restore} re-binds\r\n * it rather than freezing the value. Calls stack: each `save()` pushes a new\r\n * layer, and each {@link restore} pops the most recent one.\r\n *\r\n * @example\r\n * node.save();\r\n * node.moveTo({ data: { x: 200, y: 0 }, duration: 1 });\r\n * node.restore({ duration: 1 }); // animate back to where it was saved\r\n */\r\n save(): void {\r\n saveState(this);\r\n }\r\n\r\n /**\r\n * Pop the most recent {@link save} snapshot and roll this node back to it.\r\n *\r\n * Called with no `duration` (or `0`), every prop is reapplied instantly —\r\n * plain values are set, reactive bindings are re-bound. Called with a\r\n * positive `duration`, the numeric props (and any with a custom `tween`)\r\n * animate toward their saved values over that many seconds; once the tween\r\n * finishes the full snapshot is reapplied, which re-binds any reactive props\r\n * and snaps non-tweenable props (e.g. strings) to their saved values.\r\n *\r\n * A no-op (returns immediately) if there is nothing on the stack.\r\n */\r\n restore(): void;\r\n restore(args: CommandArgs<Record<string, never>> & { duration: number }): Command<Record<string, never>>;\r\n restore(args?: CommandArgs<Record<string, never>>): void | Command<Record<string, never>> {\r\n const layer = popState(this);\r\n const duration = args?.duration;\r\n if (duration === undefined || duration <= 0) {\r\n if (layer) applySnapshotLayer(this, layer);\r\n return;\r\n }\r\n return restoreAnimated(this, layer, duration, args?.easing);\r\n }\r\n\r\n // ---- Clock ------------------------------------------------------------\r\n\r\n protected _time: MutableNodeTime = createNodeTime();\r\n\r\n /** This node's place on the scene clock. See {@link NodeTime}. */\r\n public get time(): NodeTime {\r\n if (_observer !== null) _observer.clock?.(this);\r\n return this._time;\r\n }\r\n\r\n /**\r\n * Advance **this node's** clock to `total` clip-seconds and sample its\r\n * derived render state.\r\n *\r\n * Per-node, not per-subtree: {@link attach} already recurses, so a recursive\r\n * advance here would re-advance every descendant once per ancestor.\r\n *\r\n * Sampling happens here, not at render: this runs on every advanced frame in\r\n * every playback path (forward, scrub, precomp), whereas `render` runs only\r\n * for displayed frames. Sampling per-frame is what makes velocity correct on\r\n * the first frame after a scrub/rewind, where sampling only at render time\r\n * read zero. The advance loop runs before `generator.next()` (so audio\r\n * scheduling in generator bodies reads the right time), which means x/y here\r\n * still hold the previous frame's value — velocity therefore trails the\r\n * rendered position by one frame. That lag is constant and identical forward\r\n * vs. scrub, and imperceptible for motion blur.\r\n */\r\n private _advanceOwnTime(total: number): void {\r\n advanceNodeTime(this._time, total);\r\n this._sample();\r\n }\r\n\r\n /**\r\n * Sample this node's own derived render state for the current frame. Nothing\r\n * to derive in the general case; {@link Node2D} samples its motion here.\r\n *\r\n * @internal The per-node half of `sampleTree` — a walk, not a node method.\r\n */\r\n _sample(): void { }\r\n\r\n /**\r\n * Record this node's current position as the motion history's previous\r\n * frame, stamped `at`, deriving no velocity.\r\n *\r\n * @internal The per-node half of `primeMotionTree`.\r\n */\r\n _primeMotion(at: number): void { }\r\n\r\n // ---- Attachment -------------------------------------------------------\r\n\r\n /**\r\n * Put this subtree into the scene: mark it mounted, bind the asset catalog\r\n * and inherited context, advance its clock to `scope.time`.\r\n *\r\n * Safe and cheap to call every frame — an unchanged catalog/context\r\n * short-circuits, and {@link resolveContext} fires only on first attach.\r\n *\r\n * @internal Driven by `ClipInstance` per frame, and by {@link add} for a mid-frame subtree.\r\n */\r\n attach(scope: AttachScope): void {\r\n const first = !this._mounted;\r\n this._mounted = true;\r\n\r\n if (this._assets !== scope.assets) this._assets = scope.assets;\r\n\r\n const next = this.provideContext(scope.context);\r\n // Unchanged map, already bound, and not this instance's first attach ⇒\r\n // the whole subtree already holds `next` and the walk below would be pure\r\n // repetition of the context half. The time half still has to run.\r\n const contextChanged = !this._contextBound || this._context !== next;\r\n if (contextChanged) {\r\n this._context = next;\r\n this._contextBound = true;\r\n }\r\n if (first) this.resolveContext(next);\r\n\r\n this._advanceOwnTime(scope.time);\r\n\r\n if (this._children.length === 0) return;\r\n const childScope = next === scope.context ? scope : { ...scope, context: next };\r\n for (const child of this._children) child.attach(childScope);\r\n }\r\n\r\n /**\r\n * Take this subtree out of the scene. Not a teardown — props/children/bindings\r\n * stay, so it can be attached elsewhere (`reparent`). {@link dispose} tears down.\r\n *\r\n * @internal Driven by {@link remove}/{@link clear}.\r\n */\r\n detach(): void {\r\n if (!this._mounted) return;\r\n this._mounted = false;\r\n for (const child of this._children) child.detach();\r\n }\r\n\r\n /** The scope this node was last attached with, for handing to a late child. */\r\n private _currentScope(): AttachScope | null {\r\n return this._assets && this._contextBound\r\n ? { assets: this._assets, context: this._context, time: this._time.total }\r\n : null;\r\n }\r\n\r\n /** Attach `child` if this node is itself attached; otherwise leave it for the walk. */\r\n /** @internal Shared with `Node2D.addChildAt`, which splices rather than pushes. */\r\n protected _attachChild(child: Node): void {\r\n if (!this._mounted) return;\r\n const scope = this._currentScope();\r\n if (scope) child.attach(scope);\r\n }\r\n\r\n // ---- Context lifecycle ------------------------------------------------\r\n\r\n /**\r\n * Apply inherited context **values** to this node, once, after it's linked\r\n * into the tree and ancestor providers have resolved: a component's\r\n * `inherit` entries. Runs exactly once per instance.\r\n */\r\n protected resolveContext(ctx: ContextMap): void { }\r\n\r\n /**\r\n * The {@link ContextMap} handed to descendants: a component's `provide`\r\n * adds its tokens. The base passes the parent's map through unchanged.\r\n */\r\n protected provideContext(parent: ContextMap): ContextMap {\r\n return parent;\r\n }\r\n\r\n /**\r\n * Bind `node`'s asset catalog, context and clock without making it a child —\r\n * for a node used purely as a pixel source (`Tex.surface`), laid out on\r\n * demand rather than sitting in the tree.\r\n */\r\n protected attachDetached(node: Node): void {\r\n const scope = this._currentScope();\r\n if (scope) node.attach(scope);\r\n }\r\n\r\n /**\r\n * Declare what this node draws from its props and inherited context alone —\r\n * never `layoutBounds` or the clock. The runtime records what this reads and\r\n * calls it again only when one of those props is written, so anything else it\r\n * depends on is a change nobody will ask about.\r\n */\r\n declareAssets(assets: AssetScope): void { }\r\n\r\n get children(): Node[] {\r\n if (_observer !== null) _observer.read(this._structureSlot());\r\n return this._children;\r\n }\r\n\r\n /**\r\n * Every child, both dimensions, unfiltered — unlike {@link children}, which\r\n * a {@link Node2D} filters to its own kind. Used where index has to match\r\n * the authored tree (picking), since filtering would renumber it.\r\n */\r\n get _allChildren(): readonly Node[] {\r\n if (_observer !== null) _observer.read(this._structureSlot());\r\n return this._children;\r\n }\r\n\r\n /**\r\n * Add children — a node, an array, or a nested mix; falsy entries\r\n * (`cond && node`) are dropped. A child of the other dimension throws —\r\n * see {@link acceptsChild}.\r\n */\r\n add(child: NodeChildren): void {\r\n if (child instanceof Node) {\r\n this._addChild(child);\r\n return;\r\n }\r\n const flat = Node.flattenChildrenProp({ children: child });\r\n if (flat.length > 0) this._addChildren(flat);\r\n }\r\n\r\n /** Remove children — same shapes as {@link add}. Not a child of this one is a no-op. */\r\n remove(child: NodeChildren): void {\r\n if (child instanceof Node) {\r\n this._removeChild(child);\r\n return;\r\n }\r\n for (const node of Node.flattenChildrenProp({ children: child })) {\r\n this._removeChild(node);\r\n }\r\n }\r\n\r\n /** Remove every child, detaching each (see {@link remove}). */\r\n clear(): void {\r\n for (const child of this._children) {\r\n if (_observer !== null) this._structureChanged(child);\r\n child._parent = null;\r\n child.detach();\r\n }\r\n this._children.length = 0;\r\n }\r\n\r\n /**\r\n * Insert `child` at `index` among this node's children.\r\n *\r\n * On {@link Node} rather than {@link Node2D} because it is tree machinery —\r\n * `ClipTimeline.syncPresence` reaches for it on whatever a spec's\r\n * `parentId` names, which since audio joined the graph is not always a 2D\r\n * node. `Node2D` overrides it for the animated insert, which measures the\r\n * child off-tree and so needs a laid-out one.\r\n */\r\n addChildAt(args: CommandArgs<{ child: Node; index: number }>): void | Command<Record<string, never>> {\r\n const { child, index } = args.data as { child: Node; index: number };\r\n this.assertAcceptsChild(child);\r\n this._insertChildAt(child, index);\r\n }\r\n\r\n /** @internal Shared with `Node2D.addChildAt`'s instant branch. */\r\n protected _insertChildAt(child: Node, index: number): void {\r\n if (_observer !== null) this._structureChanged(child);\r\n this._children.splice(index, 0, child);\r\n child._parent = this;\r\n this._attachChild(child);\r\n }\r\n\r\n /**\r\n * @internal The pseudo-slot {@link children} and {@link parent} report to an\r\n * observer. Allocated on first observation, so a tree nobody observes carries none.\r\n */\r\n _structureSlot(): PropSlot<null> {\r\n return this._structure ??= new PropSlot<null>(null, this, STRUCTURE_SLOT);\r\n }\r\n\r\n /** @internal Report a child entering or leaving this node — its parent link changes with it. Call only while observed. */\r\n _structureChanged(child: Node | null): void {\r\n _observer!.write(this._structureSlot());\r\n if (child) _observer!.write(child._structureSlot());\r\n }\r\n\r\n private _structure: PropSlot<null> | null = null;\r\n\r\n private _addChild(child: Node): void {\r\n this.assertAcceptsChild(child);\r\n if (_observer !== null) this._structureChanged(child);\r\n this._children.push(child);\r\n child._parent = this;\r\n this._attachChild(child);\r\n }\r\n\r\n private _addChildren(children: Node[]): void {\r\n for (const child of children) this.assertAcceptsChild(child);\r\n if (_observer !== null) for (const child of children) this._structureChanged(child);\r\n this._children.push(...children);\r\n for (const child of children) child._parent = this;\r\n for (const child of children) this._attachChild(child);\r\n }\r\n\r\n private _removeChild(child: Node): void {\r\n const i = this._children.indexOf(child);\r\n if (i < 0) return;\r\n if (_observer !== null) this._structureChanged(child);\r\n const [removed] = this._children.splice(i, 1);\r\n if (removed) {\r\n removed._parent = null;\r\n removed.detach();\r\n }\r\n }\r\n\r\n dispose(): void {\r\n if (this.__cells) {\r\n for (const slot of this.__cells.slots.values()) {\r\n slot.dispose();\r\n }\r\n }\r\n this.__cells = undefined;\r\n this._assets = null;\r\n this._mounted = false;\r\n // _props is retained (authored identity) so provideContext still works after reuse.\r\n this._context = ContextMap.EMPTY;\r\n this._contextBound = false;\r\n }\r\n}\r\n\r\ndeclareMembers(Node, {\r\n to: command(),\r\n restore: command(),\r\n addChildAt: command({ args: [\"child\", \"index\"] }),\r\n});\r\n"]}
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAsD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAW,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAe,MAAM,mCAAmC,CAAC;AACjG,OAAO,EACH,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,SAAS,GACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAA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L,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,oFAAoF;QACpF,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;CACJ;AAED,cAAc,CAAC,IAAI,EAAE;IACjB,EAAE,EAAE,OAAO,EAAE;IACb,OAAO,EAAE,OAAO,EAAE;IAClB,UAAU,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { _observer, PropSlot } from \"@/props/slot\";\nimport { STRUCTURE_SLOT } from \"@/props/observer\";\nimport { PropHost, type PropCells } from \"@/props/host\";\nimport { EasingFunction } from \"@/tween/ease/type\";\nimport { toCommand } from \"@/tween/to-command\";\nimport { makeCommand, type Command, type CommandArgs, type CommandTarget } from \"@/tween/command\";\nimport { prepareNumericCellTween } from \"@/tween/prepare\";\nimport { inertCommand, inertStepper } from \"@/tween/inert\";\nimport { TweenStepper } from \"@/tween/stepper\";\nimport { RefTarget } from \"@/util/reference\";\nimport { Context, ContextMap } from \"@/util/context\";\nimport { AssetCatalog } from \"@/assets/catalog\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport { declareMembers, getPropertyMeta, PropOptions } from \"@/attributes/properties/decorator\";\nimport {\n applyProp,\n applySnapshotLayer,\n collectProperties,\n popState,\n restoreAnimated,\n saveState,\n} from \"./node-reactive\";\nimport type { PropLayer } from \"./node-reactive\";\nimport { advanceNodeTime, createNodeTime, type MutableNodeTime, type NodeTime } from \"@/components/trees/node/node-time\";\nimport type { PropInputs } from \"@/attributes/properties/inputs\";\nimport { command } from \"@/tween/command-decorator\";\n\nexport type { NodeTime } from \"@/components/trees/node/node-time\";\nexport type { PropInput, PropInputs } from \"@/attributes/properties/inputs\";\n\n/** Which scene graph a node belongs to. See {@link Node.dimension}. */\nexport type NodeDimension = \"2d\" | \"3d\" | \"audio\";\n\n/** Where a node of each dimension is allowed to live, for the mismatch error. */\nconst HOSTS_OF: Record<NodeDimension, string> = {\n \"2d\": \"2D nodes go in the 2D tree, or inside a Canvas3D as a HUD over its scene.\",\n \"3d\": \"Put 3D nodes inside a Canvas3D, which is the one node that holds both.\",\n audio: \"Put audio nodes under an AudioBus, or directly on the scene root.\",\n};\n\nexport interface NodeMetadata<T extends Node> {\n /**\n * Handle written with this node at construction. Typed as {@link RefTarget}\n * rather than `Reference<T>` so a ref declared as one of `T`'s *supertypes*\n * is accepted (`createRef<Node2D>()` on a `<Rect>`) — see the note there\n * for why that direction is the sound one.\n */\n ref?: RefTarget<T>;\n}\n\nexport type NodeConfig<T extends Node, P> = PropInputs<P> & NodeMetadata<T>;\n\n/**\n * Everything {@link Node.attach} needs to put a subtree into a live scene.\n *\n * The three things tree membership supplies, and the only three: what assets are\n * available, what context the ancestors provide, and where the playhead is.\n */\nexport interface AttachScope {\n /** Metadata for the assets this scene may declare. */\n assets: AssetCatalog;\n /** The token map the parent provides to this node. */\n context: ContextMap;\n /** Clip-relative time, in seconds. */\n time: number;\n}\n\n/**\n * A `children` child: a single {@link Node}, an arbitrarily-nested array of\n * children, or a falsy value. Nesting is allowed so `.map()` results can be\n * dropped straight in as a child, and falsy values are allowed so\n * `condition && Rect({ … })` works — the constructor flattens\n * (`.flat(Infinity)`) and filters out everything but `Node` instances.\n */\nexport type NodeChildren = Node | false | null | undefined | NodeChildren[];\n\n/**\n * The props every node has, in either dimension.\n *\n * Deliberately tiny. Everything that reads as \"a box on a page\" — `x`/`y`,\n * `width`/`height`, `padding`, `flex`, anchors, `opacity` — lives on\n * {@link Node2DProps}, and everything that reads as \"a thing in space\" —\n * `position`, `quaternion`, `castShadow` — lives on `Node3DProps`, because a\n * prop that means nothing for half the tree is worse than no prop at all.\n */\nexport interface NodeProps {\n children: NodeChildren;\n /**\n * Seeds {@link Node.id}. A document's `NodeSpec.id` supplies it — see\n * `Registry.instantiate` — so an instantiated node answers to the identity\n * its row was authored under. Left out, the node falls back to a UUID, which\n * is what every hand-written `new Rect({…})` and component call gets.\n */\n id?: string;\n /**\n * The handle a node is *referenced by*, as against {@link NodeProps.id},\n * which addresses it. `\"=[card.x]\"` in any prop reads the `x` of the node\n * keyed `card` — see `NodeSpec.key`.\n *\n * Optional and never generated — a node has one only because an author wrote\n * one, which is what makes it safe to point a formula at — and unique per\n * document, which `document/validate.ts` enforces.\n */\n key?: string;\n}\n\n/**\n * The dimension-agnostic base of the scene graph: tree, identity, reactive\n * properties, commands, context, clock, asset declaration, teardown. Nothing\n * about *where* a node is or *how* it draws — that's {@link Node2D} / `Node3D`.\n * They meet only at `Canvas3D`; mixing them anywhere else throws (see\n * {@link acceptsChild}).\n *\n * Subclasses call {@link initProps} from their own constructor rather than the\n * base doing it: a subclass's field initializers only run *after* `super()`\n * returns, so applying `property` defaults any earlier would write into cells\n * that don't exist yet.\n */\nexport abstract class Node<P extends NodeProps = NodeProps> implements PropHost {\n /**\n * Which scene graph this node belongs to.\n *\n * A getter rather than a field so it is answerable from the prototype during\n * construction, before any subclass field initializer has run.\n */\n abstract get dimension(): NodeDimension;\n\n /** The trees this type takes children from, answerable from the prototype as {@link dimension} is. */\n get _childTrees(): readonly NodeDimension[] {\n return [this.dimension];\n }\n\n constructor(props?: NodeConfig<any, P>) {\n // Retain the raw props (see _props doc) so a provider's provideContext can\n // read which keys the author passed. Captured before any default\n // application so it reflects exactly what the author passed. The object is\n // retained by reference, so a subclass expanding prop sugar in place\n // afterwards (`size`, `transform3D`) is reflected here too.\n this._props = props;\n // Neither is a property: identity does not tween, so neither has any\n // business in the table `set()`, `to()` and the baseline restore walk\n // iterate.\n const identity = props as { id?: string; key?: string } | undefined;\n this.key = identity?.key;\n // Nullish, never falsy: `\"\"` is the scene root's real id, not a missing\n // one (`checkRootShape` in document/validate.ts defines the root as the\n // row holding it), and a UUID in its place would have the host's tree\n // report a root no document row mentions.\n this.id = identity?.id ?? crypto.randomUUID();\n }\n\n /** See {@link NodeProps.key}. */\n key?: string;\n\n private _hidden = false;\n private _locked = false;\n\n /**\n * Hidden by the editor — no paint, no pick, no layout slot. See\n * {@link NodeEditorState.hidden}.\n */\n get hidden(): boolean {\n return this._hidden;\n }\n\n /** Locked by the editor — unpickable, but drawn. See {@link NodeEditorState.locked}. */\n get locked(): boolean {\n return this._locked;\n }\n\n /**\n * @internal — written only by `applyEditorStates`, which owns both flags for\n * the whole tree. Not a setter pair, so a caller cannot set one and leave the\n * other holding a previous frame's answer.\n */\n _setEditorState(hidden: boolean, locked: boolean): void {\n this._hidden = hidden;\n this._locked = locked;\n }\n\n /**\n * Fire the `ref` and apply every declared property, reading\n * initial values from `props`.\n *\n * Called by the concrete constructor ({@link Node2D}'s, `Node3D`'s) rather\n * than by this one, because a subclass's field initializers run *after*\n * `super()` returns: doing this here would apply props while the cells those\n * props write into are still `undefined`.\n */\n protected initProps(props?: NodeConfig<any, P>): void {\n if (props?.ref) {\n props.ref(this as any);\n }\n\n // Apply every declared property, reading initial values from props.\n for (const meta of getPropertyMeta(this)) {\n const propsVal = props ? (props as any)[meta.key] : undefined;\n const initial = propsVal !== undefined ? propsVal : meta.default;\n this.applyProp(meta.key, initial, meta.options);\n }\n }\n\n /**\n * Adopt the `children` prop. Called by the concrete constructor after its own\n * defaults are in place, so a child never lands in a tree whose parent has not\n * finished sizing itself.\n */\n protected adoptChildrenProp(props?: NodeConfig<any, P>): void {\n if (props && (props as any).children) {\n const raw = Array.isArray((props as any).children) ? (props as any).children : [(props as any).children];\n const flat = (raw as unknown[]).flat(Infinity)\n .filter((c: unknown): c is Node => c instanceof Node);\n if (flat.length > 0) this._addChildren(flat);\n }\n }\n\n /**\n * Whether `child` may be adopted by this node.\n *\n * A node holds children of its own dimension; the places the trees meet are\n * `Canvas3D`, which takes 2D and 3D, and `Canvas2D`, which takes 2D and\n * audio. Both partition what they accept. Rejecting the mix here rather than\n * letting it through is deliberate: a `Box3D` parented to a `Rect` would be\n * silently skipped by both the layout walk and the 3D walk, and would simply\n * never appear.\n */\n protected acceptsChild(child: Node): boolean {\n return child.dimension === this.dimension;\n }\n\n /** Throw if `child` cannot go here: by its tree, by what this node takes, or by where the child says it goes. */\n protected assertAcceptsChild(child: Node): void {\n if (!this.acceptsChild(child)) {\n const why = child.dimension === this.dimension ? this._childRule() : HOSTS_OF[child.dimension];\n throw new TypeError(`${this.className} (${this.dimension}) cannot hold ${child.className} (${child.dimension}).${why ? ` ${why}` : \"\"}`);\n }\n const refusal = child._parentRefusal(this);\n if (refusal) throw new TypeError(refusal);\n }\n\n /** What this node takes, for the error when it refuses a child of its own tree. */\n protected _childRule(): string {\n return \"\";\n }\n\n /** Why this node cannot go inside `parent`, or `null`: only a node that names its parents refuses one. */\n _parentRefusal(_parent: Node): string | null {\n return null;\n }\n\n private _assets: AssetCatalog | null = null;\n protected _parent: Node | null = null;\n\n /**\n * Whether this node is in a live scene tree. Gates measure/layout/render,\n * asset declaration and every command — checked at the handful of places\n * the framework dispatches from, not per method.\n */\n private _mounted = false;\n\n /** See {@link _mounted}. */\n get mounted(): boolean {\n return this._mounted;\n }\n\n get parent(): Node | null {\n if (_observer !== null) _observer.read(this._structureSlot());\n return this._parent;\n }\n\n get assets(): AssetCatalog {\n if (!this._assets) throw new Error(\"Assets not bound — this node is not attached to a scene. See Node.attach().\");\n return this._assets;\n }\n\n /** Token→value map pushed down from ancestor providers, bound by {@link attach}. */\n private _context: ContextMap = ContextMap.EMPTY;\n /** True once {@link attach} has reached this node. */\n private _contextBound = false;\n\n /** Raw constructor props, retained so {@link provideContext} can see which keys were explicitly passed. Kept through {@link dispose} so a reused instance re-derives context on the next attach. */\n protected _props?: NodeConfig<any, P>;\n\n /** Read the nearest ancestor provider's value for `ctx` (or its default). */\n useContext<T>(ctx: Context<T>): T {\n return this._context.get(ctx);\n }\n\n /** Assigned in the constructor — see {@link NodeProps.id}. */\n readonly id: string;\n\n /**\n * The slots behind this node's `property` fields. See {@link PropCells}.\n *\n * @internal — the authoring surface is the declared props themselves, plus\n * `set()`/`to()`/`captureProps()`.\n */\n __cells?: PropCells;\n\n protected _children: Node[] = [];\n\n /**\n * Flatten a constructor's raw `children` prop into the `Node` instances it\n * contains, without mutating or adding them — the same normalisation the\n * constructor applies before adding them, exposed standalone so\n * {@link applyDefaultSize} overrides can inspect children's own resolved\n * `width`/`height` *before* they're attached (children are constructed,\n * defaults and all, before being passed in as props).\n */\n protected static flattenChildrenProp(props: { children?: unknown } | undefined): Node[] {\n const childProp = props ? props.children : undefined;\n if (!childProp) return [];\n const raw = Array.isArray(childProp) ? childProp : [childProp];\n return (raw as unknown[]).flat(Infinity).filter((c: unknown): c is Node => c instanceof Node);\n }\n\n // ---- Reactive properties ----------------------------------------------\n\n /**\n * Declare a prop on this node. Creates a {@link PropSlot}-backed accessor\n * for `field`, applies an initial value (callback → binding; otherwise\n * constant), and registers optional tween/mapper metadata used by `set()`\n * and `to()`.\n *\n * Subsequent calls for the same field reuse the existing slot and act as\n * a value assignment, so subclasses can override a parent's default by\n * calling applyProp again without losing the slot or its bindings.\n */\n protected applyProp<Ext, Int = Ext>(\n field: string,\n initial: Ext | (() => Ext) | undefined,\n options?: PropOptions<Ext, Int>,\n ): void {\n applyProp(this, field, initial, options);\n }\n\n /** @internal Hot-path prop write (mapper- and binding-aware). Public-but-underscored like `_prepareStep` so reactive companions in this directory can call it; not part of the authoring surface. */\n _writeProp(field: string, value: unknown): void {\n if (value === undefined) return;\n const slot = this.__cells?.slots.get(field);\n if (!slot) return;\n const mapper = this.__cells?.mappers?.get(field);\n if (typeof value === \"function\") {\n const extFn = value as () => any;\n if (mapper) {\n // A binding that reads `undefined` — a node reference to a node that is\n // not there — leaves the prop as a node built without it, and never\n // reaches the mapper, which holds the shape the prop's readers go through.\n let unset: { value: unknown } | undefined;\n slot.bind(() => {\n const read = extFn();\n return read === undefined\n ? (unset ??= { value: this._unsetValue(field, mapper) }).value\n : mapper(read, slot.get());\n });\n } else {\n slot.bind(extFn);\n }\n } else {\n slot.set(mapper ? mapper(value, slot.get()) : value);\n }\n }\n\n get properties(): P {\n return collectProperties(this) as P;\n }\n\n /**\n * This node's **class** name, for a message or a host's type column. Not an\n * authored identity — those are {@link id} and {@link key}, and nothing in\n * the document model is called a name any more. Nor is it the registry key a\n * document writes in `NodeSpec.type`: a minifier is free to rename a class.\n */\n get className(): string {\n return this.constructor.name;\n }\n\n set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\n const slots = this.__cells?.slots;\n if (!slots) return;\n // Iterate the caller's keys (usually 1–3) rather than every registered\n // prop (15+): set() runs in the per-frame hot path. Only keys backed by\n // a slot are written; unknown keys are ignored — which is also what\n // lets a subclass distribute its own sugar (2D's `size`, `transform3D`)\n // into real keys and then delegate here.\n for (const key in props) {\n const val = (props as any)[key];\n if (val !== undefined && slots.has(key)) this._writeProp(key, val);\n }\n }\n\n to<D extends Partial<P> = Partial<P>>(args: CommandArgs<D> & { duration: number }): Command<P> {\n return toCommand<P>(this, args.data ?? {}, args.duration, args.easing);\n }\n\n /**\n * Build a {@link Command} from a pure function of normalized time — an\n * animation this node can be *evaluated* at, not only run through. The pair\n * to {@link to}, for the built-in commands whose values at `t` are not a prop\n * list, and what a component command's timeline lowers to.\n *\n * Snapshot whatever the animation starts from *outside* `at`: reading a prop\n * inside it would re-read the value the command is itself writing.\n */\n protected command<Props = P>(\n at: (t: number) => Partial<Props>,\n duration: number = 1,\n easing?: EasingFunction,\n ): Command<Props> {\n if (!this._mounted) return inertCommand<Props>(this, duration);\n return makeCommand<Props>(\n this as unknown as CommandTarget<Props>,\n at,\n duration,\n easing,\n );\n }\n\n /**\n * Resolve a single `to()` step into a flat {@link TweenStepper} — all the\n * per-key setup (mapper, numeric-vs-custom routing) happens once here, then\n * `advance(dt)` is allocation-free. Used by both a chain's iterator path and\n * the batched `parallel` path.\n *\n * A subclass with positional sugar of its own (2D's `size` and anchors)\n * expands `to` in place and then delegates here.\n */\n _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\n if (!this._mounted) return inertStepper(duration);\n // A tween runs in stored space, so the destination is mapped once, here,\n // and every step after it is a stored value written to the slot as it is.\n // Writing a step through the setter would map it a second time, which only\n // an idempotent mapper survives.\n const numCells: PropSlot<number>[] = [];\n const numFrom: number[] = [];\n const numEnd: number[] = [];\n const customLerps: Array<(t: number) => void> = [];\n const stringSnaps: Array<[PropSlot<string>, string]> = [];\n\n for (const key of Object.keys(to)) {\n const slot = this.__cells?.slots.get(key);\n if (!slot) continue;\n const extVal = (to as any)[key];\n const mapper = this.__cells?.mappers?.get(key);\n const targetVal = mapper ? mapper(extVal, (this as any)[key]) : extVal;\n const tweenFn = this.__cells?.tweens?.get(key);\n if (tweenFn) {\n const from = (this as any)[key];\n customLerps.push((t) => {\n slot.set(tweenFn(from, targetVal, t));\n });\n } else if (typeof targetVal === 'number') {\n numCells.push(slot as PropSlot<number>);\n numFrom.push((this as any)[key] as number);\n numEnd.push(targetVal as number);\n } else if (typeof targetVal === 'string') {\n stringSnaps.push([slot as PropSlot<string>, targetVal]);\n }\n }\n\n const lerp = prepareNumericCellTween(numCells, numFrom, numEnd);\n const hasCustom = customLerps.length > 0;\n const hasSnaps = stringSnaps.length > 0;\n\n const apply = (t: number): void => {\n const easedT = easing ? easing(t) : t;\n lerp(easedT);\n if (hasCustom) for (const fn of customLerps) fn(easedT);\n // A discrete prop has nothing between its endpoints, so it snaps at\n // the end rather than interpolating. Applied here rather than only in\n // `advance` because a `seek` past the end has, by definition, reached\n // that end — leaving it out meant `seek(duration)` and running to\n // `duration` produced different nodes, and only the second was right.\n if (hasSnaps && t >= 1) for (const [slot, val] of stringSnaps) slot.set(val);\n };\n\n let elapsed = 0;\n return {\n // Tracks `elapsed`, so a seek and a subsequent advance agree about\n // where the tween is. Without it, seeking forward then advancing\n // rewound to `dt`.\n seek: (e: number) => {\n elapsed = e;\n apply(duration > 0 ? Math.min(e / duration, 1) : 1);\n },\n advance: (dt: number): boolean => {\n elapsed += dt;\n if (elapsed < duration) {\n apply(elapsed / duration);\n return false;\n }\n apply(1);\n return true;\n },\n };\n }\n\n /** What a node constructed without `field` holds: its declared default, through the mapper. */\n private _unsetValue(field: string, mapper: (ext: any, prev?: any) => any): unknown {\n const declared = getPropertyMeta(this).find((meta) => meta.key === field)?.default;\n const initial = typeof declared === \"function\" ? declared() : declared;\n return initial === undefined ? undefined : mapper(initial, undefined);\n }\n\n // ---- State stack (save / restore) -------------------------------------\n // A per-node LIFO stack of property snapshots, mirroring Motion Canvas's\n // node.save()/restore(). `save()` pushes a snapshot of every declared prop;\n // `restore()` pops the most recent one and either snaps to it (no duration)\n // or tweens the numeric props back to it over `duration`.\n\n /** @internal LIFO stack of save() snapshot layers. Underscore-internal so the prop companion can read it; not authoring surface. */\n _stateStack: PropLayer[] = [];\n\n /**\n * Push a snapshot of this node's current state onto its save stack.\n *\n * Every reactive prop (`x`, `y`, `scale`, `opacity`, `fill`, …) is captured,\n * preserving reactive bindings — a prop bound to `() => other().x` is saved\n * as the binding, not just its resolved value, so {@link restore} re-binds\n * it rather than freezing the value. Calls stack: each `save()` pushes a new\n * layer, and each {@link restore} pops the most recent one.\n *\n * @example\n * node.save();\n * node.moveTo({ data: { x: 200, y: 0 }, duration: 1 });\n * node.restore({ duration: 1 }); // animate back to where it was saved\n */\n save(): void {\n saveState(this);\n }\n\n /**\n * Pop the most recent {@link save} snapshot and roll this node back to it.\n *\n * Called with no `duration` (or `0`), every prop is reapplied instantly —\n * plain values are set, reactive bindings are re-bound. Called with a\n * positive `duration`, the numeric props (and any with a custom `tween`)\n * animate toward their saved values over that many seconds; once the tween\n * finishes the full snapshot is reapplied, which re-binds any reactive props\n * and snaps non-tweenable props (e.g. strings) to their saved values.\n *\n * A no-op (returns immediately) if there is nothing on the stack.\n */\n restore(): void;\n restore(args: CommandArgs<Record<string, never>> & { duration: number }): Command<Record<string, never>>;\n restore(args?: CommandArgs<Record<string, never>>): void | Command<Record<string, never>> {\n const layer = popState(this);\n const duration = args?.duration;\n if (duration === undefined || duration <= 0) {\n if (layer) applySnapshotLayer(this, layer);\n return;\n }\n return restoreAnimated(this, layer, duration, args?.easing);\n }\n\n // ---- Clock ------------------------------------------------------------\n\n protected _time: MutableNodeTime = createNodeTime();\n\n /** This node's place on the scene clock. See {@link NodeTime}. */\n public get time(): NodeTime {\n if (_observer !== null) _observer.clock?.(this);\n return this._time;\n }\n\n /**\n * Advance **this node's** clock to `total` clip-seconds and sample its\n * derived render state.\n *\n * Per-node, not per-subtree: {@link attach} already recurses, so a recursive\n * advance here would re-advance every descendant once per ancestor.\n *\n * Sampling happens here, not at render: this runs on every advanced frame in\n * every playback path (forward, scrub, precomp), whereas `render` runs only\n * for displayed frames. Sampling per-frame is what makes velocity correct on\n * the first frame after a scrub/rewind, where sampling only at render time\n * read zero. The advance loop runs before `generator.next()` (so audio\n * scheduling in generator bodies reads the right time), which means x/y here\n * still hold the previous frame's value — velocity therefore trails the\n * rendered position by one frame. That lag is constant and identical forward\n * vs. scrub, and imperceptible for motion blur.\n */\n private _advanceOwnTime(total: number): void {\n advanceNodeTime(this._time, total);\n this._sample();\n }\n\n /**\n * Sample this node's own derived render state for the current frame. Nothing\n * to derive in the general case; {@link Node2D} samples its motion here.\n *\n * @internal The per-node half of `sampleTree` — a walk, not a node method.\n */\n _sample(): void { }\n\n /**\n * Record this node's current position as the motion history's previous\n * frame, stamped `at`, deriving no velocity.\n *\n * @internal The per-node half of `primeMotionTree`.\n */\n _primeMotion(at: number): void { }\n\n // ---- Attachment -------------------------------------------------------\n\n /**\n * Put this subtree into the scene: mark it mounted, bind the asset catalog\n * and inherited context, advance its clock to `scope.time`.\n *\n * Safe and cheap to call every frame — an unchanged catalog/context\n * short-circuits, and {@link resolveContext} fires only on first attach.\n *\n * @internal Driven by `ClipInstance` per frame, and by {@link add} for a mid-frame subtree.\n */\n attach(scope: AttachScope): void {\n const first = !this._mounted;\n this._mounted = true;\n\n if (this._assets !== scope.assets) this._assets = scope.assets;\n\n const next = this.provideContext(scope.context);\n // Unchanged map, already bound, and not this instance's first attach ⇒\n // the whole subtree already holds `next` and the walk below would be pure\n // repetition of the context half. The time half still has to run.\n const contextChanged = !this._contextBound || this._context !== next;\n if (contextChanged) {\n this._context = next;\n this._contextBound = true;\n }\n if (first) this.resolveContext(next);\n\n this._advanceOwnTime(scope.time);\n\n if (this._children.length === 0) return;\n const childScope = next === scope.context ? scope : { ...scope, context: next };\n for (const child of this._children) child.attach(childScope);\n }\n\n /**\n * Take this subtree out of the scene. Not a teardown — props/children/bindings\n * stay, so it can be attached elsewhere (`reparent`). {@link dispose} tears down.\n *\n * @internal Driven by {@link remove}/{@link clear}.\n */\n detach(): void {\n if (!this._mounted) return;\n this._mounted = false;\n for (const child of this._children) child.detach();\n }\n\n /** The scope this node was last attached with, for handing to a late child. */\n private _currentScope(): AttachScope | null {\n return this._assets && this._contextBound\n ? { assets: this._assets, context: this._context, time: this._time.total }\n : null;\n }\n\n /** Attach `child` if this node is itself attached; otherwise leave it for the walk. */\n /** @internal Shared with `Node2D.addChildAt`, which splices rather than pushes. */\n protected _attachChild(child: Node): void {\n if (!this._mounted) return;\n const scope = this._currentScope();\n if (scope) child.attach(scope);\n }\n\n // ---- Context lifecycle ------------------------------------------------\n\n /**\n * Apply inherited context **values** to this node, once, after it's linked\n * into the tree and ancestor providers have resolved: a component's\n * `inherit` entries. Runs exactly once per instance.\n */\n protected resolveContext(ctx: ContextMap): void { }\n\n /**\n * The {@link ContextMap} handed to descendants: a component's `provide`\n * adds its tokens. The base passes the parent's map through unchanged.\n */\n protected provideContext(parent: ContextMap): ContextMap {\n return parent;\n }\n\n /**\n * Bind `node`'s asset catalog, context and clock without making it a child —\n * for a node used purely as a pixel source (`Tex.surface`), laid out on\n * demand rather than sitting in the tree.\n */\n protected attachDetached(node: Node): void {\n const scope = this._currentScope();\n if (scope) node.attach(scope);\n }\n\n /**\n * Declare what this node draws from its props and inherited context alone —\n * never `layoutBounds` or the clock. The runtime records what this reads and\n * calls it again only when one of those props is written, so anything else it\n * depends on is a change nobody will ask about.\n */\n declareAssets(assets: AssetScope): void { }\n\n get children(): Node[] {\n if (_observer !== null) _observer.read(this._structureSlot());\n return this._children;\n }\n\n /**\n * Every child, both dimensions, unfiltered — unlike {@link children}, which\n * a {@link Node2D} filters to its own kind. Used where index has to match\n * the authored tree (picking), since filtering would renumber it.\n */\n get _allChildren(): readonly Node[] {\n if (_observer !== null) _observer.read(this._structureSlot());\n return this._children;\n }\n\n /**\n * Add children — a node, an array, or a nested mix; falsy entries\n * (`cond && node`) are dropped. A child of the other dimension throws —\n * see {@link acceptsChild}.\n */\n add(child: NodeChildren): void {\n if (child instanceof Node) {\n this._addChild(child);\n return;\n }\n const flat = Node.flattenChildrenProp({ children: child });\n if (flat.length > 0) this._addChildren(flat);\n }\n\n /** Remove children — same shapes as {@link add}. Not a child of this one is a no-op. */\n remove(child: NodeChildren): void {\n if (child instanceof Node) {\n this._removeChild(child);\n return;\n }\n for (const node of Node.flattenChildrenProp({ children: child })) {\n this._removeChild(node);\n }\n }\n\n /** Remove every child, detaching each (see {@link remove}). */\n clear(): void {\n for (const child of this._children) {\n if (_observer !== null) this._structureChanged(child);\n child._parent = null;\n child.detach();\n }\n this._children.length = 0;\n }\n\n /**\n * Insert `child` at `index` among this node's children.\n *\n * On {@link Node} rather than {@link Node2D} because it is tree machinery —\n * `ClipTimeline.syncPresence` reaches for it on whatever a spec's\n * `parentId` names, which since audio joined the graph is not always a 2D\n * node. `Node2D` overrides it for the animated insert, which measures the\n * child off-tree and so needs a laid-out one.\n */\n addChildAt(args: CommandArgs<{ child: Node; index: number }>): void | Command<Record<string, never>> {\n const { child, index } = args.data as { child: Node; index: number };\n this.assertAcceptsChild(child);\n this._insertChildAt(child, index);\n }\n\n /** @internal Shared with `Node2D.addChildAt`'s instant branch. */\n protected _insertChildAt(child: Node, index: number): void {\n if (_observer !== null) this._structureChanged(child);\n this._children.splice(index, 0, child);\n child._parent = this;\n this._attachChild(child);\n }\n\n /**\n * @internal The pseudo-slot {@link children} and {@link parent} report to an\n * observer. Allocated on first observation, so a tree nobody observes carries none.\n */\n _structureSlot(): PropSlot<null> {\n return this._structure ??= new PropSlot<null>(null, this, STRUCTURE_SLOT);\n }\n\n /** @internal Report a child entering or leaving this node — its parent link changes with it. Call only while observed. */\n _structureChanged(child: Node | null): void {\n _observer!.write(this._structureSlot());\n if (child) _observer!.write(child._structureSlot());\n }\n\n private _structure: PropSlot<null> | null = null;\n\n private _addChild(child: Node): void {\n this.assertAcceptsChild(child);\n if (_observer !== null) this._structureChanged(child);\n this._children.push(child);\n child._parent = this;\n this._attachChild(child);\n }\n\n private _addChildren(children: Node[]): void {\n for (const child of children) this.assertAcceptsChild(child);\n if (_observer !== null) for (const child of children) this._structureChanged(child);\n this._children.push(...children);\n for (const child of children) child._parent = this;\n for (const child of children) this._attachChild(child);\n }\n\n private _removeChild(child: Node): void {\n const i = this._children.indexOf(child);\n if (i < 0) return;\n if (_observer !== null) this._structureChanged(child);\n const [removed] = this._children.splice(i, 1);\n if (removed) {\n removed._parent = null;\n removed.detach();\n }\n }\n\n dispose(): void {\n if (this.__cells) {\n for (const slot of this.__cells.slots.values()) {\n slot.dispose();\n }\n }\n this.__cells = undefined;\n this._assets = null;\n this._mounted = false;\n // _props is retained (authored identity) so provideContext still works after reuse.\n this._context = ContextMap.EMPTY;\n this._contextBound = false;\n }\n}\n\ndeclareMembers(Node, {\n to: command(),\n restore: command(),\n addChildAt: command({ args: [\"child\", \"index\"] }),\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"canvas2d-node.js","sourceRoot":"","sources":["../../../../src/components/trees/root/canvas2d-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EA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,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IACtF,MAAM,EAAE,OAAO,EAAE;IACjB,SAAS,EAAE,OAAO,EAAE;CACvB,CAAC,CAAC","sourcesContent":["import { RenderContext2D, RenderPass2D } from \"@/render/render-context2d\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { Clip } from \"@/render/clip\";\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport { lerpLookAt, type LookAt, type SpaceCamera } from \"@/attributes/layout/space3d\";\r\nimport { NO_PROJECTION_3D, type Projection3D } from \"@/attributes/layout/matrix2d\";\r\nimport { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { FlowMode, FlowProps, FlowSettings, GapSize } from \"@/layout/types\";\r\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport { CameraScope, Node2D, NodeConfig, Node2DProps } from \"@/components/trees/2d/node2d\";\r\nimport { spaceRootFrame } from \"@/components/trees/2d/node-space\";\r\nimport type { Node, NodeDimension } from \"@/components/trees/node/node\";\r\nimport { NodeAudio } from \"@/components/trees/audio/node-audio\";\r\nimport { declareMembers, property } from \"@/attributes/properties/decorator\";\r\nimport { alignmentProperty, fillProperty, flowProperty } from \"@/attributes/properties/typed\";\r\n\r\n/** @internal */\r\nexport interface Canvas2DProps extends Node2DProps, FlowProps {\r\n /**\r\n * Background fill layer(s). Each item can be a CSS color string, a fill\r\n * prop object, an already-resolved fill, or a {@link FillChain} from the\r\n * `Fills` builder. Painted behind the scene's children.\r\n */\r\n fill: Fill;\r\n /**\r\n * Overlay layer(s) — same loose values as {@link fill}, but painted *over*\r\n * the fill **and** the children (clipped to the viewport). Use for textures\r\n * laid across the whole scene, e.g. a VHS-grain image or video.\r\n */\r\n overlay: Fill;\r\n /** Camera magnification factor. Values > 1 zoom in; < 1 zoom out. */\r\n zoom: number;\r\n /**\r\n * World-space point that maps to the centre of the viewport. In a\r\n * {@link space3D} it is also what the camera orbits, and `z` puts it in\r\n * depth — the same sense as a node's `depth`, so a negative `z` flies in.\r\n */\r\n lookAt: LookAt;\r\n /** Rotation of the camera view in degrees (clockwise). */\r\n heading: number;\r\n /**\r\n * Place the children in one 3D space seen through this camera, rather than\r\n * each projecting through a perspective of its own. Their `depth` and tilt\r\n * are then positions and turns in that space, and siblings paint far to\r\n * near. A switch rather than something read off the camera's numbers, so\r\n * turning it on can never jump a tween.\r\n *\r\n * While it is on, `perspective` is the camera's distance from {@link lookAt}\r\n * at `dolly: 0` — CSS's convention, so that plane draws 1:1 and `0` is a\r\n * parallel projection — and the stage's own tilt and depth are unused.\r\n */\r\n space3D: boolean;\r\n /** Degrees about the vertical axis through {@link lookAt}. 0 is head-on; positive moves the camera to the right. Same as `Camera3D`. */\r\n orbit: number;\r\n /** Degrees above the layers. Positive looks down on them. Same as `Camera3D`. */\r\n elevation: number;\r\n /** Px the camera has moved in toward {@link lookAt}. Inert with no perspective, as depth is. */\r\n dolly: number;\r\n}\r\n\r\n/**\r\n * The single root container every clip document builds into.\r\n *\r\n * A `Canvas2D` is a plain {@link Node2D} that doubles as the clip's layout frame\r\n * and camera. It lays its children out (flex `horizontal`/`vertical` or\r\n * `freeform`, with `gap`, `align`, `padding`) and paints a scene-wide background\r\n * (`fill`) and `overlay` — *and* views those laid-out children through a viewport\r\n * transform (`zoom`, `lookAt`, `heading`).\r\n *\r\n * Unlike a {@link Rect} it is **not a shape**: it has no stroke, shadow, corner,\r\n * or `start`/`end` props. It carries only the scene-wide concerns — background\r\n * paint, child layout, and camera — so `stage.fill`, `stage.flow`, etc. read\r\n * the root directly without exposing per-shape geometry the scene root never has.\r\n *\r\n * Its layout props are the arrangement {@link Node2D} lays its children out by,\r\n * the same as a {@link Rect}'s — see {@link flowArrangement}.\r\n */\r\n/** @internal */\r\nexport class Canvas2D extends Node2D<Canvas2DProps> {\r\n\r\n // ---- Background paint -------------------------------------------------\r\n // Author-facing paint props. Like Rect, the declared type is the loose\r\n // `Fill` so assignment (`this.fill = 'red'`) and reads share one type; the\r\n // property accessor stores the *resolved* value via the mapper.\r\n declare fill: Fill;\r\n declare overlay: Fill;\r\n\r\n // ---- Layout container -------------------------------------------------\r\n declare flow: FlowMode;\r\n declare readonly gap: GapSize;\r\n declare readonly wrap: boolean;\r\n // `undefined` means \"follow `gap`\", not \"missing\" — see FlowProps.crossGap.\r\n declare readonly crossGap: number | undefined;\r\n declare readonly columns: number;\r\n // Declared loose as `Alignment` (covers `this.align = 'center'`); the\r\n // accessor stores the resolved per-axis `Vector2` pivot. See Rect.\r\n declare align: Alignment;\r\n\r\n // ---- Camera -----------------------------------------------------------\r\n /** Camera magnification factor (default: 1). */\r\n declare zoom: number;\r\n /** World-space focus point (default: {x:0, y:0}). */\r\n declare lookAt: LookAt;\r\n /** Camera view rotation in degrees (default: 0). */\r\n declare heading: number;\r\n declare space3D: boolean;\r\n declare orbit: number;\r\n declare elevation: number;\r\n declare dolly: number;\r\n\r\n constructor(props: NodeConfig<Canvas2D, Canvas2DProps>) {\r\n super(props);\r\n }\r\n\r\n // ---- Camera motion commands -------------------------------------------\r\n // Mirror the Camera node's viewport commands.\r\n\r\n /** Animate `zoom`. Values > 1 zoom in; < 1 zoom out. */\r\n zoomTo(args: CommandArgs<{ zoom: number }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Pan — animate `lookAt`, the world-space point mapped to the viewport center. `z` moves it in depth. */\r\n panTo(args: CommandArgs<{ lookAt: LookAt }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /**\r\n * Swing the camera round {@link lookAt}. The argument names are the ones the\r\n * 3D components' `orbitTo` takes, less `zoom`: here that is the lens, not a\r\n * distance, and it has a command of its own.\r\n */\r\n orbitTo(args: CommandArgs<{ orbit?: number; elevation?: number }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Move the camera in toward {@link lookAt} (positive) or back out. */\r\n dollyTo(args: CommandArgs<{ dolly: number }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the view rotation (`heading`), in degrees clockwise. */\r\n headingTo(args: CommandArgs<{ heading: number }> & { duration: number }): Command<Canvas2DProps> {\r\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n fillTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<Canvas2DProps> {\r\n const from = this.fill as FillResolved[];\r\n const target = fillOps.resolve(args.data as Fill);\r\n const lerp = args.lerp ?? fillOps.lerp;\r\n return this.command<Canvas2DProps>(t => ({ fill: lerp(from, target, t) }) as Partial<Canvas2DProps>, args.duration, args.easing);\r\n }\r\n\r\n overlayTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<Canvas2DProps> {\r\n const from = this.overlay as FillResolved[];\r\n const target = fillOps.resolve(args.data as Fill);\r\n const lerp = args.lerp ?? fillOps.lerp;\r\n return this.command<Canvas2DProps>(t => ({ overlay: lerp(from, target, t) }) as Partial<Canvas2DProps>, args.duration, args.easing);\r\n }\r\n\r\n // ---- Layout -----------------------------------------------------------\r\n\r\n protected override flowArrangement(): FlowSettings {\r\n return this;\r\n }\r\n\r\n // ---- Drawing ----------------------------------------------------------\r\n\r\n // The viewport-sized background box behind the children.\r\n private shapeGraphics(): Graphics2D {\r\n return new Graphics2D().rect({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n });\r\n }\r\n\r\n protected override renderSelf(draw: RenderContext2D): void {\r\n const fill = this.fill as FillResolved[];\r\n if (fill.length === 0) return;\r\n draw.draw(this.shapeGraphics().fill(fill));\r\n }\r\n\r\n // Overlay over fill + children, clipped to the viewport silhouette.\r\n protected override renderOverlay(ctx: RenderContext2D): void {\r\n const overlay = this.overlay as FillResolved[];\r\n if (overlay.length === 0) return;\r\n ctx.draw(this.shapeGraphics().fill(overlay));\r\n }\r\n\r\n /**\r\n * Accept audio children as well as 2D ones.\r\n *\r\n * The scene root is where the two trees meet, mirroring `Canvas3D` — and for\r\n * the same reason it is *this* node: a composition already carries both\r\n * halves of a clip, so a voiceover belongs in the document that shows the\r\n * picture it is narrating rather than in a second document beside it.\r\n *\r\n * Nothing partitions them by hand. `Node2D.children` already filters to its\r\n * own kind, so layout and render skip the audio subtree for free, and the\r\n * audio declaration walk reads the unfiltered list.\r\n */\r\n protected override acceptsChild(child: Node): boolean {\r\n return child.dimension === \"2d\" || child.dimension === \"audio\";\r\n }\r\n\r\n override get _childTrees(): readonly NodeDimension[] {\r\n return [\"2d\", \"audio\"];\r\n }\r\n\r\n /** This node's children in the audio tree. */\r\n get childrenAudio(): NodeAudio[] {\r\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\r\n }\r\n\r\n // The world container, not a shape, so it declares its own `fill`/`overlay`.\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n assets.fill(this.fill as FillResolved[]);\r\n assets.fill(this.overlay as FillResolved[]);\r\n }\r\n\r\n // The viewport outline — used for `clip` and as the area backdrop effects\r\n // are confined to.\r\n protected override clipSelf(): Clip {\r\n return new Clip().rect({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n });\r\n }\r\n\r\n // ---- Rendering --------------------------------------------------------\r\n\r\n // Children are laid out by the flow engine; here we view that laid-out\r\n // world through the camera viewport transform, the same way the Camera node\r\n // does. When the camera is at rest (zoom 1, no heading, origin at 0) this is\r\n // the identity, so a plain layout root pays nothing extra.\r\n // Non-null exactly when renderChildren below opens a camera, so a consumer\r\n // reproducing the render transform (node picking) inserts the same scope in\r\n // the same place — and skips it on the at-rest fast path, where the renderer\r\n // pushes nothing at all.\r\n override _cameraScope(): CameraScope | null {\r\n if (this.space3D) return null;\r\n if (this.zoom === 1 && this.heading === 0 && this.lookAt.x === 0 && this.lookAt.y === 0) return null;\r\n return { lookAt: this.lookAt, zoom: this.zoom, heading: this.heading };\r\n }\r\n\r\n override _spaceCamera(): SpaceCamera | null {\r\n if (!this.space3D) return null;\r\n const rect = this.layoutBounds;\r\n return {\r\n perspective: this.perspective,\r\n orbit: this.orbit,\r\n elevation: this.elevation,\r\n dolly: this.dolly,\r\n lookAt: this.lookAt,\r\n zoom: this.zoom,\r\n heading: this.heading,\r\n viewportX: rect?.x ?? 0,\r\n viewportY: -(rect?.y ?? 0),\r\n };\r\n }\r\n\r\n // In a space the stage's own tilt and depth would turn the whole scene as\r\n // one flat card; its `perspective` is the camera's instead.\r\n protected override _projection(): Projection3D {\r\n return this.space3D ? NO_PROJECTION_3D : super._projection();\r\n }\r\n\r\n protected override renderChildren(ctx: RenderPass2D): void {\r\n const camera = this._spaceCamera();\r\n if (camera) {\r\n this._renderInSpace(ctx, spaceRootFrame(this, camera));\r\n return;\r\n }\r\n if (this.zoom === 1 && this.heading === 0 && this.lookAt.x === 0 && this.lookAt.y === 0) {\r\n super.renderChildren(ctx);\r\n return;\r\n }\r\n\r\n const rect = this.layoutBounds;\r\n const w = rect?.width ?? 0;\r\n const h = rect?.height ?? 0;\r\n const cx = rect?.x ?? 0;\r\n const cy = rect?.y ?? 0;\r\n\r\n ctx.beginCamera(\r\n { x: cx, y: -cy, width: w, height: h },\r\n this.lookAt,\r\n this.zoom,\r\n this.heading,\r\n );\r\n\r\n for (const child of this._children) if (child instanceof Node2D) child.render(ctx);\r\n\r\n ctx.endCamera();\r\n }\r\n}\r\n\r\ndeclareMembers(Canvas2D, {\r\n fill: fillProperty(),\r\n overlay: fillProperty(),\r\n flow: flowProperty(),\r\n gap: property({ default: 0 }),\r\n wrap: property({ default: false }),\r\n crossGap: property({ default: undefined }),\r\n columns: property({ default: 1 }),\r\n align: alignmentProperty(),\r\n zoom: property({ default: 1 }),\r\n lookAt: property({ default: { x: 0, y: 0 }, tween: lerpLookAt }),\r\n heading: property({ default: 0 }),\r\n space3D: property({ default: false }),\r\n orbit: property({ default: 0 }),\r\n elevation: property({ default: 0 }),\r\n dolly: property({ default: 0 }),\r\n\r\n zoomTo: command({ args: [{ key: \"zoom\", kind: \"number\", min: 0.01, step: 0.1, unit: \"×\" }] }),\r\n panTo: command({ args: [{ key: \"lookAt\", kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" }, z: { kind: \"number\" } } }] }),\r\n orbitTo: command({ args: [{ key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" }, { key: \"elevation\", kind: \"number\", step: 1, unit: \"°\" }] }),\r\n dollyTo: command({ args: [{ key: \"dolly\", kind: \"number\", step: 10 }] }),\r\n headingTo: command({ args: [{ key: \"heading\", kind: \"number\", step: 1, unit: \"°\" }] }),\r\n fillTo: command(),\r\n overlayTo: command(),\r\n});\r\n"]}
1
+ {"version":3,"file":"canvas2d-node.js","sourceRoot":"","sources":["../../../../src/components/trees/root/canvas2d-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAiC,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAqB,MAAM,8BAA8B,CAAC;AAGnF,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAI3D,OAAO,EAAe,MAAM,EAA2B,MAAM,8BAA8B,CAAC;AAC5F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\"@/render/graphics2d\";\nimport { Clip } from \"@/render/clip\";\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\nimport { lerpLookAt, type LookAt, type SpaceCamera } from \"@/attributes/layout/space3d\";\nimport { NO_PROJECTION_3D, type Projection3D } from \"@/attributes/layout/matrix2d\";\nimport { Alignment } from \"@/attributes/layout/alignment\";\nimport type { FlowMode, FlowProps, FlowSettings, GapSize } from \"@/layout/types\";\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { Fill } from \"@/attributes/shape/fill/chain\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport { CameraScope, Node2D, NodeConfig, Node2DProps } from \"@/components/trees/2d/node2d\";\nimport { spaceRootFrame } from \"@/components/trees/2d/node-space\";\nimport type { Node, NodeDimension } from \"@/components/trees/node/node\";\nimport { NodeAudio } from \"@/components/trees/audio/node-audio\";\nimport { declareMembers, property } from \"@/attributes/properties/decorator\";\nimport { alignmentProperty, fillProperty, flowProperty } from \"@/attributes/properties/typed\";\n\n/** @internal */\nexport interface Canvas2DProps extends Node2DProps, FlowProps {\n /**\n * Background fill layer(s). Each item can be a CSS color string, a fill\n * prop object, an already-resolved fill, or a {@link FillChain} from the\n * `Fills` builder. Painted behind the scene's children.\n */\n fill: Fill;\n /**\n * Overlay layer(s) — same loose values as {@link fill}, but painted *over*\n * the fill **and** the children (clipped to the viewport). Use for textures\n * laid across the whole scene, e.g. a VHS-grain image or video.\n */\n overlay: Fill;\n /** Camera magnification factor. Values > 1 zoom in; < 1 zoom out. */\n zoom: number;\n /**\n * World-space point that maps to the centre of the viewport. In a\n * {@link space3D} it is also what the camera orbits, and `z` puts it in\n * depth — the same sense as a node's `depth`, so a negative `z` flies in.\n */\n lookAt: LookAt;\n /** Rotation of the camera view in degrees (clockwise). */\n heading: number;\n /**\n * Place the children in one 3D space seen through this camera, rather than\n * each projecting through a perspective of its own. Their `depth` and tilt\n * are then positions and turns in that space, and siblings paint far to\n * near. A switch rather than something read off the camera's numbers, so\n * turning it on can never jump a tween.\n *\n * While it is on, `perspective` is the camera's distance from {@link lookAt}\n * at `dolly: 0` — CSS's convention, so that plane draws 1:1 and `0` is a\n * parallel projection — and the stage's own tilt and depth are unused.\n */\n space3D: boolean;\n /** Degrees about the vertical axis through {@link lookAt}. 0 is head-on; positive moves the camera to the right. Same as `Camera3D`. */\n orbit: number;\n /** Degrees above the layers. Positive looks down on them. Same as `Camera3D`. */\n elevation: number;\n /** Px the camera has moved in toward {@link lookAt}. Inert with no perspective, as depth is. */\n dolly: number;\n}\n\n/**\n * The single root container every clip document builds into.\n *\n * A `Canvas2D` is a plain {@link Node2D} that doubles as the clip's layout frame\n * and camera. It lays its children out (flex `horizontal`/`vertical` or\n * `freeform`, with `gap`, `align`, `padding`) and paints a scene-wide background\n * (`fill`) and `overlay` — *and* views those laid-out children through a viewport\n * transform (`zoom`, `lookAt`, `heading`).\n *\n * Unlike a {@link Rect} it is **not a shape**: it has no stroke, shadow, corner,\n * or `start`/`end` props. It carries only the scene-wide concerns — background\n * paint, child layout, and camera — so `stage.fill`, `stage.flow`, etc. read\n * the root directly without exposing per-shape geometry the scene root never has.\n *\n * Its layout props are the arrangement {@link Node2D} lays its children out by,\n * the same as a {@link Rect}'s — see {@link flowArrangement}.\n */\n/** @internal */\nexport class Canvas2D extends Node2D<Canvas2DProps> {\n\n // ---- Background paint -------------------------------------------------\n // Author-facing paint props. Like Rect, the declared type is the loose\n // `Fill` so assignment (`this.fill = 'red'`) and reads share one type; the\n // property accessor stores the *resolved* value via the mapper.\n declare fill: Fill;\n declare overlay: Fill;\n\n // ---- Layout container -------------------------------------------------\n declare flow: FlowMode;\n declare readonly gap: GapSize;\n declare readonly wrap: boolean;\n // `undefined` means \"follow `gap`\", not \"missing\" — see FlowProps.crossGap.\n declare readonly crossGap: number | undefined;\n declare readonly columns: number;\n // Declared loose as `Alignment` (covers `this.align = 'center'`); the\n // accessor stores the resolved per-axis `Vector2` pivot. See Rect.\n declare align: Alignment;\n\n // ---- Camera -----------------------------------------------------------\n /** Camera magnification factor (default: 1). */\n declare zoom: number;\n /** World-space focus point (default: {x:0, y:0}). */\n declare lookAt: LookAt;\n /** Camera view rotation in degrees (default: 0). */\n declare heading: number;\n declare space3D: boolean;\n declare orbit: number;\n declare elevation: number;\n declare dolly: number;\n\n constructor(props: NodeConfig<Canvas2D, Canvas2DProps>) {\n super(props);\n }\n\n // ---- Camera motion commands -------------------------------------------\n // Mirror the Camera node's viewport commands.\n\n /** Animate `zoom`. Values > 1 zoom in; < 1 zoom out. */\n zoomTo(args: CommandArgs<{ zoom: number }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Pan — animate `lookAt`, the world-space point mapped to the viewport center. `z` moves it in depth. */\n panTo(args: CommandArgs<{ lookAt: LookAt }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n /**\n * Swing the camera round {@link lookAt}. The argument names are the ones the\n * 3D components' `orbitTo` takes, less `zoom`: here that is the lens, not a\n * distance, and it has a command of its own.\n */\n orbitTo(args: CommandArgs<{ orbit?: number; elevation?: number }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Move the camera in toward {@link lookAt} (positive) or back out. */\n dollyTo(args: CommandArgs<{ dolly: number }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Animate the view rotation (`heading`), in degrees clockwise. */\n headingTo(args: CommandArgs<{ heading: number }> & { duration: number }): Command<Canvas2DProps> {\n return this.to({ data: args.data as Partial<Canvas2DProps>, duration: args.duration, easing: args.easing });\n }\n\n fillTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<Canvas2DProps> {\n const from = this.fill as FillResolved[];\n const target = fillOps.resolve(args.data as Fill);\n const lerp = args.lerp ?? fillOps.lerp;\n return this.command<Canvas2DProps>(t => ({ fill: lerp(from, target, t) }) as Partial<Canvas2DProps>, args.duration, args.easing);\n }\n\n overlayTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<Canvas2DProps> {\n const from = this.overlay as FillResolved[];\n const target = fillOps.resolve(args.data as Fill);\n const lerp = args.lerp ?? fillOps.lerp;\n return this.command<Canvas2DProps>(t => ({ overlay: lerp(from, target, t) }) as Partial<Canvas2DProps>, args.duration, args.easing);\n }\n\n // ---- Layout -----------------------------------------------------------\n\n protected override flowArrangement(): FlowSettings {\n return this;\n }\n\n // ---- Drawing ----------------------------------------------------------\n\n // The viewport-sized background box behind the children.\n private shapeGraphics(): Graphics2D {\n return new Graphics2D().rect({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n });\n }\n\n protected override renderSelf(draw: RenderContext2D): void {\n const fill = this.fill as FillResolved[];\n if (fill.length === 0) return;\n draw.draw(this.shapeGraphics().fill(fill));\n }\n\n // Overlay over fill + children, clipped to the viewport silhouette.\n protected override renderOverlay(ctx: RenderContext2D): void {\n const overlay = this.overlay as FillResolved[];\n if (overlay.length === 0) return;\n ctx.draw(this.shapeGraphics().fill(overlay));\n }\n\n /**\n * Accept audio children as well as 2D ones.\n *\n * The scene root is where the two trees meet, mirroring `Canvas3D` — and for\n * the same reason it is *this* node: a composition already carries both\n * halves of a clip, so a voiceover belongs in the document that shows the\n * picture it is narrating rather than in a second document beside it.\n *\n * Nothing partitions them by hand. `Node2D.children` already filters to its\n * own kind, so layout and render skip the audio subtree for free, and the\n * audio declaration walk reads the unfiltered list.\n */\n protected override acceptsChild(child: Node): boolean {\n return child.dimension === \"2d\" || child.dimension === \"audio\";\n }\n\n override get _childTrees(): readonly NodeDimension[] {\n return [\"2d\", \"audio\"];\n }\n\n /** This node's children in the audio tree. */\n get childrenAudio(): NodeAudio[] {\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\n }\n\n // The world container, not a shape, so it declares its own `fill`/`overlay`.\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets);\n assets.fill(this.fill as FillResolved[]);\n assets.fill(this.overlay as FillResolved[]);\n }\n\n // The viewport outline — used for `clip` and as the area backdrop effects\n // are confined to.\n protected override clipSelf(): Clip {\n return new Clip().rect({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n });\n }\n\n // ---- Rendering --------------------------------------------------------\n\n // Children are laid out by the flow engine; here we view that laid-out\n // world through the camera viewport transform, the same way the Camera node\n // does. When the camera is at rest (zoom 1, no heading, origin at 0) this is\n // the identity, so a plain layout root pays nothing extra.\n // Non-null exactly when renderChildren below opens a camera, so a consumer\n // reproducing the render transform (node picking) inserts the same scope in\n // the same place — and skips it on the at-rest fast path, where the renderer\n // pushes nothing at all.\n override _cameraScope(): CameraScope | null {\n if (this.space3D) return null;\n if (this.zoom === 1 && this.heading === 0 && this.lookAt.x === 0 && this.lookAt.y === 0) return null;\n return { lookAt: this.lookAt, zoom: this.zoom, heading: this.heading };\n }\n\n override _spaceCamera(): SpaceCamera | null {\n if (!this.space3D) return null;\n const rect = this.layoutBounds;\n return {\n perspective: this.perspective,\n orbit: this.orbit,\n elevation: this.elevation,\n dolly: this.dolly,\n lookAt: this.lookAt,\n zoom: this.zoom,\n heading: this.heading,\n viewportX: rect?.x ?? 0,\n viewportY: -(rect?.y ?? 0),\n };\n }\n\n // In a space the stage's own tilt and depth would turn the whole scene as\n // one flat card; its `perspective` is the camera's instead.\n protected override _projection(): Projection3D {\n return this.space3D ? NO_PROJECTION_3D : super._projection();\n }\n\n protected override renderChildren(ctx: RenderPass2D): void {\n const camera = this._spaceCamera();\n if (camera) {\n this._renderInSpace(ctx, spaceRootFrame(this, camera));\n return;\n }\n if (this.zoom === 1 && this.heading === 0 && this.lookAt.x === 0 && this.lookAt.y === 0) {\n super.renderChildren(ctx);\n return;\n }\n\n const rect = this.layoutBounds;\n const w = rect?.width ?? 0;\n const h = rect?.height ?? 0;\n const cx = rect?.x ?? 0;\n const cy = rect?.y ?? 0;\n\n ctx.beginCamera(\n { x: cx, y: -cy, width: w, height: h },\n this.lookAt,\n this.zoom,\n this.heading,\n );\n\n for (const child of this._children) if (child instanceof Node2D) child.render(ctx);\n\n ctx.endCamera();\n }\n}\n\ndeclareMembers(Canvas2D, {\n fill: fillProperty(),\n overlay: fillProperty(),\n flow: flowProperty(),\n gap: property({ default: 0 }),\n wrap: property({ default: false }),\n crossGap: property({ default: undefined }),\n columns: property({ default: 1 }),\n align: alignmentProperty(),\n zoom: property({ default: 1 }),\n lookAt: property({ default: { x: 0, y: 0 }, tween: lerpLookAt }),\n heading: property({ default: 0 }),\n space3D: property({ default: false }),\n orbit: property({ default: 0 }),\n elevation: property({ default: 0 }),\n dolly: property({ default: 0 }),\n\n zoomTo: command({ args: [{ key: \"zoom\", kind: \"number\", min: 0.01, step: 0.1, unit: \"×\" }] }),\n panTo: command({ args: [{ key: \"lookAt\", kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" }, z: { kind: \"number\" } } }] }),\n orbitTo: command({ args: [{ key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" }, { key: \"elevation\", kind: \"number\", step: 1, unit: \"°\" }] }),\n dollyTo: command({ args: [{ key: \"dolly\", kind: \"number\", step: 10 }] }),\n headingTo: command({ args: [{ key: \"heading\", kind: \"number\", step: 1, unit: \"°\" }] }),\n fillTo: command(),\n overlayTo: command(),\n});\n"]}