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

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 (746) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +48 -0
  4. package/README.md +93 -72
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.d.ts +9 -0
  7. package/dist/assets/catalog.d.ts.map +1 -1
  8. package/dist/assets/catalog.js +11 -0
  9. package/dist/assets/catalog.js.map +1 -1
  10. package/dist/assets/errors.d.ts.map +1 -1
  11. package/dist/assets/errors.js +8 -3
  12. package/dist/assets/errors.js.map +1 -1
  13. package/dist/assets/index.js.map +1 -1
  14. package/dist/assets/manager.d.ts +26 -1
  15. package/dist/assets/manager.d.ts.map +1 -1
  16. package/dist/assets/manager.js +79 -4
  17. package/dist/assets/manager.js.map +1 -1
  18. package/dist/assets/manifest.js.map +1 -1
  19. package/dist/assets/record.js.map +1 -1
  20. package/dist/assets/scope.d.ts +3 -3
  21. package/dist/assets/scope.d.ts.map +1 -1
  22. package/dist/assets/scope.js.map +1 -1
  23. package/dist/attributes/audio/filters/chain.d.ts +1 -1
  24. package/dist/attributes/audio/filters/chain.js.map +1 -1
  25. package/dist/attributes/audio/filters/curve.d.ts +8 -8
  26. package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
  27. package/dist/attributes/audio/filters/curve.js +20 -19
  28. package/dist/attributes/audio/filters/curve.js.map +1 -1
  29. package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
  30. package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
  31. package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
  32. package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
  33. package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
  34. package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
  35. package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
  36. package/dist/attributes/audio/filters/index.d.ts +1 -1
  37. package/dist/attributes/audio/filters/index.d.ts.map +1 -1
  38. package/dist/attributes/audio/filters/index.js +1 -1
  39. package/dist/attributes/audio/filters/index.js.map +1 -1
  40. package/dist/attributes/audio/filters/registry.js.map +1 -1
  41. package/dist/attributes/audio/filters/union.js.map +1 -1
  42. package/dist/attributes/audio/request.d.ts +17 -2
  43. package/dist/attributes/audio/request.d.ts.map +1 -1
  44. package/dist/attributes/audio/request.js.map +1 -1
  45. package/dist/attributes/audio/schedule.d.ts +4 -2
  46. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  47. package/dist/attributes/audio/schedule.js +15 -8
  48. package/dist/attributes/audio/schedule.js.map +1 -1
  49. package/dist/attributes/audio/sound.d.ts +4 -2
  50. package/dist/attributes/audio/sound.d.ts.map +1 -1
  51. package/dist/attributes/audio/sound.js +8 -4
  52. package/dist/attributes/audio/sound.js.map +1 -1
  53. package/dist/attributes/index.js.map +1 -1
  54. package/dist/attributes/layout/alignment.js +1 -1
  55. package/dist/attributes/layout/alignment.js.map +1 -1
  56. package/dist/attributes/layout/index.js.map +1 -1
  57. package/dist/attributes/layout/insets.js.map +1 -1
  58. package/dist/attributes/layout/matrix2d.js.map +1 -1
  59. package/dist/attributes/layout/size.js.map +1 -1
  60. package/dist/attributes/layout/transform3d.js.map +1 -1
  61. package/dist/attributes/layout/vector2.js.map +1 -1
  62. package/dist/attributes/layout/world-transform.js.map +1 -1
  63. package/dist/attributes/mask/boolean.js.map +1 -1
  64. package/dist/attributes/mask/mask.js.map +1 -1
  65. package/dist/attributes/properties/decorator.d.ts +3 -1
  66. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  67. package/dist/attributes/properties/decorator.js.map +1 -1
  68. package/dist/attributes/properties/inputs.js.map +1 -1
  69. package/dist/attributes/properties/typed.d.ts +9 -2
  70. package/dist/attributes/properties/typed.d.ts.map +1 -1
  71. package/dist/attributes/properties/typed.js +15 -1
  72. package/dist/attributes/properties/typed.js.map +1 -1
  73. package/dist/attributes/render3d/orbit.d.ts +8 -8
  74. package/dist/attributes/render3d/orbit.js +7 -7
  75. package/dist/attributes/render3d/orbit.js.map +1 -1
  76. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  77. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  78. package/dist/attributes/shape/corners/corners.js.map +1 -1
  79. package/dist/attributes/shape/corners/index.js.map +1 -1
  80. package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
  81. package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
  82. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  83. package/dist/attributes/shape/effects/chain.d.ts +28 -120
  84. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  85. package/dist/attributes/shape/effects/chain.js +16 -88
  86. package/dist/attributes/shape/effects/chain.js.map +1 -1
  87. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  88. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
  96. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  97. package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
  98. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  99. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  100. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  101. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  102. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  103. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  104. package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
  105. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  106. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  108. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  110. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  112. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
  114. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  116. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  118. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  120. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  122. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  124. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  126. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/shader.js +15 -8
  128. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  130. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  132. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  134. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  136. package/dist/attributes/shape/effects/index.d.ts +2 -6
  137. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  138. package/dist/attributes/shape/effects/index.js.map +1 -1
  139. package/dist/attributes/shape/effects/registry.d.ts +23 -6
  140. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  141. package/dist/attributes/shape/effects/registry.js +44 -10
  142. package/dist/attributes/shape/effects/registry.js.map +1 -1
  143. package/dist/attributes/shape/effects/union.d.ts +2 -6
  144. package/dist/attributes/shape/effects/union.d.ts.map +1 -1
  145. package/dist/attributes/shape/effects/union.js.map +1 -1
  146. package/dist/attributes/shape/fill/blend.js.map +1 -1
  147. package/dist/attributes/shape/fill/chain.js.map +1 -1
  148. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  149. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  150. package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
  151. package/dist/attributes/shape/fill/color/parser.js +81 -44
  152. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  153. package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
  154. package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
  155. package/dist/attributes/shape/fill/gradient-stops.js +65 -0
  156. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
  157. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  158. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  159. package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
  160. package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
  161. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  162. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  163. package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
  164. package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
  165. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  166. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  167. package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
  168. package/dist/attributes/shape/fill/implementations/image.js +5 -4
  169. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  170. package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
  171. package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
  172. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  173. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  174. package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
  175. package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
  176. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  177. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  178. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  179. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  180. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  181. package/dist/attributes/shape/fill/index.js.map +1 -1
  182. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  183. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  184. package/dist/attributes/shape/fill/registry.js.map +1 -1
  185. package/dist/attributes/shape/fill/union.js.map +1 -1
  186. package/dist/attributes/shape/filters/chain.d.ts +4 -10
  187. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  188. package/dist/attributes/shape/filters/chain.js +1 -13
  189. package/dist/attributes/shape/filters/chain.js.map +1 -1
  190. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  191. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  192. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  193. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  194. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  195. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  196. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  197. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  198. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  199. package/dist/attributes/shape/filters/index.d.ts +1 -1
  200. package/dist/attributes/shape/filters/index.js.map +1 -1
  201. package/dist/attributes/shape/filters/registry.d.ts +2 -2
  202. package/dist/attributes/shape/filters/registry.js +3 -3
  203. package/dist/attributes/shape/filters/registry.js.map +1 -1
  204. package/dist/attributes/shape/filters/union.d.ts +6 -7
  205. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  206. package/dist/attributes/shape/filters/union.js.map +1 -1
  207. package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
  208. package/dist/attributes/shape/path/anchors.js +12 -5
  209. package/dist/attributes/shape/path/anchors.js.map +1 -1
  210. package/dist/attributes/shape/path/bezier.js.map +1 -1
  211. package/dist/attributes/shape/path/index.js.map +1 -1
  212. package/dist/attributes/shape/path/measure.js.map +1 -1
  213. package/dist/attributes/shape/path/morph.d.ts.map +1 -1
  214. package/dist/attributes/shape/path/morph.js +16 -4
  215. package/dist/attributes/shape/path/morph.js.map +1 -1
  216. package/dist/attributes/shape/path/ops.js.map +1 -1
  217. package/dist/attributes/shape/path/types.js.map +1 -1
  218. package/dist/attributes/shape/path/walk.js.map +1 -1
  219. package/dist/attributes/shape/shaders/index.js.map +1 -1
  220. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  221. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  222. package/dist/attributes/shape/shadow/index.js.map +1 -1
  223. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  224. package/dist/attributes/shape/stroke/index.d.ts +2 -2
  225. package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
  226. package/dist/attributes/shape/stroke/index.js +1 -1
  227. package/dist/attributes/shape/stroke/index.js.map +1 -1
  228. package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
  229. package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
  230. package/dist/attributes/shape/stroke/stroke.js +22 -2
  231. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  232. package/dist/attributes/shared/operators.js.map +1 -1
  233. package/dist/attributes/text/index.js.map +1 -1
  234. package/dist/attributes/text/ops.d.ts +6 -0
  235. package/dist/attributes/text/ops.d.ts.map +1 -1
  236. package/dist/attributes/text/ops.js +1 -0
  237. package/dist/attributes/text/ops.js.map +1 -1
  238. package/dist/attributes/text/types.js.map +1 -1
  239. package/dist/browser/chunks/chunk-FUZVFT3W.js +18 -0
  240. package/dist/browser/chunks/chunk-FUZVFT3W.js.map +7 -0
  241. package/dist/browser/chunks/chunk-QG6C23IJ.js +3 -0
  242. package/dist/browser/chunks/chunk-QG6C23IJ.js.map +7 -0
  243. package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
  244. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
  245. package/dist/browser/component.js +1 -1
  246. package/dist/browser/component.js.map +1 -1
  247. package/dist/browser/index.js +1 -1
  248. package/dist/browser/index.js.map +4 -4
  249. package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
  250. package/dist/browser/jsx-jsx-runtime.js +1 -1
  251. package/dist/browser/manifest.json +3 -2
  252. package/dist/browser/sdk.js +1 -1
  253. package/dist/component.js.map +1 -1
  254. package/dist/document/audio.d.ts +1 -1
  255. package/dist/document/audio.js +4 -4
  256. package/dist/document/audio.js.map +1 -1
  257. package/dist/document/builtins.d.ts.map +1 -1
  258. package/dist/document/builtins.js +8 -14
  259. package/dist/document/builtins.js.map +1 -1
  260. package/dist/document/command-traits.d.ts +1 -1
  261. package/dist/document/command-traits.js +13 -1
  262. package/dist/document/command-traits.js.map +1 -1
  263. package/dist/document/deny-globals.js.map +1 -1
  264. package/dist/document/diff.js.map +1 -1
  265. package/dist/document/doc-index.d.ts +2 -2
  266. package/dist/document/doc-index.d.ts.map +1 -1
  267. package/dist/document/doc-index.js.map +1 -1
  268. package/dist/document/expression/compile.d.ts.map +1 -1
  269. package/dist/document/expression/compile.js +8 -5
  270. package/dist/document/expression/compile.js.map +1 -1
  271. package/dist/document/expression/index.js.map +1 -1
  272. package/dist/document/expression/ops.js +1 -1
  273. package/dist/document/expression/ops.js.map +1 -1
  274. package/dist/document/expression/parse.d.ts.map +1 -1
  275. package/dist/document/expression/parse.js +15 -6
  276. package/dist/document/expression/parse.js.map +1 -1
  277. package/dist/document/expression/refs.d.ts +1 -1
  278. package/dist/document/expression/refs.js +1 -1
  279. package/dist/document/expression/refs.js.map +1 -1
  280. package/dist/document/expression/types.js.map +1 -1
  281. package/dist/document/expression/walk.d.ts.map +1 -1
  282. package/dist/document/expression/walk.js +2 -1
  283. package/dist/document/expression/walk.js.map +1 -1
  284. package/dist/document/index.d.ts +2 -0
  285. package/dist/document/index.d.ts.map +1 -1
  286. package/dist/document/index.js +2 -0
  287. package/dist/document/index.js.map +1 -1
  288. package/dist/document/node-decorator.js.map +1 -1
  289. package/dist/document/node-descriptor.d.ts +19 -0
  290. package/dist/document/node-descriptor.d.ts.map +1 -1
  291. package/dist/document/node-descriptor.js.map +1 -1
  292. package/dist/document/placement.d.ts +70 -0
  293. package/dist/document/placement.d.ts.map +1 -0
  294. package/dist/document/placement.js +83 -0
  295. package/dist/document/placement.js.map +1 -0
  296. package/dist/document/project.d.ts +2 -2
  297. package/dist/document/project.d.ts.map +1 -1
  298. package/dist/document/project.js.map +1 -1
  299. package/dist/document/registry.d.ts +17 -0
  300. package/dist/document/registry.d.ts.map +1 -1
  301. package/dist/document/registry.js +29 -2
  302. package/dist/document/registry.js.map +1 -1
  303. package/dist/document/timeline-patch.js.map +1 -1
  304. package/dist/document/timeline.d.ts +73 -18
  305. package/dist/document/timeline.d.ts.map +1 -1
  306. package/dist/document/timeline.js +192 -40
  307. package/dist/document/timeline.js.map +1 -1
  308. package/dist/document/types.d.ts +12 -12
  309. package/dist/document/types.d.ts.map +1 -1
  310. package/dist/document/types.js +2 -2
  311. package/dist/document/types.js.map +1 -1
  312. package/dist/document/validate.d.ts +2 -2
  313. package/dist/document/validate.d.ts.map +1 -1
  314. package/dist/document/validate.js +37 -31
  315. package/dist/document/validate.js.map +1 -1
  316. package/dist/document/withdraw.d.ts +28 -0
  317. package/dist/document/withdraw.d.ts.map +1 -0
  318. package/dist/document/withdraw.js +61 -0
  319. package/dist/document/withdraw.js.map +1 -0
  320. package/dist/index.d.ts +1 -0
  321. package/dist/index.d.ts.map +1 -1
  322. package/dist/index.js +1 -0
  323. package/dist/index.js.map +1 -1
  324. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  325. package/dist/jsx/jsx-runtime.d.ts +9 -1
  326. package/dist/jsx/jsx-runtime.d.ts.map +1 -1
  327. package/dist/jsx/jsx-runtime.js +13 -3
  328. package/dist/jsx/jsx-runtime.js.map +1 -1
  329. package/dist/layout/bounds.d.ts +0 -1
  330. package/dist/layout/bounds.d.ts.map +1 -1
  331. package/dist/layout/bounds.js.map +1 -1
  332. package/dist/layout/constraints.js.map +1 -1
  333. package/dist/layout/flex.d.ts +4 -2
  334. package/dist/layout/flex.d.ts.map +1 -1
  335. package/dist/layout/flex.js +27 -11
  336. package/dist/layout/flex.js.map +1 -1
  337. package/dist/layout/freeform.js.map +1 -1
  338. package/dist/layout/grid.js.map +1 -1
  339. package/dist/layout/index.js.map +1 -1
  340. package/dist/layout/item.js.map +1 -1
  341. package/dist/layout/ops.d.ts +6 -0
  342. package/dist/layout/ops.d.ts.map +1 -1
  343. package/dist/layout/ops.js +6 -0
  344. package/dist/layout/ops.js.map +1 -1
  345. package/dist/layout/types.js.map +1 -1
  346. package/dist/nodes/2d/node-lifecycle.js.map +1 -1
  347. package/dist/nodes/2d/node-motion.js.map +1 -1
  348. package/dist/nodes/2d/node-render.d.ts +3 -3
  349. package/dist/nodes/2d/node-render.d.ts.map +1 -1
  350. package/dist/nodes/2d/node-render.js.map +1 -1
  351. package/dist/nodes/2d/node-transform.js.map +1 -1
  352. package/dist/nodes/2d/node2d.d.ts +115 -3
  353. package/dist/nodes/2d/node2d.d.ts.map +1 -1
  354. package/dist/nodes/2d/node2d.js +180 -28
  355. package/dist/nodes/2d/node2d.js.map +1 -1
  356. package/dist/nodes/2d/paint-node.d.ts +27 -0
  357. package/dist/nodes/2d/paint-node.d.ts.map +1 -1
  358. package/dist/nodes/2d/paint-node.js +42 -0
  359. package/dist/nodes/2d/paint-node.js.map +1 -1
  360. package/dist/nodes/audio/audio-bus.js.map +1 -1
  361. package/dist/nodes/audio/index.js.map +1 -1
  362. package/dist/nodes/audio/node-audio.js.map +1 -1
  363. package/dist/nodes/audio/sound-node.d.ts +2 -2
  364. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  365. package/dist/nodes/audio/sound-node.js +1 -1
  366. package/dist/nodes/audio/sound-node.js.map +1 -1
  367. package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
  368. package/dist/nodes/geometry/bounds-shape-node.js +2 -2
  369. package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
  370. package/dist/nodes/geometry/box-path-node.d.ts +3 -3
  371. package/dist/nodes/geometry/box-path-node.js +2 -2
  372. package/dist/nodes/geometry/box-path-node.js.map +1 -1
  373. package/dist/nodes/geometry/ellipse-node.js.map +1 -1
  374. package/dist/nodes/geometry/group-bounds.d.ts +2 -2
  375. package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
  376. package/dist/nodes/geometry/group-bounds.js +1 -2
  377. package/dist/nodes/geometry/group-bounds.js.map +1 -1
  378. package/dist/nodes/geometry/path-node.d.ts.map +1 -1
  379. package/dist/nodes/geometry/path-node.js +6 -0
  380. package/dist/nodes/geometry/path-node.js.map +1 -1
  381. package/dist/nodes/geometry/polygon-node.js.map +1 -1
  382. package/dist/nodes/geometry/polygram-node.js.map +1 -1
  383. package/dist/nodes/geometry/rect-node.js.map +1 -1
  384. package/dist/nodes/geometry/shape-node.js.map +1 -1
  385. package/dist/nodes/geometry/shape-outline.d.ts +2 -2
  386. package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
  387. package/dist/nodes/geometry/shape-outline.js +2 -13
  388. package/dist/nodes/geometry/shape-outline.js.map +1 -1
  389. package/dist/nodes/index.d.ts +3 -8
  390. package/dist/nodes/index.d.ts.map +1 -1
  391. package/dist/nodes/index.js +3 -8
  392. package/dist/nodes/index.js.map +1 -1
  393. package/dist/nodes/layout/camera-node.d.ts +9 -0
  394. package/dist/nodes/layout/camera-node.d.ts.map +1 -1
  395. package/dist/nodes/layout/camera-node.js +38 -3
  396. package/dist/nodes/layout/camera-node.js.map +1 -1
  397. package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
  398. package/dist/nodes/layout/orbit-camera-node.js +1 -1
  399. package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
  400. package/dist/nodes/layout/rotated-box.js.map +1 -1
  401. package/dist/nodes/media/video-node.d.ts.map +1 -1
  402. package/dist/nodes/media/video-node.js +2 -0
  403. package/dist/nodes/media/video-node.js.map +1 -1
  404. package/dist/nodes/node/declare-paints.js.map +1 -1
  405. package/dist/nodes/node/node-editor-state.js.map +1 -1
  406. package/dist/nodes/node/node-reactive.js.map +1 -1
  407. package/dist/nodes/node/node-time.d.ts +3 -3
  408. package/dist/nodes/node/node-time.d.ts.map +1 -1
  409. package/dist/nodes/node/node-time.js +1 -1
  410. package/dist/nodes/node/node-time.js.map +1 -1
  411. package/dist/nodes/node/node-walk.js.map +1 -1
  412. package/dist/nodes/node/node.d.ts +5 -3
  413. package/dist/nodes/node/node.d.ts.map +1 -1
  414. package/dist/nodes/node/node.js +44 -19
  415. package/dist/nodes/node/node.js.map +1 -1
  416. package/dist/nodes/node/text-defaults.d.ts +10 -12
  417. package/dist/nodes/node/text-defaults.d.ts.map +1 -1
  418. package/dist/nodes/node/text-defaults.js +10 -12
  419. package/dist/nodes/node/text-defaults.js.map +1 -1
  420. package/dist/nodes/{scene → root}/canvas2d-node.d.ts +2 -2
  421. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
  422. package/dist/nodes/{scene → root}/canvas2d-node.js +2 -2
  423. package/dist/nodes/root/canvas2d-node.js.map +1 -0
  424. package/dist/nodes/root/provider-node.d.ts.map +1 -0
  425. package/dist/nodes/root/provider-node.js.map +1 -0
  426. package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
  427. package/dist/nodes/root/theme-provider-node.js.map +1 -0
  428. package/dist/nodes/text/default-text-style-node.d.ts +5 -2
  429. package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
  430. package/dist/nodes/text/default-text-style-node.js +10 -4
  431. package/dist/nodes/text/default-text-style-node.js.map +1 -1
  432. package/dist/nodes/text/number-format.d.ts +1 -1
  433. package/dist/nodes/text/number-format.js +1 -1
  434. package/dist/nodes/text/number-format.js.map +1 -1
  435. package/dist/nodes/text/number-node.js.map +1 -1
  436. package/dist/nodes/text/number-pattern.js.map +1 -1
  437. package/dist/nodes/text/richtext-node.js +1 -1
  438. package/dist/nodes/text/richtext-node.js.map +1 -1
  439. package/dist/nodes/text/text-base.d.ts.map +1 -1
  440. package/dist/nodes/text/text-base.js +1 -1
  441. package/dist/nodes/text/text-base.js.map +1 -1
  442. package/dist/nodes/text/text-node.js.map +1 -1
  443. package/dist/nodes/text/text-selection.js.map +1 -1
  444. package/dist/nodes/three/camera-nodes.d.ts +21 -3
  445. package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
  446. package/dist/nodes/three/camera-nodes.js +42 -1
  447. package/dist/nodes/three/camera-nodes.js.map +1 -1
  448. package/dist/nodes/three/canvas3d-node.d.ts +29 -6
  449. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  450. package/dist/nodes/three/canvas3d-node.js +44 -2
  451. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  452. package/dist/nodes/three/drawable-nodes.d.ts +25 -11
  453. package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
  454. package/dist/nodes/three/drawable-nodes.js +43 -13
  455. package/dist/nodes/three/drawable-nodes.js.map +1 -1
  456. package/dist/nodes/three/environment-nodes.d.ts +9 -3
  457. package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
  458. package/dist/nodes/three/environment-nodes.js.map +1 -1
  459. package/dist/nodes/three/geometry-nodes.d.ts +2 -2
  460. package/dist/nodes/three/geometry-nodes.js +2 -2
  461. package/dist/nodes/three/geometry-nodes.js.map +1 -1
  462. package/dist/nodes/three/grid-geometry3d.js.map +1 -1
  463. package/dist/nodes/three/group3d.js.map +1 -1
  464. package/dist/nodes/three/light-nodes.d.ts.map +1 -1
  465. package/dist/nodes/three/light-nodes.js +3 -3
  466. package/dist/nodes/three/light-nodes.js.map +1 -1
  467. package/dist/nodes/three/mesh3d.js.map +1 -1
  468. package/dist/nodes/three/node3d.d.ts +48 -0
  469. package/dist/nodes/three/node3d.d.ts.map +1 -1
  470. package/dist/nodes/three/node3d.js +53 -3
  471. package/dist/nodes/three/node3d.js.map +1 -1
  472. package/dist/platform/audio-sink.d.ts +2 -2
  473. package/dist/platform/audio-sink.d.ts.map +1 -1
  474. package/dist/platform/audio-sink.js.map +1 -1
  475. package/dist/platform/exporter.d.ts +13 -8
  476. package/dist/platform/exporter.d.ts.map +1 -1
  477. package/dist/platform/exporter.js.map +1 -1
  478. package/dist/platform/index.d.ts +1 -1
  479. package/dist/platform/index.d.ts.map +1 -1
  480. package/dist/platform/index.js.map +1 -1
  481. package/dist/platform/stepped-clock.js.map +1 -1
  482. package/dist/platform/storage-adapter.d.ts +12 -6
  483. package/dist/platform/storage-adapter.d.ts.map +1 -1
  484. package/dist/platform/storage-adapter.js +4 -0
  485. package/dist/platform/storage-adapter.js.map +1 -1
  486. package/dist/platform/ticker.d.ts +6 -0
  487. package/dist/platform/ticker.d.ts.map +1 -1
  488. package/dist/platform/ticker.js +6 -0
  489. package/dist/platform/ticker.js.map +1 -1
  490. package/dist/project/config.js.map +1 -1
  491. package/dist/project/index.js.map +1 -1
  492. package/dist/project/tree.d.ts +3 -3
  493. package/dist/project/tree.d.ts.map +1 -1
  494. package/dist/project/tree.js.map +1 -1
  495. package/dist/props/host.js.map +1 -1
  496. package/dist/props/index.js.map +1 -1
  497. package/dist/props/observer.js.map +1 -1
  498. package/dist/props/slot.js.map +1 -1
  499. package/dist/renamed-scene-names.d.ts +17 -0
  500. package/dist/renamed-scene-names.d.ts.map +1 -0
  501. package/dist/renamed-scene-names.js +9 -0
  502. package/dist/renamed-scene-names.js.map +1 -0
  503. package/dist/render/canvas-render-context2d.d.ts +2 -2
  504. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  505. package/dist/render/canvas-render-context2d.js.map +1 -1
  506. package/dist/render/clip-contains.js.map +1 -1
  507. package/dist/render/clip.js.map +1 -1
  508. package/dist/render/descriptors/ellipse.js.map +1 -1
  509. package/dist/render/descriptors/latex.js.map +1 -1
  510. package/dist/render/descriptors/line.js.map +1 -1
  511. package/dist/render/descriptors/path-builder.js.map +1 -1
  512. package/dist/render/descriptors/path.js.map +1 -1
  513. package/dist/render/descriptors/polygon.js.map +1 -1
  514. package/dist/render/descriptors/polygram.js.map +1 -1
  515. package/dist/render/descriptors/rect.js.map +1 -1
  516. package/dist/render/descriptors/richtext.js.map +1 -1
  517. package/dist/render/descriptors/shape.d.ts +12 -0
  518. package/dist/render/descriptors/shape.d.ts.map +1 -1
  519. package/dist/render/descriptors/shape.js.map +1 -1
  520. package/dist/render/descriptors/text.d.ts +2 -2
  521. package/dist/render/descriptors/text.js +2 -2
  522. package/dist/render/descriptors/text.js.map +1 -1
  523. package/dist/render/descriptors/transform.d.ts +2 -2
  524. package/dist/render/descriptors/transform.d.ts.map +1 -1
  525. package/dist/render/descriptors/transform.js.map +1 -1
  526. package/dist/render/graphics2d.d.ts +3 -3
  527. package/dist/render/graphics2d.d.ts.map +1 -1
  528. package/dist/render/graphics2d.js +1 -1
  529. package/dist/render/graphics2d.js.map +1 -1
  530. package/dist/render/index.js.map +1 -1
  531. package/dist/render/measure-context.js.map +1 -1
  532. package/dist/render/null-render-context.js.map +1 -1
  533. package/dist/render/render-context2d.d.ts +2 -2
  534. package/dist/render/render-context2d.d.ts.map +1 -1
  535. package/dist/render/render-context2d.js.map +1 -1
  536. package/dist/render/surface.js.map +1 -1
  537. package/dist/render/text-defaults.js.map +1 -1
  538. package/dist/render/text-layout.js.map +1 -1
  539. package/dist/render3d/bounds3d.d.ts.map +1 -1
  540. package/dist/render3d/bounds3d.js +4 -2
  541. package/dist/render3d/bounds3d.js.map +1 -1
  542. package/dist/render3d/builders.js.map +1 -1
  543. package/dist/render3d/camera.d.ts +6 -0
  544. package/dist/render3d/camera.d.ts.map +1 -1
  545. package/dist/render3d/camera.js +5 -3
  546. package/dist/render3d/camera.js.map +1 -1
  547. package/dist/render3d/fill3d.d.ts +2 -9
  548. package/dist/render3d/fill3d.d.ts.map +1 -1
  549. package/dist/render3d/fill3d.js +2 -13
  550. package/dist/render3d/fill3d.js.map +1 -1
  551. package/dist/render3d/geometry.d.ts +8 -1
  552. package/dist/render3d/geometry.d.ts.map +1 -1
  553. package/dist/render3d/geometry.js.map +1 -1
  554. package/dist/render3d/graphics3d.d.ts +8 -4
  555. package/dist/render3d/graphics3d.d.ts.map +1 -1
  556. package/dist/render3d/graphics3d.js +18 -10
  557. package/dist/render3d/graphics3d.js.map +1 -1
  558. package/dist/render3d/index.d.ts +1 -1
  559. package/dist/render3d/index.js +1 -1
  560. package/dist/render3d/index.js.map +1 -1
  561. package/dist/render3d/inert.d.ts +14 -0
  562. package/dist/render3d/inert.d.ts.map +1 -0
  563. package/dist/render3d/inert.js +62 -0
  564. package/dist/render3d/inert.js.map +1 -0
  565. package/dist/render3d/light.js.map +1 -1
  566. package/dist/render3d/material.d.ts +10 -5
  567. package/dist/render3d/material.d.ts.map +1 -1
  568. package/dist/render3d/material.js.map +1 -1
  569. package/dist/render3d/matrix4.js.map +1 -1
  570. package/dist/render3d/render-context3d.js.map +1 -1
  571. package/dist/render3d/resources.js.map +1 -1
  572. package/dist/render3d/rounded-box.js.map +1 -1
  573. package/dist/render3d/scene-settings.d.ts +23 -4
  574. package/dist/render3d/scene-settings.d.ts.map +1 -1
  575. package/dist/render3d/scene-settings.js.map +1 -1
  576. package/dist/render3d/scene3d.d.ts +11 -0
  577. package/dist/render3d/scene3d.d.ts.map +1 -1
  578. package/dist/render3d/scene3d.js +39 -6
  579. package/dist/render3d/scene3d.js.map +1 -1
  580. package/dist/render3d/segments.js.map +1 -1
  581. package/dist/render3d/texture.d.ts +9 -0
  582. package/dist/render3d/texture.d.ts.map +1 -1
  583. package/dist/render3d/texture.js +13 -0
  584. package/dist/render3d/texture.js.map +1 -1
  585. package/dist/render3d/tracking.js.map +1 -1
  586. package/dist/render3d/transform.d.ts +1 -1
  587. package/dist/render3d/transform.js.map +1 -1
  588. package/dist/render3d/vector3.d.ts +18 -1
  589. package/dist/render3d/vector3.d.ts.map +1 -1
  590. package/dist/render3d/vector3.js +27 -0
  591. package/dist/render3d/vector3.js.map +1 -1
  592. package/dist/render3d/walk.d.ts +1 -1
  593. package/dist/render3d/walk.d.ts.map +1 -1
  594. package/dist/render3d/walk.js +5 -1
  595. package/dist/render3d/walk.js.map +1 -1
  596. package/dist/runtime/asset-refine.js.map +1 -1
  597. package/dist/runtime/asset-timeline.js.map +1 -1
  598. package/dist/runtime/asset-update.js.map +1 -1
  599. package/dist/runtime/audio-index.js.map +1 -1
  600. package/dist/runtime/builtin-context.js.map +1 -1
  601. package/dist/runtime/clip-instance.d.ts +5 -3
  602. package/dist/runtime/clip-instance.d.ts.map +1 -1
  603. package/dist/runtime/clip-instance.js +10 -6
  604. package/dist/runtime/clip-instance.js.map +1 -1
  605. package/dist/runtime/clip-store.d.ts +9 -0
  606. package/dist/runtime/clip-store.d.ts.map +1 -1
  607. package/dist/runtime/clip-store.js +19 -0
  608. package/dist/runtime/clip-store.js.map +1 -1
  609. package/dist/runtime/engine.d.ts +5 -0
  610. package/dist/runtime/engine.d.ts.map +1 -1
  611. package/dist/runtime/engine.js +2 -0
  612. package/dist/runtime/engine.js.map +1 -1
  613. package/dist/runtime/frame-time.d.ts +31 -0
  614. package/dist/runtime/frame-time.d.ts.map +1 -0
  615. package/dist/runtime/frame-time.js +29 -0
  616. package/dist/runtime/frame-time.js.map +1 -0
  617. package/dist/runtime/index.d.ts +1 -0
  618. package/dist/runtime/index.d.ts.map +1 -1
  619. package/dist/runtime/index.js +1 -0
  620. package/dist/runtime/index.js.map +1 -1
  621. package/dist/runtime/node-picking.d.ts +44 -3
  622. package/dist/runtime/node-picking.d.ts.map +1 -1
  623. package/dist/runtime/node-picking.js +118 -3
  624. package/dist/runtime/node-picking.js.map +1 -1
  625. package/dist/runtime/node-picking3d.d.ts +2 -1
  626. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  627. package/dist/runtime/node-picking3d.js +5 -2
  628. package/dist/runtime/node-picking3d.js.map +1 -1
  629. package/dist/runtime/placement.d.ts.map +1 -1
  630. package/dist/runtime/placement.js +4 -5
  631. package/dist/runtime/placement.js.map +1 -1
  632. package/dist/runtime/playback-controller.d.ts +31 -2
  633. package/dist/runtime/playback-controller.d.ts.map +1 -1
  634. package/dist/runtime/playback-controller.js +63 -6
  635. package/dist/runtime/playback-controller.js.map +1 -1
  636. package/dist/runtime/playback.js.map +1 -1
  637. package/dist/runtime/precompisition.js.map +1 -1
  638. package/dist/runtime/project-assets.js.map +1 -1
  639. package/dist/runtime/session.d.ts +9 -7
  640. package/dist/runtime/session.d.ts.map +1 -1
  641. package/dist/runtime/session.js +12 -4
  642. package/dist/runtime/session.js.map +1 -1
  643. package/dist/runtime/settle.js.map +1 -1
  644. package/dist/runtime/state-evaluator.d.ts +1 -1
  645. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  646. package/dist/runtime/state-evaluator.js +4 -3
  647. package/dist/runtime/state-evaluator.js.map +1 -1
  648. package/dist/runtime/text-geometry.js.map +1 -1
  649. package/dist/sdk/index.d.ts +19 -15
  650. package/dist/sdk/index.d.ts.map +1 -1
  651. package/dist/sdk/index.js +11 -6
  652. package/dist/sdk/index.js.map +1 -1
  653. package/dist/tween/command-decorator.d.ts +2 -0
  654. package/dist/tween/command-decorator.d.ts.map +1 -1
  655. package/dist/tween/command-decorator.js.map +1 -1
  656. package/dist/tween/command.js.map +1 -1
  657. package/dist/tween/ease/constants.d.ts.map +1 -1
  658. package/dist/tween/ease/constants.js +8 -5
  659. package/dist/tween/ease/constants.js.map +1 -1
  660. package/dist/tween/ease/curve.d.ts.map +1 -1
  661. package/dist/tween/ease/curve.js +4 -3
  662. package/dist/tween/ease/curve.js.map +1 -1
  663. package/dist/tween/ease/describe.d.ts +15 -0
  664. package/dist/tween/ease/describe.d.ts.map +1 -0
  665. package/dist/tween/ease/describe.js +37 -0
  666. package/dist/tween/ease/describe.js.map +1 -0
  667. package/dist/tween/ease/type.js.map +1 -1
  668. package/dist/tween/index.js.map +1 -1
  669. package/dist/tween/inert.js.map +1 -1
  670. package/dist/tween/lerp.js.map +1 -1
  671. package/dist/tween/loop.js.map +1 -1
  672. package/dist/tween/prepare.d.ts +3 -3
  673. package/dist/tween/prepare.js +3 -3
  674. package/dist/tween/prepare.js.map +1 -1
  675. package/dist/tween/seekable.d.ts +1 -1
  676. package/dist/tween/seekable.js.map +1 -1
  677. package/dist/tween/stepper.js.map +1 -1
  678. package/dist/tween/to-command.js.map +1 -1
  679. package/dist/util/clamp.js.map +1 -1
  680. package/dist/util/context.js.map +1 -1
  681. package/dist/util/csv.js.map +1 -1
  682. package/dist/util/generateList.js.map +1 -1
  683. package/dist/util/index.js.map +1 -1
  684. package/dist/util/metrics.d.ts +1 -1
  685. package/dist/util/metrics.js +1 -1
  686. package/dist/util/metrics.js.map +1 -1
  687. package/dist/util/random.js.map +1 -1
  688. package/dist/util/reference.js.map +1 -1
  689. package/dist/util/scheduler.js.map +1 -1
  690. package/package.json +2 -1
  691. package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
  692. package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
  693. package/dist/attributes/shape/effects/implementations/displace.js +0 -30
  694. package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
  695. package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
  696. package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
  697. package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
  698. package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
  699. package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
  700. package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
  701. package/dist/attributes/shape/effects/implementations/texture.js +0 -25
  702. package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
  703. package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
  704. package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
  705. package/dist/attributes/shape/effects/implementations/trails.js +0 -22
  706. package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
  707. package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
  708. package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
  709. package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
  710. package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
  711. package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
  712. package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
  713. package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
  714. package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
  715. package/dist/nodes/geometry/dot-grid-node.js +0 -142
  716. package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
  717. package/dist/nodes/geometry/grid-lines.d.ts +0 -101
  718. package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
  719. package/dist/nodes/geometry/grid-lines.js +0 -128
  720. package/dist/nodes/geometry/grid-lines.js.map +0 -1
  721. package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
  722. package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
  723. package/dist/nodes/geometry/grid-pattern-node.js +0 -172
  724. package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
  725. package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
  726. package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
  727. package/dist/nodes/geometry/line-grid-node.js +0 -127
  728. package/dist/nodes/geometry/line-grid-node.js.map +0 -1
  729. package/dist/nodes/geometry/line-node.d.ts +0 -58
  730. package/dist/nodes/geometry/line-node.d.ts.map +0 -1
  731. package/dist/nodes/geometry/line-node.js +0 -123
  732. package/dist/nodes/geometry/line-node.js.map +0 -1
  733. package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
  734. package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
  735. package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
  736. package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
  737. package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
  738. package/dist/nodes/scene/canvas2d-node.js.map +0 -1
  739. package/dist/nodes/scene/provider-node.d.ts.map +0 -1
  740. package/dist/nodes/scene/provider-node.js.map +0 -1
  741. package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
  742. package/dist/nodes/scene/theme-provider-node.js.map +0 -1
  743. /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
  744. /package/dist/nodes/{scene → root}/provider-node.js +0 -0
  745. /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
  746. /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/document/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAiB,MAAM,cAAc,CAAC;AAiXzD,kDAAkD;AAClD,MAAM,UAAU,eAAe,CAAC,GA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I,CAAC,OAAO,KAAK,SAAS;YAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAClE,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import type { EaseParams } from \"@/tween/ease/constants\";\nimport type { CurvePoint } from \"@/tween/ease/curve\";\nimport { loopPasses, type LoopSpec } from \"@/tween/loop\";\nimport type { Theme } from \"@/project/config\";\n\n/**\n * Re-exported as part of the document vocabulary: a loop is stored on a\n * {@link CommandSpec} the way an {@link EaseSpec} is, but its arithmetic is a\n * tween concern and lives with the tweens (`tween/loop.ts`).\n */\nexport type { LoopDirection, LoopSpec } from \"@/tween/loop\";\n\n/**\n * The scene document: what a scene **is**, as data.\n *\n * A scene used to be a generator function, so the only way to know what frame N\n * looked like was to run frames 0..N-1. That made a whole class of host\n * impossible — a document cannot be stored, diffed, synced or evaluated out of\n * order when its meaning is \"whatever running this code does\". These types are\n * the replacement: a scene is rows, and a frame is a pure function of them.\n *\n * The split between what is data and what is code is deliberate and total:\n *\n * - **Nodes are code.** A node type is a class registered under a string key\n * (see `document/registry.ts`). That is the extension point — a custom node\n * with its own `@property` declarations, its own `renderSelf`, its own\n * `@command` methods — and it is where anything a JSON value cannot express\n * (a computed lookup table, a generated point cloud) belongs.\n * - **Scenes are data.** Which nodes exist, what props they carry, and what\n * happens to them over time are plain JSON.\n *\n * Everything here is JSON-serializable by construction: no functions, no class\n * instances. A document round-trips through a file or a database column without\n * a mapping layer.\n */\n\n/**\n * One node, as a row.\n *\n * Flat rather than nested, for two reasons that both bite immediately\n * otherwise: a command addresses its target by `id`, and a nested tree makes\n * \"move this node under that one\" a structural rewrite rather than a\n * single-field edit. It is also the shape a relational store already wants —\n * `parentId` is a self-referencing foreign key.\n *\n * The scene root is not special-cased here: it is the one row with\n * `id: \"\"`, `type: \"canvas2d\"` and `parentId: null` — see\n * {@link CommandSpec.targetId}.\n */\nexport interface NodeSpec {\n /** Stable identity. Command targets resolve to it; it survives reordering. */\n id: string;\n /**\n * Registry key of the node's class — `\"rect\"`, `\"text\"`, `\"canvas3d\"`, or\n * whatever a custom node registered itself as. An unknown key is a\n * validation error rather than a silently-skipped node: a document that\n * half-renders is worse than one that refuses to.\n */\n type: string;\n /**\n * The handle an **expression** names this node by: `\"=[card.x]\"` reads the\n * `x` of the node keyed `card`. See {@link CompositionDocument} and\n * `document/expression/`.\n *\n * Optional and **never generated**, unlike {@link id} — a node has one\n * because an author wrote one, which is what makes it safe to point a\n * formula at. Unique per document all the same: a second `card` would make\n * `[card.x]` mean whichever row was read last. It is a *reference*, not an\n * address — a `parentId` or a `targetId` is always an {@link id}, so there is\n * exactly one way to say which node and one way to say which handle.\n *\n * Not a display label. A host that wants one keeps it, since nothing here\n * reads it.\n */\n key?: string;\n /** Parent node id, or `null` for a direct child of the scene root. */\n parentId: string | null;\n /**\n * Position among siblings. Load-bearing rather than cosmetic: a `row`/\n * `column` parent lays its children out in exactly this order.\n */\n layerOrder: number;\n /**\n * Authored props, **sparse** — only what differs from the type's declared\n * defaults. A freshly created node is `{}`, which is what keeps a document\n * diff small and lets a change to a default actually reach existing\n * documents.\n */\n props: Record<string, unknown>;\n}\n\n/**\n * A {@link NodeSpec} placed on a clip's clock: present from {@link startAt} until\n * {@link endAt}.\n *\n * The span is a field of the node rather than a pair of commands, so a node is\n * the same row whether a still or a composition holds it — moving a subtree\n * between the two is dropping or adding these two fields, never rewriting rows.\n * Not `start`/`end`: a painted node already owns those as path-trim props.\n */\nexport interface TimedNodeSpec extends NodeSpec {\n /** Seconds from the clip's start at which the node enters the tree. Absent is `0`. */\n startAt?: number;\n /** Seconds at which it leaves. Absent is never — it stays to the clip's end. */\n endAt?: number;\n}\n\n/**\n * A **variable**: a value with a name, in neither the tree nor the command list.\n *\n * The thing that exists purely so a change can happen in *one* place. Twelve\n * nodes fading together used to be twelve `to` commands whose `at` and\n * `duration` had to be kept equal by hand; with a variable it is one\n * `variableTo` and twelve props bound to `\"=[fade]\"`.\n *\n * Every document kind declares them the same way, in `variables`. On a still\n * nothing can change one, so it is a fixed value; on a composition a\n * `variableTo`/`variableSet` command may drive it. A variable has no presence\n * span: an expression naming one that \"does not exist yet\" is a broken document,\n * so a variable holds its declared {@link value} from t=0 until a command\n * changes it.\n *\n * Nothing reads a variable except an expression (`document/expression/`), and an\n * expression can only appear in a prop — so a variable cannot read another\n * variable, and no chain of them can cycle. A prop reading another node's prop\n * (`[key.x]`) is the case that can, and `validate.ts` refuses it.\n */\nexport interface VariableSpec {\n /**\n * Stable identity. Commands target it, and `[id]` in an expression names\n * it — one key, not two, so there is nothing to keep in sync.\n */\n id: string;\n /** A display label for a host's UI. Expressions never see it. */\n name?: string;\n /**\n * What it holds before anything changes it, and the value type every\n * command that writes it is expected to produce.\n *\n * Any JSON value. A number is the common case, but a colour string, a\n * `Vector2` or a whole fill object all work — a lone `\"=[x]\"` hands the\n * value through untouched, so a variable is as expressive as the prop it\n * drives.\n */\n value: unknown;\n /**\n * How it interpolates, by registry key — `\"number\"`, `\"vector2\"`,\n * `\"vector3\"`, `\"color\"`, `\"step\"`, or anything `Registry.addLerp`\n * added. A command may override it per tween.\n *\n * Absent means `\"number\"` for a numeric {@link value} and `\"step\"` for\n * anything else: snap at the end rather than interpolate garbage.\n */\n lerp?: string;\n}\n\n/**\n * How a command eases, as data.\n *\n * Mirrors the `linear`/`easeIn`/`easeOut`/`easeInOut` families in\n * `tween/ease/constants.ts` — `kind` picks the direction, `args` picks the\n * family and its knobs. Resolved to an `EasingFunction` once, at compile time.\n *\n * `kind: \"custom\"` resolves through the registry instead — `args` is then\n * the key a host passed to `Registry.addEase`/`RegistryOptions.eases`,\n * for an ease no standard family expresses (an authored curve, a physically\n * simulated one).\n */\nexport interface EaseSpec {\n kind: \"linear\" | \"in\" | \"out\" | \"inOut\" | \"custom\";\n /**\n * Family and its parameters (`\"quad\"`, or `{ type: \"back\", overshoot: 2 }`)\n * for every `kind` but `\"custom\"`, whose `args` is instead the drawn curve\n * itself — a {@link CurvePoint} chain from (0, 0) to (1, 1), so the timing\n * travels with the document — or the `Registry.addEase` key of a function\n * the host registered.\n */\n args?: EaseParams | CurvePoint[] | string;\n}\n\n/**\n * One command, **placed on the timeline**.\n *\n * The placement is the whole idea. A generator expressed sequencing by\n * suspending — running `a` to completion before `b` began — which is why order\n * of evaluation was order of execution, and why seeking backwards meant\n * starting over. A command\n * carries its own `at`, so:\n *\n * - **sequence** is `b.at === a.at + a.duration`,\n * - **parallel** is two commands sharing an `at`,\n * - **wait** is a gap between them.\n *\n * There are no `sequence`/`parallel`/`wait` primitives any more because there\n * is nothing left for them to do. And because every command's span is declared\n * rather than discovered, the scene's duration, its asset windows and each\n * node's lifespan are all readable straight off the document — see\n * `runtime/analysis.ts`.\n */\nexport interface CommandSpec {\n /** Stable identity, so a host can address and reorder one command. */\n id: string;\n /**\n * Registry key of the command — `\"to\"`, `\"set\"`, `\"variableTo\"`, or any\n * `@command()` method a node class exposes (`\"moveTo\"`, `\"fillTo\"`,\n * `\"countTo\"`, …). See `document/registry.ts`. A command changes what a\n * node holds, never whether it exists — that is its {@link TimedNodeSpec} span.\n */\n type: string;\n /**\n * The node this command acts on, or `null` for the scene root — the\n * `Canvas2D` that is simultaneously the scene's layout frame, its\n * background paint and its camera (the node with `id: \"\"`,\n * `type: \"canvas2d\"`).\n *\n * A **variable** command (`\"variableTo\"`, `\"variableSet\"`) names a\n * {@link VariableSpec} here instead. The command type says which table the\n * id is looked up in, so there is no prefix to write; ids are required to be\n * unique across nodes and variables so a host grouping its timeline rows by\n * `targetId` cannot conflate the two.\n */\n targetId: string | null;\n /**\n * Seconds from the scene's start at which the command begins.\n *\n * Seconds rather than a frame index because a document has to survive an\n * fps change: the same scene rendered at 30 and at 60 must be the same\n * animation, not the same integers. Frames are derived (`at * fps`).\n */\n at: number;\n /**\n * Seconds **one pass** takes. Absent or `0` is a stamp — it applies at once.\n *\n * One pass rather than the whole span, so that {@link loop}ing a command\n * repeats it instead of squeezing the same motion into the same time: a\n * two-second spin repeated three times runs for six seconds and each turn\n * still takes two. The span is {@link commandSpan}.\n */\n duration?: number;\n /** How it eases, per pass. Absent means the command's own default. */\n easing?: EaseSpec;\n /**\n * How it repeats. Absent runs it once.\n *\n * A placement field beside {@link at} and {@link duration} rather than\n * something inside {@link args}, because repeating is not any one command's\n * business: the runtime wraps the *built* command, so `to`, `fillTo`,\n * `countTo` and a node's own `@command()` all loop by the same code and a\n * newly written command type gets it for free.\n */\n loop?: LoopSpec;\n /**\n * The command's arguments. Shape is per command type: `\"to\"`/`\"set\"`'s *is*\n * the props diff, `\"variableTo\"`'s carries the `value`, a named command\n * carries its leading arguments by parameter name. Never wrapped in an extra\n * key for a command with exactly one argument.\n */\n args: Record<string, unknown>;\n}\n\n/**\n * A **still**: a node tree and nothing else.\n *\n * One frame, no timeline, no commands. It is its own document type rather than\n * \"an animation nobody ran\" because the two are edited by different tools and\n * validated by different rules — a still carrying a duration, or a half-applied\n * tween, is a document that should never have been representable.\n *\n * The scene root — `fill`, `overlay`, `flow`, `align`, `padding`, the camera\n * (`zoom`, `origin`, `heading`) — is not a separate field: it is the row in\n * {@link nodes} with `id: \"\"` and `type: \"canvas2d\"`. Omitting it gets the\n * default root.\n */\nexport interface StillDocument {\n kind: \"still\";\n /** Every node in the scene, including the root. Order here is irrelevant — `parentId`/`layerOrder` carry the structure. */\n nodes: NodeSpec[];\n /** Values props bind to with an expression. Fixed here — nothing on a still changes one. */\n variables?: VariableSpec[];\n /**\n * Colour tokens and typography presets this clip resolves against.\n *\n * On the clip, not only on the project, because a theme is part of what a\n * clip *looks like* — a lower third in a brand's palette is that document,\n * not that document plus a setting a host remembered to pass alongside it.\n * A project's own `theme` is the default for clips that declare none.\n */\n theme?: Theme;\n}\n\n/**\n * A **composition**: a still's node tree, placed in time, and the commands that\n * animate it.\n *\n * The nodes are the same rows a still holds, each with its own span, so when a\n * node appears is one editable field rather than an implicit consequence of\n * where a `stage.add(...)` sat in a function body — and a subtree lifted out of\n * a still drops in here unchanged.\n *\n * The scene root is the row in {@link nodes} with `id: \"\"` and\n * `type: \"canvas2d\"`, as on a still. Omitting it gets the default root; a\n * command targeting `null` animates it like any other node.\n */\nexport interface CompositionDocument {\n kind: \"composition\";\n /** Every node, the root included. Order is irrelevant — `parentId`/`layerOrder` carry the structure. */\n nodes: TimedNodeSpec[];\n /** Values props bind to with an expression, and that `variableTo`/`variableSet` may drive. */\n variables?: VariableSpec[];\n /** Every command. Order in the array is irrelevant; `at` is the placement. */\n commands: CommandSpec[];\n /**\n * Colour tokens and typography presets this clip resolves against.\n *\n * On the clip, not only on the project, because a theme is part of what a\n * clip *looks like* — a lower third in a brand's palette is that document,\n * not that document plus a setting a host remembered to pass alongside it.\n * A project's own `theme` is the default for clips that declare none.\n */\n theme?: Theme;\n\n /**\n * Total length in seconds. Defaults to the last moment anything happens — a\n * command's end, or a node's start or finite end — which is what you want\n * almost always; set it to hold on the final frame, or to cut a scene short.\n */\n duration?: number;\n}\n\n/**\n * An **audio document**: a bus tree placed in time, and the commands that move\n * it.\n *\n * The audio counterpart to {@link CompositionDocument}, and it reads the same\n * way for the same reason — when a sound starts is its node's `startAt`, not a\n * consequence of running something.\n *\n * The root is implicit, on the same convention a composition uses for its\n * `canvas2d`: `targetId: null` on a command, and `parentId: null` on a node,\n * name *this document's own root bus* — the row with `id: \"\"` and\n * `type: \"audioBus\"`. Omitting it gets the default one.\n *\n * There is deliberately no \"still\" case for audio: unlike a picture, sound with\n * no timeline is silence, so the degenerate case is not worth a document kind.\n */\nexport interface AudioDocument {\n kind: \"audio\";\n /** Every node, the root bus included. */\n nodes: TimedNodeSpec[];\n /** Values props bind to with an expression, and that `variableTo`/`variableSet` may drive. */\n variables?: VariableSpec[];\n /** Every command. Order in the array is irrelevant; `at` is the placement. */\n commands: CommandSpec[];\n /** Defaults to the last moment anything happens, same rule as {@link CompositionDocument}. */\n duration?: number;\n}\n\n/** Either **scene** document kind — the two that draw. */\nexport type SceneDocument = StillDocument | CompositionDocument;\n\n/**\n * Anything a project track can play: a scene, or sound.\n *\n * One union rather than two lists, because a track is a placement and a\n * placement does not care which. A composition already carries both halves —\n * its `canvas2d` root takes audio children as readily as visual ones — so an\n * {@link AudioDocument} is not \"the audio track kind\", it is the clip you reach\n * for when there is no picture to go with the sound.\n */\nexport type ClipDocument = SceneDocument | AudioDocument;\n\n/** Narrows a {@link SceneDocument} to a still. */\nexport function isStillDocument(doc: SceneDocument): doc is StillDocument {\n return doc.kind === \"still\";\n}\n\n/** Narrows a {@link SceneDocument} to a composition. */\nexport function isCompositionDocument(doc: SceneDocument): doc is CompositionDocument {\n return doc.kind === \"composition\";\n}\n\n/** Narrows a {@link ClipDocument} to an audio document. */\nexport function isAudioDocument(doc: ClipDocument): doc is AudioDocument {\n return doc.kind === \"audio\";\n}\n\n/** Narrows a {@link ClipDocument} to one that has a clock — anything but a still. */\nexport function hasTimeline(doc: ClipDocument): doc is CompositionDocument | AudioDocument {\n return doc.kind !== \"still\";\n}\n\n/**\n * The id the scene root answers to — the empty string, a real id rather than a\n * missing one. A host storing its root under some other id maps it here at the\n * one boundary its rows become a document.\n */\nexport const ROOT_NODE_ID = \"\";\n\n/** When a node is in the tree. `end` is `Infinity` for a node that never leaves. */\nexport interface NodeSpan {\n start: number;\n end: number;\n}\n\n/** A node's own span, as declared. A still's node — no span fields — is present always. */\nexport function nodeSpan(spec: NodeSpec | TimedNodeSpec): NodeSpan {\n const timed = spec as TimedNodeSpec;\n return { start: timed.startAt ?? 0, end: timed.endAt ?? Infinity };\n}\n\n/**\n * When a node is actually drawn: its own span intersected with every ancestor's.\n *\n * A child hangs off its parent, so it cannot outlive it — this is what the\n * runtime already does, and what an editor drawing a clipped bar or a validator\n * asking \"is the target there\" should read. Empty (`start >= end`) when the\n * spans never overlap; `undefined` for an id no row declares.\n */\nexport function effectiveSpan(nodes: readonly (NodeSpec | TimedNodeSpec)[], id: string): NodeSpan | undefined {\n return effectiveSpanIn(new Map(nodes.map((n) => [n.id, n])), id);\n}\n\n/**\n * {@link effectiveSpan} for every row at once, each ancestor chain walked once\n * however many descendants share it.\n */\nexport function effectiveSpans(nodes: readonly (NodeSpec | TimedNodeSpec)[]): Map<string, NodeSpan> {\n const byId = new Map(nodes.map((n) => [n.id, n]));\n const spans = new Map<string, NodeSpan>();\n const chain: (NodeSpec | TimedNodeSpec)[] = [];\n const inChain = new Set<string>();\n for (const start of byId.values()) {\n if (spans.has(start.id)) continue;\n chain.length = 0;\n inChain.clear();\n let above: NodeSpan | undefined;\n let spec: NodeSpec | TimedNodeSpec | undefined = start;\n while (spec) {\n const known = spans.get(spec.id);\n if (known) {\n above = known;\n break;\n }\n if (inChain.has(spec.id)) {\n // A parent cycle has no top to fold down from; an invalid document\n // gets the single-id answer for each member instead.\n for (const member of chain) spans.set(member.id, effectiveSpanIn(byId, member.id)!);\n chain.length = 0;\n break;\n }\n chain.push(spec);\n inChain.add(spec.id);\n spec = spec.parentId === null ? undefined : byId.get(spec.parentId);\n }\n for (let i = chain.length - 1; i >= 0; i--) {\n const span = nodeSpan(chain[i]);\n if (above) {\n span.start = Math.max(span.start, above.start);\n span.end = Math.min(span.end, above.end);\n }\n spans.set(chain[i].id, span);\n above = span;\n }\n }\n return spans;\n}\n\n/** @internal {@link effectiveSpan} over an id map a caller already holds. */\nexport function effectiveSpanIn(\n byId: ReadonlyMap<string, NodeSpec | TimedNodeSpec>,\n id: string,\n): NodeSpan | undefined {\n let spec = byId.get(id);\n if (!spec) return undefined;\n const span = nodeSpan(spec);\n const seen = new Set<string>();\n while (spec.parentId !== null && !seen.has(spec.id)) {\n seen.add(spec.id);\n const parent = byId.get(spec.parentId);\n if (!parent) break;\n const own = nodeSpan(parent);\n span.start = Math.max(span.start, own.start);\n span.end = Math.min(span.end, own.end);\n spec = parent;\n }\n return span;\n}\n\n/** A node with its span dropped — what a timed node becomes when it lands in a still. */\nexport function untimed(spec: NodeSpec | TimedNodeSpec): NodeSpec {\n const { startAt: _startAt, endAt: _endAt, ...rest } = spec as TimedNodeSpec;\n return rest;\n}\n\n/**\n * Seconds a command occupies: one pass, or every pass of a counted loop.\n *\n * An unlimited loop counts as **one** pass. It has no length of its own — it\n * runs for as long as there is clip — so letting it answer here would be a\n * command asking for a scene as long as it wants, which is a scene that can\n * never end.\n */\nexport function commandSpan(command: CommandSpec): number {\n const duration = command.duration ?? 0;\n if (duration <= 0 || !command.loop || command.loop.count === null) return duration;\n return duration * loopPasses(command.loop);\n}\n\n/**\n * How long a clip runs: its declared `duration`, else the last moment anything in\n * it happens — a command's end, or a node's arrival or finite departure. A still\n * has none.\n */\nexport function documentDuration(doc: ClipDocument): number {\n if (!hasTimeline(doc)) return 0;\n if (doc.duration !== undefined) return doc.duration;\n let end = 0;\n for (const command of doc.commands) {\n end = Math.max(end, command.at + commandSpan(command));\n }\n for (const node of doc.nodes) {\n if (node.startAt !== undefined) end = Math.max(end, node.startAt);\n if (node.endAt !== undefined && Number.isFinite(node.endAt)) end = Math.max(end, node.endAt);\n }\n return end;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/document/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAiB,MAAM,cAAc,CAAC;AAiXzD,mDAAmD;AACnD,MAAM,UAAU,eAAe,CAAC,GAAmB;IAC/C,OAAO,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,qBAAqB,CAAC,GAAmB;IACrD,OAAO,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC;AACtC,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,GAAiB;IAC7C,OAAO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,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import type { EaseParams } from \"@/tween/ease/constants\";\r\nimport type { CurvePoint } from \"@/tween/ease/curve\";\r\nimport { loopPasses, type LoopSpec } from \"@/tween/loop\";\r\nimport type { Theme } from \"@/project/config\";\r\n\r\n/**\r\n * Re-exported as part of the document vocabulary: a loop is stored on a\r\n * {@link CommandSpec} the way an {@link EaseSpec} is, but its arithmetic is a\r\n * tween concern and lives with the tweens (`tween/loop.ts`).\r\n */\r\nexport type { LoopDirection, LoopSpec } from \"@/tween/loop\";\r\n\r\n/**\r\n * The clip document: what a clip **is**, as data.\r\n *\r\n * A visual clip used to be a generator function, so the only way to know what frame N\r\n * looked like was to run frames 0..N-1. That made a whole class of host\r\n * impossible — a document cannot be stored, diffed, synced or evaluated out of\r\n * order when its meaning is \"whatever running this code does\". These types are\r\n * the replacement: a clip is rows, and a frame is a pure function of them.\r\n *\r\n * The split between what is data and what is code is deliberate and total:\r\n *\r\n * - **Nodes are code.** A node type is a class registered under a string key\r\n * (see `document/registry.ts`). That is the extension point — a custom node\r\n * with its own `@property` declarations, its own `renderSelf`, its own\r\n * `@command` methods — and it is where anything a JSON value cannot express\r\n * (a computed lookup table, a generated point cloud) belongs.\r\n * - **Documents are data.** Which nodes exist, what props they carry, and what\r\n * happens to them over time are plain JSON.\r\n *\r\n * Everything here is JSON-serializable by construction: no functions, no class\r\n * instances. A document round-trips through a file or a database column without\r\n * a mapping layer.\r\n */\r\n\r\n/**\r\n * One node, as a row.\r\n *\r\n * Flat rather than nested, for two reasons that both bite immediately\r\n * otherwise: a command addresses its target by `id`, and a nested tree makes\r\n * \"move this node under that one\" a structural rewrite rather than a\r\n * single-field edit. It is also the shape a relational store already wants —\r\n * `parentId` is a self-referencing foreign key.\r\n *\r\n * The scene root is not special-cased here: it is the one row with\r\n * `id: \"\"`, `type: \"canvas2d\"` and `parentId: null` — see\r\n * {@link CommandSpec.targetId}.\r\n */\r\nexport interface NodeSpec {\r\n /** Stable identity. Command targets resolve to it; it survives reordering. */\r\n id: string;\r\n /**\r\n * Registry key of the node's class — `\"rect\"`, `\"text\"`, `\"canvas3d\"`, or\r\n * whatever a custom node registered itself as. An unknown key is a\r\n * validation error rather than a silently-skipped node: a document that\r\n * half-renders is worse than one that refuses to.\r\n */\r\n type: string;\r\n /**\r\n * The handle an **expression** names this node by: `\"=[card.x]\"` reads the\r\n * `x` of the node keyed `card`. See {@link CompositionDocument} and\r\n * `document/expression/`.\r\n *\r\n * Optional and **never generated**, unlike {@link id} — a node has one\r\n * because an author wrote one, which is what makes it safe to point a\r\n * formula at. Unique per document all the same: a second `card` would make\r\n * `[card.x]` mean whichever row was read last. It is a *reference*, not an\r\n * address — a `parentId` or a `targetId` is always an {@link id}, so there is\r\n * exactly one way to say which node and one way to say which handle.\r\n *\r\n * Not a display label. A host that wants one keeps it, since nothing here\r\n * reads it.\r\n */\r\n key?: string;\r\n /** Parent node id, or `null` for a direct child of the scene root. */\r\n parentId: string | null;\r\n /**\r\n * Position among siblings. Load-bearing rather than cosmetic: a `row`/\r\n * `column` parent lays its children out in exactly this order.\r\n */\r\n layerOrder: number;\r\n /**\r\n * Authored props, **sparse** — only what differs from the type's declared\r\n * defaults. A freshly created node is `{}`, which is what keeps a document\r\n * diff small and lets a change to a default actually reach existing\r\n * documents.\r\n */\r\n props: Record<string, unknown>;\r\n}\r\n\r\n/**\r\n * A {@link NodeSpec} placed on a clip's clock: present from {@link startAt} until\r\n * {@link endAt}.\r\n *\r\n * The span is a field of the node rather than a pair of commands, so a node is\r\n * the same row whether a still or a composition holds it — moving a subtree\r\n * between the two is dropping or adding these two fields, never rewriting rows.\r\n * Not `start`/`end`: a painted node already owns those as path-trim props.\r\n */\r\nexport interface TimedNodeSpec extends NodeSpec {\r\n /** Seconds from the clip's start at which the node enters the tree. Absent is `0`. */\r\n startAt?: number;\r\n /** Seconds at which it leaves. Absent is never — it stays to the clip's end. */\r\n endAt?: number;\r\n}\r\n\r\n/**\r\n * A **variable**: a value with a name, in neither the tree nor the command list.\r\n *\r\n * The thing that exists purely so a change can happen in *one* place. Twelve\r\n * nodes fading together used to be twelve `to` commands whose `at` and\r\n * `duration` had to be kept equal by hand; with a variable it is one\r\n * `variableTo` and twelve props bound to `\"=[fade]\"`.\r\n *\r\n * Every document kind declares them the same way, in `variables`. On a still\r\n * nothing can change one, so it is a fixed value; on a composition a\r\n * `variableTo`/`variableSet` command may drive it. A variable has no presence\r\n * span: an expression naming one that \"does not exist yet\" is a broken document,\r\n * so a variable holds its declared {@link value} from t=0 until a command\r\n * changes it.\r\n *\r\n * Nothing reads a variable except an expression (`document/expression/`), and an\r\n * expression can only appear in a prop — so a variable cannot read another\r\n * variable, and no chain of them can cycle. A prop reading another node's prop\r\n * (`[key.x]`) is the case that can, and `validate.ts` refuses it.\r\n */\r\nexport interface VariableSpec {\r\n /**\r\n * Stable identity. Commands target it, and `[id]` in an expression names\r\n * it — one key, not two, so there is nothing to keep in sync.\r\n */\r\n id: string;\r\n /** A display label for a host's UI. Expressions never see it. */\r\n name?: string;\r\n /**\r\n * What it holds before anything changes it, and the value type every\r\n * command that writes it is expected to produce.\r\n *\r\n * Any JSON value. A number is the common case, but a colour string, a\r\n * `Vector2` or a whole fill object all work — a lone `\"=[x]\"` hands the\r\n * value through untouched, so a variable is as expressive as the prop it\r\n * drives.\r\n */\r\n value: unknown;\r\n /**\r\n * How it interpolates, by registry key — `\"number\"`, `\"vector2\"`,\r\n * `\"vector3\"`, `\"color\"`, `\"step\"`, or anything `Registry.addLerp`\r\n * added. A command may override it per tween.\r\n *\r\n * Absent means `\"number\"` for a numeric {@link value} and `\"step\"` for\r\n * anything else: snap at the end rather than interpolate garbage.\r\n */\r\n lerp?: string;\r\n}\r\n\r\n/**\r\n * How a command eases, as data.\r\n *\r\n * Mirrors the `linear`/`easeIn`/`easeOut`/`easeInOut` families in\r\n * `tween/ease/constants.ts` — `kind` picks the direction, `args` picks the\r\n * family and its knobs. Resolved to an `EasingFunction` once, at compile time.\r\n *\r\n * `kind: \"custom\"` resolves through the registry instead — `args` is then\r\n * the key a host passed to `Registry.addEase`/`RegistryOptions.eases`,\r\n * for an ease no standard family expresses (an authored curve, a physically\r\n * simulated one).\r\n */\r\nexport interface EaseSpec {\r\n kind: \"linear\" | \"in\" | \"out\" | \"inOut\" | \"custom\";\r\n /**\r\n * Family and its parameters (`\"quad\"`, or `{ type: \"back\", overshoot: 2 }`)\r\n * for every `kind` but `\"custom\"`, whose `args` is instead the drawn curve\r\n * itself — a {@link CurvePoint} chain from (0, 0) to (1, 1), so the timing\r\n * travels with the document — or the `Registry.addEase` key of a function\r\n * the host registered.\r\n */\r\n args?: EaseParams | CurvePoint[] | string;\r\n}\r\n\r\n/**\r\n * One command, **placed on the timeline**.\r\n *\r\n * The placement is the whole idea. A generator expressed sequencing by\r\n * suspending — running `a` to completion before `b` began — which is why order\r\n * of evaluation was order of execution, and why seeking backwards meant\r\n * starting over. A command\r\n * carries its own `at`, so:\r\n *\r\n * - **sequence** is `b.at === a.at + a.duration`,\r\n * - **parallel** is two commands sharing an `at`,\r\n * - **wait** is a gap between them.\r\n *\r\n * There are no `sequence`/`parallel`/`wait` primitives any more because there\r\n * is nothing left for them to do. And because every command's span is declared\r\n * rather than discovered, the scene's duration, its asset windows and each\r\n * node's lifespan are all readable straight off the document — see\r\n * `runtime/analysis.ts`.\r\n */\r\nexport interface CommandSpec {\r\n /** Stable identity, so a host can address and reorder one command. */\r\n id: string;\r\n /**\r\n * Registry key of the command — `\"to\"`, `\"set\"`, `\"variableTo\"`, or any\r\n * `@command()` method a node class exposes (`\"moveTo\"`, `\"fillTo\"`,\r\n * `\"countTo\"`, …). See `document/registry.ts`. A command changes what a\r\n * node holds, never whether it exists — that is its {@link TimedNodeSpec} span.\r\n */\r\n type: string;\r\n /**\r\n * The node this command acts on, or `null` for the scene root — the\r\n * `Canvas2D` that is simultaneously the scene's layout frame, its\r\n * background paint and its camera (the node with `id: \"\"`,\r\n * `type: \"canvas2d\"`).\r\n *\r\n * A **variable** command (`\"variableTo\"`, `\"variableSet\"`) names a\r\n * {@link VariableSpec} here instead. The command type says which table the\r\n * id is looked up in, so there is no prefix to write; ids are required to be\r\n * unique across nodes and variables so a host grouping its timeline rows by\r\n * `targetId` cannot conflate the two.\r\n */\r\n targetId: string | null;\r\n /**\r\n * Seconds from the scene's start at which the command begins.\r\n *\r\n * Seconds rather than a frame index because a document has to survive an\r\n * fps change: the same scene rendered at 30 and at 60 must be the same\r\n * animation, not the same integers. Frames are derived (`at * fps`).\r\n */\r\n at: number;\r\n /**\r\n * Seconds **one pass** takes. Absent or `0` is a stamp — it applies at once.\r\n *\r\n * One pass rather than the whole span, so that {@link loop}ing a command\r\n * repeats it instead of squeezing the same motion into the same time: a\r\n * two-second spin repeated three times runs for six seconds and each turn\r\n * still takes two. The span is {@link commandSpan}.\r\n */\r\n duration?: number;\r\n /** How it eases, per pass. Absent means the command's own default. */\r\n easing?: EaseSpec;\r\n /**\r\n * How it repeats. Absent runs it once.\r\n *\r\n * A placement field beside {@link at} and {@link duration} rather than\r\n * something inside {@link args}, because repeating is not any one command's\r\n * business: the runtime wraps the *built* command, so `to`, `fillTo`,\r\n * `countTo` and a node's own `@command()` all loop by the same code and a\r\n * newly written command type gets it for free.\r\n */\r\n loop?: LoopSpec;\r\n /**\r\n * The command's arguments. Shape is per command type: `\"to\"`/`\"set\"`'s *is*\r\n * the props diff, `\"variableTo\"`'s carries the `value`, a named command\r\n * carries its leading arguments by parameter name. Never wrapped in an extra\r\n * key for a command with exactly one argument.\r\n */\r\n args: Record<string, unknown>;\r\n}\r\n\r\n/**\r\n * A **still**: a node tree and nothing else.\r\n *\r\n * One frame, no timeline, no commands. It is its own document type rather than\r\n * \"an animation nobody ran\" because the two are edited by different tools and\r\n * validated by different rules — a still carrying a duration, or a half-applied\r\n * tween, is a document that should never have been representable.\r\n *\r\n * The scene root — `fill`, `overlay`, `flow`, `align`, `padding`, the camera\r\n * (`zoom`, `origin`, `heading`) — is not a separate field: it is the row in\r\n * {@link nodes} with `id: \"\"` and `type: \"canvas2d\"`. Omitting it gets the\r\n * default root.\r\n */\r\nexport interface StillDocument {\r\n kind: \"still\";\r\n /** Every node in the scene, including the root. Order here is irrelevant — `parentId`/`layerOrder` carry the structure. */\r\n nodes: NodeSpec[];\r\n /** Values props bind to with an expression. Fixed here — nothing on a still changes one. */\r\n variables?: VariableSpec[];\r\n /**\r\n * Colour tokens and typography presets this clip resolves against.\r\n *\r\n * On the clip, not only on the project, because a theme is part of what a\r\n * clip *looks like* — a lower third in a brand's palette is that document,\r\n * not that document plus a setting a host remembered to pass alongside it.\r\n * A project's own `theme` is the default for clips that declare none.\r\n */\r\n theme?: Theme;\r\n}\r\n\r\n/**\r\n * A **composition**: a still's node tree, placed in time, and the commands that\r\n * animate it.\r\n *\r\n * The nodes are the same rows a still holds, each with its own span, so when a\r\n * node appears is one editable field rather than an implicit consequence of\r\n * where a `stage.add(...)` sat in a function body — and a subtree lifted out of\r\n * a still drops in here unchanged.\r\n *\r\n * The scene root is the row in {@link nodes} with `id: \"\"` and\r\n * `type: \"canvas2d\"`, as on a still. Omitting it gets the default root; a\r\n * command targeting `null` animates it like any other node.\r\n */\r\nexport interface CompositionDocument {\r\n kind: \"composition\";\r\n /** Every node, the root included. Order is irrelevant — `parentId`/`layerOrder` carry the structure. */\r\n nodes: TimedNodeSpec[];\r\n /** Values props bind to with an expression, and that `variableTo`/`variableSet` may drive. */\r\n variables?: VariableSpec[];\r\n /** Every command. Order in the array is irrelevant; `at` is the placement. */\r\n commands: CommandSpec[];\r\n /**\r\n * Colour tokens and typography presets this clip resolves against.\r\n *\r\n * On the clip, not only on the project, because a theme is part of what a\r\n * clip *looks like* — a lower third in a brand's palette is that document,\r\n * not that document plus a setting a host remembered to pass alongside it.\r\n * A project's own `theme` is the default for clips that declare none.\r\n */\r\n theme?: Theme;\r\n\r\n /**\r\n * Total length in seconds. Defaults to the last moment anything happens — a\r\n * command's end, or a node's start or finite end — which is what you want\r\n * almost always; set it to hold on the final frame, or to cut a scene short.\r\n */\r\n duration?: number;\r\n}\r\n\r\n/**\r\n * An **audio document**: a bus tree placed in time, and the commands that move\r\n * it.\r\n *\r\n * The audio counterpart to {@link CompositionDocument}, and it reads the same\r\n * way for the same reason — when a sound starts is its node's `startAt`, not a\r\n * consequence of running something.\r\n *\r\n * The root is implicit, on the same convention a composition uses for its\r\n * `canvas2d`: `targetId: null` on a command, and `parentId: null` on a node,\r\n * name *this document's own root bus* — the row with `id: \"\"` and\r\n * `type: \"audioBus\"`. Omitting it gets the default one.\r\n *\r\n * There is deliberately no \"still\" case for audio: unlike a picture, sound with\r\n * no timeline is silence, so the degenerate case is not worth a document kind.\r\n */\r\nexport interface AudioDocument {\r\n kind: \"audio\";\r\n /** Every node, the root bus included. */\r\n nodes: TimedNodeSpec[];\r\n /** Values props bind to with an expression, and that `variableTo`/`variableSet` may drive. */\r\n variables?: VariableSpec[];\r\n /** Every command. Order in the array is irrelevant; `at` is the placement. */\r\n commands: CommandSpec[];\r\n /** Defaults to the last moment anything happens, same rule as {@link CompositionDocument}. */\r\n duration?: number;\r\n}\r\n\r\n/** Either **visual** document kind — the two that draw. */\r\nexport type VisualDocument = StillDocument | CompositionDocument;\r\n\r\n/**\r\n * Anything a project track can play: a picture, or sound.\r\n *\r\n * One union rather than two lists, because a track is a placement and a\r\n * placement does not care which. A composition already carries both halves —\r\n * its `canvas2d` root takes audio children as readily as visual ones — so an\r\n * {@link AudioDocument} is not \"the audio track kind\", it is the clip you reach\r\n * for when there is no picture to go with the sound.\r\n */\r\nexport type ClipDocument = VisualDocument | AudioDocument;\r\n\r\n/** Narrows a {@link VisualDocument} to a still. */\r\nexport function isStillDocument(doc: VisualDocument): doc is StillDocument {\r\n return doc.kind === \"still\";\r\n}\r\n\r\n/** Narrows a {@link VisualDocument} to a composition. */\r\nexport function isCompositionDocument(doc: VisualDocument): doc is CompositionDocument {\r\n return doc.kind === \"composition\";\r\n}\r\n\r\n/** Narrows a {@link ClipDocument} to an audio document. */\r\nexport function isAudioDocument(doc: ClipDocument): doc is AudioDocument {\r\n return doc.kind === \"audio\";\r\n}\r\n\r\n/** Narrows a {@link ClipDocument} to one that has a clock — anything but a still. */\r\nexport function hasTimeline(doc: ClipDocument): doc is CompositionDocument | AudioDocument {\r\n return doc.kind !== \"still\";\r\n}\r\n\r\n/**\r\n * The id the scene root answers to — the empty string, a real id rather than a\r\n * missing one. A host storing its root under some other id maps it here at the\r\n * one boundary its rows become a document.\r\n */\r\nexport const ROOT_NODE_ID = \"\";\r\n\r\n/** When a node is in the tree. `end` is `Infinity` for a node that never leaves. */\r\nexport interface NodeSpan {\r\n start: number;\r\n end: number;\r\n}\r\n\r\n/** A node's own span, as declared. A still's node — no span fields — is present always. */\r\nexport function nodeSpan(spec: NodeSpec | TimedNodeSpec): NodeSpan {\r\n const timed = spec as TimedNodeSpec;\r\n return { start: timed.startAt ?? 0, end: timed.endAt ?? Infinity };\r\n}\r\n\r\n/**\r\n * When a node is actually drawn: its own span intersected with every ancestor's.\r\n *\r\n * A child hangs off its parent, so it cannot outlive it — this is what the\r\n * runtime already does, and what an editor drawing a clipped bar or a validator\r\n * asking \"is the target there\" should read. Empty (`start >= end`) when the\r\n * spans never overlap; `undefined` for an id no row declares.\r\n */\r\nexport function effectiveSpan(nodes: readonly (NodeSpec | TimedNodeSpec)[], id: string): NodeSpan | undefined {\r\n return effectiveSpanIn(new Map(nodes.map((n) => [n.id, n])), id);\r\n}\r\n\r\n/**\r\n * {@link effectiveSpan} for every row at once, each ancestor chain walked once\r\n * however many descendants share it.\r\n */\r\nexport function effectiveSpans(nodes: readonly (NodeSpec | TimedNodeSpec)[]): Map<string, NodeSpan> {\r\n const byId = new Map(nodes.map((n) => [n.id, n]));\r\n const spans = new Map<string, NodeSpan>();\r\n const chain: (NodeSpec | TimedNodeSpec)[] = [];\r\n const inChain = new Set<string>();\r\n for (const start of byId.values()) {\r\n if (spans.has(start.id)) continue;\r\n chain.length = 0;\r\n inChain.clear();\r\n let above: NodeSpan | undefined;\r\n let spec: NodeSpec | TimedNodeSpec | undefined = start;\r\n while (spec) {\r\n const known = spans.get(spec.id);\r\n if (known) {\r\n above = known;\r\n break;\r\n }\r\n if (inChain.has(spec.id)) {\r\n // A parent cycle has no top to fold down from; an invalid document\r\n // gets the single-id answer for each member instead.\r\n for (const member of chain) spans.set(member.id, effectiveSpanIn(byId, member.id)!);\r\n chain.length = 0;\r\n break;\r\n }\r\n chain.push(spec);\r\n inChain.add(spec.id);\r\n spec = spec.parentId === null ? undefined : byId.get(spec.parentId);\r\n }\r\n for (let i = chain.length - 1; i >= 0; i--) {\r\n const span = nodeSpan(chain[i]);\r\n if (above) {\r\n span.start = Math.max(span.start, above.start);\r\n span.end = Math.min(span.end, above.end);\r\n }\r\n spans.set(chain[i].id, span);\r\n above = span;\r\n }\r\n }\r\n return spans;\r\n}\r\n\r\n/** @internal {@link effectiveSpan} over an id map a caller already holds. */\r\nexport function effectiveSpanIn(\r\n byId: ReadonlyMap<string, NodeSpec | TimedNodeSpec>,\r\n id: string,\r\n): NodeSpan | undefined {\r\n let spec = byId.get(id);\r\n if (!spec) return undefined;\r\n const span = nodeSpan(spec);\r\n const seen = new Set<string>();\r\n while (spec.parentId !== null && !seen.has(spec.id)) {\r\n seen.add(spec.id);\r\n const parent = byId.get(spec.parentId);\r\n if (!parent) break;\r\n const own = nodeSpan(parent);\r\n span.start = Math.max(span.start, own.start);\r\n span.end = Math.min(span.end, own.end);\r\n spec = parent;\r\n }\r\n return span;\r\n}\r\n\r\n/** A node with its span dropped — what a timed node becomes when it lands in a still. */\r\nexport function untimed(spec: NodeSpec | TimedNodeSpec): NodeSpec {\r\n const { startAt: _startAt, endAt: _endAt, ...rest } = spec as TimedNodeSpec;\r\n return rest;\r\n}\r\n\r\n/**\r\n * Seconds a command occupies: one pass, or every pass of a counted loop.\r\n *\r\n * An unlimited loop counts as **one** pass. It has no length of its own — it\r\n * runs for as long as there is clip — so letting it answer here would be a\r\n * command asking for a scene as long as it wants, which is a scene that can\r\n * never end.\r\n */\r\nexport function commandSpan(command: CommandSpec): number {\r\n const duration = command.duration ?? 0;\r\n if (duration <= 0 || !command.loop || command.loop.count === null) return duration;\r\n return duration * loopPasses(command.loop);\r\n}\r\n\r\n/**\r\n * How long a clip runs: its declared `duration`, else the last moment anything in\r\n * it happens — a command's end, or a node's arrival or finite departure. A still\r\n * has none.\r\n */\r\nexport function documentDuration(doc: ClipDocument): number {\r\n if (!hasTimeline(doc)) return 0;\r\n if (doc.duration !== undefined) return doc.duration;\r\n let end = 0;\r\n for (const command of doc.commands) {\r\n end = Math.max(end, command.at + commandSpan(command));\r\n }\r\n for (const node of doc.nodes) {\r\n if (node.startAt !== undefined) end = Math.max(end, node.startAt);\r\n if (node.endAt !== undefined && Number.isFinite(node.endAt)) end = Math.max(end, node.endAt);\r\n }\r\n return end;\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { ClipDocument } from "./types.js";
