use-scroll-animate 2.2.0 → 2.4.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 (49) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +3 -1
  3. package/README_ja.md +2 -0
  4. package/README_zh.md +2 -0
  5. package/dist/chunks/{base-BiTc85p_.cjs → base-CJ7XfidP.cjs} +2 -1
  6. package/dist/chunks/{base-BiTc85p_.cjs.map → base-CJ7XfidP.cjs.map} +1 -1
  7. package/dist/chunks/{base-CFtnmfli.js → base-CuvCgqLy.js} +2 -2
  8. package/dist/chunks/{base-CFtnmfli.js.map → base-CuvCgqLy.js.map} +1 -1
  9. package/dist/chunks/spring-BKUU7-Xm.js +219 -0
  10. package/dist/chunks/spring-BKUU7-Xm.js.map +1 -0
  11. package/dist/chunks/spring-CGO9Jd9b.cjs +232 -0
  12. package/dist/chunks/spring-CGO9Jd9b.cjs.map +1 -0
  13. package/dist/components/background.cjs +1 -1
  14. package/dist/components/background.js +2 -2
  15. package/dist/components/cards.cjs +563 -0
  16. package/dist/components/cards.cjs.map +1 -0
  17. package/dist/components/cards.css +6 -0
  18. package/dist/components/cards.d.cts +142 -0
  19. package/dist/components/cards.d.ts +142 -0
  20. package/dist/components/cards.js +555 -0
  21. package/dist/components/cards.js.map +1 -0
  22. package/dist/components/feedback.cjs +1 -1
  23. package/dist/components/feedback.js +2 -2
  24. package/dist/components/interaction.cjs +1 -1
  25. package/dist/components/interaction.js +2 -2
  26. package/dist/components/physics.cjs +450 -0
  27. package/dist/components/physics.cjs.map +1 -0
  28. package/dist/components/physics.css +5 -0
  29. package/dist/components/physics.d.cts +216 -0
  30. package/dist/components/physics.d.ts +216 -0
  31. package/dist/components/physics.js +431 -0
  32. package/dist/components/physics.js.map +1 -0
  33. package/dist/components/reveal.cjs +1 -1
  34. package/dist/components/reveal.js +2 -2
  35. package/dist/components/text.cjs +1 -1
  36. package/dist/components/text.js +2 -2
  37. package/dist/components/transitions.cjs +1 -1
  38. package/dist/components/transitions.js +2 -2
  39. package/dist/components.cjs +32 -1
  40. package/dist/components.cjs.map +1 -1
  41. package/dist/components.css +7 -0
  42. package/dist/components.d.cts +284 -2
  43. package/dist/components.d.ts +284 -2
  44. package/dist/components.js +11 -2
  45. package/dist/components.js.map +1 -1
  46. package/dist/components.umd.js +2 -2
  47. package/dist/components.umd.js.map +1 -1
  48. package/docs/components.md +23 -0
  49. package/package.json +25 -2
@@ -119,6 +119,29 @@ 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
+
136
+ ### 8. Card effects — `components/cards`
137
+
138
+ | Element | What it does | Key attributes | JS API / events |
139
+ |---|---|---|---|
140
+ | `<usa-card>` | Combinable card effects: `flip`, `holo`, `glass`, `border-glow`, `conic-border`, `lift`, `spotlight`, `sheen`, `parallax-layers`, `expand` | `effect` (space-separated), `trigger` (`hover` · `click`, flip), `axis` (`y` · `x`), `depth` (16), `color`, `flipped`, `disabled`; children `[data-front]` / `[data-back]` / `[data-detail]` / `[data-depth]` / `[data-close]` | `flip(force?)`, `expand()`, `collapse()`, `flipped`, `expanded`; `usa:flip`, `usa:expand`, `usa:collapse`; `--usa-card-x/-y/-nx/-ny`, `--usa-card-radius`, `--usa-card-bg`, `--usa-card-glow` |
141
+ | `<usa-card-stack>` | Swipeable deck, cards fan out behind the top one | `threshold` (90), `visible` (3), `offset` (10), `loop`, `disabled` | `top`, `swipe('left' \| 'right')`; `usa:swipe`, `usa:empty` |
142
+ | `<usa-sticky-stack>` | Cards stack while scrolling; covered ones shrink & dim | `top` (80), `gap` (16), `scale` (0.06) | `update()` |
143
+ | `<usa-carousel-3d>` | 3D ring carousel with spring rotation | `radius` (auto), `perspective` (1200), `autoplay` (ms), `index` | `index`, `next()`, `prev()`, `goTo(i)`; `usa:change` |
144
+
122
145
  ## Frameworks
123
146
 
124
147
  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.2.0",
3
+ "version": "2.4.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,26 @@
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
+ },
151
+ "./components/cards": {
152
+ "import": {
153
+ "types": "./dist/components/cards.d.ts",
154
+ "default": "./dist/components/cards.js"
155
+ },
156
+ "require": {
157
+ "types": "./dist/components/cards.d.cts",
158
+ "default": "./dist/components/cards.cjs"
159
+ }
160
+ },
141
161
  "./components.css": "./dist/components.css",
142
162
  "./components/reveal.css": "./dist/components/reveal.css",
143
163
  "./components/text.css": "./dist/components/text.css",
@@ -145,6 +165,8 @@
145
165
  "./components/feedback.css": "./dist/components/feedback.css",
146
166
  "./components/background.css": "./dist/components/background.css",
147
167
  "./components/transitions.css": "./dist/components/transitions.css",
168
+ "./components/physics.css": "./dist/components/physics.css",
169
+ "./components/cards.css": "./dist/components/cards.css",
148
170
  "./package.json": "./package.json"
149
171
  },
150
172
  "files": [
@@ -165,10 +187,11 @@
165
187
  "typecheck": "tsc --noEmit -p .",
166
188
  "test": "vitest run",
167
189
  "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",
190
+ "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 ./components/cards.css",
169
191
  "size": "node scripts/size.mjs",
170
192
  "prepublishOnly": "npm run typecheck && npm test && npm run build && npm run check:exports",
171
193
  "size:check": "node scripts/size.mjs --check",
194
+ "sync:exports": "node scripts/sync-exports.mjs",
172
195
  "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\""
173
196
  },
174
197
  "keywords": [