use-scroll-animate 4.8.0 → 5.0.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 (222) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +2 -1
  3. package/README_ja.md +1 -0
  4. package/README_zh.md +2 -1
  5. package/bin/usa-codemod-5.mjs +79 -0
  6. package/dist/chunks/{base-CxYU2NK_.cjs → base-B5i8qQPR.cjs} +65 -30
  7. package/dist/chunks/base-B5i8qQPR.cjs.map +1 -0
  8. package/dist/chunks/{base-CZiIAMBc.js → base-C3Sw9sAO.js} +63 -31
  9. package/dist/chunks/base-C3Sw9sAO.js.map +1 -0
  10. package/dist/chunks/{core-HLqH3qkA.cjs → core-BDcszY4L.cjs} +2 -2
  11. package/dist/chunks/{core-HLqH3qkA.cjs.map → core-BDcszY4L.cjs.map} +1 -1
  12. package/dist/chunks/{core-COi3DrLx.js → core-BTf__I-8.js} +2 -2
  13. package/dist/chunks/{core-COi3DrLx.js.map → core-BTf__I-8.js.map} +1 -1
  14. package/dist/chunks/{core-CctNfzuP.cjs → core-BjOYKSrV.cjs} +2 -2
  15. package/dist/chunks/{core-CctNfzuP.cjs.map → core-BjOYKSrV.cjs.map} +1 -1
  16. package/dist/chunks/{core-CJHJeMI_.js → core-DN3hHbHh.js} +2 -2
  17. package/dist/chunks/{core-CJHJeMI_.js.map → core-DN3hHbHh.js.map} +1 -1
  18. package/dist/chunks/fx-B8hk1Fby.cjs +114 -0
  19. package/dist/chunks/fx-B8hk1Fby.cjs.map +1 -0
  20. package/dist/chunks/fx-ChjxrMBo.js +109 -0
  21. package/dist/chunks/fx-ChjxrMBo.js.map +1 -0
  22. package/dist/chunks/{index-tags-Dh8nwXqw.js → index-tags-DucKMQr_.js} +2 -1
  23. package/dist/chunks/{index-tags-Dh8nwXqw.js.map → index-tags-DucKMQr_.js.map} +1 -1
  24. package/dist/chunks/{index-tags-CIRY2KnU.cjs → index-tags-wv0R_vkO.cjs} +2 -1
  25. package/dist/chunks/{index-tags-CIRY2KnU.cjs.map → index-tags-wv0R_vkO.cjs.map} +1 -1
  26. package/dist/chunks/{spring-Dkpygsuj.cjs → spring--oZh55tB.cjs} +2 -2
  27. package/dist/chunks/{spring-Dkpygsuj.cjs.map → spring--oZh55tB.cjs.map} +1 -1
  28. package/dist/chunks/{spring-BS5tg6aK.js → spring-CckMe3x0.js} +2 -2
  29. package/dist/chunks/{spring-BS5tg6aK.js.map → spring-CckMe3x0.js.map} +1 -1
  30. package/dist/chunks/{variants-D9n-3x27.js → variants-Bsevy6Xm.js} +2 -2
  31. package/dist/chunks/{variants-D9n-3x27.js.map → variants-Bsevy6Xm.js.map} +1 -1
  32. package/dist/chunks/{variants-CfJzrzMh.cjs → variants-DxPmgrNX.cjs} +2 -2
  33. package/dist/chunks/{variants-CfJzrzMh.cjs.map → variants-DxPmgrNX.cjs.map} +1 -1
  34. package/dist/components/a11y.cjs +39 -2
  35. package/dist/components/a11y.cjs.map +1 -1
  36. package/dist/components/a11y.d.cts +13 -2
  37. package/dist/components/a11y.d.ts +13 -2
  38. package/dist/components/a11y.js +39 -4
  39. package/dist/components/a11y.js.map +1 -1
  40. package/dist/components/angular.cjs +8 -6
  41. package/dist/components/angular.cjs.map +1 -1
  42. package/dist/components/angular.d.cts +33 -4
  43. package/dist/components/angular.d.ts +33 -4
  44. package/dist/components/angular.js +8 -6
  45. package/dist/components/angular.js.map +1 -1
  46. package/dist/components/background.cjs +2 -4
  47. package/dist/components/background.cjs.map +1 -1
  48. package/dist/components/background.d.cts +2 -47
  49. package/dist/components/background.d.ts +2 -47
  50. package/dist/components/background.js +3 -4
  51. package/dist/components/background.js.map +1 -1
  52. package/dist/components/bridge.cjs +1 -1
  53. package/dist/components/bridge.js +1 -1
  54. package/dist/components/cards.cjs +2 -4
  55. package/dist/components/cards.cjs.map +1 -1
  56. package/dist/components/cards.d.cts +2 -47
  57. package/dist/components/cards.d.ts +2 -47
  58. package/dist/components/cards.js +2 -3
  59. package/dist/components/cards.js.map +1 -1
  60. package/dist/components/click.cjs +24 -130
  61. package/dist/components/click.cjs.map +1 -1
  62. package/dist/components/click.d.cts +2 -47
  63. package/dist/components/click.d.ts +2 -47
  64. package/dist/components/click.js +4 -109
  65. package/dist/components/click.js.map +1 -1
  66. package/dist/components/depth.cjs +3 -5
  67. package/dist/components/depth.cjs.map +1 -1
  68. package/dist/components/depth.d.cts +2 -47
  69. package/dist/components/depth.d.ts +2 -47
  70. package/dist/components/depth.js +3 -4
  71. package/dist/components/depth.js.map +1 -1
  72. package/dist/components/feedback.cjs +1 -3
  73. package/dist/components/feedback.cjs.map +1 -1
  74. package/dist/components/feedback.d.cts +2 -47
  75. package/dist/components/feedback.d.ts +2 -47
  76. package/dist/components/feedback.js +1 -2
  77. package/dist/components/feedback.js.map +1 -1
  78. package/dist/components/fx.cjs +285 -0
  79. package/dist/components/fx.cjs.map +1 -0
  80. package/dist/components/fx.css +3 -0
  81. package/dist/components/fx.d.cts +114 -0
  82. package/dist/components/fx.d.ts +114 -0
  83. package/dist/components/fx.js +271 -0
  84. package/dist/components/fx.js.map +1 -0
  85. package/dist/components/gesture.cjs +3 -5
  86. package/dist/components/gesture.cjs.map +1 -1
  87. package/dist/components/gesture.d.cts +2 -47
  88. package/dist/components/gesture.d.ts +2 -47
  89. package/dist/components/gesture.js +4 -5
  90. package/dist/components/gesture.js.map +1 -1
  91. package/dist/components/interaction.cjs +1 -3
  92. package/dist/components/interaction.cjs.map +1 -1
  93. package/dist/components/interaction.d.cts +2 -47
  94. package/dist/components/interaction.d.ts +2 -47
  95. package/dist/components/interaction.js +1 -2
  96. package/dist/components/interaction.js.map +1 -1
  97. package/dist/components/jsx.d.cts +1 -0
  98. package/dist/components/jsx.d.ts +1 -0
  99. package/dist/components/layout.cjs +1 -3
  100. package/dist/components/layout.cjs.map +1 -1
  101. package/dist/components/layout.d.cts +2 -47
  102. package/dist/components/layout.d.ts +2 -47
  103. package/dist/components/layout.js +2 -3
  104. package/dist/components/layout.js.map +1 -1
  105. package/dist/components/lazy.cjs +2 -1
  106. package/dist/components/lazy.cjs.map +1 -1
  107. package/dist/components/lazy.d.cts +1 -0
  108. package/dist/components/lazy.d.ts +1 -0
  109. package/dist/components/lazy.js +2 -1
  110. package/dist/components/lazy.js.map +1 -1
  111. package/dist/components/lite.cjs +413 -42
  112. package/dist/components/lite.cjs.map +1 -1
  113. package/dist/components/lite.js +394 -43
  114. package/dist/components/lite.js.map +1 -1
  115. package/dist/components/packs.cjs +1 -3
  116. package/dist/components/packs.cjs.map +1 -1
  117. package/dist/components/packs.d.cts +2 -47
  118. package/dist/components/packs.d.ts +2 -47
  119. package/dist/components/packs.js +2 -3
  120. package/dist/components/packs.js.map +1 -1
  121. package/dist/components/page.cjs +31 -12
  122. package/dist/components/page.cjs.map +1 -1
  123. package/dist/components/page.d.cts +15 -52
  124. package/dist/components/page.d.ts +15 -52
  125. package/dist/components/page.js +31 -12
  126. package/dist/components/page.js.map +1 -1
  127. package/dist/components/perf.cjs +3 -4
  128. package/dist/components/perf.cjs.map +1 -1
  129. package/dist/components/perf.d.cts +1 -0
  130. package/dist/components/perf.d.ts +1 -0
  131. package/dist/components/perf.js +4 -5
  132. package/dist/components/perf.js.map +1 -1
  133. package/dist/components/physics.cjs +2 -4
  134. package/dist/components/physics.cjs.map +1 -1
  135. package/dist/components/physics.d.cts +2 -47
  136. package/dist/components/physics.d.ts +2 -47
  137. package/dist/components/physics.js +3 -4
  138. package/dist/components/physics.js.map +1 -1
  139. package/dist/components/react.cjs +1 -1
  140. package/dist/components/react.js +1 -1
  141. package/dist/components/reveal.cjs +1 -3
  142. package/dist/components/reveal.cjs.map +1 -1
  143. package/dist/components/reveal.d.cts +2 -47
  144. package/dist/components/reveal.d.ts +2 -47
  145. package/dist/components/reveal.js +1 -2
  146. package/dist/components/reveal.js.map +1 -1
  147. package/dist/components/solid.cjs +8 -6
  148. package/dist/components/solid.cjs.map +1 -1
  149. package/dist/components/solid.d.cts +33 -4
  150. package/dist/components/solid.d.ts +33 -4
  151. package/dist/components/solid.js +8 -6
  152. package/dist/components/solid.js.map +1 -1
  153. package/dist/components/svelte.cjs +8 -6
  154. package/dist/components/svelte.cjs.map +1 -1
  155. package/dist/components/svelte.d.cts +33 -4
  156. package/dist/components/svelte.d.ts +33 -4
  157. package/dist/components/svelte.js +8 -6
  158. package/dist/components/svelte.js.map +1 -1
  159. package/dist/components/svg.cjs +1 -3
  160. package/dist/components/svg.cjs.map +1 -1
  161. package/dist/components/svg.d.cts +2 -47
  162. package/dist/components/svg.d.ts +2 -47
  163. package/dist/components/svg.js +2 -3
  164. package/dist/components/svg.js.map +1 -1
  165. package/dist/components/text.cjs +2 -4
  166. package/dist/components/text.cjs.map +1 -1
  167. package/dist/components/text.d.cts +2 -47
  168. package/dist/components/text.d.ts +2 -47
  169. package/dist/components/text.js +2 -3
  170. package/dist/components/text.js.map +1 -1
  171. package/dist/components/timeline.cjs +3 -5
  172. package/dist/components/timeline.cjs.map +1 -1
  173. package/dist/components/timeline.d.cts +4 -49
  174. package/dist/components/timeline.d.ts +4 -49
  175. package/dist/components/timeline.js +4 -5
  176. package/dist/components/timeline.js.map +1 -1
  177. package/dist/components/transitions.cjs +1 -3
  178. package/dist/components/transitions.cjs.map +1 -1
  179. package/dist/components/transitions.d.cts +2 -47
  180. package/dist/components/transitions.d.ts +2 -47
  181. package/dist/components/transitions.js +2 -3
  182. package/dist/components/transitions.js.map +1 -1
  183. package/dist/components/ui.cjs +3 -5
  184. package/dist/components/ui.cjs.map +1 -1
  185. package/dist/components/ui.d.cts +2 -47
  186. package/dist/components/ui.d.ts +2 -47
  187. package/dist/components/ui.js +4 -5
  188. package/dist/components/ui.js.map +1 -1
  189. package/dist/components/vue.cjs +8 -6
  190. package/dist/components/vue.cjs.map +1 -1
  191. package/dist/components/vue.d.cts +33 -4
  192. package/dist/components/vue.d.ts +33 -4
  193. package/dist/components/vue.js +8 -6
  194. package/dist/components/vue.js.map +1 -1
  195. package/dist/components/webgl.cjs +3 -5
  196. package/dist/components/webgl.cjs.map +1 -1
  197. package/dist/components/webgl.d.cts +2 -47
  198. package/dist/components/webgl.d.ts +2 -47
  199. package/dist/components/webgl.js +3 -4
  200. package/dist/components/webgl.js.map +1 -1
  201. package/dist/components.cjs +33 -10
  202. package/dist/components.cjs.map +1 -1
  203. package/dist/components.css +1 -0
  204. package/dist/components.d.cts +147 -17
  205. package/dist/components.d.ts +147 -17
  206. package/dist/components.js +16 -12
  207. package/dist/components.js.map +1 -1
  208. package/dist/components.umd.js +2 -2
  209. package/dist/components.umd.js.map +1 -1
  210. package/dist/index.cjs +2 -2
  211. package/dist/index.js +2 -2
  212. package/dist/index.umd.js +1 -1
  213. package/dist/index.umd.js.map +1 -1
  214. package/docs/API.md +1 -1
  215. package/docs/ROADMAP.md +12 -12
  216. package/docs/components.md +14 -1
  217. package/docs/deprecations.md +6 -0
  218. package/docs/performance.md +1 -1
  219. package/docs/upgrading-5.md +31 -0
  220. package/package.json +18 -3
  221. package/dist/chunks/base-CZiIAMBc.js.map +0 -1
  222. package/dist/chunks/base-CxYU2NK_.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [5.0.0] - 2026-10-08
