use-scroll-animate 2.8.0 → 3.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 +48 -0
- package/README.md +5 -5
- package/README_zh.md +2 -2
- package/dist/chunks/{base-BR6fYLBA.cjs → base-CXx7jZ-o.cjs} +10 -1
- package/dist/chunks/{base-BR6fYLBA.cjs.map → base-CXx7jZ-o.cjs.map} +1 -1
- package/dist/chunks/{base-C_w9ibbn.js → base-Co98Z2iM.js} +10 -2
- package/dist/chunks/{base-C_w9ibbn.js.map → base-Co98Z2iM.js.map} +1 -1
- package/dist/chunks/{core-BP-a1iNc.js → core-mV_TPgG_.js} +3 -44
- package/dist/chunks/core-mV_TPgG_.js.map +1 -0
- package/dist/chunks/{core-B_J4rXbC.cjs → core-qpECfEkb.cjs} +2 -43
- package/dist/chunks/core-qpECfEkb.cjs.map +1 -0
- package/dist/chunks/index-tags-BEM98giN.cjs +20 -0
- package/dist/chunks/index-tags-BEM98giN.cjs.map +1 -0
- package/dist/chunks/index-tags-f37txHmb.js +18 -0
- package/dist/chunks/index-tags-f37txHmb.js.map +1 -0
- package/dist/chunks/{spring-DyHe1Hfa.cjs → spring-2OTnYCzm.cjs} +2 -2
- package/dist/chunks/{spring-DyHe1Hfa.cjs.map → spring-2OTnYCzm.cjs.map} +1 -1
- package/dist/chunks/{spring-Dc8ZqDWE.js → spring-YNUpez2g.js} +2 -2
- package/dist/chunks/{spring-Dc8ZqDWE.js.map → spring-YNUpez2g.js.map} +1 -1
- package/dist/chunks/{stagger-DTv_WiUQ.js → stagger-BFAhKknX.js} +2 -2
- package/dist/chunks/{stagger-DTv_WiUQ.js.map → stagger-BFAhKknX.js.map} +1 -1
- package/dist/chunks/{stagger-DHw0ExuR.cjs → stagger-CLc3j58T.cjs} +2 -2
- package/dist/chunks/{stagger-DHw0ExuR.cjs.map → stagger-CLc3j58T.cjs.map} +1 -1
- package/dist/chunks/{variants-Bbatdq8d.cjs → variants-BNIrn4ch.cjs} +2 -2
- package/dist/chunks/{variants-Bbatdq8d.cjs.map → variants-BNIrn4ch.cjs.map} +1 -1
- package/dist/chunks/{variants-idgMVXhE.js → variants-Dp_5lJ_J.js} +2 -2
- package/dist/chunks/{variants-idgMVXhE.js.map → variants-Dp_5lJ_J.js.map} +1 -1
- package/dist/components/background.cjs +3 -3
- package/dist/components/background.cjs.map +1 -1
- package/dist/components/background.css +1 -1
- package/dist/components/background.d.cts +1 -1
- package/dist/components/background.d.ts +1 -1
- package/dist/components/background.js +4 -4
- package/dist/components/background.js.map +1 -1
- package/dist/components/cards.cjs +2 -2
- package/dist/components/cards.js +3 -3
- package/dist/components/click.cjs +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/feedback.cjs +15 -15
- package/dist/components/feedback.cjs.map +1 -1
- package/dist/components/feedback.css +2 -2
- package/dist/components/feedback.d.cts +4 -3
- package/dist/components/feedback.d.ts +4 -3
- package/dist/components/feedback.js +16 -16
- package/dist/components/feedback.js.map +1 -1
- package/dist/components/interaction.cjs +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/jsx.cjs +3 -0
- package/dist/components/jsx.cjs.map +1 -0
- package/dist/components/jsx.d.cts +45 -0
- package/dist/components/jsx.d.ts +45 -0
- package/dist/components/jsx.js +2 -0
- package/dist/components/jsx.js.map +1 -0
- package/dist/components/lazy.cjs +84 -0
- package/dist/components/lazy.cjs.map +1 -0
- package/dist/components/lazy.d.cts +40 -0
- package/dist/components/lazy.d.ts +40 -0
- package/dist/components/lazy.js +79 -0
- package/dist/components/lazy.js.map +1 -0
- package/dist/components/page.cjs +2 -2
- package/dist/components/page.js +3 -3
- package/dist/components/physics.cjs +2 -2
- package/dist/components/physics.js +4 -4
- package/dist/components/react.cjs +96 -0
- package/dist/components/react.cjs.map +1 -0
- package/dist/components/react.d.cts +18 -0
- package/dist/components/react.d.ts +18 -0
- package/dist/components/react.js +91 -0
- package/dist/components/react.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 +8 -9
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.d.cts +1 -1
- package/dist/components/transitions.d.ts +1 -1
- package/dist/components/transitions.js +9 -10
- package/dist/components/transitions.js.map +1 -1
- package/dist/components/ui.cjs +3 -3
- package/dist/components/ui.js +5 -5
- package/dist/components/vue.cjs +51 -0
- package/dist/components/vue.cjs.map +1 -0
- package/dist/components/vue.d.cts +1342 -0
- package/dist/components/vue.d.ts +1342 -0
- package/dist/components/vue.js +48 -0
- package/dist/components/vue.js.map +1 -0
- package/dist/components.cjs +5 -18
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +3 -3
- package/dist/components.d.cts +7 -5
- package/dist/components.d.ts +7 -5
- package/dist/components.js +7 -20
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/element.cjs +2 -3
- package/dist/element.cjs.map +1 -1
- package/dist/element.d.cts +4 -19
- package/dist/element.d.ts +4 -19
- package/dist/element.js +2 -3
- package/dist/element.js.map +1 -1
- package/dist/element.umd.js +1 -1
- package/dist/element.umd.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -19
- package/dist/index.d.ts +4 -19
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/react.cjs +3 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -18
- package/dist/react.d.ts +3 -18
- package/dist/react.js +3 -3
- package/dist/react.js.map +1 -1
- package/dist/solid.cjs +2 -2
- package/dist/solid.d.cts +3 -18
- package/dist/solid.d.ts +3 -18
- package/dist/solid.js +2 -2
- package/dist/svelte.cjs +2 -2
- package/dist/svelte.d.cts +3 -18
- package/dist/svelte.d.ts +3 -18
- package/dist/svelte.js +2 -2
- package/dist/vue.cjs +3 -3
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +3 -18
- package/dist/vue.d.ts +3 -18
- package/dist/vue.js +3 -3
- package/dist/vue.js.map +1 -1
- package/docs/API.md +1 -2
- package/docs/accessibility.md +32 -0
- package/docs/components.md +30 -8
- package/docs/frameworks-ssr.md +64 -0
- package/docs/upgrading-3.md +21 -0
- package/docs/windows-apps.md +2 -2
- package/package.json +43 -2
- package/dist/chunks/core-BP-a1iNc.js.map +0 -1
- package/dist/chunks/core-B_J4rXbC.cjs.map +0 -1
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createScrollAnimate } from './chunks/core-
|
|
2
|
-
import { s as staggerChildren } from './chunks/stagger-
|
|
1
|
+
import { c as createScrollAnimate } from './chunks/core-mV_TPgG_.js';
|
|
2
|
+
import { s as staggerChildren } from './chunks/stagger-BFAhKknX.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* use-scroll-animate - React Integration
|
|
@@ -7,7 +7,7 @@ import { s as staggerChildren } from './chunks/stagger-DTv_WiUQ.js';
|
|
|
7
7
|
* `useScrollStagger({ observeChildren: true })` also animates children added later.
|
|
8
8
|
*
|
|
9
9
|
* Both hooks are thin wrappers around the core engine, so they share its
|
|
10
|
-
* behaviour: `once`, `offset`, custom easing functions,
|
|
10
|
+
* behaviour: `once`, `offset`, custom easing functions, progress,
|
|
11
11
|
* `prefers-reduced-motion` support, and proper cleanup on unmount.
|
|
12
12
|
*/
|
|
13
13
|
const CALLBACKS = ['onStart', 'onComplete', 'onEnter', 'onLeave', 'onProgress'];
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":["../src/react.ts"],"sourcesContent":["/**\n * use-scroll-animate - React Integration\n * Provides useScrollAnimate and useScrollStagger hooks for React applications.\n * `useScrollStagger({ observeChildren: true })` also animates children added later.\n *\n * Both hooks are thin wrappers around the core engine, so they share its\n * behaviour: `once`, `offset`, custom easing functions,
|
|
1
|
+
{"version":3,"file":"react.js","sources":["../src/react.ts"],"sourcesContent":["/**\n * use-scroll-animate - React Integration\n * Provides useScrollAnimate and useScrollStagger hooks for React applications.\n * `useScrollStagger({ observeChildren: true })` also animates children added later.\n *\n * Both hooks are thin wrappers around the core engine, so they share its\n * behaviour: `once`, `offset`, custom easing functions, progress,\n * `prefers-reduced-motion` support, and proper cleanup on unmount.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate } from './core';\nimport { staggerChildren, type StaggerOptions } from './stagger';\n\ntype ReactRef<T> = { current: T | null };\n\nconst CALLBACKS = ['onStart', 'onComplete', 'onEnter', 'onLeave', 'onProgress'] as const;\n\n/**\n * Wrap the callbacks that exist at mount so they always call the latest\n * version from the most recent render (avoids stale closures without\n * re-creating observers on every render).\n * @internal\n */\nexport function withLatestCallbacks(latest: ReactRef<AnimateOptions>): AnimateOptions {\n const initial = latest.current || {};\n const opts: AnimateOptions = { ...initial };\n CALLBACKS.forEach((name) => {\n if (typeof initial[name] === 'function') {\n (opts as any)[name] = (...args: unknown[]) => (latest.current?.[name] as any)?.(...args);\n }\n });\n return opts;\n}\n\nexport function createReactHooks(React: {\n useRef: <T>(initial: T | null) => ReactRef<T>;\n useEffect: (effect: () => (() => void) | void, deps?: unknown[]) => void;\n}) {\n // Created lazily on the client so importing on the server is side-effect free.\n let instance: ScrollAnimateInstance | null = null;\n const getInstance = () => instance || (instance = createScrollAnimate());\n\n function useScrollAnimate(options: AnimateOptions = {}) {\n const ref = React.useRef<Element>(null);\n const optionsRef = React.useRef<AnimateOptions>(options);\n optionsRef.current = options;\n\n React.useEffect(() => {\n const el = ref.current;\n if (!el) return;\n const sa = getInstance();\n sa.observe(el, withLatestCallbacks(optionsRef));\n return () => sa.unobserve(el);\n }, []);\n\n return ref;\n }\n\n function useScrollStagger(options: StaggerOptions = {}) {\n const ref = React.useRef<Element>(null);\n const optionsRef = React.useRef<AnimateOptions>(options);\n optionsRef.current = options;\n\n React.useEffect(() => {\n const container = ref.current;\n if (!container) return;\n return staggerChildren(container, withLatestCallbacks(optionsRef) as StaggerOptions, getInstance());\n }, []);\n\n return ref;\n }\n\n return { useScrollAnimate, useScrollStagger };\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;;;AAQG;AAQH,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAU;AAExF;;;;;AAKG;AACG,SAAU,mBAAmB,CAAC,MAAgC,EAAA;AAClE,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE;AACpC,IAAA,MAAM,IAAI,GAAmB,EAAE,GAAG,OAAO,EAAE;AAC3C,IAAA,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;QACzB,IAAI,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;YACtC,IAAY,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAe,KAAM,MAAM,CAAC,OAAO,GAAG,IAAI,CAAS,GAAG,GAAG,IAAI,CAAC;QAC1F;AACF,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,IAAI;AACb;AAEM,SAAU,gBAAgB,CAAC,KAGhC,EAAA;;IAEC,IAAI,QAAQ,GAAiC,IAAI;AACjD,IAAA,MAAM,WAAW,GAAG,MAAM,QAAQ,KAAK,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IAExE,SAAS,gBAAgB,CAAC,OAAA,GAA0B,EAAE,EAAA;QACpD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAU,IAAI,CAAC;QACvC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAiB,OAAO,CAAC;AACxD,QAAA,UAAU,CAAC,OAAO,GAAG,OAAO;AAE5B,QAAA,KAAK,CAAC,SAAS,CAAC,MAAK;AACnB,YAAA,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO;AACtB,YAAA,IAAI,CAAC,EAAE;gBAAE;AACT,YAAA,MAAM,EAAE,GAAG,WAAW,EAAE;YACxB,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAC/C,OAAO,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,CAAC,EAAE,EAAE,CAAC;AAEN,QAAA,OAAO,GAAG;IACZ;IAEA,SAAS,gBAAgB,CAAC,OAAA,GAA0B,EAAE,EAAA;QACpD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAU,IAAI,CAAC;QACvC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAiB,OAAO,CAAC;AACxD,QAAA,UAAU,CAAC,OAAO,GAAG,OAAO;AAE5B,QAAA,KAAK,CAAC,SAAS,CAAC,MAAK;AACnB,YAAA,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO;AAC7B,YAAA,IAAI,CAAC,SAAS;gBAAE;AAChB,YAAA,OAAO,eAAe,CAAC,SAAS,EAAE,mBAAmB,CAAC,UAAU,CAAmB,EAAE,WAAW,EAAE,CAAC;QACrG,CAAC,EAAE,EAAE,CAAC;AAEN,QAAA,OAAO,GAAG;IACZ;AAEA,IAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE;AAC/C;;;;"}
|
package/dist/solid.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
|
-
var core = require('./chunks/core-
|
|
5
|
-
var stagger = require('./chunks/stagger-
|
|
4
|
+
var core = require('./chunks/core-qpECfEkb.cjs');
|
|
5
|
+
var stagger = require('./chunks/stagger-CLc3j58T.cjs');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* use-scroll-animate - Solid integration
|
package/dist/solid.d.cts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Built-in animation presets */
|
|
6
6
|
type AnimationPreset = 'fade-in' | 'fade-in-up' | 'fade-in-down' | 'fade-in-left' | 'fade-in-right' | 'zoom-in' | 'zoom-out' | 'flip-x' | 'flip-y' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'bounce' | 'rotate-in' | 'blur-in' | 'skew-in' | 'scale-x' | 'scale-y' | 'shimmer' | 'pulse' | 'swing' | 'scale-up' | 'blur-in-up' | 'flip-up' | 'flip-down' | 'rotate-left' | 'rotate-right' | 'clip-up' | 'clip-down' | 'clip-left' | 'clip-right' | 'clip-circle';
|
|
7
7
|
/**
|
|
8
|
-
* How `onProgress`
|
|
8
|
+
* How `onProgress` / `progressVar` progress is measured.
|
|
9
9
|
* - `'ratio'` (default): the element's visible ratio (IntersectionObserver `intersectionRatio`).
|
|
10
10
|
* - `'scroll'`: true scroll progress, 0 when the element's top touches the bottom of the
|
|
11
11
|
* viewport and 1 when its bottom leaves the top. Works for elements taller than the screen.
|
|
@@ -33,19 +33,6 @@ interface CustomAnimation {
|
|
|
33
33
|
from: AnimationKeyframe;
|
|
34
34
|
to: AnimationKeyframe;
|
|
35
35
|
}
|
|
36
|
-
/** Parallax configuration */
|
|
37
|
-
interface ParallaxOptions {
|
|
38
|
-
/** Movement on X axis (e.g., '100px', '20%') */
|
|
39
|
-
x?: string | number;
|
|
40
|
-
/** Movement on Y axis (e.g., '100px', '20%') */
|
|
41
|
-
y?: string | number;
|
|
42
|
-
/** Rotation in degrees */
|
|
43
|
-
rotate?: number;
|
|
44
|
-
/** Scale factor */
|
|
45
|
-
scale?: number;
|
|
46
|
-
/** Speed multiplier (default: 1) */
|
|
47
|
-
speed?: number;
|
|
48
|
-
}
|
|
49
36
|
/** Per-element animation options */
|
|
50
37
|
interface AnimateOptions {
|
|
51
38
|
/** Animation preset name, array of presets, or custom animation object */
|
|
@@ -68,8 +55,6 @@ interface AnimateOptions {
|
|
|
68
55
|
offset?: number;
|
|
69
56
|
/** Stagger delay for child elements in ms (default: 0) */
|
|
70
57
|
stagger?: number;
|
|
71
|
-
/** Parallax effect configuration */
|
|
72
|
-
parallax?: ParallaxOptions;
|
|
73
58
|
/** Callback fired when animation starts */
|
|
74
59
|
onStart?: (element: Element) => void;
|
|
75
60
|
/** Callback fired when animation completes */
|
|
@@ -80,7 +65,7 @@ interface AnimateOptions {
|
|
|
80
65
|
onLeave?: (element: Element) => void;
|
|
81
66
|
/** Callback fired with scroll progress (0 to 1) */
|
|
82
67
|
onProgress?: (element: Element, progress: number) => void;
|
|
83
|
-
/** How progress for `onProgress
|
|
68
|
+
/** How progress for `onProgress`/`progressVar` is measured (default: 'ratio') */
|
|
84
69
|
progressMode?: ProgressMode;
|
|
85
70
|
/**
|
|
86
71
|
* Name of a CSS custom property (e.g. `'--sa-progress'`) that receives the
|
|
@@ -141,7 +126,7 @@ interface ScrollAnimateConfig {
|
|
|
141
126
|
root?: Element | null;
|
|
142
127
|
/**
|
|
143
128
|
* Drop `once` elements from the registry as soon as their entrance animation
|
|
144
|
-
* has been triggered (unless they still need
|
|
129
|
+
* has been triggered (unless they still need onProgress/progressVar), so they can
|
|
145
130
|
* be garbage-collected. They are remembered in a WeakSet, so `init()`/`observe()`
|
|
146
131
|
* never re-hide or replay them. (default: true)
|
|
147
132
|
*/
|
package/dist/solid.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Built-in animation presets */
|
|
6
6
|
type AnimationPreset = 'fade-in' | 'fade-in-up' | 'fade-in-down' | 'fade-in-left' | 'fade-in-right' | 'zoom-in' | 'zoom-out' | 'flip-x' | 'flip-y' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'bounce' | 'rotate-in' | 'blur-in' | 'skew-in' | 'scale-x' | 'scale-y' | 'shimmer' | 'pulse' | 'swing' | 'scale-up' | 'blur-in-up' | 'flip-up' | 'flip-down' | 'rotate-left' | 'rotate-right' | 'clip-up' | 'clip-down' | 'clip-left' | 'clip-right' | 'clip-circle';
|
|
7
7
|
/**
|
|
8
|
-
* How `onProgress`
|
|
8
|
+
* How `onProgress` / `progressVar` progress is measured.
|
|
9
9
|
* - `'ratio'` (default): the element's visible ratio (IntersectionObserver `intersectionRatio`).
|
|
10
10
|
* - `'scroll'`: true scroll progress, 0 when the element's top touches the bottom of the
|
|
11
11
|
* viewport and 1 when its bottom leaves the top. Works for elements taller than the screen.
|
|
@@ -33,19 +33,6 @@ interface CustomAnimation {
|
|
|
33
33
|
from: AnimationKeyframe;
|
|
34
34
|
to: AnimationKeyframe;
|
|
35
35
|
}
|
|
36
|
-
/** Parallax configuration */
|
|
37
|
-
interface ParallaxOptions {
|
|
38
|
-
/** Movement on X axis (e.g., '100px', '20%') */
|
|
39
|
-
x?: string | number;
|
|
40
|
-
/** Movement on Y axis (e.g., '100px', '20%') */
|
|
41
|
-
y?: string | number;
|
|
42
|
-
/** Rotation in degrees */
|
|
43
|
-
rotate?: number;
|
|
44
|
-
/** Scale factor */
|
|
45
|
-
scale?: number;
|
|
46
|
-
/** Speed multiplier (default: 1) */
|
|
47
|
-
speed?: number;
|
|
48
|
-
}
|
|
49
36
|
/** Per-element animation options */
|
|
50
37
|
interface AnimateOptions {
|
|
51
38
|
/** Animation preset name, array of presets, or custom animation object */
|
|
@@ -68,8 +55,6 @@ interface AnimateOptions {
|
|
|
68
55
|
offset?: number;
|
|
69
56
|
/** Stagger delay for child elements in ms (default: 0) */
|
|
70
57
|
stagger?: number;
|
|
71
|
-
/** Parallax effect configuration */
|
|
72
|
-
parallax?: ParallaxOptions;
|
|
73
58
|
/** Callback fired when animation starts */
|
|
74
59
|
onStart?: (element: Element) => void;
|
|
75
60
|
/** Callback fired when animation completes */
|
|
@@ -80,7 +65,7 @@ interface AnimateOptions {
|
|
|
80
65
|
onLeave?: (element: Element) => void;
|
|
81
66
|
/** Callback fired with scroll progress (0 to 1) */
|
|
82
67
|
onProgress?: (element: Element, progress: number) => void;
|
|
83
|
-
/** How progress for `onProgress
|
|
68
|
+
/** How progress for `onProgress`/`progressVar` is measured (default: 'ratio') */
|
|
84
69
|
progressMode?: ProgressMode;
|
|
85
70
|
/**
|
|
86
71
|
* Name of a CSS custom property (e.g. `'--sa-progress'`) that receives the
|
|
@@ -141,7 +126,7 @@ interface ScrollAnimateConfig {
|
|
|
141
126
|
root?: Element | null;
|
|
142
127
|
/**
|
|
143
128
|
* Drop `once` elements from the registry as soon as their entrance animation
|
|
144
|
-
* has been triggered (unless they still need
|
|
129
|
+
* has been triggered (unless they still need onProgress/progressVar), so they can
|
|
145
130
|
* be garbage-collected. They are remembered in a WeakSet, so `init()`/`observe()`
|
|
146
131
|
* never re-hide or replay them. (default: true)
|
|
147
132
|
*/
|
package/dist/solid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onMount, onCleanup } from 'solid-js';
|
|
2
|
-
import { c as createScrollAnimate } from './chunks/core-
|
|
3
|
-
import { s as staggerChildren } from './chunks/stagger-
|
|
2
|
+
import { c as createScrollAnimate } from './chunks/core-mV_TPgG_.js';
|
|
3
|
+
import { s as staggerChildren } from './chunks/stagger-BFAhKknX.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* use-scroll-animate - Solid integration
|
package/dist/svelte.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var core = require('./chunks/core-
|
|
4
|
-
var stagger = require('./chunks/stagger-
|
|
3
|
+
var core = require('./chunks/core-qpECfEkb.cjs');
|
|
4
|
+
var stagger = require('./chunks/stagger-CLc3j58T.cjs');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* use-scroll-animate - Svelte integration
|
package/dist/svelte.d.cts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Built-in animation presets */
|
|
6
6
|
type AnimationPreset = 'fade-in' | 'fade-in-up' | 'fade-in-down' | 'fade-in-left' | 'fade-in-right' | 'zoom-in' | 'zoom-out' | 'flip-x' | 'flip-y' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'bounce' | 'rotate-in' | 'blur-in' | 'skew-in' | 'scale-x' | 'scale-y' | 'shimmer' | 'pulse' | 'swing' | 'scale-up' | 'blur-in-up' | 'flip-up' | 'flip-down' | 'rotate-left' | 'rotate-right' | 'clip-up' | 'clip-down' | 'clip-left' | 'clip-right' | 'clip-circle';
|
|
7
7
|
/**
|
|
8
|
-
* How `onProgress`
|
|
8
|
+
* How `onProgress` / `progressVar` progress is measured.
|
|
9
9
|
* - `'ratio'` (default): the element's visible ratio (IntersectionObserver `intersectionRatio`).
|
|
10
10
|
* - `'scroll'`: true scroll progress, 0 when the element's top touches the bottom of the
|
|
11
11
|
* viewport and 1 when its bottom leaves the top. Works for elements taller than the screen.
|
|
@@ -33,19 +33,6 @@ interface CustomAnimation {
|
|
|
33
33
|
from: AnimationKeyframe;
|
|
34
34
|
to: AnimationKeyframe;
|
|
35
35
|
}
|
|
36
|
-
/** Parallax configuration */
|
|
37
|
-
interface ParallaxOptions {
|
|
38
|
-
/** Movement on X axis (e.g., '100px', '20%') */
|
|
39
|
-
x?: string | number;
|
|
40
|
-
/** Movement on Y axis (e.g., '100px', '20%') */
|
|
41
|
-
y?: string | number;
|
|
42
|
-
/** Rotation in degrees */
|
|
43
|
-
rotate?: number;
|
|
44
|
-
/** Scale factor */
|
|
45
|
-
scale?: number;
|
|
46
|
-
/** Speed multiplier (default: 1) */
|
|
47
|
-
speed?: number;
|
|
48
|
-
}
|
|
49
36
|
/** Per-element animation options */
|
|
50
37
|
interface AnimateOptions {
|
|
51
38
|
/** Animation preset name, array of presets, or custom animation object */
|
|
@@ -68,8 +55,6 @@ interface AnimateOptions {
|
|
|
68
55
|
offset?: number;
|
|
69
56
|
/** Stagger delay for child elements in ms (default: 0) */
|
|
70
57
|
stagger?: number;
|
|
71
|
-
/** Parallax effect configuration */
|
|
72
|
-
parallax?: ParallaxOptions;
|
|
73
58
|
/** Callback fired when animation starts */
|
|
74
59
|
onStart?: (element: Element) => void;
|
|
75
60
|
/** Callback fired when animation completes */
|
|
@@ -80,7 +65,7 @@ interface AnimateOptions {
|
|
|
80
65
|
onLeave?: (element: Element) => void;
|
|
81
66
|
/** Callback fired with scroll progress (0 to 1) */
|
|
82
67
|
onProgress?: (element: Element, progress: number) => void;
|
|
83
|
-
/** How progress for `onProgress
|
|
68
|
+
/** How progress for `onProgress`/`progressVar` is measured (default: 'ratio') */
|
|
84
69
|
progressMode?: ProgressMode;
|
|
85
70
|
/**
|
|
86
71
|
* Name of a CSS custom property (e.g. `'--sa-progress'`) that receives the
|
|
@@ -141,7 +126,7 @@ interface ScrollAnimateConfig {
|
|
|
141
126
|
root?: Element | null;
|
|
142
127
|
/**
|
|
143
128
|
* Drop `once` elements from the registry as soon as their entrance animation
|
|
144
|
-
* has been triggered (unless they still need
|
|
129
|
+
* has been triggered (unless they still need onProgress/progressVar), so they can
|
|
145
130
|
* be garbage-collected. They are remembered in a WeakSet, so `init()`/`observe()`
|
|
146
131
|
* never re-hide or replay them. (default: true)
|
|
147
132
|
*/
|
package/dist/svelte.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Built-in animation presets */
|
|
6
6
|
type AnimationPreset = 'fade-in' | 'fade-in-up' | 'fade-in-down' | 'fade-in-left' | 'fade-in-right' | 'zoom-in' | 'zoom-out' | 'flip-x' | 'flip-y' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'bounce' | 'rotate-in' | 'blur-in' | 'skew-in' | 'scale-x' | 'scale-y' | 'shimmer' | 'pulse' | 'swing' | 'scale-up' | 'blur-in-up' | 'flip-up' | 'flip-down' | 'rotate-left' | 'rotate-right' | 'clip-up' | 'clip-down' | 'clip-left' | 'clip-right' | 'clip-circle';
|
|
7
7
|
/**
|
|
8
|
-
* How `onProgress`
|
|
8
|
+
* How `onProgress` / `progressVar` progress is measured.
|
|
9
9
|
* - `'ratio'` (default): the element's visible ratio (IntersectionObserver `intersectionRatio`).
|
|
10
10
|
* - `'scroll'`: true scroll progress, 0 when the element's top touches the bottom of the
|
|
11
11
|
* viewport and 1 when its bottom leaves the top. Works for elements taller than the screen.
|
|
@@ -33,19 +33,6 @@ interface CustomAnimation {
|
|
|
33
33
|
from: AnimationKeyframe;
|
|
34
34
|
to: AnimationKeyframe;
|
|
35
35
|
}
|
|
36
|
-
/** Parallax configuration */
|
|
37
|
-
interface ParallaxOptions {
|
|
38
|
-
/** Movement on X axis (e.g., '100px', '20%') */
|
|
39
|
-
x?: string | number;
|
|
40
|
-
/** Movement on Y axis (e.g., '100px', '20%') */
|
|
41
|
-
y?: string | number;
|
|
42
|
-
/** Rotation in degrees */
|
|
43
|
-
rotate?: number;
|
|
44
|
-
/** Scale factor */
|
|
45
|
-
scale?: number;
|
|
46
|
-
/** Speed multiplier (default: 1) */
|
|
47
|
-
speed?: number;
|
|
48
|
-
}
|
|
49
36
|
/** Per-element animation options */
|
|
50
37
|
interface AnimateOptions {
|
|
51
38
|
/** Animation preset name, array of presets, or custom animation object */
|
|
@@ -68,8 +55,6 @@ interface AnimateOptions {
|
|
|
68
55
|
offset?: number;
|
|
69
56
|
/** Stagger delay for child elements in ms (default: 0) */
|
|
70
57
|
stagger?: number;
|
|
71
|
-
/** Parallax effect configuration */
|
|
72
|
-
parallax?: ParallaxOptions;
|
|
73
58
|
/** Callback fired when animation starts */
|
|
74
59
|
onStart?: (element: Element) => void;
|
|
75
60
|
/** Callback fired when animation completes */
|
|
@@ -80,7 +65,7 @@ interface AnimateOptions {
|
|
|
80
65
|
onLeave?: (element: Element) => void;
|
|
81
66
|
/** Callback fired with scroll progress (0 to 1) */
|
|
82
67
|
onProgress?: (element: Element, progress: number) => void;
|
|
83
|
-
/** How progress for `onProgress
|
|
68
|
+
/** How progress for `onProgress`/`progressVar` is measured (default: 'ratio') */
|
|
84
69
|
progressMode?: ProgressMode;
|
|
85
70
|
/**
|
|
86
71
|
* Name of a CSS custom property (e.g. `'--sa-progress'`) that receives the
|
|
@@ -141,7 +126,7 @@ interface ScrollAnimateConfig {
|
|
|
141
126
|
root?: Element | null;
|
|
142
127
|
/**
|
|
143
128
|
* Drop `once` elements from the registry as soon as their entrance animation
|
|
144
|
-
* has been triggered (unless they still need
|
|
129
|
+
* has been triggered (unless they still need onProgress/progressVar), so they can
|
|
145
130
|
* be garbage-collected. They are remembered in a WeakSet, so `init()`/`observe()`
|
|
146
131
|
* never re-hide or replay them. (default: true)
|
|
147
132
|
*/
|
package/dist/svelte.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createScrollAnimate } from './chunks/core-
|
|
2
|
-
import { s as staggerChildren } from './chunks/stagger-
|
|
1
|
+
import { c as createScrollAnimate } from './chunks/core-mV_TPgG_.js';
|
|
2
|
+
import { s as staggerChildren } from './chunks/stagger-BFAhKknX.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* use-scroll-animate - Svelte integration
|
package/dist/vue.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var core = require('./chunks/core-
|
|
4
|
-
var stagger = require('./chunks/stagger-
|
|
3
|
+
var core = require('./chunks/core-qpECfEkb.cjs');
|
|
4
|
+
var stagger = require('./chunks/stagger-CLc3j58T.cjs');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* use-scroll-animate - Vue 3 Integration
|
|
8
8
|
* Provides useScrollAnimate and useScrollStagger composables for Vue 3 applications.
|
|
9
9
|
*
|
|
10
10
|
* A thin wrapper around the core engine, so it shares its behaviour: `once`,
|
|
11
|
-
* `offset`, custom easing functions,
|
|
11
|
+
* `offset`, custom easing functions, progress, `prefers-reduced-motion`
|
|
12
12
|
* support, and cleanup on unmount.
|
|
13
13
|
*/
|
|
14
14
|
/** Support refs on components (`$el`) as well as plain elements. */
|
package/dist/vue.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.cjs","sources":["../src/vue.ts"],"sourcesContent":["/**\n * use-scroll-animate - Vue 3 Integration\n * Provides useScrollAnimate and useScrollStagger composables for Vue 3 applications.\n *\n * A thin wrapper around the core engine, so it shares its behaviour: `once`,\n * `offset`, custom easing functions,
|
|
1
|
+
{"version":3,"file":"vue.cjs","sources":["../src/vue.ts"],"sourcesContent":["/**\n * use-scroll-animate - Vue 3 Integration\n * Provides useScrollAnimate and useScrollStagger composables for Vue 3 applications.\n *\n * A thin wrapper around the core engine, so it shares its behaviour: `once`,\n * `offset`, custom easing functions, progress, `prefers-reduced-motion`\n * support, and cleanup on unmount.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate } from './core';\nimport { staggerChildren, type StaggerOptions } from './stagger';\n\n/** Support refs on components (`$el`) as well as plain elements. */\nfunction unwrap(value: unknown): Element | null {\n if (value && typeof Element !== 'undefined' && !(value instanceof Element) && (value as any).$el instanceof Element) {\n return (value as any).$el as Element;\n }\n return (value as Element | null) || null;\n}\n\nexport function createVueComposables(Vue: {\n ref: <T>(value: T | null) => { value: T | null };\n onMounted: (fn: () => void) => void;\n onUnmounted: (fn: () => void) => void;\n}) {\n // Created lazily on the client so importing on the server is side-effect free.\n let instance: ScrollAnimateInstance | null = null;\n const getInstance = () => instance || (instance = createScrollAnimate());\n\n function useScrollAnimate(options: AnimateOptions = {}) {\n const animateRef = Vue.ref<Element>(null);\n let el: Element | null = null;\n\n Vue.onMounted(() => {\n const target = unwrap(animateRef.value);\n if (!target) return;\n el = target;\n getInstance().observe(el, options);\n });\n\n Vue.onUnmounted(() => {\n if (el) getInstance().unobserve(el);\n el = null;\n });\n\n return { animateRef };\n }\n\n /** Stagger the children of `staggerRef`; `observeChildren: true` also animates children added later. */\n function useScrollStagger(options: StaggerOptions = {}) {\n const staggerRef = Vue.ref<Element>(null);\n let stop: (() => void) | undefined;\n\n Vue.onMounted(() => {\n const target = unwrap(staggerRef.value);\n if (target) stop = staggerChildren(target, options, getInstance());\n });\n\n Vue.onUnmounted(() => {\n stop?.();\n stop = undefined;\n });\n\n return { staggerRef };\n }\n\n return { useScrollAnimate, useScrollStagger };\n}\n"],"names":["createScrollAnimate","staggerChildren"],"mappings":";;;;;AAAA;;;;;;;AAOG;AAMH;AACA,SAAS,MAAM,CAAC,KAAc,EAAA;IAC5B,IAAI,KAAK,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,EAAE,KAAK,YAAY,OAAO,CAAC,IAAK,KAAa,CAAC,GAAG,YAAY,OAAO,EAAE;QACnH,OAAQ,KAAa,CAAC,GAAc;IACtC;IACA,OAAQ,KAAwB,IAAI,IAAI;AAC1C;AAEM,SAAU,oBAAoB,CAAC,GAIpC,EAAA;;IAEC,IAAI,QAAQ,GAAiC,IAAI;AACjD,IAAA,MAAM,WAAW,GAAG,MAAM,QAAQ,KAAK,QAAQ,GAAGA,wBAAmB,EAAE,CAAC;IAExE,SAAS,gBAAgB,CAAC,OAAA,GAA0B,EAAE,EAAA;QACpD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAU,IAAI,CAAC;QACzC,IAAI,EAAE,GAAmB,IAAI;AAE7B,QAAA,GAAG,CAAC,SAAS,CAAC,MAAK;YACjB,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;AACvC,YAAA,IAAI,CAAC,MAAM;gBAAE;YACb,EAAE,GAAG,MAAM;YACX,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC;AACpC,QAAA,CAAC,CAAC;AAEF,QAAA,GAAG,CAAC,WAAW,CAAC,MAAK;AACnB,YAAA,IAAI,EAAE;AAAE,gBAAA,WAAW,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,EAAE,GAAG,IAAI;AACX,QAAA,CAAC,CAAC;QAEF,OAAO,EAAE,UAAU,EAAE;IACvB;;IAGA,SAAS,gBAAgB,CAAC,OAAA,GAA0B,EAAE,EAAA;QACpD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAU,IAAI,CAAC;AACzC,QAAA,IAAI,IAA8B;AAElC,QAAA,GAAG,CAAC,SAAS,CAAC,MAAK;YACjB,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;AACvC,YAAA,IAAI,MAAM;gBAAE,IAAI,GAAGC,uBAAe,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACpE,QAAA,CAAC,CAAC;AAEF,QAAA,GAAG,CAAC,WAAW,CAAC,MAAK;YACnB,IAAI,IAAI;YACR,IAAI,GAAG,SAAS;AAClB,QAAA,CAAC,CAAC;QAEF,OAAO,EAAE,UAAU,EAAE;IACvB;AAEA,IAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE;AAC/C;;;;"}
|
package/dist/vue.d.cts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Built-in animation presets */
|
|
6
6
|
type AnimationPreset = 'fade-in' | 'fade-in-up' | 'fade-in-down' | 'fade-in-left' | 'fade-in-right' | 'zoom-in' | 'zoom-out' | 'flip-x' | 'flip-y' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'bounce' | 'rotate-in' | 'blur-in' | 'skew-in' | 'scale-x' | 'scale-y' | 'shimmer' | 'pulse' | 'swing' | 'scale-up' | 'blur-in-up' | 'flip-up' | 'flip-down' | 'rotate-left' | 'rotate-right' | 'clip-up' | 'clip-down' | 'clip-left' | 'clip-right' | 'clip-circle';
|
|
7
7
|
/**
|
|
8
|
-
* How `onProgress`
|
|
8
|
+
* How `onProgress` / `progressVar` progress is measured.
|
|
9
9
|
* - `'ratio'` (default): the element's visible ratio (IntersectionObserver `intersectionRatio`).
|
|
10
10
|
* - `'scroll'`: true scroll progress, 0 when the element's top touches the bottom of the
|
|
11
11
|
* viewport and 1 when its bottom leaves the top. Works for elements taller than the screen.
|
|
@@ -33,19 +33,6 @@ interface CustomAnimation {
|
|
|
33
33
|
from: AnimationKeyframe;
|
|
34
34
|
to: AnimationKeyframe;
|
|
35
35
|
}
|
|
36
|
-
/** Parallax configuration */
|
|
37
|
-
interface ParallaxOptions {
|
|
38
|
-
/** Movement on X axis (e.g., '100px', '20%') */
|
|
39
|
-
x?: string | number;
|
|
40
|
-
/** Movement on Y axis (e.g., '100px', '20%') */
|
|
41
|
-
y?: string | number;
|
|
42
|
-
/** Rotation in degrees */
|
|
43
|
-
rotate?: number;
|
|
44
|
-
/** Scale factor */
|
|
45
|
-
scale?: number;
|
|
46
|
-
/** Speed multiplier (default: 1) */
|
|
47
|
-
speed?: number;
|
|
48
|
-
}
|
|
49
36
|
/** Per-element animation options */
|
|
50
37
|
interface AnimateOptions {
|
|
51
38
|
/** Animation preset name, array of presets, or custom animation object */
|
|
@@ -68,8 +55,6 @@ interface AnimateOptions {
|
|
|
68
55
|
offset?: number;
|
|
69
56
|
/** Stagger delay for child elements in ms (default: 0) */
|
|
70
57
|
stagger?: number;
|
|
71
|
-
/** Parallax effect configuration */
|
|
72
|
-
parallax?: ParallaxOptions;
|
|
73
58
|
/** Callback fired when animation starts */
|
|
74
59
|
onStart?: (element: Element) => void;
|
|
75
60
|
/** Callback fired when animation completes */
|
|
@@ -80,7 +65,7 @@ interface AnimateOptions {
|
|
|
80
65
|
onLeave?: (element: Element) => void;
|
|
81
66
|
/** Callback fired with scroll progress (0 to 1) */
|
|
82
67
|
onProgress?: (element: Element, progress: number) => void;
|
|
83
|
-
/** How progress for `onProgress
|
|
68
|
+
/** How progress for `onProgress`/`progressVar` is measured (default: 'ratio') */
|
|
84
69
|
progressMode?: ProgressMode;
|
|
85
70
|
/**
|
|
86
71
|
* Name of a CSS custom property (e.g. `'--sa-progress'`) that receives the
|
|
@@ -133,7 +118,7 @@ interface StaggerOptions extends AnimateOptions {
|
|
|
133
118
|
* Provides useScrollAnimate and useScrollStagger composables for Vue 3 applications.
|
|
134
119
|
*
|
|
135
120
|
* A thin wrapper around the core engine, so it shares its behaviour: `once`,
|
|
136
|
-
* `offset`, custom easing functions,
|
|
121
|
+
* `offset`, custom easing functions, progress, `prefers-reduced-motion`
|
|
137
122
|
* support, and cleanup on unmount.
|
|
138
123
|
*/
|
|
139
124
|
|
package/dist/vue.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Built-in animation presets */
|
|
6
6
|
type AnimationPreset = 'fade-in' | 'fade-in-up' | 'fade-in-down' | 'fade-in-left' | 'fade-in-right' | 'zoom-in' | 'zoom-out' | 'flip-x' | 'flip-y' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'bounce' | 'rotate-in' | 'blur-in' | 'skew-in' | 'scale-x' | 'scale-y' | 'shimmer' | 'pulse' | 'swing' | 'scale-up' | 'blur-in-up' | 'flip-up' | 'flip-down' | 'rotate-left' | 'rotate-right' | 'clip-up' | 'clip-down' | 'clip-left' | 'clip-right' | 'clip-circle';
|
|
7
7
|
/**
|
|
8
|
-
* How `onProgress`
|
|
8
|
+
* How `onProgress` / `progressVar` progress is measured.
|
|
9
9
|
* - `'ratio'` (default): the element's visible ratio (IntersectionObserver `intersectionRatio`).
|
|
10
10
|
* - `'scroll'`: true scroll progress, 0 when the element's top touches the bottom of the
|
|
11
11
|
* viewport and 1 when its bottom leaves the top. Works for elements taller than the screen.
|
|
@@ -33,19 +33,6 @@ interface CustomAnimation {
|
|
|
33
33
|
from: AnimationKeyframe;
|
|
34
34
|
to: AnimationKeyframe;
|
|
35
35
|
}
|
|
36
|
-
/** Parallax configuration */
|
|
37
|
-
interface ParallaxOptions {
|
|
38
|
-
/** Movement on X axis (e.g., '100px', '20%') */
|
|
39
|
-
x?: string | number;
|
|
40
|
-
/** Movement on Y axis (e.g., '100px', '20%') */
|
|
41
|
-
y?: string | number;
|
|
42
|
-
/** Rotation in degrees */
|
|
43
|
-
rotate?: number;
|
|
44
|
-
/** Scale factor */
|
|
45
|
-
scale?: number;
|
|
46
|
-
/** Speed multiplier (default: 1) */
|
|
47
|
-
speed?: number;
|
|
48
|
-
}
|
|
49
36
|
/** Per-element animation options */
|
|
50
37
|
interface AnimateOptions {
|
|
51
38
|
/** Animation preset name, array of presets, or custom animation object */
|
|
@@ -68,8 +55,6 @@ interface AnimateOptions {
|
|
|
68
55
|
offset?: number;
|
|
69
56
|
/** Stagger delay for child elements in ms (default: 0) */
|
|
70
57
|
stagger?: number;
|
|
71
|
-
/** Parallax effect configuration */
|
|
72
|
-
parallax?: ParallaxOptions;
|
|
73
58
|
/** Callback fired when animation starts */
|
|
74
59
|
onStart?: (element: Element) => void;
|
|
75
60
|
/** Callback fired when animation completes */
|
|
@@ -80,7 +65,7 @@ interface AnimateOptions {
|
|
|
80
65
|
onLeave?: (element: Element) => void;
|
|
81
66
|
/** Callback fired with scroll progress (0 to 1) */
|
|
82
67
|
onProgress?: (element: Element, progress: number) => void;
|
|
83
|
-
/** How progress for `onProgress
|
|
68
|
+
/** How progress for `onProgress`/`progressVar` is measured (default: 'ratio') */
|
|
84
69
|
progressMode?: ProgressMode;
|
|
85
70
|
/**
|
|
86
71
|
* Name of a CSS custom property (e.g. `'--sa-progress'`) that receives the
|
|
@@ -133,7 +118,7 @@ interface StaggerOptions extends AnimateOptions {
|
|
|
133
118
|
* Provides useScrollAnimate and useScrollStagger composables for Vue 3 applications.
|
|
134
119
|
*
|
|
135
120
|
* A thin wrapper around the core engine, so it shares its behaviour: `once`,
|
|
136
|
-
* `offset`, custom easing functions,
|
|
121
|
+
* `offset`, custom easing functions, progress, `prefers-reduced-motion`
|
|
137
122
|
* support, and cleanup on unmount.
|
|
138
123
|
*/
|
|
139
124
|
|
package/dist/vue.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as createScrollAnimate } from './chunks/core-
|
|
2
|
-
import { s as staggerChildren } from './chunks/stagger-
|
|
1
|
+
import { c as createScrollAnimate } from './chunks/core-mV_TPgG_.js';
|
|
2
|
+
import { s as staggerChildren } from './chunks/stagger-BFAhKknX.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* use-scroll-animate - Vue 3 Integration
|
|
6
6
|
* Provides useScrollAnimate and useScrollStagger composables for Vue 3 applications.
|
|
7
7
|
*
|
|
8
8
|
* A thin wrapper around the core engine, so it shares its behaviour: `once`,
|
|
9
|
-
* `offset`, custom easing functions,
|
|
9
|
+
* `offset`, custom easing functions, progress, `prefers-reduced-motion`
|
|
10
10
|
* support, and cleanup on unmount.
|
|
11
11
|
*/
|
|
12
12
|
/** Support refs on components (`$el`) as well as plain elements. */
|
package/dist/vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.js","sources":["../src/vue.ts"],"sourcesContent":["/**\n * use-scroll-animate - Vue 3 Integration\n * Provides useScrollAnimate and useScrollStagger composables for Vue 3 applications.\n *\n * A thin wrapper around the core engine, so it shares its behaviour: `once`,\n * `offset`, custom easing functions,
|
|
1
|
+
{"version":3,"file":"vue.js","sources":["../src/vue.ts"],"sourcesContent":["/**\n * use-scroll-animate - Vue 3 Integration\n * Provides useScrollAnimate and useScrollStagger composables for Vue 3 applications.\n *\n * A thin wrapper around the core engine, so it shares its behaviour: `once`,\n * `offset`, custom easing functions, progress, `prefers-reduced-motion`\n * support, and cleanup on unmount.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate } from './core';\nimport { staggerChildren, type StaggerOptions } from './stagger';\n\n/** Support refs on components (`$el`) as well as plain elements. */\nfunction unwrap(value: unknown): Element | null {\n if (value && typeof Element !== 'undefined' && !(value instanceof Element) && (value as any).$el instanceof Element) {\n return (value as any).$el as Element;\n }\n return (value as Element | null) || null;\n}\n\nexport function createVueComposables(Vue: {\n ref: <T>(value: T | null) => { value: T | null };\n onMounted: (fn: () => void) => void;\n onUnmounted: (fn: () => void) => void;\n}) {\n // Created lazily on the client so importing on the server is side-effect free.\n let instance: ScrollAnimateInstance | null = null;\n const getInstance = () => instance || (instance = createScrollAnimate());\n\n function useScrollAnimate(options: AnimateOptions = {}) {\n const animateRef = Vue.ref<Element>(null);\n let el: Element | null = null;\n\n Vue.onMounted(() => {\n const target = unwrap(animateRef.value);\n if (!target) return;\n el = target;\n getInstance().observe(el, options);\n });\n\n Vue.onUnmounted(() => {\n if (el) getInstance().unobserve(el);\n el = null;\n });\n\n return { animateRef };\n }\n\n /** Stagger the children of `staggerRef`; `observeChildren: true` also animates children added later. */\n function useScrollStagger(options: StaggerOptions = {}) {\n const staggerRef = Vue.ref<Element>(null);\n let stop: (() => void) | undefined;\n\n Vue.onMounted(() => {\n const target = unwrap(staggerRef.value);\n if (target) stop = staggerChildren(target, options, getInstance());\n });\n\n Vue.onUnmounted(() => {\n stop?.();\n stop = undefined;\n });\n\n return { staggerRef };\n }\n\n return { useScrollAnimate, useScrollStagger };\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;;AAOG;AAMH;AACA,SAAS,MAAM,CAAC,KAAc,EAAA;IAC5B,IAAI,KAAK,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,EAAE,KAAK,YAAY,OAAO,CAAC,IAAK,KAAa,CAAC,GAAG,YAAY,OAAO,EAAE;QACnH,OAAQ,KAAa,CAAC,GAAc;IACtC;IACA,OAAQ,KAAwB,IAAI,IAAI;AAC1C;AAEM,SAAU,oBAAoB,CAAC,GAIpC,EAAA;;IAEC,IAAI,QAAQ,GAAiC,IAAI;AACjD,IAAA,MAAM,WAAW,GAAG,MAAM,QAAQ,KAAK,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IAExE,SAAS,gBAAgB,CAAC,OAAA,GAA0B,EAAE,EAAA;QACpD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAU,IAAI,CAAC;QACzC,IAAI,EAAE,GAAmB,IAAI;AAE7B,QAAA,GAAG,CAAC,SAAS,CAAC,MAAK;YACjB,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;AACvC,YAAA,IAAI,CAAC,MAAM;gBAAE;YACb,EAAE,GAAG,MAAM;YACX,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC;AACpC,QAAA,CAAC,CAAC;AAEF,QAAA,GAAG,CAAC,WAAW,CAAC,MAAK;AACnB,YAAA,IAAI,EAAE;AAAE,gBAAA,WAAW,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,EAAE,GAAG,IAAI;AACX,QAAA,CAAC,CAAC;QAEF,OAAO,EAAE,UAAU,EAAE;IACvB;;IAGA,SAAS,gBAAgB,CAAC,OAAA,GAA0B,EAAE,EAAA;QACpD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAU,IAAI,CAAC;AACzC,QAAA,IAAI,IAA8B;AAElC,QAAA,GAAG,CAAC,SAAS,CAAC,MAAK;YACjB,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;AACvC,YAAA,IAAI,MAAM;gBAAE,IAAI,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACpE,QAAA,CAAC,CAAC;AAEF,QAAA,GAAG,CAAC,WAAW,CAAC,MAAK;YACnB,IAAI,IAAI;YACR,IAAI,GAAG,SAAS;AAClB,QAAA,CAAC,CAAC;QAEF,OAAO,EAAE,UAAU,EAAE;IACvB;AAEA,IAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE;AAC/C;;;;"}
|
package/docs/API.md
CHANGED
|
@@ -74,7 +74,6 @@ const sa = createScrollAnimate({ defaultDuration: 800, defaultEngine: 'auto' });
|
|
|
74
74
|
| `stagger` | `number` (ms) | `0` | Extra delay per sibling revealed in the same batch |
|
|
75
75
|
| `engine` | `'auto' \| 'js' \| 'css'` | `'auto'` | `'auto'`: native scroll-driven timeline when supported, else JS — and JS when the element sets `duration`/`delay`/`offset`/`stagger`; `'css'`: native whenever supported; `'js'`: always time-based |
|
|
76
76
|
| `viewRange` | `[string, string]` | `['entry 0%', 'entry 100%']` | Native engine: view-timeline range of the entrance |
|
|
77
|
-
| `parallax` | `{ x?, y?, rotate?, scale?, speed? }` | `{}` | Legacy transform-based parallax (writes `transform`); see also `parallax()` |
|
|
78
77
|
| `progressMode` | `'ratio' \| 'scroll'` | `'ratio'` | `onProgress` source: visible ratio, or true scroll progress (0 = top enters at the bottom, 1 = bottom leaves at the top) |
|
|
79
78
|
| `progressVar` | `string` | – | CSS custom property that receives the progress |
|
|
80
79
|
| `onEnter` / `onLeave` | `(el) => void` | – | Viewport entry / exit |
|
|
@@ -85,7 +84,7 @@ const sa = createScrollAnimate({ defaultDuration: 800, defaultEngine: 'auto' });
|
|
|
85
84
|
|
|
86
85
|
Mark elements with `data-sa` and call `init()` / `watch()`. Every option has an attribute:
|
|
87
86
|
|
|
88
|
-
`data-sa-animation` (comma-separated to combine), `data-sa-duration`, `data-sa-delay`, `data-sa-easing` (name, CSS string or JSON array), `data-sa-threshold` (comma-separated list allowed), `data-sa-root-margin`, `data-sa-offset`, `data-sa-once`, `data-sa-repeat`, `data-sa-exit` (bare = `true`, or preset name), `data-sa-stagger`, `data-sa-engine`, `data-sa-view-range` (`"entry 0%, cover 40%"`), `data-sa-progress` (`"scroll"`), `data-sa-progress-var` (bare = `--sa-progress`)
|
|
87
|
+
`data-sa-animation` (comma-separated to combine), `data-sa-duration`, `data-sa-delay`, `data-sa-easing` (name, CSS string or JSON array), `data-sa-threshold` (comma-separated list allowed), `data-sa-root-margin`, `data-sa-offset`, `data-sa-once`, `data-sa-repeat`, `data-sa-exit` (bare = `true`, or preset name), `data-sa-stagger`, `data-sa-engine`, `data-sa-view-range` (`"entry 0%, cover 40%"`), `data-sa-progress` (`"scroll"`), `data-sa-progress-var` (bare = `--sa-progress`).
|
|
89
88
|
|
|
90
89
|
Boolean attributes are true when present unless their value is `"false"`.
|
|
91
90
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Accessibility (`use-scroll-animate/components`)
|
|
2
|
+
|
|
3
|
+
Audited in v2.9 (automated sweep in `test/components-a11y-frameworks.test.ts` + per-component tests).
|
|
4
|
+
|
|
5
|
+
## Motion
|
|
6
|
+
- Every `<usa-*>` element honours **`prefers-reduced-motion: reduce`**: entrances fade or appear, loops/particles/cursors stop, springs jump to their target, page transitions update instantly. Override per app with `configureComponents({ reducedMotion: 'reduce' | 'no-preference' | 'user' })`.
|
|
7
|
+
- **Global motion intensity** (v2.7): `setMotionIntensity('off' | 'low' | 'normal' | 'high', persist)` or let users choose with `<usa-motion-switch>`. `off` behaves exactly like reduced motion; `low` shortens every animation to 60 %.
|
|
8
|
+
- No component flashes more than 3×/s; glitch and grain effects are disabled under reduced motion.
|
|
9
|
+
|
|
10
|
+
## Keyboard
|
|
11
|
+
| Component | Keys |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `<usa-toggle>`, `<usa-checkbox>`, `<usa-like>` | Space / Enter |
|
|
14
|
+
| `<usa-hold>` | hold Space / Enter |
|
|
15
|
+
| `<usa-slider>` | ←/→/↑/↓, PageUp/PageDown, Home/End |
|
|
16
|
+
| `<usa-rating>` | ←/→, number keys, Home/End |
|
|
17
|
+
| `<usa-tabs>` | ←/→/↑/↓, Home/End (roving tabindex) |
|
|
18
|
+
| `<usa-draggable>` | arrows (by `step` / `snap`), Home / Esc resets |
|
|
19
|
+
| `<usa-card-stack>` | ← / → swipe |
|
|
20
|
+
| `<usa-carousel-3d>` | ← / → |
|
|
21
|
+
| `<usa-fullpage>` | PageUp/PageDown, ↑/↓, Space, Home/End |
|
|
22
|
+
| `<usa-card effect="flip" trigger="click">`, `effect="expand"` | Enter / Space; Esc collapses |
|
|
23
|
+
| `<usa-drawer>`, `<usa-bottom-sheet>`, `<usa-popover>`, `<usa-fab>`, `<usa-tooltip>`, `<usa-dialog>` | Esc closes, focus returns to the trigger |
|
|
24
|
+
| `<usa-double-tap>` | `L` |
|
|
25
|
+
|
|
26
|
+
## Roles & states
|
|
27
|
+
`switch` (toggle), `checkbox` (+ `aria-checked="mixed"`), `slider` (slider, rating; `aria-valuenow/-text`), `tablist`/`tab`/`tabpanel`, `dialog` + `aria-modal` (drawer, sheet, dialog, popover), `button` + `aria-pressed` (like, click-flip card, icon-morph toggle) / `aria-expanded` (fab, popover, expand card), `progressbar` (progress, loading bar, scroll progress), `status` live regions (toasts, submit button, pull-to-refresh, badge), `radiogroup` (motion switch), `aria-busy` while loading (submit, pull-refresh, auto-skeleton, splash).
|
|
28
|
+
|
|
29
|
+
Animated text (`<usa-split-text>`, `<usa-typewriter>`, `<usa-wave-text>`, `<usa-handwriting>`, `<usa-scroll-highlight>` …) renders an `aria-hidden` animated copy plus a visually hidden plain copy. Decorative layers (`<usa-cursor>`, `<usa-ambient>`, particles, sheens, goo) are `aria-hidden` and never take pointer events.
|
|
30
|
+
|
|
31
|
+
## Transparency & contrast
|
|
32
|
+
Glass, acrylic and Fluent materials fall back to solid surfaces under `prefers-reduced-transparency: reduce` and `forced-colors: active`.
|