use-scroll-animate 2.7.0 → 2.9.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 (125) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +4 -4
  3. package/README_ja.md +2 -2
  4. package/README_zh.md +3 -3
  5. package/dist/chunks/{base-BR6fYLBA.cjs → base-BkQcvoSG.cjs} +29 -1
  6. package/dist/chunks/{base-BR6fYLBA.cjs.map → base-BkQcvoSG.cjs.map} +1 -1
  7. package/dist/chunks/{base-D6zLiNGH.js → base-CB8gChoe.js} +29 -2
  8. package/dist/chunks/{base-D6zLiNGH.js.map → base-CB8gChoe.js.map} +1 -1
  9. package/dist/chunks/{core-B_J4rXbC.cjs → core-C1cEwjJj.cjs} +11 -2
  10. package/dist/chunks/core-C1cEwjJj.cjs.map +1 -0
  11. package/dist/chunks/{core-BP-a1iNc.js → core-J_KM443q.js} +12 -3
  12. package/dist/chunks/core-J_KM443q.js.map +1 -0
  13. package/dist/chunks/index-tags-BEM98giN.cjs +20 -0
  14. package/dist/chunks/index-tags-BEM98giN.cjs.map +1 -0
  15. package/dist/chunks/index-tags-f37txHmb.js +18 -0
  16. package/dist/chunks/index-tags-f37txHmb.js.map +1 -0
  17. package/dist/chunks/{spring-DyHe1Hfa.cjs → spring-7U9MC6yQ.cjs} +2 -2
  18. package/dist/chunks/{spring-DyHe1Hfa.cjs.map → spring-7U9MC6yQ.cjs.map} +1 -1
  19. package/dist/chunks/{spring-C2Megtcf.js → spring-ka0YJ_ZR.js} +2 -2
  20. package/dist/chunks/{spring-C2Megtcf.js.map → spring-ka0YJ_ZR.js.map} +1 -1
  21. package/dist/chunks/{stagger-DTv_WiUQ.js → stagger-CGF18oNs.js} +2 -2
  22. package/dist/chunks/{stagger-DTv_WiUQ.js.map → stagger-CGF18oNs.js.map} +1 -1
  23. package/dist/chunks/{stagger-DHw0ExuR.cjs → stagger-DtKKS6GP.cjs} +2 -2
  24. package/dist/chunks/{stagger-DHw0ExuR.cjs.map → stagger-DtKKS6GP.cjs.map} +1 -1
  25. package/dist/chunks/variants-Ce9CboVc.js +35 -0
  26. package/dist/chunks/variants-Ce9CboVc.js.map +1 -0
  27. package/dist/chunks/variants-PsCXbQ5h.cjs +39 -0
  28. package/dist/chunks/variants-PsCXbQ5h.cjs.map +1 -0
  29. package/dist/components/background.cjs +277 -11
  30. package/dist/components/background.cjs.map +1 -1
  31. package/dist/components/background.css +3 -1
  32. package/dist/components/background.d.cts +64 -3
  33. package/dist/components/background.d.ts +64 -3
  34. package/dist/components/background.js +274 -13
  35. package/dist/components/background.js.map +1 -1
  36. package/dist/components/cards.cjs +2 -2
  37. package/dist/components/cards.js +3 -3
  38. package/dist/components/click.cjs +2 -2
  39. package/dist/components/click.js +3 -3
  40. package/dist/components/feedback.cjs +15 -8
  41. package/dist/components/feedback.cjs.map +1 -1
  42. package/dist/components/feedback.d.cts +4 -1
  43. package/dist/components/feedback.d.ts +4 -1
  44. package/dist/components/feedback.js +16 -9
  45. package/dist/components/feedback.js.map +1 -1
  46. package/dist/components/interaction.cjs +1 -1
  47. package/dist/components/interaction.js +2 -2
  48. package/dist/components/jsx.cjs +3 -0
  49. package/dist/components/jsx.cjs.map +1 -0
  50. package/dist/components/jsx.d.cts +45 -0
  51. package/dist/components/jsx.d.ts +45 -0
  52. package/dist/components/jsx.js +2 -0
  53. package/dist/components/jsx.js.map +1 -0
  54. package/dist/components/lazy.cjs +84 -0
  55. package/dist/components/lazy.cjs.map +1 -0
  56. package/dist/components/lazy.d.cts +40 -0
  57. package/dist/components/lazy.d.ts +40 -0
  58. package/dist/components/lazy.js +79 -0
  59. package/dist/components/lazy.js.map +1 -0
  60. package/dist/components/page.cjs +2 -2
  61. package/dist/components/page.js +3 -3
  62. package/dist/components/physics.cjs +2 -2
  63. package/dist/components/physics.js +4 -4
  64. package/dist/components/react.cjs +96 -0
  65. package/dist/components/react.cjs.map +1 -0
  66. package/dist/components/react.d.cts +18 -0
  67. package/dist/components/react.d.ts +18 -0
  68. package/dist/components/react.js +91 -0
  69. package/dist/components/react.js.map +1 -0
  70. package/dist/components/reveal.cjs +1 -1
  71. package/dist/components/reveal.js +2 -2
  72. package/dist/components/text.cjs +180 -11
  73. package/dist/components/text.cjs.map +1 -1
  74. package/dist/components/text.css +1 -0
  75. package/dist/components/text.d.cts +54 -2
  76. package/dist/components/text.d.ts +54 -2
  77. package/dist/components/text.js +177 -13
  78. package/dist/components/text.js.map +1 -1
  79. package/dist/components/transitions.cjs +3 -4
  80. package/dist/components/transitions.cjs.map +1 -1
  81. package/dist/components/transitions.js +4 -5
  82. package/dist/components/transitions.js.map +1 -1
  83. package/dist/components/ui.cjs +18 -48
  84. package/dist/components/ui.cjs.map +1 -1
  85. package/dist/components/ui.js +6 -35
  86. package/dist/components/ui.js.map +1 -1
  87. package/dist/components/vue.cjs +51 -0
  88. package/dist/components/vue.cjs.map +1 -0
  89. package/dist/components/vue.d.cts +1344 -0
  90. package/dist/components/vue.d.ts +1344 -0
  91. package/dist/components/vue.js +48 -0
  92. package/dist/components/vue.js.map +1 -0
  93. package/dist/components.cjs +19 -21
  94. package/dist/components.cjs.map +1 -1
  95. package/dist/components.css +4 -1
  96. package/dist/components.d.cts +123 -6
  97. package/dist/components.d.ts +123 -6
  98. package/dist/components.js +11 -22
  99. package/dist/components.js.map +1 -1
  100. package/dist/components.umd.js +2 -2
  101. package/dist/components.umd.js.map +1 -1
  102. package/dist/element.cjs +1 -1
  103. package/dist/element.js +1 -1
  104. package/dist/element.umd.js +1 -1
  105. package/dist/element.umd.js.map +1 -1
  106. package/dist/index.cjs +2 -2
  107. package/dist/index.js +3 -3
  108. package/dist/index.umd.js +2 -2
  109. package/dist/index.umd.js.map +1 -1
  110. package/dist/react.cjs +2 -2
  111. package/dist/react.js +2 -2
  112. package/dist/solid.cjs +2 -2
  113. package/dist/solid.js +2 -2
  114. package/dist/svelte.cjs +2 -2
  115. package/dist/svelte.js +2 -2
  116. package/dist/vue.cjs +2 -2
  117. package/dist/vue.js +2 -2
  118. package/docs/accessibility.md +32 -0
  119. package/docs/components.md +45 -6
  120. package/docs/frameworks-ssr.md +64 -0
  121. package/docs/upgrading-3.md +20 -0
  122. package/docs/windows-apps.md +13 -2
  123. package/package.json +42 -1
  124. package/dist/chunks/core-BP-a1iNc.js.map +0 -1
  125. package/dist/chunks/core-B_J4rXbC.cjs.map +0 -1
