use-scroll-animate 6.1.0 → 6.2.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 (352) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +157 -411
  3. package/README_ja.md +170 -175
  4. package/README_zh.md +169 -198
  5. package/dist/chunks/{base-B5i8qQPR.cjs → base-BaQV-2ha.cjs} +3 -3
  6. package/dist/chunks/base-BaQV-2ha.cjs.map +1 -0
  7. package/dist/chunks/{base-C3Sw9sAO.js → base-C_3cAoRz.js} +4 -4
  8. package/dist/chunks/base-C_3cAoRz.js.map +1 -0
  9. package/dist/chunks/{core-BYLtO0Po.cjs → core-B5T0dhFH.cjs} +3 -3
  10. package/dist/chunks/core-B5T0dhFH.cjs.map +1 -0
  11. package/dist/chunks/{core-BDcszY4L.cjs → core-BGAyaY6L.cjs} +2 -2
  12. package/dist/chunks/{core-BDcszY4L.cjs.map → core-BGAyaY6L.cjs.map} +1 -1
  13. package/dist/chunks/{core-BVQW34aX.js → core-D7cVumUu.js} +3 -3
  14. package/dist/chunks/core-D7cVumUu.js.map +1 -0
  15. package/dist/chunks/{core-DN3hHbHh.js → core-VEBw36QK.js} +2 -2
  16. package/dist/chunks/{core-DN3hHbHh.js.map → core-VEBw36QK.js.map} +1 -1
  17. package/dist/chunks/{core-BTf__I-8.js → core-ps8uvYuN.js} +2 -2
  18. package/dist/chunks/{core-BTf__I-8.js.map → core-ps8uvYuN.js.map} +1 -1
  19. package/dist/chunks/{core-BjOYKSrV.cjs → core-zq17EeCI.cjs} +2 -2
  20. package/dist/chunks/{core-BjOYKSrV.cjs.map → core-zq17EeCI.cjs.map} +1 -1
  21. package/dist/chunks/{fx-ChjxrMBo.js → fx-Bs6IrV4Q.js} +2 -2
  22. package/dist/chunks/{fx-ChjxrMBo.js.map → fx-Bs6IrV4Q.js.map} +1 -1
  23. package/dist/chunks/{fx-B8hk1Fby.cjs → fx-lBGVtQO1.cjs} +2 -2
  24. package/dist/chunks/{fx-B8hk1Fby.cjs.map → fx-lBGVtQO1.cjs.map} +1 -1
  25. package/dist/chunks/generative-D2YyhaeO.js +336 -0
  26. package/dist/chunks/generative-D2YyhaeO.js.map +1 -0
  27. package/dist/chunks/generative-DzIZq-_g.cjs +348 -0
  28. package/dist/chunks/generative-DzIZq-_g.cjs.map +1 -0
  29. package/dist/chunks/gpu-Bu7qwugO.js +380 -0
  30. package/dist/chunks/gpu-Bu7qwugO.js.map +1 -0
  31. package/dist/chunks/gpu-CenK2l6b.cjs +387 -0
  32. package/dist/chunks/gpu-CenK2l6b.cjs.map +1 -0
  33. package/dist/chunks/{presets-BJ09NeTo.js → presets-BYBVJVeP.js} +3 -3
  34. package/dist/chunks/presets-BYBVJVeP.js.map +1 -0
  35. package/dist/chunks/{presets-D2ksQNzJ.cjs → presets-CUHys3sK.cjs} +3 -3
  36. package/dist/chunks/presets-CUHys3sK.cjs.map +1 -0
  37. package/dist/chunks/registry-CKNLQpwd.js +121 -0
  38. package/dist/chunks/registry-CKNLQpwd.js.map +1 -0
  39. package/dist/chunks/registry-DehBVRDV.cjs +131 -0
  40. package/dist/chunks/registry-DehBVRDV.cjs.map +1 -0
  41. package/dist/chunks/{spring-CckMe3x0.js → spring-CbvHfVtP.js} +2 -2
  42. package/dist/chunks/{spring-CckMe3x0.js.map → spring-CbvHfVtP.js.map} +1 -1
  43. package/dist/chunks/{spring--oZh55tB.cjs → spring-Dgx187Vh.cjs} +2 -2
  44. package/dist/chunks/{spring--oZh55tB.cjs.map → spring-Dgx187Vh.cjs.map} +1 -1
  45. package/dist/chunks/{stagger-CvhYlKrF.cjs → stagger-CCFyhzSw.cjs} +3 -3
  46. package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
  47. package/dist/chunks/{stagger-Dh4V-OL0.js → stagger-DtMKo2SK.js} +3 -3
  48. package/dist/chunks/stagger-DtMKo2SK.js.map +1 -0
  49. package/dist/chunks/{variants-DxPmgrNX.cjs → variants-BhjyddG8.cjs} +2 -2
  50. package/dist/chunks/{variants-DxPmgrNX.cjs.map → variants-BhjyddG8.cjs.map} +1 -1
  51. package/dist/chunks/{variants-Bsevy6Xm.js → variants-DRlKVHvu.js} +2 -2
  52. package/dist/chunks/{variants-Bsevy6Xm.js.map → variants-DRlKVHvu.js.map} +1 -1
  53. package/dist/components/a11y.cjs +4 -4
  54. package/dist/components/a11y.cjs.map +1 -1
  55. package/dist/components/a11y.d.cts +2 -2
  56. package/dist/components/a11y.d.ts +2 -2
  57. package/dist/components/a11y.js +5 -5
  58. package/dist/components/a11y.js.map +1 -1
  59. package/dist/components/angular.cjs +9 -8
  60. package/dist/components/angular.cjs.map +1 -1
  61. package/dist/components/angular.d.cts +22 -22
  62. package/dist/components/angular.d.ts +22 -22
  63. package/dist/components/angular.js +9 -8
  64. package/dist/components/angular.js.map +1 -1
  65. package/dist/components/background.cjs +3 -3
  66. package/dist/components/background.cjs.map +1 -1
  67. package/dist/components/background.css +1 -1
  68. package/dist/components/background.d.cts +1 -1
  69. package/dist/components/background.d.ts +1 -1
  70. package/dist/components/background.js +3 -3
  71. package/dist/components/background.js.map +1 -1
  72. package/dist/components/bridge.cjs +2 -2
  73. package/dist/components/bridge.cjs.map +1 -1
  74. package/dist/components/bridge.d.cts +1 -1
  75. package/dist/components/bridge.d.ts +1 -1
  76. package/dist/components/bridge.js +2 -2
  77. package/dist/components/bridge.js.map +1 -1
  78. package/dist/components/cards.cjs +3 -3
  79. package/dist/components/cards.cjs.map +1 -1
  80. package/dist/components/cards.css +1 -1
  81. package/dist/components/cards.d.cts +1 -1
  82. package/dist/components/cards.d.ts +1 -1
  83. package/dist/components/cards.js +3 -3
  84. package/dist/components/cards.js.map +1 -1
  85. package/dist/components/click.cjs +4 -4
  86. package/dist/components/click.cjs.map +1 -1
  87. package/dist/components/click.css +1 -1
  88. package/dist/components/click.d.cts +1 -1
  89. package/dist/components/click.d.ts +1 -1
  90. package/dist/components/click.js +4 -4
  91. package/dist/components/click.js.map +1 -1
  92. package/dist/components/depth.cjs +4 -4
  93. package/dist/components/depth.cjs.map +1 -1
  94. package/dist/components/depth.css +1 -1
  95. package/dist/components/depth.d.cts +1 -1
  96. package/dist/components/depth.d.ts +1 -1
  97. package/dist/components/depth.js +4 -4
  98. package/dist/components/depth.js.map +1 -1
  99. package/dist/components/effects.cjs +84 -416
  100. package/dist/components/effects.cjs.map +1 -1
  101. package/dist/components/effects.d.cts +2 -2
  102. package/dist/components/effects.d.ts +2 -2
  103. package/dist/components/effects.js +18 -349
  104. package/dist/components/effects.js.map +1 -1
  105. package/dist/components/feedback.cjs +2 -2
  106. package/dist/components/feedback.cjs.map +1 -1
  107. package/dist/components/feedback.css +1 -1
  108. package/dist/components/feedback.d.cts +1 -1
  109. package/dist/components/feedback.d.ts +1 -1
  110. package/dist/components/feedback.js +2 -2
  111. package/dist/components/feedback.js.map +1 -1
  112. package/dist/components/fx-gpu.cjs +12 -0
  113. package/dist/components/fx-gpu.cjs.map +1 -0
  114. package/dist/components/fx-gpu.d.cts +63 -0
  115. package/dist/components/fx-gpu.d.ts +63 -0
  116. package/dist/components/fx-gpu.js +5 -0
  117. package/dist/components/fx-gpu.js.map +1 -0
  118. package/dist/components/fx.cjs +18 -138
  119. package/dist/components/fx.cjs.map +1 -1
  120. package/dist/components/fx.css +1 -1
  121. package/dist/components/fx.d.cts +2 -2
  122. package/dist/components/fx.d.ts +2 -2
  123. package/dist/components/fx.js +8 -127
  124. package/dist/components/fx.js.map +1 -1
  125. package/dist/components/fx2.cjs +25 -0
  126. package/dist/components/fx2.cjs.map +1 -0
  127. package/dist/components/fx2.d.cts +136 -0
  128. package/dist/components/fx2.d.ts +136 -0
  129. package/dist/components/fx2.js +17 -0
  130. package/dist/components/fx2.js.map +1 -0
  131. package/dist/components/gesture.cjs +4 -4
  132. package/dist/components/gesture.cjs.map +1 -1
  133. package/dist/components/gesture.css +1 -1
  134. package/dist/components/gesture.d.cts +1 -1
  135. package/dist/components/gesture.d.ts +1 -1
  136. package/dist/components/gesture.js +5 -5
  137. package/dist/components/gesture.js.map +1 -1
  138. package/dist/components/interaction.cjs +2 -2
  139. package/dist/components/interaction.cjs.map +1 -1
  140. package/dist/components/interaction.css +1 -1
  141. package/dist/components/interaction.d.cts +1 -1
  142. package/dist/components/interaction.d.ts +1 -1
  143. package/dist/components/interaction.js +2 -2
  144. package/dist/components/interaction.js.map +1 -1
  145. package/dist/components/jsx.d.cts +2 -2
  146. package/dist/components/jsx.d.ts +2 -2
  147. package/dist/components/layout.cjs +2 -2
  148. package/dist/components/layout.cjs.map +1 -1
  149. package/dist/components/layout.css +1 -1
  150. package/dist/components/layout.d.cts +1 -1
  151. package/dist/components/layout.d.ts +1 -1
  152. package/dist/components/layout.js +2 -2
  153. package/dist/components/layout.js.map +1 -1
  154. package/dist/components/lazy.cjs +2 -2
  155. package/dist/components/lazy.cjs.map +1 -1
  156. package/dist/components/lazy.d.cts +2 -2
  157. package/dist/components/lazy.d.ts +2 -2
  158. package/dist/components/lazy.js +2 -2
  159. package/dist/components/lazy.js.map +1 -1
  160. package/dist/components/lite.cjs +46 -50
  161. package/dist/components/lite.cjs.map +1 -1
  162. package/dist/components/lite.js +46 -50
  163. package/dist/components/lite.js.map +1 -1
  164. package/dist/components/packs.cjs +2 -2
  165. package/dist/components/packs.cjs.map +1 -1
  166. package/dist/components/packs.css +1 -1
  167. package/dist/components/packs.d.cts +1 -1
  168. package/dist/components/packs.d.ts +1 -1
  169. package/dist/components/packs.js +2 -2
  170. package/dist/components/packs.js.map +1 -1
  171. package/dist/components/page.cjs +3 -3
  172. package/dist/components/page.cjs.map +1 -1
  173. package/dist/components/page.css +1 -1
  174. package/dist/components/page.d.cts +1 -1
  175. package/dist/components/page.d.ts +1 -1
  176. package/dist/components/page.js +4 -4
  177. package/dist/components/page.js.map +1 -1
  178. package/dist/components/perf.cjs +3 -3
  179. package/dist/components/perf.cjs.map +1 -1
  180. package/dist/components/perf.d.cts +2 -2
  181. package/dist/components/perf.d.ts +2 -2
  182. package/dist/components/perf.js +4 -4
  183. package/dist/components/perf.js.map +1 -1
  184. package/dist/components/physics.cjs +3 -3
  185. package/dist/components/physics.cjs.map +1 -1
  186. package/dist/components/physics.css +1 -1
  187. package/dist/components/physics.d.cts +1 -1
  188. package/dist/components/physics.d.ts +1 -1
  189. package/dist/components/physics.js +4 -4
  190. package/dist/components/physics.js.map +1 -1
  191. package/dist/components/react.cjs +4 -4
  192. package/dist/components/react.cjs.map +1 -1
  193. package/dist/components/react.js +4 -4
  194. package/dist/components/react.js.map +1 -1
  195. package/dist/components/reveal.cjs +2 -2
  196. package/dist/components/reveal.cjs.map +1 -1
  197. package/dist/components/reveal.css +1 -1
  198. package/dist/components/reveal.d.cts +1 -1
  199. package/dist/components/reveal.d.ts +1 -1
  200. package/dist/components/reveal.js +2 -2
  201. package/dist/components/reveal.js.map +1 -1
  202. package/dist/components/solid.cjs +10 -9
  203. package/dist/components/solid.cjs.map +1 -1
  204. package/dist/components/solid.d.cts +22 -22
  205. package/dist/components/solid.d.ts +22 -22
  206. package/dist/components/solid.js +10 -9
  207. package/dist/components/solid.js.map +1 -1
  208. package/dist/components/svelte.cjs +9 -8
  209. package/dist/components/svelte.cjs.map +1 -1
  210. package/dist/components/svelte.d.cts +22 -22
  211. package/dist/components/svelte.d.ts +22 -22
  212. package/dist/components/svelte.js +9 -8
  213. package/dist/components/svelte.js.map +1 -1
  214. package/dist/components/svg.cjs +2 -2
  215. package/dist/components/svg.cjs.map +1 -1
  216. package/dist/components/svg.css +1 -1
  217. package/dist/components/svg.d.cts +1 -1
  218. package/dist/components/svg.d.ts +1 -1
  219. package/dist/components/svg.js +2 -2
  220. package/dist/components/svg.js.map +1 -1
  221. package/dist/components/text.cjs +3 -3
  222. package/dist/components/text.cjs.map +1 -1
  223. package/dist/components/text.css +1 -1
  224. package/dist/components/text.d.cts +1 -1
  225. package/dist/components/text.d.ts +1 -1
  226. package/dist/components/text.js +3 -3
  227. package/dist/components/text.js.map +1 -1
  228. package/dist/components/timeline.cjs +3 -3
  229. package/dist/components/timeline.cjs.map +1 -1
  230. package/dist/components/timeline.css +1 -1
  231. package/dist/components/timeline.d.cts +1 -1
  232. package/dist/components/timeline.d.ts +1 -1
  233. package/dist/components/timeline.js +4 -4
  234. package/dist/components/timeline.js.map +1 -1
  235. package/dist/components/tokens.cjs +2 -2
  236. package/dist/components/tokens.cjs.map +1 -1
  237. package/dist/components/tokens.d.cts +2 -2
  238. package/dist/components/tokens.d.ts +2 -2
  239. package/dist/components/tokens.js +2 -2
  240. package/dist/components/tokens.js.map +1 -1
  241. package/dist/components/transitions.cjs +2 -2
  242. package/dist/components/transitions.cjs.map +1 -1
  243. package/dist/components/transitions.css +1 -1
  244. package/dist/components/transitions.d.cts +1 -1
  245. package/dist/components/transitions.d.ts +1 -1
  246. package/dist/components/transitions.js +2 -2
  247. package/dist/components/transitions.js.map +1 -1
  248. package/dist/components/ui.cjs +4 -4
  249. package/dist/components/ui.cjs.map +1 -1
  250. package/dist/components/ui.css +1 -1
  251. package/dist/components/ui.d.cts +1 -1
  252. package/dist/components/ui.d.ts +1 -1
  253. package/dist/components/ui.js +5 -5
  254. package/dist/components/ui.js.map +1 -1
  255. package/dist/components/vue.cjs +10 -9
  256. package/dist/components/vue.cjs.map +1 -1
  257. package/dist/components/vue.d.cts +23 -23
  258. package/dist/components/vue.d.ts +23 -23
  259. package/dist/components/vue.js +10 -9
  260. package/dist/components/vue.js.map +1 -1
  261. package/dist/components/webgl.cjs +2 -2
  262. package/dist/components/webgl.cjs.map +1 -1
  263. package/dist/components/webgl.css +1 -1
  264. package/dist/components/webgl.d.cts +1 -1
  265. package/dist/components/webgl.d.ts +1 -1
  266. package/dist/components/webgl.js +2 -2
  267. package/dist/components/webgl.js.map +1 -1
  268. package/dist/components/widgets.cjs +591 -0
  269. package/dist/components/widgets.cjs.map +1 -0
  270. package/dist/components/widgets.d.cts +110 -0
  271. package/dist/components/widgets.d.ts +110 -0
  272. package/dist/components/widgets.js +581 -0
  273. package/dist/components/widgets.js.map +1 -0
  274. package/dist/components.cjs +19 -18
  275. package/dist/components.cjs.map +1 -1
  276. package/dist/components.css +1 -1
  277. package/dist/components.d.cts +30 -30
  278. package/dist/components.d.ts +30 -30
  279. package/dist/components.js +13 -12
  280. package/dist/components.js.map +1 -1
  281. package/dist/components.umd.js +5 -5
  282. package/dist/components.umd.js.map +1 -1
  283. package/dist/element.cjs +4 -4
  284. package/dist/element.cjs.map +1 -1
  285. package/dist/element.d.cts +5 -5
  286. package/dist/element.d.ts +5 -5
  287. package/dist/element.js +4 -4
  288. package/dist/element.js.map +1 -1
  289. package/dist/element.umd.js.map +1 -1
  290. package/dist/index.cjs +10 -10
  291. package/dist/index.cjs.map +1 -1
  292. package/dist/index.d.cts +9 -9
  293. package/dist/index.d.ts +9 -9
  294. package/dist/index.js +11 -11
  295. package/dist/index.js.map +1 -1
  296. package/dist/index.umd.js +3 -3
  297. package/dist/index.umd.js.map +1 -1
  298. package/dist/presets/extended.cjs +3 -3
  299. package/dist/presets/extended.cjs.map +1 -1
  300. package/dist/presets/extended.d.cts +3 -3
  301. package/dist/presets/extended.d.ts +3 -3
  302. package/dist/presets/extended.js +3 -3
  303. package/dist/presets/extended.js.map +1 -1
  304. package/dist/presets-extended.umd.js.map +1 -1
  305. package/dist/react.cjs +4 -4
  306. package/dist/react.cjs.map +1 -1
  307. package/dist/react.d.cts +5 -5
  308. package/dist/react.d.ts +5 -5
  309. package/dist/react.js +4 -4
  310. package/dist/react.js.map +1 -1
  311. package/dist/solid.cjs +5 -5
  312. package/dist/solid.cjs.map +1 -1
  313. package/dist/solid.d.cts +6 -6
  314. package/dist/solid.d.ts +6 -6
  315. package/dist/solid.js +5 -5
  316. package/dist/solid.js.map +1 -1
  317. package/dist/svelte.cjs +5 -5
  318. package/dist/svelte.cjs.map +1 -1
  319. package/dist/svelte.d.cts +6 -6
  320. package/dist/svelte.d.ts +6 -6
  321. package/dist/svelte.js +5 -5
  322. package/dist/svelte.js.map +1 -1
  323. package/dist/vue.cjs +4 -4
  324. package/dist/vue.cjs.map +1 -1
  325. package/dist/vue.d.cts +5 -5
  326. package/dist/vue.d.ts +5 -5
  327. package/dist/vue.js +4 -4
  328. package/dist/vue.js.map +1 -1
  329. package/dist/widgets.umd.js +2 -0
  330. package/dist/widgets.umd.js.map +1 -0
  331. package/docs/API.md +13 -13
  332. package/docs/ROADMAP.md +11 -12
  333. package/docs/accessibility.md +2 -2
  334. package/docs/components.md +62 -33
  335. package/docs/frameworks-ssr.md +12 -12
  336. package/docs/hybrid-apps.md +10 -10
  337. package/docs/migration-from-aos.md +5 -5
  338. package/docs/migration-from-gsap-scrolltrigger.md +3 -3
  339. package/docs/motion-tokens.css +1 -1
  340. package/docs/motion-tokens.md +2 -2
  341. package/docs/performance.md +6 -6
  342. package/docs/presets.md +5 -5
  343. package/docs/windows-apps.md +8 -8
  344. package/package.json +56 -25
  345. package/dist/chunks/base-B5i8qQPR.cjs.map +0 -1
  346. package/dist/chunks/base-C3Sw9sAO.js.map +0 -1
  347. package/dist/chunks/core-BVQW34aX.js.map +0 -1
  348. package/dist/chunks/core-BYLtO0Po.cjs.map +0 -1
  349. package/dist/chunks/presets-BJ09NeTo.js.map +0 -1
  350. package/dist/chunks/presets-D2ksQNzJ.cjs.map +0 -1
  351. package/dist/chunks/stagger-CvhYlKrF.cjs.map +0 -1
  352. package/dist/chunks/stagger-Dh4V-OL0.js.map +0 -1
