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

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 (615) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +2 -4
  3. package/dist/assets/errors.js +4 -5
  4. package/dist/assets/errors.js.map +1 -1
  5. package/dist/assets/scope.d.ts +1 -1
  6. package/dist/assets/scope.d.ts.map +1 -1
  7. package/dist/assets/scope.js +1 -1
  8. package/dist/assets/scope.js.map +1 -1
  9. package/dist/attributes/audio/schedule.d.ts +3 -18
  10. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  11. package/dist/attributes/audio/schedule.js.map +1 -1
  12. package/dist/attributes/index.d.ts +3 -5
  13. package/dist/attributes/index.d.ts.map +1 -1
  14. package/dist/attributes/index.js +2 -2
  15. package/dist/attributes/index.js.map +1 -1
  16. package/dist/attributes/layout/insets.d.ts +1 -1
  17. package/dist/attributes/layout/insets.js.map +1 -1
  18. package/dist/attributes/layout/size.d.ts +1 -1
  19. package/dist/attributes/layout/size.js +1 -1
  20. package/dist/attributes/layout/size.js.map +1 -1
  21. package/dist/attributes/properties/decorator.d.ts +44 -11
  22. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  23. package/dist/attributes/properties/decorator.js +37 -9
  24. package/dist/attributes/properties/decorator.js.map +1 -1
  25. package/dist/attributes/properties/inputs.d.ts +1 -1
  26. package/dist/attributes/properties/inputs.js +1 -1
  27. package/dist/attributes/properties/inputs.js.map +1 -1
  28. package/dist/attributes/properties/typed.d.ts +19 -140
  29. package/dist/attributes/properties/typed.d.ts.map +1 -1
  30. package/dist/attributes/properties/typed.js +12 -108
  31. package/dist/attributes/properties/typed.js.map +1 -1
  32. package/dist/attributes/shape/corners/corner-radius.d.ts +1 -1
  33. package/dist/attributes/shape/corners/corner-radius.js +1 -1
  34. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  35. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +1 -1
  36. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  37. package/dist/attributes/shape/fill/color/parser.d.ts +1 -1
  38. package/dist/attributes/shape/fill/color/parser.js +1 -1
  39. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  40. package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -2
  41. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  42. package/dist/attributes/shape/fill/implementations/shader.d.ts +2 -2
  43. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  44. package/dist/attributes/shape/fill/implementations/video.d.ts +1 -1
  45. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  46. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  47. package/dist/attributes/shape/fill/lerp.d.ts +1 -1
  48. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  49. package/dist/attributes/shape/filters/chain.d.ts +1 -1
  50. package/dist/attributes/shape/filters/chain.js +1 -1
  51. package/dist/attributes/shape/filters/chain.js.map +1 -1
  52. package/dist/attributes/shape/filters/union.d.ts +4 -3
  53. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  54. package/dist/attributes/shape/filters/union.js.map +1 -1
  55. package/dist/attributes/shape/path/ops.d.ts +1 -2
  56. package/dist/attributes/shape/path/ops.d.ts.map +1 -1
  57. package/dist/attributes/shape/path/ops.js.map +1 -1
  58. package/dist/attributes/shared/operators.d.ts +2 -2
  59. package/dist/attributes/shared/operators.js.map +1 -1
  60. package/dist/attributes/text/types.d.ts +2 -3
  61. package/dist/attributes/text/types.d.ts.map +1 -1
  62. package/dist/attributes/text/types.js.map +1 -1
  63. package/dist/browser/chunks/chunk-D4FSTPML.js +14 -0
  64. package/dist/browser/chunks/chunk-D4FSTPML.js.map +7 -0
  65. package/dist/browser/chunks/chunk-LKUYVFU3.js +2 -0
  66. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +7 -0
  67. package/dist/browser/chunks/chunk-RTNATFWX.js +5 -0
  68. package/dist/browser/chunks/chunk-RTNATFWX.js.map +7 -0
  69. package/dist/browser/chunks/chunk-ZRPZPWZU.js +3 -0
  70. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +7 -0
  71. package/dist/browser/component.js +1 -1
  72. package/dist/browser/component.js.map +4 -4
  73. package/dist/browser/experimental.js +2 -0
  74. package/dist/browser/index.js +1 -1
  75. package/dist/browser/index.js.map +4 -4
  76. package/dist/browser/manifest.json +3 -4
  77. package/dist/browser/sdk.js +1 -1
  78. package/dist/component/api.d.ts +508 -0
  79. package/dist/component/api.d.ts.map +1 -0
  80. package/dist/component/api.js +4 -0
  81. package/dist/component/api.js.map +1 -0
  82. package/dist/component/builtins/audio.d.ts +26 -0
  83. package/dist/component/builtins/audio.d.ts.map +1 -0
  84. package/dist/component/builtins/audio.js +41 -0
  85. package/dist/component/builtins/audio.js.map +1 -0
  86. package/dist/component/builtins/canvas3d.d.ts +98 -0
  87. package/dist/component/builtins/canvas3d.d.ts.map +1 -0
  88. package/dist/component/builtins/canvas3d.js +21 -0
  89. package/dist/component/builtins/canvas3d.js.map +1 -0
  90. package/dist/component/builtins/composite.d.ts +56 -0
  91. package/dist/component/builtins/composite.d.ts.map +1 -0
  92. package/dist/component/builtins/composite.js +25 -0
  93. package/dist/component/builtins/composite.js.map +1 -0
  94. package/dist/component/builtins/geometry.d.ts +505 -0
  95. package/dist/component/builtins/geometry.d.ts.map +1 -0
  96. package/dist/component/builtins/geometry.js +107 -0
  97. package/dist/component/builtins/geometry.js.map +1 -0
  98. package/dist/component/builtins/layout.d.ts +88 -0
  99. package/dist/component/builtins/layout.d.ts.map +1 -0
  100. package/dist/component/builtins/layout.js +84 -0
  101. package/dist/component/builtins/layout.js.map +1 -0
  102. package/dist/component/builtins/media.d.ts +95 -0
  103. package/dist/component/builtins/media.d.ts.map +1 -0
  104. package/dist/component/builtins/media.js +149 -0
  105. package/dist/component/builtins/media.js.map +1 -0
  106. package/dist/component/builtins/providers.d.ts +23 -0
  107. package/dist/component/builtins/providers.d.ts.map +1 -0
  108. package/dist/component/builtins/providers.js +30 -0
  109. package/dist/component/builtins/providers.js.map +1 -0
  110. package/dist/component/builtins/text.d.ts +193 -0
  111. package/dist/component/builtins/text.d.ts.map +1 -0
  112. package/dist/component/builtins/text.js +113 -0
  113. package/dist/component/builtins/text.js.map +1 -0
  114. package/dist/component/builtins/three.d.ts +1085 -0
  115. package/dist/component/builtins/three.d.ts.map +1 -0
  116. package/dist/component/builtins/three.js +265 -0
  117. package/dist/component/builtins/three.js.map +1 -0
  118. package/dist/component/clip-of.d.ts +5 -0
  119. package/dist/component/clip-of.d.ts.map +1 -0
  120. package/dist/component/clip-of.js +33 -0
  121. package/dist/component/clip-of.js.map +1 -0
  122. package/dist/component/commands-for.d.ts +19 -0
  123. package/dist/component/commands-for.d.ts.map +1 -0
  124. package/dist/component/commands-for.js +5 -0
  125. package/dist/component/commands-for.js.map +1 -0
  126. package/dist/component/component-audio.d.ts +9 -0
  127. package/dist/component/component-audio.d.ts.map +1 -0
  128. package/dist/component/component-audio.js +18 -0
  129. package/dist/component/component-audio.js.map +1 -0
  130. package/dist/component/component2d.d.ts +9 -0
  131. package/dist/component/component2d.d.ts.map +1 -0
  132. package/dist/component/component2d.js +239 -0
  133. package/dist/component/component2d.js.map +1 -0
  134. package/dist/component/component3d.d.ts +9 -0
  135. package/dist/component/component3d.d.ts.map +1 -0
  136. package/dist/component/component3d.js +99 -0
  137. package/dist/component/component3d.js.map +1 -0
  138. package/dist/component/factory.d.ts +63 -0
  139. package/dist/component/factory.d.ts.map +1 -0
  140. package/dist/component/factory.js +313 -0
  141. package/dist/component/factory.js.map +1 -0
  142. package/dist/component/modules/aim.d.ts +30 -0
  143. package/dist/component/modules/aim.d.ts.map +1 -0
  144. package/dist/component/modules/aim.js +39 -0
  145. package/dist/component/modules/aim.js.map +1 -0
  146. package/dist/component/modules/corners.d.ts +13 -0
  147. package/dist/component/modules/corners.d.ts.map +1 -0
  148. package/dist/component/modules/corners.js +12 -0
  149. package/dist/component/modules/corners.js.map +1 -0
  150. package/dist/component/modules/flow.d.ts +26 -0
  151. package/dist/component/modules/flow.d.ts.map +1 -0
  152. package/dist/component/modules/flow.js +55 -0
  153. package/dist/component/modules/flow.js.map +1 -0
  154. package/dist/component/modules/material.d.ts +40 -0
  155. package/dist/component/modules/material.d.ts.map +1 -0
  156. package/dist/component/modules/material.js +75 -0
  157. package/dist/component/modules/material.js.map +1 -0
  158. package/dist/component/modules/paint.d.ts +71 -0
  159. package/dist/component/modules/paint.d.ts.map +1 -0
  160. package/dist/component/modules/paint.js +106 -0
  161. package/dist/component/modules/paint.js.map +1 -0
  162. package/dist/component/modules/shapes.d.ts +31 -0
  163. package/dist/component/modules/shapes.d.ts.map +1 -0
  164. package/dist/component/modules/shapes.js +43 -0
  165. package/dist/component/modules/shapes.js.map +1 -0
  166. package/dist/component/modules/text-layout.d.ts +26 -0
  167. package/dist/component/modules/text-layout.d.ts.map +1 -0
  168. package/dist/component/modules/text-layout.js +57 -0
  169. package/dist/component/modules/text-layout.js.map +1 -0
  170. package/dist/component/modules/text-style.d.ts +48 -0
  171. package/dist/component/modules/text-style.d.ts.map +1 -0
  172. package/dist/component/modules/text-style.js +63 -0
  173. package/dist/component/modules/text-style.js.map +1 -0
  174. package/dist/component/modules/three-entries.d.ts +23 -0
  175. package/dist/component/modules/three-entries.d.ts.map +1 -0
  176. package/dist/component/modules/three-entries.js +41 -0
  177. package/dist/component/modules/three-entries.js.map +1 -0
  178. package/dist/component/modules/view3d.d.ts +55 -0
  179. package/dist/component/modules/view3d.d.ts.map +1 -0
  180. package/dist/component/modules/view3d.js +160 -0
  181. package/dist/component/modules/view3d.js.map +1 -0
  182. package/dist/component/timeline.d.ts +22 -0
  183. package/dist/component/timeline.d.ts.map +1 -0
  184. package/dist/component/timeline.js +128 -0
  185. package/dist/component/timeline.js.map +1 -0
  186. package/dist/component/type-def.d.ts +26 -0
  187. package/dist/component/type-def.d.ts.map +1 -0
  188. package/dist/component/type-def.js +16 -0
  189. package/dist/component/type-def.js.map +1 -0
  190. package/dist/component/types.d.ts +91 -0
  191. package/dist/component/types.d.ts.map +1 -0
  192. package/dist/component/types.js +88 -0
  193. package/dist/component/types.js.map +1 -0
  194. package/dist/component/views.d.ts +121 -0
  195. package/dist/component/views.d.ts.map +1 -0
  196. package/dist/component/views.js +413 -0
  197. package/dist/component/views.js.map +1 -0
  198. package/dist/component.d.ts +10 -19
  199. package/dist/component.d.ts.map +1 -1
  200. package/dist/component.js +10 -19
  201. package/dist/component.js.map +1 -1
  202. package/dist/components/builtins/audio/audio.d.ts +53 -0
  203. package/dist/components/builtins/audio/audio.d.ts.map +1 -0
  204. package/dist/components/builtins/audio/audio.js +41 -0
  205. package/dist/components/builtins/audio/audio.js.map +1 -0
  206. package/dist/components/builtins/geometry/composite.d.ts +93 -0
  207. package/dist/components/builtins/geometry/composite.d.ts.map +1 -0
  208. package/dist/components/builtins/geometry/composite.js +25 -0
  209. package/dist/components/builtins/geometry/composite.js.map +1 -0
  210. package/dist/components/builtins/geometry/geometry.d.ts +921 -0
  211. package/dist/components/builtins/geometry/geometry.d.ts.map +1 -0
  212. package/dist/components/builtins/geometry/geometry.js +107 -0
  213. package/dist/components/builtins/geometry/geometry.js.map +1 -0
  214. package/dist/components/builtins/geometry/shape-outline.d.ts +93 -0
  215. package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -0
  216. package/dist/components/builtins/geometry/shape-outline.js +470 -0
  217. package/dist/components/builtins/geometry/shape-outline.js.map +1 -0
  218. package/dist/components/builtins/layout/layout.d.ts +186 -0
  219. package/dist/components/builtins/layout/layout.d.ts.map +1 -0
  220. package/dist/components/builtins/layout/layout.js +84 -0
  221. package/dist/components/builtins/layout/layout.js.map +1 -0
  222. package/dist/components/builtins/media/media.d.ts +240 -0
  223. package/dist/components/builtins/media/media.d.ts.map +1 -0
  224. package/dist/components/builtins/media/media.js +149 -0
  225. package/dist/components/builtins/media/media.js.map +1 -0
  226. package/dist/components/builtins/providers/providers.d.ts +47 -0
  227. package/dist/components/builtins/providers/providers.d.ts.map +1 -0
  228. package/dist/components/builtins/providers/providers.js +30 -0
  229. package/dist/components/builtins/providers/providers.js.map +1 -0
  230. package/dist/components/builtins/text/number-format.d.ts +66 -0
  231. package/dist/components/builtins/text/number-format.d.ts.map +1 -0
  232. package/dist/components/builtins/text/number-format.js +227 -0
  233. package/dist/components/builtins/text/number-format.js.map +1 -0
  234. package/dist/components/builtins/text/number-pattern.d.ts +51 -0
  235. package/dist/components/builtins/text/number-pattern.d.ts.map +1 -0
  236. package/dist/components/builtins/text/number-pattern.js +77 -0
  237. package/dist/components/builtins/text/number-pattern.js.map +1 -0
  238. package/dist/components/builtins/text/text-defaults.d.ts +32 -0
  239. package/dist/components/builtins/text/text-defaults.d.ts.map +1 -0
  240. package/dist/components/builtins/text/text-defaults.js +37 -0
  241. package/dist/components/builtins/text/text-defaults.js.map +1 -0
  242. package/dist/components/builtins/text/text-layout.d.ts +82 -0
  243. package/dist/components/builtins/text/text-layout.d.ts.map +1 -0
  244. package/dist/components/builtins/text/text-layout.js +331 -0
  245. package/dist/components/builtins/text/text-layout.js.map +1 -0
  246. package/dist/components/builtins/text/text.d.ts +409 -0
  247. package/dist/components/builtins/text/text.d.ts.map +1 -0
  248. package/dist/components/builtins/text/text.js +113 -0
  249. package/dist/components/builtins/text/text.js.map +1 -0
  250. package/dist/components/builtins/three/canvas3d.d.ts +245 -0
  251. package/dist/components/builtins/three/canvas3d.d.ts.map +1 -0
  252. package/dist/components/builtins/three/canvas3d.js +21 -0
  253. package/dist/components/builtins/three/canvas3d.js.map +1 -0
  254. package/dist/components/builtins/three/grid-geometry3d.d.ts +62 -0
  255. package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -0
  256. package/dist/components/builtins/three/grid-geometry3d.js +114 -0
  257. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -0
  258. package/dist/components/builtins/three/three.d.ts +1889 -0
  259. package/dist/components/builtins/three/three.d.ts.map +1 -0
  260. package/dist/components/builtins/three/three.js +305 -0
  261. package/dist/components/builtins/three/three.js.map +1 -0
  262. package/dist/components/factory/api.d.ts +516 -0
  263. package/dist/components/factory/api.d.ts.map +1 -0
  264. package/dist/components/factory/api.js +4 -0
  265. package/dist/components/factory/api.js.map +1 -0
  266. package/dist/components/factory/clip-of.d.ts +5 -0
  267. package/dist/components/factory/clip-of.d.ts.map +1 -0
  268. package/dist/components/factory/clip-of.js +33 -0
  269. package/dist/components/factory/clip-of.js.map +1 -0
  270. package/dist/components/factory/commands-for.d.ts +19 -0
  271. package/dist/components/factory/commands-for.d.ts.map +1 -0
  272. package/dist/components/factory/commands-for.js +5 -0
  273. package/dist/components/factory/commands-for.js.map +1 -0
  274. package/dist/components/factory/component-audio.d.ts +9 -0
  275. package/dist/components/factory/component-audio.d.ts.map +1 -0
  276. package/dist/components/factory/component-audio.js +18 -0
  277. package/dist/components/factory/component-audio.js.map +1 -0
  278. package/dist/components/factory/component2d.d.ts +8 -0
  279. package/dist/components/factory/component2d.d.ts.map +1 -0
  280. package/dist/components/factory/component2d.js +240 -0
  281. package/dist/components/factory/component2d.js.map +1 -0
  282. package/dist/components/factory/component3d.d.ts +9 -0
  283. package/dist/components/factory/component3d.d.ts.map +1 -0
  284. package/dist/components/factory/component3d.js +99 -0
  285. package/dist/components/factory/component3d.js.map +1 -0
  286. package/dist/components/factory/factory.d.ts +63 -0
  287. package/dist/components/factory/factory.d.ts.map +1 -0
  288. package/dist/components/factory/factory.js +313 -0
  289. package/dist/components/factory/factory.js.map +1 -0
  290. package/dist/components/factory/timeline.d.ts +22 -0
  291. package/dist/components/factory/timeline.d.ts.map +1 -0
  292. package/dist/components/factory/timeline.js +128 -0
  293. package/dist/components/factory/timeline.js.map +1 -0
  294. package/dist/components/factory/type-def.d.ts +26 -0
  295. package/dist/components/factory/type-def.d.ts.map +1 -0
  296. package/dist/components/factory/type-def.js +16 -0
  297. package/dist/components/factory/type-def.js.map +1 -0
  298. package/dist/components/factory/types.d.ts +91 -0
  299. package/dist/components/factory/types.d.ts.map +1 -0
  300. package/dist/components/factory/types.js +88 -0
  301. package/dist/components/factory/types.js.map +1 -0
  302. package/dist/components/factory/views.d.ts +121 -0
  303. package/dist/components/factory/views.d.ts.map +1 -0
  304. package/dist/components/factory/views.js +413 -0
  305. package/dist/components/factory/views.js.map +1 -0
  306. package/dist/components/modules/aim.d.ts +30 -0
  307. package/dist/components/modules/aim.d.ts.map +1 -0
  308. package/dist/components/modules/aim.js +39 -0
  309. package/dist/components/modules/aim.js.map +1 -0
  310. package/dist/components/modules/corners.d.ts +13 -0
  311. package/dist/components/modules/corners.d.ts.map +1 -0
  312. package/dist/components/modules/corners.js +12 -0
  313. package/dist/components/modules/corners.js.map +1 -0
  314. package/dist/components/modules/flow.d.ts +26 -0
  315. package/dist/components/modules/flow.d.ts.map +1 -0
  316. package/dist/components/modules/flow.js +57 -0
  317. package/dist/components/modules/flow.js.map +1 -0
  318. package/dist/components/modules/material.d.ts +40 -0
  319. package/dist/components/modules/material.d.ts.map +1 -0
  320. package/dist/components/modules/material.js +75 -0
  321. package/dist/components/modules/material.js.map +1 -0
  322. package/dist/components/modules/paint.d.ts +71 -0
  323. package/dist/components/modules/paint.d.ts.map +1 -0
  324. package/dist/components/modules/paint.js +106 -0
  325. package/dist/components/modules/paint.js.map +1 -0
  326. package/dist/components/modules/shapes.d.ts +31 -0
  327. package/dist/components/modules/shapes.d.ts.map +1 -0
  328. package/dist/components/modules/shapes.js +43 -0
  329. package/dist/components/modules/shapes.js.map +1 -0
  330. package/dist/components/modules/text-layout.d.ts +26 -0
  331. package/dist/components/modules/text-layout.d.ts.map +1 -0
  332. package/dist/components/modules/text-layout.js +57 -0
  333. package/dist/components/modules/text-layout.js.map +1 -0
  334. package/dist/components/modules/text-style.d.ts +48 -0
  335. package/dist/components/modules/text-style.d.ts.map +1 -0
  336. package/dist/components/modules/text-style.js +63 -0
  337. package/dist/components/modules/text-style.js.map +1 -0
  338. package/dist/components/modules/three-entries.d.ts +23 -0
  339. package/dist/components/modules/three-entries.d.ts.map +1 -0
  340. package/dist/components/modules/three-entries.js +41 -0
  341. package/dist/components/modules/three-entries.js.map +1 -0
  342. package/dist/components/modules/view3d.d.ts +59 -0
  343. package/dist/components/modules/view3d.d.ts.map +1 -0
  344. package/dist/components/modules/view3d.js +171 -0
  345. package/dist/components/modules/view3d.js.map +1 -0
  346. package/dist/components/trees/2d/group-bounds.d.ts +56 -0
  347. package/dist/components/trees/2d/group-bounds.d.ts.map +1 -0
  348. package/dist/components/trees/2d/group-bounds.js +87 -0
  349. package/dist/components/trees/2d/group-bounds.js.map +1 -0
  350. package/dist/components/trees/2d/node-lifecycle.d.ts +46 -0
  351. package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -0
  352. package/dist/components/trees/2d/node-lifecycle.js +264 -0
  353. package/dist/components/trees/2d/node-lifecycle.js.map +1 -0
  354. package/dist/components/trees/2d/node-motion.d.ts +56 -0
  355. package/dist/components/trees/2d/node-motion.d.ts.map +1 -0
  356. package/dist/components/trees/2d/node-motion.js +86 -0
  357. package/dist/components/trees/2d/node-motion.js.map +1 -0
  358. package/dist/components/trees/2d/node-render.d.ts +36 -0
  359. package/dist/components/trees/2d/node-render.d.ts.map +1 -0
  360. package/dist/components/trees/2d/node-render.js +67 -0
  361. package/dist/components/trees/2d/node-render.js.map +1 -0
  362. package/dist/components/trees/2d/node-space.d.ts +63 -0
  363. package/dist/components/trees/2d/node-space.d.ts.map +1 -0
  364. package/dist/components/trees/2d/node-space.js +131 -0
  365. package/dist/components/trees/2d/node-space.js.map +1 -0
  366. package/dist/components/trees/2d/node-transform.d.ts +55 -0
  367. package/dist/components/trees/2d/node-transform.d.ts.map +1 -0
  368. package/dist/components/trees/2d/node-transform.js +73 -0
  369. package/dist/components/trees/2d/node-transform.js.map +1 -0
  370. package/dist/components/trees/2d/node2d.d.ts +1020 -0
  371. package/dist/components/trees/2d/node2d.d.ts.map +1 -0
  372. package/dist/components/trees/2d/node2d.js +1481 -0
  373. package/dist/components/trees/2d/node2d.js.map +1 -0
  374. package/dist/components/trees/audio/index.d.ts +2 -0
  375. package/dist/components/trees/audio/index.d.ts.map +1 -0
  376. package/dist/components/trees/audio/index.js +2 -0
  377. package/dist/components/trees/audio/index.js.map +1 -0
  378. package/dist/components/trees/audio/node-audio.d.ts +109 -0
  379. package/dist/components/trees/audio/node-audio.d.ts.map +1 -0
  380. package/dist/components/trees/audio/node-audio.js +167 -0
  381. package/dist/components/trees/audio/node-audio.js.map +1 -0
  382. package/dist/components/trees/index.d.ts +10 -0
  383. package/dist/components/trees/index.d.ts.map +1 -0
  384. package/dist/components/trees/index.js +14 -0
  385. package/dist/components/trees/index.js.map +1 -0
  386. package/dist/components/trees/node/node-editor-state.d.ts +53 -0
  387. package/dist/components/trees/node/node-editor-state.d.ts.map +1 -0
  388. package/dist/components/trees/node/node-editor-state.js +23 -0
  389. package/dist/components/trees/node/node-editor-state.js.map +1 -0
  390. package/dist/components/trees/node/node-reactive.d.ts +89 -0
  391. package/dist/components/trees/node/node-reactive.d.ts.map +1 -0
  392. package/dist/components/trees/node/node-reactive.js +135 -0
  393. package/dist/components/trees/node/node-reactive.js.map +1 -0
  394. package/dist/components/trees/node/node-time.d.ts +39 -0
  395. package/dist/components/trees/node/node-time.d.ts.map +1 -0
  396. package/dist/components/trees/node/node-time.js +14 -0
  397. package/dist/components/trees/node/node-time.js.map +1 -0
  398. package/dist/components/trees/node/node-walk.d.ts +46 -0
  399. package/dist/components/trees/node/node-walk.d.ts.map +1 -0
  400. package/dist/components/trees/node/node-walk.js +74 -0
  401. package/dist/components/trees/node/node-walk.js.map +1 -0
  402. package/dist/components/trees/node/node.d.ts +401 -0
  403. package/dist/components/trees/node/node.d.ts.map +1 -0
  404. package/dist/components/trees/node/node.js +680 -0
  405. package/dist/components/trees/node/node.js.map +1 -0
  406. package/dist/components/trees/root/canvas2d-node.d.ts +163 -0
  407. package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -0
  408. package/dist/components/trees/root/canvas2d-node.js +216 -0
  409. package/dist/components/trees/root/canvas2d-node.js.map +1 -0
  410. package/dist/components/trees/three/node3d.d.ts +222 -0
  411. package/dist/components/trees/three/node3d.d.ts.map +1 -0
  412. package/dist/components/trees/three/node3d.js +289 -0
  413. package/dist/components/trees/three/node3d.js.map +1 -0
  414. package/dist/document/audio.d.ts +9 -1
  415. package/dist/document/audio.d.ts.map +1 -1
  416. package/dist/document/audio.js +41 -0
  417. package/dist/document/audio.js.map +1 -1
  418. package/dist/document/builtins.d.ts.map +1 -1
  419. package/dist/document/builtins.js +13 -31
  420. package/dist/document/builtins.js.map +1 -1
  421. package/dist/document/command-traits.d.ts +2 -2
  422. package/dist/document/command-traits.js +4 -1
  423. package/dist/document/command-traits.js.map +1 -1
  424. package/dist/document/deny-globals.d.ts +2 -2
  425. package/dist/document/deny-globals.js +2 -2
  426. package/dist/document/deny-globals.js.map +1 -1
  427. package/dist/document/diff.d.ts.map +1 -1
  428. package/dist/document/diff.js +3 -3
  429. package/dist/document/diff.js.map +1 -1
  430. package/dist/document/doc-index.d.ts.map +1 -1
  431. package/dist/document/doc-index.js +3 -3
  432. package/dist/document/doc-index.js.map +1 -1
  433. package/dist/document/expression/index.d.ts +1 -1
  434. package/dist/document/expression/index.js +1 -1
  435. package/dist/document/expression/index.js.map +1 -1
  436. package/dist/document/expression/ops.js +1 -1
  437. package/dist/document/expression/ops.js.map +1 -1
  438. package/dist/document/index.d.ts +1 -2
  439. package/dist/document/index.d.ts.map +1 -1
  440. package/dist/document/index.js +1 -2
  441. package/dist/document/index.js.map +1 -1
  442. package/dist/document/node-decorator.d.ts +14 -10
  443. package/dist/document/node-decorator.d.ts.map +1 -1
  444. package/dist/document/node-decorator.js +14 -10
  445. package/dist/document/node-decorator.js.map +1 -1
  446. package/dist/document/node-descriptor.d.ts +9 -3
  447. package/dist/document/node-descriptor.d.ts.map +1 -1
  448. package/dist/document/node-descriptor.js.map +1 -1
  449. package/dist/document/placement.js +2 -2
  450. package/dist/document/placement.js.map +1 -1
  451. package/dist/document/registry.d.ts +29 -36
  452. package/dist/document/registry.d.ts.map +1 -1
  453. package/dist/document/registry.js +29 -35
  454. package/dist/document/registry.js.map +1 -1
  455. package/dist/document/settled-index.d.ts +49 -0
  456. package/dist/document/settled-index.d.ts.map +1 -0
  457. package/dist/document/settled-index.js +247 -0
  458. package/dist/document/settled-index.js.map +1 -0
  459. package/dist/document/timeline.d.ts +29 -3
  460. package/dist/document/timeline.d.ts.map +1 -1
  461. package/dist/document/timeline.js +99 -3
  462. package/dist/document/timeline.js.map +1 -1
  463. package/dist/document/types.d.ts +4 -4
  464. package/dist/document/types.js.map +1 -1
  465. package/dist/document/validate.d.ts +1 -1
  466. package/dist/document/validate.js.map +1 -1
  467. package/dist/experimental.d.ts +22 -0
  468. package/dist/experimental.d.ts.map +1 -0
  469. package/dist/experimental.js +20 -0
  470. package/dist/experimental.js.map +1 -0
  471. package/dist/index.d.ts +10 -2
  472. package/dist/index.d.ts.map +1 -1
  473. package/dist/index.js +10 -2
  474. package/dist/index.js.map +1 -1
  475. package/dist/layout/types.d.ts +1 -1
  476. package/dist/layout/types.js.map +1 -1
  477. package/dist/nodes/audio/index.d.ts +2 -2
  478. package/dist/nodes/audio/index.d.ts.map +1 -1
  479. package/dist/nodes/audio/index.js +0 -2
  480. package/dist/nodes/audio/index.js.map +1 -1
  481. package/dist/nodes/audio/sound-node.d.ts +2 -1
  482. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  483. package/dist/nodes/audio/sound-node.js +3 -0
  484. package/dist/nodes/audio/sound-node.js.map +1 -1
  485. package/dist/nodes/index.d.ts +39 -27
  486. package/dist/nodes/index.d.ts.map +1 -1
  487. package/dist/nodes/index.js +16 -30
  488. package/dist/nodes/index.js.map +1 -1
  489. package/dist/nodes/node/node.d.ts +7 -1
  490. package/dist/nodes/node/node.d.ts.map +1 -1
  491. package/dist/nodes/node/node.js +23 -8
  492. package/dist/nodes/node/node.js.map +1 -1
  493. package/dist/nodes/root/canvas2d-node.d.ts +2 -1
  494. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -1
  495. package/dist/nodes/root/canvas2d-node.js +3 -0
  496. package/dist/nodes/root/canvas2d-node.js.map +1 -1
  497. package/dist/nodes/text/richtext-node.d.ts +0 -5
  498. package/dist/nodes/text/richtext-node.d.ts.map +1 -1
  499. package/dist/nodes/text/richtext-node.js +5 -71
  500. package/dist/nodes/text/richtext-node.js.map +1 -1
  501. package/dist/nodes/text/text-base.d.ts +5 -22
  502. package/dist/nodes/text/text-base.d.ts.map +1 -1
  503. package/dist/nodes/text/text-base.js +12 -363
  504. package/dist/nodes/text/text-base.js.map +1 -1
  505. package/dist/nodes/text/text-layout.d.ts +87 -0
  506. package/dist/nodes/text/text-layout.d.ts.map +1 -0
  507. package/dist/nodes/text/text-layout.js +368 -0
  508. package/dist/nodes/text/text-layout.js.map +1 -0
  509. package/dist/nodes/three/canvas3d-node.d.ts +3 -1
  510. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  511. package/dist/nodes/three/canvas3d-node.js +6 -0
  512. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  513. package/dist/props/host.d.ts +1 -1
  514. package/dist/props/host.js.map +1 -1
  515. package/dist/props/slot.d.ts +1 -1
  516. package/dist/props/slot.js +1 -1
  517. package/dist/props/slot.js.map +1 -1
  518. package/dist/render/clip.d.ts +1 -1
  519. package/dist/render/clip.js +1 -1
  520. package/dist/render/clip.js.map +1 -1
  521. package/dist/render/descriptors/rect.js.map +1 -1
  522. package/dist/render/descriptors/text.d.ts +11 -5
  523. package/dist/render/descriptors/text.d.ts.map +1 -1
  524. package/dist/render/descriptors/text.js +7 -1
  525. package/dist/render/descriptors/text.js.map +1 -1
  526. package/dist/render/render-context2d.d.ts +2 -2
  527. package/dist/render/render-context2d.js.map +1 -1
  528. package/dist/render3d/builders.d.ts +1 -1
  529. package/dist/render3d/builders.js +1 -1
  530. package/dist/render3d/builders.js.map +1 -1
  531. package/dist/render3d/graphics3d.d.ts +13 -19
  532. package/dist/render3d/graphics3d.d.ts.map +1 -1
  533. package/dist/render3d/graphics3d.js +13 -19
  534. package/dist/render3d/graphics3d.js.map +1 -1
  535. package/dist/render3d/scene3d.d.ts +1 -1
  536. package/dist/render3d/scene3d.js +1 -1
  537. package/dist/render3d/scene3d.js.map +1 -1
  538. package/dist/render3d/texture.d.ts +2 -2
  539. package/dist/render3d/texture.d.ts.map +1 -1
  540. package/dist/render3d/texture.js.map +1 -1
  541. package/dist/render3d/vector3.d.ts +2 -2
  542. package/dist/render3d/vector3.js +2 -2
  543. package/dist/render3d/vector3.js.map +1 -1
  544. package/dist/runtime/asset-refine.d.ts +1 -1
  545. package/dist/runtime/asset-refine.d.ts.map +1 -1
  546. package/dist/runtime/asset-refine.js +1 -1
  547. package/dist/runtime/asset-refine.js.map +1 -1
  548. package/dist/runtime/asset-update.js +1 -1
  549. package/dist/runtime/asset-update.js.map +1 -1
  550. package/dist/runtime/audio-index.d.ts +0 -11
  551. package/dist/runtime/audio-index.d.ts.map +1 -1
  552. package/dist/runtime/audio-index.js +0 -25
  553. package/dist/runtime/audio-index.js.map +1 -1
  554. package/dist/runtime/clip-instance.d.ts +7 -4
  555. package/dist/runtime/clip-instance.d.ts.map +1 -1
  556. package/dist/runtime/clip-instance.js +21 -7
  557. package/dist/runtime/clip-instance.js.map +1 -1
  558. package/dist/runtime/clip-store.d.ts +11 -3
  559. package/dist/runtime/clip-store.d.ts.map +1 -1
  560. package/dist/runtime/clip-store.js +83 -23
  561. package/dist/runtime/clip-store.js.map +1 -1
  562. package/dist/runtime/engine.d.ts +3 -3
  563. package/dist/runtime/engine.js +2 -2
  564. package/dist/runtime/engine.js.map +1 -1
  565. package/dist/runtime/node-picking.d.ts +2 -2
  566. package/dist/runtime/node-picking.d.ts.map +1 -1
  567. package/dist/runtime/node-picking.js +9 -10
  568. package/dist/runtime/node-picking.js.map +1 -1
  569. package/dist/runtime/node-picking3d.d.ts +12 -5
  570. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  571. package/dist/runtime/node-picking3d.js +6 -1
  572. package/dist/runtime/node-picking3d.js.map +1 -1
  573. package/dist/runtime/playback-controller.d.ts +2 -2
  574. package/dist/runtime/playback-controller.d.ts.map +1 -1
  575. package/dist/runtime/playback-controller.js +1 -1
  576. package/dist/runtime/playback-controller.js.map +1 -1
  577. package/dist/runtime/state-evaluator.d.ts +2 -2
  578. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  579. package/dist/runtime/state-evaluator.js.map +1 -1
  580. package/dist/runtime/text-geometry.d.ts +1 -1
  581. package/dist/runtime/text-geometry.d.ts.map +1 -1
  582. package/dist/runtime/text-geometry.js +6 -3
  583. package/dist/runtime/text-geometry.js.map +1 -1
  584. package/dist/sdk/index.d.ts +46 -21
  585. package/dist/sdk/index.d.ts.map +1 -1
  586. package/dist/sdk/index.js +47 -43
  587. package/dist/sdk/index.js.map +1 -1
  588. package/dist/tween/command-decorator.d.ts +7 -9
  589. package/dist/tween/command-decorator.d.ts.map +1 -1
  590. package/dist/tween/command-decorator.js +2 -2
  591. package/dist/tween/command-decorator.js.map +1 -1
  592. package/dist/tween/command.d.ts +13 -1
  593. package/dist/tween/command.d.ts.map +1 -1
  594. package/dist/tween/command.js +14 -0
  595. package/dist/tween/command.js.map +1 -1
  596. package/dist/tween/index.d.ts +2 -1
  597. package/dist/tween/index.d.ts.map +1 -1
  598. package/dist/tween/index.js +1 -1
  599. package/dist/tween/index.js.map +1 -1
  600. package/dist/tween/loop.d.ts +1 -1
  601. package/dist/tween/loop.js +1 -1
  602. package/dist/tween/loop.js.map +1 -1
  603. package/dist/util/reference.d.ts +6 -6
  604. package/dist/util/reference.js.map +1 -1
  605. package/package.json +7 -10
  606. package/dist/browser/chunks/chunk-FUZVFT3W.js +0 -18
  607. package/dist/browser/chunks/chunk-FUZVFT3W.js.map +0 -7
  608. package/dist/browser/chunks/chunk-QG6C23IJ.js +0 -3
  609. package/dist/browser/chunks/chunk-QG6C23IJ.js.map +0 -7
  610. package/dist/browser/chunks/chunk-SFNJRPBV.js +0 -2
  611. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +0 -7
  612. package/dist/browser/jsx-jsx-dev-runtime.js +0 -2
  613. package/dist/browser/jsx-jsx-runtime.js +0 -2
  614. package/dist/browser/jsx-jsx-runtime.js.map +0 -7
  615. /package/dist/browser/{jsx-jsx-dev-runtime.js.map → experimental.js.map} +0 -0
