use-scroll-animate 10.2.0 → 10.4.0

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 (403) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +35 -0
  3. package/README.md +67 -0
  4. package/bin/motionary-mcp.mjs +265 -0
  5. package/dist/chunks/anim-image-DDdb9q3X.js +166 -0
  6. package/dist/chunks/anim-image-DDdb9q3X.js.map +1 -0
  7. package/dist/chunks/anim-image-blQgPFFS.cjs +174 -0
  8. package/dist/chunks/anim-image-blQgPFFS.cjs.map +1 -0
  9. package/dist/chunks/audio-BpU-A1m1.cjs.map +1 -1
  10. package/dist/chunks/{audio-D95jwlOh.js → audio-CWt1xdZB.js} +3 -3
  11. package/dist/chunks/{audio-D95jwlOh.js.map → audio-CWt1xdZB.js.map} +1 -1
  12. package/dist/chunks/{base-BnRyfuyM.js → base-BTev8qxg.js} +2 -2
  13. package/dist/chunks/{base-BnRyfuyM.js.map → base-BTev8qxg.js.map} +1 -1
  14. package/dist/chunks/base-DBheNxJu.cjs.map +1 -1
  15. package/dist/chunks/bind-B_CTL6Qn.js.map +1 -1
  16. package/dist/chunks/bind-Ui43-n2d.cjs.map +1 -1
  17. package/dist/chunks/builtins-CKKZNR95.cjs.map +1 -1
  18. package/dist/chunks/{builtins-CqIq1zBv.js → builtins-CPmS6aDB.js} +3 -3
  19. package/dist/chunks/{builtins-CqIq1zBv.js.map → builtins-CPmS6aDB.js.map} +1 -1
  20. package/dist/chunks/core-B5T0dhFH.cjs.map +1 -1
  21. package/dist/chunks/{core-DsGoL9EY.js → core-BviA7nFa.js} +2 -2
  22. package/dist/chunks/{core-DsGoL9EY.js.map → core-BviA7nFa.js.map} +1 -1
  23. package/dist/chunks/core-D74Fz-dL.cjs.map +1 -1
  24. package/dist/chunks/core-D7cVumUu.js.map +1 -1
  25. package/dist/chunks/{core-XA2yhn1b.js → core-KiM7MXjL.js} +2 -2
  26. package/dist/chunks/{core-XA2yhn1b.js.map → core-KiM7MXjL.js.map} +1 -1
  27. package/dist/chunks/core-MQlXZKUG.cjs.map +1 -1
  28. package/dist/chunks/ease-HwYZnZat.cjs +94 -0
  29. package/dist/chunks/ease-HwYZnZat.cjs.map +1 -0
  30. package/dist/chunks/ease-XN8_0sXu.js +89 -0
  31. package/dist/chunks/ease-XN8_0sXu.js.map +1 -0
  32. package/dist/chunks/fx-B_pbhpDp.cjs.map +1 -1
  33. package/dist/chunks/{fx-CtnrFEg9.js → fx-CgWKqVsn.js} +2 -2
  34. package/dist/chunks/{fx-CtnrFEg9.js.map → fx-CgWKqVsn.js.map} +1 -1
  35. package/dist/chunks/generative-2LhxG5BJ.js.map +1 -1
  36. package/dist/chunks/generative-BHIj-NU0.cjs.map +1 -1
  37. package/dist/chunks/{gpu-CDcXiNA8.js → gpu-BWfgYWMY.js} +2 -2
  38. package/dist/chunks/{gpu-CDcXiNA8.js.map → gpu-BWfgYWMY.js.map} +1 -1
  39. package/dist/chunks/gpu-cUixt7kT.cjs.map +1 -1
  40. package/dist/chunks/index-tags-B-JBecYg.js.map +1 -1
  41. package/dist/chunks/index-tags-hLIF2Clq.cjs.map +1 -1
  42. package/dist/chunks/{keyframes-W-474DMc.js → keyframes-B5PWe5bU.js} +3 -2
  43. package/dist/chunks/keyframes-B5PWe5bU.js.map +1 -0
  44. package/dist/chunks/{keyframes-ZheOkpt0.cjs → keyframes-tC3I7anQ.cjs} +4 -3
  45. package/dist/chunks/keyframes-tC3I7anQ.cjs.map +1 -0
  46. package/dist/chunks/{manifest-D58HXVY-.js → manifest-BHx5yPN6.js} +2 -2
  47. package/dist/chunks/{manifest-D58HXVY-.js.map → manifest-BHx5yPN6.js.map} +1 -1
  48. package/dist/chunks/manifest-PaF9B8Vt.cjs.map +1 -1
  49. package/dist/chunks/{player-48Zy_NBG.js → player-BfHMNtiM.js} +4 -4
  50. package/dist/chunks/{player-48Zy_NBG.js.map → player-BfHMNtiM.js.map} +1 -1
  51. package/dist/chunks/player-C4y4jXSv.cjs.map +1 -1
  52. package/dist/chunks/presets-BYBVJVeP.js.map +1 -1
  53. package/dist/chunks/presets-CUHys3sK.cjs.map +1 -1
  54. package/dist/chunks/{registry-gFJRpPES.js → registry-BKzyg1JV.js} +2 -2
  55. package/dist/chunks/{registry-gFJRpPES.js.map → registry-BKzyg1JV.js.map} +1 -1
  56. package/dist/chunks/{registry-BIEjKngP.js → registry-CT-TT_bx.js} +3 -3
  57. package/dist/chunks/{registry-BIEjKngP.js.map → registry-CT-TT_bx.js.map} +1 -1
  58. package/dist/chunks/{registry-eJgpFAzI.cjs → registry-tzwKkldE.cjs} +2 -2
  59. package/dist/chunks/{registry-eJgpFAzI.cjs.map → registry-tzwKkldE.cjs.map} +1 -1
  60. package/dist/chunks/registry-xQZnSqqV.cjs.map +1 -1
  61. package/dist/chunks/shared-CkKHWrtJ.js.map +1 -1
  62. package/dist/chunks/shared-jkgRH-Hx.cjs.map +1 -1
  63. package/dist/chunks/{spring-CZDNyqWp.js → spring-BHuP55DR.js} +2 -2
  64. package/dist/chunks/{spring-CZDNyqWp.js.map → spring-BHuP55DR.js.map} +1 -1
  65. package/dist/chunks/spring-BlTQD2AV.cjs.map +1 -1
  66. package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -1
  67. package/dist/chunks/stagger-DtMKo2SK.js.map +1 -1
  68. package/dist/chunks/{ticker-CM_56oVy.js → ticker-C8lSGml9.js} +2 -2
  69. package/dist/chunks/{ticker-CM_56oVy.js.map → ticker-C8lSGml9.js.map} +1 -1
  70. package/dist/chunks/{ticker-D4o6enH0.cjs → ticker-Un0bvTWR.cjs} +2 -2
  71. package/dist/chunks/{ticker-D4o6enH0.cjs.map → ticker-Un0bvTWR.cjs.map} +1 -1
  72. package/dist/chunks/{tween-CqX1JBuj.js → tween-BcejKpsx.js} +15 -91
  73. package/dist/chunks/tween-BcejKpsx.js.map +1 -0
  74. package/dist/chunks/{tween-CBuWYpI-.cjs → tween-CwLLC3Ko.cjs} +15 -95
  75. package/dist/chunks/tween-CwLLC3Ko.cjs.map +1 -0
  76. package/dist/chunks/variants-CrDDJoYK.cjs.map +1 -1
  77. package/dist/chunks/{variants-GU3yIL4F.js → variants-CsRGUIyA.js} +2 -2
  78. package/dist/chunks/{variants-GU3yIL4F.js.map → variants-CsRGUIyA.js.map} +1 -1
  79. package/dist/components/a11y.cjs.map +1 -1
  80. package/dist/components/a11y.js +2 -2
  81. package/dist/components/a11y.js.map +1 -1
  82. package/dist/components/angular.cjs.map +1 -1
  83. package/dist/components/angular.js +8 -8
  84. package/dist/components/angular.js.map +1 -1
  85. package/dist/components/background.cjs.map +1 -1
  86. package/dist/components/background.js +2 -2
  87. package/dist/components/background.js.map +1 -1
  88. package/dist/components/bridge.cjs.map +1 -1
  89. package/dist/components/bridge.js +1 -1
  90. package/dist/components/bridge.js.map +1 -1
  91. package/dist/components/cards.cjs.map +1 -1
  92. package/dist/components/cards.js +2 -2
  93. package/dist/components/cards.js.map +1 -1
  94. package/dist/components/click.cjs.map +1 -1
  95. package/dist/components/click.js +3 -3
  96. package/dist/components/click.js.map +1 -1
  97. package/dist/components/core.cjs.map +1 -1
  98. package/dist/components/core.js.map +1 -1
  99. package/dist/components/depth.cjs.map +1 -1
  100. package/dist/components/depth.js +3 -3
  101. package/dist/components/depth.js.map +1 -1
  102. package/dist/components/design.cjs.map +1 -1
  103. package/dist/components/design.js +3 -3
  104. package/dist/components/design.js.map +1 -1
  105. package/dist/components/dsl.cjs.map +1 -1
  106. package/dist/components/dsl.js +2 -2
  107. package/dist/components/dsl.js.map +1 -1
  108. package/dist/components/effects.cjs.map +1 -1
  109. package/dist/components/effects.js +9 -9
  110. package/dist/components/effects.js.map +1 -1
  111. package/dist/components/engine.cjs.map +1 -1
  112. package/dist/components/engine.js +2 -2
  113. package/dist/components/engine.js.map +1 -1
  114. package/dist/components/feedback.cjs.map +1 -1
  115. package/dist/components/feedback.js +1 -1
  116. package/dist/components/feedback.js.map +1 -1
  117. package/dist/components/fx-3d.cjs.map +1 -1
  118. package/dist/components/fx-3d.js +2 -2
  119. package/dist/components/fx-3d.js.map +1 -1
  120. package/dist/components/fx-ai.cjs.map +1 -1
  121. package/dist/components/fx-ai.js +2 -2
  122. package/dist/components/fx-ai.js.map +1 -1
  123. package/dist/components/fx-chart.cjs.map +1 -1
  124. package/dist/components/fx-chart.js +2 -2
  125. package/dist/components/fx-chart.js.map +1 -1
  126. package/dist/components/fx-cinema.cjs.map +1 -1
  127. package/dist/components/fx-cinema.js +2 -2
  128. package/dist/components/fx-cinema.js.map +1 -1
  129. package/dist/components/fx-cyber.cjs.map +1 -1
  130. package/dist/components/fx-cyber.js +2 -2
  131. package/dist/components/fx-cyber.js.map +1 -1
  132. package/dist/components/fx-festival.cjs.map +1 -1
  133. package/dist/components/fx-festival.js +2 -2
  134. package/dist/components/fx-festival.js.map +1 -1
  135. package/dist/components/fx-focus.cjs.map +1 -1
  136. package/dist/components/fx-focus.js +2 -2
  137. package/dist/components/fx-focus.js.map +1 -1
  138. package/dist/components/fx-form.cjs.map +1 -1
  139. package/dist/components/fx-form.js +2 -2
  140. package/dist/components/fx-form.js.map +1 -1
  141. package/dist/components/fx-game.cjs.map +1 -1
  142. package/dist/components/fx-game.js +2 -2
  143. package/dist/components/fx-game.js.map +1 -1
  144. package/dist/components/fx-genart.cjs.map +1 -1
  145. package/dist/components/fx-genart.js +2 -2
  146. package/dist/components/fx-genart.js.map +1 -1
  147. package/dist/components/fx-geo.cjs.map +1 -1
  148. package/dist/components/fx-geo.js +2 -2
  149. package/dist/components/fx-geo.js.map +1 -1
  150. package/dist/components/fx-gesture.cjs.map +1 -1
  151. package/dist/components/fx-gesture.js +2 -2
  152. package/dist/components/fx-gesture.js.map +1 -1
  153. package/dist/components/fx-gpu.js +3 -3
  154. package/dist/components/fx-light.cjs.map +1 -1
  155. package/dist/components/fx-light.js +2 -2
  156. package/dist/components/fx-light.js.map +1 -1
  157. package/dist/components/fx-lottie.cjs.map +1 -1
  158. package/dist/components/fx-lottie.js +2 -2
  159. package/dist/components/fx-lottie.js.map +1 -1
  160. package/dist/components/fx-morph.cjs.map +1 -1
  161. package/dist/components/fx-morph.js +2 -2
  162. package/dist/components/fx-morph.js.map +1 -1
  163. package/dist/components/fx-music.cjs.map +1 -1
  164. package/dist/components/fx-music.js +3 -3
  165. package/dist/components/fx-music.js.map +1 -1
  166. package/dist/components/fx-organic.cjs.map +1 -1
  167. package/dist/components/fx-organic.js +2 -2
  168. package/dist/components/fx-organic.js.map +1 -1
  169. package/dist/components/fx-paper.cjs.map +1 -1
  170. package/dist/components/fx-paper.js +2 -2
  171. package/dist/components/fx-paper.js.map +1 -1
  172. package/dist/components/fx-perf.cjs.map +1 -1
  173. package/dist/components/fx-perf.js +2 -2
  174. package/dist/components/fx-perf.js.map +1 -1
  175. package/dist/components/fx-physics.cjs.map +1 -1
  176. package/dist/components/fx-physics.js +2 -2
  177. package/dist/components/fx-physics.js.map +1 -1
  178. package/dist/components/fx-retro.cjs.map +1 -1
  179. package/dist/components/fx-retro.js +2 -2
  180. package/dist/components/fx-retro.js.map +1 -1
  181. package/dist/components/fx-safe.cjs.map +1 -1
  182. package/dist/components/fx-safe.js +2 -2
  183. package/dist/components/fx-safe.js.map +1 -1
  184. package/dist/components/fx-shop.cjs.map +1 -1
  185. package/dist/components/fx-shop.js +2 -2
  186. package/dist/components/fx-shop.js.map +1 -1
  187. package/dist/components/fx-social.cjs.map +1 -1
  188. package/dist/components/fx-social.js +2 -2
  189. package/dist/components/fx-social.js.map +1 -1
  190. package/dist/components/fx-spatial.cjs.map +1 -1
  191. package/dist/components/fx-spatial.js +2 -2
  192. package/dist/components/fx-spatial.js.map +1 -1
  193. package/dist/components/fx-surface.cjs.map +1 -1
  194. package/dist/components/fx-surface.js +2 -2
  195. package/dist/components/fx-surface.js.map +1 -1
  196. package/dist/components/fx-text.cjs.map +1 -1
  197. package/dist/components/fx-text.js +2 -2
  198. package/dist/components/fx-text.js.map +1 -1
  199. package/dist/components/fx-transitions.cjs.map +1 -1
  200. package/dist/components/fx-transitions.js +3 -3
  201. package/dist/components/fx-transitions.js.map +1 -1
  202. package/dist/components/fx-video.cjs.map +1 -1
  203. package/dist/components/fx-video.js +2 -2
  204. package/dist/components/fx-video.js.map +1 -1
  205. package/dist/components/fx-weather.cjs.map +1 -1
  206. package/dist/components/fx-weather.js +2 -2
  207. package/dist/components/fx-weather.js.map +1 -1
  208. package/dist/components/fx.cjs.map +1 -1
  209. package/dist/components/fx.js +6 -6
  210. package/dist/components/fx.js.map +1 -1
  211. package/dist/components/fx2.cjs.map +1 -1
  212. package/dist/components/fx2.js +6 -6
  213. package/dist/components/fx2.js.map +1 -1
  214. package/dist/components/gesture.cjs.map +1 -1
  215. package/dist/components/gesture.js +4 -4
  216. package/dist/components/gesture.js.map +1 -1
  217. package/dist/components/interaction.cjs.map +1 -1
  218. package/dist/components/interaction.js +1 -1
  219. package/dist/components/interaction.js.map +1 -1
  220. package/dist/components/layout.cjs.map +1 -1
  221. package/dist/components/layout.js +1 -1
  222. package/dist/components/layout.js.map +1 -1
  223. package/dist/components/lazy.cjs.map +1 -1
  224. package/dist/components/lazy.js.map +1 -1
  225. package/dist/components/lite.cjs.map +1 -1
  226. package/dist/components/lite.js.map +1 -1
  227. package/dist/components/marketplace.cjs.map +1 -1
  228. package/dist/components/marketplace.js +4 -4
  229. package/dist/components/marketplace.js.map +1 -1
  230. package/dist/components/native.cjs.map +1 -1
  231. package/dist/components/native.js +3 -3
  232. package/dist/components/native.js.map +1 -1
  233. package/dist/components/packs.cjs.map +1 -1
  234. package/dist/components/packs.js +1 -1
  235. package/dist/components/packs.js.map +1 -1
  236. package/dist/components/page.cjs.map +1 -1
  237. package/dist/components/page.js +3 -3
  238. package/dist/components/page.js.map +1 -1
  239. package/dist/components/perf.cjs.map +1 -1
  240. package/dist/components/perf.js +2 -2
  241. package/dist/components/perf.js.map +1 -1
  242. package/dist/components/physics.cjs.map +1 -1
  243. package/dist/components/physics.js +3 -3
  244. package/dist/components/physics.js.map +1 -1
  245. package/dist/components/plugins.cjs.map +1 -1
  246. package/dist/components/plugins.js +4 -4
  247. package/dist/components/plugins.js.map +1 -1
  248. package/dist/components/react.cjs.map +1 -1
  249. package/dist/components/react.js.map +1 -1
  250. package/dist/components/reveal.cjs.map +1 -1
  251. package/dist/components/reveal.js +1 -1
  252. package/dist/components/reveal.js.map +1 -1
  253. package/dist/components/solid.cjs.map +1 -1
  254. package/dist/components/solid.js +8 -8
  255. package/dist/components/solid.js.map +1 -1
  256. package/dist/components/svelte.cjs.map +1 -1
  257. package/dist/components/svelte.js +8 -8
  258. package/dist/components/svelte.js.map +1 -1
  259. package/dist/components/svg.cjs.map +1 -1
  260. package/dist/components/svg.js +1 -1
  261. package/dist/components/svg.js.map +1 -1
  262. package/dist/components/text.cjs.map +1 -1
  263. package/dist/components/text.js +2 -2
  264. package/dist/components/text.js.map +1 -1
  265. package/dist/components/timeline.cjs.map +1 -1
  266. package/dist/components/timeline.js +3 -3
  267. package/dist/components/timeline.js.map +1 -1
  268. package/dist/components/tokens.cjs.map +1 -1
  269. package/dist/components/tokens.js.map +1 -1
  270. package/dist/components/transitions.cjs.map +1 -1
  271. package/dist/components/transitions.js +1 -1
  272. package/dist/components/transitions.js.map +1 -1
  273. package/dist/components/ui.cjs.map +1 -1
  274. package/dist/components/ui.js +4 -4
  275. package/dist/components/ui.js.map +1 -1
  276. package/dist/components/vue.cjs.map +1 -1
  277. package/dist/components/vue.js +8 -8
  278. package/dist/components/vue.js.map +1 -1
  279. package/dist/components/webgl.cjs.map +1 -1
  280. package/dist/components/webgl.js +1 -1
  281. package/dist/components/webgl.js.map +1 -1
  282. package/dist/components/widgets.cjs +766 -212
  283. package/dist/components/widgets.cjs.map +1 -1
  284. package/dist/components/widgets.d.cts +207 -2
  285. package/dist/components/widgets.d.ts +207 -2
  286. package/dist/components/widgets.js +770 -221
  287. package/dist/components/widgets.js.map +1 -1
  288. package/dist/components.cjs.map +1 -1
  289. package/dist/components.js +10 -10
  290. package/dist/components.js.map +1 -1
  291. package/dist/element.cjs.map +1 -1
  292. package/dist/element.js.map +1 -1
  293. package/dist/index.cjs.map +1 -1
  294. package/dist/index.js +2 -2
  295. package/dist/index.js.map +1 -1
  296. package/dist/llms-full.txt +250 -1
  297. package/dist/llms.txt +13 -2
  298. package/dist/manifest.json +646 -1
  299. package/dist/presets/extended.cjs.map +1 -1
  300. package/dist/presets/extended.js.map +1 -1
  301. package/dist/react.cjs.map +1 -1
  302. package/dist/react.js.map +1 -1
  303. package/dist/runtime/format-apng.cjs +131 -0
  304. package/dist/runtime/format-apng.cjs.map +1 -0
  305. package/dist/runtime/format-apng.d.cts +250 -0
  306. package/dist/runtime/format-apng.d.ts +250 -0
  307. package/dist/runtime/format-apng.iife.js +2 -0
  308. package/dist/runtime/format-apng.iife.js.map +1 -0
  309. package/dist/runtime/format-apng.js +123 -0
  310. package/dist/runtime/format-apng.js.map +1 -0
  311. package/dist/runtime/format-css.cjs +5 -4
  312. package/dist/runtime/format-css.cjs.map +1 -1
  313. package/dist/runtime/format-css.js +5 -4
  314. package/dist/runtime/format-css.js.map +1 -1
  315. package/dist/runtime/format-gif.cjs +206 -0
  316. package/dist/runtime/format-gif.cjs.map +1 -0
  317. package/dist/runtime/format-gif.d.cts +223 -0
  318. package/dist/runtime/format-gif.d.ts +223 -0
  319. package/dist/runtime/format-gif.iife.js +2 -0
  320. package/dist/runtime/format-gif.iife.js.map +1 -0
  321. package/dist/runtime/format-gif.js +199 -0
  322. package/dist/runtime/format-gif.js.map +1 -0
  323. package/dist/runtime/format-motion.cjs +9 -8
  324. package/dist/runtime/format-motion.cjs.map +1 -1
  325. package/dist/runtime/format-motion.js +5 -4
  326. package/dist/runtime/format-motion.js.map +1 -1
  327. package/dist/runtime/format-sprite.cjs +226 -0
  328. package/dist/runtime/format-sprite.cjs.map +1 -0
  329. package/dist/runtime/format-sprite.d.cts +224 -0
  330. package/dist/runtime/format-sprite.d.ts +224 -0
  331. package/dist/runtime/format-sprite.iife.js +2 -0
  332. package/dist/runtime/format-sprite.iife.js.map +1 -0
  333. package/dist/runtime/format-sprite.js +216 -0
  334. package/dist/runtime/format-sprite.js.map +1 -0
  335. package/dist/runtime/format-svg.cjs +5 -4
  336. package/dist/runtime/format-svg.cjs.map +1 -1
  337. package/dist/runtime/format-svg.iife.js.map +1 -1
  338. package/dist/runtime/format-svg.js +4 -3
  339. package/dist/runtime/format-svg.js.map +1 -1
  340. package/dist/runtime/format-webp.cjs +123 -0
  341. package/dist/runtime/format-webp.cjs.map +1 -0
  342. package/dist/runtime/format-webp.d.cts +245 -0
  343. package/dist/runtime/format-webp.d.ts +245 -0
  344. package/dist/runtime/format-webp.iife.js +2 -0
  345. package/dist/runtime/format-webp.iife.js.map +1 -0
  346. package/dist/runtime/format-webp.js +115 -0
  347. package/dist/runtime/format-webp.js.map +1 -0
  348. package/dist/runtime/scroll.cjs +2 -2
  349. package/dist/runtime/scroll.cjs.map +1 -1
  350. package/dist/runtime/scroll.js +2 -2
  351. package/dist/runtime/scroll.js.map +1 -1
  352. package/dist/runtime/smooth.cjs +284 -0
  353. package/dist/runtime/smooth.cjs.map +1 -0
  354. package/dist/runtime/smooth.d.cts +137 -0
  355. package/dist/runtime/smooth.d.ts +137 -0
  356. package/dist/runtime/smooth.iife.js +2 -0
  357. package/dist/runtime/smooth.iife.js.map +1 -0
  358. package/dist/runtime/smooth.js +279 -0
  359. package/dist/runtime/smooth.js.map +1 -0
  360. package/dist/runtime/text.cjs +147 -0
  361. package/dist/runtime/text.cjs.map +1 -0
  362. package/dist/runtime/text.d.cts +65 -0
  363. package/dist/runtime/text.d.ts +65 -0
  364. package/dist/runtime/text.iife.js +2 -0
  365. package/dist/runtime/text.iife.js.map +1 -0
  366. package/dist/runtime/text.js +143 -0
  367. package/dist/runtime/text.js.map +1 -0
  368. package/dist/runtime.cjs +9 -8
  369. package/dist/runtime.cjs.map +1 -1
  370. package/dist/runtime.d.cts +9 -2
  371. package/dist/runtime.d.ts +9 -2
  372. package/dist/runtime.iife.js +1 -1
  373. package/dist/runtime.iife.js.map +1 -1
  374. package/dist/runtime.js +6 -5
  375. package/dist/runtime.js.map +1 -1
  376. package/dist/solid.cjs.map +1 -1
  377. package/dist/solid.js.map +1 -1
  378. package/dist/svelte.cjs.map +1 -1
  379. package/dist/svelte.js.map +1 -1
  380. package/dist/vue.cjs.map +1 -1
  381. package/dist/vue.js.map +1 -1
  382. package/dist/widgets.umd.js +1 -1
  383. package/dist/widgets.umd.js.map +1 -1
  384. package/docs/ROADMAP.md +2 -2
  385. package/docs/components/README.md +12 -7
  386. package/docs/components/usa-parallax-layers.md +38 -0
  387. package/docs/components/usa-route-transition.md +38 -0
  388. package/docs/components/usa-scroll-ring.md +32 -0
  389. package/docs/components/usa-smooth-scroll.md +60 -0
  390. package/docs/components/usa-text-splitter.md +60 -0
  391. package/docs/components.md +94 -0
  392. package/docs/mcp.md +50 -0
  393. package/docs/runtime/format-apng.md +59 -0
  394. package/docs/runtime/format-gif.md +60 -0
  395. package/docs/runtime/format-sprite.md +60 -0
  396. package/docs/runtime/format-webp.md +58 -0
  397. package/docs/runtime/smooth.md +60 -0
  398. package/docs/runtime/text.md +59 -0
  399. package/package.json +64 -2
  400. package/dist/chunks/keyframes-W-474DMc.js.map +0 -1
  401. package/dist/chunks/keyframes-ZheOkpt0.cjs.map +0 -1
  402. package/dist/chunks/tween-CBuWYpI-.cjs.map +0 -1
  403. package/dist/chunks/tween-CqX1JBuj.js.map +0 -1
