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,968 @@
1
+ 'use strict';
2
+
3
+ var base = require('../chunks/base-BaQV-2ha.cjs');
4
+ var core = require('../chunks/core-BGAyaY6L.cjs');
5
+ require('./tokens.cjs');
6
+
7
+ var css$5 = "usa-typewriter{white-space:pre-wrap}usa-typewriter .usa-tw-caret{display:inline-block;width:var(--usa-caret-width,0.08em);height:1.05em;margin-left:0.06em;vertical-align:-0.12em;background:var(--usa-caret-color,currentColor);animation:usa-caret 1.06s steps(1) infinite}usa-typewriter[data-typing] .usa-tw-caret{animation:none}usa-typewriter[data-no-cursor] .usa-tw-caret{display:none}@keyframes usa-caret{50%{opacity:0}}@media (prefers-reduced-motion:reduce){usa-typewriter .usa-tw-caret,usa-shimmer-text{animation:none}}";
8
+
9
+ function defineTypewriter(tag = 'usa-typewriter') {
10
+ return base.defineElement(tag, (Base) => class UsaTypewriter extends Base {
11
+ constructor() {
12
+ super(...arguments);
13
+ this._source = null;
14
+ this._out = null;
15
+ this._timer = 0;
16
+ this._running = false;
17
+ }
18
+ static get observedAttributes() {
19
+ return ['text', 'words'];
20
+ }
21
+ get phrases() {
22
+ const words = this.getAttribute('words');
23
+ if (words)
24
+ return words.split('|').map((w) => w.trim()).filter(Boolean);
25
+ return [this.getAttribute('text') ?? this._source ?? ''];
26
+ }
27
+ mount() {
28
+ if (this._source === null)
29
+ this._source = (this.textContent || '').trim();
30
+ const phrases = this.phrases;
31
+ const sr = base.srText(phrases.join(', '));
32
+ this._out = document.createElement('span');
33
+ this._out.className = 'usa-tw-text';
34
+ this._out.setAttribute('aria-hidden', 'true');
35
+ const caret = document.createElement('span');
36
+ caret.className = 'usa-tw-caret';
37
+ caret.setAttribute('aria-hidden', 'true');
38
+ this.replaceChildren(sr, this._out, caret);
39
+ this.toggleAttribute('data-no-cursor', this.getAttribute('cursor') === 'false');
40
+ if (this.reduced) {
41
+ this._out.textContent = phrases[0] || '';
42
+ return;
43
+ }
44
+ const start = this.str('start', 'view');
45
+ if (start === 'load')
46
+ this.start();
47
+ else if (start === 'view') {
48
+ this.inView((visible) => {
49
+ if (visible && !this._running && !this._out?.textContent)
50
+ this.start();
51
+ });
52
+ }
53
+ }
54
+ unmount() {
55
+ this.stop();
56
+ }
57
+ stop() {
58
+ clearTimeout(this._timer);
59
+ this._timer = 0;
60
+ this._running = false;
61
+ this.removeAttribute('data-typing');
62
+ }
63
+ restart() {
64
+ this.stop();
65
+ if (this._out)
66
+ this._out.textContent = '';
67
+ this.start();
68
+ }
69
+ start() {
70
+ if (this._running || !this._out)
71
+ return;
72
+ const out = this._out;
73
+ const phrases = this.phrases;
74
+ if (this.reduced) {
75
+ out.textContent = phrases[0] || '';
76
+ return;
77
+ }
78
+ this._running = true;
79
+ const speed = this.num('speed', 55);
80
+ const del = this.num('delete-speed', 30);
81
+ const pause = this.num('pause', 1400);
82
+ const loop = this.flag('loop') || phrases.length > 1;
83
+ let p = 0;
84
+ let i = 0;
85
+ let deleting = false;
86
+ const tick = () => {
87
+ const word = phrases[p] || '';
88
+ if (!deleting) {
89
+ i++;
90
+ out.textContent = word.slice(0, i);
91
+ this.setAttribute('data-typing', '');
92
+ if (i >= word.length) {
93
+ this.removeAttribute('data-typing');
94
+ const last = p === phrases.length - 1;
95
+ if (last)
96
+ this.emit('complete');
97
+ if (!loop && last) {
98
+ this._running = false;
99
+ return;
100
+ }
101
+ deleting = true;
102
+ this._timer = setTimeout(tick, pause);
103
+ return;
104
+ }
105
+ this._timer = setTimeout(tick, speed * (0.6 + Math.random() * 0.8));
106
+ }
107
+ else {
108
+ i--;
109
+ out.textContent = word.slice(0, Math.max(0, i));
110
+ if (i <= 0) {
111
+ deleting = false;
112
+ p = (p + 1) % phrases.length;
113
+ this._timer = setTimeout(tick, speed * 4);
114
+ return;
115
+ }
116
+ this._timer = setTimeout(tick, del);
117
+ }
118
+ };
119
+ this._timer = setTimeout(tick, this.num('delay', 0));
120
+ }
121
+ }, { id: 'typewriter', text: css$5 });
122
+ }
123
+
124
+ var css$4 = "usa-split-text .usa-split-word{display:inline-block;white-space:nowrap}usa-split-text .usa-split-unit{display:inline-block;white-space:pre}usa-split-text[data-state=\"hidden\"] .usa-split-unit{opacity:0}usa-split-text[data-state=\"play\"] .usa-split-unit{animation:usa-split-rise var(--usa-split-duration,620ms) cubic-bezier(0.22,1,0.36,1) both;animation-delay:calc(var(--usa-split-delay,0ms) + var(--i,0) * var(--usa-split-stagger,28ms))}usa-split-text[effect=\"fade\"][data-state=\"play\"] .usa-split-unit{animation-name:usa-split-fade}usa-split-text[effect=\"blur\"][data-state=\"play\"] .usa-split-unit{animation-name:usa-split-blur}usa-split-text[effect=\"flip\"][data-state=\"play\"] .usa-split-unit{animation-name:usa-split-flip;transform-origin:50% 100%}usa-split-text[effect=\"pop\"][data-state=\"play\"] .usa-split-unit{animation-name:usa-split-pop;animation-timing-function:cubic-bezier(0.34,1.56,0.64,1)}@keyframes usa-split-rise{from{opacity:0;transform:translate3d(0,0.6em,0)}to{opacity:1;transform:none}}@keyframes usa-split-fade{from{opacity:0}to{opacity:1}}@keyframes usa-split-blur{from{opacity:0;filter:blur(8px)}to{opacity:1;filter:none}}@keyframes usa-split-flip{from{opacity:0;transform:perspective(500px) rotateX(-80deg)}to{opacity:1;transform:none}}@keyframes usa-split-pop{from{opacity:0;transform:scale(0.3)}to{opacity:1;transform:none}}@media (prefers-reduced-motion:reduce){usa-split-text .usa-split-unit{animation:none !important;opacity:1 !important}}";
125
+
126
+ const CJK = /[\u2E80-\u2FFF\u3000-\u303F\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/;
127
+ /** Scripts whose letters join (splitting them would break shaping). */
128
+ const JOINING_SCRIPT = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/;
129
+ const RTL = /[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/;
130
+ const SR = 'position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0';
131
+ function segmenter(locale, granularity) {
132
+ const S = globalThis.Intl?.Segmenter;
133
+ if (typeof S !== 'function')
134
+ return null;
135
+ try {
136
+ return new S(locale || undefined, { granularity });
137
+ }
138
+ catch {
139
+ return null;
140
+ }
141
+ }
142
+ /** Grapheme clusters of `s` (emoji / combining marks stay whole). */
143
+ function graphemes(s, locale) {
144
+ const seg = segmenter(locale, 'grapheme');
145
+ if (seg)
146
+ return Array.from(seg.segment(s), (x) => x.segment);
147
+ return Array.from(s);
148
+ }
149
+ /**
150
+ * Word-ish tokens of `s`, whitespace kept as separate tokens. CJK text is
151
+ * segmented into words with `Intl.Segmenter`, or per character without it.
152
+ */
153
+ function words(s, locale) {
154
+ const seg = segmenter(locale, 'word');
155
+ const out = [];
156
+ if (seg) {
157
+ for (const x of seg.segment(s)) {
158
+ const last = out[out.length - 1];
159
+ // glue punctuation onto the previous word so it never starts a line alone
160
+ if (!x.isWordLike && !/^\s+$/.test(x.segment) && last && !/^\s+$/.test(last))
161
+ out[out.length - 1] = last + x.segment;
162
+ else
163
+ out.push(x.segment);
164
+ }
165
+ return out;
166
+ }
167
+ for (const part of s.split(/(\s+)/)) {
168
+ if (!part)
169
+ continue;
170
+ if (/^\s+$/.test(part) || !CJK.test(part))
171
+ out.push(part);
172
+ else {
173
+ let buf = '';
174
+ for (const ch of Array.from(part)) {
175
+ if (CJK.test(ch)) {
176
+ if (buf)
177
+ out.push(buf), (buf = '');
178
+ out.push(ch);
179
+ }
180
+ else if (/[\p{P}]/u.test(ch) && out.length)
181
+ out[out.length - 1] += ch;
182
+ else
183
+ buf += ch;
184
+ }
185
+ if (buf)
186
+ out.push(buf);
187
+ }
188
+ }
189
+ return out;
190
+ }
191
+ function dirOf(el, text) {
192
+ const attr = el.closest?.('[dir]')?.getAttribute('dir');
193
+ if (attr === 'rtl' || attr === 'ltr')
194
+ return attr;
195
+ try {
196
+ const d = getComputedStyle(el).direction;
197
+ if (d === 'rtl')
198
+ return 'rtl';
199
+ }
200
+ catch {
201
+ /* no layout */
202
+ }
203
+ return RTL.test(text) && !/[A-Za-z]/.test(text.replace(RTL, '')) ? 'rtl' : 'ltr';
204
+ }
205
+ function splitText(el, options = {}) {
206
+ const by = new Set((Array.isArray(options.by) ? options.by : String(options.by ?? 'char').split(/[\s,]+/)).filter(Boolean));
207
+ const cls = options.className || 'usa-split';
208
+ const locale = options.locale || el.closest?.('[lang]')?.getAttribute('lang') || undefined;
209
+ const original = Array.from(el.childNodes).map((n) => n.cloneNode(true));
210
+ const text = el.textContent || '';
211
+ const direction = dirOf(el, text);
212
+ const chars = [];
213
+ const wordEls = [];
214
+ let lines = [];
215
+ const doc = el.ownerDocument;
216
+ const span = (c, t) => {
217
+ const s = doc.createElement('span');
218
+ s.className = c;
219
+ if (t !== undefined)
220
+ s.textContent = t;
221
+ return s;
222
+ };
223
+ const splitNode = (node) => {
224
+ if (node.nodeType === 3) {
225
+ const frag = doc.createDocumentFragment();
226
+ for (const w of words(node.nodeValue || '', locale)) {
227
+ if (/^\s+$/.test(w)) {
228
+ frag.append(doc.createTextNode(w));
229
+ continue;
230
+ }
231
+ const wordEl = span(`${cls}-word`);
232
+ wordEl.style.display = 'inline-block';
233
+ wordEl.style.whiteSpace = 'nowrap';
234
+ wordEl.dataset.index = String(wordEls.length);
235
+ wordEls.push(wordEl);
236
+ // Arabic script joins its letters: keep the word whole (shaping), even in char mode.
237
+ if (by.has('char') && !JOINING_SCRIPT.test(w)) {
238
+ for (const g of graphemes(w, locale)) {
239
+ const c = span(`${cls}-char`, g);
240
+ c.style.display = 'inline-block';
241
+ c.dataset.index = String(chars.length);
242
+ chars.push(c);
243
+ wordEl.append(c);
244
+ }
245
+ }
246
+ else {
247
+ wordEl.textContent = w;
248
+ if (by.has('char')) {
249
+ wordEl.dataset.whole = '';
250
+ chars.push(wordEl);
251
+ }
252
+ }
253
+ frag.append(wordEl);
254
+ }
255
+ node.parentNode.replaceChild(frag, node);
256
+ }
257
+ else if (node.nodeType === 1 && !/^(BR|SCRIPT|STYLE|SVG|IMG)$/i.test(node.tagName)) {
258
+ Array.from(node.childNodes).forEach(splitNode);
259
+ }
260
+ };
261
+ const wrap = doc.createElement('span');
262
+ wrap.setAttribute('aria-hidden', 'true');
263
+ wrap.className = `${cls}-body`;
264
+ original.forEach((n) => wrap.append(n.cloneNode(true)));
265
+ Array.from(wrap.childNodes).forEach(splitNode);
266
+ const sr = span(`${cls}-sr`, text.replace(/\s+/g, ' ').trim());
267
+ sr.setAttribute('style', SR);
268
+ el.replaceChildren(sr, wrap);
269
+ el.setAttribute('data-split', [...by].join(' '));
270
+ if (direction === 'rtl')
271
+ el.setAttribute('data-split-dir', 'rtl');
272
+ const relayout = () => {
273
+ // unwrap old lines
274
+ for (const l of lines)
275
+ l.replaceWith(...Array.from(l.childNodes));
276
+ lines = [];
277
+ if (!by.has('line') || !wordEls.length)
278
+ return lines;
279
+ const groups = [];
280
+ let lastTop = null;
281
+ for (const w of wordEls) {
282
+ const top = Math.round(w.offsetTop);
283
+ if (lastTop === null || Math.abs(top - lastTop) > 2)
284
+ groups.push([]);
285
+ groups[groups.length - 1].push(w);
286
+ lastTop = top;
287
+ }
288
+ groups.forEach((g, i) => {
289
+ // only group words that share a parent (inline markup keeps its words)
290
+ const parent = g[0].parentNode;
291
+ const same = g.filter((w) => w.parentNode === parent);
292
+ const line = span(`${cls}-line`);
293
+ line.style.display = 'inline-block';
294
+ line.dataset.index = String(i);
295
+ parent.insertBefore(line, same[0]);
296
+ let n = same[0];
297
+ const end = same[same.length - 1];
298
+ while (n) {
299
+ const next = n.nextSibling;
300
+ line.append(n);
301
+ if (n === end)
302
+ break;
303
+ n = next;
304
+ }
305
+ // keep the space between lines outside the line box
306
+ lines.push(line);
307
+ });
308
+ return lines;
309
+ };
310
+ relayout();
311
+ return {
312
+ chars,
313
+ words: wordEls,
314
+ get lines() {
315
+ return lines;
316
+ },
317
+ direction,
318
+ relayout,
319
+ revert() {
320
+ el.replaceChildren(...original.map((n) => n.cloneNode(true)));
321
+ el.removeAttribute('data-split');
322
+ el.removeAttribute('data-split-dir');
323
+ },
324
+ };
325
+ }
326
+ /** Order indices `0…n-1` by choreography: from the start, end, center outwards, edges inwards, or random (seeded). */
327
+ function splitOrder(n, from = 'start', seed = 1) {
328
+ const idx = Array.from({ length: n }, (_, i) => i);
329
+ const mid = (n - 1) / 2;
330
+ if (from === 'end')
331
+ return idx.map((i) => n - 1 - i);
332
+ if (from === 'center')
333
+ return idx.map((i) => Math.round(Math.abs(i - mid) * 2) / 2);
334
+ if (from === 'edges')
335
+ return idx.map((i) => Math.round((mid - Math.abs(i - mid)) * 2) / 2);
336
+ if (from === 'random') {
337
+ let s = seed;
338
+ const r = () => ((s = (s * 16807) % 2147483647) / 2147483647);
339
+ const shuffled = idx.slice().sort(() => r() - 0.5);
340
+ const rank = [];
341
+ shuffled.forEach((v, i) => (rank[v] = i));
342
+ return rank;
343
+ }
344
+ return idx;
345
+ }
346
+ /**
347
+ * Split `el` and build a `timeline()` with one step per unit — play it,
348
+ * `scrub()` it with scroll, `reverse()` or `seek()` it.
349
+ *
350
+ * ```ts
351
+ * const { timeline: tl } = splitTimeline(h1, { by: 'char', preset: 'blur', from: 'center' });
352
+ * tl.play();
353
+ * ```
354
+ */
355
+ function splitTimeline(el, options = {}) {
356
+ const split = splitText(el, options);
357
+ const by = Array.isArray(options.by) ? options.by : String(options.by ?? 'char').split(/[\s,]+/);
358
+ const unit = options.unit || (by.includes('char') ? 'char' : by.includes('word') ? 'word' : 'line');
359
+ const units = unit === 'char' ? split.chars : unit === 'word' ? split.words : split.lines;
360
+ const stagger = options.stagger ?? (unit === 'char' ? 30 : unit === 'word' ? 80 : 140);
361
+ const order = splitOrder(units.length, options.from);
362
+ const tl = core.timeline({ defaults: { duration: options.duration ?? 500, easing: options.easing } });
363
+ units.forEach((u, i) => tl.to(u, options.preset || 'fade-up', { at: order[i] * stagger }));
364
+ tl.seek(0);
365
+ return { split, timeline: tl };
366
+ }
367
+
368
+ function defineSplitText(tag = 'usa-split-text') {
369
+ return base.defineElement(tag, (Base) => class UsaSplitText extends Base {
370
+ constructor() {
371
+ super(...arguments);
372
+ this._source = null;
373
+ this._timer = 0;
374
+ this._steps = 0;
375
+ }
376
+ static get observedAttributes() {
377
+ return ['by', 'text'];
378
+ }
379
+ get units() {
380
+ return Array.from(this.querySelectorAll('.usa-split-unit'));
381
+ }
382
+ mount() {
383
+ if (this._source === null)
384
+ this._source = this.getAttribute('text') ?? (this.textContent || '').replace(/\s+/g, ' ').trim();
385
+ const text = this.getAttribute('text') ?? this._source;
386
+ const mode = this.str('by', 'chars');
387
+ const byWords = mode !== 'chars';
388
+ const lang = this.closest('[lang]')?.getAttribute('lang') || undefined;
389
+ const frag = document.createDocumentFragment();
390
+ frag.append(base.srText(text));
391
+ const units = [];
392
+ for (const word of words(text, lang)) {
393
+ if (/^\s+$/.test(word)) {
394
+ frag.append(' ');
395
+ continue;
396
+ }
397
+ const wordEl = document.createElement('span');
398
+ wordEl.className = 'usa-split-word';
399
+ wordEl.setAttribute('aria-hidden', 'true');
400
+ const parts = byWords || JOINING_SCRIPT.test(word) ? [word] : graphemes(word, lang);
401
+ for (const part of parts) {
402
+ const u = document.createElement('span');
403
+ u.className = 'usa-split-unit';
404
+ u.textContent = part;
405
+ units.push(u);
406
+ wordEl.append(u);
407
+ }
408
+ frag.append(wordEl);
409
+ }
410
+ this.replaceChildren(frag);
411
+ // cascade order: per unit, or per line for by="lines"
412
+ let rank = units.map((_, k) => k);
413
+ if (mode === 'lines') {
414
+ let line = -1;
415
+ let top = null;
416
+ rank = units.map((u) => {
417
+ const t = Math.round(u.parentElement.offsetTop);
418
+ if (top === null || Math.abs(t - top) > 2)
419
+ line++;
420
+ top = t;
421
+ return line;
422
+ });
423
+ }
424
+ const groups = Math.max(0, ...rank) + 1;
425
+ const order = splitOrder(groups, this.str('from', 'start'));
426
+ units.forEach((u, k) => u.style.setProperty('--i', String(order[rank[k]] ?? 0)));
427
+ const i = Math.max(0, ...units.map((_, k) => order[rank[k]] ?? 0)) + 1;
428
+ this._steps = i;
429
+ this.style.setProperty('--usa-split-stagger', `${this.num('stagger', mode === 'lines' ? 140 : byWords ? 70 : 28)}ms`);
430
+ this.style.setProperty('--usa-split-duration', `${this.num('duration', 620)}ms`);
431
+ this.style.setProperty('--usa-split-delay', `${this.num('delay', 0)}ms`);
432
+ this.style.setProperty('--usa-split-count', String(i));
433
+ if (this.reduced) {
434
+ this.setAttribute('data-state', 'shown');
435
+ return;
436
+ }
437
+ this.setAttribute('data-state', 'hidden');
438
+ const trigger = this.str('trigger', 'view');
439
+ if (trigger === 'load')
440
+ this.play();
441
+ else if (trigger === 'view') {
442
+ this.inView((visible) => {
443
+ if (visible && this.getAttribute('data-state') === 'hidden')
444
+ this.play();
445
+ else if (!visible && this.flag('repeat'))
446
+ this.reset();
447
+ }, { threshold: 0.2 });
448
+ }
449
+ }
450
+ unmount() {
451
+ clearTimeout(this._timer);
452
+ }
453
+ play() {
454
+ clearTimeout(this._timer);
455
+ if (this.reduced) {
456
+ this.setAttribute('data-state', 'shown');
457
+ return;
458
+ }
459
+ // Restart the CSS animations
460
+ this.setAttribute('data-state', 'hidden');
461
+ void this.offsetWidth;
462
+ this.setAttribute('data-state', 'play');
463
+ const by = this.str('by', 'chars');
464
+ const total = this.num('delay', 0) + this.num('duration', 620) + Math.max(0, this._steps - 1) * this.num('stagger', by === 'lines' ? 140 : by === 'words' ? 70 : 28);
465
+ this._timer = setTimeout(() => {
466
+ this.setAttribute('data-state', 'shown');
467
+ this.emit('complete');
468
+ }, total);
469
+ }
470
+ reset() {
471
+ clearTimeout(this._timer);
472
+ this.setAttribute('data-state', this.reduced ? 'shown' : 'hidden');
473
+ }
474
+ }, { id: 'split-text', text: css$4 });
475
+ }
476
+
477
+ const GLYPHS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=<>/\\?!';
478
+ /** One frame of the scramble: the first `progress` share is resolved. */
479
+ function scrambleFrame(text, progress, glyphs = GLYPHS, rnd = Math.random) {
480
+ const done = Math.floor(text.length * progress);
481
+ let out = '';
482
+ for (let i = 0; i < text.length; i++) {
483
+ const ch = text[i];
484
+ out += i < done || /\s|[.,:;!?'"()\-–—]/.test(ch) ? ch : glyphs[Math.floor(rnd() * glyphs.length)];
485
+ }
486
+ return out;
487
+ }
488
+ function defineScramble(tag = 'usa-scramble') {
489
+ return base.defineElement(tag, (Base) => class UsaScramble extends Base {
490
+ constructor() {
491
+ super(...arguments);
492
+ this._source = null;
493
+ this._out = null;
494
+ this._frame = 0;
495
+ }
496
+ static get observedAttributes() {
497
+ return ['text'];
498
+ }
499
+ get text() {
500
+ return this.getAttribute('text') ?? this._source ?? '';
501
+ }
502
+ mount() {
503
+ if (this._source === null)
504
+ this._source = (this.textContent || '').trim();
505
+ this._out = document.createElement('span');
506
+ this._out.setAttribute('aria-hidden', 'true');
507
+ this._out.textContent = this.text;
508
+ this.replaceChildren(base.srText(this.text), this._out);
509
+ if (this.reduced)
510
+ return;
511
+ const trigger = this.str('trigger', 'view');
512
+ if (trigger === 'load')
513
+ this.play();
514
+ else if (trigger === 'hover') {
515
+ this.listen(this, 'pointerenter', () => this.play());
516
+ this.listen(this, 'focusin', () => this.play());
517
+ }
518
+ else if (trigger === 'view') {
519
+ let played = false;
520
+ this.inView((v) => {
521
+ if (v && !played) {
522
+ played = true;
523
+ this.play();
524
+ }
525
+ });
526
+ }
527
+ }
528
+ unmount() {
529
+ base.caf(this._frame);
530
+ this._frame = 0;
531
+ }
532
+ play() {
533
+ base.caf(this._frame);
534
+ const out = this._out;
535
+ const text = this.text;
536
+ if (!out || this.reduced) {
537
+ if (out)
538
+ out.textContent = text;
539
+ return Promise.resolve();
540
+ }
541
+ const duration = this.num('duration', 900);
542
+ const glyphs = this.str('chars', GLYPHS) || GLYPHS;
543
+ const t0 = base.now();
544
+ let last = -1;
545
+ return new Promise((resolve) => {
546
+ const step = () => {
547
+ const p = Math.min(1, Math.max(0, base.now() - t0) / duration);
548
+ // ~30 fps glyph churn is plenty and halves DOM writes
549
+ const bucket = Math.floor(p * duration / 33);
550
+ if (bucket !== last || p === 1) {
551
+ last = bucket;
552
+ out.textContent = p === 1 ? text : scrambleFrame(text, p, glyphs);
553
+ }
554
+ if (p < 1)
555
+ this._frame = base.raf(step);
556
+ else {
557
+ this._frame = 0;
558
+ this.emit('complete');
559
+ resolve();
560
+ }
561
+ };
562
+ this._frame = base.raf(step);
563
+ });
564
+ }
565
+ }, undefined);
566
+ }
567
+
568
+ var css$3 = "usa-counter{font-variant-numeric:tabular-nums}";
569
+
570
+ /** easeOutExpo */
571
+ const easeOutExpo = (t) => (t >= 1 ? 1 : 1 - Math.pow(2, -10 * t));
572
+ function defineCounter(tag = 'usa-counter') {
573
+ return base.defineElement(tag, (Base) => class UsaCounter extends Base {
574
+ constructor() {
575
+ super(...arguments);
576
+ this._current = NaN;
577
+ this._target = NaN;
578
+ this._frame = 0;
579
+ this._fmt = null;
580
+ }
581
+ static get observedAttributes() {
582
+ return ['to', 'decimals', 'locale', 'prefix', 'suffix', 'grouping'];
583
+ }
584
+ get value() {
585
+ return Number.isNaN(this._target) ? this.num('to', 0) : this._target;
586
+ }
587
+ set value(v) {
588
+ this.play(Number(v));
589
+ }
590
+ format(n) {
591
+ if (!this._fmt) {
592
+ const d = Math.max(0, Math.min(20, this.num('decimals', 0)));
593
+ const locale = this.getAttribute('locale') || (typeof document !== 'undefined' && document.documentElement.lang) || undefined;
594
+ try {
595
+ this._fmt = new Intl.NumberFormat(locale, { minimumFractionDigits: d, maximumFractionDigits: d, useGrouping: this.getAttribute('grouping') !== 'false' });
596
+ }
597
+ catch {
598
+ this._fmt = new Intl.NumberFormat(undefined, { minimumFractionDigits: d, maximumFractionDigits: d });
599
+ }
600
+ }
601
+ return `${this.str('prefix')}${this._fmt.format(n)}${this.str('suffix')}`;
602
+ }
603
+ render(n) {
604
+ this._current = n;
605
+ this.textContent = this.format(n);
606
+ }
607
+ changed(name) {
608
+ this._fmt = null;
609
+ if (name === 'to')
610
+ this.play();
611
+ else
612
+ this.render(Number.isNaN(this._current) ? this.num('from', 0) : this._current);
613
+ }
614
+ mount() {
615
+ this._fmt = null;
616
+ const to = this.num('to', 0);
617
+ if (this.reduced) {
618
+ this._target = to;
619
+ this.render(to);
620
+ return;
621
+ }
622
+ if (Number.isNaN(this._current))
623
+ this.render(this.num('from', 0));
624
+ const start = this.str('start', 'view');
625
+ if (start === 'load')
626
+ this.play();
627
+ else if (start === 'view') {
628
+ let done = false;
629
+ this.inView((v) => {
630
+ if (v && !done) {
631
+ done = true;
632
+ this.play();
633
+ }
634
+ }, { threshold: 0.4 });
635
+ }
636
+ }
637
+ unmount() {
638
+ base.caf(this._frame);
639
+ this._frame = 0;
640
+ }
641
+ play(to = this.num('to', 0)) {
642
+ base.caf(this._frame);
643
+ this._target = to;
644
+ const from = Number.isNaN(this._current) ? this.num('from', 0) : this._current;
645
+ if (this.reduced || from === to || !this.isConnected) {
646
+ this.render(to);
647
+ this.emit('complete', { value: to });
648
+ return Promise.resolve();
649
+ }
650
+ const duration = this.num('duration', 1600);
651
+ const t0 = base.now();
652
+ return new Promise((resolve) => {
653
+ const step = () => {
654
+ const t = Math.min(1, Math.max(0, base.now() - t0) / duration);
655
+ this.render(from + (to - from) * easeOutExpo(t));
656
+ if (t < 1)
657
+ this._frame = base.raf(step);
658
+ else {
659
+ this._frame = 0;
660
+ this.render(to);
661
+ this.emit('complete', { value: to });
662
+ resolve();
663
+ }
664
+ };
665
+ this._frame = base.raf(step);
666
+ });
667
+ }
668
+ }, { id: 'counter', text: css$3 });
669
+ }
670
+
671
+ var css$2 = "usa-shimmer-text{--usa-shimmer-color:currentColor;--usa-shimmer-shine:#fff;background:linear-gradient(var(--usa-shimmer-angle,110deg),var(--usa-shimmer-color) 35%,var(--usa-shimmer-shine) 50%,var(--usa-shimmer-color) 65%) 0 0 / 250% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent;animation:usa-shimmer var(--usa-shimmer-duration,2600ms) linear infinite}@keyframes usa-shimmer{from{background-position:100% 0}to{background-position:-150% 0}}";
672
+
673
+ function defineShimmerText(tag = 'usa-shimmer-text') {
674
+ return base.defineElement(tag, (Base) => class UsaShimmerText extends Base {
675
+ static get observedAttributes() {
676
+ return ['duration', 'color', 'shine', 'angle'];
677
+ }
678
+ mount() {
679
+ const set = (attr, prop, unit = '') => {
680
+ const v = this.getAttribute(attr);
681
+ if (v !== null)
682
+ this.style.setProperty(prop, v + unit);
683
+ else
684
+ this.style.removeProperty(prop);
685
+ };
686
+ set('duration', '--usa-shimmer-duration', 'ms');
687
+ set('color', '--usa-shimmer-color');
688
+ set('shine', '--usa-shimmer-shine');
689
+ set('angle', '--usa-shimmer-angle', 'deg');
690
+ }
691
+ }, { id: 'shimmer-text', text: css$2 });
692
+ }
693
+
694
+ var css$1 = "usa-text-rotate{display:inline-grid;vertical-align:bottom;overflow:hidden;padding-block:0.08em}usa-text-rotate .usa-rotate-word{grid-area:1 / 1;white-space:nowrap}usa-text-rotate .usa-rotate-word[data-hidden]{opacity:0}";
695
+
696
+ function defineTextRotate(tag = 'usa-text-rotate') {
697
+ return base.defineElement(tag, (Base) => class UsaTextRotate extends Base {
698
+ constructor() {
699
+ super(...arguments);
700
+ this._source = null;
701
+ this._index = 0;
702
+ this._timer = 0;
703
+ this._visible = true;
704
+ }
705
+ static get observedAttributes() {
706
+ return ['words', 'interval', 'paused'];
707
+ }
708
+ get index() {
709
+ return this._index;
710
+ }
711
+ get words() {
712
+ return (this.getAttribute('words') ?? this._source ?? '').split('|').map((w) => w.trim()).filter(Boolean);
713
+ }
714
+ mount() {
715
+ if (this._source === null)
716
+ this._source = (this.textContent || '').trim();
717
+ const words = this.words;
718
+ this.replaceChildren(base.srText(words.join(', ')), ...words.map((w, i) => {
719
+ const s = document.createElement('span');
720
+ s.className = 'usa-rotate-word';
721
+ s.textContent = w;
722
+ s.setAttribute('aria-hidden', 'true');
723
+ if (i !== this._index)
724
+ s.setAttribute('data-hidden', '');
725
+ return s;
726
+ }));
727
+ if (this._index >= words.length)
728
+ this._index = 0;
729
+ if (words.length < 2)
730
+ return;
731
+ this.inView((v) => (this._visible = v));
732
+ if (!this.flag('paused')) {
733
+ this._timer = setInterval(() => {
734
+ if (this._visible && !(typeof document !== 'undefined' && document.hidden))
735
+ this.next();
736
+ }, Math.max(400, this.num('interval', 2200)));
737
+ }
738
+ }
739
+ unmount() {
740
+ clearInterval(this._timer);
741
+ this._timer = 0;
742
+ }
743
+ next() {
744
+ const els = Array.from(this.querySelectorAll('.usa-rotate-word'));
745
+ if (els.length < 2)
746
+ return;
747
+ const prev = els[this._index];
748
+ this._index = (this._index + 1) % els.length;
749
+ const cur = els[this._index];
750
+ prev.setAttribute('data-hidden', '');
751
+ cur.removeAttribute('data-hidden');
752
+ const effect = this.reduced ? 'fade' : this.str('effect', 'slide');
753
+ const [inFrom, outTo] = effect === 'fade'
754
+ ? [{ opacity: 0 }, { opacity: 0 }]
755
+ : effect === 'flip'
756
+ ? [{ opacity: 0, transform: 'perspective(400px) rotateX(-90deg)' }, { opacity: 0, transform: 'perspective(400px) rotateX(90deg)' }]
757
+ : effect === 'blur'
758
+ ? [{ opacity: 0, filter: 'blur(8px)' }, { opacity: 0, filter: 'blur(8px)' }]
759
+ : [{ opacity: 0, transform: 'translateY(0.8em)' }, { opacity: 0, transform: 'translateY(-0.8em)' }];
760
+ const neutral = { opacity: 1, transform: 'none', filter: 'none' };
761
+ const pick = (f) => Object.fromEntries(Object.keys(f).map((k) => [k, neutral[k]]));
762
+ this.motion(prev, [{ ...pick(outTo) }, outTo], { duration: 380, easing: base.EASE_OUT });
763
+ this.motion(cur, [inFrom, pick(inFrom)], { duration: 520, easing: effect === 'slide' ? base.EASE_SPRING : base.EASE_OUT });
764
+ this.emit('change', { index: this._index, word: cur.textContent });
765
+ }
766
+ }, { id: 'text-rotate', text: css$1 });
767
+ }
768
+
769
+ var css = "usa-wave-text .usa-word,usa-scroll-highlight .usa-word{display:inline-block;white-space:nowrap}usa-wave-text .usa-char{display:inline-block;animation:usa-wave var(--usa-wave-s,1.6s) ease-in-out infinite;animation-delay:calc(var(--i) * var(--usa-wave-d,0.06s))}@keyframes usa-wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(calc(var(--usa-wave-a,0.25em) * -1))}}usa-glitch{position:relative;display:inline-block}usa-glitch::before,usa-glitch::after{content:attr(data-text);position:absolute;inset:0;pointer-events:none}usa-glitch::before{color:#ff2bd6;transform:translate(calc(var(--usa-glitch-i,3px) * -1),0);clip-path:inset(0 0 55% 0);mix-blend-mode:screen;animation:usa-glitch-a 2.4s steps(2,end) infinite}usa-glitch::after{color:#00f0ff;transform:translate(var(--usa-glitch-i,3px),0);clip-path:inset(50% 0 0 0);mix-blend-mode:screen;animation:usa-glitch-b 1.9s steps(2,end) infinite}usa-glitch[trigger=\"hover\"]::before,usa-glitch[trigger=\"hover\"]::after{animation-play-state:paused;opacity:0}usa-glitch[trigger=\"hover\"]:hover::before,usa-glitch[trigger=\"hover\"]:hover::after{animation-play-state:running;opacity:1}@keyframes usa-glitch-a{0%{clip-path:inset(0 0 80% 0)}20%{clip-path:inset(30% 0 40% 0)}40%{clip-path:inset(70% 0 5% 0)}60%{clip-path:inset(10% 0 60% 0)}80%{clip-path:inset(50% 0 30% 0)}100%{clip-path:inset(0 0 80% 0)}}@keyframes usa-glitch-b{0%{clip-path:inset(60% 0 10% 0)}25%{clip-path:inset(15% 0 70% 0)}50%{clip-path:inset(80% 0 2% 0)}75%{clip-path:inset(40% 0 35% 0)}100%{clip-path:inset(60% 0 10% 0)}}usa-gradient-text{background:var(--usa-grad) 0 50% / 300% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;animation:usa-grad-flow var(--usa-grad-s,6s) linear infinite}@keyframes usa-grad-flow{to{background-position:150% 50%}}usa-handwriting{--usa-hw-stroke:currentColor;display:inline-block;line-height:0}usa-handwriting svg{width:auto;max-width:100%;height:auto;overflow:visible}usa-handwriting text{fill:transparent;stroke:var(--usa-hw-stroke);stroke-width:1.2;stroke-dasharray:1600;stroke-dashoffset:1600;font-family:\"Segoe Script\",\"Brush Script MT\",\"Snell Roundhand\",cursive}usa-handwriting[data-state=\"drawing\"] text{animation:usa-hw-draw var(--usa-hw-d,2400ms) cubic-bezier(0.55,0,0.45,1) forwards,usa-hw-fill 0.6s ease calc(var(--usa-hw-d,2400ms) * 0.8) forwards}usa-handwriting[data-state=\"done\"] text{stroke-dashoffset:0;fill:currentColor}@keyframes usa-hw-draw{to{stroke-dashoffset:0}}@keyframes usa-hw-fill{to{fill:currentColor}}usa-scroll-highlight .usa-hl-word{opacity:var(--usa-hl-dim,0.2);transition:opacity 0.35s ease}usa-scroll-highlight .usa-hl-word[data-on]{opacity:1}usa-scroll-highlight[mode=\"marker\"]{--usa-hl-color:color-mix(in srgb,#facc15 55%,transparent);background:linear-gradient(var(--usa-hl-color),var(--usa-hl-color)) 0 88% / 0% 40% no-repeat;transition:background-size 1s cubic-bezier(0.65,0,0.35,1);-webkit-box-decoration-break:clone;box-decoration-break:clone}usa-scroll-highlight[mode=\"marker\"][data-lit]{background-size:100% 40%}@media (prefers-reduced-motion:reduce){usa-wave-text .usa-char,usa-glitch::before,usa-glitch::after,usa-gradient-text{animation:none !important}usa-glitch::before,usa-glitch::after{display:none}usa-scroll-highlight .usa-hl-word,usa-scroll-highlight[mode=\"marker\"]{transition:none}}";
770
+
771
+ /** Split `text` into per-character spans (words never break). The animated copy is aria-hidden. */
772
+ function splitChars(host, text) {
773
+ const vis = document.createElement('span');
774
+ vis.setAttribute('aria-hidden', 'true');
775
+ const chars = [];
776
+ text.split(/(\s+)/).forEach((w) => {
777
+ if (/^\s+$/.test(w)) {
778
+ vis.append(document.createTextNode(w));
779
+ return;
780
+ }
781
+ const word = document.createElement('span');
782
+ word.className = 'usa-word';
783
+ for (const c of Array.from(w)) {
784
+ const s = document.createElement('span');
785
+ s.className = 'usa-char';
786
+ s.textContent = c;
787
+ s.style.setProperty('--i', String(chars.length));
788
+ word.append(s);
789
+ chars.push(s);
790
+ }
791
+ vis.append(word);
792
+ });
793
+ host.replaceChildren(base.srText(text), vis);
794
+ return chars;
795
+ }
796
+ const textOf = (el) => (el.getAttribute('text') ?? el.dataset.usaText ?? (el.dataset.usaText = (el.textContent || '').trim()));
797
+ function defineWaveText(tag = 'usa-wave-text') {
798
+ return base.defineElement(tag, (Base) => class extends Base {
799
+ static get observedAttributes() { return ['text']; }
800
+ mount() {
801
+ splitChars(this, textOf(this));
802
+ this.style.setProperty('--usa-wave-a', `${this.num('amplitude', 0.25)}em`);
803
+ this.style.setProperty('--usa-wave-s', `${this.num('speed', 1.6)}s`);
804
+ this.style.setProperty('--usa-wave-d', `${this.num('stagger', 0.06)}s`);
805
+ }
806
+ }, { id: 'text-fx', text: css });
807
+ }
808
+ function defineGlitch(tag = 'usa-glitch') {
809
+ return base.defineElement(tag, (Base) => class extends Base {
810
+ static get observedAttributes() { return ['text', 'intensity']; }
811
+ mount() {
812
+ const t = textOf(this);
813
+ this.setAttribute('data-text', t);
814
+ this.style.setProperty('--usa-glitch-i', `${this.num('intensity', 3)}px`);
815
+ if (!this.firstChild)
816
+ this.textContent = t;
817
+ }
818
+ }, { id: 'text-fx', text: css });
819
+ }
820
+ function defineGradientText(tag = 'usa-gradient-text') {
821
+ return base.defineElement(tag, (Base) => class extends Base {
822
+ static get observedAttributes() { return ['colors', 'speed', 'angle']; }
823
+ mount() {
824
+ const c = this.str('colors', '#7c5cff,#22d3ee,#f472b6,#facc15').split(',').map((s) => s.trim());
825
+ this.style.setProperty('--usa-grad', `linear-gradient(${this.num('angle', 90)}deg, ${[...c, c[0]].join(', ')})`);
826
+ this.style.setProperty('--usa-grad-s', `${this.num('speed', 6)}s`);
827
+ }
828
+ }, { id: 'text-fx', text: css });
829
+ }
830
+ function defineHandwriting(tag = 'usa-handwriting') {
831
+ return base.defineElement(tag, (Base) => class extends Base {
832
+ static get observedAttributes() { return ['text', 'size', 'font']; }
833
+ mount() {
834
+ const t = textOf(this);
835
+ const size = this.num('size', 64);
836
+ const w = Math.ceil(t.length * size * 0.62) + 8;
837
+ this.replaceChildren(base.srText(t));
838
+ this.insertAdjacentHTML('beforeend', `<svg aria-hidden="true" viewBox="0 0 ${w} ${Math.ceil(size * 1.3)}" width="${w}" height="${Math.ceil(size * 1.3)}"><text x="4" y="${Math.round(size)}" font-size="${size}"></text></svg>`);
839
+ const text = this.querySelector('text');
840
+ text.textContent = t;
841
+ if (this.str('font'))
842
+ text.setAttribute('font-family', this.str('font'));
843
+ if (this.str('stroke'))
844
+ this.style.setProperty('--usa-hw-stroke', this.str('stroke'));
845
+ this.style.setProperty('--usa-hw-d', `${this.num('duration', 2400)}ms`);
846
+ if (this.reduced) {
847
+ this.setAttribute('data-state', 'done');
848
+ return;
849
+ }
850
+ this.inView((v) => v && this.play(), { threshold: 0.3 });
851
+ }
852
+ play() {
853
+ this.removeAttribute('data-state');
854
+ void this.offsetWidth;
855
+ this.setAttribute('data-state', 'drawing');
856
+ setTimeout(() => {
857
+ this.setAttribute('data-state', 'done');
858
+ this.emit('complete');
859
+ }, this.reduced ? 0 : this.num('duration', 2400));
860
+ }
861
+ }, { id: 'text-fx', text: css });
862
+ }
863
+ function defineScrollHighlight(tag = 'usa-scroll-highlight') {
864
+ return base.defineElement(tag, (Base) => class extends Base {
865
+ constructor() {
866
+ super(...arguments);
867
+ this._f = 0;
868
+ this._p = 0;
869
+ }
870
+ static get observedAttributes() { return ['mode', 'text']; }
871
+ get progress() { return this._p; }
872
+ mount() {
873
+ const mode = this.str('mode', 'words');
874
+ if (this.str('color'))
875
+ this.style.setProperty('--usa-hl-color', this.str('color'));
876
+ this.style.setProperty('--usa-hl-dim', String(this.num('dim', 0.2)));
877
+ if (mode === 'marker') {
878
+ if (this.reduced)
879
+ this.setAttribute('data-lit', '');
880
+ else
881
+ this.inView((v) => v && this.setAttribute('data-lit', ''), { threshold: 0.6 });
882
+ return;
883
+ }
884
+ const t = textOf(this);
885
+ const vis = document.createElement('span');
886
+ vis.setAttribute('aria-hidden', 'true');
887
+ const words = t.split(/\s+/).filter(Boolean).map((w) => {
888
+ const s = document.createElement('span');
889
+ s.className = 'usa-hl-word';
890
+ s.textContent = w;
891
+ vis.append(s, ' ');
892
+ return s;
893
+ });
894
+ this.replaceChildren(base.srText(t), vis);
895
+ if (this.reduced) {
896
+ words.forEach((w) => w.setAttribute('data-on', ''));
897
+ return;
898
+ }
899
+ const update = () => {
900
+ this._f = 0;
901
+ const r = this.getBoundingClientRect();
902
+ const H = window.innerHeight || 800;
903
+ this._p = base.clamp((H * 0.85 - r.top) / (r.height + H * 0.35), 0, 1);
904
+ const lit = Math.round(this._p * words.length);
905
+ words.forEach((w, i) => w.toggleAttribute('data-on', i < lit));
906
+ };
907
+ const on = () => !this._f && (this._f = base.raf(update));
908
+ let active = false;
909
+ this.inView((v) => {
910
+ if (v === active)
911
+ return;
912
+ active = v;
913
+ if (v)
914
+ window.addEventListener('scroll', on, { passive: true });
915
+ else
916
+ window.removeEventListener('scroll', on);
917
+ on();
918
+ });
919
+ this.onCleanup(() => window.removeEventListener('scroll', on));
920
+ }
921
+ unmount() {
922
+ base.caf(this._f);
923
+ this._f = 0;
924
+ }
925
+ }, { id: 'text-fx', text: css });
926
+ }
927
+
928
+ /**
929
+ * motionary/components/text — text effects.
930
+ * `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
931
+ * `<usa-shimmer-text>`, `<usa-text-rotate>`.
932
+ */
933
+ /** Register every component of this category under its default tag. */
934
+ function defineTextComponents() {
935
+ defineTypewriter();
936
+ defineSplitText();
937
+ defineScramble();
938
+ defineCounter();
939
+ defineShimmerText();
940
+ defineTextRotate();
941
+ defineWaveText();
942
+ defineGlitch();
943
+ defineGradientText();
944
+ defineHandwriting();
945
+ defineScrollHighlight();
946
+ }
947
+
948
+ exports.JOINING_SCRIPT = JOINING_SCRIPT;
949
+ exports.defineCounter = defineCounter;
950
+ exports.defineGlitch = defineGlitch;
951
+ exports.defineGradientText = defineGradientText;
952
+ exports.defineHandwriting = defineHandwriting;
953
+ exports.defineScramble = defineScramble;
954
+ exports.defineScrollHighlight = defineScrollHighlight;
955
+ exports.defineShimmerText = defineShimmerText;
956
+ exports.defineSplitText = defineSplitText;
957
+ exports.defineTextComponents = defineTextComponents;
958
+ exports.defineTextRotate = defineTextRotate;
959
+ exports.defineTypewriter = defineTypewriter;
960
+ exports.defineWaveText = defineWaveText;
961
+ exports.easeOutExpo = easeOutExpo;
962
+ exports.graphemes = graphemes;
963
+ exports.scrambleFrame = scrambleFrame;
964
+ exports.splitOrder = splitOrder;
965
+ exports.splitText = splitText;
966
+ exports.splitTimeline = splitTimeline;
967
+ exports.splitWords = words;
968
+ //# sourceMappingURL=text.cjs.map