use-scroll-animate 2.2.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.
- package/CHANGELOG.md +12 -0
- package/README.md +2 -1
- package/README_ja.md +1 -0
- package/README_zh.md +1 -0
- package/dist/chunks/{base-BiTc85p_.cjs → base-CJ7XfidP.cjs} +2 -1
- package/dist/chunks/{base-BiTc85p_.cjs.map → base-CJ7XfidP.cjs.map} +1 -1
- package/dist/chunks/{base-CFtnmfli.js → base-CuvCgqLy.js} +2 -2
- package/dist/chunks/{base-CFtnmfli.js.map → base-CuvCgqLy.js.map} +1 -1
- package/dist/components/background.cjs +1 -1
- package/dist/components/background.js +2 -2
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.js +2 -2
- package/dist/components/interaction.cjs +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/physics.cjs +664 -0
- package/dist/components/physics.cjs.map +1 -0
- package/dist/components/physics.css +5 -0
- package/dist/components/physics.d.cts +216 -0
- package/dist/components/physics.d.ts +216 -0
- package/dist/components/physics.js +644 -0
- package/dist/components/physics.js.map +1 -0
- package/dist/components/reveal.cjs +1 -1
- package/dist/components/reveal.js +2 -2
- package/dist/components/text.cjs +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/transitions.cjs +1 -1
- package/dist/components/transitions.js +2 -2
- package/dist/components.cjs +22 -1
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +3 -0
- package/dist/components.d.cts +180 -2
- package/dist/components.d.ts +180 -2
- package/dist/components.js +6 -2
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/docs/components.md +14 -0
- package/package.json +14 -2
package/docs/components.md
CHANGED
|
@@ -119,6 +119,20 @@ All attributes are optional unless noted. Events are `CustomEvent`s that bubble,
|
|
|
119
119
|
| `flip(targets, mutate, opts?)` | FLIP-animates any layout change | `{ duration, easing, animateEnter }` | `Promise<void>` |
|
|
120
120
|
| `connectedAnimation(from, to, opts?)` | WinUI-style connected / shared-element animation | `{ duration, easing, hideSource }` | `Promise<void>` |
|
|
121
121
|
|
|
122
|
+
### 7. Spring & physics — `components/physics`
|
|
123
|
+
|
|
124
|
+
| Element / API | What it does | Key attributes / options | JS API / events |
|
|
125
|
+
|---|---|---|---|
|
|
126
|
+
| `<usa-spring>` | Spring entrances (`bounce-in`, `pop`, `drop`) and attention effects (`jelly`, `rubber-band`) | `effect`, `trigger` (`view` · `hover` · `click` · `manual`), `preset` or `stiffness` / `damping` / `mass`, `delay`, `duration` (attention, 900), `repeat`, `block` | `play()`, `reset()`; `usa:complete` |
|
|
127
|
+
| `<usa-draggable>` | Drag with pointer or arrow keys, physics on release | `axis` (`both` · `x` · `y`), `spring-back`, `inertia`, `snap` (`80` grid or `0,120,240` points), `bounds="parent"`, `preset` (`wobbly`), `step` (16), `disabled` | `x`, `y`, `dragging`, `moveTo(x, y, animate?)`, `reset()`; `usa:drag-start`, `usa:drag`, `usa:drag-end`, `usa:settle`; `--usa-drag-x/-y` |
|
|
128
|
+
| `<usa-overscroll>` | Elastic scroll container (rubber-band edges) | `axis` (`y` · `x`), `max` (120), `preset`, `disabled` | `offset`; `--usa-overscroll` |
|
|
129
|
+
| `spring(el, keyframes, preset?, options?)` | WAAPI animation with spring timing | preset name or `{ stiffness, damping, mass, velocity }` | returns `Animation` (or `null` under reduced motion) |
|
|
130
|
+
| `springEasing(preset?)` | `{ easing: 'linear(…)', duration }` for CSS / WAAPI | — | cubic-bezier fallback without `linear()` |
|
|
131
|
+
| `createSpring({ value, spring, onUpdate, onRest })` | Interruptible spring value for gestures | — | `set(target, velocity?)`, `jump(v)`, `stop()`, `configure()` |
|
|
132
|
+
| `projectInertia(v, velocity)` · `snapTo(v, grid \| points)` · `rubberBand(d, dim)` | Inertia, snapping and resistance math | — | pure functions |
|
|
133
|
+
|
|
134
|
+
Presets (`SPRING_PRESETS`): `default` (170/26), `gentle` (120/14), `wobbly` (180/12), `stiff` (210/20), `bouncy` (300/10), `slow` (280/60), `molasses` (280/120) — stiffness/damping, mass 1.
|
|
135
|
+
|
|
122
136
|
## Frameworks
|
|
123
137
|
|
|
124
138
|
Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-scroll-animate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -138,6 +138,16 @@
|
|
|
138
138
|
"default": "./dist/components/transitions.cjs"
|
|
139
139
|
}
|
|
140
140
|
},
|
|
141
|
+
"./components/physics": {
|
|
142
|
+
"import": {
|
|
143
|
+
"types": "./dist/components/physics.d.ts",
|
|
144
|
+
"default": "./dist/components/physics.js"
|
|
145
|
+
},
|
|
146
|
+
"require": {
|
|
147
|
+
"types": "./dist/components/physics.d.cts",
|
|
148
|
+
"default": "./dist/components/physics.cjs"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
141
151
|
"./components.css": "./dist/components.css",
|
|
142
152
|
"./components/reveal.css": "./dist/components/reveal.css",
|
|
143
153
|
"./components/text.css": "./dist/components/text.css",
|
|
@@ -145,6 +155,7 @@
|
|
|
145
155
|
"./components/feedback.css": "./dist/components/feedback.css",
|
|
146
156
|
"./components/background.css": "./dist/components/background.css",
|
|
147
157
|
"./components/transitions.css": "./dist/components/transitions.css",
|
|
158
|
+
"./components/physics.css": "./dist/components/physics.css",
|
|
148
159
|
"./package.json": "./package.json"
|
|
149
160
|
},
|
|
150
161
|
"files": [
|
|
@@ -165,10 +176,11 @@
|
|
|
165
176
|
"typecheck": "tsc --noEmit -p .",
|
|
166
177
|
"test": "vitest run",
|
|
167
178
|
"check:exports": "node scripts/check-exports.mjs",
|
|
168
|
-
"lint:package": "publint && attw --pack . --profile node16 --exclude-entrypoints ./components.css ./components/reveal.css ./components/text.css ./components/interaction.css ./components/feedback.css ./components/background.css ./components/transitions.css",
|
|
179
|
+
"lint:package": "publint && attw --pack . --profile node16 --exclude-entrypoints ./components.css ./components/reveal.css ./components/text.css ./components/interaction.css ./components/feedback.css ./components/background.css ./components/transitions.css ./components/physics.css",
|
|
169
180
|
"size": "node scripts/size.mjs",
|
|
170
181
|
"prepublishOnly": "npm run typecheck && npm test && npm run build && npm run check:exports",
|
|
171
182
|
"size:check": "node scripts/size.mjs --check",
|
|
183
|
+
"sync:exports": "node scripts/sync-exports.mjs",
|
|
172
184
|
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\""
|
|
173
185
|
},
|
|
174
186
|
"keywords": [
|