@motionscript/core 0.1.0-alpha.0 → 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 (767) hide show
  1. package/CHANGELOG.md +282 -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 +93 -11
  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 +32 -4
  43. package/dist/attributes/audio/request.d.ts.map +1 -1
  44. package/dist/attributes/audio/request.js +9 -1
  45. package/dist/attributes/audio/request.js.map +1 -1
  46. package/dist/attributes/audio/schedule.d.ts +11 -2
  47. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  48. package/dist/attributes/audio/schedule.js +15 -8
  49. package/dist/attributes/audio/schedule.js.map +1 -1
  50. package/dist/attributes/audio/sound.d.ts +4 -2
  51. package/dist/attributes/audio/sound.d.ts.map +1 -1
  52. package/dist/attributes/audio/sound.js +8 -4
  53. package/dist/attributes/audio/sound.js.map +1 -1
  54. package/dist/attributes/index.d.ts +1 -0
  55. package/dist/attributes/index.d.ts.map +1 -1
  56. package/dist/attributes/index.js +1 -0
  57. package/dist/attributes/index.js.map +1 -1
  58. package/dist/attributes/layout/alignment.js +1 -1
  59. package/dist/attributes/layout/alignment.js.map +1 -1
  60. package/dist/attributes/layout/index.js.map +1 -1
  61. package/dist/attributes/layout/insets.js.map +1 -1
  62. package/dist/attributes/layout/matrix2d.js.map +1 -1
  63. package/dist/attributes/layout/size.js.map +1 -1
  64. package/dist/attributes/layout/transform3d.js.map +1 -1
  65. package/dist/attributes/layout/vector2.js.map +1 -1
  66. package/dist/attributes/layout/world-transform.js.map +1 -1
  67. package/dist/attributes/mask/boolean.js.map +1 -1
  68. package/dist/attributes/mask/mask.js.map +1 -1
  69. package/dist/attributes/properties/decorator.d.ts +17 -6
  70. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  71. package/dist/attributes/properties/decorator.js +26 -14
  72. package/dist/attributes/properties/decorator.js.map +1 -1
  73. package/dist/attributes/properties/inputs.js.map +1 -1
  74. package/dist/attributes/properties/typed.d.ts +9 -2
  75. package/dist/attributes/properties/typed.d.ts.map +1 -1
  76. package/dist/attributes/properties/typed.js +15 -1
  77. package/dist/attributes/properties/typed.js.map +1 -1
  78. package/dist/attributes/render3d/orbit.d.ts +8 -8
  79. package/dist/attributes/render3d/orbit.js +7 -7
  80. package/dist/attributes/render3d/orbit.js.map +1 -1
  81. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  82. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  83. package/dist/attributes/shape/corners/corners.js.map +1 -1
  84. package/dist/attributes/shape/corners/index.js.map +1 -1
  85. package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
  86. package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
  87. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  88. package/dist/attributes/shape/effects/chain.d.ts +28 -120
  89. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  90. package/dist/attributes/shape/effects/chain.js +16 -88
  91. package/dist/attributes/shape/effects/chain.js.map +1 -1
  92. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  96. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  97. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  98. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  99. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  100. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
  101. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  102. package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
  103. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  104. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  105. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  106. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  108. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
  110. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  112. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  114. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  116. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  118. package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
  119. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  120. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  122. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  124. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  126. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  128. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  130. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  132. package/dist/attributes/shape/effects/implementations/shader.js +15 -8
  133. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  134. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  136. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  137. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  138. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  139. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  140. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  141. package/dist/attributes/shape/effects/index.d.ts +2 -6
  142. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  143. package/dist/attributes/shape/effects/index.js.map +1 -1
  144. package/dist/attributes/shape/effects/registry.d.ts +23 -6
  145. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  146. package/dist/attributes/shape/effects/registry.js +44 -10
  147. package/dist/attributes/shape/effects/registry.js.map +1 -1
  148. package/dist/attributes/shape/effects/union.d.ts +2 -6
  149. package/dist/attributes/shape/effects/union.d.ts.map +1 -1
  150. package/dist/attributes/shape/effects/union.js.map +1 -1
  151. package/dist/attributes/shape/fill/blend.js.map +1 -1
  152. package/dist/attributes/shape/fill/chain.js.map +1 -1
  153. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  154. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  155. package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
  156. package/dist/attributes/shape/fill/color/parser.js +81 -44
  157. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  158. package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
  159. package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
  160. package/dist/attributes/shape/fill/gradient-stops.js +65 -0
  161. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
  162. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  163. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  164. package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
  165. package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
  166. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  167. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  168. package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
  169. package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
  170. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  171. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  172. package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
  173. package/dist/attributes/shape/fill/implementations/image.js +5 -4
  174. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  175. package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
  176. package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
  177. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  178. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  179. package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
  180. package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
  181. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  182. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  183. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  184. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  185. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  186. package/dist/attributes/shape/fill/index.js.map +1 -1
  187. package/dist/attributes/shape/fill/lerp.d.ts +9 -1
  188. package/dist/attributes/shape/fill/lerp.d.ts.map +1 -1
  189. package/dist/attributes/shape/fill/lerp.js +12 -1
  190. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  191. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  192. package/dist/attributes/shape/fill/registry.js.map +1 -1
  193. package/dist/attributes/shape/fill/union.js.map +1 -1
  194. package/dist/attributes/shape/filters/chain.d.ts +4 -10
  195. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  196. package/dist/attributes/shape/filters/chain.js +1 -13
  197. package/dist/attributes/shape/filters/chain.js.map +1 -1
  198. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  199. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  200. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  201. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  202. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  203. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  204. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  205. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  206. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  207. package/dist/attributes/shape/filters/index.d.ts +1 -1
  208. package/dist/attributes/shape/filters/index.js.map +1 -1
  209. package/dist/attributes/shape/filters/registry.d.ts +2 -2
  210. package/dist/attributes/shape/filters/registry.js +3 -3
  211. package/dist/attributes/shape/filters/registry.js.map +1 -1
  212. package/dist/attributes/shape/filters/union.d.ts +6 -7
  213. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  214. package/dist/attributes/shape/filters/union.js.map +1 -1
  215. package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
  216. package/dist/attributes/shape/path/anchors.js +12 -5
  217. package/dist/attributes/shape/path/anchors.js.map +1 -1
  218. package/dist/attributes/shape/path/bezier.js.map +1 -1
  219. package/dist/attributes/shape/path/index.js.map +1 -1
  220. package/dist/attributes/shape/path/measure.js.map +1 -1
  221. package/dist/attributes/shape/path/morph.d.ts.map +1 -1
  222. package/dist/attributes/shape/path/morph.js +16 -4
  223. package/dist/attributes/shape/path/morph.js.map +1 -1
  224. package/dist/attributes/shape/path/ops.js.map +1 -1
  225. package/dist/attributes/shape/path/types.js.map +1 -1
  226. package/dist/attributes/shape/path/walk.js.map +1 -1
  227. package/dist/attributes/shape/shaders/index.js.map +1 -1
  228. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  229. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  230. package/dist/attributes/shape/shadow/index.js.map +1 -1
  231. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  232. package/dist/attributes/shape/stroke/index.d.ts +2 -2
  233. package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
  234. package/dist/attributes/shape/stroke/index.js +1 -1
  235. package/dist/attributes/shape/stroke/index.js.map +1 -1
  236. package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
  237. package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
  238. package/dist/attributes/shape/stroke/stroke.js +22 -2
  239. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  240. package/dist/attributes/shared/operators.js.map +1 -1
  241. package/dist/attributes/text/index.js.map +1 -1
  242. package/dist/attributes/text/ops.d.ts +6 -0
  243. package/dist/attributes/text/ops.d.ts.map +1 -1
  244. package/dist/attributes/text/ops.js +1 -0
  245. package/dist/attributes/text/ops.js.map +1 -1
  246. package/dist/attributes/text/types.js.map +1 -1
  247. package/dist/browser/chunks/chunk-FUZVFT3W.js +18 -0
  248. package/dist/browser/chunks/chunk-FUZVFT3W.js.map +7 -0
  249. package/dist/browser/chunks/chunk-QG6C23IJ.js +3 -0
  250. package/dist/browser/chunks/chunk-QG6C23IJ.js.map +7 -0
  251. package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
  252. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
  253. package/dist/browser/component.js +1 -1
  254. package/dist/browser/component.js.map +3 -3
  255. package/dist/browser/index.js +1 -1
  256. package/dist/browser/index.js.map +4 -4
  257. package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
  258. package/dist/browser/jsx-jsx-runtime.js +1 -1
  259. package/dist/browser/manifest.json +3 -2
  260. package/dist/browser/sdk.js +1 -1
  261. package/dist/component.js.map +1 -1
  262. package/dist/document/audio.d.ts +1 -1
  263. package/dist/document/audio.js +4 -4
  264. package/dist/document/audio.js.map +1 -1
  265. package/dist/document/builtins.d.ts.map +1 -1
  266. package/dist/document/builtins.js +8 -14
  267. package/dist/document/builtins.js.map +1 -1
  268. package/dist/document/command-traits.d.ts +1 -1
  269. package/dist/document/command-traits.d.ts.map +1 -1
  270. package/dist/document/command-traits.js +17 -3
  271. package/dist/document/command-traits.js.map +1 -1
  272. package/dist/document/deny-globals.js.map +1 -1
  273. package/dist/document/diff.js.map +1 -1
  274. package/dist/document/doc-index.d.ts +2 -2
  275. package/dist/document/doc-index.d.ts.map +1 -1
  276. package/dist/document/doc-index.js.map +1 -1
  277. package/dist/document/expression/compile.d.ts.map +1 -1
  278. package/dist/document/expression/compile.js +8 -5
  279. package/dist/document/expression/compile.js.map +1 -1
  280. package/dist/document/expression/index.js.map +1 -1
  281. package/dist/document/expression/ops.js +1 -1
  282. package/dist/document/expression/ops.js.map +1 -1
  283. package/dist/document/expression/parse.d.ts.map +1 -1
  284. package/dist/document/expression/parse.js +15 -6
  285. package/dist/document/expression/parse.js.map +1 -1
  286. package/dist/document/expression/refs.d.ts +1 -1
  287. package/dist/document/expression/refs.js +1 -1
  288. package/dist/document/expression/refs.js.map +1 -1
  289. package/dist/document/expression/types.js.map +1 -1
  290. package/dist/document/expression/walk.d.ts.map +1 -1
  291. package/dist/document/expression/walk.js +2 -1
  292. package/dist/document/expression/walk.js.map +1 -1
  293. package/dist/document/index.d.ts +2 -0
  294. package/dist/document/index.d.ts.map +1 -1
  295. package/dist/document/index.js +2 -0
  296. package/dist/document/index.js.map +1 -1
  297. package/dist/document/node-decorator.js.map +1 -1
  298. package/dist/document/node-descriptor.d.ts +19 -0
  299. package/dist/document/node-descriptor.d.ts.map +1 -1
  300. package/dist/document/node-descriptor.js.map +1 -1
  301. package/dist/document/placement.d.ts +70 -0
  302. package/dist/document/placement.d.ts.map +1 -0
  303. package/dist/document/placement.js +83 -0
  304. package/dist/document/placement.js.map +1 -0
  305. package/dist/document/project.d.ts +2 -2
  306. package/dist/document/project.d.ts.map +1 -1
  307. package/dist/document/project.js.map +1 -1
  308. package/dist/document/registry.d.ts +34 -16
  309. package/dist/document/registry.d.ts.map +1 -1
  310. package/dist/document/registry.js +51 -12
  311. package/dist/document/registry.js.map +1 -1
  312. package/dist/document/timeline-patch.js.map +1 -1
  313. package/dist/document/timeline.d.ts +73 -18
  314. package/dist/document/timeline.d.ts.map +1 -1
  315. package/dist/document/timeline.js +192 -40
  316. package/dist/document/timeline.js.map +1 -1
  317. package/dist/document/types.d.ts +12 -12
  318. package/dist/document/types.d.ts.map +1 -1
  319. package/dist/document/types.js +2 -2
  320. package/dist/document/types.js.map +1 -1
  321. package/dist/document/validate.d.ts +2 -2
  322. package/dist/document/validate.d.ts.map +1 -1
  323. package/dist/document/validate.js +37 -31
  324. package/dist/document/validate.js.map +1 -1
  325. package/dist/document/withdraw.d.ts +28 -0
  326. package/dist/document/withdraw.d.ts.map +1 -0
  327. package/dist/document/withdraw.js +61 -0
  328. package/dist/document/withdraw.js.map +1 -0
  329. package/dist/index.d.ts +1 -0
  330. package/dist/index.d.ts.map +1 -1
  331. package/dist/index.js +1 -0
  332. package/dist/index.js.map +1 -1
  333. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  334. package/dist/jsx/jsx-runtime.d.ts +9 -1
  335. package/dist/jsx/jsx-runtime.d.ts.map +1 -1
  336. package/dist/jsx/jsx-runtime.js +13 -3
  337. package/dist/jsx/jsx-runtime.js.map +1 -1
  338. package/dist/layout/bounds.d.ts +0 -1
  339. package/dist/layout/bounds.d.ts.map +1 -1
  340. package/dist/layout/bounds.js.map +1 -1
  341. package/dist/layout/constraints.js.map +1 -1
  342. package/dist/layout/flex.d.ts +4 -2
  343. package/dist/layout/flex.d.ts.map +1 -1
  344. package/dist/layout/flex.js +27 -11
  345. package/dist/layout/flex.js.map +1 -1
  346. package/dist/layout/freeform.js.map +1 -1
  347. package/dist/layout/grid.js.map +1 -1
  348. package/dist/layout/index.js.map +1 -1
  349. package/dist/layout/item.js.map +1 -1
  350. package/dist/layout/ops.d.ts +6 -0
  351. package/dist/layout/ops.d.ts.map +1 -1
  352. package/dist/layout/ops.js +6 -0
  353. package/dist/layout/ops.js.map +1 -1
  354. package/dist/layout/types.js.map +1 -1
  355. package/dist/nodes/2d/node-lifecycle.js.map +1 -1
  356. package/dist/nodes/2d/node-motion.js.map +1 -1
  357. package/dist/nodes/2d/node-render.d.ts +3 -3
  358. package/dist/nodes/2d/node-render.d.ts.map +1 -1
  359. package/dist/nodes/2d/node-render.js.map +1 -1
  360. package/dist/nodes/2d/node-transform.js.map +1 -1
  361. package/dist/nodes/2d/node2d.d.ts +115 -3
  362. package/dist/nodes/2d/node2d.d.ts.map +1 -1
  363. package/dist/nodes/2d/node2d.js +188 -32
  364. package/dist/nodes/2d/node2d.js.map +1 -1
  365. package/dist/nodes/2d/paint-node.d.ts +27 -0
  366. package/dist/nodes/2d/paint-node.d.ts.map +1 -1
  367. package/dist/nodes/2d/paint-node.js +42 -0
  368. package/dist/nodes/2d/paint-node.js.map +1 -1
  369. package/dist/nodes/audio/audio-bus.js.map +1 -1
  370. package/dist/nodes/audio/index.js.map +1 -1
  371. package/dist/nodes/audio/node-audio.d.ts +3 -2
  372. package/dist/nodes/audio/node-audio.d.ts.map +1 -1
  373. package/dist/nodes/audio/node-audio.js +8 -5
  374. package/dist/nodes/audio/node-audio.js.map +1 -1
  375. package/dist/nodes/audio/sound-node.d.ts +2 -2
  376. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  377. package/dist/nodes/audio/sound-node.js +2 -2
  378. package/dist/nodes/audio/sound-node.js.map +1 -1
  379. package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
  380. package/dist/nodes/geometry/bounds-shape-node.js +2 -2
  381. package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
  382. package/dist/nodes/geometry/box-path-node.d.ts +3 -3
  383. package/dist/nodes/geometry/box-path-node.js +2 -2
  384. package/dist/nodes/geometry/box-path-node.js.map +1 -1
  385. package/dist/nodes/geometry/ellipse-node.js.map +1 -1
  386. package/dist/nodes/geometry/group-bounds.d.ts +2 -2
  387. package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
  388. package/dist/nodes/geometry/group-bounds.js +1 -2
  389. package/dist/nodes/geometry/group-bounds.js.map +1 -1
  390. package/dist/nodes/geometry/path-node.d.ts.map +1 -1
  391. package/dist/nodes/geometry/path-node.js +6 -0
  392. package/dist/nodes/geometry/path-node.js.map +1 -1
  393. package/dist/nodes/geometry/polygon-node.js.map +1 -1
  394. package/dist/nodes/geometry/polygram-node.js.map +1 -1
  395. package/dist/nodes/geometry/rect-node.js.map +1 -1
  396. package/dist/nodes/geometry/shape-node.js.map +1 -1
  397. package/dist/nodes/geometry/shape-outline.d.ts +2 -2
  398. package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
  399. package/dist/nodes/geometry/shape-outline.js +2 -13
  400. package/dist/nodes/geometry/shape-outline.js.map +1 -1
  401. package/dist/nodes/index.d.ts +3 -8
  402. package/dist/nodes/index.d.ts.map +1 -1
  403. package/dist/nodes/index.js +3 -8
  404. package/dist/nodes/index.js.map +1 -1
  405. package/dist/nodes/layout/camera-node.d.ts +9 -0
  406. package/dist/nodes/layout/camera-node.d.ts.map +1 -1
  407. package/dist/nodes/layout/camera-node.js +38 -3
  408. package/dist/nodes/layout/camera-node.js.map +1 -1
  409. package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
  410. package/dist/nodes/layout/orbit-camera-node.js +1 -1
  411. package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
  412. package/dist/nodes/layout/rotated-box.js.map +1 -1
  413. package/dist/nodes/media/video-node.d.ts.map +1 -1
  414. package/dist/nodes/media/video-node.js +5 -3
  415. package/dist/nodes/media/video-node.js.map +1 -1
  416. package/dist/nodes/node/declare-paints.js.map +1 -1
  417. package/dist/nodes/node/node-editor-state.js.map +1 -1
  418. package/dist/nodes/node/node-reactive.js.map +1 -1
  419. package/dist/nodes/node/node-time.d.ts +3 -3
  420. package/dist/nodes/node/node-time.d.ts.map +1 -1
  421. package/dist/nodes/node/node-time.js +1 -1
  422. package/dist/nodes/node/node-time.js.map +1 -1
  423. package/dist/nodes/node/node-walk.js.map +1 -1
  424. package/dist/nodes/node/node.d.ts +5 -3
  425. package/dist/nodes/node/node.d.ts.map +1 -1
  426. package/dist/nodes/node/node.js +44 -19
  427. package/dist/nodes/node/node.js.map +1 -1
  428. package/dist/nodes/node/text-defaults.d.ts +10 -12
  429. package/dist/nodes/node/text-defaults.d.ts.map +1 -1
  430. package/dist/nodes/node/text-defaults.js +10 -12
  431. package/dist/nodes/node/text-defaults.js.map +1 -1
  432. package/dist/nodes/{scene → root}/canvas2d-node.d.ts +2 -2
  433. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
  434. package/dist/nodes/{scene → root}/canvas2d-node.js +2 -2
  435. package/dist/nodes/root/canvas2d-node.js.map +1 -0
  436. package/dist/nodes/root/provider-node.d.ts.map +1 -0
  437. package/dist/nodes/root/provider-node.js.map +1 -0
  438. package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
  439. package/dist/nodes/root/theme-provider-node.js.map +1 -0
  440. package/dist/nodes/text/default-text-style-node.d.ts +5 -2
  441. package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
  442. package/dist/nodes/text/default-text-style-node.js +10 -4
  443. package/dist/nodes/text/default-text-style-node.js.map +1 -1
  444. package/dist/nodes/text/number-format.d.ts +1 -1
  445. package/dist/nodes/text/number-format.js +1 -1
  446. package/dist/nodes/text/number-format.js.map +1 -1
  447. package/dist/nodes/text/number-node.js.map +1 -1
  448. package/dist/nodes/text/number-pattern.js.map +1 -1
  449. package/dist/nodes/text/richtext-node.js +1 -1
  450. package/dist/nodes/text/richtext-node.js.map +1 -1
  451. package/dist/nodes/text/text-base.d.ts.map +1 -1
  452. package/dist/nodes/text/text-base.js +1 -1
  453. package/dist/nodes/text/text-base.js.map +1 -1
  454. package/dist/nodes/text/text-node.js.map +1 -1
  455. package/dist/nodes/text/text-selection.js.map +1 -1
  456. package/dist/nodes/three/camera-nodes.d.ts +21 -3
  457. package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
  458. package/dist/nodes/three/camera-nodes.js +42 -1
  459. package/dist/nodes/three/camera-nodes.js.map +1 -1
  460. package/dist/nodes/three/canvas3d-node.d.ts +29 -6
  461. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  462. package/dist/nodes/three/canvas3d-node.js +44 -2
  463. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  464. package/dist/nodes/three/drawable-nodes.d.ts +25 -11
  465. package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
  466. package/dist/nodes/three/drawable-nodes.js +43 -13
  467. package/dist/nodes/three/drawable-nodes.js.map +1 -1
  468. package/dist/nodes/three/environment-nodes.d.ts +9 -3
  469. package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
  470. package/dist/nodes/three/environment-nodes.js.map +1 -1
  471. package/dist/nodes/three/geometry-nodes.d.ts +2 -2
  472. package/dist/nodes/three/geometry-nodes.js +2 -2
  473. package/dist/nodes/three/geometry-nodes.js.map +1 -1
  474. package/dist/nodes/three/grid-geometry3d.js.map +1 -1
  475. package/dist/nodes/three/group3d.js.map +1 -1
  476. package/dist/nodes/three/light-nodes.d.ts.map +1 -1
  477. package/dist/nodes/three/light-nodes.js +3 -3
  478. package/dist/nodes/three/light-nodes.js.map +1 -1
  479. package/dist/nodes/three/mesh3d.js.map +1 -1
  480. package/dist/nodes/three/node3d.d.ts +48 -0
  481. package/dist/nodes/three/node3d.d.ts.map +1 -1
  482. package/dist/nodes/three/node3d.js +53 -3
  483. package/dist/nodes/three/node3d.js.map +1 -1
  484. package/dist/platform/audio-sink.d.ts +2 -2
  485. package/dist/platform/audio-sink.d.ts.map +1 -1
  486. package/dist/platform/audio-sink.js.map +1 -1
  487. package/dist/platform/exporter.d.ts +13 -8
  488. package/dist/platform/exporter.d.ts.map +1 -1
  489. package/dist/platform/exporter.js.map +1 -1
  490. package/dist/platform/index.d.ts +1 -1
  491. package/dist/platform/index.d.ts.map +1 -1
  492. package/dist/platform/index.js.map +1 -1
  493. package/dist/platform/stepped-clock.js.map +1 -1
  494. package/dist/platform/storage-adapter.d.ts +12 -6
  495. package/dist/platform/storage-adapter.d.ts.map +1 -1
  496. package/dist/platform/storage-adapter.js +4 -0
  497. package/dist/platform/storage-adapter.js.map +1 -1
  498. package/dist/platform/ticker.d.ts +6 -0
  499. package/dist/platform/ticker.d.ts.map +1 -1
  500. package/dist/platform/ticker.js +6 -0
  501. package/dist/platform/ticker.js.map +1 -1
  502. package/dist/project/config.js.map +1 -1
  503. package/dist/project/index.js.map +1 -1
  504. package/dist/project/tree.d.ts +3 -3
  505. package/dist/project/tree.d.ts.map +1 -1
  506. package/dist/project/tree.js.map +1 -1
  507. package/dist/props/host.js.map +1 -1
  508. package/dist/props/index.js.map +1 -1
  509. package/dist/props/observer.js.map +1 -1
  510. package/dist/props/slot.js.map +1 -1
  511. package/dist/renamed-scene-names.d.ts +17 -0
  512. package/dist/renamed-scene-names.d.ts.map +1 -0
  513. package/dist/renamed-scene-names.js +9 -0
  514. package/dist/renamed-scene-names.js.map +1 -0
  515. package/dist/render/canvas-render-context2d.d.ts +10 -3
  516. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  517. package/dist/render/canvas-render-context2d.js +10 -0
  518. package/dist/render/canvas-render-context2d.js.map +1 -1
  519. package/dist/render/clip-contains.js.map +1 -1
  520. package/dist/render/clip.js.map +1 -1
  521. package/dist/render/descriptors/ellipse.js.map +1 -1
  522. package/dist/render/descriptors/latex.js.map +1 -1
  523. package/dist/render/descriptors/line.js.map +1 -1
  524. package/dist/render/descriptors/path-builder.js.map +1 -1
  525. package/dist/render/descriptors/path.js.map +1 -1
  526. package/dist/render/descriptors/polygon.js.map +1 -1
  527. package/dist/render/descriptors/polygram.js.map +1 -1
  528. package/dist/render/descriptors/rect.js.map +1 -1
  529. package/dist/render/descriptors/richtext.js.map +1 -1
  530. package/dist/render/descriptors/shape.d.ts +12 -0
  531. package/dist/render/descriptors/shape.d.ts.map +1 -1
  532. package/dist/render/descriptors/shape.js.map +1 -1
  533. package/dist/render/descriptors/text.d.ts +2 -2
  534. package/dist/render/descriptors/text.js +2 -2
  535. package/dist/render/descriptors/text.js.map +1 -1
  536. package/dist/render/descriptors/transform.d.ts +2 -2
  537. package/dist/render/descriptors/transform.d.ts.map +1 -1
  538. package/dist/render/descriptors/transform.js.map +1 -1
  539. package/dist/render/graphics2d.d.ts +3 -3
  540. package/dist/render/graphics2d.d.ts.map +1 -1
  541. package/dist/render/graphics2d.js +1 -1
  542. package/dist/render/graphics2d.js.map +1 -1
  543. package/dist/render/index.js.map +1 -1
  544. package/dist/render/measure-context.js.map +1 -1
  545. package/dist/render/null-render-context.js.map +1 -1
  546. package/dist/render/render-context2d.d.ts +5 -5
  547. package/dist/render/render-context2d.d.ts.map +1 -1
  548. package/dist/render/render-context2d.js.map +1 -1
  549. package/dist/render/surface.js.map +1 -1
  550. package/dist/render/text-defaults.js.map +1 -1
  551. package/dist/render/text-layout.js.map +1 -1
  552. package/dist/render3d/bounds3d.d.ts.map +1 -1
  553. package/dist/render3d/bounds3d.js +4 -2
  554. package/dist/render3d/bounds3d.js.map +1 -1
  555. package/dist/render3d/builders.js.map +1 -1
  556. package/dist/render3d/camera.d.ts +6 -0
  557. package/dist/render3d/camera.d.ts.map +1 -1
  558. package/dist/render3d/camera.js +5 -3
  559. package/dist/render3d/camera.js.map +1 -1
  560. package/dist/render3d/fill3d.d.ts +2 -9
  561. package/dist/render3d/fill3d.d.ts.map +1 -1
  562. package/dist/render3d/fill3d.js +2 -13
  563. package/dist/render3d/fill3d.js.map +1 -1
  564. package/dist/render3d/geometry.d.ts +8 -1
  565. package/dist/render3d/geometry.d.ts.map +1 -1
  566. package/dist/render3d/geometry.js.map +1 -1
  567. package/dist/render3d/graphics3d.d.ts +8 -4
  568. package/dist/render3d/graphics3d.d.ts.map +1 -1
  569. package/dist/render3d/graphics3d.js +18 -10
  570. package/dist/render3d/graphics3d.js.map +1 -1
  571. package/dist/render3d/index.d.ts +1 -1
  572. package/dist/render3d/index.js +1 -1
  573. package/dist/render3d/index.js.map +1 -1
  574. package/dist/render3d/inert.d.ts +14 -0
  575. package/dist/render3d/inert.d.ts.map +1 -0
  576. package/dist/render3d/inert.js +62 -0
  577. package/dist/render3d/inert.js.map +1 -0
  578. package/dist/render3d/light.js.map +1 -1
  579. package/dist/render3d/material.d.ts +10 -5
  580. package/dist/render3d/material.d.ts.map +1 -1
  581. package/dist/render3d/material.js.map +1 -1
  582. package/dist/render3d/matrix4.js.map +1 -1
  583. package/dist/render3d/render-context3d.js.map +1 -1
  584. package/dist/render3d/resources.d.ts +2 -2
  585. package/dist/render3d/resources.js +2 -2
  586. package/dist/render3d/resources.js.map +1 -1
  587. package/dist/render3d/rounded-box.js.map +1 -1
  588. package/dist/render3d/scene-settings.d.ts +23 -4
  589. package/dist/render3d/scene-settings.d.ts.map +1 -1
  590. package/dist/render3d/scene-settings.js.map +1 -1
  591. package/dist/render3d/scene3d.d.ts +11 -0
  592. package/dist/render3d/scene3d.d.ts.map +1 -1
  593. package/dist/render3d/scene3d.js +39 -6
  594. package/dist/render3d/scene3d.js.map +1 -1
  595. package/dist/render3d/segments.js.map +1 -1
  596. package/dist/render3d/texture.d.ts +9 -0
  597. package/dist/render3d/texture.d.ts.map +1 -1
  598. package/dist/render3d/texture.js +13 -0
  599. package/dist/render3d/texture.js.map +1 -1
  600. package/dist/render3d/tracking.js.map +1 -1
  601. package/dist/render3d/transform.d.ts +1 -1
  602. package/dist/render3d/transform.js.map +1 -1
  603. package/dist/render3d/vector3.d.ts +18 -1
  604. package/dist/render3d/vector3.d.ts.map +1 -1
  605. package/dist/render3d/vector3.js +27 -0
  606. package/dist/render3d/vector3.js.map +1 -1
  607. package/dist/render3d/walk.d.ts +1 -1
  608. package/dist/render3d/walk.d.ts.map +1 -1
  609. package/dist/render3d/walk.js +5 -1
  610. package/dist/render3d/walk.js.map +1 -1
  611. package/dist/runtime/asset-refine.js.map +1 -1
  612. package/dist/runtime/asset-timeline.js.map +1 -1
  613. package/dist/runtime/asset-update.js.map +1 -1
  614. package/dist/runtime/audio-index.d.ts +2 -2
  615. package/dist/runtime/audio-index.d.ts.map +1 -1
  616. package/dist/runtime/audio-index.js +8 -2
  617. package/dist/runtime/audio-index.js.map +1 -1
  618. package/dist/runtime/builtin-context.js.map +1 -1
  619. package/dist/runtime/clip-instance.d.ts +5 -3
  620. package/dist/runtime/clip-instance.d.ts.map +1 -1
  621. package/dist/runtime/clip-instance.js +10 -6
  622. package/dist/runtime/clip-instance.js.map +1 -1
  623. package/dist/runtime/clip-store.d.ts +9 -0
  624. package/dist/runtime/clip-store.d.ts.map +1 -1
  625. package/dist/runtime/clip-store.js +33 -3
  626. package/dist/runtime/clip-store.js.map +1 -1
  627. package/dist/runtime/engine.d.ts +5 -0
  628. package/dist/runtime/engine.d.ts.map +1 -1
  629. package/dist/runtime/engine.js +2 -0
  630. package/dist/runtime/engine.js.map +1 -1
  631. package/dist/runtime/frame-time.d.ts +31 -0
  632. package/dist/runtime/frame-time.d.ts.map +1 -0
  633. package/dist/runtime/frame-time.js +29 -0
  634. package/dist/runtime/frame-time.js.map +1 -0
  635. package/dist/runtime/index.d.ts +1 -0
  636. package/dist/runtime/index.d.ts.map +1 -1
  637. package/dist/runtime/index.js +1 -0
  638. package/dist/runtime/index.js.map +1 -1
  639. package/dist/runtime/node-picking.d.ts +44 -3
  640. package/dist/runtime/node-picking.d.ts.map +1 -1
  641. package/dist/runtime/node-picking.js +118 -3
  642. package/dist/runtime/node-picking.js.map +1 -1
  643. package/dist/runtime/node-picking3d.d.ts +2 -1
  644. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  645. package/dist/runtime/node-picking3d.js +5 -2
  646. package/dist/runtime/node-picking3d.js.map +1 -1
  647. package/dist/runtime/placement.d.ts.map +1 -1
  648. package/dist/runtime/placement.js +4 -5
  649. package/dist/runtime/placement.js.map +1 -1
  650. package/dist/runtime/playback-controller.d.ts +31 -2
  651. package/dist/runtime/playback-controller.d.ts.map +1 -1
  652. package/dist/runtime/playback-controller.js +63 -6
  653. package/dist/runtime/playback-controller.js.map +1 -1
  654. package/dist/runtime/playback.js.map +1 -1
  655. package/dist/runtime/precompisition.js.map +1 -1
  656. package/dist/runtime/project-assets.js.map +1 -1
  657. package/dist/runtime/session.d.ts +9 -7
  658. package/dist/runtime/session.d.ts.map +1 -1
  659. package/dist/runtime/session.js +12 -4
  660. package/dist/runtime/session.js.map +1 -1
  661. package/dist/runtime/settle.js.map +1 -1
  662. package/dist/runtime/state-evaluator.d.ts +1 -1
  663. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  664. package/dist/runtime/state-evaluator.js +4 -3
  665. package/dist/runtime/state-evaluator.js.map +1 -1
  666. package/dist/runtime/text-geometry.js.map +1 -1
  667. package/dist/sdk/index.d.ts +27 -22
  668. package/dist/sdk/index.d.ts.map +1 -1
  669. package/dist/sdk/index.js +23 -9
  670. package/dist/sdk/index.js.map +1 -1
  671. package/dist/tween/command-decorator.d.ts +12 -4
  672. package/dist/tween/command-decorator.d.ts.map +1 -1
  673. package/dist/tween/command-decorator.js +10 -22
  674. package/dist/tween/command-decorator.js.map +1 -1
  675. package/dist/tween/command.js.map +1 -1
  676. package/dist/tween/ease/constants.d.ts.map +1 -1
  677. package/dist/tween/ease/constants.js +8 -5
  678. package/dist/tween/ease/constants.js.map +1 -1
  679. package/dist/tween/ease/curve.d.ts.map +1 -1
  680. package/dist/tween/ease/curve.js +4 -3
  681. package/dist/tween/ease/curve.js.map +1 -1
  682. package/dist/tween/ease/describe.d.ts +15 -0
  683. package/dist/tween/ease/describe.d.ts.map +1 -0
  684. package/dist/tween/ease/describe.js +37 -0
  685. package/dist/tween/ease/describe.js.map +1 -0
  686. package/dist/tween/ease/type.js.map +1 -1
  687. package/dist/tween/index.js.map +1 -1
  688. package/dist/tween/inert.js.map +1 -1
  689. package/dist/tween/lerp.js.map +1 -1
  690. package/dist/tween/loop.js.map +1 -1
  691. package/dist/tween/prepare.d.ts +3 -3
  692. package/dist/tween/prepare.js +3 -3
  693. package/dist/tween/prepare.js.map +1 -1
  694. package/dist/tween/seekable.d.ts +12 -1
  695. package/dist/tween/seekable.d.ts.map +1 -1
  696. package/dist/tween/seekable.js +15 -0
  697. package/dist/tween/seekable.js.map +1 -1
  698. package/dist/tween/stepper.js.map +1 -1
  699. package/dist/tween/to-command.js.map +1 -1
  700. package/dist/util/clamp.js.map +1 -1
  701. package/dist/util/context.js.map +1 -1
  702. package/dist/util/csv.js.map +1 -1
  703. package/dist/util/generateList.js.map +1 -1
  704. package/dist/util/index.js.map +1 -1
  705. package/dist/util/metrics.d.ts +1 -1
  706. package/dist/util/metrics.js +1 -1
  707. package/dist/util/metrics.js.map +1 -1
  708. package/dist/util/random.js.map +1 -1
  709. package/dist/util/reference.js.map +1 -1
  710. package/dist/util/scheduler.js.map +1 -1
  711. package/package.json +2 -1
  712. package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
  713. package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
  714. package/dist/attributes/shape/effects/implementations/displace.js +0 -30
  715. package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
  716. package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
  717. package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
  718. package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
  719. package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
  720. package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
  721. package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
  722. package/dist/attributes/shape/effects/implementations/texture.js +0 -25
  723. package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
  724. package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
  725. package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
  726. package/dist/attributes/shape/effects/implementations/trails.js +0 -22
  727. package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
  728. package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
  729. package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
  730. package/dist/browser/chunks/chunk-P3XQCHDW.js +0 -16
  731. package/dist/browser/chunks/chunk-P3XQCHDW.js.map +0 -7
  732. package/dist/browser/chunks/chunk-VJQMKHGQ.js +0 -3
  733. package/dist/browser/chunks/chunk-VJQMKHGQ.js.map +0 -7
  734. package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
  735. package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
  736. package/dist/nodes/geometry/dot-grid-node.js +0 -142
  737. package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
  738. package/dist/nodes/geometry/grid-lines.d.ts +0 -101
  739. package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
  740. package/dist/nodes/geometry/grid-lines.js +0 -128
  741. package/dist/nodes/geometry/grid-lines.js.map +0 -1
  742. package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
  743. package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
  744. package/dist/nodes/geometry/grid-pattern-node.js +0 -172
  745. package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
  746. package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
  747. package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
  748. package/dist/nodes/geometry/line-grid-node.js +0 -127
  749. package/dist/nodes/geometry/line-grid-node.js.map +0 -1
  750. package/dist/nodes/geometry/line-node.d.ts +0 -58
  751. package/dist/nodes/geometry/line-node.d.ts.map +0 -1
  752. package/dist/nodes/geometry/line-node.js +0 -123
  753. package/dist/nodes/geometry/line-node.js.map +0 -1
  754. package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
  755. package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
  756. package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
  757. package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
  758. package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
  759. package/dist/nodes/scene/canvas2d-node.js.map +0 -1
  760. package/dist/nodes/scene/provider-node.d.ts.map +0 -1
  761. package/dist/nodes/scene/provider-node.js.map +0 -1
  762. package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
  763. package/dist/nodes/scene/theme-provider-node.js.map +0 -1
  764. /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
  765. /package/dist/nodes/{scene → root}/provider-node.js +0 -0
  766. /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
  767. /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tween/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAE7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AAEpC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC","sourcesContent":["export * from './ease/type';\nexport * from './ease/constants';\nexport * from './ease/curve';\n\nexport * from './to-command';\nexport * from './command';\nexport * from './loop';\nexport * from './command-decorator';\n\nexport * from './prepare';\nexport * from './stepper';\nexport * from './lerp';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tween/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAE7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AAEpC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC","sourcesContent":["export * from './ease/type';\r\nexport * from './ease/constants';\r\nexport * from './ease/curve';\r\n\r\nexport * from './to-command';\r\nexport * from './command';\r\nexport * from './loop';\r\nexport * from './command-decorator';\r\n\r\nexport * from './prepare';\r\nexport * from './stepper';\r\nexport * from './lerp';\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"inert.js","sourceRoot":"","sources":["../../src/tween/inert.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAI,MAAc,EAAE,QAAgB;IAC5D,KAAK,MAAM,CAAC;IACZ,OAAO;QACH,QAAQ;QACR,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAe;QAC5B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC;KACzC,CAAC;AACN,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAAC,QAAgB;IACzC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,OAAO;QACH,IAAI,EAAE,CAAC,CAAS,EAAE,EAAE,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;QACrC,OAAO,EAAE,CAAC,EAAU,EAAW,EAAE;YAC7B,OAAO,IAAI,EAAE,CAAC;YACd,OAAO,OAAO,IAAI,QAAQ,CAAC;QAC/B,CAAC;KACJ,CAAC;AACN,CAAC","sourcesContent":["import { TweenStepper } from \"./stepper\";\nimport type { Command } from \"./command\";\n\n/**\n * An animation that occupies its duration and writes nothing.\n *\n * What a command on an **unmounted** node becomes. A node that is not in the\n * tree has no box, no surface and no timeline, so a tween on it has nothing to\n * be a tween *of* — but it still has a duration, and the timeline slot it was\n * placed in is entitled to have that duration pass. Returning a real command of\n * the right length keeps the scene's timing intact where throwing would abort\n * the pass and where returning nothing would silently shorten it.\n *\n * The failure this turns into a no-op is a real one — animating a node the\n * author forgot to `add` — and it reads as \"nothing moved\", which is what the\n * author sees on screen anyway.\n */\nexport function inertCommand<P>(target: object, duration: number): Command<P> {\n void target;\n return {\n duration,\n at: () => ({}) as Partial<P>,\n _stepper: () => inertStepper(duration),\n };\n}\n\n/** The {@link TweenStepper} half of {@link inertCommand}: runs its clock, writes nothing. */\nexport function inertStepper(duration: number): TweenStepper {\n let elapsed = 0;\n return {\n seek: (e: number) => { elapsed = e; },\n advance: (dt: number): boolean => {\n elapsed += dt;\n return elapsed >= duration;\n },\n };\n}\n"]}
