use-scroll-animate 5.8.0 → 6.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 +31 -0
- package/README.md +3 -2
- package/README_ja.md +1 -0
- package/README_zh.md +2 -1
- package/bin/usa-codemod-6.mjs +146 -0
- package/dist/components/angular.d.cts +5 -3
- package/dist/components/angular.d.ts +5 -3
- package/dist/components/click.cjs +2 -4
- package/dist/components/click.cjs.map +1 -1
- package/dist/components/click.d.cts +3 -8
- package/dist/components/click.d.ts +3 -8
- package/dist/components/click.js +3 -2
- package/dist/components/click.js.map +1 -1
- package/dist/components/effects.cjs +306 -1
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.d.cts +66 -2
- package/dist/components/effects.d.ts +66 -2
- package/dist/components/effects.js +303 -2
- package/dist/components/effects.js.map +1 -1
- package/dist/components/fx.cjs +2 -2
- package/dist/components/fx.cjs.map +1 -1
- package/dist/components/fx.js +2 -2
- package/dist/components/fx.js.map +1 -1
- package/dist/components/lite.cjs +9 -10
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +10 -8
- package/dist/components/lite.js.map +1 -1
- package/dist/components/page.cjs +6 -5
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.css +1 -1
- package/dist/components/page.d.cts +4 -3
- package/dist/components/page.d.ts +4 -3
- package/dist/components/page.js +6 -5
- package/dist/components/page.js.map +1 -1
- package/dist/components/solid.d.cts +5 -3
- package/dist/components/solid.d.ts +5 -3
- package/dist/components/svelte.d.cts +5 -3
- package/dist/components/svelte.d.ts +5 -3
- package/dist/components/vue.d.cts +5 -3
- package/dist/components/vue.d.ts +5 -3
- package/dist/components.cjs +2 -5
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.d.cts +7 -11
- package/dist/components.d.ts +7 -11
- package/dist/components.js +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/docs/ROADMAP.md +12 -12
- package/docs/components.md +29 -3
- package/docs/deprecations.md +4 -0
- package/docs/performance.md +1 -1
- package/docs/upgrading-6.md +32 -0
- package/package.json +3 -2
package/docs/ROADMAP.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# 路线图(
|
|
1
|
+
# 路线图(6.0 之后)
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 6.0.0:移除 5.9 弃用的 API(`burst()` / `confetti()` / `shake()`、`<usa-cursor mode="trail">`),所有效果统一通过注册表(`registerEffect()` / `playEffect()` / `<usa-fx>`)提供。以下为 6.x → 7.0 的规划,每个版本一个 PR;新效果继续集中在 `use-scroll-animate/components/effects`(`components/lite` 维持 70 KB 预算),全部兼容“减少动态效果”。
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
5
|
+
- **v6.1** — 粒子与流体 2.0:GPU 流体模拟背景、烟雾与火焰、墨滴扩散、萤火虫群、樱花与落叶飘散、点击溅起水花 —— WebGL2 实现,自动降级到 Canvas 2D。
|
|
6
|
+
- **v6.2** — 文字特效 3.0:液态文字、霓虹描边书写、文字粒子化聚散、故障(glitch)字、打字机光标拖影、可变字体呼吸、逐字 3D 翻转。
|
|
7
|
+
- **v6.3** — 光影与材质:动态光源投影、玻璃折射、金属拉丝反光、珠光 / 镭射材质、体积光(god rays)、跟随指针的实时阴影。
|
|
8
|
+
- **v6.4** — 3D 场景卡片:视差层叠景深卡、可旋转 3D 商品展示、立方体翻转画廊、折纸展开、轨道相机滚动叙事 —— CSS 3D 为主,可选 WebGL。
|
|
9
|
+
- **v6.5** — 形变与 SVG 2.0:路径自动补间形变、液态 blob 按钮、描边绘制动画、SVG 滤镜(湍流、置换)扭曲转场、图标一键变形。
|
|
10
|
+
- **v6.6** — 转场大全:涟漪溶解、碎片爆裂、马赛克翻牌、液体擦除、卷页、镜头推拉 —— View Transitions 优先,多页(MPA)同样可用。
|
|
11
|
+
- **v6.7** — 天气与氛围:雨滴打在玻璃上、雪花堆积、雷电闪光(限频的安全闪烁)、雾气、极光、随时间变化的昼夜光照。
|
|
12
|
+
- **v6.8** — 交互物理 2.0:可拖拽的软体与布料、绳索与链条、磁力吸附排列、碰撞弹球、重力翻转页面 —— 轻量 Verlet 求解器。
|
|
13
|
+
- **v6.9** — 7.0 预备:动画编辑器 2.0(曲线编辑、`<usa-player>` 关键帧录制)、效果市场清单格式;标记 7.0 将移除的 API 并输出一次性警告,发布 `upgrading-7.md` 与 `usa-codemod-7`。
|
|
14
|
+
- **v7.0** — 破坏性清理:移除 6.9 弃用的 API,效果包按需拆分入口,WebGPU 渲染后端(WebGL2 回退),迁移指南与自动迁移脚本,npm `latest`。
|
package/docs/components.md
CHANGED
|
@@ -40,7 +40,7 @@ defineTypewriter();
|
|
|
40
40
|
No build step (registers every `<usa-*>` and exposes the API as `window.UsaComponents`):
|
|
41
41
|
|
|
42
42
|
```html
|
|
43
|
-
<script src="https://unpkg.com/use-scroll-animate@
|
|
43
|
+
<script src="https://unpkg.com/use-scroll-animate@6/dist/components.umd.js"></script>
|
|
44
44
|
<usa-typewriter words="Hello, Windows.|Hello, web."></usa-typewriter>
|
|
45
45
|
<script>UsaComponents.toast('Ready', { type: 'success' });</script>
|
|
46
46
|
```
|
|
@@ -151,7 +151,7 @@ Presets (`SPRING_PRESETS`): `default` (170/26), `gentle` (120/14), `wobbly` (180
|
|
|
151
151
|
| `<usa-hold>` | Hold-to-confirm ring | `duration` (1200), `label`, `color`, `haptic` | `progress`, `cancel()`; `usa:progress`, `usa:confirm`, `usa:cancel`; `--usa-hold` |
|
|
152
152
|
| `<usa-double-tap>` | Double tap → heart at the point | `icon` (♥), `color`, `delay` (300), `haptic` | `pop(x?, y?)`; `usa:double-tap` |
|
|
153
153
|
| `<usa-checkbox>` | Animated form-associated checkbox | `checked`, `indeterminate`, `name`, `value`, `label`, `shape` (`circle`) | `checked`, `toggle()`; `change`, `usa:change` |
|
|
154
|
-
| `
|
|
154
|
+
| `haptic()` · `playEffect(el, 'burst' \| 'confetti' \| 'shake', …)` | Haptics; the click effects from code go through the effect registry (6.0 removed `burst()` / `confetti()` / `shake()`) | — | particles skip under reduced motion |
|
|
155
155
|
|
|
156
156
|
### 10. UI components & variants — `components/ui`
|
|
157
157
|
|
|
@@ -180,7 +180,7 @@ Presets (`SPRING_PRESETS`): `default` (170/26), `gentle` (120/14), `wobbly` (180
|
|
|
180
180
|
| `pageTransition(update, opts)` | SPA page transition (View Transitions) | `effect` (`fade` · `slide` · `slide-left` · `slide-right` · `slide-up` · `circle` · `blinds` · `pixel` · `zoom`), `x`, `y`, `duration`, `fallback` | Promise |
|
|
181
181
|
| `enableMpaTransitions(effect)` | Cross-document (MPA) transitions | effect, duration | — |
|
|
182
182
|
| `themeTransition(apply, { x, y })` | Circle-reveal theme switch | — | Promise |
|
|
183
|
-
| `<usa-cursor>` | Custom cursor | `mode` (`dot` · `
|
|
183
|
+
| `<usa-cursor>` | Custom cursor | `mode` (`dot` · `magnetic` · `glow`; 6.0 removed `trail` → `comet-trail` effect), `color`, `size`, `hide-native`, `targets` | `active` |
|
|
184
184
|
| `smoothScroll(opts)` · `scrollToTarget(to, opts)` | Wheel smoothing · spring scroll-to | `target`, `lerp` (0.12), `wheelMultiplier` · `offset`, `preset` | returns stop fn · Promise |
|
|
185
185
|
| `<usa-fullpage>` | Full-screen snapping sections | `dots`, `axis` (`y` · `x`) | `index`, `go(i)`, `next()`, `prev()`; `usa:section` |
|
|
186
186
|
| `<usa-loading-bar>` · `loadingBar` | Top loading bar | `color`, `height` (3), `position` | `start()`, `set(p)`, `done()`, `track(promise)` |
|
|
@@ -473,6 +473,32 @@ playEffect(passwordToggle, 'password-reveal');
|
|
|
473
473
|
```
|
|
474
474
|
Themes: `neon` · `paper` · `glass` · `retro` · `brutalist`. Micro effects keep working (state, labels, counts) under reduced motion.
|
|
475
475
|
|
|
476
|
+
### v5.9 `<usa-player>`
|
|
477
|
+
|
|
478
|
+
Plays JSON animations made of timeline presets, keyframes and registered effects on one clock.
|
|
479
|
+
|
|
480
|
+
```html
|
|
481
|
+
<usa-player trigger="view" controls>
|
|
482
|
+
<h1>Title</h1>
|
|
483
|
+
<a class="cta">Start</a>
|
|
484
|
+
<script type="application/json">
|
|
485
|
+
{ "format": "use-scroll-animate/animation", "version": 1,
|
|
486
|
+
"tracks": [
|
|
487
|
+
{ "target": "h1", "start": 0, "duration": 600, "preset": "fade-up" },
|
|
488
|
+
{ "target": ".cta", "start": 400, "duration": 500, "keyframes": [{ "opacity": 0, "transform": "scale(.8)" }, { "opacity": 1, "transform": "none" }] },
|
|
489
|
+
{ "target": ".cta", "start": 1000, "effect": "jelly" }
|
|
490
|
+
] }
|
|
491
|
+
</script>
|
|
492
|
+
</usa-player>
|
|
493
|
+
```
|
|
494
|
+
```js
|
|
495
|
+
import { createPlayer, registerAllEffects } from 'use-scroll-animate/components/effects';
|
|
496
|
+
registerAllEffects();
|
|
497
|
+
const p = createPlayer(hero, await (await fetch('/hero.json')).json());
|
|
498
|
+
p.play(); p.seek(500); p.rate = 0.5;
|
|
499
|
+
```
|
|
500
|
+
`trigger="scroll"` scrubs the animation with the page. Reduced motion: the final state, no effects. Export JSON from the Playground (`<usa-player> JSON` tab).
|
|
501
|
+
|
|
476
502
|
## Frameworks
|
|
477
503
|
|
|
478
504
|
Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
|
package/docs/deprecations.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Deprecations
|
|
2
2
|
|
|
3
|
+
## Deprecated in 5.9, removed in 6.0
|
|
4
|
+
|
|
5
|
+
See [upgrading-6.md](./upgrading-6.md) — `burst()`, `confetti()`, `shake()` (use `playEffect(el, 'burst' | 'confetti' | 'shake', …)`), `<usa-cursor mode="trail">` (use the `comet-trail` effect). Run `npx usa-codemod-6 --write src`.
|
|
6
|
+
|
|
3
7
|
## Deprecated in 4.9, removed in 5.0
|
|
4
8
|
|
|
5
9
|
See [upgrading-5.md](./upgrading-5.md) — `motionIntensity: 'off'` / `setMotionIntensity('off')`, `reducedMotion: 'no-preference'`, `<usa-timeline scrub="js">`, shared names re-exported from category entries. Run `npx usa-codemod-5 --write src`.
|
package/docs/performance.md
CHANGED
|
@@ -21,4 +21,4 @@ Same API as `use-scroll-animate/components`, but the light-DOM CSS is **not** in
|
|
|
21
21
|
| `use-scroll-animate/components` (everything, CSS inlined) | ≈ 79 KB |
|
|
22
22
|
| `use-scroll-animate/components/lite` (everything, CSS on demand) | **≈ 62 KB** (budget 70 KB, checked in CI) |
|
|
23
23
|
|
|
24
|
-
Serve the CSS from somewhere else with `onDemandStyles('https://cdn.example/use-scroll-animate@
|
|
24
|
+
Serve the CSS from somewhere else with `onDemandStyles('https://cdn.example/use-scroll-animate@6/dist/')`, or preload with `loadCategoryStyles('cards', base)`.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Upgrading to 6.0
|
|
2
|
+
|
|
3
|
+
6.0.0 is released. 5.9 **warned once in the console** for everything below, and a codemod rewrites most of it:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx usa-codemod-6 src # dry run: lists every change (and what needs a manual edit)
|
|
7
|
+
npx usa-codemod-6 --write src # apply
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Removed in 6.0 (deprecated in 5.9)
|
|
11
|
+
|
|
12
|
+
6.0 finishes the move to the 5.0 effect registry: every effect is registered once and played the same way (`playEffect()`, `bindEffect()`, `<usa-fx>`). The ad-hoc helpers that bypassed it go away.
|
|
13
|
+
|
|
14
|
+
| 5.x | 6.0 | Codemod |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `burst(x, y, options)` from `use-scroll-animate/components` / `/components/click` | `playEffect(document.body, 'burst', { x, y, ...options })` from `use-scroll-animate/components/fx` | ✅ |
|
|
17
|
+
| `confetti(options)` | `playEffect(document.body, 'confetti', options)` (`x` / `y` in the options, or play it on the element to fire from its centre) | ✅ |
|
|
18
|
+
| `shake(el, intensity, duration)` | `playEffect(el, 'shake', { intensity, duration })` | ✅ |
|
|
19
|
+
| `UsaComponents.burst / confetti / shake` (UMD global) | `UsaComponents.playEffect(…)` | ✅ |
|
|
20
|
+
| `<usa-cursor mode="trail">` | wrap the content: `<usa-fx effect="comet-trail" trigger="load" self>…</usa-fx>` (5.7; scoped, touch-aware, overlay canvas). `mode="dot" \| "magnetic" \| "glow"` stay. | ⚠️ reported, manual |
|
|
21
|
+
|
|
22
|
+
`haptic()` stays. The registered `burst` effect accepts `x` / `y` since 5.9, so the rewrite keeps the exact origin.
|
|
23
|
+
|
|
24
|
+
## Behaviour
|
|
25
|
+
|
|
26
|
+
- Nothing else changes in 6.0: the modern-browser baseline is the 5.0 one, every 5.1–5.9 pack keeps its API, and `<usa-player>` JSON (`format: "use-scroll-animate/animation"`, `version: 1`) stays readable.
|
|
27
|
+
|
|
28
|
+
## New in 5.9 (before the break)
|
|
29
|
+
|
|
30
|
+
- `<usa-player>` plays JSON animations (keyframe tracks, timeline presets, registered effects) — exported from the playground's **`<usa-player> JSON`** tab. See [components.md](./components.md#v59-usa-player).
|
|
31
|
+
|
|
32
|
+
See the [CHANGELOG](../CHANGELOG.md) for the full list.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-scroll-animate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "A lightweight, high-performance, dependency-free scroll animation library and animated UI components (Web Components) for the web and Windows web-view apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -514,6 +514,7 @@
|
|
|
514
514
|
"node": ">=20"
|
|
515
515
|
},
|
|
516
516
|
"bin": {
|
|
517
|
-
"usa-codemod-5": "./bin/usa-codemod-5.mjs"
|
|
517
|
+
"usa-codemod-5": "./bin/usa-codemod-5.mjs",
|
|
518
|
+
"usa-codemod-6": "./bin/usa-codemod-6.mjs"
|
|
518
519
|
}
|
|
519
520
|
}
|