@@ -149,6 +149,53 @@ interface UsaTextRotateElement extends UsaElement {
149
149
  }
150
150
  declare function defineTextRotate(tag?: string): CustomElementConstructor | undefined;
151
151
 
152
+ /**
153
+ * `<usa-wave-text>` — letters bob in a travelling wave.
154
+ * Attributes: `amplitude` (em, 0.25), `speed` (s per cycle, 1.6), `stagger`
155
+ * (s between letters, 0.06). Reduced motion: still text.
156
+ */
157
+ interface UsaWaveTextElement extends UsaElement {
158
+ }
159
+ declare function defineWaveText(tag?: string): CustomElementConstructor | undefined;
160
+ /**
161
+ * `<usa-glitch>` — an RGB-split glitch on its text (`trigger="always"`
162
+ * default, or `hover`). Attributes: `intensity` (px, 3), `trigger`.
163
+ * Reduced motion: no animation (plain text).
164
+ */
165
+ interface UsaGlitchElement extends UsaElement {
166
+ }
167
+ declare function defineGlitch(tag?: string): CustomElementConstructor | undefined;
168
+ /**
169
+ * `<usa-gradient-text>` — text filled with a flowing multi-colour gradient.
170
+ * Attributes: `colors` (comma list), `speed` (s, 6), `angle` (deg, 90).
171
+ * Reduced motion: a static gradient.
172
+ */
173
+ interface UsaGradientTextElement extends UsaElement {
174
+ }
175
+ declare function defineGradientText(tag?: string): CustomElementConstructor | undefined;
176
+ /**
177
+ * `<usa-handwriting>` — the text draws itself stroke by stroke (SVG text
178
+ * outline), then fills in, when it scrolls into view.
179
+ * Attributes: `text`, `duration` (ms, 2400), `stroke` (colour), `size` (px,
180
+ * 64), `font` (family; a script font looks best). Events: `usa:complete`.
181
+ * Reduced motion: the filled text appears at once.
182
+ */
183
+ interface UsaHandwritingElement extends UsaElement {
184
+ play(): void;
185
+ }
186
+ declare function defineHandwriting(tag?: string): CustomElementConstructor | undefined;
187
+ /**
188
+ * `<usa-scroll-highlight>` — reading highlight: words light up one by one
189
+ * as the paragraph scrolls through the viewport (`mode="words"`, default),
190
+ * or a highlighter marker sweeps behind the text on enter (`mode="marker"`).
191
+ * Attributes: `mode`, `color` (marker), `dim` (opacity of unread words,
192
+ * 0.2). Reduced motion: fully highlighted text.
193
+ */
194
+ interface UsaScrollHighlightElement extends UsaElement {
195
+ readonly progress: number;
196
+ }
197
+ declare function defineScrollHighlight(tag?: string): CustomElementConstructor | undefined;
198
+
152
199
  /**
153
200
  * use-scroll-animate/components/text — text effects.
154
201
  * `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
@@ -159,6 +206,11 @@ declare function defineTextRotate(tag?: string): CustomElementConstructor | unde
159
206
  declare function defineTextComponents(): void;
160
207
  declare global {
161
208
  interface HTMLElementTagNameMap {
209
+ 'usa-wave-text': UsaWaveTextElement;
210
+ 'usa-glitch': UsaGlitchElement;
211
+ 'usa-gradient-text': UsaGradientTextElement;
212
+ 'usa-handwriting': UsaHandwritingElement;
213
+ 'usa-scroll-highlight': UsaScrollHighlightElement;
162
214
  'usa-typewriter': UsaTypewriterElement;
163
215
  'usa-split-text': UsaSplitTextElement;
164
216
  'usa-scramble': UsaScrambleElement;
@@ -168,5 +220,5 @@ declare global {
168
220
  }
169
221
  }
170
222
 
171
- export { configureComponents, defineCounter, defineScramble, defineShimmerText, defineSplitText, defineTextComponents, defineTextRotate, defineTypewriter, easeOutExpo, prefersReducedMotion, scrambleFrame };
172
- export type { ComponentsConfig, UsaCounterElement, UsaElement, UsaScrambleElement, UsaShimmerTextElement, UsaSplitTextElement, UsaTextRotateElement, UsaTypewriterElement };
223
+ export { configureComponents, defineCounter, defineGlitch, defineGradientText, defineHandwriting, defineScramble, defineScrollHighlight, defineShimmerText, defineSplitText, defineTextComponents, defineTextRotate, defineTypewriter, defineWaveText, easeOutExpo, prefersReducedMotion, scrambleFrame };
224
+ export type { ComponentsConfig, UsaCounterElement, UsaElement, UsaGlitchElement, UsaGradientTextElement, UsaHandwritingElement, UsaScrambleElement, UsaScrollHighlightElement, UsaShimmerTextElement, UsaSplitTextElement, UsaTextRotateElement, UsaTypewriterElement, UsaWaveTextElement };
@@ -149,6 +149,53 @@ interface UsaTextRotateElement extends UsaElement {
149
149
  }
150
150
  declare function defineTextRotate(tag?: string): CustomElementConstructor | undefined;
151
151
 
152
+ /**
153
+ * `<usa-wave-text>` — letters bob in a travelling wave.
154
+ * Attributes: `amplitude` (em, 0.25), `speed` (s per cycle, 1.6), `stagger`
155
+ * (s between letters, 0.06). Reduced motion: still text.
156
+ */
157
+ interface UsaWaveTextElement extends UsaElement {
158
+ }
159
+ declare function defineWaveText(tag?: string): CustomElementConstructor | undefined;
160
+ /**
161
+ * `<usa-glitch>` — an RGB-split glitch on its text (`trigger="always"`
162
+ * default, or `hover`). Attributes: `intensity` (px, 3), `trigger`.
163
+ * Reduced motion: no animation (plain text).
164
+ */
165
+ interface UsaGlitchElement extends UsaElement {
166
+ }
167
+ declare function defineGlitch(tag?: string): CustomElementConstructor | undefined;
168
+ /**
169
+ * `<usa-gradient-text>` — text filled with a flowing multi-colour gradient.
170
+ * Attributes: `colors` (comma list), `speed` (s, 6), `angle` (deg, 90).
171
+ * Reduced motion: a static gradient.
172
+ */
173
+ interface UsaGradientTextElement extends UsaElement {
174
+ }
175
+ declare function defineGradientText(tag?: string): CustomElementConstructor | undefined;
176
+ /**
177
+ * `<usa-handwriting>` — the text draws itself stroke by stroke (SVG text
178
+ * outline), then fills in, when it scrolls into view.
179
+ * Attributes: `text`, `duration` (ms, 2400), `stroke` (colour), `size` (px,
180
+ * 64), `font` (family; a script font looks best). Events: `usa:complete`.
181
+ * Reduced motion: the filled text appears at once.
182
+ */
183
+ interface UsaHandwritingElement extends UsaElement {
184
+ play(): void;
185
+ }
186
+ declare function defineHandwriting(tag?: string): CustomElementConstructor | undefined;
187
+ /**
188
+ * `<usa-scroll-highlight>` — reading highlight: words light up one by one
189
+ * as the paragraph scrolls through the viewport (`mode="words"`, default),
190
+ * or a highlighter marker sweeps behind the text on enter (`mode="marker"`).
191
+ * Attributes: `mode`, `color` (marker), `dim` (opacity of unread words,
192
+ * 0.2). Reduced motion: fully highlighted text.
193
+ */
194
+ interface UsaScrollHighlightElement extends UsaElement {
195
+ readonly progress: number;
196
+ }
197
+ declare function defineScrollHighlight(tag?: string): CustomElementConstructor | undefined;
198
+
152
199
  /**
153
200
  * use-scroll-animate/components/text — text effects.
154
201
  * `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>`,
@@ -159,6 +206,11 @@ declare function defineTextRotate(tag?: string): CustomElementConstructor | unde
159
206
  declare function defineTextComponents(): void;
160
207
  declare global {
161
208
  interface HTMLElementTagNameMap {
209
+ 'usa-wave-text': UsaWaveTextElement;
210
+ 'usa-glitch': UsaGlitchElement;
211
+ 'usa-gradient-text': UsaGradientTextElement;
212
+ 'usa-handwriting': UsaHandwritingElement;
213
+ 'usa-scroll-highlight': UsaScrollHighlightElement;
162
214
  'usa-typewriter': UsaTypewriterElement;
163
215
  'usa-split-text': UsaSplitTextElement;
164
216
  'usa-scramble': UsaScrambleElement;
@@ -168,5 +220,5 @@ declare global {
168
220
  }
169
221
  }
170
222
 
171
- export { configureComponents, defineCounter, defineScramble, defineShimmerText, defineSplitText, defineTextComponents, defineTextRotate, defineTypewriter, easeOutExpo, prefersReducedMotion, scrambleFrame };
172
- export type { ComponentsConfig, UsaCounterElement, UsaElement, UsaScrambleElement, UsaShimmerTextElement, UsaSplitTextElement, UsaTextRotateElement, UsaTypewriterElement };
223
+ export { configureComponents, defineCounter, defineGlitch, defineGradientText, defineHandwriting, defineScramble, defineScrollHighlight, defineShimmerText, defineSplitText, defineTextComponents, defineTextRotate, defineTypewriter, defineWaveText, easeOutExpo, prefersReducedMotion, scrambleFrame };
224
+ export type { ComponentsConfig, UsaCounterElement, UsaElement, UsaGlitchElement, UsaGradientTextElement, UsaHandwritingElement, UsaScrambleElement, UsaScrollHighlightElement, UsaShimmerTextElement, UsaSplitTextElement, UsaTextRotateElement, UsaTypewriterElement, UsaWaveTextElement };
@@ -1,7 +1,7 @@
1
- import { d as defineElement, s as srText, e as caf, n as now, r as raf, E as EASE_OUT, f as EASE_SPRING } from '../chunks/base-D6zLiNGH.js';
2
- export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-D6zLiNGH.js';
1
+ import { f as defineElement, j as srText, d as caf, n as now, r as raf, i as EASE_OUT, E as EASE_SPRING, h as clamp } from '../chunks/base-CB8gChoe.js';
2
+ export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-CB8gChoe.js';
3
3
 
4
- var css$4 = "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}}";
4
+ 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}}";
5
5
 
6
6
  function defineTypewriter(tag = 'usa-typewriter') {
7
7
  return defineElement(tag, (Base) => class UsaTypewriter extends Base {
@@ -115,10 +115,10 @@ function defineTypewriter(tag = 'usa-typewriter') {
115
115
  };
116
116
  this._timer = setTimeout(tick, this.num('delay', 0));
117
117
  }
118
- }, { id: 'typewriter', text: css$4 });
118
+ }, { id: 'typewriter', text: css$5 });
119
119
  }
120
120
 
121
- var css$3 = "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}}";
121
+ 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}}";
122
122
 
123
123
  function defineSplitText(tag = 'usa-split-text') {
124
124
  return defineElement(tag, (Base) => class UsaSplitText extends Base {
@@ -203,7 +203,7 @@ function defineSplitText(tag = 'usa-split-text') {
203
203
  clearTimeout(this._timer);
204
204
  this.setAttribute('data-state', this.reduced ? 'shown' : 'hidden');
205
205
  }
206
- }, { id: 'split-text', text: css$3 });
206
+ }, { id: 'split-text', text: css$4 });
207
207
  }
208
208
 
209
209
  const GLYPHS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=<>/\\?!';
@@ -297,7 +297,7 @@ function defineScramble(tag = 'usa-scramble') {
297
297
  }, undefined);
298
298
  }
299
299
 
300
- var css$2 = "usa-counter{font-variant-numeric:tabular-nums}";
300
+ var css$3 = "usa-counter{font-variant-numeric:tabular-nums}";
301
301
 
302
302
  /** easeOutExpo */