11
+
12
+ ### ⚠ BREAKING CHANGES (see [docs/upgrading-5.md](./docs/upgrading-5.md); `npx usa-codemod-5 --write src`)
13
+ - **Modern-browser baseline**: Custom Elements, Web Animations, IntersectionObserver, ResizeObserver and constructable stylesheets are required (Chrome / Edge ≥ 111, Safari ≥ 16.4, Firefox ≥ 115, WebView2, Electron ≥ 24). The `experimental-webgl` context is no longer requested. View Transitions and scroll-driven animations remain progressive.
14
+ - `motionIntensity: 'off'` / `setMotionIntensity('off')` removed (ignored at runtime) → `motionSensitivity: 'minimal'`. `MotionIntensity` is `'low' | 'normal' | 'high'`; `MOTION_SCALE` has no `off`.
15
+ - `reducedMotion: 'no-preference'` removed (treated as `'user'`) — the OS setting is always honoured.
16
+ - `<usa-timeline scrub="js">` removed — `scrub` picks the JS engine automatically; `smooth="…"` opts into smoothing.
17
+ - Category entries (`use-scroll-animate/components/<category>`) no longer re-export `configureComponents`, `prefersReducedMotion`, `ComponentsConfig`, `UsaElement` — import them from `use-scroll-animate/components`.
18
+
19
+ ### Added
20
+ - **Unified plugin-style effect registration** — new category `use-scroll-animate/components/fx`: `registerEffect({ name, kind, defaults, reduced, run })`, `registerEffects()`, `playEffect(el, name, options)`, `bindEffect(el, name, { trigger: 'click' | 'hover' | 'enter' | 'load' | 'loop' | 'manual' })`, `listEffects(kind?)`, `getEffect()`, `hasEffect()`, `EFFECT_KINDS`, `EFFECT_TRIGGERS`. Effects receive a context whose `animate()` applies reduced motion, motion sensitivity, intensity and the animation budget.
21
+ - **`<usa-fx effect="…" trigger="…">`** plays any registered effect on its child.
22
+ - **Built-in effects** (`BUILTIN_EFFECTS`): every timeline preset as an `enter` effect; attention seekers `pulse` · `pop` · `jelly` · `wiggle` · `heartbeat` · `bounce` · `flash` · `tada` · `shake`; click effects `burst` · `confetti` · `ripple`.
23
+ - `animateWithMotion(el, frames, options)` — the shared motion-aware `animate()` used by elements and effects.
24
+ - `<usa-motion-switch>` keeps its Off button (now motion sensitivity `minimal`); `setMotionLevel()`, `getMotionLevel()`, `MotionSwitchLevel`.
25
+ - Showcase: new **Effects (plugin API)** category — attention seekers, click effects, scroll entrances, `registerEffect()` live demo.
26
+ - **[docs/ROADMAP.md](./docs/ROADMAP.md)**: the 5.1 → 6.0 plan (card & click 2.0, bounce physics, page-wide, scroll storytelling, generative backgrounds, sound-reactive, cursor & gesture packs, theme packs & micro-interactions, JSON animation player, 6.0 cleanup).
27
+ - CDN examples now use `use-scroll-animate@5`.
28
+
29
+ ## [4.9.0] - 2026-10-08
30
+
31
+ ### Deprecated (removed in 5.0 — each warns once in the console)
32
+ - `configureComponents({ motionIntensity: 'off' })` and `setMotionIntensity('off')` → `motionSensitivity: 'minimal'` / `setMotionSensitivity('minimal')`. (`<usa-motion-switch>`'s Off button and restoring a saved level stay silent.)
33
+ - `configureComponents({ reducedMotion: 'no-preference' })` → removed; the OS setting is always honoured (`'user'` / `'reduce'`).
34
+ - `<usa-timeline scrub="js">` → `scrub` (automatic JS fallback) + `smooth="…"`.
35
+ - `configureComponents` / `prefersReducedMotion` / `ComponentsConfig` / `UsaElement` imported from category entries → import from `use-scroll-animate/components`.
36
+
37
+ ### Added
38
+ - **Codemod** `npx usa-codemod-5 [--write] [paths…]` (new `bin`): rewrites all of the above in `.js/.ts/.jsx/.tsx/.vue/.svelte/.html/.astro` files; dry run by default.
39
+ - **[docs/upgrading-5.md](./docs/upgrading-5.md)** — removals, the 5.0 modern-browser baseline, what's new.
40
+ - `baselineReport()` / `warnBaseline()` (`components/a11y`): which 5.0-required (Custom Elements, WAAPI, IntersectionObserver, ResizeObserver, adoptedStyleSheets) and progressive (View Transitions, scroll-driven animations, WebGL) features this browser has.
41
+ - `withoutDeprecations(fn)` for library-internal calls.
42
+
10
43
  ## [4.8.0] - 2026-10-08
11
44
 
12
45
  ### Added
package/README.md CHANGED
@@ -39,7 +39,7 @@ defineComponents(); // or per category: import { defineTextComponents } from 'us
39
39
 
40
40
  ```html
41
41
  <!-- or with no build step -->
42
- <script src="https://unpkg.com/use-scroll-animate@4/dist/components.umd.js"></script>
42
+ <script src="https://unpkg.com/use-scroll-animate@5/dist/components.umd.js"></script>
43
43
  <usa-typewriter words="Hello, Windows.|Hello, web."></usa-typewriter>
44
44
  <usa-spinner kind="fluent"></usa-spinner>
45
45
  ```
@@ -64,6 +64,7 @@ defineComponents(); // or per category: import { defineTextComponents } from 'us
64
64
  | **3D & depth** (`/components/depth`) | `<usa-cube>` · `<usa-depth>` (pointer · gyroscope · scroll depth parallax) · `deviceTilt()` · (+ `<usa-carousel-3d>` in cards) |
65
65
  | **Layout animation** (`/components/layout`) | `<usa-auto-animate>` / `autoAnimate()` (list & grid reflow) · `<usa-masonry>` · `sharedTransition()` (shared elements) |
66
66
  | **Effect packs** (`/components/packs`) | `<usa-pack>` (`name="ecommerce \| portfolio \| dashboard \| game \| landing"`) · `applyPack()` · `flyToCart()` · `countUp()` |
67
+ | **Effects — plugin API** (`/components/fx`) | `<usa-fx>` (`effect` · `trigger` click / hover / enter / load / loop) · `registerEffect()` · `playEffect()` · `bindEffect()` · built-ins: every timeline entrance, pulse · pop · jelly · wiggle · heartbeat · bounce · flash · tada · shake, burst · confetti · ripple |
67
68
 
68
69
  Whole bundle ≈ 22 kB gzip (JS + CSS); one category 3.5–6.4 kB; a single component ≈ 2 kB. The scroll-animation core below is unaffected.
69
70
 
package/README_ja.md CHANGED
@@ -52,6 +52,7 @@ defineComponents(); // カテゴリ単位: import { defineTextComponents } from
52
52
  | **3D / 奥行き** (`/components/depth`) | `<usa-cube>` · `<usa-depth>`(ポインター · ジャイロ · スクロール視差)· `deviceTilt()` |
53
53
  | **レイアウト** (`/components/layout`) | `<usa-auto-animate>` / `autoAnimate()` · `<usa-masonry>` · `sharedTransition()`(共有要素) |
54
54
  | **エフェクトパック** (`/components/packs`) | `<usa-pack>` (`name="ecommerce \| portfolio \| dashboard \| game \| landing"`) · `applyPack()` · `flyToCart()` |
55
+ | **エフェクト API** (`/components/fx`) | `<usa-fx>` · `registerEffect()` · `playEffect()` · `bindEffect()` · 内蔵: タイムライン入場、pulse · pop · jelly · wiggle · bounce · tada · shake、burst · confetti · ripple |
55
56
 
56
57
  ## ドキュメント
57
58
 
package/README_zh.md CHANGED
@@ -36,7 +36,7 @@ defineComponents(); // 或按分类:import { defineTextComponents } from 'use-
36
36
 
37
37
  ```html
38
38
  <!-- 或免构建直接使用 -->
39
- <script src="https://unpkg.com/use-scroll-animate@4/dist/components.umd.js"></script>
39
+ <script src="https://unpkg.com/use-scroll-animate@5/dist/components.umd.js"></script>
40
40
  <usa-typewriter words="你好,Windows。|你好,Web。"></usa-typewriter>
41
41
  <usa-spinner kind="fluent"></usa-spinner>
42
42
  ```
@@ -61,6 +61,7 @@ defineComponents(); // 或按分类:import { defineTextComponents } from 'use-
61
61
  | **3D 与景深** (`/components/depth`) | `<usa-cube>` · `<usa-depth>`(指针 · 陀螺仪 · 滚动景深视差)· `deviceTilt()` ·(另见 cards 中的 `<usa-carousel-3d>`) |
62
62
  | **布局动画** (`/components/layout`) | `<usa-auto-animate>` / `autoAnimate()`(列表与网格重排)· `<usa-masonry>`(瀑布流)· `sharedTransition()`(共享元素) |
63
63
  | **效果包** (`/components/packs`) | `<usa-pack>` (`name="ecommerce \| portfolio \| dashboard \| game \| landing"`) · `applyPack()` · `flyToCart()` · `countUp()` |
64
+ | **特效插件 API** (`/components/fx`) | `<usa-fx>`(`effect` · `trigger`)· `registerEffect()` · `playEffect()` · `bindEffect()` · 内置:全部时间线入场、pulse · pop · jelly · wiggle · heartbeat · bounce · flash · tada · shake、burst · confetti · ripple |
64
65
 
65
66
  完整包约 22 kB gzip(JS + CSS);单个分类 3.5–6.4 kB;单个组件约 2 kB。下方的滚动动画核心不受影响。
66
67
 
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+ // use-scroll-animate 4.x → 5.0 codemod.
3
+ // npx usa-codemod-5 [--write] [paths…] (default: ./src; dry run without --write)
4
+ // Rewrites:
5
+ // 1. motionIntensity: 'off' → motionSensitivity: 'minimal'
6
+ // 2. setMotionIntensity('off'…) → setMotionSensitivity('minimal'…) (+ import from components/a11y)
7
+ // 3. reducedMotion: 'no-preference' → reducedMotion: 'user'
8
+ // 4. <usa-timeline … scrub="js" …> → scrub smooth="0.1"
9
+ // 5. configureComponents / prefersReducedMotion imported from a category entry
10
+ // (use-scroll-animate/components/<category>) → from 'use-scroll-animate/components'
11
+ import { readFileSync, writeFileSync, readdirSync, statSync } from 'node:fs';
12
+ import { join, extname } from 'node:path';
13
+ import { pathToFileURL } from 'node:url';
14
+
15
+ const EXT = new Set(['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.mts', '.cts', '.vue', '.svelte', '.html', '.astro']);
16
+ const SHARED = ['configureComponents', 'prefersReducedMotion', 'ComponentsConfig', 'UsaElement'];
17
+
18
+ /** Apply every rewrite to one file's source. Returns { code, changes }. */
19
+ export function transform(source) {
20
+ const changes = [];
21
+ let code = source;
22
+ const rep = (re, to, label) => {
23
+ code = code.replace(re, (...m) => {
24
+ changes.push(label);
25
+ return typeof to === 'function' ? to(...m) : to;
26
+ });
27
+ };
28
+ rep(/motionIntensity(\s*:\s*)(['"])off\2/g, (_m, sep, q) => `motionSensitivity${sep}${q}minimal${q}`, "motionIntensity: 'off' → motionSensitivity: 'minimal'");
29
+ let usedSens = false;
30
+ rep(/\bsetMotionIntensity\(\s*(['"])off\1/g, (_m, q) => ((usedSens = true), `setMotionSensitivity(${q}minimal${q}`), "setMotionIntensity('off') → setMotionSensitivity('minimal')");
31
+ rep(/reducedMotion(\s*:\s*)(['"])no-preference\2/g, (_m, sep, q) => `reducedMotion${sep}${q}user${q}`, "reducedMotion: 'no-preference' → 'user'");
32
+ rep(/(<usa-timeline\b[^>]*?)\bscrub=(["'])js\2/g, (_m, pre) => `${pre}scrub smooth="0.1"`, '<usa-timeline scrub="js"> → scrub smooth="0.1"');
33
+ // shared names imported from a category entry
34
+ rep(/import\s+(type\s+)?\{([^}]*)\}\s*from\s*(['"])use-scroll-animate\/components\/([a-z-]+)\3;?/g, (m, type, names, q, cat) => {
35
+ if (['react', 'vue', 'svelte', 'solid', 'angular', 'jsx', 'lazy', 'tokens', 'a11y', 'perf', 'bridge', 'lite'].includes(cat)) return changes.pop(), m;
36
+ const list = names.split(',').map((n) => n.trim()).filter(Boolean);
37
+ const shared = list.filter((n) => SHARED.includes(n.replace(/^type\s+/, '').split(/\s+as\s+/)[0]));
38
+ changes.pop(); // the generic label; re-pushed precisely below when something changes
39
+ if (!shared.length) return m;
40
+ changes.push(`${shared.join(', ')} → import from 'use-scroll-animate/components'`);
41
+ const rest = list.filter((n) => !shared.includes(n));
42
+ const t = type || '';
43
+ const a = rest.length ? `import ${t}{ ${rest.join(', ')} } from ${q}use-scroll-animate/components/${cat}${q};\n` : '';
44
+ return `${a}import ${t}{ ${shared.join(', ')} } from ${q}use-scroll-animate/components${q};`;
45
+ }, 'shared import');
46
+ if (usedSens && !/\bsetMotionSensitivity\b[^(]*from\s*['"]use-scroll-animate/.test(code) && /\bimport\b/.test(code)) {
47
+ code = code.replace(/^(\s*import[^\n]*\n)/m, `import { setMotionSensitivity } from 'use-scroll-animate/components/a11y';\n$1`);
48
+ changes.push("added import { setMotionSensitivity } from 'use-scroll-animate/components/a11y'");
49
+ }
50
+ return { code, changes };
51
+ }
52
+
53
+ function* walk(p) {
54
+ const st = statSync(p);
55
+ if (st.isDirectory()) {
56
+ for (const f of readdirSync(p)) if (!['node_modules', 'dist', '.git'].includes(f)) yield* walk(join(p, f));
57
+ } else if (EXT.has(extname(p))) yield p;
58
+ }
59
+
60
+ export function run(args) {
61
+ const write = args.includes('--write');
62
+ const paths = args.filter((a) => !a.startsWith('--'));
63
+ let files = 0;
64
+ let edits = 0;
65
+ for (const root of paths.length ? paths : ['src'])
66
+ for (const f of walk(root)) {
67
+ const src = readFileSync(f, 'utf8');
68
+ const { code, changes } = transform(src);
69
+ if (!changes.length) continue;
70
+ files++;
71
+ edits += changes.length;
72
+ console.log(`${f}\n - ${changes.join('\n - ')}`);
73
+ if (write) writeFileSync(f, code);
74
+ }
75
+ console.log(`\n${edits} change(s) in ${files} file(s)${write ? ' written' : ' (dry run — add --write to apply)'}.`);
76
+ return { files, edits };
77
+ }
78
+
79
+ if (import.meta.url === pathToFileURL(process.argv[1] || '').href) run(process.argv.slice(2));
@@ -9,10 +9,16 @@
9
9
  * scripts. Classes are created the first time a `define*()` function runs.
10
10
  */
11
11
  const MOTION_SENSITIVITY_LEVELS = ['full', 'gentle', 'minimal', 'static'];
12
- const MOTION_SCALE = { off: 0, low: 0.6, normal: 1, high: 1.25 };
12
+ const MOTION_SCALE = { low: 0.6, normal: 1, high: 1.25 };
13
13
  const config = { injectStyles: true, reducedMotion: 'user', motionIntensity: 'normal', motionSensitivity: 'full' };
14
14
  /** Change global component settings (call before `define*()` for `injectStyles`). */
15
15
  function configureComponents(options) {
16
+ options = { ...options };
17
+ // 5.0: removed values are ignored (see docs/upgrading-5.md)
18
+ if (options.motionIntensity && !(options.motionIntensity in MOTION_SCALE))
19
+ delete options.motionIntensity;
20
+ if (options.reducedMotion && options.reducedMotion !== 'reduce')
21
+ options.reducedMotion = 'user';
16
22
  Object.assign(config, options);
17
23
  if (options.motionIntensity && typeof document !== 'undefined') {
18
24
  document.documentElement.style.setProperty('--usa-motion', String(MOTION_SCALE[options.motionIntensity] ?? 1));
@@ -57,6 +63,14 @@ function adaptKeyframes(frames, level = config.motionSensitivity) {
57
63
  return out;
58
64
  });
59
65
  }
66
+ /** Run `fn` without 4.9 deprecation warnings (library-internal calls). */
67
+ function withoutDeprecations(fn) {
68
+ try {
69
+ return fn();
70
+ }
71
+ finally {
72
+ }
73
+ }
60
74
  /** The current global motion intensity. */
61
75
  function getMotionIntensity() {
62
76
  return config.motionIntensity;
@@ -68,10 +82,10 @@ function motionScale() {
68
82
  const canDefine = () => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';
69
83
  /** `true` when animations should be reduced (OS setting or `configureComponents`). */
70
84
  function prefersReducedMotion() {
71
- if (config.motionIntensity === 'off' || config.motionSensitivity === 'minimal' || config.motionSensitivity === 'static')
85
+ if (config.motionSensitivity === 'minimal' || config.motionSensitivity === 'static')
86
+ return true;
87
+ if (config.reducedMotion === 'reduce')
72
88
  return true;
73
- if (config.reducedMotion !== 'user')
74
- return config.reducedMotion === 'reduce';
75
89
  return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;
76
90
  }
77
91
  const injected = new Set();
@@ -207,31 +221,7 @@ function getBase() {
207
221
  }
208
222
  /** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */
209
223
  motion(el, keyframes, options) {
210
- if (typeof el.animate !== 'function' || config.motionSensitivity === 'static') {
211
- applyFrame(el, keyframes[keyframes.length - 1]);
212
- return null;
213
- }
214
- keyframes = adaptKeyframes(keyframes);
215
- if (active >= maxActive) {
216
- applyFrame(el, keyframes[keyframes.length - 1]);
217
- return null;
218
- }
219
- const k = motionScale();
220
- if (k !== 1 && k > 0 && typeof options.duration === 'number')
221
- options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };
222
- const a = el.animate(keyframes, options);
223
- if (options.iterations !== Infinity) {
224
- active++;
225
- let done = false;
226
- const end = () => {
227
- if (!done) {
228
- done = true;
229
- active--;
230
- }
231
- };
232
- a?.finished?.then(end, end);
233
- }
234
- return a;
224
+ return animateWithMotion(el, keyframes, options);
235
225
  }
236
226
  emit(type, detail) {
237
227
  return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));
@@ -240,6 +230,39 @@ function getBase() {
240
230
  baseClass = Base;
241
231
  return baseClass;
242
232
  }
233
+ /**
234
+ * `el.animate()` with the library's motion rules (5.0, shared by elements and
235
+ * registered effects): motion sensitivity (keyframes adapted, `static` →
236
+ * final frame), intensity (duration scale) and the animation budget. Returns
237
+ * `null` (final frame applied) when nothing should animate.
238
+ */
239
+ function animateWithMotion(el, keyframes, options) {
240
+ if (typeof el.animate !== 'function' || config.motionSensitivity === 'static') {
241
+ applyFrame(el, keyframes[keyframes.length - 1]);
242
+ return null;
243
+ }
244
+ keyframes = adaptKeyframes(keyframes);
245
+ if (active >= maxActive) {
246
+ applyFrame(el, keyframes[keyframes.length - 1]);
247
+ return null;
248
+ }
249
+ const k = motionScale();
250
+ if (k !== 1 && k > 0 && typeof options.duration === 'number')
251
+ options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };
252
+ const a = el.animate(keyframes, options);
253
+ if (options.iterations !== Infinity) {
254
+ active++;
255
+ let done = false;
256
+ const end = () => {
257
+ if (!done) {
258
+ done = true;
259
+ active--;
260
+ }
261
+ };
262
+ a?.finished?.then(end, end);
263
+ }
264
+ return a;
265
+ }
243
266
  /** Write a keyframe's properties as inline styles (no-WAAPI fallback). */
244
267
  function applyFrame(el, frame) {
245
268
  if (!frame)
@@ -360,6 +383,15 @@ const EASE_OUT = 'cubic-bezier(0.22, 1, 0.36, 1)';
360
383
  const EASE_SPRING = 'cubic-bezier(0.34, 1.56, 0.64, 1)';
361
384
  /** Windows Fluent "decelerate" / "point-to-point" curves. */
362
385
  const FLUENT_DECELERATE = 'cubic-bezier(0.1, 0.9, 0.2, 1)';
386
+ const warned = new Set();
387
+ /** Log a deprecation once per key (console.warn). */
388
+ function deprecate(key, message) {
389
+ if (warned.has(key))
390
+ return;
391
+ warned.add(key);
392
+ if (typeof console !== 'undefined')
393
+ console.warn(`[use-scroll-animate] ${message}`);
394
+ }
363
395
  /**
364
396
  * The `kind` attribute of `<usa-spinner>`, `<usa-check>`, `<usa-dialog>` and
365
397
  * `<usa-acrylic>` (3.0: `variant` only selects a style variant).
@@ -378,6 +410,7 @@ exports.MOTION_SENSITIVITY_LEVELS = MOTION_SENSITIVITY_LEVELS;
378
410
  exports.activeAnimations = activeAnimations;
379
411
  exports.adaptKeyframes = adaptKeyframes;
380
412
  exports.adoptStyles = adoptStyles;
413
+ exports.animateWithMotion = animateWithMotion;
381
414
  exports.animationBudget = animationBudget;
382
415
  exports.applyFrame = applyFrame;
383
416
  exports.caf = caf;
@@ -385,6 +418,7 @@ exports.canDefine = canDefine;
385
418
  exports.clamp = clamp;
386
419
  exports.configureComponents = configureComponents;
387
420
  exports.defineElement = defineElement;
421
+ exports.deprecate = deprecate;
388
422
  exports.getMotionIntensity = getMotionIntensity;
389
423
  exports.getMotionSensitivity = getMotionSensitivity;
390
424
  exports.kindOf = kindOf;
@@ -398,4 +432,5 @@ exports.setAnimationBudget = setAnimationBudget;
398
432
  exports.setStyleLoader = setStyleLoader;
399
433
  exports.shadowStyles = shadowStyles;
400
434
  exports.srText = srText;
401
- //# sourceMappingURL=base-CxYU2NK_.cjs.map
435
+ exports.withoutDeprecations = withoutDeprecations;
436
+ //# sourceMappingURL=base-B5i8qQPR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-B5i8qQPR.cjs","sources":["../../src/components/base.ts"],"sourcesContent":["/**\n * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.\n *\n * Everything here is lazy: nothing touches `window`, `document`,\n * `HTMLElement` or `matchMedia` at import time, so the components can be\n * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload\n * scripts. Classes are created the first time a `define*()` function runs.\n */\n\nexport interface ComponentsConfig {\n /**\n * Inject each component's CSS when it is defined (default `true`). Uses a\n * constructable stylesheet (`document.adoptedStyleSheets`, which a strict\n * `style-src` CSP does not block) and falls back to a `<style>` tag. Set\n * to `false` when you load `use-scroll-animate/components.css` yourself.\n */\n injectStyles?: boolean;\n /**\n * `'user'` (default) follows `prefers-reduced-motion`; `'reduce'` always\n * uses the reduced variants (e.g. a kiosk / battery-saver mode). 5.0: the\n * OS setting can no longer be ignored (`'no-preference'` was removed).\n */\n reducedMotion?: 'user' | 'reduce';\n /**\n * Global motion intensity (v2.7): `'low'` (shorter, calmer), `'normal'`\n * (default) or `'high'`. Scales every component animation's duration and\n * sets `--usa-motion` (0.6 / 1 / 1.25) on `<html>` for your own CSS. 5.0:\n * `'off'` was removed — use `motionSensitivity: 'minimal'`.\n */\n motionIntensity?: MotionIntensity;\n /**\n * Motion-sensitivity level (v4.4), finer than reduced motion:\n * `'full'` (default) · `'gentle'` (no spins, zooms, skews or parallax —\n * translations and fades only, safe for vestibular disorders) ·\n * `'minimal'` (fades only; components use their reduced-motion variants) ·\n * `'static'` (no animation: every component shows its static alternative).\n * See `setMotionSensitivity()` in `use-scroll-animate/components/a11y`.\n */\n motionSensitivity?: MotionSensitivity;\n}\n\nexport type MotionSensitivity = 'full' | 'gentle' | 'minimal' | 'static';\nexport const MOTION_SENSITIVITY_LEVELS: readonly MotionSensitivity[] = ['full', 'gentle', 'minimal', 'static'];\n\nexport type MotionIntensity = 'low' | 'normal' | 'high';\nexport const MOTION_SCALE: Record<MotionIntensity, number> = { low: 0.6, normal: 1, high: 1.25 };\n\nconst config: Required<ComponentsConfig> = { injectStyles: true, reducedMotion: 'user', motionIntensity: 'normal', motionSensitivity: 'full' };\n\n/** Change global component settings (call before `define*()` for `injectStyles`). */\nexport function configureComponents(options: ComponentsConfig): void {\n options = { ...options };\n // 5.0: removed values are ignored (see docs/upgrading-5.md)\n if (options.motionIntensity && !(options.motionIntensity in MOTION_SCALE)) delete options.motionIntensity;\n if (options.reducedMotion && options.reducedMotion !== 'reduce') options.reducedMotion = 'user';\n Object.assign(config, options);\n if (options.motionIntensity && typeof document !== 'undefined') {\n document.documentElement.style.setProperty('--usa-motion', String(MOTION_SCALE[options.motionIntensity] ?? 1));\n document.documentElement.setAttribute('data-usa-motion', options.motionIntensity);\n }\n if (options.motionSensitivity && typeof document !== 'undefined') {\n if (options.motionSensitivity === 'full') document.documentElement.removeAttribute('data-usa-sensitivity');\n else document.documentElement.setAttribute('data-usa-sensitivity', options.motionSensitivity);\n }\n}\n\n/** The current motion-sensitivity level (v4.4). */\nexport function getMotionSensitivity(): MotionSensitivity {\n return config.motionSensitivity;\n}\n\nconst VESTIBULAR = /rotate|scale|skew|perspective|matrix3d/;\n/**\n * Adapt keyframes to the sensitivity level: `gentle` drops transforms that\n * spin, zoom or skew (and 3D), `minimal` keeps opacity only, `static` keeps\n * just the final frame. `full` returns them unchanged.\n */\nexport function adaptKeyframes(frames: Keyframe[], level: MotionSensitivity = config.motionSensitivity): Keyframe[] {\n if (level === 'full' || !frames.length) return frames;\n if (level === 'static') return [frames[frames.length - 1]];\n return frames.map((f) => {\n const out: Keyframe = {};\n for (const [k, v] of Object.entries(f)) {\n if (k === 'offset' || k === 'easing' || k === 'composite') out[k] = v as any;\n else if (level === 'minimal') {\n if (k === 'opacity') out[k] = v as any;\n } else if (k === 'rotate' || k === 'scale' || (k === 'transform' && VESTIBULAR.test(String(v)))) continue;\n else out[k] = v as any;\n }\n return out;\n });\n}\n\nlet quiet = 0;\n/** Run `fn` without 4.9 deprecation warnings (library-internal calls). */\nexport function withoutDeprecations<T>(fn: () => T): T {\n quiet++;\n try {\n return fn();\n } finally {\n quiet--;\n }\n}\n\n/** The current global motion intensity. */\nexport function getMotionIntensity(): MotionIntensity {\n return config.motionIntensity;\n}\n\n/** Duration multiplier for the current intensity (1 when `normal`). */\nexport function motionScale(): number {\n return MOTION_SCALE[config.motionIntensity] ?? 1;\n}\n\nexport const canDefine = (): boolean => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';\n\n/** `true` when animations should be reduced (OS setting or `configureComponents`). */\nexport function prefersReducedMotion(): boolean {\n if (config.motionSensitivity === 'minimal' || config.motionSensitivity === 'static') return true;\n if (config.reducedMotion === 'reduce') return true;\n return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst injected = new Set<string>();\n\n/** Add a component's stylesheet to the document once. */\nexport function adoptStyles(id: string, css: string): void {\n if (!config.injectStyles || !css || injected.has(id) || typeof document === 'undefined') return;\n injected.add(id);\n try {\n if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in document) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];\n return;\n }\n } catch {\n /* fall through to <style> */\n }\n const style = document.createElement('style');\n style.setAttribute('data-usa', id);\n style.textContent = css;\n (document.head || document.documentElement).appendChild(style);\n}\n\n/** Attach `css` to a shadow root (constructable sheet where supported, else `<style>`). */\nexport function shadowStyles(root: ShadowRoot, css: string): void {\n try {\n if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in root) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n root.adoptedStyleSheets = [sheet];\n return;\n }\n } catch {\n /* fall through */\n }\n const style = document.createElement('style');\n style.textContent = css;\n root.prepend(style);\n}\n\nexport type Cleanup = () => void;\n\n/**\n * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup\n * bag that is emptied on disconnect, and motion helpers that degrade to the\n * final state without WAAPI or under reduced motion.\n */\nexport interface UsaElement extends HTMLElement {\n /** `true` while reduced motion applies to this element. */\n readonly reduced: boolean;\n}\n\nexport interface UsaBase extends UsaElement {\n mount(): void;\n changed(name: string): void;\n unmount(): void;\n str(name: string, fallback?: string): string;\n num(name: string, fallback: number): number;\n flag(name: string): boolean;\n setFlag(name: string, on: boolean): void;\n onCleanup(fn: Cleanup): void;\n listen<K extends keyof HTMLElementEventMap>(\n target: EventTarget,\n type: K | string,\n fn: (e: any) => void,\n options?: AddEventListenerOptions\n ): void;\n inView(cb: (visible: boolean, entry?: IntersectionObserverEntry) => void, init?: IntersectionObserverInit, target?: Element): void;\n motion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null;\n emit(type: string, detail?: unknown): boolean;\n}\n\ntype BaseCtor = new () => UsaBase;\nlet baseClass: BaseCtor | null = null;\n\n/** The lazily created base class (needs `HTMLElement`). */\nexport function getBase(): BaseCtor {\n if (baseClass) return baseClass;\n class Base extends HTMLElement {\n private _cleanups: Cleanup[] = [];\n private _connected = false;\n\n get reduced(): boolean {\n return prefersReducedMotion();\n }\n\n connectedCallback(): void {\n if (this._connected) return;\n this._connected = true;\n styleLoader?.(this.localName);\n // Upgraded while the parser is still inside us (a <script> in <head>\n // defined the element): children/text are not there yet, so wait.\n if (typeof document !== 'undefined' && document.readyState === 'loading' && !this.nextSibling && !this.childNodes.length) {\n const go = () => {\n if (this._connected && this.isConnected) this.mount();\n };\n document.addEventListener('DOMContentLoaded', go, { once: true });\n this._cleanups.push(() => document.removeEventListener('DOMContentLoaded', go));\n return;\n }\n this.mount();\n }\n\n disconnectedCallback(): void {\n this._connected = false;\n this.teardown();\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, value: string | null): void {\n if (!this._connected || oldValue === value) return;\n this.changed(_name);\n }\n\n /** Re-mount on attribute change (override for finer updates). */\n changed(_name: string): void {\n this.teardown();\n this.mount();\n }\n\n private teardown(): void {\n this._cleanups.splice(0).reverse().forEach((fn) => fn());\n this.unmount();\n }\n\n mount(): void {}\n unmount(): void {}\n\n str(name: string, fallback = ''): string {\n const v = this.getAttribute(name);\n return v === null ? fallback : v;\n }\n\n num(name: string, fallback: number): number {\n const v = this.getAttribute(name);\n const n = v === null || v.trim() === '' ? NaN : Number(v);\n return Number.isFinite(n) ? n : fallback;\n }\n\n /** Boolean attribute: present and not `\"false\"`. */\n flag(name: string): boolean {\n const v = this.getAttribute(name);\n return v !== null && v !== 'false';\n }\n\n setFlag(name: string, on: boolean): void {\n if (on) this.setAttribute(name, '');\n else this.removeAttribute(name);\n }\n\n onCleanup(fn: Cleanup): void {\n this._cleanups.push(fn);\n }\n\n listen(target: EventTarget, type: string, fn: (e: any) => void, options?: AddEventListenerOptions): void {\n target.addEventListener(type, fn, options);\n this.onCleanup(() => target.removeEventListener(type, fn, options));\n }\n\n /** Calls `cb(true/false)` as the element enters / leaves the viewport. */\n inView(cb: (visible: boolean, entry?: IntersectionObserverEntry) => void, init?: IntersectionObserverInit, target: Element = this): void {\n if (typeof IntersectionObserver === 'undefined') {\n cb(true);\n return;\n }\n const io = new IntersectionObserver((entries) => {\n for (const e of entries) cb(e.isIntersecting, e);\n }, init);\n io.observe(target);\n this.onCleanup(() => io.disconnect());\n }\n\n /** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */\n motion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null {\n return animateWithMotion(el, keyframes, options);\n }\n\n emit(type: string, detail?: unknown): boolean {\n return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));\n }\n }\n baseClass = Base as unknown as BaseCtor;\n return baseClass;\n}\n\n/**\n * `el.animate()` with the library's motion rules (5.0, shared by elements and\n * registered effects): motion sensitivity (keyframes adapted, `static` →\n * final frame), intensity (duration scale) and the animation budget. Returns\n * `null` (final frame applied) when nothing should animate.\n */\nexport function animateWithMotion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null {\n if (typeof (el as HTMLElement).animate !== 'function' || config.motionSensitivity === 'static') {\n applyFrame(el as HTMLElement, keyframes[keyframes.length - 1]);\n return null;\n }\n keyframes = adaptKeyframes(keyframes);\n if (active >= maxActive) {\n applyFrame(el as HTMLElement, keyframes[keyframes.length - 1]);\n return null;\n }\n const k = motionScale();\n if (k !== 1 && k > 0 && typeof options.duration === 'number') options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };\n const a = (el as HTMLElement).animate(keyframes, options);\n if (options.iterations !== Infinity) {\n active++;\n let done = false;\n const end = () => {\n if (!done) {\n done = true;\n active--;\n }\n };\n a?.finished?.then(end, end);\n }\n return a;\n}\n\n/** Write a keyframe's properties as inline styles (no-WAAPI fallback). */\nexport function applyFrame(el: HTMLElement, frame?: Keyframe): void {\n if (!frame) return;\n for (const [k, v] of Object.entries(frame)) {\n if (k === 'offset' || k === 'easing' || k === 'composite' || v == null) continue;\n (el.style as any)[k] = String(v);\n }\n}\n\n/**\n * Register `tag` with the class built by `make(Base)`. Returns the\n * constructor, the already registered one, or `undefined` without DOM.\n */\nexport function defineElement(\n tag: string,\n make: (Base: BaseCtor) => CustomElementConstructor,\n css?: { id: string; text: string }\n): CustomElementConstructor | undefined {\n if (!canDefine()) return undefined;\n adoptStyles('base', BASE_CSS);\n if (css) adoptStyles(css.id, css.text);\n const existing = customElements.get(tag);\n if (existing) return existing;\n const ctor = make(getBase());\n customElements.define(tag, ctor);\n return ctor;\n}\n\nconst BASE_CSS = '.usa-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}';\n\n/** A visually hidden copy of `text` for screen readers (the animated copy is `aria-hidden`). */\nexport function srText(text: string): HTMLSpanElement {\n const s = document.createElement('span');\n s.className = 'usa-sr';\n s.textContent = text;\n return s;\n}\n\n// --- shared rAF scheduler (4.5) ----------------------------------------------\n// Every component loop goes through one requestAnimationFrame per frame\n// instead of one per element: callbacks are batched, run in order, and a\n// throwing callback no longer starves the others (the first error is rethrown).\nconst frameQueue = new Map<number, FrameRequestCallback>();\nlet frameSeq = 1;\nlet frameHandle: number | ReturnType<typeof setTimeout> | 0 = 0;\nlet frameVia: unknown = null;\nconst frameStats = { frames: 0, callbacks: 0, peak: 0, last: 0 };\nconst frameListeners = new Set<(t: number, dt: number) => void>();\n\nfunction flushFrame(t: number): void {\n frameHandle = 0;\n const dt = frameStats.last && t > frameStats.last ? t - frameStats.last : 16.7;\n frameStats.last = t;\n frameStats.frames++;\n const cbs = Array.from(frameQueue.values());\n frameQueue.clear();\n frameStats.callbacks += cbs.length;\n frameStats.peak = Math.max(frameStats.peak, cbs.length);\n let error: unknown = null;\n for (const cb of cbs) {\n try {\n cb(t);\n } catch (e) {\n error ??= e;\n }\n }\n frameListeners.forEach((fn) => fn(t, dt));\n if (frameListeners.size) requestFlush();\n if (error) throw error;\n}\n\nfunction requestFlush(): void {\n const native = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : null;\n // A stale handle from a replaced requestAnimationFrame (tests, iframes) is dropped.\n if (frameHandle && frameVia === native) return;\n frameVia = native;\n frameHandle = native ? native(flushFrame) : setTimeout(() => flushFrame(now()), 16);\n}\n\n/** requestAnimationFrame through the shared scheduler (timeout fallback in jsdom / hidden documents). */\nexport const raf = (cb: FrameRequestCallback): number => {\n const id = frameSeq++;\n frameQueue.set(id, cb);\n requestFlush();\n return id;\n};\n/** Monotonic time in ms (rAF callback timestamps differ between environments, so loops use this). */\nexport const now = (): number => (typeof performance !== 'undefined' ? performance.now() : Date.now());\nexport const caf = (id: number): void => {\n frameQueue.delete(id);\n};\n\n/** Run `fn(time, dt)` every frame on the shared scheduler until the returned function is called. */\nexport function onFrame(fn: (t: number, dt: number) => void): () => void {\n frameListeners.add(fn);\n requestFlush();\n return () => frameListeners.delete(fn);\n}\n\n/** Scheduler counters: frames flushed, callbacks run, peak callbacks in one frame, pending now. */\nexport function schedulerStats(): { frames: number; callbacks: number; peak: number; pending: number; loops: number } {\n return { frames: frameStats.frames, callbacks: frameStats.callbacks, peak: frameStats.peak, pending: frameQueue.size, loops: frameListeners.size };\n}\n\n// --- active animation budget (4.5) ---------------------------------------------\nlet active = 0;\nlet maxActive = Infinity;\n/** Number of component animations running right now. */\nexport const activeAnimations = (): number => active;\n/** Cap concurrent component animations; extra ones jump to their final frame (`Infinity` = no cap). */\nexport function setAnimationBudget(max: number): void {\n maxActive = max > 0 ? max : Infinity;\n}\n/** The current cap. */\nexport const animationBudget = (): number => maxActive;\n\n// --- on-demand styles (4.5) -----------------------------------------------------\nlet styleLoader: ((tag: string) => void) | null = null;\n/** Called with each element's tag the first time one connects (used by the `lite` build to load CSS on demand). */\nexport function setStyleLoader(fn: ((tag: string) => void) | null): void {\n styleLoader = fn;\n}\n\nexport const EASE_OUT = 'cubic-bezier(0.22, 1, 0.36, 1)';\nexport const EASE_SPRING = 'cubic-bezier(0.34, 1.56, 0.64, 1)';\n/** Windows Fluent \"decelerate\" / \"point-to-point\" curves. */\nexport const FLUENT_DECELERATE = 'cubic-bezier(0.1, 0.9, 0.2, 1)';\n\nconst warned = new Set<string>();\n/** Log a deprecation once per key (console.warn). */\nexport function deprecate(key: string, message: string): void {\n if (warned.has(key)) return;\n warned.add(key);\n if (typeof console !== 'undefined') console.warn(`[use-scroll-animate] ${message}`);\n}\n\n/**\n * The `kind` attribute of `<usa-spinner>`, `<usa-check>`, `<usa-dialog>` and\n * `<usa-acrylic>` (3.0: `variant` only selects a style variant).\n */\nexport function kindOf(el: Element, valid: readonly string[] | Record<string, unknown>, fallback: string): string {\n const k = el.getAttribute('kind');\n return k && (Array.isArray(valid) ? valid.includes(k) : k in (valid as object)) ? k : fallback;\n}\n\nexport const clamp = (v: number, min: number, max: number): number => Math.min(max, Math.max(min, v));\n"],"names":[],"mappings":";;AAAA;;;;;;;AAOG;AA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B,IAAA,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;IACf,IAAI,OAAO,OAAO,KAAK,WAAW;AAAE,QAAA,OAAO,CAAC,IAAI,CAAC,wBAAwB,OAAO,CAAA,CAAE,CAAC;AACrF;AAEA;;;AAGG;SACa,MAAM,CAAC,EAAW,EAAE,KAAkD,EAAE,QAAgB,EAAA;IACtG,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC;AACjC,IAAA,OAAO,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAK,KAAgB,CAAC,GAAG,CAAC,GAAG,QAAQ;AAChG;AAEO,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW,KAAa,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -7,10 +7,16 @@
7
7
  * scripts. Classes are created the first time a `define*()` function runs.
8
8
  */
9
9
  const MOTION_SENSITIVITY_LEVELS = ['full', 'gentle', 'minimal', 'static'];
10
- const MOTION_SCALE = { off: 0, low: 0.6, normal: 1, high: 1.25 };
10
+ const MOTION_SCALE = { low: 0.6, normal: 1, high: 1.25 };
11
11
  const config = { injectStyles: true, reducedMotion: 'user', motionIntensity: 'normal', motionSensitivity: 'full' };
12
12
  /** Change global component settings (call before `define*()` for `injectStyles`). */
13
13
  function configureComponents(options) {
14
+ options = { ...options };
15
+ // 5.0: removed values are ignored (see docs/upgrading-5.md)
16
+ if (options.motionIntensity && !(options.motionIntensity in MOTION_SCALE))
17
+ delete options.motionIntensity;
18
+ if (options.reducedMotion && options.reducedMotion !== 'reduce')
19
+ options.reducedMotion = 'user';
14
20
  Object.assign(config, options);
15
21
  if (options.motionIntensity && typeof document !== 'undefined') {
16
22
  document.documentElement.style.setProperty('--usa-motion', String(MOTION_SCALE[options.motionIntensity] ?? 1));
@@ -55,6 +61,14 @@ function adaptKeyframes(frames, level = config.motionSensitivity) {
55
61
  return out;
56
62
  });
57
63
  }
64
+ /** Run `fn` without 4.9 deprecation warnings (library-internal calls). */
65
+ function withoutDeprecations(fn) {
66
+ try {
67
+ return fn();
68
+ }
69
+ finally {
70
+ }
71
+ }
58
72
  /** The current global motion intensity. */
59
73
  function getMotionIntensity() {
60
74
  return config.motionIntensity;
@@ -66,10 +80,10 @@ function motionScale() {
66
80
  const canDefine = () => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';
67
81
  /** `true` when animations should be reduced (OS setting or `configureComponents`). */
68
82
  function prefersReducedMotion() {
69
- if (config.motionIntensity === 'off' || config.motionSensitivity === 'minimal' || config.motionSensitivity === 'static')
83
+ if (config.motionSensitivity === 'minimal' || config.motionSensitivity === 'static')
84
+ return true;
85
+ if (config.reducedMotion === 'reduce')
70
86
  return true;
71
- if (config.reducedMotion !== 'user')
72
- return config.reducedMotion === 'reduce';
73
87
  return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;
74
88
  }
75
89
  const injected = new Set();
@@ -205,31 +219,7 @@ function getBase() {
205
219
  }
206
220
  /** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */
207
221
  motion(el, keyframes, options) {
208
- if (typeof el.animate !== 'function' || config.motionSensitivity === 'static') {
209
- applyFrame(el, keyframes[keyframes.length - 1]);
210
- return null;
211
- }
212
- keyframes = adaptKeyframes(keyframes);
213
- if (active >= maxActive) {
214
- applyFrame(el, keyframes[keyframes.length - 1]);
215
- return null;
216
- }
217
- const k = motionScale();
218
- if (k !== 1 && k > 0 && typeof options.duration === 'number')
219
- options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };
220
- const a = el.animate(keyframes, options);
221
- if (options.iterations !== Infinity) {
222
- active++;
223
- let done = false;
224
- const end = () => {
225
- if (!done) {
226
- done = true;
227
- active--;
228
- }
229
- };
230
- a?.finished?.then(end, end);
231
- }
232
- return a;
222
+ return animateWithMotion(el, keyframes, options);
233
223
  }
234
224
  emit(type, detail) {
235
225
  return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));
@@ -238,6 +228,39 @@ function getBase() {
238
228
  baseClass = Base;
239
229
  return baseClass;
240
230
  }
231
+ /**
232
+ * `el.animate()` with the library's motion rules (5.0, shared by elements and
233
+ * registered effects): motion sensitivity (keyframes adapted, `static` →
234
+ * final frame), intensity (duration scale) and the animation budget. Returns
235
+ * `null` (final frame applied) when nothing should animate.
236
+ */
237
+ function animateWithMotion(el, keyframes, options) {
238
+ if (typeof el.animate !== 'function' || config.motionSensitivity === 'static') {
239
+ applyFrame(el, keyframes[keyframes.length - 1]);
240
+ return null;
241
+ }
242
+ keyframes = adaptKeyframes(keyframes);
243
+ if (active >= maxActive) {
244
+ applyFrame(el, keyframes[keyframes.length - 1]);
245
+ return null;
246
+ }
247
+ const k = motionScale();
248
+ if (k !== 1 && k > 0 && typeof options.duration === 'number')
249
+ options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };
250
+ const a = el.animate(keyframes, options);
251
+ if (options.iterations !== Infinity) {
252
+ active++;
253
+ let done = false;
254
+ const end = () => {
255
+ if (!done) {
256
+ done = true;
257
+ active--;
258
+ }
259
+ };
260
+ a?.finished?.then(end, end);
261
+ }
262
+ return a;
263
+ }
241
264
  /** Write a keyframe's properties as inline styles (no-WAAPI fallback). */
242
265
  function applyFrame(el, frame) {
243
266
  if (!frame)
@@ -358,6 +381,15 @@ const EASE_OUT = 'cubic-bezier(0.22, 1, 0.36, 1)';
358
381
  const EASE_SPRING = 'cubic-bezier(0.34, 1.56, 0.64, 1)';
359
382
  /** Windows Fluent "decelerate" / "point-to-point" curves. */
360
383
  const FLUENT_DECELERATE = 'cubic-bezier(0.1, 0.9, 0.2, 1)';
384
+ const warned = new Set();
385
+ /** Log a deprecation once per key (console.warn). */
386
+ function deprecate(key, message) {
387
+ if (warned.has(key))
388
+ return;
389
+ warned.add(key);
390
+ if (typeof console !== 'undefined')
391
+ console.warn(`[use-scroll-animate] ${message}`);
392
+ }
361
393
  /**
362
394
  * The `kind` attribute of `<usa-spinner>`, `<usa-check>`, `<usa-dialog>` and
363
395
  * `<usa-acrylic>` (3.0: `variant` only selects a style variant).
@@ -368,5 +400,5 @@ function kindOf(el, valid, fallback) {
368
400
  }
369
401
  const clamp = (v, min, max) => Math.min(max, Math.max(min, v));
370
402
 
371
- export { EASE_SPRING as E, FLUENT_DECELERATE as F, MOTION_SCALE as M, MOTION_SENSITIVITY_LEVELS as a, activeAnimations as b, canDefine as c, adaptKeyframes as d, animationBudget as e, configureComponents as f, getMotionIntensity as g, getMotionSensitivity as h, setAnimationBudget as i, clamp as j, caf as k, applyFrame as l, motionScale as m, now as n, onFrame as o, prefersReducedMotion as p, adoptStyles as q, raf as r, schedulerStats as s, setStyleLoader as t, defineElement as u, EASE_OUT as v, kindOf as w, shadowStyles as x, srText as y };
372
- //# sourceMappingURL=base-CZiIAMBc.js.map
403
+ export { shadowStyles as A, srText as B, EASE_SPRING as E, FLUENT_DECELERATE as F, MOTION_SCALE as M, MOTION_SENSITIVITY_LEVELS as a, activeAnimations as b, canDefine as c, adaptKeyframes as d, animateWithMotion as e, animationBudget as f, configureComponents as g, getMotionIntensity as h, getMotionSensitivity as i, setAnimationBudget as j, clamp as k, applyFrame as l, motionScale as m, now as n, onFrame as o, prefersReducedMotion as p, caf as q, raf as r, schedulerStats as s, setStyleLoader as t, adoptStyles as u, deprecate as v, withoutDeprecations as w, defineElement as x, EASE_OUT as y, kindOf as z };
404
+ //# sourceMappingURL=base-C3Sw9sAO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-C3Sw9sAO.js","sources":["../../src/components/base.ts"],"sourcesContent":["/**\n * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.\n *\n * Everything here is lazy: nothing touches `window`, `document`,\n * `HTMLElement` or `matchMedia` at import time, so the components can be\n * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload\n * scripts. Classes are created the first time a `define*()` function runs.\n */\n\nexport interface ComponentsConfig {\n /**\n * Inject each component's CSS when it is defined (default `true`). Uses a\n * constructable stylesheet (`document.adoptedStyleSheets`, which a strict\n * `style-src` CSP does not block) and falls back to a `<style>` tag. Set\n * to `false` when you load `use-scroll-animate/components.css` yourself.\n */\n injectStyles?: boolean;\n /**\n * `'user'` (default) follows `prefers-reduced-motion`; `'reduce'` always\n * uses the reduced variants (e.g. a kiosk / battery-saver mode). 5.0: the\n * OS setting can no longer be ignored (`'no-preference'` was removed).\n */\n reducedMotion?: 'user' | 'reduce';\n /**\n * Global motion intensity (v2.7): `'low'` (shorter, calmer), `'normal'`\n * (default) or `'high'`. Scales every component animation's duration and\n * sets `--usa-motion` (0.6 / 1 / 1.25) on `<html>` for your own CSS. 5.0:\n * `'off'` was removed — use `motionSensitivity: 'minimal'`.\n */\n motionIntensity?: MotionIntensity;\n /**\n * Motion-sensitivity level (v4.4), finer than reduced motion:\n * `'full'` (default) · `'gentle'` (no spins, zooms, skews or parallax —\n * translations and fades only, safe for vestibular disorders) ·\n * `'minimal'` (fades only; components use their reduced-motion variants) ·\n * `'static'` (no animation: every component shows its static alternative).\n * See `setMotionSensitivity()` in `use-scroll-animate/components/a11y`.\n */\n motionSensitivity?: MotionSensitivity;\n}\n\nexport type MotionSensitivity = 'full' | 'gentle' | 'minimal' | 'static';\nexport const MOTION_SENSITIVITY_LEVELS: readonly MotionSensitivity[] = ['full', 'gentle', 'minimal', 'static'];\n\nexport type MotionIntensity = 'low' | 'normal' | 'high';\nexport const MOTION_SCALE: Record<MotionIntensity, number> = { low: 0.6, normal: 1, high: 1.25 };\n\nconst config: Required<ComponentsConfig> = { injectStyles: true, reducedMotion: 'user', motionIntensity: 'normal', motionSensitivity: 'full' };\n\n/** Change global component settings (call before `define*()` for `injectStyles`). */\nexport function configureComponents(options: ComponentsConfig): void {\n options = { ...options };\n // 5.0: removed values are ignored (see docs/upgrading-5.md)\n if (options.motionIntensity && !(options.motionIntensity in MOTION_SCALE)) delete options.motionIntensity;\n if (options.reducedMotion && options.reducedMotion !== 'reduce') options.reducedMotion = 'user';\n Object.assign(config, options);\n if (options.motionIntensity && typeof document !== 'undefined') {\n document.documentElement.style.setProperty('--usa-motion', String(MOTION_SCALE[options.motionIntensity] ?? 1));\n document.documentElement.setAttribute('data-usa-motion', options.motionIntensity);\n }\n if (options.motionSensitivity && typeof document !== 'undefined') {\n if (options.motionSensitivity === 'full') document.documentElement.removeAttribute('data-usa-sensitivity');\n else document.documentElement.setAttribute('data-usa-sensitivity', options.motionSensitivity);\n }\n}\n\n/** The current motion-sensitivity level (v4.4). */\nexport function getMotionSensitivity(): MotionSensitivity {\n return config.motionSensitivity;\n}\n\nconst VESTIBULAR = /rotate|scale|skew|perspective|matrix3d/;\n/**\n * Adapt keyframes to the sensitivity level: `gentle` drops transforms that\n * spin, zoom or skew (and 3D), `minimal` keeps opacity only, `static` keeps\n * just the final frame. `full` returns them unchanged.\n */\nexport function adaptKeyframes(frames: Keyframe[], level: MotionSensitivity = config.motionSensitivity): Keyframe[] {\n if (level === 'full' || !frames.length) return frames;\n if (level === 'static') return [frames[frames.length - 1]];\n return frames.map((f) => {\n const out: Keyframe = {};\n for (const [k, v] of Object.entries(f)) {\n if (k === 'offset' || k === 'easing' || k === 'composite') out[k] = v as any;\n else if (level === 'minimal') {\n if (k === 'opacity') out[k] = v as any;\n } else if (k === 'rotate' || k === 'scale' || (k === 'transform' && VESTIBULAR.test(String(v)))) continue;\n else out[k] = v as any;\n }\n return out;\n });\n}\n\nlet quiet = 0;\n/** Run `fn` without 4.9 deprecation warnings (library-internal calls). */\nexport function withoutDeprecations<T>(fn: () => T): T {\n quiet++;\n try {\n return fn();\n } finally {\n quiet--;\n }\n}\n\n/** The current global motion intensity. */\nexport function getMotionIntensity(): MotionIntensity {\n return config.motionIntensity;\n}\n\n/** Duration multiplier for the current intensity (1 when `normal`). */\nexport function motionScale(): number {\n return MOTION_SCALE[config.motionIntensity] ?? 1;\n}\n\nexport const canDefine = (): boolean => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';\n\n/** `true` when animations should be reduced (OS setting or `configureComponents`). */\nexport function prefersReducedMotion(): boolean {\n if (config.motionSensitivity === 'minimal' || config.motionSensitivity === 'static') return true;\n if (config.reducedMotion === 'reduce') return true;\n return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst injected = new Set<string>();\n\n/** Add a component's stylesheet to the document once. */\nexport function adoptStyles(id: string, css: string): void {\n if (!config.injectStyles || !css || injected.has(id) || typeof document === 'undefined') return;\n injected.add(id);\n try {\n if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in document) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];\n return;\n }\n } catch {\n /* fall through to <style> */\n }\n const style = document.createElement('style');\n style.setAttribute('data-usa', id);\n style.textContent = css;\n (document.head || document.documentElement).appendChild(style);\n}\n\n/** Attach `css` to a shadow root (constructable sheet where supported, else `<style>`). */\nexport function shadowStyles(root: ShadowRoot, css: string): void {\n try {\n if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in root) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n root.adoptedStyleSheets = [sheet];\n return;\n }\n } catch {\n /* fall through */\n }\n const style = document.createElement('style');\n style.textContent = css;\n root.prepend(style);\n}\n\nexport type Cleanup = () => void;\n\n/**\n * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup\n * bag that is emptied on disconnect, and motion helpers that degrade to the\n * final state without WAAPI or under reduced motion.\n */\nexport interface UsaElement extends HTMLElement {\n /** `true` while reduced motion applies to this element. */\n readonly reduced: boolean;\n}\n\nexport interface UsaBase extends UsaElement {\n mount(): void;\n changed(name: string): void;\n unmount(): void;\n str(name: string, fallback?: string): string;\n num(name: string, fallback: number): number;\n flag(name: string): boolean;\n setFlag(name: string, on: boolean): void;\n onCleanup(fn: Cleanup): void;\n listen<K extends keyof HTMLElementEventMap>(\n target: EventTarget,\n type: K | string,\n fn: (e: any) => void,\n options?: AddEventListenerOptions\n ): void;\n inView(cb: (visible: boolean, entry?: IntersectionObserverEntry) => void, init?: IntersectionObserverInit, target?: Element): void;\n motion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null;\n emit(type: string, detail?: unknown): boolean;\n}\n\ntype BaseCtor = new () => UsaBase;\nlet baseClass: BaseCtor | null = null;\n\n/** The lazily created base class (needs `HTMLElement`). */\nexport function getBase(): BaseCtor {\n if (baseClass) return baseClass;\n class Base extends HTMLElement {\n private _cleanups: Cleanup[] = [];\n private _connected = false;\n\n get reduced(): boolean {\n return prefersReducedMotion();\n }\n\n connectedCallback(): void {\n if (this._connected) return;\n this._connected = true;\n styleLoader?.(this.localName);\n // Upgraded while the parser is still inside us (a <script> in <head>\n // defined the element): children/text are not there yet, so wait.\n if (typeof document !== 'undefined' && document.readyState === 'loading' && !this.nextSibling && !this.childNodes.length) {\n const go = () => {\n if (this._connected && this.isConnected) this.mount();\n };\n document.addEventListener('DOMContentLoaded', go, { once: true });\n this._cleanups.push(() => document.removeEventListener('DOMContentLoaded', go));\n return;\n }\n this.mount();\n }\n\n disconnectedCallback(): void {\n this._connected = false;\n this.teardown();\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, value: string | null): void {\n if (!this._connected || oldValue === value) return;\n this.changed(_name);\n }\n\n /** Re-mount on attribute change (override for finer updates). */\n changed(_name: string): void {\n this.teardown();\n this.mount();\n }\n\n private teardown(): void {\n this._cleanups.splice(0).reverse().forEach((fn) => fn());\n this.unmount();\n }\n\n mount(): void {}\n unmount(): void {}\n\n str(name: string, fallback = ''): string {\n const v = this.getAttribute(name);\n return v === null ? fallback : v;\n }\n\n num(name: string, fallback: number): number {\n const v = this.getAttribute(name);\n const n = v === null || v.trim() === '' ? NaN : Number(v);\n return Number.isFinite(n) ? n : fallback;\n }\n\n /** Boolean attribute: present and not `\"false\"`. */\n flag(name: string): boolean {\n const v = this.getAttribute(name);\n return v !== null && v !== 'false';\n }\n\n setFlag(name: string, on: boolean): void {\n if (on) this.setAttribute(name, '');\n else this.removeAttribute(name);\n }\n\n onCleanup(fn: Cleanup): void {\n this._cleanups.push(fn);\n }\n\n listen(target: EventTarget, type: string, fn: (e: any) => void, options?: AddEventListenerOptions): void {\n target.addEventListener(type, fn, options);\n this.onCleanup(() => target.removeEventListener(type, fn, options));\n }\n\n /** Calls `cb(true/false)` as the element enters / leaves the viewport. */\n inView(cb: (visible: boolean, entry?: IntersectionObserverEntry) => void, init?: IntersectionObserverInit, target: Element = this): void {\n if (typeof IntersectionObserver === 'undefined') {\n cb(true);\n return;\n }\n const io = new IntersectionObserver((entries) => {\n for (const e of entries) cb(e.isIntersecting, e);\n }, init);\n io.observe(target);\n this.onCleanup(() => io.disconnect());\n }\n\n /** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */\n motion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null {\n return animateWithMotion(el, keyframes, options);\n }\n\n emit(type: string, detail?: unknown): boolean {\n return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));\n }\n }\n baseClass = Base as unknown as BaseCtor;\n return baseClass;\n}\n\n/**\n * `el.animate()` with the library's motion rules (5.0, shared by elements and\n * registered effects): motion sensitivity (keyframes adapted, `static` →\n * final frame), intensity (duration scale) and the animation budget. Returns\n * `null` (final frame applied) when nothing should animate.\n */\nexport function animateWithMotion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null {\n if (typeof (el as HTMLElement).animate !== 'function' || config.motionSensitivity === 'static') {\n applyFrame(el as HTMLElement, keyframes[keyframes.length - 1]);\n return null;\n }\n keyframes = adaptKeyframes(keyframes);\n if (active >= maxActive) {\n applyFrame(el as HTMLElement, keyframes[keyframes.length - 1]);\n return null;\n }\n const k = motionScale();\n if (k !== 1 && k > 0 && typeof options.duration === 'number') options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };\n const a = (el as HTMLElement).animate(keyframes, options);\n if (options.iterations !== Infinity) {\n active++;\n let done = false;\n const end = () => {\n if (!done) {\n done = true;\n active--;\n }\n };\n a?.finished?.then(end, end);\n }\n return a;\n}\n\n/** Write a keyframe's properties as inline styles (no-WAAPI fallback). */\nexport function applyFrame(el: HTMLElement, frame?: Keyframe): void {\n if (!frame) return;\n for (const [k, v] of Object.entries(frame)) {\n if (k === 'offset' || k === 'easing' || k === 'composite' || v == null) continue;\n (el.style as any)[k] = String(v);\n }\n}\n\n/**\n * Register `tag` with the class built by `make(Base)`. Returns the\n * constructor, the already registered one, or `undefined` without DOM.\n */\nexport function defineElement(\n tag: string,\n make: (Base: BaseCtor) => CustomElementConstructor,\n css?: { id: string; text: string }\n): CustomElementConstructor | undefined {\n if (!canDefine()) return undefined;\n adoptStyles('base', BASE_CSS);\n if (css) adoptStyles(css.id, css.text);\n const existing = customElements.get(tag);\n if (existing) return existing;\n const ctor = make(getBase());\n customElements.define(tag, ctor);\n return ctor;\n}\n\nconst BASE_CSS = '.usa-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}';\n\n/** A visually hidden copy of `text` for screen readers (the animated copy is `aria-hidden`). */\nexport function srText(text: string): HTMLSpanElement {\n const s = document.createElement('span');\n s.className = 'usa-sr';\n s.textContent = text;\n return s;\n}\n\n// --- shared rAF scheduler (4.5) ----------------------------------------------\n// Every component loop goes through one requestAnimationFrame per frame\n// instead of one per element: callbacks are batched, run in order, and a\n// throwing callback no longer starves the others (the first error is rethrown).\nconst frameQueue = new Map<number, FrameRequestCallback>();\nlet frameSeq = 1;\nlet frameHandle: number | ReturnType<typeof setTimeout> | 0 = 0;\nlet frameVia: unknown = null;\nconst frameStats = { frames: 0, callbacks: 0, peak: 0, last: 0 };\nconst frameListeners = new Set<(t: number, dt: number) => void>();\n\nfunction flushFrame(t: number): void {\n frameHandle = 0;\n const dt = frameStats.last && t > frameStats.last ? t - frameStats.last : 16.7;\n frameStats.last = t;\n frameStats.frames++;\n const cbs = Array.from(frameQueue.values());\n frameQueue.clear();\n frameStats.callbacks += cbs.length;\n frameStats.peak = Math.max(frameStats.peak, cbs.length);\n let error: unknown = null;\n for (const cb of cbs) {\n try {\n cb(t);\n } catch (e) {\n error ??= e;\n }\n }\n frameListeners.forEach((fn) => fn(t, dt));\n if (frameListeners.size) requestFlush();\n if (error) throw error;\n}\n\nfunction requestFlush(): void {\n const native = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : null;\n // A stale handle from a replaced requestAnimationFrame (tests, iframes) is dropped.\n if (frameHandle && frameVia === native) return;\n frameVia = native;\n frameHandle = native ? native(flushFrame) : setTimeout(() => flushFrame(now()), 16);\n}\n\n/** requestAnimationFrame through the shared scheduler (timeout fallback in jsdom / hidden documents). */\nexport const raf = (cb: FrameRequestCallback): number => {\n const id = frameSeq++;\n frameQueue.set(id, cb);\n requestFlush();\n return id;\n};\n/** Monotonic time in ms (rAF callback timestamps differ between environments, so loops use this). */\nexport const now = (): number => (typeof performance !== 'undefined' ? performance.now() : Date.now());\nexport const caf = (id: number): void => {\n frameQueue.delete(id);\n};\n\n/** Run `fn(time, dt)` every frame on the shared scheduler until the returned function is called. */\nexport function onFrame(fn: (t: number, dt: number) => void): () => void {\n frameListeners.add(fn);\n requestFlush();\n return () => frameListeners.delete(fn);\n}\n\n/** Scheduler counters: frames flushed, callbacks run, peak callbacks in one frame, pending now. */\nexport function schedulerStats(): { frames: number; callbacks: number; peak: number; pending: number; loops: number } {\n return { frames: frameStats.frames, callbacks: frameStats.callbacks, peak: frameStats.peak, pending: frameQueue.size, loops: frameListeners.size };\n}\n\n// --- active animation budget (4.5) ---------------------------------------------\nlet active = 0;\nlet maxActive = Infinity;\n/** Number of component animations running right now. */\nexport const activeAnimations = (): number => active;\n/** Cap concurrent component animations; extra ones jump to their final frame (`Infinity` = no cap). */\nexport function setAnimationBudget(max: number): void {\n maxActive = max > 0 ? max : Infinity;\n}\n/** The current cap. */\nexport const animationBudget = (): number => maxActive;\n\n// --- on-demand styles (4.5) -----------------------------------------------------\nlet styleLoader: ((tag: string) => void) | null = null;\n/** Called with each element's tag the first time one connects (used by the `lite` build to load CSS on demand). */\nexport function setStyleLoader(fn: ((tag: string) => void) | null): void {\n styleLoader = fn;\n}\n\nexport const EASE_OUT = 'cubic-bezier(0.22, 1, 0.36, 1)';\nexport const EASE_SPRING = 'cubic-bezier(0.34, 1.56, 0.64, 1)';\n/** Windows Fluent \"decelerate\" / \"point-to-point\" curves. */\nexport const FLUENT_DECELERATE = 'cubic-bezier(0.1, 0.9, 0.2, 1)';\n\nconst warned = new Set<string>();\n/** Log a deprecation once per key (console.warn). */\nexport function deprecate(key: string, message: string): void {\n if (warned.has(key)) return;\n warned.add(key);\n if (typeof console !== 'undefined') console.warn(`[use-scroll-animate] ${message}`);\n}\n\n/**\n * The `kind` attribute of `<usa-spinner>`, `<usa-check>`, `<usa-dialog>` and\n * `<usa-acrylic>` (3.0: `variant` only selects a style variant).\n */\nexport function kindOf(el: Element, valid: readonly string[] | Record<string, unknown>, fallback: string): string {\n const k = el.getAttribute('kind');\n return k && (Array.isArray(valid) ? valid.includes(k) : k in (valid as object)) ? k : fallback;\n}\n\nexport const clamp = (v: number, min: number, max: number): number => Math.min(max, Math.max(min, v));\n"],"names":[],"mappings":"AAAA;;;;;;;AAOG;AAmCI,MAAM,yBAAyB,GAAiC,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;AAGtG,MAAM,YAAY,GAAoC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI;AAE9F,MAAM,MAAM,GAA+B,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAA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