2
2
  /**
3
- * Schema validation for a {@link SceneDocument}.
3
+ * Schema validation for a {@link VisualDocument}.
4
4
  *
5
5
  * Hand-rolled rather than pulled from a schema library because
6
6
  * `@motionscript/core` has **no runtime dependencies**, and a renderer that
@@ -26,7 +26,7 @@ export interface ValidationResult {
26
26
  issues: ValidationIssue[];
27
27
  }
28
28
  /**
29
- * Validate a scene document.
29
+ * Validate a clip document.
30
30
  *
31
31
  * Returns every issue rather than throwing on the first: a host showing a
32
32
  * document's problems wants the list, and a fix-one-rerun loop over a large
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/document/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAER,YAAY,EASf,MAAM,SAAS,CAAC;AAGjB;;;;;;;;;;;;;GAaG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC5B,wEAAwE;IACxE,IAAI,EAAE,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G,YAAY,CAO9D"}
@@ -255,7 +255,7 @@ function checkVariables(sites, issues) {
255
255
  * has no dot and so names a variable instead.
256
256
  *
257
257
  * The dot is the whole discriminator, in the parser (which hands the bracket's
258
- * contents over as one opaque name), here, and in `SceneTimeline`.
258
+ * contents over as one opaque name), here, and in `ClipTimeline`.
259
259
  */