package/AGENTS.md CHANGED
@@ -59,3 +59,7 @@ Declarative motion without components (10.2):
59
59
  applyMotionAttributes(createMotion());
60
60
  </script>
61
61
  ```
62
+
63
+ ## MCP server
64
+
65
+ If your client speaks MCP, add `motionary-mcp` (read-only, ships with the package): `{ "command": "npx", "args": ["-y", "-p", "motionary", "motionary-mcp"] }`. Use `search_components` → `get_component` → `scaffold_snippet` (prerequisites are already in the snippet, in order). See docs/mcp.md.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [10.4.0] - 2026-10-09
11
+
12
+ ### Added
13
+ - **Scroll-driven 3.0 — native `animation-timeline` first.** The new scroll components animate with the browser's own scroll / view timelines (`animation-timeline: scroll()` / `view()`, named timelines + `timeline-scope` for containers) where supported — no script per frame — and fall back to a small passive JS loop elsewhere (`engine="auto | native | js"`, the engine in use is reflected in `data-engine`).
14
+ - **`motionary-mcp`** — a read-only [MCP](https://modelcontextprotocol.io) server for the component catalog, shipped in the package (`npx -y -p motionary motionary-mcp`, stdio, zero dependencies). Tools: `list_components`, `search_components`, `get_component`, `get_example`, `scaffold_snippet` (snippets for HTML / ESM / React / Vue / Svelte with every prerequisite installed, imported and registered first); resources `motionary://manifest`, `motionary://llms.txt`, `motionary://component/{tag}`. Answers from the bundled AI manifest only — no file writes, code execution or network; all tools annotated `readOnlyHint`. Tested in CI with the official MCP TypeScript SDK client over stdio. Docs: `docs/mcp.md`.
15
+ - **`motionary/runtime/smooth`** — smooth, inertial wheel scrolling (frame-rate-independent lerp, or `duration` + `ease`) for the window or any scroll container, vertical or horizontal; anchor links glide (offset, focus moved, hash kept); keyboard, scrollbar, find-in-page and assistive-tech scrolling stay native (the target follows them); touch native by default; nested scrollables, `[data-smooth-ignore]` and ctrl+wheel zoom are left alone; **disabled under `prefers-reduced-motion`** (live). Real `scroll` events still fire, so scroll scenes, observers and CSS scroll timelines keep working. CDN `dist/runtime/smooth.iife.js`; fixed gzip budget.
16
+ - **Animated image loaders** (own implementations, fixed gzip budgets, real sample files with reference results): **`motionary/runtime/format-gif`** — complete GIF decoder with its own LZW (GIF87a / 89a, global / local palettes, transparency, interlacing, disposal 0–3, delays, NETSCAPE2.0 loop count), pure (works in workers / Node), pixel-exact against Pillow on the test files; **`motionary/runtime/format-apng`** — APNG `acTL` / `fcTL` / `fdAT` split into standalone frame PNGs (fresh CRCs) decoded by the browser, composited with `dispose_op` / `blend_op`; **`motionary/runtime/format-webp`** — animated WebP `ANIM` / `ANMF` split into standalone frames (lossless VP8L, lossy VP8 with `ALPH` via an added VP8X header) decoded by the browser, composited with blend / dispose. Shared `animatedImagePlayer(canvas, anim)` plays any of them as a runtime timeline (pause, reverse, `speed`, scrub with `progress`). Compatibility tables in `docs/runtime/format-gif.md`, `format-apng.md`, `format-webp.md`; sample files and how they were made in `test/fixtures/formats/CREDITS.md`.
17
+ - **New components (10.4)** in `motionary/components/widgets`: `<usa-scroll-ring>` — circular scroll-progress indicator for the page or a container (`for`), `label`, `back-to-top`, `size`, `thickness`; `<usa-parallax-layers>` — `data-depth` layers move at different speeds through the viewport, optional `pointer` tilt; `<usa-smooth-scroll>` — page or `wrapper` smooth scrolling with `lerp`, `duration`, `offset`, `anchors` (**Requires: motionary/runtime/smooth**).
18
+ - Showcase: new gallery cards with copyable code (prerequisites first), live demos and live Store thumbnails.
19
+
20
+ ### Accessibility
21
+ - `<usa-smooth-scroll>` / `motionary/runtime/smooth` switch themselves off while `prefers-reduced-motion: reduce` matches, never hijack keyboard, scrollbar or touch scrolling, and move focus to anchor targets. `<usa-parallax-layers>` is static under reduced motion. `<usa-scroll-ring>` is a labelled `progressbar` (`aria-valuenow`), or a labelled "Back to top" button with `back-to-top`; its back-to-top jump is instant under reduced motion.
22
+
23
+ ## [10.3.0] - 2026-10-09
24
+
25
+ ### Added
26
+ - **View Transitions 2.0** — `<usa-route-transition>`: a route container that swaps its content on same-origin link clicks (fetched pages, using the element that matches `selector` / its id) or inline `<template data-route>` routes; animated with the View Transitions API when available (`engine="auto"`) or the Web Animations fallback (`engine="waapi"`, effects `fade` / `slide` / `zoom`); `data-shared="name"` elements morph between routes (`view-transition-name`); `cross-document` opts the site into native cross-document (MPA) view transitions (`@view-transition { navigation: auto }`); history push / replace / off with `popstate`; `navigate(url)`, `current`; `usa:navigate` (cancelable), `usa:navigated`.
27
+ - **`motionary/runtime/text`** — `splitText(el, { type: 'chars,words,lines' })`: grapheme-aware characters (`Intl.Segmenter`: emoji, combining marks, CJK), words, lines grouped by rendered position; nested inline markup kept; accessible (`aria-label` with the full text, pieces `aria-hidden`); `--i` index custom property; `revert()` / `resplit()`; pure `segment()` for SSR / workers. CDN `dist/runtime/text.iife.js`; fixed gzip budget.
28
+ - **`motionary/runtime/format-sprite`** — sprite sheets and image sequences: `parseSpriteSheet()` (TexturePacker JSON hash + array with trimmed / rotated frames; Aseprite JSON hash + array with per-frame `duration` and `frameTags` forward / reverse / pingpong / pingpong_reverse), `gridSheet()`, `frameOrder()`, `drawFrame()`, `spritePlayer()` (canvas or element background), `imageSequence('frame_{0001}.webp', …)`, `preloadImages()`, `sequencePlayer()` (cover-fit, scrub with `progress`). All players are runtime timelines (seek, reverse, scroll-scrub). Test fixtures in the real export formats; `test/fixtures/formats/CREDITS.md` lists sample licences.
29
+ - **Runtime tween**: numbers inside any CSS string are interpolated when both ends share the same text (`filter: blur(8px) saturate(0%)`, `box-shadow`, `clip-path`, `matrix(…)`), and values that cannot be interpolated (keywords such as `display`) switch at 50 % like CSS — previously they threw.
30
+ - **New components (10.3)** in `motionary/components/widgets`: `<usa-route-transition>` and `<usa-text-splitter>` — splits into chars / words / lines and staggers them in (`rise`, `fade`, `blur`, `flip`, `wave`) on view, load or hover, optional `loop` (**Requires: motionary/runtime/text**). The 4.x `<usa-split-text>` keeps its name and API; the runtime-powered element is a new tag.
31
+ - Showcase: new gallery cards with copyable code, live demos and live Store thumbnails.
32
+
33
+ ### Accessibility
34
+ - `<usa-text-splitter>` keeps the full sentence as the element's accessible name and hides the animated pieces from screen readers; under reduced motion the text is shown at once. `<usa-route-transition>` swaps instantly under reduced motion and keeps native link semantics (modifier-clicks, `target`, downloads and cross-origin links are left alone).
35
+
36
+ ### Fixed
37
+ - `<usa-route-transition>` (Web Animations fallback) no longer hangs when the exit animation's `finished` promise never settles (background tabs, DOMs without animation timing): the swap waits at most the exit duration.
38
+ - `format-svg`: value interpolation narrows the runtime's new string values correctly (TypeScript build error after the 10.3 tween change; behaviour unchanged).
39
+
10
40
  ## [10.2.0] - 2026-10-09