@@ -15,7 +15,7 @@ export interface Command<P = Record<string, unknown>> extends Steppable {
15
15
  at(t: number): Partial<P>;
16
16
  }
17
17
  /**
18
- * The single argument a `@command()` method takes: its own params under `data`,
18
+ * The single argument a `command()` method takes: its own params under `data`,
19
19
  * plus shared timing. One object (not positional args) so a manifest can read a
20
20
  * command's shape off `T` directly.
21
21
  *
@@ -31,6 +31,18 @@ export interface CommandArgs<T = Record<string, unknown>, R = T> {
31
31
  easing?: EasingFunction;
32
32
  lerp?: LerpFunction<R>;
33
33
  }
34
+ /**
35
+ * Mark a command whose `at` reads nothing but what it captured when it was built
36
+ * and does nothing but write prop slots, its end values all at `at(1)`. A
37
+ * timeline may then hold it finished by writing those end values instead of
38
+ * running it — see `document/settled-index`.
39
+ */
40
+ export declare function settling<C extends {
41
+ at(t: number): unknown;
42
+ }>(command: C): C;
43
+ export declare function settles(command: {
44
+ at(t: number): unknown;
45
+ }): boolean;
34
46
  /** True when `x` is a {@link Command} rather than a plain object. */
35
47
  export declare function isCommand(x: unknown): x is Command;
