use-scroll-animate 3.9.0 → 4.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 +27 -0
- package/README.md +16 -14
- package/README_ja.md +10 -11
- package/README_zh.md +11 -12
- package/dist/chunks/{base-Dm6ee5ug.cjs → base-CXx7jZ-o.cjs} +1 -11
- package/dist/chunks/{base-Dm6ee5ug.cjs.map → base-CXx7jZ-o.cjs.map} +1 -1
- package/dist/chunks/{base-BRIPyPtX.js → base-ZARFccur.js} +2 -11
- package/dist/chunks/{base-BRIPyPtX.js.map → base-ZARFccur.js.map} +1 -1
- package/dist/chunks/core-Co-6AL0h.js +218 -0
- package/dist/chunks/core-Co-6AL0h.js.map +1 -0
- package/dist/chunks/{core-CYozf_E-.js → core-DKY-fVzR.js} +2 -2
- package/dist/chunks/{core-CYozf_E-.js.map → core-DKY-fVzR.js.map} +1 -1
- package/dist/chunks/core-DXqZm5Il.cjs +222 -0
- package/dist/chunks/core-DXqZm5Il.cjs.map +1 -0
- package/dist/chunks/{core-CHAtivHV.cjs → core-IaorbTdu.cjs} +2 -2
- package/dist/chunks/{core-CHAtivHV.cjs.map → core-IaorbTdu.cjs.map} +1 -1
- package/dist/chunks/{index-tags-BmQR17Sb.js → index-tags-43Xtd01A.js} +2 -2
- package/dist/chunks/index-tags-43Xtd01A.js.map +1 -0
- package/dist/chunks/{index-tags-DYYsgbba.cjs → index-tags-BQh_uGqH.cjs} +2 -2
- package/dist/chunks/index-tags-BQh_uGqH.cjs.map +1 -0
- package/dist/chunks/{spring-Dp5BllPB.cjs → spring-2OTnYCzm.cjs} +2 -2
- package/dist/chunks/{spring-Dp5BllPB.cjs.map → spring-2OTnYCzm.cjs.map} +1 -1
- package/dist/chunks/{spring-UBPhrh1X.js → spring-E2ickYNI.js} +2 -2
- package/dist/chunks/{spring-UBPhrh1X.js.map → spring-E2ickYNI.js.map} +1 -1
- package/dist/chunks/{variants-_dC-ey6R.cjs → variants-BNIrn4ch.cjs} +2 -2
- package/dist/chunks/{variants-_dC-ey6R.cjs.map → variants-BNIrn4ch.cjs.map} +1 -1
- package/dist/chunks/{variants-DTypaOH3.js → variants-DvnxvRCM.js} +2 -2
- package/dist/chunks/{variants-DTypaOH3.js.map → variants-DvnxvRCM.js.map} +1 -1
- package/dist/components/angular.cjs +6 -5
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +4 -17
- package/dist/components/angular.d.ts +4 -17
- package/dist/components/angular.js +6 -5
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs +2 -2
- package/dist/components/background.js +3 -3
- 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/depth.cjs +3 -3
- package/dist/components/depth.js +4 -4
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.js +2 -2
- package/dist/components/gesture.cjs +3 -3
- package/dist/components/gesture.js +5 -5
- package/dist/components/interaction.cjs +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/jsx.d.cts +1 -1
- package/dist/components/jsx.d.ts +1 -1
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.js +2 -2
- package/dist/components/lazy.cjs +1 -1
- package/dist/components/lazy.d.cts +1 -1
- package/dist/components/lazy.d.ts +1 -1
- package/dist/components/lazy.js +1 -1
- package/dist/components/packs.cjs +1 -1
- package/dist/components/packs.js +2 -2
- 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 +2 -2
- package/dist/components/react.cjs.map +1 -1
- package/dist/components/react.d.cts +1 -1
- package/dist/components/react.d.ts +1 -1
- package/dist/components/react.js +2 -2
- package/dist/components/react.js.map +1 -1
- package/dist/components/reveal.cjs +1 -1
- package/dist/components/reveal.js +2 -2
- package/dist/components/solid.cjs +6 -5
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +4 -17
- package/dist/components/solid.d.ts +4 -17
- package/dist/components/solid.js +6 -5
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +6 -5
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +4 -17
- package/dist/components/svelte.d.ts +4 -17
- package/dist/components/svelte.js +6 -5
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs +1 -1
- package/dist/components/svg.js +2 -2
- package/dist/components/text.cjs +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.cjs +7 -220
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.js +5 -217
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/transitions.cjs +8 -125
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.css +0 -1
- package/dist/components/transitions.d.cts +5 -34
- package/dist/components/transitions.d.ts +5 -34
- package/dist/components/transitions.js +10 -125
- 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 +6 -5
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +4 -17
- package/dist/components/vue.d.ts +4 -17
- package/dist/components/vue.js +6 -5
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +1 -1
- package/dist/components/webgl.js +2 -2
- package/dist/components.cjs +12 -13
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +0 -1
- package/dist/components.d.cts +6 -35
- package/dist/components.d.ts +6 -35
- package/dist/components.js +10 -9
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/index.cjs +5 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -32
- package/dist/index.d.ts +72 -32
- package/dist/index.js +4 -110
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/docs/API.md +6 -6
- package/docs/ROADMAP.md +14 -0
- package/docs/components.md +3 -5
- package/docs/migration-from-aos.md +1 -1
- package/docs/migration-from-gsap-scrolltrigger.md +6 -6
- package/package.json +1 -1
- package/dist/chunks/index-tags-BmQR17Sb.js.map +0 -1
- package/dist/chunks/index-tags-DYYsgbba.cjs.map +0 -1
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/presets.ts","../src/core.ts","../src/stagger.ts","../src/sequence.ts","../src/parallax.ts","../src/index.ts"],"sourcesContent":["/**\n * use-scroll-animate - Animation Presets\n * Defines keyframes for all built-in animation presets\n */\n\nimport type { AnimationPreset, CustomAnimation, EasingType } from './types';\n\ntype KeyframeMap = {\n from: Record<string, string | number>;\n to: Record<string, string | number>;\n};\n\nexport const PRESETS: Record<AnimationPreset, KeyframeMap> = {\n 'fade-in': {\n from: { opacity: 0 },\n to: { opacity: 1 },\n },\n 'fade-in-up': {\n from: { opacity: 0, transform: 'translateY(40px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'fade-in-down': {\n from: { opacity: 0, transform: 'translateY(-40px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'fade-in-left': {\n from: { opacity: 0, transform: 'translateX(-40px)' },\n to: { opacity: 1, transform: 'translateX(0px)' },\n },\n 'fade-in-right': {\n from: { opacity: 0, transform: 'translateX(40px)' },\n to: { opacity: 1, transform: 'translateX(0px)' },\n },\n 'zoom-in': {\n from: { opacity: 0, transform: 'scale(0.8)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'zoom-out': {\n from: { opacity: 0, transform: 'scale(1.2)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'flip-x': {\n from: { opacity: 0, transform: 'rotateX(-90deg)' },\n to: { opacity: 1, transform: 'rotateX(0deg)' },\n },\n 'flip-y': {\n from: { opacity: 0, transform: 'rotateY(-90deg)' },\n to: { opacity: 1, transform: 'rotateY(0deg)' },\n },\n 'slide-up': {\n from: { transform: 'translateY(100%)' },\n to: { transform: 'translateY(0px)' },\n },\n 'slide-down': {\n from: { transform: 'translateY(-100%)' },\n to: { transform: 'translateY(0px)' },\n },\n 'slide-left': {\n from: { transform: 'translateX(-100%)' },\n to: { transform: 'translateX(0px)' },\n },\n 'slide-right': {\n from: { transform: 'translateX(100%)' },\n to: { transform: 'translateX(0px)' },\n },\n 'bounce': {\n from: { opacity: 0, transform: 'translateY(-60px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'rotate-in': {\n from: { opacity: 0, transform: 'rotate(-180deg) scale(0.5)' },\n to: { opacity: 1, transform: 'rotate(0deg) scale(1)' },\n },\n 'blur-in': {\n from: { opacity: 0, filter: 'blur(12px)' },\n to: { opacity: 1, filter: 'blur(0px)' },\n },\n 'skew-in': {\n from: { opacity: 0, transform: 'skewX(20deg) translateX(30px)' },\n to: { opacity: 1, transform: 'skewX(0deg) translateX(0px)' },\n },\n 'scale-x': {\n from: { transform: 'scaleX(0)' },\n to: { transform: 'scaleX(1)' },\n },\n 'scale-y': {\n from: { transform: 'scaleY(0)' },\n to: { transform: 'scaleY(1)' },\n },\n 'shimmer': {\n from: { opacity: 0.5, filter: 'brightness(1)' },\n to: { opacity: 1, filter: 'brightness(1.5)' },\n },\n 'pulse': {\n from: { transform: 'scale(1)' },\n to: { transform: 'scale(1.05)' },\n },\n 'swing': {\n from: { transform: 'rotate(-10deg)' },\n to: { transform: 'rotate(10deg)' },\n },\n 'scale-up': {\n from: { opacity: 0, transform: 'scale(0.5)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'blur-in-up': {\n from: { opacity: 0, filter: 'blur(12px)', transform: 'translateY(40px)' },\n to: { opacity: 1, filter: 'blur(0px)', transform: 'translateY(0px)' },\n },\n 'flip-up': {\n from: { opacity: 0, transform: 'perspective(800px) rotateX(60deg)' },\n to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },\n },\n 'flip-down': {\n from: { opacity: 0, transform: 'perspective(800px) rotateX(-60deg)' },\n to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },\n },\n 'rotate-left': {\n from: { opacity: 0, transform: 'rotate(-15deg) translateX(-40px)' },\n to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },\n },\n 'rotate-right': {\n from: { opacity: 0, transform: 'rotate(15deg) translateX(40px)' },\n to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },\n },\n // clip-path reveals: content is uncovered without moving or fading\n 'clip-up': {\n from: { clipPath: 'inset(100% 0% 0% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-down': {\n from: { clipPath: 'inset(0% 0% 100% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-left': {\n from: { clipPath: 'inset(0% 0% 0% 100%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-right': {\n from: { clipPath: 'inset(0% 100% 0% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-circle': {\n from: { clipPath: 'circle(0% at 50% 50%)' },\n to: { clipPath: 'circle(75% at 50% 50%)' },\n },\n};\n\nexport function resolvePreset(animation: AnimationPreset | AnimationPreset[] | CustomAnimation): KeyframeMap {\n if (typeof animation === 'string') {\n return PRESETS[animation.trim() as AnimationPreset] ?? PRESETS['fade-in-up'];\n }\n \n if (Array.isArray(animation)) {\n const combined: KeyframeMap = { from: {}, to: {} };\n animation.forEach(name => {\n const preset = PRESETS[name.trim() as AnimationPreset];\n if (preset) {\n Object.entries(preset.from).forEach(([key, val]) => {\n if (key === 'transform' && combined.from[key]) {\n combined.from[key] = `${combined.from[key]} ${val}`;\n } else {\n combined.from[key] = val;\n }\n });\n Object.entries(preset.to).forEach(([key, val]) => {\n if (key === 'transform' && combined.to[key]) {\n combined.to[key] = `${combined.to[key]} ${val}`;\n } else {\n combined.to[key] = val;\n }\n });\n }\n });\n return combined;\n }\n \n return animation;\n}\n\n/** Easing to CSS cubic-bezier mapping */\nexport const EASING_MAP: Record<string, string> = {\n linear: 'linear',\n ease: 'ease',\n 'ease-in': 'ease-in',\n 'ease-out': 'ease-out',\n 'ease-in-out': 'ease-in-out',\n spring: 'cubic-bezier(0.34, 1.56, 0.64, 1)',\n 'soft-spring': 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',\n 'heavy-bounce': 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',\n};\n\nexport function resolveEasing(easing: EasingType): string {\n if (typeof easing === 'string') {\n return EASING_MAP[easing] ?? easing;\n }\n if (Array.isArray(easing)) {\n return `cubic-bezier(${easing.join(', ')})`;\n }\n if (typeof easing === 'function') {\n // Functions cannot be expressed as a CSS easing string; the core samples\n // them into a `linear()` easing (or keyframes on older browsers).\n return 'linear';\n }\n return 'ease';\n}\n","/**\n * use-scroll-animate - Core Implementation\n * Uses IntersectionObserver + Web Animations API for zero-dependency,\n * high-performance scroll-triggered animations.\n */\n\nimport type {\n AnimateOptions,\n AnimatedElement,\n ScrollAnimateConfig,\n ScrollAnimateInstance,\n} from './types';\nimport { resolvePreset, resolveEasing } from './presets';\n\ntype KeyframeMap = ReturnType<typeof resolvePreset>;\ntype Target = string | Element | NodeList | Element[];\ntype Root = Element | Document | null;\n\nconst DEFAULT_CONFIG: Required<ScrollAnimateConfig> = {\n defaultAnimation: 'fade-in-up',\n defaultDuration: 600,\n defaultDelay: 0,\n defaultEasing: 'ease',\n defaultThreshold: 0.1,\n defaultRootMargin: '0px',\n defaultRepeat: false,\n defaultOnce: true,\n defaultOffset: 0,\n hiddenClass: 'sa-hidden',\n visibleClass: 'sa-visible',\n useClassNames: false,\n disabled: false,\n root: null,\n autoUnregister: true,\n defaultEngine: 'auto',\n};\n\nconst noop = () => undefined;\n\n/* ------------------------------------------------------------------ */\n/* Environment helpers (all SSR-safe: never touch globals at import) */\n/* ------------------------------------------------------------------ */\n\nconst hasDOM = (): boolean => typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** @internal */\nexport const supportsObserver = (): boolean => hasDOM() && typeof IntersectionObserver !== 'undefined';\n\nlet reducedMotionQuery: MediaQueryList | null | undefined;\n\n/** @internal Whether the user asked the OS/browser to reduce motion. */\nexport function prefersReducedMotion(): boolean {\n if (!hasDOM()) return false;\n if (reducedMotionQuery === undefined) {\n reducedMotionQuery =\n typeof window.matchMedia === 'function' ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;\n }\n return !!reducedMotionQuery && reducedMotionQuery.matches;\n}\n\nlet scrollTimelineSupported: boolean | undefined;\n\n/**\n * Whether the browser can run presets on a native scroll-driven timeline:\n * `CSS.supports('animation-timeline: view()')` plus the `ViewTimeline`\n * constructor used to attach it from JavaScript. Cached. SSR-safe.\n */\nexport function supportsScrollTimeline(): boolean {\n if (scrollTimelineSupported === undefined) {\n scrollTimelineSupported =\n hasDOM() &&\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('animation-timeline: view()') &&\n typeof (globalThis as any).ViewTimeline === 'function';\n }\n return scrollTimelineSupported;\n}\n\n/** @internal Reset the cached feature checks (tests). */\nexport function resetFeatureCache(): void {\n scrollTimelineSupported = undefined;\n linearSupported = undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* Option parsing */\n/* ------------------------------------------------------------------ */\n\nfunction num(value: string | undefined): number | undefined {\n if (value === undefined || value.trim() === '') return undefined;\n const n = parseFloat(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n\nconst DEFAULT_PROGRESS_VAR = '--sa-progress';\nconst DEFAULT_VIEW_RANGE: [string, string] = ['entry 0%', 'entry 100%'];\n\n/** `''` (bare attribute) -> default name; `sa-progress` -> `--sa-progress`. */\nfunction normalizeVar(name: string): string {\n const v = name.trim();\n if (!v) return DEFAULT_PROGRESS_VAR;\n return v.startsWith('--') ? v : `--${v}`;\n}\n\n/**\n * @internal Read options from string attributes. `get(name)` returns the raw\n * value of the attribute `name` (kebab-case, e.g. `root-margin`), `''` for a\n * bare attribute and `undefined` when absent. Shared by `data-sa-*` and the\n * `<scroll-animate>` element.\n */\nexport function readOptions(get: (name: string) => string | undefined): AnimateOptions {\n const opts: AnimateOptions = {};\n\n const anim = get('animation');\n if (anim) {\n opts.animation = (anim.includes(',') ? anim.split(',').map((s) => s.trim()) : anim.trim()) as any;\n }\n opts.duration = num(get('duration'));\n opts.delay = num(get('delay'));\n const easing = get('easing');\n if (easing) {\n const e = easing.trim();\n if (e.startsWith('[')) {\n try {\n opts.easing = JSON.parse(e);\n } catch {\n // Malformed JSON: fall back to the default easing instead of throwing\n }\n } else {\n opts.easing = e;\n }\n }\n const t = get('threshold');\n if (t) {\n opts.threshold = t.includes(',') ? t.split(',').map(parseFloat).filter(Number.isFinite) : num(t);\n }\n const rootMargin = get('root-margin');\n if (rootMargin) opts.rootMargin = rootMargin;\n const repeat = get('repeat');\n if (repeat !== undefined) opts.repeat = repeat !== 'false';\n const once = get('once');\n if (once !== undefined) opts.once = once !== 'false';\n opts.offset = num(get('offset'));\n opts.stagger = num(get('stagger'));\n const progressVar = get('progress-var');\n if (progressVar !== undefined) opts.progressVar = normalizeVar(progressVar);\n const engine = get('engine')?.trim();\n if (engine === 'auto' || engine === 'js' || engine === 'css') opts.engine = engine;\n const range = get('view-range');\n if (range) {\n const [start, end] = range.split(',').map((s) => s.trim());\n if (start && end) opts.viewRange = [start, end];\n }\n const exit = get('exit');\n if (exit !== undefined) {\n const e = exit.trim();\n opts.exit = e === '' || e === 'true' ? true : e === 'false' ? false : ((e.includes(',') ? e.split(',').map((s) => s.trim()) : e) as any);\n }\n const progress = get('progress');\n if (progress) opts.progressMode = progress.trim() === 'scroll' ? 'scroll' : 'ratio';\n\n // Drop keys that were not set, so they don't override defaults when spread.\n (Object.keys(opts) as Array<keyof AnimateOptions>).forEach((k) => opts[k] === undefined && delete opts[k]);\n return opts;\n}\n\nfunction parseDataAttributes(el: Element, config: Required<ScrollAnimateConfig>): Required<AnimateOptions> {\n return mergeOptions(\n readOptions((name) => {\n const v = el.getAttribute(`data-sa-${name}`);\n return v === null ? undefined : v;\n }),\n config\n );\n}\n\nfunction mergeOptions(opts: AnimateOptions, config: Required<ScrollAnimateConfig>): Required<AnimateOptions> {\n let engine = opts.engine ?? config.defaultEngine;\n // 'auto' keeps time-based semantics when the element asks for them explicitly.\n if (engine === 'auto' && (opts.duration !== undefined || opts.delay !== undefined || opts.offset !== undefined || (opts.stagger ?? 0) > 0)) {\n engine = 'js';\n }\n const exit = opts.exit ?? false;\n const repeat = opts.repeat ?? (exit ? true : config.defaultRepeat);\n const threshold = opts.threshold ?? config.defaultThreshold;\n return {\n animation: opts.animation ?? config.defaultAnimation,\n duration: opts.duration ?? config.defaultDuration,\n delay: opts.delay ?? config.defaultDelay,\n easing: opts.easing ?? config.defaultEasing,\n threshold: Array.isArray(threshold) && threshold.length === 0 ? config.defaultThreshold : threshold,\n rootMargin: opts.rootMargin ?? config.defaultRootMargin,\n repeat,\n once: opts.once ?? (repeat ? false : config.defaultOnce),\n offset: opts.offset ?? config.defaultOffset,\n stagger: opts.stagger ?? 0,\n onStart: opts.onStart ?? noop,\n onComplete: opts.onComplete ?? noop,\n onEnter: opts.onEnter ?? noop,\n onLeave: opts.onLeave ?? noop,\n onProgress: opts.onProgress ?? noop,\n progressMode: opts.progressMode ?? 'ratio',\n progressVar: opts.progressVar ? normalizeVar(opts.progressVar) : '',\n engine,\n viewRange: opts.viewRange ?? DEFAULT_VIEW_RANGE,\n exit,\n };\n}\n\nfunction resolveTargets(target: Target | null | undefined): Element[] {\n if (!target || !hasDOM()) return [];\n if (typeof target === 'string') return Array.from(document.querySelectorAll(target));\n if (target instanceof Element) return [target];\n if (Array.isArray(target) || target instanceof NodeList) {\n return (Array.from(target as ArrayLike<Node>) as Element[]).filter((el) => el instanceof Element);\n }\n return [];\n}\n\n/**\n * Apply `offset` to the bottom edge of a rootMargin, preserving the other\n * three sides. `offset: 100` means \"trigger 100px later\" (bottom -100px).\n * @internal\n */\nexport function applyOffset(rootMargin: string, offset: number): string {\n if (!offset) return rootMargin;\n const parts = (rootMargin || '0px').trim().split(/\\s+/);\n const top = parts[0];\n const right = parts[1] ?? top;\n const bottom = parts[2] ?? top;\n const left = parts[3] ?? right;\n const m = /^(-?\\d*\\.?\\d+)(px)?$/.exec(bottom);\n const base = m ? parseFloat(m[1]) : 0; // non-px bottoms (e.g. %) cannot be combined; offset wins\n return `${top} ${right} ${base - offset}px ${left}`;\n}\n\nfunction needsProgress(opts: Required<AnimateOptions>): boolean {\n return opts.onProgress !== noop || !!opts.progressVar;\n}\n\n/**\n * True scroll progress of `el` through the viewport (or `root`): 0 when its top\n * edge reaches the bottom of the viewport, 1 when its bottom edge passes the top.\n * Works for elements taller than the viewport. Returns 0 without a DOM.\n */\nexport function getScrollProgress(el: Element, root?: Element | null): number {\n if (!hasDOM()) return 0;\n const rect = el.getBoundingClientRect();\n let top = 0;\n let height = window.innerHeight || document.documentElement.clientHeight || 0;\n if (root) {\n const r = root.getBoundingClientRect();\n top = r.top;\n height = r.height;\n }\n const total = height + rect.height;\n if (total <= 0) return 0;\n const p = (top + height - rect.top) / total;\n return p < 0 ? 0 : p > 1 ? 1 : p;\n}\n\n/* ------------------------------------------------------------------ */\n/* Animation */\n/* ------------------------------------------------------------------ */\n\n/** The animation currently running on an element, so it can be cancelled/replaced. */\nconst running = new WeakMap<Element, Animation>();\n/** Native engine: the scroll-linked exit animation, next to the entrance in `running`. */\nconst exits = new WeakMap<Element, Animation>();\nconst timers = new WeakMap<Element, ReturnType<typeof setTimeout>>();\n\nfunction cancelRunning(el: Element): void {\n const exitAnim = exits.get(el);\n if (exitAnim) {\n exits.delete(el);\n exitAnim.cancel();\n }\n const anim = running.get(el);\n if (anim) {\n running.delete(el);\n anim.onfinish = null;\n anim.cancel();\n }\n const timer = timers.get(el);\n if (timer !== undefined) {\n clearTimeout(timer);\n timers.delete(el);\n }\n}\n\nfunction setStyles(el: Element, styles: Record<string, string | number>): void {\n const style = (el as HTMLElement).style;\n if (!style) return;\n Object.keys(styles).forEach((prop) => {\n (style as any)[prop] = String(styles[prop]);\n });\n}\n\nconst NUM_UNIT = /(-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?)([a-z%]*)/gi;\n\n/**\n * Interpolate two CSS values at `t`. Numbers interpolate directly; strings\n * interpolate when they share the same structure (e.g. `translateY(40px)` ->\n * `translateY(0px)`, or `scale(0.8)` -> `scale(1)`). Otherwise snaps at 0.5.\n * @internal\n */\nexport function interpolateValue(from: string | number, to: string | number, t: number): string | number {\n if (typeof from === 'number' && typeof to === 'number') return from + (to - from) * t;\n const a = String(from);\n const b = String(to);\n const ta: Array<[number, string]> = [];\n const tb: Array<[number, string]> = [];\n const skA = a.replace(NUM_UNIT, (_, n, u) => (ta.push([parseFloat(n), u]), '#'));\n const skB = b.replace(NUM_UNIT, (_, n, u) => (tb.push([parseFloat(n), u]), '#'));\n if (skA !== skB || ta.length !== tb.length) return t < 0.5 ? from : to;\n let i = 0;\n let ok = true;\n const out = skA.replace(/#/g, () => {\n const [na, ua] = ta[i];\n const [nb, ub] = tb[i++];\n if (ua !== ub && na !== 0 && nb !== 0 && ua && ub) ok = false;\n const unit = ua || ub;\n return `${+(na + (nb - na) * t).toFixed(4)}${unit}`;\n });\n return ok ? out : t < 0.5 ? from : to;\n}\n\nconst EASING_SAMPLES = 30;\nlet linearSupported: boolean | undefined;\n\nfunction supportsLinearEasing(): boolean {\n if (linearSupported === undefined) {\n linearSupported =\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('animation-timing-function', 'linear(0, 1)');\n }\n return linearSupported;\n}\n\nfunction sampleEasing(fn: (t: number) => number): number[] {\n const values: number[] = [];\n for (let i = 0; i <= EASING_SAMPLES; i++) {\n const v = fn(i / EASING_SAMPLES);\n values.push(Number.isFinite(v) ? +v.toFixed(4) : i / EASING_SAMPLES);\n }\n return values;\n}\n\nfunction buildAnimation(\n preset: KeyframeMap,\n easing: Required<AnimateOptions>['easing']\n): { keyframes: Keyframe[]; easing: string } {\n if (typeof easing !== 'function') {\n return { keyframes: [preset.from as Keyframe, preset.to as Keyframe], easing: resolveEasing(easing) };\n }\n const samples = sampleEasing(easing);\n // Modern browsers: an exact, property-agnostic `linear()` easing curve.\n if (supportsLinearEasing()) {\n return { keyframes: [preset.from as Keyframe, preset.to as Keyframe], easing: `linear(${samples.join(', ')})` };\n }\n // Fallback: approximate the curve with interpolated keyframes.\n const props = Object.keys(preset.from).filter((p) => p in preset.to);\n const keyframes = samples.map((eased, i) => {\n const frame: Keyframe = { offset: i / EASING_SAMPLES };\n props.forEach((prop) => {\n frame[prop] = interpolateValue(preset.from[prop], preset.to[prop], eased);\n });\n return frame;\n });\n return { keyframes, easing: 'linear' };\n}\n\n/** Make an element visible without animating (reduced motion / disabled / no WAAPI). */\nfunction reveal(el: Element, config: Required<ScrollAnimateConfig>): void {\n cancelRunning(el);\n if (config.useClassNames) {\n el.classList.remove(config.hiddenClass);\n el.classList.add(config.visibleClass);\n } else {\n const style = (el as HTMLElement).style;\n if (style) style.opacity = '';\n }\n}\n\n/** @internal Cancel a running/pending animation and make the element visible. */\nexport function stopAnimation(el: Element, config: ScrollAnimateConfig = {}): void {\n reveal(el, { ...DEFAULT_CONFIG, ...config });\n}\n\n/** @internal Resolve a selector / Element / NodeList / Element[] to elements (SSR-safe). */\nexport { resolveTargets, hasDOM };\n\n/** @internal Whether animations should be skipped entirely. */\nexport function motionDisabled(config: Pick<ScrollAnimateConfig, 'disabled'>): boolean {\n return !!config.disabled || prefersReducedMotion();\n}\n\nfunction runAnimation(\n el: Element,\n opts: Required<AnimateOptions>,\n config: Required<ScrollAnimateConfig>,\n staggerIndex = 0,\n pending?: Set<Element>\n): void {\n const { duration, delay, stagger, onStart, onComplete } = opts;\n const totalDelay = Math.max(0, delay + staggerIndex * stagger);\n cancelRunning(el);\n\n if (motionDisabled(config)) {\n reveal(el, config);\n onStart(el);\n onComplete(el);\n return;\n }\n\n if (config.useClassNames) {\n if (totalDelay > 0) (el as HTMLElement).style.animationDelay = `${totalDelay}ms`;\n el.classList.remove(config.hiddenClass);\n el.classList.add(config.visibleClass);\n onStart(el);\n pending?.add(el);\n timers.set(\n el,\n setTimeout(() => {\n timers.delete(el);\n pending?.delete(el);\n onComplete(el);\n }, duration + totalDelay)\n );\n return;\n }\n\n const preset = resolvePreset(opts.animation);\n // Presets that don't animate opacity (slide-*, clip-*, scale-x, ...) would\n // otherwise stay at the `opacity: 0` applied while waiting to enter.\n if (!('opacity' in preset.to)) {\n const style = (el as HTMLElement).style;\n if (style && style.opacity === '0') style.opacity = '';\n }\n\n if (typeof el.animate !== 'function') {\n setStyles(el, preset.to);\n onStart(el);\n onComplete(el);\n return;\n }\n\n const built = buildAnimation(preset, opts.easing);\n const timing: KeyframeAnimationOptions = { duration, delay: totalDelay, easing: built.easing, fill: 'both' };\n let anim: Animation;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n // Invalid user easing string (WAAPI throws a TypeError): fall back to 'ease'\n anim = el.animate(built.keyframes, { ...timing, easing: 'ease' });\n }\n running.set(el, anim);\n onStart(el);\n anim.onfinish = () => {\n if (running.get(el) === anim) {\n running.delete(el);\n // Persist the end state inline and drop the filling animation. This frees\n // the Animation object and lets later inline styles (parallax, user code)\n // take effect instead of being masked by `fill: forwards`.\n try {\n anim.commitStyles();\n } catch {\n setStyles(el, preset.to);\n }\n anim.cancel();\n }\n onComplete(el);\n };\n}\n\n/**\n * Native engine: attach the preset to a `ViewTimeline` of the element, so the\n * browser drives it from scroll position. Returns `null` when that fails\n * (caller falls back to the JS engine).\n */\nfunction startNative(el: Element, opts: Required<AnimateOptions>, onFrozen?: () => void): Animation | null {\n if (typeof el.animate !== 'function') return null;\n const preset = resolvePreset(opts.animation);\n const built = buildAnimation(preset, opts.easing);\n let anim: Animation;\n try {\n const timeline = new (globalThis as any).ViewTimeline({ subject: el, axis: 'block' });\n const timing = {\n fill: 'both',\n easing: built.easing,\n timeline,\n rangeStart: opts.viewRange[0],\n rangeEnd: opts.viewRange[1],\n } as KeyframeAnimationOptions;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n anim = el.animate(built.keyframes, { ...timing, easing: 'linear' });\n }\n } catch {\n return null;\n }\n running.set(el, anim);\n if (opts.exit) {\n // Reverse keyframes over the `exit` range; `fill: 'forwards'` so it has\n // no effect before the element starts leaving.\n const leave = resolvePreset(opts.exit === true ? opts.animation : opts.exit);\n const out = buildAnimation({ from: leave.to, to: leave.from }, opts.easing);\n try {\n const timeline = new (globalThis as any).ViewTimeline({ subject: el, axis: 'block' });\n const timing = { fill: 'forwards', easing: out.easing, timeline, rangeStart: 'exit 0%', rangeEnd: 'exit 100%' };\n exits.set(el, el.animate(out.keyframes, timing as KeyframeAnimationOptions));\n } catch {\n // Exit is cosmetic: ignore if unsupported.\n }\n }\n const keep = opts.repeat || !opts.once;\n anim.onfinish = () => {\n // `once`: freeze the end state, so scrolling back up does not reverse it.\n if (!keep && running.get(el) === anim) {\n running.delete(el);\n try {\n anim.commitStyles();\n } catch {\n setStyles(el, preset.to);\n }\n anim.cancel();\n onFrozen?.();\n }\n opts.onComplete(el);\n };\n return anim;\n}\n\n/** Play the exit animation (entrance or `exit` preset, reversed), ending hidden. */\nfunction runExit(el: Element, opts: Required<AnimateOptions>, config: Required<ScrollAnimateConfig>): void {\n if (config.useClassNames || typeof el.animate !== 'function') {\n hideElement(el, config);\n return;\n }\n cancelRunning(el);\n const preset = resolvePreset(opts.exit === true ? opts.animation : (opts.exit as Exclude<typeof opts.exit, boolean>));\n const built = buildAnimation({ from: preset.to, to: preset.from }, opts.easing);\n const timing: KeyframeAnimationOptions = { duration: opts.duration, easing: built.easing, fill: 'forwards' };\n let anim: Animation;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n anim = el.animate(built.keyframes, { ...timing, easing: 'ease' });\n }\n // Kept (filling) until the next entrance cancels it.\n running.set(el, anim);\n}\n\nfunction hideElement(el: Element, config: Required<ScrollAnimateConfig>): void {\n cancelRunning(el);\n if (config.useClassNames) {\n el.classList.add(config.hiddenClass);\n el.classList.remove(config.visibleClass);\n } else {\n const style = (el as HTMLElement).style;\n if (style) style.opacity = '0';\n }\n}\n\n/** @internal Hide an element before its entrance animation, unless motion is off. */\nexport function prepareElement(el: Element, config: ScrollAnimateConfig = {}): void {\n const full = { ...DEFAULT_CONFIG, ...config };\n if (!motionDisabled(full)) hideElement(el, full);\n}\n\nlet progressThresholds: number[] | undefined;\nfunction getProgressThresholds(): number[] {\n if (!progressThresholds) {\n progressThresholds = [];\n for (let i = 0; i <= 100; i++) progressThresholds.push(i / 100);\n }\n return progressThresholds;\n}\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\n/* ------------------------------------------------------------------ */\n/* Instance */\n/* ------------------------------------------------------------------ */\n\nexport function createScrollAnimate(userConfig: ScrollAnimateConfig = {}): ScrollAnimateInstance {\n let config: Required<ScrollAnimateConfig> = { ...DEFAULT_CONFIG, ...userConfig };\n const registry = new Map<Element, AnimatedElement>();\n // `once` elements that finished and were dropped from the registry (autoUnregister).\n let finished = new WeakSet<Element>();\n // Elements in `progressMode: 'scroll'` that are currently inside the viewport.\n const scrolling = new Set<Element>();\n let frame = 0;\n let listening: EventTarget | null = null;\n // Active watch() MutationObservers, disconnected by destroy().\n const watchers = new Set<MutationObserver>();\n // Elements with a pending class-name completion timer started by this instance.\n const pending = new Set<Element>();\n // Elements whose entrance runs on a native scroll-driven timeline.\n const natives = new Set<Element>();\n\n // Observers are shared between elements with the same root/threshold/rootMargin,\n // instead of one (or two) IntersectionObservers per element.\n const pools = new Map<Root, Map<string, IntersectionObserver>>();\n\n function pooled(root: Root, key: string, create: () => IntersectionObserver): IntersectionObserver {\n let pool = pools.get(root);\n if (!pool) pools.set(root, (pool = new Map()));\n let io = pool.get(key);\n if (!io) pool.set(key, (io = create()));\n return io;\n }\n\n function teardown(el: Element, restore: boolean): void {\n const record = registry.get(el);\n if (!record) return;\n record.observer.unobserve(el);\n record.progressObserver?.unobserve(el);\n registry.delete(el);\n untrack(el);\n if (record.engine === 'css') {\n // A scroll-linked animation would keep following the scroll: stop it and\n // show the element (unless it finished and is just being released).\n if (restore) {\n natives.delete(el);\n reveal(el, config);\n } else if (el.isConnected === false) {\n // Left the DOM: drop it too, or the instance keeps it alive (and\n // destroy() touches it) for its whole lifetime.\n natives.delete(el);\n }\n return;\n }\n // An element that never animated would otherwise stay invisible forever.\n if (restore && !record.animated) reveal(el, config);\n }\n\n function pruneDetached(): void {\n registry.forEach((record, el) => {\n if (el.isConnected === false) teardown(el, false);\n });\n }\n\n function emitProgress(el: Element, record: AnimatedElement, progress: number): void {\n const opts = record.options;\n opts.onProgress(el, progress);\n if (opts.progressVar) {\n const style = (el as HTMLElement).style;\n if (style) style.setProperty(opts.progressVar, String(+progress.toFixed(4)));\n }\n }\n\n function update(): void {\n frame = 0;\n scrolling.forEach((el) => {\n const record = registry.get(el);\n if (record) emitProgress(el, record, getScrollProgress(el, config.root));\n });\n }\n\n // rAF-throttled; IntersectionObserver-capable browsers all have rAF.\n const schedule = () => frame || (frame = requestAnimationFrame(update));\n\n function listen(on: boolean): void {\n if (on === !!listening) return;\n const method = on ? 'addEventListener' : 'removeEventListener';\n const target: EventTarget = listening || (config.root as EventTarget | null) || window;\n target[method]('scroll', schedule, PASSIVE);\n window[method]('resize', schedule, PASSIVE);\n listening = on ? target : null;\n if (!on && frame) {\n cancelAnimationFrame(frame);\n frame = 0;\n }\n }\n\n function untrack(el: Element): void {\n if (scrolling.delete(el) && !scrolling.size) listen(false);\n }\n\n function onScrollIntersect(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => {\n const el = entry.target;\n const record = registry.get(el);\n if (!record) return;\n if (entry.isIntersecting) {\n scrolling.add(el);\n listen(true);\n } else {\n untrack(el);\n }\n // Emit right away so the edges (0 / 1) are reported even on fast scrolls.\n emitProgress(el, record, getScrollProgress(el, config.root));\n });\n }\n\n function onIntersect(entries: IntersectionObserverEntry[]): void {\n const staggerCounts = new Map<Element | null, number>();\n entries.forEach((entry) => {\n const el = entry.target;\n const record = registry.get(el);\n if (!record) return;\n const opts = record.options;\n\n if (el.isConnected === false) {\n teardown(el, false);\n return;\n }\n\n if (record.engine === 'css') {\n // The browser drives the animation; only lifecycle bookkeeping here.\n if (entry.isIntersecting) {\n opts.onEnter(el);\n if (!record.animated) {\n record.animated = true;\n opts.onStart(el);\n }\n if (opts.once && !opts.repeat) {\n record.observer.unobserve(el);\n if (config.autoUnregister && !record.progressObserver) {\n finished.add(el);\n teardown(el, false);\n }\n }\n } else {\n opts.onLeave(el);\n if (opts.repeat) record.animated = false;\n }\n return;\n }\n\n if (entry.isIntersecting) {\n opts.onEnter(el);\n if (record.animated && !opts.repeat) return;\n\n // Stagger relative to siblings revealed in the same batch, so elements\n // scrolled into view later don't inherit an ever-growing delay.\n let staggerIndex = 0;\n if (opts.stagger > 0) {\n const parent = el.parentElement;\n staggerIndex = staggerCounts.get(parent) ?? 0;\n staggerCounts.set(parent, staggerIndex + 1);\n }\n\n runAnimation(el, opts, config, staggerIndex, pending);\n record.animated = true;\n\n if (opts.once && !opts.repeat) {\n // Keep the progress observer: parallax/onProgress must keep working.\n record.observer.unobserve(el);\n if (config.autoUnregister && !record.progressObserver) {\n // Nothing left to watch: free the record (the running animation\n // keeps its own reference until it finishes).\n finished.add(el);\n teardown(el, false);\n }\n }\n } else {\n opts.onLeave(el);\n if (opts.repeat && record.animated) {\n if (!motionDisabled(config)) {\n if (opts.exit) runExit(el, opts, config);\n else hideElement(el, config);\n }\n record.animated = false;\n }\n }\n });\n }\n\n function onProgress(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => {\n const record = registry.get(entry.target);\n if (!record) return;\n emitProgress(entry.target, record, entry.intersectionRatio);\n });\n }\n\n function getObserver(opts: Required<AnimateOptions>): IntersectionObserver {\n const rootMargin = applyOffset(opts.rootMargin, opts.offset);\n const threshold = opts.threshold;\n const root = config.root;\n return pooled(root, `m|${rootMargin}|${String(threshold)}`, () =>\n new IntersectionObserver(onIntersect, { threshold, rootMargin, root: root as Element | null })\n );\n }\n\n function getProgressObserver(opts: Required<AnimateOptions>): IntersectionObserver {\n const root = config.root;\n if (opts.progressMode === 'scroll') {\n // Only used to know when to start/stop measuring; progress itself comes\n // from a single shared, rAF-throttled passive scroll listener.\n return pooled(root, `s|${opts.rootMargin}`, () =>\n new IntersectionObserver(onScrollIntersect, { threshold: 0, rootMargin: opts.rootMargin, root: root as Element | null })\n );\n }\n return pooled(root, `p|${opts.rootMargin}`, () =>\n new IntersectionObserver(onProgress, {\n threshold: getProgressThresholds(),\n rootMargin: opts.rootMargin,\n root: root as Element | null,\n })\n );\n }\n\n function attach(el: Element, record: AnimatedElement, observeMain: boolean): void {\n record.observer = getObserver(record.options);\n if (observeMain) record.observer.observe(el);\n record.progressObserver = needsProgress(record.options) ? getProgressObserver(record.options) : undefined;\n record.progressObserver?.observe(el);\n }\n\n function wantsNative(opts: Required<AnimateOptions>): boolean {\n return opts.engine !== 'js' && !config.useClassNames && !motionDisabled(config) && supportsScrollTimeline();\n }\n\n function observeElement(el: Element, opts: Required<AnimateOptions>): void {\n if (registry.has(el) || finished.has(el)) return;\n\n if (!supportsObserver()) {\n // No IntersectionObserver (very old browser): never leave content hidden.\n reveal(el, config);\n return;\n }\n\n const record = { element: el, options: opts, animated: false, engine: 'js' } as AnimatedElement;\n if (wantsNative(opts)) {\n cancelRunning(el);\n if (startNative(el, opts, () => natives.delete(el))) {\n record.engine = 'css';\n natives.add(el);\n }\n }\n if (record.engine === 'js' && !motionDisabled(config)) hideElement(el, config);\n\n registry.set(el, record);\n attach(el, record, true);\n }\n\n function observeDataElement(el: Element): void {\n if (!registry.has(el)) observeElement(el, parseDataAttributes(el, config));\n }\n\n const instance: ScrollAnimateInstance = {\n observe(target, options = {}) {\n pruneDetached();\n const opts = mergeOptions(options, config);\n resolveTargets(target).forEach((el) => observeElement(el, opts));\n },\n\n unobserve(target) {\n resolveTargets(target).forEach((el) => {\n finished.delete(el);\n teardown(el, true);\n });\n },\n\n init(rootElement) {\n const scope = rootElement ?? (hasDOM() ? document : null);\n if (!scope) return;\n pruneDetached();\n scope.querySelectorAll('[data-sa]').forEach(observeDataElement);\n },\n\n watch(rootElement) {\n const scope = rootElement ?? (hasDOM() ? document : null);\n if (!scope || typeof MutationObserver === 'undefined') return noop;\n instance.init(scope);\n const observeTree = (node: Element) => {\n if (node.hasAttribute('data-sa')) observeDataElement(node);\n node.querySelectorAll('[data-sa]').forEach(observeDataElement);\n };\n const mo = new MutationObserver((records) => {\n let removed = false;\n records.forEach((record) => {\n if (record.type === 'attributes') {\n const target = record.target as Element;\n if (target.isConnected !== false) observeTree(target);\n return;\n }\n record.addedNodes.forEach((node) => {\n if (node instanceof Element && node.isConnected !== false) observeTree(node);\n });\n if (record.removedNodes.length) removed = true;\n });\n // Free elements that left the DOM (they can't animate any more).\n if (removed) pruneDetached();\n });\n mo.observe(scope, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-sa'] });\n watchers.add(mo);\n return () => {\n mo.disconnect();\n watchers.delete(mo);\n };\n },\n\n destroy() {\n watchers.forEach((mo) => mo.disconnect());\n watchers.clear();\n // Class-name mode: drop completion timers so onComplete never fires after destroy().\n pending.forEach((el) => {\n const timer = timers.get(el);\n if (timer !== undefined) {\n clearTimeout(timer);\n timers.delete(el);\n }\n });\n pending.clear();\n registry.forEach((record, el) => {\n if (!record.animated && record.engine !== 'css') reveal(el, config);\n });\n // Native scroll-linked animations still running: stop them, show content.\n natives.forEach((el) => {\n if (running.has(el)) reveal(el, config);\n });\n natives.clear();\n pools.forEach((pool) => pool.forEach((io) => io.disconnect()));\n pools.clear();\n registry.clear();\n scrolling.clear();\n listen(false);\n finished = new WeakSet();\n },\n\n refresh() {\n // Rebuild observers (e.g. after configure({ root })) without re-hiding or\n // replaying elements that have already animated.\n pools.forEach((pool) => pool.forEach((io) => io.disconnect()));\n pools.clear();\n scrolling.clear();\n listen(false);\n pruneDetached();\n if (!supportsObserver()) return;\n registry.forEach((record, el) => {\n const done = record.animated && record.options.once && !record.options.repeat;\n attach(el, record, !done);\n });\n },\n\n animate(target, options = {}) {\n const opts = mergeOptions(options, config);\n resolveTargets(target).forEach((el) => runAnimation(el, opts, config, 0, pending));\n },\n\n getObservedElements() {\n return Array.from(registry.values());\n },\n\n configure(newConfig) {\n config = { ...config, ...newConfig };\n },\n };\n\n return instance;\n}\n","/**\n * use-scroll-animate - Staggered children\n * Reveal a container's children one after another when the container scrolls\n * into view, optionally also animating children that are added later.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, hasDOM, prepareElement, stopAnimation, supportsObserver } from './core';\n\nexport interface StaggerOptions extends AnimateOptions {\n /** Delay between consecutive children in ms (default: 80) */\n stagger?: number;\n /**\n * Watch the container with a MutationObserver and animate children added\n * later (e.g. infinite lists). Children added after the container was\n * revealed animate when they scroll into view, staggered per batch.\n * (default: false)\n */\n observeChildren?: boolean;\n}\n\nlet fallback: ScrollAnimateInstance | null = null;\n\n/**\n * Animate the children of `container` with a stagger once it enters the\n * viewport. Returns a cleanup function. SSR-safe (no-op without a DOM).\n *\n * @example\n * const stop = staggerChildren(document.querySelector('ul'), { stagger: 60, observeChildren: true });\n */\nexport function staggerChildren(\n container: Element | null | undefined,\n options: StaggerOptions = {},\n instance?: ScrollAnimateInstance\n): () => void {\n if (!container || !hasDOM() || !supportsObserver()) return () => undefined; // leave content visible\n const sa = instance || fallback || (fallback = createScrollAnimate());\n const { stagger = 80, delay = 0, threshold = 0.1, rootMargin = '0px', observeChildren = false, ...rest } = options;\n\n let items = Array.from(container.children);\n let revealed = false;\n const late: Element[] = [];\n items.forEach((child) => prepareElement(child));\n\n const io = new IntersectionObserver(\n (entries) => {\n if (revealed || !entries.some((entry) => entry.isIntersecting)) return;\n revealed = true;\n io.disconnect();\n items.forEach((child, i) => {\n if (child.parentNode === container) sa.animate(child, { ...rest, delay: delay + i * stagger });\n });\n items = [];\n },\n { threshold, rootMargin }\n );\n io.observe(container);\n\n let mo: MutationObserver | undefined;\n if (observeChildren && typeof MutationObserver !== 'undefined') {\n mo = new MutationObserver((records) => {\n records.forEach((record) => {\n record.addedNodes.forEach((node) => {\n if (!(node instanceof Element) || node.parentNode !== container) return;\n if (!revealed) {\n prepareElement(node);\n items.push(node);\n } else {\n // The core engine staggers siblings relative to the batch that\n // enters the viewport together.\n late.push(node);\n sa.observe(node, { ...rest, delay, stagger, threshold, rootMargin });\n }\n });\n record.removedNodes.forEach((node) => {\n if (!(node instanceof Element)) return;\n items = items.filter((el) => el !== node);\n const i = late.indexOf(node);\n if (i >= 0) {\n late.splice(i, 1);\n sa.unobserve(node);\n }\n });\n });\n });\n mo.observe(container, { childList: true });\n }\n\n return () => {\n io.disconnect();\n mo?.disconnect();\n // Stopped before the container was revealed: never leave the children hidden.\n if (!revealed) {\n revealed = true;\n items.forEach((child) => stopAnimation(child));\n items = [];\n }\n late.forEach((el) => sa.unobserve(el));\n late.length = 0;\n };\n}\n","/**\n * use-scroll-animate - Sequence / timeline helper\n * Chain animations on several targets, one after another (or overlapping).\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, hasDOM, prepareElement, resolveTargets, stopAnimation, supportsObserver } from './core';\n\nexport interface SequenceStep extends AnimateOptions {\n /** Selector, Element, NodeList or Element[] to animate in this step */\n target: string | Element | NodeList | Element[];\n /** Pause (ms) after the previous step ends before this one starts. Negative values overlap. (default: 0) */\n gap?: number;\n /** Absolute start time (ms) on the timeline; overrides `gap` */\n at?: number;\n}\n\nexport interface SequenceOptions extends AnimateOptions {\n /** Play automatically (once) when this element/selector enters the viewport */\n trigger?: string | Element;\n /** Instance whose global config (easing, classes, `disabled`) is used */\n instance?: ScrollAnimateInstance;\n}\n\nexport interface SequenceController {\n /** Play (or replay) the timeline. Resolves when every step has completed, or on `cancel()`. */\n play(): Promise<void>;\n /** Stop the trigger and running animations; elements are left visible. */\n cancel(): void;\n /** Total duration of the timeline in ms (computed for the current DOM). */\n duration(): number;\n}\n\nlet fallback: ScrollAnimateInstance | null = null;\nlet warned = false;\n\ntype Planned = { el: Element; opts: AnimateOptions; end: number };\n\nfunction plan(steps: SequenceStep[], defaults: AnimateOptions): Planned[] {\n const out: Planned[] = [];\n let cursor = 0;\n steps.forEach((step) => {\n const { target, gap = 0, at, ...stepOpts } = step;\n const opts = { ...defaults, ...stepOpts };\n const duration = opts.duration ?? 600;\n const start = Math.max(0, at ?? cursor + gap) + (opts.delay ?? 0);\n let end = Math.max(cursor, start);\n resolveTargets(target).forEach((el, i) => {\n const delay = start + i * (opts.stagger ?? 0);\n out.push({ el, opts: { ...opts, duration, delay, stagger: 0 }, end: delay + duration });\n end = Math.max(end, delay + duration);\n });\n cursor = end;\n });\n return out;\n}\n\n/**\n * Build a timeline of animations.\n *\n * @deprecated since 3.9, removed in 4.0 — use `timeline()` (`.to(target, preset, { at: '-=300' })`).\n *\n * @example\n * sequence([\n * { target: '.title', animation: 'fade-in-up' },\n * { target: '.subtitle', animation: 'blur-in', gap: -300 }, // overlap by 300ms\n * { target: '.card', animation: 'scale-up', stagger: 80 },\n * ], { trigger: '.hero' });\n */\nexport function sequence(steps: SequenceStep[], options: SequenceOptions = {}): SequenceController {\n if (!warned && typeof console !== 'undefined') {\n warned = true;\n console.warn(\"[use-scroll-animate] sequence() is deprecated and will be removed in 4.0 — use timeline() from 'use-scroll-animate/components/timeline' (also exported from 'use-scroll-animate' in 4.0). See docs/upgrading-4.md.\");\n }\n const { trigger, instance, ...defaults } = options;\n const sa = () => instance || fallback || (fallback = createScrollAnimate());\n let io: IntersectionObserver | undefined;\n let active: Planned[] = [];\n let settle: (() => void) | undefined;\n // Targets hidden while waiting for `trigger`; revealed if cancelled before it fires.\n let prepared: Element[] = [];\n\n const controller: SequenceController = {\n play() {\n controller.cancel();\n if (!hasDOM()) return Promise.resolve();\n active = plan(steps, defaults);\n return new Promise<void>((resolve) => {\n let left = active.length;\n settle = () => {\n settle = undefined;\n resolve();\n };\n if (!left) return settle();\n const run = active;\n run.forEach(({ el, opts }) => {\n const done = opts.onComplete;\n sa().animate(el, {\n ...opts,\n onComplete: (node) => {\n done?.(node);\n if (run === active && --left === 0) settle?.();\n },\n });\n });\n });\n },\n\n cancel() {\n io?.disconnect();\n io = undefined;\n prepared.forEach((el) => stopAnimation(el));\n prepared = [];\n active.forEach(({ el }) => stopAnimation(el));\n active = [];\n settle?.();\n },\n\n duration() {\n return plan(steps, defaults).reduce((max, p) => Math.max(max, p.end), 0);\n },\n };\n\n if (trigger && hasDOM() && supportsObserver()) {\n const el = resolveTargets(trigger)[0];\n if (el) {\n prepared = plan(steps, defaults).map(({ el: target }) => target);\n prepared.forEach((target) => prepareElement(target));\n io = new IntersectionObserver(\n (entries) => {\n if (!entries.some((e) => e.isIntersecting)) return;\n io?.disconnect();\n io = undefined;\n prepared = []; // play() takes over from here\n controller.play();\n },\n { threshold: defaults.threshold ?? 0.1, rootMargin: defaults.rootMargin ?? '0px' }\n );\n io.observe(el);\n }\n }\n\n return controller;\n}\n","/**\n * use-scroll-animate - parallax() helper\n *\n * Moves elements at a different speed than the page while they cross the\n * viewport. Built on the same scroll progress as `progressVar` (0 when the\n * element's top enters at the bottom, 1 when its bottom leaves at the top):\n * the progress is written to a CSS custom property (default `--sa-parallax`)\n * and the offset is applied with the individual `translate` property, so it\n * composes with entrance animations and other `transform`s.\n */\n\nimport { getScrollProgress, hasDOM, prefersReducedMotion, resolveTargets, supportsObserver } from './core';\n\nexport interface ParallaxHelperOptions {\n /**\n * Total distance the element shifts while it crosses the viewport, as a\n * fraction of the viewport size (`0.2` = 20vh on the y axis). Positive values\n * lag behind the scroll (background-like), negative values move ahead of it\n * (foreground-like). (default: `0.2`)\n */\n speed?: number;\n /** `'y'` (default) or `'x'` (horizontal drift, in `vw`) */\n axis?: 'x' | 'y';\n /** CSS custom property receiving the progress (default: `'--sa-parallax'`) */\n progressVar?: string;\n /** Scroll container (default: the viewport) */\n root?: Element | null;\n /**\n * Under `prefers-reduced-motion: reduce` no offset is applied (the progress\n * variable is still written). Set to `false` to move anyway. (default: `true`)\n */\n respectReducedMotion?: boolean;\n}\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\n/**\n * Apply a scroll parallax to `target` (selector, Element, NodeList or array).\n * Returns a function that stops it and removes the inline styles it set.\n * SSR-safe (no-op without a DOM / IntersectionObserver).\n *\n * @example\n * const stop = parallax('.hero-bg', { speed: 0.3 });\n * parallax('.badge', { speed: -0.15, axis: 'x' });\n */\nexport function parallax(\n target: string | Element | NodeList | Element[],\n options: ParallaxHelperOptions = {}\n): () => void {\n const els = resolveTargets(target);\n if (!els.length || !hasDOM() || !supportsObserver()) return () => undefined;\n const { speed = 0.2, axis = 'y', root = null, respectReducedMotion = true } = options;\n const name = options.progressVar ? (options.progressVar.startsWith('--') ? options.progressVar : `--${options.progressVar}`) : '--sa-parallax';\n const unit = axis === 'x' ? 'vw' : 'vh';\n const visible = new Set<Element>();\n let frame = 0;\n let listening = false;\n const scroller: EventTarget = root || window;\n\n const apply = (el: Element) => {\n const style = (el as HTMLElement).style;\n if (!style) return;\n const p = getScrollProgress(el, root);\n style.setProperty(name, String(+p.toFixed(4)));\n if (respectReducedMotion && prefersReducedMotion()) {\n style.removeProperty('translate');\n return;\n }\n const offset = `${+((p - 0.5) * speed * 100).toFixed(3)}${unit}`;\n style.setProperty('translate', axis === 'x' ? `${offset} 0px` : `0px ${offset}`);\n };\n\n const update = () => {\n frame = 0;\n visible.forEach(apply);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(update);\n };\n const listen = (on: boolean) => {\n if (on === listening) return;\n listening = on;\n const method = on ? 'addEventListener' : 'removeEventListener';\n scroller[method]('scroll', schedule, PASSIVE);\n window[method]('resize', schedule, PASSIVE);\n if (!on && frame) {\n cancelAnimationFrame(frame);\n frame = 0;\n }\n };\n\n const io = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) visible.add(entry.target);\n else visible.delete(entry.target);\n apply(entry.target); // report the edges even on fast scrolls\n });\n listen(visible.size > 0);\n },\n { threshold: 0, root }\n );\n els.forEach((el) => {\n apply(el); // no jump before the first observer callback\n io.observe(el);\n });\n\n return () => {\n io.disconnect();\n listen(false);\n visible.clear();\n els.forEach((el) => {\n const style = (el as HTMLElement).style;\n if (!style) return;\n style.removeProperty('translate');\n style.removeProperty(name);\n });\n };\n}\n","/**\n * use-scroll-animate\n *\n * A lightweight, dependency-free scroll animation library for modern web\n * applications. Built with TypeScript, powered by IntersectionObserver and\n * the Web Animations API (or the native scroll-driven timeline). Safe to\n * import during SSR. Framework integrations live in the subpath entries:\n * `use-scroll-animate/react`, `/vue`, `/svelte`, `/solid`, `/element`.\n *\n * @license MIT\n * @see https://github.com/HarrisonCN/use-scroll-animate\n */\n\nexport { createScrollAnimate, getScrollProgress, supportsScrollTimeline } from './core';\nexport { staggerChildren } from './stagger';\nexport { sequence } from './sequence';\nexport { parallax } from './parallax';\nexport { PRESETS, resolvePreset, resolveEasing, EASING_MAP } from './presets';\nexport type {\n AnimationPreset,\n EasingType,\n AnimationKeyframe,\n CustomAnimation,\n ProgressMode,\n ScrollEngine,\n AnimateOptions,\n ScrollAnimateConfig,\n AnimatedElement,\n ScrollAnimateInstance,\n} from './types';\nexport type { StaggerOptions } from './stagger';\nexport type { ParallaxHelperOptions } from './parallax';\nexport type { SequenceStep, SequenceOptions, SequenceController } from './sequence';\n\n// Default export: a ready-to-use singleton instance\nimport { createScrollAnimate } from './core';\n\n/**\n * Default singleton instance of ScrollAnimate.\n * Ready to use out of the box with sensible defaults.\n *\n * @example\n * ```js\n * import ScrollAnimate from 'use-scroll-animate';\n *\n * // Auto-initialize all elements with data-sa attribute\n * ScrollAnimate.init();\n *\n * // Or manually observe elements\n * ScrollAnimate.observe('.my-element', { animation: 'fade-in-up' });\n * ```\n */\nconst ScrollAnimate = /* @__PURE__ */ createScrollAnimate();\nexport default ScrollAnimate;\n"],"names":["PRESETS","from","opacity","to","transform","bounce","filter","shimmer","pulse","swing","clipPath","resolvePreset","animation","trim","Array","isArray","combined","forEach","name","preset","Object","entries","key","val","EASING_MAP","linear","ease","spring","resolveEasing","easing","join","DEFAULT_CONFIG","defaultAnimation","defaultDuration","defaultDelay","defaultEasing","defaultThreshold","defaultRootMargin","defaultRepeat","defaultOnce","defaultOffset","hiddenClass","visibleClass","useClassNames","disabled","root","autoUnregister","defaultEngine","noop","hasDOM","window","document","supportsObserver","IntersectionObserver","reducedMotionQuery","scrollTimelineSupported","prefersReducedMotion","undefined","matchMedia","matches","supportsScrollTimeline","CSS","supports","globalThis","ViewTimeline","num","value","n","parseFloat","Number","isFinite","DEFAULT_VIEW_RANGE","normalizeVar","v","startsWith","parseDataAttributes","el","config","mergeOptions","get","opts","anim","includes","split","map","s","duration","delay","e","JSON","parse","t","threshold","rootMargin","repeat","once","offset","stagger","progressVar","engine","range","start","end","viewRange","exit","progress","progressMode","keys","k","readOptions","getAttribute","length","onStart","onComplete","onEnter","onLeave","onProgress","resolveTargets","target","querySelectorAll","Element","NodeList","getScrollProgress","rect","getBoundingClientRect","top","height","innerHeight","documentElement","clientHeight","r","total","p","running","WeakMap","exits","timers","cancelRunning","exitAnim","delete","cancel","onfinish","timer","clearTimeout","setStyles","styles","style","prop","String","NUM_UNIT","linearSupported","progressThresholds","buildAnimation","keyframes","samples","fn","values","i","push","toFixed","sampleEasing","props","eased","frame","a","b","ta","tb","skA","replace","_","u","ok","out","na","ua","nb","ub","unit","interpolateValue","reveal","classList","remove","add","stopAnimation","motionDisabled","runAnimation","staggerIndex","pending","totalDelay","Math","max","animationDelay","set","setTimeout","animate","built","timing","fill","commitStyles","hideElement","prepareElement","full","getProgressThresholds","PASSIVE","passive","createScrollAnimate","userConfig","registry","Map","finished","WeakSet","scrolling","Set","listening","watchers","natives","pools","pooled","create","pool","io","teardown","restore","record","observer","unobserve","progressObserver","untrack","animated","isConnected","pruneDetached","emitProgress","options","setProperty","update","schedule","requestAnimationFrame","listen","on","method","cancelAnimationFrame","size","onScrollIntersect","entry","isIntersecting","onIntersect","staggerCounts","parent","parentElement","runExit","intersectionRatio","getObserver","parts","right","bottom","left","m","exec","applyOffset","attach","observeMain","observe","getProgressObserver","observeElement","has","element","wantsNative","onFrozen","timeline","subject","axis","rangeStart","rangeEnd","leave","keep","startNative","observeDataElement","instance","init","rootElement","scope","watch","MutationObserver","observeTree","node","hasAttribute","mo","records","removed","type","addedNodes","removedNodes","childList","subtree","attributes","attributeFilter","disconnect","destroy","clear","refresh","getObservedElements","configure","newConfig","fallback","warned","plan","steps","defaults","cursor","step","gap","at","stepOpts","ScrollAnimate","els","speed","respectReducedMotion","visible","scroller","apply","removeProperty","console","warn","trigger","settle","active","prepared","controller","play","Promise","resolve","run","done","reduce","some","container","sa","observeChildren","rest","items","children","revealed","late","child","parentNode","indexOf","splice"],"mappings":"oPAYO,MAAMA,EAAgD,CAC3D,UAAW,CACTC,KAAM,CAAEC,QAAS,GACjBC,GAAI,CAAED,QAAS,IAEjB,aAAc,CACZD,KAAM,CAAEC,QAAS,EAAGE,UAAW,oBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,eAAgB,CACdH,KAAM,CAAEC,QAAS,EAAGE,UAAW,qBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,eAAgB,CACdH,KAAM,CAAEC,QAAS,EAAGE,UAAW,qBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,gBAAiB,CACfH,KAAM,CAAEC,QAAS,EAAGE,UAAW,oBAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,oBAE/B,UAAW,CACTH,KAAM,CAAEC,QAAS,EAAGE,UAAW,cAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,aAE/B,WAAY,CACVH,KAAM,CAAEC,QAAS,EAAGE,UAAW,cAC/BD,GAAI,CAAED,QAAS,EAAGE,UAAW,aAE/B,SAAU,CACRH,KAAM,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IxK,qBACZhC,KACKiU,GAAajU,EAAQ0T,KAAM3F,GAAUA,EAAMC,kBAC/CiG,GAAW,EACXzH,EAAG4E,aACH2C,EAAMnU,QAAQ,CAACuU,EAAO3L,KAChB2L,EAAMC,aAAeT,GAAWC,EAAG9I,QAAQqJ,EAAO,IAAKL,EAAM5P,MAAOA,EAAQsE,EAAI5D,MAEtFmP,EAAQ,KAEV,CAAExP,YAAWC,eAIf,IAAIkM,EA8BJ,OAhCAlE,EAAGyC,QAAQ0E,GAGPE,GAA+C,oBAArBvD,mBAC5BI,EAAK,IAAIJ,iBAAkBK,IACzBA,EAAQ/Q,QAAS+M,IACfA,EAAOmE,WAAWlR,QAAS4Q,IACnBA,aAAgBrK,SAAYqK,EAAK4D,aAAeT,IACjDM,GAMHC,EAAKzL,KAAK+H,GACVoD,EAAG3E,QAAQuB,EAAM,IAAKsD,EAAM5P,QAAOU,UAASL,YAAWC,iBANvD4G,EAAeoF,GACfuD,EAAMtL,KAAK+H,OAQf7D,EAAOoE,aAAanR,QAAS4Q,IAC3B,KAAMA,aAAgBrK,SAAU,OAChC4N,EAAQA,EAAM9U,OAAQsE,GAAOA,IAAOiN,GACpC,MAAMhI,EAAI0L,EAAKG,QAAQ7D,GACnBhI,GAAK,IACP0L,EAAKI,OAAO9L,EAAG,GACfoL,EAAG/G,UAAU2D,UAKrBE,EAAGzB,QAAQ0E,EAAW,CAAE3C,WAAW,KAG9B,KACLxE,EAAG4E,aACHV,GAAIU,aAEC6C,IACHA,GAAW,EACXF,EAAMnU,QAASuU,GAAUhK,EAAcgK,IACvCJ,EAAQ,IAEVG,EAAKtU,QAAS2D,GAAOqQ,EAAG/G,UAAUtJ,IAClC2Q,EAAKxO,OAAS,EAElB"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/presets.ts","../src/core.ts","../src/stagger.ts","../src/components/base.ts","../src/components/timeline/core.ts","../src/parallax.ts","../src/index.ts"],"sourcesContent":["/**\n * use-scroll-animate - Animation Presets\n * Defines keyframes for all built-in animation presets\n */\n\nimport type { AnimationPreset, CustomAnimation, EasingType } from './types';\n\ntype KeyframeMap = {\n from: Record<string, string | number>;\n to: Record<string, string | number>;\n};\n\nexport const PRESETS: Record<AnimationPreset, KeyframeMap> = {\n 'fade-in': {\n from: { opacity: 0 },\n to: { opacity: 1 },\n },\n 'fade-in-up': {\n from: { opacity: 0, transform: 'translateY(40px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'fade-in-down': {\n from: { opacity: 0, transform: 'translateY(-40px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'fade-in-left': {\n from: { opacity: 0, transform: 'translateX(-40px)' },\n to: { opacity: 1, transform: 'translateX(0px)' },\n },\n 'fade-in-right': {\n from: { opacity: 0, transform: 'translateX(40px)' },\n to: { opacity: 1, transform: 'translateX(0px)' },\n },\n 'zoom-in': {\n from: { opacity: 0, transform: 'scale(0.8)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'zoom-out': {\n from: { opacity: 0, transform: 'scale(1.2)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'flip-x': {\n from: { opacity: 0, transform: 'rotateX(-90deg)' },\n to: { opacity: 1, transform: 'rotateX(0deg)' },\n },\n 'flip-y': {\n from: { opacity: 0, transform: 'rotateY(-90deg)' },\n to: { opacity: 1, transform: 'rotateY(0deg)' },\n },\n 'slide-up': {\n from: { transform: 'translateY(100%)' },\n to: { transform: 'translateY(0px)' },\n },\n 'slide-down': {\n from: { transform: 'translateY(-100%)' },\n to: { transform: 'translateY(0px)' },\n },\n 'slide-left': {\n from: { transform: 'translateX(-100%)' },\n to: { transform: 'translateX(0px)' },\n },\n 'slide-right': {\n from: { transform: 'translateX(100%)' },\n to: { transform: 'translateX(0px)' },\n },\n 'bounce': {\n from: { opacity: 0, transform: 'translateY(-60px)' },\n to: { opacity: 1, transform: 'translateY(0px)' },\n },\n 'rotate-in': {\n from: { opacity: 0, transform: 'rotate(-180deg) scale(0.5)' },\n to: { opacity: 1, transform: 'rotate(0deg) scale(1)' },\n },\n 'blur-in': {\n from: { opacity: 0, filter: 'blur(12px)' },\n to: { opacity: 1, filter: 'blur(0px)' },\n },\n 'skew-in': {\n from: { opacity: 0, transform: 'skewX(20deg) translateX(30px)' },\n to: { opacity: 1, transform: 'skewX(0deg) translateX(0px)' },\n },\n 'scale-x': {\n from: { transform: 'scaleX(0)' },\n to: { transform: 'scaleX(1)' },\n },\n 'scale-y': {\n from: { transform: 'scaleY(0)' },\n to: { transform: 'scaleY(1)' },\n },\n 'shimmer': {\n from: { opacity: 0.5, filter: 'brightness(1)' },\n to: { opacity: 1, filter: 'brightness(1.5)' },\n },\n 'pulse': {\n from: { transform: 'scale(1)' },\n to: { transform: 'scale(1.05)' },\n },\n 'swing': {\n from: { transform: 'rotate(-10deg)' },\n to: { transform: 'rotate(10deg)' },\n },\n 'scale-up': {\n from: { opacity: 0, transform: 'scale(0.5)' },\n to: { opacity: 1, transform: 'scale(1)' },\n },\n 'blur-in-up': {\n from: { opacity: 0, filter: 'blur(12px)', transform: 'translateY(40px)' },\n to: { opacity: 1, filter: 'blur(0px)', transform: 'translateY(0px)' },\n },\n 'flip-up': {\n from: { opacity: 0, transform: 'perspective(800px) rotateX(60deg)' },\n to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },\n },\n 'flip-down': {\n from: { opacity: 0, transform: 'perspective(800px) rotateX(-60deg)' },\n to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },\n },\n 'rotate-left': {\n from: { opacity: 0, transform: 'rotate(-15deg) translateX(-40px)' },\n to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },\n },\n 'rotate-right': {\n from: { opacity: 0, transform: 'rotate(15deg) translateX(40px)' },\n to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },\n },\n // clip-path reveals: content is uncovered without moving or fading\n 'clip-up': {\n from: { clipPath: 'inset(100% 0% 0% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-down': {\n from: { clipPath: 'inset(0% 0% 100% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-left': {\n from: { clipPath: 'inset(0% 0% 0% 100%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-right': {\n from: { clipPath: 'inset(0% 100% 0% 0%)' },\n to: { clipPath: 'inset(0% 0% 0% 0%)' },\n },\n 'clip-circle': {\n from: { clipPath: 'circle(0% at 50% 50%)' },\n to: { clipPath: 'circle(75% at 50% 50%)' },\n },\n};\n\nexport function resolvePreset(animation: AnimationPreset | AnimationPreset[] | CustomAnimation): KeyframeMap {\n if (typeof animation === 'string') {\n return PRESETS[animation.trim() as AnimationPreset] ?? PRESETS['fade-in-up'];\n }\n \n if (Array.isArray(animation)) {\n const combined: KeyframeMap = { from: {}, to: {} };\n animation.forEach(name => {\n const preset = PRESETS[name.trim() as AnimationPreset];\n if (preset) {\n Object.entries(preset.from).forEach(([key, val]) => {\n if (key === 'transform' && combined.from[key]) {\n combined.from[key] = `${combined.from[key]} ${val}`;\n } else {\n combined.from[key] = val;\n }\n });\n Object.entries(preset.to).forEach(([key, val]) => {\n if (key === 'transform' && combined.to[key]) {\n combined.to[key] = `${combined.to[key]} ${val}`;\n } else {\n combined.to[key] = val;\n }\n });\n }\n });\n return combined;\n }\n \n return animation;\n}\n\n/** Easing to CSS cubic-bezier mapping */\nexport const EASING_MAP: Record<string, string> = {\n linear: 'linear',\n ease: 'ease',\n 'ease-in': 'ease-in',\n 'ease-out': 'ease-out',\n 'ease-in-out': 'ease-in-out',\n spring: 'cubic-bezier(0.34, 1.56, 0.64, 1)',\n 'soft-spring': 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',\n 'heavy-bounce': 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',\n};\n\nexport function resolveEasing(easing: EasingType): string {\n if (typeof easing === 'string') {\n return EASING_MAP[easing] ?? easing;\n }\n if (Array.isArray(easing)) {\n return `cubic-bezier(${easing.join(', ')})`;\n }\n if (typeof easing === 'function') {\n // Functions cannot be expressed as a CSS easing string; the core samples\n // them into a `linear()` easing (or keyframes on older browsers).\n return 'linear';\n }\n return 'ease';\n}\n","/**\n * use-scroll-animate - Core Implementation\n * Uses IntersectionObserver + Web Animations API for zero-dependency,\n * high-performance scroll-triggered animations.\n */\n\nimport type {\n AnimateOptions,\n AnimatedElement,\n ScrollAnimateConfig,\n ScrollAnimateInstance,\n} from './types';\nimport { resolvePreset, resolveEasing } from './presets';\n\ntype KeyframeMap = ReturnType<typeof resolvePreset>;\ntype Target = string | Element | NodeList | Element[];\ntype Root = Element | Document | null;\n\nconst DEFAULT_CONFIG: Required<ScrollAnimateConfig> = {\n defaultAnimation: 'fade-in-up',\n defaultDuration: 600,\n defaultDelay: 0,\n defaultEasing: 'ease',\n defaultThreshold: 0.1,\n defaultRootMargin: '0px',\n defaultRepeat: false,\n defaultOnce: true,\n defaultOffset: 0,\n hiddenClass: 'sa-hidden',\n visibleClass: 'sa-visible',\n useClassNames: false,\n disabled: false,\n root: null,\n autoUnregister: true,\n defaultEngine: 'auto',\n};\n\nconst noop = () => undefined;\n\n/* ------------------------------------------------------------------ */\n/* Environment helpers (all SSR-safe: never touch globals at import) */\n/* ------------------------------------------------------------------ */\n\nconst hasDOM = (): boolean => typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/** @internal */\nexport const supportsObserver = (): boolean => hasDOM() && typeof IntersectionObserver !== 'undefined';\n\nlet reducedMotionQuery: MediaQueryList | null | undefined;\n\n/** @internal Whether the user asked the OS/browser to reduce motion. */\nexport function prefersReducedMotion(): boolean {\n if (!hasDOM()) return false;\n if (reducedMotionQuery === undefined) {\n reducedMotionQuery =\n typeof window.matchMedia === 'function' ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;\n }\n return !!reducedMotionQuery && reducedMotionQuery.matches;\n}\n\nlet scrollTimelineSupported: boolean | undefined;\n\n/**\n * Whether the browser can run presets on a native scroll-driven timeline:\n * `CSS.supports('animation-timeline: view()')` plus the `ViewTimeline`\n * constructor used to attach it from JavaScript. Cached. SSR-safe.\n */\nexport function supportsScrollTimeline(): boolean {\n if (scrollTimelineSupported === undefined) {\n scrollTimelineSupported =\n hasDOM() &&\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('animation-timeline: view()') &&\n typeof (globalThis as any).ViewTimeline === 'function';\n }\n return scrollTimelineSupported;\n}\n\n/** @internal Reset the cached feature checks (tests). */\nexport function resetFeatureCache(): void {\n scrollTimelineSupported = undefined;\n linearSupported = undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* Option parsing */\n/* ------------------------------------------------------------------ */\n\nfunction num(value: string | undefined): number | undefined {\n if (value === undefined || value.trim() === '') return undefined;\n const n = parseFloat(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n\nconst DEFAULT_PROGRESS_VAR = '--sa-progress';\nconst DEFAULT_VIEW_RANGE: [string, string] = ['entry 0%', 'entry 100%'];\n\n/** `''` (bare attribute) -> default name; `sa-progress` -> `--sa-progress`. */\nfunction normalizeVar(name: string): string {\n const v = name.trim();\n if (!v) return DEFAULT_PROGRESS_VAR;\n return v.startsWith('--') ? v : `--${v}`;\n}\n\n/**\n * @internal Read options from string attributes. `get(name)` returns the raw\n * value of the attribute `name` (kebab-case, e.g. `root-margin`), `''` for a\n * bare attribute and `undefined` when absent. Shared by `data-sa-*` and the\n * `<scroll-animate>` element.\n */\nexport function readOptions(get: (name: string) => string | undefined): AnimateOptions {\n const opts: AnimateOptions = {};\n\n const anim = get('animation');\n if (anim) {\n opts.animation = (anim.includes(',') ? anim.split(',').map((s) => s.trim()) : anim.trim()) as any;\n }\n opts.duration = num(get('duration'));\n opts.delay = num(get('delay'));\n const easing = get('easing');\n if (easing) {\n const e = easing.trim();\n if (e.startsWith('[')) {\n try {\n opts.easing = JSON.parse(e);\n } catch {\n // Malformed JSON: fall back to the default easing instead of throwing\n }\n } else {\n opts.easing = e;\n }\n }\n const t = get('threshold');\n if (t) {\n opts.threshold = t.includes(',') ? t.split(',').map(parseFloat).filter(Number.isFinite) : num(t);\n }\n const rootMargin = get('root-margin');\n if (rootMargin) opts.rootMargin = rootMargin;\n const repeat = get('repeat');\n if (repeat !== undefined) opts.repeat = repeat !== 'false';\n const once = get('once');\n if (once !== undefined) opts.once = once !== 'false';\n opts.offset = num(get('offset'));\n opts.stagger = num(get('stagger'));\n const progressVar = get('progress-var');\n if (progressVar !== undefined) opts.progressVar = normalizeVar(progressVar);\n const engine = get('engine')?.trim();\n if (engine === 'auto' || engine === 'js' || engine === 'css') opts.engine = engine;\n const range = get('view-range');\n if (range) {\n const [start, end] = range.split(',').map((s) => s.trim());\n if (start && end) opts.viewRange = [start, end];\n }\n const exit = get('exit');\n if (exit !== undefined) {\n const e = exit.trim();\n opts.exit = e === '' || e === 'true' ? true : e === 'false' ? false : ((e.includes(',') ? e.split(',').map((s) => s.trim()) : e) as any);\n }\n const progress = get('progress');\n if (progress) opts.progressMode = progress.trim() === 'scroll' ? 'scroll' : 'ratio';\n\n // Drop keys that were not set, so they don't override defaults when spread.\n (Object.keys(opts) as Array<keyof AnimateOptions>).forEach((k) => opts[k] === undefined && delete opts[k]);\n return opts;\n}\n\nfunction parseDataAttributes(el: Element, config: Required<ScrollAnimateConfig>): Required<AnimateOptions> {\n return mergeOptions(\n readOptions((name) => {\n const v = el.getAttribute(`data-sa-${name}`);\n return v === null ? undefined : v;\n }),\n config\n );\n}\n\nfunction mergeOptions(opts: AnimateOptions, config: Required<ScrollAnimateConfig>): Required<AnimateOptions> {\n let engine = opts.engine ?? config.defaultEngine;\n // 'auto' keeps time-based semantics when the element asks for them explicitly.\n if (engine === 'auto' && (opts.duration !== undefined || opts.delay !== undefined || opts.offset !== undefined || (opts.stagger ?? 0) > 0)) {\n engine = 'js';\n }\n const exit = opts.exit ?? false;\n const repeat = opts.repeat ?? (exit ? true : config.defaultRepeat);\n const threshold = opts.threshold ?? config.defaultThreshold;\n return {\n animation: opts.animation ?? config.defaultAnimation,\n duration: opts.duration ?? config.defaultDuration,\n delay: opts.delay ?? config.defaultDelay,\n easing: opts.easing ?? config.defaultEasing,\n threshold: Array.isArray(threshold) && threshold.length === 0 ? config.defaultThreshold : threshold,\n rootMargin: opts.rootMargin ?? config.defaultRootMargin,\n repeat,\n once: opts.once ?? (repeat ? false : config.defaultOnce),\n offset: opts.offset ?? config.defaultOffset,\n stagger: opts.stagger ?? 0,\n onStart: opts.onStart ?? noop,\n onComplete: opts.onComplete ?? noop,\n onEnter: opts.onEnter ?? noop,\n onLeave: opts.onLeave ?? noop,\n onProgress: opts.onProgress ?? noop,\n progressMode: opts.progressMode ?? 'ratio',\n progressVar: opts.progressVar ? normalizeVar(opts.progressVar) : '',\n engine,\n viewRange: opts.viewRange ?? DEFAULT_VIEW_RANGE,\n exit,\n };\n}\n\nfunction resolveTargets(target: Target | null | undefined): Element[] {\n if (!target || !hasDOM()) return [];\n if (typeof target === 'string') return Array.from(document.querySelectorAll(target));\n if (target instanceof Element) return [target];\n if (Array.isArray(target) || target instanceof NodeList) {\n return (Array.from(target as ArrayLike<Node>) as Element[]).filter((el) => el instanceof Element);\n }\n return [];\n}\n\n/**\n * Apply `offset` to the bottom edge of a rootMargin, preserving the other\n * three sides. `offset: 100` means \"trigger 100px later\" (bottom -100px).\n * @internal\n */\nexport function applyOffset(rootMargin: string, offset: number): string {\n if (!offset) return rootMargin;\n const parts = (rootMargin || '0px').trim().split(/\\s+/);\n const top = parts[0];\n const right = parts[1] ?? top;\n const bottom = parts[2] ?? top;\n const left = parts[3] ?? right;\n const m = /^(-?\\d*\\.?\\d+)(px)?$/.exec(bottom);\n const base = m ? parseFloat(m[1]) : 0; // non-px bottoms (e.g. %) cannot be combined; offset wins\n return `${top} ${right} ${base - offset}px ${left}`;\n}\n\nfunction needsProgress(opts: Required<AnimateOptions>): boolean {\n return opts.onProgress !== noop || !!opts.progressVar;\n}\n\n/**\n * True scroll progress of `el` through the viewport (or `root`): 0 when its top\n * edge reaches the bottom of the viewport, 1 when its bottom edge passes the top.\n * Works for elements taller than the viewport. Returns 0 without a DOM.\n */\nexport function getScrollProgress(el: Element, root?: Element | null): number {\n if (!hasDOM()) return 0;\n const rect = el.getBoundingClientRect();\n let top = 0;\n let height = window.innerHeight || document.documentElement.clientHeight || 0;\n if (root) {\n const r = root.getBoundingClientRect();\n top = r.top;\n height = r.height;\n }\n const total = height + rect.height;\n if (total <= 0) return 0;\n const p = (top + height - rect.top) / total;\n return p < 0 ? 0 : p > 1 ? 1 : p;\n}\n\n/* ------------------------------------------------------------------ */\n/* Animation */\n/* ------------------------------------------------------------------ */\n\n/** The animation currently running on an element, so it can be cancelled/replaced. */\nconst running = new WeakMap<Element, Animation>();\n/** Native engine: the scroll-linked exit animation, next to the entrance in `running`. */\nconst exits = new WeakMap<Element, Animation>();\nconst timers = new WeakMap<Element, ReturnType<typeof setTimeout>>();\n\nfunction cancelRunning(el: Element): void {\n const exitAnim = exits.get(el);\n if (exitAnim) {\n exits.delete(el);\n exitAnim.cancel();\n }\n const anim = running.get(el);\n if (anim) {\n running.delete(el);\n anim.onfinish = null;\n anim.cancel();\n }\n const timer = timers.get(el);\n if (timer !== undefined) {\n clearTimeout(timer);\n timers.delete(el);\n }\n}\n\nfunction setStyles(el: Element, styles: Record<string, string | number>): void {\n const style = (el as HTMLElement).style;\n if (!style) return;\n Object.keys(styles).forEach((prop) => {\n (style as any)[prop] = String(styles[prop]);\n });\n}\n\nconst NUM_UNIT = /(-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?)([a-z%]*)/gi;\n\n/**\n * Interpolate two CSS values at `t`. Numbers interpolate directly; strings\n * interpolate when they share the same structure (e.g. `translateY(40px)` ->\n * `translateY(0px)`, or `scale(0.8)` -> `scale(1)`). Otherwise snaps at 0.5.\n * @internal\n */\nexport function interpolateValue(from: string | number, to: string | number, t: number): string | number {\n if (typeof from === 'number' && typeof to === 'number') return from + (to - from) * t;\n const a = String(from);\n const b = String(to);\n const ta: Array<[number, string]> = [];\n const tb: Array<[number, string]> = [];\n const skA = a.replace(NUM_UNIT, (_, n, u) => (ta.push([parseFloat(n), u]), '#'));\n const skB = b.replace(NUM_UNIT, (_, n, u) => (tb.push([parseFloat(n), u]), '#'));\n if (skA !== skB || ta.length !== tb.length) return t < 0.5 ? from : to;\n let i = 0;\n let ok = true;\n const out = skA.replace(/#/g, () => {\n const [na, ua] = ta[i];\n const [nb, ub] = tb[i++];\n if (ua !== ub && na !== 0 && nb !== 0 && ua && ub) ok = false;\n const unit = ua || ub;\n return `${+(na + (nb - na) * t).toFixed(4)}${unit}`;\n });\n return ok ? out : t < 0.5 ? from : to;\n}\n\nconst EASING_SAMPLES = 30;\nlet linearSupported: boolean | undefined;\n\nfunction supportsLinearEasing(): boolean {\n if (linearSupported === undefined) {\n linearSupported =\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('animation-timing-function', 'linear(0, 1)');\n }\n return linearSupported;\n}\n\nfunction sampleEasing(fn: (t: number) => number): number[] {\n const values: number[] = [];\n for (let i = 0; i <= EASING_SAMPLES; i++) {\n const v = fn(i / EASING_SAMPLES);\n values.push(Number.isFinite(v) ? +v.toFixed(4) : i / EASING_SAMPLES);\n }\n return values;\n}\n\nfunction buildAnimation(\n preset: KeyframeMap,\n easing: Required<AnimateOptions>['easing']\n): { keyframes: Keyframe[]; easing: string } {\n if (typeof easing !== 'function') {\n return { keyframes: [preset.from as Keyframe, preset.to as Keyframe], easing: resolveEasing(easing) };\n }\n const samples = sampleEasing(easing);\n // Modern browsers: an exact, property-agnostic `linear()` easing curve.\n if (supportsLinearEasing()) {\n return { keyframes: [preset.from as Keyframe, preset.to as Keyframe], easing: `linear(${samples.join(', ')})` };\n }\n // Fallback: approximate the curve with interpolated keyframes.\n const props = Object.keys(preset.from).filter((p) => p in preset.to);\n const keyframes = samples.map((eased, i) => {\n const frame: Keyframe = { offset: i / EASING_SAMPLES };\n props.forEach((prop) => {\n frame[prop] = interpolateValue(preset.from[prop], preset.to[prop], eased);\n });\n return frame;\n });\n return { keyframes, easing: 'linear' };\n}\n\n/** Make an element visible without animating (reduced motion / disabled / no WAAPI). */\nfunction reveal(el: Element, config: Required<ScrollAnimateConfig>): void {\n cancelRunning(el);\n if (config.useClassNames) {\n el.classList.remove(config.hiddenClass);\n el.classList.add(config.visibleClass);\n } else {\n const style = (el as HTMLElement).style;\n if (style) style.opacity = '';\n }\n}\n\n/** @internal Cancel a running/pending animation and make the element visible. */\nexport function stopAnimation(el: Element, config: ScrollAnimateConfig = {}): void {\n reveal(el, { ...DEFAULT_CONFIG, ...config });\n}\n\n/** @internal Resolve a selector / Element / NodeList / Element[] to elements (SSR-safe). */\nexport { resolveTargets, hasDOM };\n\n/** @internal Whether animations should be skipped entirely. */\nexport function motionDisabled(config: Pick<ScrollAnimateConfig, 'disabled'>): boolean {\n return !!config.disabled || prefersReducedMotion();\n}\n\nfunction runAnimation(\n el: Element,\n opts: Required<AnimateOptions>,\n config: Required<ScrollAnimateConfig>,\n staggerIndex = 0,\n pending?: Set<Element>\n): void {\n const { duration, delay, stagger, onStart, onComplete } = opts;\n const totalDelay = Math.max(0, delay + staggerIndex * stagger);\n cancelRunning(el);\n\n if (motionDisabled(config)) {\n reveal(el, config);\n onStart(el);\n onComplete(el);\n return;\n }\n\n if (config.useClassNames) {\n if (totalDelay > 0) (el as HTMLElement).style.animationDelay = `${totalDelay}ms`;\n el.classList.remove(config.hiddenClass);\n el.classList.add(config.visibleClass);\n onStart(el);\n pending?.add(el);\n timers.set(\n el,\n setTimeout(() => {\n timers.delete(el);\n pending?.delete(el);\n onComplete(el);\n }, duration + totalDelay)\n );\n return;\n }\n\n const preset = resolvePreset(opts.animation);\n // Presets that don't animate opacity (slide-*, clip-*, scale-x, ...) would\n // otherwise stay at the `opacity: 0` applied while waiting to enter.\n if (!('opacity' in preset.to)) {\n const style = (el as HTMLElement).style;\n if (style && style.opacity === '0') style.opacity = '';\n }\n\n if (typeof el.animate !== 'function') {\n setStyles(el, preset.to);\n onStart(el);\n onComplete(el);\n return;\n }\n\n const built = buildAnimation(preset, opts.easing);\n const timing: KeyframeAnimationOptions = { duration, delay: totalDelay, easing: built.easing, fill: 'both' };\n let anim: Animation;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n // Invalid user easing string (WAAPI throws a TypeError): fall back to 'ease'\n anim = el.animate(built.keyframes, { ...timing, easing: 'ease' });\n }\n running.set(el, anim);\n onStart(el);\n anim.onfinish = () => {\n if (running.get(el) === anim) {\n running.delete(el);\n // Persist the end state inline and drop the filling animation. This frees\n // the Animation object and lets later inline styles (parallax, user code)\n // take effect instead of being masked by `fill: forwards`.\n try {\n anim.commitStyles();\n } catch {\n setStyles(el, preset.to);\n }\n anim.cancel();\n }\n onComplete(el);\n };\n}\n\n/**\n * Native engine: attach the preset to a `ViewTimeline` of the element, so the\n * browser drives it from scroll position. Returns `null` when that fails\n * (caller falls back to the JS engine).\n */\nfunction startNative(el: Element, opts: Required<AnimateOptions>, onFrozen?: () => void): Animation | null {\n if (typeof el.animate !== 'function') return null;\n const preset = resolvePreset(opts.animation);\n const built = buildAnimation(preset, opts.easing);\n let anim: Animation;\n try {\n const timeline = new (globalThis as any).ViewTimeline({ subject: el, axis: 'block' });\n const timing = {\n fill: 'both',\n easing: built.easing,\n timeline,\n rangeStart: opts.viewRange[0],\n rangeEnd: opts.viewRange[1],\n } as KeyframeAnimationOptions;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n anim = el.animate(built.keyframes, { ...timing, easing: 'linear' });\n }\n } catch {\n return null;\n }\n running.set(el, anim);\n if (opts.exit) {\n // Reverse keyframes over the `exit` range; `fill: 'forwards'` so it has\n // no effect before the element starts leaving.\n const leave = resolvePreset(opts.exit === true ? opts.animation : opts.exit);\n const out = buildAnimation({ from: leave.to, to: leave.from }, opts.easing);\n try {\n const timeline = new (globalThis as any).ViewTimeline({ subject: el, axis: 'block' });\n const timing = { fill: 'forwards', easing: out.easing, timeline, rangeStart: 'exit 0%', rangeEnd: 'exit 100%' };\n exits.set(el, el.animate(out.keyframes, timing as KeyframeAnimationOptions));\n } catch {\n // Exit is cosmetic: ignore if unsupported.\n }\n }\n const keep = opts.repeat || !opts.once;\n anim.onfinish = () => {\n // `once`: freeze the end state, so scrolling back up does not reverse it.\n if (!keep && running.get(el) === anim) {\n running.delete(el);\n try {\n anim.commitStyles();\n } catch {\n setStyles(el, preset.to);\n }\n anim.cancel();\n onFrozen?.();\n }\n opts.onComplete(el);\n };\n return anim;\n}\n\n/** Play the exit animation (entrance or `exit` preset, reversed), ending hidden. */\nfunction runExit(el: Element, opts: Required<AnimateOptions>, config: Required<ScrollAnimateConfig>): void {\n if (config.useClassNames || typeof el.animate !== 'function') {\n hideElement(el, config);\n return;\n }\n cancelRunning(el);\n const preset = resolvePreset(opts.exit === true ? opts.animation : (opts.exit as Exclude<typeof opts.exit, boolean>));\n const built = buildAnimation({ from: preset.to, to: preset.from }, opts.easing);\n const timing: KeyframeAnimationOptions = { duration: opts.duration, easing: built.easing, fill: 'forwards' };\n let anim: Animation;\n try {\n anim = el.animate(built.keyframes, timing);\n } catch {\n anim = el.animate(built.keyframes, { ...timing, easing: 'ease' });\n }\n // Kept (filling) until the next entrance cancels it.\n running.set(el, anim);\n}\n\nfunction hideElement(el: Element, config: Required<ScrollAnimateConfig>): void {\n cancelRunning(el);\n if (config.useClassNames) {\n el.classList.add(config.hiddenClass);\n el.classList.remove(config.visibleClass);\n } else {\n const style = (el as HTMLElement).style;\n if (style) style.opacity = '0';\n }\n}\n\n/** @internal Hide an element before its entrance animation, unless motion is off. */\nexport function prepareElement(el: Element, config: ScrollAnimateConfig = {}): void {\n const full = { ...DEFAULT_CONFIG, ...config };\n if (!motionDisabled(full)) hideElement(el, full);\n}\n\nlet progressThresholds: number[] | undefined;\nfunction getProgressThresholds(): number[] {\n if (!progressThresholds) {\n progressThresholds = [];\n for (let i = 0; i <= 100; i++) progressThresholds.push(i / 100);\n }\n return progressThresholds;\n}\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\n/* ------------------------------------------------------------------ */\n/* Instance */\n/* ------------------------------------------------------------------ */\n\nexport function createScrollAnimate(userConfig: ScrollAnimateConfig = {}): ScrollAnimateInstance {\n let config: Required<ScrollAnimateConfig> = { ...DEFAULT_CONFIG, ...userConfig };\n const registry = new Map<Element, AnimatedElement>();\n // `once` elements that finished and were dropped from the registry (autoUnregister).\n let finished = new WeakSet<Element>();\n // Elements in `progressMode: 'scroll'` that are currently inside the viewport.\n const scrolling = new Set<Element>();\n let frame = 0;\n let listening: EventTarget | null = null;\n // Active watch() MutationObservers, disconnected by destroy().\n const watchers = new Set<MutationObserver>();\n // Elements with a pending class-name completion timer started by this instance.\n const pending = new Set<Element>();\n // Elements whose entrance runs on a native scroll-driven timeline.\n const natives = new Set<Element>();\n\n // Observers are shared between elements with the same root/threshold/rootMargin,\n // instead of one (or two) IntersectionObservers per element.\n const pools = new Map<Root, Map<string, IntersectionObserver>>();\n\n function pooled(root: Root, key: string, create: () => IntersectionObserver): IntersectionObserver {\n let pool = pools.get(root);\n if (!pool) pools.set(root, (pool = new Map()));\n let io = pool.get(key);\n if (!io) pool.set(key, (io = create()));\n return io;\n }\n\n function teardown(el: Element, restore: boolean): void {\n const record = registry.get(el);\n if (!record) return;\n record.observer.unobserve(el);\n record.progressObserver?.unobserve(el);\n registry.delete(el);\n untrack(el);\n if (record.engine === 'css') {\n // A scroll-linked animation would keep following the scroll: stop it and\n // show the element (unless it finished and is just being released).\n if (restore) {\n natives.delete(el);\n reveal(el, config);\n } else if (el.isConnected === false) {\n // Left the DOM: drop it too, or the instance keeps it alive (and\n // destroy() touches it) for its whole lifetime.\n natives.delete(el);\n }\n return;\n }\n // An element that never animated would otherwise stay invisible forever.\n if (restore && !record.animated) reveal(el, config);\n }\n\n function pruneDetached(): void {\n registry.forEach((record, el) => {\n if (el.isConnected === false) teardown(el, false);\n });\n }\n\n function emitProgress(el: Element, record: AnimatedElement, progress: number): void {\n const opts = record.options;\n opts.onProgress(el, progress);\n if (opts.progressVar) {\n const style = (el as HTMLElement).style;\n if (style) style.setProperty(opts.progressVar, String(+progress.toFixed(4)));\n }\n }\n\n function update(): void {\n frame = 0;\n scrolling.forEach((el) => {\n const record = registry.get(el);\n if (record) emitProgress(el, record, getScrollProgress(el, config.root));\n });\n }\n\n // rAF-throttled; IntersectionObserver-capable browsers all have rAF.\n const schedule = () => frame || (frame = requestAnimationFrame(update));\n\n function listen(on: boolean): void {\n if (on === !!listening) return;\n const method = on ? 'addEventListener' : 'removeEventListener';\n const target: EventTarget = listening || (config.root as EventTarget | null) || window;\n target[method]('scroll', schedule, PASSIVE);\n window[method]('resize', schedule, PASSIVE);\n listening = on ? target : null;\n if (!on && frame) {\n cancelAnimationFrame(frame);\n frame = 0;\n }\n }\n\n function untrack(el: Element): void {\n if (scrolling.delete(el) && !scrolling.size) listen(false);\n }\n\n function onScrollIntersect(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => {\n const el = entry.target;\n const record = registry.get(el);\n if (!record) return;\n if (entry.isIntersecting) {\n scrolling.add(el);\n listen(true);\n } else {\n untrack(el);\n }\n // Emit right away so the edges (0 / 1) are reported even on fast scrolls.\n emitProgress(el, record, getScrollProgress(el, config.root));\n });\n }\n\n function onIntersect(entries: IntersectionObserverEntry[]): void {\n const staggerCounts = new Map<Element | null, number>();\n entries.forEach((entry) => {\n const el = entry.target;\n const record = registry.get(el);\n if (!record) return;\n const opts = record.options;\n\n if (el.isConnected === false) {\n teardown(el, false);\n return;\n }\n\n if (record.engine === 'css') {\n // The browser drives the animation; only lifecycle bookkeeping here.\n if (entry.isIntersecting) {\n opts.onEnter(el);\n if (!record.animated) {\n record.animated = true;\n opts.onStart(el);\n }\n if (opts.once && !opts.repeat) {\n record.observer.unobserve(el);\n if (config.autoUnregister && !record.progressObserver) {\n finished.add(el);\n teardown(el, false);\n }\n }\n } else {\n opts.onLeave(el);\n if (opts.repeat) record.animated = false;\n }\n return;\n }\n\n if (entry.isIntersecting) {\n opts.onEnter(el);\n if (record.animated && !opts.repeat) return;\n\n // Stagger relative to siblings revealed in the same batch, so elements\n // scrolled into view later don't inherit an ever-growing delay.\n let staggerIndex = 0;\n if (opts.stagger > 0) {\n const parent = el.parentElement;\n staggerIndex = staggerCounts.get(parent) ?? 0;\n staggerCounts.set(parent, staggerIndex + 1);\n }\n\n runAnimation(el, opts, config, staggerIndex, pending);\n record.animated = true;\n\n if (opts.once && !opts.repeat) {\n // Keep the progress observer: parallax/onProgress must keep working.\n record.observer.unobserve(el);\n if (config.autoUnregister && !record.progressObserver) {\n // Nothing left to watch: free the record (the running animation\n // keeps its own reference until it finishes).\n finished.add(el);\n teardown(el, false);\n }\n }\n } else {\n opts.onLeave(el);\n if (opts.repeat && record.animated) {\n if (!motionDisabled(config)) {\n if (opts.exit) runExit(el, opts, config);\n else hideElement(el, config);\n }\n record.animated = false;\n }\n }\n });\n }\n\n function onProgress(entries: IntersectionObserverEntry[]): void {\n entries.forEach((entry) => {\n const record = registry.get(entry.target);\n if (!record) return;\n emitProgress(entry.target, record, entry.intersectionRatio);\n });\n }\n\n function getObserver(opts: Required<AnimateOptions>): IntersectionObserver {\n const rootMargin = applyOffset(opts.rootMargin, opts.offset);\n const threshold = opts.threshold;\n const root = config.root;\n return pooled(root, `m|${rootMargin}|${String(threshold)}`, () =>\n new IntersectionObserver(onIntersect, { threshold, rootMargin, root: root as Element | null })\n );\n }\n\n function getProgressObserver(opts: Required<AnimateOptions>): IntersectionObserver {\n const root = config.root;\n if (opts.progressMode === 'scroll') {\n // Only used to know when to start/stop measuring; progress itself comes\n // from a single shared, rAF-throttled passive scroll listener.\n return pooled(root, `s|${opts.rootMargin}`, () =>\n new IntersectionObserver(onScrollIntersect, { threshold: 0, rootMargin: opts.rootMargin, root: root as Element | null })\n );\n }\n return pooled(root, `p|${opts.rootMargin}`, () =>\n new IntersectionObserver(onProgress, {\n threshold: getProgressThresholds(),\n rootMargin: opts.rootMargin,\n root: root as Element | null,\n })\n );\n }\n\n function attach(el: Element, record: AnimatedElement, observeMain: boolean): void {\n record.observer = getObserver(record.options);\n if (observeMain) record.observer.observe(el);\n record.progressObserver = needsProgress(record.options) ? getProgressObserver(record.options) : undefined;\n record.progressObserver?.observe(el);\n }\n\n function wantsNative(opts: Required<AnimateOptions>): boolean {\n return opts.engine !== 'js' && !config.useClassNames && !motionDisabled(config) && supportsScrollTimeline();\n }\n\n function observeElement(el: Element, opts: Required<AnimateOptions>): void {\n if (registry.has(el) || finished.has(el)) return;\n\n if (!supportsObserver()) {\n // No IntersectionObserver (very old browser): never leave content hidden.\n reveal(el, config);\n return;\n }\n\n const record = { element: el, options: opts, animated: false, engine: 'js' } as AnimatedElement;\n if (wantsNative(opts)) {\n cancelRunning(el);\n if (startNative(el, opts, () => natives.delete(el))) {\n record.engine = 'css';\n natives.add(el);\n }\n }\n if (record.engine === 'js' && !motionDisabled(config)) hideElement(el, config);\n\n registry.set(el, record);\n attach(el, record, true);\n }\n\n function observeDataElement(el: Element): void {\n if (!registry.has(el)) observeElement(el, parseDataAttributes(el, config));\n }\n\n const instance: ScrollAnimateInstance = {\n observe(target, options = {}) {\n pruneDetached();\n const opts = mergeOptions(options, config);\n resolveTargets(target).forEach((el) => observeElement(el, opts));\n },\n\n unobserve(target) {\n resolveTargets(target).forEach((el) => {\n finished.delete(el);\n teardown(el, true);\n });\n },\n\n init(rootElement) {\n const scope = rootElement ?? (hasDOM() ? document : null);\n if (!scope) return;\n pruneDetached();\n scope.querySelectorAll('[data-sa]').forEach(observeDataElement);\n },\n\n watch(rootElement) {\n const scope = rootElement ?? (hasDOM() ? document : null);\n if (!scope || typeof MutationObserver === 'undefined') return noop;\n instance.init(scope);\n const observeTree = (node: Element) => {\n if (node.hasAttribute('data-sa')) observeDataElement(node);\n node.querySelectorAll('[data-sa]').forEach(observeDataElement);\n };\n const mo = new MutationObserver((records) => {\n let removed = false;\n records.forEach((record) => {\n if (record.type === 'attributes') {\n const target = record.target as Element;\n if (target.isConnected !== false) observeTree(target);\n return;\n }\n record.addedNodes.forEach((node) => {\n if (node instanceof Element && node.isConnected !== false) observeTree(node);\n });\n if (record.removedNodes.length) removed = true;\n });\n // Free elements that left the DOM (they can't animate any more).\n if (removed) pruneDetached();\n });\n mo.observe(scope, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-sa'] });\n watchers.add(mo);\n return () => {\n mo.disconnect();\n watchers.delete(mo);\n };\n },\n\n destroy() {\n watchers.forEach((mo) => mo.disconnect());\n watchers.clear();\n // Class-name mode: drop completion timers so onComplete never fires after destroy().\n pending.forEach((el) => {\n const timer = timers.get(el);\n if (timer !== undefined) {\n clearTimeout(timer);\n timers.delete(el);\n }\n });\n pending.clear();\n registry.forEach((record, el) => {\n if (!record.animated && record.engine !== 'css') reveal(el, config);\n });\n // Native scroll-linked animations still running: stop them, show content.\n natives.forEach((el) => {\n if (running.has(el)) reveal(el, config);\n });\n natives.clear();\n pools.forEach((pool) => pool.forEach((io) => io.disconnect()));\n pools.clear();\n registry.clear();\n scrolling.clear();\n listen(false);\n finished = new WeakSet();\n },\n\n refresh() {\n // Rebuild observers (e.g. after configure({ root })) without re-hiding or\n // replaying elements that have already animated.\n pools.forEach((pool) => pool.forEach((io) => io.disconnect()));\n pools.clear();\n scrolling.clear();\n listen(false);\n pruneDetached();\n if (!supportsObserver()) return;\n registry.forEach((record, el) => {\n const done = record.animated && record.options.once && !record.options.repeat;\n attach(el, record, !done);\n });\n },\n\n animate(target, options = {}) {\n const opts = mergeOptions(options, config);\n resolveTargets(target).forEach((el) => runAnimation(el, opts, config, 0, pending));\n },\n\n getObservedElements() {\n return Array.from(registry.values());\n },\n\n configure(newConfig) {\n config = { ...config, ...newConfig };\n },\n };\n\n return instance;\n}\n","/**\n * use-scroll-animate - Staggered children\n * Reveal a container's children one after another when the container scrolls\n * into view, optionally also animating children that are added later.\n */\n\nimport type { AnimateOptions, ScrollAnimateInstance } from './types';\nimport { createScrollAnimate, hasDOM, prepareElement, stopAnimation, supportsObserver } from './core';\n\nexport interface StaggerOptions extends AnimateOptions {\n /** Delay between consecutive children in ms (default: 80) */\n stagger?: number;\n /**\n * Watch the container with a MutationObserver and animate children added\n * later (e.g. infinite lists). Children added after the container was\n * revealed animate when they scroll into view, staggered per batch.\n * (default: false)\n */\n observeChildren?: boolean;\n}\n\nlet fallback: ScrollAnimateInstance | null = null;\n\n/**\n * Animate the children of `container` with a stagger once it enters the\n * viewport. Returns a cleanup function. SSR-safe (no-op without a DOM).\n *\n * @example\n * const stop = staggerChildren(document.querySelector('ul'), { stagger: 60, observeChildren: true });\n */\nexport function staggerChildren(\n container: Element | null | undefined,\n options: StaggerOptions = {},\n instance?: ScrollAnimateInstance\n): () => void {\n if (!container || !hasDOM() || !supportsObserver()) return () => undefined; // leave content visible\n const sa = instance || fallback || (fallback = createScrollAnimate());\n const { stagger = 80, delay = 0, threshold = 0.1, rootMargin = '0px', observeChildren = false, ...rest } = options;\n\n let items = Array.from(container.children);\n let revealed = false;\n const late: Element[] = [];\n items.forEach((child) => prepareElement(child));\n\n const io = new IntersectionObserver(\n (entries) => {\n if (revealed || !entries.some((entry) => entry.isIntersecting)) return;\n revealed = true;\n io.disconnect();\n items.forEach((child, i) => {\n if (child.parentNode === container) sa.animate(child, { ...rest, delay: delay + i * stagger });\n });\n items = [];\n },\n { threshold, rootMargin }\n );\n io.observe(container);\n\n let mo: MutationObserver | undefined;\n if (observeChildren && typeof MutationObserver !== 'undefined') {\n mo = new MutationObserver((records) => {\n records.forEach((record) => {\n record.addedNodes.forEach((node) => {\n if (!(node instanceof Element) || node.parentNode !== container) return;\n if (!revealed) {\n prepareElement(node);\n items.push(node);\n } else {\n // The core engine staggers siblings relative to the batch that\n // enters the viewport together.\n late.push(node);\n sa.observe(node, { ...rest, delay, stagger, threshold, rootMargin });\n }\n });\n record.removedNodes.forEach((node) => {\n if (!(node instanceof Element)) return;\n items = items.filter((el) => el !== node);\n const i = late.indexOf(node);\n if (i >= 0) {\n late.splice(i, 1);\n sa.unobserve(node);\n }\n });\n });\n });\n mo.observe(container, { childList: true });\n }\n\n return () => {\n io.disconnect();\n mo?.disconnect();\n // Stopped before the container was revealed: never leave the children hidden.\n if (!revealed) {\n revealed = true;\n items.forEach((child) => stopAnimation(child));\n items = [];\n }\n late.forEach((el) => sa.unobserve(el));\n late.length = 0;\n };\n}\n","/**\n * use-scroll-animate/components — shared base for the `<usa-*>` custom elements.\n *\n * Everything here is lazy: nothing touches `window`, `document`,\n * `HTMLElement` or `matchMedia` at import time, so the components can be\n * imported during SSR (Next, Nuxt, Astro…) and in Electron/Tauri preload\n * scripts. Classes are created the first time a `define*()` function runs.\n */\n\nexport interface ComponentsConfig {\n /**\n * Inject each component's CSS when it is defined (default `true`). Uses a\n * constructable stylesheet (`document.adoptedStyleSheets`, which a strict\n * `style-src` CSP does not block) and falls back to a `<style>` tag. Set\n * to `false` when you load `use-scroll-animate/components.css` yourself.\n */\n injectStyles?: boolean;\n /**\n * `'user'` (default) follows `prefers-reduced-motion`; `'reduce'` always\n * uses the reduced variants (e.g. a kiosk / battery-saver mode);\n * `'no-preference'` ignores the OS setting (only for demos — respect your users).\n */\n reducedMotion?: 'user' | 'reduce' | 'no-preference';\n /**\n * Global motion intensity (v2.7): `'off'` (same as reduced motion),\n * `'low'` (shorter, calmer), `'normal'` (default) or `'high'`. Scales every\n * component animation's duration and sets `--usa-motion` (0 / 0.6 / 1 /\n * 1.25) on `<html>` for your own CSS. See `setMotionIntensity()`.\n */\n motionIntensity?: MotionIntensity;\n}\n\nexport type MotionIntensity = 'off' | 'low' | 'normal' | 'high';\nexport const MOTION_SCALE: Record<MotionIntensity, number> = { off: 0, low: 0.6, normal: 1, high: 1.25 };\n\nconst config: Required<ComponentsConfig> = { injectStyles: true, reducedMotion: 'user', motionIntensity: 'normal' };\n\n/** Change global component settings (call before `define*()` for `injectStyles`). */\nexport function configureComponents(options: ComponentsConfig): void {\n Object.assign(config, options);\n if (options.motionIntensity && typeof document !== 'undefined') {\n document.documentElement.style.setProperty('--usa-motion', String(MOTION_SCALE[options.motionIntensity] ?? 1));\n document.documentElement.setAttribute('data-usa-motion', options.motionIntensity);\n }\n}\n\n/** The current global motion intensity. */\nexport function getMotionIntensity(): MotionIntensity {\n return config.motionIntensity;\n}\n\n/** Duration multiplier for the current intensity (1 when `normal`). */\nexport function motionScale(): number {\n return MOTION_SCALE[config.motionIntensity] ?? 1;\n}\n\nexport const canDefine = (): boolean => typeof customElements !== 'undefined' && typeof HTMLElement !== 'undefined';\n\n/** `true` when animations should be reduced (OS setting or `configureComponents`). */\nexport function prefersReducedMotion(): boolean {\n if (config.motionIntensity === 'off') return true;\n if (config.reducedMotion !== 'user') return config.reducedMotion === 'reduce';\n return typeof matchMedia === 'function' && !!matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst injected = new Set<string>();\n\n/** Add a component's stylesheet to the document once. */\nexport function adoptStyles(id: string, css: string): void {\n if (!config.injectStyles || !css || injected.has(id) || typeof document === 'undefined') return;\n injected.add(id);\n try {\n if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in document) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];\n return;\n }\n } catch {\n /* fall through to <style> */\n }\n const style = document.createElement('style');\n style.setAttribute('data-usa', id);\n style.textContent = css;\n (document.head || document.documentElement).appendChild(style);\n}\n\n/** Attach `css` to a shadow root (constructable sheet where supported, else `<style>`). */\nexport function shadowStyles(root: ShadowRoot, css: string): void {\n try {\n if (typeof CSSStyleSheet === 'function' && 'adoptedStyleSheets' in root) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(css);\n root.adoptedStyleSheets = [sheet];\n return;\n }\n } catch {\n /* fall through */\n }\n const style = document.createElement('style');\n style.textContent = css;\n root.prepend(style);\n}\n\nexport type Cleanup = () => void;\n\n/**\n * Members shared by every `<usa-*>` element. Attribute helpers, a cleanup\n * bag that is emptied on disconnect, and motion helpers that degrade to the\n * final state without WAAPI or under reduced motion.\n */\nexport interface UsaElement extends HTMLElement {\n /** `true` while reduced motion applies to this element. */\n readonly reduced: boolean;\n}\n\nexport interface UsaBase extends UsaElement {\n mount(): void;\n changed(name: string): void;\n unmount(): void;\n str(name: string, fallback?: string): string;\n num(name: string, fallback: number): number;\n flag(name: string): boolean;\n setFlag(name: string, on: boolean): void;\n onCleanup(fn: Cleanup): void;\n listen<K extends keyof HTMLElementEventMap>(\n target: EventTarget,\n type: K | string,\n fn: (e: any) => void,\n options?: AddEventListenerOptions\n ): void;\n inView(cb: (visible: boolean, entry?: IntersectionObserverEntry) => void, init?: IntersectionObserverInit, target?: Element): void;\n motion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null;\n emit(type: string, detail?: unknown): boolean;\n}\n\ntype BaseCtor = new () => UsaBase;\nlet baseClass: BaseCtor | null = null;\n\n/** The lazily created base class (needs `HTMLElement`). */\nexport function getBase(): BaseCtor {\n if (baseClass) return baseClass;\n class Base extends HTMLElement {\n private _cleanups: Cleanup[] = [];\n private _connected = false;\n\n get reduced(): boolean {\n return prefersReducedMotion();\n }\n\n connectedCallback(): void {\n if (this._connected) return;\n this._connected = true;\n // Upgraded while the parser is still inside us (a <script> in <head>\n // defined the element): children/text are not there yet, so wait.\n if (typeof document !== 'undefined' && document.readyState === 'loading' && !this.nextSibling && !this.childNodes.length) {\n const go = () => {\n if (this._connected && this.isConnected) this.mount();\n };\n document.addEventListener('DOMContentLoaded', go, { once: true });\n this._cleanups.push(() => document.removeEventListener('DOMContentLoaded', go));\n return;\n }\n this.mount();\n }\n\n disconnectedCallback(): void {\n this._connected = false;\n this.teardown();\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, value: string | null): void {\n if (!this._connected || oldValue === value) return;\n this.changed(_name);\n }\n\n /** Re-mount on attribute change (override for finer updates). */\n changed(_name: string): void {\n this.teardown();\n this.mount();\n }\n\n private teardown(): void {\n this._cleanups.splice(0).reverse().forEach((fn) => fn());\n this.unmount();\n }\n\n mount(): void {}\n unmount(): void {}\n\n str(name: string, fallback = ''): string {\n const v = this.getAttribute(name);\n return v === null ? fallback : v;\n }\n\n num(name: string, fallback: number): number {\n const v = this.getAttribute(name);\n const n = v === null || v.trim() === '' ? NaN : Number(v);\n return Number.isFinite(n) ? n : fallback;\n }\n\n /** Boolean attribute: present and not `\"false\"`. */\n flag(name: string): boolean {\n const v = this.getAttribute(name);\n return v !== null && v !== 'false';\n }\n\n setFlag(name: string, on: boolean): void {\n if (on) this.setAttribute(name, '');\n else this.removeAttribute(name);\n }\n\n onCleanup(fn: Cleanup): void {\n this._cleanups.push(fn);\n }\n\n listen(target: EventTarget, type: string, fn: (e: any) => void, options?: AddEventListenerOptions): void {\n target.addEventListener(type, fn, options);\n this.onCleanup(() => target.removeEventListener(type, fn, options));\n }\n\n /** Calls `cb(true/false)` as the element enters / leaves the viewport. */\n inView(cb: (visible: boolean, entry?: IntersectionObserverEntry) => void, init?: IntersectionObserverInit, target: Element = this): void {\n if (typeof IntersectionObserver === 'undefined') {\n cb(true);\n return;\n }\n const io = new IntersectionObserver((entries) => {\n for (const e of entries) cb(e.isIntersecting, e);\n }, init);\n io.observe(target);\n this.onCleanup(() => io.disconnect());\n }\n\n /** `el.animate()` that returns `null` (and applies the last frame) without WAAPI. */\n motion(el: Element, keyframes: Keyframe[], options: KeyframeAnimationOptions): Animation | null {\n if (typeof (el as HTMLElement).animate !== 'function') {\n applyFrame(el as HTMLElement, keyframes[keyframes.length - 1]);\n return null;\n }\n const k = motionScale();\n if (k !== 1 && k > 0 && typeof options.duration === 'number') options = { ...options, duration: options.duration * k, delay: (options.delay || 0) * k };\n return (el as HTMLElement).animate(keyframes, options);\n }\n\n emit(type: string, detail?: unknown): boolean {\n return this.dispatchEvent(new CustomEvent(`usa:${type}`, { detail, bubbles: true, cancelable: true }));\n }\n }\n baseClass = Base as unknown as BaseCtor;\n return baseClass;\n}\n\n/** Write a keyframe's properties as inline styles (no-WAAPI fallback). */\nexport function applyFrame(el: HTMLElement, frame?: Keyframe): void {\n if (!frame) return;\n for (const [k, v] of Object.entries(frame)) {\n if (k === 'offset' || k === 'easing' || k === 'composite' || v == null) continue;\n (el.style as any)[k] = String(v);\n }\n}\n\n/**\n * Register `tag` with the class built by `make(Base)`. Returns the\n * constructor, the already registered one, or `undefined` without DOM.\n */\nexport function defineElement(\n tag: string,\n make: (Base: BaseCtor) => CustomElementConstructor,\n css?: { id: string; text: string }\n): CustomElementConstructor | undefined {\n if (!canDefine()) return undefined;\n adoptStyles('base', BASE_CSS);\n if (css) adoptStyles(css.id, css.text);\n const existing = customElements.get(tag);\n if (existing) return existing;\n const ctor = make(getBase());\n customElements.define(tag, ctor);\n return ctor;\n}\n\nconst BASE_CSS = '.usa-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}';\n\n/** A visually hidden copy of `text` for screen readers (the animated copy is `aria-hidden`). */\nexport function srText(text: string): HTMLSpanElement {\n const s = document.createElement('span');\n s.className = 'usa-sr';\n s.textContent = text;\n return s;\n}\n\n/** requestAnimationFrame with a timeout fallback (jsdom / hidden documents). */\nexport const raf = (cb: FrameRequestCallback): number =>\n typeof requestAnimationFrame === 'function' ? requestAnimationFrame(cb) : (setTimeout(() => cb(Date.now()), 16) as unknown as number);\n/** Monotonic time in ms (rAF callback timestamps differ between environments, so loops use this). */\nexport const now = (): number => (typeof performance !== 'undefined' ? performance.now() : Date.now());\nexport const caf = (id: number): void => {\n if (typeof cancelAnimationFrame === 'function') cancelAnimationFrame(id);\n else clearTimeout(id);\n};\n\n/** Spring-ish easing used across the components. */\nexport const EASE_OUT = 'cubic-bezier(0.22, 1, 0.36, 1)';\nexport const EASE_SPRING = 'cubic-bezier(0.34, 1.56, 0.64, 1)';\n/** Windows Fluent \"decelerate\" / \"point-to-point\" curves. */\nexport const FLUENT_DECELERATE = 'cubic-bezier(0.1, 0.9, 0.2, 1)';\n\nconst warned = new Set<string>();\n/** Log a deprecation once per key (console.warn). */\nexport function deprecate(key: string, message: string): void {\n if (warned.has(key)) return;\n warned.add(key);\n if (typeof console !== 'undefined') console.warn(`[use-scroll-animate] ${message}`);\n}\n\n/**\n * The `kind` attribute of `<usa-spinner>`, `<usa-check>`, `<usa-dialog>` and\n * `<usa-acrylic>` (3.0: `variant` only selects a style variant).\n */\nexport function kindOf(el: Element, valid: readonly string[] | Record<string, unknown>, fallback: string): string {\n const k = el.getAttribute('kind');\n return k && (Array.isArray(valid) ? valid.includes(k) : k in (valid as object)) ? k : fallback;\n}\n\nexport const clamp = (v: number, min: number, max: number): number => Math.min(max, Math.max(min, v));\n","import { prefersReducedMotion, motionScale, applyFrame, raf, caf, now, clamp } from '../base';\n\n/**\n * Where a step starts on a timeline:\n * - a number: absolute time in ms\n * - `'>'` (default): when the previous step ends · `'<'`: when it starts\n * - `'+=200'` / `'-=200'`: after / overlapping the previous end\n * - `'<+=100'`: 100ms after the previous step's start\n * - `'intro'` / `'intro+=150'`: at (or relative to) a label\n */\nexport type TimelinePosition = number | string;\n\nexport interface TimelineStepOptions {\n /** Duration in ms (default: timeline default, 600). */\n duration?: number;\n /** CSS easing (default `cubic-bezier(0.22, 1, 0.36, 1)`). */\n easing?: string;\n /** Start position, see `TimelinePosition`. */\n at?: TimelinePosition;\n /** ms between targets when the selector matches several elements. */\n stagger?: number;\n}\n\nexport interface TimelineOptions {\n /** Defaults for every step. */\n defaults?: Pick<TimelineStepOptions, 'duration' | 'easing' | 'stagger'>;\n /** Playback rate (1 = normal). */\n speed?: number;\n /** Called after `play()` reaches the end (or the start when reversed). */\n onComplete?: () => void;\n /** Called on every frame with progress 0–1. */\n onUpdate?: (progress: number) => void;\n}\n\nexport interface ScrubOptions {\n /** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts. */\n offset?: number;\n /** Smoothing 0–1 (0 = immediate, default 0). */\n smooth?: number;\n}\n\nexport interface Timeline {\n /** Total length in ms. */\n readonly duration: number;\n /** Label positions in ms. */\n readonly labels: Readonly<Record<string, number>>;\n /** Current playhead in ms. */\n readonly time: number;\n /** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */\n to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;\n /** Name a position (default: the current end). */\n label(name: string, at?: TimelinePosition): Timeline;\n /** Run `fn` when the playhead passes `at`. */\n call(fn: () => void, at?: TimelinePosition): Timeline;\n /** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */\n play(from?: TimelinePosition): Promise<void>;\n /** Play backwards to 0. */\n reverse(): Promise<void>;\n pause(): Timeline;\n /** Jump to a time (ms) or label. */\n seek(to: TimelinePosition): Timeline;\n /** Get or set progress 0–1. */\n progress(p?: number): number;\n /** Tie progress to the scroll position of `source` (it moves through the viewport). Returns a stop function. */\n scrub(source: Element, options?: ScrubOptions): () => void;\n /** Stop and drop every animation (elements keep their last frame). */\n cancel(): void;\n}\n\n/** Keyframe presets usable by name in `to()` and `data-tl`. */\nexport const TIMELINE_PRESETS: Record<string, Keyframe[]> = {\n fade: [{ opacity: 0 }, { opacity: 1 }],\n 'fade-up': [{ opacity: 0, transform: 'translateY(24px)' }, { opacity: 1, transform: 'none' }],\n 'fade-down': [{ opacity: 0, transform: 'translateY(-24px)' }, { opacity: 1, transform: 'none' }],\n 'fade-left': [{ opacity: 0, transform: 'translateX(24px)' }, { opacity: 1, transform: 'none' }],\n 'fade-right': [{ opacity: 0, transform: 'translateX(-24px)' }, { opacity: 1, transform: 'none' }],\n scale: [{ opacity: 0, transform: 'scale(0.85)' }, { opacity: 1, transform: 'none' }],\n blur: [{ opacity: 0, filter: 'blur(12px)' }, { opacity: 1, filter: 'blur(0)' }],\n rotate: [{ opacity: 0, transform: 'rotate(-12deg) scale(0.9)' }, { opacity: 1, transform: 'none' }],\n 'clip-up': [{ clipPath: 'inset(100% 0 0 0)' }, { clipPath: 'inset(0 0 0 0)' }],\n 'clip-right': [{ clipPath: 'inset(0 100% 0 0)' }, { clipPath: 'inset(0 0 0 0)' }],\n};\n\n/** Resolve a position against the previous step and labels (pure). */\nexport function resolvePosition(\n pos: TimelinePosition | undefined,\n end: number,\n prevStart: number,\n labels: Record<string, number> = {}\n): number {\n if (pos === undefined || pos === '' || pos === '>') return end;\n if (typeof pos === 'number') return Math.max(0, pos);\n const s = String(pos).trim();\n if (/^-?\\d+(\\.\\d+)?$/.test(s)) return Math.max(0, Number(s));\n const m = /^(<|>|[A-Za-z_][\\w-]*)?\\s*(?:([+-])=\\s*(\\d+(?:\\.\\d+)?))?$/.exec(s);\n if (!m) return end;\n const base = m[1] === '<' ? prevStart : m[1] === '>' || !m[1] ? end : labels[m[1]] ?? end;\n const delta = m[2] ? (m[2] === '-' ? -1 : 1) * Number(m[3]) : 0;\n return Math.max(0, base + delta);\n}\n\nconst toEls = (t: string | Element | Element[] | NodeList): Element[] =>\n typeof t === 'string' ? (typeof document === 'undefined' ? [] : Array.from(document.querySelectorAll(t))) : t instanceof Element ? [t] : Array.from(t as ArrayLike<Element>);\n\ninterface Step { el: Element; frames: Keyframe[]; start: number; duration: number; easing: string; anim?: Animation | null }\ninterface Cue { fn: () => void; at: number }\n\n/**\n * Choreograph animations on one clock: chain, overlap, label, seek, reverse and\n * scrub them with scroll. Built on WAAPI (paused animations driven by one\n * playhead); without WAAPI or under reduced motion it jumps to the end state.\n *\n * @example\n * const tl = timeline({ defaults: { duration: 500 } })\n * .to('.title', 'fade-up')\n * .label('cards')\n * .to('.card', 'scale', { stagger: 80, at: '-=200' })\n * .to('.cta', [{ opacity: 0 }, { opacity: 1 }], { at: 'cards+=400' });\n * tl.play(); // or tl.scrub(document.querySelector('.hero'))\n */\nexport function timeline(options: TimelineOptions = {}): Timeline {\n const d = { duration: 600, easing: 'cubic-bezier(0.22, 1, 0.36, 1)', stagger: 0, ...options.defaults };\n const steps: Step[] = [];\n const cues: Cue[] = [];\n const labels: Record<string, number> = {};\n let end = 0;\n let prevStart = 0;\n let t = 0;\n let frame = 0;\n let dir = 1;\n let settle: (() => void) | undefined;\n let built = false;\n\n const total = () => Math.max(end, ...cues.map((c) => c.at), 0);\n const build = () => {\n if (built) return;\n built = true;\n for (const s of steps) {\n if (typeof (s.el as HTMLElement).animate !== 'function') { s.anim = null; continue; }\n s.anim = (s.el as HTMLElement).animate(s.frames, { duration: s.duration, delay: s.start, easing: s.easing, fill: 'both' });\n s.anim.pause?.();\n }\n };\n const render = (to: number, from: number) => {\n build();\n t = clamp(to, 0, total());\n for (const s of steps) {\n if (s.anim) s.anim.currentTime = t;\n else applyFrame(s.el as HTMLElement, s.frames[t >= s.start ? s.frames.length - 1 : 0]);\n }\n for (const c of cues) if ((from < c.at && t >= c.at) || (from > c.at && t <= c.at)) c.fn();\n options.onUpdate?.(total() ? t / total() : 1);\n };\n const stop = () => {\n if (frame) caf(frame);\n frame = 0;\n };\n const run = (direction: number): Promise<void> => {\n stop();\n settle?.();\n dir = direction;\n const target = dir > 0 ? total() : 0;\n const k = motionScale();\n if (prefersReducedMotion() || k === 0 || !total()) {\n render(target, t);\n options.onComplete?.();\n return Promise.resolve();\n }\n const rate = (options.speed ?? 1) / k;\n return new Promise<void>((resolve) => {\n settle = () => { settle = undefined; resolve(); };\n let last = now();\n const loop = () => {\n const n = now();\n const next = t + (n - last) * rate * dir;\n last = n;\n render(next, t);\n if ((dir > 0 && t >= target) || (dir < 0 && t <= 0)) {\n frame = 0;\n options.onComplete?.();\n settle?.();\n return;\n }\n frame = raf(loop);\n };\n frame = raf(loop);\n });\n };\n\n const api: Timeline = {\n get duration() { return total(); },\n get labels() { return { ...labels }; },\n get time() { return t; },\n to(target, frames, o = {}) {\n const kf = typeof frames === 'string' ? TIMELINE_PRESETS[frames] || TIMELINE_PRESETS.fade : frames;\n const start = resolvePosition(o.at, end, prevStart, labels);\n const duration = o.duration ?? d.duration;\n const stagger = o.stagger ?? d.stagger;\n let last = start;\n toEls(target).forEach((el, i) => {\n const s = start + i * stagger;\n steps.push({ el, frames: kf, start: s, duration, easing: o.easing ?? d.easing });\n last = Math.max(last, s + duration);\n });\n prevStart = start;\n end = Math.max(end, last);\n built = false;\n steps.forEach((s) => s.anim?.cancel?.());\n return api;\n },\n label(name, at) {\n labels[name] = resolvePosition(at, end, prevStart, labels);\n return api;\n },\n call(fn, at) {\n cues.push({ fn, at: resolvePosition(at, end, prevStart, labels) });\n return api;\n },\n play(from) {\n if (from !== undefined) render(resolvePosition(from, 0, 0, labels), t);\n else if (t >= total()) render(0, -1);\n return run(1);\n },\n reverse() {\n return run(-1);\n },\n pause() {\n stop();\n return api;\n },\n seek(to) {\n stop();\n render(resolvePosition(to, 0, 0, labels), t);\n return api;\n },\n progress(p) {\n if (p !== undefined) api.seek(clamp(p, 0, 1) * total());\n return total() ? t / total() : 0;\n },\n scrub(source, o = {}) {\n stop();\n if (prefersReducedMotion() || typeof window === 'undefined') {\n render(total(), t);\n return () => {};\n }\n let id = 0;\n let cur = t;\n const update = () => {\n id = 0;\n const r = source.getBoundingClientRect();\n const vh = window.innerHeight || 1;\n const p = clamp((vh + (o.offset ?? 0) - r.top) / (vh + r.height || 1), 0, 1);\n const goal = p * total();\n const sm = clamp(o.smooth ?? 0, 0, 0.95);\n cur = sm ? cur + (goal - cur) * (1 - sm) : goal;\n render(cur, t);\n if (sm && Math.abs(goal - cur) > 0.5) id = raf(update);\n };\n const onScroll = () => { if (!id) id = raf(update); };\n window.addEventListener('scroll', onScroll, { passive: true });\n window.addEventListener('resize', onScroll, { passive: true });\n update();\n return () => {\n window.removeEventListener('scroll', onScroll);\n window.removeEventListener('resize', onScroll);\n if (id) caf(id);\n };\n },\n cancel() {\n stop();\n settle?.();\n steps.forEach((s) => s.anim?.cancel?.());\n built = false;\n },\n };\n return api;\n}\n","/**\n * use-scroll-animate - parallax() helper\n *\n * Moves elements at a different speed than the page while they cross the\n * viewport. Built on the same scroll progress as `progressVar` (0 when the\n * element's top enters at the bottom, 1 when its bottom leaves at the top):\n * the progress is written to a CSS custom property (default `--sa-parallax`)\n * and the offset is applied with the individual `translate` property, so it\n * composes with entrance animations and other `transform`s.\n */\n\nimport { getScrollProgress, hasDOM, prefersReducedMotion, resolveTargets, supportsObserver } from './core';\n\nexport interface ParallaxHelperOptions {\n /**\n * Total distance the element shifts while it crosses the viewport, as a\n * fraction of the viewport size (`0.2` = 20vh on the y axis). Positive values\n * lag behind the scroll (background-like), negative values move ahead of it\n * (foreground-like). (default: `0.2`)\n */\n speed?: number;\n /** `'y'` (default) or `'x'` (horizontal drift, in `vw`) */\n axis?: 'x' | 'y';\n /** CSS custom property receiving the progress (default: `'--sa-parallax'`) */\n progressVar?: string;\n /** Scroll container (default: the viewport) */\n root?: Element | null;\n /**\n * Under `prefers-reduced-motion: reduce` no offset is applied (the progress\n * variable is still written). Set to `false` to move anyway. (default: `true`)\n */\n respectReducedMotion?: boolean;\n}\n\nconst PASSIVE: AddEventListenerOptions = { passive: true };\n\n/**\n * Apply a scroll parallax to `target` (selector, Element, NodeList or array).\n * Returns a function that stops it and removes the inline styles it set.\n * SSR-safe (no-op without a DOM / IntersectionObserver).\n *\n * @example\n * const stop = parallax('.hero-bg', { speed: 0.3 });\n * parallax('.badge', { speed: -0.15, axis: 'x' });\n */\nexport function parallax(\n target: string | Element | NodeList | Element[],\n options: ParallaxHelperOptions = {}\n): () => void {\n const els = resolveTargets(target);\n if (!els.length || !hasDOM() || !supportsObserver()) return () => undefined;\n const { speed = 0.2, axis = 'y', root = null, respectReducedMotion = true } = options;\n const name = options.progressVar ? (options.progressVar.startsWith('--') ? options.progressVar : `--${options.progressVar}`) : '--sa-parallax';\n const unit = axis === 'x' ? 'vw' : 'vh';\n const visible = new Set<Element>();\n let frame = 0;\n let listening = false;\n const scroller: EventTarget = root || window;\n\n const apply = (el: Element) => {\n const style = (el as HTMLElement).style;\n if (!style) return;\n const p = getScrollProgress(el, root);\n style.setProperty(name, String(+p.toFixed(4)));\n if (respectReducedMotion && prefersReducedMotion()) {\n style.removeProperty('translate');\n return;\n }\n const offset = `${+((p - 0.5) * speed * 100).toFixed(3)}${unit}`;\n style.setProperty('translate', axis === 'x' ? `${offset} 0px` : `0px ${offset}`);\n };\n\n const update = () => {\n frame = 0;\n visible.forEach(apply);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(update);\n };\n const listen = (on: boolean) => {\n if (on === listening) return;\n listening = on;\n const method = on ? 'addEventListener' : 'removeEventListener';\n scroller[method]('scroll', schedule, PASSIVE);\n window[method]('resize', schedule, PASSIVE);\n if (!on && frame) {\n cancelAnimationFrame(frame);\n frame = 0;\n }\n };\n\n const io = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) visible.add(entry.target);\n else visible.delete(entry.target);\n apply(entry.target); // report the edges even on fast scrolls\n });\n listen(visible.size > 0);\n },\n { threshold: 0, root }\n );\n els.forEach((el) => {\n apply(el); // no jump before the first observer callback\n io.observe(el);\n });\n\n return () => {\n io.disconnect();\n listen(false);\n visible.clear();\n els.forEach((el) => {\n const style = (el as HTMLElement).style;\n if (!style) return;\n style.removeProperty('translate');\n style.removeProperty(name);\n });\n };\n}\n","/**\n * use-scroll-animate\n *\n * A lightweight, dependency-free scroll animation library for modern web\n * applications. Built with TypeScript, powered by IntersectionObserver and\n * the Web Animations API (or the native scroll-driven timeline). Safe to\n * import during SSR. Framework integrations live in the subpath entries:\n * `use-scroll-animate/react`, `/vue`, `/svelte`, `/solid`, `/element`.\n *\n * @license MIT\n * @see https://github.com/HarrisonCN/use-scroll-animate\n */\n\nexport { createScrollAnimate, getScrollProgress, supportsScrollTimeline } from './core';\nexport { staggerChildren } from './stagger';\nexport { timeline, resolvePosition, TIMELINE_PRESETS } from './components/timeline/core';\nexport { parallax } from './parallax';\nexport { PRESETS, resolvePreset, resolveEasing, EASING_MAP } from './presets';\nexport type {\n AnimationPreset,\n EasingType,\n AnimationKeyframe,\n CustomAnimation,\n ProgressMode,\n ScrollEngine,\n AnimateOptions,\n ScrollAnimateConfig,\n AnimatedElement,\n ScrollAnimateInstance,\n} from './types';\nexport type { StaggerOptions } from './stagger';\nexport type { ParallaxHelperOptions } from './parallax';\nexport type { Timeline, TimelineOptions, TimelineStepOptions, TimelinePosition, ScrubOptions } from './components/timeline/core';\n\n// Default export: a ready-to-use singleton instance\nimport { createScrollAnimate } from './core';\n\n/**\n * Default singleton instance of ScrollAnimate.\n * Ready to use out of the box with sensible defaults.\n *\n * @example\n * ```js\n * import ScrollAnimate from 'use-scroll-animate';\n *\n * // Auto-initialize all elements with data-sa attribute\n * ScrollAnimate.init();\n *\n * // Or manually observe elements\n * ScrollAnimate.observe('.my-element', { animation: 'fade-in-up' });\n * ```\n */\nconst ScrollAnimate = /* @__PURE__ */ createScrollAnimate();\nexport default ScrollAnimate;\n"],"names":["PRESETS","from","opacity","to","transform","bounce","filter","shimmer","pulse","swing","clipPath","resolvePreset","animation","trim","Array","isArray","combined","forEach","name","preset","Object","entries","key","val","EASING_MAP","linear","ease","spring","resolveEasing","easing","join","DEFAULT_CONFIG","defaultAnimation","defaultDuration","defaultDelay","defaultEasing","defaultThreshold","defaultRootMargin","defaultRepeat","defaultOnce","defaultOffset","hiddenClass","visibleClass","useClassNames","disabled","root","autoUnregister","defaultEngine","noop","hasDOM","window","document","supportsObserver","IntersectionObserver","reducedMotionQuery","scrollTimelineSupported","prefersReducedMotion","undefined","matchMedia","matches","supportsScrollTimeline","CSS","supports","globalThis","ViewTimeline","num","value","n","parseFloat","Number","isFinite","DEFAULT_VIEW_RANGE","normalizeVar","v","startsWith","parseDataAttributes","el","config","mergeOptions","get","opts","anim","includes","split","map","s","duration","delay","e","JSON","parse","t","threshold","rootMargin","repeat","once","offset","stagger","progressVar","engine","range","start","end","viewRange","exit","progress","progressMode","keys","k","readOptions","getAttribute","length","onStart","onComplete","onEnter","onLeave","onProgress","resolveTargets","target","querySelectorAll","Element","NodeList","getScrollProgress","rect","getBoundingClientRect","top","height","innerHeight","documentElement","clientHeight","r","total","p","running","WeakMap","exits","timers","cancelRunning","exitAnim","delete","cancel","onfinish","timer","clearTimeout","setStyles","styles","style","prop","String","NUM_UNIT","linearSupported","progressThresholds","buildAnimation","keyframes","samples","fn","values","i","push","toFixed","sampleEasing","props","eased","frame","a","b","ta","tb","skA","replace","_","u","ok","out","na","ua","nb","ub","unit","interpolateValue","reveal","classList","remove","add","motionDisabled","runAnimation","staggerIndex","pending","totalDelay","Math","max","animationDelay","set","setTimeout","animate","built","timing","fill","commitStyles","hideElement","prepareElement","full","getProgressThresholds","PASSIVE","passive","createScrollAnimate","userConfig","registry","Map","finished","WeakSet","scrolling","Set","listening","watchers","natives","pools","pooled","create","pool","io","teardown","restore","record","observer","unobserve","progressObserver","untrack","animated","isConnected","pruneDetached","emitProgress","options","setProperty","update","schedule","requestAnimationFrame","listen","on","method","cancelAnimationFrame","size","onScrollIntersect","entry","isIntersecting","onIntersect","staggerCounts","parent","parentElement","runExit","intersectionRatio","getObserver","parts","right","bottom","left","m","exec","applyOffset","attach","observeMain","observe","getProgressObserver","observeElement","has","element","wantsNative","onFrozen","timeline","subject","axis","rangeStart","rangeEnd","leave","keep","startNative","observeDataElement","instance","init","rootElement","scope","watch","MutationObserver","observeTree","node","hasAttribute","mo","records","removed","type","addedNodes","removedNodes","childList","subtree","attributes","attributeFilter","disconnect","destroy","clear","refresh","getObservedElements","configure","newConfig","fallback","MOTION_SCALE","off","low","normal","high","applyFrame","raf","cb","Date","now","performance","caf","id","clamp","min","TIMELINE_PRESETS","fade","scale","blur","rotate","resolvePosition","pos","prevStart","labels","test","base","delta","ScrollAnimate","els","speed","respectReducedMotion","visible","scroller","apply","removeProperty","container","sa","observeChildren","rest","items","children","revealed","late","child","some","parentNode","indexOf","splice","stopAnimation","d","defaults","steps","cues","settle","dir","c","at","render","frames","pause","build","currentTime","onUpdate","stop","run","direction","Promise","resolve","rate","last","loop","next","api","time","o","kf","toEls","label","call","play","reverse","seek","scrub","source","cur","vh","goal","sm","smooth","abs","onScroll","addEventList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
10
10
|
- [Global config (`ScrollAnimateConfig`)](#global-config-scrollanimateconfig)
|
|
11
11
|
- [Presets & easings](#presets--easings)
|
|
12
|
-
- [Helpers: `staggerChildren`, `
|
|
12
|
+
- [Helpers: `staggerChildren`, `timeline`, `parallax`, `getScrollProgress`, `supportsScrollTimeline`](#helpers)
|
|
13
13
|
- [Framework integrations](#framework-integrations)
|
|
14
14
|
- [Behaviour notes](#behaviour-notes)
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
| Import | Contents |
|
|
19
19
|
|---|---|
|
|
20
|
-
| `use-scroll-animate` | Default instance, `createScrollAnimate`, `staggerChildren`, `
|
|
20
|
+
| `use-scroll-animate` | Default instance, `createScrollAnimate`, `staggerChildren`, `timeline`, `parallax`, `getScrollProgress`, `supportsScrollTimeline`, `PRESETS`, `resolvePreset`, `resolveEasing`, `EASING_MAP`, all types |
|
|
21
21
|
| `use-scroll-animate/react` | `createReactHooks(React)` |
|
|
22
22
|
| `use-scroll-animate/vue` | `createVueComposables({ ref, onMounted, onUnmounted })` |
|
|
23
23
|
| `use-scroll-animate/svelte` | `scrollAnimate`, `scrollStagger` actions |
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
| `use-scroll-animate/element` | `defineScrollAnimate(tagName?, instance?)` for `<scroll-animate>` |
|
|
26
26
|
| `dist/index.umd.js` | Global `ScrollAnimate` (`ScrollAnimate.default` is the instance, other exports as properties) |
|
|
27
27
|
| `dist/element.umd.js` | Registers `<scroll-animate>` on load; global `ScrollAnimateElement` |
|
|
28
|
-
| `use-scroll-animate/components` (+ `/components/reveal`, `/text`, `/interaction`, `/feedback`, `/background`, `/transitions`) | 30 animated `<usa-*>` Web Components, `defineComponents()`, `configureComponents()`, `toast()`, `viewTransition()`, `flip()
|
|
28
|
+
| `use-scroll-animate/components` (+ `/components/reveal`, `/text`, `/interaction`, `/feedback`, `/background`, `/transitions`) | 30 animated `<usa-*>` Web Components, `defineComponents()`, `configureComponents()`, `toast()`, `viewTransition()`, `flip()` — see **[components.md](./components.md)** |
|
|
29
29
|
| `dist/components.umd.js`, `use-scroll-animate/components.css` | Registers every `<usa-*>` on load (global `UsaComponents`); the component styles as a file |
|
|
30
30
|
|
|
31
31
|
Every entry is ESM-first (`import` → `.js` + `.d.ts`) with a CommonJS build (`require` → `.cjs` + `.d.cts`), SSR-safe (no DOM access at import), and has zero runtime dependencies.
|
|
@@ -111,8 +111,8 @@ Boolean attributes are true when present unless their value is `"false"`.
|
|
|
111
111
|
### `staggerChildren(container, options?, instance?)` → `() => void`
|
|
112
112
|
Reveal the children of `container` one after another when it enters. `StaggerOptions` = `AnimateOptions` + `stagger` (default `80` ms) + `observeChildren` (MutationObserver for children added later). Stopping before the reveal makes the children visible.
|
|
113
113
|
|
|
114
|
-
### `
|
|
115
|
-
|
|
114
|
+
### `timeline(options?)` → `Timeline` (4.0; replaces `sequence()`)
|
|
115
|
+
One playhead for many WAAPI animations. `options` = `{ defaults: { duration = 600, easing, stagger }, speed, onUpdate(p), onComplete() }`. Build with `.to(target, keyframes | preset, { at, duration, easing, stagger })`, `.label(name, at?)`, `.call(fn, at?)`; positions `'>'` (default), `'<'`, `'-=ms'`, `'+=ms'`, `'<+=ms'`, `'label+=ms'` or ms (`resolvePosition()`). Control: `play(from?)` / `reverse()` (Promises), `pause()`, `seek(ms | label)`, `progress(p?)`, `scrub(el, { offset, smooth })` → stop, `cancel()`; read `duration`, `time`, `labels`. Presets: `TIMELINE_PRESETS`. Reduced motion jumps to the end. Also in `use-scroll-animate/components/timeline` with `<usa-timeline>`.
|
|
116
116
|
|
|
117
117
|
### `parallax(target, options?)` → `() => void`
|
|
118
118
|
`{ speed = 0.2, axis = 'y', progressVar = '--sa-parallax', root = null, respectReducedMotion = true }`. Offset `(progress − 0.5) × speed × 100vh` (or `vw`) on the `translate` property; progress (0–1) in the CSS variable. The stop function removes listeners and inline styles.
|
|
@@ -136,5 +136,5 @@ True scroll progress 0–1 of `el` through the viewport or `root`. `0` without a
|
|
|
136
136
|
- **Reduced motion**: with `prefers-reduced-motion: reduce` (or `disabled: true`) nothing is hidden or moved; callbacks still fire; `progressVar` is still written (it is data); `parallax()` writes only its variable.
|
|
137
137
|
- **SSR**: every entry can be imported and called on the server; calls are no-ops without a DOM.
|
|
138
138
|
- **No IntersectionObserver**: content is shown immediately.
|
|
139
|
-
- **Native engine**: scroll-linked, so `duration`/`delay`/`threshold`/`offset`/`stagger` don't apply; `once` freezes the end state on completion; class-name mode, reduced motion, `animate()`, `
|
|
139
|
+
- **Native engine**: scroll-linked, so `duration`/`delay`/`threshold`/`offset`/`stagger` don't apply; `once` freezes the end state on completion; class-name mode, reduced motion, `animate()`, `timeline()` and `staggerChildren()` always use JS.
|
|
140
140
|
- **Native engine by default**: in browsers without `animation-timeline: view()` everything runs on the JS engine.
|
package/docs/ROADMAP.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 路线图(4.0 之后)
|
|
2
|
+
|
|
3
|
+
> 4.0.0 已完成 API 统一:`timeline()` 取代 `sequence()`,`sharedTransition()` 取代 `connectedAnimation()`,`<usa-auto-animate>` 取代 `<usa-flip-list>`。以下为 4.x → 5.0 的规划,每个版本一个 PR,按需调整。
|
|
4
|
+
|
|
5
|
+
- **v4.1** — 滚动驱动时间线:`timeline().scrub()` 优先使用原生 `ScrollTimeline` / `ViewTimeline`(脱离主线程),JS 作为回退。
|
|
6
|
+
- **v4.2** — 动效设计令牌:统一的时长 / 缓动 / 弹簧令牌(CSS 变量 + JSON),支持从 Figma Tokens / Style Dictionary 导入。
|
|
7
|
+
- **v4.3** — 文本进阶:按字 / 词 / 行拆分的 `splitText()`,支持中日韩文字与 RTL,配合 `timeline()` 逐字编排。
|
|
8
|
+
- **v4.4** — 无障碍增强:每个组件提供“静态替代”与 `aria-live` 规范,新增运动敏感度分级与自动化 a11y 回归测试。
|
|
9
|
+
- **v4.5** — 性能与体积:按需加载 CSS、共享 rAF 调度器、动画数量自动降级,组件整体 gzip 目标 ≤ 70KB。
|
|
10
|
+
- **v4.6** — 实验室 2.0:时间线可视化编辑(关键帧轨道)、保存 / 分享预设,并可导出为 `<usa-timeline>` 标记。
|
|
11
|
+
- **v4.7** — 原生壳集成:WinUI 3、.NET MAUI、Flutter 的官方桥接示例包,支持系统“减少动态效果”与主题自动同步。
|
|
12
|
+
- **v4.8** — 3D 与 WebGL 扩展:基于 `glQuad()` 的粒子 / 后处理小型预设库,统一 WebGL 回退与电量 / 帧率自适应。
|
|
13
|
+
- **v4.9** — 5.0 预备:标记计划移除或重命名的 API 并输出一次性弃用警告,发布 `upgrading-5.md` 与自动迁移脚本(codemod)。
|
|
14
|
+
- **v5.0** — 下一代主版本:仅支持现代浏览器(原生 View Transitions / Scroll Timeline 基线),移除 4.9 弃用的 API,统一的插件式效果注册机制。
|
package/docs/components.md
CHANGED
|
@@ -40,7 +40,7 @@ defineTypewriter();
|
|
|
40
40
|
No build step (registers every `<usa-*>` and exposes the API as `window.UsaComponents`):
|
|
41
41
|
|
|
42
42
|
```html
|
|
43
|
-
<script src="https://unpkg.com/use-scroll-animate@
|
|
43
|
+
<script src="https://unpkg.com/use-scroll-animate@4/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
|
```
|
|
@@ -113,11 +113,9 @@ All attributes are optional unless noted. Events are `CustomEvent`s that bubble,
|
|
|
113
113
|
|---|---|---|---|
|
|
114
114
|
| `<usa-dialog>` | Animated modal / drawer / sheet on the native `<dialog>` (focus trap, Esc, top layer); content is slotted, so frameworks keep owning it | `open`, `kind` (`modal`*, `drawer-start`, `drawer-end`, `drawer-bottom`, `sheet`), `label`, `no-backdrop-close`, `no-esc`; `[data-close]` children close it; `::part(panel/backdrop)`, `--usa-dialog-*` | `show()`, `close(value?)`, `open`, `returnValue`; `usa:open`, `usa:beforeclose` (cancelable), `usa:close` |
|
|
115
115
|
| `<usa-accordion>` | Smooth height animation for native `<details>` | `multiple`, `duration` (300) | `toggleItem(details, open?)`, `items`; `usa:toggle` |
|
|
116
|
-
| `<usa-flip-list>` | Children glide to new places on add / remove / reorder (FLIP) | `duration` (420), `easing`, `disabled` | `flip(mutate)` |
|
|
117
116
|
| `<usa-view-switch>` | One view at a time with direction-aware transitions | `active` (name or index), `effect` (`slide`*, `fade`, `scale`, `drill`), `duration` | `show(view)`, `active`, `views`; `usa:change` |
|
|
118
117
|
| `viewTransition(update, opts?)` | Runs a DOM update inside `document.startViewTransition()`, cross-fade fallback | `{ fallback, duration, types }` | `Promise<void>` |
|
|
119
118
|
| `flip(targets, mutate, opts?)` | FLIP-animates any layout change | `{ duration, easing, animateEnter }` | `Promise<void>` |
|
|
120
|
-
| `connectedAnimation(from, to, opts?)` | WinUI-style connected / shared-element animation | `{ duration, easing, hideSource }` | `Promise<void>` |
|
|
121
119
|
|
|
122
120
|
### 7. Spring & physics — `components/physics`
|
|
123
121
|
|
|
@@ -287,7 +285,7 @@ Fallbacks set `data-fallback` (`webgl` · `image` · `no-image`); cross-origin i
|
|
|
287
285
|
| `<usa-masonry>` | Masonry grid with animated reflow | `columns` or `min` (220), `gap` (16); `layout()` |
|
|
288
286
|
| `sharedTransition(update, root?)` | Shared-element transition via `data-shared="id"` | `duration` (450), `easing`; View Transitions API or FLIP |
|
|
289
287
|
|
|
290
|
-
Also see `flip()` /
|
|
288
|
+
Also see `flip()` in `components/transitions`. (4.0 removed `<usa-flip-list>` and `connectedAnimation()` in favour of these.)
|
|
291
289
|
|
|
292
290
|
### v3.7 Visual playground
|
|
293
291
|
|
|
@@ -315,7 +313,7 @@ Hybrid / desktop hosts (MAUI, Flutter WebView, Electron, Tauri): [hybrid-apps.md
|
|
|
315
313
|
|
|
316
314
|
`<usa-pack>` (e.g. `<usa-pack name="ecommerce">…</usa-pack>`) or `applyPack('ecommerce', root)`; helpers `flyToCart(from, to)`, `countUp(el)`.
|
|
317
315
|
|
|
318
|
-
**Deprecated in 3.9, removed in 4.0:** `sequence()`, `connectedAnimation()`, `<usa-flip-list>` — see [upgrading-4.md](./upgrading-4.md).
|
|
316
|
+
**Deprecated in 3.9, removed in 4.0.0:** `sequence()`, `connectedAnimation()`, `<usa-flip-list>` — see [upgrading-4.md](./upgrading-4.md).
|
|
319
317
|
|
|
320
318
|
## Frameworks
|
|
321
319
|
|