260
260
  function splitNodeRef(ref) {
261
261
  const dot = ref.indexOf(".");
@@ -386,27 +386,30 @@ function checkExpressionCycles(bound, issues) {
386
386
  * recurse until the stack overflows, and the trace points at the layout engine
387
387
  * rather than at the two rows that point at each other.
388
388
  */
389
- function checkTree(nodes, base, issues) {
390
- const byId = new Map();
391
- nodes.forEach((n, i) => {
392
- if (byId.has(n.id)) {
393
- issues.push({ path: `${base}[${i}].id`, message: `duplicate node id "${n.id}".` });
394
- return;
389
+ function checkTree(sites, issues) {
390
+ // `sites` holds only the rows that passed their shape check, so a position in
391
+ // it is not a position in the document: every issue path comes from the
392
+ // site, which remembers where its row was authored.
393
+ const bySite = new Map();
394
+ for (const site of sites) {
395
+ if (bySite.has(site.spec.id)) {
396
+ issues.push({ path: `${site.path}.id`, message: `duplicate node id "${site.spec.id}".` });
397
+ continue;
395
398
  }
396
- byId.set(n.id, i);
397
- });
398
- for (let i = 0; i < nodes.length; i++) {
399
- const parent = nodes[i].parentId;
400
- if (parent !== null && !byId.has(parent)) {
399
+ bySite.set(site.spec.id, site);
400
+ }
401
+ for (const site of sites) {
402
+ const parent = site.spec.parentId;
403
+ if (parent !== null && !bySite.has(parent)) {
401
404
  issues.push({
402
- path: `${base}[${i}].parentId`,
405
+ path: `${site.path}.parentId`,
403
406
  message: `parentId "${parent}" is not a node in this document.`,
404
407
  });
405
408
  }
406
409
  }
407
410
  // Walk each node to the root; a revisit within one walk is a cycle.
408
411
  const settled = new Set();
409
- for (const node of nodes) {
412
+ for (const { spec: node } of sites) {
410
413
  if (settled.has(node.id))
411
414
  continue;
412
415
  const seen = new Set();
@@ -414,7 +417,7 @@ function checkTree(nodes, base, issues) {
414
417
  while (cursor) {
415
418
  if (seen.has(cursor.id)) {
416
419
  issues.push({
417
- path: `${base}[${byId.get(cursor.id)}].parentId`,
420
+ path: `${bySite.get(cursor.id)?.path}.parentId`,
418
421
  message: `node "${cursor.id}" is its own ancestor — parent chain forms a cycle.`,
419
422
  });
420
423
  break;
@@ -423,7 +426,7 @@ function checkTree(nodes, base, issues) {
423
426
  if (settled.has(cursor.id))
424
427
  break;
425
428
  const parentId = cursor.parentId;
426
- cursor = parentId === null ? undefined : nodes[byId.get(parentId) ?? -1];
429
+ cursor = parentId === null ? undefined : bySite.get(parentId)?.spec;
427
430
  }
428
431
  for (const id of seen)
429
432
  settled.add(id);
@@ -486,7 +489,7 @@ function checkNodes(nodes, rootType, issues) {
486
489
  checkRootShape(n, path, rootType, issues);
487
490
  }
488
491
  });
489
- checkTree(sites.map((s) => s.spec), "nodes", issues);
492
+ checkTree(sites, issues);
490
493
  return sites;
491
494
  }
492
495
  /** A timed node's span: two times in order, and none at all on the root. */
@@ -578,6 +581,8 @@ function validateTimedDocument(doc, rootType, issues) {
578
581
  const nodes = nodeSites.map((s) => s.spec);
579
582
  checkIdSpace(nodes, variables, issues);
580
583
  const keyed = checkNodeKeys(nodeSites, issues);
584
+ // The commands that passed their shape check, each with the row it was
585
+ // authored in: a position in this list is not a position in `commands`.
581
586
  const valid = [];
582
587
  const ids = new Set();
583
588
  doc.commands.forEach((c, i) => {
@@ -593,7 +598,7 @@ function validateTimedDocument(doc, rootType, issues) {
593
598
  return;
594
599
  }
595
600
  ids.add(c.id);
596
- valid.push(c);
601
+ valid.push({ spec: c, path: `commands[${i}]` });
597
602
  });
598
603
  // A command cannot act on a node that is not there yet. This is the one
599
604
  // ordering rule the document has, and it is the one a timeline editor
@@ -604,25 +609,25 @@ function validateTimedDocument(doc, rootType, issues) {
604
609
  // its declared value from t=0, so there is no "before it exists" to run
605
610
  // ahead of. See `VariableSpec`.
606
611
  const byId = new Map(nodes.map((n) => [n.id, n]));
607
- valid.forEach((c, i) => {
612
+ for (const { spec: c, path } of valid) {
608
613
  if (c.targetId === null)
609
- return;
614
+ continue;
610
615
  if (variables.has(c.targetId))
611
- return;
616
+ continue;
612
617
  const span = effectiveSpanIn(byId, c.targetId);
613
618
  if (span === undefined) {
614
619
  issues.push({
615
- path: `commands[${i}].targetId`,
620
+ path: `${path}.targetId`,
616
621
  message: `targetId "${c.targetId}" is not a node or variable in this document.`,
617
622
  });
618
623
  }
619
624
  else if (c.at < span.start) {
620
625
  issues.push({
621
- path: `commands[${i}].at`,
626
+ path: `${path}.at`,
622
627
  message: `command runs at ${c.at}s but its target "${c.targetId}" is not present until ${span.start}s.`,
623
628
  });
624
629
  }
625
- });
630
+ }
626
631
  // Expressions, wherever a prop can be authored: a node's props (the scene
627
632
  // root included), a `to`/`set` props bag, or a named command's arguments.
628
633
  const declared = new Set(variables.keys());
@@ -630,7 +635,8 @@ function validateTimedDocument(doc, rootType, issues) {
630
635
  for (const site of nodeSites) {
631
636
  checkExpressions(site.spec.props, `${site.path}.props`, declared, keys, issues);
632
637
  }
633
- valid.forEach((c, i) => checkExpressions(c.args, `commands[${i}].args`, declared, keys, issues));
638
+ for (const { spec: c, path } of valid)
639
+ checkExpressions(c.args, `${path}.args`, declared, keys, issues);
634
640
  // Cycles, over the two places a document installs a binding: a node's own
635
641
  // props, and a `set` — the one command whose args reach `node.set()`.
636
642
  const bound = [];
@@ -638,17 +644,17 @@ function validateTimedDocument(doc, rootType, issues) {
638
644
  if (site.spec.key)
639
645
  boundProps(site.spec.key, site.spec.props, `${site.path}.props`, bound);
640
646
  }
641
- valid.forEach((c, i) => {
647
+ for (const { spec: c, path } of valid) {
642
648
  if (c.type !== "set" || c.targetId === null)
643
- return;
649
+ continue;
644
650
  const key = byId.get(c.targetId)?.key;
645
651
  if (key)
646
- boundProps(key, c.args, `commands[${i}].args`, bound);
647
- });
652
+ boundProps(key, c.args, `${path}.args`, bound);
653
+ }
648
654
  checkExpressionCycles(bound, issues);
649
655
  }
650
656
  /**
651
- * Validate a scene document.
657
+ * Validate a clip document.
652
658
  *
653
659
  * Returns every issue rather than throwing on the first: a host showing a
654
660
  * document's problems wants the list, and a fix-one-rerun loop over a large
@@ -784,7 +790,7 @@ export function assertValidDocument(doc) {
784
790
  const { valid, issues } = validateDocument(doc);
785
791
  if (!valid) {
786
792
  const detail = issues.map((i) => ` ${i.path || "<root>"}: ${i.message}`).join("\n");
787
- throw new Error(`Invalid scene document:\n${detail}`);
793
+ throw new Error(`Invalid clip document:\n${detail}`);
788
794
  }
789
795
  return doc;
790
796
  }