36
48
  /** What a {@link Command} writes its evaluated props onto. */
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/tween/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAmC,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,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,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAyB7F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC7B,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EACxB,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAC1B,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,yHAAyH;AACzH,wBAAgB,eAAe,CAAC,CAAC,EAC7B,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EACxB,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAC1B,OAAO,CAAC,CAAC,CAAC,CAYZ"}
@@ -1,5 +1,19 @@
1
1
  import { clamp01 } from "../util/clamp.js";
2
2
  import { loopPasses, loopPhase, loopSpan } from "./loop.js";
3
+ const SETTLES = Symbol("settles");
4
+ /**
5
+ * Mark a command whose `at` reads nothing but what it captured when it was built
6
+ * and does nothing but write prop slots, its end values all at `at(1)`. A
7
+ * timeline may then hold it finished by writing those end values instead of
8
+ * running it — see `document/settled-index`.
9
+ */
10
+ export function settling(command) {
11
+ command[SETTLES] = true;
12
+ return command;
13
+ }
14
+ export function settles(command) {
15
+ return command[SETTLES] === true;
16
+ }
3
17
  /** True when `x` is a {@link Command} rather than a plain object. */
4
18
  export function isCommand(x) {
5
19
  return typeof x?.at === "function"
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/tween/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAiB,MAAM,QAAQ,CAAC;AAmCxE,qEAAqE;AACrE,MAAM,UAAU,SAAS,CAAC,CAAU;IAChC,OAAO,OAAQ,CAAa,EAAE,EAAE,KAAK,UAAU;WACxC,OAAQ,CAAa,EAAE,QAAQ,KAAK,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AwE;QACxE,yEAAyE;QACzE,sEAAsE;QACtE,kEAAkE;QAClE,iEAAiE;QACjE,EAAE,CAAC,CAAS;YACR,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAClB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,QAAQ;YACJ,IAAI,OAAO,GAAG,CAAC,CAAC;YAChB,OAAO;gBACH,IAAI,EAAE,CAAC,CAAS,EAAE,EAAE;oBAChB,OAAO,GAAG,CAAC,CAAC;oBACZ,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnC,CAAC;gBACD,OAAO,EAAE,CAAC,EAAU,EAAW,EAAE;oBAC7B,OAAO,IAAI,EAAE,CAAC;oBACd,MAAM,IAAI,GAAG,OAAO,IAAI,QAAQ,CAAC;oBACjC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBAChD,OAAO,IAAI,CAAC;gBAChB,CAAC;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC","sourcesContent":["import { clamp01 } from \"@/util/clamp\";\r\nimport { EasingFunction } from \"./ease/type\";\r\nimport { loopPasses, loopPhase, loopSpan, type LoopSpec } from \"./loop\";\r\nimport { LerpFunction } from \"./lerp\";\r\nimport { Steppable, TweenStepper } from \"./stepper\";\r\n\r\n/**\r\n * A named animation, as a value: `at(t)` is a pure function of normalized time,\r\n * so a host can ask what frame N looks like without replaying frames 0..N-1.\r\n *\r\n * `at` is only pure once *built* — a factory reads the node's current props to\r\n * fix its start value, so a host evaluating out of order must build commands in\r\n * timeline order, leaving each node in the state the previous command left it.\r\n */\r\nexport interface Command<P = Record<string, unknown>> extends Steppable {\r\n readonly duration: number;\r\n at(t: number): Partial<P>;\r\n}\r\n\r\n/**\r\n * The single argument a `@command()` method takes: its own params under `data`,\r\n * plus shared timing. One object (not positional args) so a manifest can read a\r\n * command's shape off `T` directly.\r\n *\r\n * `duration`/`data` are optional for a command with a synchronous mode\r\n * (`restore`, `addChildAt`) or nothing to carry (`restore`).\r\n *\r\n * `R` differs from `T` when `data` is loose author input (`Fill`) but `lerp`\r\n * operates on its resolved form (`FillResolved[]`).\r\n */\r\nexport interface CommandArgs<T = Record<string, unknown>, R = T> {\r\n data?: T;\r\n duration?: number;\r\n easing?: EasingFunction;\r\n lerp?: LerpFunction<R>;\r\n}\r\n\r\n/** True when `x` is a {@link Command} rather than a plain object. */\r\nexport function isCommand(x: unknown): x is Command {\r\n return typeof (x as Command)?.at === \"function\"\r\n && typeof (x as Command)?.duration === \"number\";\r\n}\r\n\r\n/** What a {@link Command} writes its evaluated props onto. */\r\nexport interface CommandTarget<P> {\r\n set(props: Partial<P>): void;\r\n}\r\n\r\n/** Build a {@link Command} from a pure `t → props` function. `easing` is applied inside, so `at` itself takes raw normalized time. */\r\nexport function makeCommand<P>(\r\n target: CommandTarget<P>,\r\n at: (t: number) => Partial<P>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n): Command<P> {\r\n const value = (t: number): Partial<P> => at(easing ? easing(clamp01(t)) : clamp01(t));\r\n return fromValue(target, duration, value);\r\n}\r\n\r\n/**\r\n * A {@link Command} whose product is a side effect rather than props — for state\r\n * a `set()` can't reach (a private field, an array element).\r\n *\r\n * `apply` must be a pure function of `t`: it can run for any `t`, any number of\r\n * times, in any order. Accumulating (`x += …`) instead of assigning from `t`\r\n * looks right forwards and drifts the instant anything scrubs.\r\n */\r\nexport function driveCommand(\r\n duration: number,\r\n apply: (t: number) => void,\r\n easing?: EasingFunction,\r\n): Command<Record<string, never>> {\r\n const sink: CommandTarget<Record<string, never>> = { set: () => { } };\r\n return makeCommand(sink, (t) => {\r\n apply(t);\r\n return {};\r\n }, duration, easing);\r\n}\r\n\r\n/**\r\n * Repeat `command`, as one seekable {@link Command} that lasts for every pass.\r\n *\r\n * Wrapping rather than a parameter on each command is what makes this work for\r\n * every command there is: the inner one is asked for the frame at a pass-local\r\n * `t`, so it never learns it is being repeated, and its easing applies per pass\r\n * — which is what \"three bounces\" means, rather than one ease stretched over\r\n * three of them.\r\n *\r\n * `fill` is the seconds an unlimited loop (`count: null`) may cover; it defaults\r\n * to a single pass, since a command built outside a timeline has no clip to fill.\r\n * A stamp (`duration === 0`) is returned untouched: there is no pass to repeat.\r\n */\r\nexport function loopCommand<P>(command: Command<P>, loop: LoopSpec, fill?: number): Command<P> {\r\n const one = command.duration;\r\n if (one <= 0 || loopPasses(loop) <= 1) return command;\r\n const duration = loopSpan(loop, one, fill);\r\n const value = (t: number): Partial<P> => command.at(loopPhase(loop, clamp01(t) * duration, one));\r\n\r\n return {\r\n duration,\r\n at: value,\r\n _stepper(): TweenStepper {\r\n let elapsed = 0;\r\n return {\r\n seek: (e: number) => {\r\n elapsed = e;\r\n value(e / duration);\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n const done = elapsed >= duration;\r\n value(done ? 1 : elapsed / duration);\r\n return done;\r\n },\r\n };\r\n },\r\n };\r\n}\r\n\r\n/**\r\n * Run `commands` one after another as a single seekable {@link Command}.\r\n *\r\n * A finished child holds at `at(1)` rather than being dropped, so a prop\r\n * written early keeps its value once its step ends.\r\n */\r\nexport function commandSequence<P>(\r\n target: CommandTarget<P>,\r\n ...commands: Command<P>[]\r\n): Command<P> {\r\n const duration = commands.reduce((sum, c) => sum + c.duration, 0);\r\n\r\n return fromValue(target, duration, (t) => {\r\n const elapsed = t * duration;\r\n const props: Partial<P> = {};\r\n let cursor = 0;\r\n for (const command of commands) {\r\n if (elapsed < cursor) break;\r\n const local = command.duration > 0 ? (elapsed - cursor) / command.duration : 1;\r\n Object.assign(props, command.at(clamp01(local)));\r\n cursor += command.duration;\r\n }\r\n return props;\r\n });\r\n}\r\n\r\n/** Run `commands` together as one {@link Command}, ending when the longest does. Later commands win on a shared prop. */\r\nexport function commandParallel<P>(\r\n target: CommandTarget<P>,\r\n ...commands: Command<P>[]\r\n): Command<P> {\r\n const duration = commands.reduce((max, c) => Math.max(max, c.duration), 0);\r\n\r\n return fromValue(target, duration, (t) => {\r\n const elapsed = t * duration;\r\n const props: Partial<P> = {};\r\n for (const command of commands) {\r\n const local = command.duration > 0 ? elapsed / command.duration : 1;\r\n Object.assign(props, command.at(clamp01(local)));\r\n }\r\n return props;\r\n });\r\n}\r\n\r\n/** Wrap a pure `t → props` function into the full {@link Command} surface. */\r\nfunction fromValue<P>(\r\n target: CommandTarget<P>,\r\n duration: number,\r\n value: (t: number) => Partial<P>,\r\n): Command<P> {\r\n const progress = (elapsed: number): number => (duration > 0 ? elapsed / duration : 1);\r\n\r\n return {\r\n duration,\r\n // Writes as well as returns. A host evaluating a timeline calls `at(t)`\r\n // and discards what comes back — `ToCommand` has always applied its step\r\n // as a side effect, and a `Command` built from a `t → props` function\r\n // that only *described* its frame was silently inert everywhere a\r\n // document is seeked, while behaving correctly under `_stepper`.\r\n at(t: number): Partial<P> {\r\n const props = value(t);\r\n target.set(props);\r\n return props;\r\n },\r\n\r\n _stepper(): TweenStepper {\r\n let elapsed = 0;\r\n return {\r\n seek: (e: number) => {\r\n elapsed = e;\r\n target.set(value(progress(e)));\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n const done = elapsed >= duration;\r\n target.set(value(done ? 1 : progress(elapsed)));\r\n return done;\r\n },\r\n };\r\n },\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/tween/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAiB,MAAM,QAAQ,CAAC;AAmCxE,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAElC;;;;;GAK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r\nimport { loopPasses, loopPhase, loopSpan, type LoopSpec } from \"./loop\";\r\nimport { LerpFunction } from \"./lerp\";\r\nimport { Steppable, TweenStepper } from \"./stepper\";\r\n\r\n/**\r\n * A named animation, as a value: `at(t)` is a pure function of normalized time,\r\n * so a host can ask what frame N looks like without replaying frames 0..N-1.\r\n *\r\n * `at` is only pure once *built* — a factory reads the node's current props to\r\n * fix its start value, so a host evaluating out of order must build commands in\r\n * timeline order, leaving each node in the state the previous command left it.\r\n */\r\nexport interface Command<P = Record<string, unknown>> extends Steppable {\r\n readonly duration: number;\r\n at(t: number): Partial<P>;\r\n}\r\n\r\n/**\r\n * The single argument a `command()` method takes: its own params under `data`,\r\n * plus shared timing. One object (not positional args) so a manifest can read a\r\n * command's shape off `T` directly.\r\n *\r\n * `duration`/`data` are optional for a command with a synchronous mode\r\n * (`restore`, `addChildAt`) or nothing to carry (`restore`).\r\n *\r\n * `R` differs from `T` when `data` is loose author input (`Fill`) but `lerp`\r\n * operates on its resolved form (`FillResolved[]`).\r\n */\r\nexport interface CommandArgs<T = Record<string, unknown>, R = T> {\r\n data?: T;\r\n duration?: number;\r\n easing?: EasingFunction;\r\n lerp?: LerpFunction<R>;\r\n}\r\n\r\nconst SETTLES = Symbol(\"settles\");\r\n\r\n/**\r\n * Mark a command whose `at` reads nothing but what it captured when it was built\r\n * and does nothing but write prop slots, its end values all at `at(1)`. A\r\n * timeline may then hold it finished by writing those end values instead of\r\n * running it — see `document/settled-index`.\r\n */\r\nexport function settling<C extends { at(t: number): unknown }>(command: C): C {\r\n (command as unknown as Record<symbol, boolean>)[SETTLES] = true;\r\n return command;\r\n}\r\n\r\nexport function settles(command: { at(t: number): unknown }): boolean {\r\n return (command as unknown as Record<symbol, boolean>)[SETTLES] === true;\r\n}\r\n\r\n/** True when `x` is a {@link Command} rather than a plain object. */\r\nexport function isCommand(x: unknown): x is Command {\r\n return typeof (x as Command)?.at === \"function\"\r\n && typeof (x as Command)?.duration === \"number\";\r\n}\r\n\r\n/** What a {@link Command} writes its evaluated props onto. */\r\nexport interface CommandTarget<P> {\r\n set(props: Partial<P>): void;\r\n}\r\n\r\n/** Build a {@link Command} from a pure `t → props` function. `easing` is applied inside, so `at` itself takes raw normalized time. */\r\nexport function makeCommand<P>(\r\n target: CommandTarget<P>,\r\n at: (t: number) => Partial<P>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n): Command<P> {\r\n const value = (t: number): Partial<P> => at(easing ? easing(clamp01(t)) : clamp01(t));\r\n return fromValue(target, duration, value);\r\n}\r\n\r\n/**\r\n * A {@link Command} whose product is a side effect rather than props — for state\r\n * a `set()` can't reach (a private field, an array element).\r\n *\r\n * `apply` must be a pure function of `t`: it can run for any `t`, any number of\r\n * times, in any order. Accumulating (`x += …`) instead of assigning from `t`\r\n * looks right forwards and drifts the instant anything scrubs.\r\n */\r\nexport function driveCommand(\r\n duration: number,\r\n apply: (t: number) => void,\r\n easing?: EasingFunction,\r\n): Command<Record<string, never>> {\r\n const sink: CommandTarget<Record<string, never>> = { set: () => { } };\r\n return makeCommand(sink, (t) => {\r\n apply(t);\r\n return {};\r\n }, duration, easing);\r\n}\r\n\r\n/**\r\n * Repeat `command`, as one seekable {@link Command} that lasts for every pass.\r\n *\r\n * Wrapping rather than a parameter on each command is what makes this work for\r\n * every command there is: the inner one is asked for the frame at a pass-local\r\n * `t`, so it never learns it is being repeated, and its easing applies per pass\r\n * — which is what \"three bounces\" means, rather than one ease stretched over\r\n * three of them.\r\n *\r\n * `fill` is the seconds an unlimited loop (`count: null`) may cover; it defaults\r\n * to a single pass, since a command built outside a timeline has no clip to fill.\r\n * A stamp (`duration === 0`) is returned untouched: there is no pass to repeat.\r\n */\r\nexport function loopCommand<P>(command: Command<P>, loop: LoopSpec, fill?: number): Command<P> {\r\n const one = command.duration;\r\n if (one <= 0 || loopPasses(loop) <= 1) return command;\r\n const duration = loopSpan(loop, one, fill);\r\n const value = (t: number): Partial<P> => command.at(loopPhase(loop, clamp01(t) * duration, one));\r\n\r\n return {\r\n duration,\r\n at: value,\r\n _stepper(): TweenStepper {\r\n let elapsed = 0;\r\n return {\r\n seek: (e: number) => {\r\n elapsed = e;\r\n value(e / duration);\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n const done = elapsed >= duration;\r\n value(done ? 1 : elapsed / duration);\r\n return done;\r\n },\r\n };\r\n },\r\n };\r\n}\r\n\r\n/**\r\n * Run `commands` one after another as a single seekable {@link Command}.\r\n *\r\n * A finished child holds at `at(1)` rather than being dropped, so a prop\r\n * written early keeps its value once its step ends.\r\n */\r\nexport function commandSequence<P>(\r\n target: CommandTarget<P>,\r\n ...commands: Command<P>[]\r\n): Command<P> {\r\n const duration = commands.reduce((sum, c) => sum + c.duration, 0);\r\n\r\n return fromValue(target, duration, (t) => {\r\n const elapsed = t * duration;\r\n const props: Partial<P> = {};\r\n let cursor = 0;\r\n for (const command of commands) {\r\n if (elapsed < cursor) break;\r\n const local = command.duration > 0 ? (elapsed - cursor) / command.duration : 1;\r\n Object.assign(props, command.at(clamp01(local)));\r\n cursor += command.duration;\r\n }\r\n return props;\r\n });\r\n}\r\n\r\n/** Run `commands` together as one {@link Command}, ending when the longest does. Later commands win on a shared prop. */\r\nexport function commandParallel<P>(\r\n target: CommandTarget<P>,\r\n ...commands: Command<P>[]\r\n): Command<P> {\r\n const duration = commands.reduce((max, c) => Math.max(max, c.duration), 0);\r\n\r\n return fromValue(target, duration, (t) => {\r\n const elapsed = t * duration;\r\n const props: Partial<P> = {};\r\n for (const command of commands) {\r\n const local = command.duration > 0 ? elapsed / command.duration : 1;\r\n Object.assign(props, command.at(clamp01(local)));\r\n }\r\n return props;\r\n });\r\n}\r\n\r\n/** Wrap a pure `t → props` function into the full {@link Command} surface. */\r\nfunction fromValue<P>(\r\n target: CommandTarget<P>,\r\n duration: number,\r\n value: (t: number) => Partial<P>,\r\n): Command<P> {\r\n const progress = (elapsed: number): number => (duration > 0 ? elapsed / duration : 1);\r\n\r\n return {\r\n duration,\r\n // Writes as well as returns. A host evaluating a timeline calls `at(t)`\r\n // and discards what comes back — `ToCommand` has always applied its step\r\n // as a side effect, and a `Command` built from a `t → props` function\r\n // that only *described* its frame was silently inert everywhere a\r\n // document is seeked, while behaving correctly under `_stepper`.\r\n at(t: number): Partial<P> {\r\n const props = value(t);\r\n target.set(props);\r\n return props;\r\n },\r\n\r\n _stepper(): TweenStepper {\r\n let elapsed = 0;\r\n return {\r\n seek: (e: number) => {\r\n elapsed = e;\r\n target.set(value(progress(e)));\r\n },\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n const done = elapsed >= duration;\r\n target.set(value(done ? 1 : progress(elapsed)));\r\n return done;\r\n },\r\n };\r\n },\r\n };\r\n}\r\n"]}
@@ -4,7 +4,8 @@ export * from './ease/curve.js';
4
4
  export * from './to-command.js';