11
41
 
12
42
  ### Added
@@ -21,6 +51,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
51
  ### Accessibility
22
52
  - `<usa-scroll-scene>` is user-driven (it only moves when the reader scrolls); under reduced motion the scrub is linear and the preview loop does not run. `<usa-motion-inspector>` controls are a labelled `toolbar`, rows have labelled scrub sliders, and its slow-motion switch helps people check motion for vestibular safety.
23
53
 
54
+ ### Fixed
55
+ - Runtime timeline: a timeline holding an infinitely repeating child no longer seeks to `NaN` (`0 × Infinity`) — infinite-duration timelines seek on the raw time.
56
+ - `format-svg`: SMIL `<set>` without `dur` is applied and holds its value (duration 0, freeze) instead of being dropped with a `NaN` duration.
57
+ - Tests: the 10.1 manifest test no longer pins the exact runtime module list, so releases that add modules keep it green.
58
+
24
59
  ## [10.1.0] - 2026-10-09
25
60
 
26
61
  ### Added
package/README.md CHANGED
@@ -180,6 +180,12 @@ Motionary ships its own zero-dependency animation runtime — shared ticker, twe
180
180
  | [Motion / Framer keyframe JSON loader](docs/runtime/format-motion.md) | `motionary/runtime/format-motion` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-motion.iife.js` | `use(formatMotion);` | 2.5 KB |
181
181
  | [Scroll scenes](docs/runtime/scroll.md) | `motionary/runtime/scroll` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/scroll.iife.js` | `use(scroll);` | 4.5 KB |
