motionary 10.3.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 (390) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +35 -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-DVAC5sQI.js → keyframes-B5PWe5bU.js} +3 -2
  43. package/dist/chunks/keyframes-B5PWe5bU.js.map +1 -0
  44. package/dist/chunks/{keyframes-Dw9zwVQa.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-46AAzyeC.js → registry-CT-TT_bx.js} +3 -3
  57. package/dist/chunks/{registry-46AAzyeC.js.map → registry-CT-TT_bx.js.map} +1 -1
  58. package/dist/chunks/{registry-CSVil2qJ.cjs → registry-tzwKkldE.cjs} +2 -2
  59. package/dist/chunks/{registry-CSVil2qJ.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-COOYAyQy.js → ticker-C8lSGml9.js} +2 -2
  69. package/dist/chunks/{ticker-COOYAyQy.js.map → ticker-C8lSGml9.js.map} +1 -1
  70. package/dist/chunks/{ticker-gHv6pNfx.cjs → ticker-Un0bvTWR.cjs} +2 -2
  71. package/dist/chunks/{ticker-gHv6pNfx.cjs.map → ticker-Un0bvTWR.cjs.map} +1 -1
  72. package/dist/chunks/{tween-CGyolmzB.js → tween-BcejKpsx.js} +4 -90
  73. package/dist/chunks/tween-BcejKpsx.js.map +1 -0
  74. package/dist/chunks/{tween-CFN0WcOb.cjs → tween-CwLLC3Ko.cjs} +4 -94
  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 +569 -216
  283. package/dist/components/widgets.cjs.map +1 -1
  284. package/dist/components/widgets.d.cts +167 -2
  285. package/dist/components/widgets.d.ts +167 -2
  286. package/dist/components/widgets.js +575 -225
  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 +154 -1
  297. package/dist/llms.txt +9 -2
  298. package/dist/manifest.json +413 -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 +4 -3
  328. package/dist/runtime/format-sprite.cjs.map +1 -1
  329. package/dist/runtime/format-sprite.js +4 -3
  330. package/dist/runtime/format-sprite.js.map +1 -1
  331. package/dist/runtime/format-svg.cjs +5 -4
  332. package/dist/runtime/format-svg.cjs.map +1 -1
  333. package/dist/runtime/format-svg.js +4 -3
  334. package/dist/runtime/format-svg.js.map +1 -1
  335. package/dist/runtime/format-webp.cjs +123 -0
  336. package/dist/runtime/format-webp.cjs.map +1 -0
  337. package/dist/runtime/format-webp.d.cts +245 -0
  338. package/dist/runtime/format-webp.d.ts +245 -0
  339. package/dist/runtime/format-webp.iife.js +2 -0
  340. package/dist/runtime/format-webp.iife.js.map +1 -0
  341. package/dist/runtime/format-webp.js +115 -0
  342. package/dist/runtime/format-webp.js.map +1 -0
  343. package/dist/runtime/scroll.cjs +2 -2
  344. package/dist/runtime/scroll.cjs.map +1 -1
  345. package/dist/runtime/scroll.js +2 -2
  346. package/dist/runtime/scroll.js.map +1 -1
  347. package/dist/runtime/smooth.cjs +284 -0
  348. package/dist/runtime/smooth.cjs.map +1 -0
  349. package/dist/runtime/smooth.d.cts +137 -0
  350. package/dist/runtime/smooth.d.ts +137 -0
  351. package/dist/runtime/smooth.iife.js +2 -0
  352. package/dist/runtime/smooth.iife.js.map +1 -0
  353. package/dist/runtime/smooth.js +279 -0
  354. package/dist/runtime/smooth.js.map +1 -0
  355. package/dist/runtime/text.cjs +1 -1
  356. package/dist/runtime/text.cjs.map +1 -1
  357. package/dist/runtime/text.js +1 -1
  358. package/dist/runtime/text.js.map +1 -1
  359. package/dist/runtime.cjs +9 -8
  360. package/dist/runtime.cjs.map +1 -1
  361. package/dist/runtime.d.cts +1 -1
  362. package/dist/runtime.d.ts +1 -1
  363. package/dist/runtime.iife.js +1 -1
  364. package/dist/runtime.iife.js.map +1 -1
  365. package/dist/runtime.js +6 -5
  366. package/dist/runtime.js.map +1 -1
  367. package/dist/solid.cjs.map +1 -1
  368. package/dist/solid.js.map +1 -1
  369. package/dist/svelte.cjs.map +1 -1
  370. package/dist/svelte.js.map +1 -1
  371. package/dist/vue.cjs.map +1 -1
  372. package/dist/vue.js.map +1 -1
  373. package/dist/widgets.umd.js +1 -1
  374. package/dist/widgets.umd.js.map +1 -1
  375. package/docs/ROADMAP.md +1 -1
  376. package/docs/components/README.md +10 -7
  377. package/docs/components/usa-parallax-layers.md +38 -0
  378. package/docs/components/usa-scroll-ring.md +32 -0
  379. package/docs/components/usa-smooth-scroll.md +60 -0
  380. package/docs/components.md +49 -0
  381. package/docs/mcp.md +50 -0
  382. package/docs/runtime/format-apng.md +59 -0
  383. package/docs/runtime/format-gif.md +60 -0
  384. package/docs/runtime/format-webp.md +58 -0
  385. package/docs/runtime/smooth.md +60 -0
  386. package/package.json +44 -2
  387. package/dist/chunks/keyframes-DVAC5sQI.js.map +0 -1
  388. package/dist/chunks/keyframes-Dw9zwVQa.cjs.map +0 -1
  389. package/dist/chunks/tween-CFN0WcOb.cjs.map +0 -1
  390. package/dist/chunks/tween-CGyolmzB.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-webp.iife.js","sources":["../../src/runtime/anim-image.ts","../../src/runtime/format-webp.ts","../../src/runtime/iife/format-webp.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","/**\n * `motionary/runtime/format-webp` (10.4) — animated WebP loader written for\n * Motionary: reads the RIFF container (`VP8X`, `ANIM`, `ANMF`), rebuilds each\n * frame (lossy `VP8 ` with optional `ALPH`, or lossless `VP8L`) as a\n * standalone WebP file that the browser's own decoder decodes, then\n * composites the frames (blending on / off, dispose to background) into\n * full-size RGBA. A still WebP loads as a one-frame animation.\n *\n * `parseWebp()` and `webpFrameFiles()` are pure (no DOM); `decodeWebp()` uses\n * the browser decoder by default (also in workers) or your own `{ decode }`.\n * Browsers without WebP support cannot decode the frames — fall back to `<img>`.\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { composeFrames, fixDelay, bytesOf, browserDecode, animatedImagePlayer, u8, type AnimatedImage, type FramePart, type FrameDecoder } from './anim-image';\n\nexport type { AnimatedImage, AnimFrame, Rgba, AnimPlayer, AnimPlayerOptions, FrameDecoder } from './anim-image';\nexport { animatedImagePlayer } from './anim-image';\n\nexport interface WebpChunk {\n type: string;\n data: Uint8Array;\n}\n\nexport interface WebpFrameInfo {\n x: number;\n y: number;\n width: number;\n height: number;\n delay: number;\n blend: FramePart['blend'];\n dispose: FramePart['dispose'];\n /** The frame's image chunks (ALPH? + VP8, or VP8L). */\n chunks: WebpChunk[];\n}\n\nexport interface WebpInfo {\n width: number;\n height: number;\n animated: boolean;\n /** ANIM loop count (0 = forever); 1 for a still image. */\n plays: number;\n /** ANIM background colour as [r, g, b, a] (a hint; browsers composite on transparent). */\n background: [number, number, number, number];\n frames: WebpFrameInfo[];\n}\n\nconst u24 = (b: Uint8Array, i: number) => b[i] | (b[i + 1] << 8) | (b[i + 2] << 16);\nconst u32le = (b: Uint8Array, i: number) => (b[i] | (b[i + 1] << 8) | (b[i + 2] << 16) | (b[i + 3] << 24)) >>> 0;\nconst tag = (b: Uint8Array, i: number) => String.fromCharCode(b[i], b[i + 1], b[i + 2], b[i + 3]);\n\n/** Read RIFF chunks from `start` to `end` (pure). */\nexport function riffChunks(b: Uint8Array, start = 12, end = b.length): WebpChunk[] {\n const out: WebpChunk[] = [];\n let p = start;\n while (p + 8 <= end) {\n const n = u32le(b, p + 4);\n out.push({ type: tag(b, p), data: b.subarray(p + 8, p + 8 + n) });\n p += 8 + n + (n & 1);\n }\n return out;\n}\n\n/** Size of a still VP8 / VP8L bitstream. */\nfunction bitstreamSize(c: WebpChunk): [number, number] {\n const d = c.data;\n if (c.type === 'VP8L') {\n const bits = u32le(d, 1);\n return [(bits & 0x3fff) + 1, ((bits >> 14) & 0x3fff) + 1];\n }\n return [(d[6] | (d[7] << 8)) & 0x3fff, (d[8] | (d[9] << 8)) & 0x3fff];\n}\n\n/** Parse the container (pure; no pixels decoded). */\nexport function parseWebp(input: Uint8Array | ArrayBuffer): WebpInfo {\n const b = u8(input);\n if (tag(b, 0) !== 'RIFF' || tag(b, 8) !== 'WEBP') throw new Error('[motionary] format-webp: not a WebP file');\n const chunks = riffChunks(b, 12, Math.min(b.length, 8 + u32le(b, 4)));\n const x = chunks.find((c) => c.type === 'VP8X');\n const anim = chunks.find((c) => c.type === 'ANIM');\n const anmf = chunks.filter((c) => c.type === 'ANMF');\n if (x && anim && anmf.length) {\n const width = u24(x.data, 4) + 1, height = u24(x.data, 7) + 1;\n const bg = anim.data;\n const frames = anmf.map((f): WebpFrameInfo => {\n const d = f.data, flags = d[15];\n return { x: u24(d, 0) * 2, y: u24(d, 3) * 2, width: u24(d, 6) + 1, height: u24(d, 9) + 1, delay: fixDelay(u24(d, 12)), blend: flags & 2 ? 'source' : 'over', dispose: flags & 1 ? 'background' : 'none', chunks: riffChunks(d, 16, d.length).filter((c) => /^(ALPH|VP8 |VP8L)$/.test(c.type)) };\n });\n // ANIM background is stored B, G, R, A\n return { width, height, animated: true, plays: bg[4] | (bg[5] << 8), background: [bg[2], bg[1], bg[0], bg[3]], frames };\n }\n const img = chunks.filter((c) => /^(ALPH|VP8 |VP8L)$/.test(c.type));\n const main = img.find((c) => c.type !== 'ALPH');\n if (!main) throw new Error('[motionary] format-webp: no image data');\n const [w, h] = x ? [u24(x.data, 4) + 1, u24(x.data, 7) + 1] : bitstreamSize(main);\n return { width: w, height: h, animated: false, plays: 1, background: [0, 0, 0, 0], frames: [{ x: 0, y: 0, width: w, height: h, delay: 100, blend: 'source', dispose: 'none', chunks: img }] };\n}\n\nfunction riff(chunks: WebpChunk[]): Uint8Array {\n const size = chunks.reduce((n, c) => n + 8 + c.data.length + (c.data.length & 1), 4);\n const out = new Uint8Array(8 + size);\n const v = new DataView(out.buffer);\n const put = (s: string, i: number) => { for (let k = 0; k < 4; k++) out[i + k] = s.charCodeAt(k); };\n put('RIFF', 0);\n v.setUint32(4, size, true);\n put('WEBP', 8);\n let p = 12;\n for (const c of chunks) {\n put(c.type, p);\n v.setUint32(p + 4, c.data.length, true);\n out.set(c.data, p + 8);\n p += 8 + c.data.length + (c.data.length & 1);\n }\n return out;\n}\n\n/** Rebuild every frame as a standalone (still) WebP file (pure). */\nexport function webpFrameFiles(info: WebpInfo): Uint8Array[] {\n return info.frames.map((f) => {\n if (!f.chunks.some((c) => c.type === 'ALPH')) return riff(f.chunks.filter((c) => c.type !== 'ALPH'));\n // lossy + alpha needs an extended header (VP8X with the alpha flag)\n const vp8x = new Uint8Array(10);\n vp8x[0] = 0x10;\n const w = f.width - 1, h = f.height - 1;\n vp8x.set([w & 255, (w >> 8) & 255, (w >> 16) & 255, h & 255, (h >> 8) & 255, (h >> 16) & 255], 4);\n return riff([{ type: 'VP8X', data: vp8x }, ...f.chunks]);\n });\n}\n\n/** Decode an animated (or still) WebP into composited RGBA frames. */\nexport async function decodeWebp(input: Uint8Array | ArrayBuffer, o: { decode?: FrameDecoder } = {}): Promise<AnimatedImage & { info: WebpInfo }> {\n const info = parseWebp(input);\n const decode = o.decode || browserDecode;\n const images = await Promise.all(webpFrameFiles(info).map((f) => decode(f, 'image/webp')));\n const parts: FramePart[] = info.frames.map((f, i) => ({ x: f.x, y: f.y, image: images[i], delay: f.delay, blend: f.blend, dispose: f.dispose }));\n return { format: 'webp', width: info.width, height: info.height, plays: info.plays, frames: composeFrames(info.width, info.height, parts), info };\n}\n\n/** Fetch (URL) or read (ArrayBuffer / Blob / bytes) and decode a WebP. */\nexport async function loadWebp(src: string | ArrayBuffer | ArrayBufferView | Blob, o: { decode?: FrameDecoder } = {}): Promise<AnimatedImage & { info: WebpInfo }> {\n return decodeWebp(await bytesOf(src), o);\n}\n\nexport interface FormatWebpApi {\n parseWebp: typeof parseWebp;\n webpFrameFiles: typeof webpFrameFiles;\n decodeWebp: typeof decodeWebp;\n loadWebp: typeof loadWebp;\n animatedImagePlayer: typeof animatedImagePlayer;\n}\n\n/** The module object for `use(formatWebp)`. */\nexport const formatWebp: RuntimeModule<FormatWebpApi> = { id: 'format-webp', version: RUNTIME_VERSION, requires: ['core'], api: { parseWebp, webpFrameFiles, decodeWebp, loadWebp, animatedImagePlayer } };\n","// CDN build: load runtime.iife.js first, then this file → registers motionary/runtime/format-webp and adds its API to window.MotionaryRuntime.\nimport { register } from '../registry';\nimport { formatWebp } from '../format-webp';\nexport * from '../format-webp';\nregister(formatWebp);\n"],"names":["composeFrames","width","height","parts","background","canvas","Uint8ClampedArray","out","p","before","dispose","slice","w","h","data","image","y","cy","x","cx","s","d","a","blend","da","sa","oa","c","push","delay","Math","max","min","set","browserDecode","async","bytes","mime","g","globalThis","createImageBitmap","Error","bmp","Blob","type","ctx","OffscreenCanvas","Object","assign","document","createElement","getContext","willReadFrequently","drawImage","close","id","getImageData","AnimImagePlayer","Playable","constructor","anim","o","super","repeat","plays","yoyo","this","times","cur","timeScale","speed","f","frames","length","datas","map","show","paused","play","duration","frame","frameCount","renderLocal","ms","t","lo","hi","mid","i","ImageData","putImageData","animatedImagePlayer","u24","b","u32le","tag","String","fromCharCode","riffChunks","start","end","n","subarray","parseWebp","input","ArrayBuffer","Uint8Array","buffer","byteOffset","byteLength","u8","chunks","find","anmf","filter","bg","flags","test","animated","img","main","bits","bitstreamSize","riff","size","reduce","v","DataView","put","k","charCodeAt","setUint32","webpFrameFiles","info","some","vp8x","decodeWebp","decode","images","Promise","all","format","loadWebp","src","r","fetch","ok","status","arrayBuffer","isView","bytesOf","formatWebp","version","RUNTIME_VERSION","requires","api","register"],"mappings":"8BAiDM,SAAUA,EAAcC,EAAeC,EAAgBC,EAAoBC,GAC/E,MAAMC,EAAS,IAAIC,kBAAkBL,EAAQC,EAAS,GAChDK,EAAmB,GACzB,IAAK,MAAMC,KAAKL,EAAO,CACrB,MAAMM,EAAuB,aAAdD,EAAEE,QAAyBL,EAAOM,QAAU,MACnDV,MAAOW,EAAGV,OAAQW,EAACC,KAAEA,GAASN,EAAEO,MACxC,IAAK,IAAIC,EAAI,EAAGA,EAAIH,EAAGG,IAAK,CAC1B,MAAMC,EAAKT,EAAEQ,EAAIA,EACjB,KAAIC,EAAK,GAAKA,GAAMf,GACpB,IAAK,IAAIgB,EAAI,EAAGA,EAAIN,EAAGM,IAAK,CAC1B,MAAMC,EAAKX,EAAEU,EAAIA,EACjB,GAAIC,EAAK,GAAKA,GAAMlB,EAAO,SAC3B,MAAMmB,EAAkB,GAAbJ,EAAIJ,EAAIM,GAAQG,EAAwB,GAAnBJ,EAAKhB,EAAQkB,GACvCG,EAAIR,EAAKM,EAAI,GACnB,GAAgB,WAAZZ,EAAEe,OAA4B,MAAND,EAC1BjB,EAAOgB,GAAKP,EAAKM,GAAIf,EAAOgB,EAAI,GAAKP,EAAKM,EAAI,GAAIf,EAAOgB,EAAI,GAAKP,EAAKM,EAAI,GAAIf,EAAOgB,EAAI,GAAKC,OAC1F,GAAIA,EAAG,CAEZ,MAAME,EAAKnB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BwG,QAAeC,QAAQC,IAAIR,EAAeC,GAAM1D,IAAKJ,GAAMkE,EAAOlE,EAAG,gBACrEpE,EAAqBkI,EAAK7D,OAAOG,IAAI,CAACJ,EAAGiB,KAAC,CAAQtE,EAAGqD,EAAErD,EAAGF,EAAGuD,EAAEvD,EAAGD,MAAO2H,EAAOlD,GAAI3D,MAAO0C,EAAE1C,MAAON,MAAOgD,EAAEhD,MAAOb,QAAS6D,EAAE7D,WACrI,MAAO,CAAEmI,OAAQ,OAAQ5I,MAAOoI,EAAKpI,MAAOC,OAAQmI,EAAKnI,OAAQ8D,MAAOqE,EAAKrE,MAAOQ,OAAQxE,EAAcqI,EAAKpI,MAAOoI,EAAKnI,OAAQC,GAAQkI,OAC7I,CAGOlG,eAAe2G,EAASC,EAAoDlF,EAA+B,IAChH,OAAO2E,QDvCFrG,eAAuB4G,GAC5B,GAAmB,iBAARA,EAAkB,CAC3B,MAAMC,QAAUC,MAAMF,GACtB,IAAKC,EAAEE,GAAI,MAAM,IAAIzG,MAAM,8BAA8BsG,MAAQC,EAAEG,WACnE,OAAO,IAAIzC,iBAAiBsC,EAAEI,cAChC,CACA,OAAIL,aAAetC,YAAoB,IAAIC,WAAWqC,GAClDtC,YAAY4C,OAAON,GAAa,IAAIrC,WAAWqC,EAAIpC,OAAQoC,EAAInC,WAAYmC,EAAIlC,YAC5E,IAAIH,iBAAkBqC,EAAaK,cAC5C,CC8B0BE,CAAQP,GAAMlF,EACxC,CAWO,MAAM0F,EAA2C,CAAEhG,GAAI,cAAeiG,QAASC,EAAAA,gBAAiBC,SAAU,CAAC,QAASC,IAAK,CAAEpD,YAAW6B,iBAAgBI,aAAYM,WAAUnD,wBCnJnLiE,EAAAA,SAASL"}
@@ -0,0 +1,115 @@
1
+ import { R as RUNTIME_VERSION } from '../chunks/registry-CT-TT_bx.js';
2
+ import { a as animatedImagePlayer, b as browserDecode, c as composeFrames, d as bytesOf, u as u8, f as fixDelay } from '../chunks/anim-image-DDdb9q3X.js';
3
+ import '../chunks/tween-BcejKpsx.js';
4
+ import '../chunks/ticker-C8lSGml9.js';
5
+ import '../chunks/ease-XN8_0sXu.js';
6
+
7
+ /**
8
+ * `motionary/runtime/format-webp` (10.4) — animated WebP loader written for
9
+ * Motionary: reads the RIFF container (`VP8X`, `ANIM`, `ANMF`), rebuilds each
10
+ * frame (lossy `VP8 ` with optional `ALPH`, or lossless `VP8L`) as a
11
+ * standalone WebP file that the browser's own decoder decodes, then
12
+ * composites the frames (blending on / off, dispose to background) into
13
+ * full-size RGBA. A still WebP loads as a one-frame animation.
14
+ *
15
+ * `parseWebp()` and `webpFrameFiles()` are pure (no DOM); `decodeWebp()` uses
16
+ * the browser decoder by default (also in workers) or your own `{ decode }`.
17
+ * Browsers without WebP support cannot decode the frames — fall back to `<img>`.
18
+ */
19
+ const u24 = (b, i) => b[i] | (b[i + 1] << 8) | (b[i + 2] << 16);
20
+ const u32le = (b, i) => (b[i] | (b[i + 1] << 8) | (b[i + 2] << 16) | (b[i + 3] << 24)) >>> 0;
21
+ const tag = (b, i) => String.fromCharCode(b[i], b[i + 1], b[i + 2], b[i + 3]);
22
+ /** Read RIFF chunks from `start` to `end` (pure). */
23
+ function riffChunks(b, start = 12, end = b.length) {
24
+ const out = [];
25
+ let p = start;
26
+ while (p + 8 <= end) {
27
+ const n = u32le(b, p + 4);
28
+ out.push({ type: tag(b, p), data: b.subarray(p + 8, p + 8 + n) });
29
+ p += 8 + n + (n & 1);
30
+ }
31
+ return out;
32
+ }
33
+ /** Size of a still VP8 / VP8L bitstream. */
34
+ function bitstreamSize(c) {
35
+ const d = c.data;
36
+ if (c.type === 'VP8L') {
37
+ const bits = u32le(d, 1);
38
+ return [(bits & 0x3fff) + 1, ((bits >> 14) & 0x3fff) + 1];
39
+ }
40
+ return [(d[6] | (d[7] << 8)) & 0x3fff, (d[8] | (d[9] << 8)) & 0x3fff];
41
+ }
42
+ /** Parse the container (pure; no pixels decoded). */
43
+ function parseWebp(input) {
44
+ const b = u8(input);
45
+ if (tag(b, 0) !== 'RIFF' || tag(b, 8) !== 'WEBP')
46
+ throw new Error('[motionary] format-webp: not a WebP file');
47
+ const chunks = riffChunks(b, 12, Math.min(b.length, 8 + u32le(b, 4)));
48
+ const x = chunks.find((c) => c.type === 'VP8X');
49
+ const anim = chunks.find((c) => c.type === 'ANIM');
50
+ const anmf = chunks.filter((c) => c.type === 'ANMF');
51
+ if (x && anim && anmf.length) {
52
+ const width = u24(x.data, 4) + 1, height = u24(x.data, 7) + 1;
53
+ const bg = anim.data;
54
+ const frames = anmf.map((f) => {
55
+ const d = f.data, flags = d[15];
56
+ return { x: u24(d, 0) * 2, y: u24(d, 3) * 2, width: u24(d, 6) + 1, height: u24(d, 9) + 1, delay: fixDelay(u24(d, 12)), blend: flags & 2 ? 'source' : 'over', dispose: flags & 1 ? 'background' : 'none', chunks: riffChunks(d, 16, d.length).filter((c) => /^(ALPH|VP8 |VP8L)$/.test(c.type)) };
57
+ });
58
+ // ANIM background is stored B, G, R, A
59
+ return { width, height, animated: true, plays: bg[4] | (bg[5] << 8), background: [bg[2], bg[1], bg[0], bg[3]], frames };
60
+ }
61
+ const img = chunks.filter((c) => /^(ALPH|VP8 |VP8L)$/.test(c.type));
62
+ const main = img.find((c) => c.type !== 'ALPH');
63
+ if (!main)
64
+ throw new Error('[motionary] format-webp: no image data');
65
+ const [w, h] = x ? [u24(x.data, 4) + 1, u24(x.data, 7) + 1] : bitstreamSize(main);
66
+ return { width: w, height: h, animated: false, plays: 1, background: [0, 0, 0, 0], frames: [{ x: 0, y: 0, width: w, height: h, delay: 100, blend: 'source', dispose: 'none', chunks: img }] };
67
+ }
68
+ function riff(chunks) {
69
+ const size = chunks.reduce((n, c) => n + 8 + c.data.length + (c.data.length & 1), 4);
70
+ const out = new Uint8Array(8 + size);
71
+ const v = new DataView(out.buffer);
72
+ const put = (s, i) => { for (let k = 0; k < 4; k++)
73
+ out[i + k] = s.charCodeAt(k); };
74
+ put('RIFF', 0);
75
+ v.setUint32(4, size, true);
76
+ put('WEBP', 8);
77
+ let p = 12;
78
+ for (const c of chunks) {
79
+ put(c.type, p);
80
+ v.setUint32(p + 4, c.data.length, true);
81
+ out.set(c.data, p + 8);
82
+ p += 8 + c.data.length + (c.data.length & 1);
83
+ }
84
+ return out;
85
+ }
86
+ /** Rebuild every frame as a standalone (still) WebP file (pure). */
87
+ function webpFrameFiles(info) {
88
+ return info.frames.map((f) => {
89
+ if (!f.chunks.some((c) => c.type === 'ALPH'))
90
+ return riff(f.chunks.filter((c) => c.type !== 'ALPH'));
91
+ // lossy + alpha needs an extended header (VP8X with the alpha flag)
92
+ const vp8x = new Uint8Array(10);
93
+ vp8x[0] = 0x10;
94
+ const w = f.width - 1, h = f.height - 1;
95
+ vp8x.set([w & 255, (w >> 8) & 255, (w >> 16) & 255, h & 255, (h >> 8) & 255, (h >> 16) & 255], 4);
96
+ return riff([{ type: 'VP8X', data: vp8x }, ...f.chunks]);
97
+ });
98
+ }
99
+ /** Decode an animated (or still) WebP into composited RGBA frames. */
100
+ async function decodeWebp(input, o = {}) {
101
+ const info = parseWebp(input);
102
+ const decode = o.decode || browserDecode;
103
+ const images = await Promise.all(webpFrameFiles(info).map((f) => decode(f, 'image/webp')));
104
+ const parts = info.frames.map((f, i) => ({ x: f.x, y: f.y, image: images[i], delay: f.delay, blend: f.blend, dispose: f.dispose }));
105
+ return { format: 'webp', width: info.width, height: info.height, plays: info.plays, frames: composeFrames(info.width, info.height, parts), info };
106
+ }
107
+ /** Fetch (URL) or read (ArrayBuffer / Blob / bytes) and decode a WebP. */
108
+ async function loadWebp(src, o = {}) {
109
+ return decodeWebp(await bytesOf(src), o);
110
+ }
111
+ /** The module object for `use(formatWebp)`. */
112
+ const formatWebp = { id: 'format-webp', version: RUNTIME_VERSION, requires: ['core'], api: { parseWebp, webpFrameFiles, decodeWebp, loadWebp, animatedImagePlayer } };
113
+
114
+ export { animatedImagePlayer, decodeWebp, formatWebp, loadWebp, parseWebp, riffChunks, webpFrameFiles };
115
+ //# sourceMappingURL=format-webp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-webp.js","sources":["../../src/runtime/format-webp.ts"],"sourcesContent":["/**\n * `motionary/runtime/format-webp` (10.4) — animated WebP loader written for\n * Motionary: reads the RIFF container (`VP8X`, `ANIM`, `ANMF`), rebuilds each\n * frame (lossy `VP8 ` with optional `ALPH`, or lossless `VP8L`) as a\n * standalone WebP file that the browser's own decoder decodes, then\n * composites the frames (blending on / off, dispose to background) into\n * full-size RGBA. A still WebP loads as a one-frame animation.\n *\n * `parseWebp()` and `webpFrameFiles()` are pure (no DOM); `decodeWebp()` uses\n * the browser decoder by default (also in workers) or your own `{ decode }`.\n * Browsers without WebP support cannot decode the frames — fall back to `<img>`.\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { composeFrames, fixDelay, bytesOf, browserDecode, animatedImagePlayer, u8, type AnimatedImage, type FramePart, type FrameDecoder } from './anim-image';\n\nexport type { AnimatedImage, AnimFrame, Rgba, AnimPlayer, AnimPlayerOptions, FrameDecoder } from './anim-image';\nexport { animatedImagePlayer } from './anim-image';\n\nexport interface WebpChunk {\n type: string;\n data: Uint8Array;\n}\n\nexport interface WebpFrameInfo {\n x: number;\n y: number;\n width: number;\n height: number;\n delay: number;\n blend: FramePart['blend'];\n dispose: FramePart['dispose'];\n /** The frame's image chunks (ALPH? + VP8, or VP8L). */\n chunks: WebpChunk[];\n}\n\nexport interface WebpInfo {\n width: number;\n height: number;\n animated: boolean;\n /** ANIM loop count (0 = forever); 1 for a still image. */\n plays: number;\n /** ANIM background colour as [r, g, b, a] (a hint; browsers composite on transparent). */\n background: [number, number, number, number];\n frames: WebpFrameInfo[];\n}\n\nconst u24 = (b: Uint8Array, i: number) => b[i] | (b[i + 1] << 8) | (b[i + 2] << 16);\nconst u32le = (b: Uint8Array, i: number) => (b[i] | (b[i + 1] << 8) | (b[i + 2] << 16) | (b[i + 3] << 24)) >>> 0;\nconst tag = (b: Uint8Array, i: number) => String.fromCharCode(b[i], b[i + 1], b[i + 2], b[i + 3]);\n\n/** Read RIFF chunks from `start` to `end` (pure). */\nexport function riffChunks(b: Uint8Array, start = 12, end = b.length): WebpChunk[] {\n const out: WebpChunk[] = [];\n let p = start;\n while (p + 8 <= end) {\n const n = u32le(b, p + 4);\n out.push({ type: tag(b, p), data: b.subarray(p + 8, p + 8 + n) });\n p += 8 + n + (n & 1);\n }\n return out;\n}\n\n/** Size of a still VP8 / VP8L bitstream. */\nfunction bitstreamSize(c: WebpChunk): [number, number] {\n const d = c.data;\n if (c.type === 'VP8L') {\n const bits = u32le(d, 1);\n return [(bits & 0x3fff) + 1, ((bits >> 14) & 0x3fff) + 1];\n }\n return [(d[6] | (d[7] << 8)) & 0x3fff, (d[8] | (d[9] << 8)) & 0x3fff];\n}\n\n/** Parse the container (pure; no pixels decoded). */\nexport function parseWebp(input: Uint8Array | ArrayBuffer): WebpInfo {\n const b = u8(input);\n if (tag(b, 0) !== 'RIFF' || tag(b, 8) !== 'WEBP') throw new Error('[motionary] format-webp: not a WebP file');\n const chunks = riffChunks(b, 12, Math.min(b.length, 8 + u32le(b, 4)));\n const x = chunks.find((c) => c.type === 'VP8X');\n const anim = chunks.find((c) => c.type === 'ANIM');\n const anmf = chunks.filter((c) => c.type === 'ANMF');\n if (x && anim && anmf.length) {\n const width = u24(x.data, 4) + 1, height = u24(x.data, 7) + 1;\n const bg = anim.data;\n const frames = anmf.map((f): WebpFrameInfo => {\n const d = f.data, flags = d[15];\n return { x: u24(d, 0) * 2, y: u24(d, 3) * 2, width: u24(d, 6) + 1, height: u24(d, 9) + 1, delay: fixDelay(u24(d, 12)), blend: flags & 2 ? 'source' : 'over', dispose: flags & 1 ? 'background' : 'none', chunks: riffChunks(d, 16, d.length).filter((c) => /^(ALPH|VP8 |VP8L)$/.test(c.type)) };\n });\n // ANIM background is stored B, G, R, A\n return { width, height, animated: true, plays: bg[4] | (bg[5] << 8), background: [bg[2], bg[1], bg[0], bg[3]], frames };\n }\n const img = chunks.filter((c) => /^(ALPH|VP8 |VP8L)$/.test(c.type));\n const main = img.find((c) => c.type !== 'ALPH');\n if (!main) throw new Error('[motionary] format-webp: no image data');\n const [w, h] = x ? [u24(x.data, 4) + 1, u24(x.data, 7) + 1] : bitstreamSize(main);\n return { width: w, height: h, animated: false, plays: 1, background: [0, 0, 0, 0], frames: [{ x: 0, y: 0, width: w, height: h, delay: 100, blend: 'source', dispose: 'none', chunks: img }] };\n}\n\nfunction riff(chunks: WebpChunk[]): Uint8Array {\n const size = chunks.reduce((n, c) => n + 8 + c.data.length + (c.data.length & 1), 4);\n const out = new Uint8Array(8 + size);\n const v = new DataView(out.buffer);\n const put = (s: string, i: number) => { for (let k = 0; k < 4; k++) out[i + k] = s.charCodeAt(k); };\n put('RIFF', 0);\n v.setUint32(4, size, true);\n put('WEBP', 8);\n let p = 12;\n for (const c of chunks) {\n put(c.type, p);\n v.setUint32(p + 4, c.data.length, true);\n out.set(c.data, p + 8);\n p += 8 + c.data.length + (c.data.length & 1);\n }\n return out;\n}\n\n/** Rebuild every frame as a standalone (still) WebP file (pure). */\nexport function webpFrameFiles(info: WebpInfo): Uint8Array[] {\n return info.frames.map((f) => {\n if (!f.chunks.some((c) => c.type === 'ALPH')) return riff(f.chunks.filter((c) => c.type !== 'ALPH'));\n // lossy + alpha needs an extended header (VP8X with the alpha flag)\n const vp8x = new Uint8Array(10);\n vp8x[0] = 0x10;\n const w = f.width - 1, h = f.height - 1;\n vp8x.set([w & 255, (w >> 8) & 255, (w >> 16) & 255, h & 255, (h >> 8) & 255, (h >> 16) & 255], 4);\n return riff([{ type: 'VP8X', data: vp8x }, ...f.chunks]);\n });\n}\n\n/** Decode an animated (or still) WebP into composited RGBA frames. */\nexport async function decodeWebp(input: Uint8Array | ArrayBuffer, o: { decode?: FrameDecoder } = {}): Promise<AnimatedImage & { info: WebpInfo }> {\n const info = parseWebp(input);\n const decode = o.decode || browserDecode;\n const images = await Promise.all(webpFrameFiles(info).map((f) => decode(f, 'image/webp')));\n const parts: FramePart[] = info.frames.map((f, i) => ({ x: f.x, y: f.y, image: images[i], delay: f.delay, blend: f.blend, dispose: f.dispose }));\n return { format: 'webp', width: info.width, height: info.height, plays: info.plays, frames: composeFrames(info.width, info.height, parts), info };\n}\n\n/** Fetch (URL) or read (ArrayBuffer / Blob / bytes) and decode a WebP. */\nexport async function loadWebp(src: string | ArrayBuffer | ArrayBufferView | Blob, o: { decode?: FrameDecoder } = {}): Promise<AnimatedImage & { info: WebpInfo }> {\n return decodeWebp(await bytesOf(src), o);\n}\n\nexport interface FormatWebpApi {\n parseWebp: typeof parseWebp;\n webpFrameFiles: typeof webpFrameFiles;\n decodeWebp: typeof decodeWebp;\n loadWebp: typeof loadWebp;\n animatedImagePlayer: typeof animatedImagePlayer;\n}\n\n/** The module object for `use(formatWebp)`. */\nexport const formatWebp: RuntimeModule<FormatWebpApi> = { id: 'format-webp', version: RUNTIME_VERSION, requires: ['core'], api: { parseWebp, webpFrameFiles, decodeWebp, loadWebp, animatedImagePlayer } };\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;AAWG;AAmCH,MAAM,GAAG,GAAG,CAAC,CAAa,EAAE,CAAS,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACnF,MAAM,KAAK,GAAG,CAAC,CAAa,EAAE,CAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC;AAChH,MAAM,GAAG,GAAG,CAAC,CAAa,EAAE,CAAS,KAAK,MAA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AC,CAAC,OAAO,EAAE,CAAC,CAAC;AAChJ,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE;AACnJ;AAEA;AACO,eAAe,QAAQ,CAAC,GAAkD,EAAE,IAA+B,EAAE,EAAA;IAClH,OAAO,UAAU,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC1C;AAUA;AACO,MAAM,UAAU,GAAiC,EAAE,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var registry = require('../chunks/registry-CSVil2qJ.cjs');
4
- var ticker = require('../chunks/ticker-gHv6pNfx.cjs');
3
+ var registry = require('../chunks/registry-tzwKkldE.cjs');
4
+ var ticker = require('../chunks/ticker-Un0bvTWR.cjs');
5
5
 
6
6
  /**
7
7
  * `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.cjs","sources":["../../src/runtime/scroll.ts"],"sourcesContent":["/**\n * `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original\n * implementation: start / end rules, scrubbing (direct or smoothed), pinning,\n * debug markers, enter / leave callbacks and per-edge actions for a runtime\n * tween or timeline.\n *\n * ```ts\n * import { use, timeline } from 'motionary/runtime';\n * import { scroll, scrollScene } from 'motionary/runtime/scroll';\n * use(scroll);\n * const tl = timeline({ paused: true }).to('.card', { to: { x: 200, rotate: 8 } });\n * scrollScene({ trigger: '.section', start: 'top 80%', end: 'bottom 20%', scrub: 120, pin: true, markers: true, animation: tl });\n * ```\n *\n * Rules: `\"<trigger edge> <viewport edge>\"` where an edge is `top | center | bottom`,\n * a percentage or pixels, optionally `+=N` / `-=N` (e.g. `\"top top+=80\"`);\n * `end` may also be `\"+=600\"` (pixels after start). Horizontal scenes use\n * `left | center | right`. Nothing touches `window` until a scene is created.\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { getTicker } from './ticker';\nimport type { Playable } from './tween';\n\nexport type SceneAction = 'play' | 'pause' | 'resume' | 'reverse' | 'restart' | 'reset' | 'complete' | 'none';\n\nexport interface SceneOptions {\n /** Element (or selector) whose position defines the scene. */\n trigger: Element | string;\n /** Default 'top bottom' (trigger top meets viewport bottom). */\n start?: string;\n /** Default 'bottom top'. `'+=600'` = 600 px after start. */\n end?: string;\n /** Link the animation to the scroll position: `true` (direct) or a smoothing time in ms. */\n scrub?: boolean | number;\n /** Runtime tween / timeline (created `paused: true`). */\n animation?: Playable;\n /** Without scrub: actions on enter, leave, enter back, leave back. Default 'play none none reverse'. */\n actions?: string;\n /** Pin the trigger (or another element) while the scene is active. */\n pin?: boolean | Element | string;\n /** Show start / end markers (debugging). */\n markers?: boolean | { color?: string };\n /** Class toggled on the trigger while active. */\n toggleClass?: string;\n /** Kill after the first forward completion. */\n once?: boolean;\n horizontal?: boolean;\n /** Scroll container (default: the window). */\n scroller?: Element | string;\n onEnter?: (s: ScrollScene) => void;\n onLeave?: (s: ScrollScene) => void;\n onEnterBack?: (s: ScrollScene) => void;\n onLeaveBack?: (s: ScrollScene) => void;\n onUpdate?: (s: ScrollScene) => void;\n onToggle?: (s: ScrollScene) => void;\n}\n\nconst KEYWORDS: Record<string, number> = { top: 0, left: 0, center: 0.5, bottom: 1, right: 1 };\n\n/** One side of a rule ('top', '80%', '120px', 'center+=40') → pixels within `size`. */\nexport function parseEdge(spec: string, size: number): number {\n const m = /^([a-z]+|-?[\\d.]+%|-?[\\d.]+(?:px)?)?\\s*(?:([+-])=\\s*(-?[\\d.]+)(px|%)?)?$/.exec(spec.trim());\n if (!m) throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n let v = 0;\n const b = m[1] || '0';\n if (b in KEYWORDS) v = KEYWORDS[b] * size;\n else if (b.endsWith('%')) v = (parseFloat(b) / 100) * size;\n else if (/^-?[\\d.]/.test(b)) v = parseFloat(b);\n else throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n if (m[2]) {\n const n = m[4] === '%' ? (parseFloat(m[3]) / 100) * size : parseFloat(m[3]);\n v += m[2] === '+' ? n : -n;\n }\n return v;\n}\n\n/** Scroll offset at which `rule` is met: trigger edge (at `triggerStart`, size `triggerSize`) meets viewport edge. */\nexport function resolveRule(rule: string, triggerStart: number, triggerSize: number, viewport: number): number {\n const parts = rule.trim().split(/\\s+(?![+-]=)/);\n const t = parts[0] ?? 'top';\n const s = parts[1] ?? 'bottom';\n return triggerStart + parseEdge(t, triggerSize) - parseEdge(s, viewport);\n}\n\nconst scenes = new Set<ScrollScene>();\nconst q = (x: Element | string): Element => {\n const el = typeof x === 'string' ? document.querySelector(x) : x;\n if (!el) throw new Error(`[motionary] scroll: element \"${x}\" not found`);\n return el;\n};\n\n/** A scroll scene (see `scrollScene()`). */\nexport class ScrollScene {\n readonly trigger: Element;\n readonly options: SceneOptions;\n /** Scroll offsets (px) of the start and end. */\n start = 0;\n end = 0;\n /** 0 → 1 between start and end. */\n progress = 0;\n /** 1 scrolling forward, -1 back. */\n direction = 1;\n isActive = false;\n private shown = 0;\n private last = -1;\n private offs: (() => void)[] = [];\n private pinEl: HTMLElement | null = null;\n private spacer: HTMLElement | null = null;\n private marks: HTMLElement[] = [];\n private scroller: Element | Window;\n private killed = false;\n\n constructor(o: SceneOptions) {\n if (typeof window === 'undefined') throw new Error('[motionary] scroll scenes need a browser window');\n this.options = o;\n this.trigger = q(o.trigger);\n this.scroller = o.scroller ? q(o.scroller) : window;\n if (o.pin) this.setupPin(o.pin === true ? (this.trigger as HTMLElement) : (q(o.pin) as HTMLElement));\n const target: EventTarget = this.scroller;\n const onScroll = () => this.update();\n target.addEventListener('scroll', onScroll, { passive: true });\n window.addEventListener('resize', this.refreshBound);\n this.offs.push(() => target.removeEventListener('scroll', onScroll), () => window.removeEventListener('resize', this.refreshBound));\n if (o.scrub && typeof o.scrub === 'number') this.offs.push(getTicker().add((_, dt) => this.smooth(dt)));\n scenes.add(this);\n this.refresh();\n }\n private refreshBound = () => this.refresh();\n\n private pos(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.scrollX : window.scrollY;\n return this.options.horizontal ? s.scrollLeft : s.scrollTop;\n }\n private viewport(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.innerWidth : window.innerHeight;\n return this.options.horizontal ? s.clientWidth : s.clientHeight;\n }\n\n /** Re-measure start / end (after layout changes). */\n refresh(): void {\n if (this.killed) return;\n const h = !!this.options.horizontal;\n const ref = (this.spacer || this.trigger) as Element;\n const r = ref.getBoundingClientRect();\n const sr = this.scroller === window ? { top: 0, left: 0 } : (this.scroller as Element).getBoundingClientRect();\n const tStart = (h ? r.left - sr.left : r.top - sr.top) + this.pos();\n const tSize = (this.pinEl ? (h ? this.pinEl.offsetWidth : this.pinEl.offsetHeight) : h ? r.width : r.height) || 0;\n const vp = this.viewport();\n this.start = resolveRule(this.options.start || (h ? 'left right' : 'top bottom'), tStart, tSize, vp);\n const e = this.options.end || (h ? 'right left' : 'bottom top');\n this.end = /^\\+=/.test(e.trim()) ? this.start + parseFloat(e.trim().slice(2)) : resolveRule(e, tStart, tSize, vp);\n if (this.end <= this.start) this.end = this.start + 1;\n if (this.spacer && this.pinEl) this.spacer.style[h ? 'paddingRight' : 'paddingBottom'] = `${this.end - this.start}px`;\n this.drawMarkers(vp);\n this.last = -1;\n this.update();\n }\n\n /** Read the scroll position and fire callbacks / drive the animation. */\n update(): void {\n if (this.killed) return;\n const y = this.pos();\n const p = Math.min(1, Math.max(0, (y - this.start) / (this.end - this.start)));\n if (y !== this.last && this.last >= 0) this.direction = y > this.last ? 1 : -1;\n const prev = this.progress;\n const was = this.isActive;\n this.progress = p;\n this.isActive = y > this.start && y < this.end;\n this.last = y;\n const o = this.options;\n if (this.isActive !== was || (prev === 0 && p === 1) || (prev === 1 && p === 0)) {\n const toggles: [keyof SceneOptions, number][] = [];\n if (p > 0 && prev === 0) toggles.push(['onEnter', 0]);\n if (p === 1 && prev < 1) toggles.push(['onLeave', 1]);\n if (p < 1 && prev === 1) toggles.push(['onEnterBack', 2]);\n if (p === 0 && prev > 0) toggles.push(['onLeaveBack', 3]);\n for (const [cb, i] of toggles) {\n (o[cb] as ((s: ScrollScene) => void) | undefined)?.(this);\n if (!o.scrub) this.act(i);\n }\n if (o.toggleClass) this.trigger.classList.toggle(o.toggleClass, this.isActive);\n o.onToggle?.(this);\n if (o.once && p === 1) {\n this.applyPin(1);\n this.kill(true);\n return;\n }\n }\n this.applyPin(p);\n if (o.scrub === true && o.animation) o.animation.progress = p;\n o.onUpdate?.(this);\n }\n\n private smooth(dt: number): void {\n const a = this.options.animation;\n if (!a) return;\n const k = 1 - Math.exp(-dt / Math.max(1, this.options.scrub as number));\n this.shown += (this.progress - this.shown) * k;\n if (Math.abs(this.progress - this.shown) < 0.0005) this.shown = this.progress;\n a.progress = this.shown;\n }\n\n private act(i: number): void {\n const a = this.options.animation;\n if (!a) return;\n const act = ((this.options.actions || 'play none none reverse').split(/\\s+/)[i] || 'none') as SceneAction;\n if (act === 'play') a.play();\n else if (act === 'pause') a.pause();\n else if (act === 'resume') a.play();\n else if (act === 'reverse') a.reverse();\n else if (act === 'restart') a.restart();\n else if (act === 'reset') (a.pause(), a.seek(0));\n else if (act === 'complete') (a.pause(), (a.progress = 1));\n }\n\n private setupPin(el: HTMLElement): void {\n this.pinEl = el;\n const sp = document.createElement('div');\n sp.className = 'usa-pin-spacer';\n sp.style.boxSizing = 'content-box';\n el.parentNode?.insertBefore(sp, el);\n sp.appendChild(el);\n this.spacer = sp;\n this.offs.push(() => {\n el.style.position = el.style.top = el.style.left = el.style.width = el.style.transform = '';\n sp.parentNode?.insertBefore(el, sp);\n sp.remove();\n });\n }\n\n private applyPin(p: number): void {\n const el = this.pinEl, sp = this.spacer;\n if (!el || !sp) return;\n const h = !!this.options.horizontal;\n if (p > 0 && p < 1 && this.scroller === window) {\n const r = sp.getBoundingClientRect();\n const offset = this.start - (h ? r.left + window.scrollX : r.top + window.scrollY);\n el.style.position = 'fixed';\n el.style.width = `${r.width}px`;\n el.style.left = h ? `${-offset}px` : `${r.left}px`;\n el.style.top = h ? `${r.top}px` : `${-offset}px`;\n el.style.transform = '';\n } else {\n el.style.position = el.style.top = el.style.left = el.style.width = '';\n // inside a scroll container (or after the end) pinning is done with a transform\n const d = p >= 1 ? this.end - this.start : p > 0 ? this.pos() - this.start : 0;\n el.style.transform = d ? (h ? `translateX(${d}px)` : `translateY(${d}px)`) : '';\n }\n }\n\n private drawMarkers(vp: number): void {\n this.marks.forEach((m) => m.remove());\n this.marks = [];\n const mk = this.options.markers;\n if (!mk) return;\n const color = (typeof mk === 'object' && mk.color) || '#e11d48';\n const h = !!this.options.horizontal;\n const host = this.scroller === window ? document.body : (this.scroller as HTMLElement);\n const line = (label: string, at: number, fixed: boolean, c: string) => {\n const d = document.createElement('div');\n d.className = 'usa-scroll-marker';\n d.textContent = label;\n d.setAttribute('aria-hidden', 'true');\n Object.assign(d.style, { position: fixed ? 'fixed' : 'absolute', [h ? 'left' : 'top']: `${at}px`, [h ? 'top' : 'right']: '0', [h ? 'height' : 'width']: '80px', [h ? 'borderLeft' : 'borderTop']: `2px solid ${c}`, color: c, font: '600 11px/1.2 ui-monospace,monospace', padding: '2px 4px', zIndex: '2147483646', pointerEvents: 'none', background: 'rgba(255,255,255,.7)' });\n (fixed ? document.body : host).appendChild(d);\n this.marks.push(d);\n };\n const rule = (r: string | undefined, d: string) => (r || d).trim().split(/\\s+(?![+-]=)/)[1] ?? 'bottom';\n line(`start ${this.start | 0}`, this.start, false, color);\n line(`end ${this.end | 0}`, this.end, false, color);\n line('scroller-start', parseEdge(rule(this.options.start, 'top bottom'), vp), true, '#16a34a');\n if (!/^\\+=/.test((this.options.end || '').trim())) line('scroller-end', parseEdge(rule(this.options.end, 'bottom top'), vp), true, '#2563eb');\n }\n\n /** Remove listeners, pin spacer and markers (`keepState` keeps the animation where it is). */\n kill(keepState = false): void {\n if (this.killed) return;\n this.killed = true;\n if (!keepState) this.options.animation?.pause();\n this.offs.splice(0).forEach((f) => f());\n this.marks.forEach((m) => m.remove());\n scenes.delete(this);\n }\n}\n\n/** Create a scroll scene. */\nexport function scrollScene(o: SceneOptions): ScrollScene {\n return new ScrollScene(o);\n}\n/** Re-measure every scene (call after layout changes such as images loading). */\nexport function refreshScenes(): void {\n scenes.forEach((s) => s.refresh());\n}\n/** Kill every scene. */\nexport function killScenes(): void {\n Array.from(scenes).forEach((s) => s.kill());\n}\n/** The live scenes. */\nexport const allScenes = (): ScrollScene[] => Array.from(scenes);\n\nexport interface ScrollApi {\n scrollScene: typeof scrollScene;\n refreshScenes: typeof refreshScenes;\n killScenes: typeof killScenes;\n allScenes: typeof allScenes;\n parseEdge: typeof parseEdge;\n resolveRule: typeof resolveRule;\n ScrollScene: typeof ScrollScene;\n}\n\n/** The module object for `use(scroll)`. */\nexport const scroll: RuntimeModule<ScrollApi> = { id: 'scroll', version: RUNTIME_VERSION, requires: ['core'], api: { scrollScene, refreshScenes, killScenes, allScenes, parseEdge, resolveRule, ScrollScene } };\n"],"names":["getTicker","RUNTIME_VERSION"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAuCH,MAAM,QAAQ,GAA2B,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;AAE9F;AACM,SAAU,SAAS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AE;AAC/C,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;AACvC,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;AACrC,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IACrB;AACD;AAED;AACM,SAAU,WAAW,CAAC,CAAe,EAAA;AACzC,IAAA,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC;AAC3B;AACA;SACgB,aAAa,GAAA;AAC3B,IAAA,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;AACpC;AACA;SACgB,UAAU,GAAA;AACxB,IAAA,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC7C;AACA;AACO,MAAM,SAAS,GAAG,MAAqB,KAAK,CAAC,IAAI,CAAC,MAAM;AAY/D;AACO,MAAM,MAAM,GAA6B,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAEC,wBAAe,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE;;;;;;;;;;;"}
1
+ {"version":3,"file":"scroll.cjs","sources":["../../src/runtime/scroll.ts"],"sourcesContent":["/**\n * `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original\n * implementation: start / end rules, scrubbing (direct or smoothed), pinning,\n * debug markers, enter / leave callbacks and per-edge actions for a runtime\n * tween or timeline.\n *\n * ```ts\n * import { use, timeline } from 'motionary/runtime';\n * import { scroll, scrollScene } from 'motionary/runtime/scroll';\n * use(scroll);\n * const tl = timeline({ paused: true }).to('.card', { to: { x: 200, rotate: 8 } });\n * scrollScene({ trigger: '.section', start: 'top 80%', end: 'bottom 20%', scrub: 120, pin: true, markers: true, animation: tl });\n * ```\n *\n * Rules: `\"<trigger edge> <viewport edge>\"` where an edge is `top | center | bottom`,\n * a percentage or pixels, optionally `+=N` / `-=N` (e.g. `\"top top+=80\"`);\n * `end` may also be `\"+=600\"` (pixels after start). Horizontal scenes use\n * `left | center | right`. Nothing touches `window` until a scene is created.\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { getTicker } from './ticker';\nimport type { Playable } from './tween';\n\nexport type SceneAction = 'play' | 'pause' | 'resume' | 'reverse' | 'restart' | 'reset' | 'complete' | 'none';\n\nexport interface SceneOptions {\n /** Element (or selector) whose position defines the scene. */\n trigger: Element | string;\n /** Default 'top bottom' (trigger top meets viewport bottom). */\n start?: string;\n /** Default 'bottom top'. `'+=600'` = 600 px after start. */\n end?: string;\n /** Link the animation to the scroll position: `true` (direct) or a smoothing time in ms. */\n scrub?: boolean | number;\n /** Runtime tween / timeline (created `paused: true`). */\n animation?: Playable;\n /** Without scrub: actions on enter, leave, enter back, leave back. Default 'play none none reverse'. */\n actions?: string;\n /** Pin the trigger (or another element) while the scene is active. */\n pin?: boolean | Element | string;\n /** Show start / end markers (debugging). */\n markers?: boolean | { color?: string };\n /** Class toggled on the trigger while active. */\n toggleClass?: string;\n /** Kill after the first forward completion. */\n once?: boolean;\n horizontal?: boolean;\n /** Scroll container (default: the window). */\n scroller?: Element | string;\n onEnter?: (s: ScrollScene) => void;\n onLeave?: (s: ScrollScene) => void;\n onEnterBack?: (s: ScrollScene) => void;\n onLeaveBack?: (s: ScrollScene) => void;\n onUpdate?: (s: ScrollScene) => void;\n onToggle?: (s: ScrollScene) => void;\n}\n\nconst KEYWORDS: Record<string, number> = { top: 0, left: 0, center: 0.5, bottom: 1, right: 1 };\n\n/** One side of a rule ('top', '80%', '120px', 'center+=40') → pixels within `size`. */\nexport function parseEdge(spec: string, size: number): number {\n const m = /^([a-z]+|-?[\\d.]+%|-?[\\d.]+(?:px)?)?\\s*(?:([+-])=\\s*(-?[\\d.]+)(px|%)?)?$/.exec(spec.trim());\n if (!m) throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n let v = 0;\n const b = m[1] || '0';\n if (b in KEYWORDS) v = KEYWORDS[b] * size;\n else if (b.endsWith('%')) v = (parseFloat(b) / 100) * size;\n else if (/^-?[\\d.]/.test(b)) v = parseFloat(b);\n else throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n if (m[2]) {\n const n = m[4] === '%' ? (parseFloat(m[3]) / 100) * size : parseFloat(m[3]);\n v += m[2] === '+' ? n : -n;\n }\n return v;\n}\n\n/** Scroll offset at which `rule` is met: trigger edge (at `triggerStart`, size `triggerSize`) meets viewport edge. */\nexport function resolveRule(rule: string, triggerStart: number, triggerSize: number, viewport: number): number {\n const parts = rule.trim().split(/\\s+(?![+-]=)/);\n const t = parts[0] ?? 'top';\n const s = parts[1] ?? 'bottom';\n return triggerStart + parseEdge(t, triggerSize) - parseEdge(s, viewport);\n}\n\nconst scenes = new Set<ScrollScene>();\nconst q = (x: Element | string): Element => {\n const el = typeof x === 'string' ? document.querySelector(x) : x;\n if (!el) throw new Error(`[motionary] scroll: element \"${x}\" not found`);\n return el;\n};\n\n/** A scroll scene (see `scrollScene()`). */\nexport class ScrollScene {\n readonly trigger: Element;\n readonly options: SceneOptions;\n /** Scroll offsets (px) of the start and end. */\n start = 0;\n end = 0;\n /** 0 → 1 between start and end. */\n progress = 0;\n /** 1 scrolling forward, -1 back. */\n direction = 1;\n isActive = false;\n private shown = 0;\n private last = -1;\n private offs: (() => void)[] = [];\n private pinEl: HTMLElement | null = null;\n private spacer: HTMLElement | null = null;\n private marks: HTMLElement[] = [];\n private scroller: Element | Window;\n private killed = false;\n\n constructor(o: SceneOptions) {\n if (typeof window === 'undefined') throw new Error('[motionary] scroll scenes need a browser window');\n this.options = o;\n this.trigger = q(o.trigger);\n this.scroller = o.scroller ? q(o.scroller) : window;\n if (o.pin) this.setupPin(o.pin === true ? (this.trigger as HTMLElement) : (q(o.pin) as HTMLElement));\n const target: EventTarget = this.scroller;\n const onScroll = () => this.update();\n target.addEventListener('scroll', onScroll, { passive: true });\n window.addEventListener('resize', this.refreshBound);\n this.offs.push(() => target.removeEventListener('scroll', onScroll), () => window.removeEventListener('resize', this.refreshBound));\n if (o.scrub && typeof o.scrub === 'number') this.offs.push(getTicker().add((_, dt) => this.smooth(dt)));\n scenes.add(this);\n this.refresh();\n }\n private refreshBound = () => this.refresh();\n\n private pos(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.scrollX : window.scrollY;\n return this.options.horizontal ? s.scrollLeft : s.scrollTop;\n }\n private viewport(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.innerWidth : window.innerHeight;\n return this.options.horizontal ? s.clientWidth : s.clientHeight;\n }\n\n /** Re-measure start / end (after layout changes). */\n refresh(): void {\n if (this.killed) return;\n const h = !!this.options.horizontal;\n const ref = (this.spacer || this.trigger) as Element;\n const r = ref.getBoundingClientRect();\n const sr = this.scroller === window ? { top: 0, left: 0 } : (this.scroller as Element).getBoundingClientRect();\n const tStart = (h ? r.left - sr.left : r.top - sr.top) + this.pos();\n const tSize = (this.pinEl ? (h ? this.pinEl.offsetWidth : this.pinEl.offsetHeight) : h ? r.width : r.height) || 0;\n const vp = this.viewport();\n this.start = resolveRule(this.options.start || (h ? 'left right' : 'top bottom'), tStart, tSize, vp);\n const e = this.options.end || (h ? 'right left' : 'bottom top');\n this.end = /^\\+=/.test(e.trim()) ? this.start + parseFloat(e.trim().slice(2)) : resolveRule(e, tStart, tSize, vp);\n if (this.end <= this.start) this.end = this.start + 1;\n if (this.spacer && this.pinEl) this.spacer.style[h ? 'paddingRight' : 'paddingBottom'] = `${this.end - this.start}px`;\n this.drawMarkers(vp);\n this.last = -1;\n this.update();\n }\n\n /** Read the scroll position and fire callbacks / drive the animation. */\n update(): void {\n if (this.killed) return;\n const y = this.pos();\n const p = Math.min(1, Math.max(0, (y - this.start) / (this.end - this.start)));\n if (y !== this.last && this.last >= 0) this.direction = y > this.last ? 1 : -1;\n const prev = this.progress;\n const was = this.isActive;\n this.progress = p;\n this.isActive = y > this.start && y < this.end;\n this.last = y;\n const o = this.options;\n if (this.isActive !== was || (prev === 0 && p === 1) || (prev === 1 && p === 0)) {\n const toggles: [keyof SceneOptions, number][] = [];\n if (p > 0 && prev === 0) toggles.push(['onEnter', 0]);\n if (p === 1 && prev < 1) toggles.push(['onLeave', 1]);\n if (p < 1 && prev === 1) toggles.push(['onEnterBack', 2]);\n if (p === 0 && prev > 0) toggles.push(['onLeaveBack', 3]);\n for (const [cb, i] of toggles) {\n (o[cb] as ((s: ScrollScene) => void) | undefined)?.(this);\n if (!o.scrub) this.act(i);\n }\n if (o.toggleClass) this.trigger.classList.toggle(o.toggleClass, this.isActive);\n o.onToggle?.(this);\n if (o.once && p === 1) {\n this.applyPin(1);\n this.kill(true);\n return;\n }\n }\n this.applyPin(p);\n if (o.scrub === true && o.animation) o.animation.progress = p;\n o.onUpdate?.(this);\n }\n\n private smooth(dt: number): void {\n const a = this.options.animation;\n if (!a) return;\n const k = 1 - Math.exp(-dt / Math.max(1, this.options.scrub as number));\n this.shown += (this.progress - this.shown) * k;\n if (Math.abs(this.progress - this.shown) < 0.0005) this.shown = this.progress;\n a.progress = this.shown;\n }\n\n private act(i: number): void {\n const a = this.options.animation;\n if (!a) return;\n const act = ((this.options.actions || 'play none none reverse').split(/\\s+/)[i] || 'none') as SceneAction;\n if (act === 'play') a.play();\n else if (act === 'pause') a.pause();\n else if (act === 'resume') a.play();\n else if (act === 'reverse') a.reverse();\n else if (act === 'restart') a.restart();\n else if (act === 'reset') (a.pause(), a.seek(0));\n else if (act === 'complete') (a.pause(), (a.progress = 1));\n }\n\n private setupPin(el: HTMLElement): void {\n this.pinEl = el;\n const sp = document.createElement('div');\n sp.className = 'usa-pin-spacer';\n sp.style.boxSizing = 'content-box';\n el.parentNode?.insertBefore(sp, el);\n sp.appendChild(el);\n this.spacer = sp;\n this.offs.push(() => {\n el.style.position = el.style.top = el.style.left = el.style.width = el.style.transform = '';\n sp.parentNode?.insertBefore(el, sp);\n sp.remove();\n });\n }\n\n private applyPin(p: number): void {\n const el = this.pinEl, sp = this.spacer;\n if (!el || !sp) return;\n const h = !!this.options.horizontal;\n if (p > 0 && p < 1 && this.scroller === window) {\n const r = sp.getBoundingClientRect();\n const offset = this.start - (h ? r.left + window.scrollX : r.top + window.scrollY);\n el.style.position = 'fixed';\n el.style.width = `${r.width}px`;\n el.style.left = h ? `${-offset}px` : `${r.left}px`;\n el.style.top = h ? `${r.top}px` : `${-offset}px`;\n el.style.transform = '';\n } else {\n el.style.position = el.style.top = el.style.left = el.style.width = '';\n // inside a scroll container (or after the end) pinning is done with a transform\n const d = p >= 1 ? this.end - this.start : p > 0 ? this.pos() - this.start : 0;\n el.style.transform = d ? (h ? `translateX(${d}px)` : `translateY(${d}px)`) : '';\n }\n }\n\n private drawMarkers(vp: number): void {\n this.marks.forEach((m) => m.remove());\n this.marks = [];\n const mk = this.options.markers;\n if (!mk) return;\n const color = (typeof mk === 'object' && mk.color) || '#e11d48';\n const h = !!this.options.horizontal;\n const host = this.scroller === window ? document.body : (this.scroller as HTMLElement);\n const line = (label: string, at: number, fixed: boolean, c: string) => {\n const d = document.createElement('div');\n d.className = 'usa-scroll-marker';\n d.textContent = label;\n d.setAttribute('aria-hidden', 'true');\n Object.assign(d.style, { position: fixed ? 'fixed' : 'absolute', [h ? 'left' : 'top']: `${at}px`, [h ? 'top' : 'right']: '0', [h ? 'height' : 'width']: '80px', [h ? 'borderLeft' : 'borderTop']: `2px solid ${c}`, color: c, font: '600 11px/1.2 ui-monospace,monospace', padding: '2px 4px', zIndex: '2147483646', pointerEvents: 'none', background: 'rgba(255,255,255,.7)' });\n (fixed ? document.body : host).appendChild(d);\n this.marks.push(d);\n };\n const rule = (r: string | undefined, d: string) => (r || d).trim().split(/\\s+(?![+-]=)/)[1] ?? 'bottom';\n line(`start ${this.start | 0}`, this.start, false, color);\n line(`end ${this.end | 0}`, this.end, false, color);\n line('scroller-start', parseEdge(rule(this.options.start, 'top bottom'), vp), true, '#16a34a');\n if (!/^\\+=/.test((this.options.end || '').trim())) line('scroller-end', parseEdge(rule(this.options.end, 'bottom top'), vp), true, '#2563eb');\n }\n\n /** Remove listeners, pin spacer and markers (`keepState` keeps the animation where it is). */\n kill(keepState = false): void {\n if (this.killed) return;\n this.killed = true;\n if (!keepState) this.options.animation?.pause();\n this.offs.splice(0).forEach((f) => f());\n this.marks.forEach((m) => m.remove());\n scenes.delete(this);\n }\n}\n\n/** Create a scroll scene. */\nexport function scrollScene(o: SceneOptions): ScrollScene {\n return new ScrollScene(o);\n}\n/** Re-measure every scene (call after layout changes such as images loading). */\nexport function refreshScenes(): void {\n scenes.forEach((s) => s.refresh());\n}\n/** Kill every scene. */\nexport function killScenes(): void {\n Array.from(scenes).forEach((s) => s.kill());\n}\n/** The live scenes. */\nexport const allScenes = (): ScrollScene[] => Array.from(scenes);\n\nexport interface ScrollApi {\n scrollScene: typeof scrollScene;\n refreshScenes: typeof refreshScenes;\n killScenes: typeof killScenes;\n allScenes: typeof allScenes;\n parseEdge: typeof parseEdge;\n resolveRule: typeof resolveRule;\n ScrollScene: typeof ScrollScene;\n}\n\n/** The module object for `use(scroll)`. */\nexport const scroll: RuntimeModule<ScrollApi> = { id: 'scroll', version: RUNTIME_VERSION, requires: ['core'], api: { scrollScene, refreshScenes, killScenes, allScenes, parseEdge, resolveRule, ScrollScene } };\n"],"names":["getTicker","RUNTIME_VERSION"],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAuCH,MAAM,QAAQ,GAA2B,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;AAE9F;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,EAAE,KAAK,EAAE;AAC/C,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;AACvC,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;AACrC,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IACrB;AACD;AAED;AACM,SAAU,WAAW,CAAC,CAAe,EAAA;AACzC,IAAA,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC;AAC3B;AACA;SACgB,aAAa,GAAA;AAC3B,IAAA,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;AACpC;AACA;SACgB,UAAU,GAAA;AACxB,IAAA,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC7C;AACA;AACO,MAAM,SAAS,GAAG,MAAqB,KAAK,CAAC,IAAI,CAAC,MAAM;AAY/D;AACO,MAAM,MAAM,GAA6B,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAEC,wBAAe,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { R as RUNTIME_VERSION } from '../chunks/registry-46AAzyeC.js';
2
- import { g as getTicker } from '../chunks/ticker-COOYAyQy.js';
1
+ import { R as RUNTIME_VERSION } from '../chunks/registry-CT-TT_bx.js';
2
+ import { g as getTicker } from '../chunks/ticker-C8lSGml9.js';
3
3
 
4
4
  /**
5
5
  * `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.js","sources":["../../src/runtime/scroll.ts"],"sourcesContent":["/**\n * `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original\n * implementation: start / end rules, scrubbing (direct or smoothed), pinning,\n * debug markers, enter / leave callbacks and per-edge actions for a runtime\n * tween or timeline.\n *\n * ```ts\n * import { use, timeline } from 'motionary/runtime';\n * import { scroll, scrollScene } from 'motionary/runtime/scroll';\n * use(scroll);\n * const tl = timeline({ paused: true }).to('.card', { to: { x: 200, rotate: 8 } });\n * scrollScene({ trigger: '.section', start: 'top 80%', end: 'bottom 20%', scrub: 120, pin: true, markers: true, animation: tl });\n * ```\n *\n * Rules: `\"<trigger edge> <viewport edge>\"` where an edge is `top | center | bottom`,\n * a percentage or pixels, optionally `+=N` / `-=N` (e.g. `\"top top+=80\"`);\n * `end` may also be `\"+=600\"` (pixels after start). Horizontal scenes use\n * `left | center | right`. Nothing touches `window` until a scene is created.\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { getTicker } from './ticker';\nimport type { Playable } from './tween';\n\nexport type SceneAction = 'play' | 'pause' | 'resume' | 'reverse' | 'restart' | 'reset' | 'complete' | 'none';\n\nexport interface SceneOptions {\n /** Element (or selector) whose position defines the scene. */\n trigger: Element | string;\n /** Default 'top bottom' (trigger top meets viewport bottom). */\n start?: string;\n /** Default 'bottom top'. `'+=600'` = 600 px after start. */\n end?: string;\n /** Link the animation to the scroll position: `true` (direct) or a smoothing time in ms. */\n scrub?: boolean | number;\n /** Runtime tween / timeline (created `paused: true`). */\n animation?: Playable;\n /** Without scrub: actions on enter, leave, enter back, leave back. Default 'play none none reverse'. */\n actions?: string;\n /** Pin the trigger (or another element) while the scene is active. */\n pin?: boolean | Element | string;\n /** Show start / end markers (debugging). */\n markers?: boolean | { color?: string };\n /** Class toggled on the trigger while active. */\n toggleClass?: string;\n /** Kill after the first forward completion. */\n once?: boolean;\n horizontal?: boolean;\n /** Scroll container (default: the window). */\n scroller?: Element | string;\n onEnter?: (s: ScrollScene) => void;\n onLeave?: (s: ScrollScene) => void;\n onEnterBack?: (s: ScrollScene) => void;\n onLeaveBack?: (s: ScrollScene) => void;\n onUpdate?: (s: ScrollScene) => void;\n onToggle?: (s: ScrollScene) => void;\n}\n\nconst KEYWORDS: Record<string, number> = { top: 0, left: 0, center: 0.5, bottom: 1, right: 1 };\n\n/** One side of a rule ('top', '80%', '120px', 'center+=40') → pixels within `size`. */\nexport function parseEdge(spec: string, size: number): number {\n const m = /^([a-z]+|-?[\\d.]+%|-?[\\d.]+(?:px)?)?\\s*(?:([+-])=\\s*(-?[\\d.]+)(px|%)?)?$/.exec(spec.trim());\n if (!m) throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n let v = 0;\n const b = m[1] || '0';\n if (b in KEYWORDS) v = KEYWORDS[b] * size;\n else if (b.endsWith('%')) v = (parseFloat(b) / 100) * size;\n else if (/^-?[\\d.]/.test(b)) v = parseFloat(b);\n else throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n if (m[2]) {\n const n = m[4] === '%' ? (parseFloat(m[3]) / 100) * size : parseFloat(m[3]);\n v += m[2] === '+' ? n : -n;\n }\n return v;\n}\n\n/** Scroll offset at which `rule` is met: trigger edge (at `triggerStart`, size `triggerSize`) meets viewport edge. */\nexport function resolveRule(rule: string, triggerStart: number, triggerSize: number, viewport: number): number {\n const parts = rule.trim().split(/\\s+(?![+-]=)/);\n const t = parts[0] ?? 'top';\n const s = parts[1] ?? 'bottom';\n return triggerStart + parseEdge(t, triggerSize) - parseEdge(s, viewport);\n}\n\nconst scenes = new Set<ScrollScene>();\nconst q = (x: Element | string): Element => {\n const el = typeof x === 'string' ? document.querySelector(x) : x;\n if (!el) throw new Error(`[motionary] scroll: element \"${x}\" not found`);\n return el;\n};\n\n/** A scroll scene (see `scrollScene()`). */\nexport class ScrollScene {\n readonly trigger: Element;\n readonly options: SceneOptions;\n /** Scroll offsets (px) of the start and end. */\n start = 0;\n end = 0;\n /** 0 → 1 between start and end. */\n progress = 0;\n /** 1 scrolling forward, -1 back. */\n direction = 1;\n isActive = false;\n private shown = 0;\n private last = -1;\n private offs: (() => void)[] = [];\n private pinEl: HTMLElement | null = null;\n private spacer: HTMLElement | null = null;\n private marks: HTMLElement[] = [];\n private scroller: Element | Window;\n private killed = false;\n\n constructor(o: SceneOptions) {\n if (typeof window === 'undefined') throw new Error('[motionary] scroll scenes need a browser window');\n this.options = o;\n this.trigger = q(o.trigger);\n this.scroller = o.scroller ? q(o.scroller) : window;\n if (o.pin) this.setupPin(o.pin === true ? (this.trigger as HTMLElement) : (q(o.pin) as HTMLElement));\n const target: EventTarget = this.scroller;\n const onScroll = () => this.update();\n target.addEventListener('scroll', onScroll, { passive: true });\n window.addEventListener('resize', this.refreshBound);\n this.offs.push(() => target.removeEventListener('scroll', onScroll), () => window.removeEventListener('resize', this.refreshBound));\n if (o.scrub && typeof o.scrub === 'number') this.offs.push(getTicker().add((_, dt) => this.smooth(dt)));\n scenes.add(this);\n this.refresh();\n }\n private refreshBound = () => this.refresh();\n\n private pos(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.scrollX : window.scrollY;\n return this.options.horizontal ? s.scrollLeft : s.scrollTop;\n }\n private viewport(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.innerWidth : window.innerHeight;\n return this.options.horizontal ? s.clientWidth : s.clientHeight;\n }\n\n /** Re-measure start / end (after layout changes). */\n refresh(): void {\n if (this.killed) return;\n const h = !!this.options.horizontal;\n const ref = (this.spacer || this.trigger) as Element;\n const r = ref.getBoundingClientRect();\n const sr = this.scroller === window ? { top: 0, left: 0 } : (this.scroller as Element).getBoundingClientRect();\n const tStart = (h ? r.left - sr.left : r.top - sr.top) + this.pos();\n const tSize = (this.pinEl ? (h ? this.pinEl.offsetWidth : this.pinEl.offsetHeight) : h ? r.width : r.height) || 0;\n const vp = this.viewport();\n this.start = resolveRule(this.options.start || (h ? 'left right' : 'top bottom'), tStart, tSize, vp);\n const e = this.options.end || (h ? 'right left' : 'bottom top');\n this.end = /^\\+=/.test(e.trim()) ? this.start + parseFloat(e.trim().slice(2)) : resolveRule(e, tStart, tSize, vp);\n if (this.end <= this.start) this.end = this.start + 1;\n if (this.spacer && this.pinEl) this.spacer.style[h ? 'paddingRight' : 'paddingBottom'] = `${this.end - this.start}px`;\n this.drawMarkers(vp);\n this.last = -1;\n this.update();\n }\n\n /** Read the scroll position and fire callbacks / drive the animation. */\n update(): void {\n if (this.killed) return;\n const y = this.pos();\n const p = Math.min(1, Math.max(0, (y - this.start) / (this.end - this.start)));\n if (y !== this.last && this.last >= 0) this.direction = y > this.last ? 1 : -1;\n const prev = this.progress;\n const was = this.isActive;\n this.progress = p;\n this.isActive = y > this.start && y < this.end;\n this.last = y;\n const o = this.options;\n if (this.isActive !== was || (prev === 0 && p === 1) || (prev === 1 && p === 0)) {\n const toggles: [keyof SceneOptions, number][] = [];\n if (p > 0 && prev === 0) toggles.push(['onEnter', 0]);\n if (p === 1 && prev < 1) toggles.push(['onLeave', 1]);\n if (p < 1 && prev === 1) toggles.push(['onEnterBack', 2]);\n if (p === 0 && prev > 0) toggles.push(['onLeaveBack', 3]);\n for (const [cb, i] of toggles) {\n (o[cb] as ((s: ScrollScene) => void) | undefined)?.(this);\n if (!o.scrub) this.act(i);\n }\n if (o.toggleClass) this.trigger.classList.toggle(o.toggleClass, this.isActive);\n o.onToggle?.(this);\n if (o.once && p === 1) {\n this.applyPin(1);\n this.kill(true);\n return;\n }\n }\n this.applyPin(p);\n if (o.scrub === true && o.animation) o.animation.progress = p;\n o.onUpdate?.(this);\n }\n\n private smooth(dt: number): void {\n const a = this.options.animation;\n if (!a) return;\n const k = 1 - Math.exp(-dt / Math.max(1, this.options.scrub as number));\n this.shown += (this.progress - this.shown) * k;\n if (Math.abs(this.progress - this.shown) < 0.0005) this.shown = this.progress;\n a.progress = this.shown;\n }\n\n private act(i: number): void {\n const a = this.options.animation;\n if (!a) return;\n const act = ((this.options.actions || 'play none none reverse').split(/\\s+/)[i] || 'none') as SceneAction;\n if (act === 'play') a.play();\n else if (act === 'pause') a.pause();\n else if (act === 'resume') a.play();\n else if (act === 'reverse') a.reverse();\n else if (act === 'restart') a.restart();\n else if (act === 'reset') (a.pause(), a.seek(0));\n else if (act === 'complete') (a.pause(), (a.progress = 1));\n }\n\n private setupPin(el: HTMLElement): void {\n this.pinEl = el;\n const sp = document.createElement('div');\n sp.className = 'usa-pin-spacer';\n sp.style.boxSizing = 'content-box';\n el.parentNode?.insertBefore(sp, el);\n sp.appendChild(el);\n this.spacer = sp;\n this.offs.push(() => {\n el.style.position = el.style.top = el.style.left = el.style.width = el.style.transform = '';\n sp.parentNode?.insertBefore(el, sp);\n sp.remove();\n });\n }\n\n private applyPin(p: number): void {\n const el = this.pinEl, sp = this.spacer;\n if (!el || !sp) return;\n const h = !!this.options.horizontal;\n if (p > 0 && p < 1 && this.scroller === window) {\n const r = sp.getBoundingClientRect();\n const offset = this.start - (h ? r.left + window.scrollX : r.top + window.scrollY);\n el.style.position = 'fixed';\n el.style.width = `${r.width}px`;\n el.style.left = h ? `${-offset}px` : `${r.left}px`;\n el.style.top = h ? `${r.top}px` : `${-offset}px`;\n el.style.transform = '';\n } else {\n el.style.position = el.style.top = el.style.left = el.style.width = '';\n // inside a scroll container (or after the end) pinning is done with a transform\n const d = p >= 1 ? this.end - this.start : p > 0 ? this.pos() - this.start : 0;\n el.style.transform = d ? (h ? `translateX(${d}px)` : `translateY(${d}px)`) : '';\n }\n }\n\n private drawMarkers(vp: number): void {\n this.marks.forEach((m) => m.remove());\n this.marks = [];\n const mk = this.options.markers;\n if (!mk) return;\n const color = (typeof mk === 'object' && mk.color) || '#e11d48';\n const h = !!this.options.horizontal;\n const host = this.scroller === window ? document.body : (this.scroller as HTMLElement);\n const line = (label: string, at: number, fixed: boolean, c: string) => {\n const d = document.createElement('div');\n d.className = 'usa-scroll-marker';\n d.textContent = label;\n d.setAttribute('aria-hidden', 'true');\n Object.assign(d.style, { position: fixed ? 'fixed' : 'absolute', [h ? 'left' : 'top']: `${at}px`, [h ? 'top' : 'right']: '0', [h ? 'height' : 'width']: '80px', [h ? 'borderLeft' : 'borderTop']: `2px solid ${c}`, color: c, font: '600 11px/1.2 ui-monospace,monospace', padding: '2px 4px', zIndex: '2147483646', pointerEvents: 'none', background: 'rgba(255,255,255,.7)' });\n (fixed ? document.body : host).appendChild(d);\n this.marks.push(d);\n };\n const rule = (r: string | undefined, d: string) => (r || d).trim().split(/\\s+(?![+-]=)/)[1] ?? 'bottom';\n line(`start ${this.start | 0}`, this.start, false, color);\n line(`end ${this.end | 0}`, this.end, false, color);\n line('scroller-start', parseEdge(rule(this.options.start, 'top bottom'), vp), true, '#16a34a');\n if (!/^\\+=/.test((this.options.end || '').trim())) line('scroller-end', parseEdge(rule(this.options.end, 'bottom top'), vp), true, '#2563eb');\n }\n\n /** Remove listeners, pin spacer and markers (`keepState` keeps the animation where it is). */\n kill(keepState = false): void {\n if (this.killed) return;\n this.killed = true;\n if (!keepState) this.options.animation?.pause();\n this.offs.splice(0).forEach((f) => f());\n this.marks.forEach((m) => m.remove());\n scenes.delete(this);\n }\n}\n\n/** Create a scroll scene. */\nexport function scrollScene(o: SceneOptions): ScrollScene {\n return new ScrollScene(o);\n}\n/** Re-measure every scene (call after layout changes such as images loading). */\nexport function refreshScenes(): void {\n scenes.forEach((s) => s.refresh());\n}\n/** Kill every scene. */\nexport function killScenes(): void {\n Array.from(scenes).forEach((s) => s.kill());\n}\n/** The live scenes. */\nexport const allScenes = (): ScrollScene[] => Array.from(scenes);\n\nexport interface ScrollApi {\n scrollScene: typeof scrollScene;\n refreshScenes: typeof refreshScenes;\n killScenes: typeof killScenes;\n allScenes: typeof allScenes;\n parseEdge: typeof parseEdge;\n resolveRule: typeof resolveRule;\n ScrollScene: typeof ScrollScene;\n}\n\n/** The module object for `use(scroll)`. */\nexport const scroll: RuntimeModule<ScrollApi> = { id: 'scroll', version: RUNTIME_VERSION, requires: ['core'], api: { scr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":["../../src/runtime/scroll.ts"],"sourcesContent":["/**\n * `motionary/runtime/scroll` (10.2) — scroll-linked scenes, an original\n * implementation: start / end rules, scrubbing (direct or smoothed), pinning,\n * debug markers, enter / leave callbacks and per-edge actions for a runtime\n * tween or timeline.\n *\n * ```ts\n * import { use, timeline } from 'motionary/runtime';\n * import { scroll, scrollScene } from 'motionary/runtime/scroll';\n * use(scroll);\n * const tl = timeline({ paused: true }).to('.card', { to: { x: 200, rotate: 8 } });\n * scrollScene({ trigger: '.section', start: 'top 80%', end: 'bottom 20%', scrub: 120, pin: true, markers: true, animation: tl });\n * ```\n *\n * Rules: `\"<trigger edge> <viewport edge>\"` where an edge is `top | center | bottom`,\n * a percentage or pixels, optionally `+=N` / `-=N` (e.g. `\"top top+=80\"`);\n * `end` may also be `\"+=600\"` (pixels after start). Horizontal scenes use\n * `left | center | right`. Nothing touches `window` until a scene is created.\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { getTicker } from './ticker';\nimport type { Playable } from './tween';\n\nexport type SceneAction = 'play' | 'pause' | 'resume' | 'reverse' | 'restart' | 'reset' | 'complete' | 'none';\n\nexport interface SceneOptions {\n /** Element (or selector) whose position defines the scene. */\n trigger: Element | string;\n /** Default 'top bottom' (trigger top meets viewport bottom). */\n start?: string;\n /** Default 'bottom top'. `'+=600'` = 600 px after start. */\n end?: string;\n /** Link the animation to the scroll position: `true` (direct) or a smoothing time in ms. */\n scrub?: boolean | number;\n /** Runtime tween / timeline (created `paused: true`). */\n animation?: Playable;\n /** Without scrub: actions on enter, leave, enter back, leave back. Default 'play none none reverse'. */\n actions?: string;\n /** Pin the trigger (or another element) while the scene is active. */\n pin?: boolean | Element | string;\n /** Show start / end markers (debugging). */\n markers?: boolean | { color?: string };\n /** Class toggled on the trigger while active. */\n toggleClass?: string;\n /** Kill after the first forward completion. */\n once?: boolean;\n horizontal?: boolean;\n /** Scroll container (default: the window). */\n scroller?: Element | string;\n onEnter?: (s: ScrollScene) => void;\n onLeave?: (s: ScrollScene) => void;\n onEnterBack?: (s: ScrollScene) => void;\n onLeaveBack?: (s: ScrollScene) => void;\n onUpdate?: (s: ScrollScene) => void;\n onToggle?: (s: ScrollScene) => void;\n}\n\nconst KEYWORDS: Record<string, number> = { top: 0, left: 0, center: 0.5, bottom: 1, right: 1 };\n\n/** One side of a rule ('top', '80%', '120px', 'center+=40') → pixels within `size`. */\nexport function parseEdge(spec: string, size: number): number {\n const m = /^([a-z]+|-?[\\d.]+%|-?[\\d.]+(?:px)?)?\\s*(?:([+-])=\\s*(-?[\\d.]+)(px|%)?)?$/.exec(spec.trim());\n if (!m) throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n let v = 0;\n const b = m[1] || '0';\n if (b in KEYWORDS) v = KEYWORDS[b] * size;\n else if (b.endsWith('%')) v = (parseFloat(b) / 100) * size;\n else if (/^-?[\\d.]/.test(b)) v = parseFloat(b);\n else throw new Error(`[motionary] scroll: bad edge \"${spec}\"`);\n if (m[2]) {\n const n = m[4] === '%' ? (parseFloat(m[3]) / 100) * size : parseFloat(m[3]);\n v += m[2] === '+' ? n : -n;\n }\n return v;\n}\n\n/** Scroll offset at which `rule` is met: trigger edge (at `triggerStart`, size `triggerSize`) meets viewport edge. */\nexport function resolveRule(rule: string, triggerStart: number, triggerSize: number, viewport: number): number {\n const parts = rule.trim().split(/\\s+(?![+-]=)/);\n const t = parts[0] ?? 'top';\n const s = parts[1] ?? 'bottom';\n return triggerStart + parseEdge(t, triggerSize) - parseEdge(s, viewport);\n}\n\nconst scenes = new Set<ScrollScene>();\nconst q = (x: Element | string): Element => {\n const el = typeof x === 'string' ? document.querySelector(x) : x;\n if (!el) throw new Error(`[motionary] scroll: element \"${x}\" not found`);\n return el;\n};\n\n/** A scroll scene (see `scrollScene()`). */\nexport class ScrollScene {\n readonly trigger: Element;\n readonly options: SceneOptions;\n /** Scroll offsets (px) of the start and end. */\n start = 0;\n end = 0;\n /** 0 → 1 between start and end. */\n progress = 0;\n /** 1 scrolling forward, -1 back. */\n direction = 1;\n isActive = false;\n private shown = 0;\n private last = -1;\n private offs: (() => void)[] = [];\n private pinEl: HTMLElement | null = null;\n private spacer: HTMLElement | null = null;\n private marks: HTMLElement[] = [];\n private scroller: Element | Window;\n private killed = false;\n\n constructor(o: SceneOptions) {\n if (typeof window === 'undefined') throw new Error('[motionary] scroll scenes need a browser window');\n this.options = o;\n this.trigger = q(o.trigger);\n this.scroller = o.scroller ? q(o.scroller) : window;\n if (o.pin) this.setupPin(o.pin === true ? (this.trigger as HTMLElement) : (q(o.pin) as HTMLElement));\n const target: EventTarget = this.scroller;\n const onScroll = () => this.update();\n target.addEventListener('scroll', onScroll, { passive: true });\n window.addEventListener('resize', this.refreshBound);\n this.offs.push(() => target.removeEventListener('scroll', onScroll), () => window.removeEventListener('resize', this.refreshBound));\n if (o.scrub && typeof o.scrub === 'number') this.offs.push(getTicker().add((_, dt) => this.smooth(dt)));\n scenes.add(this);\n this.refresh();\n }\n private refreshBound = () => this.refresh();\n\n private pos(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.scrollX : window.scrollY;\n return this.options.horizontal ? s.scrollLeft : s.scrollTop;\n }\n private viewport(): number {\n const s = this.scroller as any;\n if (s === window) return this.options.horizontal ? window.innerWidth : window.innerHeight;\n return this.options.horizontal ? s.clientWidth : s.clientHeight;\n }\n\n /** Re-measure start / end (after layout changes). */\n refresh(): void {\n if (this.killed) return;\n const h = !!this.options.horizontal;\n const ref = (this.spacer || this.trigger) as Element;\n const r = ref.getBoundingClientRect();\n const sr = this.scroller === window ? { top: 0, left: 0 } : (this.scroller as Element).getBoundingClientRect();\n const tStart = (h ? r.left - sr.left : r.top - sr.top) + this.pos();\n const tSize = (this.pinEl ? (h ? this.pinEl.offsetWidth : this.pinEl.offsetHeight) : h ? r.width : r.height) || 0;\n const vp = this.viewport();\n this.start = resolveRule(this.options.start || (h ? 'left right' : 'top bottom'), tStart, tSize, vp);\n const e = this.options.end || (h ? 'right left' : 'bottom top');\n this.end = /^\\+=/.test(e.trim()) ? this.start + parseFloat(e.trim().slice(2)) : resolveRule(e, tStart, tSize, vp);\n if (this.end <= this.start) this.end = this.start + 1;\n if (this.spacer && this.pinEl) this.spacer.style[h ? 'paddingRight' : 'paddingBottom'] = `${this.end - this.start}px`;\n this.drawMarkers(vp);\n this.last = -1;\n this.update();\n }\n\n /** Read the scroll position and fire callbacks / drive the animation. */\n update(): void {\n if (this.killed) return;\n const y = this.pos();\n const p = Math.min(1, Math.max(0, (y - this.start) / (this.end - this.start)));\n if (y !== this.last && this.last >= 0) this.direction = y > this.last ? 1 : -1;\n const prev = this.progress;\n const was = this.isActive;\n this.progress = p;\n this.isActive = y > this.start && y < this.end;\n this.last = y;\n const o = this.options;\n if (this.isActive !== was || (prev === 0 && p === 1) || (prev === 1 && p === 0)) {\n const toggles: [keyof SceneOptions, number][] = [];\n if (p > 0 && prev === 0) toggles.push(['onEnter', 0]);\n if (p === 1 && prev < 1) toggles.push(['onLeave', 1]);\n if (p < 1 && prev === 1) toggles.push(['onEnterBack', 2]);\n if (p === 0 && prev > 0) toggles.push(['onLeaveBack', 3]);\n for (const [cb, i] of toggles) {\n (o[cb] as ((s: ScrollScene) => void) | undefined)?.(this);\n if (!o.scrub) this.act(i);\n }\n if (o.toggleClass) this.trigger.classList.toggle(o.toggleClass, this.isActive);\n o.onToggle?.(this);\n if (o.once && p === 1) {\n this.applyPin(1);\n this.kill(true);\n return;\n }\n }\n this.applyPin(p);\n if (o.scrub === true && o.animation) o.animation.progress = p;\n o.onUpdate?.(this);\n }\n\n private smooth(dt: number): void {\n const a = this.options.animation;\n if (!a) return;\n const k = 1 - Math.exp(-dt / Math.max(1, this.options.scrub as number));\n this.shown += (this.progress - this.shown) * k;\n if (Math.abs(this.progress - this.shown) < 0.0005) this.shown = this.progress;\n a.progress = this.shown;\n }\n\n private act(i: number): void {\n const a = this.options.animation;\n if (!a) return;\n const act = ((this.options.actions || 'play none none reverse').split(/\\s+/)[i] || 'none') as SceneAction;\n if (act === 'play') a.play();\n else if (act === 'pause') a.pause();\n else if (act === 'resume') a.play();\n else if (act === 'reverse') a.reverse();\n else if (act === 'restart') a.restart();\n else if (act === 'reset') (a.pause(), a.seek(0));\n else if (act === 'complete') (a.pause(), (a.progress = 1));\n }\n\n private setupPin(el: HTMLElement): void {\n this.pinEl = el;\n const sp = document.createElement('div');\n sp.className = 'usa-pin-spacer';\n sp.style.boxSizing = 'content-box';\n el.parentNode?.insertBefore(sp, el);\n sp.appendChild(el);\n this.spacer = sp;\n this.offs.push(() => {\n el.style.position = el.style.top = el.style.left = el.style.width = el.style.transform = '';\n sp.parentNode?.insertBefore(el, sp);\n sp.remove();\n });\n }\n\n private applyPin(p: number): void {\n const el = this.pinEl, sp = this.spacer;\n if (!el || !sp) return;\n const h = !!this.options.horizontal;\n if (p > 0 && p < 1 && this.scroller === window) {\n const r = sp.getBoundingClientRect();\n const offset = this.start - (h ? r.left + window.scrollX : r.top + window.scrollY);\n el.style.position = 'fixed';\n el.style.width = `${r.width}px`;\n el.style.left = h ? `${-offset}px` : `${r.left}px`;\n el.style.top = h ? `${r.top}px` : `${-offset}px`;\n el.style.transform = '';\n } else {\n el.style.position = el.style.top = el.style.left = el.style.width = '';\n // inside a scroll container (or after the end) pinning is done with a transform\n const d = p >= 1 ? this.end - this.start : p > 0 ? this.pos() - this.start : 0;\n el.style.transform = d ? (h ? `translateX(${d}px)` : `translateY(${d}px)`) : '';\n }\n }\n\n private drawMarkers(vp: number): void {\n this.marks.forEach((m) => m.remove());\n this.marks = [];\n const mk = this.options.markers;\n if (!mk) return;\n const color = (typeof mk === 'object' && mk.color) || '#e11d48';\n const h = !!this.options.horizontal;\n const host = this.scroller === window ? document.body : (this.scroller as HTMLElement);\n const line = (label: string, at: number, fixed: boolean, c: string) => {\n const d = document.createElement('div');\n d.className = 'usa-scroll-marker';\n d.textContent = label;\n d.setAttribute('aria-hidden', 'true');\n Object.assign(d.style, { position: fixed ? 'fixed' : 'absolute', [h ? 'left' : 'top']: `${at}px`, [h ? 'top' : 'right']: '0', [h ? 'height' : 'width']: '80px', [h ? 'borderLeft' : 'borderTop']: `2px solid ${c}`, color: c, font: '600 11px/1.2 ui-monospace,monospace', padding: '2px 4px', zIndex: '2147483646', pointerEvents: 'none', background: 'rgba(255,255,255,.7)' });\n (fixed ? document.body : host).appendChild(d);\n this.marks.push(d);\n };\n const rule = (r: string | undefined, d: string) => (r || d).trim().split(/\\s+(?![+-]=)/)[1] ?? 'bottom';\n line(`start ${this.start | 0}`, this.start, false, color);\n line(`end ${this.end | 0}`, this.end, false, color);\n line('scroller-start', parseEdge(rule(this.options.start, 'top bottom'), vp), true, '#16a34a');\n if (!/^\\+=/.test((this.options.end || '').trim())) line('scroller-end', parseEdge(rule(this.options.end, 'bottom top'), vp), true, '#2563eb');\n }\n\n /** Remove listeners, pin spacer and markers (`keepState` keeps the animation where it is). */\n kill(keepState = false): void {\n if (this.killed) return;\n this.killed = true;\n if (!keepState) this.options.animation?.pause();\n this.offs.splice(0).forEach((f) => f());\n this.marks.forEach((m) => m.remove());\n scenes.delete(this);\n }\n}\n\n/** Create a scroll scene. */\nexport function scrollScene(o: SceneOptions): ScrollScene {\n return new ScrollScene(o);\n}\n/** Re-measure every scene (call after layout changes such as images loading). */\nexport function refreshScenes(): void {\n scenes.forEach((s) => s.refresh());\n}\n/** Kill every scene. */\nexport function killScenes(): void {\n Array.from(scenes).forEach((s) => s.kill());\n}\n/** The live scenes. */\nexport const allScenes = (): ScrollScene[] => Array.from(scenes);\n\nexport interface ScrollApi {\n scrollScene: typeof scrollScene;\n refreshScenes: typeof refreshScenes;\n killScenes: typeof killScenes;\n allScenes: typeof allScenes;\n parseEdge: typeof parseEdge;\n resolveRule: typeof resolveRule;\n ScrollScene: typeof ScrollScene;\n}\n\n/** The module object for `use(scroll)`. */\nexport const scroll: RuntimeModule<ScrollApi> = { id: 'scroll', version: RUNTIME_VERSION, requires: ['core'], api: { scrollScene, refreshScenes, killScenes, allSc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