use-scroll-animate 4.9.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.
- package/CHANGELOG.md +19 -0
- package/README.md +2 -1
- package/README_ja.md +1 -0
- package/README_zh.md +2 -1
- package/dist/chunks/{base-BvpQ4Ggj.cjs → base-B5i8qQPR.cjs} +46 -40
- package/dist/chunks/base-B5i8qQPR.cjs.map +1 -0
- package/dist/chunks/{base-DbbRUxaa.js → base-C3Sw9sAO.js} +46 -41
- package/dist/chunks/base-C3Sw9sAO.js.map +1 -0
- package/dist/chunks/{core-BWO7JKJ5.cjs → core-BDcszY4L.cjs} +2 -2
- package/dist/chunks/{core-BWO7JKJ5.cjs.map → core-BDcszY4L.cjs.map} +1 -1
- package/dist/chunks/{core-CcaSsbV8.js → core-BTf__I-8.js} +2 -2
- package/dist/chunks/{core-CcaSsbV8.js.map → core-BTf__I-8.js.map} +1 -1
- package/dist/chunks/{core-CCAM3nKw.cjs → core-BjOYKSrV.cjs} +2 -2
- package/dist/chunks/{core-CCAM3nKw.cjs.map → core-BjOYKSrV.cjs.map} +1 -1
- package/dist/chunks/{core-BVTuet9o.js → core-DN3hHbHh.js} +2 -2
- package/dist/chunks/{core-BVTuet9o.js.map → core-DN3hHbHh.js.map} +1 -1
- package/dist/chunks/fx-B8hk1Fby.cjs +114 -0
- package/dist/chunks/fx-B8hk1Fby.cjs.map +1 -0
- package/dist/chunks/fx-ChjxrMBo.js +109 -0
- package/dist/chunks/fx-ChjxrMBo.js.map +1 -0
- package/dist/chunks/{index-tags-Dh8nwXqw.js → index-tags-DucKMQr_.js} +2 -1
- package/dist/chunks/{index-tags-Dh8nwXqw.js.map → index-tags-DucKMQr_.js.map} +1 -1
- package/dist/chunks/{index-tags-CIRY2KnU.cjs → index-tags-wv0R_vkO.cjs} +2 -1
- package/dist/chunks/{index-tags-CIRY2KnU.cjs.map → index-tags-wv0R_vkO.cjs.map} +1 -1
- package/dist/chunks/{spring-fFkqE9J0.cjs → spring--oZh55tB.cjs} +2 -2
- package/dist/chunks/{spring-fFkqE9J0.cjs.map → spring--oZh55tB.cjs.map} +1 -1
- package/dist/chunks/{spring-B6w7mVCU.js → spring-CckMe3x0.js} +2 -2
- package/dist/chunks/{spring-B6w7mVCU.js.map → spring-CckMe3x0.js.map} +1 -1
- package/dist/chunks/{variants-Cal4DB0E.js → variants-Bsevy6Xm.js} +2 -2
- package/dist/chunks/{variants-Cal4DB0E.js.map → variants-Bsevy6Xm.js.map} +1 -1
- package/dist/chunks/{variants-C8xj8gfd.cjs → variants-DxPmgrNX.cjs} +2 -2
- package/dist/chunks/{variants-C8xj8gfd.cjs.map → variants-DxPmgrNX.cjs.map} +1 -1
- package/dist/components/a11y.cjs +3 -2
- package/dist/components/a11y.cjs.map +1 -1
- package/dist/components/a11y.d.cts +1 -0
- package/dist/components/a11y.d.ts +1 -0
- package/dist/components/a11y.js +4 -3
- package/dist/components/a11y.js.map +1 -1
- package/dist/components/angular.cjs +8 -6
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +33 -4
- package/dist/components/angular.d.ts +33 -4
- package/dist/components/angular.js +8 -6
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs +2 -4
- package/dist/components/background.cjs.map +1 -1
- package/dist/components/background.d.cts +2 -47
- package/dist/components/background.d.ts +2 -47
- package/dist/components/background.js +3 -4
- package/dist/components/background.js.map +1 -1
- package/dist/components/bridge.cjs +1 -1
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.cjs +2 -4
- package/dist/components/cards.cjs.map +1 -1
- package/dist/components/cards.d.cts +2 -47
- package/dist/components/cards.d.ts +2 -47
- package/dist/components/cards.js +2 -3
- package/dist/components/cards.js.map +1 -1
- package/dist/components/click.cjs +24 -130
- package/dist/components/click.cjs.map +1 -1
- package/dist/components/click.d.cts +2 -47
- package/dist/components/click.d.ts +2 -47
- package/dist/components/click.js +4 -109
- package/dist/components/click.js.map +1 -1
- package/dist/components/depth.cjs +3 -5
- package/dist/components/depth.cjs.map +1 -1
- package/dist/components/depth.d.cts +2 -47
- package/dist/components/depth.d.ts +2 -47
- package/dist/components/depth.js +3 -4
- package/dist/components/depth.js.map +1 -1
- package/dist/components/feedback.cjs +1 -3
- package/dist/components/feedback.cjs.map +1 -1
- package/dist/components/feedback.d.cts +2 -47
- package/dist/components/feedback.d.ts +2 -47
- package/dist/components/feedback.js +1 -2
- package/dist/components/feedback.js.map +1 -1
- package/dist/components/fx.cjs +285 -0
- package/dist/components/fx.cjs.map +1 -0
- package/dist/components/fx.css +3 -0
- package/dist/components/fx.d.cts +114 -0
- package/dist/components/fx.d.ts +114 -0
- package/dist/components/fx.js +271 -0
- package/dist/components/fx.js.map +1 -0
- package/dist/components/gesture.cjs +3 -5
- package/dist/components/gesture.cjs.map +1 -1
- package/dist/components/gesture.d.cts +2 -47
- package/dist/components/gesture.d.ts +2 -47
- package/dist/components/gesture.js +4 -5
- package/dist/components/gesture.js.map +1 -1
- package/dist/components/interaction.cjs +1 -3
- package/dist/components/interaction.cjs.map +1 -1
- package/dist/components/interaction.d.cts +2 -47
- package/dist/components/interaction.d.ts +2 -47
- package/dist/components/interaction.js +1 -2
- package/dist/components/interaction.js.map +1 -1
- package/dist/components/jsx.d.cts +1 -0
- package/dist/components/jsx.d.ts +1 -0
- package/dist/components/layout.cjs +1 -3
- package/dist/components/layout.cjs.map +1 -1
- package/dist/components/layout.d.cts +2 -47
- package/dist/components/layout.d.ts +2 -47
- package/dist/components/layout.js +2 -3
- package/dist/components/layout.js.map +1 -1
- package/dist/components/lazy.cjs +2 -1
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.d.cts +1 -0
- package/dist/components/lazy.d.ts +1 -0
- package/dist/components/lazy.js +2 -1
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/lite.cjs +362 -64
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +345 -65
- package/dist/components/lite.js.map +1 -1
- package/dist/components/packs.cjs +1 -3
- package/dist/components/packs.cjs.map +1 -1
- package/dist/components/packs.d.cts +2 -47
- package/dist/components/packs.d.ts +2 -47
- package/dist/components/packs.js +2 -3
- package/dist/components/packs.js.map +1 -1
- package/dist/components/page.cjs +33 -22
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.d.cts +15 -52
- package/dist/components/page.d.ts +15 -52
- package/dist/components/page.js +33 -22
- package/dist/components/page.js.map +1 -1
- package/dist/components/perf.cjs +3 -4
- package/dist/components/perf.cjs.map +1 -1
- package/dist/components/perf.d.cts +1 -0
- package/dist/components/perf.d.ts +1 -0
- package/dist/components/perf.js +4 -5
- package/dist/components/perf.js.map +1 -1
- package/dist/components/physics.cjs +2 -4
- package/dist/components/physics.cjs.map +1 -1
- package/dist/components/physics.d.cts +2 -47
- package/dist/components/physics.d.ts +2 -47
- package/dist/components/physics.js +3 -4
- package/dist/components/physics.js.map +1 -1
- package/dist/components/react.cjs +1 -1
- package/dist/components/react.js +1 -1
- package/dist/components/reveal.cjs +1 -3
- package/dist/components/reveal.cjs.map +1 -1
- package/dist/components/reveal.d.cts +2 -47
- package/dist/components/reveal.d.ts +2 -47
- package/dist/components/reveal.js +1 -2
- package/dist/components/reveal.js.map +1 -1
- package/dist/components/solid.cjs +8 -6
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +33 -4
- package/dist/components/solid.d.ts +33 -4
- package/dist/components/solid.js +8 -6
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +8 -6
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +33 -4
- package/dist/components/svelte.d.ts +33 -4
- package/dist/components/svelte.js +8 -6
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs +1 -3
- package/dist/components/svg.cjs.map +1 -1
- package/dist/components/svg.d.cts +2 -47
- package/dist/components/svg.d.ts +2 -47
- package/dist/components/svg.js +2 -3
- package/dist/components/svg.js.map +1 -1
- package/dist/components/text.cjs +2 -4
- package/dist/components/text.cjs.map +1 -1
- package/dist/components/text.d.cts +2 -47
- package/dist/components/text.d.ts +2 -47
- package/dist/components/text.js +2 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/timeline.cjs +3 -7
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.d.cts +4 -49
- package/dist/components/timeline.d.ts +4 -49
- package/dist/components/timeline.js +4 -7
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/transitions.cjs +1 -3
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.d.cts +2 -47
- package/dist/components/transitions.d.ts +2 -47
- package/dist/components/transitions.js +2 -3
- package/dist/components/transitions.js.map +1 -1
- package/dist/components/ui.cjs +3 -5
- package/dist/components/ui.cjs.map +1 -1
- package/dist/components/ui.d.cts +2 -47
- package/dist/components/ui.d.ts +2 -47
- package/dist/components/ui.js +4 -5
- package/dist/components/ui.js.map +1 -1
- package/dist/components/vue.cjs +8 -6
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +33 -4
- package/dist/components/vue.d.ts +33 -4
- package/dist/components/vue.js +8 -6
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +3 -5
- package/dist/components/webgl.cjs.map +1 -1
- package/dist/components/webgl.d.cts +2 -47
- package/dist/components/webgl.d.ts +2 -47
- package/dist/components/webgl.js +3 -4
- package/dist/components/webgl.js.map +1 -1
- package/dist/components.cjs +31 -10
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +1 -0
- package/dist/components.d.cts +137 -17
- package/dist/components.d.ts +137 -17
- package/dist/components.js +15 -11
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/docs/API.md +1 -1
- package/docs/ROADMAP.md +12 -12
- package/docs/components.md +14 -1
- package/docs/performance.md +1 -1
- package/docs/upgrading-5.md +2 -2
- package/package.json +14 -3
- package/dist/chunks/base-BvpQ4Ggj.cjs.map +0 -1
- package/dist/chunks/base-DbbRUxaa.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ 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
|
+
|
|
10
29
|
## [4.9.0] - 2026-10-08
|
|
11
30
|
|
|
12
31
|
### Deprecated (removed in 5.0 — each warns once in the console)
|
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@
|
|
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@
|
|
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
|
|
|
@@ -9,17 +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 = {
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
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';
|
|
23
22
|
Object.assign(config, options);
|
|
24
23
|
if (options.motionIntensity && typeof document !== 'undefined') {
|
|
25
24
|
document.documentElement.style.setProperty('--usa-motion', String(MOTION_SCALE[options.motionIntensity] ?? 1));
|
|
@@ -64,15 +63,12 @@ function adaptKeyframes(frames, level = config.motionSensitivity) {
|
|
|
64
63
|
return out;
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
|
-
let quiet = 0;
|
|
68
66
|
/** Run `fn` without 4.9 deprecation warnings (library-internal calls). */
|
|
69
67
|
function withoutDeprecations(fn) {
|
|
70
|
-
quiet++;
|
|
71
68
|
try {
|
|
72
69
|
return fn();
|
|
73
70
|
}
|
|
74
71
|
finally {
|
|
75
|
-
quiet--;
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
74
|
/** The current global motion intensity. */
|
|
@@ -86,10 +82,10 @@ function motionScale() {
|
|
|
86
82
|
const canDefine = () => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';
|
|
87
83
|
/** `true` when animations should be reduced (OS setting or `configureComponents`). */
|
|
88
84
|
function prefersReducedMotion() {
|
|
89
|
-
if (config.
|
|
85
|
+
if (config.motionSensitivity === 'minimal' || config.motionSensitivity === 'static')
|
|
86
|
+
return true;
|
|
87
|
+
if (config.reducedMotion === 'reduce')
|
|
90
88
|
return true;
|
|
91
|
-
if (config.reducedMotion !== 'user')
|
|
92
|
-
return config.reducedMotion === 'reduce';
|
|
93
89
|
return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
94
90
|
}
|
|
95
91
|
const injected = new Set();
|
|
@@ -225,31 +221,7 @@ function getBase() {
|
|
|
225
221
|
}
|
|
226
222
|
/** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */
|
|
227
223
|
motion(el, keyframes, options) {
|
|
228
|
-
|
|
229
|
-
applyFrame(el, keyframes[keyframes.length - 1]);
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
keyframes = adaptKeyframes(keyframes);
|
|
233
|
-
if (active >= maxActive) {
|
|
234
|
-
applyFrame(el, keyframes[keyframes.length - 1]);
|
|
235
|
-
return null;
|
|
236
|
-
}
|
|
237
|
-
const k = motionScale();
|
|
238
|
-
if (k !== 1 && k > 0 && typeof options.duration === 'number')
|
|
239
|
-
options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };
|
|
240
|
-
const a = el.animate(keyframes, options);
|
|
241
|
-
if (options.iterations !== Infinity) {
|
|
242
|
-
active++;
|
|
243
|
-
let done = false;
|
|
244
|
-
const end = () => {
|
|
245
|
-
if (!done) {
|
|
246
|
-
done = true;
|
|
247
|
-
active--;
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
a?.finished?.then(end, end);
|
|
251
|
-
}
|
|
252
|
-
return a;
|
|
224
|
+
return animateWithMotion(el, keyframes, options);
|
|
253
225
|
}
|
|
254
226
|
emit(type, detail) {
|
|
255
227
|
return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));
|
|
@@ -258,6 +230,39 @@ function getBase() {
|
|
|
258
230
|
baseClass = Base;
|
|
259
231
|
return baseClass;
|
|
260
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
|
+
}
|
|
261
266
|
/** Write a keyframe's properties as inline styles (no-WAAPI fallback). */
|
|
262
267
|
function applyFrame(el, frame) {
|
|
263
268
|
if (!frame)
|
|
@@ -405,6 +410,7 @@ exports.MOTION_SENSITIVITY_LEVELS = MOTION_SENSITIVITY_LEVELS;
|
|
|
405
410
|
exports.activeAnimations = activeAnimations;
|
|
406
411
|
exports.adaptKeyframes = adaptKeyframes;
|
|
407
412
|
exports.adoptStyles = adoptStyles;
|
|
413
|
+
exports.animateWithMotion = animateWithMotion;
|
|
408
414
|
exports.animationBudget = animationBudget;
|
|
409
415
|
exports.applyFrame = applyFrame;
|
|
410
416
|
exports.caf = caf;
|
|
@@ -427,4 +433,4 @@ exports.setStyleLoader = setStyleLoader;
|
|
|
427
433
|
exports.shadowStyles = shadowStyles;
|
|
428
434
|
exports.srText = srText;
|
|
429
435
|
exports.withoutDeprecations = withoutDeprecations;
|
|
430
|
-
//# sourceMappingURL=base-
|
|
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(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U;AAChC;AACM,SAAU,SAAS,CAAC,GAAW,EAAE,OAAe,EAAA;AACpD,IAAA,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE;AACrB,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,17 +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 = {
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
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';
|
|
21
20
|
Object.assign(config, options);
|
|
22
21
|
if (options.motionIntensity && typeof document !== 'undefined') {
|
|
23
22
|
document.documentElement.style.setProperty('--usa-motion', String(MOTION_SCALE[options.motionIntensity] ?? 1));
|
|
@@ -62,15 +61,12 @@ function adaptKeyframes(frames, level = config.motionSensitivity) {
|
|
|
62
61
|
return out;
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
|
-
let quiet = 0;
|
|
66
64
|
/** Run `fn` without 4.9 deprecation warnings (library-internal calls). */
|
|
67
65
|
function withoutDeprecations(fn) {
|
|
68
|
-
quiet++;
|
|
69
66
|
try {
|
|
70
67
|
return fn();
|
|
71
68
|
}
|
|
72
69
|
finally {
|
|
73
|
-
quiet--;
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
72
|
/** The current global motion intensity. */
|
|
@@ -84,10 +80,10 @@ function motionScale() {
|
|
|
84
80
|
const canDefine = () => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';
|
|
85
81
|
/** `true` when animations should be reduced (OS setting or `configureComponents`). */
|
|
86
82
|
function prefersReducedMotion() {
|
|
87
|
-
if (config.
|
|
83
|
+
if (config.motionSensitivity === 'minimal' || config.motionSensitivity === 'static')
|
|
84
|
+
return true;
|
|
85
|
+
if (config.reducedMotion === 'reduce')
|
|
88
86
|
return true;
|
|
89
|
-
if (config.reducedMotion !== 'user')
|
|
90
|
-
return config.reducedMotion === 'reduce';
|
|
91
87
|
return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
92
88
|
}
|
|
93
89
|
const injected = new Set();
|
|
@@ -223,31 +219,7 @@ function getBase() {
|
|
|
223
219
|
}
|
|
224
220
|
/** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */
|
|
225
221
|
motion(el, keyframes, options) {
|
|
226
|
-
|
|
227
|
-
applyFrame(el, keyframes[keyframes.length - 1]);
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
keyframes = adaptKeyframes(keyframes);
|
|
231
|
-
if (active >= maxActive) {
|
|
232
|
-
applyFrame(el, keyframes[keyframes.length - 1]);
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
const k = motionScale();
|
|
236
|
-
if (k !== 1 && k > 0 && typeof options.duration === 'number')
|
|
237
|
-
options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };
|
|
238
|
-
const a = el.animate(keyframes, options);
|
|
239
|
-
if (options.iterations !== Infinity) {
|
|
240
|
-
active++;
|
|
241
|
-
let done = false;
|
|
242
|
-
const end = () => {
|
|
243
|
-
if (!done) {
|
|
244
|
-
done = true;
|
|
245
|
-
active--;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
a?.finished?.then(end, end);
|
|
249
|
-
}
|
|
250
|
-
return a;
|
|
222
|
+
return animateWithMotion(el, keyframes, options);
|
|
251
223
|
}
|
|
252
224
|
emit(type, detail) {
|
|
253
225
|
return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));
|
|
@@ -256,6 +228,39 @@ function getBase() {
|
|
|
256
228
|
baseClass = Base;
|
|
257
229
|
return baseClass;
|
|
258
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
|
+
}
|
|
259
264
|
/** Write a keyframe's properties as inline styles (no-WAAPI fallback). */
|
|
260
265
|
function applyFrame(el, frame) {
|
|
261
266
|
if (!frame)
|
|
@@ -395,5 +400,5 @@ function kindOf(el, valid, fallback) {
|
|
|
395
400
|
}
|
|
396
401
|
const clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
397
402
|
|
|
398
|
-
export {
|
|
399
|
-
//# sourceMappingURL=base-
|
|
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,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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;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var base = require('./base-
|
|
3
|
+
var base = require('./base-B5i8qQPR.cjs');
|
|
4
4
|
var components_tokens = require('../components/tokens.cjs');
|
|
5
5
|
|
|
6
6
|
/** 4.1: whether `scrub()` can use native ScrollTimeline / ViewTimeline here. */
|
|
@@ -262,4 +262,4 @@ exports.TIMELINE_PRESETS = TIMELINE_PRESETS;
|
|
|
262
262
|
exports.resolvePosition = resolvePosition;
|
|
263
263
|
exports.supportsNativeScrub = supportsNativeScrub;
|
|
264
264
|
exports.timeline = timeline;
|
|
265
|
-
//# sourceMappingURL=core-
|
|
265
|
+
//# sourceMappingURL=core-BDcszY4L.cjs.map
|