use-scroll-animate 2.1.0 → 2.3.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 (70) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +31 -2
  3. package/README_ja.md +19 -0
  4. package/README_zh.md +30 -0
  5. package/dist/chunks/base-CJ7XfidP.cjs +233 -0
  6. package/dist/chunks/base-CJ7XfidP.cjs.map +1 -0
  7. package/dist/chunks/base-CuvCgqLy.js +219 -0
  8. package/dist/chunks/base-CuvCgqLy.js.map +1 -0
  9. package/dist/components/background.cjs +395 -0
  10. package/dist/components/background.cjs.map +1 -0
  11. package/dist/components/background.css +7 -0
  12. package/dist/components/background.d.cts +132 -0
  13. package/dist/components/background.d.ts +132 -0
  14. package/dist/components/background.js +387 -0
  15. package/dist/components/background.js.map +1 -0
  16. package/dist/components/feedback.cjs +444 -0
  17. package/dist/components/feedback.cjs.map +1 -0
  18. package/dist/components/feedback.css +7 -0
  19. package/dist/components/feedback.d.cts +170 -0
  20. package/dist/components/feedback.d.ts +170 -0
  21. package/dist/components/feedback.js +434 -0
  22. package/dist/components/feedback.js.map +1 -0
  23. package/dist/components/interaction.cjs +426 -0
  24. package/dist/components/interaction.cjs.map +1 -0
  25. package/dist/components/interaction.css +8 -0
  26. package/dist/components/interaction.d.cts +142 -0
  27. package/dist/components/interaction.d.ts +142 -0
  28. package/dist/components/interaction.js +417 -0
  29. package/dist/components/interaction.js.map +1 -0
  30. package/dist/components/physics.cjs +664 -0
  31. package/dist/components/physics.cjs.map +1 -0
  32. package/dist/components/physics.css +5 -0
  33. package/dist/components/physics.d.cts +216 -0
  34. package/dist/components/physics.d.ts +216 -0
  35. package/dist/components/physics.js +644 -0
  36. package/dist/components/physics.js.map +1 -0
  37. package/dist/components/reveal.cjs +360 -0
  38. package/dist/components/reveal.cjs.map +1 -0
  39. package/dist/components/reveal.css +5 -0
  40. package/dist/components/reveal.d.cts +132 -0
  41. package/dist/components/reveal.d.ts +132 -0
  42. package/dist/components/reveal.js +350 -0
  43. package/dist/components/reveal.js.map +1 -0
  44. package/dist/components/text.cjs +528 -0
  45. package/dist/components/text.cjs.map +1 -0
  46. package/dist/components/text.css +7 -0
  47. package/dist/components/text.d.cts +164 -0
  48. package/dist/components/text.d.ts +164 -0
  49. package/dist/components/text.js +517 -0
  50. package/dist/components/text.js.map +1 -0
  51. package/dist/components/transitions.cjs +546 -0
  52. package/dist/components/transitions.cjs.map +1 -0
  53. package/dist/components/transitions.css +6 -0
  54. package/dist/components/transitions.d.cts +180 -0
  55. package/dist/components/transitions.d.ts +180 -0
  56. package/dist/components/transitions.js +536 -0
  57. package/dist/components/transitions.js.map +1 -0
  58. package/dist/components.cjs +127 -0
  59. package/dist/components.cjs.map +1 -0
  60. package/dist/components.css +33 -0
  61. package/dist/components.d.cts +919 -0
  62. package/dist/components.d.ts +919 -0
  63. package/dist/components.js +65 -0
  64. package/dist/components.js.map +1 -0
  65. package/dist/components.umd.js +22 -0
  66. package/dist/components.umd.js.map +1 -0
  67. package/docs/API.md +2 -0
  68. package/docs/components.md +169 -0
  69. package/docs/windows-apps.md +108 -0
  70. package/package.json +105 -5
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
+ ## [2.3.0] - 2026-10-07
11
+
12
+ ### Added
13
+ - **Spring & physics** — new category `use-scroll-animate/components/physics` (+ `components/physics.css`):
14
+ - **Spring core**: a damped-spring solver (`stiffness`, `damping`, `mass`, initial `velocity`) with presets `gentle`, `wobbly`, `stiff`, `bouncy` (plus `default`, `slow`, `molasses`). `springEasing()` converts a spring into a CSS `linear()` easing + duration for WAAPI/CSS (cubic-bezier fallback where `linear()` is unsupported); `spring(el, keyframes, preset)` animates with it; `createSpring()` is an interruptible, velocity-preserving spring value for gestures. Helpers `projectInertia()` (flick projection), `snapTo()` (grid / points) and `rubberBand()` (iOS-style resistance).
15
+ - `<usa-spring>`: `bounce-in`, `pop`, `drop` entrances with true spring timing, `jelly` and `rubber-band` attention effects; `trigger="view|hover|click|manual"`, `preset` or `stiffness`/`damping`/`mass`, `repeat`.
16
+ - `<usa-draggable>`: drag with mouse, touch, pen or arrow keys; `spring-back`, `inertia`, `snap` (grid or points), `bounds="parent"` with rubber-banding, `axis`; events `usa:drag-start` / `usa:drag-end` / `usa:settle`.
17
+ - `<usa-overscroll>`: elastic scroll container — pulling past an edge (touch, trackpad, wheel) stretches with rubber-band resistance and springs back.
18
+ - Reduced motion: entrances fade, attention effects and overscroll stretch are skipped, springs jump to their target.
19
+ - Showcase: new **Spring & physics** category in the component gallery with live demos (effect / preset pickers, drag areas, elastic list, `spring()` playground).
20
+ - `npm run sync:exports` regenerates the per-category `exports` from `scripts/categories.mjs` (single list used by Rollup, the CSS bundle and a sync test).
21
+
22
+ ## [2.2.0] - 2026-10-07
23
+
24
+ ### Added
25
+ - **Animated components** — `use-scroll-animate/components`: 30 framework-agnostic, dependency-free `<usa-*>` custom elements (Custom Elements + CSS + Web Animations API) that run in browsers and in Windows desktop apps rendering with a web view (Electron, Tauri, WebView2 in WinUI 3 / WPF / WinForms, PWAs). Organised in six categories, each its own subpath export:
26
+ - **Entrance & scroll** (`/components/reveal`): `<usa-reveal>` (12 effects, `repeat`), `<usa-stagger>`, `<usa-scroll-progress>` (page or `target`, `role="progressbar"`), `<usa-scrolly>` (sticky scrollytelling with `usa:step`).
27
+ - **Text** (`/components/text`): `<usa-typewriter>`, `<usa-split-text>`, `<usa-scramble>`, `<usa-counter>` (`Intl.NumberFormat`, animated `.value`), `<usa-shimmer-text>`, `<usa-text-rotate>`. Animated text keeps a visually hidden plain copy for screen readers.
28
+ - **Interaction** (`/components/interaction`): `<usa-ripple>`, `<usa-magnetic>`, `<usa-tilt>` (glare, `--usa-tilt-x/y`), `<usa-spotlight>` (Fluent Reveal highlight), `<usa-press>`, `<usa-toggle>` (`role="switch"`, form-associated).
29
+ - **Loading & feedback** (`/components/feedback`): `<usa-spinner>` (`fluent` WinUI ring, `windows` orbiting dots, `ring`, `dots`, `pulse`, `bars`), `<usa-skeleton>`, `<usa-progress>` (Fluent indeterminate, paused / error states), `<usa-toaster>` + `toast()`, `<usa-check>`.
30
+ - **Background & decoration** (`/components/background`): `<usa-aurora>`, `<usa-particles>` (canvas, runs only while visible), `<usa-grain>`, `<usa-marquee>`, `<usa-acrylic>` (Acrylic / Mica, solid under `prefers-reduced-transparency` / forced colours).
31
+ - **Transitions** (`/components/transitions`): `<usa-dialog>` (native `<dialog>`; modal, drawers, sheet), `<usa-accordion>` (native `<details>`), `<usa-flip-list>`, `<usa-view-switch>`, and the helpers `viewTransition()` (View Transitions API with fallback), `flip()` and `connectedAnimation()` (WinUI-style shared-element animation).
32
+ - `defineComponents(categories?)`, `define<Category>Components()`, one `define*()` per element (custom tag names supported), `COMPONENT_CATEGORIES`, `configureComponents({ injectStyles, reducedMotion })`. Typed via `HTMLElementTagNameMap`.
33
+ - Every component honours `prefers-reduced-motion`, animates `transform` / `opacity` (and `filter` for blurs), batches layout reads/writes per frame, pauses loops off-screen / in hidden tabs, and is SSR-safe (no DOM access at import; `define*()` is a no-op on the server).
34
+ - Styles are injected per component as constructable stylesheets (CSP `style-src 'self'` friendly) or loaded as files: `use-scroll-animate/components.css` and `use-scroll-animate/components/<category>.css`.
35
+ - **No-build bundle** `dist/components.umd.js` (IIFE/UMD, global `UsaComponents`) registers every element on load.
36
+ - Docs: [`docs/components.md`](./docs/components.md) (every element, attribute, method and event, by category) and [`docs/windows-apps.md`](./docs/windows-apps.md) (Electron, Tauri, WinUI 3 / WPF / WinForms with WebView2, PWA, CSP, native Mica). README sections in English, 中文 and 日本語.
37
+ - **Showcase**: new component gallery `showcase/components.html` with category navigation, search, live demos of every element, per-card code tabs (HTML / ES module / React / Vue / Electron·Tauri·WebView2), English / 中文, dark / light; linked from the Animation Store and deployed by the existing Pages workflow.
38
+ - Size budgets for the bundle, the CSS file, each category and single-component imports (`size-budget.json`); `check:exports` covers the new entries and stylesheets.
39
+
40
+ ### Changed
41
+ - `package.json` `sideEffects` is now `["*.css"]` (was `false`) so bundlers keep the optional stylesheet imports; all JS stays side-effect free.
42
+
10
43
  ## [2.1.0] - 2026-10-07