5
5
  export * from './command.js';
6
6
  export * from './loop.js';
7
- export * from './command-decorator.js';
7
+ export { COMMAND_META, getCommandMeta } from './command-decorator.js';
8
+ export type { CommandArg, CommandArgDescriptor, CommandMeta, CommandOptions } from './command-decorator.js';
8
9
  export * from './prepare.js';
9
10
  export * from './stepper.js';
10
11
  export * from './lerp.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","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"}
1
+ {"version":3,"file":"index.d.ts","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,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEzG,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -4,7 +4,7 @@ export * from './ease/curve.js';
4
4
  export * from './to-command.js';
5
5
  export * from './command.js';
6
6
  export * from './loop.js';
7
- export * from './command-decorator.js';
7
+ export { COMMAND_META, getCommandMeta } from './command-decorator.js';
8
8
  export * from './prepare.js';
9
9
  export * from './stepper.js';
10
10
  export * from './lerp.js';
@@ -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';\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
+ {"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,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGnE,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 { COMMAND_META, getCommandMeta } from './command-decorator';\r\nexport type { CommandArg, CommandArgDescriptor, CommandMeta, CommandOptions } from './command-decorator';\r\n\r\nexport * from './prepare';\r\nexport * from './stepper';\r\nexport * from './lerp';\r\n"]}
@@ -6,7 +6,7 @@
6
6
  * `duration` — it says when the command is running, never what it does. That is