1
+ {"version":3,"file":"inert.js","sourceRoot":"","sources":["../../src/tween/inert.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAI,MAAc,EAAE,QAAgB;IAC5D,KAAK,MAAM,CAAC;IACZ,OAAO;QACH,QAAQ;QACR,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAe;QAC5B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC;KACzC,CAAC;AACN,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAAC,QAAgB;IACzC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,OAAO;QACH,IAAI,EAAE,CAAC,CAAS,EAAE,EAAE,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;QACrC,OAAO,EAAE,CAAC,EAAU,EAAW,EAAE;YAC7B,OAAO,IAAI,EAAE,CAAC;YACd,OAAO,OAAO,IAAI,QAAQ,CAAC;QAC/B,CAAC;KACJ,CAAC;AACN,CAAC","sourcesContent":["import { TweenStepper } from \"./stepper\";\r\nimport type { Command } from \"./command\";\r\n\r\n/**\r\n * An animation that occupies its duration and writes nothing.\r\n *\r\n * What a command on an **unmounted** node becomes. A node that is not in the\r\n * tree has no box, no surface and no timeline, so a tween on it has nothing to\r\n * be a tween *of* — but it still has a duration, and the timeline slot it was\r\n * placed in is entitled to have that duration pass. Returning a real command of\r\n * the right length keeps the scene's timing intact where throwing would abort\r\n * the pass and where returning nothing would silently shorten it.\r\n *\r\n * The failure this turns into a no-op is a real one — animating a node the\r\n * author forgot to `add` — and it reads as \"nothing moved\", which is what the\r\n * author sees on screen anyway.\r\n */\r\nexport function inertCommand<P>(target: object, duration: number): Command<P> {\r\n void target;\r\n return {\r\n duration,\r\n at: () => ({}) as Partial<P>,\r\n _stepper: () => inertStepper(duration),\r\n };\r\n}\r\n\r\n/** The {@link TweenStepper} half of {@link inertCommand}: runs its clock, writes nothing. */\r\nexport function inertStepper(duration: number): TweenStepper {\r\n let elapsed = 0;\r\n return {\r\n seek: (e: number) => { elapsed = e; },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n return elapsed >= duration;\r\n },\r\n };\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"lerp.js","sourceRoot":"","sources":["../../src/tween/lerp.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,EAAU,EAAE,CAAS;IAC1D,OAAO,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,EAAU,EAAE,CAAS;IAC/D,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5C,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { EasingFunction } from \"./ease/type\";\n\n/**\n * Linearly interpolates between two numbers.\n *\n * @param from - Start value at `t = 0`.\n * @param to - End value at `t = 1`.\n * @param t - Normalized progress in [0, 1]. Values outside this range\n * extrapolate beyond the endpoints.\n * @returns The interpolated value: `from + (to - from) * t`.\n */\nexport function lerpNumber(from: number, to: number, t: number): number {\n return from + (to - from) * t;\n}\n\n/**\n * Interpolates a CSS-style perspective distance (viewer-to-plane, in px, where\n * `0` means \"no perspective\" — a parallel projection).\n *\n * Perspective enters the projection matrix as its reciprocal — a point at depth\n * `z` lands at `x / (1 - z/perspective)` — so `1/perspective` (not the raw\n * distance) is the quantity that varies smoothly with the visual strength of\n * the effect. Lerping the raw px value linearly sweeps through the small\n * positive numbers next to `0` on the way between \"off\" and any finite\n * distance, and `1/perspective` diverges there: a `0 → 800` tween would flash\n * through a wildly exaggerated, near-degenerate projection right at the start\n * before settling down to the mild depth `800` actually asks for. Lerping the\n * reciprocal instead — with `0` standing in for a reciprocal of `0`, matching\n * the renderer's own convention (see `isProjective`/`invP` in `matrix2d.ts`) —\n * keeps that quantity monotonic and bounded between the two endpoints, so the\n * effect builds or settles smoothly instead of spiking.\n */\nexport function lerpPerspective(from: number, to: number, t: number): number {\n const invFrom = from !== 0 ? 1 / from : 0;\n const invTo = to !== 0 ? 1 / to : 0;\n const inv = invFrom + (invTo - invFrom) * t;\n return inv !== 0 ? 1 / inv : 0;\n}\n\nexport type LerpFunction<T> = (from: T, to: T, t: number) => T;\nexport type TweenOptions<T> = { ease?: EasingFunction, lerp?: LerpFunction<T> };"]}
1
+ {"version":3,"file":"lerp.js","sourceRoot":"","sources":["../../src/tween/lerp.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,EAAU,EAAE,CAAS;IAC1D,OAAO,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,EAAU,EAAE,CAAS;IAC/D,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5C,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { EasingFunction } from \"./ease/type\";\r\n\r\n/**\r\n * Linearly interpolates between two numbers.\r\n *\r\n * @param from - Start value at `t = 0`.\r\n * @param to - End value at `t = 1`.\r\n * @param t - Normalized progress in [0, 1]. Values outside this range\r\n * extrapolate beyond the endpoints.\r\n * @returns The interpolated value: `from + (to - from) * t`.\r\n */\r\nexport function lerpNumber(from: number, to: number, t: number): number {\r\n return from + (to - from) * t;\r\n}\r\n\r\n/**\r\n * Interpolates a CSS-style perspective distance (viewer-to-plane, in px, where\r\n * `0` means \"no perspective\" — a parallel projection).\r\n *\r\n * Perspective enters the projection matrix as its reciprocal — a point at depth\r\n * `z` lands at `x / (1 - z/perspective)` — so `1/perspective` (not the raw\r\n * distance) is the quantity that varies smoothly with the visual strength of\r\n * the effect. Lerping the raw px value linearly sweeps through the small\r\n * positive numbers next to `0` on the way between \"off\" and any finite\r\n * distance, and `1/perspective` diverges there: a `0 → 800` tween would flash\r\n * through a wildly exaggerated, near-degenerate projection right at the start\r\n * before settling down to the mild depth `800` actually asks for. Lerping the\r\n * reciprocal instead — with `0` standing in for a reciprocal of `0`, matching\r\n * the renderer's own convention (see `isProjective`/`invP` in `matrix2d.ts`) —\r\n * keeps that quantity monotonic and bounded between the two endpoints, so the\r\n * effect builds or settles smoothly instead of spiking.\r\n */\r\nexport function lerpPerspective(from: number, to: number, t: number): number {\r\n const invFrom = from !== 0 ? 1 / from : 0;\r\n const invTo = to !== 0 ? 1 / to : 0;\r\n const inv = invFrom + (invTo - invFrom) * t;\r\n return inv !== 0 ? 1 / inv : 0;\r\n}\r\n\r\nexport type LerpFunction<T> = (from: T, to: T, t: number) => T;\r\nexport type TweenOptions<T> = { ease?: EasingFunction, lerp?: LerpFunction<T> };"]}
@@ -1 +1 @@
1
- {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/tween/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA6BvC,qFAAqF;AACrF,MAAM,UAAU,UAAU,CAAC,IAAc;IACrC,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;AACpF,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,WAAW,CAAC,IAA0B;IAClD,OAAO,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAc,EAAE,QAAgB,EAAE,IAAI,GAAG,QAAQ;IACtE,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC;IACnC,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACzD,OAAO,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,OAAe,EAAE,QAAgB;IACvE,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjE,4EAA4E;IAC5E,sEAAsE;IACtE,kCAAkC;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;IAClC,QAAQ,IAAI,CAAC,SAAS,IAAI,QAAQ,EAAE,CAAC;QACjC,KAAK,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,KAAK,WAAW,CAAC,CAAC,OAAO,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrD,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;AACL,CAAC","sourcesContent":["/**\n * Repetition, as data: how many times a command runs and which way each pass\n * goes.\n *\n * A loop is a **placement** property, the same kind of thing as `at` and\n * `duration` — it says when the command is running, never what it does. That is\n * why it lives out here rather than in any one command's args: the wrapper goes\n * *around* a built `Command`, so `to`, `fillTo`, `countTo` and a custom\n * `@command()` nobody has written yet all loop by the same code, with nothing to\n * forward and nothing to forget.\n *\n * And it stays seekable. A looped command is still a pure function of its own\n * normalized time — `at(t)` maps `t` onto a pass and asks the inner command for\n * that pass's frame — so scrubbing into the fourth repetition costs the same as\n * scrubbing into the first, which is the whole reason commands are values here.\n */\n\nimport { clamp01 } from \"@/util/clamp\";\n\n/**\n * Which way a pass runs.\n *\n * `alternate` is the reason this is three values rather than a boolean: a\n * bounce — out and back — is one command with two passes, not two commands whose\n * `at`s have to be kept in step by hand.\n */\nexport type LoopDirection = \"normal\" | \"reverse\" | \"alternate\";\n\n/**\n * How a command repeats. Absent on a command is \"runs once\".\n */\nexport interface LoopSpec {\n /** Absent is `\"normal\"`. */\n direction?: LoopDirection;\n /**\n * How many times to repeat **after** the first pass: `0` is no repeat (the\n * same as no loop at all), `3` plays four passes, and `null` repeats for as\n * long as there is clip left to fill.\n *\n * Repeats rather than total passes so that the value reads as what the word\n * says — \"repeat twice\" is `2` — and so that the no-op is `0` rather than a\n * `1` that looks like it should do something.\n */\n count: number | null;\n}\n\n/** Total passes: repeats plus the first one, or `Infinity` for an unlimited loop. */\nexport function loopPasses(loop: LoopSpec): number {\n return loop.count === null ? Infinity : Math.max(0, Math.floor(loop.count)) + 1;\n}\n\n/** Whether a loop changes anything: an unlimited one always does, a counted one only past zero. */\nexport function loopRepeats(loop: LoopSpec | undefined): loop is LoopSpec {\n return loop !== undefined && (loop.count === null || loop.count >= 1);\n}\n\n/**\n * Seconds a looped command occupies.\n *\n * `fill` is what an unlimited loop is given to cover — the clip's remaining time,\n * where a timeline places one. An unlimited loop does not *define* a length the\n * way a counted one does: a background that turns forever should fill the scene\n * it is in, not stretch it, so `documentDuration` counts one pass of it and this\n * stretches it to whatever that came to.\n */\nexport function loopSpan(loop: LoopSpec, duration: number, fill = duration): number {\n if (duration <= 0) return duration;\n if (loop.count === null) return Math.max(duration, fill);\n return duration * loopPasses(loop);\n}\n\n/**\n * Where in one pass `elapsed` lands, as normalized time for the inner command.\n *\n * Past the last pass of a counted loop it holds at that pass's end rather than\n * wrapping to the start — the same rule a finished command follows everywhere\n * else, and what keeps the value a loop leaves behind the value the next command\n * tweens from.\n */\nexport function loopPhase(loop: LoopSpec, elapsed: number, duration: number): number {\n if (duration <= 0) return 1;\n const passes = loopPasses(loop);\n const capped = Math.min(Math.max(elapsed, 0) / duration, passes);\n // `passes - 1` holds the final pass at its end instead of rolling over to a\n // pass that does not exist. `Infinity - 1` is still `Infinity`, so an\n // unlimited loop is never capped.\n const index = Math.min(Math.floor(capped), passes - 1);\n const t = clamp01(capped - index);\n switch (loop.direction ?? \"normal\") {\n case \"reverse\": return 1 - t;\n case \"alternate\": return index % 2 === 0 ? t : 1 - t;\n default: return t;\n }\n}\n"]}
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/tween/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA6BvC,qFAAqF;AACrF,MAAM,UAAU,UAAU,CAAC,IAAc;IACrC,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;AACpF,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,WAAW,CAAC,IAA0B;IAClD,OAAO,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAc,EAAE,QAAgB,EAAE,IAAI,GAAG,QAAQ;IACtE,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC;IACnC,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACzD,OAAO,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,OAAe,EAAE,QAAgB;IACvE,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjE,4EAA4E;IAC5E,sEAAsE;IACtE,kCAAkC;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;IAClC,QAAQ,IAAI,CAAC,SAAS,IAAI,QAAQ,EAAE,CAAC;QACjC,KAAK,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,KAAK,WAAW,CAAC,CAAC,OAAO,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrD,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;AACL,CAAC","sourcesContent":["/**\r\n * Repetition, as data: how many times a command runs and which way each pass\r\n * goes.\r\n *\r\n * A loop is a **placement** property, the same kind of thing as `at` and\r\n * `duration` — it says when the command is running, never what it does. That is\r\n * why it lives out here rather than in any one command's args: the wrapper goes\r\n * *around* a built `Command`, so `to`, `fillTo`, `countTo` and a custom\r\n * `@command()` nobody has written yet all loop by the same code, with nothing to\r\n * forward and nothing to forget.\r\n *\r\n * And it stays seekable. A looped command is still a pure function of its own\r\n * normalized time — `at(t)` maps `t` onto a pass and asks the inner command for\r\n * that pass's frame — so scrubbing into the fourth repetition costs the same as\r\n * scrubbing into the first, which is the whole reason commands are values here.\r\n */\r\n\r\nimport { clamp01 } from \"@/util/clamp\";\r\n\r\n/**\r\n * Which way a pass runs.\r\n *\r\n * `alternate` is the reason this is three values rather than a boolean: a\r\n * bounce — out and back — is one command with two passes, not two commands whose\r\n * `at`s have to be kept in step by hand.\r\n */\r\nexport type LoopDirection = \"normal\" | \"reverse\" | \"alternate\";\r\n\r\n/**\r\n * How a command repeats. Absent on a command is \"runs once\".\r\n */\r\nexport interface LoopSpec {\r\n /** Absent is `\"normal\"`. */\r\n direction?: LoopDirection;\r\n /**\r\n * How many times to repeat **after** the first pass: `0` is no repeat (the\r\n * same as no loop at all), `3` plays four passes, and `null` repeats for as\r\n * long as there is clip left to fill.\r\n *\r\n * Repeats rather than total passes so that the value reads as what the word\r\n * says — \"repeat twice\" is `2` — and so that the no-op is `0` rather than a\r\n * `1` that looks like it should do something.\r\n */\r\n count: number | null;\r\n}\r\n\r\n/** Total passes: repeats plus the first one, or `Infinity` for an unlimited loop. */\r\nexport function loopPasses(loop: LoopSpec): number {\r\n return loop.count === null ? Infinity : Math.max(0, Math.floor(loop.count)) + 1;\r\n}\r\n\r\n/** Whether a loop changes anything: an unlimited one always does, a counted one only past zero. */\r\nexport function loopRepeats(loop: LoopSpec | undefined): loop is LoopSpec {\r\n return loop !== undefined && (loop.count === null || loop.count >= 1);\r\n}\r\n\r\n/**\r\n * Seconds a looped command occupies.\r\n *\r\n * `fill` is what an unlimited loop is given to cover — the clip's remaining time,\r\n * where a timeline places one. An unlimited loop does not *define* a length the\r\n * way a counted one does: a background that turns forever should fill the scene\r\n * it is in, not stretch it, so `documentDuration` counts one pass of it and this\r\n * stretches it to whatever that came to.\r\n */\r\nexport function loopSpan(loop: LoopSpec, duration: number, fill = duration): number {\r\n if (duration <= 0) return duration;\r\n if (loop.count === null) return Math.max(duration, fill);\r\n return duration * loopPasses(loop);\r\n}\r\n\r\n/**\r\n * Where in one pass `elapsed` lands, as normalized time for the inner command.\r\n *\r\n * Past the last pass of a counted loop it holds at that pass's end rather than\r\n * wrapping to the start — the same rule a finished command follows everywhere\r\n * else, and what keeps the value a loop leaves behind the value the next command\r\n * tweens from.\r\n */\r\nexport function loopPhase(loop: LoopSpec, elapsed: number, duration: number): number {\r\n if (duration <= 0) return 1;\r\n const passes = loopPasses(loop);\r\n const capped = Math.min(Math.max(elapsed, 0) / duration, passes);\r\n // `passes - 1` holds the final pass at its end instead of rolling over to a\r\n // pass that does not exist. `Infinity - 1` is still `Infinity`, so an\r\n // unlimited loop is never capped.\r\n const index = Math.min(Math.floor(capped), passes - 1);\r\n const t = clamp01(capped - index);\r\n switch (loop.direction ?? \"normal\") {\r\n case \"reverse\": return 1 - t;\r\n case \"alternate\": return index % 2 === 0 ? t : 1 - t;\r\n default: return t;\r\n }\r\n}\r\n"]}
@@ -20,9 +20,9 @@ export declare function prepareNumericTween<T extends object>(target: T, to: Par
20
20
  * directly to the backing {@link PropSlot}s.
21
21
  *
22
22
  * Skipping the setter avoids the mapper-lookup and `_writeProp` indirection on
23
- * every frame step. Only valid for numeric, mapper-free properties — the caller
24
- * is responsible for resolving the slots and capturing the `from`/`end`
25
- * values before calling this.
23
+ * every frame step. Only valid for numeric properties whose `end` is already in
24
+ * stored space — the caller is responsible for resolving the slots, mapping the
25
+ * destination and capturing the `from`/`end` values before calling this.
26
26
  *
27
27
  * - `cells[i]` — the slot for the i-th animated property.
28
28
  * - `from[i]` — start value for that property.
@@ -32,9 +32,9 @@ export function prepareNumericTween(target, to) {
32
32
  * directly to the backing {@link PropSlot}s.
33
33
  *
34
34
  * Skipping the setter avoids the mapper-lookup and `_writeProp` indirection on
35
- * every frame step. Only valid for numeric, mapper-free properties — the caller
36
- * is responsible for resolving the slots and capturing the `from`/`end`
37
- * values before calling this.
35
+ * every frame step. Only valid for numeric properties whose `end` is already in
36
+ * stored space — the caller is responsible for resolving the slots, mapping the
37
+ * destination and capturing the `from`/`end` values before calling this.
38
38
  *
39
39
  * - `cells[i]` — the slot for the i-th animated property.
40
40
  * - `from[i]` — start value for that property.
@@ -1 +1 @@
1
- {"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/tween/prepare.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,gBAAgB;AAChB,MAAM,UAAU,mBAAmB,CAC/B,MAAS,EACT,EAAoC;IAEpC,MAAM,IAAI,GAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,IAAI,KAAK,CAAS,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAI,KAAK,CAAS,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,CAAC,CAAC,GAAI,MAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAW,CAAC;QAC7C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAW,CAAC;IACnC,CAAC;IACD,OAAO,CAAC,CAAS,EAAE,EAAE;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClC,MAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChE,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,gBAAgB;AAChB,MAAM,UAAU,uBAAuB,CACnC,KAAyB,EACzB,IAAc,EACd,GAAa;IAEb,OAAO,CAAC,CAAS,EAAE,EAAE;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,CAAC;IACL,CAAC,CAAC;AACN,CAAC","sourcesContent":["import type { PropSlot } from \"@/props/slot\";\n\n/**\n * Snapshots the current numeric property values on `target` for the keys\n * present in `to`, then returns a lerp callback that writes interpolated values\n * back each frame.\n *\n * The snapshot is taken at call time, so invoke this immediately before the\n * animation starts (not lazily) to capture the correct `from` state.\n *\n * @param target - The object whose properties will be animated.\n * @param to - Desired end values keyed by property name. Keys with\n * `undefined` values are ignored.\n * @returns A function `(t: number) => void` that writes `lerp(from, to, t)`\n * for each key. `t` must already be eased by the caller.\n */\n/** @internal */\nexport function prepareNumericTween<T extends object>(\n target: T,\n to: Partial<Record<keyof T, number>>,\n): (t: number) => void {\n const keys = (Object.keys(to) as (keyof T)[]).filter((k) => to[k] !== undefined);\n const from = new Array<number>(keys.length);\n const end = new Array<number>(keys.length);\n for (let i = 0; i < keys.length; i++) {\n from[i] = (target as any)[keys[i]] as number;\n end[i] = to[keys[i]] as number;\n }\n return (t: number) => {\n for (let i = 0; i < keys.length; i++) {\n (target as any)[keys[i]] = from[i] + (end[i] - from[i]) * t;\n }\n };\n}\n\n/**\n * Like {@link prepareNumericTween}, but bypasses property setters and writes\n * directly to the backing {@link PropSlot}s.\n *\n * Skipping the setter avoids the mapper-lookup and `_writeProp` indirection on\n * every frame step. Only valid for numeric, mapper-free properties — the caller\n * is responsible for resolving the slots and capturing the `from`/`end`\n * values before calling this.\n *\n * - `cells[i]` — the slot for the i-th animated property.\n * - `from[i]` — start value for that property.\n * - `end[i]` — end value for that property.\n *\n * The arrays are captured by the returned closure and reused each step, so the\n * per-frame cost is one `slot.set(number)` per property with no allocation.\n */\n/** @internal */\nexport function prepareNumericCellTween(\n cells: PropSlot<number>[],\n from: number[],\n end: number[],\n): (t: number) => void {\n return (t: number) => {\n for (let i = 0; i < cells.length; i++) {\n cells[i].set(from[i] + (end[i] - from[i]) * t);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/tween/prepare.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,gBAAgB;AAChB,MAAM,UAAU,mBAAmB,CAC/B,MAAS,EACT,EAAoC;IAEpC,MAAM,IAAI,GAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,IAAI,KAAK,CAAS,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAI,KAAK,CAAS,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,CAAC,CAAC,GAAI,MAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAW,CAAC;QAC7C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAW,CAAC;IACnC,CAAC;IACD,OAAO,CAAC,CAAS,EAAE,EAAE;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClC,MAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChE,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,gBAAgB;AAChB,MAAM,UAAU,uBAAuB,CACnC,KAAyB,EACzB,IAAc,EACd,GAAa;IAEb,OAAO,CAAC,CAAS,EAAE,EAAE;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,CAAC;IACL,CAAC,CAAC;AACN,CAAC","sourcesContent":["import type { PropSlot } from \"@/props/slot\";\r\n\r\n/**\r\n * Snapshots the current numeric property values on `target` for the keys\r\n * present in `to`, then returns a lerp callback that writes interpolated values\r\n * back each frame.\r\n *\r\n * The snapshot is taken at call time, so invoke this immediately before the\r\n * animation starts (not lazily) to capture the correct `from` state.\r\n *\r\n * @param target - The object whose properties will be animated.\r\n * @param to - Desired end values keyed by property name. Keys with\r\n * `undefined` values are ignored.\r\n * @returns A function `(t: number) => void` that writes `lerp(from, to, t)`\r\n * for each key. `t` must already be eased by the caller.\r\n */\r\n/** @internal */\r\nexport function prepareNumericTween<T extends object>(\r\n target: T,\r\n to: Partial<Record<keyof T, number>>,\r\n): (t: number) => void {\r\n const keys = (Object.keys(to) as (keyof T)[]).filter((k) => to[k] !== undefined);\r\n const from = new Array<number>(keys.length);\r\n const end = new Array<number>(keys.length);\r\n for (let i = 0; i < keys.length; i++) {\r\n from[i] = (target as any)[keys[i]] as number;\r\n end[i] = to[keys[i]] as number;\r\n }\r\n return (t: number) => {\r\n for (let i = 0; i < keys.length; i++) {\r\n (target as any)[keys[i]] = from[i] + (end[i] - from[i]) * t;\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Like {@link prepareNumericTween}, but bypasses property setters and writes\r\n * directly to the backing {@link PropSlot}s.\r\n *\r\n * Skipping the setter avoids the mapper-lookup and `_writeProp` indirection on\r\n * every frame step. Only valid for numeric properties whose `end` is already in\r\n * stored space — the caller is responsible for resolving the slots, mapping the\r\n * destination and capturing the `from`/`end` values before calling this.\r\n *\r\n * - `cells[i]` — the slot for the i-th animated property.\r\n * - `from[i]` — start value for that property.\r\n * - `end[i]` — end value for that property.\r\n *\r\n * The arrays are captured by the returned closure and reused each step, so the\r\n * per-frame cost is one `slot.set(number)` per property with no allocation.\r\n */\r\n/** @internal */\r\nexport function prepareNumericCellTween(\r\n cells: PropSlot<number>[],\r\n from: number[],\r\n end: number[],\r\n): (t: number) => void {\r\n return (t: number) => {\r\n for (let i = 0; i < cells.length; i++) {\r\n cells[i].set(from[i] + (end[i] - from[i]) * t);\r\n }\r\n };\r\n}\r\n"]}
@@ -1,3 +1,4 @@
1
+ import { type Command } from "./command.js";
1
2
  import type { Steppable } from "./stepper.js";
2
3
  /**
3
4
  * Choreography that can be **asked** what it looks like at a time.
@@ -13,7 +14,7 @@ import type { Steppable } from "./stepper.js";
13
14
  * hands back something seekable, so a host can jump straight to a time.
14
15
  *
15
16
  * Each part writes to **its own node**, which is why this is not
16
- * `commandSequence` from motion-script: that composes one node's props by
17
+ * `commandSequence`: that composes one node's props by
17
18
  * merging `Partial<P>`, and an axis entrance is a dozen nodes moving at once
18
19
  * with nothing to merge. Composing steppers instead lets each part write where
19
20
  * it already writes.
@@ -57,6 +58,16 @@ export declare function together(...parts: Seekable[]): Seekable;
57
58
  * look right playing forwards and drift the moment anything scrubs.
58
59
  */
59
60
  export declare function drive(seconds: number, apply: (t: number) => void): Seekable;
61
+ /**
62
+ * `part` as the {@link Command} a `@command()` method returns, which is what a
63
+ * document's timeline evaluates: a `Seekable` has no `at`.
64
+ *
65
+ * `duration` is the slot the command was given. A part that ends sooner holds its
66
+ * last frame for the rest of it, and one that runs longer is played faster, so
67
+ * the command's end is always the part's end — the state the next command on the
68
+ * node is built against. The part is prepared here, when the command is built.
69
+ */
70
+ export declare function asCommand(part: Seekable, duration?: number): Command<Record<string, never>>;
60
71
  /**
61
72
  * Combine placed parts into one seekable whole.
62
73
  *
@@ -1 +1 @@
1
- {"version":3,"file":"seekable.d.ts","sourceRoot":"","sources":["../../src/tween/seekable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,WAAW,CAAA;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sDAAsD;AACtD,MAAM,WAAW,QAAS,SAAQ,SAAS;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED,wDAAwD;AACxD,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,0DAA0D;AAC1D,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAEzD;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAkB9C;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,CASvD;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAEvD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CACnB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GACzB,QAAQ,CAwBV;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,C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AsCjD"}
@@ -1,3 +1,4 @@
1
+ import { driveCommand } from "./command.js";
1
2
  /** Sugar for {@link compose}: `at(0.2, node.to(...))`. */
2
3
  export function at(offset, part) {
3
4
  return { offset, part };
@@ -78,6 +79,20 @@ export function drive(seconds, apply) {
78
79
  _stepper: makeStepper,
79
80
  };
80
81
  }
82
+ /**
83
+ * `part` as the {@link Command} a `@command()` method returns, which is what a
84
+ * document's timeline evaluates: a `Seekable` has no `at`.
85
+ *
86
+ * `duration` is the slot the command was given. A part that ends sooner holds its
87
+ * last frame for the rest of it, and one that runs longer is played faster, so
88
+ * the command's end is always the part's end — the state the next command on the
89
+ * node is built against. The part is prepared here, when the command is built.
90
+ */
91
+ export function asCommand(part, duration = part.duration) {
92
+ const stepper = part._stepper();
93
+ const span = Math.max(duration, part.duration);
94
+ return driveCommand(duration, (t) => stepper.seek(t * span));
95
+ }
81
96
  /**
82
97
  * Combine placed parts into one seekable whole.
83
98
  *
@@ -1 +1 @@
1
- {"version":3,"file":"seekable.js","sourceRoot":"","sources":["../../src/tween/seekable.ts"],"names":[],"mappings":"AAiCA,0DAA0D;AAC1D,MAAM,UAAU,EAAE,CAAC,MAAc,EAAE,IAAc;IAC/C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACzB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,MAAM,WAAW,GAAG,GAAiB,EAAE;QACrC,IAAI,OAAO,GAAG,CAAC,CAAA;QACf,OAAO;YACL,IAAI,EAAE,CAAC,CAAS,EAAE,EAAE;gBAClB,OAAO,GAAG,CAAC,CAAA;YACb,CAAC;YACD,OAAO,EAAE,CAAC,EAAU,EAAW,EAAE;gBAC/B,OAAO,IAAI,EAAE,CAAA;gBACb,OAAO,OAAO,IAAI,OAAO,CAAA;YAC3B,CAAC;SACF,CAAA;IACH,CAAC,CAAA;IAED,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,QAAQ,EAAE,WAAW;K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O,CAAC,CAAA;YAClB,CAAC;YACD,OAAO,EAAE,CAAC,EAAU,EAAW,EAAE;gBAC/B,OAAO,IAAI,EAAE,CAAA;gBACb,OAAO,CAAC,OAAO,CAAC,CAAA;gBAChB,OAAO,OAAO,IAAI,QAAQ,CAAA;YAC5B,CAAC;SACF,CAAA;IACH,CAAC,CAAA;IAED,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,WAAW;KACtB,CAAA;AACH,CAAC","sourcesContent":["import type { Steppable, TweenStepper } from \"./stepper\"\n\n/**\n * Choreography that can be **asked** what it looks like at a time.\n *\n * A node's entrance is usually a stagger: markers landing one after another, a\n * caption following them, a legend after that. Written as a generator — `yield*\n * parallel(...)` over per-item `wait` + `to` — the offsets exist only while it\n * runs, so the only way to know what it looks like 0.4s in is to run it from\n * zero. That is what makes a chart scene fall back to replay-based scrubbing.\n *\n * The offsets are static, though. Nothing about a stagger needs to be discovered\n * by running it. {@link compose} keeps the same parts at the same offsets and\n * hands back something seekable, so a host can jump straight to a time.\n *\n * Each part writes to **its own node**, which is why this is not\n * `commandSequence` from motion-script: that composes one node's props by\n * merging `Partial<P>`, and an axis entrance is a dozen nodes moving at once\n * with nothing to merge. Composing steppers instead lets each part write where\n * it already writes.\n */\n\n/** Something seekable that knows how long it runs. */\nexport interface Seekable extends Steppable {\n readonly duration: number\n}\n\n/** A part, and how far into the composite it starts. */\nexport interface Placed {\n offset: number\n part: Seekable\n}\n\n/** Sugar for {@link compose}: `at(0.2, node.to(...))`. */\nexport function at(offset: number, part: Seekable): Placed {\n return { offset, part }\n}\n\n/**\n * A part that writes nothing for `seconds` — the seekable `wait`.\n *\n * What the no-op branch of a command returns. A command's duration is the slot\n * the timeline lays out for it and the length its parallel siblings are timed\n * against, so a call that happens to have nothing to do still has to take its\n * time; returning something shorter would pull the rest of the scene forward.\n */\nexport function hold(seconds: number): Seekable {\n const makeStepper = (): TweenStepper => {\n let elapsed = 0\n return {\n seek: (s: number) => {\n elapsed = s\n },\n advance: (dt: number): boolean => {\n elapsed += dt\n return elapsed >= seconds\n },\n }\n }\n\n return {\n duration: seconds,\n _stepper: makeStepper,\n }\n}\n\n/** Run `parts` end to end, each starting where the previous one finished. */\nexport function sequence(...parts: Seekable[]): Seekable {\n let cursor = 0\n return compose(\n parts.map((part) => {\n const placed = at(cursor, part)\n cursor += part.duration\n return placed\n })\n )\n}\n\n/** Run `parts` together, all starting at the composite's own start. */\nexport function together(...parts: Seekable[]): Seekable {\n return compose(parts.map((part) => at(0, part)))\n}\n\n/**\n * A seekable `tween`: calls `apply(t)` with `t` running 0 → 1 over `seconds`.\n *\n * The escape hatch for state a `to` cannot reach — a plain field, an array\n * element, anything that is not one of the node's own reactive props. That is\n * most of what the chart commands were using `tween()` for, and `tween()` is a\n * generator, so it was also most of what kept them un-drivable.\n *\n * `apply` **must be a pure function of `t`**. It is called for any `t`, in any\n * order, more than once for the same value, and — unlike a generator's body — it\n * is not run once per frame in sequence. Accumulating into what it writes (`x +=\n * …`) rather than assigning from `t` is the one way to misuse this, and it will\n * look right playing forwards and drift the moment anything scrubs.\n */\nexport function drive(\n seconds: number,\n apply: (t: number) => void\n): Seekable {\n const at = (elapsed: number): void => {\n apply(seconds > 0 ? Math.min(Math.max(elapsed / seconds, 0), 1) : 1)\n }\n\n const makeStepper = (): TweenStepper => {\n let elapsed = 0\n return {\n seek: (s: number) => {\n elapsed = s\n at(s)\n },\n advance: (dt: number): boolean => {\n elapsed += dt\n at(elapsed)\n return elapsed >= seconds\n },\n }\n }\n\n return {\n duration: seconds,\n _stepper: makeStepper,\n }\n}\n\n/**\n * Combine placed parts into one seekable whole.\n *\n * Every part is seeked on every evaluation, not just the ones that have started:\n * a part still ahead of the playhead is held at its own zero, which is the state\n * it was prepared against and therefore the state that should precede it.\n * Skipping it would leave whatever a *later* evaluation wrote sitting there when\n * the playhead came back.\n */\nexport function compose(parts: Placed[]): Seekable {\n const duration = parts.reduce(\n (max, p) => Math.max(max, p.offset + p.part.duration),\n 0\n )\n\n const makeStepper = (): TweenStepper => {\n // Prepared once. Preparing is what snapshots each part's `from` off its live\n // node, so doing it per seek would make the answer depend on where the\n // playhead came from rather than on the time asked for.\n const steppers = parts.map((p) => p.part._stepper())\n let elapsed = 0\n\n const applyAt = (seconds: number): void => {\n for (let i = 0; i < parts.length; i++) {\n const { offset, part } = parts[i]\n const local = Math.min(Math.max(seconds - offset, 0), part.duration)\n steppers[i].seek(local)\n }\n }\n\n return {\n seek: (seconds: number) => {\n elapsed = seconds\n applyAt(seconds)\n },\n advance: (dt: number): boolean => {\n elapsed += dt\n applyAt(elapsed)\n return elapsed >= duration\n },\n }\n }\n\n return {\n duration,\n _stepper: makeStepper,\n }\n}\n"]}
1
+ {"version":3,"file":"seekable.js","sourceRoot":"","sources":["../../src/tween/seekable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,WAAW,CAAA;AAkCtD,0DAA0D;AAC1D,MAAM,UAAU,EAAE,CAAC,MAAc,EAAE,IAAc;IAC/C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACzB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,MAAM,WAAW,GAAG,GAAiB,EAAE;QACrC,IAAI,OAAO,GAAG,CAAC,CAAA;QACf,OAAO;YACL,IAAI,EAAE,CAAC,CAAS,EAAE,EAAE;gBAClB,OAAO,GAAG,CAAC,CAAA;YACb,CAAC;YACD,OAAO,EAAE,CAAC,EAAU,EAAW,EAAE;gBAC/B,OAAO,IAAI,EAAE,CAAA;gBACb,OAAO,OAAO,IAAI,OAAO,CAAA;YAC3B,CAAC;SACF,CAAA;IACH,CAAC,CAAA;IAED,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,QAAQ,EAAE,WAAW;KACtB,CAAA;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,QAAQ,CAAC,GAAG,KAAiB;IAC3C,IAAI,MAAM,GAAG,CAAC,CAAA;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,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACpE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACzB,CAAC;QACH,CAAC,CAAA;QAED,OAAO;YACL,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;gBACxB,OAAO,GAAG,OAAO,CAAA;gBACjB,OAAO,CAAC,OAAO,CAAC,CAAA;YAClB,CAAC;YACD,OAAO,EAAE,CAAC,EAAU,EAAW,EAAE;gBAC/B,OAAO,IAAI,EAAE,CAAA;gBACb,OAAO,CAAC,OAAO,CAAC,CAAA;gBAChB,OAAO,OAAO,IAAI,QAAQ,CAAA;YAC5B,CAAC;SACF,CAAA;IACH,CAAC,CAAA;IAED,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,WAAW;KACtB,CAAA;AACH,CAAC","sourcesContent":["import { driveCommand, type Command } from \"./command\"\r\nimport type { Steppable, TweenStepper } from \"./stepper\"\r\n\r\n/**\r\n * Choreography that can be **asked** what it looks like at a time.\r\n *\r\n * A node's entrance is usually a stagger: markers landing one after another, a\r\n * caption following them, a legend after that. Written as a generator — `yield*\r\n * parallel(...)` over per-item `wait` + `to` — the offsets exist only while it\r\n * runs, so the only way to know what it looks like 0.4s in is to run it from\r\n * zero. That is what makes a chart scene fall back to replay-based scrubbing.\r\n *\r\n * The offsets are static, though. Nothing about a stagger needs to be discovered\r\n * by running it. {@link compose} keeps the same parts at the same offsets and\r\n * hands back something seekable, so a host can jump straight to a time.\r\n *\r\n * Each part writes to **its own node**, which is why this is not\r\n * `commandSequence`: that composes one node's props by\r\n * merging `Partial<P>`, and an axis entrance is a dozen nodes moving at once\r\n * with nothing to merge. Composing steppers instead lets each part write where\r\n * it already writes.\r\n */\r\n\r\n/** Something seekable that knows how long it runs. */\r\nexport interface Seekable extends Steppable {\r\n readonly duration: number\r\n}\r\n\r\n/** A part, and how far into the composite it starts. */\r\nexport interface Placed {\r\n offset: number\r\n part: Seekable\r\n}\r\n\r\n/** Sugar for {@link compose}: `at(0.2, node.to(...))`. */\r\nexport function at(offset: number, part: Seekable): Placed {\r\n return { offset, part }\r\n}\r\n\r\n/**\r\n * A part that writes nothing for `seconds` — the seekable `wait`.\r\n *\r\n * What the no-op branch of a command returns. A command's duration is the slot\r\n * the timeline lays out for it and the length its parallel siblings are timed\r\n * against, so a call that happens to have nothing to do still has to take its\r\n * time; returning something shorter would pull the rest of the scene forward.\r\n */\r\nexport function hold(seconds: number): Seekable {\r\n const makeStepper = (): TweenStepper => {\r\n let elapsed = 0\r\n return {\r\n seek: (s: number) => {\r\n elapsed = s\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt\r\n return elapsed >= seconds\r\n },\r\n }\r\n }\r\n\r\n return {\r\n duration: seconds,\r\n _stepper: makeStepper,\r\n }\r\n}\r\n\r\n/** Run `parts` end to end, each starting where the previous one finished. */\r\nexport function sequence(...parts: Seekable[]): Seekable {\r\n let cursor = 0\r\n return compose(\r\n parts.map((part) => {\r\n const placed = at(cursor, part)\r\n cursor += part.duration\r\n return placed\r\n })\r\n )\r\n}\r\n\r\n/** Run `parts` together, all starting at the composite's own start. */\r\nexport function together(...parts: Seekable[]): Seekable {\r\n return compose(parts.map((part) => at(0, part)))\r\n}\r\n\r\n/**\r\n * A seekable `tween`: calls `apply(t)` with `t` running 0 → 1 over `seconds`.\r\n *\r\n * The escape hatch for state a `to` cannot reach — a plain field, an array\r\n * element, anything that is not one of the node's own reactive props. That is\r\n * most of what the chart commands were using `tween()` for, and `tween()` is a\r\n * generator, so it was also most of what kept them un-drivable.\r\n *\r\n * `apply` **must be a pure function of `t`**. It is called for any `t`, in any\r\n * order, more than once for the same value, and — unlike a generator's body — it\r\n * is not run once per frame in sequence. Accumulating into what it writes (`x +=\r\n * …`) rather than assigning from `t` is the one way to misuse this, and it will\r\n * look right playing forwards and drift the moment anything scrubs.\r\n */\r\nexport function drive(\r\n seconds: number,\r\n apply: (t: number) => void\r\n): Seekable {\r\n const at = (elapsed: number): void => {\r\n apply(seconds > 0 ? Math.min(Math.max(elapsed / seconds, 0), 1) : 1)\r\n }\r\n\r\n const makeStepper = (): TweenStepper => {\r\n let elapsed = 0\r\n return {\r\n seek: (s: number) => {\r\n elapsed = s\r\n at(s)\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt\r\n at(elapsed)\r\n return elapsed >= seconds\r\n },\r\n }\r\n }\r\n\r\n return {\r\n duration: seconds,\r\n _stepper: makeStepper,\r\n }\r\n}\r\n\r\n/**\r\n * `part` as the {@link Command} a `@command()` method returns, which is what a\r\n * document's timeline evaluates: a `Seekable` has no `at`.\r\n *\r\n * `duration` is the slot the command was given. A part that ends sooner holds its\r\n * last frame for the rest of it, and one that runs longer is played faster, so\r\n * the command's end is always the part's end — the state the next command on the\r\n * node is built against. The part is prepared here, when the command is built.\r\n */\r\nexport function asCommand(\r\n part: Seekable,\r\n duration: number = part.duration\r\n): Command<Record<string, never>> {\r\n const stepper = part._stepper()\r\n const span = Math.max(duration, part.duration)\r\n return driveCommand(duration, (t) => stepper.seek(t * span))\r\n}\r\n\r\n/**\r\n * Combine placed parts into one seekable whole.\r\n *\r\n * Every part is seeked on every evaluation, not just the ones that have started:\r\n * a part still ahead of the playhead is held at its own zero, which is the state\r\n * it was prepared against and therefore the state that should precede it.\r\n * Skipping it would leave whatever a *later* evaluation wrote sitting there when\r\n * the playhead came back.\r\n */\r\nexport function compose(parts: Placed[]): Seekable {\r\n const duration = parts.reduce(\r\n (max, p) => Math.max(max, p.offset + p.part.duration),\r\n 0\r\n )\r\n\r\n const makeStepper = (): TweenStepper => {\r\n // Prepared once. Preparing is what snapshots each part's `from` off its live\r\n // node, so doing it per seek would make the answer depend on where the\r\n // playhead came from rather than on the time asked for.\r\n const steppers = parts.map((p) => p.part._stepper())\r\n let elapsed = 0\r\n\r\n const applyAt = (seconds: number): void => {\r\n for (let i = 0; i < parts.length; i++) {\r\n const { offset, part } = parts[i]\r\n const local = Math.min(Math.max(seconds - offset, 0), part.duration)\r\n steppers[i].seek(local)\r\n }\r\n }\r\n\r\n return {\r\n seek: (seconds: number) => {\r\n elapsed = seconds\r\n applyAt(seconds)\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt\r\n applyAt(elapsed)\r\n return elapsed >= duration\r\n },\r\n }\r\n }\r\n\r\n return {\r\n duration,\r\n _stepper: makeStepper,\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stepper.js","sourceRoot":"","sources":["../../src/tween/stepper.ts"],"names":[],"mappings":"AAmCA,MAAM,UAAU,WAAW,CAAC,CAAU;IAClC,OAAO,OAAQ,CAAe,EAAE,QAAQ,KAAK,UAAU,CAAC;AAC5D,CAAC","sourcesContent":["/**\n * A flat animation driver. `advance(dt)` moves the animation forward by `dt`\n * seconds and returns `true` once it has completed (and applied its final\n * value). It must be primed at t=0 before the first `advance` so the starting\n * frame is correct — callers apply the initial value via `seek(0)`.\n *\n * `seek(elapsed)` is the absolute-time half, and is what a {@link Command}'s\n * `at` is built on: a stepper can be asked for any time, in any order, which is\n * what lets a timeline evaluate a frame without having played the ones before\n * it.\n */\n/** @internal */\nexport interface TweenStepper {\n /**\n * Jump to the value corresponding to `elapsed` seconds from the start.\n * Call with `0` to prime the stepper before the first {@link advance}.\n */\n seek(elapsed: number): void;\n /**\n * Advance the animation by `dt` seconds.\n * @returns `true` when the animation has finished and its final value has\n * been applied; `false` if it is still running.\n */\n advance(dt: number): boolean;\n}\n\n/**\n * Implemented by anything that can produce a {@link TweenStepper} — a\n * {@link Command}, and anything a host drives directly.\n */\nexport interface Steppable {\n /** Return a fresh stepper for a single playthrough of this animation. */\n _stepper(): TweenStepper;\n}\n\nexport function isSteppable(x: unknown): x is Steppable {\n return typeof (x as Steppable)?._stepper === \"function\";\n}\n"]}
1
+ {"version":3,"file":"stepper.js","sourceRoot":"","sources":["../../src/tween/stepper.ts"],"names":[],"mappings":"AAmCA,MAAM,UAAU,WAAW,CAAC,CAAU;IAClC,OAAO,OAAQ,CAAe,EAAE,QAAQ,KAAK,UAAU,CAAC;AAC5D,CAAC","sourcesContent":["/**\r\n * A flat animation driver. `advance(dt)` moves the animation forward by `dt`\r\n * seconds and returns `true` once it has completed (and applied its final\r\n * value). It must be primed at t=0 before the first `advance` so the starting\r\n * frame is correct — callers apply the initial value via `seek(0)`.\r\n *\r\n * `seek(elapsed)` is the absolute-time half, and is what a {@link Command}'s\r\n * `at` is built on: a stepper can be asked for any time, in any order, which is\r\n * what lets a timeline evaluate a frame without having played the ones before\r\n * it.\r\n */\r\n/** @internal */\r\nexport interface TweenStepper {\r\n /**\r\n * Jump to the value corresponding to `elapsed` seconds from the start.\r\n * Call with `0` to prime the stepper before the first {@link advance}.\r\n */\r\n seek(elapsed: number): void;\r\n /**\r\n * Advance the animation by `dt` seconds.\r\n * @returns `true` when the animation has finished and its final value has\r\n * been applied; `false` if it is still running.\r\n */\r\n advance(dt: number): boolean;\r\n}\r\n\r\n/**\r\n * Implemented by anything that can produce a {@link TweenStepper} — a\r\n * {@link Command}, and anything a host drives directly.\r\n */\r\nexport interface Steppable {\r\n /** Return a fresh stepper for a single playthrough of this animation. */\r\n _stepper(): TweenStepper;\r\n}\r\n\r\nexport function isSteppable(x: unknown): x is Steppable {\r\n return typeof (x as Steppable)?._stepper === \"function\";\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"to-command.js","sourceRoot":"","sources":["../../src/tween/to-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAgBvC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,SAAS;IAIU;IACA;IACR;IACQ;IANb,UAAU,GAAwB,IAAI,CAAC;IAE/C,YACqB,MAA0B,EAC1B,KAAiB,EACzB,QAAgB,EACR,MAAuB;QAHvB,WAAM,GAAN,MAAM,CAAoB;QAC1B,UAAK,GAAL,KAAK,CAAY;QACzB,aAAQ,GAAR,QAAQ,CAAQ;QACR,WAAM,GAAN,MAAM,CAAiB;IACxC,CAAC;IAEL;;;;;;OAMG;IACH,EAAE,CAAC,CAAS;QACR,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QACvD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,EAAE,CAAC;IACd,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAEO,OAAO;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5E,CAAC;CACJ;AAED,wDAAwD;AACxD,MAAM,UAAU,SAAS,CACrB,MAA0B,EAC1B,KAAiB,EACjB,QAAgB,EAChB,MAAuB;IAEvB,OAAO,IAAI,SAAS,CAAI,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { clamp01 } from \"@/util/clamp\";\nimport { EasingFunction } from \"@/tween/ease/type\";\nimport { Steppable, TweenStepper } from \"@/tween/stepper\";\nimport { Command } from \"./command\";\n\n/**\n * Interface a node (or other host) implements to be driven by {@link toCommand}.\n *\n * `_prepareStep` resolves one tween into a flat, mutation-driving\n * {@link TweenStepper} — the same primitive both the flat `parallel` fast path\n * and the command's own evaluation are built from.\n */\nexport interface AnimationTarget<P> {\n _prepareStep(props: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper;\n}\n\n/**\n * The {@link Command} `node.to(...)` returns: one tween on one target, and\n * nothing else.\n *\n * **Single, not chainable.** `to()` used to return a builder whose own `to()`\n * appended another step and returned `this`, so `node.to(a, 1).to(b, 1)` read as\n * a sequence. Sequencing is now a property of the timeline — a command carries\n * its own `at`, so \"after this one\" is `at + duration` — and one command shape\n * means a host reading a `Command` off a node knows exactly what it holds.\n *\n * Implements {@link Command} (a host can ask what it looks like at a time) and\n * {@link Steppable} (the flat driver).\n *\n * `at` and `_stepper` each keep their **own** prepared stepper: preparing is\n * what snapshots the tween's `from` (it reads the live target), so two drivers\n * must never fight over one mutable stepper.\n */\nclass ToCommand<P> implements Command<P>, Steppable {\n private atPrepared: TweenStepper | null = null;\n\n constructor(\n private readonly target: AnimationTarget<P>,\n private readonly props: Partial<P>,\n readonly duration: number,\n private readonly easing?: EasingFunction,\n ) { }\n\n /**\n * The props this command writes at normalized `t`. Applied as a side effect\n * (direct cell writes through the prepared stepper, exactly like\n * `driveCommand`) rather than returned — a tween may carry a custom tween\n * function or a mapped prop, and only the target's own `_prepareStep` knows\n * how to apply those correctly.\n */\n at(t: number): Partial<P> {\n if (!this.atPrepared) this.atPrepared = this.prepare();\n this.atPrepared.seek(clamp01(t) * this.duration);\n return {};\n }\n\n _stepper(): TweenStepper {\n return this.prepare();\n }\n\n private prepare(): TweenStepper {\n return this.target._prepareStep(this.props, this.duration, this.easing);\n }\n}\n\n/** Build the {@link Command} `node.to(...)` returns. */\nexport function toCommand<P>(\n target: AnimationTarget<P>,\n props: Partial<P>,\n duration: number,\n easing?: EasingFunction,\n): Command<P> {\n return new ToCommand<P>(target, props, duration, easing);\n}\n"]}
1
+ {"version":3,"file":"to-command.js","sourceRoot":"","sources":["../../src/tween/to-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAgBvC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,SAAS;IAIU;IACA;IACR;IACQ;IANb,UAAU,GAAwB,IAAI,CAAC;IAE/C,YACqB,MAA0B,EAC1B,KAAiB,EACzB,QAAgB,EACR,MAAuB;QAHvB,WAAM,GAAN,MAAM,CAAoB;QAC1B,UAAK,GAAL,KAAK,CAAY;QACzB,aAAQ,GAAR,QAAQ,CAAQ;QACR,WAAM,GAAN,MAAM,CAAiB;IACxC,CAAC;IAEL;;;;;;OAMG;IACH,EAAE,CAAC,CAAS;QACR,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QACvD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,EAAE,CAAC;IACd,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAEO,OAAO;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5E,CAAC;CACJ;AAED,wDAAwD;AACxD,MAAM,UAAU,SAAS,CACrB,MAA0B,EAC1B,KAAiB,EACjB,QAAgB,EAChB,MAAuB;IAEvB,OAAO,IAAI,SAAS,CAAI,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { clamp01 } from \"@/util/clamp\";\r\nimport { EasingFunction } from \"@/tween/ease/type\";\r\nimport { Steppable, TweenStepper } from \"@/tween/stepper\";\r\nimport { Command } from \"./command\";\r\n\r\n/**\r\n * Interface a node (or other host) implements to be driven by {@link toCommand}.\r\n *\r\n * `_prepareStep` resolves one tween into a flat, mutation-driving\r\n * {@link TweenStepper} — the same primitive both the flat `parallel` fast path\r\n * and the command's own evaluation are built from.\r\n */\r\nexport interface AnimationTarget<P> {\r\n _prepareStep(props: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper;\r\n}\r\n\r\n/**\r\n * The {@link Command} `node.to(...)` returns: one tween on one target, and\r\n * nothing else.\r\n *\r\n * **Single, not chainable.** `to()` used to return a builder whose own `to()`\r\n * appended another step and returned `this`, so `node.to(a, 1).to(b, 1)` read as\r\n * a sequence. Sequencing is now a property of the timeline — a command carries\r\n * its own `at`, so \"after this one\" is `at + duration` — and one command shape\r\n * means a host reading a `Command` off a node knows exactly what it holds.\r\n *\r\n * Implements {@link Command} (a host can ask what it looks like at a time) and\r\n * {@link Steppable} (the flat driver).\r\n *\r\n * `at` and `_stepper` each keep their **own** prepared stepper: preparing is\r\n * what snapshots the tween's `from` (it reads the live target), so two drivers\r\n * must never fight over one mutable stepper.\r\n */\r\nclass ToCommand<P> implements Command<P>, Steppable {\r\n private atPrepared: TweenStepper | null = null;\r\n\r\n constructor(\r\n private readonly target: AnimationTarget<P>,\r\n private readonly props: Partial<P>,\r\n readonly duration: number,\r\n private readonly easing?: EasingFunction,\r\n ) { }\r\n\r\n /**\r\n * The props this command writes at normalized `t`. Applied as a side effect\r\n * (direct cell writes through the prepared stepper, exactly like\r\n * `driveCommand`) rather than returned — a tween may carry a custom tween\r\n * function or a mapped prop, and only the target's own `_prepareStep` knows\r\n * how to apply those correctly.\r\n */\r\n at(t: number): Partial<P> {\r\n if (!this.atPrepared) this.atPrepared = this.prepare();\r\n this.atPrepared.seek(clamp01(t) * this.duration);\r\n return {};\r\n }\r\n\r\n _stepper(): TweenStepper {\r\n return this.prepare();\r\n }\r\n\r\n private prepare(): TweenStepper {\r\n return this.target._prepareStep(this.props, this.duration, this.easing);\r\n }\r\n}\r\n\r\n/** Build the {@link Command} `node.to(...)` returns. */\r\nexport function toCommand<P>(\r\n target: AnimationTarget<P>,\r\n props: Partial<P>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n): Command<P> {\r\n return new ToCommand<P>(target, props, duration, easing);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../src/util/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAU,EAAE;IACvE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,iFAAiF;AACjF,MAAM,UAAU,OAAO,CAAC,CAAS;IAC7B,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * Clamps a number between a minimum and maximum value.\n *\n * @param value - The number to clamp.\n * @param min - The lower bound.\n * @param max - The upper bound.\n * @returns The clamped number.\n */\nexport const clamp = (value: number, min: number, max: number): number => {\n return Math.max(min, Math.min(value, max));\n};\n\n/** Shorthand for `clamp(t, 0, 1)`, commonly used to normalize tween progress. */\nexport function clamp01(t: number) {\n return clamp(t, 0, 1);\n}\n"]}
1
+ {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../src/util/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAU,EAAE;IACvE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,iFAAiF;AACjF,MAAM,UAAU,OAAO,CAAC,CAAS;IAC7B,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/**\r\n * Clamps a number between a minimum and maximum value.\r\n *\r\n * @param value - The number to clamp.\r\n * @param min - The lower bound.\r\n * @param max - The upper bound.\r\n * @returns The clamped number.\r\n */\r\nexport const clamp = (value: number, min: number, max: number): number => {\r\n return Math.max(min, Math.min(value, max));\r\n};\r\n\r\n/** Shorthand for `clamp(t, 0, 1)`, commonly used to normalize tween progress. */\r\nexport function clamp01(t: number) {\r\n return clamp(t, 0, 1);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/util/context.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAI,YAAe,EAAE,IAAa;IAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,IAAI,SAAS,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACkB;IAArC,YAAqC,OAAqC;QAArC,YAAO,GAAP,OAAO,CAA8B;IAAI,CAAC;IAE/E,+DAA+D;IAC/D,MAAM,CAAU,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAElD,4EAA4E;IAC5E,IAAI,CAAI,GAAe,EAAE,KAAQ;QAC7B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACxB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,qEAAqE;IACrE,GAAG,CAAI,GAAe;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAO,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;IACzF,CAAC","sourcesContent":["/**\n * Typed context tokens for passing inherited data down the node tree —\n * analogous to React's `createContext` / `useContext`, but resolved over the\n * scene-node tree rather than a render tree.\n *\n * A {@link Context} is an opaque token carrying a phantom type `T` and a\n * default value. Providers attach a value for a token to the {@link ContextMap}\n * pushed to their descendants; a descendant reads the nearest ancestor's value\n * (or the token's default) via `node.useContext(token)`.\n *\n * Mirrors the {@link createRef} factory style: a small typed helper rather than\n * a class the author has to instantiate.\n */\nexport interface Context<T> {\n /** Identity used as the map key. Unique per `createContext` call. */\n readonly id: symbol;\n /** Value returned by `useContext` when no ancestor provides this token. */\n readonly defaultValue: T;\n /** Optional label, surfaced on the symbol for debugging. */\n readonly name?: string;\n}\n\n/**\n * Create a typed context token.\n *\n * @example\n * ```ts\n * const Money = createContext<number>(0, \"money\");\n * // provide: <Provider context={Money} value={500}>…</Provider>\n * // consume: init() { const m = this.useContext(Money); } // m: number\n * ```\n */\nexport function createContext<T>(defaultValue: T, name?: string): Context<T> {\n return { id: Symbol(name ?? \"context\"), defaultValue, name };\n}\n\n/**\n * An immutable, layered token→value map carried down the node tree. Each\n * provider derives a child map from its parent's via {@link with}, overriding a\n * single token — so a deeper provider naturally shadows a shallower one\n * (nearest-ancestor-wins) without any stack bookkeeping.\n */\nexport class ContextMap {\n private constructor(private readonly entries: ReadonlyMap<symbol, unknown>) { }\n\n /** The empty map — every token resolves to its own default. */\n static readonly EMPTY = new ContextMap(new Map());\n\n /** Return a new map identical to this one but with `ctx` set to `value`. */\n with<T>(ctx: Context<T>, value: T): ContextMap {\n const next = new Map(this.entries);\n next.set(ctx.id, value);\n return new ContextMap(next);\n }\n\n /** Resolve `ctx`'s value, falling back to its default when unset. */\n get<T>(ctx: Context<T>): T {\n return this.entries.has(ctx.id) ? (this.entries.get(ctx.id) as T) : ctx.defaultValue;\n }\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/util/context.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAI,YAAe,EAAE,IAAa;IAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,IAAI,SAAS,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACkB;IAArC,YAAqC,OAAqC;QAArC,YAAO,GAAP,OAAO,CAA8B;IAAI,CAAC;IAE/E,+DAA+D;IAC/D,MAAM,CAAU,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAElD,4EAA4E;IAC5E,IAAI,CAAI,GAAe,EAAE,KAAQ;QAC7B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACxB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,qEAAqE;IACrE,GAAG,CAAI,GAAe;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAO,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC;IACzF,CAAC","sourcesContent":["/**\r\n * Typed context tokens for passing inherited data down the node tree —\r\n * analogous to React's `createContext` / `useContext`, but resolved over the\r\n * scene-node tree rather than a render tree.\r\n *\r\n * A {@link Context} is an opaque token carrying a phantom type `T` and a\r\n * default value. Providers attach a value for a token to the {@link ContextMap}\r\n * pushed to their descendants; a descendant reads the nearest ancestor's value\r\n * (or the token's default) via `node.useContext(token)`.\r\n *\r\n * Mirrors the {@link createRef} factory style: a small typed helper rather than\r\n * a class the author has to instantiate.\r\n */\r\nexport interface Context<T> {\r\n /** Identity used as the map key. Unique per `createContext` call. */\r\n readonly id: symbol;\r\n /** Value returned by `useContext` when no ancestor provides this token. */\r\n readonly defaultValue: T;\r\n /** Optional label, surfaced on the symbol for debugging. */\r\n readonly name?: string;\r\n}\r\n\r\n/**\r\n * Create a typed context token.\r\n *\r\n * @example\r\n * ```ts\r\n * const Money = createContext<number>(0, \"money\");\r\n * // provide: <Provider context={Money} value={500}>…</Provider>\r\n * // consume: init() { const m = this.useContext(Money); } // m: number\r\n * ```\r\n */\r\nexport function createContext<T>(defaultValue: T, name?: string): Context<T> {\r\n return { id: Symbol(name ?? \"context\"), defaultValue, name };\r\n}\r\n\r\n/**\r\n * An immutable, layered token→value map carried down the node tree. Each\r\n * provider derives a child map from its parent's via {@link with}, overriding a\r\n * single token — so a deeper provider naturally shadows a shallower one\r\n * (nearest-ancestor-wins) without any stack bookkeeping.\r\n */\r\nexport class ContextMap {\r\n private constructor(private readonly entries: ReadonlyMap<symbol, unknown>) { }\r\n\r\n /** The empty map — every token resolves to its own default. */\r\n static readonly EMPTY = new ContextMap(new Map());\r\n\r\n /** Return a new map identical to this one but with `ctx` set to `value`. */\r\n with<T>(ctx: Context<T>, value: T): ContextMap {\r\n const next = new Map(this.entries);\r\n next.set(ctx.id, value);\r\n return new ContextMap(next);\r\n }\r\n\r\n /** Resolve `ctx`'s value, falling back to its default when unset. */\r\n get<T>(ctx: Context<T>): T {\r\n return this.entries.has(ctx.id) ? (this.entries.get(ctx.id) as T) : ctx.defaultValue;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"csv.js","sourceRoot":"","sources":["../../src/util/csv.ts"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,UAA2B,EAAE;IAChE,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,GAAG,CAAC;IAC3C,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE3B,MAAM,OAAO,GAA6B,IAAI,CAAC,GAAG,C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,EAAE,CAAC;gBAAC,CAAC;;oBAC1C,QAAQ,GAAG,KAAK,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACJ,KAAK,IAAI,EAAE,CAAC;YAChB,CAAC;YACD,SAAS;QACb,CAAC;QAED,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YAAC,QAAQ,GAAG,IAAI,CAAC;YAAC,WAAW,GAAG,IAAI,CAAC;YAAC,SAAS;QAAC,CAAC;QAClE,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YAAC,WAAW,GAAG,IAAI,CAAC;YAAC,SAAS,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QACpE,IAAI,EAAE,KAAK,IAAI;YAAE,SAAS;QAC1B,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;YAAC,IAAI,WAAW,IAAI,KAAK;gBAAE,OAAO,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QACnE,KAAK,IAAI,EAAE,CAAC;QACZ,WAAW,GAAG,IAAI,CAAC;IACvB,CAAC;IACD,qEAAqE;IACrE,IAAI,WAAW,IAAI,KAAK;QAAE,OAAO,EAAE,CAAC;IAEpC,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["/** One parsed data record: column name → cell value (string, or number/boolean\n * when the column auto-coerces — see {@link ParseCSVOptions.numeric} and\n * {@link ParseCSVOptions.boolean}). */\nexport type DataRecord = Record<string, string | number | boolean>;\n\nexport interface ParseCSVOptions {\n /** Field separator. Default: ','. */\n delimiter?: string;\n /**\n * Which columns to coerce to `number`. An explicit list forces just those\n * columns; `false` disables coercion entirely (every cell stays a string).\n * Default (omitted/`true`): auto-detect — a column becomes numeric only if\n * every non-empty cell in it parses as a finite number, so a text column\n * that happens to contain a numeric-looking value here and there is left\n * alone rather than partially coerced.\n */\n numeric?: string[] | boolean;\n /**\n * Which columns to coerce to `boolean`, same shape/semantics as\n * {@link numeric}. Default (omitted/`true`): auto-detect — a column\n * becomes boolean only if every non-empty cell is exactly `\"true\"` or\n * `\"false\"`. Never applied to a column already coerced to numeric.\n */\n boolean?: string[] | boolean;\n}\n\n/**\n * Parse CSV text into an array of row records keyed by the header row.\n * Handles quoted fields (embedded delimiters, newlines, and `\"\"` escapes) and\n * both CRLF/LF line endings. Synchronous and dependency-free, so it's safe to\n * call at module-eval time on text pulled in via a `?raw` import.\n */\nexport function parseCSV(text: string, options: ParseCSVOptions = {}): DataRecord[] {\n const delimiter = options.delimiter ?? ',';\n const rows = splitRows(text, delimiter);\n if (rows.length === 0) return [];\n\n const header = rows[0].map(cell => cell.trim());\n const body = rows.slice(1);\n\n const records: Record<string, string>[] = body.map(row => {\n const record: Record<string, string> = {};\n header.forEach((key, i) => { record[key] = row[i] ?? ''; });\n return record;\n });\n\n const numericCols = resolveNumericColumns(header, records, options.numeric);\n const booleanCols = resolveBooleanColumns(header, records, numericCols, options.boolean);\n if (numericCols.length === 0 && booleanCols.length === 0) return records;\n\n return records.map(record => {\n const out: DataRecord = { ...record };\n for (const col of numericCols) {\n const raw = record[col];\n if (raw === '') continue;\n out[col] = Number(raw);\n }\n for (const col of booleanCols) {\n const raw = record[col];\n if (raw === '') continue;\n out[col] = raw === 'true';\n }\n return out;\n });\n}\n\n/**\n * `parseData` only ever runs as an inlined literal — the\n * `@motionscript/vite-plugin` build-time macro replaces\n * `parseData(\"file.csv\")` call sites with the already-parsed rows before this\n * body ever executes. This implementation exists purely so the call\n * type-checks and so an unresolved call site (missing plugin, or a\n * non-literal argument the macro couldn't statically inline) fails loudly\n * instead of silently returning nothing.\n */\nexport function parseData(file: string, _options?: ParseCSVOptions): DataRecord[] {\n throw new Error(\n `parseData(\"${file}\") must be called with a static string literal so the ` +\n `@motionscript/vite-plugin macro can inline it at build time. If you're seeing ` +\n `this error at runtime, either the plugin isn't installed/registered, or this ` +\n `call's argument isn't a plain string literal.`\n );\n}\n\n/** Decide which columns to coerce, per {@link ParseCSVOptions.numeric}. */\nfunction resolveNumericColumns(\n header: string[],\n records: Record<string, string>[],\n numeric: string[] | boolean | undefined,\n): string[] {\n if (numeric === false) return [];\n if (Array.isArray(numeric)) return numeric;\n\n return header.filter(col => {\n let sawValue = false;\n for (const record of records) {\n const raw = record[col];\n if (raw === '') continue;\n if (!Number.isFinite(Number(raw))) return false;\n sawValue = true;\n }\n return sawValue;\n });\n}\n\n/** Decide which columns to coerce, per {@link ParseCSVOptions.boolean}. */\nfunction resolveBooleanColumns(\n header: string[],\n records: Record<string, string>[],\n numericCols: string[],\n bool: string[] | boolean | undefined,\n): string[] {\n if (bool === false) return [];\n if (Array.isArray(bool)) return bool;\n\n const numericSet = new Set(numericCols);\n return header.filter(col => {\n if (numericSet.has(col)) return false;\n let sawValue = false;\n for (const record of records) {\n const raw = record[col];\n if (raw === '') continue;\n if (raw !== 'true' && raw !== 'false') return false;\n sawValue = true;\n }\n return sawValue;\n });\n}\n\n/**\n * Split raw CSV text into rows of raw (unquoted) string cells. A minimal\n * hand-rolled scanner rather than a `split(',')`/`split('\\n')` pair so quoted\n * fields can safely contain the delimiter, newlines, and escaped (`\"\"`) quotes.\n */\nfunction splitRows(text: string, delimiter: string): string[][] {\n const rows: string[][] = [];\n let row: string[] = [];\n let field = '';\n let inQuotes = false;\n let sawAnyField = false;\n\n const pushField = () => { row.push(field); field = ''; };\n const pushRow = () => { pushField(); rows.push(row); row = []; sawAnyField = false; };\n\n for (let i = 0; i < text.length; i++) {\n const ch = text[i];\n\n if (inQuotes) {\n if (ch === '\"') {\n if (text[i + 1] === '\"') { field += '\"'; i++; }\n else inQuotes = false;\n } else {\n field += ch;\n }\n continue;\n }\n\n if (ch === '\"') { inQuotes = true; sawAnyField = true; continue; }\n if (ch === delimiter) { sawAnyField = true; pushField(); continue; }\n if (ch === '\\r') continue;\n if (ch === '\\n') { if (sawAnyField || field) pushRow(); continue; }\n field += ch;\n sawAnyField = true;\n }\n // Flush a final row left over when the text has no trailing newline.\n if (sawAnyField || field) pushRow();\n\n return rows;\n}\n"]}
1
+ {"version":3,"file":"csv.js","sourceRo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AAO,EAAE,CAAC;IAEpC,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["/** One parsed data record: column name → cell value (string, or number/boolean\r\n * when the column auto-coerces — see {@link ParseCSVOptions.numeric} and\r\n * {@link ParseCSVOptions.boolean}). */\r\nexport type DataRecord = Record<string, string | number | boolean>;\r\n\r\nexport interface ParseCSVOptions {\r\n /** Field separator. Default: ','. */\r\n delimiter?: string;\r\n /**\r\n * Which columns to coerce to `number`. An explicit list forces just those\r\n * columns; `false` disables coercion entirely (every cell stays a string).\r\n * Default (omitted/`true`): auto-detect — a column becomes numeric only if\r\n * every non-empty cell in it parses as a finite number, so a text column\r\n * that happens to contain a numeric-looking value here and there is left\r\n * alone rather than partially coerced.\r\n */\r\n numeric?: string[] | boolean;\r\n /**\r\n * Which columns to coerce to `boolean`, same shape/semantics as\r\n * {@link numeric}. Default (omitted/`true`): auto-detect — a column\r\n * becomes boolean only if every non-empty cell is exactly `\"true\"` or\r\n * `\"false\"`. Never applied to a column already coerced to numeric.\r\n */\r\n boolean?: string[] | boolean;\r\n}\r\n\r\n/**\r\n * Parse CSV text into an array of row records keyed by the header row.\r\n * Handles quoted fields (embedded delimiters, newlines, and `\"\"` escapes) and\r\n * both CRLF/LF line endings. Synchronous and dependency-free, so it's safe to\r\n * call at module-eval time on text pulled in via a `?raw` import.\r\n */\r\nexport function parseCSV(text: string, options: ParseCSVOptions = {}): DataRecord[] {\r\n const delimiter = options.delimiter ?? ',';\r\n const rows = splitRows(text, delimiter);\r\n if (rows.length === 0) return [];\r\n\r\n const header = rows[0].map(cell => cell.trim());\r\n const body = rows.slice(1);\r\n\r\n const records: Record<string, string>[] = body.map(row => {\r\n const record: Record<string, string> = {};\r\n header.forEach((key, i) => { record[key] = row[i] ?? ''; });\r\n return record;\r\n });\r\n\r\n const numericCols = resolveNumericColumns(header, records, options.numeric);\r\n const booleanCols = resolveBooleanColumns(header, records, numericCols, options.boolean);\r\n if (numericCols.length === 0 && booleanCols.length === 0) return records;\r\n\r\n return records.map(record => {\r\n const out: DataRecord = { ...record };\r\n for (const col of numericCols) {\r\n const raw = record[col];\r\n if (raw === '') continue;\r\n out[col] = Number(raw);\r\n }\r\n for (const col of booleanCols) {\r\n const raw = record[col];\r\n if (raw === '') continue;\r\n out[col] = raw === 'true';\r\n }\r\n return out;\r\n });\r\n}\r\n\r\n/**\r\n * `parseData` only ever runs as an inlined literal — the\r\n * `@motionscript/vite-plugin` build-time macro replaces\r\n * `parseData(\"file.csv\")` call sites with the already-parsed rows before this\r\n * body ever executes. This implementation exists purely so the call\r\n * type-checks and so an unresolved call site (missing plugin, or a\r\n * non-literal argument the macro couldn't statically inline) fails loudly\r\n * instead of silently returning nothing.\r\n */\r\nexport function parseData(file: string, _options?: ParseCSVOptions): DataRecord[] {\r\n throw new Error(\r\n `parseData(\"${file}\") must be called with a static string literal so the ` +\r\n `@motionscript/vite-plugin macro can inline it at build time. If you're seeing ` +\r\n `this error at runtime, either the plugin isn't installed/registered, or this ` +\r\n `call's argument isn't a plain string literal.`\r\n );\r\n}\r\n\r\n/** Decide which columns to coerce, per {@link ParseCSVOptions.numeric}. */\r\nfunction resolveNumericColumns(\r\n header: string[],\r\n records: Record<string, string>[],\r\n numeric: string[] | boolean | undefined,\r\n): string[] {\r\n if (numeric === false) return [];\r\n if (Array.isArray(numeric)) return numeric;\r\n\r\n return header.filter(col => {\r\n let sawValue = false;\r\n for (const record of records) {\r\n const raw = record[col];\r\n if (raw === '') continue;\r\n if (!Number.isFinite(Number(raw))) return false;\r\n sawValue = true;\r\n }\r\n return sawValue;\r\n });\r\n}\r\n\r\n/** Decide which columns to coerce, per {@link ParseCSVOptions.boolean}. */\r\nfunction resolveBooleanColumns(\r\n header: string[],\r\n records: Record<string, string>[],\r\n numericCols: string[],\r\n bool: string[] | boolean | undefined,\r\n): string[] {\r\n if (bool === false) return [];\r\n if (Array.isArray(bool)) return bool;\r\n\r\n const numericSet = new Set(numericCols);\r\n return header.filter(col => {\r\n if (numericSet.has(col)) return false;\r\n let sawValue = false;\r\n for (const record of records) {\r\n const raw = record[col];\r\n if (raw === '') continue;\r\n if (raw !== 'true' && raw !== 'false') return false;\r\n sawValue = true;\r\n }\r\n return sawValue;\r\n });\r\n}\r\n\r\n/**\r\n * Split raw CSV text into rows of raw (unquoted) string cells. A minimal\r\n * hand-rolled scanner rather than a `split(',')`/`split('\\n')` pair so quoted\r\n * fields can safely contain the delimiter, newlines, and escaped (`\"\"`) quotes.\r\n */\r\nfunction splitRows(text: string, delimiter: string): string[][] {\r\n const rows: string[][] = [];\r\n let row: string[] = [];\r\n let field = '';\r\n let inQuotes = false;\r\n let sawAnyField = false;\r\n\r\n const pushField = () => { row.push(field); field = ''; };\r\n const pushRow = () => { pushField(); rows.push(row); row = []; sawAnyField = false; };\r\n\r\n for (let i = 0; i < text.length; i++) {\r\n const ch = text[i];\r\n\r\n if (inQuotes) {\r\n if (ch === '\"') {\r\n if (text[i + 1] === '\"') { field += '\"'; i++; }\r\n else inQuotes = false;\r\n } else {\r\n field += ch;\r\n }\r\n continue;\r\n }\r\n\r\n if (ch === '\"') { inQuotes = true; sawAnyField = true; continue; }\r\n if (ch === delimiter) { sawAnyField = true; pushField(); continue; }\r\n if (ch === '\\r') continue;\r\n if (ch === '\\n') { if (sawAnyField || field) pushRow(); continue; }\r\n field += ch;\r\n sawAnyField = true;\r\n }\r\n // Flush a final row left over when the text has no trailing newline.\r\n if (sawAnyField || field) pushRow();\r\n\r\n return rows;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"generateList.js","sourceRoot":"","sources":["../../src/util/generateList.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,CAAS,EAAE,SAA+B,EAAO,EAAE;IACjF,gFAAgF;IAChF,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/**\n * Generates an array of size `n` populated by a generator function.\n * Mirrored after Dart's List.generate.\n */\nexport const generateList = <T>(n: number, generator: (index: number) => T): T[] => {\n // Use a traditional loop for maximum performance inside animation/render cycles\n const result = new Array(n);\n for (let i = 0; i < n; i++) {\n result[i] = generator(i);\n }\n return result;\n};\n"]}
1
+ {"version":3,"file":"generateList.js","sourceRoot":"","sources":["../../src/util/generateList.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,CAAS,EAAE,SAA+B,EAAO,EAAE;IACjF,gFAAgF;IAChF,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/**\r\n * Generates an array of size `n` populated by a generator function.\r\n * Mirrored after Dart's List.generate.\r\n */\r\nexport const generateList = <T>(n: number, generator: (index: number) => T): T[] => {\r\n // Use a traditional loop for maximum performance inside animation/render cycles\r\n const result = new Array(n);\r\n for (let i = 0; i < n; i++) {\r\n result[i] = generator(i);\r\n }\r\n return result;\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,OAAO,CAAA;AACrB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA","sourcesContent":["export * from './clamp'\nexport * from './context'\nexport * from './csv'\nexport * from './generateList'\nexport * from './metrics'\nexport * from './reference'\nexport * from './scheduler'\nexport { Random, SeedGenerator } from './random'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,OAAO,CAAA;AACrB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA","sourcesContent":["export * from './clamp'\r\nexport * from './context'\r\nexport * from './csv'\r\nexport * from './generateList'\r\nexport * from './metrics'\r\nexport * from './reference'\r\nexport * from './scheduler'\r\nexport { Random, SeedGenerator } from './random'\r\n"]}
@@ -17,7 +17,7 @@ export declare function niceStep(raw: number): number;
17
17
  * marker's* slide, and then added the stagger between them and a full-length
18
18
  * caption move on the end — so `enter(0.8)` on a five-marker axis actually took
19
19
  * about 2.2 seconds. That's fine when a scene is a hand-written script whose
20
- * beats are whatever they turn out to be. It is not fine here: the studio lays a
20
+ * beats are whatever they turn out to be. It is not fine here: an editor lays a
21
21
  * command out on the timeline at the duration it declares, times its parallel
22
22
  * siblings against it, and sums those durations into the scene's length. A
23
23
  * generator that overruns is a command that renders in the wrong place.
@@ -24,7 +24,7 @@ export function niceStep(raw) {
24
24
  * marker's* slide, and then added the stagger between them and a full-length
25
25
  * caption move on the end — so `enter(0.8)` on a five-marker axis actually took
26
26
  * about 2.2 seconds. That's fine when a scene is a hand-written script whose
27
- * beats are whatever they turn out to be. It is not fine here: the studio lays a
27
+ * beats are whatever they turn out to be. It is not fine here: an editor lays a
28
28
  * command out on the timeline at the duration it declares, times its parallel
29
29
  * siblings against it, and sums those durations into the scene's length. A
30
30
  * generator that overruns is a command that renders in the wrong place.
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/util/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IACtB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACrD,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAA;IACtB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/D,OAAO,IAAI,GAAG,GAAG,CAAA;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CACzB,QAAgB,EAChB,KAAa,EACb,UAAmB;AACnB,6EAA6E;AAC7E,OAAgB;IAEhB,wEAAwE;IACxE,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAA;IAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IAEnC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,wEAAwE;QACxE,8DAA8D;QAC9D,OAAO;YACL,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;YAC1C,OAAO;SACR,CAAA;IACH,CAAC;IACD,2EAA2E;IAC3E,iEAAiE;IACjE,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAA;IACpC,OAAO,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAA;AACxC,CAAC","sourcesContent":["/**\n * Two numbers a component ends up needing, neither of which belongs to any one\n * of them.\n *\n * Both were written for the chart family and are used well outside it — a\n * graph's plane rounds its ticks with one, a diagram divides its entrance with\n * the other. Leaving them there would make a package with nothing to do with\n * charts depend on charts for a page of arithmetic.\n */\n\n/** Round a raw step up to a tidy value (1/2/5 × 10ⁿ) so markers land round. */\nexport function niceStep(raw: number): number {\n if (raw <= 0) return 1\n const mag = Math.pow(10, Math.floor(Math.log10(raw)))\n const norm = raw / mag\n const nice = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 5 ? 5 : 10\n return nice * mag\n}\n\n/**\n * How an axis's staggered entrance is divided up, so the whole thing fits inside\n * `duration` instead of running past it.\n *\n * The standalone components this family was ported from read `duration` as *one\n * marker's* slide, and then added the stagger between them and a full-length\n * caption move on the end — so `enter(0.8)` on a five-marker axis actually took\n * about 2.2 seconds. That's fine when a scene is a hand-written script whose\n * beats are whatever they turn out to be. It is not fine here: the studio lays a\n * command out on the timeline at the duration it declares, times its parallel\n * siblings against it, and sums those durations into the scene's length. A\n * generator that overruns is a command that renders in the wrong place.\n *\n * So the budget runs the other way: the caption takes a fixed share off the top,\n * and the markers' per-move duration is solved for from what's left, given the\n * stagger. Same shape of animation, honest arithmetic.\n */\nexport function enterBudget(\n duration: number,\n count: number,\n hasCaption: boolean,\n /** An explicit gap between markers; derived from `duration` when omitted. */\n stagger?: number\n): { step: number; per: number; caption: number } {\n // The caption lands *after* the last marker, so it needs its own slice.\n const caption = hasCaption ? duration * 0.3 : 0\n const markers = Math.max(0, duration - caption)\n const gaps = Math.max(0, count - 1)\n\n if (stagger !== undefined) {\n // An explicit gap wins; the per-marker move takes whatever is left, and\n // can't go negative on an axis with more markers than budget.\n return {\n step: stagger,\n per: Math.max(0, markers - stagger * gaps),\n caption,\n }\n }\n // Default rhythm: each gap is a fifth of a marker's own move, which is the\n // ratio the original used — solved for here rather than assumed.\n const per = markers / (1 + gaps / 5)\n return { step: per / 5, per, caption }\n}\n"]}
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/util/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IACtB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACrD,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAA;IACtB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/D,OAAO,IAAI,GAAG,GAAG,CAAA;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CACzB,QAAgB,EAChB,KAAa,EACb,UAAmB;AACnB,6EAA6E;AAC7E,OAAgB;IAEhB,wEAAwE;IACxE,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAA;IAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IAEnC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,wEAAwE;QACxE,8DAA8D;QAC9D,OAAO;YACL,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;YAC1C,OAAO;SACR,CAAA;IACH,CAAC;IACD,2EAA2E;IAC3E,iEAAiE;IACjE,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAA;IACpC,OAAO,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAA;AACxC,CAAC","sourcesContent":["/**\r\n * Two numbers a component ends up needing, neither of which belongs to any one\r\n * of them.\r\n *\r\n * Both were written for the chart family and are used well outside it — a\r\n * graph's plane rounds its ticks with one, a diagram divides its entrance with\r\n * the other. Leaving them there would make a package with nothing to do with\r\n * charts depend on charts for a page of arithmetic.\r\n */\r\n\r\n/** Round a raw step up to a tidy value (1/2/5 × 10ⁿ) so markers land round. */\r\nexport function niceStep(raw: number): number {\r\n if (raw <= 0) return 1\r\n const mag = Math.pow(10, Math.floor(Math.log10(raw)))\r\n const norm = raw / mag\r\n const nice = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 5 ? 5 : 10\r\n return nice * mag\r\n}\r\n\r\n/**\r\n * How an axis's staggered entrance is divided up, so the whole thing fits inside\r\n * `duration` instead of running past it.\r\n *\r\n * The standalone components this family was ported from read `duration` as *one\r\n * marker's* slide, and then added the stagger between them and a full-length\r\n * caption move on the end — so `enter(0.8)` on a five-marker axis actually took\r\n * about 2.2 seconds. That's fine when a scene is a hand-written script whose\r\n * beats are whatever they turn out to be. It is not fine here: an editor lays a\r\n * command out on the timeline at the duration it declares, times its parallel\r\n * siblings against it, and sums those durations into the scene's length. A\r\n * generator that overruns is a command that renders in the wrong place.\r\n *\r\n * So the budget runs the other way: the caption takes a fixed share off the top,\r\n * and the markers' per-move duration is solved for from what's left, given the\r\n * stagger. Same shape of animation, honest arithmetic.\r\n */\r\nexport function enterBudget(\r\n duration: number,\r\n count: number,\r\n hasCaption: boolean,\r\n /** An explicit gap between markers; derived from `duration` when omitted. */\r\n stagger?: number\r\n): { step: number; per: number; caption: number } {\r\n // The caption lands *after* the last marker, so it needs its own slice.\r\n const caption = hasCaption ? duration * 0.3 : 0\r\n const markers = Math.max(0, duration - caption)\r\n const gaps = Math.max(0, count - 1)\r\n\r\n if (stagger !== undefined) {\r\n // An explicit gap wins; the per-marker move takes whatever is left, and\r\n // can't go negative on an axis with more markers than budget.\r\n return {\r\n step: stagger,\r\n per: Math.max(0, markers - stagger * gaps),\r\n caption,\r\n }\r\n }\r\n // Default rhythm: each gap is a fifth of a marker's own move, which is the\r\n // ratio the original used — solved for here rather than assumed.\r\n const per = markers / (1 + gaps / 5)\r\n return { step: per / 5, per, caption }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/util/random.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,OAAO,aAAa;IACd,KAAK,GAAW,CAAC,CAAC;IAE1B,YAAY,IAAqB;QAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,IAAqB;QACzB,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,KAAK,QAAQ;YACjC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EA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32 algorithm.\n * Produces the same sequence for the same seed, making animations reproducible.\n *\n * This is the low-level engine. Scene authors use the higher-level {@link Random}\n * facade (handed out by `stage.random(seed)`), which wraps a `SeedGenerator` and\n * adds typed draws (`nextFloat`/`nextInt`/`gauss`/arrays) plus seeded `noise`.\n */\nexport class SeedGenerator {\n private state: number = 0;\n\n constructor(seed: string | number) {\n this.setSeed(seed);\n }\n\n /**\n * Resets the generator to a new seed.\n * String seeds are hashed via djb2 into a 32-bit integer.\n */\n setSeed(seed: string | number) {\n this.state = typeof seed === 'string'\n ? seed.split('').reduce((a, b) => { a = ((a << 5) - a) + b.charCodeAt(0); return a & a; }, 0)\n : seed;\n }\n\n /** Returns the next pseudo-random float in [0, 1). */\n next() {\n this.state |= 0; this.state = this.state + 0x6D2B79F5 | 0;\n var t = Math.imul(this.state ^ this.state >>> 15, 1 | this.state);\n t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;\n return ((t ^ t >>> 14) >>> 0) / 4294967296;\n }\n}\n\n/** Upper bound of {@link Random.nextInt} / {@link Random.intArray} (2^32). */\nconst UINT32_RANGE = 4294967296;\n\n/**\n * A seeded random source handed to scene generators by `stage.random(seed)`.\n *\n * Wraps a {@link SeedGenerator} (mulberry32) and exposes the author-facing draw\n * surface. Because the seed lives on the `Random` instance, determinism is\n * scoped per source: two scenes can each `stage.random(\"name\")` and get their\n * own reproducible stream without touching a shared stage-level seed.\n *\n * const random = stage.random(\"sparkle\");\n * const xs = random.floatArray(40, -100, 100); // 40 reproducible offsets\n * const drift = random.noise(t, 6); // smooth field over time\n *\n * Two families live here, and they are NOT interchangeable:\n * - **Independent draws** — `nextFloat`/`nextInt`/`gauss` and their array\n * forms. Successive calls are uncorrelated; `gauss` only changes the\n * *distribution* (bell curve vs flat), not the independence.\n * - **Correlated field** — `noise(t)`. Nearby inputs return nearby values, so\n * it is the right tool for smooth motion over time/space (drift, shake,\n * waves). No distribution draw can reproduce that smoothness.\n */\nexport class Random {\n /** The seed this source rewinds to; reassign via {@link seed} or\n * {@link reset}. Set by {@link adopt} (definitely assigned via the\n * constructor's `adopt` call). */\n private _seed!: string | number;\n\n /** Numeric form of {@link _seed}, used to mix `noise`'s lattice. Kept in\n * lockstep with `_seed` through {@link adopt}. */\n private numericSeed!: number;\n\n private readonly gen: SeedGenerator;\n\n /** A spare gaussian sample from the last Box–Muller pair (see {@link gauss}). */\n private spareGauss: number | null = null;\n\n constructor(seed: string | number) {\n this.gen = new SeedGenerator(seed);\n this.adopt(seed);\n }\n\n /** The seed this source rewinds to. Assigning a new value re-anchors the\n * source (same effect as `reset(seed)`): the next draws reproduce the\n * sequence for that seed, and `noise`'s lattice shifts to match. */\n get seed(): string | number {\n return this._seed;\n }\n set seed(seed: string | number) {\n this.adopt(seed);\n }\n\n /** Numeric form of a seed: string seeds are hashed (the same djb2-style mix\n * the generator uses), numbers pass through. Shared so the constructor, the\n * {@link seed} setter, and {@link reset} all derive `numericSeed` identically. */\n private static toNumeric(seed: string | number): number {\n return typeof seed === 'string'\n ? seed.split('').reduce((a, b) => (a << 5) - a + b.charCodeAt(0), 0)\n : seed;\n }\n\n /** Take `seed` as the new origin and rewind to it: store it, recompute the\n * `noise` lattice anchor, reset the generator, and drop any spare gauss. The\n * single seed-adoption path behind the constructor, {@link seed}, and a\n * seeded {@link reset}. */\n private adopt(seed: string | number): void {\n this._seed = seed;\n this.numericSeed = Random.toNumeric(seed);\n this.gen.setSeed(seed);\n this.spareGauss = null;\n }\n\n /**\n * The next pseudo-random float in `[from, to)`. Defaults to `[0, 1)`.\n */\n nextFloat(from: number = 0, to: number = 1): number {\n return this.gen.next() * (to - from) + from;\n }\n\n /**\n * The next pseudo-random integer in `[from, to)`. Defaults to the full\n * unsigned 32-bit range `[0, 2^32)`.\n */\n nextInt(from: number = 0, to: number = UINT32_RANGE): number {\n return Math.floor(this.gen.next() * (to - from)) + from;\n }\n\n /** `size` independent floats in `[from, to)`. */\n floatArray(size: number, from: number = 0, to: number = 1): number[] {\n const out = new Array<number>(size);\n for (let i = 0; i < size; i++) out[i] = this.nextFloat(from, to);\n return out;\n }\n\n /** `size` independent integers in `[from, to)`. */\n intArray(size: number, from: number = 0, to: number = UINT32_RANGE): number[] {\n const out = new Array<number>(size);\n for (let i = 0; i < size; i++) out[i] = this.nextInt(from, to);\n return out;\n }\n\n /**\n * A normally-distributed sample with the given `mean` and `stdev` (default\n * standard normal). Values cluster near the mean and tail off — useful for\n * natural-looking scatter where most draws stay central with occasional\n * outliers.\n *\n * Uses the polar Box–Muller transform, which yields two independent normals\n * per pair of uniforms; the spare is cached and returned on the next call.\n */\n gauss(mean: number = 0, stdev: number = 1): number {\n if (this.spareGauss !== null) {\n const z = this.spareGauss;\n this.spareGauss = null;\n return mean + stdev * z;\n }\n // Rejection-sample a point in the unit circle, then map to two normals.\n let u: number, v: number, s: number;\n do {\n u = this.gen.next() * 2 - 1;\n v = this.gen.next() * 2 - 1;\n s = u * u + v * v;\n } while (s >= 1 || s === 0);\n const mul = Math.sqrt(-2 * Math.log(s) / s);\n this.spareGauss = v * mul;\n return mean + stdev * (u * mul);\n }\n\n /**\n * Smooth 1-D value noise in `[0, 1]`.\n *\n * Samples two adjacent lattice points around `time * frequency`, then\n * interpolates with a smoothstep curve (`3t² - 2t³`) to avoid the linear\n * kinks of plain lerp. Unlike {@link nextFloat}/{@link gauss}, nearby\n * `time` inputs return nearby values — this is the correlated field used for\n * organic, continuously varying motion (camera shake, drift, waves).\n *\n * @param time Sample position (e.g. normalized timeline `[0, 1]`, or a\n * spatial index).\n * @param frequency Scales `time` before sampling; higher = faster\n * oscillation / more crests across the same span.\n */\n noise(time: number, frequency: number = 1): number {\n const t = time * frequency;\n const i = Math.floor(t);\n const f = t - i;\n // Smoothstep: maps f through 3f²-2f³ to ease in/out between lattice points.\n const curve = f * f * (3 - 2 * f);\n const r1 = this.latticeValue(i);\n const r2 = this.latticeValue(i + 1);\n return r1 + (r2 - r1) * curve;\n }\n\n /**\n * Rewind this source so the next draws reproduce a sequence from the start.\n *\n * With no argument, rewinds to the current {@link seed} — what authors call to\n * repeat a sequence within a scene. Pass a `seed` to adopt it as the new origin\n * first (equivalent to assigning {@link seed}), so the source both re-seeds and\n * rewinds in one call — e.g. in a node's constructor to give it a distinct\n * reproducible stream.\n */\n reset(seed: string | number = this._seed): void {\n this.adopt(seed);\n }\n\n /**\n * Deterministic value in `[0, 1)` for a given integer lattice point `x`,\n * mixed with this source's seed via `sin`. Pure in `x` (no generator state),\n * so {@link noise} is stable regardless of how many draws preceded it.\n */\n private latticeValue(x: number): number {\n const h = Math.sin(x + this.numericSeed) * 10000;\n return h - Math.floor(h);\n }\n}\n"]}
1
+ {"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/util/random.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,OAAO,aAAa;IACd,KAAK,GAAW,CAAC,CAAC;IAE1B,YAAY,IAAqB;QAC7B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,IAAqB;QACzB,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,KAAK,QAAQ;YACjC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC7F,CAAC,CAAC,IAAI,CAAC;IACf,CAAC;IAED,sDAAsD;IACtD,IAAI;QACA,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,UAAU,GAAG,CAAC,CAAC;QAC1D,IAAI,CAAC,GAAG,IAAI,CAAC,IAA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,CAAC,CAAC,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB,4EAA4E;QAC5E,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAClC,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACpC,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;IAClC,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,OAAwB,IAAI,CAAC,KAAK;QACpC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACK,YAAY,CAAC,CAAS;QAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;QACjD,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["/**\r\n * Deterministic pseudo-random number generator based on the mulberry32 algorithm.\r\n * Produces the same sequence for the same seed, making animations reproducible.\r\n *\r\n * This is the low-level engine. Scene authors use the higher-level {@link Random}\r\n * facade (handed out by `stage.random(seed)`), which wraps a `SeedGenerator` and\r\n * adds typed draws (`nextFloat`/`nextInt`/`gauss`/arrays) plus seeded `noise`.\r\n */\r\nexport class SeedGenerator {\r\n private state: number = 0;\r\n\r\n constructor(seed: string | number) {\r\n this.setSeed(seed);\r\n }\r\n\r\n /**\r\n * Resets the generator to a new seed.\r\n * String seeds are hashed via djb2 into a 32-bit integer.\r\n */\r\n setSeed(seed: string | number) {\r\n this.state = typeof seed === 'string'\r\n ? seed.split('').reduce((a, b) => { a = ((a << 5) - a) + b.charCodeAt(0); return a & a; }, 0)\r\n : seed;\r\n }\r\n\r\n /** Returns the next pseudo-random float in [0, 1). */\r\n next() {\r\n this.state |= 0; this.state = this.state + 0x6D2B79F5 | 0;\r\n var t = Math.imul(this.state ^ this.state >>> 15, 1 | this.state);\r\n t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;\r\n return ((t ^ t >>> 14) >>> 0) / 4294967296;\r\n }\r\n}\r\n\r\n/** Upper bound of {@link Random.nextInt} / {@link Random.intArray} (2^32). */\r\nconst UINT32_RANGE = 4294967296;\r\n\r\n/**\r\n * A seeded random source handed to scene generators by `stage.random(seed)`.\r\n *\r\n * Wraps a {@link SeedGenerator} (mulberry32) and exposes the author-facing draw\r\n * surface. Because the seed lives on the `Random` instance, determinism is\r\n * scoped per source: two scenes can each `stage.random(\"name\")` and get their\r\n * own reproducible stream without touching a shared stage-level seed.\r\n *\r\n * const random = stage.random(\"sparkle\");\r\n * const xs = random.floatArray(40, -100, 100); // 40 reproducible offsets\r\n * const drift = random.noise(t, 6); // smooth field over time\r\n *\r\n * Two families live here, and they are NOT interchangeable:\r\n * - **Independent draws** — `nextFloat`/`nextInt`/`gauss` and their array\r\n * forms. Successive calls are uncorrelated; `gauss` only changes the\r\n * *distribution* (bell curve vs flat), not the independence.\r\n * - **Correlated field** — `noise(t)`. Nearby inputs return nearby values, so\r\n * it is the right tool for smooth motion over time/space (drift, shake,\r\n * waves). No distribution draw can reproduce that smoothness.\r\n */\r\nexport class Random {\r\n /** The seed this source rewinds to; reassign via {@link seed} or\r\n * {@link reset}. Set by {@link adopt} (definitely assigned via the\r\n * constructor's `adopt` call). */\r\n private _seed!: string | number;\r\n\r\n /** Numeric form of {@link _seed}, used to mix `noise`'s lattice. Kept in\r\n * lockstep with `_seed` through {@link adopt}. */\r\n private numericSeed!: number;\r\n\r\n private readonly gen: SeedGenerator;\r\n\r\n /** A spare gaussian sample from the last Box–Muller pair (see {@link gauss}). */\r\n private spareGauss: number | null = null;\r\n\r\n constructor(seed: string | number) {\r\n this.gen = new SeedGenerator(seed);\r\n this.adopt(seed);\r\n }\r\n\r\n /** The seed this source rewinds to. Assigning a new value re-anchors the\r\n * source (same effect as `reset(seed)`): the next draws reproduce the\r\n * sequence for that seed, and `noise`'s lattice shifts to match. */\r\n get seed(): string | number {\r\n return this._seed;\r\n }\r\n set seed(seed: string | number) {\r\n this.adopt(seed);\r\n }\r\n\r\n /** Numeric form of a seed: string seeds are hashed (the same djb2-style mix\r\n * the generator uses), numbers pass through. Shared so the constructor, the\r\n * {@link seed} setter, and {@link reset} all derive `numericSeed` identically. */\r\n private static toNumeric(seed: string | number): number {\r\n return typeof seed === 'string'\r\n ? seed.split('').reduce((a, b) => (a << 5) - a + b.charCodeAt(0), 0)\r\n : seed;\r\n }\r\n\r\n /** Take `seed` as the new origin and rewind to it: store it, recompute the\r\n * `noise` lattice anchor, reset the generator, and drop any spare gauss. The\r\n * single seed-adoption path behind the constructor, {@link seed}, and a\r\n * seeded {@link reset}. */\r\n private adopt(seed: string | number): void {\r\n this._seed = seed;\r\n this.numericSeed = Random.toNumeric(seed);\r\n this.gen.setSeed(seed);\r\n this.spareGauss = null;\r\n }\r\n\r\n /**\r\n * The next pseudo-random float in `[from, to)`. Defaults to `[0, 1)`.\r\n */\r\n nextFloat(from: number = 0, to: number = 1): number {\r\n return this.gen.next() * (to - from) + from;\r\n }\r\n\r\n /**\r\n * The next pseudo-random integer in `[from, to)`. Defaults to the full\r\n * unsigned 32-bit range `[0, 2^32)`.\r\n */\r\n nextInt(from: number = 0, to: number = UINT32_RANGE): number {\r\n return Math.floor(this.gen.next() * (to - from)) + from;\r\n }\r\n\r\n /** `size` independent floats in `[from, to)`. */\r\n floatArray(size: number, from: number = 0, to: number = 1): number[] {\r\n const out = new Array<number>(size);\r\n for (let i = 0; i < size; i++) out[i] = this.nextFloat(from, to);\r\n return out;\r\n }\r\n\r\n /** `size` independent integers in `[from, to)`. */\r\n intArray(size: number, from: number = 0, to: number = UINT32_RANGE): number[] {\r\n const out = new Array<number>(size);\r\n for (let i = 0; i < size; i++) out[i] = this.nextInt(from, to);\r\n return out;\r\n }\r\n\r\n /**\r\n * A normally-distributed sample with the given `mean` and `stdev` (default\r\n * standard normal). Values cluster near the mean and tail off — useful for\r\n * natural-looking scatter where most draws stay central with occasional\r\n * outliers.\r\n *\r\n * Uses the polar Box–Muller transform, which yields two independent normals\r\n * per pair of uniforms; the spare is cached and returned on the next call.\r\n */\r\n gauss(mean: number = 0, stdev: number = 1): number {\r\n if (this.spareGauss !== null) {\r\n const z = this.spareGauss;\r\n this.spareGauss = null;\r\n return mean + stdev * z;\r\n }\r\n // Rejection-sample a point in the unit circle, then map to two normals.\r\n let u: number, v: number, s: number;\r\n do {\r\n u = this.gen.next() * 2 - 1;\r\n v = this.gen.next() * 2 - 1;\r\n s = u * u + v * v;\r\n } while (s >= 1 || s === 0);\r\n const mul = Math.sqrt(-2 * Math.log(s) / s);\r\n this.spareGauss = v * mul;\r\n return mean + stdev * (u * mul);\r\n }\r\n\r\n /**\r\n * Smooth 1-D value noise in `[0, 1]`.\r\n *\r\n * Samples two adjacent lattice points around `time * frequency`, then\r\n * interpolates with a smoothstep curve (`3t² - 2t³`) to avoid the linear\r\n * kinks of plain lerp. Unlike {@link nextFloat}/{@link gauss}, nearby\r\n * `time` inputs return nearby values — this is the correlated field used for\r\n * organic, continuously varying motion (camera shake, drift, waves).\r\n *\r\n * @param time Sample position (e.g. normalized timeline `[0, 1]`, or a\r\n * spatial index).\r\n * @param frequency Scales `time` before sampling; higher = faster\r\n * oscillation / more crests across the same span.\r\n */\r\n noise(time: number, frequency: number = 1): number {\r\n const t = time * frequency;\r\n const i = Math.floor(t);\r\n const f = t - i;\r\n // Smoothstep: maps f through 3f²-2f³ to ease in/out between lattice points.\r\n const curve = f * f * (3 - 2 * f);\r\n const r1 = this.latticeValue(i);\r\n const r2 = this.latticeValue(i + 1);\r\n return r1 + (r2 - r1) * curve;\r\n }\r\n\r\n /**\r\n * Rewind this source so the next draws reproduce a sequence from the start.\r\n *\r\n * With no argument, rewinds to the current {@link seed} — what authors call to\r\n * repeat a sequence within a scene. Pass a `seed` to adopt it as the new origin\r\n * first (equivalent to assigning {@link seed}), so the source both re-seeds and\r\n * rewinds in one call — e.g. in a node's constructor to give it a distinct\r\n * reproducible stream.\r\n */\r\n reset(seed: string | number = this._seed): void {\r\n this.adopt(seed);\r\n }\r\n\r\n /**\r\n * Deterministic value in `[0, 1)` for a given integer lattice point `x`,\r\n * mixed with this source's seed via `sin`. Pure in `x` (no generator state),\r\n * so {@link noise} is stable regardless of how many draws preceded it.\r\n */\r\n private latticeValue(x: number): number {\r\n const h = Math.sin(x + this.numericSeed) * 10000;\r\n return h - Math.floor(h);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reference.js","sourceRoot":"","sources":["../../src/util/reference.ts"],"names":[],"mappings":"AAiDA;;;GAGG;AACH,MAAM,UAAU,SAAS;IACrB,IAAI,OAAO,GAAa,IAAI,CAAC;IAI7B,SAAS,GAAG,CAAC,IAAe;QACxB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,GAAG,IAAI,CAAC;QACnB,CAAC;aAAM,CAAC;YACJ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAClD,CAAC;YACD,OAAO,OAAO,CAAC;QACnB,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["/**\n * A callable reference that acts as both getter and setter.\n * - `ref()` → returns the current value (throws if not yet assigned)\n * - `ref(value)` → sets the current value\n */\nexport interface Reference<T> {\n (): T;\n (node: T | null): void;\n /**\n * Phantom — never assigned at runtime, and never called. It exists so that\n * `T` appears in a *contravariant* position, which is what makes\n * {@link RefTarget} safe. The call signatures alone can't decide it: the\n * zero-arg getter `(): T` is assignable to any `(x) => void`, so a slot\n * typed as just the setter would silently accept a `Reference` of an\n * unrelated node type.\n * @internal\n */\n readonly __accepts?: (node: T) => void;\n}\n\n/**\n * A slot that can *receive* a `T` — a `Reference<T>`, or one declared as any\n * **supertype** of `T`.\n *\n * This is the type a node's `ref` prop takes, and the widening is deliberate:\n * the framework only ever writes into a ref (`props.ref(this)` in the `Node2D`\n * constructor) and the author only ever reads, so handing a `Rect` to a\n * `Reference<ShapeNode>` is sound in both directions — the write stores a\n * subtype, the read yields the supertype the author asked for. That is what\n * lets one ref hold whichever shape a factory happened to build:\n *\n * ```tsx\n * const ref = createRef<ShapeNode>();\n * <Rect ref={ref} /> // ✔ Rect is a ShapeNode\n * <Ellipse ref={ref} /> // ✔ so is Ellipse\n * ```\n *\n * The opposite direction stays an error, because it is the unsound one: a\n * `Reference<Rect>` on a `<Text>` would be handed a `Text` at runtime while\n * still typing every read as a `Rect`.\n *\n * A plain setter function is accepted too, which makes React-style callback\n * refs (`ref={n => …}`) work without a separate type.\n */\nexport type RefTarget<T> = {\n (node: T | null): void;\n readonly __accepts?: (node: T) => void;\n};\n\n/**\n * Creates a typed reference holder — analogous to React's `createRef`,\n * but expressed as a single overloaded function rather than a `{ current }` object.\n */\nexport function createRef<T>(): Reference<T> {\n let current: T | null = null;\n\n function ref(): T;\n function ref(node: T | null): void;\n function ref(node?: T | null): T | void {\n if (node !== undefined) {\n current = node;\n } else {\n if (current === null) {\n throw new Error(\"Reference not assigned yet\");\n }\n return current;\n }\n }\n\n return ref;\n}\n"]}
1
+ {"version":3,"file":"reference.js","sourceRoot":"","sources":["../../src/util/reference.ts"],"names":[],"mappings":"AAiDA;;;GAGG;AACH,MAAM,UAAU,SAAS;IACrB,IAAI,OAAO,GAAa,IAAI,CAAC;IAI7B,SAAS,GAAG,CAAC,IAAe;QACxB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,GAAG,IAAI,CAAC;QACnB,CAAC;aAAM,CAAC;YACJ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAClD,CAAC;YACD,OAAO,OAAO,CAAC;QACnB,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["/**\r\n * A callable reference that acts as both getter and setter.\r\n * - `ref()` → returns the current value (throws if not yet assigned)\r\n * - `ref(value)` → sets the current value\r\n */\r\nexport interface Reference<T> {\r\n (): T;\r\n (node: T | null): void;\r\n /**\r\n * Phantom — never assigned at runtime, and never called. It exists so that\r\n * `T` appears in a *contravariant* position, which is what makes\r\n * {@link RefTarget} safe. The call signatures alone can't decide it: the\r\n * zero-arg getter `(): T` is assignable to any `(x) => void`, so a slot\r\n * typed as just the setter would silently accept a `Reference` of an\r\n * unrelated node type.\r\n * @internal\r\n */\r\n readonly __accepts?: (node: T) => void;\r\n}\r\n\r\n/**\r\n * A slot that can *receive* a `T` — a `Reference<T>`, or one declared as any\r\n * **supertype** of `T`.\r\n *\r\n * This is the type a node's `ref` prop takes, and the widening is deliberate:\r\n * the framework only ever writes into a ref (`props.ref(this)` in the `Node2D`\r\n * constructor) and the author only ever reads, so handing a `Rect` to a\r\n * `Reference<ShapeNode>` is sound in both directions — the write stores a\r\n * subtype, the read yields the supertype the author asked for. That is what\r\n * lets one ref hold whichever shape a factory happened to build:\r\n *\r\n * ```tsx\r\n * const ref = createRef<ShapeNode>();\r\n * <Rect ref={ref} /> // ✔ Rect is a ShapeNode\r\n * <Ellipse ref={ref} /> // ✔ so is Ellipse\r\n * ```\r\n *\r\n * The opposite direction stays an error, because it is the unsound one: a\r\n * `Reference<Rect>` on a `<Text>` would be handed a `Text` at runtime while\r\n * still typing every read as a `Rect`.\r\n *\r\n * A plain setter function is accepted too, which makes React-style callback\r\n * refs (`ref={n => …}`) work without a separate type.\r\n */\r\nexport type RefTarget<T> = {\r\n (node: T | null): void;\r\n readonly __accepts?: (node: T) => void;\r\n};\r\n\r\n/**\r\n * Creates a typed reference holder — analogous to React's `createRef`,\r\n * but expressed as a single overloaded function rather than a `{ current }` object.\r\n */\r\nexport function createRef<T>(): Reference<T> {\r\n let current: T | null = null;\r\n\r\n function ref(): T;\r\n function ref(node: T | null): void;\r\n function ref(node?: T | null): T | void {\r\n if (node !== undefined) {\r\n current = node;\r\n } else {\r\n if (current === null) {\r\n throw new Error(\"Reference not assigned yet\");\r\n }\r\n return current;\r\n }\r\n }\r\n\r\n return ref;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../src/util/scheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,kFAAkF;AAClF,MAAM,UAAU,GAAG;IACf,OAAO,OAAO,WAAW,KAAK,WAAW,IAAI,OAAO,WAAW,CAAC,GAAG,KAAK,UAAU;QAC9E,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE;QACnB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAID,8EAA8E;AAC9E,SAAS,WAAW;IAChB,MAAM,CAAC,GAAI,UAAiD,CAAC,SAAS,CAAC;IACvE,OAAO,OAAO,CAAC,EAAE,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,IAAI,OAAO,GAA0B,IAAI,CAAC;AAC1C,MAAM,KAAK,GAAmB,EAAE,CAAC;AAEjC,SAAS,mBAAmB;IACxB,IAAI,OAAO,cAAc,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IACtD,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC;QAClD,uEAAuE;QACvE,6DAA6D;QAC5D,OAAO,CAAC,KAA2C,CAAC,KAAK,EAAE,EAAE,CAAC;QAC9D,OAAO,CAAC,KAA2C,CAAC,KAAK,EAAE,EAAE,CAAC;IACnE,CAAC;IACD,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;QAC/B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,OAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB;IAC5B,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,IAAI,MAAM;QAAE,OAAO,MAAM,EAAE,CAAC;IAC5B,OAAO,mBAAmB,EAAE,IAAI,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,wBAAwB;IACpC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,OAAO,GAAG,IAAI,CAAC;IACf,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Event-loop yielding, for work that must stay interruptible.\n *\n * A long synchronous loop on the main thread cannot be cancelled: nothing else\n * can run to *ask* it to stop. `StateEvaluator`'s backward-seek replay is\n * exactly that shape, so it yields periodically through {@link yieldToScheduler}\n * — which is what lets a newer seek supersede one already in flight.\n *\n * Core is backend-agnostic (no DOM), so every mechanism here is feature-detected\n * and the module works unchanged in a browser, in Node, and under vitest.\n */\n\n/** Monotonic-ish clock in milliseconds. `performance` is absent in some hosts. */\nexport function now(): number {\n return typeof performance !== \"undefined\" && typeof performance.now === \"function\"\n ? performance.now()\n : Date.now();\n}\n\ntype SchedulerWithYield = { yield?: () => Promise<void> };\n\n/** `scheduler.yield()` when the host has it (Chrome 129+), else undefined. */\nfunction nativeYield(): (() => Promise<void>) | undefined {\n const s = (globalThis as { scheduler?: SchedulerWithYield }).scheduler;\n return typeof s?.yield === \"function\" ? s.yield.bind(s) : undefined;\n}\n\n/**\n * A single shared `MessageChannel`, because a yield-per-channel would allocate\n * (and leak until GC) thousands of ports over one scrub. Callbacks queue in FIFO\n * order and each posted message drains exactly one, so resolution order matches\n * call order.\n */\nlet channel: MessageChannel | null = null;\nconst queue: (() => void)[] = [];\n\nfunction messageChannelYield(): Promise<void> | null {\n if (typeof MessageChannel !== \"function\") return null;\n if (!channel) {\n channel = new MessageChannel();\n channel.port1.onmessage = () => queue.shift()?.();\n // Node2D keeps the event loop alive for an open port, which would hang\n // vitest on exit. Browsers have no unref and don't need one.\n (channel.port1 as unknown as { unref?: () => void }).unref?.();\n (channel.port2 as unknown as { unref?: () => void }).unref?.();\n }\n return new Promise<void>(resolve => {\n queue.push(resolve);\n channel!.port2.postMessage(null);\n });\n}\n\n/**\n * Yield to the event loop, letting pending input, timers and rendering run\n * before the caller resumes.\n *\n * Deliberately a **macrotask**, not a microtask: `await Promise.resolve()`\n * drains within the same task and would starve exactly the work we're yielding\n * for. `requestAnimationFrame` is also wrong here — it caps throughput to the\n * display rate and stops entirely in a background tab, which would stall\n * headless export and tests.\n *\n * Preference order:\n * 1. `scheduler.yield()` — resumes at continuation priority, so a sliced task\n * isn't starved behind unrelated work queued while it was parked.\n * 2. `MessageChannel` — a true macrotask with no clamping, in browsers and\n * Node2D ≥ 15.\n * 3. `setTimeout(0)` — last resort; clamps to ~4 ms once nested, capping the\n * slice rate, but always available.\n */\nexport function yieldToScheduler(): Promise<void> {\n const native = nativeYield();\n if (native) return native();\n return messageChannelYield() ?? new Promise<void>(resolve => setTimeout(resolve, 0));\n}\n\n/** Drop the shared channel. Tests only — the next yield lazily rebuilds it. */\nexport function __resetSchedulerForTests(): void {\n channel?.port1.close();\n channel?.port2.close();\n channel = null;\n queue.length = 0;\n}\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C,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB;IAC5B,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,IAAI,MAAM;QAAE,OAAO,MAAM,EAAE,CAAC;IAC5B,OAAO,mBAAmB,EAAE,IAAI,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,wBAAwB;IACpC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,OAAO,GAAG,IAAI,CAAC;IACf,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACrB,CAAC","sourcesContent":["/**\r\n * Event-loop yielding, for work that must stay interruptible.\r\n *\r\n * A long synchronous loop on the main thread cannot be cancelled: nothing else\r\n * can run to *ask* it to stop. `StateEvaluator`'s backward-seek replay is\r\n * exactly that shape, so it yields periodically through {@link yieldToScheduler}\r\n * — which is what lets a newer seek supersede one already in flight.\r\n *\r\n * Core is backend-agnostic (no DOM), so every mechanism here is feature-detected\r\n * and the module works unchanged in a browser, in Node, and under vitest.\r\n */\r\n\r\n/** Monotonic-ish clock in milliseconds. `performance` is absent in some hosts. */\r\nexport function now(): number {\r\n return typeof performance !== \"undefined\" && typeof performance.now === \"function\"\r\n ? performance.now()\r\n : Date.now();\r\n}\r\n\r\ntype SchedulerWithYield = { yield?: () => Promise<void> };\r\n\r\n/** `scheduler.yield()` when the host has it (Chrome 129+), else undefined. */\r\nfunction nativeYield(): (() => Promise<void>) | undefined {\r\n const s = (globalThis as { scheduler?: SchedulerWithYield }).scheduler;\r\n return typeof s?.yield === \"function\" ? s.yield.bind(s) : undefined;\r\n}\r\n\r\n/**\r\n * A single shared `MessageChannel`, because a yield-per-channel would allocate\r\n * (and leak until GC) thousands of ports over one scrub. Callbacks queue in FIFO\r\n * order and each posted message drains exactly one, so resolution order matches\r\n * call order.\r\n */\r\nlet channel: MessageChannel | null = null;\r\nconst queue: (() => void)[] = [];\r\n\r\nfunction messageChannelYield(): Promise<void> | null {\r\n if (typeof MessageChannel !== \"function\") return null;\r\n if (!channel) {\r\n channel = new MessageChannel();\r\n channel.port1.onmessage = () => queue.shift()?.();\r\n // Node2D keeps the event loop alive for an open port, which would hang\r\n // vitest on exit. Browsers have no unref and don't need one.\r\n (channel.port1 as unknown as { unref?: () => void }).unref?.();\r\n (channel.port2 as unknown as { unref?: () => void }).unref?.();\r\n }\r\n return new Promise<void>(resolve => {\r\n queue.push(resolve);\r\n channel!.port2.postMessage(null);\r\n });\r\n}\r\n\r\n/**\r\n * Yield to the event loop, letting pending input, timers and rendering run\r\n * before the caller resumes.\r\n *\r\n * Deliberately a **macrotask**, not a microtask: `await Promise.resolve()`\r\n * drains within the same task and would starve exactly the work we're yielding\r\n * for. `requestAnimationFrame` is also wrong here — it caps throughput to the\r\n * display rate and stops entirely in a background tab, which would stall\r\n * headless export and tests.\r\n *\r\n * Preference order:\r\n * 1. `scheduler.yield()` — resumes at continuation priority, so a sliced task\r\n * isn't starved behind unrelated work queued while it was parked.\r\n * 2. `MessageChannel` — a true macrotask with no clamping, in browsers and\r\n * Node2D ≥ 15.\r\n * 3. `setTimeout(0)` — last resort; clamps to ~4 ms once nested, capping the\r\n * slice rate, but always available.\r\n */\r\nexport function yieldToScheduler(): Promise<void> {\r\n const native = nativeYield();\r\n if (native) return native();\r\n return messageChannelYield() ?? new Promise<void>(resolve => setTimeout(resolve, 0));\r\n}\r\n\r\n/** Drop the shared channel. Tests only — the next yield lazily rebuilds it. */\r\nexport function __resetSchedulerForTests(): void {\r\n channel?.port1.close();\r\n channel?.port2.close();\r\n channel = null;\r\n queue.length = 0;\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motionscript/core",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.5",
4
4
  "type": "module",
5
5
  "description": "Engine-agnostic animation library for Motion Script: scenes, nodes, props, tweens, layout, and the JSX runtime.",
6
6
  "repository": {
@@ -25,6 +25,7 @@
25
25
  "types": "dist/index.d.ts",
26
26
  "sideEffects": false,
27
27
  "files": [
28
+ "NOTICE",
28
29
  "dist",
29
30
  "CHANGELOG.md",
30
31
  "!dist/**/*.tsbuildinfo"