motionary 0.0.0-stage → 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 (374) hide show
  1. package/CHANGELOG.md +803 -0
  2. package/LICENSE +21 -0
  3. package/README.md +218 -2
  4. package/README_ja.md +219 -0
  5. package/README_zh.md +219 -0
  6. package/bin/usa-codemod-5.mjs +79 -0
  7. package/bin/usa-codemod-6.mjs +146 -0
  8. package/dist/chunks/base-BaQV-2ha.cjs +436 -0
  9. package/dist/chunks/base-BaQV-2ha.cjs.map +1 -0
  10. package/dist/chunks/base-C_3cAoRz.js +404 -0
  11. package/dist/chunks/base-C_3cAoRz.js.map +1 -0
  12. package/dist/chunks/bind-B_CTL6Qn.js +22 -0
  13. package/dist/chunks/bind-B_CTL6Qn.js.map +1 -0
  14. package/dist/chunks/bind-Ui43-n2d.cjs +25 -0
  15. package/dist/chunks/bind-Ui43-n2d.cjs.map +1 -0
  16. package/dist/chunks/core-B5T0dhFH.cjs +920 -0
  17. package/dist/chunks/core-B5T0dhFH.cjs.map +1 -0
  18. package/dist/chunks/core-BGAyaY6L.cjs +265 -0
  19. package/dist/chunks/core-BGAyaY6L.cjs.map +1 -0
  20. package/dist/chunks/core-D7cVumUu.js +909 -0
  21. package/dist/chunks/core-D7cVumUu.js.map +1 -0
  22. package/dist/chunks/core-VEBw36QK.js +260 -0
  23. package/dist/chunks/core-VEBw36QK.js.map +1 -0
  24. package/dist/chunks/core-ps8uvYuN.js +181 -0
  25. package/dist/chunks/core-ps8uvYuN.js.map +1 -0
  26. package/dist/chunks/core-zq17EeCI.cjs +185 -0
  27. package/dist/chunks/core-zq17EeCI.cjs.map +1 -0
  28. package/dist/chunks/fx-Bs6IrV4Q.js +109 -0
  29. package/dist/chunks/fx-Bs6IrV4Q.js.map +1 -0
  30. package/dist/chunks/fx-lBGVtQO1.cjs +114 -0
  31. package/dist/chunks/fx-lBGVtQO1.cjs.map +1 -0
  32. package/dist/chunks/generative-D2YyhaeO.js +336 -0
  33. package/dist/chunks/generative-D2YyhaeO.js.map +1 -0
  34. package/dist/chunks/generative-DzIZq-_g.cjs +348 -0
  35. package/dist/chunks/generative-DzIZq-_g.cjs.map +1 -0
  36. package/dist/chunks/gpu-Bu7qwugO.js +380 -0
  37. package/dist/chunks/gpu-Bu7qwugO.js.map +1 -0
  38. package/dist/chunks/gpu-CenK2l6b.cjs +387 -0
  39. package/dist/chunks/gpu-CenK2l6b.cjs.map +1 -0
  40. package/dist/chunks/index-tags-DucKMQr_.js +26 -0
  41. package/dist/chunks/index-tags-DucKMQr_.js.map +1 -0
  42. package/dist/chunks/index-tags-wv0R_vkO.cjs +28 -0
  43. package/dist/chunks/index-tags-wv0R_vkO.cjs.map +1 -0
  44. package/dist/chunks/presets-BYBVJVeP.js +226 -0
  45. package/dist/chunks/presets-BYBVJVeP.js.map +1 -0
  46. package/dist/chunks/presets-CUHys3sK.cjs +233 -0
  47. package/dist/chunks/presets-CUHys3sK.cjs.map +1 -0
  48. package/dist/chunks/registry-CKNLQpwd.js +121 -0
  49. package/dist/chunks/registry-CKNLQpwd.js.map +1 -0
  50. package/dist/chunks/registry-DehBVRDV.cjs +131 -0
  51. package/dist/chunks/registry-DehBVRDV.cjs.map +1 -0
  52. package/dist/chunks/spring-CbvHfVtP.js +219 -0
  53. package/dist/chunks/spring-CbvHfVtP.js.map +1 -0
  54. package/dist/chunks/spring-Dgx187Vh.cjs +232 -0
  55. package/dist/chunks/spring-Dgx187Vh.cjs.map +1 -0
  56. package/dist/chunks/stagger-CCFyhzSw.cjs +86 -0
  57. package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
  58. package/dist/chunks/stagger-DtMKo2SK.js +84 -0
  59. package/dist/chunks/stagger-DtMKo2SK.js.map +1 -0
  60. package/dist/chunks/variants-BhjyddG8.cjs +39 -0
  61. package/dist/chunks/variants-BhjyddG8.cjs.map +1 -0
  62. package/dist/chunks/variants-DRlKVHvu.js +35 -0
  63. package/dist/chunks/variants-DRlKVHvu.js.map +1 -0
  64. package/dist/components/a11y.cjs +276 -0
  65. package/dist/components/a11y.cjs.map +1 -0
  66. package/dist/components/a11y.d.cts +131 -0
  67. package/dist/components/a11y.d.ts +131 -0
  68. package/dist/components/a11y.js +259 -0
  69. package/dist/components/a11y.js.map +1 -0
  70. package/dist/components/angular.cjs +76 -0
  71. package/dist/components/angular.cjs.map +1 -0
  72. package/dist/components/angular.d.cts +1734 -0
  73. package/dist/components/angular.d.ts +1734 -0
  74. package/dist/components/angular.js +70 -0
  75. package/dist/components/angular.js.map +1 -0
  76. package/dist/components/background.cjs +659 -0
  77. package/dist/components/background.cjs.map +1 -0
  78. package/dist/components/background.css +9 -0
  79. package/dist/components/background.d.cts +166 -0
  80. package/dist/components/background.d.ts +166 -0
  81. package/dist/components/background.js +647 -0
  82. package/dist/components/background.js.map +1 -0
  83. package/dist/components/bridge.cjs +154 -0
  84. package/dist/components/bridge.cjs.map +1 -0
  85. package/dist/components/bridge.d.cts +63 -0
  86. package/dist/components/bridge.d.ts +63 -0
  87. package/dist/components/bridge.js +147 -0
  88. package/dist/components/bridge.js.map +1 -0
  89. package/dist/components/cards.cjs +561 -0
  90. package/dist/components/cards.cjs.map +1 -0
  91. package/dist/components/cards.css +6 -0
  92. package/dist/components/cards.d.cts +115 -0
  93. package/dist/components/cards.d.ts +115 -0
  94. package/dist/components/cards.js +554 -0
  95. package/dist/components/cards.js.map +1 -0
  96. package/dist/components/click.cjs +877 -0
  97. package/dist/components/click.cjs.map +1 -0
  98. package/dist/components/click.css +9 -0
  99. package/dist/components/click.d.cts +218 -0
  100. package/dist/components/click.d.ts +218 -0
  101. package/dist/components/click.js +863 -0
  102. package/dist/components/click.js.map +1 -0
  103. package/dist/components/depth.cjs +250 -0
  104. package/dist/components/depth.cjs.map +1 -0
  105. package/dist/components/depth.css +3 -0
  106. package/dist/components/depth.d.cts +86 -0
  107. package/dist/components/depth.d.ts +86 -0
  108. package/dist/components/depth.js +242 -0
  109. package/dist/components/depth.js.map +1 -0
  110. package/dist/components/effects.cjs +2258 -0
  111. package/dist/components/effects.cjs.map +1 -0
  112. package/dist/components/effects.d.cts +545 -0
  113. package/dist/components/effects.d.ts +545 -0
  114. package/dist/components/effects.js +2200 -0
  115. package/dist/components/effects.js.map +1 -0
  116. package/dist/components/feedback.cjs +442 -0
  117. package/dist/components/feedback.cjs.map +1 -0
  118. package/dist/components/feedback.css +7 -0
  119. package/dist/components/feedback.d.cts +144 -0
  120. package/dist/components/feedback.d.ts +144 -0
  121. package/dist/components/feedback.js +433 -0
  122. package/dist/components/feedback.js.map +1 -0
  123. package/dist/components/fx-gpu.cjs +12 -0
  124. package/dist/components/fx-gpu.cjs.map +1 -0
  125. package/dist/components/fx-gpu.d.cts +63 -0
  126. package/dist/components/fx-gpu.d.ts +63 -0
  127. package/dist/components/fx-gpu.js +5 -0
  128. package/dist/components/fx-gpu.js.map +1 -0
  129. package/dist/components/fx.cjs +169 -0
  130. package/dist/components/fx.cjs.map +1 -0
  131. package/dist/components/fx.css +3 -0
  132. package/dist/components/fx.d.cts +114 -0
  133. package/dist/components/fx.d.ts +114 -0
  134. package/dist/components/fx.js +156 -0
  135. package/dist/components/fx.js.map +1 -0
  136. package/dist/components/fx2.cjs +25 -0
  137. package/dist/components/fx2.cjs.map +1 -0
  138. package/dist/components/fx2.d.cts +136 -0
  139. package/dist/components/fx2.d.ts +136 -0
  140. package/dist/components/fx2.js +17 -0
  141. package/dist/components/fx2.js.map +1 -0
  142. package/dist/components/gesture.cjs +209 -0
  143. package/dist/components/gesture.cjs.map +1 -0
  144. package/dist/components/gesture.css +3 -0
  145. package/dist/components/gesture.d.cts +134 -0
  146. package/dist/components/gesture.d.ts +134 -0
  147. package/dist/components/gesture.js +203 -0
  148. package/dist/components/gesture.js.map +1 -0
  149. package/dist/components/interaction.cjs +424 -0
  150. package/dist/components/interaction.cjs.map +1 -0
  151. package/dist/components/interaction.css +8 -0
  152. package/dist/components/interaction.d.cts +115 -0
  153. package/dist/components/interaction.d.ts +115 -0
  154. package/dist/components/interaction.js +416 -0
  155. package/dist/components/interaction.js.map +1 -0
  156. package/dist/components/jsx.cjs +3 -0
  157. package/dist/components/jsx.cjs.map +1 -0
  158. package/dist/components/jsx.d.cts +53 -0
  159. package/dist/components/jsx.d.ts +53 -0
  160. package/dist/components/jsx.js +2 -0
  161. package/dist/components/jsx.js.map +1 -0
  162. package/dist/components/layout.cjs +257 -0
  163. package/dist/components/layout.cjs.map +1 -0
  164. package/dist/components/layout.css +3 -0
  165. package/dist/components/layout.d.cts +99 -0
  166. package/dist/components/layout.d.ts +99 -0
  167. package/dist/components/layout.js +249 -0
  168. package/dist/components/layout.js.map +1 -0
  169. package/dist/components/lazy.cjs +92 -0
  170. package/dist/components/lazy.cjs.map +1 -0
  171. package/dist/components/lazy.d.cts +48 -0
  172. package/dist/components/lazy.d.ts +48 -0
  173. package/dist/components/lazy.js +87 -0
  174. package/dist/components/lazy.js.map +1 -0
  175. package/dist/components/lite.cjs +11095 -0
  176. package/dist/components/lite.cjs.map +1 -0
  177. package/dist/components/lite.d.cts +4 -0
  178. package/dist/components/lite.d.ts +4 -0
  179. package/dist/components/lite.js +10827 -0
  180. package/dist/components/lite.js.map +1 -0
  181. package/dist/components/packs.cjs +192 -0
  182. package/dist/components/packs.cjs.map +1 -0
  183. package/dist/components/packs.css +3 -0
  184. package/dist/components/packs.d.cts +72 -0
  185. package/dist/components/packs.d.ts +72 -0
  186. package/dist/components/packs.js +184 -0
  187. package/dist/components/packs.js.map +1 -0
  188. package/dist/components/page.cjs +824 -0
  189. package/dist/components/page.cjs.map +1 -0
  190. package/dist/components/page.css +11 -0
  191. package/dist/components/page.d.cts +249 -0
  192. package/dist/components/page.d.ts +249 -0
  193. package/dist/components/page.js +799 -0
  194. package/dist/components/page.js.map +1 -0
  195. package/dist/components/perf.cjs +120 -0
  196. package/dist/components/perf.cjs.map +1 -0
  197. package/dist/components/perf.d.cts +98 -0
  198. package/dist/components/perf.d.ts +98 -0
  199. package/dist/components/perf.js +110 -0
  200. package/dist/components/perf.js.map +1 -0
  201. package/dist/components/physics.cjs +448 -0
  202. package/dist/components/physics.cjs.map +1 -0
  203. package/dist/components/physics.css +5 -0
  204. package/dist/components/physics.d.cts +189 -0
  205. package/dist/components/physics.d.ts +189 -0
  206. package/dist/components/physics.js +430 -0
  207. package/dist/components/physics.js.map +1 -0
  208. package/dist/components/react.cjs +96 -0
  209. package/dist/components/react.cjs.map +1 -0
  210. package/dist/components/react.d.cts +18 -0
  211. package/dist/components/react.d.ts +18 -0
  212. package/dist/components/react.js +91 -0
  213. package/dist/components/react.js.map +1 -0
  214. package/dist/components/reveal.cjs +362 -0
  215. package/dist/components/reveal.cjs.map +1 -0
  216. package/dist/components/reveal.css +5 -0
  217. package/dist/components/reveal.d.cts +105 -0
  218. package/dist/components/reveal.d.ts +105 -0
  219. package/dist/components/reveal.js +353 -0
  220. package/dist/components/reveal.js.map +1 -0
  221. package/dist/components/solid.cjs +86 -0
  222. package/dist/components/solid.cjs.map +1 -0
  223. package/dist/components/solid.d.cts +1751 -0
  224. package/dist/components/solid.d.ts +1751 -0
  225. package/dist/components/solid.js +82 -0
  226. package/dist/components/solid.js.map +1 -0
  227. package/dist/components/svelte.cjs +68 -0
  228. package/dist/components/svelte.cjs.map +1 -0
  229. package/dist/components/svelte.d.cts +1733 -0
  230. package/dist/components/svelte.d.ts +1733 -0
  231. package/dist/components/svelte.js +64 -0
  232. package/dist/components/svelte.js.map +1 -0
  233. package/dist/components/svg.cjs +359 -0
  234. package/dist/components/svg.cjs.map +1 -0
  235. package/dist/components/svg.css +3 -0
  236. package/dist/components/svg.d.cts +113 -0
  237. package/dist/components/svg.d.ts +113 -0
  238. package/dist/components/svg.js +347 -0
  239. package/dist/components/svg.js.map +1 -0
  240. package/dist/components/text.cjs +968 -0
  241. package/dist/components/text.cjs.map +1 -0
  242. package/dist/components/text.css +8 -0
  243. package/dist/components/text.d.cts +342 -0
  244. package/dist/components/text.d.ts +342 -0
  245. package/dist/components/text.js +947 -0
  246. package/dist/components/text.js.map +1 -0
  247. package/dist/components/timeline.cjs +109 -0
  248. package/dist/components/timeline.cjs.map +1 -0
  249. package/dist/components/timeline.css +3 -0
  250. package/dist/components/timeline.d.cts +155 -0
  251. package/dist/components/timeline.d.ts +155 -0
  252. package/dist/components/timeline.js +103 -0
  253. package/dist/components/timeline.js.map +1 -0
  254. package/dist/components/tokens.cjs +226 -0
  255. package/dist/components/tokens.cjs.map +1 -0
  256. package/dist/components/tokens.d.cts +74 -0
  257. package/dist/components/tokens.d.ts +74 -0
  258. package/dist/components/tokens.js +211 -0
  259. package/dist/components/tokens.js.map +1 -0
  260. package/dist/components/transitions.cjs +430 -0
  261. package/dist/components/transitions.cjs.map +1 -0
  262. package/dist/components/transitions.css +5 -0
  263. package/dist/components/transitions.d.cts +126 -0
  264. package/dist/components/transitions.d.ts +126 -0
  265. package/dist/components/transitions.js +423 -0
  266. package/dist/components/transitions.js.map +1 -0
  267. package/dist/components/ui.cjs +1050 -0
  268. package/dist/components/ui.cjs.map +1 -0
  269. package/dist/components/ui.css +14 -0
  270. package/dist/components/ui.d.cts +224 -0
  271. package/dist/components/ui.d.ts +224 -0
  272. package/dist/components/ui.js +1034 -0
  273. package/dist/components/ui.js.map +1 -0
  274. package/dist/components/vue.cjs +67 -0
  275. package/dist/components/vue.cjs.map +1 -0
  276. package/dist/components/vue.d.cts +1722 -0
  277. package/dist/components/vue.d.ts +1722 -0
  278. package/dist/components/vue.js +64 -0
  279. package/dist/components/vue.js.map +1 -0
  280. package/dist/components/webgl.cjs +459 -0
  281. package/dist/components/webgl.cjs.map +1 -0
  282. package/dist/components/webgl.css +3 -0
  283. package/dist/components/webgl.d.cts +133 -0
  284. package/dist/components/webgl.d.ts +133 -0
  285. package/dist/components/webgl.js +442 -0
  286. package/dist/components/webgl.js.map +1 -0
  287. package/dist/components/widgets.cjs +591 -0
  288. package/dist/components/widgets.cjs.map +1 -0
  289. package/dist/components/widgets.d.cts +110 -0
  290. package/dist/components/widgets.d.ts +110 -0
  291. package/dist/components/widgets.js +581 -0
  292. package/dist/components/widgets.js.map +1 -0
  293. package/dist/components.cjs +351 -0
  294. package/dist/components.cjs.map +1 -0
  295. package/dist/components.css +75 -0
  296. package/dist/components.d.cts +2997 -0
  297. package/dist/components.d.ts +2997 -0
  298. package/dist/components.js +106 -0
  299. package/dist/components.js.map +1 -0
  300. package/dist/components.umd.js +23 -0
  301. package/dist/components.umd.js.map +1 -0
  302. package/dist/element.cjs +97 -0
  303. package/dist/element.cjs.map +1 -0
  304. package/dist/element.d.cts +215 -0
  305. package/dist/element.d.ts +215 -0
  306. package/dist/element.js +95 -0
  307. package/dist/element.js.map +1 -0
  308. package/dist/element.umd.js +2 -0
  309. package/dist/element.umd.js.map +1 -0
  310. package/dist/index.cjs +149 -0
  311. package/dist/index.cjs.map +1 -0
  312. package/dist/index.d.cts +425 -0
  313. package/dist/index.d.ts +425 -0
  314. package/dist/index.js +131 -0
  315. package/dist/index.js.map +1 -0
  316. package/dist/index.umd.js +15 -0
  317. package/dist/index.umd.js.map +1 -0
  318. package/dist/presets/extended.cjs +243 -0
  319. package/dist/presets/extended.cjs.map +1 -0
  320. package/dist/presets/extended.d.cts +37 -0
  321. package/dist/presets/extended.d.ts +37 -0
  322. package/dist/presets/extended.js +239 -0
  323. package/dist/presets/extended.js.map +1 -0
  324. package/dist/presets-extended.umd.js +2 -0
  325. package/dist/presets-extended.umd.js.map +1 -0
  326. package/dist/react.cjs +68 -0
  327. package/dist/react.cjs.map +1 -0
  328. package/dist/react.d.cts +158 -0
  329. package/dist/react.d.ts +158 -0
  330. package/dist/react.js +65 -0
  331. package/dist/react.js.map +1 -0
  332. package/dist/solid.cjs +93 -0
  333. package/dist/solid.cjs.map +1 -0
  334. package/dist/solid.d.cts +249 -0
  335. package/dist/solid.d.ts +249 -0
  336. package/dist/solid.js +89 -0
  337. package/dist/solid.js.map +1 -0
  338. package/dist/svelte.cjs +66 -0
  339. package/dist/svelte.cjs.map +1 -0
  340. package/dist/svelte.d.cts +243 -0
  341. package/dist/svelte.d.ts +243 -0
  342. package/dist/svelte.js +63 -0
  343. package/dist/svelte.js.map +1 -0
  344. package/dist/vue.cjs +62 -0
  345. package/dist/vue.cjs.map +1 -0
  346. package/dist/vue.d.cts +158 -0
  347. package/dist/vue.d.ts +158 -0
  348. package/dist/vue.js +60 -0
  349. package/dist/vue.js.map +1 -0
  350. package/dist/widgets.umd.js +2 -0
  351. package/dist/widgets.umd.js.map +1 -0
  352. package/docs/API.md +147 -0
  353. package/docs/ROADMAP.md +14 -0
  354. package/docs/accessibility.md +60 -0
  355. package/docs/components.md +564 -0
  356. package/docs/deprecations.md +30 -0
  357. package/docs/frameworks-ssr.md +100 -0
  358. package/docs/hybrid-apps.md +145 -0
  359. package/docs/images/showcase-detail.png +0 -0
  360. package/docs/images/showcase-grid.png +0 -0
  361. package/docs/images/showcase-mobile.png +0 -0
  362. package/docs/migration-from-aos.md +67 -0
  363. package/docs/migration-from-gsap-scrolltrigger.md +80 -0
  364. package/docs/motion-tokens.css +31 -0
  365. package/docs/motion-tokens.md +46 -0
  366. package/docs/motion.tokens.json +132 -0
  367. package/docs/performance.md +24 -0
  368. package/docs/presets.md +310 -0
  369. package/docs/upgrading-3.md +21 -0
  370. package/docs/upgrading-4.md +65 -0
  371. package/docs/upgrading-5.md +31 -0
  372. package/docs/upgrading-6.md +32 -0
  373. package/docs/windows-apps.md +119 -0
  374. package/package.json +562 -4