182
182
  | [SVG loader: SMIL playback + path morphing](docs/runtime/format-svg.md) | `motionary/runtime/format-svg` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-svg.iife.js` | `use(formatSvg);` | 5.0 KB |
183
+ | [Text splitting](docs/runtime/text.md) | `motionary/runtime/text` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/text.iife.js` | `use(text);` | 2.5 KB |
184
+ | [Sprite sheets & image sequences](docs/runtime/format-sprite.md) | `motionary/runtime/format-sprite` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-sprite.iife.js` | `use(formatSprite);` | 3.0 KB |
185
+ | [Smooth scrolling](docs/runtime/smooth.md) | `motionary/runtime/smooth` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/smooth.iife.js` | `use(smooth);` | 3.5 KB |
186
+ | [GIF decoder](docs/runtime/format-gif.md) | `motionary/runtime/format-gif` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-gif.iife.js` | `use(formatGif);` | 3.0 KB |
187
+ | [APNG loader](docs/runtime/format-apng.md) | `motionary/runtime/format-apng` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-apng.iife.js` | `use(formatApng);` | 3.0 KB |
188
+ | [Animated WebP loader](docs/runtime/format-webp.md) | `motionary/runtime/format-webp` | `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-webp.iife.js` | `use(formatWebp);` | 3.0 KB |
183
189
 
184
190
  Install once: `npm i motionary`. Plain HTML: load `runtime.iife.js` first, then the module files (each registers itself).
185
191
 
@@ -246,6 +252,66 @@ defineScrollScene(); // registers <usa-scroll-scene> — after the prerequisites
246
252
  </usa-scroll-scene>