11
44
 
12
45
  ### Added
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # use-scroll-animate 🚀
4
4
 
5
- **A lightweight (~5.7KB gzipped), dependency-free scroll animation library for the modern web.**
5
+ **A lightweight (~5.7KB gzipped), dependency-free scroll animation library for the modern web — plus 30 animated Web Components for web pages and Windows apps.**
6
6
 
7
7
  [![GitHub release (latest by date)](https://img.shields.io/github/v/release/HarrisonCN/use-scroll-animate?style=flat-square)](https://github.com/HarrisonCN/use-scroll-animate/releases)
8
8
  [![GitHub repo size](https://img.shields.io/github/repo-size/HarrisonCN/use-scroll-animate?style=flat-square)](https://github.com/HarrisonCN/use-scroll-animate)
@@ -10,7 +10,7 @@
10
10
 
11
11
  [English](./README.md) | [简体中文](./README_zh.md) | [日本語](./README_ja.md)
12
12
 
13
- **[✨ Live showcase — every effect, live, with copy-paste code](https://harrisoncn.github.io/use-scroll-animate/)**
13
+ **[✨ Live showcase — every effect, live, with copy-paste code](https://harrisoncn.github.io/use-scroll-animate/)** · **[🧩 Component gallery](https://harrisoncn.github.io/use-scroll-animate/showcase/components.html)**
14
14
 
15
15
  </div>
16
16
 
@@ -26,6 +26,34 @@ In 2025, performance is everything. Traditional scroll animation libraries often
26
26
  - ♿ **Accessible**: Respects `prefers-reduced-motion` out of the box (content is shown immediately, no entrance or parallax motion).
27
27
  - 🖥️ **SSR-safe**: Importing (and even calling) the API on the server is a no-op.
28
28
 
29
+ ## Animated components (v2.2+) 🧩
30
+
31
+ **30 dependency-free animated Web Components** (`<usa-*>`) in six categories — for **web pages and Windows desktop apps** (Electron, Tauri, WebView2 in WinUI/WPF/WinForms, PWAs). Custom Elements + CSS + Web Animations only: tree-shakable, SSR-safe, `prefers-reduced-motion` everywhere. **[Live gallery](https://harrisoncn.github.io/use-scroll-animate/showcase/components.html)** · [Component docs](./docs/components.md) · [Windows apps guide](./docs/windows-apps.md)
32
+
33
+ ```js
34
+ import { defineComponents } from 'use-scroll-animate/components';
35
+ defineComponents(); // or per category: import { defineTextComponents } from 'use-scroll-animate/components/text'
36
+ ```
37
+
38
+ ```html
39
+ <!-- or with no build step -->
40
+ <script src="https://unpkg.com/use-scroll-animate@2/dist/components.umd.js"></script>
41
+ <usa-typewriter words="Hello, Windows.|Hello, web."></usa-typewriter>
42
+ <usa-spinner variant="fluent"></usa-spinner>
43
+ ```
44
+
45
+ | Category (import) | Components |
46
+ |---|---|
47
+ | **Entrance & scroll** (`/components/reveal`) | `<usa-reveal>` (12 effects) · `<usa-stagger>` · `<usa-scroll-progress>` · `<usa-scrolly>` (sticky scrollytelling) |
48
+ | **Text** (`/components/text`) | `<usa-typewriter>` · `<usa-split-text>` · `<usa-scramble>` · `<usa-counter>` · `<usa-shimmer-text>` · `<usa-text-rotate>` |
49
+ | **Interaction** (`/components/interaction`) | `<usa-ripple>` · `<usa-magnetic>` · `<usa-tilt>` · `<usa-spotlight>` (Fluent reveal highlight) · `<usa-press>` · `<usa-toggle>` |
50
+ | **Loading & feedback** (`/components/feedback`) | `<usa-spinner>` (WinUI ring, Windows dots, ring, dots, pulse, bars) · `<usa-skeleton>` · `<usa-progress>` · `<usa-toaster>` + `toast()` · `<usa-check>` |
51
+ | **Background & decoration** (`/components/background`) | `<usa-aurora>` · `<usa-particles>` · `<usa-grain>` · `<usa-marquee>` · `<usa-acrylic>` (Acrylic / Mica) |
52
+ | **Transitions** (`/components/transitions`) | `<usa-dialog>` (modal / drawer / sheet) · `<usa-accordion>` · `<usa-flip-list>` · `<usa-view-switch>` · `viewTransition()` · `flip()` · `connectedAnimation()` |
53
+ | **Spring & physics** (`/components/physics`) | `<usa-spring>` (bounce-in · pop · drop · jelly · rubber-band) · `<usa-draggable>` (spring-back · inertia · snap) · `<usa-overscroll>` · `spring()` · `createSpring()` · `SPRING_PRESETS` |
54
+
55
+ 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.
56
+
29
57
  ## v2.0.0 🎉
30
58
 
31
59
  - **Native scroll-driven animations by default** (`engine: 'auto'`) where the browser supports `animation-timeline: view()`, JS everywhere else.
@@ -35,6 +63,7 @@ In 2025, performance is everything. Traditional scroll animation libraries often
35
63
  ## Documentation
36
64
 
37
65
  - 📖 [API reference](./docs/API.md) — every export, option, attribute and config key
66
+ - 🧩 [Animated components](./docs/components.md) — every `<usa-*>` element, by category · [Windows apps guide](./docs/windows-apps.md) (Electron, Tauri, WebView2, PWA)
38
67
  - 🎛️ [Demo / preset playground](./demo/index.html) — every preset clickable, no build step (open `demo/index.html` from a clone)
39
68
  - 🔁 Migration guides: [from AOS](./docs/migration-from-aos.md) · [from GSAP ScrollTrigger](./docs/migration-from-gsap-scrolltrigger.md)
40
69
  - ⚠️ [Upgrading to 2.0](./docs/deprecations.md) — what 2.0 removed and what replaces it (also the MIGRATION section of the [CHANGELOG](./CHANGELOG.md))
package/README_ja.md CHANGED
@@ -23,6 +23,25 @@
23
23
  - 🧩 **フレームワークに依存しない**:Vanilla JS、React、Vue、Svelteなどとシームレスに動作。一流の React Hooks と Vue Composables を内蔵。
24
24
  - ♿ **アクセシブル**:`prefers-reduced-motion` を標準でサポート。
25
25
 
26
+ ## アニメーションコンポーネント(v2.2)🧩
27
+
28
+ 依存ゼロの**アニメーション Web Components 30 種**(`<usa-*>`)を 6 カテゴリで提供。**Web ページと Windows デスクトップアプリ**(Electron、Tauri、WinUI/WPF/WinForms の WebView2、PWA)の両方で動作します。Custom Elements + CSS + Web Animations のみ、ツリーシェイク可能、SSR セーフ、`prefers-reduced-motion` 対応。**[ライブギャラリー](https://harrisoncn.github.io/use-scroll-animate/showcase/components.html)** · [コンポーネント文書](./docs/components.md)(英語)· [Windows アプリガイド](./docs/windows-apps.md)(英語)
29
+
30
+ ```js
31
+ import { defineComponents } from 'use-scroll-animate/components';
32
+ defineComponents(); // カテゴリ単位: import { defineTextComponents } from 'use-scroll-animate/components/text'
33
+ ```
34
+
35
+ | カテゴリ(インポート) | コンポーネント |
36
+ |---|---|
37
+ | **入場・スクロール**(`/components/reveal`) | `<usa-reveal>` · `<usa-stagger>` · `<usa-scroll-progress>` · `<usa-scrolly>` |
38
+ | **テキスト**(`/components/text`) | `<usa-typewriter>` · `<usa-split-text>` · `<usa-scramble>` · `<usa-counter>` · `<usa-shimmer-text>` · `<usa-text-rotate>` |
39
+ | **インタラクション**(`/components/interaction`) | `<usa-ripple>` · `<usa-magnetic>` · `<usa-tilt>` · `<usa-spotlight>`(Fluent Reveal)· `<usa-press>` · `<usa-toggle>` |
40
+ | **ローディング・フィードバック**(`/components/feedback`) | `<usa-spinner>` · `<usa-skeleton>` · `<usa-progress>` · `<usa-toaster>` + `toast()` · `<usa-check>` |
41
+ | **背景・装飾**(`/components/background`) | `<usa-aurora>` · `<usa-particles>` · `<usa-grain>` · `<usa-marquee>` · `<usa-acrylic>`(Acrylic / Mica) |
42
+ | **トランジション**(`/components/transitions`) | `<usa-dialog>` · `<usa-accordion>` · `<usa-flip-list>` · `<usa-view-switch>` · `viewTransition()` · `flip()` · `connectedAnimation()` |
43
+ | **スプリング・物理**(`/components/physics`) | `<usa-spring>`(bounce-in · pop · drop · jelly · rubber-band)· `<usa-draggable>` · `<usa-overscroll>` · `spring()` · `createSpring()` |
44
+
26
45
  ## ドキュメント
27
46
 
28
47
  - [API リファレンス](./docs/API.md)(英語)· [デモ](./demo/index.html)(全プリセットをクリックで再生、ビルド不要)
package/README_zh.md CHANGED
@@ -25,6 +25,36 @@
25
25
  - 🧩 **框架无关**:完美支持原生 JS、React、Vue、Svelte 等。内置一流的 React Hooks 和 Vue Composables。
26
26
  - ♿ **无障碍**:原生支持 `prefers-reduced-motion`。
27
27
 
28
+ ## 动画组件(v2.2)🧩
29
+
30
+ **30 个零依赖的动画 Web Components**(`<usa-*>`),分为六大类——**同时适用于网页与 Windows 桌面软件**(Electron、Tauri、WinUI/WPF/WinForms 中的 WebView2、PWA)。仅基于 Custom Elements + CSS + Web Animations:可摇树、SSR 安全、全面遵循 `prefers-reduced-motion`。**[在线组件库](https://harrisoncn.github.io/use-scroll-animate/showcase/components.html)** · [组件文档](./docs/components.md)(英文)· [Windows 应用指南](./docs/windows-apps.md)(英文)
31
+
32
+ ```js
33
+ import { defineComponents } from 'use-scroll-animate/components';
34
+ defineComponents(); // 或按分类:import { defineTextComponents } from 'use-scroll-animate/components/text'
35
+ ```
36
+
37
+ ```html
38
+ <!-- 或免构建直接使用 -->
39
+ <script src="https://unpkg.com/use-scroll-animate@2/dist/components.umd.js"></script>
40
+ <usa-typewriter words="你好,Windows。|你好,Web。"></usa-typewriter>
41
+ <usa-spinner variant="fluent"></usa-spinner>
42
+ ```
43
+
44
+ | 分类(导入路径) | 组件 |
45
+ |---|---|
46
+ | **入场与滚动**(`/components/reveal`) | `<usa-reveal>` 滚动揭示(12 种效果)· `<usa-stagger>` 错峰列表 · `<usa-scroll-progress>` 阅读进度条 · `<usa-scrolly>` 粘性滚动叙事 |
47
+ | **文字**(`/components/text`) | `<usa-typewriter>` 打字机 · `<usa-split-text>` 逐字揭示 · `<usa-scramble>` 乱码解码 · `<usa-counter>` 数字滚动 · `<usa-shimmer-text>` 流光文字 · `<usa-text-rotate>` 轮换词语 |
48
+ | **交互反馈**(`/components/interaction`) | `<usa-ripple>` 水波纹 · `<usa-magnetic>` 磁吸按钮 · `<usa-tilt>` 3D 倾斜卡片 · `<usa-spotlight>` Fluent 光照高亮 · `<usa-press>` 按压反馈 · `<usa-toggle>` 切换开关 |
49
+ | **加载与反馈**(`/components/feedback`) | `<usa-spinner>`(WinUI 进度环、Windows 圆点等 6 种)· `<usa-skeleton>` 骨架屏 · `<usa-progress>` 进度条 · `<usa-toaster>` + `toast()` 通知 · `<usa-check>` 结果图标 |
50
+ | **背景与装饰**(`/components/background`) | `<usa-aurora>` 极光 · `<usa-particles>` 粒子 · `<usa-grain>` 胶片颗粒 · `<usa-marquee>` 无限跑马灯 · `<usa-acrylic>` 亚克力 / 云母材质 |
51
+ | **过渡动画**(`/components/transitions`) | `<usa-dialog>` 弹窗 / 抽屉 / 底部面板 · `<usa-accordion>` 手风琴 · `<usa-flip-list>` FLIP 列表 · `<usa-view-switch>` 视图切换 · `viewTransition()` · `flip()` · `connectedAnimation()` |
52
+ | **弹簧与物理**(`/components/physics`) | `<usa-spring>` 弹入 / 弹出 / 掉落 / 果冻 / 橡皮筋 · `<usa-draggable>` 拖拽回弹、惯性、吸附 · `<usa-overscroll>` 弹性越界 · `spring()` · `createSpring()` · 预设 gentle / wobbly / stiff / bouncy |
53
+
54
+ 完整包约 22 kB gzip(JS + CSS);单个分类 3.5–6.4 kB;单个组件约 2 kB。下方的滚动动画核心不受影响。
55
+
56
+ **在 Windows 软件中使用**:组件只是标准 Web 代码,Electron / Tauri 渲染进程中直接 `import` 即可;WinUI 3 / WPF / WinForms 用 WebView2 加载本地页面(`SetVirtualHostNameToFolderMapping`)并通过 `<script src="components.umd.js">` 引入。样式以 constructable stylesheet 注入,兼容严格 CSP;也可改为引入 `use-scroll-animate/components.css` 并调用 `configureComponents({ injectStyles: false })`。系统“动画效果”关闭时(`prefers-reduced-motion`)自动使用平静版本。
57
+
28
58
  ## 文档
29
59
 
30
60
  - [API 参考](./docs/API.md)(英文)· [演示页](./demo/index.html)(每个预设都可点击,无需构建)
@@ -0,0 +1,233 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.
5
+ *
6
+ * Everything here is lazy: nothing touches `window`, `document`,
7
+ * `HTMLElement` or `matchMedia` at import time, so the components can be
8
+ * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload
9
+ * scripts. Classes are created the first time a `define*()` function runs.
10
+ */
11
+ const config = { injectStyles: true, reducedMotion: 'user' };
12
+ /** Change global component settings (call before `define*()` for `injectStyles`). */
13
+ function configureComponents(options) {
14
+ Object.assign(config, options);
15
+ }
16
+ const canDefine = () => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';
17
+ /** `true` when animations should be reduced (OS setting or `configureComponents`). */
18
+ function prefersReducedMotion() {
19
+ if (config.reducedMotion !== 'user')
20
+ return config.reducedMotion === 'reduce';
21
+ return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;
22
+ }
23
+ const injected = new Set();
24
+ /** Add a component's stylesheet to the document once. */
25
+ function adoptStyles(id, css) {
26
+ if (!config.injectStyles || !css || injected.has(id) || typeof document === 'undefined')
27
+ return;
28
+ injected.add(id);
29
+ try {
30
+ if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in document) {
31
+ const sheet = new CSSStyleSheet();
32
+ sheet.replaceSync(css);
33
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
34
+ return;
35
+ }
36
+ }
37
+ catch {
38
+ /* fall through to <style> */
39
+ }
40
+ const style = document.createElement('style');
41
+ style.setAttribute('data-usa', id);
42
+ style.textContent = css;
43
+ (document.head || document.documentElement).appendChild(style);
44
+ }
45
+ /** Attach `css` to a shadow root (constructable sheet where supported, else `<style>`). */
46
+ function shadowStyles(root, css) {
47
+ try {
48
+ if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in root) {
49
+ const sheet = new CSSStyleSheet();
50
+ sheet.replaceSync(css);
51
+ root.adoptedStyleSheets = [sheet];
52
+ return;
53
+ }
54
+ }
55
+ catch {
56
+ /* fall through */
57
+ }
58
+ const style = document.createElement('style');
59
+ style.textContent = css;
60
+ root.prepend(style);
61
+ }
62
+ let baseClass = null;
63
+ /** The lazily created base class (needs `HTMLElement`). */
64
+ function getBase() {
65
+ if (baseClass)
66
+ return baseClass;
67
+ class Base extends HTMLElement {
68
+ constructor() {
69
+ super(...arguments);
70
+ this._cleanups = [];
71
+ this._connected = false;
72
+ }
73
+ get reduced() {
74
+ return prefersReducedMotion();
75
+ }
76
+ connectedCallback() {
77
+ if (this._connected)
78
+ return;
79
+ this._connected = true;
80
+ // Upgraded while the parser is still inside us (a <script> in <head>
81
+ // defined the element): children/text are not there yet, so wait.
82
+ if (typeof document !== 'undefined' && document.readyState === 'loading' && !this.nextSibling && !this.childNodes.length) {
83
+ const go = () => {
84
+ if (this._connected && this.isConnected)
85
+ this.mount();
86
+ };
87
+ document.addEventListener('DOMContentLoaded', go, { once: true });
88
+ this._cleanups.push(() => document.removeEventListener('DOMContentLoaded', go));
89
+ return;
90
+ }
91
+ this.mount();
92
+ }
93
+ disconnectedCallback() {
94
+ this._connected = false;
95
+ this.teardown();
96
+ }
97
+ attributeChangedCallback(_name, oldValue, value) {
98
+ if (!this._connected || oldValue === value)
99
+ return;
100
+ this.changed(_name);
101
+ }
102
+ /** Re-mount on attribute change (override for finer updates). */
103
+ changed(_name) {
104
+ this.teardown();
105
+ this.mount();
106
+ }
107
+ teardown() {
108
+ this._cleanups.splice(0).reverse().forEach((fn) => fn());
109
+ this.unmount();
110
+ }
111
+ mount() { }
112
+ unmount() { }
113
+ str(name, fallback = '') {
114
+ const v = this.getAttribute(name);
115
+ return v === null ? fallback : v;
116
+ }
117
+ num(name, fallback) {
118
+ const v = this.getAttribute(name);
119
+ const n = v === null || v.trim() === '' ? NaN : Number(v);
120
+ return Number.isFinite(n) ? n : fallback;
121
+ }
122
+ /** Boolean attribute: present and not `"false"`. */
123
+ flag(name) {
124
+ const v = this.getAttribute(name);
125
+ return v !== null && v !== 'false';
126
+ }
127
+ setFlag(name, on) {
128
+ if (on)
129
+ this.setAttribute(name, '');
130
+ else
131
+ this.removeAttribute(name);
132
+ }
133
+ onCleanup(fn) {
134
+ this._cleanups.push(fn);
135
+ }
136
+ listen(target, type, fn, options) {
137
+ target.addEventListener(type, fn, options);
138
+ this.onCleanup(() => target.removeEventListener(type, fn, options));
139
+ }
140
+ /** Calls `cb(true/false)` as the element enters / leaves the viewport. */
141
+ inView(cb, init, target = this) {
142
+ if (typeof IntersectionObserver === 'undefined') {
143
+ cb(true);
144
+ return;
145
+ }
146
+ const io = new IntersectionObserver((entries) => {
147
+ for (const e of entries)
148
+ cb(e.isIntersecting, e);
149
+ }, init);
150
+ io.observe(target);
151
+ this.onCleanup(() => io.disconnect());
152
+ }
153
+ /** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */
154
+ motion(el, keyframes, options) {
155
+ if (typeof el.animate !== 'function') {
156
+ applyFrame(el, keyframes[keyframes.length - 1]);
157
+ return null;
158
+ }
159
+ return el.animate(keyframes, options);
160
+ }
161
+ emit(type, detail) {
162
+ return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));
163
+ }
164
+ }
165
+ baseClass = Base;
166
+ return baseClass;
167
+ }
168
+ /** Write a keyframe's properties as inline styles (no-WAAPI fallback). */
169
+ function applyFrame(el, frame) {
170
+ if (!frame)
171
+ return;
172
+ for (const [k, v] of Object.entries(frame)) {
173
+ if (k === 'offset' || k === 'easing' || k === 'composite' || v == null)
174
+ continue;
175
+ el.style[k] = String(v);
176
+ }
177
+ }
178
+ /**
179
+ * Register `tag` with the class built by `make(Base)`. Returns the
180
+ * constructor, the already registered one, or `undefined` without DOM.
181
+ */
182
+ function defineElement(tag, make, css) {
183
+ if (!canDefine())
184
+ return undefined;
185
+ adoptStyles('base', BASE_CSS);
186
+ if (css)
187
+ adoptStyles(css.id, css.text);
188
+ const existing = customElements.get(tag);
189
+ if (existing)
190
+ return existing;
191
+ const ctor = make(getBase());
192
+ customElements.define(tag, ctor);
193
+ return ctor;
194
+ }
195
+ const 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}';
196
+ /** A visually hidden copy of `text` for screen readers (the animated copy is `aria-hidden`). */
197
+ function srText(text) {
198
+ const s = document.createElement('span');
199
+ s.className = 'usa-sr';
200
+ s.textContent = text;
201
+ return s;
202
+ }
203
+ /** requestAnimationFrame with a timeout fallback (jsdom / hidden documents). */
204
+ const raf = (cb) => typeof requestAnimationFrame === 'function' ? requestAnimationFrame(cb) : setTimeout(() => cb(Date.now()), 16);
205
+ /** Monotonic time in ms (rAF callback timestamps differ between environments, so loops use this). */
206
+ const now = () => (typeof performance !== 'undefined' ? performance.now() : Date.now());
207
+ const caf = (id) => {
208
+ if (typeof cancelAnimationFrame === 'function')
209
+ cancelAnimationFrame(id);
210
+ else
211
+ clearTimeout(id);
212
+ };
213
+ /** Spring-ish easing used across the components. */
214
+ const EASE_OUT = 'cubic-bezier(0.22, 1, 0.36, 1)';
215
+ const EASE_SPRING = 'cubic-bezier(0.34, 1.56, 0.64, 1)';
216
+ /** Windows Fluent "decelerate" / "point-to-point" curves. */
217
+ const FLUENT_DECELERATE = 'cubic-bezier(0.1, 0.9, 0.2, 1)';
218
+ const clamp = (v, min, max) => Math.min(max, Math.max(min, v));
219
+
220
+ exports.EASE_OUT = EASE_OUT;
221
+ exports.EASE_SPRING = EASE_SPRING;
222
+ exports.FLUENT_DECELERATE = FLUENT_DECELERATE;
223
+ exports.applyFrame = applyFrame;
224
+ exports.caf = caf;
225
+ exports.clamp = clamp;
226
+ exports.configureComponents = configureComponents;
227
+ exports.defineElement = defineElement;
228
+ exports.now = now;
229
+ exports.prefersReducedMotion = prefersReducedMotion;
230
+ exports.raf = raf;
231
+ exports.shadowStyles = shadowStyles;
232
+ exports.srText = srText;
233
+ //# sourceMappingURL=base-CJ7XfidP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-CJ7XfidP.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);\n * `'no-preference'` ignores the OS setting (only for demos — respect your users).\n */\n reducedMotion?: 'user' | 'reduce' | 'no-preference';\n}\n\nconst config: Required<ComponentsConfig> = { injectStyles: true, reducedMotion: 'user' };\n\n/** Change global component settings (call before `define*()` for `injectStyles`). */\nexport function configureComponents(options: ComponentsConfig): void {\n Object.assign(config, options);\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.reducedMotion !== 'user') return config.reducedMotion === 'reduce';\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 // 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 if (typeof (el as HTMLElement).animate !== 'function') {\n applyFrame(el as HTMLElement, keyframes[keyframes.length - 1]);\n return null;\n }\n return (el as HTMLElement).animate(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/** 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/** requestAnimationFrame with a timeout fallback (jsdom / hidden documents). */\nexport const raf = (cb: FrameRequestCallback): number =>\n typeof requestAnimationFrame === 'function' ? requestAnimationFrame(cb) : (setTimeout(() => cb(Date.now()), 16) as unknown as number);\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 if (typeof cancelAnimationFrame === 'function') cancelAnimationFrame(id);\n else clearTimeout(id);\n};\n\n/** Spring-ish easing used across the components. */\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\nexport const clamp = (v: number, min: number, max: number): number => Math.min(max, Math.max(min, v));\n"],"names":[],"mappings":";;AAAA;;;;;;;AAOG;AAkBH,MAAM,MAAM,GAA+B,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE;AAExF;AACM,SAAU,mBAAmB,CAAC,OAAyB,EAAA;AAC3D,IAAA,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;AAChC;AAEO,MAAM,SAAS,GAAG,MAAe,OAAO,cAAc,KAAK,WAAW,IAAI,OAAO,WAAW,KAAK,WAAW;AAEnH;SACgB,oBAAoB,GAAA;AAClC,IAAA,IAAI,MAAM,CAAC,aAAa,KAAK,MAAM;AAAE,QAAA,OAAO,MAAM,CAAC,aAAa,KAAK,QAAQ;AAC7E,IAAA,OAAO,OAAO,UAAU,KAAK,UAAU,IAAI,CAAC,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO;AACrG;AAEA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU;AAElC;AACM,SAAU,WAAW,CAAC,EAAU,EAAE,GAAW,EAAA;AACjD,IAAA,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE;AACzF,IAAA,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;AAChB,IAAA,IAAI;QACF,IAAI,OAAO,aAAa,KAAK,UAAU,IAAI,oBAAoB,IAAI,QAAQ,EAAE;AAC3E,YAAA,MAAM,KAAK,GAAG,IAAI,aAAa,EAAE;AACjC,YAAA,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;YACtB,QAAQ,CAAC,kBAAkB,GAAG,CAAC,G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