7
7
  * why it lives out here rather than in any one command's args: the wrapper goes
8
8
  * *around* a built `Command`, so `to`, `fillTo`, `countTo` and a custom
9
- * `@command()` nobody has written yet all loop by the same code, with nothing to
9
+ * `command()` nobody has written yet all loop by the same code, with nothing to
10
10
  * forward and nothing to forget.
11
11
  *
12
12
  * And it stays seekable. A looped command is still a pure function of its own
@@ -6,7 +6,7 @@
6
6
  * `duration` — it says when the command is running, never what it does. That is
7
7
  * why it lives out here rather than in any one command's args: the wrapper goes
8
8
  * *around* a built `Command`, so `to`, `fillTo`, `countTo` and a custom
9
- * `@command()` nobody has written yet all loop by the same code, with nothing to
9
+ * `command()` nobody has written yet all loop by the same code, with nothing to
10
10
  * forward and nothing to forget.
11
11
  *
12
12
  * And it stays seekable. A looped command is still a pure function of its own
@@ -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,IAA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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"]}
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/tween/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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,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"]}
@@ -24,18 +24,18 @@ export interface Reference<T> {
24
24
  * This is the type a node's `ref` prop takes, and the widening is deliberate:
25
25
  * the framework only ever writes into a ref (`props.ref(this)` in the `Node2D`
26
26
  * constructor) and the author only ever reads, so handing a `Rect` to a
27
- * `Reference<ShapeNode>` is sound in both directions — the write stores a
27
+ * `Reference<Node2D>` is sound in both directions — the write stores a
28
28
  * subtype, the read yields the supertype the author asked for. That is what
29
29
  * lets one ref hold whichever shape a factory happened to build:
30
30
  *
31
- * ```tsx
32
- * const ref = createRef<ShapeNode>();
33
- * <Rect ref={ref} /> // ✔ Rect is a ShapeNode
34
- * <Ellipse ref={ref} /> // ✔ so is Ellipse
31
+ * ```ts
32
+ * const ref = createRef<Node2D>();
33
+ * Rect({ ref }); // ✔ Rect is a Node2D
34
+ * Ellipse({ ref }); // ✔ so is Ellipse
35
35
  * ```
36
36
  *
37
37
  * The opposite direction stays an error, because it is the unsound one: a
38
- * `Reference<Rect>` on a `<Text>` would be handed a `Text` at runtime while
38
+ * `Reference<Rect>` on a `Text` would be handed a `Text` at runtime while
39
39
  * still typing every read as a `Rect`.
40
40
  *
41
41
  * A plain setter function is accepted too, which makes React-style callback
@@ -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":["/**\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
+ {"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<Node2D>` 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 * ```ts\r\n * const ref = createRef<Node2D>();\r\n * Rect({ ref }); // ✔ Rect is a Node2D\r\n * Ellipse({ 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"]}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@motionscript/core",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.7",
4
4
  "type": "module",
5
- "description": "Engine-agnostic animation library for Motion Script: scenes, nodes, props, tweens, layout, and the JSX runtime.",
5
+ "description": "Engine-agnostic animation library for Motion Script: scenes, nodes, props, tweens and layout.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/motionscript-dev/motionscript.git",
@@ -35,6 +35,10 @@
35
35
  "types": "./dist/index.d.ts",
36
36
  "default": "./dist/index.js"
37
37
  },
38
+ "./experimental": {
39
+ "types": "./dist/experimental.d.ts",
40
+ "default": "./dist/experimental.js"
41
+ },
38
42
  "./component": {
39
43
  "types": "./dist/component.d.ts",
40
44
  "default": "./dist/component.js"
@@ -42,14 +46,6 @@
42
46
  "./sdk": {
43
47
  "types": "./dist/sdk/index.d.ts",
44
48
  "default": "./dist/sdk/index.js"
45
- },
46
- "./jsx/jsx-runtime": {
47
- "types": "./dist/jsx/jsx-runtime.d.ts",
48
- "default": "./dist/jsx/jsx-runtime.js"
49
- },
50
- "./jsx/jsx-dev-runtime": {
51
- "types": "./dist/jsx/jsx-dev-runtime.d.ts",
52
- "default": "./dist/jsx/jsx-dev-runtime.js"
53
49
  }
54
50
  },
55
51
  "devDependencies": {
@@ -68,6 +64,7 @@
68
64
  "dev": "concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc-alias -p tsconfig.build.json -w\"",
69
65
  "clean": "rimraf --glob dist .turbo *.tsbuildinfo",
70
66
  "test": "vitest",
67
+ "bench": "vitest bench --run",
71
68
  "lint": "eslint .",
72
69
  "typecheck": "tsc -p tsconfig.json --noEmit"
73
70
  }