303
303
  const easeOutExpo = (t) => (t >= 1 ? 1 : 1 - Math.pow(2, -10 * t));
@@ -397,10 +397,10 @@ function defineCounter(tag = 'usa-counter') {
397
397
  this._frame = raf(step);
398
398
  });
399
399
  }
400
- }, { id: 'counter', text: css$2 });
400
+ }, { id: 'counter', text: css$3 });
401
401
  }
402
402
 
403
- var css$1 = "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}}";
403
+ 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}}";
404
404
 
405
405
  function defineShimmerText(tag = 'usa-shimmer-text') {
406
406
  return defineElement(tag, (Base) => class UsaShimmerText extends Base {
@@ -420,10 +420,10 @@ function defineShimmerText(tag = 'usa-shimmer-text') {
420
420
  set('shine', '--usa-shimmer-shine');
421
421
  set('angle', '--usa-shimmer-angle', 'deg');
422
422
  }
423
- }, { id: 'shimmer-text', text: css$1 });
423
+ }, { id: 'shimmer-text', text: css$2 });
424
424
  }
425
425
 
426
- var css = "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}";
426
+ 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}";
427
427
 
428
428
  function defineTextRotate(tag = 'usa-text-rotate') {
429
429
  return defineElement(tag, (Base) => class UsaTextRotate extends Base {
@@ -495,7 +495,166 @@ function defineTextRotate(tag = 'usa-text-rotate') {
495
495
  this.motion(cur, [inFrom, pick(inFrom)], { duration: 520, easing: effect === 'slide' ? EASE_SPRING : EASE_OUT });
496
496
  this.emit('change', { index: this._index, word: cur.textContent });
497
497
  }
498
- }, { id: 'text-rotate', text: css });
498
+ }, { id: 'text-rotate', text: css$1 });
499
+ }
500
+
501
+ 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{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}}";
502
+
503
+ /** Split `text` into per-character spans (words never break). The animated copy is aria-hidden. */
504
+ function splitChars(host, text) {
505
+ const vis = document.createElement('span');
506
+ vis.setAttribute('aria-hidden', 'true');
507
+ const chars = [];
508
+ text.split(/(\s+)/).forEach((w) => {
509
+ if (/^\s+$/.test(w)) {
510
+ vis.append(document.createTextNode(w));
511
+ return;
512
+ }
513
+ const word = document.createElement('span');
514
+ word.className = 'usa-word';
515
+ for (const c of Array.from(w)) {
516
+ const s = document.createElement('span');
517
+ s.className = 'usa-char';
518
+ s.textContent = c;
519
+ s.style.setProperty('--i', String(chars.length));
520
+ word.append(s);
521
+ chars.push(s);
522
+ }
523
+ vis.append(word);
524
+ });
525
+ host.replaceChildren(srText(text), vis);
526
+ return chars;
527
+ }
528
+ const textOf = (el) => (el.getAttribute('text') ?? el.dataset.usaText ?? (el.dataset.usaText = (el.textContent || '').trim()));
529
+ function defineWaveText(tag = 'usa-wave-text') {
530
+ return defineElement(tag, (Base) => class extends Base {
531
+ static get observedAttributes() { return ['text']; }
532
+ mount() {
533
+ splitChars(this, textOf(this));
534
+ this.style.setProperty('--usa-wave-a', `${this.num('amplitude', 0.25)}em`);
535
+ this.style.setProperty('--usa-wave-s', `${this.num('speed', 1.6)}s`);
536
+ this.style.setProperty('--usa-wave-d', `${this.num('stagger', 0.06)}s`);
537
+ }
538
+ }, { id: 'text-fx', text: css });
539
+ }
540
+ function defineGlitch(tag = 'usa-glitch') {
541
+ return defineElement(tag, (Base) => class extends Base {
542
+ static get observedAttributes() { return ['text', 'intensity']; }
543
+ mount() {
544
+ const t = textOf(this);
545
+ this.setAttribute('data-text', t);
546
+ this.style.setProperty('--usa-glitch-i', `${this.num('intensity', 3)}px`);
547
+ if (!this.firstChild)
548
+ this.textContent = t;
549
+ }
550
+ }, { id: 'text-fx', text: css });
551
+ }
552
+ function defineGradientText(tag = 'usa-gradient-text') {
553
+ return defineElement(tag, (Base) => class extends Base {
554
+ static get observedAttributes() { return ['colors', 'speed', 'angle']; }
555
+ mount() {
556
+ const c = this.str('colors', '#7c5cff,#22d3ee,#f472b6,#facc15').split(',').map((s) => s.trim());
557
+ this.style.setProperty('--usa-grad', `linear-gradient(${this.num('angle', 90)}deg, ${[...c, c[0]].join(', ')})`);
558
+ this.style.setProperty('--usa-grad-s', `${this.num('speed', 6)}s`);
559
+ }
560
+ }, { id: 'text-fx', text: css });
561
+ }
562
+ function defineHandwriting(tag = 'usa-handwriting') {
563
+ return defineElement(tag, (Base) => class extends Base {
564
+ static get observedAttributes() { return ['text', 'size', 'font']; }
565
+ mount() {
566
+ const t = textOf(this);
567
+ const size = this.num('size', 64);
568
+ const w = Math.ceil(t.length * size * 0.62) + 8;
569
+ this.replaceChildren(srText(t));
570
+ 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>`);
571
+ const text = this.querySelector('text');
572
+ text.textContent = t;
573
+ if (this.str('font'))
574
+ text.setAttribute('font-family', this.str('font'));
575
+ if (this.str('stroke'))
576
+ this.style.setProperty('--usa-hw-stroke', this.str('stroke'));
577
+ this.style.setProperty('--usa-hw-d', `${this.num('duration', 2400)}ms`);
578
+ if (this.reduced) {
579
+ this.setAttribute('data-state', 'done');
580
+ return;
581
+ }
582
+ this.inView((v) => v && this.play(), { threshold: 0.3 });
583
+ }
584
+ play() {
585
+ this.removeAttribute('data-state');
586
+ void this.offsetWidth;
587
+ this.setAttribute('data-state', 'drawing');
588
+ setTimeout(() => {
589
+ this.setAttribute('data-state', 'done');
590
+ this.emit('complete');
591
+ }, this.reduced ? 0 : this.num('duration', 2400));
592
+ }
593
+ }, { id: 'text-fx', text: css });
594
+ }
595
+ function defineScrollHighlight(tag = 'usa-scroll-highlight') {
596
+ return defineElement(tag, (Base) => class extends Base {
597
+ constructor() {
598
+ super(...arguments);
599
+ this._f = 0;
600
+ this._p = 0;
601
+ }
602
+ static get observedAttributes() { return ['mode', 'text']; }
603
+ get progress() { return this._p; }
604
+ mount() {
605
+ const mode = this.str('mode', 'words');
606
+ if (this.str('color'))
607
+ this.style.setProperty('--usa-hl-color', this.str('color'));
608
+ this.style.setProperty('--usa-hl-dim', String(this.num('dim', 0.2)));
609
+ if (mode === 'marker') {
610
+ if (this.reduced)
611
+ this.setAttribute('data-lit', '');
612
+ else
613
+ this.inView((v) => v && this.setAttribute('data-lit', ''), { threshold: 0.6 });
614
+ return;
615
+ }
616
+ const t = textOf(this);
617
+ const vis = document.createElement('span');
618
+ vis.setAttribute('aria-hidden', 'true');
619
+ const words = t.split(/\s+/).filter(Boolean).map((w) => {
620
+ const s = document.createElement('span');
621
+ s.className = 'usa-hl-word';
622
+ s.textContent = w;
623
+ vis.append(s, ' ');
624
+ return s;
625
+ });
626
+ this.replaceChildren(srText(t), vis);
627
+ if (this.reduced) {
628
+ words.forEach((w) => w.setAttribute('data-on', ''));
629
+ return;
630
+ }
631
+ const update = () => {
632
+ this._f = 0;
633
+ const r = this.getBoundingClientRect();
634
+ const H = window.innerHeight || 800;
635
+ this._p = clamp((H * 0.85 - r.top) / (r.height + H * 0.35), 0, 1);
636
+ const lit = Math.round(this._p * words.length);
637
+ words.forEach((w, i) => w.toggleAttribute('data-on', i < lit));
638
+ };
639
+ const on = () => !this._f && (this._f = raf(update));
640
+ let active = false;
641
+ this.inView((v) => {
642
+ if (v === active)
643
+ return;
644
+ active = v;
645
+ if (v)
646
+ window.addEventListener('scroll', on, { passive: true });
647
+ else
648
+ window.removeEventListener('scroll', on);
649
+ on();
650
+ });
651
+ this.onCleanup(() => window.removeEventListener('scroll', on));
652
+ }
653
+ unmount() {
654
+ caf(this._f);
655
+ this._f = 0;
656
+ }
657
+ }, { id: 'text-fx', text: css });
499
658
  }
500
659
 
501
660
  /**
@@ -511,7 +670,12 @@ function defineTextComponents() {
511
670
  defineCounter();
512
671
  defineShimmerText();
513
672
  defineTextRotate();
673
+ defineWaveText();
674
+ defineGlitch();
675
+ defineGradientText();
676
+ defineHandwriting();
677
+ defineScrollHighlight();
514
678
  }
515
679
 
516
- export { defineCounter, defineScramble, defineShimmerText, defineSplitText, defineTextComponents, defineTextRotate, defineTypewriter, easeOutExpo, scrambleFrame };
680
+ export { defineCounter, defineGlitch, defineGradientText, defineHandwriting, defineScramble, defineScrollHighlight, defineShimmerText, defineSplitText, defineTextComponents, defineTextRotate, defineTypewriter, defineWaveText, easeOutExpo, scrambleFrame };
517
681
  //# sourceMappingURL=text.js.map