@@ -0,0 +1,591 @@
1
+ 'use strict';
2
+
3
+ var base = require('../chunks/base-BaQV-2ha.cjs');
4
+ var spring = require('../chunks/spring-Dgx187Vh.cjs');
5
+
6
+ /** Helpers shared by the 6.x widgets (`motionary/components/widgets`). */
7
+ const clampN = (v, a, b) => Math.min(b, Math.max(a, v));
8
+ /** Children of `el` that are elements and not created by the widget itself. */
9
+ const ownChildren = (el, skip = '[data-usa-part]') => Array.from(el.children).filter((c) => c instanceof HTMLElement && !c.matches(skip));
10
+ /** Create a part element (marked so re-mounts can find / skip it). */
11
+ function part(tag, cls, attrs = {}, html = '') {
12
+ const n = document.createElement(tag);
13
+ n.className = cls;
14
+ n.setAttribute('data-usa-part', '');
15
+ for (const [k, v] of Object.entries(attrs))
16
+ n.setAttribute(k, v);
17
+ if (html)
18
+ n.innerHTML = html;
19
+ return n;
20
+ }
21
+ /** Remove the parts a previous mount created. */
22
+ const dropParts = (el) => el.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
23
+ let uid = 0;
24
+ /** A document-unique id with a prefix. */
25
+ const nextId = (p) => `${p}-${++uid}`;
26
+ /** Roving arrow-key focus over `items` (horizontal or vertical); returns the new index or -1. */
27
+ function arrowIndex(e, i, n, vertical = false) {
28
+ const prev = vertical ? 'ArrowUp' : 'ArrowLeft';
29
+ const next = vertical ? 'ArrowDown' : 'ArrowRight';
30
+ if (e.key === prev)
31
+ return (i - 1 + n) % n;
32
+ if (e.key === next)
33
+ return (i + 1) % n;
34
+ if (e.key === 'Home')
35
+ return 0;
36
+ if (e.key === 'End')
37
+ return n - 1;
38
+ return -1;
39
+ }
40
+
41
+ var css$3 = "usa-carousel{display:block;position:relative;--usa-carousel-dur:520ms;--usa-carousel-ease:cubic-bezier(.22,1,.36,1);overflow:hidden;border-radius:var(--usa-radius,14px);touch-action:pan-y}.usa-carousel-viewport{position:relative;overflow:hidden;height:100%;min-height:inherit}.usa-carousel-track{display:flex;height:100%;transition:transform var(--usa-carousel-dur) var(--usa-carousel-ease);will-change:transform}.usa-carousel-track>*{flex:0 0 100%;min-width:0;box-sizing:border-box}usa-carousel:not([data-effect=\"slide\"]) .usa-carousel-track{display:grid}usa-carousel:not([data-effect=\"slide\"]) .usa-carousel-track>*{grid-area:1/1;transition:opacity var(--usa-carousel-dur) ease,transform var(--usa-carousel-dur) var(--usa-carousel-ease),filter var(--usa-carousel-dur) ease}usa-carousel[data-effect=\"cards\"] .usa-carousel-viewport{perspective:900px}usa-carousel[data-dragging] .usa-carousel-track,usa-carousel[data-dragging] .usa-carousel-track>*{transition:none}.usa-carousel-nav{position:absolute;top:50%;translate:0 -50%;z-index:2;width:36px;height:36px;border-radius:50%;border:0;background:rgba(255,255,255,.85);color:#111;font:600 18px/1 system-ui;cursor:pointer;display:grid;place-items:center;box-shadow:0 4px 14px rgba(0,0,0,.18);transition:transform .2s}.usa-carousel-nav:hover{transform:scale(1.08)}.usa-carousel-nav:focus-visible{outline:2px solid #7c5cff;outline-offset:2px}.usa-carousel-prev{left:10px}.usa-carousel-next{right:10px}.usa-carousel-dots{position:absolute;left:0;right:0;bottom:10px;display:flex;justify-content:center;gap:6px;z-index:2}.usa-carousel-dot{width:8px;height:8px;padding:0;border:0;border-radius:99px;background:rgba(255,255,255,.55);cursor:pointer;transition:width .35s var(--usa-carousel-ease),background .35s}.usa-carousel-dot[aria-current=\"true\"]{width:22px;background:#fff}@media (prefers-reduced-motion:reduce){usa-carousel .usa-carousel-track,usa-carousel .usa-carousel-track>*,.usa-carousel-dot{transition:none!important}}usa-carousel[data-reduced] .usa-carousel-track,usa-carousel[data-reduced] .usa-carousel-track>*{transition:none!important}";
42
+
43
+ const CAROUSEL_EFFECTS = ['slide', 'fade', 'scale', 'cards'];
44
+ function defineCarousel(tag = 'usa-carousel') {
45
+ return base.defineElement(tag, (Base) => {
46
+ class UsaCarousel extends Base {
47
+ constructor() {
48
+ super(...arguments);
49
+ this._i = 0;
50
+ this._slides = [];
51
+ this._track = null;
52
+ this._timer = 0;
53
+ this._hold = false;
54
+ this._dots = [];
55
+ }
56
+ static get observedAttributes() {
57
+ return ['effect', 'autoplay', 'loop', 'no-controls', 'no-dots'];
58
+ }
59
+ get length() {
60
+ return this._slides.length;
61
+ }
62
+ get index() {
63
+ return this._i;
64
+ }
65
+ set index(v) {
66
+ this.goTo(v);
67
+ }
68
+ get effect() {
69
+ const e = this.str('effect', 'slide');
70
+ return CAROUSEL_EFFECTS.includes(e) ? e : 'slide';
71
+ }
72
+ mount() {
73
+ this.dataset.effect = this.effect; // (not the observed attribute: no re-mount loop)
74
+ this.toggleAttribute('data-reduced', this.reduced);
75
+ const old = this.querySelector(':scope > .usa-carousel-viewport');
76
+ this._slides = old ? ownChildren(old.firstElementChild) : ownChildren(this);
77
+ dropParts(this);
78
+ const vp = part('div', 'usa-carousel-viewport', { 'aria-live': this.num('autoplay', 0) ? 'off' : 'polite' });
79
+ const track = part('div', 'usa-carousel-track');
80
+ this._track = track;
81
+ vp.append(track);
82
+ const n = this._slides.length;
83
+ this._slides.forEach((s, i) => {
84
+ s.setAttribute('role', 'group');
85
+ s.setAttribute('aria-roledescription', 'slide');
86
+ s.setAttribute('aria-label', `${i + 1} of ${n}`);
87
+ track.append(s);
88
+ });
89
+ this.prepend(vp);
90
+ this.setAttribute('role', 'region');
91
+ this.setAttribute('aria-roledescription', 'carousel');
92
+ this.setAttribute('aria-label', this.str('label', 'Carousel'));
93
+ if (!this.hasAttribute('tabindex'))
94
+ this.tabIndex = 0;
95
+ if (n > 1 && !this.flag('no-controls')) {
96
+ const prev = part('button', 'usa-carousel-nav usa-carousel-prev', { type: 'button', 'aria-label': 'Previous slide' }, '‹');
97
+ const next = part('button', 'usa-carousel-nav usa-carousel-next', { type: 'button', 'aria-label': 'Next slide' }, '›');
98
+ this.listen(prev, 'click', () => this.prev());
99
+ this.listen(next, 'click', () => this.next());
100
+ this.append(prev, next);
101
+ }
102
+ this._dots = [];
103
+ if (n > 1 && !this.flag('no-dots')) {
104
+ const dots = part('div', 'usa-carousel-dots', { role: 'group', 'aria-label': 'Choose slide' });
105
+ for (let i = 0; i < n; i++) {
106
+ const d = part('button', 'usa-carousel-dot', { type: 'button', 'aria-label': `Slide ${i + 1}` });
107
+ this.listen(d, 'click', () => this.goTo(i));
108
+ this._dots.push(d);
109
+ dots.append(d);
110
+ }
111
+ this.append(dots);
112
+ }
113
+ this._i = clampN(Math.round(this.num('index', 0)), 0, Math.max(0, n - 1));
114
+ this.layout(0);
115
+ this.listen(this, 'keydown', (e) => {
116
+ if (e.key === 'ArrowRight')
117
+ (e.preventDefault(), this.next());
118
+ else if (e.key === 'ArrowLeft')
119
+ (e.preventDefault(), this.prev());
120
+ });
121
+ this.drag(vp);
122
+ const ms = this.num('autoplay', 0);
123
+ if (ms > 0 && n > 1 && !this.reduced) {
124
+ let visible = true;
125
+ this.inView((v) => (visible = v));
126
+ const pause = (on) => () => (this._hold = on);
127
+ this.listen(this, 'pointerenter', pause(true));
128
+ this.listen(this, 'pointerleave', pause(false));
129
+ this.listen(this, 'focusin', pause(true));
130
+ this.listen(this, 'focusout', pause(false));
131
+ this._timer = window.setInterval(() => {
132
+ if (visible && !this._hold && !document.hidden)
133
+ this.next();
134
+ }, Math.max(1200, ms));
135
+ this.onCleanup(() => clearInterval(this._timer));
136
+ }
137
+ }
138
+ drag(vp) {
139
+ let x0 = 0;
140
+ let dx = 0;
141
+ let id = -1;
142
+ this.listen(vp, 'pointerdown', (e) => {
143
+ if (this.length < 2 || e.target.closest('button,a,input'))
144
+ return;
145
+ id = e.pointerId;
146
+ x0 = e.clientX;
147
+ dx = 0;
148
+ this.setAttribute('data-dragging', '');
149
+ });
150
+ this.listen(window, 'pointermove', (e) => {
151
+ if (e.pointerId !== id)
152
+ return;
153
+ dx = e.clientX - x0;
154
+ this.layout(dx / Math.max(1, vp.clientWidth));
155
+ });
156
+ const end = (e) => {
157
+ if (e.pointerId !== id)
158
+ return;
159
+ id = -1;
160
+ this.removeAttribute('data-dragging');
161
+ const w = Math.max(1, vp.clientWidth);
162
+ if (Math.abs(dx) > w * 0.18)
163
+ dx < 0 ? this.next() : this.prev();
164
+ else
165
+ this.layout(0);
166
+ };
167
+ this.listen(window, 'pointerup', end);
168
+ this.listen(window, 'pointercancel', end);
169
+ }
170
+ /** Position the slides (`drag` = fraction of a slide the pointer moved). */
171
+ layout(drag) {
172
+ const n = this.length;
173
+ const i = this._i;
174
+ const fx = this.effect;
175
+ if (this._track)
176
+ this._track.style.transform = fx === 'slide' ? `translateX(${(-i + drag) * 100}%)` : '';
177
+ this._slides.forEach((s, k) => {
178
+ let off = k - i + drag;
179
+ if (this.flag('loop') && n > 2) {
180
+ if (off > n / 2)
181
+ off -= n;
182
+ if (off < -n / 2)
183
+ off += n;
184
+ }
185
+ const active = k === i;
186
+ s.toggleAttribute('data-active', active);
187
+ s.setAttribute('aria-hidden', String(!active));
188
+ s.inert = !active;
189
+ if (fx === 'slide') {
190
+ s.style.transform = s.style.opacity = s.style.zIndex = s.style.filter = '';
191
+ return;
192
+ }
193
+ const a = Math.abs(off);
194
+ if (fx === 'fade') {
195
+ s.style.opacity = String(clampN(1 - a, 0, 1));
196
+ s.style.transform = '';
197
+ }
198
+ else if (fx === 'scale') {
199
+ s.style.opacity = String(clampN(1 - a, 0, 1));
200
+ s.style.transform = `scale(${1 + Math.min(1, a) * (off < 0 ? 0.12 : -0.12)})`;
201
+ }
202
+ else {
203
+ s.style.opacity = a > 2.2 ? '0' : String(1 - Math.min(a, 2) * 0.28);
204
+ s.style.transform = `translateX(${off * 58}%) translateZ(${-a * 140}px) rotateY(${clampN(-off * 38, -60, 60)}deg)`;
205
+ s.style.filter = a > 0.5 ? `brightness(${1 - Math.min(a, 2) * 0.18})` : '';
206
+ }
207
+ s.style.zIndex = String(100 - Math.round(a * 10));
208
+ });
209
+ this._dots.forEach((d, k) => d.setAttribute('aria-current', String(k === i)));
210
+ }
211
+ goTo(to) {
212
+ const n = this.length;
213
+ if (!n)
214
+ return;
215
+ const t = this.flag('loop') ? ((Math.round(to) % n) + n) % n : clampN(Math.round(to), 0, n - 1);
216
+ const from = this._i;
217
+ this._i = t;
218
+ this.layout(0);
219
+ if (t !== from)
220
+ this.emit('change', { index: t, from });
221
+ }
222
+ next() {
223
+ this.goTo(this._i + 1 >= this.length && !this.flag('loop') ? 0 : this._i + 1);
224
+ }
225
+ prev() {
226
+ this.goTo(this._i - 1 < 0 && !this.flag('loop') ? this.length - 1 : this._i - 1);
227
+ }
228
+ }
229
+ return UsaCarousel;
230
+ }, { id: 'carousel', text: css$3 });
231
+ }
232
+
233
+ var css$2 = "usa-tab-bar{display:block;--usa-tab-accent:#7c5cff;--usa-tab-ease:cubic-bezier(.22,1,.36,1)}.usa-tab-bar-list{position:relative;display:flex;gap:4px;padding:4px;border-radius:12px;background:rgba(127,127,127,.12);isolation:isolate;overflow-x:auto;scrollbar-width:none}.usa-tab-bar-list::-webkit-scrollbar{display:none}.usa-tab-bar-list>[role=\"tab\"]{position:relative;z-index:1;flex:1 0 auto;border:0;background:none;color:inherit;font:inherit;font-weight:600;padding:8px 14px;border-radius:9px;cursor:pointer;opacity:.7;transition:opacity .25s,color .25s;white-space:nowrap}.usa-tab-bar-list>[role=\"tab\"][aria-selected=\"true\"]{opacity:1}.usa-tab-bar-list>[role=\"tab\"]:focus-visible{outline:2px solid var(--usa-tab-accent);outline-offset:1px}.usa-tab-bar-ink{position:absolute;z-index:0;left:0;top:4px;bottom:4px;width:0;border-radius:9px;background:var(--usa-tab-accent);pointer-events:none}usa-tab-bar[data-indicator=\"pill\"] [aria-selected=\"true\"]{color:#fff}usa-tab-bar[data-indicator=\"underline\"] .usa-tab-bar-list{background:none;border-bottom:1px solid rgba(127,127,127,.25);border-radius:0}usa-tab-bar[data-indicator=\"underline\"] .usa-tab-bar-ink{top:auto;bottom:0;height:3px;border-radius:3px}usa-tab-bar[data-indicator=\"glow\"] .usa-tab-bar-ink{background:transparent;box-shadow:0 0 0 2px var(--usa-tab-accent),0 0 18px var(--usa-tab-accent)}usa-tab-bar[data-indicator=\"gooey\"] .usa-tab-bar-ink{filter:blur(.5px);border-radius:999px}usa-tab-bar[data-indicator=\"gooey\"] [aria-selected=\"true\"]{color:#fff}.usa-tab-bar-panel{padding:14px 2px}.usa-tab-bar-panel[hidden]{display:none}";
234
+
235
+ const TAB_INDICATORS = ['pill', 'underline', 'glow', 'gooey'];
236
+ function defineTabBar(tag = 'usa-tab-bar') {
237
+ return base.defineElement(tag, (Base) => {
238
+ class UsaTabBar extends Base {
239
+ constructor() {
240
+ super(...arguments);
241
+ this._tabs = [];
242
+ this._panels = [];
243
+ this._ink = null;
244
+ this._i = 0;
245
+ }
246
+ static get observedAttributes() {
247
+ return ['indicator'];
248
+ }
249
+ get selected() {
250
+ return this._i;
251
+ }
252
+ set selected(v) {
253
+ this.select(v);
254
+ }
255
+ mount() {
256
+ const ind = this.str('indicator', 'pill');
257
+ this.dataset.indicator = TAB_INDICATORS.includes(ind) ? ind : 'pill';
258
+ let list = this.querySelector(':scope > .usa-tab-bar-list');
259
+ if (!list) {
260
+ list = part('div', 'usa-tab-bar-list');
261
+ this.prepend(list);
262
+ }
263
+ list.setAttribute('role', 'tablist');
264
+ list.setAttribute('aria-label', this.str('label', 'Tabs'));
265
+ const kids = ownChildren(this);
266
+ this._panels = kids.filter((k) => k.hasAttribute('data-panel'));
267
+ for (const k of kids)
268
+ if (!k.hasAttribute('data-panel') && k.matches('button,[data-tab]'))
269
+ list.append(k);
270
+ this._tabs = Array.from(list.children).filter((c) => c instanceof HTMLElement && !c.classList.contains('usa-tab-bar-ink'));
271
+ this._ink = list.querySelector('.usa-tab-bar-ink') || part('span', 'usa-tab-bar-ink', { 'aria-hidden': 'true' });
272
+ list.prepend(this._ink);
273
+ this._tabs.forEach((t, i) => {
274
+ t.setAttribute('role', 'tab');
275
+ if (t.localName === 'button' && !t.hasAttribute('type'))
276
+ t.setAttribute('type', 'button');
277
+ t.id || (t.id = nextId('usa-tab'));
278
+ const p = this._panels[i];
279
+ if (p) {
280
+ p.id || (p.id = nextId('usa-tabpanel'));
281
+ p.classList.add('usa-tab-bar-panel');
282
+ p.setAttribute('role', 'tabpanel');
283
+ p.setAttribute('aria-labelledby', t.id);
284
+ p.tabIndex = 0;
285
+ t.setAttribute('aria-controls', p.id);
286
+ }
287
+ this.listen(t, 'click', () => this.select(i));
288
+ });
289
+ this.listen(list, 'keydown', (e) => {
290
+ const n = arrowIndex(e, this._i, this._tabs.length);
291
+ if (n < 0)
292
+ return;
293
+ e.preventDefault();
294
+ this.select(n);
295
+ this._tabs[n].focus();
296
+ });
297
+ this._i = Math.min(Math.max(0, Math.round(this.num('selected', 0))), Math.max(0, this._tabs.length - 1));
298
+ this.sync(-1);
299
+ if (typeof ResizeObserver === 'function') {
300
+ const ro = new ResizeObserver(() => this.place());
301
+ ro.observe(list);
302
+ this.onCleanup(() => ro.disconnect());
303
+ }
304
+ }
305
+ rect(i) {
306
+ const t = this._tabs[i];
307
+ return t ? [t.offsetLeft, t.offsetWidth] : [0, 0];
308
+ }
309
+ place() {
310
+ if (!this._ink)
311
+ return;
312
+ const [x, w] = this.rect(this._i);
313
+ this._ink.style.transform = `translateX(${x}px)`;
314
+ this._ink.style.width = `${w}px`;
315
+ }
316
+ sync(from) {
317
+ this._tabs.forEach((t, k) => {
318
+ t.setAttribute('aria-selected', String(k === this._i));
319
+ t.tabIndex = k === this._i ? 0 : -1;
320
+ });
321
+ this._panels.forEach((p, k) => (p.hidden = k !== this._i));
322
+ this.place();
323
+ if (from < 0 || from === this._i || !this._ink || this.reduced)
324
+ return;
325
+ // stretchy travel: the leading edge arrives first, the trailing edge follows
326
+ const [x0, w0] = this.rect(from);
327
+ const [x1, w1] = this.rect(this._i);
328
+ const right = x1 > x0;
329
+ const mid = right ? { transform: `translateX(${x0}px)`, width: `${x1 + w1 - x0}px` } : { transform: `translateX(${x1}px)`, width: `${x0 + w0 - x1}px` };
330
+ this.motion(this._ink, [{ transform: `translateX(${x0}px)`, width: `${w0}px` }, { ...mid, offset: 0.45 }, { transform: `translateX(${x1}px)`, width: `${w1}px` }], { duration: 480, easing: 'cubic-bezier(.22,1,.36,1)' });
331
+ const p = this._panels[this._i];
332
+ if (p)
333
+ this.motion(p, [{ opacity: 0, transform: `translateX(${right ? 24 : -24}px)` }, { opacity: 1, transform: 'none' }], { duration: 320, easing: 'cubic-bezier(.22,1,.36,1)' });
334
+ }
335
+ select(i) {
336
+ const n = Math.min(Math.max(0, Math.round(i)), this._tabs.length - 1);
337
+ if (n === this._i || n < 0)
338
+ return;
339
+ const from = this._i;
340
+ this._i = n;
341
+ this.sync(from);
342
+ this.emit('change', { index: n, from });
343
+ }
344
+ }
345
+ return UsaTabBar;
346
+ }, { id: 'tab-bar', text: css$2 });
347
+ }
348
+
349
+ var css$1 = "usa-disclosure{display:block;--usa-disclosure-accent:#7c5cff}usa-disclosure>details{border-bottom:1px solid rgba(127,127,127,.25);overflow:hidden}usa-disclosure>details>summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 4px;font-weight:600}usa-disclosure>details>summary::-webkit-details-marker{display:none}usa-disclosure>details>summary::after{content:\"\";flex:none;width:9px;height:9px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;rotate:45deg;translate:0 -3px;transition:rotate .35s cubic-bezier(.34,1.56,.64,1),translate .35s}usa-disclosure>details[open]>summary::after{rotate:225deg;translate:0 2px}usa-disclosure>details>summary:focus-visible{outline:2px solid var(--usa-disclosure-accent);outline-offset:2px;border-radius:6px}usa-disclosure>details>:not(summary){padding:0 4px 12px}usa-disclosure[variant=\"cards\"]>details{border:1px solid rgba(127,127,127,.25);border-radius:12px;margin-bottom:8px;padding:0 10px;transition:box-shadow .3s,border-color .3s}usa-disclosure[variant=\"cards\"]>details[open]{border-color:var(--usa-disclosure-accent);box-shadow:0 8px 24px rgba(124,92,255,.16)}@media (prefers-reduced-motion:reduce){usa-disclosure>details>summary::after{transition:none}}";
350
+
351
+ function defineDisclosure(tag = 'usa-disclosure') {
352
+ return base.defineElement(tag, (Base) => {
353
+ class UsaDisclosure extends Base {
354
+ constructor() {
355
+ super(...arguments);
356
+ this._anims = new WeakMap();
357
+ }
358
+ get items() {
359
+ return Array.from(this.children).filter((c) => c.localName === 'details');
360
+ }
361
+ mount() {
362
+ this.listen(this, 'click', (e) => {
363
+ const s = e.target.closest('summary');
364
+ const d = s?.parentElement;
365
+ if (!s || !d || d.parentElement !== this)
366
+ return;
367
+ e.preventDefault();
368
+ this.set(d, !d.open);
369
+ });
370
+ }
371
+ set(d, open) {
372
+ if (open && !this.flag('multiple'))
373
+ for (const o of this.items)
374
+ if (o !== d && o.open)
375
+ this.set(o, false);
376
+ if (d.open === open && !this._anims.get(d))
377
+ return;
378
+ const summary = d.querySelector('summary');
379
+ const closedH = summary ? summary.offsetHeight : 0;
380
+ const startH = d.offsetHeight;
381
+ this._anims.get(d)?.cancel();
382
+ if (open)
383
+ d.open = true;
384
+ const endH = open ? d.scrollHeight : closedH;
385
+ const sp = spring.springEasing(this.str('spring', 'gentle'));
386
+ const a = this.reduced ? null : this.motion(d, [{ height: `${startH}px` }, { height: `${endH}px` }], { duration: Math.min(sp.duration, 700), easing: sp.easing, fill: 'forwards' });
387
+ const body = Array.from(d.children).filter((c) => c.localName !== 'summary');
388
+ if (open && !this.reduced)
389
+ body.forEach((b) => this.motion(b, [{ opacity: 0, transform: 'translateY(-6px)' }, { opacity: 1, transform: 'none' }], { duration: 300, delay: 60, easing: 'ease-out' }));
390
+ const done = () => {
391
+ this._anims.delete(d);
392
+ if (!open)
393
+ d.open = false;
394
+ a?.cancel();
395
+ };
396
+ if (a) {
397
+ this._anims.set(d, a);
398
+ a.finished.then(() => this._anims.get(d) === a && done(), () => undefined);
399
+ }
400
+ else
401
+ done();
402
+ this.emit('toggle', { index: this.items.indexOf(d), open });
403
+ }
404
+ toggle(i, force) {
405
+ const d = this.items[i];
406
+ if (d)
407
+ this.set(d, force ?? !d.open);
408
+ }
409
+ openAll() {
410
+ this.items.forEach((d) => (d.open = true));
411
+ }
412
+ closeAll() {
413
+ this.items.forEach((d) => this.set(d, false));
414
+ }
415
+ }
416
+ return UsaDisclosure;
417
+ }, { id: 'disclosure', text: css$1 });
418
+ }
419
+
420
+ var css = "usa-stories{display:block;position:relative;overflow:hidden;border-radius:var(--usa-radius,16px);background:#111;color:#fff;aspect-ratio:9/14;max-height:520px;user-select:none;-webkit-user-select:none;touch-action:manipulation}usa-stories>:not([data-usa-part]){position:absolute;inset:0;opacity:0;transition:opacity .35s ease,transform .5s cubic-bezier(.22,1,.36,1);transform:scale(1.04);pointer-events:none;box-sizing:border-box}usa-stories>[data-active]:not([data-usa-part]){opacity:1;transform:none;pointer-events:auto}usa-stories>img:not([data-usa-part]){width:100%;height:100%;object-fit:cover}.usa-stories-bars{position:absolute;z-index:3;top:8px;left:8px;right:48px;display:flex;gap:4px}.usa-stories-bar{flex:1;height:3px;border-radius:3px;background:rgba(255,255,255,.35);overflow:hidden}.usa-stories-bar>i{display:block;height:100%;width:100%;background:#fff;transform-origin:left;transform:scaleX(0)}.usa-stories-bar[data-done]>i{transform:scaleX(1)}.usa-stories-toggle{position:absolute;z-index:3;top:2px;right:6px;width:36px;height:30px;border:0;background:none;color:#fff;font:700 14px/1 system-ui;cursor:pointer;border-radius:8px}.usa-stories-toggle:focus-visible{outline:2px solid #fff}@media (prefers-reduced-motion:reduce){usa-stories>*{transition:none!important;transform:none!important}}";
421
+
422
+ function defineStories(tag = 'usa-stories') {
423
+ return base.defineElement(tag, (Base) => {
424
+ class UsaStories extends Base {
425
+ constructor() {
426
+ super(...arguments);
427
+ this._i = 0;
428
+ this._items = [];
429
+ this._bars = [];
430
+ this._fill = null;
431
+ this._btn = null;
432
+ }
433
+ static get observedAttributes() {
434
+ return ['duration', 'loop'];
435
+ }
436
+ get index() {
437
+ return this._i;
438
+ }
439
+ mount() {
440
+ dropParts(this);
441
+ this._items = ownChildren(this);
442
+ const bars = part('div', 'usa-stories-bars', { 'aria-hidden': 'true' });
443
+ this._bars = this._items.map(() => {
444
+ const b = part('div', 'usa-stories-bar', {}, '<i></i>');
445
+ bars.append(b);
446
+ return b;
447
+ });
448
+ this._btn = part('button', 'usa-stories-toggle', { type: 'button' });
449
+ this.listen(this._btn, 'click', (e) => {
450
+ e.stopPropagation();
451
+ this.hasAttribute('paused') ? this.play() : this.pause();
452
+ });
453
+ this.append(bars, this._btn);
454
+ this.setAttribute('role', 'region');
455
+ this.setAttribute('aria-roledescription', 'stories');
456
+ if (!this.hasAttribute('aria-label'))
457
+ this.setAttribute('aria-label', 'Stories');
458
+ if (!this.hasAttribute('tabindex'))
459
+ this.tabIndex = 0;
460
+ if (this.reduced)
461
+ this.setAttribute('paused', '');
462
+ let held = false;
463
+ let downAt = 0;
464
+ this.listen(this, 'pointerdown', (e) => {
465
+ if (e.target.closest('button,a'))
466
+ return;
467
+ downAt = performance.now();
468
+ held = !this.hasAttribute('paused');
469
+ if (held)
470
+ this._fill?.pause();
471
+ });
472
+ this.listen(this, 'pointerup', (e) => {
473
+ if (e.target.closest('button,a') || !downAt)
474
+ return;
475
+ const long = performance.now() - downAt > 350;
476
+ downAt = 0;
477
+ if (held && !this.hasAttribute('paused'))
478
+ this._fill?.play();
479
+ if (long)
480
+ return;
481
+ const r = this.getBoundingClientRect();
482
+ e.clientX - r.left < r.width / 3 ? this.prev() : this.next();
483
+ });
484
+ this.listen(this, 'keydown', (e) => {
485
+ if (e.key === 'ArrowRight')
486
+ this.next();
487
+ else if (e.key === 'ArrowLeft')
488
+ this.prev();
489
+ else if (e.key === ' ')
490
+ (e.preventDefault(), this.hasAttribute('paused') ? this.play() : this.pause());
491
+ });
492
+ this.onCleanup(() => this._fill?.cancel());
493
+ this.goTo(Math.min(this._i, Math.max(0, this._items.length - 1)), true);
494
+ }
495
+ label() {
496
+ if (this._btn) {
497
+ const p = this.hasAttribute('paused');
498
+ this._btn.textContent = p ? '▶' : '❚❚';
499
+ this._btn.setAttribute('aria-label', p ? 'Play stories' : 'Pause stories');
500
+ }
501
+ }
502
+ goTo(i, initial = false) {
503
+ const n = this._items.length;
504
+ if (!n)
505
+ return;
506
+ if (i >= n && !this.flag('loop')) {
507
+ this.emit('end');
508
+ this.pause();
509
+ return;
510
+ }
511
+ const t = ((i % n) + n) % n;
512
+ const changed = t !== this._i || initial;
513
+ this._i = t;
514
+ this._items.forEach((s, k) => {
515
+ s.toggleAttribute('data-active', k === t);
516
+ s.setAttribute('aria-hidden', String(k !== t));
517
+ });
518
+ this._bars.forEach((b, k) => b.toggleAttribute('data-done', k < t));
519
+ this._fill?.cancel();
520
+ const fillEl = this._bars[t]?.firstElementChild;
521
+ this._fill = fillEl ? fillEl.animate?.([{ transform: 'scaleX(0)' }, { transform: 'scaleX(1)' }], { duration: Math.max(800, this.num('duration', 5000)), fill: 'forwards' }) ?? null : null;
522
+ if (this._fill) {
523
+ const a = this._fill;
524
+ a.onfinish = () => this._fill === a && this.goTo(this._i + 1);
525
+ if (this.hasAttribute('paused'))
526
+ a.pause();
527
+ }
528
+ this.label();
529
+ if (changed && !initial)
530
+ this.emit('change', { index: t });
531
+ }
532
+ next() {
533
+ this.goTo(this._i + 1);
534
+ }
535
+ prev() {
536
+ this.goTo(Math.max(0, this._i - 1));
537
+ }
538
+ pause() {
539
+ this.setAttribute('paused', '');
540
+ this._fill?.pause();
541
+ this.label();
542
+ }
543
+ play() {
544
+ this.removeAttribute('paused');
545
+ if (this._fill?.playState === 'finished')
546
+ this.goTo(this._i + 1 >= this._items.length ? 0 : this._i + 1);
547
+ else
548
+ this._fill?.play();
549
+ this.label();
550
+ }
551
+ }
552
+ return UsaStories;
553
+ }, { id: 'stories', text: css });
554
+ }
555
+
556
+ /**
557
+ * motionary/components/widgets — the 6.x animated UI widgets, in their own
558
+ * entry so `motionary/components` and `components/lite` keep their size
559
+ * budgets. Every widget is reduced-motion safe and keyboard accessible.
560
+ *
561
+ * ```ts
562
+ * import { defineWidgets } from 'motionary/components/widgets';
563
+ * defineWidgets(); // or defineCarousel(), defineTabBar(), …
564
+ * ```
565
+ * No build step: `<script src="https://unpkg.com/motionary@6/dist/widgets.umd.js">`
566
+ * (registers every widget and every 6.x effect pack; `window.UsaWidgets`).
567
+ */
568
+ /** The widgets by release (tag → define function). */
569
+ const WIDGETS = {
570
+ '6.2': { 'usa-carousel': defineCarousel, 'usa-tab-bar': defineTabBar, 'usa-disclosure': defineDisclosure, 'usa-stories': defineStories },
571
+ };
572
+ /** Every widget tag, in release order. */
573
+ const WIDGET_TAGS = Object.values(WIDGETS).flatMap((g) => Object.keys(g));
574
+ /** Register every widget (or only those of one release, e.g. `'6.2'`) under its default tag. */
575
+ function defineWidgets(release) {
576
+ for (const [v, group] of Object.entries(WIDGETS))
577
+ if (!release || release === v)
578
+ for (const [tag, fn] of Object.entries(group))
579
+ fn(tag);
580
+ }
581
+
582
+ exports.CAROUSEL_EFFECTS = CAROUSEL_EFFECTS;
583
+ exports.TAB_INDICATORS = TAB_INDICATORS;
584
+ exports.WIDGETS = WIDGETS;
585
+ exports.WIDGET_TAGS = WIDGET_TAGS;
586
+ exports.defineCarousel = defineCarousel;
587
+ exports.defineDisclosure = defineDisclosure;
588
+ exports.defineStories = defineStories;
589
+ exports.defineTabBar = defineTabBar;
590
+ exports.defineWidgets = defineWidgets;
591
+ //# sourceMappingURL=widgets.cjs.map