use-scroll-animate 10.2.0 → 10.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +35 -0
  3. package/README.md +67 -0
  4. package/bin/motionary-mcp.mjs +265 -0
  5. package/dist/chunks/anim-image-DDdb9q3X.js +166 -0
  6. package/dist/chunks/anim-image-DDdb9q3X.js.map +1 -0
  7. package/dist/chunks/anim-image-blQgPFFS.cjs +174 -0
  8. package/dist/chunks/anim-image-blQgPFFS.cjs.map +1 -0
  9. package/dist/chunks/audio-BpU-A1m1.cjs.map +1 -1
  10. package/dist/chunks/{audio-D95jwlOh.js → audio-CWt1xdZB.js} +3 -3
  11. package/dist/chunks/{audio-D95jwlOh.js.map → audio-CWt1xdZB.js.map} +1 -1
  12. package/dist/chunks/{base-BnRyfuyM.js → base-BTev8qxg.js} +2 -2
  13. package/dist/chunks/{base-BnRyfuyM.js.map → base-BTev8qxg.js.map} +1 -1
  14. package/dist/chunks/base-DBheNxJu.cjs.map +1 -1
  15. package/dist/chunks/bind-B_CTL6Qn.js.map +1 -1
  16. package/dist/chunks/bind-Ui43-n2d.cjs.map +1 -1
  17. package/dist/chunks/builtins-CKKZNR95.cjs.map +1 -1
  18. package/dist/chunks/{builtins-CqIq1zBv.js → builtins-CPmS6aDB.js} +3 -3
  19. package/dist/chunks/{builtins-CqIq1zBv.js.map → builtins-CPmS6aDB.js.map} +1 -1
  20. package/dist/chunks/core-B5T0dhFH.cjs.map +1 -1
  21. package/dist/chunks/{core-DsGoL9EY.js → core-BviA7nFa.js} +2 -2
  22. package/dist/chunks/{core-DsGoL9EY.js.map → core-BviA7nFa.js.map} +1 -1
  23. package/dist/chunks/core-D74Fz-dL.cjs.map +1 -1
  24. package/dist/chunks/core-D7cVumUu.js.map +1 -1
  25. package/dist/chunks/{core-XA2yhn1b.js → core-KiM7MXjL.js} +2 -2
  26. package/dist/chunks/{core-XA2yhn1b.js.map → core-KiM7MXjL.js.map} +1 -1
  27. package/dist/chunks/core-MQlXZKUG.cjs.map +1 -1
  28. package/dist/chunks/ease-HwYZnZat.cjs +94 -0
  29. package/dist/chunks/ease-HwYZnZat.cjs.map +1 -0
  30. package/dist/chunks/ease-XN8_0sXu.js +89 -0
  31. package/dist/chunks/ease-XN8_0sXu.js.map +1 -0
  32. package/dist/chunks/fx-B_pbhpDp.cjs.map +1 -1
  33. package/dist/chunks/{fx-CtnrFEg9.js → fx-CgWKqVsn.js} +2 -2
  34. package/dist/chunks/{fx-CtnrFEg9.js.map → fx-CgWKqVsn.js.map} +1 -1
  35. package/dist/chunks/generative-2LhxG5BJ.js.map +1 -1
  36. package/dist/chunks/generative-BHIj-NU0.cjs.map +1 -1
  37. package/dist/chunks/{gpu-CDcXiNA8.js → gpu-BWfgYWMY.js} +2 -2
  38. package/dist/chunks/{gpu-CDcXiNA8.js.map → gpu-BWfgYWMY.js.map} +1 -1
  39. package/dist/chunks/gpu-cUixt7kT.cjs.map +1 -1
  40. package/dist/chunks/index-tags-B-JBecYg.js.map +1 -1
  41. package/dist/chunks/index-tags-hLIF2Clq.cjs.map +1 -1
  42. package/dist/chunks/{keyframes-W-474DMc.js → keyframes-B5PWe5bU.js} +3 -2
  43. package/dist/chunks/keyframes-B5PWe5bU.js.map +1 -0
  44. package/dist/chunks/{keyframes-ZheOkpt0.cjs → keyframes-tC3I7anQ.cjs} +4 -3
  45. package/dist/chunks/keyframes-tC3I7anQ.cjs.map +1 -0
  46. package/dist/chunks/{manifest-D58HXVY-.js → manifest-BHx5yPN6.js} +2 -2
  47. package/dist/chunks/{manifest-D58HXVY-.js.map → manifest-BHx5yPN6.js.map} +1 -1
  48. package/dist/chunks/manifest-PaF9B8Vt.cjs.map +1 -1
  49. package/dist/chunks/{player-48Zy_NBG.js → player-BfHMNtiM.js} +4 -4
  50. package/dist/chunks/{player-48Zy_NBG.js.map → player-BfHMNtiM.js.map} +1 -1
  51. package/dist/chunks/player-C4y4jXSv.cjs.map +1 -1
  52. package/dist/chunks/presets-BYBVJVeP.js.map +1 -1
  53. package/dist/chunks/presets-CUHys3sK.cjs.map +1 -1
  54. package/dist/chunks/{registry-gFJRpPES.js → registry-BKzyg1JV.js} +2 -2
  55. package/dist/chunks/{registry-gFJRpPES.js.map → registry-BKzyg1JV.js.map} +1 -1
  56. package/dist/chunks/{registry-BIEjKngP.js → registry-CT-TT_bx.js} +3 -3
  57. package/dist/chunks/{registry-BIEjKngP.js.map → registry-CT-TT_bx.js.map} +1 -1
  58. package/dist/chunks/{registry-eJgpFAzI.cjs → registry-tzwKkldE.cjs} +2 -2
  59. package/dist/chunks/{registry-eJgpFAzI.cjs.map → registry-tzwKkldE.cjs.map} +1 -1
  60. package/dist/chunks/registry-xQZnSqqV.cjs.map +1 -1
  61. package/dist/chunks/shared-CkKHWrtJ.js.map +1 -1
  62. package/dist/chunks/shared-jkgRH-Hx.cjs.map +1 -1
  63. package/dist/chunks/{spring-CZDNyqWp.js → spring-BHuP55DR.js} +2 -2
  64. package/dist/chunks/{spring-CZDNyqWp.js.map → spring-BHuP55DR.js.map} +1 -1
  65. package/dist/chunks/spring-BlTQD2AV.cjs.map +1 -1
  66. package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -1
  67. package/dist/chunks/stagger-DtMKo2SK.js.map +1 -1
  68. package/dist/chunks/{ticker-CM_56oVy.js → ticker-C8lSGml9.js} +2 -2
  69. package/dist/chunks/{ticker-CM_56oVy.js.map → ticker-C8lSGml9.js.map} +1 -1
  70. package/dist/chunks/{ticker-D4o6enH0.cjs → ticker-Un0bvTWR.cjs} +2 -2
  71. package/dist/chunks/{ticker-D4o6enH0.cjs.map → ticker-Un0bvTWR.cjs.map} +1 -1
  72. package/dist/chunks/{tween-CqX1JBuj.js → tween-BcejKpsx.js} +15 -91
  73. package/dist/chunks/tween-BcejKpsx.js.map +1 -0
  74. package/dist/chunks/{tween-CBuWYpI-.cjs → tween-CwLLC3Ko.cjs} +15 -95
  75. package/dist/chunks/tween-CwLLC3Ko.cjs.map +1 -0
  76. package/dist/chunks/variants-CrDDJoYK.cjs.map +1 -1
  77. package/dist/chunks/{variants-GU3yIL4F.js → variants-CsRGUIyA.js} +2 -2
  78. package/dist/chunks/{variants-GU3yIL4F.js.map → variants-CsRGUIyA.js.map} +1 -1
  79. package/dist/components/a11y.cjs.map +1 -1
  80. package/dist/components/a11y.js +2 -2
  81. package/dist/components/a11y.js.map +1 -1
  82. package/dist/components/angular.cjs.map +1 -1
  83. package/dist/components/angular.js +8 -8
  84. package/dist/components/angular.js.map +1 -1
  85. package/dist/components/background.cjs.map +1 -1
  86. package/dist/components/background.js +2 -2
  87. package/dist/components/background.js.map +1 -1
  88. package/dist/components/bridge.cjs.map +1 -1
  89. package/dist/components/bridge.js +1 -1
  90. package/dist/components/bridge.js.map +1 -1
  91. package/dist/components/cards.cjs.map +1 -1
  92. package/dist/components/cards.js +2 -2
  93. package/dist/components/cards.js.map +1 -1
  94. package/dist/components/click.cjs.map +1 -1
  95. package/dist/components/click.js +3 -3
  96. package/dist/components/click.js.map +1 -1
  97. package/dist/components/core.cjs.map +1 -1
  98. package/dist/components/core.js.map +1 -1
  99. package/dist/components/depth.cjs.map +1 -1
  100. package/dist/components/depth.js +3 -3
  101. package/dist/components/depth.js.map +1 -1
  102. package/dist/components/design.cjs.map +1 -1
  103. package/dist/components/design.js +3 -3
  104. package/dist/components/design.js.map +1 -1
  105. package/dist/components/dsl.cjs.map +1 -1
  106. package/dist/components/dsl.js +2 -2
  107. package/dist/components/dsl.js.map +1 -1
  108. package/dist/components/effects.cjs.map +1 -1
  109. package/dist/components/effects.js +9 -9
  110. package/dist/components/effects.js.map +1 -1
  111. package/dist/components/engine.cjs.map +1 -1
  112. package/dist/components/engine.js +2 -2
  113. package/dist/components/engine.js.map +1 -1
  114. package/dist/components/feedback.cjs.map +1 -1
  115. package/dist/components/feedback.js +1 -1
  116. package/dist/components/feedback.js.map +1 -1
  117. package/dist/components/fx-3d.cjs.map +1 -1
  118. package/dist/components/fx-3d.js +2 -2
  119. package/dist/components/fx-3d.js.map +1 -1
  120. package/dist/components/fx-ai.cjs.map +1 -1
  121. package/dist/components/fx-ai.js +2 -2
  122. package/dist/components/fx-ai.js.map +1 -1
  123. package/dist/components/fx-chart.cjs.map +1 -1
  124. package/dist/components/fx-chart.js +2 -2
  125. package/dist/components/fx-chart.js.map +1 -1
  126. package/dist/components/fx-cinema.cjs.map +1 -1
  127. package/dist/components/fx-cinema.js +2 -2
  128. package/dist/components/fx-cinema.js.map +1 -1
  129. package/dist/components/fx-cyber.cjs.map +1 -1
  130. package/dist/components/fx-cyber.js +2 -2
  131. package/dist/components/fx-cyber.js.map +1 -1
  132. package/dist/components/fx-festival.cjs.map +1 -1
  133. package/dist/components/fx-festival.js +2 -2
  134. package/dist/components/fx-festival.js.map +1 -1
  135. package/dist/components/fx-focus.cjs.map +1 -1
  136. package/dist/components/fx-focus.js +2 -2
  137. package/dist/components/fx-focus.js.map +1 -1
  138. package/dist/components/fx-form.cjs.map +1 -1
  139. package/dist/components/fx-form.js +2 -2
  140. package/dist/components/fx-form.js.map +1 -1
  141. package/dist/components/fx-game.cjs.map +1 -1
  142. package/dist/components/fx-game.js +2 -2
  143. package/dist/components/fx-game.js.map +1 -1
  144. package/dist/components/fx-genart.cjs.map +1 -1
  145. package/dist/components/fx-genart.js +2 -2
  146. package/dist/components/fx-genart.js.map +1 -1
  147. package/dist/components/fx-geo.cjs.map +1 -1
  148. package/dist/components/fx-geo.js +2 -2
  149. package/dist/components/fx-geo.js.map +1 -1
  150. package/dist/components/fx-gesture.cjs.map +1 -1
  151. package/dist/components/fx-gesture.js +2 -2
  152. package/dist/components/fx-gesture.js.map +1 -1
  153. package/dist/components/fx-gpu.js +3 -3
  154. package/dist/components/fx-light.cjs.map +1 -1
  155. package/dist/components/fx-light.js +2 -2
  156. package/dist/components/fx-light.js.map +1 -1
  157. package/dist/components/fx-lottie.cjs.map +1 -1
  158. package/dist/components/fx-lottie.js +2 -2
  159. package/dist/components/fx-lottie.js.map +1 -1
  160. package/dist/components/fx-morph.cjs.map +1 -1
  161. package/dist/components/fx-morph.js +2 -2
  162. package/dist/components/fx-morph.js.map +1 -1
  163. package/dist/components/fx-music.cjs.map +1 -1
  164. package/dist/components/fx-music.js +3 -3
  165. package/dist/components/fx-music.js.map +1 -1
  166. package/dist/components/fx-organic.cjs.map +1 -1
  167. package/dist/components/fx-organic.js +2 -2
  168. package/dist/components/fx-organic.js.map +1 -1
  169. package/dist/components/fx-paper.cjs.map +1 -1
  170. package/dist/components/fx-paper.js +2 -2
  171. package/dist/components/fx-paper.js.map +1 -1
  172. package/dist/components/fx-perf.cjs.map +1 -1
  173. package/dist/components/fx-perf.js +2 -2
  174. package/dist/components/fx-perf.js.map +1 -1
  175. package/dist/components/fx-physics.cjs.map +1 -1
  176. package/dist/components/fx-physics.js +2 -2
  177. package/dist/components/fx-physics.js.map +1 -1
  178. package/dist/components/fx-retro.cjs.map +1 -1
  179. package/dist/components/fx-retro.js +2 -2
  180. package/dist/components/fx-retro.js.map +1 -1
  181. package/dist/components/fx-safe.cjs.map +1 -1
  182. package/dist/components/fx-safe.js +2 -2
  183. package/dist/components/fx-safe.js.map +1 -1
  184. package/dist/components/fx-shop.cjs.map +1 -1
  185. package/dist/components/fx-shop.js +2 -2
  186. package/dist/components/fx-shop.js.map +1 -1
  187. package/dist/components/fx-social.cjs.map +1 -1
  188. package/dist/components/fx-social.js +2 -2
  189. package/dist/components/fx-social.js.map +1 -1
  190. package/dist/components/fx-spatial.cjs.map +1 -1
  191. package/dist/components/fx-spatial.js +2 -2
  192. package/dist/components/fx-spatial.js.map +1 -1
  193. package/dist/components/fx-surface.cjs.map +1 -1
  194. package/dist/components/fx-surface.js +2 -2
  195. package/dist/components/fx-surface.js.map +1 -1
  196. package/dist/components/fx-text.cjs.map +1 -1
  197. package/dist/components/fx-text.js +2 -2
  198. package/dist/components/fx-text.js.map +1 -1
  199. package/dist/components/fx-transitions.cjs.map +1 -1
  200. package/dist/components/fx-transitions.js +3 -3
  201. package/dist/components/fx-transitions.js.map +1 -1
  202. package/dist/components/fx-video.cjs.map +1 -1
  203. package/dist/components/fx-video.js +2 -2
  204. package/dist/components/fx-video.js.map +1 -1
  205. package/dist/components/fx-weather.cjs.map +1 -1
  206. package/dist/components/fx-weather.js +2 -2
  207. package/dist/components/fx-weather.js.map +1 -1
  208. package/dist/components/fx.cjs.map +1 -1
  209. package/dist/components/fx.js +6 -6
  210. package/dist/components/fx.js.map +1 -1
  211. package/dist/components/fx2.cjs.map +1 -1
  212. package/dist/components/fx2.js +6 -6
  213. package/dist/components/fx2.js.map +1 -1
  214. package/dist/components/gesture.cjs.map +1 -1
  215. package/dist/components/gesture.js +4 -4
  216. package/dist/components/gesture.js.map +1 -1
  217. package/dist/components/interaction.cjs.map +1 -1
  218. package/dist/components/interaction.js +1 -1
  219. package/dist/components/interaction.js.map +1 -1
  220. package/dist/components/layout.cjs.map +1 -1
  221. package/dist/components/layout.js +1 -1
  222. package/dist/components/layout.js.map +1 -1
  223. package/dist/components/lazy.cjs.map +1 -1
  224. package/dist/components/lazy.js.map +1 -1
  225. package/dist/components/lite.cjs.map +1 -1
  226. package/dist/components/lite.js.map +1 -1
  227. package/dist/components/marketplace.cjs.map +1 -1
  228. package/dist/components/marketplace.js +4 -4
  229. package/dist/components/marketplace.js.map +1 -1
  230. package/dist/components/native.cjs.map +1 -1
  231. package/dist/components/native.js +3 -3
  232. package/dist/components/native.js.map +1 -1
  233. package/dist/components/packs.cjs.map +1 -1
  234. package/dist/components/packs.js +1 -1
  235. package/dist/components/packs.js.map +1 -1
  236. package/dist/components/page.cjs.map +1 -1
  237. package/dist/components/page.js +3 -3
  238. package/dist/components/page.js.map +1 -1
  239. package/dist/components/perf.cjs.map +1 -1
  240. package/dist/components/perf.js +2 -2
  241. package/dist/components/perf.js.map +1 -1
  242. package/dist/components/physics.cjs.map +1 -1
  243. package/dist/components/physics.js +3 -3
  244. package/dist/components/physics.js.map +1 -1
  245. package/dist/components/plugins.cjs.map +1 -1
  246. package/dist/components/plugins.js +4 -4
  247. package/dist/components/plugins.js.map +1 -1
  248. package/dist/components/react.cjs.map +1 -1
  249. package/dist/components/react.js.map +1 -1
  250. package/dist/components/reveal.cjs.map +1 -1
  251. package/dist/components/reveal.js +1 -1
  252. package/dist/components/reveal.js.map +1 -1
  253. package/dist/components/solid.cjs.map +1 -1
  254. package/dist/components/solid.js +8 -8
  255. package/dist/components/solid.js.map +1 -1
  256. package/dist/components/svelte.cjs.map +1 -1
  257. package/dist/components/svelte.js +8 -8
  258. package/dist/components/svelte.js.map +1 -1
  259. package/dist/components/svg.cjs.map +1 -1
  260. package/dist/components/svg.js +1 -1
  261. package/dist/components/svg.js.map +1 -1
  262. package/dist/components/text.cjs.map +1 -1
  263. package/dist/components/text.js +2 -2
  264. package/dist/components/text.js.map +1 -1
  265. package/dist/components/timeline.cjs.map +1 -1
  266. package/dist/components/timeline.js +3 -3
  267. package/dist/components/timeline.js.map +1 -1
  268. package/dist/components/tokens.cjs.map +1 -1
  269. package/dist/components/tokens.js.map +1 -1
  270. package/dist/components/transitions.cjs.map +1 -1
  271. package/dist/components/transitions.js +1 -1
  272. package/dist/components/transitions.js.map +1 -1
  273. package/dist/components/ui.cjs.map +1 -1
  274. package/dist/components/ui.js +4 -4
  275. package/dist/components/ui.js.map +1 -1
  276. package/dist/components/vue.cjs.map +1 -1
  277. package/dist/components/vue.js +8 -8
  278. package/dist/components/vue.js.map +1 -1
  279. package/dist/components/webgl.cjs.map +1 -1
  280. package/dist/components/webgl.js +1 -1
  281. package/dist/components/webgl.js.map +1 -1
  282. package/dist/components/widgets.cjs +766 -212
  283. package/dist/components/widgets.cjs.map +1 -1
  284. package/dist/components/widgets.d.cts +207 -2
  285. package/dist/components/widgets.d.ts +207 -2
  286. package/dist/components/widgets.js +770 -221
  287. package/dist/components/widgets.js.map +1 -1
  288. package/dist/components.cjs.map +1 -1
  289. package/dist/components.js +10 -10
  290. package/dist/components.js.map +1 -1
  291. package/dist/element.cjs.map +1 -1
  292. package/dist/element.js.map +1 -1
  293. package/dist/index.cjs.map +1 -1
  294. package/dist/index.js +2 -2
  295. package/dist/index.js.map +1 -1
  296. package/dist/llms-full.txt +250 -1
  297. package/dist/llms.txt +13 -2
  298. package/dist/manifest.json +646 -1
  299. package/dist/presets/extended.cjs.map +1 -1
  300. package/dist/presets/extended.js.map +1 -1
  301. package/dist/react.cjs.map +1 -1
  302. package/dist/react.js.map +1 -1
  303. package/dist/runtime/format-apng.cjs +131 -0
  304. package/dist/runtime/format-apng.cjs.map +1 -0
  305. package/dist/runtime/format-apng.d.cts +250 -0
  306. package/dist/runtime/format-apng.d.ts +250 -0
  307. package/dist/runtime/format-apng.iife.js +2 -0
  308. package/dist/runtime/format-apng.iife.js.map +1 -0
  309. package/dist/runtime/format-apng.js +123 -0
  310. package/dist/runtime/format-apng.js.map +1 -0
  311. package/dist/runtime/format-css.cjs +5 -4
  312. package/dist/runtime/format-css.cjs.map +1 -1
  313. package/dist/runtime/format-css.js +5 -4
  314. package/dist/runtime/format-css.js.map +1 -1
  315. package/dist/runtime/format-gif.cjs +206 -0
  316. package/dist/runtime/format-gif.cjs.map +1 -0
  317. package/dist/runtime/format-gif.d.cts +223 -0
  318. package/dist/runtime/format-gif.d.ts +223 -0
  319. package/dist/runtime/format-gif.iife.js +2 -0
  320. package/dist/runtime/format-gif.iife.js.map +1 -0
  321. package/dist/runtime/format-gif.js +199 -0
  322. package/dist/runtime/format-gif.js.map +1 -0
  323. package/dist/runtime/format-motion.cjs +9 -8
  324. package/dist/runtime/format-motion.cjs.map +1 -1
  325. package/dist/runtime/format-motion.js +5 -4
  326. package/dist/runtime/format-motion.js.map +1 -1
  327. package/dist/runtime/format-sprite.cjs +226 -0
  328. package/dist/runtime/format-sprite.cjs.map +1 -0
  329. package/dist/runtime/format-sprite.d.cts +224 -0
  330. package/dist/runtime/format-sprite.d.ts +224 -0
  331. package/dist/runtime/format-sprite.iife.js +2 -0
  332. package/dist/runtime/format-sprite.iife.js.map +1 -0
  333. package/dist/runtime/format-sprite.js +216 -0
  334. package/dist/runtime/format-sprite.js.map +1 -0
  335. package/dist/runtime/format-svg.cjs +5 -4
  336. package/dist/runtime/format-svg.cjs.map +1 -1
  337. package/dist/runtime/format-svg.iife.js.map +1 -1
  338. package/dist/runtime/format-svg.js +4 -3
  339. package/dist/runtime/format-svg.js.map +1 -1
  340. package/dist/runtime/format-webp.cjs +123 -0
  341. package/dist/runtime/format-webp.cjs.map +1 -0
  342. package/dist/runtime/format-webp.d.cts +245 -0
  343. package/dist/runtime/format-webp.d.ts +245 -0
  344. package/dist/runtime/format-webp.iife.js +2 -0
  345. package/dist/runtime/format-webp.iife.js.map +1 -0
  346. package/dist/runtime/format-webp.js +115 -0
  347. package/dist/runtime/format-webp.js.map +1 -0
  348. package/dist/runtime/scroll.cjs +2 -2
  349. package/dist/runtime/scroll.cjs.map +1 -1
  350. package/dist/runtime/scroll.js +2 -2
  351. package/dist/runtime/scroll.js.map +1 -1
  352. package/dist/runtime/smooth.cjs +284 -0
  353. package/dist/runtime/smooth.cjs.map +1 -0
  354. package/dist/runtime/smooth.d.cts +137 -0
  355. package/dist/runtime/smooth.d.ts +137 -0
  356. package/dist/runtime/smooth.iife.js +2 -0
  357. package/dist/runtime/smooth.iife.js.map +1 -0
  358. package/dist/runtime/smooth.js +279 -0
  359. package/dist/runtime/smooth.js.map +1 -0
  360. package/dist/runtime/text.cjs +147 -0
  361. package/dist/runtime/text.cjs.map +1 -0
  362. package/dist/runtime/text.d.cts +65 -0
  363. package/dist/runtime/text.d.ts +65 -0
  364. package/dist/runtime/text.iife.js +2 -0
  365. package/dist/runtime/text.iife.js.map +1 -0
  366. package/dist/runtime/text.js +143 -0
  367. package/dist/runtime/text.js.map +1 -0
  368. package/dist/runtime.cjs +9 -8
  369. package/dist/runtime.cjs.map +1 -1
  370. package/dist/runtime.d.cts +9 -2
  371. package/dist/runtime.d.ts +9 -2
  372. package/dist/runtime.iife.js +1 -1
  373. package/dist/runtime.iife.js.map +1 -1
  374. package/dist/runtime.js +6 -5
  375. package/dist/runtime.js.map +1 -1
  376. package/dist/solid.cjs.map +1 -1
  377. package/dist/solid.js.map +1 -1
  378. package/dist/svelte.cjs.map +1 -1
  379. package/dist/svelte.js.map +1 -1
  380. package/dist/vue.cjs.map +1 -1
  381. package/dist/vue.js.map +1 -1
  382. package/dist/widgets.umd.js +1 -1
  383. package/dist/widgets.umd.js.map +1 -1
  384. package/docs/ROADMAP.md +2 -2
  385. package/docs/components/README.md +12 -7
  386. package/docs/components/usa-parallax-layers.md +38 -0
  387. package/docs/components/usa-route-transition.md +38 -0
  388. package/docs/components/usa-scroll-ring.md +32 -0
  389. package/docs/components/usa-smooth-scroll.md +60 -0
  390. package/docs/components/usa-text-splitter.md +60 -0
  391. package/docs/components.md +94 -0
  392. package/docs/mcp.md +50 -0
  393. package/docs/runtime/format-apng.md +59 -0
  394. package/docs/runtime/format-gif.md +60 -0
  395. package/docs/runtime/format-sprite.md +60 -0
  396. package/docs/runtime/format-webp.md +58 -0
  397. package/docs/runtime/smooth.md +60 -0
  398. package/docs/runtime/text.md +59 -0
  399. package/package.json +64 -2
  400. package/dist/chunks/keyframes-W-474DMc.js.map +0 -1
  401. package/dist/chunks/keyframes-ZheOkpt0.cjs.map +0 -1
  402. package/dist/chunks/tween-CBuWYpI-.cjs.map +0 -1
  403. package/dist/chunks/tween-CqX1JBuj.js.map +0 -1
