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