use-scroll-animate 2.9.0 → 3.1.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 +34 -0
- package/README.md +4 -3
- package/README_ja.md +1 -0
- package/README_zh.md +2 -1
- package/dist/chunks/{base-BkQcvoSG.cjs → base-CXx7jZ-o.cjs} +4 -23
- package/dist/chunks/{base-BkQcvoSG.cjs.map → base-CXx7jZ-o.cjs.map} +1 -1
- package/dist/chunks/{base-CB8gChoe.js → base-Cu-86Z31.js} +5 -24
- package/dist/chunks/{base-CB8gChoe.js.map → base-Cu-86Z31.js.map} +1 -1
- package/dist/chunks/{core-J_KM443q.js → core-mV_TPgG_.js} +2 -52
- package/dist/chunks/core-mV_TPgG_.js.map +1 -0
- package/dist/chunks/{core-C1cEwjJj.cjs → core-qpECfEkb.cjs} +2 -52
- package/dist/chunks/core-qpECfEkb.cjs.map +1 -0
- package/dist/chunks/{index-tags-f37txHmb.js → index-tags-D7NynL4r.js} +2 -1
- package/dist/chunks/{index-tags-f37txHmb.js.map → index-tags-D7NynL4r.js.map} +1 -1
- package/dist/chunks/{index-tags-BEM98giN.cjs → index-tags-Gw1G06Pb.cjs} +2 -1
- package/dist/chunks/{index-tags-BEM98giN.cjs.map → index-tags-Gw1G06Pb.cjs.map} +1 -1
- package/dist/chunks/{spring-7U9MC6yQ.cjs → spring-2OTnYCzm.cjs} +2 -2
- package/dist/chunks/{spring-7U9MC6yQ.cjs.map → spring-2OTnYCzm.cjs.map} +1 -1
- package/dist/chunks/{spring-ka0YJ_ZR.js → spring-BV-cpTHC.js} +2 -2
- package/dist/chunks/{spring-ka0YJ_ZR.js.map → spring-BV-cpTHC.js.map} +1 -1
- package/dist/chunks/{stagger-CGF18oNs.js → stagger-BFAhKknX.js} +2 -2
- package/dist/chunks/{stagger-CGF18oNs.js.map → stagger-BFAhKknX.js.map} +1 -1
- package/dist/chunks/{stagger-DtKKS6GP.cjs → stagger-CLc3j58T.cjs} +2 -2
- package/dist/chunks/{stagger-DtKKS6GP.cjs.map → stagger-CLc3j58T.cjs.map} +1 -1
- package/dist/chunks/{variants-PsCXbQ5h.cjs → variants-BNIrn4ch.cjs} +2 -2
- package/dist/chunks/{variants-PsCXbQ5h.cjs.map → variants-BNIrn4ch.cjs.map} +1 -1
- package/dist/chunks/{variants-Ce9CboVc.js → variants-BQ3gCb5L.js} +2 -2
- package/dist/chunks/{variants-Ce9CboVc.js.map → variants-BQ3gCb5L.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 +9 -16
- package/dist/components/feedback.cjs.map +1 -1
- package/dist/components/feedback.css +2 -2
- package/dist/components/feedback.d.cts +2 -4
- package/dist/components/feedback.d.ts +2 -4
- package/dist/components/feedback.js +10 -17
- 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.d.cts +1 -0
- package/dist/components/jsx.d.ts +1 -0
- 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/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 +1 -1
- package/dist/components/react.js +1 -1
- 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/timeline.cjs +303 -0
- package/dist/components/timeline.cjs.map +1 -0
- package/dist/components/timeline.css +3 -0
- package/dist/components/timeline.d.cts +164 -0
- package/dist/components/timeline.d.ts +164 -0
- package/dist/components/timeline.js +296 -0
- package/dist/components/timeline.js.map +1 -0
- package/dist/components/transitions.cjs +7 -7
- 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 +8 -8
- 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 +5 -4
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +91 -6
- package/dist/components/vue.d.ts +91 -6
- package/dist/components/vue.js +5 -4
- package/dist/components/vue.js.map +1 -1
- package/dist/components.cjs +11 -4
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +4 -3
- package/dist/components.d.cts +124 -8
- package/dist/components.d.ts +124 -8
- package/dist/components.js +10 -7
- 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/components.md +12 -3
- package/docs/upgrading-3.md +1 -0
- package/package.json +14 -3
- package/dist/chunks/core-C1cEwjJj.cjs.map +0 -1
- package/dist/chunks/core-J_KM443q.js.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-CGF18oNs.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
|
|
package/docs/components.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Animated components (`use-scroll-animate/components`)
|
|
2
2
|
|
|
3
|
-
Since **v2.2** the package ships **30 animated UI components** as standard Web Components (`<usa-*>` custom elements) plus three transition helpers. They are built only on Custom Elements, CSS and the Web Animations API, so the same code runs:
|
|
3
|
+
Since **v2.2** (now **v3**) the package ships **30 animated UI components** as standard Web Components (`<usa-*>` custom elements) plus three transition helpers. They are built only on Custom Elements, CSS and the Web Animations API, so the same code runs:
|
|
4
4
|
|
|
5
5
|
- in any modern browser (Chrome, Edge, Firefox, Safari), and with React, Vue, Svelte, Solid, Angular or no framework;
|
|
6
6
|
- in **Windows desktop software** that renders its UI with a web view — Electron, Tauri (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs. See **[Windows apps guide](./windows-apps.md)**.
|
|
@@ -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@3/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
|
```
|
|
@@ -157,7 +157,7 @@ Presets (`SPRING_PRESETS`): `default` (170/26), `gentle` (120/14), `wobbly` (180
|
|
|
157
157
|
|
|
158
158
|
### 10. UI components & variants — `components/ui`
|
|
159
159
|
|
|
160
|
-
**Style variants.** `variant="minimal | neon | glass | brutalist | fluent | material"` works on every `<usa-*>` element (or `data-usa-variant` on an ancestor, or `setVariant('fluent')` page-wide). Variants only set design tokens — `--usa-accent`, `--usa-accent-text`, `--usa-surface`, `--usa-text`, `--usa-radius`, `--usa-border`, `--usa-shadow`, `--usa-blur`, `--usa-font` — which you can also set yourself. (
|
|
160
|
+
**Style variants.** `variant="minimal | neon | glass | brutalist | fluent | material"` works on every `<usa-*>` element (or `data-usa-variant` on an ancestor, or `setVariant('fluent')` page-wide). Variants only set design tokens — `--usa-accent`, `--usa-accent-text`, `--usa-surface`, `--usa-text`, `--usa-radius`, `--usa-border`, `--usa-shadow`, `--usa-blur`, `--usa-font` — which you can also set yourself. (`<usa-spinner>`, `<usa-check>`, `<usa-dialog>` and `<usa-acrylic>` pick their kind with `kind`; since 3.0 `variant` is only a style variant everywhere.)
|
|
161
161
|
|
|
162
162
|
| Element | What it does | Key attributes | JS API / events |
|
|
163
163
|
|---|---|---|---|
|
|
@@ -231,6 +231,15 @@ Every component reads these CSS custom properties (set them on `:root`, any ance
|
|
|
231
231
|
|
|
232
232
|
See [frameworks-ssr.md](./frameworks-ssr.md) and [accessibility.md](./accessibility.md).
|
|
233
233
|
|
|
234
|
+
### v3.1 Timeline & choreography (`components/timeline`)
|
|
235
|
+
|
|
236
|
+
| Element / API | What it does | Key options |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| `timeline(opts)` | One playhead for many animations | `.to(target, frames \| preset, { at, duration, easing, stagger })`, `.label()`, `.call()`, `play()`, `reverse()`, `seek()`, `progress()`, `scrub(el, { smooth })` |
|
|
239
|
+
| `<usa-timeline>` | `data-tl` children become steps | `trigger` (`view` · `click` · `manual`), `scrub`, `overlap`, `duration`, `stagger`, `repeat`; child `data-at`, `data-duration`, `data-label` |
|
|
240
|
+
|
|
241
|
+
Positions: `'>'` chain (default) · `'<'` with previous · `'-=200'` overlap · `'+=100'` gap · `'<+=50'` · `'label+=100'` · ms.
|
|
242
|
+
|
|
234
243
|
## Frameworks
|
|
235
244
|
|
|
236
245
|
Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
|
package/docs/upgrading-3.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
| `spinner.variant` property | `spinner.kind` |
|
|
9
9
|
| `observe(el, { parallax: { y: 80 } })`, `data-sa-parallax-x/-y/-rotate/-scale/-speed` | `parallax(el, { speed: 0.3 })` (writes `--sa-parallax`, use it in CSS: `transform: translateY(calc(var(--sa-parallax) * -80px))`) or `progressVar: '--p'` |
|
|
10
10
|
| `ParallaxOptions` type | `ParallaxHelperOptions` |
|
|
11
|
+
| `data-variant` on spinner / check / dialog (internal styling hook) | `data-kind` |
|
|
11
12
|
| Node 18 for SSR imports | Node ≥ 20 (`engines`) |
|
|
12
13
|
|
|
13
14
|
Search & replace:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-scroll-animate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.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",
|
|
@@ -188,6 +188,16 @@
|
|
|
188
188
|
"default": "./dist/components/page.cjs"
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
|
+
"./components/timeline": {
|
|
192
|
+
"import": {
|
|
193
|
+
"types": "./dist/components/timeline.d.ts",
|
|
194
|
+
"default": "./dist/components/timeline.js"
|
|
195
|
+
},
|
|
196
|
+
"require": {
|
|
197
|
+
"types": "./dist/components/timeline.d.cts",
|
|
198
|
+
"default": "./dist/components/timeline.cjs"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
191
201
|
"./components/react": {
|
|
192
202
|
"import": {
|
|
193
203
|
"types": "./dist/components/react.d.ts",
|
|
@@ -240,6 +250,7 @@
|
|
|
240
250
|
"./components/click.css": "./dist/components/click.css",
|
|
241
251
|
"./components/ui.css": "./dist/components/ui.css",
|
|
242
252
|
"./components/page.css": "./dist/components/page.css",
|
|
253
|
+
"./components/timeline.css": "./dist/components/timeline.css",
|
|
243
254
|
"./package.json": "./package.json"
|
|
244
255
|
},
|
|
245
256
|
"files": [
|
|
@@ -260,7 +271,7 @@
|
|
|
260
271
|
"typecheck": "tsc --noEmit -p .",
|
|
261
272
|
"test": "vitest run",
|
|
262
273
|
"check:exports": "node scripts/check-exports.mjs",
|
|
263
|
-
"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 ./components/click.css ./components/ui.css ./components/page.css",
|
|
274
|
+
"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 ./components/click.css ./components/ui.css ./components/page.css ./components/timeline.css",
|
|
264
275
|
"size": "node scripts/size.mjs",
|
|
265
276
|
"prepublishOnly": "npm run typecheck && npm test && npm run build && npm run check:exports",
|
|
266
277
|
"size:check": "node scripts/size.mjs --check",
|
|
@@ -332,6 +343,6 @@
|
|
|
332
343
|
}
|
|
333
344
|
},
|
|
334
345
|
"engines": {
|
|
335
|
-
"node": ">=
|
|
346
|
+
"node": ">=20"
|
|
336
347
|
}
|
|
337
348
|
}
|