247
253
  ```
248
254
 
255
+ #### `<usa-text-splitter>` — Requires: motionary/runtime/text
256
+
257
+ - **Install:** `npm i motionary`
258
+ - **Import order & registration:** Register the core first, then the module: use(text) also registers the core. CDN: load runtime.iife.js, then runtime/text.iife.js (it registers itself).
259
+
260
+ ```js
261
+ import { use } from 'motionary/runtime';
262
+ import { text } from 'motionary/runtime/text';
263
+ import { defineTextSplitter } from 'motionary/components/widgets';
264
+
265
+ use(text);
266
+ defineTextSplitter(); // registers <usa-text-splitter> — after the prerequisites
267
+ ```
268
+
269
+ - **CDN:**
270
+
271
+ ```html
272
+ <script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
273
+ <script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/text.iife.js"></script>
274
+ <!-- then the component bundles -->
275
+ <script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
276
+ <script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
277
+ ```
278
+
279
+ - **Minimal example:**
280
+
281
+ ```html
282
+ <usa-text-splitter split="chars" effect="rise" stagger="30">Motion, made simple.</usa-text-splitter>
283
+ ```
284
+
285
+ #### `<usa-smooth-scroll>` — Requires: motionary/runtime/smooth
286
+
287
+ - **Install:** `npm i motionary`
288
+ - **Import order & registration:** Register the core first, then the module: use(smooth) also registers the core. CDN: load runtime.iife.js, then runtime/smooth.iife.js (it registers itself).
289
+
290
+ ```js
291
+ import { use } from 'motionary/runtime';
292
+ import { smooth } from 'motionary/runtime/smooth';
293
+ import { defineSmoothScroll } from 'motionary/components/widgets';
294
+
295
+ use(smooth);
296
+ defineSmoothScroll(); // registers <usa-smooth-scroll> — after the prerequisites
297
+ ```
298
+
299
+ - **CDN:**
300
+
301
+ ```html
302
+ <script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
303
+ <script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/smooth.iife.js"></script>
304
+ <!-- then the component bundles -->
305
+ <script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
306
+ <script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
307
+ ```
308
+
309
+ - **Minimal example:**
310
+
311
+ ```html
312
+ <usa-smooth-scroll lerp="0.1" offset="64"></usa-smooth-scroll>
313
+ ```
314
+
249
315
  <!-- runtime:end -->
250
316
 
251
317
  ## Accessibility & reduced motion
@@ -279,6 +345,7 @@ Evergreen browsers since 2023: Chrome / Edge ≥ 111, Safari ≥ 16.4, Firefox
279
345
 
280
346
  ## Documentation
281
347
 
348
+ - **MCP server:** `npx -y -p motionary motionary-mcp` — read-only component catalog for MCP clients (search, API, prerequisite-aware snippets): [docs/mcp.md](docs/mcp.md).
282
349
  - **AI assistants:** [AGENTS.md](AGENTS.md) · [prompt guide](docs/ai-prompt-guide.md) · one page per component in [docs/components/](docs/components/README.md) · `components.json` / `llms.txt` / `llms-full.txt` on the site root.
283
350
 
284
351
  - [API reference](./docs/API.md) — every export, option and `data-sa-*` attribute
@@ -0,0 +1,265 @@
1
+ #!/usr/bin/env node
2
+ // motionary-mcp (10.4) — a read-only Model Context Protocol server for the
3
+ // Motionary component catalog. Zero dependencies: speaks MCP (JSON-RPC 2.0,
4
+ // newline-delimited) over stdio and answers from the AI manifest that ships
5
+ // in the package (dist/manifest.json, the same data as components.json /
6
+ // llms.txt). It never writes files, runs code or touches the network.
7
+ //
8
+ // npx -p motionary motionary-mcp (or: npx motionary-mcp once installed)
9
+ // MOTIONARY_MANIFEST=/path/manifest.json motionary-mcp (use another manifest)
10
+ //
11
+ // Tools: list_components, search_components, get_component, get_example,
12
+ // scaffold_snippet (prerequisites included automatically).
13
+ // Resources: motionary://manifest, motionary://llms.txt, motionary://component/<tag>.
14
+ import { readFileSync, existsSync } from 'node:fs';
15
+ import { fileURLToPath } from 'node:url';
16
+ import { dirname, join } from 'node:path';
17
+ import { createInterface } from 'node:readline';
18
+
19
+ const HERE = dirname(fileURLToPath(import.meta.url));
20
+ const SERVER = { name: 'motionary-mcp', version: '0.1.0' };
21
+ const PROTOCOLS = ['2025-06-18', '2025-03-26', '2024-11-05'];
22
+
23
+ export function loadManifest(path = process.env.MOTIONARY_MANIFEST || join(HERE, '../dist/manifest.json')) {
24
+ if (!existsSync(path)) throw new Error(`motionary-mcp: manifest not found at ${path} (set MOTIONARY_MANIFEST, or run from an installed motionary package)`);
25
+ return JSON.parse(readFileSync(path, 'utf8'));
26
+ }
27
+
28
+ // ---------------------------------------------------------------- catalog logic (pure)
29
+ const norm = (s) => String(s || '').toLowerCase();
30
+ const tagOf = (s) => {
31
+ const t = norm(s).trim().replace(/^<|\/?>$/g, '');
32
+ return t.startsWith('usa-') ? t : `usa-${t}`;
33
+ };
34
+ const brief = (c) => ({ tag: c.tag, title: c.title, category: c.category, import: c.import.path, requires: c.requires.map((r) => (r === 'core' ? 'motionary/runtime' : r.includes('/') || r.startsWith('@') ? r : `motionary/runtime/${r}`)), since: c.since, description: c.description.slice(0, 200) });
35
+
36
+ export function findComponent(m, tag) {
37
+ const t = tagOf(tag);
38
+ return m.components.find((c) => c.tag === t) || m.components.find((c) => c.id === norm(tag));
39
+ }
40
+
41
+ /** Rank components for a free-text query (tag, title, keywords, description, category). */
42
+ export function searchComponents(m, query, limit = 10) {
43
+ const words = norm(query).split(/[^a-z0-9\u00c0-\uffff-]+/).filter(Boolean);
44
+ if (!words.length) return [];
45
+ const scored = m.components.map((c) => {
46
+ const tag = c.tag, title = norm(c.title), kw = (c.keywords || []).map(norm).join(' '), desc = norm(c.description), cat = norm(c.category);
47
+ let s = 0;
48
+ for (const w of words) {
49
+ if (tag === `usa-${w}` || tag === w) s += 20;
50
+ else if (tag.includes(w)) s += 8;
51
+ if (title.includes(w)) s += 6;
52
+ if (kw.includes(w)) s += 5;
53
+ if (cat === w) s += 4;
54
+ if (desc.includes(w)) s += 2;
55
+ if ((c.attributes || []).includes(w)) s += 1;
56
+ }
57
+ return { c, s };
58
+ });
59
+ return scored.filter((x) => x.s > 0).sort((a, b) => b.s - a.s || a.c.tag.localeCompare(b.c.tag)).slice(0, limit).map((x) => ({ ...brief(x.c), score: x.s }));
60
+ }
61
+
62
+ const FRAMEWORKS = ['html', 'esm', 'react', 'vue', 'svelte'];
63
+ const runtimeCdn = (m, ids) => {
64
+ const base = m.cdn.runtime.replace(/runtime\.iife\.js$/, '');
65
+ return [`<script src="${m.cdn.runtime}"></script>`, ...ids.filter((i) => i !== 'core').map((i) => `<script src="${base}runtime/${i}.iife.js"></script>`)];
66
+ };
67
+ const runtimeImports = (ids) => {
68
+ const mods = ids.filter((i) => i !== 'core');
69
+ const camel = (id) => id.replace(/-(\w)/g, (_, c) => c.toUpperCase());
70
+ return { lines: ["import { use } from 'motionary/runtime';", ...mods.map((i) => `import { ${camel(i)} } from 'motionary/runtime/${i}';`)], register: `use(${mods.map(camel).join(', ')});` };
71
+ };
72
+
73
+ /** A ready-to-paste snippet for one or more components, prerequisites first. */
74
+ export function scaffold(m, tags, framework = 'esm') {
75
+ if (!FRAMEWORKS.includes(framework)) throw new Error(`framework must be one of ${FRAMEWORKS.join(', ')}`);
76
+ const comps = tags.map((t) => {
77
+ const c = findComponent(m, t);
78
+ if (!c) throw new Error(`unknown component ${t} — use search_components first`);
79
+ return c;
80
+ });
81
+ const req = [...new Set(comps.flatMap((c) => c.requires))].filter((r) => !r.startsWith('@'));
82
+ const peers = [...new Set(comps.flatMap((c) => c.requires))].filter((r) => r.startsWith('@'));
83
+ const needsWidgets = comps.some((c) => /widgets\.umd/.test(c.cdn));
84
+ const markup = comps.map((c) => c.example).join('\n');
85
+ const byPath = new Map();
86
+ for (const c of comps) byPath.set(c.import.path, [...(byPath.get(c.import.path) || []), c.import.define]);
87
+ const defImports = [...byPath].map(([p, d]) => `import { ${[...new Set(d)].join(', ')} } from '${p}';`);
88
+ const defCalls = [...new Set(comps.map((c) => c.import.register))];
89
+ const install = ['npm i motionary', ...peers.map((p) => `npm i ${p}`)].join(' && ');
90
+ const rt = req.length ? runtimeImports(req) : null;
91
+ const prereqNote = req.length ? `Prerequisites: ${req.map((r) => (r === 'core' ? 'motionary/runtime' : `motionary/runtime/${r}`)).join(', ')} — register them before the components mount.` : 'No prerequisites.';
92
+ let code;
93
+ if (framework === 'html') {
94
+ code = [
95
+ '<!-- ' + prereqNote + ' -->',
96
+ ...(req.length ? runtimeCdn(m, req) : []),
97
+ `<script src="${m.cdn.components}"></script>`,
98
+ ...(needsWidgets ? [`<script src="${m.cdn.widgets}"></script>`] : []),
99
+ '',
100
+ markup,
101
+ ].join('\n');
102
+ } else {
103
+ const setup = [...(rt ? [...rt.lines] : []), ...defImports, '', ...(rt ? [rt.register + ' // prerequisites first'] : []), ...defCalls].join('\n');
104
+ if (framework === 'esm') code = `// ${install}\n${setup}\n\n/* HTML:\n${markup}\n*/`;
105
+ else if (framework === 'react') code = `// ${install}\n${setup}\n\nexport function Demo() {\n return (\n <>\n${markup.split('\n').map((l) => ' ' + l.replace(/\bclass=/g, 'className=')).join('\n')}\n </>\n );\n}`;
106
+ else if (framework === 'vue') code = `<!-- ${install} -->\n<script setup>\n${setup}\n</script>\n\n<template>\n${markup.split('\n').map((l) => ' ' + l).join('\n')}\n</template>\n<!-- vite.config: vue({ template: { compilerOptions: { isCustomElement: (t) => t.startsWith('usa-') } } }) -->`;
107
+ else code = `<!-- ${install} -->\n<script>\n${setup}\n</script>\n\n${markup}`;
108
+ }
109
+ return { framework, components: comps.map((c) => c.tag), install, prerequisites: req.map((r) => (r === 'core' ? 'motionary/runtime' : `motionary/runtime/${r}`)).concat(peers), code };
110
+ }
111
+
112
+ // ---------------------------------------------------------------- MCP surface
113
+ const RO = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
114
+ export const TOOLS = [
115
+ { name: 'list_components', title: 'List Motionary components', description: 'List the <usa-*> Web Components in the Motionary catalog (tag, title, category, import path, prerequisites). Filter by category, by required runtime module, or by version introduced.', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'e.g. text, scroll, ui, transitions, widgets' }, requires: { type: 'string', description: "only components needing this prerequisite, e.g. 'scroll' or 'motionary/runtime/text'; 'none' for components without prerequisites" }, since: { type: 'string', description: "introduced in this version or later, e.g. '10.0'" }, limit: { type: 'number', default: 500 } }, additionalProperties: false }, annotations: { title: 'List components', ...RO } },
116
+ { name: 'search_components', title: 'Search Motionary components', description: 'Free-text search over tags, titles, keywords and descriptions; best matches first. Use it to pick a component for a UI need ("animated counter", "scroll pinned scene", "confetti").', inputSchema: { type: 'object', properties: { query: { type: 'string' }, limit: { type: 'number', default: 10 } }, required: ['query'], additionalProperties: false }, annotations: { title: 'Search components', ...RO } },
117
+ { name: 'get_component', title: 'Get a component', description: 'Everything about one component: attributes, events, slots, methods, import / define, CDN, prerequisites (install, import + register order, CDN script order), minimal example, variants.', inputSchema: { type: 'object', properties: { tag: { type: 'string', description: "'usa-tilt', 'tilt' or '<usa-tilt>'" } }, required: ['tag'], additionalProperties: false }, annotations: { title: 'Get component', ...RO } },
118
+ { name: 'get_example', title: 'Get an example', description: "A working example for one component in the requested style ('html' = CDN, 'esm' = npm + bundler, or a variant id).", inputSchema: { type: 'object', properties: { tag: { type: 'string' }, variant: { type: 'string', description: "'html' (default), 'esm', or a variant id from get_component" } }, required: ['tag'], additionalProperties: false }, annotations: { title: 'Get example', ...RO } },
119
+ { name: 'scaffold_snippet', title: 'Scaffold a snippet', description: 'A ready-to-paste snippet using one or more components, with every prerequisite installed, imported and registered in the right order before the components mount.', inputSchema: { type: 'object', properties: { tags: { type: 'array', items: { type: 'string' }, minItems: 1 }, framework: { type: 'string', enum: FRAMEWORKS, default: 'esm' } }, required: ['tags'], additionalProperties: false }, annotations: { title: 'Scaffold snippet', ...RO } },
120
+ ];
121
+
122
+ const text = (obj) => ({ content: [{ type: 'text', text: typeof obj === 'string' ? obj : JSON.stringify(obj, null, 2) }], ...(typeof obj === 'object' ? { structuredContent: Array.isArray(obj) ? { items: obj } : obj } : {}) });
123
+
124
+ export function callTool(m, name, a = {}) {
125
+ switch (name) {
126
+ case 'list_components': {
127
+ let list = m.components;
128
+ if (a.category) list = list.filter((c) => norm(c.category) === norm(a.category));
129
+ if (a.requires) {
130
+ const r = norm(a.requires).replace(/^motionary\/runtime\/?/, '') || 'core';
131
+ list = r === 'none' ? list.filter((c) => !c.requires.length) : list.filter((c) => c.requires.includes(r));
132
+ }
133
+ if (a.since) {
134
+ const v = (s) => String(s || '0').split('.').map(Number);
135
+ const [M, n] = v(a.since);
136
+ list = list.filter((c) => c.since && (v(c.since)[0] > M || (v(c.since)[0] === M && (v(c.since)[1] || 0) >= (n || 0))));
137
+ }
138
+ const items = list.slice(0, a.limit || 500).map(brief);
139
+ return text({ version: m.version, count: items.length, total: m.components.length, components: items });
140
+ }
141
+ case 'search_components':
142
+ if (!a.query) throw new Error('query is required');
143
+ return text({ query: a.query, results: searchComponents(m, a.query, a.limit || 10) });
144
+ case 'get_component': {
145
+ const c = findComponent(m, a.tag);
146
+ if (!c) throw new Error(`unknown component ${a.tag} — use search_components`);
147
+ return text(c);
148
+ }
149
+ case 'get_example': {
150
+ const c = findComponent(m, a.tag);
151
+ if (!c) throw new Error(`unknown component ${a.tag} — use search_components`);
152
+ const v = a.variant || 'html';
153
+ if (v === 'esm') return text(c.prerequisites ? `// ${c.prerequisites.install}\n${c.prerequisites.importAndRegister}\n\n/* HTML:\n${c.example}\n*/` : c.esm);
154
+ if (v === 'html') return text(scaffold(m, [c.tag], 'html').code);
155
+ const variant = (c.variants || []).find((x) => x.id === v);
156
+ if (!variant) throw new Error(`no variant ${v} for ${c.tag}; variants: ${(c.variants || []).map((x) => x.id).join(', ') || 'none'}`);
157
+ return text(variant.example);
158
+ }
159
+ case 'scaffold_snippet':
160
+ if (!Array.isArray(a.tags) || !a.tags.length) throw new Error('tags must be a non-empty array');
161
+ return text(scaffold(m, a.tags, a.framework || 'esm'));
162
+ default:
163
+ throw Object.assign(new Error(`unknown tool ${name}`), { code: -32602 });
164
+ }
165
+ }
166
+
167
+ export function resources(m) {
168
+ return [
169
+ { uri: 'motionary://manifest', name: 'manifest', title: 'Motionary component manifest (components.json)', mimeType: 'application/json' },
170
+ { uri: 'motionary://llms.txt', name: 'llms.txt', title: 'Motionary llms.txt', mimeType: 'text/plain' },
171
+ ];
172
+ }
173
+
174
+ export function readResource(m, uri) {
175
+ if (uri === 'motionary://manifest') return { uri, mimeType: 'application/json', text: JSON.stringify(m) };
176
+ if (uri === 'motionary://llms.txt') {
177
+ const p = join(HERE, '../dist/llms.txt');
178
+ const t = existsSync(p) ? readFileSync(p, 'utf8') : m.components.map((c) => `- <${c.tag}> (${c.import.path}): ${c.description}`).join('\n');
179
+ return { uri, mimeType: 'text/plain', text: t };
180
+ }
181
+ const mm = /^motionary:\/\/component\/(.+)$/.exec(uri);
182
+ if (mm) {
183
+ const c = findComponent(m, decodeURIComponent(mm[1]));
184
+ if (c) return { uri, mimeType: 'application/json', text: JSON.stringify(c, null, 2) };
185
+ }
186
+ throw Object.assign(new Error(`unknown resource ${uri}`), { code: -32002 });
187
+ }
188
+
189
+ /** Handle one JSON-RPC message; returns the response object (or null for notifications). */
190
+ export function handle(m, msg, state = {}) {
191
+ const { id, method, params = {} } = msg || {};
192
+ const isNote = id === undefined || id === null;
193
+ const ok = (result) => (isNote ? null : { jsonrpc: '2.0', id, result });
194
+ const err = (code, message) => (isNote ? null : { jsonrpc: '2.0', id, error: { code, message } });
195
+ if (!msg || msg.jsonrpc !== '2.0' || typeof method !== 'string') return msg && 'result' in msg ? null : err(-32600, 'Invalid Request');
196
+ try {
197
+ switch (method) {
198
+ case 'initialize': {
199
+ const v = PROTOCOLS.includes(params.protocolVersion) ? params.protocolVersion : PROTOCOLS[0];
200
+ state.initialized = true;
201
+ return ok({ protocolVersion: v, capabilities: { tools: { listChanged: false }, resources: { listChanged: false, subscribe: false }, prompts: { listChanged: false }, logging: {} }, serverInfo: { ...SERVER, title: 'Motionary component catalog' }, instructions: `Read-only catalog of Motionary ${m.version} (${m.components.length} <usa-*> Web Components + motionary/runtime modules). Search or list to pick a component, get_component for its API, scaffold_snippet for code that already registers every prerequisite in the right order.` });
202
+ }
203
+ case 'ping':
204
+ return ok({});
205
+ case 'tools/list':
206
+ return ok({ tools: TOOLS });
207
+ case 'tools/call':
208
+ try {
209
+ return ok(callTool(m, params.name, params.arguments || {}));
210
+ } catch (e) {
211
+ if (e.code === -32602) return err(-32602, e.message);
212
+ return ok({ content: [{ type: 'text', text: String(e.message || e) }], isError: true });
213
+ }
214
+ case 'resources/list':
215
+ return ok({ resources: resources(m) });
216
+ case 'resources/templates/list':
217
+ return ok({ resourceTemplates: [{ uriTemplate: 'motionary://component/{tag}', name: 'component', title: 'One Motionary component (JSON)', mimeType: 'application/json' }] });
218
+ case 'resources/read':
219
+ return ok({ contents: [readResource(m, params.uri)] });
220
+ case 'prompts/list':
221
+ return ok({ prompts: [] });
222
+ case 'logging/setLevel':
223
+ return ok({});
224
+ default:
225
+ if (method.startsWith('notifications/')) return null;
226
+ return err(-32601, `Method not found: ${method}`);
227
+ }
228
+ } catch (e) {
229
+ return err(e.code || -32603, String(e.message || e));
230
+ }
231
+ }
232
+
233
+ export function serve(input = process.stdin, output = process.stdout, manifest) {
234
+ const m = manifest || loadManifest();
235
+ const state = {};
236
+ const send = (o) => o && output.write(JSON.stringify(o) + '\n');
237
+ const rl = createInterface({ input, crlfDelay: Infinity });
238
+ rl.on('line', (line) => {
239
+ if (!line.trim()) return;
240
+ let msg;
241
+ try {
242
+ msg = JSON.parse(line);
243
+ } catch {
244
+ return send({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } });
245
+ }
246
+ if (Array.isArray(msg)) msg.forEach((x) => send(handle(m, x, state)));
247
+ else send(handle(m, msg, state));
248
+ });
249
+ return rl;
250
+ }
251
+
252
+ const invoked = process.argv[1] && fileURLToPath(import.meta.url) === (await import('node:fs')).realpathSync(process.argv[1]);
253
+ if (invoked) {
254
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
255
+ console.log('motionary-mcp — read-only MCP server (stdio) for the Motionary component catalog.\nConfigure your MCP client with: { "command": "npx", "args": ["-y", "-p", "motionary", "motionary-mcp"] }\nTools: ' + TOOLS.map((t) => t.name).join(', '));
256
+ } else if (process.argv.includes('--version')) console.log(SERVER.version);
257
+ else {
258
+ try {
259
+ serve();
260
+ } catch (e) {
261
+ console.error(String(e.message || e));
262
+ process.exit(1);
263
+ }
264
+ }
265
+ }
@@ -0,0 +1,166 @@
1
+ import { P as Playable } from './tween-BcejKpsx.js';
2
+
3
+ /**
4
+ * Shared internals of the animated-image loaders (`format-gif`, `format-apng`,
5
+ * `format-webp`, 10.4): the decoded-animation shape, frame compositing in
6
+ * plain RGBA arrays (no DOM — works in workers and on the server), the
7
+ * browser image decoder used for APNG / WebP frames, and the canvas player
8
+ * (a runtime `Playable`, so it can be paused, reversed, scrubbed and driven
9
+ * by a scroll scene). Bundled into each loader; not a public module.
10
+ */
11
+ /** Browsers clamp tiny delays (0–10 ms) to 100 ms; we do the same. */
12
+ const fixDelay = (ms) => (ms <= 10 ? 100 : ms);
13
+ /** Composite frame parts onto a `width × height` canvas (pure; RGBA in, RGBA out). */
14
+ function composeFrames(width, height, parts, background) {
15
+ const canvas = new Uint8ClampedArray(width * height * 4);
16
+ const out = [];
17
+ for (const p of parts) {
18
+ const before = p.dispose === 'previous' ? canvas.slice() : null;
19
+ const { width: w, height: h, data } = p.image;
20
+ for (let y = 0; y < h; y++) {
21
+ const cy = p.y + y;
22
+ if (cy < 0 || cy >= height)
23
+ continue;
24
+ for (let x = 0; x < w; x++) {
25
+ const cx = p.x + x;
26
+ if (cx < 0 || cx >= width)
27
+ continue;
28
+ const s = (y * w + x) * 4, d = (cy * width + cx) * 4;
29
+ const a = data[s + 3];
30
+ if (p.blend === 'source' || a === 255) {
31
+ canvas[d] = data[s];
32
+ canvas[d + 1] = data[s + 1];
33
+ canvas[d + 2] = data[s + 2];
34
+ canvas[d + 3] = a;
35
+ }
36
+ else if (a) {
37
+ // straight-alpha "over"
38
+ const da = canvas[d + 3] / 255, sa = a / 255, oa = sa + da * (1 - sa);
39
+ for (let c = 0; c < 3; c++)
40
+ canvas[d + c] = (data[s + c] * sa + canvas[d + c] * da * (1 - sa)) / oa;
41
+ canvas[d + 3] = oa * 255;
42
+ }
43
+ }
44
+ }
45
+ out.push({ delay: p.delay, image: { width, height, data: canvas.slice() } });
46
+ if (p.dispose === 'background') {
47
+ for (let y = Math.max(0, p.y); y < Math.min(height, p.y + h); y++)
48
+ for (let x = Math.max(0, p.x); x < Math.min(width, p.x + w); x++)
49
+ canvas.set(background || [0, 0, 0, 0], (y * width + x) * 4);
50
+ }
51
+ else if (before)
52
+ canvas.set(before);
53
+ }
54
+ return out;
55
+ }
56
+ /** Default decoder: the browser's own (`createImageBitmap` + a 2D canvas; OffscreenCanvas in workers). */
57
+ const browserDecode = async (bytes, mime) => {
58
+ const g = globalThis;
59
+ if (typeof g.createImageBitmap !== 'function')
60
+ throw new Error('[motionary] no image decoder here (createImageBitmap is missing) — pass { decode } to the loader');
61
+ const bmp = await g.createImageBitmap(new Blob([bytes], { type: mime }));
62
+ const w = bmp.width, h = bmp.height; // read before close(): a closed ImageBitmap reports 0 × 0
63
+ const c = typeof g.OffscreenCanvas === 'function' ? new g.OffscreenCanvas(w, h) : Object.assign(document.createElement('canvas'), { width: w, height: h });
64
+ const ctx = c.getContext('2d', { willReadFrequently: true });
65
+ ctx.drawImage(bmp, 0, 0);
66
+ bmp.close?.();
67
+ const id = ctx.getImageData(0, 0, w, h);
68
+ return { width: id.width, height: id.height, data: id.data };
69
+ };
70
+ /** Read a `src` (URL, ArrayBuffer, typed array or Blob) into bytes. */
71
+ async function bytesOf(src) {
72
+ if (typeof src === 'string') {
73
+ const r = await fetch(src);
74
+ if (!r.ok)
75
+ throw new Error(`[motionary] could not load ${src} (${r.status})`);
76
+ return new Uint8Array(await r.arrayBuffer());
77
+ }
78
+ if (src instanceof ArrayBuffer)
79
+ return new Uint8Array(src);
80
+ if (ArrayBuffer.isView(src))
81
+ return new Uint8Array(src.buffer, src.byteOffset, src.byteLength);
82
+ return new Uint8Array(await src.arrayBuffer());
83
+ }
84
+ class AnimImagePlayer extends Playable {
85
+ constructor(canvas, anim, o) {
86
+ super({ repeat: o.repeat ?? (anim.plays === 0 ? -1 : Math.max(0, anim.plays - 1)), yoyo: o.yoyo });
87
+ this.canvas = canvas;
88
+ this.anim = anim;
89
+ this.times = [0];
90
+ this.cur = -1;
91
+ this.timeScale = o.speed || 1;
92
+ for (const f of anim.frames)
93
+ this.times.push(this.times[this.times.length - 1] + f.delay);
94
+ if (canvas.width !== anim.width)
95
+ canvas.width = anim.width;
96
+ if (canvas.height !== anim.height)
97
+ canvas.height = anim.height;
98
+ this.ctx = canvas.getContext('2d');
99
+ this.datas = anim.frames.map(() => null);
100
+ this.show(0);
101
+ if (!o.paused)
102
+ this.play();
103
+ }
104
+ get duration() {
105
+ return this.times[this.times.length - 1];
106
+ }
107
+ get frame() {
108
+ return this.cur;
109
+ }
110
+ get frameCount() {
111
+ return this.anim.frames.length;
112
+ }
113
+ renderLocal(ms) {
114
+ const t = Math.min(ms, this.duration - 0.001);
115
+ let lo = 0, hi = this.anim.frames.length - 1;
116
+ while (lo < hi) {
117
+ const mid = (lo + hi + 1) >> 1;
118
+ if (this.times[mid] <= t)
119
+ lo = mid;
120
+ else
121
+ hi = mid - 1;
122
+ }
123
+ this.show(lo);
124
+ }
125
+ show(i) {
126
+ if (i === this.cur || !this.ctx)
127
+ return;
128
+ this.cur = i;
129
+ const f = this.anim.frames[i];
130
+ if (!f)
131
+ return;
132
+ let d = this.datas[i];
133
+ if (!d && typeof ImageData === 'function')
134
+ d = this.datas[i] = new ImageData(new Uint8ClampedArray(f.image.data), f.image.width, f.image.height);
135
+ if (d)
136
+ this.ctx.putImageData(d, 0, 0);
137
+ }
138
+ }
139
+ /** Play a decoded animation on a canvas as a runtime timeline (seek / reverse / `progress` scrub). */
140
+ function animatedImagePlayer(canvas, anim, o = {}) {
141
+ if (!anim.frames.length)
142
+ throw new Error('[motionary] animatedImagePlayer: the animation has no frames');
143
+ return new AnimImagePlayer(canvas, anim, o);
144
+ }
145
+ /** A plain Uint8Array view (Node Buffers' `slice()` shares memory — normalise them away). */
146
+ const u8 = (x) => (x instanceof ArrayBuffer ? new Uint8Array(x) : new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
147
+ /** CRC-32 (PNG chunks). */
148
+ let CRC = null;
149
+ function crc32(bytes, start = 0, end = bytes.length) {
150
+ if (!CRC) {
151
+ CRC = new Uint32Array(256);
152
+ for (let n = 0; n < 256; n++) {
153
+ let c = n;
154
+ for (let k = 0; k < 8; k++)
155
+ c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
156
+ CRC[n] = c >>> 0;
157
+ }
158
+ }
159
+ let c = 0xffffffff;
160
+ for (let i = start; i < end; i++)
161
+ c = CRC[(c ^ bytes[i]) & 0xff] ^ (c >>> 8);
162
+ return (c ^ 0xffffffff) >>> 0;
163
+ }
164
+
165
+ export { animatedImagePlayer as a, browserDecode as b, composeFrames as c, bytesOf as d, crc32 as e, fixDelay as f, u8 as u };
166
+ //# sourceMappingURL=anim-image-DDdb9q3X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anim-image-DDdb9q3X.js","sources":["../../src/runtime/anim-image.ts"],"sourcesContent":["/**\n * Shared internals of the animated-image loaders (`format-gif`, `format-apng`,\n * `format-webp`, 10.4): the decoded-animation shape, frame compositing in\n * plain RGBA arrays (no DOM — works in workers and on the server), the\n * browser image decoder used for APNG / WebP frames, and the canvas player\n * (a runtime `Playable`, so it can be paused, reversed, scrubbed and driven\n * by a scroll scene). Bundled into each loader; not a public module.\n */\nimport { Playable } from './tween';\n\n/** An RGBA bitmap (the shape of `ImageData`, without needing the DOM). */\nexport interface Rgba {\n width: number;\n height: number;\n data: Uint8ClampedArray;\n}\n\n/** One frame of an animation, already composited to the full canvas size. */\nexport interface AnimFrame {\n /** Display time, ms. */\n delay: number;\n image: Rgba;\n}\n\nexport interface AnimatedImage {\n format: 'gif' | 'apng' | 'webp';\n width: number;\n height: number;\n /** Number of plays: 0 = forever, 1 = once, … */\n plays: number;\n frames: AnimFrame[];\n}\n\n/** A frame region before compositing (APNG fcTL / WebP ANMF / GIF descriptor). */\nexport interface FramePart {\n x: number;\n y: number;\n image: Rgba;\n delay: number;\n /** 'over' alpha-blends onto the canvas, 'source' replaces the region. */\n blend: 'over' | 'source';\n /** What happens to the region after the frame is shown. */\n dispose: 'none' | 'background' | 'previous';\n}\n\n/** Browsers clamp tiny delays (0–10 ms) to 100 ms; we do the same. */\nexport const fixDelay = (ms: number): number => (ms <= 10 ? 100 : ms);\n\n/** Composite frame parts onto a `width × height` canvas (pure; RGBA in, RGBA out). */\nexport function composeFrames(width: number, height: number, parts: FramePart[], background?: [number, number, number, number]): AnimFrame[] {\n const canvas = new Uint8ClampedArray(width * height * 4);\n const out: AnimFrame[] = [];\n for (const p of parts) {\n const before = p.dispose === 'previous' ? canvas.slice() : null;\n const { width: w, height: h, data } = p.image;\n for (let y = 0; y < h; y++) {\n const cy = p.y + y;\n if (cy < 0 || cy >= height) continue;\n for (let x = 0; x < w; x++) {\n const cx = p.x + x;\n if (cx < 0 || cx >= width) continue;\n const s = (y * w + x) * 4, d = (cy * width + cx) * 4;\n const a = data[s + 3];\n if (p.blend === 'source' || a === 255) {\n canvas[d] = data[s]; canvas[d + 1] = data[s + 1]; canvas[d + 2] = data[s + 2]; canvas[d + 3] = a;\n } else if (a) {\n // straight-alpha \"over\"\n const da = canvas[d + 3] / 255, sa = a / 255, oa = sa + da * (1 - sa);\n for (let c = 0; c < 3; c++) canvas[d + c] = (data[s + c] * sa + canvas[d + c] * da * (1 - sa)) / oa;\n canvas[d + 3] = oa * 255;\n }\n }\n }\n out.push({ delay: p.delay, image: { width, height, data: canvas.slice() } });\n if (p.dispose === 'background') {\n for (let y = Math.max(0, p.y); y < Math.min(height, p.y + h); y++)\n for (let x = Math.max(0, p.x); x < Math.min(width, p.x + w); x++) canvas.set(background || [0, 0, 0, 0], (y * width + x) * 4);\n } else if (before) canvas.set(before);\n }\n return out;\n}\n\n/** Image decoder for one frame file (PNG / WebP bytes) → RGBA. Replaceable (workers, tests, servers). */\nexport type FrameDecoder = (bytes: Uint8Array, mime: string) => Promise<Rgba>;\n\n/** Default decoder: the browser's own (`createImageBitmap` + a 2D canvas; OffscreenCanvas in workers). */\nexport const browserDecode: FrameDecoder = async (bytes, mime) => {\n const g = globalThis as any;\n if (typeof g.createImageBitmap !== 'function') throw new Error('[motionary] no image decoder here (createImageBitmap is missing) — pass { decode } to the loader');\n const bmp = await g.createImageBitmap(new Blob([bytes as BlobPart], { type: mime }));\n const w = bmp.width, h = bmp.height; // read before close(): a closed ImageBitmap reports 0 × 0\n const c = typeof g.OffscreenCanvas === 'function' ? new g.OffscreenCanvas(w, h) : Object.assign(document.createElement('canvas'), { width: w, height: h });\n const ctx = c.getContext('2d', { willReadFrequently: true });\n ctx.drawImage(bmp, 0, 0);\n bmp.close?.();\n const id = ctx.getImageData(0, 0, w, h);\n return { width: id.width, height: id.height, data: id.data };\n};\n\n/** Read a `src` (URL, ArrayBuffer, typed array or Blob) into bytes. */\nexport async function bytesOf(src: string | ArrayBuffer | ArrayBufferView | Blob): Promise<Uint8Array> {\n if (typeof src === 'string') {\n const r = await fetch(src);\n if (!r.ok) throw new Error(`[motionary] could not load ${src} (${r.status})`);\n return new Uint8Array(await r.arrayBuffer());\n }\n if (src instanceof ArrayBuffer) return new Uint8Array(src);\n if (ArrayBuffer.isView(src)) return new Uint8Array(src.buffer, src.byteOffset, src.byteLength);\n return new Uint8Array(await (src as Blob).arrayBuffer());\n}\n\nexport interface AnimPlayerOptions {\n /** Extra repeats; default from the file (`plays`: 0 → forever). */\n repeat?: number;\n yoyo?: boolean;\n paused?: boolean;\n /** Playback speed (default 1). */\n speed?: number;\n}\n\nexport type AnimPlayer = Playable & { readonly frame: number; readonly frameCount: number };\n\nclass AnimImagePlayer extends Playable {\n private times: number[] = [0];\n private cur = -1;\n private ctx: CanvasRenderingContext2D | null;\n private datas: (ImageData | null)[];\n constructor(private canvas: HTMLCanvasElement | OffscreenCanvas, private anim: AnimatedImage, o: AnimPlayerOptions) {\n super({ repeat: o.repeat ?? (anim.plays === 0 ? -1 : Math.max(0, anim.plays - 1)), yoyo: o.yoyo });\n this.timeScale = o.speed || 1;\n for (const f of anim.frames) this.times.push(this.times[this.times.length - 1] + f.delay);\n if (canvas.width !== anim.width) canvas.width = anim.width;\n if (canvas.height !== anim.height) canvas.height = anim.height;\n this.ctx = canvas.getContext('2d') as CanvasRenderingContext2D | null;\n this.datas = anim.frames.map(() => null);\n this.show(0);\n if (!o.paused) this.play();\n }\n get duration(): number {\n return this.times[this.times.length - 1];\n }\n get frame(): number {\n return this.cur;\n }\n get frameCount(): number {\n return this.anim.frames.length;\n }\n protected renderLocal(ms: number): void {\n const t = Math.min(ms, this.duration - 0.001);\n let lo = 0, hi = this.anim.frames.length - 1;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (this.times[mid] <= t) lo = mid;\n else hi = mid - 1;\n }\n this.show(lo);\n }\n private show(i: number): void {\n if (i === this.cur || !this.ctx) return;\n this.cur = i;\n const f = this.anim.frames[i];\n if (!f) return;\n let d = this.datas[i];\n if (!d && typeof ImageData === 'function') d = this.datas[i] = new ImageData(new Uint8ClampedArray(f.image.data), f.image.width, f.image.height);\n if (d) this.ctx.putImageData(d, 0, 0);\n }\n}\n\n/** Play a decoded animation on a canvas as a runtime timeline (seek / reverse / `progress` scrub). */\nexport function animatedImagePlayer(canvas: HTMLCanvasElement | OffscreenCanvas, anim: AnimatedImage, o: AnimPlayerOptions = {}): AnimPlayer {\n if (!anim.frames.length) throw new Error('[motionary] animatedImagePlayer: the animation has no frames');\n return new AnimImagePlayer(canvas, anim, o);\n}\n\n/** A plain Uint8Array view (Node Buffers' `slice()` shares memory — normalise them away). */\nexport const u8 = (x: Uint8Array | ArrayBuffer): Uint8Array => (x instanceof ArrayBuffer ? new Uint8Array(x) : new Uint8Array(x.buffer, x.byteOffset, x.byteLength));\n\n/** CRC-32 (PNG chunks). */\nlet CRC: Uint32Array | null = null;\nexport function crc32(bytes: Uint8Array, start = 0, end = bytes.length): number {\n if (!CRC) {\n CRC = new Uint32Array(256);\n for (let n = 0; n < 256; n++) {\n let c = n;\n for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;\n CRC[n] = c >>> 0;\n }\n }\n let c = 0xffffffff;\n for (let i = start; i < end; i++) c = CRC[(c ^ bytes[i]) & 0xff] ^ (c >>> 8);\n return (c ^ 0xffffffff) >>> 0;\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;AAOG;AAsCH;MACa,QAAQ,GAAG,CAAC,EAAU,MA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