use-scroll-animate 6.0.1 → 6.1.1
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 +31 -0
- package/README.md +157 -373
- package/README_ja.md +171 -145
- package/README_zh.md +169 -167
- package/dist/chunks/{base-B5i8qQPR.cjs → base-BaQV-2ha.cjs} +3 -3
- package/dist/chunks/base-BaQV-2ha.cjs.map +1 -0
- package/dist/chunks/{base-C3Sw9sAO.js → base-Yno7N2eC.js} +3 -3
- package/dist/chunks/base-Yno7N2eC.js.map +1 -0
- package/dist/chunks/{core-qpECfEkb.cjs → core-B5T0dhFH.cjs} +14 -210
- package/dist/chunks/core-B5T0dhFH.cjs.map +1 -0
- package/dist/chunks/{core-BDcszY4L.cjs → core-BGAyaY6L.cjs} +2 -2
- package/dist/chunks/{core-BDcszY4L.cjs.map → core-BGAyaY6L.cjs.map} +1 -1
- package/dist/chunks/{core-BTf__I-8.js → core-BIOaYdgN.js} +2 -2
- package/dist/chunks/{core-BTf__I-8.js.map → core-BIOaYdgN.js.map} +1 -1
- package/dist/chunks/{core-DN3hHbHh.js → core-CUGCsMsJ.js} +2 -2
- package/dist/chunks/{core-DN3hHbHh.js.map → core-CUGCsMsJ.js.map} +1 -1
- package/dist/chunks/{core-mV_TPgG_.js → core-D7cVumUu.js} +11 -203
- package/dist/chunks/core-D7cVumUu.js.map +1 -0
- package/dist/chunks/{core-BjOYKSrV.cjs → core-zq17EeCI.cjs} +2 -2
- package/dist/chunks/{core-BjOYKSrV.cjs.map → core-zq17EeCI.cjs.map} +1 -1
- package/dist/chunks/{fx-ChjxrMBo.js → fx-BqDeFywO.js} +2 -2
- package/dist/chunks/{fx-ChjxrMBo.js.map → fx-BqDeFywO.js.map} +1 -1
- package/dist/chunks/{fx-B8hk1Fby.cjs → fx-lBGVtQO1.cjs} +2 -2
- package/dist/chunks/{fx-B8hk1Fby.cjs.map → fx-lBGVtQO1.cjs.map} +1 -1
- package/dist/chunks/presets-BYBVJVeP.js +226 -0
- package/dist/chunks/presets-BYBVJVeP.js.map +1 -0
- package/dist/chunks/presets-CUHys3sK.cjs +233 -0
- package/dist/chunks/presets-CUHys3sK.cjs.map +1 -0
- package/dist/chunks/{spring-CckMe3x0.js → spring-DfQO5USi.js} +2 -2
- package/dist/chunks/{spring-CckMe3x0.js.map → spring-DfQO5USi.js.map} +1 -1
- package/dist/chunks/{spring--oZh55tB.cjs → spring-Dgx187Vh.cjs} +2 -2
- package/dist/chunks/{spring--oZh55tB.cjs.map → spring-Dgx187Vh.cjs.map} +1 -1
- package/dist/chunks/{stagger-CLc3j58T.cjs → stagger-CCFyhzSw.cjs} +3 -3
- package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
- package/dist/chunks/{stagger-BFAhKknX.js → stagger-DtMKo2SK.js} +3 -3
- package/dist/chunks/stagger-DtMKo2SK.js.map +1 -0
- package/dist/chunks/{variants-DxPmgrNX.cjs → variants-BhjyddG8.cjs} +2 -2
- package/dist/chunks/{variants-DxPmgrNX.cjs.map → variants-BhjyddG8.cjs.map} +1 -1
- package/dist/chunks/{variants-Bsevy6Xm.js → variants-VNscPeTD.js} +2 -2
- package/dist/chunks/{variants-Bsevy6Xm.js.map → variants-VNscPeTD.js.map} +1 -1
- package/dist/components/a11y.cjs +4 -4
- package/dist/components/a11y.cjs.map +1 -1
- package/dist/components/a11y.d.cts +2 -2
- package/dist/components/a11y.d.ts +2 -2
- package/dist/components/a11y.js +5 -5
- package/dist/components/a11y.js.map +1 -1
- package/dist/components/angular.cjs +8 -8
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +22 -22
- package/dist/components/angular.d.ts +22 -22
- package/dist/components/angular.js +8 -8
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs +3 -3
- package/dist/components/background.cjs.map +1 -1
- package/dist/components/background.css +1 -1
- package/dist/components/background.d.cts +1 -1
- package/dist/components/background.d.ts +1 -1
- package/dist/components/background.js +3 -3
- package/dist/components/background.js.map +1 -1
- package/dist/components/bridge.cjs +2 -2
- package/dist/components/bridge.cjs.map +1 -1
- package/dist/components/bridge.d.cts +1 -1
- package/dist/components/bridge.d.ts +1 -1
- package/dist/components/bridge.js +2 -2
- package/dist/components/bridge.js.map +1 -1
- package/dist/components/cards.cjs +3 -3
- package/dist/components/cards.cjs.map +1 -1
- package/dist/components/cards.css +1 -1
- package/dist/components/cards.d.cts +1 -1
- package/dist/components/cards.d.ts +1 -1
- package/dist/components/cards.js +3 -3
- package/dist/components/cards.js.map +1 -1
- package/dist/components/click.cjs +4 -4
- package/dist/components/click.cjs.map +1 -1
- package/dist/components/click.css +1 -1
- package/dist/components/click.d.cts +1 -1
- package/dist/components/click.d.ts +1 -1
- package/dist/components/click.js +4 -4
- package/dist/components/click.js.map +1 -1
- package/dist/components/depth.cjs +4 -4
- package/dist/components/depth.cjs.map +1 -1
- package/dist/components/depth.css +1 -1
- package/dist/components/depth.d.cts +1 -1
- package/dist/components/depth.d.ts +1 -1
- package/dist/components/depth.js +4 -4
- package/dist/components/depth.js.map +1 -1
- package/dist/components/effects.cjs +13 -13
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.d.cts +2 -2
- package/dist/components/effects.d.ts +2 -2
- package/dist/components/effects.js +13 -13
- package/dist/components/effects.js.map +1 -1
- package/dist/components/feedback.cjs +2 -2
- package/dist/components/feedback.cjs.map +1 -1
- package/dist/components/feedback.css +1 -1
- package/dist/components/feedback.d.cts +1 -1
- package/dist/components/feedback.d.ts +1 -1
- package/dist/components/feedback.js +2 -2
- package/dist/components/feedback.js.map +1 -1
- package/dist/components/fx.cjs +10 -10
- package/dist/components/fx.cjs.map +1 -1
- package/dist/components/fx.css +1 -1
- package/dist/components/fx.d.cts +2 -2
- package/dist/components/fx.d.ts +2 -2
- package/dist/components/fx.js +10 -10
- package/dist/components/fx.js.map +1 -1
- package/dist/components/gesture.cjs +4 -4
- package/dist/components/gesture.cjs.map +1 -1
- package/dist/components/gesture.css +1 -1
- package/dist/components/gesture.d.cts +1 -1
- package/dist/components/gesture.d.ts +1 -1
- package/dist/components/gesture.js +5 -5
- package/dist/components/gesture.js.map +1 -1
- package/dist/components/interaction.cjs +2 -2
- package/dist/components/interaction.cjs.map +1 -1
- package/dist/components/interaction.css +1 -1
- package/dist/components/interaction.d.cts +1 -1
- package/dist/components/interaction.d.ts +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/interaction.js.map +1 -1
- package/dist/components/jsx.d.cts +2 -2
- package/dist/components/jsx.d.ts +2 -2
- package/dist/components/layout.cjs +2 -2
- package/dist/components/layout.cjs.map +1 -1
- package/dist/components/layout.css +1 -1
- package/dist/components/layout.d.cts +1 -1
- package/dist/components/layout.d.ts +1 -1
- package/dist/components/layout.js +2 -2
- package/dist/components/layout.js.map +1 -1
- package/dist/components/lazy.cjs +2 -2
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.d.cts +2 -2
- package/dist/components/lazy.d.ts +2 -2
- package/dist/components/lazy.js +2 -2
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/lite.cjs +45 -41
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +45 -41
- package/dist/components/lite.js.map +1 -1
- package/dist/components/packs.cjs +2 -2
- package/dist/components/packs.cjs.map +1 -1
- package/dist/components/packs.css +1 -1
- package/dist/components/packs.d.cts +1 -1
- package/dist/components/packs.d.ts +1 -1
- package/dist/components/packs.js +2 -2
- package/dist/components/packs.js.map +1 -1
- package/dist/components/page.cjs +3 -3
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.css +1 -1
- package/dist/components/page.d.cts +1 -1
- package/dist/components/page.d.ts +1 -1
- package/dist/components/page.js +4 -4
- package/dist/components/page.js.map +1 -1
- package/dist/components/perf.cjs +3 -3
- package/dist/components/perf.cjs.map +1 -1
- package/dist/components/perf.d.cts +2 -2
- package/dist/components/perf.d.ts +2 -2
- package/dist/components/perf.js +4 -4
- package/dist/components/perf.js.map +1 -1
- package/dist/components/physics.cjs +3 -3
- package/dist/components/physics.cjs.map +1 -1
- package/dist/components/physics.css +1 -1
- package/dist/components/physics.d.cts +1 -1
- package/dist/components/physics.d.ts +1 -1
- package/dist/components/physics.js +4 -4
- package/dist/components/physics.js.map +1 -1
- package/dist/components/react.cjs +4 -4
- package/dist/components/react.cjs.map +1 -1
- package/dist/components/react.js +4 -4
- package/dist/components/react.js.map +1 -1
- package/dist/components/reveal.cjs +6 -2
- package/dist/components/reveal.cjs.map +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.d.cts +1 -1
- package/dist/components/reveal.d.ts +1 -1
- package/dist/components/reveal.js +6 -2
- package/dist/components/reveal.js.map +1 -1
- package/dist/components/solid.cjs +9 -9
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +22 -22
- package/dist/components/solid.d.ts +22 -22
- package/dist/components/solid.js +9 -9
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +8 -8
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +22 -22
- package/dist/components/svelte.d.ts +22 -22
- package/dist/components/svelte.js +8 -8
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs +2 -2
- package/dist/components/svg.cjs.map +1 -1
- package/dist/components/svg.css +1 -1
- package/dist/components/svg.d.cts +1 -1
- package/dist/components/svg.d.ts +1 -1
- package/dist/components/svg.js +2 -2
- package/dist/components/svg.js.map +1 -1
- package/dist/components/text.cjs +3 -3
- package/dist/components/text.cjs.map +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.d.cts +1 -1
- package/dist/components/text.d.ts +1 -1
- package/dist/components/text.js +3 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/timeline.cjs +3 -3
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.css +1 -1
- package/dist/components/timeline.d.cts +1 -1
- package/dist/components/timeline.d.ts +1 -1
- package/dist/components/timeline.js +4 -4
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/tokens.cjs +2 -2
- package/dist/components/tokens.cjs.map +1 -1
- package/dist/components/tokens.d.cts +2 -2
- package/dist/components/tokens.d.ts +2 -2
- package/dist/components/tokens.js +2 -2
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/transitions.cjs +2 -2
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.css +1 -1
- package/dist/components/transitions.d.cts +1 -1
- package/dist/components/transitions.d.ts +1 -1
- package/dist/components/transitions.js +2 -2
- package/dist/components/transitions.js.map +1 -1
- package/dist/components/ui.cjs +4 -4
- package/dist/components/ui.cjs.map +1 -1
- package/dist/components/ui.css +1 -1
- package/dist/components/ui.d.cts +1 -1
- package/dist/components/ui.d.ts +1 -1
- package/dist/components/ui.js +5 -5
- package/dist/components/ui.js.map +1 -1
- package/dist/components/vue.cjs +9 -9
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +23 -23
- package/dist/components/vue.d.ts +23 -23
- package/dist/components/vue.js +9 -9
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +2 -2
- package/dist/components/webgl.cjs.map +1 -1
- package/dist/components/webgl.css +1 -1
- package/dist/components/webgl.d.cts +1 -1
- package/dist/components/webgl.d.ts +1 -1
- package/dist/components/webgl.js +2 -2
- package/dist/components/webgl.js.map +1 -1
- package/dist/components.cjs +9 -9
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.d.cts +30 -30
- package/dist/components.d.ts +30 -30
- package/dist/components.js +11 -11
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +5 -5
- package/dist/components.umd.js.map +1 -1
- package/dist/element.cjs +4 -3
- package/dist/element.cjs.map +1 -1
- package/dist/element.d.cts +19 -5
- package/dist/element.d.ts +19 -5
- package/dist/element.js +4 -3
- package/dist/element.js.map +1 -1
- package/dist/element.umd.js +1 -1
- package/dist/element.umd.js.map +1 -1
- package/dist/index.cjs +28 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -15
- package/dist/index.d.ts +40 -15
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/presets/extended.cjs +243 -0
- package/dist/presets/extended.cjs.map +1 -0
- package/dist/presets/extended.d.cts +37 -0
- package/dist/presets/extended.d.ts +37 -0
- package/dist/presets/extended.js +239 -0
- package/dist/presets/extended.js.map +1 -0
- package/dist/presets-extended.umd.js +2 -0
- package/dist/presets-extended.umd.js.map +1 -0
- package/dist/react.cjs +4 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +19 -5
- package/dist/react.d.ts +19 -5
- package/dist/react.js +4 -3
- package/dist/react.js.map +1 -1
- package/dist/solid.cjs +5 -4
- package/dist/solid.cjs.map +1 -1
- package/dist/solid.d.cts +20 -6
- package/dist/solid.d.ts +20 -6
- package/dist/solid.js +5 -4
- package/dist/solid.js.map +1 -1
- package/dist/svelte.cjs +5 -4
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +20 -6
- package/dist/svelte.d.ts +20 -6
- package/dist/svelte.js +5 -4
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +4 -3
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +19 -5
- package/dist/vue.d.ts +19 -5
- package/dist/vue.js +4 -3
- package/dist/vue.js.map +1 -1
- package/docs/API.md +17 -12
- package/docs/ROADMAP.md +12 -11
- package/docs/accessibility.md +2 -2
- package/docs/components.md +33 -33
- package/docs/frameworks-ssr.md +12 -12
- package/docs/hybrid-apps.md +10 -10
- package/docs/migration-from-aos.md +5 -5
- package/docs/migration-from-gsap-scrolltrigger.md +3 -3
- package/docs/motion-tokens.css +1 -1
- package/docs/motion-tokens.md +2 -2
- package/docs/performance.md +6 -6
- package/docs/presets.md +310 -0
- package/docs/windows-apps.md +8 -8
- package/package.json +40 -26
- package/dist/chunks/base-B5i8qQPR.cjs.map +0 -1
- package/dist/chunks/base-C3Sw9sAO.js.map +0 -1
- package/dist/chunks/core-mV_TPgG_.js.map +0 -1
- package/dist/chunks/core-qpECfEkb.cjs.map +0 -1
- package/dist/chunks/stagger-BFAhKknX.js.map +0 -1
- package/dist/chunks/stagger-CLc3j58T.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fx-B8hk1Fby.cjs","sources":["../../src/components/click/fx.ts"],"sourcesContent":["import { prefersReducedMotion, applyFrame } from '../base';\n\n/**\n * Click-effect helpers (v2.5): `burst()`, `confetti()`, `shake()`, `haptic()`.\n * Particles live in one fixed, pointer-transparent layer and are removed when\n * their animation ends. Under reduced motion particles are skipped and\n * `shake()` only flashes an outline.\n */\n\nlet layer: HTMLElement | null = null;\nfunction fxLayer(): HTMLElement {\n if (layer && layer.isConnected) return layer;\n layer = document.createElement('div');\n layer.className = 'usa-fx-layer';\n layer.setAttribute('aria-hidden', 'true');\n layer.style.cssText = 'position:fixed;inset:0;pointer-events:none;z-index:2147483000;overflow:hidden;contain:strict';\n document.body.appendChild(layer);\n return layer;\n}\n\nexport interface BurstOptions {\n /** Number of particles (default 12). */\n count?: number;\n /** Colours to pick from (default: accent palette). */\n colors?: string[];\n /** Travel distance in px (default 48). */\n distance?: number;\n /** Particle size in px (default 6). */\n size?: number;\n /** `circle` (default), `square`, `star`, `heart` or any text / emoji. */\n shape?: 'circle' | 'square' | 'star' | 'heart' | string;\n /** Duration in ms (default 600). */\n duration?: number;\n}\n\nconst PALETTE = ['#7c5cff', '#22d3ee', '#f472b6', '#facc15', '#34d399', '#fb923c'];\nconst GLYPH: Record<string, string> = { star: '★', heart: '♥' };\n\nfunction particle(x: number, y: number, size: number, color: string, shape: string): HTMLElement {\n const p = document.createElement('span');\n const glyph = GLYPH[shape] || (shape !== 'circle' && shape !== 'square' ? shape : '');\n p.style.cssText = `position:absolute;left:${x}px;top:${y}px;width:${size}px;height:${size}px;margin:${-size / 2}px 0 0 ${-size / 2}px;will-change:transform,opacity;` +\n (glyph ? `font-size:${size * 2}px;line-height:${size}px;text-align:center;color:${color}` : `background:${color};border-radius:${shape === 'square' ? '2px' : '50%'}`);\n if (glyph) p.textContent = glyph;\n fxLayer().appendChild(p);\n return p;\n}\n\nconst done = (a: Animation | null, el: Element) => {\n if (a) a.onfinish = () => el.remove();\n else el.remove();\n};\n\n/** Particles radiating from client point (x, y). Returns the number spawned. */\nexport function burst(x: number, y: number, options: BurstOptions = {}): number {\n if (typeof document === 'undefined' || prefersReducedMotion()) return 0;\n const { count = 12, colors = PALETTE, distance = 48, size = 6, shape = 'circle', duration = 600 } = options;\n for (let i = 0; i < count; i++) {\n const angle = (i / count) * Math.PI * 2 + Math.random() * 0.4;\n const d = distance * (0.7 + Math.random() * 0.5);\n const p = particle(x, y, size, colors[i % colors.length], shape);\n const a = typeof p.animate === 'function'\n ? p.animate(\n [\n { transform: 'translate(0,0) scale(1)', opacity: 1 },\n { transform: `translate(${Math.cos(angle) * d}px, ${Math.sin(angle) * d}px) scale(0.2)`, opacity: 0 },\n ],\n { duration: duration * (0.8 + Math.random() * 0.4), easing: 'cubic-bezier(0.22, 1, 0.36, 1)', fill: 'forwards' }\n )\n : null;\n done(a, p);\n }\n return count;\n}\n\nexport interface ConfettiOptions {\n /** Origin in client px (default: centre-bottom third of the viewport). */\n x?: number;\n y?: number;\n /** Pieces (default 80). */\n count?: number;\n /** Spread angle in degrees (default 70). */\n spread?: number;\n /** Launch speed multiplier (default 1). */\n velocity?: number;\n colors?: string[];\n /** Duration in ms (default 1600). */\n duration?: number;\n}\n\n/** A confetti cannon (paper pieces with gravity, drift and spin). */\nexport function confetti(options: ConfettiOptions = {}): number {\n if (typeof document === 'undefined' || prefersReducedMotion()) return 0;\n const W = window.innerWidth || 800;\n const H = window.innerHeight || 600;\n const { x = W / 2, y = H * 0.66, count = 80, spread = 70, velocity = 1, colors = PALETTE, duration = 1600 } = options;\n for (let i = 0; i < count; i++) {\n const angle = ((-90 + (Math.random() - 0.5) * spread) * Math.PI) / 180;\n const speed = (260 + Math.random() * 320) * velocity;\n const vx = Math.cos(angle) * speed;\n const vy = Math.sin(angle) * speed;\n const p = particle(x, y, 6 + Math.random() * 5, colors[i % colors.length], Math.random() > 0.5 ? 'square' : 'circle');\n p.style.height = `${4 + Math.random() * 3}px`;\n const frames: Keyframe[] = [];\n const steps = 8;\n const T = duration / 1000;\n const spin = (Math.random() - 0.5) * 1440;\n for (let s = 0; s <= steps; s++) {\n const t = (s / steps) * T;\n const g = 900;\n frames.push({\n transform: `translate(${(vx * t * 0.8).toFixed(1)}px, ${(vy * t + 0.5 * g * t * t).toFixed(1)}px) rotate(${((spin * s) / steps).toFixed(0)}deg) rotateX(${s * 120}deg)`,\n opacity: s === steps ? 0 : 1,\n });\n }\n const a = typeof p.animate === 'function' ? p.animate(frames, { duration: duration * (0.85 + Math.random() * 0.3), easing: 'linear', fill: 'forwards' }) : null;\n done(a, p);\n }\n return count;\n}\n\n/** Horizontal error shake (`intensity` px, default 8). Reduced motion: a red outline flash. */\nexport function shake(el: Element, intensity = 8, duration = 480): Animation | null {\n const t = el as HTMLElement;\n if (typeof t.animate !== 'function') return null;\n if (prefersReducedMotion()) return t.animate([{ outline: '2px solid #e5484d' }, { outline: '2px solid transparent' }], { duration: 600 });\n const k = intensity;\n return t.animate(\n [0, -k, k, -k * 0.75, k * 0.75, -k * 0.4, k * 0.4, 0].map((v) => ({ transform: `translateX(${v}px)` })),\n { duration, easing: 'ease-in-out' }\n );\n}\n\n/** `navigator.vibrate()` where supported (Android Chrome, some WebViews). Returns whether it ran. */\nexport function haptic(pattern: number | number[] = 10): boolean {\n try {\n return typeof navigator !== 'undefined' && typeof navigator.vibrate === 'function' ? navigator.vibrate(pattern) : false;\n } catch {\n return false;\n }\n}\n\nexport { applyFrame };\n"],"names":["prefersReducedMotion"],"mappings":";;;;AAEA;;;;;AAKG;AAEH,IAAI,KAAK,GAAuB,IAAI;AACpC,SAAS,OAAO,GAAA;AACd,IAAA,I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CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,CAAA,WAAA,EAAc,CAAC,CAAA,GAAA,CAAK,EAAE,CAAC,CAAC,EACvG,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,CACpC;AACH;AAEA;AACM,SAAU,MAAM,CAAC,OAAA,GAA6B,EAAE,EAAA;AACpD,IAAA,IAAI;QACF,OAAO,OAAO,SAAS,KAAK,WAAW,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK;IACzH;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;AACF;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"fx-lBGVtQO1.cjs","sources":["../../src/components/click/fx.ts"],"sourcesContent":["import { prefersReducedMotion, applyFrame } from '../base';\n\n/**\n * Click-effect helpers (v2.5): `burst()`, `confetti()`, `shake()`, `haptic()`.\n * Particles live in one fixed, pointer-transparent layer and are removed when\n * their animation ends. Under reduced motion particles are skipped and\n * `shake()` only flashes an outline.\n */\n\nlet layer: HTMLElement | null = null;\nfunction fxLayer(): HTMLElement {\n if (layer && layer.isConnected) return layer;\n layer = document.createElement('div');\n layer.className = 'usa-fx-layer';\n layer.setAttribute('aria-hidden', 'true');\n layer.style.cssText = 'position:fixed;inset:0;pointer-events:none;z-index:2147483000;overflow:hidden;contain:strict';\n document.body.appendChild(layer);\n return layer;\n}\n\nexport interface BurstOptions {\n /** Number of particles (default 12). */\n count?: number;\n /** Colours to pick from (default: accent palette). */\n colors?: string[];\n /** Travel distance in px (default 48). */\n distance?: number;\n /** Particle size in px (default 6). */\n size?: number;\n /** `circle` (default), `square`, `star`, `heart` or any text / emoji. */\n shape?: 'circle' | 'square' | 'star' | 'heart' | string;\n /** Duration in ms (default 600). */\n duration?: number;\n}\n\nconst PALETTE = ['#7c5cff', '#22d3ee', '#f472b6', '#facc15', '#34d399', '#fb923c'];\nconst GLYPH: Record<string, string> = { star: '★', heart: '♥' };\n\nfunction particle(x: number, y: number, size: number, color: string, shape: string): HTMLElement {\n const p = document.createElement('span');\n const glyph = GLYPH[shape] || (shape !== 'circle' && shape !== 'square' ? shape : '');\n p.style.cssText = `position:absolute;left:${x}px;top:${y}px;width:${size}px;height:${size}px;margin:${-size / 2}px 0 0 ${-size / 2}px;will-change:transform,opacity;` +\n (glyph ? `font-size:${size * 2}px;line-height:${size}px;text-align:center;color:${color}` : `background:${color};border-radius:${shape === 'square' ? '2px' : '50%'}`);\n if (glyph) p.textContent = glyph;\n fxLayer().appendChild(p);\n return p;\n}\n\nconst done = (a: Animation | null, el: Element) => {\n if (a) a.onfinish = () => el.remove();\n else el.remove();\n};\n\n/** Particles radiating from client point (x, y). Returns the number spawned. */\nexport function burst(x: number, y: number, options: BurstOptions = {}): number {\n if (typeof document === 'undefined' || prefersReducedMotion()) return 0;\n const { count = 12, colors = PALETTE, distance = 48, size = 6, shape = 'circle', duration = 600 } = options;\n for (let i = 0; i < count; i++) {\n const angle = (i / count) * Math.PI * 2 + Math.random() * 0.4;\n const d = distance * (0.7 + Math.random() * 0.5);\n const p = particle(x, y, size, colors[i % colors.length], shape);\n const a = typeof p.animate === 'function'\n ? p.animate(\n [\n { transform: 'translate(0,0) scale(1)', opacity: 1 },\n { transform: `translate(${Math.cos(angle) * d}px, ${Math.sin(angle) * d}px) scale(0.2)`, opacity: 0 },\n ],\n { duration: duration * (0.8 + Math.random() * 0.4), easing: 'cubic-bezier(0.22, 1, 0.36, 1)', fill: 'forwards' }\n )\n : null;\n done(a, p);\n }\n return count;\n}\n\nexport interface ConfettiOptions {\n /** Origin in client px (default: centre-bottom third of the viewport). */\n x?: number;\n y?: number;\n /** Pieces (default 80). */\n count?: number;\n /** Spread angle in degrees (default 70). */\n spread?: number;\n /** Launch speed multiplier (default 1). */\n velocity?: number;\n colors?: string[];\n /** Duration in ms (default 1600). */\n duration?: number;\n}\n\n/** A confetti cannon (paper pieces with gravity, drift and spin). */\nexport function confetti(options: ConfettiOptions = {}): number {\n if (typeof document === 'undefined' || prefersReducedMotion()) return 0;\n const W = window.innerWidth || 800;\n const H = window.innerHeight || 600;\n const { x = W / 2, y = H * 0.66, count = 80, spread = 70, velocity = 1, colors = PALETTE, duration = 1600 } = options;\n for (let i = 0; i < count; i++) {\n const angle = ((-90 + (Math.random() - 0.5) * spread) * Math.PI) / 180;\n const speed = (260 + Math.random() * 320) * velocity;\n const vx = Math.cos(angle) * speed;\n const vy = Math.sin(angle) * speed;\n const p = particle(x, y, 6 + Math.random() * 5, colors[i % colors.length], Math.random() > 0.5 ? 'square' : 'circle');\n p.style.height = `${4 + Math.random() * 3}px`;\n const frames: Keyframe[] = [];\n const steps = 8;\n const T = duration / 1000;\n const spin = (Math.random() - 0.5) * 1440;\n for (let s = 0; s <= steps; s++) {\n const t = (s / steps) * T;\n const g = 900;\n frames.push({\n transform: `translate(${(vx * t * 0.8).toFixed(1)}px, ${(vy * t + 0.5 * g * t * t).toFixed(1)}px) rotate(${((spin * s) / steps).toFixed(0)}deg) rotateX(${s * 120}deg)`,\n opacity: s === steps ? 0 : 1,\n });\n }\n const a = typeof p.animate === 'function' ? p.animate(frames, { duration: duration * (0.85 + Math.random() * 0.3), easing: 'linear', fill: 'forwards' }) : null;\n done(a, p);\n }\n return count;\n}\n\n/** Horizontal error shake (`intensity` px, default 8). Reduced motion: a red outline flash. */\nexport function shake(el: Element, intensity = 8, duration = 480): Animation | null {\n const t = el as HTMLElement;\n if (typeof t.animate !== 'function') return null;\n if (prefersReducedMotion()) return t.animate([{ outline: '2px solid #e5484d' }, { outline: '2px solid transparent' }], { duration: 600 });\n const k = intensity;\n return t.animate(\n [0, -k, k, -k * 0.75, k * 0.75, -k * 0.4, k * 0.4, 0].map((v) => ({ transform: `translateX(${v}px)` })),\n { duration, easing: 'ease-in-out' }\n );\n}\n\n/** `navigator.vibrate()` where supported (Android Chrome, some WebViews). Returns whether it ran. */\nexport function haptic(pattern: number | number[] = 10): boolean {\n try {\n return typeof navigator !== 'undefined' && typeof navigator.vibrate === 'function' ? navigator.vibrate(pattern) : false;\n } catch {\n return false;\n }\n}\n\nexport { applyFrame };\n"],"names":["prefersReducedMotion"],"mappings":";;;;AAEA;;;;;AAKG;AAEH,IAAI,KAAK,GAAuB,IAAI;AACpC,SAAS,OAAO,GAAA;AACd,IAAA,IAAI,KAAK,IAAI,KAAK,CAAC,WAAW;AAAE,QAAA,OAAO,KAAK;AAC5C,IAAA,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;AACrC,IAAA,KAAK,CAAC,SAAS,GAAG,cAAc;AAChC,IAAA,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC;AACzC,IAAA,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,8FAA8F;AACpH,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAChC,IAAA,OAAO,KAAK;AACd;AAiBA,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;AAClF,MAAM,KAAK,GAA2B,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;AAE/D,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS,EAAE,IAAY,EAAE,KAAa,EAAE,KAAa,EAAA;IAChF,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;IACxC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAG,EAAE,CAAC;IACrF,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAA,uBAAA,EAA0B,CAAC,CAAA,OAAA,EAAU,CAAC,CAAA,SAAA,EAAY,IAAI,aAAa,IAAI,CAAA,UAAA,EAAa,CAAC,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Q,EAAE,GAAG,EAAE,CAAC;IACzI,MAAM,CAAC,GAAG,SAAS;IACnB,OAAO,CAAC,CAAC,OAAO,CACd,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,CAAA,WAAA,EAAc,CAAC,CAAA,GAAA,CAAK,EAAE,CAAC,CAAC,EACvG,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,CACpC;AACH;AAEA;AACM,SAAU,MAAM,CAAC,OAAA,GAA6B,EAAE,EAAA;AACpD,IAAA,IAAI;QACF,OAAO,OAAO,SAAS,KAAK,WAAW,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK;IACzH;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;AACF;;;;;;;"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* motionary - Animation Presets
|
|
3
|
+
* Defines keyframes for all built-in animation presets
|
|
4
|
+
*/
|
|
5
|
+
const CORE = {
|
|
6
|
+
'fade-in': {
|
|
7
|
+
from: { opacity: 0 },
|
|
8
|
+
to: { opacity: 1 },
|
|
9
|
+
},
|
|
10
|
+
'fade-in-up': {
|
|
11
|
+
from: { opacity: 0, transform: 'translateY(40px)' },
|
|
12
|
+
to: { opacity: 1, transform: 'translateY(0px)' },
|
|
13
|
+
},
|
|
14
|
+
'fade-in-down': {
|
|
15
|
+
from: { opacity: 0, transform: 'translateY(-40px)' },
|
|
16
|
+
to: { opacity: 1, transform: 'translateY(0px)' },
|
|
17
|
+
},
|
|
18
|
+
'fade-in-left': {
|
|
19
|
+
from: { opacity: 0, transform: 'translateX(-40px)' },
|
|
20
|
+
to: { opacity: 1, transform: 'translateX(0px)' },
|
|
21
|
+
},
|
|
22
|
+
'fade-in-right': {
|
|
23
|
+
from: { opacity: 0, transform: 'translateX(40px)' },
|
|
24
|
+
to: { opacity: 1, transform: 'translateX(0px)' },
|
|
25
|
+
},
|
|
26
|
+
'zoom-in': {
|
|
27
|
+
from: { opacity: 0, transform: 'scale(0.8)' },
|
|
28
|
+
to: { opacity: 1, transform: 'scale(1)' },
|
|
29
|
+
},
|
|
30
|
+
'zoom-out': {
|
|
31
|
+
from: { opacity: 0, transform: 'scale(1.2)' },
|
|
32
|
+
to: { opacity: 1, transform: 'scale(1)' },
|
|
33
|
+
},
|
|
34
|
+
'flip-x': {
|
|
35
|
+
from: { opacity: 0, transform: 'rotateX(-90deg)' },
|
|
36
|
+
to: { opacity: 1, transform: 'rotateX(0deg)' },
|
|
37
|
+
},
|
|
38
|
+
'flip-y': {
|
|
39
|
+
from: { opacity: 0, transform: 'rotateY(-90deg)' },
|
|
40
|
+
to: { opacity: 1, transform: 'rotateY(0deg)' },
|
|
41
|
+
},
|
|
42
|
+
'slide-up': {
|
|
43
|
+
from: { transform: 'translateY(100%)' },
|
|
44
|
+
to: { transform: 'translateY(0px)' },
|
|
45
|
+
},
|
|
46
|
+
'slide-down': {
|
|
47
|
+
from: { transform: 'translateY(-100%)' },
|
|
48
|
+
to: { transform: 'translateY(0px)' },
|
|
49
|
+
},
|
|
50
|
+
'slide-left': {
|
|
51
|
+
from: { transform: 'translateX(-100%)' },
|
|
52
|
+
to: { transform: 'translateX(0px)' },
|
|
53
|
+
},
|
|
54
|
+
'slide-right': {
|
|
55
|
+
from: { transform: 'translateX(100%)' },
|
|
56
|
+
to: { transform: 'translateX(0px)' },
|
|
57
|
+
},
|
|
58
|
+
'bounce': {
|
|
59
|
+
from: { opacity: 0, transform: 'translateY(-60px)' },
|
|
60
|
+
to: { opacity: 1, transform: 'translateY(0px)' },
|
|
61
|
+
},
|
|
62
|
+
'rotate-in': {
|
|
63
|
+
from: { opacity: 0, transform: 'rotate(-180deg) scale(0.5)' },
|
|
64
|
+
to: { opacity: 1, transform: 'rotate(0deg) scale(1)' },
|
|
65
|
+
},
|
|
66
|
+
'blur-in': {
|
|
67
|
+
from: { opacity: 0, filter: 'blur(12px)' },
|
|
68
|
+
to: { opacity: 1, filter: 'blur(0px)' },
|
|
69
|
+
},
|
|
70
|
+
'skew-in': {
|
|
71
|
+
from: { opacity: 0, transform: 'skewX(20deg) translateX(30px)' },
|
|
72
|
+
to: { opacity: 1, transform: 'skewX(0deg) translateX(0px)' },
|
|
73
|
+
},
|
|
74
|
+
'scale-x': {
|
|
75
|
+
from: { transform: 'scaleX(0)' },
|
|
76
|
+
to: { transform: 'scaleX(1)' },
|
|
77
|
+
},
|
|
78
|
+
'scale-y': {
|
|
79
|
+
from: { transform: 'scaleY(0)' },
|
|
80
|
+
to: { transform: 'scaleY(1)' },
|
|
81
|
+
},
|
|
82
|
+
'shimmer': {
|
|
83
|
+
from: { opacity: 0.5, filter: 'brightness(1)' },
|
|
84
|
+
to: { opacity: 1, filter: 'brightness(1.5)' },
|
|
85
|
+
},
|
|
86
|
+
'pulse': {
|
|
87
|
+
from: { transform: 'scale(1)' },
|
|
88
|
+
to: { transform: 'scale(1.05)' },
|
|
89
|
+
},
|
|
90
|
+
'swing': {
|
|
91
|
+
from: { transform: 'rotate(-10deg)' },
|
|
92
|
+
to: { transform: 'rotate(10deg)' },
|
|
93
|
+
},
|
|
94
|
+
'scale-up': {
|
|
95
|
+
from: { opacity: 0, transform: 'scale(0.5)' },
|
|
96
|
+
to: { opacity: 1, transform: 'scale(1)' },
|
|
97
|
+
},
|
|
98
|
+
'blur-in-up': {
|
|
99
|
+
from: { opacity: 0, filter: 'blur(12px)', transform: 'translateY(40px)' },
|
|
100
|
+
to: { opacity: 1, filter: 'blur(0px)', transform: 'translateY(0px)' },
|
|
101
|
+
},
|
|
102
|
+
'flip-up': {
|
|
103
|
+
from: { opacity: 0, transform: 'perspective(800px) rotateX(60deg)' },
|
|
104
|
+
to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },
|
|
105
|
+
},
|
|
106
|
+
'flip-down': {
|
|
107
|
+
from: { opacity: 0, transform: 'perspective(800px) rotateX(-60deg)' },
|
|
108
|
+
to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },
|
|
109
|
+
},
|
|
110
|
+
'rotate-left': {
|
|
111
|
+
from: { opacity: 0, transform: 'rotate(-15deg) translateX(-40px)' },
|
|
112
|
+
to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },
|
|
113
|
+
},
|
|
114
|
+
'rotate-right': {
|
|
115
|
+
from: { opacity: 0, transform: 'rotate(15deg) translateX(40px)' },
|
|
116
|
+
to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },
|
|
117
|
+
},
|
|
118
|
+
// clip-path reveals: content is uncovered without moving or fading
|
|
119
|
+
'clip-up': {
|
|
120
|
+
from: { clipPath: 'inset(100% 0% 0% 0%)' },
|
|
121
|
+
to: { clipPath: 'inset(0% 0% 0% 0%)' },
|
|
122
|
+
},
|
|
123
|
+
'clip-down': {
|
|
124
|
+
from: { clipPath: 'inset(0% 0% 100% 0%)' },
|
|
125
|
+
to: { clipPath: 'inset(0% 0% 0% 0%)' },
|
|
126
|
+
},
|
|
127
|
+
'clip-left': {
|
|
128
|
+
from: { clipPath: 'inset(0% 0% 0% 100%)' },
|
|
129
|
+
to: { clipPath: 'inset(0% 0% 0% 0%)' },
|
|
130
|
+
},
|
|
131
|
+
'clip-right': {
|
|
132
|
+
from: { clipPath: 'inset(0% 100% 0% 0%)' },
|
|
133
|
+
to: { clipPath: 'inset(0% 0% 0% 0%)' },
|
|
134
|
+
},
|
|
135
|
+
'clip-circle': {
|
|
136
|
+
from: { clipPath: 'circle(0% at 50% 50%)' },
|
|
137
|
+
to: { clipPath: 'circle(75% at 50% 50%)' },
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* One preset table per page, shared through a global symbol so every copy of
|
|
142
|
+
* the library (ESM entries, the UMD bundle, `presets/extended`) sees presets
|
|
143
|
+
* registered by any other copy. `<usa-reveal>` / `<usa-stagger>` read it too.
|
|
144
|
+
*/
|
|
145
|
+
const share = (core) => {
|
|
146
|
+
const g = globalThis;
|
|
147
|
+
const key = Symbol.for('use-scroll-animate.presets');
|
|
148
|
+
return (g[key] = Object.assign(g[key] || {}, core));
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Every registered preset: the 33 core presets, plus the 6.1 extended set once
|
|
152
|
+
* `motionary/presets/extended` is loaded, plus your own.
|
|
153
|
+
*/
|
|
154
|
+
const PRESETS = /*#__PURE__*/ share(CORE);
|
|
155
|
+
/**
|
|
156
|
+
* Add (or replace) presets by name: `registerPresets({ 'my-pop': { from, to, frames? } })`.
|
|
157
|
+
* They work everywhere a preset name does (`animation`, `exit`, `data-sa-animation`,
|
|
158
|
+
* `<scroll-animate>`, `<usa-reveal effect>`).
|
|
159
|
+
*/
|
|
160
|
+
function registerPresets(presets) {
|
|
161
|
+
Object.assign(PRESETS, presets);
|
|
162
|
+
}
|
|
163
|
+
/** The same keyframes played backwards (exit animations). */
|
|
164
|
+
function reversePreset(p) {
|
|
165
|
+
return { from: p.to, to: p.from, frames: p.frames && p.frames.map((f) => ({ ...f, offset: 1 - f.offset })).reverse() };
|
|
166
|
+
}
|
|
167
|
+
const lookup = (name) => PRESETS[name.trim()];
|
|
168
|
+
function resolvePreset(animation) {
|
|
169
|
+
if (typeof animation === 'string') {
|
|
170
|
+
return lookup(animation) ?? PRESETS['fade-in-up'];
|
|
171
|
+
}
|
|
172
|
+
if (Array.isArray(animation)) {
|
|
173
|
+
const combined = { from: {}, to: {} };
|
|
174
|
+
animation.forEach(name => {
|
|
175
|
+
const preset = lookup(name);
|
|
176
|
+
if (preset) {
|
|
177
|
+
Object.entries(preset.from).forEach(([key, val]) => {
|
|
178
|
+
if (key === 'transform' && combined.from[key]) {
|
|
179
|
+
combined.from[key] = `${combined.from[key]} ${val}`;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
combined.from[key] = val;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
Object.entries(preset.to).forEach(([key, val]) => {
|
|
186
|
+
if (key === 'transform' && combined.to[key]) {
|
|
187
|
+
combined.to[key] = `${combined.to[key]} ${val}`;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
combined.to[key] = val;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return combined;
|
|
196
|
+
}
|
|
197
|
+
return animation;
|
|
198
|
+
}
|
|
199
|
+
/** Easing to CSS cubic-bezier mapping */
|
|
200
|
+
const EASING_MAP = {
|
|
201
|
+
linear: 'linear',
|
|
202
|
+
ease: 'ease',
|
|
203
|
+
'ease-in': 'ease-in',
|
|
204
|
+
'ease-out': 'ease-out',
|
|
205
|
+
'ease-in-out': 'ease-in-out',
|
|
206
|
+
spring: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
|
|
207
|
+
'soft-spring': 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
|
|
208
|
+
'heavy-bounce': 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
|
|
209
|
+
};
|
|
210
|
+
function resolveEasing(easing) {
|
|
211
|
+
if (typeof easing === 'string') {
|
|
212
|
+
return EASING_MAP[easing] ?? easing;
|
|
213
|
+
}
|
|
214
|
+
if (Array.isArray(easing)) {
|
|
215
|
+
return `cubic-bezier(${easing.join(', ')})`;
|
|
216
|
+
}
|
|
217
|
+
if (typeof easing === 'function') {
|
|
218
|
+
// Functions cannot be expressed as a CSS easing string; the core samples
|
|
219
|
+
// them into a `linear()` easing (or keyframes on older browsers).
|
|
220
|
+
return 'linear';
|
|
221
|
+
}
|
|
222
|
+
return 'ease';
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export { EASING_MAP as E, PRESETS as P, resolveEasing as a, reversePreset as b, registerPresets as c, resolvePreset as r };
|
|
226
|
+
//# sourceMappingURL=presets-BYBVJVeP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets-BYBVJVeP.js","sources":["../../src/presets.ts"],"sourcesContent":["/**\n * motionary - Animation Presets\n * Defines keyframes for all built-in animation presets\n */\n\nimport type { AnimationPreset, CorePreset, CustomAnimation, EasingType, ExtendedPreset, PresetKeyframes } from './types';\n\ntype KeyframeMap = PresetKeyframes;\n\nconst CORE: Record<CorePreset, 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\n/**\n * One preset table per page, shared through a global symbol so every copy of\n * the library (ESM entries, the UMD bundle, `presets/extended`) sees presets\n * registered by any other copy. `<usa-reveal>` / `<usa-stagger>` read it too.\n */\nconst share = (core: Record<string, KeyframeMap>): Record<string, KeyframeMap> => {\n const g = globalThis as any;\n const key = Symbol.for('use-scroll-animate.presets');\n return (g[key] = Object.assign(g[key] || {}, core));\n};\n\n/**\n * Every registered preset: the 33 core presets, plus the 6.1 extended set once\n * `motionary/presets/extended` is loaded, plus your own.\n */\nexport const PRESETS = /*#__PURE__*/ share(CORE) as Record<CorePreset, KeyframeMap> & Partial<Record<ExtendedPreset, KeyframeMap>>;\n\n/**\n * Add (or replace) presets by name: `registerPresets({ 'my-pop': { from, to, frames? } })`.\n * They work everywhere a preset name does (`animation`, `exit`, `data-sa-animation`,\n * `<scroll-animate>`, `<usa-reveal effect>`).\n */\nexport function registerPresets(presets: Record<string, PresetKeyframes>): void {\n Object.assign(PRESETS, presets);\n}\n\n/** The same keyframes played backwards (exit animations). */\nexport function reversePreset(p: KeyframeMap): KeyframeMap {\n return { from: p.to, to: p.from, frames: p.frames && p.frames.map((f) => ({ ...f, offset: 1 - f.offset })).reverse() };\n}\n\nconst lookup = (name: string): KeyframeMap | undefined => (PRESETS as Record<string, KeyframeMap>)[name.trim()];\n\nexport function resolvePreset(animation: AnimationPreset | AnimationPreset[] | CustomAnimation): KeyframeMap {\n if (typeof animation === 'string') {\n return lookup(animation) ?? PRESETS['fade-in-up'];\n }\n \n if (Array.isArray(animation)) {\n const combined: KeyframeMap = { from: {}, to: {} };\n animation.forEach(name => {\n const preset = lookup(name);\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"],"names":[],"mappings":"AAAA;;;AAGG;AAMH,MAAM,IAAI,GAAoC;AAC5C,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,EAAE,OAAO,EAAE,CAA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5
|
+
* Defines keyframes for all built-in animation presets
|
|
6
|
+
*/
|
|
7
|
+
const CORE = {
|
|
8
|
+
'fade-in': {
|
|
9
|
+
from: { opacity: 0 },
|
|
10
|
+
to: { opacity: 1 },
|
|
11
|
+
},
|
|
12
|
+
'fade-in-up': {
|
|
13
|
+
from: { opacity: 0, transform: 'translateY(40px)' },
|
|
14
|
+
to: { opacity: 1, transform: 'translateY(0px)' },
|
|
15
|
+
},
|
|
16
|
+
'fade-in-down': {
|
|
17
|
+
from: { opacity: 0, transform: 'translateY(-40px)' },
|
|
18
|
+
to: { opacity: 1, transform: 'translateY(0px)' },
|
|
19
|
+
},
|
|
20
|
+
'fade-in-left': {
|
|
21
|
+
from: { opacity: 0, transform: 'translateX(-40px)' },
|
|
22
|
+
to: { opacity: 1, transform: 'translateX(0px)' },
|
|
23
|
+
},
|
|
24
|
+
'fade-in-right': {
|
|
25
|
+
from: { opacity: 0, transform: 'translateX(40px)' },
|
|
26
|
+
to: { opacity: 1, transform: 'translateX(0px)' },
|
|
27
|
+
},
|
|
28
|
+
'zoom-in': {
|
|
29
|
+
from: { opacity: 0, transform: 'scale(0.8)' },
|
|
30
|
+
to: { opacity: 1, transform: 'scale(1)' },
|
|
31
|
+
},
|
|
32
|
+
'zoom-out': {
|
|
33
|
+
from: { opacity: 0, transform: 'scale(1.2)' },
|
|
34
|
+
to: { opacity: 1, transform: 'scale(1)' },
|
|
35
|
+
},
|
|
36
|
+
'flip-x': {
|
|
37
|
+
from: { opacity: 0, transform: 'rotateX(-90deg)' },
|
|
38
|
+
to: { opacity: 1, transform: 'rotateX(0deg)' },
|
|
39
|
+
},
|
|
40
|
+
'flip-y': {
|
|
41
|
+
from: { opacity: 0, transform: 'rotateY(-90deg)' },
|
|
42
|
+
to: { opacity: 1, transform: 'rotateY(0deg)' },
|
|
43
|
+
},
|
|
44
|
+
'slide-up': {
|
|
45
|
+
from: { transform: 'translateY(100%)' },
|
|
46
|
+
to: { transform: 'translateY(0px)' },
|
|
47
|
+
},
|
|
48
|
+
'slide-down': {
|
|
49
|
+
from: { transform: 'translateY(-100%)' },
|
|
50
|
+
to: { transform: 'translateY(0px)' },
|
|
51
|
+
},
|
|
52
|
+
'slide-left': {
|
|
53
|
+
from: { transform: 'translateX(-100%)' },
|
|
54
|
+
to: { transform: 'translateX(0px)' },
|
|
55
|
+
},
|
|
56
|
+
'slide-right': {
|
|
57
|
+
from: { transform: 'translateX(100%)' },
|
|
58
|
+
to: { transform: 'translateX(0px)' },
|
|
59
|
+
},
|
|
60
|
+
'bounce': {
|
|
61
|
+
from: { opacity: 0, transform: 'translateY(-60px)' },
|
|
62
|
+
to: { opacity: 1, transform: 'translateY(0px)' },
|
|
63
|
+
},
|
|
64
|
+
'rotate-in': {
|
|
65
|
+
from: { opacity: 0, transform: 'rotate(-180deg) scale(0.5)' },
|
|
66
|
+
to: { opacity: 1, transform: 'rotate(0deg) scale(1)' },
|
|
67
|
+
},
|
|
68
|
+
'blur-in': {
|
|
69
|
+
from: { opacity: 0, filter: 'blur(12px)' },
|
|
70
|
+
to: { opacity: 1, filter: 'blur(0px)' },
|
|
71
|
+
},
|
|
72
|
+
'skew-in': {
|
|
73
|
+
from: { opacity: 0, transform: 'skewX(20deg) translateX(30px)' },
|
|
74
|
+
to: { opacity: 1, transform: 'skewX(0deg) translateX(0px)' },
|
|
75
|
+
},
|
|
76
|
+
'scale-x': {
|
|
77
|
+
from: { transform: 'scaleX(0)' },
|
|
78
|
+
to: { transform: 'scaleX(1)' },
|
|
79
|
+
},
|
|
80
|
+
'scale-y': {
|
|
81
|
+
from: { transform: 'scaleY(0)' },
|
|
82
|
+
to: { transform: 'scaleY(1)' },
|
|
83
|
+
},
|
|
84
|
+
'shimmer': {
|
|
85
|
+
from: { opacity: 0.5, filter: 'brightness(1)' },
|
|
86
|
+
to: { opacity: 1, filter: 'brightness(1.5)' },
|
|
87
|
+
},
|
|
88
|
+
'pulse': {
|
|
89
|
+
from: { transform: 'scale(1)' },
|
|
90
|
+
to: { transform: 'scale(1.05)' },
|
|
91
|
+
},
|
|
92
|
+
'swing': {
|
|
93
|
+
from: { transform: 'rotate(-10deg)' },
|
|
94
|
+
to: { transform: 'rotate(10deg)' },
|
|
95
|
+
},
|
|
96
|
+
'scale-up': {
|
|
97
|
+
from: { opacity: 0, transform: 'scale(0.5)' },
|
|
98
|
+
to: { opacity: 1, transform: 'scale(1)' },
|
|
99
|
+
},
|
|
100
|
+
'blur-in-up': {
|
|
101
|
+
from: { opacity: 0, filter: 'blur(12px)', transform: 'translateY(40px)' },
|
|
102
|
+
to: { opacity: 1, filter: 'blur(0px)', transform: 'translateY(0px)' },
|
|
103
|
+
},
|
|
104
|
+
'flip-up': {
|
|
105
|
+
from: { opacity: 0, transform: 'perspective(800px) rotateX(60deg)' },
|
|
106
|
+
to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },
|
|
107
|
+
},
|
|
108
|
+
'flip-down': {
|
|
109
|
+
from: { opacity: 0, transform: 'perspective(800px) rotateX(-60deg)' },
|
|
110
|
+
to: { opacity: 1, transform: 'perspective(800px) rotateX(0deg)' },
|
|
111
|
+
},
|
|
112
|
+
'rotate-left': {
|
|
113
|
+
from: { opacity: 0, transform: 'rotate(-15deg) translateX(-40px)' },
|
|
114
|
+
to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },
|
|
115
|
+
},
|
|
116
|
+
'rotate-right': {
|
|
117
|
+
from: { opacity: 0, transform: 'rotate(15deg) translateX(40px)' },
|
|
118
|
+
to: { opacity: 1, transform: 'rotate(0deg) translateX(0px)' },
|
|
119
|
+
},
|
|
120
|
+
// clip-path reveals: content is uncovered without moving or fading
|
|
121
|
+
'clip-up': {
|
|
122
|
+
from: { clipPath: 'inset(100% 0% 0% 0%)' },
|
|
123
|
+
to: { clipPath: 'inset(0% 0% 0% 0%)' },
|
|
124
|
+
},
|
|
125
|
+
'clip-down': {
|
|
126
|
+
from: { clipPath: 'inset(0% 0% 100% 0%)' },
|
|
127
|
+
to: { clipPath: 'inset(0% 0% 0% 0%)' },
|
|
128
|
+
},
|
|
129
|
+
'clip-left': {
|
|
130
|
+
from: { clipPath: 'inset(0% 0% 0% 100%)' },
|
|
131
|
+
to: { clipPath: 'inset(0% 0% 0% 0%)' },
|
|
132
|
+
},
|
|
133
|
+
'clip-right': {
|
|
134
|
+
from: { clipPath: 'inset(0% 100% 0% 0%)' },
|
|
135
|
+
to: { clipPath: 'inset(0% 0% 0% 0%)' },
|
|
136
|
+
},
|
|
137
|
+
'clip-circle': {
|
|
138
|
+
from: { clipPath: 'circle(0% at 50% 50%)' },
|
|
139
|
+
to: { clipPath: 'circle(75% at 50% 50%)' },
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* One preset table per page, shared through a global symbol so every copy of
|
|
144
|
+
* the library (ESM entries, the UMD bundle, `presets/extended`) sees presets
|
|
145
|
+
* registered by any other copy. `<usa-reveal>` / `<usa-stagger>` read it too.
|
|
146
|
+
*/
|
|
147
|
+
const share = (core) => {
|
|
148
|
+
const g = globalThis;
|
|
149
|
+
const key = Symbol.for('use-scroll-animate.presets');
|
|
150
|
+
return (g[key] = Object.assign(g[key] || {}, core));
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Every registered preset: the 33 core presets, plus the 6.1 extended set once
|
|
154
|
+
* `motionary/presets/extended` is loaded, plus your own.
|
|
155
|
+
*/
|
|
156
|
+
const PRESETS = /*#__PURE__*/ share(CORE);
|
|
157
|
+
/**
|
|
158
|
+
* Add (or replace) presets by name: `registerPresets({ 'my-pop': { from, to, frames? } })`.
|
|
159
|
+
* They work everywhere a preset name does (`animation`, `exit`, `data-sa-animation`,
|
|
160
|
+
* `<scroll-animate>`, `<usa-reveal effect>`).
|
|
161
|
+
*/
|
|
162
|
+
function registerPresets(presets) {
|
|
163
|
+
Object.assign(PRESETS, presets);
|
|
164
|
+
}
|
|
165
|
+
/** The same keyframes played backwards (exit animations). */
|
|
166
|
+
function reversePreset(p) {
|
|
167
|
+
return { from: p.to, to: p.from, frames: p.frames && p.frames.map((f) => ({ ...f, offset: 1 - f.offset })).reverse() };
|
|
168
|
+
}
|
|
169
|
+
const lookup = (name) => PRESETS[name.trim()];
|
|
170
|
+
function resolvePreset(animation) {
|
|
171
|
+
if (typeof animation === 'string') {
|
|
172
|
+
return lookup(animation) ?? PRESETS['fade-in-up'];
|
|
173
|
+
}
|
|
174
|
+
if (Array.isArray(animation)) {
|
|
175
|
+
const combined = { from: {}, to: {} };
|
|
176
|
+
animation.forEach(name => {
|
|
177
|
+
const preset = lookup(name);
|
|
178
|
+
if (preset) {
|
|
179
|
+
Object.entries(preset.from).forEach(([key, val]) => {
|
|
180
|
+
if (key === 'transform' && combined.from[key]) {
|
|
181
|
+
combined.from[key] = `${combined.from[key]} ${val}`;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
combined.from[key] = val;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
Object.entries(preset.to).forEach(([key, val]) => {
|
|
188
|
+
if (key === 'transform' && combined.to[key]) {
|
|
189
|
+
combined.to[key] = `${combined.to[key]} ${val}`;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
combined.to[key] = val;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
return combined;
|
|
198
|
+
}
|
|
199
|
+
return animation;
|
|
200
|
+
}
|
|
201
|
+
/** Easing to CSS cubic-bezier mapping */
|
|
202
|
+
const EASING_MAP = {
|
|
203
|
+
linear: 'linear',
|
|
204
|
+
ease: 'ease',
|
|
205
|
+
'ease-in': 'ease-in',
|
|
206
|
+
'ease-out': 'ease-out',
|
|
207
|
+
'ease-in-out': 'ease-in-out',
|
|
208
|
+
spring: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
|
|
209
|
+
'soft-spring': 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
|
|
210
|
+
'heavy-bounce': 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
|
|
211
|
+
};
|
|
212
|
+
function resolveEasing(easing) {
|
|
213
|
+
if (typeof easing === 'string') {
|
|
214
|
+
return EASING_MAP[easing] ?? easing;
|
|
215
|
+
}
|
|
216
|
+
if (Array.isArray(easing)) {
|
|
217
|
+
return `cubic-bezier(${easing.join(', ')})`;
|
|
218
|
+
}
|
|
219
|
+
if (typeof easing === 'function') {
|
|
220
|
+
// Functions cannot be expressed as a CSS easing string; the core samples
|
|
221
|
+
// them into a `linear()` easing (or keyframes on older browsers).
|
|
222
|
+
return 'linear';
|
|
223
|
+
}
|
|
224
|
+
return 'ease';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
exports.EASING_MAP = EASING_MAP;
|
|
228
|
+
exports.PRESETS = PRESETS;
|
|
229
|
+
exports.registerPresets = registerPresets;
|
|
230
|
+
exports.resolveEasing = resolveEasing;
|
|
231
|
+
exports.resolvePreset = resolvePreset;
|
|
232
|
+
exports.reversePreset = reversePreset;
|
|
233
|
+
//# sourceMappingURL=presets-CUHys3sK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets-CUHys3sK.cjs","sources":["../../src/presets.ts"],"sourcesContent":["/**\n * motionary - Animation Presets\n * Defines keyframes for all built-in animation presets\n */\n\nimport type { AnimationPreset, CorePreset, CustomAnimation, EasingType, ExtendedPreset, PresetKeyframes } from './types';\n\ntype KeyframeMap = PresetKeyframes;\n\nconst CORE: Record<CorePreset, 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\n/**\n * One preset table per page, shared through a global symbol so every copy of\n * the library (ESM entries, the UMD bundle, `presets/extended`) sees presets\n * registered by any other copy. `<usa-reveal>` / `<usa-stagger>` read it too.\n */\nconst share = (core: Record<string, KeyframeMap>): Record<string, KeyframeMap> => {\n const g = globalThis as any;\n const key = Symbol.for('use-scroll-animate.presets');\n return (g[key] = Object.assign(g[key] || {}, core));\n};\n\n/**\n * Every registered preset: the 33 core presets, plus the 6.1 extended set once\n * `motionary/presets/extended` is loaded, plus your own.\n */\nexport const PRESETS = /*#__PURE__*/ share(CORE) as Record<CorePreset, KeyframeMap> & Partial<Record<ExtendedPreset, KeyframeMap>>;\n\n/**\n * Add (or replace) presets by name: `registerPresets({ 'my-pop': { from, to, frames? } })`.\n * They work everywhere a preset name does (`animation`, `exit`, `data-sa-animation`,\n * `<scroll-animate>`, `<usa-reveal effect>`).\n */\nexport function registerPresets(presets: Record<string, PresetKeyframes>): void {\n Object.assign(PRESETS, presets);\n}\n\n/** The same keyframes played backwards (exit animations). */\nexport function reversePreset(p: KeyframeMap): KeyframeMap {\n return { from: p.to, to: p.from, frames: p.frames && p.frames.map((f) => ({ ...f, offset: 1 - f.offset })).reverse() };\n}\n\nconst lookup = (name: string): KeyframeMap | undefined => (PRESETS as Record<string, KeyframeMap>)[name.trim()];\n\nexport function resolvePreset(animation: AnimationPreset | AnimationPreset[] | CustomAnimation): KeyframeMap {\n if (typeof animation === 'string') {\n return lookup(animation) ?? PRESETS['fade-in-up'];\n }\n \n if (Array.isArray(animation)) {\n const combined: KeyframeMap = { from: {}, to: {} };\n animation.forEach(name => {\n const preset = lookup(name);\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"],"names":[],"mappings":";;AAAA;;;AAGG;AAMH,MAAM,IAAI,GAAoC;AAC5C,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;AACpB,QAAA,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;AACnB,KAAA;AACD,IAAA,YAAY,EAAE;QACZ,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE;QACnD,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE;AACjD,KAAA;AACD,IAAA,cAAc,EAAE;QACd,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE;QACpD,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE;AACjD,KAAA;AACD,IAAA,cAAc,EAAE;QACd,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE;QACpD,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE;AACjD,KAAA;AACD,IAAA,eAAe,EAAE;QACf,IAAI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3C,IAAA,aAAa,EAAE,yCAAyC;AACxD,IAAA,cAAc,EAAE,wCAAwC;;AAGpD,SAAU,aAAa,CAAC,MAAkB,EAAA;AAC9C,IAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,QAAA,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,MAAM;IACrC;AACA,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACzB,OAAO,CAAA,aAAA,EAAgB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;IAC7C;AACA,IAAA,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;;;AAGhC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,OAAO,MAAM;AACf;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as prefersReducedMotion, l as applyFrame, m as motionScale, E as EASE_SPRING, n as now, r as raf, q as caf } from './base-
|
|
1
|
+
import { p as prefersReducedMotion, l as applyFrame, m as motionScale, E as EASE_SPRING, n as now, r as raf, q as caf } from './base-Yno7N2eC.js';
|
|
2
2
|
|
|
3
3
|
const SPRING_PRESETS = {
|
|
4
4
|
default: { stiffness: 170, damping: 26, mass: 1 },
|
|
@@ -216,4 +216,4 @@ function rubberBand(distance, dimension, constant = 0.55) {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
export { SPRING_PRESETS as S, rubberBand as a, spring as b, createSpring as c, springEasing as d, springSamples as e, stepSpring as f, supportsLinearEasing as g, linearEasing as l, projectInertia as p, resolveSpring as r, snapTo as s };
|
|
219
|
-
//# sourceMappingURL=spring-
|
|
219
|
+
//# sourceMappingURL=spring-DfQO5USi.js.map
|