@@ -0,0 +1,65 @@
1
+ /** A runtime module: `{ id, version, api }`, registered with `use()`. */
2
+ interface RuntimeModule<A = unknown> {
3
+ /** Module id: 'core', 'format-css', 'scroll', … (import path `motionary/runtime/<id>`). */
4
+ id: string;
5
+ version: string;
6
+ /** Other modules this one needs (registered first by `use()` callers). */
7
+ requires?: string[];
8
+ /** The module's public API (what `requireModule(id)` returns). */
9
+ api: A;
10
+ /** Optional one-time setup, called on first registration. */
11
+ setup?(registry: RuntimeRegistry): void;
12
+ }
13
+ interface RuntimeRegistry {
14
+ version: string;
15
+ modules: Map<string, RuntimeModule>;
16
+ /** Shared per-page state slots (the ticker lives here). */
17
+ slots: Record<string, unknown>;
18
+ }
19
+
20
+ /**
21
+ * `motionary/runtime/text` (10.3) — split text into characters, words and
22
+ * lines for animation, keeping it accessible (original implementation).
23
+ *
24
+ * - `segment(text, 'chars' | 'words')` — pure, works anywhere (SSR, workers):
25
+ * grapheme clusters via `Intl.Segmenter` when available (emoji, combining
26
+ * marks, CJK stay whole), whitespace-aware words.
27
+ * - `splitText(el, { type: 'chars,words,lines' })` — wraps the element's text
28
+ * in spans (nested elements such as `<a>`, `<em>` keep their markup), groups
29
+ * words into lines by their rendered position, sets `aria-label` on the
30
+ * element with the original text and hides the pieces from assistive tech.
31
+ * `revert()` restores the original markup; `resplit()` re-measures lines
32
+ * (e.g. after a resize).
33
+ */
34
+
35
+ type SplitType = 'chars' | 'words' | 'lines';
36
+ /** Split a string into graphemes ('chars') or words + whitespace runs ('words'). */
37
+ declare function segment(text: string, by?: 'chars' | 'words'): string[];
38
+ interface SplitOptions {
39
+ /** Any of chars, words, lines (comma / space separated). Default 'chars,words'. */
40
+ type?: string;
41
+ /** Class prefix (default 'usa-split'): pieces get `<prefix>-char`, `-word`, `-line`. */
42
+ className?: string;
43
+ /** Set a `--i` custom property (index) on each piece for CSS staggering (default true). */
44
+ indexVar?: boolean;
45
+ }
46
+ interface SplitResult {
47
+ chars: HTMLElement[];
48
+ words: HTMLElement[];
49
+ lines: HTMLElement[];
50
+ /** Restore the original markup. */
51
+ revert(): void;
52
+ /** Revert and split again (re-measures lines). */
53
+ resplit(): SplitResult;
54
+ }
55
+ /** Split an element's text (see module docs). Needs a DOM. */
56
+ declare function splitText(el: HTMLElement, o?: SplitOptions): SplitResult;
57
+ interface TextApi {
58
+ segment: typeof segment;
59
+ splitText: typeof splitText;
60
+ }
61
+ /** The module object for `use(text)`. */
62
+ declare const text: RuntimeModule<TextApi>;
63
+
64
+ export { segment, splitText, text };
65
+ export type { SplitOptions, SplitResult, SplitType, TextApi };
@@ -0,0 +1,2 @@
1
+ !function(e,t){"use strict";function n(e,t="chars"){const n=Intl.Segmenter;return"chars"===t?n?Array.from(new n(void 0,{granularity:"grapheme"}).segment(e),e=>e.segment):Array.from(e):e.split(/(\s+)/).filter(e=>""!==e)}function r(e,t={}){if("undefined"==typeof document)throw new Error("[motionary] splitText needs a DOM — use segment() on the server");const s=(o=t.type,new Set((o||"chars,words").split(/[\s,]+/).filter(Boolean)));var o;const i=t.className||"usa-split",a=e.innerHTML,l=e.getAttribute("aria-label"),c=(e.textContent||"").replace(/\s+/g," ").trim(),d=[],h=[],p=(e,t)=>{const n=document.createElement("span");return n.className=e,n.setAttribute("aria-hidden","true"),n.style.display="inline-block",void 0!==t&&(n.textContent=t),n},u=s.has("words")||s.has("lines"),f=e=>{for(const t of Array.from(e.childNodes))if(3===t.nodeType){const e=document.createDocumentFragment();for(const r of n(t.textContent||"","words")){if(/^\s+$/.test(r)){e.appendChild(document.createTextNode(" "));continue}const t=u?p(`${i}-word`):null;if(s.has("chars"))for(const s of n(r,"chars")){const n=p(`${i}-char`,s);d.push(n),(t||e).appendChild(n)}else t?t.textContent=r:e.appendChild(document.createTextNode(r));t&&(h.push(t),e.appendChild(t))}t.replaceWith(e)}else 1!==t.nodeType||t.classList.contains(`${i}-word`)||f(t)};f(e),c&&null===l&&e.setAttribute("aria-label",c),e.setAttribute("data-split",Array.from(s).join(" "));const m=[];if(s.has("lines")&&h.length){let t=NaN,n=[];const r=[];for(const e of h){const s=Math.round(e.offsetTop);n.length&&Math.abs(s-t)>2&&(r.push(n),n=[]),n.length||(t=s),n.push(e)}n.length&&r.push(n);if(h.every(t=>t.parentElement===e)){e.textContent="";for(const t of r){const n=p(`${i}-line`);n.style.display="block",t.forEach((e,t)=>{t&&n.appendChild(document.createTextNode(" ")),n.appendChild(e)}),m.push(n),e.appendChild(n)}}else r.forEach((e,t)=>e.forEach(e=>e.setAttribute("data-line",String(t))))}if(!1!==t.indexVar)for(const e of[d,h,m])e.forEach((e,t)=>e.style.setProperty("--i",String(t)));const y={chars:d,words:s.has("words")?h:[],lines:m,revert(){e.innerHTML=a,e.removeAttribute("data-split"),null===l&&e.removeAttribute("aria-label")},resplit:()=>(y.revert(),r(e,t))};return y}const s={id:"text",version:t.RUNTIME_VERSION,requires:["core"],api:{segment:n,splitText:r}};t.register(s),e.segment=n,e.splitText=r,e.text=s}(this.MotionaryRuntime=this.MotionaryRuntime||{},MotionaryRuntime);
2
+ //# sourceMappingURL=text.iife.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.iife.js","sources":["../../src/runtime/text.ts","../../src/runtime/iife/text.ts"],"sourcesContent":["/**\n * `motionary/runtime/text` (10.3) — split text into characters, words and\n * lines for animation, keeping it accessible (original implementation).\n *\n * - `segment(text, 'chars' | 'words')` — pure, works anywhere (SSR, workers):\n * grapheme clusters via `Intl.Segmenter` when available (emoji, combining\n * marks, CJK stay whole), whitespace-aware words.\n * - `splitText(el, { type: 'chars,words,lines' })` — wraps the element's text\n * in spans (nested elements such as `<a>`, `<em>` keep their markup), groups\n * words into lines by their rendered position, sets `aria-label` on the\n * element with the original text and hides the pieces from assistive tech.\n * `revert()` restores the original markup; `resplit()` re-measures lines\n * (e.g. after a resize).\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\n\nexport type SplitType = 'chars' | 'words' | 'lines';\n\n/** Split a string into graphemes ('chars') or words + whitespace runs ('words'). */\nexport function segment(text: string, by: 'chars' | 'words' = 'chars'): string[] {\n const Seg = (Intl as any).Segmenter;\n if (by === 'chars') {\n if (Seg) return Array.from(new Seg(undefined, { granularity: 'grapheme' }).segment(text), (s: any) => s.segment as string);\n return Array.from(text);\n }\n return text.split(/(\\s+)/).filter((s) => s !== '');\n}\n\nexport interface SplitOptions {\n /** Any of chars, words, lines (comma / space separated). Default 'chars,words'. */\n type?: string;\n /** Class prefix (default 'usa-split'): pieces get `<prefix>-char`, `-word`, `-line`. */\n className?: string;\n /** Set a `--i` custom property (index) on each piece for CSS staggering (default true). */\n indexVar?: boolean;\n}\n\nexport interface SplitResult {\n chars: HTMLElement[];\n words: HTMLElement[];\n lines: HTMLElement[];\n /** Restore the original markup. */\n revert(): void;\n /** Revert and split again (re-measures lines). */\n resplit(): SplitResult;\n}\n\nconst types = (t?: string): Set<SplitType> => new Set((t || 'chars,words').split(/[\\s,]+/).filter(Boolean) as SplitType[]);\n\n/** Split an element's text (see module docs). Needs a DOM. */\nexport function splitText(el: HTMLElement, o: SplitOptions = {}): SplitResult {\n if (typeof document === 'undefined') throw new Error('[motionary] splitText needs a DOM — use segment() on the server');\n const want = types(o.type);\n const pre = o.className || 'usa-split';\n const original = el.innerHTML;\n const hadLabel = el.getAttribute('aria-label');\n const text = (el.textContent || '').replace(/\\s+/g, ' ').trim();\n const chars: HTMLElement[] = [], words: HTMLElement[] = [];\n const mk = (cls: string, txt?: string) => {\n const s = document.createElement('span');\n s.className = cls;\n s.setAttribute('aria-hidden', 'true');\n s.style.display = 'inline-block';\n if (txt !== undefined) s.textContent = txt;\n return s;\n };\n const wantWords = want.has('words') || want.has('lines');\n const walk = (node: Node) => {\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === 3) {\n const frag = document.createDocumentFragment();\n for (const part of segment(child.textContent || '', 'words')) {\n if (/^\\s+$/.test(part)) {\n frag.appendChild(document.createTextNode(' '));\n continue;\n }\n const w = wantWords ? mk(`${pre}-word`) : null;\n if (want.has('chars')) {\n for (const g of segment(part, 'chars')) {\n const c = mk(`${pre}-char`, g);\n chars.push(c);\n (w || frag).appendChild(c);\n }\n } else if (w) w.textContent = part;\n else frag.appendChild(document.createTextNode(part));\n if (w) {\n words.push(w);\n frag.appendChild(w);\n }\n }\n child.replaceWith(frag);\n } else if (child.nodeType === 1 && !(child as Element).classList.contains(`${pre}-word`)) walk(child);\n }\n };\n walk(el);\n if (text && hadLabel === null) el.setAttribute('aria-label', text);\n el.setAttribute('data-split', Array.from(want).join(' '));\n const lines: HTMLElement[] = [];\n if (want.has('lines') && words.length) {\n // group words by their rendered top; wrap each group in a line span (flat text only)\n let top = NaN, cur: HTMLElement[] = [];\n const groups: HTMLElement[][] = [];\n for (const w of words) {\n const t = Math.round(w.offsetTop);\n if (cur.length && Math.abs(t - top) > 2) {\n groups.push(cur);\n cur = [];\n }\n if (!cur.length) top = t;\n cur.push(w);\n }\n if (cur.length) groups.push(cur);\n const flat = words.every((w) => w.parentElement === el);\n if (flat) {\n el.textContent = '';\n for (const g of groups) {\n const line = mk(`${pre}-line`);\n line.style.display = 'block';\n g.forEach((w, i) => {\n if (i) line.appendChild(document.createTextNode(' '));\n line.appendChild(w);\n });\n lines.push(line);\n el.appendChild(line);\n }\n } else groups.forEach((g, i) => g.forEach((w) => w.setAttribute('data-line', String(i))));\n }\n if (o.indexVar !== false) for (const list of [chars, words, lines]) list.forEach((s, i) => s.style.setProperty('--i', String(i)));\n const result: SplitResult = {\n chars,\n words: want.has('words') ? words : [],\n lines,\n revert() {\n el.innerHTML = original;\n el.removeAttribute('data-split');\n if (hadLabel === null) el.removeAttribute('aria-label');\n },\n resplit() {\n result.revert();\n return splitText(el, o);\n },\n };\n return result;\n}\n\nexport interface TextApi {\n segment: typeof segment;\n splitText: typeof splitText;\n}\n\n/** The module object for `use(text)`. */\nexport const text: RuntimeModule<TextApi> = { id: 'text', version: RUNTIME_VERSION, requires: ['core'], api: { segment, splitText } };\n","// CDN build: load runtime.iife.js first, then this file → registers motionary/runtime/text and adds its API to window.MotionaryRuntime.\nimport { register } from '../registry';\nimport { text } from '../text';\nexport * from '../text';\nregister(text);\n"],"names":["segment","text","by","Seg","Intl","Segmenter","Array","from","undefined","granularity","s","split","filter","splitText","el","o","document","Error","want","t","type","Set","Boolean","pre","className","original","innerHTML","hadLabel","getAttribute","textContent","replace","trim","chars","words","mk","cls","txt","createElement","setAttribute","style","display","wantWords","has","walk","node","child","childNodes","nodeType","frag","createDocumentFragment","part","test","appendChild","createTextNode","w","g","c","push","replaceWith","classList","contains","join","lines","length","top","NaN","cur","groups","Math","round","offsetTop","abs","every","parentElement","line","forEach","i","String","indexVar","list","setProperty","result","revert","removeAttribute","resplit","id","version","RUNTIME_VERSION","requires","api","register"],"mappings":"qCAmBgBA,EAAQC,EAAcC,EAAwB,SAC5D,MAAMC,EAAOC,KAAaC,UAC1B,MAAW,UAAPH,EACEC,EAAYG,MAAMC,KAAK,IAAIJ,OAAIK,EAAW,CAAEC,YAAa,aAAcT,QAAQC,GAAQS,GAAWA,EAAEV,SACjGM,MAAMC,KAAKN,GAEbA,EAAKU,MAAM,SAASC,OAAQF,GAAY,KAANA,EAC3C,UAwBgBG,EAAUC,EAAiBC,EAAkB,IAC3D,GAAwB,oBAAbC,SAA0B,MAAM,IAAIC,MAAM,mEACrD,MAAMC,GALOC,EAKMJ,EAAEK,KALuB,IAAIC,KAAKF,GAAK,eAAeR,MAAM,UAAUC,OAAOU,WAApF,IAACH,EAMb,MAAMI,EAAMR,EAAES,WAAa,YACrBC,EAAWX,EAAGY,UACdC,EAAWb,EAAGc,aAAa,cAC3B3B,GAAQa,EAAGe,aAAe,IAAIC,QAAQ,OAAQ,KAAKC,OACnDC,EAAuB,GAAIC,EAAuB,GAClDC,EAAK,CAACC,EAAaC,KACvB,MAAM1B,EAAIM,SAASqB,cAAc,QAKjC,OAJA3B,EAAEc,UAAYW,EACdzB,EAAE4B,aAAa,cAAe,QAC9B5B,EAAE6B,MAAMC,QAAU,oBACNhC,IAAR4B,IAAmB1B,EAAEmB,YAAcO,GAChC1B,GAEH+B,EAAYvB,EAAKwB,IAAI,UAAYxB,EAAKwB,IAAI,SAC1CC,EAAQC,IACZ,IAAK,MAAMC,KAASvC,MAAMC,KAAKqC,EAAKE,YAClC,GAAuB,IAAnBD,EAAME,SAAgB,CACxB,MAAMC,EAAOhC,SAASiC,yBACtB,IAAK,MAAMC,KAAQlD,EAAQ6C,EAAMhB,aAAe,GAAI,SAAU,CAC5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,EAAEoB,QAAQ,CAACrB,EAAGsB,KACRA,GAAGF,EAAKtB,YAAYpC,SAASqC,eAAe,MAChDqB,EAAKtB,YAAYE,KAEnBQ,EAAML,KAAKiB,GACX5D,EAAGsC,YAAYsB,EACjB,CACF,MAAOP,EAAOQ,QAAQ,CAACpB,EAAGqB,IAAMrB,EAAEoB,QAASrB,GAAMA,EAAEhB,aAAa,YAAauC,OAAOD,KACtF,CACA,IAAmB,IAAf7D,EAAE+D,SAAoB,IAAK,MAAMC,IAAQ,CAAC/C,EAAOC,EAAO6B,GAAQiB,EAAKJ,QAAQ,CAACjE,EAAGkE,IAAMlE,EAAE6B,MAAMyC,YAAY,MAAOH,OAAOD,KAC7H,MAAMK,EAAsB,CAC1BjD,QACAC,MAAOf,EAAKwB,IAAI,SAAWT,EAAQ,GACnC6B,QACA,MAAAoB,GACEpE,EAAGY,UAAYD,EACfX,EAAGqE,gBAAgB,cACF,OAAbxD,GAAmBb,EAAGqE,gBAAgB,aAC5C,EACAC,QAAO,KACLH,EAAOC,SACArE,EAAUC,EAAIC,KAGzB,OAAOkE,CACT,CAQO,MAAMhF,EAA+B,CAAEoF,GAAI,OAAQC,QAASC,EAAAA,gBAAiBC,SAAU,CAAC,QAASC,IAAK,CAAEzF,UAASa,cCnJxH6E,EAAAA,SAASzF"}
@@ -0,0 +1,143 @@
1
+ import { R as RUNTIME_VERSION } from '../chunks/registry-CT-TT_bx.js';
2
+
3
+ /**
4
+ * `motionary/runtime/text` (10.3) — split text into characters, words and
5
+ * lines for animation, keeping it accessible (original implementation).
6
+ *
7
+ * - `segment(text, 'chars' | 'words')` — pure, works anywhere (SSR, workers):
8
+ * grapheme clusters via `Intl.Segmenter` when available (emoji, combining
9
+ * marks, CJK stay whole), whitespace-aware words.
10
+ * - `splitText(el, { type: 'chars,words,lines' })` — wraps the element's text
11
+ * in spans (nested elements such as `<a>`, `<em>` keep their markup), groups
12
+ * words into lines by their rendered position, sets `aria-label` on the
13
+ * element with the original text and hides the pieces from assistive tech.
14
+ * `revert()` restores the original markup; `resplit()` re-measures lines
15
+ * (e.g. after a resize).
16
+ */
17
+ /** Split a string into graphemes ('chars') or words + whitespace runs ('words'). */
18
+ function segment(text, by = 'chars') {
19
+ const Seg = Intl.Segmenter;
20
+ if (by === 'chars') {
21
+ if (Seg)
22
+ return Array.from(new Seg(undefined, { granularity: 'grapheme' }).segment(text), (s) => s.segment);
23
+ return Array.from(text);
24
+ }
25
+ return text.split(/(\s+)/).filter((s) => s !== '');
26
+ }
27
+ const types = (t) => new Set((t || 'chars,words').split(/[\s,]+/).filter(Boolean));
28
+ /** Split an element's text (see module docs). Needs a DOM. */
29
+ function splitText(el, o = {}) {
30
+ if (typeof document === 'undefined')
31
+ throw new Error('[motionary] splitText needs a DOM — use segment() on the server');
32
+ const want = types(o.type);
33
+ const pre = o.className || 'usa-split';
34
+ const original = el.innerHTML;
35
+ const hadLabel = el.getAttribute('aria-label');
36
+ const text = (el.textContent || '').replace(/\s+/g, ' ').trim();
37
+ const chars = [], words = [];
38
+ const mk = (cls, txt) => {
39
+ const s = document.createElement('span');
40
+ s.className = cls;
41
+ s.setAttribute('aria-hidden', 'true');
42
+ s.style.display = 'inline-block';
43
+ if (txt !== undefined)
44
+ s.textContent = txt;
45
+ return s;
46
+ };
47
+ const wantWords = want.has('words') || want.has('lines');
48
+ const walk = (node) => {
49
+ for (const child of Array.from(node.childNodes)) {
50
+ if (child.nodeType === 3) {
51
+ const frag = document.createDocumentFragment();
52
+ for (const part of segment(child.textContent || '', 'words')) {
53
+ if (/^\s+$/.test(part)) {
54
+ frag.appendChild(document.createTextNode(' '));
55
+ continue;
56
+ }
57
+ const w = wantWords ? mk(`${pre}-word`) : null;
58
+ if (want.has('chars')) {
59
+ for (const g of segment(part, 'chars')) {
60
+ const c = mk(`${pre}-char`, g);
61
+ chars.push(c);
62
+ (w || frag).appendChild(c);
63
+ }
64
+ }
65
+ else if (w)
66
+ w.textContent = part;
67
+ else
68
+ frag.appendChild(document.createTextNode(part));
69
+ if (w) {
70
+ words.push(w);
71
+ frag.appendChild(w);
72
+ }
73
+ }
74
+ child.replaceWith(frag);
75
+ }
76
+ else if (child.nodeType === 1 && !child.classList.contains(`${pre}-word`))
77
+ walk(child);
78
+ }
79
+ };
80
+ walk(el);
81
+ if (text && hadLabel === null)
82
+ el.setAttribute('aria-label', text);
83
+ el.setAttribute('data-split', Array.from(want).join(' '));
84
+ const lines = [];
85
+ if (want.has('lines') && words.length) {
86
+ // group words by their rendered top; wrap each group in a line span (flat text only)
87
+ let top = NaN, cur = [];
88
+ const groups = [];
89
+ for (const w of words) {
90
+ const t = Math.round(w.offsetTop);
91
+ if (cur.length && Math.abs(t - top) > 2) {
92
+ groups.push(cur);
93
+ cur = [];
94
+ }
95
+ if (!cur.length)
96
+ top = t;
97
+ cur.push(w);
98
+ }
99
+ if (cur.length)
100
+ groups.push(cur);
101
+ const flat = words.every((w) => w.parentElement === el);
102
+ if (flat) {
103
+ el.textContent = '';
104
+ for (const g of groups) {
105
+ const line = mk(`${pre}-line`);
106
+ line.style.display = 'block';
107
+ g.forEach((w, i) => {
108
+ if (i)
109
+ line.appendChild(document.createTextNode(' '));
110
+ line.appendChild(w);
111
+ });
112
+ lines.push(line);
113
+ el.appendChild(line);
114
+ }
115
+ }
116
+ else
117
+ groups.forEach((g, i) => g.forEach((w) => w.setAttribute('data-line', String(i))));
118
+ }
119
+ if (o.indexVar !== false)
120
+ for (const list of [chars, words, lines])
121
+ list.forEach((s, i) => s.style.setProperty('--i', String(i)));
122
+ const result = {
123
+ chars,
124
+ words: want.has('words') ? words : [],
125
+ lines,
126
+ revert() {
127
+ el.innerHTML = original;
128
+ el.removeAttribute('data-split');
129
+ if (hadLabel === null)
130
+ el.removeAttribute('aria-label');
131
+ },
132
+ resplit() {
133
+ result.revert();
134
+ return splitText(el, o);
135
+ },
136
+ };
137
+ return result;
138
+ }
139
+ /** The module object for `use(text)`. */
140
+ const text = { id: 'text', version: RUNTIME_VERSION, requires: ['core'], api: { segment, splitText } };
141
+
142
+ export { segment, splitText, text };
143
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sources":["../../src/runtime/text.ts"],"sourcesContent":["/**\n * `motionary/runtime/text` (10.3) — split text into characters, words and\n * lines for animation, keeping it accessible (original implementation).\n *\n * - `segment(text, 'chars' | 'words')` — pure, works anywhere (SSR, workers):\n * grapheme clusters via `Intl.Segmenter` when available (emoji, combining\n * marks, CJK stay whole), whitespace-aware words.\n * - `splitText(el, { type: 'chars,words,lines' })` — wraps the element's text\n * in spans (nested elements such as `<a>`, `<em>` keep their markup), groups\n * words into lines by their rendered position, sets `aria-label` on the\n * element with the original text and hides the pieces from assistive tech.\n * `revert()` restores the original markup; `resplit()` re-measures lines\n * (e.g. after a resize).\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\n\nexport type SplitType = 'chars' | 'words' | 'lines';\n\n/** Split a string into graphemes ('chars') or words + whitespace runs ('words'). */\nexport function segment(text: string, by: 'chars' | 'words' = 'chars'): string[] {\n const Seg = (Intl as any).Segmenter;\n if (by === 'chars') {\n if (Seg) return Array.from(new Seg(undefined, { granularity: 'grapheme' }).segment(text), (s: any) => s.segment as string);\n return Array.from(text);\n }\n return text.split(/(\\s+)/).filter((s) => s !== '');\n}\n\nexport interface SplitOptions {\n /** Any of chars, words, lines (comma / space separated). Default 'chars,words'. */\n type?: string;\n /** Class prefix (default 'usa-split'): pieces get `<prefix>-char`, `-word`, `-line`. */\n className?: string;\n /** Set a `--i` custom property (index) on each piece for CSS staggering (default true). */\n indexVar?: boolean;\n}\n\nexport interface SplitResult {\n chars: HTMLElement[];\n words: HTMLElement[];\n lines: HTMLElement[];\n /** Restore the original markup. */\n revert(): void;\n /** Revert and split again (re-measures lines). */\n resplit(): SplitResult;\n}\n\nconst types = (t?: string): Set<SplitType> => new Set((t || 'chars,words').split(/[\\s,]+/).filter(Boolean) as SplitType[]);\n\n/** Split an element's text (see module docs). Needs a DOM. */\nexport function splitText(el: HTMLElement, o: SplitOptions = {}): SplitResult {\n if (typeof document === 'undefined') throw new Error('[motionary] splitText needs a DOM — use segment() on the server');\n const want = types(o.type);\n const pre = o.className || 'usa-split';\n const original = el.innerHTML;\n const hadLabel = el.getAttribute('aria-label');\n const text = (el.textContent || '').replace(/\\s+/g, ' ').trim();\n const chars: HTMLElement[] = [], words: HTMLElement[] = [];\n const mk = (cls: string, txt?: string) => {\n const s = document.createElement('span');\n s.className = cls;\n s.setAttribute('aria-hidden', 'true');\n s.style.display = 'inline-block';\n if (txt !== undefined) s.textContent = txt;\n return s;\n };\n const wantWords = want.has('words') || want.has('lines');\n const walk = (node: Node) => {\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === 3) {\n const frag = document.createDocumentFragment();\n for (const part of segment(child.textContent || '', 'words')) {\n if (/^\\s+$/.test(part)) {\n frag.appendChild(document.createTextNode(' '));\n continue;\n }\n const w = wantWords ? mk(`${pre}-word`) : null;\n if (want.has('chars')) {\n for (const g of segment(part, 'chars')) {\n const c = mk(`${pre}-char`, g);\n chars.push(c);\n (w || frag).appendChild(c);\n }\n } else if (w) w.textContent = part;\n else frag.appendChild(document.createTextNode(part));\n if (w) {\n words.push(w);\n frag.appendChild(w);\n }\n }\n child.replaceWith(frag);\n } else if (child.nodeType === 1 && !(child as Element).classList.contains(`${pre}-word`)) walk(child);\n }\n };\n walk(el);\n if (text && hadLabel === null) el.setAttribute('aria-label', text);\n el.setAttribute('data-split', Array.from(want).join(' '));\n const lines: HTMLElement[] = [];\n if (want.has('lines') && words.length) {\n // group words by their rendered top; wrap each group in a line span (flat text only)\n let top = NaN, cur: HTMLElement[] = [];\n const groups: HTMLElement[][] = [];\n for (const w of words) {\n const t = Math.round(w.offsetTop);\n if (cur.length && Math.abs(t - top) > 2) {\n groups.push(cur);\n cur = [];\n }\n if (!cur.length) top = t;\n cur.push(w);\n }\n if (cur.length) groups.push(cur);\n const flat = words.every((w) => w.parentElement === el);\n if (flat) {\n el.textContent = '';\n for (const g of groups) {\n const line = mk(`${pre}-line`);\n line.style.display = 'block';\n g.forEach((w, i) => {\n if (i) line.appendChild(document.createTextNode(' '));\n line.appendChild(w);\n });\n lines.push(line);\n el.appendChild(line);\n }\n } else groups.forEach((g, i) => g.forEach((w) => w.setAttribute('data-line', String(i))));\n }\n if (o.indexVar !== false) for (const list of [chars, words, lines]) list.forEach((s, i) => s.style.setProperty('--i', String(i)));\n const result: SplitResult = {\n chars,\n words: want.has('words') ? words : [],\n lines,\n revert() {\n el.innerHTML = original;\n el.removeAttribute('data-split');\n if (hadLabel === null) el.removeAttribute('aria-label');\n },\n resplit() {\n result.revert();\n return splitText(el, o);\n },\n };\n return result;\n}\n\nexport interface TextApi {\n segment: typeof segment;\n splitText: typeof splitText;\n}\n\n/** The module object for `use(text)`. */\nexport const text: RuntimeModule<TextApi> = { id: 'text', version: RUNTIME_VERSION, requires: ['core'], api: { segment, splitText } };\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;AAaG;AAKH;SACgB,OAAO,CAAC,IAAY,EAAE,KAAwB,OAAO,EAAA;AACnE,IAAA,MAAM,GAAG,GAAI,IAAY,CAAC,SAAS;AACnC,IAAA,IAAI,EAAE,KAAK,OAAO,EAAE;AAClB,QAAA,IAAI,GAAG;AAAE,YAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAM,KAAK,CAAC,CAAC,OAAiB,CAAC;AAC1H,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IACzB;AACA,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;AACpD;AAqBA,MAAM,KAAK,GAAG,CAAC,CAAU,KAAqB,IAAI,GAAG,CAAC,CAA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E,CAAC,SAAS,GAAG,QAAQ;AACvB,YAAA,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC;YAChC,IAAI,QAAQ,KAAK,IAAI;AAAE,gBAAA,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC;QACzD,CAAC;QACD,OAAO,GAAA;YACL,MAAM,CAAC,MAAM,EAAE;AACf,YAAA,OAAO,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;QACzB,CAAC;KACF;AACD,IAAA,OAAO,MAAM;AACf;AAOA;AACO,MAAM,IAAI,GAA2B,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;;"}
package/dist/runtime.cjs CHANGED
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var registry = require('./chunks/registry-eJgpFAzI.cjs');
4
- var ticker = require('./chunks/ticker-D4o6enH0.cjs');
5
- var tween$1 = require('./chunks/tween-CBuWYpI-.cjs');
3
+ var registry = require('./chunks/registry-tzwKkldE.cjs');
4
+ var ticker = require('./chunks/ticker-Un0bvTWR.cjs');
5
+ var tween$1 = require('./chunks/tween-CwLLC3Ko.cjs');
6
+ var ease = require('./chunks/ease-HwYZnZat.cjs');
6
7
 
7
8
  /**
8
9
  * `motionary/runtime` (10.1) — Motionary's own zero-dependency animation
@@ -28,7 +29,7 @@ var tween$1 = require('./chunks/tween-CBuWYpI-.cjs');
28
29
  const core = {
29
30
  id: 'core',
30
31
  version: registry.RUNTIME_VERSION,
31
- api: { version: registry.RUNTIME_VERSION, getTicker: ticker.getTicker, tween, timeline: tween$1.timeline, Tween: tween$1.Tween, Timeline: tween$1.Timeline, EASES: tween$1.EASES, parseEase: tween$1.parseEase, cubicBezier: tween$1.cubicBezier, steps: tween$1.steps },
32
+ api: { version: registry.RUNTIME_VERSION, getTicker: ticker.getTicker, tween, timeline: tween$1.timeline, Tween: tween$1.Tween, Timeline: tween$1.Timeline, EASES: ease.EASES, parseEase: ease.parseEase, cubicBezier: ease.cubicBezier, steps: ease.steps },
32
33
  };
33
34
  /** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */
34
35
  function tween(target, o) {
@@ -63,15 +64,15 @@ exports.registeredModules = registry.registeredModules;
63
64
  exports.registry = registry.registry;
64
65
  exports.requireModule = registry.requireModule;
65
66
  exports.getTicker = ticker.getTicker;
66
- exports.EASES = tween$1.EASES;
67
67
  exports.Playable = tween$1.Playable;
68
68
  exports.Timeline = tween$1.Timeline;
69
69
  exports.Tween = tween$1.Tween;
70
- exports.cubicBezier = tween$1.cubicBezier;
71
- exports.parseEase = tween$1.parseEase;
72
70
  exports.parseValue = tween$1.parseValue;
73
- exports.steps = tween$1.steps;
74
71
  exports.timeline = tween$1.timeline;
72
+ exports.EASES = ease.EASES;
73
+ exports.cubicBezier = ease.cubicBezier;
74
+ exports.parseEase = ease.parseEase;
75
+ exports.steps = ease.steps;
75
76
  exports.core = core;
76
77
  exports.resolveTargets = resolveTargets;
77
78
  exports.tween = tween;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.cjs","sources":["../src/runtime/index.ts"],"sourcesContent":["/**\n * `motionary/runtime` (10.1) — Motionary's own zero-dependency animation\n * runtime, the one prerequisite for runtime-powered components:\n *\n * - shared **ticker** (`getTicker()`): one rAF loop for everything;\n * - **tween + timeline** engine with easing (`tween()`, `timeline()`, `EASES`, `cubicBezier()`);\n * - **module registry** (`use()`, `requireModule()`, `hasModule()`) with a\n * clear `RuntimeModuleError` (install / import / CDN instructions) when a\n * component needs a module that was not registered.\n *\n * Every other module lives at its own subpath (`motionary/runtime/format-css`,\n * `motionary/runtime/format-motion`, …) so you only pay for what you import.\n * SSR-safe (no `window` access at import) and usable in Web Workers.\n *\n * ```ts\n * import { use, tween } from 'motionary/runtime';\n * use(); // registers the core (components can now find it)\n * tween('.box', { to: { x: 120, opacity: 1 }, duration: 500, ease: 'back-out' });\n * ```\n */\nimport { register, RUNTIME_VERSION, type RuntimeModule, type RuntimeRegistry } from './registry';\nimport { getTicker } from './ticker';\nimport { tween as rawTween, timeline, Tween, Timeline, type TweenOptions, type Playable } from './tween';\nimport { EASES, parseEase, cubicBezier, steps } from './ease';\n\nexport { registry, register, requireModule, hasModule, registeredModules, missingMessage, modulePath, moduleCdn, RuntimeModuleError, RUNTIME_VERSION, RUNTIME_CDN } from './registry';\nexport type { RuntimeModule, RuntimeRegistry } from './registry';\nexport { getTicker } from './ticker';\nexport type { Ticker, TickFn } from './ticker';\nexport { timeline, Tween, Timeline, Playable, parseValue } from './tween';\nexport type { TweenOptions, TimelineOptions, PlayOptions, Props, Target, Position } from './tween';\nexport { EASES, parseEase, cubicBezier, steps } from './ease';\nexport type { Ease } from './ease';\n\n/** The core module's API (what `requireModule('core')` returns). */\nexport interface CoreApi {\n version: string;\n getTicker: typeof getTicker;\n tween: (target: any, o: import('./tween').TweenOptions) => import('./tween').Playable;\n timeline: typeof timeline;\n Tween: typeof Tween;\n Timeline: typeof Timeline;\n EASES: typeof EASES;\n parseEase: typeof parseEase;\n cubicBezier: typeof cubicBezier;\n steps: typeof steps;\n}\n\n/** The core as a module object. */\nexport const core: RuntimeModule<CoreApi> = {\n id: 'core',\n version: RUNTIME_VERSION,\n api: { version: RUNTIME_VERSION, getTicker, tween, timeline, Tween, Timeline, EASES, parseEase, cubicBezier, steps },\n};\n\n/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */\nexport function tween(target: any, o: TweenOptions): Playable {\n return rawTween(resolveTargets(target), o);\n}\n\n/** Selector strings become element lists (only where `document` exists). */\nexport function resolveTargets(t: any): any {\n if (typeof t === 'string') {\n if (typeof document === 'undefined') throw new Error('[motionary] selector targets need a document — pass objects or elements instead');\n return Array.from(document.querySelectorAll(t));\n }\n return t;\n}\n\n/**\n * Register the core plus any modules (`use(formatCss, formatMotion)`).\n * Call once at start-up, before runtime-powered components mount.\n */\nexport function use(...mods: RuntimeModule[]): RuntimeRegistry {\n return register(core as RuntimeModule, ...mods);\n}\n"],"names":["RUNTIME_VERSION","getTicker","timeline","Tween","Timeline","EASES","parseEase","cubicBezier","steps","rawTween","register"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AA6BH;AACO,MAAM,IAAI,GAA2B;AAC1C,IAAA,EAAE,EAAE,MAAM;AACV,IAAA,OAAO,EAAEA,wBAAe;IACxB,GAAG,EAAE,EAAE,OAAO,EAAEA,wBAAe,aAAEC,gBAAS,EAAE,KAAK,YAAEC,gBAAQ,SAAEC,aAAK,YAAEC,gBAAQ,SAAEC,aAAK,aAAEC,iBAAS,eAAEC,mBAAW,SAAEC,aAAK,EAAE;;AAGtH;AACM,SAAU,KAAK,CAAC,MAAW,EAAE,CAAe,EAAA;IAChD,OAAOC,aAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC5C;AAEA;AACM,SAAU,cAAc,CAAC,CAAM,EAAA;AACnC,IAAA,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;QACzB,IAAI,OAAO,QAAQ,KAAK,WAAW;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC;QACvI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACjD;AACA,IAAA,OAAO,CAAC;AACV;AAEA;;;AAGG;AACG,SAAU,GAAG,CAAC,GAAG,IAAqB,EAAA;AAC1C,IAAA,OAAOC,iBAAQ,CAAC,IAAqB,EAAE,GAAG,IAAI,CAAC;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"runtime.cjs","sources":["../src/runtime/index.ts"],"sourcesContent":["/**\n * `motionary/runtime` (10.1) — Motionary's own zero-dependency animation\n * runtime, the one prerequisite for runtime-powered components:\n *\n * - shared **ticker** (`getTicker()`): one rAF loop for everything;\n * - **tween + timeline** engine with easing (`tween()`, `timeline()`, `EASES`, `cubicBezier()`);\n * - **module registry** (`use()`, `requireModule()`, `hasModule()`) with a\n * clear `RuntimeModuleError` (install / import / CDN instructions) when a\n * component needs a module that was not registered.\n *\n * Every other module lives at its own subpath (`motionary/runtime/format-css`,\n * `motionary/runtime/format-motion`, …) so you only pay for what you import.\n * SSR-safe (no `window` access at import) and usable in Web Workers.\n *\n * ```ts\n * import { use, tween } from 'motionary/runtime';\n * use(); // registers the core (components can now find it)\n * tween('.box', { to: { x: 120, opacity: 1 }, duration: 500, ease: 'back-out' });\n * ```\n */\nimport { register, RUNTIME_VERSION, type RuntimeModule, type RuntimeRegistry } from './registry';\nimport { getTicker } from './ticker';\nimport { tween as rawTween, timeline, Tween, Timeline, type TweenOptions, type Playable } from './tween';\nimport { EASES, parseEase, cubicBezier, steps } from './ease';\n\nexport { registry, register, requireModule, hasModule, registeredModules, missingMessage, modulePath, moduleCdn, RuntimeModuleError, RUNTIME_VERSION, RUNTIME_CDN } from './registry';\nexport type { RuntimeModule, RuntimeRegistry } from './registry';\nexport { getTicker } from './ticker';\nexport type { Ticker, TickFn } from './ticker';\nexport { timeline, Tween, Timeline, Playable, parseValue } from './tween';\nexport type { TweenOptions, TimelineOptions, PlayOptions, Props, Target, Position } from './tween';\nexport { EASES, parseEase, cubicBezier, steps } from './ease';\nexport type { Ease } from './ease';\n\n/** The core module's API (what `requireModule('core')` returns). */\nexport interface CoreApi {\n version: string;\n getTicker: typeof getTicker;\n tween: (target: any, o: import('./tween').TweenOptions) => import('./tween').Playable;\n timeline: typeof timeline;\n Tween: typeof Tween;\n Timeline: typeof Timeline;\n EASES: typeof EASES;\n parseEase: typeof parseEase;\n cubicBezier: typeof cubicBezier;\n steps: typeof steps;\n}\n\n/** The core as a module object. */\nexport const core: RuntimeModule<CoreApi> = {\n id: 'core',\n version: RUNTIME_VERSION,\n api: { version: RUNTIME_VERSION, getTicker, tween, timeline, Tween, Timeline, EASES, parseEase, cubicBezier, steps },\n};\n\n/** Tween targets (objects, elements, lists or a CSS selector). See `TweenOptions`. */\nexport function tween(target: any, o: TweenOptions): Playable {\n return rawTween(resolveTargets(target), o);\n}\n\n/** Selector strings become element lists (only where `document` exists). */\nexport function resolveTargets(t: any): any {\n if (typeof t === 'string') {\n if (typeof document === 'undefined') throw new Error('[motionary] selector targets need a document — pass objects or elements instead');\n return Array.from(document.querySelectorAll(t));\n }\n return t;\n}\n\n/**\n * Register the core plus any modules (`use(formatCss, formatMotion)`).\n * Call once at start-up, before runtime-powered components mount.\n */\nexport function use(...mods: RuntimeModule[]): RuntimeRegistry {\n return register(core as RuntimeModule, ...mods);\n}\n"],"names":["RUNTIME_VERSION","getTicker","timeline","Tween","Timeline","EASES","parseEase","cubicBezier","steps","rawTween","register"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AA6BH;AACO,MAAM,IAAI,GAA2B;AAC1C,IAAA,EAAE,EAAE,MAAM;AACV,IAAA,OAAO,EAAEA,wBAAe;IACxB,GAAG,EAAE,EAAE,OAAO,EAAEA,wBAAe,aAAEC,gBAAS,EAAE,KAAK,YAAEC,gBAAQ,SAAEC,aAAK,YAAEC,gBAAQ,SAAEC,UAAK,aAAEC,cAAS,eAAEC,gBAAW,SAAEC,UAAK,EAAE;;AAGtH;AACM,SAAU,KAAK,CAAC,MAAW,EAAE,CAAe,EAAA;IAChD,OAAOC,aAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC5C;AAEA;AACM,SAAU,cAAc,CAAC,CAAM,EAAA;AACnC,IAAA,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;QACzB,IAAI,OAAO,QAAQ,KAAK,WAAW;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC;QACvI,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACjD;AACA,IAAA,OAAO,CAAC;AACV;AAEA;;;AAGG;AACG,SAAU,GAAG,CAAC,GAAG,IAAqB,EAAA;AAC1C,IAAA,OAAOC,iBAAQ,CAAC,IAAqB,EAAE,GAAG,IAAI,CAAC;AACjD;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -40,7 +40,14 @@ interface Col {
40
40
  kind: 'col';
41
41
  c: number[];
42
42
  }
43
- type Val = Num | Col;
43
+ /** Any other string: its numbers are interpolated when both ends share the same text around them. */
44
+ interface Str {
45
+ kind: 'str';
46
+ s: string;
47
+ parts: string[];
48
+ nums: number[];
49
+ }
50
+ type Val = Num | Col | Str;
44
51
  /** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */
45
52
  declare function parseValue(v: number | string): Val;
46
53
  /** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */
@@ -143,7 +150,7 @@ declare function timeline(o?: TimelineOptions): Timeline;
143
150
  * inside Web Workers.
144
151
  */
145
152
  /** Runtime version (kept in sync with the package version by the release script). */
146
- declare const RUNTIME_VERSION = "10.2.0";
153
+ declare const RUNTIME_VERSION = "10.4.0";
147
154
  /** Where the CDN builds live (major-pinned). */
148
155
  declare const RUNTIME_CDN = "https://cdn.jsdelivr.net/npm/motionary@10/dist/";
149
156
  /** A runtime module: `{ id, version, api }`, registered with `use()`. */
package/dist/runtime.d.ts CHANGED
@@ -40,7 +40,14 @@ interface Col {
40
40
  kind: 'col';
41
41
  c: number[];
42
42
  }
43
- type Val = Num | Col;
43
+ /** Any other string: its numbers are interpolated when both ends share the same text around them. */
44
+ interface Str {
45
+ kind: 'str';
46
+ s: string;
47
+ parts: string[];
48
+ nums: number[];
49
+ }
50
+ type Val = Num | Col | Str;
44
51
  /** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */
45
52
  declare function parseValue(v: number | string): Val;
46
53
  /** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */
@@ -143,7 +150,7 @@ declare function timeline(o?: TimelineOptions): Timeline;
143
150
  * inside Web Workers.
144
151
  */
145
152
  /** Runtime version (kept in sync with the package version by the release script). */
146
- declare const RUNTIME_VERSION = "10.2.0";
153
+ declare const RUNTIME_VERSION = "10.4.0";
147
154
  /** Where the CDN builds live (major-pinned). */
148
155
  declare const RUNTIME_CDN = "https://cdn.jsdelivr.net/npm/motionary@10/dist/";
149
156
  /** A runtime module: `{ id, version, api }`, registered with `use()`. */
@@ -1,2 +1,2 @@
1
- !function(t){"use strict";const e="10.2.0",r="https://cdn.jsdelivr.net/npm/motionary@10/dist/",s=Symbol.for("motionary.runtime");function i(){const t=globalThis;return t[s]||(t[s]={version:e,modules:new Map,slots:{}})}const o=t=>"core"===t?"motionary/runtime":`motionary/runtime/${t}`,n=t=>r+("core"===t?"runtime.iife.js":`runtime/${t}.iife.js`);function a(t,e="This feature"){const r=o(t);return`[motionary] ${e} requires ${r}. Install once: npm i motionary — then register it before the component mounts: ${"core"===t?"import { use } from 'motionary/runtime'; use();":`import { use } from 'motionary/runtime'; import { ${u(t)} } from '${r}'; use(${u(t)});`} Or from a CDN (core first): ${"core"===t?`<script src="${n("core")}"><\/script>`:`<script src="${n("core")}"><\/script><script src="${n(t)}"><\/script>`} Docs: https://github.com/HarrisonCN/Motionary/blob/main/docs/runtime/${t}.md`}const u=t=>t.replace(/-(\w)/g,(t,e)=>e.toUpperCase());class h extends Error{constructor(t,e){super(a(t,e)),this.name="RuntimeModuleError",this.module=t}}function l(...t){const e=i();for(const r of t){if(!r||"string"!=typeof r.id)throw new TypeError("[motionary] use(): not a runtime module — pass the object exported by motionary/runtime/<module>");if(!e.modules.has(r.id)){for(const t of r.requires||[])if(!e.modules.has(t))throw new h(t,`motionary/runtime/${r.id}`);e.modules.set(r.id,r),r.setup?.(e)}}return e}function c(){const t=new Set;let e=0,r=-1,s=60,i=100,o=null;const n=globalThis,a=()=>n.performance?.now?n.performance.now():Date.now(),u=t=>"function"==typeof n.requestAnimationFrame?n.requestAnimationFrame(t):setTimeout(()=>t(a()),16),h=(r,s=!0)=>{const o=(s?Math.min(r,i):r)*c.timeScale;e+=o;for(const r of Array.from(t))r(e,o)},l=e=>{if(o=null,!t.size)return;const i="number"==typeof e&&e>0?e:a(),n=r<0?0:i-r;r=i,n>0&&(s=.9*s+1e3/n*.1),h(n),t.size&&(o=u(l))},c={add:e=>(t.add(e),null===o&&t.size&&(r=-1,o=u(l)),()=>c.remove(e)),remove(e){var r;t.delete(e),t.size||null===o||(r=o,"function"==typeof n.cancelAnimationFrame?n.cancelAnimationFrame(r):clearTimeout(r),o=null)},get time(){return e},get fps(){return Math.round(s)},get size(){return t.size},lagSmoothing(t){i=t>0?t:1/0},timeScale:1,step(t){h(t,!1)}};return c}function d(){const t=i().slots;return t.ticker||(t.ticker=c())}const f=t=>e=>1-t(1-e),m=t=>e=>e<.5?t(2*e)/2:1-t(2*(1-e))/2,p=t=>e=>Math.pow(e,t);function y(t,e,r,s){const i=(t,e)=>1-3*e+3*t,o=(t,e)=>3*e-6*t,n=t=>3*t,a=(t,e,r)=>((i(e,r)*t+o(e,r))*t+n(e))*t,u=(t,e,r)=>3*i(e,r)*t*t+2*o(e,r)*t+n(e);return i=>{if(i<=0||i>=1)return i<=0?0:1;let o=i;for(let e=0;e<6;e++){const e=u(o,t,r);if(Math.abs(e)<1e-6)break;o-=(a(o,t,r)-i)/e}if(o<0||o>1||Math.abs(a(o,t,r)-i)>1e-4){let e=0,s=1;o=i;for(let n=0;n<30;n++){const n=a(o,t,r);if(Math.abs(n-i)<1e-6)break;n<i?e=o:s=o,o=(e+s)/2}}return a(o,e,s)}}const g=(t,e="end")=>r=>{const s="start"===e?Math.ceil(r*t):Math.floor(r*t);return Math.min(1,Math.max(0,s/t))},w={quad:p(2),cubic:p(3),quart:p(4),quint:p(5),sine:t=>1-Math.cos(t*Math.PI/2),expo:t=>0===t?0:Math.pow(2,10*t-10),circ:t=>1-Math.sqrt(1-t*t),back:((t=1.70158)=>e=>e*e*((t+1)*e-t))(),elastic:t=>0===t||1===t?t:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*(2*Math.PI/3)),bounce:f(t=>{const e=7.5625,r=2.75;return t<1/r?e*t*t:t<2/r?e*(t-=1.5/r)*t+.75:t<2.5/r?e*(t-=2.25/r)*t+.9375:e*(t-=2.625/r)*t+.984375})},k={linear:t=>t,ease:y(.25,.1,.25,1),"ease-in":y(.42,0,1,1),"ease-out":y(0,0,.58,1),"ease-in-out":y(.42,0,.58,1),smooth:y(.22,1,.36,1)};for(const[t,e]of Object.entries(w))k[`${t}-in`]=e,k[`${t}-out`]=f(e),k[`${t}-in-out`]=m(e);function b(t){if("function"==typeof t)return t;if(!t)return k["cubic-out"];const e=t.trim();if(k[e])return k[e];let r=/^cubic-bezier\(\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*\)$/.exec(e);if(r)return y(+r[1],+r[2],+r[3],+r[4]);if(r=/^steps\(\s*(\d+)\s*(?:,\s*(jump-)?(start|end)\s*)?\)$/.exec(e),r)return g(+r[1],r[3]||"end");if("step-start"===e)return g(1,"start");if("step-end"===e)return g(1,"end");throw new Error(`[motionary] unknown ease "${e}" — use a name from EASES, cubic-bezier(…) or steps(…)`)}const $=["x","y","rotate","scale","scaleX","scaleY","skewX","skewY"],v={x:"px",y:"px",rotate:"deg",skewX:"deg",skewY:"deg",scale:"",scaleX:"",scaleY:""},_=new WeakMap,M=t=>"undefined"!=typeof Element&&t instanceof Element;function x(t){if("number"==typeof t)return{kind:"num",v:t,u:""};const e=t.trim();let r=/^#([0-9a-f]{3,8})$/i.exec(e);if(r){let t=r[1];t.length<=4&&(t=t.split("").map(t=>t+t).join(""));const e=e=>parseInt(t.slice(e,e+2),16);return{kind:"col",c:[e(0),e(2),e(4),8===t.length?e(6)/255:1]}}if(r=/^rgba?\(([^)]+)\)$/i.exec(e),r){const t=r[1].split(/[\s,/]+/).filter(Boolean).map(t=>t.endsWith("%")?parseFloat(t)/100*255:parseFloat(t));return{kind:"col",c:[t[0],t[1],t[2],void 0===t[3]?1:t[3]>1?t[3]/255:t[3]]}}if("transparent"===e)return{kind:"col",c:[0,0,0,0]};if(r=/^(-?[\d.]+(?:e-?\d+)?)([a-z%]*)$/i.exec(e),r)return{kind:"num",v:parseFloat(r[1]),u:r[2]};throw new Error(`[motionary] cannot tween value "${e}"`)}const E=(t,e,r)=>{if("col"===t.kind||"col"===e.kind){const s="col"===t.kind?t.c:[0,0,0,0],i="col"===e.kind?e.c:[0,0,0,0],o=s.map((t,e)=>t+(i[e]-t)*r);return`rgba(${Math.round(o[0])}, ${Math.round(o[1])}, ${Math.round(o[2])}, ${+o[3].toFixed(3)})`}const s=t.v+(e.v-t.v)*r,i=e.u||t.u;return i?`${+s.toFixed(4)}${i}`:+s.toFixed(6)},S=t=>t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase());function A(t,e){if(!M(t))return t[e]??0;if($.includes(e)){const r=_.get(t)?.[e];return r?r.v+r.u:e.startsWith("scale")?1:0}const r=t.style.getPropertyValue(S(e));if(r)return r;return("function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(S(e)):"")||("opacity"===e?1:0)}function D(t,e,r){if(M(t)){if($.includes(e)){const s=x(r),i=_.get(t)||{};return i[e]={v:s.v,u:s.u},void _.set(t,i)}t.style.setProperty(S(e),"number"!=typeof r||["opacity","zIndex","z-index"].includes(e)||e.startsWith("--")?String(r):r+"px")}else t[e]="string"==typeof r&&"number"==typeof t[e]?parseFloat(r):r}class P{constructor(t){this.timeScale=1,this._t=0,this._dir=1,this._off=null,this._done=!1,this.parent=null,this.delay=t.delay||0,this.repeat=t.repeat||0,this.yoyo=!!t.yoyo,this.onUpdate=t.onUpdate,this.onComplete=t.onComplete,this.finished=new Promise(t=>this._resolve=t)}get totalDuration(){return this.repeat<0?1/0:this.delay+this.duration*(this.repeat+1)}get time(){return this._t}get progress(){const t=this.totalDuration;return t===1/0?(this._t-this.delay)%this.duration/this.duration:t?this._t/t:1}set progress(t){this.seek(t*(this.totalDuration===1/0?this.delay+this.duration:this.totalDuration))}get isActive(){return!!this._off}get reversed(){return this._dir<0}seek(t){const e=this.totalDuration;this._t=Math.max(0,Math.min(t,e));const r=this._t-this.delay,s=this.duration||0;if(r<0)this.renderLocal(0,!1);else if(s){let t=s===1/0?0:Math.floor(r/s),i=s===1/0?r:r-t*s;r>=e-this.delay&&e!==1/0&&(t=this.repeat,i=s);const o=this.yoyo&&t%2==1;this.renderLocal(o?s-i:i,i===s)}else this.renderLocal(0,!0);return this.onUpdate?.(this.progress),this}play(){return this._dir=1,this._t>=this.totalDuration&&(this._t=0),this.attach()}pause(){return this._off?.(),this._off=null,this}reverse(){return this._dir=-1,this._t<=0&&(this._t=this.totalDuration===1/0?this.delay+this.duration:this.totalDuration),this.attach()}restart(){return this._done=!1,this.seek(0),this.play()}kill(){this.pause(),this.parent?.remove(this)}then(t,e){return this.finished.then(t,e)}attach(){return this.parent||this._off||(this._done=!1,this._off=d().add((t,e)=>this.advance(e))),this}advance(t){const e=this.totalDuration;this.seek(this._t+t*this._dir*this.timeScale),(this._dir>0&&this._t>=e||this._dir<0&&this._t<=0)&&this.complete()}complete(){this.pause(),this._done||(this._done=!0,this.onComplete?.(),this._resolve())}}class T extends P{constructor(t,e){super(e),this.tracks=null,this.target=t,this._dur=e.duration??600,this.ease=b(e.ease),this.toProps=e.to||{},this.fromProps=e.from||{}}get duration(){return this._dur}init(){return Array.from(new Set([...Object.keys(this.fromProps),...Object.keys(this.toProps)])).map(t=>{const e=t in this.fromProps?this.fromProps[t]:A(this.target,t),r=t in this.toProps?this.toProps[t]:A(this.target,t);return{k:t,fromRaw:e,toRaw:r,from:x(e),to:x(r)}})}renderLocal(t,e){this.tracks||(this.tracks=this.init());const r=this._dur?e?this.ease(t>=this._dur?1:0):this.ease(t/this._dur):1;let s=!1;for(const t of this.tracks)D(this.target,t.k,E(t.from,t.to,r)),$.includes(t.k)&&(s=!0);s&&M(this.target)&&function(t){const e=_.get(t),r=(t,r)=>e[t]?e[t].v:r,s=t=>e[t]?.u??v[t],i=[];(e.x||e.y)&&i.push(`translate(${r("x",0)}${s("x")||"px"}, ${r("y",0)}${s("y")||"px"})`),e.rotate&&i.push(`rotate(${r("rotate",0)}${s("rotate")||"deg"})`),e.scale&&i.push(`scale(${r("scale",1)})`),(e.scaleX||e.scaleY)&&i.push(`scale(${r("scaleX",1)}, ${r("scaleY",1)})`),e.skewX&&i.push(`skewX(${r("skewX",0)}${s("skewX")||"deg"})`),e.skewY&&i.push(`skewY(${r("skewY",0)}${s("skewY")||"deg"})`),t.style.transform=i.join(" ")}(this.target)}}class C extends P{constructor(t={}){super(t),this.children=[],this.labels={},this.prevStart=0,this.prevEnd=0,this.lastLocal=0,this.defaults=t.defaults}get duration(){let t=0;for(const e of this.children)t=Math.max(t,e.start+("function"==typeof e.item?0:e.item.totalDuration));return t}resolve(t){if(void 0===t||">"===t)return this.prevEnd;if("number"==typeof t)return Math.max(0,t);const e=/^([<>]|[\w-]+)?\s*(?:([+-])=\s*([\d.]+))?$/.exec(t.trim());if(!e)throw new Error(`[motionary] bad timeline position "${t}"`);let r=this.prevEnd;if("<"===e[1])r=this.prevStart;else if(e[1]&&">"!==e[1]){if(!(e[1]in this.labels))throw new Error(`[motionary] unknown timeline label "${e[1]}"`);r=this.labels[e[1]]}const s=e[2]?("+"===e[2]?1:-1)*parseFloat(e[3]):0;return Math.max(0,r+s)}add(t,e){const r=this.resolve(e);return"function"!=typeof t&&(t.pause(),t.parent=this),this.children.push({item:t,start:r}),this.prevStart=r,this.prevEnd=r+("function"==typeof t?0:t.totalDuration),this}to(t,e,r){const s=z(t),i=this.resolve(r);let o=i;return s.forEach((t,r)=>{const s=new T(t,{...this.defaults,...e,delay:(e.delay||0)+(e.stagger||0)*r,paused:!0});s.parent=this,this.children.push({item:s,start:i}),o=Math.max(o,i+s.totalDuration)}),this.prevStart=i,this.prevEnd=o,this}call(t,e){return this.add(t,e)}label(t,e){return this.labels[t]=this.resolve(e),this}labelTime(t){return this.labels[t]}remove(t){this.children=this.children.filter(e=>e.item!==t)}getChildren(){return this.children.filter(t=>"function"!=typeof t.item).map(t=>t.item)}renderLocal(t){const e=t>=this.lastLocal,r=[...this.children].sort((t,r)=>e?t.start-r.start:r.start-t.start);for(const s of r){if("function"==typeof s.item){e&&!s.fired&&t>=s.start&&this.lastLocal<=s.start?(s.fired=!0,s.item()):!e&&t<s.start&&(s.fired=!1);continue}const r=t-s.start,i=s.item;r<0?i._started&&i.seek(0):(i._started=!0,i.seek(Math.min(r,i.totalDuration)))}this.lastLocal=t}}function z(t){return Array.isArray(t)?t:t&&"number"==typeof t.length&&!M(t)?Array.from(t):[t]}function F(t={}){const e=new C(t);return t.paused||e.play(),e}const j={id:"core",version:e,api:{version:e,getTicker:d,tween:q,timeline:F,Tween:T,Timeline:C,EASES:k,parseEase:b,cubicBezier:y,steps:g}};function q(t,e){return function(t,e){const r=z(t);let s;if(1===r.length)s=new T(r[0],e);else{const t=new C({repeat:e.repeat,yoyo:e.yoyo,onUpdate:e.onUpdate,onComplete:e.onComplete,delay:e.delay});t.to(r,{...e,delay:0,repeat:0,yoyo:!1,onUpdate:void 0,onComplete:void 0},0),s=t}return e.paused||s.play(),s}(L(t),e)}function L(t){if("string"==typeof t){if("undefined"==typeof document)throw new Error("[motionary] selector targets need a document — pass objects or elements instead");return Array.from(document.querySelectorAll(t))}return t}function X(...t){return l(j,...t)}X(),t.EASES=k,t.Playable=P,t.RUNTIME_CDN=r,t.RUNTIME_VERSION=e,t.RuntimeModuleError=h,t.Timeline=C,t.Tween=T,t.core=j,t.cubicBezier=y,t.getTicker=d,t.hasModule=t=>i().modules.has(t),t.missingMessage=a,t.moduleCdn=n,t.modulePath=o,t.parseEase=b,t.parseValue=x,t.register=l,t.registeredModules=()=>Array.from(i().modules.keys()),t.registry=i,t.requireModule=function(t,e){const r=i().modules.get(t);if(!r)throw new h(t,e);return r.api},t.resolveTargets=L,t.steps=g,t.timeline=F,t.tween=q,t.use=X}(this.MotionaryRuntime=this.MotionaryRuntime||{});
1
+ !function(t){"use strict";const e="10.4.0",r="https://cdn.jsdelivr.net/npm/motionary@10/dist/",s=Symbol.for("motionary.runtime");function i(){const t=globalThis;return t[s]||(t[s]={version:e,modules:new Map,slots:{}})}const n=t=>"core"===t?"motionary/runtime":`motionary/runtime/${t}`,o=t=>r+("core"===t?"runtime.iife.js":`runtime/${t}.iife.js`);function a(t,e="This feature"){const r=n(t);return`[motionary] ${e} requires ${r}. Install once: npm i motionary — then register it before the component mounts: ${"core"===t?"import { use } from 'motionary/runtime'; use();":`import { use } from 'motionary/runtime'; import { ${u(t)} } from '${r}'; use(${u(t)});`} Or from a CDN (core first): ${"core"===t?`<script src="${o("core")}"><\/script>`:`<script src="${o("core")}"><\/script><script src="${o(t)}"><\/script>`} Docs: https://github.com/HarrisonCN/Motionary/blob/main/docs/runtime/${t}.md`}const u=t=>t.replace(/-(\w)/g,(t,e)=>e.toUpperCase());class h extends Error{constructor(t,e){super(a(t,e)),this.name="RuntimeModuleError",this.module=t}}function l(...t){const e=i();for(const r of t){if(!r||"string"!=typeof r.id)throw new TypeError("[motionary] use(): not a runtime module — pass the object exported by motionary/runtime/<module>");if(!e.modules.has(r.id)){for(const t of r.requires||[])if(!e.modules.has(t))throw new h(t,`motionary/runtime/${r.id}`);e.modules.set(r.id,r),r.setup?.(e)}}return e}function c(){const t=new Set;let e=0,r=-1,s=60,i=100,n=null;const o=globalThis,a=()=>o.performance?.now?o.performance.now():Date.now(),u=t=>"function"==typeof o.requestAnimationFrame?o.requestAnimationFrame(t):setTimeout(()=>t(a()),16),h=(r,s=!0)=>{const n=(s?Math.min(r,i):r)*c.timeScale;e+=n;for(const r of Array.from(t))r(e,n)},l=e=>{if(n=null,!t.size)return;const i="number"==typeof e&&e>0?e:a(),o=r<0?0:i-r;r=i,o>0&&(s=.9*s+1e3/o*.1),h(o),t.size&&(n=u(l))},c={add:e=>(t.add(e),null===n&&t.size&&(r=-1,n=u(l)),()=>c.remove(e)),remove(e){var r;t.delete(e),t.size||null===n||(r=n,"function"==typeof o.cancelAnimationFrame?o.cancelAnimationFrame(r):clearTimeout(r),n=null)},get time(){return e},get fps(){return Math.round(s)},get size(){return t.size},lagSmoothing(t){i=t>0?t:1/0},timeScale:1,step(t){h(t,!1)}};return c}function d(){const t=i().slots;return t.ticker||(t.ticker=c())}const m=t=>e=>1-t(1-e),p=t=>e=>e<.5?t(2*e)/2:1-t(2*(1-e))/2,f=t=>e=>Math.pow(e,t);function y(t,e,r,s){const i=(t,e)=>1-3*e+3*t,n=(t,e)=>3*e-6*t,o=t=>3*t,a=(t,e,r)=>((i(e,r)*t+n(e,r))*t+o(e))*t,u=(t,e,r)=>3*i(e,r)*t*t+2*n(e,r)*t+o(e);return i=>{if(i<=0||i>=1)return i<=0?0:1;let n=i;for(let e=0;e<6;e++){const e=u(n,t,r);if(Math.abs(e)<1e-6)break;n-=(a(n,t,r)-i)/e}if(n<0||n>1||Math.abs(a(n,t,r)-i)>1e-4){let e=0,s=1;n=i;for(let o=0;o<30;o++){const o=a(n,t,r);if(Math.abs(o-i)<1e-6)break;o<i?e=n:s=n,n=(e+s)/2}}return a(n,e,s)}}const g=(t,e="end")=>r=>{const s="start"===e?Math.ceil(r*t):Math.floor(r*t);return Math.min(1,Math.max(0,s/t))},k={quad:f(2),cubic:f(3),quart:f(4),quint:f(5),sine:t=>1-Math.cos(t*Math.PI/2),expo:t=>0===t?0:Math.pow(2,10*t-10),circ:t=>1-Math.sqrt(1-t*t),back:((t=1.70158)=>e=>e*e*((t+1)*e-t))(),elastic:t=>0===t||1===t?t:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*(2*Math.PI/3)),bounce:m(t=>{const e=7.5625,r=2.75;return t<1/r?e*t*t:t<2/r?e*(t-=1.5/r)*t+.75:t<2.5/r?e*(t-=2.25/r)*t+.9375:e*(t-=2.625/r)*t+.984375})},w={linear:t=>t,ease:y(.25,.1,.25,1),"ease-in":y(.42,0,1,1),"ease-out":y(0,0,.58,1),"ease-in-out":y(.42,0,.58,1),smooth:y(.22,1,.36,1)};for(const[t,e]of Object.entries(k))w[`${t}-in`]=e,w[`${t}-out`]=m(e),w[`${t}-in-out`]=p(e);function b(t){if("function"==typeof t)return t;if(!t)return w["cubic-out"];const e=t.trim();if(w[e])return w[e];let r=/^cubic-bezier\(\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*,\s*([-\d.]+)\s*\)$/.exec(e);if(r)return y(+r[1],+r[2],+r[3],+r[4]);if(r=/^steps\(\s*(\d+)\s*(?:,\s*(jump-)?(start|end)\s*)?\)$/.exec(e),r)return g(+r[1],r[3]||"end");if("step-start"===e)return g(1,"start");if("step-end"===e)return g(1,"end");throw new Error(`[motionary] unknown ease "${e}" — use a name from EASES, cubic-bezier(…) or steps(…)`)}const $=["x","y","rotate","scale","scaleX","scaleY","skewX","skewY"],v={x:"px",y:"px",rotate:"deg",skewX:"deg",skewY:"deg",scale:"",scaleX:"",scaleY:""},_=new WeakMap,M=t=>"undefined"!=typeof Element&&t instanceof Element,x=/-?(?:\d+\.?\d*|\.\d+)(?:e-?\d+)?/gi;function E(t){if("number"==typeof t)return{kind:"num",v:t,u:""};const e=t.trim();let r=/^#([0-9a-f]{3,8})$/i.exec(e);if(r){let t=r[1];t.length<=4&&(t=t.split("").map(t=>t+t).join(""));const e=e=>parseInt(t.slice(e,e+2),16);return{kind:"col",c:[e(0),e(2),e(4),8===t.length?e(6)/255:1]}}if(r=/^rgba?\(([^)]+)\)$/i.exec(e),r){const t=r[1].split(/[\s,/]+/).filter(Boolean).map(t=>t.endsWith("%")?parseFloat(t)/100*255:parseFloat(t));return{kind:"col",c:[t[0],t[1],t[2],void 0===t[3]?1:t[3]>1?t[3]/255:t[3]]}}return"transparent"===e?{kind:"col",c:[0,0,0,0]}:(r=/^(-?[\d.]+(?:e-?\d+)?)([a-z%]*)$/i.exec(e),r?{kind:"num",v:parseFloat(r[1]),u:r[2]}:{kind:"str",s:e,parts:e.split(x),nums:(e.match(x)||[]).map(Number)})}const S=(t,e,r)=>{if("str"===t.kind||"str"===e.kind){if("str"===t.kind&&"str"===e.kind&&t.parts.join("\0")===e.parts.join("\0")&&t.nums.length===e.nums.length)return t.parts.map((s,i)=>s+(i<t.nums.length?+(t.nums[i]+(e.nums[i]-t.nums[i])*r).toFixed(4):"")).join("");const s=r<.5?t:e;return"str"===s.kind?s.s:"num"===s.kind?s.u?s.v+s.u:s.v:`rgba(${s.c.join(", ")})`}if("col"===t.kind||"col"===e.kind){const s="col"===t.kind?t.c:[0,0,0,0],i="col"===e.kind?e.c:[0,0,0,0],n=s.map((t,e)=>t+(i[e]-t)*r);return`rgba(${Math.round(n[0])}, ${Math.round(n[1])}, ${Math.round(n[2])}, ${+n[3].toFixed(3)})`}const s=t.v+(e.v-t.v)*r,i=e.u||t.u;return i?`${+s.toFixed(4)}${i}`:+s.toFixed(6)},A=t=>t.startsWith("--")?t:t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase());function D(t,e){if(!M(t))return t[e]??0;if($.includes(e)){const r=_.get(t)?.[e];return r?r.v+r.u:e.startsWith("scale")?1:0}const r=t.style.getPropertyValue(A(e));if(r)return r;return("function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(A(e)):"")||("opacity"===e?1:0)}function P(t,e,r){if(M(t)){if($.includes(e)){const s=E(r);if("num"!==s.kind)throw new Error(`[motionary] ${e} needs a number (got "${r}")`);const i=_.get(t)||{};return i[e]={v:s.v,u:s.u},void _.set(t,i)}t.style.setProperty(A(e),"number"!=typeof r||["opacity","zIndex","z-index"].includes(e)||e.startsWith("--")?String(r):r+"px")}else t[e]="string"==typeof r&&"number"==typeof t[e]?parseFloat(r):r}class T{constructor(t){this.timeScale=1,this._t=0,this._dir=1,this._off=null,this._done=!1,this.parent=null,this.delay=t.delay||0,this.repeat=t.repeat||0,this.yoyo=!!t.yoyo,this.onUpdate=t.onUpdate,this.onComplete=t.onComplete,this.finished=new Promise(t=>this._resolve=t)}get totalDuration(){return this.repeat<0?1/0:this.delay+this.duration*(this.repeat+1)}get time(){return this._t}get progress(){const t=this.totalDuration;return t===1/0?(this._t-this.delay)%this.duration/this.duration:t?this._t/t:1}set progress(t){this.seek(t*(this.totalDuration===1/0?this.delay+this.duration:this.totalDuration))}get isActive(){return!!this._off}get reversed(){return this._dir<0}seek(t){const e=this.totalDuration;this._t=Math.max(0,Math.min(t,e));const r=this._t-this.delay,s=this.duration||0;if(r<0)this.renderLocal(0,!1);else if(s){let t=s===1/0?0:Math.floor(r/s),i=s===1/0?r:r-t*s;r>=e-this.delay&&e!==1/0&&(t=this.repeat,i=s);const n=this.yoyo&&t%2==1;this.renderLocal(n?s-i:i,i===s)}else this.renderLocal(0,!0);return this.onUpdate?.(this.progress),this}play(){return this._dir=1,this._t>=this.totalDuration&&(this._t=0),this.attach()}pause(){return this._off?.(),this._off=null,this}reverse(){return this._dir=-1,this._t<=0&&(this._t=this.totalDuration===1/0?this.delay+this.duration:this.totalDuration),this.attach()}restart(){return this._done=!1,this.seek(0),this.play()}kill(){this.pause(),this.parent?.remove(this)}then(t,e){return this.finished.then(t,e)}attach(){return this.parent||this._off||(this._done=!1,this._off=d().add((t,e)=>this.advance(e))),this}advance(t){const e=this.totalDuration;this.seek(this._t+t*this._dir*this.timeScale),(this._dir>0&&this._t>=e||this._dir<0&&this._t<=0)&&this.complete()}complete(){this.pause(),this._done||(this._done=!0,this.onComplete?.(),this._resolve())}}class j extends T{constructor(t,e){super(e),this.tracks=null,this.target=t,this._dur=e.duration??600,this.ease=b(e.ease),this.toProps=e.to||{},this.fromProps=e.from||{}}get duration(){return this._dur}init(){return Array.from(new Set([...Object.keys(this.fromProps),...Object.keys(this.toProps)])).map(t=>{const e=t in this.fromProps?this.fromProps[t]:D(this.target,t),r=t in this.toProps?this.toProps[t]:D(this.target,t);return{k:t,fromRaw:e,toRaw:r,from:E(e),to:E(r)}})}renderLocal(t,e){this.tracks||(this.tracks=this.init());const r=this._dur?e?this.ease(t>=this._dur?1:0):this.ease(t/this._dur):1;let s=!1;for(const t of this.tracks)P(this.target,t.k,S(t.from,t.to,r)),$.includes(t.k)&&(s=!0);s&&M(this.target)&&function(t){const e=_.get(t),r=(t,r)=>e[t]?e[t].v:r,s=t=>e[t]?.u??v[t],i=[];(e.x||e.y)&&i.push(`translate(${r("x",0)}${s("x")||"px"}, ${r("y",0)}${s("y")||"px"})`),e.rotate&&i.push(`rotate(${r("rotate",0)}${s("rotate")||"deg"})`),e.scale&&i.push(`scale(${r("scale",1)})`),(e.scaleX||e.scaleY)&&i.push(`scale(${r("scaleX",1)}, ${r("scaleY",1)})`),e.skewX&&i.push(`skewX(${r("skewX",0)}${s("skewX")||"deg"})`),e.skewY&&i.push(`skewY(${r("skewY",0)}${s("skewY")||"deg"})`),t.style.transform=i.join(" ")}(this.target)}}class C extends T{constructor(t={}){super(t),this.children=[],this.labels={},this.prevStart=0,this.prevEnd=0,this.lastLocal=0,this.defaults=t.defaults}get duration(){let t=0;for(const e of this.children)t=Math.max(t,e.start+("function"==typeof e.item?0:e.item.totalDuration));return t}resolve(t){if(void 0===t||">"===t)return this.prevEnd;if("number"==typeof t)return Math.max(0,t);const e=/^([<>]|[\w-]+)?\s*(?:([+-])=\s*([\d.]+))?$/.exec(t.trim());if(!e)throw new Error(`[motionary] bad timeline position "${t}"`);let r=this.prevEnd;if("<"===e[1])r=this.prevStart;else if(e[1]&&">"!==e[1]){if(!(e[1]in this.labels))throw new Error(`[motionary] unknown timeline label "${e[1]}"`);r=this.labels[e[1]]}const s=e[2]?("+"===e[2]?1:-1)*parseFloat(e[3]):0;return Math.max(0,r+s)}add(t,e){const r=this.resolve(e);return"function"!=typeof t&&(t.pause(),t.parent=this),this.children.push({item:t,start:r}),this.prevStart=r,this.prevEnd=r+("function"==typeof t?0:t.totalDuration),this}to(t,e,r){const s=z(t),i=this.resolve(r);let n=i;return s.forEach((t,r)=>{const s=new j(t,{...this.defaults,...e,delay:(e.delay||0)+(e.stagger||0)*r,paused:!0});s.parent=this,this.children.push({item:s,start:i}),n=Math.max(n,i+s.totalDuration)}),this.prevStart=i,this.prevEnd=n,this}call(t,e){return this.add(t,e)}label(t,e){return this.labels[t]=this.resolve(e),this}labelTime(t){return this.labels[t]}remove(t){this.children=this.children.filter(e=>e.item!==t)}getChildren(){return this.children.filter(t=>"function"!=typeof t.item).map(t=>t.item)}renderLocal(t){const e=t>=this.lastLocal,r=[...this.children].sort((t,r)=>e?t.start-r.start:r.start-t.start);for(const s of r){if("function"==typeof s.item){e&&!s.fired&&t>=s.start&&this.lastLocal<=s.start?(s.fired=!0,s.item()):!e&&t<s.start&&(s.fired=!1);continue}const r=t-s.start,i=s.item;r<0?i._started&&i.seek(0):(i._started=!0,i.seek(Math.min(r,i.totalDuration)))}this.lastLocal=t}}function z(t){return Array.isArray(t)?t:t&&"number"==typeof t.length&&!M(t)?Array.from(t):[t]}function F(t={}){const e=new C(t);return t.paused||e.play(),e}const q={id:"core",version:e,api:{version:e,getTicker:d,tween:L,timeline:F,Tween:j,Timeline:C,EASES:w,parseEase:b,cubicBezier:y,steps:g}};function L(t,e){return function(t,e){const r=z(t);let s;if(1===r.length)s=new j(r[0],e);else{const t=new C({repeat:e.repeat,yoyo:e.yoyo,onUpdate:e.onUpdate,onComplete:e.onComplete,delay:e.delay});t.to(r,{...e,delay:0,repeat:0,yoyo:!1,onUpdate:void 0,onComplete:void 0},0),s=t}return e.paused||s.play(),s}(X(t),e)}function X(t){if("string"==typeof t){if("undefined"==typeof document)throw new Error("[motionary] selector targets need a document — pass objects or elements instead");return Array.from(document.querySelectorAll(t))}return t}function Y(...t){return l(q,...t)}Y(),t.EASES=w,t.Playable=T,t.RUNTIME_CDN=r,t.RUNTIME_VERSION=e,t.RuntimeModuleError=h,t.Timeline=C,t.Tween=j,t.core=q,t.cubicBezier=y,t.getTicker=d,t.hasModule=t=>i().modules.has(t),t.missingMessage=a,t.moduleCdn=o,t.modulePath=n,t.parseEase=b,t.parseValue=E,t.register=l,t.registeredModules=()=>Array.from(i().modules.keys()),t.registry=i,t.requireModule=function(t,e){const r=i().modules.get(t);if(!r)throw new h(t,e);return r.api},t.resolveTargets=X,t.steps=g,t.timeline=F,t.tween=L,t.use=Y}(this.MotionaryRuntime=this.MotionaryRuntime||{});
2
2
  //# sourceMappingURL=runtime.iife.js.map