@@ -0,0 +1,1751 @@
1
+ type MotionIntensity = 'low' | 'normal' | 'high';
2
+ /**
3
+ * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup
4
+ * bag that is emptied on disconnect, and motion helpers that degrade to the
5
+ * final state without WAAPI or under reduced motion.
6
+ */
7
+ interface UsaElement extends HTMLElement {
8
+ /** `true` while reduced motion applies to this element. */
9
+ readonly reduced: boolean;
10
+ }
11
+
12
+ /** Entrance effects shared by `<usa-reveal>` and `<usa-stagger>` (transform / opacity / filter only). */
13
+ declare const REVEAL_EFFECTS: readonly ["fade", "fade-up", "fade-down", "fade-left", "fade-right", "zoom-in", "zoom-out", "blur", "blur-up", "flip-up", "flip-left", "rise"];
14
+ type RevealEffect = (typeof REVEAL_EFFECTS)[number];
15
+
16
+ /**
17
+ * `<usa-reveal>` — reveals its content when it scrolls into view.
18
+ *
19
+ * Attributes: `effect` (see {@link RevealEffect}, default `fade-up`),
20
+ * `duration` (ms, 700), `delay` (ms, 0), `distance` (px, 32), `easing`,
21
+ * `threshold` (0–1, 0.15), `root-margin`, `repeat` (hide again when it
22
+ * leaves, replay on re-entry). Events: `usa:enter`, `usa:leave`, `usa:complete`.
23
+ */
24
+ interface UsaRevealElement extends UsaElement {
25
+ effect: RevealEffect | string;
26
+ /** Play the entrance now (also called automatically on enter). */
27
+ reveal(): Promise<void>;
28
+ /** Hide again so the next `reveal()` replays the entrance. */
29
+ reset(): void;
30
+ readonly revealed: boolean;
31
+ }
32
+
33
+ /**
34
+ * `<usa-stagger>` — reveals its direct children one after another when the
35
+ * list scrolls into view.
36
+ *
37
+ * Attributes: `effect` (default `fade-up`), `interval` (ms between children,
38
+ * 70), `duration` (600), `delay` (0), `distance` (24), `easing`,
39
+ * `threshold` (0.1), `repeat`. Events: `usa:enter`, `usa:complete`.
40
+ */
41
+ interface UsaStaggerElement extends UsaElement {
42
+ reveal(): Promise<void>;
43
+ reset(): void;
44
+ }
45
+
46
+ /**
47
+ * `<usa-scroll-progress>` — a reading-progress bar.
48
+ *
49
+ * Attributes: `target` (CSS selector of an article to track; default the
50
+ * whole page), `position` (`top` | `bottom` | `inline`, default `top`),
51
+ * `label` (accessible name, default "Reading progress"). Style with
52
+ * `--usa-progress-color`, `--usa-progress-height`, `--usa-progress-track`.
53
+ * Exposes the progress (0–1) as `--usa-progress` on the element and as the
54
+ * `progress` property. Event: `usa:progress` (`detail.progress`).
55
+ *
56
+ * Writes only `transform: scaleX()` (compositor-friendly); reads layout
57
+ * once per animation frame, and only while scrolling.
58
+ */
59
+ interface UsaScrollProgressElement extends UsaElement {
60
+ readonly progress: number;
61
+ /** Re-measure (e.g. after content loaded). */
62
+ update(): void;
63
+ }
64
+
65
+ /**
66
+ * `<usa-scrolly>` — sticky scrollytelling. A child marked `data-sticky`
67
+ * stays pinned while the `[data-step]` children scroll past; the step that
68
+ * crosses the trigger line becomes active.
69
+ *
70
+ * Attributes: `offset` (trigger line as a fraction of the viewport height,
71
+ * default 0.5), `active` (reflected index of the active step). The active
72
+ * step gets `data-active`; the host gets `--usa-step` and `data-step-name`
73
+ * (the step's `data-step` value). Event: `usa:step` (`detail.index`,
74
+ * `detail.step`, `detail.name`).
75
+ */
76
+ interface UsaScrollyElement extends UsaElement {
77
+ readonly active: number;
78
+ readonly steps: HTMLElement[];
79
+ }
80
+
81
+ /**
82
+ * motionary/components/reveal — entrance & scroll reveal components.
83
+ * `<usa-reveal>`, `<usa-stagger>`, `<usa-scroll-progress>`, `<usa-scrolly>`.
84
+ */
85
+
86
+ declare global {
87
+ interface HTMLElementTagNameMap {
88
+ 'usa-reveal': UsaRevealElement;
89
+ 'usa-stagger': UsaStaggerElement;
90
+ 'usa-scroll-progress': UsaScrollProgressElement;
91
+ 'usa-scrolly': UsaScrollyElement;
92
+ }
93
+ }
94
+
95
+ /**
96
+ * `<usa-typewriter>` — types text character by character, optionally cycling
97
+ * through several phrases (typing, pausing, deleting).
98
+ *
99
+ * Attributes: `text` (default: the element's text), `words` (phrases
100
+ * separated by `|`, overrides `text`), `speed` (ms per character, 55),
101
+ * `delete-speed` (ms, 30), `pause` (ms before deleting, 1400), `delay`
102
+ * (ms, 0), `loop`, `cursor="false"` to hide the caret, `start`
103
+ * (`view` | `load` | `manual`, default `view`). The full text is exposed to
104
+ * assistive tech via `aria-label`. Event: `usa:complete` (one pass done).
105
+ * Reduced motion: the text appears at once.
106
+ */
107
+ interface UsaTypewriterElement extends UsaElement {
108
+ /** Phrases being typed. */
109
+ readonly phrases: string[];
110
+ start(): void;
111
+ stop(): void;
112
+ restart(): void;
113
+ }
114
+
115
+ /**
116
+ * `<usa-split-text>` — splits its text into words or characters and reveals
117
+ * them in a cascade (pure CSS animation per unit, transform / opacity /
118
+ * filter only). Words never break across lines.
119
+ *
120
+ * 4.3: `Intl.Segmenter`-aware (emoji, CJK words), Arabic-script words are
121
+ * never split below the word, `by="lines"` reveals line by line, and `from`
122
+ * (`start` · `end` · `center` · `edges` · `random`) sets the cascade order.
123
+ *
124
+ * Attributes: `by` (`chars` | `words` | `lines`, default `chars`), `effect`
125
+ * (`rise` | `fade` | `blur` | `flip` | `pop`, default `rise`), `stagger`
126
+ * (ms between units, 28 for chars / 70 for words), `duration` (ms, 620),
127
+ * `delay` (ms, 0), `trigger` (`view` | `load` | `manual`, default `view`),
128
+ * `repeat`. The original text stays readable via `aria-label`.
129
+ * Event: `usa:complete`.
130
+ */
131
+ interface UsaSplitTextElement extends UsaElement {
132
+ readonly units: HTMLElement[];
133
+ play(): void;
134
+ reset(): void;
135
+ }
136
+
137
+ /**
138
+ * `<usa-scramble>` — "decodes" text out of random glyphs, left to right.
139
+ *
140
+ * Attributes: `text` (default: the element's text), `duration` (ms, 900),
141
+ * `chars` (glyph set), `trigger` (`view` | `hover` | `load` | `manual`,
142
+ * default `view`). Spaces and punctuation stay in place. Uses a monospace-
143
+ * friendly fixed width per glyph only if you style it so; the element sets
144
+ * nothing that causes reflow beyond its own text. Event: `usa:complete`.
145
+ * Reduced motion: shows the final text.
146
+ */
147
+ interface UsaScrambleElement extends UsaElement {
148
+ play(): Promise<void>;
149
+ }
150
+
151
+ /**
152
+ * `<usa-counter>` — counts up (or down) to a number when it scrolls into view.
153
+ *
154
+ * Attributes: `to` (target, required), `from` (0), `duration` (ms, 1600),
155
+ * `decimals` (0), `locale` (default: the document language), `prefix`,
156
+ * `suffix`, `grouping="false"` (no thousands separators), `start`
157
+ * (`view` | `load` | `manual`). Setting the `value` property animates from
158
+ * the current value — handy for live dashboards. Uses tabular digits so
159
+ * the width does not jump. Event: `usa:complete`. Reduced motion: jumps.
160
+ */
161
+ interface UsaCounterElement extends UsaElement {
162
+ /** Current target; setting it animates to the new number. */
163
+ value: number;
164
+ /** Animate to `to` (default: the `to` attribute). */
165
+ play(to?: number): Promise<void>;
166
+ format(n: number): string;
167
+ }
168
+
169
+ /**
170
+ * `<usa-shimmer-text>` — a light sweep across gradient-filled text (CSS
171
+ * only; the element just maps attributes to custom properties).
172
+ *
173
+ * Attributes: `duration` (ms, 2600), `color` (base text colour), `shine`
174
+ * (highlight colour), `angle` (deg, 110). Or style `--usa-shimmer-*`
175
+ * directly. Reduced motion: static gradient text.
176
+ */
177
+ type UsaShimmerTextElement = UsaElement;
178
+
179
+ /**
180
+ * `<usa-text-rotate>` — cycles through words in place ("Build *fast* /
181
+ * *small* / *typed* apps"). All words share one grid cell, so the width is
182
+ * that of the longest word and nothing around it reflows.
183
+ *
184
+ * Attributes: `words` (separated by `|`, default: the element's text split
185
+ * on `|`), `interval` (ms, 2200), `effect` (`slide` | `fade` | `flip` |
186
+ * `blur`, default `slide`), `paused`. Pauses while off-screen and on hover
187
+ * is not needed. Event: `usa:change` (`detail.index`, `detail.word`).
188
+ * Reduced motion: words still change, without movement (fade only).
189
+ */
190
+ interface UsaTextRotateElement extends UsaElement {
191
+ readonly index: number;
192
+ next(): void;
193
+ }
194
+
195
+ /**
196
+ * `<usa-wave-text>` — letters bob in a travelling wave.
197
+ * Attributes: `amplitude` (em, 0.25), `speed` (s per cycle, 1.6), `stagger`
198
+ * (s between letters, 0.06). Reduced motion: still text.
199
+ */
200
+ interface UsaWaveTextElement extends UsaElement {
201
+ }
202
+ /**
203
+ * `<usa-glitch>` — an RGB-split glitch on its text (`trigger="always"`
204
+ * default, or `hover`). Attributes: `intensity` (px, 3), `trigger`.
205
+ * Reduced motion: no animation (plain text).
206
+ */
207
+ interface UsaGlitchElement extends UsaElement {
208
+ }
209
+ /**
210
+ * `<usa-gradient-text>` — text filled with a flowing multi-colour gradient.
211
+ * Attributes: `colors` (comma list), `speed` (s, 6), `angle` (deg, 90).
212
+ * Reduced motion: a static gradient.
213
+ */
214
+ interface UsaGradientTextElement extends UsaElement {
215
+ }
216
+ /**
217
+ * `<usa-handwriting>` — the text draws itself stroke by stroke (SVG text
218
+ * outline), then fills in, when it scrolls into view.
219
+ * Attributes: `text`, `duration` (ms, 2400), `stroke` (colour), `size` (px,
220
+ * 64), `font` (family; a script font looks best). Events: `usa:complete`.
221
+ * Reduced motion: the filled text appears at once.
222
+ */
223
+ interface UsaHandwritingElement extends UsaElement {
224
+ play(): void;
225
+ }
226
+ /**
227
+ * `<usa-scroll-highlight>` — reading highlight: words light up one by one
228
+ * as the paragraph scrolls through the viewport (`mode="words"`, default),
229
+ * or a highlighter marker sweeps behind the text on enter (`mode="marker"`).
230
+ * Attributes: `mode`, `color` (marker), `dim` (opacity of unread words,
231
+ * 0.2). Reduced motion: fully highlighted text.
232
+ */
233
+ interface UsaScrollHighlightElement extends UsaElement {
234
+ readonly progress: number;
235
+ }
236
+
237
+ /**
238
+ * Where a step starts on a timeline:
239
+ * - a number: absolute time in ms
240
+ * - `'>'` (default): when the previous step ends · `'<'`: when it starts
241
+ * - `'+=200'` / `'-=200'`: after / overlapping the previous end
242
+ * - `'<+=100'`: 100ms after the previous step's start
243
+ * - `'intro'` / `'intro+=150'`: at (or relative to) a label
244
+ */
245
+ type TimelinePosition = number | string;
246
+ interface TimelineStepOptions {
247
+ /** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
248
+ duration?: number | string;
249
+ /** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
250
+ easing?: string;
251
+ /** Start position, see `TimelinePosition`. */
252
+ at?: TimelinePosition;
253
+ /** ms between targets when the selector matches several elements. */
254
+ stagger?: number;
255
+ }
256
+ interface ScrubOptions {
257
+ /** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
258
+ offset?: number;
259
+ /** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
260
+ smooth?: number;
261
+ /**
262
+ * 4.1: which progress source drives the timeline.
263
+ * - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
264
+ * - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
265
+ */
266
+ source?: 'view' | 'scroll';
267
+ /** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
268
+ engine?: 'auto' | 'native' | 'js';
269
+ /** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
270
+ axis?: 'block' | 'inline' | 'x' | 'y';
271
+ }
272
+ /** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
273
+ interface ScrubHandle {
274
+ (): void;
275
+ /** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
276
+ readonly native: boolean;
277
+ }
278
+ interface Timeline {
279
+ /** Total length in ms. */
280
+ readonly duration: number;
281
+ /** Label positions in ms. */
282
+ readonly labels: Readonly<Record<string, number>>;
283
+ /** Current playhead in ms. */
284
+ readonly time: number;
285
+ /** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
286
+ to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
287
+ /** Name a position (default: the current end). */
288
+ label(name: string, at?: TimelinePosition): Timeline;
289
+ /** Run `fn` when the playhead passes `at`. */
290
+ call(fn: () => void, at?: TimelinePosition): Timeline;
291
+ /** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
292
+ play(from?: TimelinePosition): Promise<void>;
293
+ /** Play backwards to 0. */
294
+ reverse(): Promise<void>;
295
+ pause(): Timeline;
296
+ /** Jump to a time (ms) or label. */
297
+ seek(to: TimelinePosition): Timeline;
298
+ /** Get or set progress 0–1. */
299
+ progress(p?: number): number;
300
+ /**
301
+ * Tie progress to scroll: `source` moving through the viewport (or, with
302
+ * `{ source: 'scroll' }`, a scroll container's own position). Runs on native
303
+ * ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
304
+ * `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
305
+ * Returns a stop function with a `native` flag.
306
+ */
307
+ scrub(source: Element, options?: ScrubOptions): ScrubHandle;
308
+ /** Stop and drop every animation (elements keep their last frame). */
309
+ cancel(): void;
310
+ }
311
+
312
+ /**
313
+ * motionary/components/text — text effects.
314
+ * `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
315
+ * `<usa-shimmer-text>`, `<usa-text-rotate>`.
316
+ */
317
+
318
+ declare global {
319
+ interface HTMLElementTagNameMap {
320
+ 'usa-wave-text': UsaWaveTextElement;
321
+ 'usa-glitch': UsaGlitchElement;
322
+ 'usa-gradient-text': UsaGradientTextElement;
323
+ 'usa-handwriting': UsaHandwritingElement;
324
+ 'usa-scroll-highlight': UsaScrollHighlightElement;
325
+ 'usa-typewriter': UsaTypewriterElement;
326
+ 'usa-split-text': UsaSplitTextElement;
327
+ 'usa-scramble': UsaScrambleElement;
328
+ 'usa-counter': UsaCounterElement;
329
+ 'usa-shimmer-text': UsaShimmerTextElement;
330
+ 'usa-text-rotate': UsaTextRotateElement;
331
+ }
332
+ }
333
+
334
+ /**
335
+ * `<usa-ripple>` — an ink ripple from the pointer (or the centre, for
336
+ * keyboard presses) on whatever it wraps: buttons, list items, cards.
337
+ *
338
+ * Attributes: `color` (default `currentColor`), `opacity` (0.22),
339
+ * `duration` (ms, 550), `centered`, `disabled`. Clips its content to its
340
+ * own border radius. Reduced motion: a brief highlight instead of the wave.
341
+ */
342
+ interface UsaRippleElement extends UsaElement {
343
+ /** Spawn a ripple at client coordinates (default: centre). */
344
+ ripple(x?: number, y?: number): void;
345
+ }
346
+
347
+ /**
348
+ * `<usa-magnetic>` — its content leans toward the pointer when the pointer
349
+ * comes near, and springs back when it leaves (great for CTAs and icons).
350
+ *
351
+ * Attributes: `strength` (0–1 share of the pointer offset, 0.35), `radius`
352
+ * (px of attraction beyond the element's edge, 60), `disabled`. Only on
353
+ * devices with a fine pointer that hovers; off under reduced motion.
354
+ * Writes one `transform` per frame through `--usa-mx` / `--usa-my`.
355
+ */
356
+ type UsaMagneticElement = UsaElement;
357
+
358
+ /**
359
+ * `<usa-tilt>` — a 3D card that tilts toward the pointer, with an optional
360
+ * glare highlight that follows it.
361
+ *
362
+ * Attributes: `max` (deg, 10), `scale` (1.03 while hovered), `perspective`
363
+ * (px, 900), `glare` (add the light reflection), `reverse` (tilt away),
364
+ * `disabled`. Off under reduced motion. Exposes `--usa-tilt-x` /
365
+ * `--usa-tilt-y` (−1…1) for parallax layers inside the card.
366
+ */
367
+ type UsaTiltElement = UsaElement;
368
+
369
+ /**
370
+ * `<usa-spotlight>` — the Windows Fluent "Reveal highlight": a soft light
371
+ * follows the pointer across a group of items, lighting up their borders
372
+ * (even of neighbours) and the background of the hovered one. Put buttons,
373
+ * tiles or menu items inside; each direct child is an item (or mark items
374
+ * with `data-spotlight` to pick them yourself).
375
+ *
376
+ * Attributes: `size` (px, radius of the light, 160), `color` (default a
377
+ * translucent white), `border` (px width of the lit border, 1),
378
+ * `no-fill` (only light the borders). Not a motion effect, so it stays on
379
+ * under reduced motion; off on touch-only devices.
380
+ */
381
+ type UsaSpotlightElement = UsaElement;
382
+
383
+ /**
384
+ * `<usa-press>` — tactile press feedback: content dips while pressed and
385
+ * springs back on release (the Fluent "pointer down" scale), or bounces once
386
+ * on click with `bounce`.
387
+ *
388
+ * Attributes: `scale` (pressed scale, 0.95), `bounce` (overshoot on
389
+ * release), `disabled`. Works with mouse, touch, pen and Space/Enter.
390
+ * Reduced motion: a subtle dim instead of scaling.
391
+ */
392
+ interface UsaPressElement extends UsaElement {
393
+ readonly pressed: boolean;
394
+ }
395
+
396
+ /**
397
+ * `<usa-toggle>` — an accessible switch whose knob stretches while pressed
398
+ * and glides across (the Windows 11 / iOS toggle). `role="switch"`,
399
+ * keyboard (Space / Enter), and form-associated where `ElementInternals`
400
+ * exists (submits `value`, default `"on"`, under `name` when checked).
401
+ *
402
+ * Attributes: `checked`, `disabled`, `name`, `value`, `label`
403
+ * (accessible name if there is no `aria-label` / `<label>`). Events:
404
+ * `change` and `usa:change` (`detail.checked`). Reduced motion: no glide.
405
+ */
406
+ interface UsaToggleElement extends UsaElement {
407
+ checked: boolean;
408
+ disabled: boolean;
409
+ toggle(force?: boolean): void;
410
+ }
411
+
412
+ /**
413
+ * motionary/components/interaction — micro-interactions.
414
+ * `<usa-ripple>`, `<usa-magnetic>`, `<usa-tilt>`, `<usa-spotlight>`,
415
+ * `<usa-press>`, `<usa-toggle>`.
416
+ */
417
+
418
+ declare global {
419
+ interface HTMLElementTagNameMap {
420
+ 'usa-ripple': UsaRippleElement;
421
+ 'usa-magnetic': UsaMagneticElement;
422
+ 'usa-tilt': UsaTiltElement;
423
+ 'usa-spotlight': UsaSpotlightElement;
424
+ 'usa-press': UsaPressElement;
425
+ 'usa-toggle': UsaToggleElement;
426
+ }
427
+ }
428
+
429
+ declare const SPINNER_VARIANTS: readonly ["fluent", "windows", "ring", "dots", "pulse", "bars"];
430
+ type SpinnerVariant = (typeof SPINNER_VARIANTS)[number];
431
+ /**
432
+ * `<usa-spinner>` — indeterminate loading indicators, pure CSS animations
433
+ * of `transform` / `opacity` (plus an SVG stroke for `fluent`).
434
+ *
435
+ * Kinds (`kind`): `fluent` (default — the WinUI / Windows 11
436
+ * ProgressRing arc), `windows` (the Windows 10 boot "orbiting dots"),
437
+ * `ring` (classic border spinner), `dots` (three bouncing dots / typing
438
+ * indicator), `pulse` (expanding ripple), `bars` (equalizer).
439
+ * Attributes: `size` (px, 32), `label` (accessible name, "Loading"),
440
+ * `paused`. Colour follows `color` / `--usa-spinner-color`.
441
+ * `role="progressbar"` without a value (indeterminate). Reduced motion:
442
+ * a slow opacity pulse instead of movement.
443
+ */
444
+ interface UsaSpinnerElement extends UsaElement {
445
+ /** Spinner kind (`kind` attribute). */
446
+ kind: SpinnerVariant;
447
+ }
448
+
449
+ /**
450
+ * `<usa-skeleton>` — shimmering placeholders while content loads. With
451
+ * `loading`, it shows `lines` bars (or one block of `width` × `height`,
452
+ * or a `circle`) and hides its children; remove `loading` and the real
453
+ * content fades in.
454
+ *
455
+ * Attributes: `loading`, `lines` (3), `width`, `height` (CSS lengths),
456
+ * `circle`, `radius`, `avatar` (circle + lines, like a list row).
457
+ * `aria-busy` follows `loading`. Reduced motion: no shimmer sweep.
458
+ */
459
+ interface UsaSkeletonElement extends UsaElement {
460
+ loading: boolean;
461
+ }
462
+
463
+ /**
464
+ * `<usa-progress>` — a linear progress bar. Determinate (`value` / `max`)
465
+ * bars glide between values with `transform: scaleX()`; without a value,
466
+ * or with `indeterminate`, it shows the Windows Fluent indeterminate
467
+ * animation (two sliding segments).
468
+ *
469
+ * Attributes: `value`, `max` (100), `indeterminate`, `state`
470
+ * (`paused` | `error` — the WinUI states), `label` (accessible name).
471
+ * `role="progressbar"` with `aria-valuenow` when determinate.
472
+ * Reduced motion: no glide; indeterminate becomes a gentle pulse.
473
+ */
474
+ interface UsaProgressElement extends UsaElement {
475
+ value: number | null;
476
+ max: number;
477
+ /** 0–1, or `null` when indeterminate. */
478
+ readonly ratio: number | null;
479
+ }
480
+
481
+ type ToastType = 'info' | 'success' | 'warning' | 'error';
482
+ interface ToastOptions {
483
+ /** ms before it hides itself; `0` keeps it until closed (default 4000). */
484
+ duration?: number;
485
+ type?: ToastType;
486
+ /** Optional action button. */
487
+ action?: {
488
+ label: string;
489
+ onClick: () => void;
490
+ };
491
+ /** Show a close button (default `true`). */
492
+ dismissible?: boolean;
493
+ /** The toaster to use (default: the first `<usa-toaster>`, created if missing). */
494
+ toaster?: UsaToasterElement | string;
495
+ }
496
+ interface ToastHandle {
497
+ element: HTMLElement;
498
+ close(): Promise<void>;
499
+ }
500
+ /**
501
+ * `<usa-toaster>` — the region toasts slide into (`role="region"`, each
502
+ * toast `role="status"`, errors `role="alert"`). Toasts pause their timer
503
+ * while hovered or focused, and the stack re-flows with a FLIP animation.
504
+ *
505
+ * Attributes: `position` (`bottom-right` default, `bottom-left`,
506
+ * `bottom-center`, `top-right`, `top-left`, `top-center`), `max` (visible
507
+ * toasts, 4), `label` (region name, "Notifications").
508
+ * Reduced motion: toasts fade instead of sliding.
509
+ */
510
+ interface UsaToasterElement extends UsaElement {
511
+ show(message: string, options?: ToastOptions): ToastHandle;
512
+ clear(): void;
513
+ }
514
+
515
+ /**
516
+ * `<usa-check>` — an animated result icon: the circle draws itself, then the
517
+ * check mark (or cross / exclamation) strokes in with a little pop.
518
+ *
519
+ * Attributes: `kind` (`success` default, `error`, `warning`), `size`
520
+ * (px, 56), `start` (`view` default | `load` | `manual`), `label`
521
+ * (accessible name, e.g. "Payment complete"; the icon is decorative
522
+ * without it). Event: `usa:complete`. Reduced motion: drawn instantly.
523
+ */
524
+ interface UsaCheckElement extends UsaElement {
525
+ play(): Promise<void>;
526
+ reset(): void;
527
+ }
528
+
529
+ /**
530
+ * motionary/components/feedback — loading & feedback.
531
+ * `<usa-spinner>`, `<usa-skeleton>`, `<usa-progress>`, `<usa-toaster>` +
532
+ * `toast()`, `<usa-check>`.
533
+ */
534
+
535
+ declare global {
536
+ interface HTMLElementTagNameMap {
537
+ 'usa-spinner': UsaSpinnerElement;
538
+ 'usa-skeleton': UsaSkeletonElement;
539
+ 'usa-progress': UsaProgressElement;
540
+ 'usa-toaster': UsaToasterElement;
541
+ 'usa-check': UsaCheckElement;
542
+ }
543
+ }
544
+
545
+ /**
546
+ * `<usa-aurora>` — a slow, drifting aurora / gradient-mesh backdrop behind
547
+ * its content. Soft radial gradients moved with `transform` only (no
548
+ * animated blur), paused while off-screen.
549
+ *
550
+ * Attributes: `colors` (comma-separated, default violet / cyan / pink),
551
+ * `speed` (multiplier, 1), `intensity` (0–1 opacity, 0.7), `paused`.
552
+ * Reduced motion: a still gradient.
553
+ */
554
+ type UsaAuroraElement = UsaElement;
555
+
556
+ /**
557
+ * `<usa-particles>` — a canvas of drifting particles, optionally linked by
558
+ * lines when close (a "constellation"), that drift away from the pointer.
559
+ * Fills its own box (place it as a background with
560
+ * `position: absolute; inset: 0`, or give it a height).
561
+ *
562
+ * Attributes: `count` (60; scaled down on small boxes), `color`
563
+ * (default `currentColor`), `size` (max radius px, 2.2), `speed` (0.35),
564
+ * `links` (max link distance px, 110; `0` disables), `interactive`,
565
+ * `paused`. Renders only while visible and the tab is shown, at device
566
+ * pixel ratio ≤ 2. Reduced motion: one still frame.
567
+ */
568
+ interface UsaParticlesElement extends UsaElement {
569
+ /** Re-seed the particles. */
570
+ reset(): void;
571
+ }
572
+
573
+ /**
574
+ * `<usa-grain>` — a film-grain / noise overlay on top of its content
575
+ * (SVG `feTurbulence` texture, no images to ship). With `animated`, the
576
+ * grain jitters like film (stepped `transform`, ~12 fps).
577
+ *
578
+ * Attributes: `opacity` (0.12), `animated`, `blend` (`mix-blend-mode`,
579
+ * default `overlay`), `scale` (texture size px, 180). Never intercepts
580
+ * pointer events. Reduced motion: static grain.
581
+ */
582
+ type UsaGrainElement = UsaElement;
583
+
584
+ /**
585
+ * `<usa-marquee>` — an infinite, seamless ticker of its children (logos,
586
+ * testimonials, tags). The content is cloned (clones are `aria-hidden` and
587
+ * `inert`) and the track slides with one WAAPI `transform` animation whose
588
+ * duration follows the measured width, so the speed is constant.
589
+ *
590
+ * Attributes: `speed` (px/s, 50), `direction` (`left` default | `right` |
591
+ * `up` | `down`), `gap` (px, 32), `pause-on-hover`, `fade` (soft edges),
592
+ * `paused`. Pauses off-screen. Reduced motion: no movement; the row
593
+ * becomes scrollable instead.
594
+ */
595
+ interface UsaMarqueeElement extends UsaElement {
596
+ pause(): void;
597
+ resume(): void;
598
+ }
599
+
600
+ /**
601
+ * `<usa-acrylic>` — Windows Fluent materials for the web: `acrylic`
602
+ * (frosted glass: backdrop blur + saturation + tint + subtle noise) and
603
+ * `mica` (an opaque, wallpaper-tinted base for app backgrounds; on the web it
604
+ * tints from `--usa-mica-source`, a gradient you control). Optional
605
+ * `shimmer` adds a light sweep when it appears or on hover.
606
+ *
607
+ * Attributes: `kind` (`acrylic` default | `mica`), `tint` (colour),
608
+ * `tint-opacity` (0–1, 0.55), `blur` (px, 30), `shimmer`
609
+ * (`hover` | `load` | `none`, default `none`). Falls back to a solid tint
610
+ * without `backdrop-filter` and under `prefers-reduced-transparency` or
611
+ * forced colours, like Windows does when transparency effects are off.
612
+ */
613
+ type UsaAcrylicElement = UsaElement;
614
+
615
+ /**
616
+ * `<usa-grid-glow>` — a line grid behind its content that lights up around
617
+ * the pointer. Attributes: `size` (cell px, 32), `color`, `radius` (px, 220).
618
+ * Reduced motion: the grid stays, a soft static glow in the centre.
619
+ */
620
+ interface UsaGridGlowElement extends UsaElement {
621
+ }
622
+ /**
623
+ * `<usa-blobs>` — soft, slowly morphing colour blobs (fluid gradient
624
+ * backdrop). Attributes: `colors` (comma list), `speed` (1), `blur` (px, 60).
625
+ * Reduced motion: still blobs.
626
+ */
627
+ interface UsaBlobsElement extends UsaElement {
628
+ }
629
+ /**
630
+ * `<usa-water-ripple>` — interactive water ripples on a canvas over its
631
+ * content (pointer moves and taps disturb the surface). Low-resolution height
632
+ * map, paused off-screen. Attributes: `damping` (0.96), `strength` (1),
633
+ * `color` (highlight). Reduced motion: nothing is drawn.
634
+ */
635
+ interface UsaWaterRippleElement extends UsaElement {
636
+ drop(x: number, y: number, strength?: number): void;
637
+ }
638
+ /**
639
+ * `<usa-dot-network>` — a grid of dots that swell and link up with lines
640
+ * around the pointer (a living network backdrop). Attributes: `gap` (px,
641
+ * 28), `color`, `radius` (px of influence, 140). Reduced motion: a static
642
+ * dot grid.
643
+ */
644
+ interface UsaDotNetworkElement extends UsaElement {
645
+ }
646
+
647
+ /**
648
+ * motionary/components/background — backgrounds & decoration.
649
+ * `<usa-aurora>`, `<usa-particles>`, `<usa-grain>`, `<usa-marquee>`,
650
+ * `<usa-acrylic>`.
651
+ */
652
+
653
+ declare global {
654
+ interface HTMLElementTagNameMap {
655
+ 'usa-grid-glow': UsaGridGlowElement;
656
+ 'usa-blobs': UsaBlobsElement;
657
+ 'usa-water-ripple': UsaWaterRippleElement;
658
+ 'usa-dot-network': UsaDotNetworkElement;
659
+ 'usa-aurora': UsaAuroraElement;
660
+ 'usa-particles': UsaParticlesElement;
661
+ 'usa-grain': UsaGrainElement;
662
+ 'usa-marquee': UsaMarqueeElement;
663
+ 'usa-acrylic': UsaAcrylicElement;
664
+ }
665
+ }
666
+
667
+ /**
668
+ * `<usa-dialog>` — an animated modal or drawer built on the native
669
+ * `<dialog>` (top layer, focus trapping, inert page, Esc to close). Its
670
+ * children are slotted into the panel (they stay in the light DOM, so
671
+ * React / Vue / Svelte keep owning them). Style with `::part(panel)`,
672
+ * `::part(backdrop)` and the `--usa-dialog-*` custom properties.
673
+ *
674
+ * Attributes: `open` (reflects; set/remove to open/close), `kind`
675
+ * (`modal` default — Fluent scale + fade; `drawer-start` / `drawer-end`
676
+ * slide from the side, `drawer-bottom` / `sheet` from below), `label`
677
+ * (accessible name), `no-backdrop-close`, `no-esc`. Elements inside
678
+ * with `data-close` close it. Events: `usa:open`, `usa:close` (cancelable
679
+ * `usa:beforeclose`). Reduced motion: fade only.
680
+ */
681
+ interface UsaDialogElement extends UsaElement {
682
+ open: boolean;
683
+ show(): Promise<void>;
684
+ close(returnValue?: string): Promise<void>;
685
+ readonly dialog: HTMLDialogElement | null;
686
+ returnValue: string;
687
+ }
688
+
689
+ /**
690
+ * `<usa-accordion>` — smooth expand / collapse for the native `<details>`
691
+ * elements inside it (keeps their semantics, keyboard support and
692
+ * find-in-page, and adds no wrapper elements, so framework-rendered content
693
+ * is left alone). Only one stays open unless `multiple` is set.
694
+ *
695
+ * Attributes: `multiple`, `duration` (ms, 300). Event: `usa:toggle`
696
+ * (`detail.details`, `detail.open`). Reduced motion: instant.
697
+ * Heights are measured once per toggle and animated on the `<details>`.
698
+ */
699
+ interface UsaAccordionElement extends UsaElement {
700
+ readonly items: HTMLDetailsElement[];
701
+ toggleItem(details: HTMLDetailsElement, open?: boolean): Promise<void>;
702
+ }
703
+
704
+ /**
705
+ * `<usa-view-switch>` — shows one of its children at a time (tabs, wizard
706
+ * steps, app pages) and animates between them. Children are views; name
707
+ * them with `data-view`, or address them by index.
708
+ *
709
+ * Attributes: `active` (view name or index, default the first),
710
+ * `effect` (`fade` | `slide` (default, direction-aware — Fluent "page
711
+ * transition") | `scale` | `drill`), `duration` (ms, 320). Inactive views
712
+ * get `hidden` + `inert`. Event: `usa:change` (`detail.view`,
713
+ * `detail.index`). Reduced motion: a quick fade.
714
+ */
715
+ interface UsaViewSwitchElement extends UsaElement {
716
+ active: string;
717
+ readonly views: HTMLElement[];
718
+ show(view: string | number): Promise<void>;
719
+ }
720
+
721
+ /**
722
+ * motionary/components/transitions — view & layout transitions.
723
+ * `<usa-dialog>`, `<usa-accordion>`, `<usa-view-switch>`
724
+ * and the `viewTransition()` and `flip()` helpers (4.0: `<usa-flip-list>` → `<usa-auto-animate>`,
725
+ * `connectedAnimation()` → `sharedTransition()`, both in `components/layout`).
726
+ */
727
+
728
+ declare global {
729
+ interface HTMLElementTagNameMap {
730
+ 'usa-dialog': UsaDialogElement;
731
+ 'usa-accordion': UsaAccordionElement;
732
+ 'usa-view-switch': UsaViewSwitchElement;
733
+ }
734
+ }
735
+
736
+ /**
737
+ * `<usa-spring>` — spring / bounce effects on its content.
738
+ *
739
+ * Attributes: `effect` (`bounce-in` default, `pop`, `drop`, `jelly`,
740
+ * `rubber-band`), `trigger` (`view` default, `hover`, `click`, `manual`),
741
+ * `preset` (`gentle`, `wobbly`, `stiff`, `bouncy`, …) or `stiffness` /
742
+ * `damping` / `mass`, `delay` (ms), `duration` (ms, attention effects; 900),
743
+ * `repeat` (replay every time it re-enters the view), `block`.
744
+ * Events: `usa:complete`. Reduced motion: entrances fade, attention effects do nothing.
745
+ */
746
+ interface UsaSpringElement extends UsaElement {
747
+ effect: string;
748
+ play(): Promise<void>;
749
+ reset(): void;
750
+ }
751
+
752
+ /**
753
+ * `<usa-draggable>` — drag its content with the pointer (mouse, touch, pen)
754
+ * or the arrow keys; physics on release.
755
+ *
756
+ * Attributes: `axis` (`both` default, `x`, `y`), `spring-back` (return to
757
+ * the origin with a spring), `inertia` (keep gliding after a flick),
758
+ * `snap` (grid size like `80`, or points like `0,120,240`), `bounds`
759
+ * (`parent` = stay inside the parent box, rubber-banding past its edges),
760
+ * `preset` (spring, default `wobbly`), `step` (arrow-key step, px, 16),
761
+ * `disabled`. Methods: `moveTo(x, y, animate?)`, `reset()`. Events:
762
+ * `usa:drag-start`, `usa:drag-end` (`{ x, y, vx, vy }`), `usa:settle`.
763
+ * Reduced motion: positions change instantly (no spring or inertia).
764
+ */
765
+ interface UsaDraggableElement extends UsaElement {
766
+ readonly x: number;
767
+ readonly y: number;
768
+ readonly dragging: boolean;
769
+ moveTo(x: number, y: number, animate?: boolean): void;
770
+ reset(): void;
771
+ }
772
+
773
+ /**
774
+ * `<usa-overscroll>` — an elastic scroll container: pulling past the top or
775
+ * bottom (touch, trackpad or wheel) stretches the content with iOS-style
776
+ * rubber-band resistance and it springs back on release.
777
+ *
778
+ * Attributes: `axis` (`y` default, `x`), `max` (largest stretch in px, 120),
779
+ * `preset` (spring, default `default`), `disabled`. CSS variable
780
+ * `--usa-overscroll` holds the current offset. Reduced motion: no stretch
781
+ * (a plain scroll container with `overscroll-behavior: contain`).
782
+ */
783
+ interface UsaOverscrollElement extends UsaElement {
784
+ /** Current stretch in px (negative = pulled past the end). */
785
+ readonly offset: number;
786
+ }
787
+
788
+ /**
789
+ * motionary/components/physics — spring & bounce physics (v2.3).
790
+ * `<usa-spring>` (bounce-in, pop, drop, jelly, rubber-band), `<usa-draggable>`
791
+ * (spring-back, inertia, snap) and `<usa-overscroll>` (elastic edges), plus
792
+ * the spring core: `spring()`, `springEasing()`, `createSpring()`,
793
+ * `SPRING_PRESETS`, `projectInertia()`, `snapTo()`, `rubberBand()`.
794
+ */
795
+
796
+ declare global {
797
+ interface HTMLElementTagNameMap {
798
+ 'usa-spring': UsaSpringElement;
799
+ 'usa-draggable': UsaDraggableElement;
800
+ 'usa-overscroll': UsaOverscrollElement;
801
+ }
802
+ }
803
+
804
+ /**
805
+ * `<usa-card>` — card effects, combinable: `effect="lift sheen"`.
806
+ *
807
+ * - `flip` — front/back (`[data-front]` / `[data-back]` children) flip on
808
+ * hover or `trigger="click"`, `axis="y"` (default, horizontal flip) or `x`.
809
+ * - `holo` — holographic foil that shifts with the pointer.
810
+ * - `glass` — frosted glass surface (backdrop blur).
811
+ * - `border-glow` — a glow on the border that follows the pointer.
812
+ * - `conic-border` — a rotating conic-gradient border.
813
+ * - `lift` — rises with a deeper shadow and a slight pointer tilt.
814
+ * - `spotlight` — a soft light that follows the pointer.
815
+ * - `sheen` — a light sweep across the card on hover / focus.
816
+ * - `parallax-layers` — children with `data-depth="0.2…1"` move at different depths.
817
+ * - `expand` — click to grow into a full detail view (`[data-detail]`
818
+ * content is shown), FLIP + spring; Esc, `[data-close]` or the backdrop closes.
819
+ *
820
+ * Attributes: `effect`, `axis`, `trigger`, `depth` (parallax px, 16),
821
+ * `color` (glow / spotlight colour), `flipped`, `expanded`, `disabled`.
822
+ * CSS variables: `--usa-card-x/-y` (pointer %, 0–100), `--usa-card-nx/-ny` (−1…1).
823
+ * Methods: `flip(force?)`, `expand()`, `collapse()`. Events: `usa:flip`,
824
+ * `usa:expand`, `usa:collapse`. Reduced motion: no tilt / parallax / sweep;
825
+ * flips and expansions cross-fade.
826
+ */
827
+ interface UsaCardElement extends UsaElement {
828
+ readonly effects: string[];
829
+ flipped: boolean;
830
+ readonly expanded: boolean;
831
+ flip(force?: boolean): void;
832
+ expand(): Promise<void>;
833
+ collapse(): Promise<void>;
834
+ }
835
+
836
+ /**
837
+ * `<usa-card-stack>` — a deck of cards (its element children). The top card
838
+ * can be swiped away left or right (pointer, touch or arrow keys); the rest
839
+ * fan out behind it and move up with a spring.
840
+ *
841
+ * Attributes: `threshold` (px to dismiss, 90), `visible` (cards fanned
842
+ * behind, 3), `offset` (px between cards, 10), `loop` (swiped cards go back
843
+ * to the bottom), `disabled`. Methods: `swipe(direction)`, `top`. Events:
844
+ * `usa:swipe` (`{ direction: 'left' | 'right', card }`), `usa:empty`.
845
+ * Reduced motion: cards are removed instantly, no rotation.
846
+ */
847
+ interface UsaCardStackElement extends UsaElement {
848
+ readonly top: HTMLElement | null;
849
+ swipe(direction: 'left' | 'right'): Promise<void>;
850
+ }
851
+
852
+ /**
853
+ * `<usa-sticky-stack>` — cards (element children) stick to the top while
854
+ * scrolling and the ones underneath scale down and dim as the next card
855
+ * slides over them, like a deck building up.
856
+ *
857
+ * Attributes: `top` (px from the viewport top, 80), `gap` (px each card
858
+ * peeks below the previous, 16), `scale` (how much a covered card shrinks,
859
+ * 0.06). Reduced motion: cards still stack (sticky) but do not scale.
860
+ */
861
+ interface UsaStickyStackElement extends UsaElement {
862
+ update(): void;
863
+ }
864
+
865
+ /**
866
+ * `<usa-carousel-3d>` — its element children on a 3D ring. Rotate with the
867
+ * arrow keys, a drag/swipe, the wheel (shift) or `next()` / `prev()`; the
868
+ * front item is `aria-current`. Spring-driven rotation.
869
+ *
870
+ * Attributes: `radius` (px, auto from item width), `autoplay` (ms between
871
+ * steps, pauses on hover/focus), `perspective` (px, 1200), `index`.
872
+ * Events: `usa:change` (`{ index }`). Reduced motion: a flat, instant
873
+ * switch (only the current item is shown, others dimmed).
874
+ */
875
+ interface UsaCarousel3dElement extends UsaElement {
876
+ index: number;
877
+ next(): void;
878
+ prev(): void;
879
+ goTo(i: number): void;
880
+ }
881
+
882
+ /**
883
+ * motionary/components/cards — card effects (v2.4).
884
+ * `<usa-card effect="flip | holo | glass | border-glow | conic-border | lift |
885
+ * spotlight | sheen | parallax-layers | expand">` (combinable),
886
+ * `<usa-card-stack>` (swipeable deck), `<usa-sticky-stack>` (stacking on
887
+ * scroll) and `<usa-carousel-3d>`.
888
+ */
889
+
890
+ declare global {
891
+ interface HTMLElementTagNameMap {
892
+ 'usa-card': UsaCardElement;
893
+ 'usa-card-stack': UsaCardStackElement;
894
+ 'usa-sticky-stack': UsaStickyStackElement;
895
+ 'usa-carousel-3d': UsaCarousel3dElement;
896
+ }
897
+ }
898
+
899
+ /**
900
+ * `<usa-click>` — click / tap effects on whatever it wraps (combinable:
901
+ * `effect="press-spring burst"`).
902
+ *
903
+ * - `ripple` — an ink wave from the pointer (enhanced: `color`, soft edge);
904
+ * - `burst` — particles radiating from the pointer (`shape`: circle, square, star, heart, emoji);
905
+ * - `confetti` — a confetti cannon from the click point;
906
+ * - `squish` — squash on press, stretch on release (spring);
907
+ * - `press-spring` — dips while pressed, springs back with overshoot;
908
+ * - `shake` — horizontal error shake; plays on `invalid` events from a form
909
+ * inside, on `shake()`, or on click when `trigger="click"`.
910
+ *
911
+ * Attributes: `effect`, `color`, `shape`, `count`, `haptic` (vibrate ms,
912
+ * where supported), `disabled`. Keyboard (Space/Enter) triggers the effects
913
+ * from the centre. Reduced motion: no particles or movement; press dims.
914
+ */
915
+ interface UsaClickElement extends UsaElement {
916
+ readonly effects: string[];
917
+ play(x?: number, y?: number): void;
918
+ shake(): void;
919
+ }
920
+
921
+ type ButtonShape = 'pill' | 'circle' | 'icon';
922
+ type ButtonState = 'idle' | 'loading' | 'success' | 'error';
923
+ /**
924
+ * `<usa-button>` — **button click deformation** (按钮点击形变) around a
925
+ * native `<button>` (or `<a>`) child — or the element itself becomes a button.
926
+ *
927
+ * `deform` (combinable, e.g. `deform="squash wobble"`):
928
+ * - `squash` — squash on press, stretch-and-settle on release (spring);
929
+ * - `wobble` — elastic border-radius wobble after a click;
930
+ * - `gooey` — liquid blob: droplets squeeze out from the press point and
931
+ * merge back (SVG goo filter);
932
+ * - `dent` — the surface dents toward the pressed point (3D tilt + inner shade).
933
+ *
934
+ * `shape="pill | circle | icon"` morphs the outline with a spring (label =
935
+ * `[data-label]`, icon = `[data-icon]` children); `morphTo(shape)`.
936
+ *
937
+ * `morph="submit"` — click → `loading` (shrinks to a circle with a spinner,
938
+ * `aria-busy`), then `success` (check) or `error` (shake + cross), and back
939
+ * to `idle` after `reset` ms (1800). Drive it with `state="…"` / `.state`, or
940
+ * call `event.detail.done(ok)` from a `usa:submit` listener.
941
+ *
942
+ * Attributes: `deform`, `shape`, `morph`, `state`, `reset`, `haptic`,
943
+ * `disabled`. Events: `usa:submit`, `usa:state`. Reduced motion: no
944
+ * deformation; shape and state changes are instant; status still announced.
945
+ */
946
+ interface UsaButtonElement extends UsaElement {
947
+ readonly target: HTMLElement;
948
+ shape: ButtonShape;
949
+ state: ButtonState;
950
+ morphTo(shape: ButtonShape): Promise<void>;
951
+ }
952
+
953
+ /**
954
+ * `<usa-icon-morph>` — an icon that morphs between shapes with a spring:
955
+ * play ↔ pause, menu ↔ close, plus ↔ minus, check, arrow-right…
956
+ *
957
+ * Attributes: `icons` (comma list, cycled; default `play,pause`), `index`
958
+ * (current, 0), `size` (px, 24), `toggle` (makes it a button that cycles
959
+ * on click / Enter / Space), `labels` (comma list of accessible names per
960
+ * icon, e.g. `Play,Pause`), `preset` (spring, `wobbly`). Methods:
961
+ * `next()`, `show(nameOrIndex)`. Events: `usa:change` (`{ index, icon }`).
962
+ * Inside a `<usa-button>` or `<button>` it is decorative. Reduced motion:
963
+ * the icon switches instantly.
964
+ */
965
+ interface UsaIconMorphElement extends UsaElement {
966
+ index: number;
967
+ readonly icon: string;
968
+ next(): void;
969
+ show(icon: string | number): void;
970
+ }
971
+
972
+ /**
973
+ * `<usa-like>` — a like / favourite toggle: the heart pops with a spring and
974
+ * bursts into particles when liked. `role="button"` + `aria-pressed`.
975
+ *
976
+ * Attributes: `liked`, `count` (shown next to the heart, updated ±1),
977
+ * `label` (accessible name, default "Like"), `color`, `size` (px, 24),
978
+ * `haptic`, `disabled`. Events: `change`, `usa:change` (`{ liked, count }`).
979
+ * Reduced motion: colour change only.
980
+ */
981
+ interface UsaLikeElement extends UsaElement {
982
+ liked: boolean;
983
+ count: number | null;
984
+ toggle(force?: boolean): void;
985
+ }
986
+
987
+ /**
988
+ * `<usa-hold>` — hold-to-confirm: press and hold (pointer, Space or Enter)
989
+ * while a progress ring fills; releasing early rewinds it. Good for
990
+ * destructive actions.
991
+ *
992
+ * Attributes: `duration` (ms, 1200), `label` (accessible name), `color`,
993
+ * `disabled`. CSS variable `--usa-hold` (0–1). Events: `usa:progress`,
994
+ * `usa:confirm`, `usa:cancel`. Reduced motion: same timing, the ring fills
995
+ * without the scale pulse.
996
+ */
997
+ interface UsaHoldElement extends UsaElement {
998
+ readonly progress: number;
999
+ cancel(): void;
1000
+ }
1001
+
1002
+ /**
1003
+ * `<usa-double-tap>` — detects a double tap / double click on its content
1004
+ * (photos, posts) and pops a heart (or `icon`) at the tap point.
1005
+ *
1006
+ * Attributes: `icon` (text / emoji, default ♥), `color`, `delay` (max ms
1007
+ * between taps, 300), `haptic`, `disabled`. Events: `usa:double-tap`
1008
+ * (`{ x, y }`, element-relative). Keyboard users: press `L` while focused.
1009
+ * Reduced motion: the icon fades in and out without scaling or particles.
1010
+ */
1011
+ interface UsaDoubleTapElement extends UsaElement {
1012
+ pop(x?: number, y?: number): void;
1013
+ }
1014
+
1015
+ /**
1016
+ * `<usa-checkbox>` — an animated, form-associated checkbox: the box springs
1017
+ * and the check mark draws itself. `role="checkbox"` + `aria-checked`
1018
+ * (`mixed` with `indeterminate`).
1019
+ *
1020
+ * Attributes: `checked`, `indeterminate`, `disabled`, `name`, `value`
1021
+ * (`on`), `label`, `shape` (`square` default, `circle`). Events: `change`,
1022
+ * `usa:change` (`{ checked }`). Reduced motion: no spring or drawing.
1023
+ */
1024
+ interface UsaCheckboxElement extends UsaElement {
1025
+ checked: boolean;
1026
+ indeterminate: boolean;
1027
+ toggle(force?: boolean): void;
1028
+ }
1029
+
1030
+ /**
1031
+ * motionary/components/click — click & tap effects (v2.5).
1032
+ * `<usa-click>` (ripple, burst, confetti, squish, press-spring, shake),
1033
+ * `<usa-button>` (button click deformation: squash, wobble, gooey, dent;
1034
+ * shape morph; submit → loading → success), `<usa-icon-morph>`,
1035
+ * `<usa-like>`, `<usa-hold>`, `<usa-double-tap>`, `<usa-checkbox>`, plus
1036
+ * `haptic()`. 6.0: `burst()`, `confetti()` and `shake()` were removed — play
1037
+ * the registered effects instead: `playEffect(el, 'burst' | 'confetti' | 'shake')`.
1038
+ */
1039
+
1040
+ declare global {
1041
+ interface HTMLElementTagNameMap {
1042
+ 'usa-click': UsaClickElement;
1043
+ 'usa-button': UsaButtonElement;
1044
+ 'usa-icon-morph': UsaIconMorphElement;
1045
+ 'usa-like': UsaLikeElement;
1046
+ 'usa-hold': UsaHoldElement;
1047
+ 'usa-double-tap': UsaDoubleTapElement;
1048
+ 'usa-checkbox': UsaCheckboxElement;
1049
+ }
1050
+ }
1051
+
1052
+ /**
1053
+ * `<usa-tabs>` — accessible tabs with a sliding (spring) indicator.
1054
+ * Tabs: `[data-tab]` children (buttons); panels: `[data-panel]` children, in
1055
+ * the same order. Arrow keys / Home / End move between tabs (roving tabindex).
1056
+ *
1057
+ * Attributes: `selected` (index, 0), `indicator` (`line` default, `pill`),
1058
+ * `variant`. Events: `usa:change` (`{ index }`). Panels fade/slide in;
1059
+ * reduced motion: the indicator jumps and panels switch instantly.
1060
+ */
1061
+ interface UsaTabsElement extends UsaElement {
1062
+ selected: number;
1063
+ select(i: number, focus?: boolean): void;
1064
+ }
1065
+
1066
+ /**
1067
+ * `<usa-drawer>` — a side panel that slides in with a spring and can be
1068
+ * dragged / swiped closed. Modal: backdrop, Esc, focus returns on close.
1069
+ * Attributes: `open`, `side` (`left` default, `right`, `top`, `bottom`),
1070
+ * `label`, `variant`. Events: `usa:open`, `usa:close`. `[data-close]` closes.
1071
+ * Reduced motion: opens and closes instantly.
1072
+ */
1073
+ interface UsaDrawerElement extends UsaElement {
1074
+ open: boolean;
1075
+ show(): void;
1076
+ close(): void;
1077
+ }
1078
+ /**
1079
+ * `<usa-bottom-sheet>` — a draggable bottom sheet with snap points
1080
+ * (`snap="0.3,0.6,0.92"`, fractions of the viewport height; default
1081
+ * `0.5,0.92`; `start` = index of the snap it opens at, default 0), inertia and drag-down-to-dismiss. `[data-handle]` (or the
1082
+ * built-in grabber) drags it. Attributes: `open`, `snap`, `start` (initial
1083
+ * snap index), `label`, `variant`. Events: `usa:open`, `usa:close`, `usa:snap`.
1084
+ */
1085
+ interface UsaBottomSheetElement extends UsaDrawerElement {
1086
+ }
1087
+
1088
+ /**
1089
+ * `<usa-pull-refresh>` — pull-to-refresh for a scroll container (itself):
1090
+ * pull down at the top (touch / pointer) and a spinner stretches in; past
1091
+ * `threshold` (px, 70) releasing fires `usa:refresh` — call
1092
+ * `event.detail.done()` (or return a promise to `onrefresh`) to finish.
1093
+ * Also exposes `refresh()` for a keyboard / button path.
1094
+ * Attributes: `threshold`, `disabled`, `label` (status text, "Refreshing").
1095
+ * Reduced motion: no stretch; the spinner simply appears while refreshing.
1096
+ */
1097
+ interface UsaPullRefreshElement extends UsaElement {
1098
+ readonly refreshing: boolean;
1099
+ refresh(): Promise<void>;
1100
+ }
1101
+
1102
+ /**
1103
+ * `<usa-fab>` — floating action button with a speed dial. The first element
1104
+ * child is the main button; the others are actions that fan out with a
1105
+ * staggered spring when it opens (`direction="up"` default, `down`, `left`,
1106
+ * `right`, `radial`). Esc / outside click closes; `aria-expanded` on the
1107
+ * main button; actions are hidden from AT while closed.
1108
+ * Attributes: `open`, `direction`, `position` (`bottom-right` default, `bottom-left`,
1109
+ * `inline`), `gap` (px, 56), `variant`. Events: `usa:toggle` (`{ open }`).
1110
+ * Reduced motion: actions appear without travel.
1111
+ */
1112
+ interface UsaFabElement extends UsaElement {
1113
+ open: boolean;
1114
+ toggle(force?: boolean): void;
1115
+ }
1116
+
1117
+ /**
1118
+ * `<usa-navbar>` — an app bar that hides while you scroll down and returns
1119
+ * as soon as you scroll up (or reach the top); `shrink` makes it compact
1120
+ * once scrolled. Focus inside always reveals it.
1121
+ * Attributes: `threshold` (px of scroll before hiding, 64), `shrink`,
1122
+ * `target` (selector of a scroll container instead of the page), `variant`.
1123
+ * State attributes: `data-hidden`, `data-scrolled`. Events: `usa:hide`, `usa:show`.
1124
+ * Reduced motion: hides/shows without sliding (instant).
1125
+ */
1126
+ interface UsaNavbarElement extends UsaElement {
1127
+ readonly hiddenByScroll: boolean;
1128
+ show(): void;
1129
+ }
1130
+
1131
+ /**
1132
+ * `<usa-slider>` — a form-associated range slider (`role="slider"`). The
1133
+ * thumb follows with a spring, grows while dragged and shows a value bubble.
1134
+ * Keyboard: arrows (step), PageUp/PageDown (10 steps), Home/End.
1135
+ * Attributes: `value`, `min` (0), `max` (100), `step` (1), `name`, `label`,
1136
+ * `bubble` (show the value while dragging), `disabled`, `variant`.
1137
+ * Events: `input` + `usa:input` while moving, `change` + `usa:change` on release.
1138
+ * Reduced motion: the thumb jumps (no spring).
1139
+ */
1140
+ interface UsaSliderElement extends UsaElement {
1141
+ value: number;
1142
+ }
1143
+
1144
+ /**
1145
+ * `<usa-rating>` — star rating with hover preview and a springy pop when a
1146
+ * value is chosen. `role="slider"` (arrow keys, Home/End, number keys).
1147
+ * Attributes: `value` (0), `max` (5), `icon` (★), `readonly`, `label`
1148
+ * ("Rating"), `name` (form value), `variant`. Events: `change`, `usa:change` (`{ value }`).
1149
+ * Reduced motion: no pop.
1150
+ */
1151
+ interface UsaRatingElement extends UsaElement {
1152
+ value: number;
1153
+ }
1154
+
1155
+ /**
1156
+ * `<usa-tooltip text="…">` — a tooltip for the element it wraps, shown on
1157
+ * hover (after `delay` ms, 300) and on keyboard focus, hidden on Esc / blur.
1158
+ * It springs in from its placement side and flips to stay on screen; the
1159
+ * trigger gets `aria-describedby`.
1160
+ * Attributes: `text`, `placement` (`top` default, `bottom`, `left`, `right`),
1161
+ * `delay`, `variant`. Reduced motion: fades only.
1162
+ */
1163
+ interface UsaTooltipElement extends UsaElement {
1164
+ show(): void;
1165
+ hide(): void;
1166
+ }
1167
+
1168
+ /**
1169
+ * `<usa-popover>` — a click-to-open popover: the first element child is the
1170
+ * trigger, `[data-popover]` is the content. Springs open from the trigger,
1171
+ * flips to stay on screen; Esc or an outside click closes and focus returns
1172
+ * to the trigger. `aria-expanded` / `aria-controls` on the trigger.
1173
+ * Attributes: `open`, `placement` (`bottom` default), `variant`. Events:
1174
+ * `usa:open`, `usa:close`. Reduced motion: fades only.
1175
+ */
1176
+ interface UsaPopoverElement extends UsaElement {
1177
+ open: boolean;
1178
+ toggle(force?: boolean): void;
1179
+ }
1180
+
1181
+ /**
1182
+ * `<usa-badge>` — a count / dot badge on whatever it wraps; bumps with a
1183
+ * spring whenever the value changes and pulses with `pulse`.
1184
+ * Attributes: `value` (number or text; 0 / empty hides it unless
1185
+ * `show-zero`), `max` (99 → "99+"), `dot`, `pulse`, `label` (accessible
1186
+ * text, default "{n} new"), `variant`. Reduced motion: no bump or pulse.
1187
+ */
1188
+ interface UsaBadgeElement extends UsaElement {
1189
+ value: string;
1190
+ }
1191
+
1192
+ /**
1193
+ * `<usa-avatar-stack>` — overlapping avatars (its children: `<img>` or any
1194
+ * element) that spread apart with a spring on hover / focus; extra ones
1195
+ * collapse into a "+N" chip.
1196
+ * Attributes: `max` (visible avatars, 5), `size` (px, 36), `overlap` (0–1,
1197
+ * 0.35), `label` (group name), `variant`. Reduced motion: no spreading.
1198
+ */
1199
+ interface UsaAvatarStackElement extends UsaElement {
1200
+ }
1201
+
1202
+ /**
1203
+ * motionary/components/ui — animated UI components + style variants (v2.6).
1204
+ * `<usa-tabs>`, `<usa-drawer>`, `<usa-bottom-sheet>`, `<usa-pull-refresh>`,
1205
+ * `<usa-fab>`, `<usa-navbar>`, `<usa-slider>`, `<usa-rating>`,
1206
+ * `<usa-tooltip>`, `<usa-popover>`, `<usa-badge>`, `<usa-avatar-stack>`,
1207
+ * and `variant="minimal | neon | glass | brutalist | fluent | material"`
1208
+ * design tokens (`setVariant()`, `VARIANTS`).
1209
+ */
1210
+
1211
+ declare global {
1212
+ interface HTMLElementTagNameMap {
1213
+ 'usa-tabs': UsaTabsElement;
1214
+ 'usa-drawer': UsaDrawerElement;
1215
+ 'usa-bottom-sheet': UsaBottomSheetElement;
1216
+ 'usa-pull-refresh': UsaPullRefreshElement;
1217
+ 'usa-fab': UsaFabElement;
1218
+ 'usa-navbar': UsaNavbarElement;
1219
+ 'usa-slider': UsaSliderElement;
1220
+ 'usa-rating': UsaRatingElement;
1221
+ 'usa-tooltip': UsaTooltipElement;
1222
+ 'usa-popover': UsaPopoverElement;
1223
+ 'usa-badge': UsaBadgeElement;
1224
+ 'usa-avatar-stack': UsaAvatarStackElement;
1225
+ }
1226
+ }
1227
+
1228
+ /**
1229
+ * `<usa-cursor mode="dot | magnetic | glow">` — a custom cursor for
1230
+ * the page (place it once, e.g. at the end of `<body>`).
1231
+ * - `dot` — a ring that follows with spring lag around the real pointer;
1232
+ * (6.0: `mode="trail"` was removed — use the registered `comet-trail` effect;
1233
+ * unknown modes render as `dot`.)
1234
+ * - `magnetic` — the ring snaps onto and wraps hovered targets (`a`,
1235
+ * `button`, `[data-cursor]`);
1236
+ * - `glow` — a large soft light following the pointer (great on dark UIs).
1237
+ * Attributes: `mode`, `color`, `size` (px, 28), `hide-native` (hide the
1238
+ * system cursor), `targets` (selector, magnetic). Only for fine pointers
1239
+ * (mouse / pen); never on touch. Reduced motion: not rendered.
1240
+ */
1241
+ interface UsaCursorElement extends UsaElement {
1242
+ readonly active: boolean;
1243
+ }
1244
+
1245
+ /**
1246
+ * `<usa-fullpage>` — full-screen sections (its element children) that snap
1247
+ * one at a time (CSS scroll snap), with keyboard paging (PageUp/PageDown,
1248
+ * arrows, Home/End), optional dot navigation and the current section in
1249
+ * `aria-current` + `usa:section`.
1250
+ * Attributes: `dots` (show the dot nav), `axis` (`y` default, `x`).
1251
+ * Methods: `go(i)`, `next()`, `prev()`. Reduced motion: snapping stays,
1252
+ * jumps are instant.
1253
+ */
1254
+ interface UsaFullpageElement extends UsaElement {
1255
+ readonly index: number;
1256
+ go(i: number): void;
1257
+ next(): void;
1258
+ prev(): void;
1259
+ }
1260
+
1261
+ /**
1262
+ * `<usa-loading-bar>` — a slim top loading bar for route changes and fetches
1263
+ * (NProgress-style): `start()` trickles towards 90 %, `done()` completes and
1264
+ * fades out, `set(0–1)` for real progress. `loadingBar` drives the first bar
1265
+ * on the page (created on demand). `role="progressbar"`, `aria-busy`.
1266
+ * Attributes: `color`, `height` (px, 3), `position` (`top` default, `bottom`).
1267
+ * Reduced motion: no trickle animation — the bar shows / hides.
1268
+ */
1269
+ interface UsaLoadingBarElement extends UsaElement {
1270
+ readonly progress: number;
1271
+ start(): void;
1272
+ set(p: number): void;
1273
+ done(): void;
1274
+ }
1275
+
1276
+ /**
1277
+ * `<usa-back-to-top>` — a floating button that appears after `offset` px
1278
+ * (300) of scrolling, shows page progress as a ring and springs the page
1279
+ * back to the top (then focuses `focus-target`, default `#main` / `body`).
1280
+ * Attributes: `offset`, `label` ("Back to top"), `focus-target`, `position`
1281
+ * (`bottom-right` default, `bottom-left`). Reduced motion: instant jump.
1282
+ */
1283
+ interface UsaBackToTopElement extends UsaElement {
1284
+ readonly visible: boolean;
1285
+ }
1286
+
1287
+ /**
1288
+ * `<usa-ambient effect="particles | snow | stars | noise | gradient">` — a
1289
+ * fixed, page-wide ambient layer behind (or, with `layer="front"`, over)
1290
+ * the content, never catching the pointer.
1291
+ * - `particles` — slow drifting dots; `snow` — falling flakes with sway;
1292
+ * `stars` — twinkling starfield (canvas, paused in hidden tabs, DPR ≤ 2);
1293
+ * - `noise` — animated film grain (CSS, SVG turbulence);
1294
+ * - `gradient` — a gradient whose hue shifts with the scroll position.
1295
+ * Attributes: `effect`, `density` (0.2–3, 1), `color`, `opacity` (0.6),
1296
+ * `layer` (`back` default, `front`), `speed` (1). Reduced motion: one
1297
+ * static frame (no falling, twinkling or grain flicker).
1298
+ */
1299
+ interface UsaAmbientElement extends UsaElement {
1300
+ }
1301
+
1302
+ /**
1303
+ * `<usa-splash>` — an app splash / launch screen: shows its content (logo,
1304
+ * spinner) over the page, then leaves with `exit` (`fade` default, `scale`,
1305
+ * `slide-up`, `circle`) once the page has loaded (or when you call
1306
+ * `done()`), but never sooner than `min` ms (600) — no flash.
1307
+ * Attributes: `min`, `exit`, `manual` (wait for `done()`), `label`.
1308
+ * Events: `usa:done`. The page underneath is `aria-busy` until then.
1309
+ * Reduced motion: fades.
1310
+ */
1311
+ interface UsaSplashElement extends UsaElement {
1312
+ done(): Promise<void>;
1313
+ }
1314
+
1315
+ /**
1316
+ * `<usa-auto-skeleton loading>` — automatic skeletons: while `loading` is
1317
+ * set, every text block, image, button and input inside is drawn as a
1318
+ * shimmering placeholder of its own size — no separate skeleton markup.
1319
+ * Remove `loading` (or set `.loading = false`) and the content fades in.
1320
+ * `aria-busy` while loading. Opt elements out with `data-no-skeleton`.
1321
+ * Reduced motion: static placeholders, no shimmer or fade.
1322
+ */
1323
+ interface UsaAutoSkeletonElement extends UsaElement {
1324
+ loading: boolean;
1325
+ }
1326
+
1327
+ /** The switch's levels: Off (motion sensitivity `minimal`) + the three intensities. */
1328
+ type MotionSwitchLevel = 'off' | MotionIntensity;
1329
+ /**
1330
+ * `<usa-motion-switch>` — a segmented control letting users choose the
1331
+ * app's motion intensity (Off · Low · Normal · High), persisted.
1332
+ * `role="radiogroup"`; arrow keys move. Attributes: `labels` (comma list),
1333
+ * `label` ("Motion"). Events: `usa:change` (`{ level }`).
1334
+ */
1335
+ interface UsaMotionSwitchElement extends UsaElement {
1336
+ value: MotionSwitchLevel;
1337
+ }
1338
+
1339
+ /**
1340
+ * motionary/components/page — page & app-wide effects (v2.7).
1341
+ * Page transitions (`pageTransition()`, `enableMpaTransitions()`,
1342
+ * `themeTransition()`), `<usa-cursor>`, `smoothScroll()` / `scrollToTarget()`,
1343
+ * `<usa-fullpage>`, `<usa-loading-bar>` + `loadingBar`, `<usa-back-to-top>`,
1344
+ * `<usa-ambient>`, `<usa-splash>`, `<usa-auto-skeleton>` and the global motion
1345
+ * intensity (`setMotionIntensity()`, `<usa-motion-switch>`).
1346
+ */
1347
+
1348
+ declare global {
1349
+ interface HTMLElementTagNameMap {
1350
+ 'usa-cursor': UsaCursorElement;
1351
+ 'usa-fullpage': UsaFullpageElement;
1352
+ 'usa-loading-bar': UsaLoadingBarElement;
1353
+ 'usa-back-to-top': UsaBackToTopElement;
1354
+ 'usa-ambient': UsaAmbientElement;
1355
+ 'usa-splash': UsaSplashElement;
1356
+ 'usa-auto-skeleton': UsaAutoSkeletonElement;
1357
+ 'usa-motion-switch': UsaMotionSwitchElement;
1358
+ }
1359
+ }
1360
+
1361
+ /**
1362
+ * `<usa-timeline>` — declarative choreography. Every descendant with
1363
+ * `data-tl="<preset>"` becomes a step, in document order; `data-at`
1364
+ * (`'-=200'`, `'<'`, `'label+=100'`, ms), `data-duration` and `data-label`
1365
+ * fine-tune it.
1366
+ *
1367
+ * Attributes: `trigger` (`view` default · `click` · `manual`), `scrub`
1368
+ * (progress follows scroll instead of playing), `overlap` (ms each step
1369
+ * overlaps the previous, default 0), `duration` (600), `stagger` (ms),
1370
+ * `repeat` (replay every time it enters the viewport). 4.1: `scrub` runs on native
1371
+ * ScrollTimeline / ViewTimeline when supported (`data-native` is set); `scrub="scroll"`
1372
+ * and `smooth` tune it (5.0: `scrub="js"` removed — the JS engine is automatic). Methods: `play()`,
1373
+ * `reverse()`, `seek(t)`; property `timeline`. Event `usa:complete`.
1374
+ * Reduced motion: steps appear in their final state.
1375
+ */
1376
+ interface UsaTimelineElement extends UsaElement {
1377
+ readonly timeline: Timeline | null;
1378
+ play(): Promise<void>;
1379
+ reverse(): Promise<void>;
1380
+ seek(to: number | string): void;
1381
+ }
1382
+
1383
+ /**
1384
+ * motionary/components/timeline — choreography (v3.1).
1385
+ * `timeline()` chains, overlaps, labels, seeks, reverses and scroll-scrubs
1386
+ * WAAPI animations on one playhead; `<usa-timeline>` builds one from
1387
+ * `data-tl` children.
1388
+ */
1389
+
1390
+ declare global {
1391
+ interface HTMLElementTagNameMap {
1392
+ 'usa-timeline': UsaTimelineElement;
1393
+ }
1394
+ }
1395
+
1396
+ type SwipeDirection = 'left' | 'right' | 'up' | 'down';
1397
+
1398
+ /**
1399
+ * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows
1400
+ * the finger (rubber-banded past `distance`), flies out on a swipe or a drag
1401
+ * past `distance`, otherwise springs home with the release velocity.
1402
+ *
1403
+ * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`
1404
+ * (spring), `dismiss` (remove the element after flying out), `disabled`.
1405
+ * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`
1406
+ * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.
1407
+ * Reduced motion: no follow / fly-out animation, events still fire.
1408
+ */
1409
+ interface UsaSwipeableElement extends UsaElement {
1410
+ swipe(direction: SwipeDirection): void;
1411
+ reset(): void;
1412
+ readonly offset: number;
1413
+ }
1414
+
1415
+ /**
1416
+ * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad
1417
+ * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;
1418
+ * scale and position spring back inside the bounds on release.
1419
+ *
1420
+ * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.
1421
+ * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.
1422
+ * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.
1423
+ */
1424
+ interface UsaPinchZoomElement extends UsaElement {
1425
+ readonly scale: number;
1426
+ zoomTo(scale: number): void;
1427
+ }
1428
+
1429
+ /**
1430
+ * motionary/components/gesture — unified gestures (v3.2).
1431
+ * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap
1432
+ * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)
1433
+ * and `<usa-pinch-zoom>` are built on it.
1434
+ */
1435
+
1436
+ declare global {
1437
+ interface HTMLElementTagNameMap {
1438
+ 'usa-swipeable': UsaSwipeableElement;
1439
+ 'usa-pinch-zoom': UsaPinchZoomElement;
1440
+ }
1441
+ }
1442
+
1443
+ /**
1444
+ * `<usa-draw>` — line drawing: every stroke of the SVG inside draws itself.
1445
+ * Attributes: `trigger` (`view` default · `hover` · `click` · `scrub`),
1446
+ * `duration` (1600), `stagger` (0–0.9 share of the timeline, 0.2), `fill`
1447
+ * (fade the fill in after drawing), `repeat`. Method `play()`, property
1448
+ * `progress`, event `usa:complete`. Reduced motion: drawn immediately.
1449
+ */
1450
+ interface UsaDrawElement extends UsaElement {
1451
+ play(): void;
1452
+ progress: number;
1453
+ }
1454
+
1455
+ /**
1456
+ * `<usa-morph>` — morphs an SVG path through a list of shapes.
1457
+ * Put a `<svg><path></path></svg>` inside (one is created otherwise) and set
1458
+ * `paths="M… | M… | M…"` (same command structure morphs smoothly, others
1459
+ * switch at the midpoint). Attributes: `trigger` (`click` default · `hover`
1460
+ * · `auto` · `view`), `interval` (ms for auto, 2000), `duration` (600).
1461
+ * Property `index`, method `next()`, event `usa:change`.
1462
+ * Reduced motion: shapes switch without animating; `auto` does not cycle.
1463
+ */
1464
+ interface UsaMorphElement extends UsaElement {
1465
+ readonly index: number;
1466
+ next(): Promise<void>;
1467
+ }
1468
+
1469
+ /**
1470
+ * `<usa-mask-reveal>` — reveals its content through a growing mask shape.
1471
+ * Attributes: `shape` (`circle` default · `diamond` · `wipe` · `wipe-up` ·
1472
+ * `iris` · `star`), `duration` (900), `delay`, `trigger` (`view` · `hover`
1473
+ * · `click`), `repeat`, `at` (`x% y%` origin for circle). Event
1474
+ * `usa:complete`. Reduced motion: content is shown without the mask.
1475
+ */
1476
+ interface UsaMaskRevealElement extends UsaElement {
1477
+ reveal(): Promise<void>;
1478
+ }
1479
+
1480
+ /**
1481
+ * `<usa-anim-icon name="bell">` — an animated stroke icon that plays its
1482
+ * motion on `trigger` (`hover` default · `click` · `view` · `loop`).
1483
+ * Attributes: `name` (see `ANIM_ICONS`), `size` (24), `label` (accessible
1484
+ * name; decorative when absent). Method `play()`. Reduced motion: static.
1485
+ */
1486
+ interface UsaAnimIconElement extends UsaElement {
1487
+ play(): void;
1488
+ }
1489
+
1490
+ /**
1491
+ * motionary/components/svg — SVG animation (v3.3).
1492
+ * `<usa-draw>` (line drawing), `<usa-morph>` (path morph), `<usa-mask-reveal>`
1493
+ * (mask / clip-path reveals) and `<usa-anim-icon>` (animated icons), plus
1494
+ * `interpolatePath()`, `morphTo()`, `drawLines()`.
1495
+ */
1496
+
1497
+ declare global {
1498
+ interface HTMLElementTagNameMap {
1499
+ 'usa-draw': UsaDrawElement;
1500
+ 'usa-morph': UsaMorphElement;
1501
+ 'usa-mask-reveal': UsaMaskRevealElement;
1502
+ 'usa-anim-icon': UsaAnimIconElement;
1503
+ }
1504
+ }
1505
+
1506
+ /**
1507
+ * Shared shell for the WebGL elements: a canvas over (or behind) the
1508
+ * content that renders only while visible and the tab is shown, a DPR cap
1509
+ * of 2, and a graceful fallback (`data-fallback`) when WebGL, the shader
1510
+ * or the image (CORS) is unavailable — the original content / CSS stays.
1511
+ */
1512
+ interface UsaGLElement extends UsaElement {
1513
+ /** `true` once WebGL rendering is active (otherwise the CSS fallback shows). */
1514
+ readonly active: boolean;
1515
+ }
1516
+
1517
+ /**
1518
+ * motionary/components/webgl — lightweight canvas / WebGL (v3.4).
1519
+ * `<usa-shader>` (shader backgrounds), `<usa-distort>` (hover image
1520
+ * distortion), `<usa-liquid>` (ripple images) on a tiny single-quad runner
1521
+ * (`glQuad()`), with graceful fallbacks when WebGL is unavailable.
1522
+ */
1523
+
1524
+ declare global {
1525
+ interface HTMLElementTagNameMap {
1526
+ 'usa-shader': UsaGLElement;
1527
+ 'usa-distort': UsaGLElement;
1528
+ 'usa-liquid': UsaGLElement;
1529
+ 'usa-post-fx': UsaGLElement;
1530
+ }
1531
+ }
1532
+
1533
+ /**
1534
+ * `<usa-cube>` — a CSS 3D cube whose up-to-six element children are its faces
1535
+ * (front, right, back, left, top, bottom). Rotate with drag / swipe, arrow
1536
+ * keys, `autoplay` (ms) or `show(face | index)`; spring-driven.
1537
+ * Attributes: `size` (px, 200), `autoplay`, `perspective` (900).
1538
+ * `usa:change` (`{ index, face }`). Reduced motion: instant face switch.
1539
+ */
1540
+ interface UsaCubeElement extends UsaElement {
1541
+ readonly index: number;
1542
+ show(face: number | string): void;
1543
+ next(): void;
1544
+ prev(): void;
1545
+ }
1546
+
1547
+ /**
1548
+ * `<usa-depth>` — depth parallax: children with `data-depth` (-1…1, 0 = the
1549
+ * screen plane) move and scale by depth as the pointer moves, the device
1550
+ * tilts (`orientation`) or the page scrolls (`scroll`).
1551
+ * Attributes: `source` (`pointer` default · `orientation` · `scroll` ·
1552
+ * space-separated mix), `strength` (px at depth 1, 40), `rotate` (max tilt
1553
+ * of the whole scene in deg, 0). `requestPermission()` for iOS motion.
1554
+ * Reduced motion: layers stay flat.
1555
+ */
1556
+ interface UsaDepthElement extends UsaElement {
1557
+ /** Current -1…1 input. */
1558
+ readonly tilt: {
1559
+ x: number;
1560
+ y: number;
1561
+ };
1562
+ requestPermission(): Promise<boolean>;
1563
+ }
1564
+
1565
+ /**
1566
+ * motionary/components/depth — 3D (v3.5).
1567
+ * `<usa-cube>` (CSS 3D cube), `<usa-depth>` (layered depth parallax driven by
1568
+ * pointer, device orientation or scroll) and `deviceTilt()`. The 3D ring
1569
+ * carousel is `<usa-carousel-3d>` in `components/cards`.
1570
+ */
1571
+
1572
+ declare global {
1573
+ interface HTMLElementTagNameMap {
1574
+ 'usa-cube': UsaCubeElement;
1575
+ 'usa-depth': UsaDepthElement;
1576
+ }
1577
+ }
1578
+
1579
+ /**
1580
+ * `<usa-auto-animate>` — wraps `autoAnimate()`: any change to its children
1581
+ * (add, remove, re-order, filter, size) animates. Attributes `duration`
1582
+ * (300), `no-scale`. Works for lists and CSS grids alike.
1583
+ */
1584
+ interface UsaAutoAnimateElement extends UsaElement {
1585
+ enable(): void;
1586
+ disable(): void;
1587
+ }
1588
+ /**
1589
+ * `<usa-masonry>` — a masonry (Pinterest-style) grid: children are placed in
1590
+ * the shortest column and glide to new spots when the width, the items or
1591
+ * their sizes change. Attributes `columns` (fixed count) or `min` (min
1592
+ * column width px, 220), `gap` (16). Without JS layout support it is a
1593
+ * plain CSS multi-column flow. Reduced motion: no glide.
1594
+ */
1595
+ interface UsaMasonryElement extends UsaElement {
1596
+ layout(): void;
1597
+ }
1598
+
1599
+ /**
1600
+ * motionary/components/layout — layout animation (v3.6).
1601
+ * `autoAnimate()` / `<usa-auto-animate>` (list & grid reflow),
1602
+ * `<usa-masonry>`, and `sharedTransition()` for shared-element transitions
1603
+ * (View Transitions API with a FLIP fallback).
1604
+ */
1605
+
1606
+ declare global {
1607
+ interface HTMLElementTagNameMap {
1608
+ 'usa-auto-animate': UsaAutoAnimateElement;
1609
+ 'usa-masonry': UsaMasonryElement;
1610
+ }
1611
+ }
1612
+
1613
+ /**
1614
+ * `<usa-pack name="ecommerce">` — applies an effect pack (`ecommerce` ·
1615
+ * `portfolio` · `dashboard` · `game` · `landing`) to its subtree:
1616
+ * descendants opt in with `data-role` (see `PACKS`). Re-applies when
1617
+ * `name` changes; undone on disconnect.
1618
+ */
1619
+ interface UsaPackElement extends UsaElement {
1620
+ readonly roles: string[];
1621
+ }
1622
+
1623
+ /**
1624
+ * motionary/components/packs — effect packs (v3.9).
1625
+ * Ready-made motion for e-commerce, portfolio, dashboard, game UI and
1626
+ * landing pages: mark elements with `data-role` and apply a pack with
1627
+ * `<usa-pack name="…">` or `applyPack(name, root)`. Includes `flyToCart()`
1628
+ * and `countUp()`.
1629
+ */
1630
+
1631
+ declare global {
1632
+ interface HTMLElementTagNameMap {
1633
+ 'usa-pack': UsaPackElement;
1634
+ }
1635
+ }
1636
+
1637
+ /** The component categories and their default tags. */
1638
+ declare const COMPONENT_CATEGORIES: {
1639
+ readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
1640
+ readonly text: readonly ["usa-typewriter", "usa-split-text", "usa-scramble", "usa-counter", "usa-shimmer-text", "usa-text-rotate", "usa-wave-text", "usa-glitch", "usa-gradient-text", "usa-handwriting", "usa-scroll-highlight"];
1641
+ readonly interaction: readonly ["usa-ripple", "usa-magnetic", "usa-tilt", "usa-spotlight", "usa-press", "usa-toggle"];
1642
+ readonly feedback: readonly ["usa-spinner", "usa-skeleton", "usa-progress", "usa-toaster", "usa-check"];
1643
+ readonly background: readonly ["usa-aurora", "usa-particles", "usa-grain", "usa-marquee", "usa-acrylic", "usa-grid-glow", "usa-blobs", "usa-water-ripple", "usa-dot-network"];
1644
+ readonly transitions: readonly ["usa-dialog", "usa-accordion", "usa-view-switch"];
1645
+ readonly physics: readonly ["usa-spring", "usa-draggable", "usa-overscroll"];
1646
+ readonly cards: readonly ["usa-card", "usa-card-stack", "usa-sticky-stack", "usa-carousel-3d"];
1647
+ readonly click: readonly ["usa-click", "usa-button", "usa-icon-morph", "usa-like", "usa-hold", "usa-double-tap", "usa-checkbox"];
1648
+ readonly ui: readonly ["usa-tabs", "usa-drawer", "usa-bottom-sheet", "usa-pull-refresh", "usa-fab", "usa-navbar", "usa-slider", "usa-rating", "usa-tooltip", "usa-popover", "usa-badge", "usa-avatar-stack"];
1649
+ readonly page: readonly ["usa-cursor", "usa-fullpage", "usa-loading-bar", "usa-back-to-top", "usa-ambient", "usa-splash", "usa-auto-skeleton", "usa-motion-switch"];
1650
+ readonly timeline: readonly ["usa-timeline"];
1651
+ readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
1652
+ readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
1653
+ readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid", "usa-post-fx"];
1654
+ readonly depth: readonly ["usa-cube", "usa-depth"];
1655
+ readonly layout: readonly ["usa-auto-animate", "usa-masonry"];
1656
+ readonly packs: readonly ["usa-pack"];
1657
+ readonly fx: readonly ["usa-fx"];
1658
+ };
1659
+ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
1660
+
1661
+ /**
1662
+ * `<usa-fx effect="pop" trigger="click">` — plays any registered effect
1663
+ * (`registerEffect()`) on its first element child (or itself with `self`).
1664
+ * `trigger`: `click` (default) · `hover` · `enter` · `load` · `loop` · `manual`;
1665
+ * `options` (JSON) is passed to the effect; `once`. Method `play()`.
1666
+ */
1667
+ interface UsaFxElement extends UsaElement {
1668
+ readonly target: HTMLElement;
1669
+ play(): Promise<void>;
1670
+ }
1671
+
1672
+ /**
1673
+ * motionary/components/fx — unified plugin-style effects (5.0).
1674
+ * `registerEffect({ name, kind, run })`, `playEffect(el, name)`,
1675
+ * `bindEffect(el, name, { trigger })`, `<usa-fx effect trigger>`. Built-ins:
1676
+ * every timeline preset (`enter`), `pulse` · `pop` · `jelly` · `wiggle` ·
1677
+ * `heartbeat` · `bounce` · `flash` · `tada` · `shake` (attention),
1678
+ * `burst` · `confetti` · `ripple` (click). More packs: `motionary/components/effects`.
1679
+ */
1680
+
1681
+ declare global {
1682
+ interface HTMLElementTagNameMap {
1683
+ 'usa-fx': UsaFxElement;
1684
+ }
1685
+ }
1686
+
1687
+ /**
1688
+ * Framework-neutral binding for `<usa-*>` elements (v3.8): set DOM
1689
+ * **properties** and listen to `usa:*` events, with update / destroy — the
1690
+ * shape Svelte actions, Solid directives and Angular directives all share.
1691
+ */
1692
+ interface UsaBinding {
1693
+ /** DOM properties to set (`checked`, `value`, `open`, `index`…). */
1694
+ props?: Record<string, unknown>;
1695
+ /** Event handlers by name; `change` is shorthand for `usa:change`. */
1696
+ on?: Record<string, (e: CustomEvent) => void>;
1697
+ }
1698
+ /** Normalise an event key: `change` → `usa:change`, `usa:change` stays. */
1699
+ declare const usaEventName: (k: string) => string;
1700
+ /** Bind properties and `usa:*` listeners to an element; returns `{ update, destroy }`. */
1701
+ declare function bindUsa(el: HTMLElement, binding?: UsaBinding): {
1702
+ update(b: UsaBinding): void;
1703
+ destroy(): void;
1704
+ };
1705
+
1706
+ /**
1707
+ * motionary/components/jsx — JSX typings for the raw `<usa-*>` tags (v2.9).
1708
+ *
1709
+ * ```ts
1710
+ * // src/usa-jsx.d.ts (React 18/19)
1711
+ * import type { UsaIntrinsicElements } from 'motionary/components/jsx';
1712
+ * declare module 'react' { namespace JSX { interface IntrinsicElements extends UsaIntrinsicElements {} } }
1713
+ * // Solid / Preact / other JSX: extend their JSX.IntrinsicElements the same way.
1714
+ * ```
1715
+ */
1716
+
1717
+ type Tags = (typeof COMPONENT_CATEGORIES)[keyof typeof COMPONENT_CATEGORIES][number];
1718
+ /** Attributes accepted by every `<usa-*>` element (all component attributes are strings / booleans). */
1719
+ interface UsaAttributes {
1720
+ [attr: string]: unknown;
1721
+ class?: string;
1722
+ className?: string;
1723
+ id?: string;
1724
+ style?: unknown;
1725
+ slot?: string;
1726
+ variant?: 'minimal' | 'neon' | 'glass' | 'brutalist' | 'fluent' | 'material' | (string & {});
1727
+ children?: unknown;
1728
+ ref?: unknown;
1729
+ }
1730
+ type UsaIntrinsicElements = {
1731
+ [K in Tags]: UsaAttributes;
1732
+ };
1733
+
1734
+ /**
1735
+ * Solid directive (`use:usa`). Solid calls it with the element and an
1736
+ * accessor; since 4.0.1 the binding is tracked with `createRenderEffect`, so
1737
+ * signals read inside `{{ props, on }}` update the element automatically and
1738
+ * the listeners are removed on cleanup. `refresh()` is kept for code that
1739
+ * calls the directive outside a reactive owner.
1740
+ */
1741
+ declare function usa(el: HTMLElement, accessor: () => UsaBinding | undefined): {
1742
+ refresh(): void;
1743
+ destroy(): void;
1744
+ };
1745
+ /** Register the elements (all, or some categories) — call from `onMount` in SSR apps. */
1746
+ declare function defineUsa(categories?: ComponentCategory[]): void;
1747
+ /** JSX intrinsic elements for Solid (same attribute types as the React/Preact ones). */
1748
+ type SolidUsaIntrinsicElements = UsaIntrinsicElements;
1749
+
1750
+ export { bindUsa, defineUsa, usa, usaEventName };
1751
+ export type { SolidUsaIntrinsicElements, UsaBinding };