@hilux/ngx-motion 2.6.0 → 2.7.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/README.md +23 -0
- package/fesm2022/hilux-ngx-motion.mjs +122 -14
- package/fesm2022/hilux-ngx-motion.mjs.map +1 -1
- package/package.json +1 -1
- package/types/hilux-ngx-motion.d.ts +36 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hilux-ngx-motion.mjs","names":["motionAnimate","motionInView","motionEaseIn","motionEaseOut","motionEaseInOut","motionStagger","motionSpring","hasStyleProperties","LAYOUT_SPRING","motionTransform","motionScroll","globalTransition"],"sources":["../../../projects/ngx-motion/src/lib/services/motion-one.service.ts","../../../projects/ngx-motion/src/lib/utils/svg-path.utils.ts","../../../projects/ngx-motion/src/lib/config/motion-config.ts","../../../projects/ngx-motion/src/lib/services/motion-animation.service.ts","../../../projects/ngx-motion/src/lib/utils/easing.utils.ts","../../../projects/ngx-motion/src/lib/services/motion-animation-options.service.ts","../../../projects/ngx-motion/src/lib/utils/timing.utils.ts","../../../projects/ngx-motion/src/lib/services/motion-stagger.service.ts","../../../projects/ngx-motion/src/lib/constants/motion-defaults.constants.ts","../../../projects/ngx-motion/src/lib/services/motion-inview.service.ts","../../../projects/ngx-motion/src/lib/utils/color.utils.ts","../../../projects/ngx-motion/src/lib/services/motion-timeline.service.ts","../../../projects/ngx-motion/src/lib/services/motion-gesture.service.ts","../../../projects/ngx-motion/src/lib/utils/transform.utils.ts","../../../projects/ngx-motion/src/lib/utils/style-extraction.utils.ts","../../../projects/ngx-motion/src/lib/utils/variant.utils.ts","../../../projects/ngx-motion/src/lib/directives/motion-one.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-if.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-presence.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-scroll.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-pointer.directives.ts","../../../projects/ngx-motion/src/lib/directives/motion-drag.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-pan.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-reorder.directives.ts","../../../projects/ngx-motion/src/lib/directives/motion-layout.directive.ts","../../../projects/ngx-motion/src/lib/values/motion-signals.ts","../../../projects/ngx-motion/src/lib/directives/motion-style.directive.ts","../../../projects/ngx-motion/src/lib/animate/inject-animate.ts"],"sourcesContent":["import {\n Injectable,\n Inject,\n signal,\n PLATFORM_ID,\n NgZone,\n OnDestroy,\n WritableSignal,\n DOCUMENT\n} from '@angular/core';\n import { isPlatformBrowser } from '@angular/common';\n import { Subject, Observable, timer } from 'rxjs';\n import { take, map } from 'rxjs/operators';\n \n // Define the interface for motion elements\n export interface MotionElement {\n elementId: string;\n getDuration(): number;\n runInitAnimation(): void;\n runExitAnimation(): void;\n cancel(): void;\n route?: string;\n }\n \n @Injectable({\n providedIn: 'root',\n })\n export class MotionOneService implements OnDestroy {\n private motionElements: MotionElement[] = [];\n private readonly _scrollYProgress = signal(0);\n private removeScrollListener: (() => void) | null = null;\n\n /**\n * Page scroll progress (0-100). The scroll listener is only attached the\n * first time this is read, so apps that never use it pay nothing.\n */\n get scrollYProgress(): WritableSignal<number> {\n this.ensureScrollListener();\n return this._scrollYProgress;\n }\n totalExitDuration: number = 0;\n \n // Subject that emits when all exit animations for a route are complete\n private exitAnimationsComplete = new Subject<string>();\n \n // Subject that emits when all enter animations for a route are complete\n private enterAnimationsComplete = new Subject<string>();\n \n // Track active exit animations by route\n private activeExitAnimations: Map<string, number> = new Map();\n \n // Track active enter animations by route\n private activeEnterAnimations: Map<string, number> = new Map();\n \n constructor(\n @Inject(DOCUMENT) private document: Document,\n @Inject(PLATFORM_ID) private platformId: Object,\n private ngZone: NgZone\n ) {}\n \n ngOnDestroy() {\n this.removeScrollListener?.();\n this.removeScrollListener = null;\n this.exitAnimationsComplete.complete();\n this.enterAnimationsComplete.complete();\n }\n \n /**\n * TODO: In a future task, we want to use Angular framework's exit delay function\n * to handle exit animations properly instead of this custom implementation.\n * \n * DISABLED: Exit duration calculation is disabled to prevent navigation blocking.\n */\n private updateTotalExitDuration() {\n // Always set to 0 to prevent navigation blocking\n // TODO: Replace with Angular framework's exit delay mechanism in future tasks\n this.totalExitDuration = 0;\n \n // DISABLED - Original implementation commented out:\n // if (!isPlatformBrowser(this.platformId)) return;\n // \n // this.totalExitDuration = this.motionElements.reduce((total, element) => {\n // return total + element.getDuration();\n // }, 0);\n }\n \n /**\n * Passive scroll listener outside the Angular zone, throttled to one update per\n * animation frame. The signal only changes when the rounded percentage changes,\n * so templates reading it re-render at most once per percent.\n */\n private ensureScrollListener() {\n if (this.removeScrollListener || !isPlatformBrowser(this.platformId)) return;\n\n let frame = 0;\n const onScroll = () => {\n if (frame) return;\n frame = requestAnimationFrame(() => {\n frame = 0;\n this.updateScrollProgress();\n });\n };\n this.ngZone.runOutsideAngular(() =>\n window.addEventListener('scroll', onScroll, { passive: true })\n );\n this.removeScrollListener = () => {\n window.removeEventListener('scroll', onScroll);\n if (frame) cancelAnimationFrame(frame);\n };\n // Initial value on the next frame, not synchronously: the first read may\n // happen inside a computed(), where writing a signal would throw.\n onScroll();\n }\n \n private updateScrollProgress() {\n if (!isPlatformBrowser(this.platformId)) return;\n \n const doc = this.document.documentElement;\n const scrollTop = window.scrollY || doc.scrollTop;\n const scrollHeight = doc.scrollHeight - doc.clientHeight;\n const progress =\n scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;\n this._scrollYProgress.set(progress);\n }\n \n registerMotionElement(element: MotionElement) {\n this.motionElements.push(element);\n this.updateTotalExitDuration();\n }\n \n unregisterMotionElement(element: MotionElement) {\n this.motionElements = this.motionElements.filter((e) => e !== element);\n this.updateTotalExitDuration();\n }\n \n getMotionElements(): MotionElement[] {\n return this.motionElements;\n }\n \n getAllElementsByRoute(route: string): MotionElement[] {\n const elements = this.motionElements.filter(element => element.route === route);\n //console.log(`[MotionOneService] Found ${elements.length} elements for route ${route} (out of ${this.motionElements.length} total)`);\n \n\n \n return elements;\n }\n \n cancelAllAnimations() {\n if (!isPlatformBrowser(this.platformId)) return;\n \n this.motionElements.forEach((motion) => {\n motion.cancel();\n });\n }\n \n runAllEnterAnimations(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n \n this.motionElements.forEach((motion) => {\n motion.runInitAnimation();\n });\n } \n \n runAllExitAnimations(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n \n this.motionElements.forEach((motion) => {\n motion.runExitAnimation();\n });\n }\n \n /**\n * Get an observable that emits true when all exit animations for a route are complete\n * @param route The route to check for animation completion\n * @returns Observable that emits true when animations are complete\n */\n getExitAnimationsComplete(route: string): Observable<boolean> {\n if (!isPlatformBrowser(this.platformId)) {\n // If not in browser, immediately emit true\n return timer(0).pipe(\n take(1),\n map(() => true)\n );\n }\n \n // Get the exit duration for the route\n const exitDuration = this.getLongestExitDurationForRoute(route);\n // console.log(`[MotionOneService] Setting up exit animations complete for route ${route} with duration ${exitDuration}s`);\n \n // If no animations or duration is 0, immediately emit true\n if (exitDuration === 0 || this.getAllElementsByRoute(route).length === 0) {\n // console.log(`[MotionOneService] No exit animations for route ${route}, emitting complete immediately`);\n return timer(0).pipe(\n take(1),\n map(() => true)\n );\n }\n \n // Otherwise, wait for the exit duration and then emit true\n return timer(exitDuration * 1000).pipe(\n take(1),\n map(() => true)\n );\n }\n \n /**\n * Get an observable that emits true when all enter animations for a route are complete\n * @param route The route to check for animation completion\n * @returns Observable that emits true when animations are complete\n */\n getEnterAnimationsComplete(route: string): Observable<boolean> {\n if (!isPlatformBrowser(this.platformId)) {\n // If not in browser, immediately emit true\n return timer(0).pipe(\n take(1),\n map(() => true)\n );\n }\n \n // Get the enter duration for the route\n const enterDuration = this.getLongestEnterDurationForRoute(route);\n // console.log(`[MotionOneService] Setting up enter animations complete for route ${route} with duration ${enterDuration}s`);\n \n // If no animations or duration is 0, immediately emit true\n if (enterDuration === 0 || this.getAllElementsByRoute(route).length === 0) {\n // console.log(`[MotionOneService] No enter animations for route ${route}, emitting complete immediately`);\n return timer(0).pipe(\n take(1),\n map(() => true)\n );\n }\n \n // Otherwise, wait for the enter duration and then emit true\n return timer(enterDuration * 1000).pipe(\n take(1),\n map(() => true)\n );\n }\n \n /**\n * Start tracking exit animations for a route\n * @param route The route to track\n */\n startExitAnimationsForRoute(route: string): void {\n if (!isPlatformBrowser(this.platformId)) return;\n \n const elements = this.getAllElementsByRoute(route);\n this.activeExitAnimations.set(route, elements.length);\n \n //console.log(`[MotionOneService] Starting exit animations for route ${route} with ${elements.length} elements`);\n \n // If no elements, immediately mark as complete\n if (elements.length === 0) {\n this.completeExitAnimationsForRoute(route);\n return;\n }\n \n // Run exit animations for all elements in this route\n elements.forEach(element => {\n element.runExitAnimation();\n });\n \n // Get the longest duration and set a timer to mark animations as complete\n const exitDuration = this.getLongestExitDurationForRoute(route);\n setTimeout(() => {\n this.completeExitAnimationsForRoute(route);\n }, exitDuration * 1000);\n }\n \n /**\n * Start tracking enter animations for a route\n * @param route The route to track\n */\n startEnterAnimationsForRoute(route: string): void {\n if (!isPlatformBrowser(this.platformId)) return;\n \n const elements = this.getAllElementsByRoute(route);\n this.activeEnterAnimations.set(route, elements.length);\n \n // console.log(`[MotionOneService] Starting enter animations for route ${route} with ${elements.length} elements`);\n \n // If no elements, immediately mark as complete\n if (elements.length === 0) {\n this.completeEnterAnimationsForRoute(route);\n return;\n }\n \n // Run enter animations for all elements in this route\n elements.forEach(element => {\n element.runInitAnimation();\n });\n \n // Get the longest duration and set a timer to mark animations as complete\n const enterDuration = this.getLongestEnterDurationForRoute(route);\n setTimeout(() => {\n this.completeEnterAnimationsForRoute(route);\n }, enterDuration * 1000);\n }\n \n /**\n * Mark exit animations for a route as complete\n * @param route The route to mark as complete\n */\n private completeExitAnimationsForRoute(route: string): void {\n this.activeExitAnimations.delete(route);\n this.exitAnimationsComplete.next(route);\n }\n \n /**\n * Mark enter animations for a route as complete\n * @param route The route to mark as complete\n */\n private completeEnterAnimationsForRoute(route: string): void {\n this.activeEnterAnimations.delete(route);\n this.enterAnimationsComplete.next(route);\n }\n \n /**\n * Check if exit animations for a route are complete\n * @param route The route to check\n * @returns True if animations are complete or not running\n */\n areExitAnimationsComplete(route: string): boolean {\n return !this.activeExitAnimations.has(route);\n }\n \n /**\n * Check if enter animations for a route are complete\n * @param route The route to check\n * @returns True if animations are complete or not running\n */\n areEnterAnimationsComplete(route: string): boolean {\n return !this.activeEnterAnimations.has(route);\n }\n \n runAllExitAnimationsForRoute(route: string): MotionElement[] {\n if (!isPlatformBrowser(this.platformId)) return [];\n \n // Start tracking animations for this route\n this.startExitAnimationsForRoute(route);\n \n return this.getAllElementsByRoute(route);\n }\n \n runAllEnterAnimationsForRoute(route: string): MotionElement[] {\n if (!isPlatformBrowser(this.platformId)) return [];\n \n // Start tracking animations for this route\n this.startEnterAnimationsForRoute(route);\n \n return this.getAllElementsByRoute(route);\n }\n \n /**\n * TODO: In a future task, we want to use Angular framework's exit delay function\n * (e.g., route guards with canDeactivate or route transition animations)\n * to handle exit animations properly instead of this custom implementation.\n * \n * DISABLED: Exit duration calculation is disabled to prevent navigation blocking.\n * Navigation should be immediate and not wait for exit animations.\n */\n getLongestExitDurationForRoute(route: string): number {\n // Always return 0 to prevent navigation blocking\n // TODO: Replace with Angular framework's exit delay mechanism in future tasks\n return 0;\n \n // DISABLED - Original implementation commented out:\n // if (!isPlatformBrowser(this.platformId)) return 0;\n // \n // // console.log(`[MotionOneService] Getting longest exit duration for route ${route}`);\n // \n // if (this.motionElements.length === 0) {\n // // console.log('[MotionOneService] No motion elements registered');\n // return 0;\n // }\n // \n // const elements = this.getAllElementsByRoute(route);\n // if (elements.length === 0) {\n // // console.log(`[MotionOneService] No elements found for route ${route}`);\n // return 0;\n // }\n // \n // const durations = elements.map((motion) => {\n // const duration = motion.getDuration();\n // // console.log(`[MotionOneService] Element ${motion.elementId} has exit duration: ${duration}s`);\n // return duration;\n // });\n // \n // const maxDuration = durations.length > 0 ? Math.max(...durations) : 0;\n // console.log(`[MotionOneService] Longest exit duration for route ${route}: ${maxDuration}s`);\n // return maxDuration;\n }\n \n getLongestEnterDurationForRoute(route: string): number {\n if (!isPlatformBrowser(this.platformId)) return 0;\n \n // console.log(`[MotionOneService] Getting longest enter duration for route ${route}`);\n \n if (this.motionElements.length === 0) {\n // console.log('[MotionOneService] No motion elements registered');\n return 0;\n }\n \n const elements = this.getAllElementsByRoute(route);\n if (elements.length === 0) {\n // console.log(`[MotionOneService] No elements found for route ${route}`);\n return 0;\n }\n \n const durations = elements.map((motion) => {\n const duration = motion.getDuration();\n // console.log(`[MotionOneService] Element ${motion.elementId} has enter duration: ${duration}s`);\n return duration;\n });\n \n const maxDuration = durations.length > 0 ? Math.max(...durations) : 0;\n return maxDuration;\n }\n \n getLongestEnterDuration(): number {\n if (!isPlatformBrowser(this.platformId)) return 0;\n \n // console.log(`[MotionOneService] Getting longest enter duration from ${this.motionElements.length} elements`);\n \n if (this.motionElements.length === 0) {\n // console.log('[MotionOneService] No motion elements registered');\n return 0;\n }\n \n const durations = this.motionElements.map((motion) => {\n const duration = motion.getDuration();\n // console.log(`[MotionOneService] Element ${motion.elementId} has duration: ${duration}s`);\n return duration;\n });\n \n const maxDuration = durations.length > 0 ? Math.max(...durations) : 0;\n return maxDuration;\n }\n }\n ","/**\n * Line drawing for SVG shapes (Framer Motion's `pathLength`, `pathOffset` and\n * `pathSpacing`), written the way Motion writes them while animating, so\n * values set here and values Motion animates line up.\n *\n * - pathLength: how much of the line is drawn, 0 to 1.\n * - pathOffset: where the drawn part starts, 0 to 1.\n * - pathSpacing: the gap after each drawn part (default 1: one draw, no repeat).\n *\n * The shape's `pathLength` attribute is set to 1, so these are fractions of\n * the shape's own length, whatever its size.\n */\nexport const SVG_PATH_KEYS = new Set(['pathLength', 'pathOffset', 'pathSpacing']);\n\nexport function isSvgPathKey(key: string): boolean {\n return SVG_PATH_KEYS.has(key);\n}\n\ntype SvgPathValues = { pathLength?: number; pathOffset?: number; pathSpacing?: number };\n\n/** The line-drawing values an element shows now, whoever wrote them (this file or Motion). */\nexport function readSvgPath(el: Element): SvgPathValues {\n if (!el.hasAttribute('pathLength')) return {};\n const out: SvgPathValues = {};\n const dash = el.getAttribute('stroke-dasharray')?.trim().split(/[\\s,]+/).map(parseFloat);\n if (dash && !isNaN(dash[0])) {\n out.pathLength = dash[0];\n if (dash.length > 1 && !isNaN(dash[1]) && dash[1] !== 1) out.pathSpacing = dash[1];\n }\n const offset = parseFloat(el.getAttribute('stroke-dashoffset') ?? '');\n if (!isNaN(offset) && offset !== 0) out.pathOffset = -offset;\n return out;\n}\n\nexport function applySvgPath(el: Element, values: { pathLength?: unknown; pathOffset?: unknown; pathSpacing?: unknown }): void {\n if (typeof SVGElement === 'undefined' || !(el instanceof SVGElement)) return;\n const current: SvgPathValues = readSvgPath(el);\n for (const key of SVG_PATH_KEYS) {\n if (!(key in values)) continue;\n const v = (values as Record<string, unknown>)[key];\n (current as Record<string, number | undefined>)[key] = v == null || v === '' ? undefined : Number(v);\n }\n if (current.pathLength === undefined && current.pathOffset === undefined && current.pathSpacing === undefined) {\n el.removeAttribute('pathLength');\n el.removeAttribute('stroke-dasharray');\n el.removeAttribute('stroke-dashoffset');\n return;\n }\n el.setAttribute('pathLength', '1');\n el.setAttribute('stroke-dasharray', `${current.pathLength ?? 1} ${current.pathSpacing ?? 1}`);\n el.setAttribute('stroke-dashoffset', `${-(current.pathOffset ?? 0)}`);\n}\n\n/**\n * Prepares line-drawing keyframes for Motion:\n * - Each animated key starts from what the shape shows now (Motion would read\n * the pathLength=\"1\" attribute as the current value and jump).\n * - Motion only draws the dash when pathLength is part of the animation, so\n * when only pathOffset or pathSpacing animate (a dash running round a\n * circle), the current values are held, and the dash keeps its length.\n */\nexport function withSvgPathContext(target: unknown, keyframes: Record<string, unknown>): Record<string, unknown> {\n if (typeof SVGElement === 'undefined' || !(target instanceof SVGElement) || !keyframes || typeof keyframes !== 'object') return keyframes;\n if (!Object.keys(keyframes).some(isSvgPathKey)) return keyframes;\n const current = readSvgPath(target);\n const out = { ...keyframes };\n // Motion reads the shape's pathLength attribute (always 1) as where the line\n // is now, so a hover from 0 to 1 would jump. Start from what is drawn.\n const defaults: Required<SvgPathValues> = { pathLength: 1, pathOffset: 0, pathSpacing: 1 };\n for (const key of SVG_PATH_KEYS) {\n const v = out[key];\n if (v === undefined || Array.isArray(v)) continue;\n const k = key as keyof SvgPathValues;\n out[key] = [current[k] ?? defaults[k], v];\n }\n // Held still: from and to are the same, so Motion doesn't animate them in\n const hold = (key: keyof SvgPathValues, fallback?: number) => {\n const v = current[key] ?? fallback;\n if (!(key in out) && v !== undefined) out[key] = [v, v];\n };\n hold('pathLength', 1);\n hold('pathSpacing');\n hold('pathOffset');\n return out;\n}\n","import { InjectionToken, Provider } from '@angular/core';\n\nexport interface MotionConfig {\n /**\n * What to do when the user asks for reduced motion\n * (`prefers-reduced-motion: reduce`), like Framer Motion's\n * `<MotionConfig reducedMotion>`:\n * - 'user' (default): movement (position, scale, rotation, size) jumps\n * straight to its end; fades, colours and line drawing still play.\n * - 'always': the same, whatever the user's setting.\n * - 'never': everything animates.\n */\n reducedMotion?: 'user' | 'always' | 'never';\n}\n\nexport const MOTION_CONFIG = new InjectionToken<MotionConfig>('MOTION_CONFIG', { factory: () => ({}) });\n\n/**\n * App-wide ngx-motion settings.\n *\n * bootstrapApplication(App, { providers: [provideMotionConfig({ reducedMotion: 'never' })] });\n */\nexport function provideMotionConfig(config: MotionConfig): Provider {\n return { provide: MOTION_CONFIG, useValue: config };\n}\n\n/** Values that move things on screen: with reduced motion they jump to their end. */\nconst MOVEMENT = /^(x|y|z|scale[XYZ]?|rotate[XYZ]?|skew[XY]?|translate[XYZ]?|transform|perspective|width|height|top|left|right|bottom|inset|margin|padding)/;\n\nexport function isMovementKey(key: string): boolean {\n return MOVEMENT.test(key);\n}\n\nexport function prefersReducedMotion(config: MotionConfig): boolean {\n const mode = config.reducedMotion ?? 'user';\n if (mode === 'never') return false;\n if (mode === 'always') return true;\n return typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;\n}\n\n/**\n * Animation options with every movement value in `keyframes` made instant\n * (Motion takes per-value transitions keyed by value name). Other values keep\n * their transition.\n */\nexport function withoutMovement(keyframes: unknown, options: Record<string, unknown> | undefined): Record<string, unknown> | undefined {\n if (!keyframes || typeof keyframes !== 'object' || Array.isArray(keyframes)) return options;\n const keys = Object.keys(keyframes).filter(isMovementKey);\n if (!keys.length) return options;\n const out: Record<string, unknown> = { ...(options ?? {}) };\n for (const key of keys) out[key] = { type: 'tween', duration: 0, delay: 0, repeat: 0 };\n return out;\n}\n","import { Injectable, NgZone, PLATFORM_ID, inject } from '@angular/core';\nimport { withSvgPathContext } from '../utils/svg-path.utils';\nimport { MOTION_CONFIG, prefersReducedMotion, withoutMovement } from '../config/motion-config';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n animate as motionAnimate,\n inView as motionInView,\n stagger as motionStagger,\n spring as motionSpring,\n easeIn as motionEaseIn,\n easeOut as motionEaseOut,\n easeInOut as motionEaseInOut\n} from 'motion';\n\nconst noopControls = () => ({ stop: () => {} }) as any;\nconst linear = (t: number) => t;\n\n/**\n * Thin wrapper around Motion's imperative API.\n *\n * - SSR-safe: every call is a no-op on the server.\n * - Zone-friendly: animations and in-view observers run outside the Angular zone,\n * so animation frames and observer callbacks don't trigger app-wide change\n * detection in zone.js apps. (In zoneless apps this is free.)\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionAnimationService {\n private readonly platformId = inject(PLATFORM_ID);\n private readonly ngZone = inject(NgZone);\n private readonly isBrowser = isPlatformBrowser(this.platformId);\n private readonly config = inject(MOTION_CONFIG);\n\n /** True when animations should skip movement: the user asks for reduced motion (see provideMotionConfig). */\n reducedMotion(): boolean {\n return this.isBrowser && prefersReducedMotion(this.config);\n }\n\n animate(target: any, keyframes: any, options?: any): any {\n if (!this.isBrowser) {\n return noopControls();\n }\n\n try {\n // With reduced motion, movement jumps to its end; fades and colours still play\n if (this.reducedMotion()) options = withoutMovement(keyframes, options);\n return this.ngZone.runOutsideAngular(() => motionAnimate(target, withSvgPathContext(target, keyframes), options));\n } catch (e) {\n console.error('[ngx-motion] Error in animate:', e);\n return noopControls();\n }\n }\n\n /**\n * Observe when an element enters the viewport. Returns a stop function.\n * The callback runs outside the Angular zone.\n */\n inView(\n element: Element,\n onStart: (entry: IntersectionObserverEntry) => void | ((entry: IntersectionObserverEntry) => void),\n options?: { root?: Element | Document; margin?: string; amount?: 'some' | 'all' | number }\n ): () => void {\n if (!this.isBrowser) {\n return () => {};\n }\n return this.ngZone.runOutsideAngular(() =>\n motionInView(element, (el: Element, entry: IntersectionObserverEntry) => onStart(entry) as any, options as any)\n );\n }\n\n get easeIn() {\n return this.isBrowser ? motionEaseIn : linear;\n }\n\n get easeOut() {\n return this.isBrowser ? motionEaseOut : linear;\n }\n\n get easeInOut() {\n return this.isBrowser ? motionEaseInOut : linear;\n }\n\n stagger(duration: number, options?: any): any {\n if (!this.isBrowser) {\n return 0;\n }\n\n try {\n return motionStagger(duration, options);\n } catch (e) {\n console.error('[ngx-motion] Error in stagger:', e);\n return 0;\n }\n }\n\n /**\n * Returns an *ease* for spring-like easing in tween contexts (timelines,\n * keyframe arrays). Motion's spring() is a generator that needs keyframes, not\n * an easing factory, so calling it like this throws in Motion 12+; the previous\n * implementation swallowed that and fell back to easeInOut, which we keep.\n * Real springs are produced via `type: 'spring'` animation options instead.\n */\n get spring() {\n return (options?: { stiffness?: number; damping?: number }) => {\n if (!this.isBrowser) {\n return linear;\n }\n try {\n const generator = (motionSpring as any)({\n stiffness: options?.stiffness ?? 100,\n damping: options?.damping ?? 10\n });\n if (typeof generator === 'function') return generator;\n } catch {\n // fall through\n }\n return motionEaseInOut;\n };\n }\n}\n","import { isDevMode } from '@angular/core';\nimport { TransitionOptions } from '../types/motion-animation.types';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** Easing names Motion understands. */\nconst MOTION_EASINGS = new Set([\n 'linear', 'easeIn', 'easeOut', 'easeInOut', 'circIn', 'circOut', 'circInOut',\n 'backIn', 'backOut', 'backInOut', 'anticipate',\n]);\n\n/** Common long names (as on easings.net) for Motion's easings. */\nconst ALIASES: Record<string, string> = {\n easeInCirc: 'circIn', easeOutCirc: 'circOut', easeInOutCirc: 'circInOut',\n easeInBack: 'backIn', easeOutBack: 'backOut', easeInOutBack: 'backInOut',\n};\n\nconst warned = new Set<string>();\n\n/**\n * Resolve an easing name, cubic bezier, function or spring config to what Motion takes.\n */\nexport function getEasing(\n easingString: string | number[] | ((t: number) => number) | { type: 'spring'; stiffness?: number; damping?: number } | undefined,\n motionAnimation: MotionAnimationService\n): any {\n if (!easingString) return motionAnimation.easeInOut;\n\n // Array easing (cubic bezier)\n if (Array.isArray(easingString)) {\n return easingString;\n }\n\n // Spring configuration\n if (typeof easingString === 'object' && 'type' in easingString && easingString.type === 'spring') {\n return motionAnimation.spring({\n stiffness: easingString.stiffness || 100,\n damping: easingString.damping || 10\n });\n }\n\n // An easing function: Motion takes it as-is\n if (typeof easingString === 'function') return easingString;\n\n // Named easing strings\n if (typeof easingString === 'string') {\n if (easingString === 'ease-in') return motionAnimation.easeIn;\n if (easingString === 'ease-out') return motionAnimation.easeOut;\n if (easingString === 'ease-in-out' || easingString === 'ease') return motionAnimation.easeInOut;\n if (easingString === 'spring') return motionAnimation.spring();\n // Motion's own names (linear, easeOut, backOut, anticipate…) pass through\n if (MOTION_EASINGS.has(easingString)) return easingString;\n if (ALIASES[easingString]) return ALIASES[easingString];\n if (isDevMode() && !warned.has(easingString)) {\n warned.add(easingString);\n console.warn(`[ngx-motion] Unknown easing \"${easingString}\", using easeInOut. Use one of: ${[...MOTION_EASINGS].join(', ')}, a cubic bezier array or a function.`);\n }\n }\n\n return motionAnimation.easeInOut;\n}\n\n/**\n * Map Framer Motion repeatType to Motion One direction\n */\nexport function mapRepeatTypeToDirection(\n repeatType: TransitionOptions['repeatType'] | undefined\n): 'normal' | 'reverse' | 'alternate' | undefined {\n if (!repeatType) return undefined;\n\n // Aliases\n if (repeatType === 'forwards' || repeatType === 'loop') return 'normal';\n if (repeatType === 'reverse') return 'reverse';\n if (repeatType === 'pingPong' || repeatType === 'mirror') return 'alternate';\n\n // Default\n return 'normal';\n}\n\n/**\n * Normalize repeat value (convert boolean/number to number)\n */\nexport function normalizeRepeatValue(repeat: number | boolean | undefined): number {\n if (repeat === undefined) return 0;\n if (repeat === true) return Infinity;\n if (typeof repeat === 'number') return repeat;\n return 0;\n}\n\n/**\n * Get repeat value from transition object or fallback\n */\nexport function getRepeatValue(transitionObj: TransitionOptions, fallbackRepeat: boolean): number {\n if (transitionObj.repeat !== undefined) {\n if (transitionObj.repeat === true) {\n return Infinity;\n } else if (typeof transitionObj.repeat === 'number') {\n return transitionObj.repeat;\n }\n }\n\n return fallbackRepeat ? Infinity : 0;\n}\n","import { Injectable } from '@angular/core';\nimport type { AnimationOptions } from 'motion';\nimport { TransitionOptions, VariantWithTransition } from '../types/motion-animation.types';\nimport { MotionAnimationService } from './motion-animation.service';\nimport { getEasing, getRepeatValue, mapRepeatTypeToDirection } from '../utils/easing.utils';\n\nexport interface AnimationOptionsConfig {\n targetState?: VariantWithTransition;\n animateState?: VariantWithTransition;\n staggerDelay?: number;\n transition: TransitionOptions | Record<string, TransitionOptions>;\n delay: number;\n easing: string | number[] | { type: 'spring'; stiffness?: number; damping?: number };\n duration: number;\n repeat: boolean;\n onComplete?: () => void;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionAnimationOptionsService {\n\n constructor(private motionAnimation: MotionAnimationService) {}\n\n /**\n * Build animation options from configuration\n * Handles priority: stagger delay > state transition > global transition > defaults\n */\n getAnimationOptions(config: AnimationOptionsConfig): AnimationOptions {\n // Priority: 1. Stagger delay, 2. State-specific transition, 3. Global transition, 4. Individual properties\n const stateTransition = (config.targetState?.transition as TransitionOptions) ??\n (config.animateState?.transition as TransitionOptions);\n const globalTransition = (config.transition as TransitionOptions);\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n // Always prioritize stagger delay over any other delay settings (including 0)\n const delay = config.staggerDelay !== undefined && config.staggerDelay >= 0\n ? config.staggerDelay\n : (transitionObj.delay ?? config.delay);\n\n // Framer-style `{ type: 'spring', stiffness, damping }` on the transition itself\n const easeInput = transitionObj.type === 'spring'\n ? { type: 'spring' as const, stiffness: transitionObj.stiffness, damping: transitionObj.damping }\n : (transitionObj.ease ?? config.easing);\n\n // Detect if target contains keyframe arrays (avoid native spring in that case)\n let targetHasKeyframeArrays = false;\n if (config.targetState) {\n for (const k of Object.keys(config.targetState)) {\n if (k === 'transition' || k === 'at') continue;\n const v: any = config.targetState[k];\n if (Array.isArray(v)) {\n targetHasKeyframeArrays = true;\n break;\n }\n }\n }\n\n // If spring config and no keyframe arrays, prefer native spring options (no fixed duration)\n if (easeInput && typeof easeInput === 'object' && 'type' in easeInput &&\n easeInput.type === 'spring' && !targetHasKeyframeArrays) {\n const springOptions: any = {\n type: 'spring',\n stiffness: easeInput.stiffness ?? 100,\n damping: easeInput.damping ?? 10,\n delay,\n repeat: getRepeatValue(transitionObj, config.repeat),\n repeatDelay: transitionObj.repeatDelay,\n onComplete: config.onComplete\n };\n const direction = mapRepeatTypeToDirection(transitionObj.repeatType);\n if (direction) springOptions.direction = direction;\n if (transitionObj.repeatType) springOptions.repeatType = transitionObj.repeatType;\n return springOptions as AnimationOptions;\n }\n\n const ease = getEasing(easeInput, this.motionAnimation);\n\n const options: any = {\n duration: transitionObj.duration ?? config.duration,\n delay,\n repeat: getRepeatValue(transitionObj, config.repeat),\n repeatDelay: transitionObj.repeatDelay,\n onComplete: config.onComplete\n };\n\n const direction = mapRepeatTypeToDirection(transitionObj.repeatType);\n if (direction) options.direction = direction;\n if (transitionObj.repeatType) options.repeatType = transitionObj.repeatType;\n\n options.easing = ease; // Motion 11+\n options.ease = ease; // Back-compat\n\n return options as AnimationOptions;\n }\n\n /**\n * Get stagger value from transition configuration\n */\n getStaggerValue(\n animateState?: VariantWithTransition,\n transition?: TransitionOptions | Record<string, TransitionOptions>,\n defaultStaggerChildren: number = 0\n ): number {\n const stateTransition = animateState?.transition as TransitionOptions;\n const globalTransition = transition as TransitionOptions;\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n return transitionObj.staggerChildren ?? defaultStaggerChildren;\n }\n\n /**\n * Get delayChildren from transition configuration (state transition first,\n * then the transition input, then the delayChildren input), as in Framer Motion\n */\n getDelayChildren(\n animateState?: VariantWithTransition,\n transition?: TransitionOptions | Record<string, TransitionOptions>,\n defaultDelayChildren: number = 0\n ): number {\n const stateTransition = animateState?.transition as TransitionOptions;\n const globalTransition = transition as TransitionOptions;\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n return transitionObj.delayChildren ?? defaultDelayChildren;\n }\n\n /**\n * Get stagger direction from transition configuration\n */\n getStaggerDirection(\n animateState?: VariantWithTransition,\n transition?: TransitionOptions | Record<string, TransitionOptions>,\n defaultStaggerDirection: number = 1\n ): number {\n const stateTransition = animateState?.transition as TransitionOptions;\n const globalTransition = transition as TransitionOptions;\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n return transitionObj.staggerDirection ?? defaultStaggerDirection;\n }\n\n /**\n * Get 'when' property from transition configuration\n */\n getWhen(\n animateState?: VariantWithTransition,\n transition?: TransitionOptions | Record<string, TransitionOptions>\n ): 'beforeChildren' | 'afterChildren' | 'together' {\n const stateTransition = animateState?.transition as TransitionOptions;\n const globalTransition = transition as TransitionOptions;\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n return (transitionObj.when ?? 'together') as 'beforeChildren' | 'afterChildren' | 'together';\n }\n}\n","/**\n * Normalize keyframe times array to 0-1 range\n * Handles both normalized (0-1) and absolute time values\n */\nexport function normalizeTimes(times: number[] | undefined, duration: number): number[] | undefined {\n if (!times || times.length === 0) return undefined;\n\n // Check if any values are above 1 (indicating absolute times)\n const hasValuesAboveOne = times.some(t => t > 1);\n if (!hasValuesAboveOne) return times;\n\n // Find the maximum time value\n const maxT = Math.max(...times);\n\n // Ensure duration is valid (avoid division by zero)\n const safeDuration = Math.max(duration, 0.000001);\n\n // Determine divisor: use maxT if significantly larger than duration, else use duration\n const divisor = maxT > safeDuration * 1.001 ? maxT : safeDuration;\n\n // Normalize to 0-1 range\n return times.map(t => {\n const v = t / divisor;\n return v < 0 ? 0 : v > 1 ? 1 : v;\n });\n}\n\n/**\n * Calculate stagger delay for a child element\n * Takes into account the child's index and stagger direction\n */\nexport function calculateStaggerDelay(\n index: number,\n totalChildren: number,\n staggerValue: number,\n direction: number\n): number {\n let staggerIndex: number;\n\n if (direction >= 0) {\n // Forward direction: 0, 1, 2, 3...\n staggerIndex = index;\n } else {\n // Reverse direction: 3, 2, 1, 0...\n staggerIndex = totalChildren - 1 - index;\n }\n\n return staggerIndex * staggerValue;\n}\n\n/**\n * Calculate total duration including stagger for all children\n */\nexport function calculateTotalStaggerDuration(\n childCount: number,\n staggerValue: number,\n baseDelay: number,\n delayChildren: number\n): number {\n return baseDelay + delayChildren + (childCount * staggerValue);\n}\n","import { Injectable } from '@angular/core';\nimport { TransitionOptions } from '../types/motion-animation.types';\nimport { calculateStaggerDelay, calculateTotalStaggerDuration } from '../utils/timing.utils';\n\nexport interface StaggerConfig {\n childCount: number;\n staggerValue: number;\n staggerDirection: number;\n delayChildren: number;\n parentDelay: number;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionStaggerService {\n\n /**\n * Calculate the delay for a specific child in a stagger sequence\n */\n calculateChildDelay(\n index: number,\n config: StaggerConfig\n ): number {\n const staggerDelay = calculateStaggerDelay(\n index,\n config.childCount,\n config.staggerValue,\n config.staggerDirection\n );\n\n return config.parentDelay + config.delayChildren + staggerDelay;\n }\n\n /**\n * Calculate delays for all children in a stagger sequence\n */\n calculateAllChildDelays(config: StaggerConfig): number[] {\n const delays: number[] = [];\n\n for (let i = 0; i < config.childCount; i++) {\n delays.push(this.calculateChildDelay(i, config));\n }\n\n return delays;\n }\n\n /**\n * Calculate the total duration for a stagger animation sequence\n */\n calculateTotalDuration(config: StaggerConfig): number {\n return calculateTotalStaggerDuration(\n config.childCount,\n config.staggerValue,\n config.parentDelay,\n config.delayChildren\n );\n }\n\n /**\n * Determine the stagger index based on direction\n */\n getStaggerIndex(index: number, childCount: number, direction: number): number {\n if (direction >= 0) {\n return index; // Forward: 0, 1, 2, 3...\n } else {\n return childCount - 1 - index; // Reverse: 3, 2, 1, 0...\n }\n }\n}\n","/**\n * Default values for Motion One animations\n */\n\nexport const MOTION_DEFAULTS = {\n DURATION: 0.3,\n DELAY: 0,\n EXIT_DELAY: 0,\n DELAY_CHILDREN: 0,\n EASING: 'ease',\n OFFSET: '0px',\n STAGGER_CHILDREN: 0, // Framer Motion default: children animate together unless staggerChildren is set\n STAGGER_DIRECTION: 1,\n REPEAT: false,\n INVIEW_THRESHOLD: 0.1,\n INVIEW_DELAY: 50,\n INVIEW_MARGIN: '0px',\n INVIEW_ROOT_MARGIN: '0px',\n RESET_TIMEOUT: 10,\n STAGGER_TIMEOUT: 50,\n} as const;\n\n/**\n * Transform properties that need special handling\n */\nexport const TRANSFORM_PROPERTIES = ['x', 'y', 'rotate', 'scale', 'scaleX', 'scaleY'] as const;\n\n/**\n * Color properties that need normalization\n */\nexport const COLOR_PROPERTIES = ['backgroundColor', 'color', 'borderColor'] as const;\n\n/**\n * Properties that should be excluded from style extraction\n */\nexport const EXCLUDED_PROPERTIES = ['transition', 'at'] as const;\n\n/**\n * Identity matrix for transform operations\n */\nexport const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0] as const;\n","import { Injectable, PLATFORM_ID, Inject } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MOTION_DEFAULTS } from '../constants/motion-defaults.constants';\n\nexport interface IntersectionObserverConfig {\n root?: Element | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionInViewService {\n\n constructor(@Inject(PLATFORM_ID) private platformId: Object) {}\n\n /**\n * Create an IntersectionObserver with the given configuration\n */\n createObserver(\n callback: IntersectionObserverCallback,\n config: IntersectionObserverConfig = {}\n ): IntersectionObserver | null {\n if (!isPlatformBrowser(this.platformId)) {\n return null;\n }\n\n const observerConfig: IntersectionObserverInit = {\n root: config.root ?? null,\n rootMargin: config.rootMargin ?? MOTION_DEFAULTS.INVIEW_ROOT_MARGIN,\n threshold: config.threshold ?? MOTION_DEFAULTS.INVIEW_THRESHOLD\n };\n\n return new IntersectionObserver(callback, observerConfig);\n }\n\n /**\n * Create a standard IntersectionObserver for runInView functionality\n */\n createRunInViewObserver(\n element: HTMLElement,\n onEntry: () => void,\n onExit: () => void\n ): IntersectionObserver | null {\n return this.createObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n onEntry();\n } else {\n onExit();\n }\n });\n },\n {\n root: null,\n rootMargin: MOTION_DEFAULTS.INVIEW_ROOT_MARGIN,\n threshold: MOTION_DEFAULTS.INVIEW_THRESHOLD\n }\n );\n }\n\n /**\n * Parse margin string (e.g., \"0px\", \"10px 20px\")\n */\n parseMargin(margin: string): string {\n // Ensure margin is in valid format for IntersectionObserver\n if (!margin) return MOTION_DEFAULTS.INVIEW_MARGIN;\n return margin;\n }\n\n /**\n * Check if IntersectionObserver is supported\n */\n isSupported(): boolean {\n if (!isPlatformBrowser(this.platformId)) {\n return false;\n }\n return 'IntersectionObserver' in window;\n }\n\n /**\n * Safely disconnect an observer\n */\n disconnect(observer: IntersectionObserver | null | undefined): void {\n if (observer) {\n observer.disconnect();\n }\n }\n}\n","import { COLOR_PROPERTIES } from '../constants/motion-defaults.constants';\n\n/**\n * Check if a property is a color property\n */\nexport function isColorProperty(key: string): boolean {\n return COLOR_PROPERTIES.includes(key as any);\n}\n\n/**\n * Normalize color values to a consistent format\n * Converts named colors to hex values for consistent animation\n */\nexport function normalizeColor(color: any): string {\n if (color == null) return '';\n\n if (typeof color !== 'string') {\n try {\n return String(color);\n } catch {\n return '';\n }\n }\n\n // Already normalized formats\n if (color.startsWith('rgb') || color.startsWith('#')) {\n return color;\n }\n\n // Named color mappings\n const colorMap: Record<string, string> = {\n aqua: '#00ffff',\n red: '#ff0000',\n blue: '#0000ff',\n green: '#008000',\n yellow: '#ffff00',\n purple: '#800080',\n orange: '#ffa500',\n black: '#000000',\n white: '#ffffff',\n };\n\n return colorMap[color] || color;\n}\n\n/**\n * Normalize color values in an array or single value\n */\nexport function normalizeColorValue(value: any): any {\n if (Array.isArray(value)) {\n return value.map(v => normalizeColor(v));\n }\n return normalizeColor(value);\n}\n","import { Injectable, NgZone, inject } from '@angular/core';\nimport type { Target } from 'motion';\nimport { TimelineStep, TransitionOptions, VariantWithTransition } from '../types/motion-animation.types';\nimport { MotionAnimationService } from './motion-animation.service';\nimport { isColorProperty, normalizeColorValue } from '../utils/color.utils';\nimport { getEasing, getRepeatValue, mapRepeatTypeToDirection } from '../utils/easing.utils';\nimport { normalizeTimes } from '../utils/timing.utils';\n\nconst TRANSITION_OPTION_KEYS = new Set([\n 'duration', 'delay', 'ease', 'easing', 'type', 'stiffness', 'damping', 'mass',\n 'bounce', 'velocity', 'restSpeed', 'restDelta', 'repeat', 'repeatType', 'repeatDelay',\n 'staggerChildren', 'staggerDirection', 'delayChildren', 'when', 'times'\n]);\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionTimelineService {\n private readonly ngZone = inject(NgZone);\n\n constructor(private motionAnimation: MotionAnimationService) {}\n\n /**\n * Execute a timeline with orchestrated per-property animations\n */\n runTimeline(\n element: HTMLElement,\n timeline: TimelineStep[],\n targetState: VariantWithTransition,\n baseDelay: number,\n duration: number,\n easing: any,\n repeat: boolean,\n onComplete?: () => void\n ): { controls: any[]; maxEnd: number } {\n const controls: any[] = [];\n let maxEnd = 0;\n\n // Also animate any non-timeline props from the target state (e.g., opacity)\n const timelinePropsSet = new Set(timeline.map(s => s.prop));\n const nonTimelineTarget: any = {};\n\n Object.keys(targetState).forEach(k => {\n if (k === 'transition' || k === 'at') return;\n if (!timelinePropsSet.has(k)) {\n nonTimelineTarget[k] = targetState[k];\n }\n });\n\n if (Object.keys(nonTimelineTarget).length > 0) {\n const options: any = {\n duration,\n delay: baseDelay,\n easing,\n ease: easing,\n repeat: repeat ? Infinity : 0\n };\n\n const ctl = this.motionAnimation.animate(element as unknown as Target, nonTimelineTarget, options);\n controls.push(ctl);\n const nonEnd = (options.delay ?? 0) + (options.duration ?? duration);\n if (nonEnd > maxEnd) maxEnd = nonEnd;\n }\n\n // Execute each timeline step\n timeline.forEach(step => {\n const start = baseDelay + (step.atTime ?? 0) + (step.delay ?? 0);\n const stepDuration = step.duration;\n const value = step.keyframes !== undefined ? step.keyframes : step.to;\n const easeInput = step.ease ?? easing;\n\n const ease = getEasing(easeInput, this.motionAnimation);\n const options: any = {\n duration: stepDuration,\n delay: start,\n easing: ease,\n ease: ease\n };\n\n // Apply repeat controls if provided\n if (step.repeat !== undefined) {\n options.repeat = step.repeat === true ? Infinity : step.repeat;\n }\n if (step.repeatDelay !== undefined) {\n options.repeatDelay = step.repeatDelay;\n }\n\n const dir = mapRepeatTypeToDirection(step.repeatType);\n if (dir) options.direction = dir;\n if (step.repeatType) options.repeatType = step.repeatType;\n if (step.times) options.offset = normalizeTimes(step.times, stepDuration);\n\n const end = start + stepDuration;\n if (end > maxEnd) maxEnd = end;\n\n let v = value;\n if (isColorProperty(step.prop)) {\n v = normalizeColorValue(v);\n }\n\n const target = { [step.prop]: v } as any;\n const control = this.motionAnimation.animate(element as unknown as Target, target, options);\n controls.push(control);\n });\n\n // Set up completion callback\n if (onComplete) {\n this.ngZone.runOutsideAngular(() => setTimeout(() => onComplete(), maxEnd * 1000));\n }\n\n return { controls, maxEnd };\n }\n\n /**\n * Execute per-property animations with different timing for each property\n */\n runPerPropertyAnimations(\n element: HTMLElement,\n targetState: VariantWithTransition,\n baseDelay: number,\n duration: number,\n easing: any,\n repeat: boolean,\n onComplete?: () => void\n ): { controls: any[]; maxEnd: number } {\n const controls: any[] = [];\n const transitionMap = targetState.transition as Record<string, TransitionOptions>;\n const props = Object.keys(targetState).filter(k => k !== 'transition' && k !== 'at');\n\n let maxEnd = 0;\n\n props.forEach((prop) => {\n const value = (targetState as any)[prop];\n const conf = (transitionMap?.[prop] || {}) as TransitionOptions;\n const delay = baseDelay + (conf.delay ?? 0);\n const ease = getEasing(conf.ease ?? easing, this.motionAnimation);\n const propDuration = conf.duration ?? duration;\n\n const options: any = {\n duration: propDuration,\n delay,\n easing: ease,\n ease: ease,\n repeat: conf.repeat !== undefined ? getRepeatValue(conf, repeat) : (repeat ? Infinity : 0),\n repeatDelay: conf.repeatDelay\n };\n\n const dir = mapRepeatTypeToDirection(conf.repeatType);\n if (dir) options.direction = dir;\n if (conf.repeatType) options.repeatType = conf.repeatType;\n\n const times = (conf as any).times as number[] | undefined;\n if (times && Array.isArray(times)) {\n options.offset = normalizeTimes(times, propDuration);\n }\n\n const end = delay + propDuration;\n if (end > maxEnd) maxEnd = end;\n\n let finalValue = value;\n if (isColorProperty(prop)) {\n finalValue = normalizeColorValue(value);\n }\n\n const target = { [prop]: finalValue } as any;\n const control = this.motionAnimation.animate(element as unknown as Target, target, options);\n controls.push(control);\n });\n\n // Set up completion callback\n if (onComplete) {\n this.ngZone.runOutsideAngular(() => setTimeout(() => onComplete(), maxEnd * 1000));\n }\n\n return { controls, maxEnd };\n }\n\n /**\n * Check if a transition is a per-property map, e.g.\n * `{ opacity: { duration: 0.2 }, x: { duration: 1, ease: 'ease-out' } }`.\n *\n * It must be a non-empty object whose keys are not transition options and whose\n * values are all plain objects. Previously any transition without\n * duration/delay/ease (such as `{ type: 'spring', stiffness: 200 }` or\n * `{ staggerChildren: 0.1 }`) was misread as a per-property map.\n */\n isPerPropertyTransition(transition: any): boolean {\n if (!transition || typeof transition !== 'object' || Array.isArray(transition)) return false;\n\n const keys = Object.keys(transition);\n if (keys.length === 0) return false;\n\n return keys.every(key =>\n !TRANSITION_OPTION_KEYS.has(key) &&\n transition[key] !== null &&\n typeof transition[key] === 'object' &&\n !Array.isArray(transition[key])\n );\n }\n}\n","import { Injectable } from '@angular/core';\n\nexport interface GestureAnimationState {\n isAnimating: boolean;\n gestureType: 'hover' | 'tap' | 'focus' | null;\n targetState: string | null;\n controls: any;\n startTime: number;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionGestureService {\n private gestureStates = new Map<string, GestureAnimationState>();\n private readonly MIN_GESTURE_INTERVAL = 50; // Minimum ms between gesture triggers\n\n /**\n * Check if a gesture should be allowed based on timing\n * Prevents rapid-fire gesture triggers that cause aggressive spring behavior\n */\n shouldAllowGesture(elementId: string, gestureType: 'hover' | 'tap' | 'focus'): boolean {\n const state = this.gestureStates.get(elementId);\n\n if (!state) {\n return true;\n }\n\n // Allow gestures of different types immediately\n if (state.gestureType !== gestureType) {\n return true;\n }\n\n // Check if enough time has passed since last gesture of same type\n const timeSinceLastGesture = Date.now() - state.startTime;\n return timeSinceLastGesture >= this.MIN_GESTURE_INTERVAL;\n }\n\n /**\n * Register that a gesture animation is starting\n */\n startGesture(\n elementId: string,\n gestureType: 'hover' | 'tap' | 'focus',\n targetState: string,\n controls: any\n ): void {\n const existingState = this.gestureStates.get(elementId);\n\n // Stop any existing animation for this element\n if (existingState?.controls) {\n try {\n existingState.controls.stop();\n } catch (e) {\n // Animation may have already finished\n }\n }\n\n this.gestureStates.set(elementId, {\n isAnimating: true,\n gestureType,\n targetState,\n controls,\n startTime: Date.now()\n });\n }\n\n /**\n * Register that a gesture animation has ended\n */\n endGesture(elementId: string): void {\n const state = this.gestureStates.get(elementId);\n if (state) {\n state.isAnimating = false;\n state.gestureType = null;\n state.targetState = null;\n }\n }\n\n /**\n * Get the current gesture state for an element\n */\n getGestureState(elementId: string): GestureAnimationState | undefined {\n return this.gestureStates.get(elementId);\n }\n\n /**\n * Cancel any ongoing gesture animation for an element\n * Returns true if an animation was cancelled\n */\n cancelGesture(elementId: string): boolean {\n const state = this.gestureStates.get(elementId);\n\n if (state?.controls && state.isAnimating) {\n try {\n state.controls.stop();\n this.endGesture(elementId);\n return true;\n } catch (e) {\n // Animation may have already finished\n }\n }\n\n return false;\n }\n\n /**\n * Check if an element currently has an active gesture animation\n */\n isGestureActive(elementId: string, gestureType?: 'hover' | 'tap' | 'focus'): boolean {\n const state = this.gestureStates.get(elementId);\n\n if (!state || !state.isAnimating) {\n return false;\n }\n\n if (gestureType) {\n return state.gestureType === gestureType;\n }\n\n return true;\n }\n\n /**\n * Clear all gesture state (useful for cleanup)\n */\n clearElement(elementId: string): void {\n this.cancelGesture(elementId);\n this.gestureStates.delete(elementId);\n }\n\n /**\n * Clear all gesture states\n */\n clearAll(): void {\n this.gestureStates.forEach((_, elementId) => {\n this.cancelGesture(elementId);\n });\n this.gestureStates.clear();\n }\n}\n","import { TRANSFORM_PROPERTIES, IDENTITY_MATRIX } from '../constants/motion-defaults.constants';\n\n/**\n * Check if a property should be handled as a transform\n */\nexport function isTransformProperty(key: string): boolean {\n return TRANSFORM_PROPERTIES.includes(key as any);\n}\n\n/**\n * Create an identity matrix for transform operations\n */\nexport function createIdentityMatrix(): number[] {\n return [...IDENTITY_MATRIX];\n}\n\n/**\n * Parse a matrix string to array of numbers\n */\nexport function parseMatrix(matrixString: string): number[] {\n const match = matrixString.match(/matrix\\((.*)\\)/);\n if (!match) return createIdentityMatrix();\n return match[1].split(',').map(Number);\n}\n\n/**\n * Multiply two 2D transformation matrices\n */\nexport function multiplyMatrices(a: number[], b: number[]): number[] {\n return [\n a[0] * b[0] + a[2] * b[1], // a\n a[1] * b[0] + a[3] * b[1], // b\n a[0] * b[2] + a[2] * b[3], // c\n a[1] * b[2] + a[3] * b[3], // d\n a[0] * b[4] + a[2] * b[5] + a[4], // e\n a[1] * b[4] + a[3] * b[5] + a[5] // f\n ];\n}\n\n/**\n * Convert a matrix array to CSS matrix string\n */\nexport function matrixToCssString(matrix: number[]): string {\n return `matrix(${matrix.join(',')})`;\n}\n\n/**\n * Create a transformation matrix for a specific transform type\n */\nexport function createTransformMatrix(key: string, value: any): number[] {\n switch (key) {\n case 'x':\n return [1, 0, 0, 1, value, 0];\n case 'y':\n return [1, 0, 0, 1, 0, value];\n case 'rotate':\n const rad = (value * Math.PI) / 180;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n return [cos, sin, -sin, cos, 0, 0];\n case 'scale':\n return [value, 0, 0, value, 0, 0];\n case 'scaleX':\n return [value, 0, 0, 1, 0, 0];\n case 'scaleY':\n return [1, 0, 0, value, 0, 0];\n default:\n return createIdentityMatrix();\n }\n}\n\n/**\n * Apply a transform property to a result object\n * Handles keyframe arrays and individual values\n */\nexport function applyTransformProperty(\n result: Record<string, any>,\n key: string,\n value: any\n): void {\n // If keyframe array is provided, let Motion One handle it directly\n if (Array.isArray(value)) {\n result[key] = value;\n return;\n }\n\n // Initialize transform matrix if it doesn't exist\n if (!result['transform']) {\n result['transform'] = matrixToCssString(createIdentityMatrix());\n }\n\n // Parse current matrix\n const currentMatrix = parseMatrix(result['transform']);\n\n // Create new matrix based on the transform type\n const newMatrix = createTransformMatrix(key, value);\n\n // Multiply matrices\n const finalMatrix = multiplyMatrices(currentMatrix, newMatrix);\n\n // Apply the new matrix\n result['transform'] = matrixToCssString(finalMatrix);\n}\n\n/**\n * Normalize the transform property by trimming extra spaces\n */\nexport function normalizeTransformProperty(result: Record<string, any>): void {\n if (result['transform']) {\n result['transform'] = result['transform'].trim();\n }\n}\n","import { applySvgPath, isSvgPathKey } from './svg-path.utils';\nimport { VariantWithTransition } from '../types/motion-animation.types';\nimport { EXCLUDED_PROPERTIES } from '../constants/motion-defaults.constants';\nimport { isTransformProperty } from './transform.utils';\nimport { isColorProperty, normalizeColorValue } from './color.utils';\n\n/**\n * Extract only style properties from a variant (excluding transition and metadata)\n */\nexport function extractStyleProperties(variant: VariantWithTransition): Record<string, any> {\n if (!variant) return {};\n\n const result: Record<string, any> = {};\n\n for (const key in variant) {\n // Skip meta keys\n if (EXCLUDED_PROPERTIES.includes(key as any)) continue;\n\n // Allow raw transform strings to pass through\n if (key === 'transform') {\n result['transform'] = variant[key];\n continue;\n }\n\n // CRITICAL FIX: Pass transform properties directly to Motion One\n // Motion One can animate rotate, scale, x, y, etc. as individual properties\n // This provides much better spring animation interruption and avoids 3D transform issues\n if (isTransformProperty(key)) {\n // Pass the value directly - Motion One will handle it\n result[key] = variant[key];\n } else {\n applyStyleProperty(result, key, variant[key]);\n }\n }\n\n // Don't normalize transforms - let Motion One handle them natively\n // normalizeTransformProperty(result);\n\n return result;\n}\n\n/**\n * Apply a regular style property to the result object\n * Handles color normalization if needed\n */\nexport function applyStyleProperty(\n result: Record<string, any>,\n key: string,\n value: any\n): void {\n if (isColorProperty(key)) {\n result[key] = normalizeColorValue(value);\n } else {\n result[key] = value;\n }\n}\n\n/**\n * Check if a variant has any style properties to apply\n */\nexport function hasStyleProperties(variant: VariantWithTransition): boolean {\n if (!variant || typeof variant !== 'object') return false;\n\n for (const key in variant) {\n if (!EXCLUDED_PROPERTIES.includes(key as any)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Motion's shorthand transform keys, in the order Motion composes them.\n * Element.style has no `x`/`y`/`rotate`-as-number etc., so assigning these with\n * Object.assign(el.style, ...) silently did nothing.\n */\nconst TRANSFORM_ORDER = [\n 'transformPerspective', 'x', 'y', 'z', 'translateX', 'translateY', 'translateZ',\n 'scale', 'scaleX', 'scaleY', 'rotate', 'rotateX', 'rotateY', 'rotateZ',\n 'skew', 'skewX', 'skewY'\n] as const;\nconst TRANSFORM_KEYS = new Set<string>(TRANSFORM_ORDER);\n\nfunction withUnit(key: string, value: any): string {\n if (typeof value !== 'number') return String(value);\n if (key === 'transformPerspective' || key === 'x' || key === 'y' || key === 'z' || key.startsWith('translate')) {\n return `${value}px`;\n }\n if (key.startsWith('rotate') || key.startsWith('skew')) return `${value}deg`;\n return String(value); // scale\n}\n\nfunction transformFunction(key: string, value: any): string {\n const v = withUnit(key, value);\n switch (key) {\n case 'transformPerspective': return `perspective(${v})`;\n case 'x': return `translateX(${v})`;\n case 'y': return `translateY(${v})`;\n case 'z': return `translateZ(${v})`;\n default: return `${key}(${v})`;\n }\n}\n\nconst kebab = (key: string) => key.replace(/[A-Z]/g, c => '-' + c.toLowerCase());\n\n/** A keyframe array's first value is the resting value to show before animating. */\nfunction firstFrame(value: any): any {\n return Array.isArray(value) ? value[0] : value;\n}\n\n/**\n * Write styles to an element synchronously, translating Motion's shorthand\n * transform keys (x, y, rotate, scale, ...) into a CSS transform string.\n */\nexport function applyInlineStyles(el: HTMLElement | SVGElement, styles: Record<string, any>): void {\n if (!el?.style || !styles) return;\n\n const transforms: string[] = [];\n let rawTransform: string | undefined;\n let path: Record<string, unknown> | undefined;\n const svgShape = typeof SVGElement !== 'undefined' && el instanceof SVGElement && !(el instanceof SVGSVGElement);\n\n for (const key of Object.keys(styles)) {\n const value = firstFrame(styles[key]);\n if (value === undefined || value === null) continue;\n if (key === 'transform') {\n rawTransform = String(value);\n } else if (isSvgPathKey(key)) {\n (path ??= {})[key] = value;\n } else if (!TRANSFORM_KEYS.has(key)) {\n if (svgShape && !key.startsWith('--')) {\n // Motion animates an SVG shape's styles as attributes; an inline style\n // here would outrank them and the animation would never show\n el.style.removeProperty(kebab(key));\n el.setAttribute(kebab(key), String(value));\n } else {\n (el.style as any)[key] = value;\n }\n }\n }\n\n if (path) applySvgPath(el, path);\n\n for (const key of TRANSFORM_ORDER) {\n if (key in styles) {\n const value = firstFrame(styles[key]);\n if (value !== undefined && value !== null) transforms.push(transformFunction(key, value));\n }\n }\n\n if (rawTransform !== undefined || transforms.length > 0) {\n el.style.transform = [rawTransform, ...transforms].filter(Boolean).join(' ');\n }\n}\n","import { VariantWithTransition } from '../types/motion-animation.types';\n\n/**\n * Resolve a variant reference to its actual definition\n * Handles both string references and direct object definitions\n */\nexport function resolveVariant(\n variant: VariantWithTransition | string,\n variants: { [key: string]: VariantWithTransition }\n): VariantWithTransition {\n if (typeof variant === 'string') {\n return variants[variant] || {};\n } else if (typeof variant === 'object' && variant !== null) {\n return variant;\n } else {\n return {};\n }\n}\n\n/**\n * Extract metadata properties from a variant (properties that aren't styles)\n */\nexport function extractVariantMetadata(variant: VariantWithTransition): {\n transition?: any;\n at?: number;\n} {\n return {\n transition: variant.transition,\n at: variant.at\n };\n}\n\n/**\n * Check if a variant has any style properties (excluding metadata)\n */\nexport function hasStyleProperties(variant: VariantWithTransition): boolean {\n if (!variant || typeof variant !== 'object') return false;\n\n const keys = Object.keys(variant);\n const styleKeys = keys.filter(key => key !== 'transition' && key !== 'at');\n\n return styleKeys.length > 0;\n}\n\n/**\n * Check if a variant is empty or undefined\n */\nexport function isEmptyVariant(variant: VariantWithTransition | string | undefined): boolean {\n if (!variant) return true;\n if (typeof variant === 'string') return false; // String references are not empty\n if (typeof variant === 'object') {\n return Object.keys(variant).length === 0;\n }\n return true;\n}\n","import {\n Directive,\n Input,\n ElementRef,\n OnDestroy,\n Output,\n EventEmitter,\n OnChanges,\n SimpleChanges,\n HostListener,\n OnInit,\n PLATFORM_ID,\n Inject,\n AfterContentInit,\n NgZone,\n inject\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionOneService } from '../services/motion-one.service';\nimport { MotionAnimationService } from '../services/motion-animation.service';\nimport { MotionAnimationOptionsService } from '../services/motion-animation-options.service';\nimport { MotionStaggerService } from '../services/motion-stagger.service';\nimport { MotionInViewService } from '../services/motion-inview.service';\nimport { MotionTimelineService } from '../services/motion-timeline.service';\nimport { MotionGestureService } from '../services/motion-gesture.service';\nimport type { AnimationOptions, Target } from 'motion';\nimport { VariantWithTransition, TransitionOptions, TimelineStep } from '../types/motion-animation.types';\nimport { MOTION_DEFAULTS } from '../constants/motion-defaults.constants';\nimport { extractStyleProperties, applyInlineStyles } from '../utils/style-extraction.utils';\nimport { resolveVariant } from '../utils/variant.utils';\n\nlet uniqueIdCounter = 0;\n\n/** Element → its motionone directive, to find the nearest one in the DOM. */\nconst directiveByElement = new WeakMap<Element, MotionOneDirective>();\n\n/** Nearest motionone on an ancestor of `el`, searching no higher than `stop` (exclusive). */\nfunction nearestMotionAncestor(el: Element, stop: Element): MotionOneDirective | undefined {\n for (let node = el.parentElement; node && node !== stop; node = node.parentElement) {\n const found = directiveByElement.get(node);\n if (found) return found;\n }\n return undefined;\n}\n\n@Directive({\n selector: '[motionone]',\n standalone: true,\n exportAs: 'motionone'\n})\nexport class MotionOneDirective implements OnInit, OnDestroy, OnChanges, AfterContentInit {\n @Input() initial: VariantWithTransition | string = {};\n @Input() animate: VariantWithTransition | string = {};\n @Input() exit: VariantWithTransition | string = {};\n @Input() inView: VariantWithTransition = {};\n @Input() duration: number = MOTION_DEFAULTS.DURATION;\n @Input() delay: number = MOTION_DEFAULTS.DELAY;\n @Input() delayChildren: number = MOTION_DEFAULTS.DELAY_CHILDREN;\n @Input() repeat: boolean = MOTION_DEFAULTS.REPEAT;\n @Input() exitDelay: number = MOTION_DEFAULTS.EXIT_DELAY;\n @Input() easing: string | number[] | { type: 'spring'; stiffness?: number; damping?: number } = MOTION_DEFAULTS.EASING;\n @Input() offset: string = MOTION_DEFAULTS.OFFSET;\n @Input() whileHover: VariantWithTransition = {};\n @Input() staggerChildren: number = MOTION_DEFAULTS.STAGGER_CHILDREN;\n @Input() staggerDirection: number = MOTION_DEFAULTS.STAGGER_DIRECTION;\n @Input() whileTap: VariantWithTransition = {};\n @Input() whileFocus: VariantWithTransition = {};\n @Input() whileInView: VariantWithTransition = {};\n @Input() runInView?: 'never' | 'once' | 'always';\n @Input() variants: { [key: string]: VariantWithTransition } = {};\n @Input() transition: TransitionOptions | Record<string, TransitionOptions> = {};\n @Input() timeline: TimelineStep[] | undefined;\n @Output() animationComplete = new EventEmitter<void>();\n\n // Public method to restart animations\n public restartAnimation() {\n this.cancelForReset();\n\n const initialVariant = this.getVariant(this.initial);\n const initialStyles = extractStyleProperties(initialVariant);\n\n const element = this.el.nativeElement;\n element.style.transition = 'none';\n this.setInlineStyles(initialStyles);\n element.offsetHeight;\n\n // Only the latest restart plays: rapid calls used to queue overlapping plays\n this.cancelScheduled(this.restartTimer);\n this.restartTimer = this.schedule(() => {\n this.restartTimer = undefined;\n element.style.transition = '';\n if (!this.isRunInViewEnabled) {\n // runInView elements are started by their in-view observer instead\n this.playAnimation(this.initial, this.animate);\n }\n }, MOTION_DEFAULTS.RESET_TIMEOUT);\n }\n\n private restartTimer: any;\n\n /**\n * Nearest ancestor motionone directive (through component boundaries).\n * Children register with it so a parent only orchestrates its *direct*\n * motion children; grandchildren are orchestrated by their own parent.\n */\n private parentMotion = inject(MotionOneDirective, { optional: true, skipSelf: true });\n private readonly motionChildren: MotionOneDirective[] = [];\n /** Set once this directive has wired up its children (see initChildren). */\n private childrenInitialized = false;\n /**\n * Values the element was last reset to via inline styles. Motion caches each\n * element's last animated values, so after a reset it would otherwise animate\n * from the stale cached value (i.e. not move at all). The next animation uses\n * these as explicit `[from, to]` keyframes.\n */\n private pendingFrom: Record<string, any> | null = null;\n\n /** Direct motionone children, in registration (DOM) order. */\n get childMotionDirectives(): MotionOneDirective[] {\n return this.motionChildren;\n }\n\n private controls: any = null;\n private childrenControls: any[] = [];\n public elementId: string;\n private hoverTimeout: any;\n private observer?: IntersectionObserver | null;\n /** Stop function returned by Motion's inView() */\n private inViewStop: (() => void) | null = null;\n private readonly ngZone = inject(NgZone);\n /** Removes gesture listeners attached in syncGestureListeners() */\n private gestureCleanups: (() => void)[] = [];\n private attachedGestures = new Set<'hover' | 'tap' | 'focus'>();\n /** Removes a pending window mouseup/touchend listener from an in-progress press */\n private pressEndCleanup: (() => void) | null = null;\n private isChild = false;\n private parentDirective: MotionOneDirective | null = null;\n private initialAnimationPlayed = false;\n private _skipStartStylesApplication = false;\n private staggerDelay: number | undefined = undefined;\n private childrenCount = 0;\n private childIndex = 0;\n private isStaggeredChild = false;\n // Track all setTimeout calls for proper cleanup on destroy\n private activeTimeouts: Set<any> = new Set();\n\n get scrollProgress() {\n return this.motionService.scrollYProgress();\n }\n\n private get isRunInViewEnabled(): boolean {\n return this.runInView === 'once' || this.runInView === 'always';\n }\n\n private get runInViewRepeat(): 'once' | 'always' {\n return this.runInView === 'always' ? 'always' : 'once';\n }\n\n constructor(\n public el: ElementRef,\n private motionService: MotionOneService,\n private motionAnimation: MotionAnimationService,\n private animationOptions: MotionAnimationOptionsService,\n private staggerService: MotionStaggerService,\n private inViewService: MotionInViewService,\n private timelineService: MotionTimelineService,\n private gestureService: MotionGestureService,\n @Inject(PLATFORM_ID) private platformId: Object\n ) {\n this.elementId = `motion-${uniqueIdCounter++}`;\n\n this.parentMotion?.motionChildren.push(this);\n directiveByElement.set(this.el.nativeElement, this);\n\n if (isPlatformBrowser(this.platformId)) {\n // Only give the element an id if it doesn't already have one\n if (!this.el.nativeElement.id) {\n this.el.nativeElement.setAttribute('id', this.elementId);\n }\n (this.el.nativeElement as any)._motionDirective = this;\n this.motionService.registerMotionElement(this);\n }\n }\n\n /** Write styles synchronously and remember them as the next animation's start values. */\n private setInlineStyles(styles: Record<string, any>) {\n if (!styles || Object.keys(styles).length === 0) return;\n applyInlineStyles(this.el.nativeElement, styles);\n this.pendingFrom = { ...(this.pendingFrom || {}), ...styles };\n }\n\n /** Animate this element, starting from any values it was just reset to. */\n private animateSelf(targetStyles: Record<string, any>, options: any): any {\n let keyframes = targetStyles;\n if (this.pendingFrom) {\n // Starting from a reset: the element was moved back without animating, so\n // the velocity of whatever was interrupted no longer applies. Inheriting it\n // made rapid restarts of a spring compound until it flew off-screen.\n options = { ...options, velocity: 0 };\n keyframes = { ...targetStyles };\n for (const key of Object.keys(targetStyles)) {\n if (key in this.pendingFrom && !Array.isArray(targetStyles[key])) {\n const from = this.pendingFrom[key];\n keyframes[key] = [Array.isArray(from) ? from[0] : from, targetStyles[key]];\n }\n }\n this.pendingFrom = null;\n }\n this.controls = this.motionAnimation.animate(this.el.nativeElement as Target, keyframes, options);\n return this.controls;\n }\n\n /**\n * setTimeout outside the Angular zone (so it doesn't trigger change detection),\n * tracked so it is cleared on destroy.\n */\n private schedule(fn: () => void, ms: number): any {\n const timeoutId = this.ngZone.runOutsideAngular(() =>\n setTimeout(() => {\n this.activeTimeouts.delete(timeoutId);\n fn();\n }, ms)\n );\n this.activeTimeouts.add(timeoutId);\n return timeoutId;\n }\n\n private cancelScheduled(timeoutId: any) {\n if (timeoutId === undefined || timeoutId === null) return;\n clearTimeout(timeoutId);\n this.activeTimeouts.delete(timeoutId);\n }\n\n /** Emit animationComplete back inside the zone, and only if someone is listening. */\n private emitComplete(): void {\n if (this.animationComplete.observed) {\n this.ngZone.run(() => this.animationComplete.emit());\n }\n }\n\n ngOnInit() {\n // A child is driven by its parent only if the parent hasn't wired up its\n // children yet; children added later (e.g. new @for items) animate themselves.\n this.isChild = !!this.parentMotion && !this.parentMotion.childrenInitialized;\n\n this.applyInitialStyles();\n\n if (isPlatformBrowser(this.platformId)) {\n this.syncGestureListeners();\n\n // runInView is set up in initChildren(), once children are known\n if (!this.isChild && !this.isRunInViewEnabled) {\n this.playAnimation(this.initial, this.animate);\n }\n\n // Setup inView/whileInView animations\n if (!this.isStaggeredChild &&\n ((this.inView && Object.keys(this.inView).length > 0) ||\n (this.whileInView && Object.keys(this.whileInView).length > 0))) {\n this.setupInViewAnimation();\n }\n }\n }\n\n ngAfterContentInit() {\n if (!isPlatformBrowser(this.platformId)) return;\n // Wait a tick so children inside nested components / control flow have registered\n this.schedule(() => this.initChildren(), 0);\n }\n\n /** Wire up direct children and start whatever this directive orchestrates. Idempotent. */\n private initChildren() {\n if (this.childrenInitialized) return;\n this.childrenInitialized = true;\n this.rehomeProjectedChildren();\n\n const children = this.motionChildren;\n this.childrenCount = children.length;\n children.forEach((child, index) => child.setParent(this, index, children.length));\n\n if (this.isRunInViewEnabled && !this.isChild) {\n // This element's in-view observer drives its children\n children.forEach(child => (child.isStaggeredChild = true));\n if (this.runInView === 'always' && children.length > 0) {\n this.setupRunInViewObserver();\n } else {\n this.setupMotionOneInView();\n }\n return;\n }\n\n if (children.length === 0) return;\n\n if (this.getStaggerValue() === 0) {\n // No stagger: in-view children watch their own visibility\n children.forEach(child => {\n if (child.isRunInViewEnabled) child.setupInViewAnimation();\n });\n } else {\n children.forEach(child => {\n if (child.isRunInViewEnabled) child.isStaggeredChild = true;\n });\n }\n\n // A nested parent waits for its own parent to play it (see playAsChild)\n if (!this.isChild && !this.isRunInViewEnabled) {\n this.applyStaggerToChildren();\n }\n }\n\n /**\n * DI registers content projected into a component (`<ng-content>`) with the\n * motionone around the component, not with the motionone the content is\n * rendered inside. Framer Motion uses the rendered tree, so hand each such\n * child to its nearest motionone ancestor in the DOM. Only ancestors inside\n * this element count (content moved elsewhere, e.g. an overlay, stays put).\n */\n private rehomeProjectedChildren() {\n const host = this.el.nativeElement as HTMLElement;\n for (const child of [...this.motionChildren]) {\n const owner = nearestMotionAncestor(child.el.nativeElement, host);\n if (!owner || owner === this) continue;\n this.motionChildren.splice(this.motionChildren.indexOf(child), 1);\n child.parentMotion = owner;\n owner.adoptChild(child);\n }\n }\n\n /** Take over a child rehomed from an outer motionone (see rehomeProjectedChildren). */\n private adoptChild(child: MotionOneDirective) {\n const list = this.motionChildren;\n // Keep DOM order, which is the stagger order\n const at = list.findIndex(c =>\n !!(child.el.nativeElement.compareDocumentPosition(c.el.nativeElement) & Node.DOCUMENT_POSITION_FOLLOWING));\n list.splice(at === -1 ? list.length : at, 0, child);\n if (this.childrenInitialized) {\n // Too late to be orchestrated: play like any child added after init\n child.isChild = false;\n if (child.isRunInViewEnabled) child.setupInViewAnimation();\n else child.playAnimation(child.initial, child.animate);\n }\n }\n\n /** Children this directive plays itself (in-view children play themselves when there's no stagger). */\n private childrenToPlay(): MotionOneDirective[] {\n // An in-view child watches its own visibility unless this parent drives it\n // (isStaggeredChild), in which case it's played here like any other child\n return this.getStaggerValue() === 0\n ? this.motionChildren.filter(child => !child.isRunInViewEnabled || child.isStaggeredChild)\n : this.motionChildren;\n }\n\n /** Called by the parent when it's this child's turn in the stagger. */\n private playAsChild() {\n // The parent's timer already applied the stagger slot; the child's own\n // transition.delay (if any) is added on top of it rather than discarded\n this.staggerDelay = undefined;\n try {\n if (this.motionChildren.length > 0) {\n this.initChildren();\n this.applyStaggerToChildren();\n } else {\n this.playAnimation(this.initial, this.animate);\n }\n } finally {\n this.staggerDelay = undefined;\n }\n }\n\n setParent(parent: MotionOneDirective, index: number, totalChildren: number) {\n this.parentDirective = parent;\n this.isChild = true;\n this.childIndex = index;\n this.childrenCount = totalChildren;\n }\n\n public completeResetToInitial() {\n this.forceResetToInitial();\n this.motionChildren.forEach(child => child.completeResetToInitial());\n }\n\n public forceResetToInitial() {\n this.cancelForReset();\n\n const initialVariant = this.getVariant(this.initial);\n const initialStyles = extractStyleProperties(initialVariant);\n\n this.el.nativeElement.style.transition = 'none';\n this.el.nativeElement.style.opacity = '';\n this.el.nativeElement.style.transform = '';\n this.setInlineStyles(initialStyles);\n this.el.nativeElement.offsetHeight;\n this.el.nativeElement.style.transition = '';\n\n this.initialAnimationPlayed = false;\n }\n\n public resetToInitialIfParentHasRunInView() {\n this.forceResetToInitial();\n }\n\n public parentExitViewportReset() {\n this.completeResetToInitial();\n }\n\n private setupRunInViewObserver() {\n if (!isPlatformBrowser(this.platformId)) return;\n\n const observer = this.ngZone.runOutsideAngular(() =>\n this.inViewService.createRunInViewObserver(\n this.el.nativeElement,\n () => this.handleViewportEntry(),\n () => this.handleViewportExit()\n )\n );\n\n if (observer) {\n this.observer = observer;\n this.observer.observe(this.el.nativeElement);\n }\n }\n\n private handleViewportEntry() {\n if (this.motionChildren.length > 0) {\n this.applyStaggerToChildren();\n } else {\n this.playAnimation(this.initial, this.animate);\n }\n }\n\n private handleViewportExit() {\n if (this.runInView === 'always') {\n if (this.motionChildren.length > 0) {\n this.motionChildren.forEach((child) => {\n if (child.controls) {\n child.controls.stop();\n child.controls = null;\n }\n child.playAnimation(child.animate, child.initial);\n child.initialAnimationPlayed = false;\n });\n }\n }\n }\n\n applyStaggerToChildren() {\n const staggerValue = this.getStaggerValue();\n const staggerDirection = this.getStaggerDirection();\n const delayChildren = this.animationOptions.getDelayChildren(\n this.getVariant(this.animate),\n this.transition,\n this.delayChildren\n );\n const parentDelay = (((this.transition as TransitionOptions)?.delay) ?? 0) as number;\n\n const childDirectives = this.childrenToPlay();\n const childCount = childDirectives.length;\n const when = this.getWhen();\n\n if (when !== 'afterChildren') {\n this.runSelfAnimation();\n }\n\n childDirectives.forEach((childDirective, index) => {\n const totalDelay = this.staggerService.calculateChildDelay(index, {\n childCount,\n staggerValue,\n staggerDirection,\n delayChildren,\n parentDelay\n });\n\n // The timer alone applies the stagger delay. (Previously the same delay was\n // also passed as the animation's own delay, doubling it, and the child's\n // transition input was mutated to clear its delay.)\n this.schedule(() => childDirective.playAsChild(), totalDelay * 1000);\n });\n\n if (when === 'afterChildren') {\n const totalChildrenDuration = this.staggerService.calculateTotalDuration({\n childCount,\n staggerValue,\n staggerDirection,\n delayChildren,\n parentDelay\n });\n const previous = this.staggerDelay;\n this.staggerDelay = totalChildrenDuration;\n this.runSelfAnimation();\n this.staggerDelay = previous;\n }\n }\n\n overrideDelay(delay: number) {\n this.staggerDelay = delay;\n }\n\n runSelfAnimation() {\n const options = this.getAnimationOptions();\n const targetStyles = extractStyleProperties(this.getVariant(this.animate));\n const startStyles = extractStyleProperties(this.getVariant(this.initial));\n\n if (!this.isStaggeredChild) {\n this.setInlineStyles(startStyles);\n }\n\n this.animateSelf(targetStyles, options);\n\n this.initialAnimationPlayed = true;\n }\n\n ngOnDestroy() {\n // Clear all pending setTimeout calls to prevent navigation blocking\n this.activeTimeouts.forEach(timeoutId => {\n clearTimeout(timeoutId);\n });\n this.activeTimeouts.clear();\n\n // Clear hover timeout\n if (this.hoverTimeout) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = null;\n }\n\n // Remove gesture listeners and any pending press-end listener\n this.gestureCleanups.forEach(cleanup => cleanup());\n this.gestureCleanups = [];\n this.attachedGestures.clear();\n this.pressEndCleanup?.();\n this.pressEndCleanup = null;\n\n // Clean up gesture state\n this.gestureService.clearElement(this.elementId);\n\n // Disconnect Motion's inView observer\n this.stopInView();\n\n // Disconnect intersection observer\n this.inViewService.disconnect(this.observer);\n this.observer = undefined;\n\n // Stop all animation controls\n if (this.controls) {\n try {\n this.controls.stop();\n } catch (e) {\n // Ignore errors if already stopped\n }\n this.controls = null;\n }\n\n // Stop all children animation controls\n this.childrenControls.forEach(control => {\n if (control) {\n try {\n control.stop();\n } catch (e) {\n // Ignore errors if already stopped\n }\n }\n });\n this.childrenControls = [];\n\n directiveByElement.delete(this.el.nativeElement);\n\n // Detach from parent; children clean up in their own ngOnDestroy\n if (this.parentMotion) {\n const i = this.parentMotion.motionChildren.indexOf(this);\n if (i !== -1) this.parentMotion.motionChildren.splice(i, 1);\n }\n\n // Unregister from motion service\n this.motionService.unregisterMotionElement(this);\n\n // Skip exit animation on destroy to prevent blocking\n // Exit animations should be handled by Angular's built-in animation system\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes['animate'] && changes['animate'].previousValue !== undefined) {\n const oldState = changes['animate'].previousValue;\n let newState = changes['animate'].currentValue;\n\n if (typeof newState === 'object') {\n this.playAnimation(oldState, newState);\n } else if (typeof newState === 'string' && this.variants?.[newState]) {\n newState = this.variants[newState];\n this.playAnimation(oldState, newState);\n }\n }\n\n if (changes['transition'] && !changes['transition'].firstChange) {\n this.playAnimation(this.initial, this.animate);\n }\n\n if ((changes['whileHover'] || changes['whileTap'] || changes['whileFocus']) &&\n isPlatformBrowser(this.platformId) && this.gestureListenersReady) {\n this.syncGestureListeners();\n }\n }\n\n private gestureListenersReady = false;\n\n /**\n * Attach only the gesture listeners this element actually uses, outside the\n * Angular zone. Previously every directive bound six host listeners, each of\n * which triggered app-wide change detection, and touchstart was non-passive.\n */\n private syncGestureListeners() {\n this.gestureListenersReady = true;\n const el: HTMLElement = this.el.nativeElement;\n const listen = (type: string, handler: (e: any) => void, options?: AddEventListenerOptions) => {\n this.ngZone.runOutsideAngular(() => el.addEventListener(type, handler, options));\n this.gestureCleanups.push(() => el.removeEventListener(type, handler, options));\n };\n\n if (!this.attachedGestures.has('hover') && this.hasKeys(this.whileHover)) {\n this.attachedGestures.add('hover');\n listen('mouseenter', () => this.onMouseEnter());\n listen('mouseleave', () => this.onMouseLeave());\n }\n if (!this.attachedGestures.has('tap') && this.hasKeys(this.whileTap)) {\n this.attachedGestures.add('tap');\n listen('mousedown', (e: Event) => this.onPress(e));\n listen('touchstart', (e: Event) => this.onPress(e), { passive: true });\n }\n if (!this.attachedGestures.has('focus') && this.hasKeys(this.whileFocus)) {\n this.attachedGestures.add('focus');\n listen('focus', () => this.onFocus());\n listen('blur', () => this.onBlur());\n }\n }\n\n private hasKeys(value: unknown): boolean {\n return !!value && typeof value === 'object' && Object.keys(value).length > 0;\n }\n\n /**\n * Cancel running animations before writing reset styles. Motion's stop()\n * commits the current value on the next frame, which overwrote the reset\n * (an element leaving the view mid-animation froze half-way); cancel() doesn't.\n */\n private cancelForReset() {\n const cancel = (c: any) => {\n if (!c) return;\n try {\n typeof c.cancel === 'function' ? c.cancel() : c.stop();\n } catch {\n // already finished\n }\n };\n cancel(this.controls);\n this.controls = null;\n this.childrenControls.forEach(cancel);\n this.childrenControls = [];\n }\n\n private stopInView() {\n if (this.inViewStop) {\n this.inViewStop();\n this.inViewStop = null;\n }\n }\n\n /** Reset elements to their initial styles with a single forced reflow for the whole batch. */\n private resetToInitialStylesBatch(directives: MotionOneDirective[]) {\n const elements: HTMLElement[] = [];\n directives.forEach(directive => {\n directive.cancelForReset();\n const styles = extractStyleProperties(directive.getVariant(directive.initial));\n if (Object.keys(styles).length === 0) return;\n const el: HTMLElement = directive.el.nativeElement;\n el.style.transition = 'none';\n directive.setInlineStyles(styles);\n elements.push(el);\n });\n if (elements.length === 0) return;\n void elements[0].offsetHeight; // one reflow for all writes above\n elements.forEach(el => (el.style.transition = ''));\n }\n\n onMouseEnter() {\n if (Object.keys(this.whileHover).length > 0) {\n clearTimeout(this.hoverTimeout);\n\n // Check if we should allow this gesture (prevents aggressive rapid triggers)\n if (!this.gestureService.shouldAllowGesture(this.elementId, 'hover')) {\n return;\n }\n\n // Cancel any ongoing gesture animation state tracking\n this.gestureService.cancelGesture(this.elementId);\n\n // Don't stop the animation - Motion One will automatically interrupt it\n // and animate from the current position when we start a new animation\n // This creates smooth transitions even during rapid hovers\n\n // Animate to whileHover from current position\n // Motion One will automatically use current animated values as start\n this.playAnimationToTarget(this.whileHover, 'hover');\n }\n }\n\n onMouseLeave() {\n if (Object.keys(this.whileHover).length > 0) {\n clearTimeout(this.hoverTimeout);\n\n // Cancel the hover gesture state tracking\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate back to initial/animate state from current position\n // Note: hoverTimeout is tracked separately and cleared in ngOnDestroy\n this.hoverTimeout = this.ngZone.runOutsideAngular(() => setTimeout(() => {\n if (Object.keys(this.animate).length > 0) {\n this.playAnimationToTarget(this.animate);\n } else {\n this.playAnimationToTarget(this.initial);\n }\n }, 100));\n }\n }\n\n onPress(event: Event) {\n if (Object.keys(this.whileTap).length > 0) {\n // Check if we should allow this gesture (prevents aggressive rapid triggers)\n if (!this.gestureService.shouldAllowGesture(this.elementId, 'tap')) {\n return;\n }\n\n // Cancel gesture state tracking\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate to whileTap from current position\n this.playAnimationToTarget(this.whileTap, 'tap');\n\n if (isPlatformBrowser(this.platformId)) {\n const endEvent = event.type === 'mousedown' ? 'mouseup' : 'touchend';\n this.pressEndCleanup?.();\n const endListener = () => {\n this.pressEndCleanup = null;\n // Cancel the tap gesture state\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate back from current position\n if (Object.keys(this.animate).length > 0) {\n this.playAnimationToTarget(this.animate);\n } else {\n this.playAnimationToTarget(this.initial);\n }\n window.removeEventListener(endEvent, endListener);\n };\n this.ngZone.runOutsideAngular(() => window.addEventListener(endEvent, endListener));\n this.pressEndCleanup = () => window.removeEventListener(endEvent, endListener);\n }\n }\n }\n\n onFocus() {\n if (Object.keys(this.whileFocus).length > 0) {\n // Check if we should allow this gesture (prevents aggressive rapid triggers)\n if (!this.gestureService.shouldAllowGesture(this.elementId, 'focus')) {\n return;\n }\n\n // Cancel gesture state tracking\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate to whileFocus from current position\n this.playAnimationToTarget(this.whileFocus, 'focus');\n }\n }\n\n onBlur() {\n if (Object.keys(this.whileFocus).length > 0) {\n // Cancel the focus gesture state\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate back from current position\n if (Object.keys(this.animate).length > 0) {\n this.playAnimationToTarget(this.animate);\n } else {\n this.playAnimationToTarget(this.initial);\n }\n }\n }\n\n applyInitialValues() {\n this.setInlineStyles(extractStyleProperties(this.getVariant(this.initial)));\n }\n\n private applyInitialStyles() {\n const styles = extractStyleProperties(this.getVariant(this.initial));\n\n if (styles && Object.keys(styles).length > 0) {\n if (this.isRunInViewEnabled && isPlatformBrowser(this.platformId)) {\n this.el.nativeElement.style.transition = 'none';\n this.setInlineStyles(styles);\n this.el.nativeElement.offsetHeight;\n this.el.nativeElement.style.transition = '';\n } else {\n this.setInlineStyles(styles);\n }\n }\n }\n\n private applyAnimateStyles() {\n this.setInlineStyles(extractStyleProperties(this.getVariant(this.animate)));\n }\n\n public extractStyleProperties(variant: VariantWithTransition): Record<string, any> {\n return extractStyleProperties(variant);\n }\n\n private getAnimationOptions(targetState?: VariantWithTransition): AnimationOptions {\n return this.animationOptions.getAnimationOptions({\n targetState,\n animateState: this.getVariant(this.animate),\n staggerDelay: this.staggerDelay,\n transition: this.transition,\n delay: this.delay,\n easing: this.easing,\n duration: this.duration,\n repeat: this.repeat,\n onComplete: () => this.emitComplete()\n });\n }\n\n private getStaggerValue(): number {\n return this.animationOptions.getStaggerValue(\n this.getVariant(this.animate),\n this.transition,\n this.staggerChildren\n );\n }\n\n private getStaggerDirection(): number {\n return this.animationOptions.getStaggerDirection(\n this.getVariant(this.animate),\n this.transition,\n this.staggerDirection\n );\n }\n\n private getWhen(): 'beforeChildren' | 'afterChildren' | 'together' {\n return this.animationOptions.getWhen(\n this.getVariant(this.animate),\n this.transition\n );\n }\n\n /**\n * Play animation TO a target state from current position\n * Motion One will automatically use current animated values as the start\n */\n private playAnimationToTarget(\n targetState: VariantWithTransition | string,\n gestureType?: 'hover' | 'tap' | 'focus'\n ) {\n if (!targetState || !isPlatformBrowser(this.platformId)) return;\n\n const resolvedTargetState = resolveVariant(targetState, this.variants);\n\n if (resolvedTargetState.at !== undefined) {\n this.schedule(() => {\n this.animateToTarget(resolvedTargetState, gestureType);\n }, resolvedTargetState.at * 1000);\n return;\n }\n\n this.animateToTarget(resolvedTargetState, gestureType);\n }\n\n /**\n * Original playAnimation method - still used for initial animations and explicit start→end\n */\n private playAnimation(\n startState: VariantWithTransition | string,\n targetState: VariantWithTransition | string,\n gestureType?: 'hover' | 'tap' | 'focus'\n ) {\n if (!targetState || !isPlatformBrowser(this.platformId)) return;\n\n const resolvedStartState = resolveVariant(startState || this.initial, this.variants);\n const resolvedTargetState = resolveVariant(targetState || this.animate, this.variants);\n\n if (resolvedTargetState.at !== undefined) {\n this.schedule(() => {\n this.continueAnimation(resolvedTargetState, false, gestureType);\n }, resolvedTargetState.at * 1000);\n return;\n }\n\n this.continueAnimation(resolvedTargetState, false, gestureType);\n }\n\n /**\n * Animate to target from current position without explicit start state\n * Motion One automatically interrupts any conflicting animations and preserves velocity\n */\n private animateToTarget(\n resolvedTargetState: VariantWithTransition,\n gestureType?: 'hover' | 'tap' | 'focus'\n ) {\n // Timeline takes precedence\n if (this.timeline && this.timeline.length > 0) {\n this.runTimeline(resolvedTargetState);\n return;\n }\n\n // Per-property transition map\n const t: any = resolvedTargetState.transition;\n if (this.timelineService.isPerPropertyTransition(t)) {\n this.runPerPropertyAnimations(resolvedTargetState);\n return;\n }\n\n // Get animation options\n const options = this.getAnimationOptions(resolvedTargetState);\n const targetStyles = extractStyleProperties(resolvedTargetState);\n\n // Motion One automatically interrupts conflicting animations\n // By passing individual transform properties (rotate, scale, x, y),\n // Motion One can smoothly interpolate and preserve spring velocity\n this.animateSelf(targetStyles, options);\n\n // Register gesture animation if this is a gesture\n if (gestureType) {\n this.gestureService.startGesture(\n this.elementId,\n gestureType,\n typeof resolvedTargetState === 'string' ? resolvedTargetState : 'custom',\n this.controls\n );\n }\n }\n\n private continueAnimation(\n resolvedTargetState: VariantWithTransition,\n isInitialAnimation: boolean,\n gestureType?: 'hover' | 'tap' | 'focus'\n ) {\n // Timeline takes precedence\n if (this.timeline && this.timeline.length > 0) {\n this.runTimeline(resolvedTargetState);\n return;\n }\n\n // Per-property transition map\n const t: any = resolvedTargetState.transition;\n if (this.timelineService.isPerPropertyTransition(t)) {\n this.runPerPropertyAnimations(resolvedTargetState);\n return;\n }\n\n // Check for stagger on initial animation\n if (isInitialAnimation && !this.initialAnimationPlayed) {\n const staggerValue = this.getStaggerValue();\n if (staggerValue > 0 && this.motionChildren.length > 0) {\n const when = this.getWhen();\n if (when !== 'afterChildren') {\n this.runSelfAnimation();\n }\n return;\n }\n }\n\n // Normal animation\n const options = this.getAnimationOptions(resolvedTargetState);\n const targetStyles = extractStyleProperties(resolvedTargetState);\n\n this.animateSelf(targetStyles, options);\n\n // Register gesture animation if this is a gesture\n if (gestureType) {\n this.gestureService.startGesture(\n this.elementId,\n gestureType,\n typeof resolvedTargetState === 'string' ? resolvedTargetState : 'custom',\n this.controls\n );\n }\n\n if (isInitialAnimation) {\n this.initialAnimationPlayed = true;\n }\n\n // Note: plain (non-motionone) DOM children are not animated. They used to be\n // animated to the parent's target styles too, which compounded transforms\n // (a parent moving to x: 100 moved its children 200px).\n }\n\n private runPerPropertyAnimations(resolvedTargetState: VariantWithTransition) {\n const baseDelay = this.staggerDelay !== undefined && this.staggerDelay >= 0\n ? this.staggerDelay\n : (((resolvedTargetState.transition as TransitionOptions)?.delay) ?? this.delay);\n\n const result = this.timelineService.runPerPropertyAnimations(\n this.el.nativeElement,\n resolvedTargetState,\n baseDelay,\n this.duration,\n this.easing,\n this.repeat,\n () => this.emitComplete()\n );\n\n this.childrenControls = result.controls;\n }\n\n private runTimeline(resolvedTargetState: VariantWithTransition) {\n const baseDelay = this.staggerDelay !== undefined && this.staggerDelay >= 0\n ? this.staggerDelay\n : (((resolvedTargetState.transition as TransitionOptions)?.delay) ?? this.delay);\n\n const result = this.timelineService.runTimeline(\n this.el.nativeElement,\n this.timeline!,\n resolvedTargetState,\n baseDelay,\n this.duration,\n this.easing,\n this.repeat,\n () => this.emitComplete()\n );\n\n this.childrenControls = result.controls;\n }\n\n private setupInViewAnimation() {\n if (!isPlatformBrowser(this.platformId)) return;\n\n try {\n if (this.isRunInViewEnabled) {\n this.setupMotionOneInView();\n } else {\n const hasWhileInView = this.whileInView && Object.keys(this.whileInView).length > 0;\n const hasInView = this.inView && Object.keys(this.inView).length > 0;\n\n if (hasWhileInView) {\n this.setupWhileInViewAnimation();\n } else if (hasInView) {\n this.stopInView();\n this.inViewStop = this.motionAnimation.inView(\n this.el.nativeElement,\n () => this.runInViewAnimation(),\n { margin: this.offset, amount: 'some' }\n );\n }\n }\n } catch (error) {\n console.error('[ngx-motion] Error setting up inView observer:', error);\n }\n }\n\n runInViewAnimation() {\n if (this.inView && Object.keys(this.inView).length > 0) {\n this.playAnimation(this.initial, this.inView);\n } else if (this.whileInView && Object.keys(this.whileInView).length > 0) {\n this.playAnimation(this.initial, this.whileInView);\n }\n }\n\n private setupWhileInViewAnimation() {\n this.stopInView();\n this.inViewStop = this.motionAnimation.inView(\n this.el.nativeElement,\n () => this.playAnimation(this.initial, this.whileInView),\n { margin: this.offset, amount: 'some' }\n );\n }\n\n private setupMotionOneInView() {\n const margin = this.offset || MOTION_DEFAULTS.INVIEW_MARGIN;\n // A root in-view element drives its children. So does a nested one that its\n // parent left to watch its own visibility (not a staggered child): without\n // this its children (e.g. split-text letters) never played.\n if (this.motionChildren.length > 0 && (!this.isChild || !this.isStaggeredChild)) {\n if (this.isChild) {\n this.initChildren();\n this.motionChildren.forEach(child => (child.isStaggeredChild = true));\n }\n this.setupStaggerParentInView(margin);\n } else if (!this.isStaggeredChild) {\n this.setupIndividualElementInView(margin);\n }\n }\n\n /**\n * Motion's inView() calls onStart on enter; returning a function makes it keep\n * observing and call that function on leave. Returning nothing stops observing\n * after the first entry, which is what runInView=\"once\" wants.\n */\n private setupStaggerParentInView(margin: string) {\n this.stopInView();\n this.inViewStop = this.motionAnimation.inView(\n this.el.nativeElement,\n () => {\n const childDirectives = this.motionChildren;\n this.resetToInitialStylesBatch([this, ...childDirectives]);\n\n let pending: any = null;\n if (childDirectives.length > 0) {\n // Same orchestration as an on-load parent: stagger slots, delayChildren,\n // each child's own delay, and nested children played by their parent.\n // (Previously each child was animated flat, so grandchildren never\n // played and the children's own delays were dropped.)\n pending = this.schedule(() => this.applyStaggerToChildren(), MOTION_DEFAULTS.STAGGER_TIMEOUT);\n }\n\n if (this.runInViewRepeat === 'always') {\n // Left before the queued play ran: cancel it so it can't play off-screen\n return () => {\n this.cancelScheduled(pending);\n this.resetToInitialStylesBatch([this, ...childDirectives]);\n };\n }\n return undefined;\n },\n { margin, amount: 0.1 }\n );\n }\n\n private setupIndividualElementInView(margin: string) {\n this.stopInView();\n this.inViewStop = this.motionAnimation.inView(\n this.el.nativeElement,\n () => {\n this.resetToInitialStylesBatch([this]);\n const pending = this.schedule(() => {\n this.playAnimation(this.initial, this.animate);\n }, MOTION_DEFAULTS.STAGGER_TIMEOUT);\n\n if (this.runInViewRepeat === 'always') {\n // Left before the queued play ran: cancel it so it can't play off-screen\n return () => {\n this.cancelScheduled(pending);\n this.resetToInitialStylesBatch([this]);\n };\n }\n return undefined;\n },\n { margin, amount: 0.1 }\n );\n }\n\n runInitAnimation() {\n if (!isPlatformBrowser(this.platformId) || !this.initial || !this.animate) return;\n\n if (this.isChild && this.staggerDelay !== undefined && this.staggerDelay >= 0) {\n if (!this._skipStartStylesApplication) {\n const startStyles = extractStyleProperties(this.getVariant(this.initial));\n const element = this.el.nativeElement;\n element.style.transition = 'none';\n this.setInlineStyles(startStyles);\n } else {\n this._skipStartStylesApplication = false;\n }\n this.el.nativeElement.offsetHeight;\n\n this.schedule(() => {\n this.el.nativeElement.style.transition = '';\n this.playAnimation(this.initial, this.animate);\n }, 5);\n\n this.initialAnimationPlayed = true;\n } else {\n this.playAnimation(this.initial, this.animate);\n }\n }\n\n runExitAnimation(): Promise<void> {\n if (!isPlatformBrowser(this.platformId)) {\n return Promise.resolve();\n }\n\n if (!this.exit || Object.keys(this.exit).length === 0) {\n return Promise.resolve();\n }\n\n const exitTransition = (this.getVariant(this.exit).transition as TransitionOptions) ||\n (this.transition as TransitionOptions) ||\n {} as TransitionOptions;\n\n return new Promise<void>((resolve) => {\n const exitOptions: any = {\n duration: (exitTransition.duration ?? this.duration) as number,\n delay: (exitTransition.delay ?? this.exitDelay) as number,\n onComplete: () => {\n this.emitComplete();\n resolve();\n }\n };\n\n const options: any = this.animationOptions.getAnimationOptions({\n targetState: this.getVariant(this.exit),\n transition: this.transition,\n delay: this.delay,\n easing: this.easing,\n duration: this.duration,\n repeat: this.repeat\n });\n\n exitOptions.easing = options.easing || options.ease;\n exitOptions.ease = options.ease || options.easing;\n\n if (this.controls) {\n this.controls.stop();\n }\n\n this.childrenControls.forEach(control => {\n if (control) control.stop();\n });\n\n const exitStyles = extractStyleProperties(this.getVariant(this.exit));\n\n this.animateSelf(exitStyles, exitOptions);\n\n if (!exitOptions.duration) {\n resolve();\n }\n });\n }\n\n cancel() {\n if (this.controls) {\n this.controls.stop();\n }\n\n this.childrenControls.forEach(control => {\n if (control) control.stop();\n });\n\n this.applyAnimateStyles();\n }\n\n getDuration(): number {\n if (!isPlatformBrowser(this.platformId)) return 0;\n\n try {\n const animateTransition = (this.getVariant(this.exit)?.transition as TransitionOptions) ||\n (this.transition as TransitionOptions) ||\n {} as TransitionOptions;\n const duration = (animateTransition.duration ?? this.duration) as number;\n const delay = (animateTransition.delay ?? this.delay) as number;\n return (Number(duration) + Number(delay)) * 1000;\n } catch (error) {\n console.error('Error calculating duration:', error);\n return 0;\n }\n }\n\n getKeyByValue(object: any, key: any) {\n return Object.keys(object).find((k) => object[k] === key);\n }\n\n public triggerExitAnimation(): Promise<void> {\n return this.runExitAnimation();\n }\n\n @HostListener('motionExit')\n onMotionExit() {\n this.runExitAnimation();\n }\n\n public getVariant(variant: VariantWithTransition | string): VariantWithTransition {\n return resolveVariant(variant, this.variants);\n }\n}\n","import { Directive, Input, TemplateRef, ViewContainerRef, OnDestroy, EmbeddedViewRef, ChangeDetectorRef } from '@angular/core';\nimport { MotionOneDirective } from './motion-one.directive';\n\n/**\n * Structural directive for animated presence with proper enter/exit lifecycle.\n * Works with the existing motionone directive's animate and exit properties.\n * \n * Usage:\n * ```html\n * <div *motionIf=\"isVisible\">\n * <div motionone \n * [initial]=\"{ opacity: 0, scale: 0.8 }\" \n * [animate]=\"{ opacity: 1, scale: 1 }\"\n * [exit]=\"{ opacity: 0, scale: 0.8 }\">\n * Content that animates in and out\n * </div>\n * </div>\n * ```\n */\n@Directive({\n selector: '[motionIf]',\n standalone: true\n})\nexport class MotionIfDirective implements OnDestroy {\n private hasView = false;\n private currentView: EmbeddedViewRef<any> | null = null;\n private motionDirectives: MotionOneDirective[] = [];\n private exitTimeout: any;\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private cdr: ChangeDetectorRef\n ) {}\n\n /** True while exit animations run and the view is waiting to be removed. */\n private exiting = false;\n\n @Input() set motionIf(condition: boolean) {\n if (condition) {\n if (this.exiting) {\n this.cancelExit();\n } else if (!this.hasView) {\n this.enter();\n }\n } else if (this.hasView && !this.exiting) {\n this.exit();\n }\n }\n\n private enter() {\n // Each motionone in the new view starts its own enter animation, and parents\n // orchestrate their children (stagger). Previously this also replayed every\n // descendant at once on the next tick, which flattened any stagger.\n this.currentView = this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView = true;\n this.cdr.detectChanges();\n }\n\n /**\n * Shown again while the exit animation was still running: keep the existing\n * view (previously the pending timeout removed it anyway, so the content\n * vanished while the condition was true) and animate back in.\n */\n private cancelExit() {\n if (this.exitTimeout) {\n clearTimeout(this.exitTimeout);\n this.exitTimeout = null;\n }\n this.exiting = false;\n // Only the elements that ran an exit animation need to come back\n this.motionDirectives\n .filter(directive => directive.exit && Object.keys(directive.exit).length > 0)\n .forEach(directive => directive.runInitAnimation());\n }\n\n private exit() {\n if (!this.hasView || !this.currentView) return;\n\n // Look the directives up now: exit can happen before enter's lookup ran\n this.motionDirectives = this.findMotionDirectives(this.currentView);\n const directivesWithExit = this.motionDirectives.filter(\n directive => directive.exit && Object.keys(directive.exit).length > 0\n );\n\n if (directivesWithExit.length > 0) {\n this.exiting = true;\n directivesWithExit.forEach(directive => directive.runExitAnimation());\n\n // Remove the view after the longest exit animation\n const maxDuration = Math.max(\n ...directivesWithExit.map(d => d.getDuration()),\n 300\n );\n\n if (this.exitTimeout) {\n clearTimeout(this.exitTimeout);\n }\n this.exitTimeout = setTimeout(() => {\n this.exitTimeout = null;\n this.clearView();\n }, maxDuration);\n } else {\n // No exit animation, remove immediately\n this.clearView();\n }\n }\n\n private clearView() {\n if (this.hasView) {\n this.viewContainer.clear();\n this.hasView = false;\n this.exiting = false;\n this.currentView = null;\n this.motionDirectives = [];\n }\n }\n\n private findMotionDirectives(view: EmbeddedViewRef<any> | null): MotionOneDirective[] {\n if (!view) return [];\n \n const directives: MotionOneDirective[] = [];\n \n view.rootNodes.forEach((node: any) => {\n // Check if root node has motion directive\n if (node?._motionDirective) {\n directives.push(node._motionDirective);\n }\n \n // Search children recursively\n if (node?.querySelectorAll) {\n const elements = node.querySelectorAll('[motionone]');\n elements.forEach((el: any) => {\n if (el._motionDirective) {\n directives.push(el._motionDirective);\n }\n });\n }\n });\n \n return directives;\n }\n\n ngOnDestroy() {\n if (this.exitTimeout) {\n clearTimeout(this.exitTimeout);\n }\n this.clearView();\n }\n} ","import {\n Directive,\n Input,\n TemplateRef,\n ViewContainerRef,\n EmbeddedViewRef,\n ElementRef,\n effect,\n signal,\n DestroyRef,\n inject,\n ChangeDetectorRef,\n Renderer2\n} from '@angular/core';\nimport { MotionOneDirective } from './motion-one.directive';\n\n/**\n * Enhanced structural directive for animated presence with proper lifecycle management.\n * Automatically handles enter and exit animations for elements added/removed from DOM.\n * \n * Supports multiple integration patterns:\n * \n * Pattern 1 - Direct with motionone directive:\n * ```html\n * <div *motionPresence=\"show\">\n * <div motionone \n * [initial]=\"{ opacity: 0 }\" \n * [animate]=\"{ opacity: 1 }\"\n * [exit]=\"{ opacity: 0 }\">\n * Content\n * </div>\n * </div>\n * ```\n * \n * Pattern 2 - With animation callbacks:\n * ```html\n * <div *motionPresence=\"show; onEnter: handleEnter; onExit: handleExit\">\n * Content\n * </div>\n * ```\n */\n@Directive({\n selector: '[motionPresence]',\n standalone: true\n})\nexport class MotionPresenceDirective {\n private hasView = false;\n private currentView: EmbeddedViewRef<any> | null = null;\n private exitTimeout: any;\n private destroyRef = inject(DestroyRef);\n\n @Input() motionPresenceOnEnter?: () => void;\n @Input() motionPresenceOnExit?: () => Promise<void>;\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private cdr: ChangeDetectorRef\n ) {\n this.destroyRef.onDestroy(() => {\n if (this.exitTimeout) {\n clearTimeout(this.exitTimeout);\n }\n });\n }\n\n /** True while exit animations run. Bumped exitId cancels an exit in progress. */\n private exiting = false;\n private exitId = 0;\n\n @Input() set motionPresence(condition: boolean) {\n if (condition) {\n if (this.exiting) {\n this.cancelExit();\n } else if (!this.hasView) {\n this.enter();\n }\n } else if (this.hasView && !this.exiting) {\n this.exit();\n }\n }\n\n private enter() {\n // Each motionone in the new view starts its own enter animation, and parents\n // orchestrate their children (stagger). Previously this also replayed every\n // descendant at once on the next tick, which flattened any stagger.\n this.currentView = this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView = true;\n this.cdr.detectChanges();\n\n if (this.motionPresenceOnEnter) {\n const view = this.currentView;\n this.exitTimeout = setTimeout(() => {\n this.exitTimeout = null;\n if (this.currentView === view && !this.exiting) this.motionPresenceOnEnter?.();\n }, 0);\n }\n }\n\n /**\n * Shown again during the exit animation: keep the view and animate back in.\n * Previously the in-flight exit still cleared the view afterwards, so the\n * content disappeared while the condition was true.\n */\n private cancelExit() {\n this.exitId++;\n this.exiting = false;\n this.motionPresenceOnEnter?.();\n // Only the elements that ran an exit animation need to come back\n this.findMotionDirectives(this.currentView)\n .filter(directive => directive.exit && Object.keys(directive.exit).length > 0)\n .forEach(directive => directive.runInitAnimation());\n }\n\n private async exit() {\n if (!this.hasView || !this.currentView) return;\n\n const exitId = ++this.exitId;\n this.exiting = true;\n\n const exitPromises = this.findMotionDirectives(this.currentView)\n .filter(directive => directive.exit && Object.keys(directive.exit).length > 0)\n .map(directive => directive.runExitAnimation());\n\n if (exitPromises.length > 0) {\n await Promise.all(exitPromises);\n }\n\n if (this.motionPresenceOnExit && exitId === this.exitId) {\n await this.motionPresenceOnExit();\n }\n\n // Shown again (or exit restarted) while we were waiting\n if (exitId !== this.exitId || !this.exiting) return;\n\n this.viewContainer.clear();\n this.hasView = false;\n this.exiting = false;\n this.currentView = null;\n }\n\n private findMotionDirectives(view: EmbeddedViewRef<any> | null): MotionOneDirective[] {\n if (!view) return [];\n \n const directives: MotionOneDirective[] = [];\n \n view.rootNodes.forEach((node: any) => {\n if (node?._motionDirective) {\n directives.push(node._motionDirective);\n }\n \n // Search children\n if (node?.querySelectorAll) {\n const elements = node.querySelectorAll('[motionone]');\n elements.forEach((el: any) => {\n if (el._motionDirective) {\n directives.push(el._motionDirective);\n }\n });\n }\n });\n \n return directives;\n }\n}\n","import { Directive, ElementRef, NgZone, afterRenderEffect, inject, input, isDevMode, signal, untracked } from '@angular/core';\n// Imported here, not in MotionAnimationService, so apps that don't use scroll-linked values don't ship it.\nimport { scroll } from 'motion';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** Style keyframes spread across scroll progress: `{ y: [0, -120], opacity: [1, 0] }`. */\nexport type ScrollKeyframes = Record<string, (string | number)[]>;\n\n/**\n * Where a scroll range starts and ends, in Motion's offset syntax: pairs of\n * \"<target edge> <container edge>\", e.g. `['start end', 'end start']` (while the\n * element crosses the viewport) or `['start start', 'end end']` (while a tall\n * section scrolls past a pinned child).\n */\nexport type ScrollOffset = (string | number | [number | string, number | string])[];\n\n/** While the element crosses the visible area of its scroll container. */\nexport const SCROLL_WHILE_VISIBLE: ScrollOffset = ['start end', 'end start'];\n/** While a section taller than the viewport scrolls through it (for pinned/sticky stages). */\nexport const SCROLL_THROUGH: ScrollOffset = ['start start', 'end end'];\n\n/**\n * Scroll-linked values.\n *\n * Maps scroll progress (0 → 1) to styles, and exposes the progress and scroll\n * velocity as signals:\n *\n * <!-- parallax: moves up 120px and fades as it crosses the viewport -->\n * <img [motionScroll]=\"{ y: [0, -120], opacity: [1, 0] }\">\n *\n * <!-- page progress bar -->\n * <div class=\"bar\" [motionScroll]=\"{ scaleX: [0, 1] }\" scrollTarget=\"container\"></div>\n *\n * <!-- pinned stage: read progress from a tall wrapper -->\n * <section motionScroll #story=\"motionScroll\" [scrollOffset]=\"through\" style=\"height: 300vh\">\n * <div class=\"sticky\">{{ story.progress() }}</div>\n * </section>\n *\n * By default it tracks the host element against its nearest scrollable\n * ancestor (or the page). A scrolling ancestor must be positioned\n * (`position: relative` or similar) so offsets are measured from it. The keyframes run as a scroll-driven animation (using\n * the browser's ScrollTimeline when it can), so they never trigger change\n * detection. Reading `progress()` or `velocity()` in a template re-renders that\n * view as you scroll; keep those reads small.\n *\n * With `prefers-reduced-motion: reduce`, keyframes are not applied (the element\n * keeps its normal styles) unless `respectReducedMotion` is false; progress is\n * still tracked.\n */\n@Directive({\n selector: '[motionScroll]',\n exportAs: 'motionScroll',\n})\nexport class MotionScrollDirective {\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly motion = inject(MotionAnimationService);\n private readonly zone = inject(NgZone);\n\n /** Keyframes per style, spread across the scroll range. Empty to only track progress. */\n readonly motionScroll = input<ScrollKeyframes | '' | null | undefined>('');\n /**\n * What to track: the host ('self', default), another element, or the whole\n * scroll container ('container', e.g. for a page progress bar).\n */\n readonly scrollTarget = input<'self' | 'container' | Element>('self');\n /** Scroll container: nearest scrollable ancestor ('auto', default), the page ('page') or an element. */\n readonly scrollContainer = input<'auto' | 'page' | Element>('auto');\n /** Start and end of the range. Defaults to SCROLL_WHILE_VISIBLE for an element target. */\n readonly scrollOffset = input<ScrollOffset | undefined>(undefined);\n readonly scrollAxis = input<'x' | 'y'>('y');\n /** Extra animation options for the keyframes, e.g. `{ ease: 'easeOut' }` or `{ times: [0, 0.3, 1] }`. */\n readonly scrollTransition = input<Record<string, unknown> | undefined>(undefined);\n readonly respectReducedMotion = input(true);\n\n private readonly _progress = signal(0);\n private readonly _velocity = signal(0);\n /** Scroll progress through the range, 0 → 1. */\n readonly progress = this._progress.asReadonly();\n /** Scroll velocity along the axis, in px/s. */\n readonly velocity = this._velocity.asReadonly();\n\n constructor() {\n // After render: the element is in the DOM and styled, so the scroll container can be found. Browser only.\n afterRenderEffect(onCleanup => {\n const keyframes = this.motionScroll();\n const targetInput = this.scrollTarget();\n const containerInput = this.scrollContainer();\n const axis = this.scrollAxis();\n const transition = this.scrollTransition();\n const respect = this.respectReducedMotion();\n const offsetInput = this.scrollOffset();\n\n untracked(() => {\n const container = containerInput === 'page' ? undefined\n : containerInput === 'auto' ? scrollParent(this.el, axis) : containerInput;\n if (container && isDevMode() && getComputedStyle(container).position === 'static') {\n console.warn('[ngx-motion] motionScroll: the scroll container should be positioned (e.g. position: relative), ' +\n 'otherwise scroll ranges are measured from the wrong origin.', container);\n }\n const target = targetInput === 'container' ? undefined : targetInput === 'self' ? this.el : targetInput;\n const offset = offsetInput ?? (target ? SCROLL_WHILE_VISIBLE : undefined);\n const options = { container, target, axis, offset };\n\n const stops: (() => void)[] = [];\n stops.push(this.scroll((p: number, info: any) => {\n this._progress.set(p);\n this._velocity.set(info?.[axis]?.velocity ?? 0);\n }, options));\n\n const reduced = respect && this.motion.reducedMotion();\n if (keyframes && Object.keys(keyframes).length && !reduced) {\n const animation = this.motion.animate(this.el, keyframes, { ease: 'linear', ...transition, duration: 1 });\n stops.push(this.scroll(animation, options));\n stops.push(() => animation.stop?.());\n }\n onCleanup(() => stops.forEach(stop => stop()));\n });\n });\n }\n\n private scroll(onScroll: any, options: object): () => void {\n try {\n return this.zone.runOutsideAngular(() => scroll(onScroll, options as any));\n } catch (e) {\n console.error('[ngx-motion] motionScroll:', e);\n return () => {};\n }\n }\n}\n\n/** The nearest ancestor that scrolls on `axis`, or undefined for the page. */\nfunction scrollParent(el: HTMLElement, axis: 'x' | 'y'): HTMLElement | undefined {\n for (let node = el.parentElement; node && node !== document.body && node !== document.documentElement; node = node.parentElement) {\n const overflow = getComputedStyle(node)[axis === 'y' ? 'overflowY' : 'overflowX'];\n if (overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay') return node;\n }\n return undefined;\n}\n","import { DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, afterNextRender, inject, input, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** Spring used by the pointer directives unless you pass your own. */\nexport const POINTER_SPRING = { type: 'spring', stiffness: 260, damping: 20, mass: 0.6 };\n\n\n\n/**\n * Adds listeners outside Angular's zone (pointer moves never need change\n * detection; signals they set still update views) and removes them on destroy.\n * Call in an injection context.\n */\nfunction listener() {\n const zone = inject(NgZone);\n const destroyRef = inject(DestroyRef);\n return (target: EventTarget, type: string, fn: (e: PointerEvent) => void, options?: AddEventListenerOptions) => {\n const h = fn as EventListener;\n zone.runOutsideAngular(() => target.addEventListener(type, h, options));\n destroyRef.onDestroy(() => target.removeEventListener(type, h, options));\n };\n}\n\n/**\n * Magnetic pull: while a mouse pointer is over (or near) the element, it leans\n * toward the pointer, then springs back when the pointer leaves.\n *\n * <button motionMagnetic>Get started</button>\n * <a [motionMagnetic]=\"0.5\" [magneticRadius]=\"60\">Strong pull, wide reach</a>\n *\n * Moves the element with `x`/`y`, so it composes with scale or rotate from\n * other ngx-motion directives. Touch input and reduced motion are ignored.\n */\n@Directive({ selector: '[motionMagnetic]', exportAs: 'motionMagnetic' })\nexport class MotionMagneticDirective {\n /** How far it follows: 0 (none) to 1 (centre sits under the pointer). Default 0.3. */\n readonly motionMagnetic = input<number | ''>('');\n /** Extra reach around the element, in px. */\n readonly magneticRadius = input(24);\n readonly magneticTransition = input<Record<string, unknown>>(POINTER_SPRING);\n\n private readonly _active = signal(false);\n /** True while the pointer is within reach. */\n readonly active = this._active.asReadonly();\n\n constructor() {\n const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const motion = inject(MotionAnimationService);\n const listen = listener();\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (motion.reducedMotion()) return;\n let x = 0, y = 0;\n listen(document, 'pointermove', e => {\n if (e.pointerType !== 'mouse') return;\n // Measure the resting box: undo the current pull\n const r = el.getBoundingClientRect();\n const left = r.left - x, top = r.top - y, reach = this.magneticRadius();\n const inside = e.clientX >= left - reach && e.clientX <= left + r.width + reach && e.clientY >= top - reach && e.clientY <= top + r.height + reach;\n if (!inside && !this._active()) return;\n const strength = this.motionMagnetic() === '' ? 0.3 : Number(this.motionMagnetic());\n x = inside ? (e.clientX - (left + r.width / 2)) * strength : 0;\n y = inside ? (e.clientY - (top + r.height / 2)) * strength : 0;\n this._active.set(inside);\n motion.animate(el, { x, y }, this.magneticTransition());\n }, { passive: true });\n });\n }\n}\n\n/**\n * 3D tilt toward the pointer, like a card under a light. Also sets\n * `--motion-pointer-x` / `--motion-pointer-y` (0%–100%) on the element for a\n * glare or spotlight in CSS:\n *\n * <article [motionTilt]=\"12\">…</article>\n * .card::after { background: radial-gradient(circle at var(--motion-pointer-x) var(--motion-pointer-y), #fff3, transparent 50%); }\n *\n * Springs back flat when the pointer leaves. With reduced motion it doesn't\n * tilt, but still sets the pointer variables.\n */\n@Directive({ selector: '[motionTilt]', exportAs: 'motionTilt' })\nexport class MotionTiltDirective {\n /** Maximum tilt in degrees. Default 10. */\n readonly motionTilt = input<number | ''>('');\n /** Scale while hovered. */\n readonly tiltScale = input(1.02);\n /** Perspective in px: lower is more dramatic. */\n readonly tiltPerspective = input(900);\n readonly tiltTransition = input<Record<string, unknown>>({ type: 'spring', stiffness: 300, damping: 26 });\n\n private readonly _hovering = signal(false);\n readonly hovering = this._hovering.asReadonly();\n\n constructor() {\n const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const motion = inject(MotionAnimationService);\n const listen = listener();\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const reduced = motion.reducedMotion();\n const max = () => (this.motionTilt() === '' ? 10 : Number(this.motionTilt()));\n listen(el, 'pointermove', e => {\n if (e.pointerType === 'touch') return;\n const r = el.getBoundingClientRect();\n const px = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width));\n const py = Math.min(1, Math.max(0, (e.clientY - r.top) / r.height));\n el.style.setProperty('--motion-pointer-x', `${(px * 100).toFixed(1)}%`);\n el.style.setProperty('--motion-pointer-y', `${(py * 100).toFixed(1)}%`);\n if (!this._hovering()) this._hovering.set(true);\n if (reduced) return;\n motion.animate(el, {\n rotateY: (px - 0.5) * 2 * max(), rotateX: -(py - 0.5) * 2 * max(), scale: this.tiltScale(),\n transformPerspective: this.tiltPerspective(),\n }, this.tiltTransition());\n }, { passive: true });\n listen(el, 'pointerleave', () => {\n this._hovering.set(false);\n if (!reduced) motion.animate(el, { rotateX: 0, rotateY: 0, scale: 1 }, this.tiltTransition());\n });\n });\n }\n}\n\n/**\n * Follows the pointer around a container on a spring: cursor blobs, \"View\"\n * bubbles, spotlights. Position it absolutely at the container's top-left; it\n * is centred on the pointer and scales in when the pointer enters the\n * container and out when it leaves.\n *\n * <section style=\"position: relative\">\n * <div class=\"glow\" motionFollowPointer></div>\n * </section>\n *\n * Mouse and pen only. With reduced motion it jumps to the pointer instead of\n * springing.\n */\n@Directive({ selector: '[motionFollowPointer]', exportAs: 'motionFollowPointer' })\nexport class MotionFollowPointerDirective {\n /** The area it follows within: the parent element (default) or the whole window. */\n readonly motionFollowPointer = input<'parent' | 'window' | Element | ''>('');\n readonly followTransition = input<Record<string, unknown>>({ type: 'spring', stiffness: 180, damping: 22, mass: 0.7 });\n /** Scale in and out with the pointer entering and leaving. Set false to keep it shown. */\n readonly followHide = input(true);\n\n private readonly _active = signal(false);\n /** True while the pointer is inside the area. */\n readonly active = this._active.asReadonly();\n\n constructor() {\n const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const motion = inject(MotionAnimationService);\n const listen = listener();\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const reduced = motion.reducedMotion();\n const mode = this.motionFollowPointer();\n const area: HTMLElement | null = mode instanceof Element ? (mode as HTMLElement) : mode === 'window' ? null : el.parentElement;\n if (this.followHide()) motion.animate(el, { scale: 0, opacity: 0 }, { duration: 0 });\n let placed = false;\n\n listen(area ?? document, 'pointermove', e => {\n if (e.pointerType === 'touch') return;\n // Relative to the element's own offset parent, centred on the pointer\n const origin = (el.offsetParent as HTMLElement | null)?.getBoundingClientRect() ?? { left: 0, top: 0 };\n const x = e.clientX - origin.left - el.offsetLeft - el.offsetWidth / 2;\n const y = e.clientY - origin.top - el.offsetTop - el.offsetHeight / 2;\n // The first move jumps there, so it doesn't fly in from the corner\n motion.animate(el, { x, y }, reduced || !placed ? { duration: 0 } : this.followTransition());\n placed = true;\n if (!this._active()) {\n this._active.set(true);\n if (this.followHide()) motion.animate(el, { scale: 1, opacity: 1 }, { duration: reduced ? 0 : 0.25 });\n }\n }, { passive: true });\n listen(area ?? document.documentElement, 'pointerleave', () => {\n this._active.set(false);\n placed = false;\n if (this.followHide()) motion.animate(el, { scale: 0, opacity: 0 }, { duration: reduced ? 0 : 0.2 });\n });\n });\n }\n}\n","import { DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, afterNextRender, inject, input, output, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** Limits for the drag offset, in px from where the element rests. */\nexport interface DragBounds { top?: number; right?: number; bottom?: number; left?: number; }\n\n/** Offsets the element settles on after a release, per axis. */\nexport interface DragSnap { x?: number[]; y?: number[]; }\n\nexport interface DragInfo {\n /** Current offset from the resting position. */\n x: number;\n y: number;\n /** Offset since the drag started. */\n offset: { x: number; y: number };\n /** Pointer velocity in px/s. */\n velocity: { x: number; y: number };\n}\n\nconst SETTLE = { type: 'spring', stiffness: 380, damping: 38 };\n\n/**\n * Settings another directive on the same element can impose (e.g. a reorder\n * item fixes the axis and always settles back to its slot).\n * @internal\n */\nexport interface DragOverrides {\n axis?: 'x' | 'y' | 'both';\n constraints?: DragBounds;\n elastic?: number;\n momentum?: boolean;\n}\n\n/**\n * Drag with constraints, elastic edges, momentum and snap points.\n *\n * <div motionDrag>free drag</div>\n * <div motionDrag=\"x\" dragConstraints=\"parent\">a track inside its window</div>\n * <div motionDrag=\"x\" [dragSnap]=\"{ x: [0, -320, -640] }\" (dragEnd)=\"onEnd($event)\">a snapping carousel</div>\n *\n * - Moves the element with `x`/`y`, so it composes with whileTap scale etc.\n * Don't give the element a CSS transform of its own (wrap it instead).\n * - Starts after the pointer moves `dragThreshold` px, so clicks on links and\n * buttons inside still work; the click that ends a drag is swallowed.\n * - Sets `touch-action` so the other axis keeps scrolling on touch screens.\n * - On release it glides on (momentum) and settles inside the constraints, or\n * on the snap point nearest to where it was heading.\n */\n@Directive({\n selector: '[motionDrag]',\n exportAs: 'motionDrag',\n host: { '[style.touch-action]': 'touchAction()', '[class.motion-dragging]': 'dragging()' },\n})\nexport class MotionDragDirective {\n /** Axis: 'x', 'y', or both (default, also for an empty attribute). */\n readonly motionDrag = input<'x' | 'y' | 'both' | ''>('');\n /** 'parent' keeps the element within its parent; or pixel bounds from the resting position; or an element. */\n readonly dragConstraints = input<'parent' | DragBounds | Element | null>(null);\n /** How far it stretches past the constraints: 0 (hard stop) to 1 (no resistance). */\n readonly dragElastic = input(0.35);\n /** Keep moving after release, in the direction it was thrown. */\n readonly dragMomentum = input(true);\n readonly dragSnap = input<DragSnap | null>(null);\n /** Spring used to settle after release and for moveTo(). */\n readonly dragTransition = input<Record<string, unknown>>(SETTLE);\n readonly dragThreshold = input(3);\n readonly dragDisabled = input(false);\n\n readonly dragStart = output<DragInfo>();\n readonly dragMove = output<DragInfo>();\n readonly dragEnd = output<DragInfo>();\n\n private readonly _x = signal(0);\n private readonly _y = signal(0);\n private readonly _dragging = signal(false);\n /** Offset from the resting position, updated as it moves (also while settling). */\n readonly x = this._x.asReadonly();\n readonly y = this._y.asReadonly();\n readonly dragging = this._dragging.asReadonly();\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly motion = inject(MotionAnimationService);\n private readonly zone = inject(NgZone);\n private settle?: { stop(): void; then(fn: () => void): Promise<void> };\n private raf = 0;\n /** Offset when the current drag started, and its limits (both in offset space). */\n private start = { x: 0, y: 0 };\n private limits: Required<DragBounds> = { top: -Infinity, left: -Infinity, right: Infinity, bottom: Infinity };\n\n /** @internal Set by directives that build on drag (see DragOverrides). */\n readonly overrides = signal<DragOverrides>({});\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n afterNextRender(() => this.zone.runOutsideAngular(() => this.bind(destroyRef)));\n destroyRef.onDestroy(() => { cancelAnimationFrame(this.raf); this.settle?.stop(); });\n }\n\n touchAction() {\n const axis = this.axis();\n return this.dragDisabled() ? null : axis === 'x' ? 'pan-y' : axis === 'y' ? 'pan-x' : 'none';\n }\n\n /** Move to an offset (e.g. from prev/next buttons), on the drag spring unless you pass a transition. */\n moveTo(x: number, y = this._y(), transition: Record<string, unknown> = this.dragTransition()) {\n this.zone.runOutsideAngular(() => this.glide({ x, y }, transition, { x: 0, y: 0 }));\n }\n\n /**\n * The element's resting place moved by (dx, dy) in the layout (e.g. it was\n * moved in the DOM mid-drag). Shift the offset the other way so it stays\n * where it is on screen, under the pointer.\n */\n rebase(dx: number, dy: number) {\n if (!dx && !dy) return;\n this.start = { x: this.start.x - dx, y: this.start.y - dy };\n const x = this._x() - dx, y = this._y() - dy;\n this._x.set(x); this._y.set(y);\n this.motion.animate(this.el, { x, y }, { duration: 0 });\n if (this._dragging()) this.limits = this.bounds();\n }\n\n private axis() { return this.overrides().axis ?? this.motionDrag(); }\n private axisX() { return this.axis() !== 'y'; }\n private axisY() { return this.axis() !== 'x'; }\n\n /** The offset actually on screen (mid-animation included). */\n private read() {\n const m = new DOMMatrix(getComputedStyle(this.el).transform);\n return { x: m.m41, y: m.m42 };\n }\n\n /** Animate to an offset, keeping the x/y signals in step each frame. */\n private glide(to: { x: number; y: number }, t: Record<string, unknown>, velocity: { x: number; y: number }) {\n this.settle?.stop();\n const settle = this.motion.animate(this.el, to, { ...t, x: { ...t, velocity: velocity.x }, y: { ...t, velocity: velocity.y } });\n this.settle = settle;\n cancelAnimationFrame(this.raf);\n const tick = () => {\n if (this.settle !== settle) return;\n const p = this.read();\n this._x.set(p.x); this._y.set(p.y);\n this.raf = requestAnimationFrame(tick);\n };\n this.raf = requestAnimationFrame(tick);\n settle.then(() => {\n if (this.settle !== settle) return;\n cancelAnimationFrame(this.raf);\n this.settle = undefined;\n this._x.set(to.x); this._y.set(to.y);\n });\n }\n\n private bounds(): Required<DragBounds> {\n const c = this.overrides().constraints ?? this.dragConstraints();\n const none = { top: -Infinity, left: -Infinity, right: Infinity, bottom: Infinity };\n if (!c) return none;\n if (c === 'parent' || c instanceof Element) {\n const box = c === 'parent' ? this.el.parentElement : (c as Element);\n if (!box) return none;\n const p = box.getBoundingClientRect();\n const r = this.el.getBoundingClientRect();\n // Resting box: where it would be with no drag offset\n const left = r.left - this._x(), top = r.top - this._y();\n // Between \"left edges aligned\" and \"right edges aligned\": keeps a smaller\n // element inside the box, and a larger one (a carousel track) covering it\n const ax = p.left - left, bx = p.right - (left + r.width);\n const ay = p.top - top, by = p.bottom - (top + r.height);\n return { left: Math.min(ax, bx), right: Math.max(ax, bx), top: Math.min(ay, by), bottom: Math.max(ay, by) };\n }\n const b = c as DragBounds;\n return { top: b.top ?? -Infinity, left: b.left ?? -Infinity, right: b.right ?? Infinity, bottom: b.bottom ?? Infinity };\n }\n\n private elastic(v: number, min: number, max: number) {\n const e = this.overrides().elastic ?? this.dragElastic();\n if (v < min) return min + (v - min) * e;\n if (v > max) return max + (v - max) * e;\n return v;\n }\n\n private target(pos: number, v: number, min: number, max: number, snap: number[] | undefined) {\n // Where a throw would carry it (as a decaying glide), then held inside the bounds\n const projected = (this.overrides().momentum ?? this.dragMomentum()) ? pos + v * 0.2 : pos;\n if (snap?.length) {\n const within = snap.filter(s => s >= min && s <= max);\n const points = within.length ? within : snap;\n return points.reduce((best, s) => (Math.abs(s - projected) < Math.abs(best - projected) ? s : best), points[0]);\n }\n return Math.min(max, Math.max(min, projected));\n }\n\n private info(velocity: { x: number; y: number }): DragInfo {\n const x = this._x(), y = this._y(), start = this.start;\n return { x, y, offset: { x: x - start.x, y: y - start.y }, velocity };\n }\n\n private bind(destroyRef: DestroyRef) {\n const el = this.el;\n const on = <K extends keyof HTMLElementEventMap>(t: EventTarget, type: K, fn: (e: HTMLElementEventMap[K]) => void, opts?: AddEventListenerOptions) => {\n t.addEventListener(type, fn as EventListener, opts);\n destroyRef.onDestroy(() => t.removeEventListener(type, fn as EventListener, opts));\n };\n\n let pointer: number | null = null;\n let origin = { x: 0, y: 0 }, last = { x: 0, y: 0, t: 0 }, velocity = { x: 0, y: 0 };\n let moved = false;\n let swallowClick = false;\n\n const set = (x: number, y: number) => {\n this._x.set(x); this._y.set(y);\n this.motion.animate(el, { x, y }, { duration: 0 });\n };\n\n on(el, 'dragstart', e => e.preventDefault());\n on(el, 'pointerdown', e => {\n if (this.dragDisabled() || e.button !== 0 || pointer !== null) return;\n pointer = e.pointerId;\n moved = false;\n // Catch it mid-settle where it is\n this.settle?.stop();\n this.settle = undefined;\n cancelAnimationFrame(this.raf);\n const now = this.read();\n this._x.set(now.x); this._y.set(now.y);\n origin = { x: e.clientX, y: e.clientY };\n this.start = { x: now.x, y: now.y };\n last = { x: e.clientX, y: e.clientY, t: e.timeStamp };\n velocity = { x: 0, y: 0 };\n });\n // Moves and release are heard on the window from pointerdown on: a quick first\n // movement can leave the element before the drag has started\n on(window, 'pointermove', e => {\n if (e.pointerId !== pointer) return;\n const dx = this.axisX() ? e.clientX - origin.x : 0;\n const dy = this.axisY() ? e.clientY - origin.y : 0;\n if (!moved) {\n if (Math.hypot(dx, dy) < this.dragThreshold()) return;\n moved = true;\n this.limits = this.bounds();\n el.setPointerCapture(e.pointerId);\n this._dragging.set(true);\n this.dragStart.emit(this.info(velocity));\n }\n const dt = Math.max(1, e.timeStamp - last.t) / 1000;\n // Smoothed pointer velocity\n velocity = {\n x: velocity.x * 0.2 + ((e.clientX - last.x) / dt) * 0.8,\n y: velocity.y * 0.2 + ((e.clientY - last.y) / dt) * 0.8,\n };\n last = { x: e.clientX, y: e.clientY, t: e.timeStamp };\n const start = this.start, bounds = this.limits;\n set(\n this.axisX() ? this.elastic(start.x + dx, bounds.left, bounds.right) : start.x,\n this.axisY() ? this.elastic(start.y + dy, bounds.top, bounds.bottom) : start.y,\n );\n this.dragMove.emit(this.info(velocity));\n });\n const end = (e: PointerEvent) => {\n if (e.pointerId !== pointer) return;\n pointer = null;\n if (!moved) return;\n swallowClick = true;\n setTimeout(() => (swallowClick = false));\n // A pause before letting go means no throw\n if (e.timeStamp - last.t > 80) velocity = { x: 0, y: 0 };\n if (!this.axisX()) velocity.x = 0;\n if (!this.axisY()) velocity.y = 0;\n this._dragging.set(false);\n const snap = this.dragSnap(), bounds = this.limits, start = this.start;\n const x = this.target(this._x(), velocity.x, bounds.left, bounds.right, this.axisX() ? snap?.x : undefined);\n const y = this.target(this._y(), velocity.y, bounds.top, bounds.bottom, this.axisY() ? snap?.y : undefined);\n this.glide({ x, y }, this.dragTransition(), velocity);\n this.dragEnd.emit({ x, y, offset: { x: x - start.x, y: y - start.y }, velocity });\n };\n on(window, 'pointerup', end);\n on(window, 'pointercancel', end);\n // The click that ends a drag is not a click\n on(el, 'click', e => { if (swallowClick) { e.preventDefault(); e.stopPropagation(); swallowClick = false; } }, { capture: true });\n }\n}\n","import { DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, afterNextRender, inject, input, output, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\ntype Point = { x: number; y: number };\n\nexport interface PanInfo {\n /** Pointer position, relative to the viewport. */\n point: Point;\n /** Movement since the last event. */\n delta: Point;\n /** Movement since the pan started (from where the pointer went down). */\n offset: Point;\n /** Pointer velocity in px/s. */\n velocity: Point;\n}\n\nexport type SwipeDirection = 'left' | 'right' | 'up' | 'down';\nexport interface SwipeInfo extends PanInfo { direction: SwipeDirection; }\n\n/** Neutral values the `whilePan` transforms return to. */\nconst NEUTRAL: Record<string, number> = {\n x: 0, y: 0, z: 0, rotate: 0, rotateX: 0, rotateY: 0, rotateZ: 0, skew: 0, skewX: 0, skewY: 0,\n scale: 1, scaleX: 1, scaleY: 1, scaleZ: 1,\n};\nconst RELEASE = { type: 'spring', stiffness: 500, damping: 35 };\n\n/**\n * Pan and swipe gestures: pointer movement reported as events, without moving\n * the element (use motionDrag for that).\n *\n * <div motionPan (pan)=\"rotate($event.delta.x)\" (swipe)=\"onSwipe($event.direction)\"\n * [whilePan]=\"{ scale: 0.97 }\">…</div>\n *\n * - A pan starts once the pointer has moved `panThreshold` px; clicks still work.\n * - `swipe` fires on release when the pan went far enough (`swipeDistance`) or\n * fast enough (`swipeVelocity`) along its main axis.\n * - `whilePan` styles apply while panning. On release, transforms (x, scale,\n * rotate…) return to neutral and other styles to what they were before.\n * - `panAxis` limits panning to one axis and lets the other scroll on touch\n * screens (sets `touch-action`).\n */\n@Directive({\n selector: '[motionPan]',\n exportAs: 'motionPan',\n host: { '[style.touch-action]': 'touchAction()', '[class.motion-panning]': 'panning()' },\n})\nexport class MotionPanDirective {\n /** Axis to pan on: 'x', 'y' or both (default, also for an empty attribute). */\n readonly motionPan = input<'x' | 'y' | 'both' | ''>('');\n readonly panThreshold = input(3);\n readonly swipeDistance = input(50);\n readonly swipeVelocity = input(500);\n readonly whilePan = input<Record<string, unknown> | null>(null);\n readonly panTransition = input<Record<string, unknown>>(RELEASE);\n readonly panDisabled = input(false);\n\n readonly panStart = output<PanInfo>();\n readonly pan = output<PanInfo>();\n readonly panEnd = output<PanInfo>();\n readonly swipe = output<SwipeInfo>();\n\n private readonly _panning = signal(false);\n readonly panning = this._panning.asReadonly();\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly motion = inject(MotionAnimationService);\n private readonly zone = inject(NgZone);\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n afterNextRender(() => this.zone.runOutsideAngular(() => this.bind(destroyRef)));\n }\n\n touchAction() {\n const axis = this.motionPan();\n return this.panDisabled() ? null : axis === 'x' ? 'pan-y' : axis === 'y' ? 'pan-x' : 'none';\n }\n\n /** The swipe a pan describes, if it went far or fast enough. */\n static swipeOf(info: PanInfo, distance: number, speed: number, axis: 'x' | 'y' | 'both' | '' = ''): SwipeDirection | null {\n const horizontal = axis === 'x' || (axis !== 'y' && Math.abs(info.offset.x) >= Math.abs(info.offset.y));\n const d = horizontal ? info.offset.x : info.offset.y;\n const v = horizontal ? info.velocity.x : info.velocity.y;\n // A fast flick counts only when it goes the same way as the pan\n if (Math.abs(d) < distance && (Math.abs(v) < speed || Math.sign(v) !== Math.sign(d))) return null;\n return horizontal ? (d > 0 ? 'right' : 'left') : (d > 0 ? 'down' : 'up');\n }\n\n private bind(destroyRef: DestroyRef) {\n const el = this.el;\n const on = <K extends keyof HTMLElementEventMap>(t: EventTarget, type: K, fn: (e: HTMLElementEventMap[K]) => void, opts?: AddEventListenerOptions) => {\n t.addEventListener(type, fn as EventListener, opts);\n destroyRef.onDestroy(() => t.removeEventListener(type, fn as EventListener, opts));\n };\n\n let pointer: number | null = null;\n let moved = false, swallowClick = false;\n let origin: Point = { x: 0, y: 0 }, last = { x: 0, y: 0, t: 0 }, velocity: Point = { x: 0, y: 0 }, delta: Point = { x: 0, y: 0 };\n let rest: Record<string, unknown> = {};\n\n const info = (e: PointerEvent): PanInfo => {\n const axis = this.motionPan();\n return {\n point: { x: e.clientX, y: e.clientY },\n delta: { x: axis === 'y' ? 0 : delta.x, y: axis === 'x' ? 0 : delta.y },\n offset: { x: axis === 'y' ? 0 : e.clientX - origin.x, y: axis === 'x' ? 0 : e.clientY - origin.y },\n velocity: { x: axis === 'y' ? 0 : velocity.x, y: axis === 'x' ? 0 : velocity.y },\n };\n };\n const emit = <T>(out: { emit(v: T): void }, v: T) => this.zone.run(() => out.emit(v));\n\n on(el, 'pointerdown', e => {\n if (this.panDisabled() || e.button !== 0 || pointer !== null) return;\n pointer = e.pointerId;\n moved = false;\n origin = { x: e.clientX, y: e.clientY };\n last = { x: e.clientX, y: e.clientY, t: e.timeStamp };\n velocity = { x: 0, y: 0 };\n });\n on(window, 'pointermove', e => {\n if (e.pointerId !== pointer) return;\n const axis = this.motionPan();\n const dx = axis === 'y' ? 0 : e.clientX - origin.x, dy = axis === 'x' ? 0 : e.clientY - origin.y;\n if (!moved) {\n if (Math.hypot(dx, dy) < this.panThreshold()) return;\n moved = true;\n el.setPointerCapture?.(e.pointerId);\n this._panning.set(true);\n const to = this.whilePan();\n if (to) {\n const { transition, ...styles } = to;\n rest = this.restingValues(styles);\n this.motion.animate(el, styles, (transition as Record<string, unknown>) ?? this.panTransition());\n }\n delta = { x: 0, y: 0 };\n emit(this.panStart, info(e));\n }\n const dt = Math.max(1, e.timeStamp - last.t) / 1000;\n delta = { x: e.clientX - last.x, y: e.clientY - last.y };\n velocity = { x: velocity.x * 0.2 + (delta.x / dt) * 0.8, y: velocity.y * 0.2 + (delta.y / dt) * 0.8 };\n last = { x: e.clientX, y: e.clientY, t: e.timeStamp };\n emit(this.pan, info(e));\n });\n const end = (e: PointerEvent) => {\n if (e.pointerId !== pointer) return;\n pointer = null;\n if (!moved) return;\n swallowClick = true;\n setTimeout(() => (swallowClick = false));\n if (e.timeStamp - last.t > 80) velocity = { x: 0, y: 0 };\n delta = { x: 0, y: 0 };\n this._panning.set(false);\n if (this.whilePan()) this.motion.animate(el, rest, this.panTransition());\n const done = info(e);\n emit(this.panEnd, done);\n const direction = e.type === 'pointerup' ? MotionPanDirective.swipeOf(done, this.swipeDistance(), this.swipeVelocity(), this.motionPan()) : null;\n if (direction) emit(this.swipe, { ...done, direction });\n };\n on(window, 'pointerup', end);\n on(window, 'pointercancel', end);\n on(el, 'click', e => { if (swallowClick) { e.preventDefault(); e.stopPropagation(); swallowClick = false; } }, { capture: true });\n }\n\n /** What each whilePan style returns to: neutral for transforms, the current value for the rest. */\n private restingValues(to: Record<string, unknown>) {\n const style = getComputedStyle(this.el);\n const rest: Record<string, unknown> = {};\n for (const key of Object.keys(to)) {\n if (key in NEUTRAL) rest[key] = NEUTRAL[key];\n else rest[key] = style.getPropertyValue(key.replace(/[A-Z]/g, c => '-' + c.toLowerCase())) || (style as unknown as Record<string, string>)[key];\n }\n return rest;\n }\n}\n","import {\n DestroyRef, Directive, ElementRef, Injector, NgZone, afterNextRender, effect, forwardRef, inject, input, model, output,\n} from '@angular/core';\nimport { MotionAnimationService } from '../services/motion-animation.service';\nimport { MotionDragDirective } from './motion-drag.directive';\n\nconst LAYOUT_SPRING = { type: 'spring', stiffness: 550, damping: 45 };\n\n/**\n * Drag-to-reorder lists, like Framer Motion's Reorder.Group / Reorder.Item.\n *\n * <ul [(motionReorderGroup)]=\"items\" reorderAxis=\"y\">\n * @for (item of items(); track item) {\n * <li [motionReorderItem]=\"item\" tabindex=\"0\">{{ item }}</li>\n * }\n * </ul>\n *\n * - Drag an item along the axis; once it passes the middle of its neighbour\n * the array is reordered (two-way bound, so `items` updates as you drag)\n * and the other items glide to their new places.\n * - On release it springs into its new slot and `reorderEnd` fires with the\n * final order.\n * - Keyboard: on a focused item, Alt + arrow keys move it one place.\n * - Track items by identity in `@for` (not `$index`), so the elements move\n * with their values. Items can have different sizes.\n */\n@Directive({\n selector: '[motionReorderGroup]',\n exportAs: 'motionReorderGroup',\n})\nexport class MotionReorderGroupDirective<T = unknown> {\n /** The values, in order. Bind two-way: `[(motionReorderGroup)]=\"items\"`. */\n readonly motionReorderGroup = model.required<T[]>();\n readonly reorderAxis = input<'x' | 'y'>('y');\n /** Spring the other items move on. */\n readonly reorderTransition = input<Record<string, unknown>>(LAYOUT_SPRING);\n /** The order after a drag or key move ends. */\n readonly reorderEnd = output<T[]>();\n\n private readonly items = new Set<MotionReorderItemDirective<T>>();\n private readonly motion = inject(MotionAnimationService);\n private readonly zone = inject(NgZone);\n private readonly injector = inject(Injector);\n /** A reorder waiting for the DOM to catch up. */\n private pending = false;\n\n /** @internal */\n register(item: MotionReorderItemDirective<T>) {\n this.items.add(item);\n return () => this.items.delete(item);\n }\n\n /** @internal An item moved by `offset` along the axis while dragged: swap it with a neighbour it has passed. */\n dragged(item: MotionReorderItemDirective<T>, offset: number, direction: number) {\n if (this.pending || !direction) return;\n const values = this.motionReorderGroup();\n const i = values.indexOf(item.motionReorderItem());\n if (i < 0) return;\n const lo = this.pos(item.el) + offset, hi = lo + this.size(item.el);\n const neighbour = this.find(values[i + direction]);\n if (!neighbour) return;\n const middle = this.pos(neighbour.el) + this.size(neighbour.el) / 2;\n if (direction > 0 ? hi > middle : lo < middle) this.move(item, i + direction);\n }\n\n /** @internal Move an item to a new index, animating the others into place. */\n move(item: MotionReorderItemDirective<T>, to: number) {\n const values = this.motionReorderGroup();\n const from = values.indexOf(item.motionReorderItem());\n if (from < 0 || to < 0 || to >= values.length || to === from || this.pending) return false;\n const before = new Map([...this.items].map(it => [it, this.pos(it.el)]));\n const next = [...values];\n next.splice(to, 0, ...next.splice(from, 1));\n this.pending = true;\n // Register before the change: set from outside the zone, the render runs\n // synchronously as zone.run exits, and a hook registered after it would\n // wait a frame, painting the moved items at their new places first.\n afterNextRender(() => {\n this.pending = false;\n const axis = this.reorderAxis();\n for (const it of this.items) {\n const was = before.get(it);\n if (was === undefined) continue;\n const moved = this.pos(it.el) - was;\n if (!moved) continue;\n if (it === item && it.drag.dragging()) {\n // Keep it under the pointer\n it.drag.rebase(axis === 'x' ? moved : 0, axis === 'y' ? moved : 0);\n } else {\n // Start from where it was on screen and glide into its new place\n const m = new DOMMatrix(getComputedStyle(it.el).transform);\n const now = (axis === 'x' ? m.m41 : m.m42) - moved;\n // Put it back where it was before this frame paints; the animation's first frame comes later\n it.el.style.transform = axis === 'x' ? `translateX(${now}px)` : `translateY(${now}px)`;\n this.zone.runOutsideAngular(() => this.motion.animate(it.el, { [axis]: [now, 0] }, this.reorderTransition()));\n }\n }\n }, { injector: this.injector });\n this.zone.run(() => this.motionReorderGroup.set(next));\n return true;\n }\n\n /** @internal */\n ended() {\n this.reorderEnd.emit(this.motionReorderGroup());\n }\n\n private find(value: T | undefined) {\n if (value === undefined) return undefined;\n for (const it of this.items) if (it.motionReorderItem() === value) return it;\n return undefined;\n }\n // Layout position (transforms ignored), so items mid-animation still count where they will land\n private pos(el: HTMLElement) { return this.reorderAxis() === 'x' ? el.offsetLeft : el.offsetTop; }\n private size(el: HTMLElement) { return this.reorderAxis() === 'x' ? el.offsetWidth : el.offsetHeight; }\n}\n\n/**\n * An item in a `motionReorderGroup`. Draggable along the group's axis; it\n * springs back into its slot on release. Accepts motionDrag's `dragTransition`\n * and `dragDisabled`, and emits `dragStart` / `dragMove` / `dragEnd`. Raised\n * (z-index 1) while it is away from its slot.\n */\n@Directive({\n selector: '[motionReorderItem]',\n exportAs: 'motionReorderItem',\n hostDirectives: [{\n directive: MotionDragDirective,\n inputs: ['dragTransition', 'dragDisabled'],\n outputs: ['dragStart', 'dragMove', 'dragEnd'],\n }],\n host: {\n '[style.position]': '\"relative\"',\n '[style.z-index]': 'raised() ? 1 : null',\n '(keydown)': 'onKey($event)',\n },\n})\nexport class MotionReorderItemDirective<T = unknown> {\n readonly motionReorderItem = input.required<T>();\n\n /** @internal */\n readonly drag = inject(MotionDragDirective, { self: true });\n /** @internal */\n readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly group = inject<MotionReorderGroupDirective<T>>(forwardRef(() => MotionReorderGroupDirective));\n\n constructor() {\n const unregister = this.group.register(this);\n inject(DestroyRef).onDestroy(unregister);\n effect(() => {\n // Free along the axis, and always back to the slot on release\n this.drag.overrides.set({ axis: this.group.reorderAxis(), constraints: { top: 0, right: 0, bottom: 0, left: 0 }, elastic: 1, momentum: false });\n });\n let last = 0;\n this.drag.dragStart.subscribe(() => (last = 0));\n this.drag.dragMove.subscribe(() => {\n const offset = this.offset();\n const direction = Math.sign(offset - last);\n last = offset;\n this.group.dragged(this, offset, direction);\n });\n this.drag.dragEnd.subscribe(() => this.group.ended());\n }\n\n raised() {\n return this.drag.dragging() || this.drag.x() !== 0 || this.drag.y() !== 0;\n }\n\n onKey(e: KeyboardEvent) {\n if (!e.altKey || e.target !== this.el) return;\n const axis = this.group.reorderAxis();\n const step = axis === 'y'\n ? (e.key === 'ArrowUp' ? -1 : e.key === 'ArrowDown' ? 1 : 0)\n : (e.key === 'ArrowLeft' ? -1 : e.key === 'ArrowRight' ? 1 : 0);\n if (!step) return;\n e.preventDefault();\n const values = this.group.motionReorderGroup();\n const i = values.indexOf(this.motionReorderItem());\n if (this.group.move(this, i + step)) {\n // Moving the element in the DOM can drop focus\n afterNextRender(() => { this.el.focus(); this.group.ended(); }, { injector: this.injector });\n }\n }\n\n private readonly injector = inject(Injector);\n private offset() { return this.group.reorderAxis() === 'x' ? this.drag.x() : this.drag.y(); }\n}\n","import { DestroyRef, Directive, ElementRef, Injectable, NgZone, PLATFORM_ID, afterEveryRender, inject, input, output, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** A layout box: centre and size, in layout coordinates (transforms and scrolling ignored). */\ninterface Box { cx: number; cy: number; w: number; h: number; }\n/** The directive's own transform: offset from the layout box, and scale. */\ninterface Offset { x: number; y: number; sx: number; sy: number; }\n\nconst NONE: Offset = { x: 0, y: 0, sx: 1, sy: 1 };\nconst LAYOUT_SPRING = { type: 'spring', stiffness: 300, damping: 34, mass: 1 };\nconst CORNERS = ['TopLeft', 'TopRight', 'BottomRight', 'BottomLeft'] as const;\n\n/** What the registry needs from a member. @internal */\ninterface Member {\n /** Become the visible one again and fly in from where the last lead was (viewport box). */\n resume(from: Box | undefined): void;\n setHidden(hidden: boolean): void;\n}\n\n/**\n * Shared layout ids. For each id: the mounted elements (the newest one, the\n * lead, is shown and the others are hidden) and where the id was last drawn,\n * in viewport coordinates so it holds across scroll containers.\n * @internal\n */\n@Injectable({ providedIn: 'root' })\nexport class MotionLayoutRegistry {\n private readonly seen = new Map<string, { owner: object; box: Box }>();\n private readonly stacks = new Map<string, Member[]>();\n\n record(id: string, owner: object, box: Box) { this.seen.set(id, { owner, box }); }\n /** The box another element left for this id, if any. */\n from(id: string, owner: object): Box | undefined {\n const s = this.seen.get(id);\n return s && s.owner !== owner ? s.box : undefined;\n }\n\n /** A new element with this id: it leads, and the one it took over from is hidden. */\n join(id: string, m: Member) {\n const stack = this.stacks.get(id) ?? [];\n stack.at(-1)?.setHidden(true);\n stack.push(m);\n this.stacks.set(id, stack);\n }\n\n /** An element with this id is going: if it led, the one before it comes back from its box. */\n leave(id: string, m: Member) {\n const stack = this.stacks.get(id) ?? [];\n const wasLead = stack.at(-1) === m;\n const i = stack.indexOf(m);\n if (i >= 0) stack.splice(i, 1);\n if (!stack.length) this.stacks.delete(id);\n const last = this.seen.get(id);\n if (wasLead && stack.length) {\n stack.at(-1)!.resume(last?.owner === m ? last.box : undefined);\n } else if (last?.owner === m) {\n // Keep the box for a moment: the element taking over usually mounts in the same render\n setTimeout(() => { if (this.seen.get(id) === last) this.seen.delete(id); }, 1000);\n }\n }\n}\n\n/**\n * Layout animations, like Framer Motion's `layout` and `layoutId`.\n *\n * <!-- Glides to its new place (and size) whenever the layout changes -->\n * <li motionLayout>…</li>\n * <div motionLayout=\"position\">only moves; size changes jump</div>\n *\n * <!-- Shared element: a new element with the same id starts where the old one was -->\n * @for (tab of tabs; track tab) {\n * <button (click)=\"active = tab\">{{ tab }}\n * @if (active === tab) { <span class=\"underline\" motionLayoutId=\"underline\"></span> }\n * </button>\n * }\n *\n * After every render it measures the element's layout box (offsets, so\n * transforms and scrolling don't count). When the box has changed, it jumps\n * back to where it was drawn (FLIP) and springs to the new place: x/y for\n * position, scaleX/scaleY for size. Every element is measured after every\n * render, so siblings that weren't re-rendered animate too (no LayoutGroup\n * needed). Interrupted animations continue from where they are. Resizing the\n * window re-measures without animating, and with reduced motion it doesn't\n * animate.\n *\n * Shared ids: while two elements with the same id are mounted (a thumbnail\n * and its open lightbox), the newer one is shown and the older one hidden;\n * when the newer one is removed, the older one reappears and flies back from\n * where it was.\n *\n * - Size changes scale the element. Corner radii are corrected; mark content\n * with `motionLayoutCorrect` to counter-scale it (it keeps its own size),\n * or use \"position\".\n * - Uses transform (centre origin); don't give the element a CSS transform\n * of its own, wrap it instead.\n * - Has the class `motion-layout-animating` while it moves (to raise it with\n * a z-index, for example).\n */\n@Directive({\n selector: '[motionLayout], [motionLayoutId]',\n exportAs: 'motionLayout',\n})\nexport class MotionLayoutDirective implements Member {\n /** What animates: both (default, also for an empty attribute), 'position' or 'size'. */\n readonly motionLayout = input<'position' | 'size' | 'both' | '' | boolean>('');\n /** Shared layout id: an element with the same id that appears takes over from this one. */\n readonly motionLayoutId = input<string | null | undefined>(null);\n readonly layoutTransition = input<Record<string, unknown>>(LAYOUT_SPRING);\n readonly layoutAnimationStart = output<void>();\n readonly layoutAnimationComplete = output<void>();\n\n private readonly _animating = signal(false);\n readonly animating = this._animating.asReadonly();\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly motion = inject(MotionAnimationService);\n private readonly registry = inject(MotionLayoutRegistry);\n private prev: Box | null = null;\n /** Layout box to viewport offset (scrolling), measured for shared ids only. */\n private shift = { x: 0, y: 0 };\n private cur: Offset = NONE;\n private controls?: { stop(): void };\n private run?: object;\n /** Measure again without animating (after a window resize). */\n private resnap = false;\n /** The id this element joined the registry with. */\n private joined: string | null = null;\n /** Fly in from here (a viewport box) at the next update: the lead with our id went away. */\n private resumeFrom: Box | undefined;\n /** Corner radii (px) while scaling; null when there are none to correct. */\n private radii: number[] | null = null;\n /** The element's own inline border-radius, put back afterwards. */\n private inlineRadius = '';\n private readonly reduced = inject(MotionAnimationService).reducedMotion();\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n afterEveryRender({ earlyRead: () => this.measure(), write: box => this.update(box) });\n // A window resize moves things without animating: re-measure now, and snap\n // whatever renders before the next frame (breakpoint changes and the like)\n let raf = 0;\n const resize = () => {\n this.resnap = true;\n this.controls?.stop();\n this.controls = undefined;\n if (this.run) { this.run = undefined; this._animating.set(false); }\n if (this.cur !== NONE) this.apply(NONE);\n this.prev = this.measure() ?? this.prev;\n // Shared ids hand over from where this is now, not from before the resize\n const id = this.motionLayoutId();\n if (id && this.prev) this.registry.record(id, this, this.shifted(this.visual(this.prev)));\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(() => (this.resnap = false));\n };\n inject(NgZone).runOutsideAngular(() => window.addEventListener('resize', resize));\n destroyRef.onDestroy(() => {\n window.removeEventListener('resize', resize);\n cancelAnimationFrame(raf);\n this.controls?.stop();\n if (this.joined) this.registry.leave(this.joined, this);\n });\n }\n\n /** @internal */\n setHidden(hidden: boolean) {\n this.el.style.visibility = hidden ? 'hidden' : '';\n }\n\n /** @internal */\n resume(from: Box | undefined) {\n this.setHidden(false);\n this.resumeFrom = from;\n }\n\n private mode() {\n const m = this.motionLayout();\n return m === 'position' || m === 'size' ? m : 'both';\n }\n\n /** Layout box from offsets: unaffected by transforms (ours or anyone's) and by scrolling. */\n private measure(): Box | null {\n const el = this.el;\n if (!el.isConnected || (!el.offsetWidth && !el.offsetHeight && !el.offsetParent)) return null;\n let x = 0, y = 0;\n for (let n: HTMLElement | null = el; n; n = n.offsetParent as HTMLElement | null) { x += n.offsetLeft; y += n.offsetTop; }\n const w = el.offsetWidth, h = el.offsetHeight;\n const box = { cx: x + w / 2, cy: y + h / 2, w, h };\n if (this.motionLayoutId()) {\n // Our transform keeps the centre at layout centre + (x, y)\n const r = el.getBoundingClientRect();\n this.shift = { x: r.left + r.width / 2 - this.cur.x - box.cx, y: r.top + r.height / 2 - this.cur.y - box.cy };\n }\n return box;\n }\n\n /** A box in layout coordinates moved to (or, with -1, from) viewport coordinates. */\n private shifted(b: Box, sign = 1): Box {\n return { ...b, cx: b.cx + sign * this.shift.x, cy: b.cy + sign * this.shift.y };\n }\n\n /** Where the element is drawn: its layout box moved and scaled by our transform. */\n private visual(b: Box, o = this.cur): Box {\n return { cx: b.cx + o.x, cy: b.cy + o.y, w: b.w * o.sx, h: b.h * o.sy };\n }\n\n private update(box: Box | null) {\n const id = this.motionLayoutId() || null;\n if (id !== this.joined) {\n if (this.joined) this.registry.leave(this.joined, this);\n if (id) this.registry.join(id, this);\n this.joined = id;\n }\n if (!box) return;\n let from: Box | undefined;\n if (this.resumeFrom) {\n from = this.shifted(this.resumeFrom, -1);\n this.resumeFrom = undefined;\n } else if (!this.prev) {\n const seen = id && this.registry.from(id, this);\n if (seen) from = this.shifted(seen, -1);\n } else if (!same(this.prev, box)) {\n from = this.visual(this.prev);\n }\n this.prev = box;\n if (from && !this.resnap && !this.reduced) this.animateFrom(from, box);\n if (id) this.registry.record(id, this, this.shifted(this.visual(box)));\n }\n\n private animateFrom(from: Box, to: Box) {\n const mode = this.mode();\n const start: Offset = {\n x: mode === 'size' ? 0 : from.cx - to.cx,\n y: mode === 'size' ? 0 : from.cy - to.cy,\n sx: mode === 'position' || !to.w ? 1 : from.w / to.w,\n sy: mode === 'position' || !to.h ? 1 : from.h / to.h,\n };\n if (Math.abs(start.x) < 0.5 && Math.abs(start.y) < 0.5 && Math.abs(start.sx - 1) < 0.005 && Math.abs(start.sy - 1) < 0.005) return;\n this.controls?.stop();\n if (!this.radii) this.readRadii();\n this.apply(start);\n if (!this._animating()) { this._animating.set(true); this.layoutAnimationStart.emit(); }\n const id = this.motionLayoutId();\n // This run's token: updates from a run that finished or was replaced are ignored\n const run = {};\n this.run = run;\n const controls = this.motion.animate(0, 1, {\n ...this.layoutTransition(),\n onUpdate: (p: number) => {\n if (this.run !== run) return;\n this.apply(lerp(start, NONE, p));\n if (id && this.prev) this.registry.record(id, this, this.shifted(this.visual(this.prev)));\n },\n });\n this.controls = controls;\n Promise.resolve(controls).then(() => {\n if (this.run !== run) return;\n this.run = undefined;\n this.controls = undefined;\n this.apply(NONE);\n this._animating.set(false);\n this.layoutAnimationComplete.emit();\n }, () => {});\n }\n\n /** The element's own corner radii in px (percentages scale with the box already, so they're left alone). */\n private readRadii() {\n if (this.mode() === 'position') return;\n const cs = getComputedStyle(this.el);\n const r = CORNERS.map(c => cs[`border${c}Radius`]);\n if (r.some(v => v.includes('%'))) return;\n const px = r.map(v => parseFloat(v) || 0);\n if (px.some(v => v > 0)) { this.radii = px; this.inlineRadius = this.el.style.borderRadius; }\n }\n\n /**\n * Set our transform. Written straight to the style (not through Motion's\n * next frame), so what's drawn always matches `cur`: measuring and\n * interrupting read the same position the user sees.\n */\n private apply(o: Offset) {\n this.cur = o;\n const still = o === NONE;\n this.el.style.transform = still ? '' : `translate(${o.x}px, ${o.y}px) scale(${o.sx}, ${o.sy})`;\n this.el.classList.toggle('motion-layout-animating', !still);\n if (this.mode() === 'position') return;\n const flat = still || (o.sx === 1 && o.sy === 1);\n // Corners keep their shape: each radius divided by the scale on its axis\n if (this.radii) {\n const r = this.radii;\n this.el.style.borderRadius = flat ? this.inlineRadius : `${r.map(v => `${v / o.sx}px`).join(' ')} / ${r.map(v => `${v / o.sy}px`).join(' ')}`;\n if (still) this.radii = null;\n }\n // Counter-scale marked content so it keeps its size while the box scales\n const inverse = flat ? '' : `scale(${1 / o.sx}, ${1 / o.sy})`;\n this.el.querySelectorAll<HTMLElement>('[motionLayoutCorrect]').forEach(c => (c.style.transform = inverse));\n }\n}\n\nfunction same(a: Box, b: Box) {\n return Math.abs(a.cx - b.cx) < 0.5 && Math.abs(a.cy - b.cy) < 0.5 && Math.abs(a.w - b.w) < 0.5 && Math.abs(a.h - b.h) < 0.5;\n}\nfunction lerp(a: Offset, b: Offset, p: number): Offset {\n return { x: a.x + (b.x - a.x) * p, y: a.y + (b.y - a.y) * p, sx: a.sx + (b.sx - a.sx) * p, sy: a.sy + (b.sy - a.sy) * p };\n}\n","import {\n DestroyRef, ElementRef, Injector, NgZone, PLATFORM_ID, Signal, afterNextRender, assertInInjectionContext, effect, inject, signal, untracked,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\nimport { scroll as motionScroll, transform as motionTransform } from 'motion';\n\nconst BRAND = Symbol('MotionSignal');\n\n/**\n * A value that changes often (every frame while something moves), like\n * Framer Motion's MotionValue, that is also an Angular signal.\n *\n * - Read it in a template (`{{ x() }}`) and that view updates as it changes.\n * - Or bind it with `[motionStyle]`: the directive listens with `on()` and\n * writes the style directly, so nothing re-renders while it moves.\n */\nexport interface MotionSignal<T = number> extends Signal<T> {\n /** The current value, without tracking it. */\n get(): T;\n /** Called synchronously on every change, outside change detection. Returns a function that stops listening. */\n on(listener: (value: T) => void): () => void;\n /** How fast it is changing, per second (numbers only; 0 once it settles). */\n getVelocity(): number;\n}\n\nexport interface WritableMotionSignal<T = number> extends MotionSignal<T> {\n set(value: T): void;\n}\n\n/** A spring-driven value: `set()` springs to the new target, `jump()` goes there at once. */\nexport interface SpringSignal extends MotionSignal<number> {\n set(target: number): void;\n jump(value: number): void;\n}\n\n/** Anything these functions accept as an input: a motion signal or any Angular signal. */\nexport type MotionSource<T = number> = MotionSignal<T> | Signal<T>;\n\nexport interface MotionSignalOptions {\n /** For calls outside an injection context (constructor or field initialiser). */\n injector?: Injector;\n}\n\nexport function isMotionSignal<T = unknown>(value: unknown): value is MotionSignal<T> {\n return typeof value === 'function' && (value as unknown as Record<symbol, unknown>)[BRAND] === true;\n}\n\n/** Settled after this long without a change: velocity reads 0. */\nconst SETTLE_MS = 50;\n/** Velocity is measured over at least about a frame. */\nconst MIN_SPAN_MS = 16;\n\n/**\n * A writable motion signal (Framer Motion's `useMotionValue`).\n *\n * readonly x = motionSignal(0);\n * (dragMove)=\"x.set($event.x)\"\n */\nexport function motionSignal<T = number>(initial: T): WritableMotionSignal<T> {\n const state = signal(initial);\n const listeners = new Set<(value: T) => void>();\n /** Recent numeric samples, for velocity: several sets within one frame must not divide by ~0 ms. */\n let samples: { t: number; v: number }[] = [];\n let lastTime = 0;\n const now = () => (typeof performance !== 'undefined' ? performance.now() : Date.now());\n\n const read = (() => state()) as WritableMotionSignal<T>;\n Object.defineProperty(read, BRAND, { value: true });\n read.get = () => untracked(state);\n read.on = listener => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n read.getVelocity = () => {\n const t = now();\n if (t - lastTime > SETTLE_MS || samples.length < 2) return 0;\n const last = samples[samples.length - 1];\n // Measure against the newest sample at least a frame older than the last one\n let ref = samples[0];\n for (let i = samples.length - 2; i >= 0; i--) if (last.t - samples[i].t >= MIN_SPAN_MS) { ref = samples[i]; break; }\n const dt = last.t - ref.t;\n return dt >= MIN_SPAN_MS / 2 ? ((last.v - ref.v) / dt) * 1000 : 0;\n };\n read.set = value => {\n const previous = untracked(state);\n if (Object.is(previous, value)) return;\n const t = now();\n if (typeof value === 'number') {\n // A fresh start after a pause: no velocity carried over from before it\n if (t - lastTime > SETTLE_MS) samples = [];\n samples.push({ t, v: value });\n if (samples.length > 8) samples = samples.slice(-8);\n }\n lastTime = t;\n state.set(value);\n for (const listener of [...listeners]) listener(value);\n };\n return read;\n}\n\n/**\n * A value derived from others (Framer Motion's `useTransform`).\n *\n * // Map a range: -200..200 px → 0..1..0 opacity (clamped; colours and units work too)\n * readonly opacity = mapSignal(x, [-200, 0, 200], [0, 1, 0]);\n * readonly colour = mapSignal(x, [-200, 200], ['#f43f5e', '#22c55e']);\n *\n * // Or a function of one or more sources\n * readonly label = mapSignal(x, v => `${Math.round(v)}px`);\n * readonly area = mapSignal([w, h], ([w, h]) => w * h);\n *\n * Plain Angular signals are accepted as sources too; they update it on the\n * next change detection, so call it in an injection context for those.\n */\nexport function mapSignal<O>(source: MotionSource<number>, input: number[], output: O[], options?: MotionSignalOptions & { clamp?: boolean; ease?: unknown }): MotionSignal<O>;\nexport function mapSignal<I, O>(source: MotionSource<I>, map: (value: I) => O, options?: MotionSignalOptions): MotionSignal<O>;\nexport function mapSignal<O>(sources: MotionSource<any>[], map: (values: any[]) => O, options?: MotionSignalOptions): MotionSignal<O>;\nexport function mapSignal(\n source: MotionSource<any> | MotionSource<any>[],\n mapOrInput: ((value: any) => unknown) | number[],\n outputOrOptions?: unknown[] | (MotionSignalOptions & { clamp?: boolean; ease?: unknown }),\n rangeOptions?: MotionSignalOptions & { clamp?: boolean; ease?: unknown },\n): MotionSignal<unknown> {\n const sources = Array.isArray(source) ? source : [source];\n let compute: () => unknown;\n let options: MotionSignalOptions | undefined;\n const value = (s: MotionSource<any>) => (isMotionSignal(s) ? s.get() : untracked(s));\n\n if (typeof mapOrInput === 'function') {\n const map = mapOrInput;\n options = outputOrOptions as MotionSignalOptions | undefined;\n compute = Array.isArray(source) ? () => map(sources.map(value)) : () => map(value(sources[0]));\n } else {\n options = rangeOptions;\n const mapper = motionTransform(mapOrInput, outputOrOptions as unknown[], { clamp: rangeOptions?.clamp ?? true, ease: rangeOptions?.ease as never });\n compute = () => mapper(value(sources[0]));\n }\n\n const out = motionSignal(compute());\n connect(sources, () => out.set(compute()), options);\n return out;\n}\n\n/**\n * A value that follows a target on a spring (Framer Motion's `useSpring`).\n *\n * // Springs towards whatever it's set to\n * readonly count = springSignal(0, { stiffness: 120, damping: 20 });\n * count.set(1200);\n *\n * // Or follows another value, smoothing it out\n * readonly smoothX = springSignal(x);\n *\n * Keeps its speed when the target changes mid-way. With reduced motion (and\n * on the server) it goes straight to the target. Call it in an injection\n * context, or pass `injector`.\n */\nexport function springSignal(\n source: number | MotionSource<number>,\n options: MotionSignalOptions & { stiffness?: number; damping?: number; mass?: number; restDelta?: number; restSpeed?: number } = {},\n): SpringSignal {\n const injector = injectorFor(springSignal, options);\n const zone = injector.get(NgZone);\n const browser = isPlatformBrowser(injector.get(PLATFORM_ID)) && typeof requestAnimationFrame !== 'undefined';\n const reduced = browser && injector.get(MotionAnimationService).reducedMotion();\n const { stiffness = 300, damping = 30, mass = 1, restDelta = 0.01, restSpeed = 0.05 } = options;\n\n const start = typeof source === 'number' ? source : isMotionSignal<number>(source) ? source.get() : untracked(source);\n const value = motionSignal(start);\n // The spring is integrated here, once per frame. A new target only moves the\n // goal: nothing restarts, so a target that changes every frame (a pointer,\n // a drag) is followed smoothly, keeping position and speed.\n let position = start;\n let velocity = 0;\n let target = start;\n let raf = 0;\n let last = 0;\n\n const stop = () => { if (raf) cancelAnimationFrame(raf); raf = 0; };\n const step = (time: number) => {\n // Long gaps (a background tab) are capped, so it doesn't leap\n let dt = Math.min(time > last ? time - last : 16, 64) / 1000;\n last = time;\n // Small fixed sub-steps keep stiff springs stable\n while (dt > 0) {\n const h = Math.min(dt, 0.004);\n const accel = (-stiffness * (position - target) - damping * velocity) / mass;\n velocity += accel * h;\n position += velocity * h;\n dt -= h;\n }\n if (Math.abs(velocity) < restSpeed && Math.abs(position - target) < restDelta) {\n position = target;\n velocity = 0;\n raf = 0;\n } else {\n raf = requestAnimationFrame(step);\n }\n value.set(position);\n };\n\n const out = (() => value()) as SpringSignal;\n Object.defineProperty(out, BRAND, { value: true });\n out.get = value.get;\n out.on = value.on;\n out.getVelocity = () => velocity;\n out.jump = v => {\n stop();\n position = target = v;\n velocity = 0;\n value.set(v);\n };\n out.set = next => {\n if (!browser || reduced) return out.jump(next);\n target = next;\n if (raf || (position === target && velocity === 0)) return;\n last = performance.now();\n zone.runOutsideAngular(() => (raf = requestAnimationFrame(step)));\n };\n\n if (typeof source !== 'number') connect([source], () => out.set(isMotionSignal<number>(source) ? source.get() : untracked(source)), options);\n injector.get(DestroyRef).onDestroy(stop);\n return out;\n}\n\n/**\n * How fast another value is changing, per second (Framer Motion's\n * `useVelocity`); back to 0 once it stops. Call it in an injection context,\n * or pass `injector`.\n *\n * readonly speed = velocitySignal(scrollY);\n * readonly skew = mapSignal(speed, [-2000, 2000], [-8, 8]);\n */\nexport function velocitySignal(source: MotionSignal<number>, options: MotionSignalOptions = {}): MotionSignal<number> {\n const injector = injectorFor(velocitySignal, options);\n const zone = injector.get(NgZone);\n const out = motionSignal(0);\n let raf = 0;\n const check = () => {\n raf = 0;\n const v = source.getVelocity();\n out.set(v);\n if (v !== 0) raf = requestAnimationFrame(check);\n };\n const stop = source.on(() => {\n out.set(source.getVelocity());\n // Keep checking each frame, so it falls to 0 when the source stops\n if (!raf && typeof requestAnimationFrame !== 'undefined') zone.runOutsideAngular(() => (raf = requestAnimationFrame(check)));\n });\n injector.get(DestroyRef).onDestroy(() => {\n stop();\n if (raf) cancelAnimationFrame(raf);\n });\n return out;\n}\n\nexport interface ScrollSignals {\n /** 0 to 1 through the scroll range. */\n progress: MotionSignal<number>;\n /** Scroll position in px. */\n offset: MotionSignal<number>;\n /** Scroll speed in px per second. */\n velocity: MotionSignal<number>;\n}\n\ntype ElementSource = Element | ElementRef<Element> | (() => Element | ElementRef<Element> | null | undefined) | null | undefined;\n\n/**\n * Scroll position as motion signals (Framer Motion's `useScroll`). The page by\n * default; pass a scrolling `container` and/or a `target` element whose\n * progress through it you want (with `offset`). Element options can be\n * functions, so `viewChild` signals work. Call it in an injection context, or\n * pass `injector`.\n *\n * readonly scrollY = scrollSignal();\n * readonly width = mapSignal(this.scrollY.progress, [0, 1], ['0%', '100%']);\n */\nexport function scrollSignal(\n options: MotionSignalOptions & { container?: ElementSource; target?: ElementSource; offset?: string[]; axis?: 'x' | 'y' } = {},\n): ScrollSignals {\n const injector = injectorFor(scrollSignal, options);\n const progress = motionSignal(0);\n const offset = motionSignal(0);\n const velocity = motionSignal(0);\n let cancel: (() => void) | undefined;\n\n if (isPlatformBrowser(injector.get(PLATFORM_ID))) {\n afterNextRender(() => {\n const resolve = (e: ElementSource): Element | undefined => {\n const v = typeof e === 'function' ? e() : e;\n return v instanceof ElementRef ? v.nativeElement : v ?? undefined;\n };\n const container = resolve(options.container);\n const target = resolve(options.target);\n const axis = options.axis ?? 'y';\n injector.get(NgZone).runOutsideAngular(() => {\n cancel = motionScroll((p: number, info: { x: AxisInfo; y: AxisInfo }) => {\n progress.set(p);\n offset.set(info[axis].current);\n velocity.set(info[axis].velocity);\n }, { container: container as HTMLElement | undefined, target, offset: options.offset as never, axis });\n });\n }, { injector });\n }\n injector.get(DestroyRef).onDestroy(() => cancel?.());\n return { progress, offset, velocity };\n}\n\ninterface AxisInfo { current: number; velocity: number; }\n\n/** Run `update` whenever any source changes: motion signals directly, Angular signals via an effect. */\nfunction connect(sources: MotionSource<any>[], update: () => void, options?: MotionSignalOptions) {\n const stops = sources.filter(isMotionSignal).map(s => s.on(update));\n const plain = sources.filter(s => !isMotionSignal(s));\n const injector = options?.injector ?? tryInject();\n if (plain.length) {\n if (!injector) throw new Error('ngx-motion: a plain Angular signal source needs an injection context or the `injector` option.');\n effect(() => { for (const s of plain) s(); untracked(update); }, { injector });\n }\n if (stops.length && injector) injector.get(DestroyRef).onDestroy(() => stops.forEach(stop => stop()));\n}\n\nfunction tryInject(): Injector | undefined {\n try { return inject(Injector); } catch { return undefined; }\n}\n\nfunction injectorFor(fn: Function, options: MotionSignalOptions): Injector {\n if (options.injector) return options.injector;\n assertInInjectionContext(fn);\n return inject(Injector);\n}\n","import { Directive, ElementRef, effect, inject, input, isSignal, untracked } from '@angular/core';\nimport { MotionSignal, isMotionSignal } from '../values/motion-signals';\nimport { applySvgPath, isSvgPathKey } from '../utils/svg-path.utils';\n\n/** Transform shortcuts, in the order they are applied (as in Framer Motion). */\nconst TRANSFORMS = ['x', 'y', 'z', 'scale', 'scaleX', 'scaleY', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'skewX', 'skewY'] as const;\nconst TRANSFORM_FN: Record<string, string> = { x: 'translateX', y: 'translateY', z: 'translateZ' };\n/** Numbers are written as-is for these; other numbers get px. */\nconst UNITLESS = new Set(['opacity', 'zIndex', 'fontWeight', 'lineHeight', 'flex', 'flexGrow', 'flexShrink', 'order', 'zoom', 'fillOpacity', 'strokeOpacity']);\n\nexport type MotionStyleValue = MotionSignal<number | string> | (() => number | string) | number | string | null | undefined;\n\n/**\n * Binds styles to motion signals (Framer Motion's `style={{ x, opacity }}`).\n * Each change is written straight to the element, without change detection,\n * so values that change every frame cost nothing to render.\n *\n * <div [motionStyle]=\"{ x: smoothX, rotate: tilt, opacity: fade, backgroundColor: colour }\"></div>\n *\n * - Transform shortcuts: x, y, z (px), scale, scaleX, scaleY, rotate,\n * rotateX/Y/Z, skewX/Y (deg). They are combined into `transform`, so don't\n * animate the same element's transform another way.\n * - SVG line drawing: pathLength, pathOffset, pathSpacing (0 to 1), e.g.\n * `{ pathLength: scroll.progress }` draws a line as the page scrolls.\n * - Other styles take camelCase names; numbers get px except unitless ones\n * (opacity, zIndex, …). CSS custom properties (`'--progress'`) take any value.\n * - Values can be motion signals, plain Angular signals (updated with change\n * detection) or constants.\n */\n@Directive({ selector: '[motionStyle]' })\nexport class MotionStyleDirective {\n readonly motionStyle = input<Record<string, MotionStyleValue> | null>(null);\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly transform = new Map<string, number | string>();\n\n constructor() {\n effect(onCleanup => {\n const styles = this.motionStyle() ?? {};\n const stops: (() => void)[] = [];\n for (const [key, v] of Object.entries(styles)) {\n if (isMotionSignal<number | string>(v)) {\n this.write(key, v.get());\n stops.push(v.on(value => this.write(key, value)));\n } else if (isSignal(v) || typeof v === 'function') {\n // A plain signal: read here, so this effect re-runs when it changes\n const value = (v as () => number | string)();\n untracked(() => this.write(key, value));\n } else {\n this.write(key, v);\n }\n }\n onCleanup(() => {\n stops.forEach(stop => stop());\n // Keys that are no longer bound go back to the stylesheet\n for (const key of Object.keys(styles)) if (!(key in (untracked(this.motionStyle) ?? {}))) this.write(key, null);\n });\n });\n }\n\n private write(key: string, value: number | string | null | undefined) {\n if (isSvgPathKey(key)) return applySvgPath(this.el, { [key]: value });\n if ((TRANSFORMS as readonly string[]).includes(key)) {\n if (value == null) this.transform.delete(key); else this.transform.set(key, value);\n this.el.style.transform = this.transformString();\n return;\n }\n const css = value == null ? '' : typeof value === 'number' && !UNITLESS.has(key) && !key.startsWith('--') ? `${value}px` : String(value);\n if (key.startsWith('--')) this.el.style.setProperty(key, css);\n else (this.el.style as unknown as Record<string, string>)[key] = css;\n }\n\n private transformString() {\n let out = '';\n for (const key of TRANSFORMS) {\n const v = this.transform.get(key);\n if (v === undefined) continue;\n const unit = typeof v !== 'number' ? '' : key === 'x' || key === 'y' || key === 'z' ? 'px' : key.startsWith('scale') ? '' : 'deg';\n out += `${TRANSFORM_FN[key] ?? key}(${v}${unit}) `;\n }\n return out.trim();\n }\n}\n","import { DestroyRef, ElementRef, Injector, NgZone, PLATFORM_ID, assertInInjectionContext, inject } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { createScopedAnimate } from 'motion';\nimport { MotionAnimationService } from '../services/motion-animation.service';\nimport { withSvgPathContext } from '../utils/svg-path.utils';\nimport { withoutMovement } from '../config/motion-config';\nimport { MotionSignal, isMotionSignal } from '../values/motion-signals';\n\n/** What injectAnimate resolves selectors in: an element, an ElementRef, or a function returning one (a viewChild). */\nexport type AnimateScope = Element | ElementRef<Element> | (() => Element | ElementRef<Element> | null | undefined);\n\n/** The running animation: await it (or `.finished`), or stop, pause, play, complete it. */\nexport interface AnimationControls extends PromiseLike<void> {\n readonly finished: Promise<unknown>;\n stop(): void;\n cancel(): void;\n complete(): void;\n play(): void;\n pause(): void;\n time: number;\n speed: number;\n readonly duration: number;\n}\n\ntype Target = string | Element | Element[] | NodeListOf<Element> | ElementRef<Element>;\ntype Keyframes = Record<string, unknown>;\ntype Options = Record<string, unknown>;\n/** A step of a sequence: [target, keyframes, options?], [signal, to, options?] or a label. */\nexport type SequenceStep = [Target | MotionSignal<number>, unknown, Options?] | string;\n\n/** A number signal it can animate: a motionSignal or springSignal (springs are moved frame by frame). */\ntype NumberSignal = MotionSignal<number> & ({ set(v: number): void } | { jump(v: number): void });\n\nexport interface ScopedAnimate {\n /** Animate elements (or a CSS selector, looked up inside the scope). */\n (target: Target, keyframes: Keyframes, options?: Options): AnimationControls;\n /** Animate a number signal to a value (or through keyframes). */\n (signal: NumberSignal, to: number | number[], options?: Options): AnimationControls;\n /** Play a sequence: steps run one after another; `at` places a step on the timeline. */\n (sequence: SequenceStep[], options?: Options): AnimationControls;\n /** Stop everything started with this function. */\n stop(): void;\n}\n\nexport interface InjectAnimateOptions {\n /** Where selectors are looked up. Defaults to the host element of the component or directive. */\n scope?: AnimateScope;\n injector?: Injector;\n}\n\n/**\n * Animate from code (Framer Motion's `useAnimate`), for animations a template\n * state doesn't express: after a request, in a sequence, from a service.\n *\n * private readonly animate = injectAnimate();\n *\n * async save() {\n * await this.animate('.card', { scale: 0.95 }, { duration: 0.1 });\n * await this.animate([\n * ['.card', { scale: 1 }, { type: 'spring', stiffness: 400 }],\n * ['.tick', { pathLength: [0, 1], opacity: 1 }, { at: '-0.1' }],\n * ['li', { opacity: [0, 1], y: [8, 0] }, { delay: stagger(0.05) }],\n * ]);\n * }\n *\n * - Selectors are looked up inside the host element (or `scope`), so they\n * never match another component's elements.\n * - Every animation it started is stopped when the component is destroyed.\n * - Runs outside Angular's change detection; does nothing on the server.\n * - With reduced motion, movement jumps to its end (see provideMotionConfig).\n * - Also animates number signals: `animate(this.count, 100)`.\n *\n * Call it in an injection context (a field or the constructor), or pass `injector`.\n */\nexport function injectAnimate(options: InjectAnimateOptions = {}): ScopedAnimate {\n if (!options.injector) assertInInjectionContext(injectAnimate);\n const injector = options.injector ?? inject(Injector);\n const motion = injector.get(MotionAnimationService);\n const zone = injector.get(NgZone);\n const browser = isPlatformBrowser(injector.get(PLATFORM_ID));\n const host = injector.get(ElementRef, null);\n\n const resolve = (s: AnimateScope | undefined): Element | undefined => {\n const v = typeof s === 'function' ? s() : s;\n return v instanceof ElementRef ? v.nativeElement : v ?? undefined;\n };\n // Motion reads scope.current when it looks up selectors\n const scope = {\n get current() { return resolve(options.scope) ?? (host?.nativeElement as Element | undefined); },\n animations: [] as { stop(): void }[],\n };\n const scoped = createScopedAnimate(scope as never) as unknown as (...args: unknown[]) => AnimationControls;\n const running = new Set<AnimationControls>();\n\n const element = (t: unknown) => (t instanceof ElementRef ? t.nativeElement : t);\n\n /** One target: elements get SVG path handling and reduced motion; signals get frames. */\n const prepare = (target: unknown, keyframes: unknown, opts: Options | undefined): [unknown, unknown, Options | undefined] => {\n if (isMotionSignal<number>(target)) {\n const sig = target as NumberSignal;\n const write = writer(sig);\n const to = Array.isArray(keyframes) ? keyframes : [sig.get(), keyframes];\n return [to, { ...opts, onUpdate: (v: number) => { write(v); (opts?.['onUpdate'] as ((v: number) => void) | undefined)?.(v); } }, undefined];\n }\n const el = element(target);\n let o = opts;\n if (motion.reducedMotion()) o = withoutMovement(keyframes, o);\n return [el, el instanceof Element ? withSvgPathContext(el, keyframes as Keyframes) : keyframes, o];\n };\n\n const animate = ((first: unknown, second?: unknown, third?: Options) => {\n if (!browser) return done();\n let controls: AnimationControls;\n if (Array.isArray(first) && first.some(Array.isArray)) {\n // A sequence: prepare each step\n const steps = (first as SequenceStep[]).map(step => {\n if (!Array.isArray(step)) return step;\n const [target, keyframes, opts] = step;\n if (isMotionSignal<number>(target)) {\n // In a sequence a signal is animated as an object whose value writes to it\n const write = writer(target as NumberSignal);\n const proxy = { get v() { return (target as NumberSignal).get(); }, set v(x: number) { write(x); } };\n const to = Array.isArray(keyframes) ? keyframes : [proxy.v, keyframes];\n return opts ? [proxy, { v: to }, opts] : [proxy, { v: to }];\n }\n const [t, k, o] = prepare(target, keyframes, opts);\n return o === undefined ? [t, k] : [t, k, o];\n });\n controls = zone.runOutsideAngular(() => scoped(steps, second));\n } else if (isMotionSignal(first)) {\n const [values, opts] = prepare(first, second, third);\n // Motion's single-value form: animate(from, keyframes, options)\n controls = zone.runOutsideAngular(() => scoped((values as number[])[0], values, opts));\n } else {\n const [t, k, o] = prepare(first, second, third);\n controls = zone.runOutsideAngular(() => scoped(t, k, o));\n }\n running.add(controls);\n controls.finished.then(() => running.delete(controls), () => running.delete(controls));\n return controls;\n }) as ScopedAnimate;\n\n animate.stop = () => {\n for (const c of running) c.stop();\n running.clear();\n };\n injector.get(DestroyRef).onDestroy(animate.stop);\n return animate;\n}\n\n/** Springs are moved frame by frame with jump(), so they don't spring on top. */\nfunction writer(sig: NumberSignal): (v: number) => void {\n return 'jump' in sig ? v => sig.jump(v) : v => (sig as { set(v: number): void }).set(v);\n}\n\n/** Finished controls, for the server. */\nfunction done(): AnimationControls {\n const finished = Promise.resolve();\n return {\n finished, time: 0, speed: 1, duration: 0,\n stop() {}, cancel() {}, complete() {}, play() {}, pause() {},\n then: (onFulfilled, onRejected) => finished.then(onFulfilled, onRejected),\n };\n}\n\nexport { stagger } from 'motion';\n"],"mappings":";;;;;;AA2BE,IAAa,mBAAb,MAAa,iBAAgB;CA4BC;CACG;CACrB;CA7BF,iBAAkC,CAAA;CACzB,mBAAmB,OAAO,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,CAAA,CAAA;CACrC,u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K,wBAAwB,OAAO,GAAG,GAAG,CAAC,CAAC;EACzD;EACA,QAAQ,IAAI,QAAQ;EACpB,SAAS,SAAS,WAAW,QAAQ,OAAO,QAAQ,SAAS,QAAQ,OAAO,QAAQ,CAAC;EACrF,OAAO;CACT;CAEA,QAAQ,aAAY;EAClB,KAAK,MAAM,KAAK,SAAS,EAAE,KAAI;EAC/B,QAAQ,MAAK;CACf;CACA,SAAS,IAAI,UAAU,CAAC,CAAC,UAAU,QAAQ,IAAI;CAC/C,OAAO;AACT;AAGA,SAAS,OAAO,KAAiB;CAC/B,OAAO,UAAU,OAAM,MAAK,IAAI,KAAK,CAAC,KAAI,MAAM,IAAiC,IAAI,CAAC;AACxF;AAGA,SAAS,OAAI;CACX,MAAM,WAAW,QAAQ,QAAO;CAChC,OAAO;EACL;EAAU,MAAM;EAAG,OAAO;EAAG,UAAU;EACvC,OAAI,CAAI;EAAG,SAAM,CAAI;EAAG,WAAQ,CAAI;EAAG,OAAI,CAAI;EAAG,QAAK,CAAI;EAC3D,OAAO,aAAa,eAAe,SAAS,KAAK,aAAa,UAAU;CACzE;AACH"}
|
|
1
|
+
{"version":3,"file":"hilux-ngx-motion.mjs","names":["motionAnimate","motionInView","motionEaseIn","motionEaseOut","motionEaseInOut","motionStagger","motionSpring","hasStyleProperties","LAYOUT_SPRING","motionTransform","motionScroll","globalTransition"],"sources":["../../../projects/ngx-motion/src/lib/services/motion-one.service.ts","../../../projects/ngx-motion/src/lib/utils/svg-path.utils.ts","../../../projects/ngx-motion/src/lib/config/motion-config.ts","../../../projects/ngx-motion/src/lib/services/motion-animation.service.ts","../../../projects/ngx-motion/src/lib/utils/easing.utils.ts","../../../projects/ngx-motion/src/lib/services/motion-animation-options.service.ts","../../../projects/ngx-motion/src/lib/utils/timing.utils.ts","../../../projects/ngx-motion/src/lib/services/motion-stagger.service.ts","../../../projects/ngx-motion/src/lib/constants/motion-defaults.constants.ts","../../../projects/ngx-motion/src/lib/services/motion-inview.service.ts","../../../projects/ngx-motion/src/lib/utils/color.utils.ts","../../../projects/ngx-motion/src/lib/services/motion-timeline.service.ts","../../../projects/ngx-motion/src/lib/services/motion-gesture.service.ts","../../../projects/ngx-motion/src/lib/utils/transform.utils.ts","../../../projects/ngx-motion/src/lib/utils/style-extraction.utils.ts","../../../projects/ngx-motion/src/lib/utils/variant.utils.ts","../../../projects/ngx-motion/src/lib/directives/motion-one.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-if.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-presence.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-scroll.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-pointer.directives.ts","../../../projects/ngx-motion/src/lib/directives/motion-drag.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-pan.directive.ts","../../../projects/ngx-motion/src/lib/directives/motion-reorder.directives.ts","../../../projects/ngx-motion/src/lib/directives/motion-layout.directive.ts","../../../projects/ngx-motion/src/lib/values/motion-signals.ts","../../../projects/ngx-motion/src/lib/directives/motion-style.directive.ts","../../../projects/ngx-motion/src/lib/animate/inject-animate.ts"],"sourcesContent":["import {\n Injectable,\n Inject,\n signal,\n PLATFORM_ID,\n NgZone,\n OnDestroy,\n WritableSignal,\n DOCUMENT\n} from '@angular/core';\n import { isPlatformBrowser } from '@angular/common';\n import { Subject, Observable, timer } from 'rxjs';\n import { take, map } from 'rxjs/operators';\n \n // Define the interface for motion elements\n export interface MotionElement {\n elementId: string;\n getDuration(): number;\n runInitAnimation(): void;\n runExitAnimation(): void;\n cancel(): void;\n route?: string;\n }\n \n @Injectable({\n providedIn: 'root',\n })\n export class MotionOneService implements OnDestroy {\n private motionElements: MotionElement[] = [];\n private readonly _scrollYProgress = signal(0);\n private removeScrollListener: (() => void) | null = null;\n\n /**\n * Page scroll progress (0-100). The scroll listener is only attached the\n * first time this is read, so apps that never use it pay nothing.\n */\n get scrollYProgress(): WritableSignal<number> {\n this.ensureScrollListener();\n return this._scrollYProgress;\n }\n totalExitDuration: number = 0;\n \n // Subject that emits when all exit animations for a route are complete\n private exitAnimationsComplete = new Subject<string>();\n \n // Subject that emits when all enter animations for a route are complete\n private enterAnimationsComplete = new Subject<string>();\n \n // Track active exit animations by route\n private activeExitAnimations: Map<string, number> = new Map();\n \n // Track active enter animations by route\n private activeEnterAnimations: Map<string, number> = new Map();\n \n constructor(\n @Inject(DOCUMENT) private document: Document,\n @Inject(PLATFORM_ID) private platformId: Object,\n private ngZone: NgZone\n ) {}\n \n ngOnDestroy() {\n this.removeScrollListener?.();\n this.removeScrollListener = null;\n this.exitAnimationsComplete.complete();\n this.enterAnimationsComplete.complete();\n }\n \n /**\n * TODO: In a future task, we want to use Angular framework's exit delay function\n * to handle exit animations properly instead of this custom implementation.\n * \n * DISABLED: Exit duration calculation is disabled to prevent navigation blocking.\n */\n private updateTotalExitDuration() {\n // Always set to 0 to prevent navigation blocking\n // TODO: Replace with Angular framework's exit delay mechanism in future tasks\n this.totalExitDuration = 0;\n \n // DISABLED - Original implementation commented out:\n // if (!isPlatformBrowser(this.platformId)) return;\n // \n // this.totalExitDuration = this.motionElements.reduce((total, element) => {\n // return total + element.getDuration();\n // }, 0);\n }\n \n /**\n * Passive scroll listener outside the Angular zone, throttled to one update per\n * animation frame. The signal only changes when the rounded percentage changes,\n * so templates reading it re-render at most once per percent.\n */\n private ensureScrollListener() {\n if (this.removeScrollListener || !isPlatformBrowser(this.platformId)) return;\n\n let frame = 0;\n const onScroll = () => {\n if (frame) return;\n frame = requestAnimationFrame(() => {\n frame = 0;\n this.updateScrollProgress();\n });\n };\n this.ngZone.runOutsideAngular(() =>\n window.addEventListener('scroll', onScroll, { passive: true })\n );\n this.removeScrollListener = () => {\n window.removeEventListener('scroll', onScroll);\n if (frame) cancelAnimationFrame(frame);\n };\n // Initial value on the next frame, not synchronously: the first read may\n // happen inside a computed(), where writing a signal would throw.\n onScroll();\n }\n \n private updateScrollProgress() {\n if (!isPlatformBrowser(this.platformId)) return;\n \n const doc = this.document.documentElement;\n const scrollTop = window.scrollY || doc.scrollTop;\n const scrollHeight = doc.scrollHeight - doc.clientHeight;\n const progress =\n scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;\n this._scrollYProgress.set(progress);\n }\n \n registerMotionElement(element: MotionElement) {\n this.motionElements.push(element);\n this.updateTotalExitDuration();\n }\n \n unregisterMotionElement(element: MotionElement) {\n this.motionElements = this.motionElements.filter((e) => e !== element);\n this.updateTotalExitDuration();\n }\n \n getMotionElements(): MotionElement[] {\n return this.motionElements;\n }\n \n getAllElementsByRoute(route: string): MotionElement[] {\n const elements = this.motionElements.filter(element => element.route === route);\n //console.log(`[MotionOneService] Found ${elements.length} elements for route ${route} (out of ${this.motionElements.length} total)`);\n \n\n \n return elements;\n }\n \n cancelAllAnimations() {\n if (!isPlatformBrowser(this.platformId)) return;\n \n this.motionElements.forEach((motion) => {\n motion.cancel();\n });\n }\n \n runAllEnterAnimations(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n \n this.motionElements.forEach((motion) => {\n motion.runInitAnimation();\n });\n } \n \n runAllExitAnimations(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n \n this.motionElements.forEach((motion) => {\n motion.runExitAnimation();\n });\n }\n \n /**\n * Get an observable that emits true when all exit animations for a route are complete\n * @param route The route to check for animation completion\n * @returns Observable that emits true when animations are complete\n */\n getExitAnimationsComplete(route: string): Observable<boolean> {\n if (!isPlatformBrowser(this.platformId)) {\n // If not in browser, immediately emit true\n return timer(0).pipe(\n take(1),\n map(() => true)\n );\n }\n \n // Get the exit duration for the route\n const exitDuration = this.getLongestExitDurationForRoute(route);\n // console.log(`[MotionOneService] Setting up exit animations complete for route ${route} with duration ${exitDuration}s`);\n \n // If no animations or duration is 0, immediately emit true\n if (exitDuration === 0 || this.getAllElementsByRoute(route).length === 0) {\n // console.log(`[MotionOneService] No exit animations for route ${route}, emitting complete immediately`);\n return timer(0).pipe(\n take(1),\n map(() => true)\n );\n }\n \n // Otherwise, wait for the exit duration and then emit true\n return timer(exitDuration * 1000).pipe(\n take(1),\n map(() => true)\n );\n }\n \n /**\n * Get an observable that emits true when all enter animations for a route are complete\n * @param route The route to check for animation completion\n * @returns Observable that emits true when animations are complete\n */\n getEnterAnimationsComplete(route: string): Observable<boolean> {\n if (!isPlatformBrowser(this.platformId)) {\n // If not in browser, immediately emit true\n return timer(0).pipe(\n take(1),\n map(() => true)\n );\n }\n \n // Get the enter duration for the route\n const enterDuration = this.getLongestEnterDurationForRoute(route);\n // console.log(`[MotionOneService] Setting up enter animations complete for route ${route} with duration ${enterDuration}s`);\n \n // If no animations or duration is 0, immediately emit true\n if (enterDuration === 0 || this.getAllElementsByRoute(route).length === 0) {\n // console.log(`[MotionOneService] No enter animations for route ${route}, emitting complete immediately`);\n return timer(0).pipe(\n take(1),\n map(() => true)\n );\n }\n \n // Otherwise, wait for the enter duration and then emit true\n return timer(enterDuration * 1000).pipe(\n take(1),\n map(() => true)\n );\n }\n \n /**\n * Start tracking exit animations for a route\n * @param route The route to track\n */\n startExitAnimationsForRoute(route: string): void {\n if (!isPlatformBrowser(this.platformId)) return;\n \n const elements = this.getAllElementsByRoute(route);\n this.activeExitAnimations.set(route, elements.length);\n \n //console.log(`[MotionOneService] Starting exit animations for route ${route} with ${elements.length} elements`);\n \n // If no elements, immediately mark as complete\n if (elements.length === 0) {\n this.completeExitAnimationsForRoute(route);\n return;\n }\n \n // Run exit animations for all elements in this route\n elements.forEach(element => {\n element.runExitAnimation();\n });\n \n // Get the longest duration and set a timer to mark animations as complete\n const exitDuration = this.getLongestExitDurationForRoute(route);\n setTimeout(() => {\n this.completeExitAnimationsForRoute(route);\n }, exitDuration * 1000);\n }\n \n /**\n * Start tracking enter animations for a route\n * @param route The route to track\n */\n startEnterAnimationsForRoute(route: string): void {\n if (!isPlatformBrowser(this.platformId)) return;\n \n const elements = this.getAllElementsByRoute(route);\n this.activeEnterAnimations.set(route, elements.length);\n \n // console.log(`[MotionOneService] Starting enter animations for route ${route} with ${elements.length} elements`);\n \n // If no elements, immediately mark as complete\n if (elements.length === 0) {\n this.completeEnterAnimationsForRoute(route);\n return;\n }\n \n // Run enter animations for all elements in this route\n elements.forEach(element => {\n element.runInitAnimation();\n });\n \n // Get the longest duration and set a timer to mark animations as complete\n const enterDuration = this.getLongestEnterDurationForRoute(route);\n setTimeout(() => {\n this.completeEnterAnimationsForRoute(route);\n }, enterDuration * 1000);\n }\n \n /**\n * Mark exit animations for a route as complete\n * @param route The route to mark as complete\n */\n private completeExitAnimationsForRoute(route: string): void {\n this.activeExitAnimations.delete(route);\n this.exitAnimationsComplete.next(route);\n }\n \n /**\n * Mark enter animations for a route as complete\n * @param route The route to mark as complete\n */\n private completeEnterAnimationsForRoute(route: string): void {\n this.activeEnterAnimations.delete(route);\n this.enterAnimationsComplete.next(route);\n }\n \n /**\n * Check if exit animations for a route are complete\n * @param route The route to check\n * @returns True if animations are complete or not running\n */\n areExitAnimationsComplete(route: string): boolean {\n return !this.activeExitAnimations.has(route);\n }\n \n /**\n * Check if enter animations for a route are complete\n * @param route The route to check\n * @returns True if animations are complete or not running\n */\n areEnterAnimationsComplete(route: string): boolean {\n return !this.activeEnterAnimations.has(route);\n }\n \n runAllExitAnimationsForRoute(route: string): MotionElement[] {\n if (!isPlatformBrowser(this.platformId)) return [];\n \n // Start tracking animations for this route\n this.startExitAnimationsForRoute(route);\n \n return this.getAllElementsByRoute(route);\n }\n \n runAllEnterAnimationsForRoute(route: string): MotionElement[] {\n if (!isPlatformBrowser(this.platformId)) return [];\n \n // Start tracking animations for this route\n this.startEnterAnimationsForRoute(route);\n \n return this.getAllElementsByRoute(route);\n }\n \n /**\n * TODO: In a future task, we want to use Angular framework's exit delay function\n * (e.g., route guards with canDeactivate or route transition animations)\n * to handle exit animations properly instead of this custom implementation.\n * \n * DISABLED: Exit duration calculation is disabled to prevent navigation blocking.\n * Navigation should be immediate and not wait for exit animations.\n */\n getLongestExitDurationForRoute(route: string): number {\n // Always return 0 to prevent navigation blocking\n // TODO: Replace with Angular framework's exit delay mechanism in future tasks\n return 0;\n \n // DISABLED - Original implementation commented out:\n // if (!isPlatformBrowser(this.platformId)) return 0;\n // \n // // console.log(`[MotionOneService] Getting longest exit duration for route ${route}`);\n // \n // if (this.motionElements.length === 0) {\n // // console.log('[MotionOneService] No motion elements registered');\n // return 0;\n // }\n // \n // const elements = this.getAllElementsByRoute(route);\n // if (elements.length === 0) {\n // // console.log(`[MotionOneService] No elements found for route ${route}`);\n // return 0;\n // }\n // \n // const durations = elements.map((motion) => {\n // const duration = motion.getDuration();\n // // console.log(`[MotionOneService] Element ${motion.elementId} has exit duration: ${duration}s`);\n // return duration;\n // });\n // \n // const maxDuration = durations.length > 0 ? Math.max(...durations) : 0;\n // console.log(`[MotionOneService] Longest exit duration for route ${route}: ${maxDuration}s`);\n // return maxDuration;\n }\n \n getLongestEnterDurationForRoute(route: string): number {\n if (!isPlatformBrowser(this.platformId)) return 0;\n \n // console.log(`[MotionOneService] Getting longest enter duration for route ${route}`);\n \n if (this.motionElements.length === 0) {\n // console.log('[MotionOneService] No motion elements registered');\n return 0;\n }\n \n const elements = this.getAllElementsByRoute(route);\n if (elements.length === 0) {\n // console.log(`[MotionOneService] No elements found for route ${route}`);\n return 0;\n }\n \n const durations = elements.map((motion) => {\n const duration = motion.getDuration();\n // console.log(`[MotionOneService] Element ${motion.elementId} has enter duration: ${duration}s`);\n return duration;\n });\n \n const maxDuration = durations.length > 0 ? Math.max(...durations) : 0;\n return maxDuration;\n }\n \n getLongestEnterDuration(): number {\n if (!isPlatformBrowser(this.platformId)) return 0;\n \n // console.log(`[MotionOneService] Getting longest enter duration from ${this.motionElements.length} elements`);\n \n if (this.motionElements.length === 0) {\n // console.log('[MotionOneService] No motion elements registered');\n return 0;\n }\n \n const durations = this.motionElements.map((motion) => {\n const duration = motion.getDuration();\n // console.log(`[MotionOneService] Element ${motion.elementId} has duration: ${duration}s`);\n return duration;\n });\n \n const maxDuration = durations.length > 0 ? Math.max(...durations) : 0;\n return maxDuration;\n }\n }\n ","/**\n * Line drawing for SVG shapes (Framer Motion's `pathLength`, `pathOffset` and\n * `pathSpacing`), written the way Motion writes them while animating, so\n * values set here and values Motion animates line up.\n *\n * - pathLength: how much of the line is drawn, 0 to 1.\n * - pathOffset: where the drawn part starts, 0 to 1.\n * - pathSpacing: the gap after each drawn part (default 1: one draw, no repeat).\n *\n * The shape's `pathLength` attribute is set to 1, so these are fractions of\n * the shape's own length, whatever its size.\n */\nexport const SVG_PATH_KEYS = new Set(['pathLength', 'pathOffset', 'pathSpacing']);\n\nexport function isSvgPathKey(key: string): boolean {\n return SVG_PATH_KEYS.has(key);\n}\n\ntype SvgPathValues = { pathLength?: number; pathOffset?: number; pathSpacing?: number };\n\n/** The line-drawing values an element shows now, whoever wrote them (this file or Motion). */\nexport function readSvgPath(el: Element): SvgPathValues {\n if (!el.hasAttribute('pathLength')) return {};\n const out: SvgPathValues = {};\n const dash = el.getAttribute('stroke-dasharray')?.trim().split(/[\\s,]+/).map(parseFloat);\n if (dash && !isNaN(dash[0])) {\n out.pathLength = dash[0];\n if (dash.length > 1 && !isNaN(dash[1]) && dash[1] !== 1) out.pathSpacing = dash[1];\n }\n const offset = parseFloat(el.getAttribute('stroke-dashoffset') ?? '');\n if (!isNaN(offset) && offset !== 0) out.pathOffset = -offset;\n return out;\n}\n\nexport function applySvgPath(el: Element, values: { pathLength?: unknown; pathOffset?: unknown; pathSpacing?: unknown }): void {\n if (typeof SVGElement === 'undefined' || !(el instanceof SVGElement)) return;\n const current: SvgPathValues = readSvgPath(el);\n for (const key of SVG_PATH_KEYS) {\n if (!(key in values)) continue;\n const v = (values as Record<string, unknown>)[key];\n (current as Record<string, number | undefined>)[key] = v == null || v === '' ? undefined : Number(v);\n }\n if (current.pathLength === undefined && current.pathOffset === undefined && current.pathSpacing === undefined) {\n el.removeAttribute('pathLength');\n el.removeAttribute('stroke-dasharray');\n el.removeAttribute('stroke-dashoffset');\n return;\n }\n el.setAttribute('pathLength', '1');\n el.setAttribute('stroke-dasharray', `${current.pathLength ?? 1} ${current.pathSpacing ?? 1}`);\n el.setAttribute('stroke-dashoffset', `${-(current.pathOffset ?? 0)}`);\n}\n\n/**\n * Prepares line-drawing keyframes for Motion:\n * - Each animated key starts from what the shape shows now (Motion would read\n * the pathLength=\"1\" attribute as the current value and jump).\n * - Motion only draws the dash when pathLength is part of the animation, so\n * when only pathOffset or pathSpacing animate (a dash running round a\n * circle), the current values are held, and the dash keeps its length.\n */\nexport function withSvgPathContext(target: unknown, keyframes: Record<string, unknown>): Record<string, unknown> {\n if (typeof SVGElement === 'undefined' || !(target instanceof SVGElement) || !keyframes || typeof keyframes !== 'object') return keyframes;\n if (!Object.keys(keyframes).some(isSvgPathKey)) return keyframes;\n const current = readSvgPath(target);\n const out = { ...keyframes };\n // Motion reads the shape's pathLength attribute (always 1) as where the line\n // is now, so a hover from 0 to 1 would jump. Start from what is drawn.\n const defaults: Required<SvgPathValues> = { pathLength: 1, pathOffset: 0, pathSpacing: 1 };\n for (const key of SVG_PATH_KEYS) {\n const v = out[key];\n if (v === undefined || Array.isArray(v)) continue;\n const k = key as keyof SvgPathValues;\n out[key] = [current[k] ?? defaults[k], v];\n }\n // Held still: from and to are the same, so Motion doesn't animate them in\n const hold = (key: keyof SvgPathValues, fallback?: number) => {\n const v = current[key] ?? fallback;\n if (!(key in out) && v !== undefined) out[key] = [v, v];\n };\n hold('pathLength', 1);\n hold('pathSpacing');\n hold('pathOffset');\n return out;\n}\n","import { InjectionToken, Provider } from '@angular/core';\n\nexport interface MotionConfig {\n /**\n * What to do when the user asks for reduced motion\n * (`prefers-reduced-motion: reduce`), like Framer Motion's\n * `<MotionConfig reducedMotion>`:\n * - 'user' (default): movement (position, scale, rotation, size) jumps\n * straight to its end; fades, colours and line drawing still play.\n * - 'always': the same, whatever the user's setting.\n * - 'never': everything animates.\n */\n reducedMotion?: 'user' | 'always' | 'never';\n}\n\nexport const MOTION_CONFIG = new InjectionToken<MotionConfig>('MOTION_CONFIG', { factory: () => ({}) });\n\n/**\n * App-wide ngx-motion settings.\n *\n * bootstrapApplication(App, { providers: [provideMotionConfig({ reducedMotion: 'never' })] });\n */\nexport function provideMotionConfig(config: MotionConfig): Provider {\n return { provide: MOTION_CONFIG, useValue: config };\n}\n\n/** Values that move things on screen: with reduced motion they jump to their end. */\nconst MOVEMENT = /^(x|y|z|scale[XYZ]?|rotate[XYZ]?|skew[XY]?|translate[XYZ]?|transform|perspective|width|height|top|left|right|bottom|inset|margin|padding)/;\n\nexport function isMovementKey(key: string): boolean {\n return MOVEMENT.test(key);\n}\n\nexport function prefersReducedMotion(config: MotionConfig): boolean {\n const mode = config.reducedMotion ?? 'user';\n if (mode === 'never') return false;\n if (mode === 'always') return true;\n return typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;\n}\n\n/**\n * Animation options with every movement value in `keyframes` made instant\n * (Motion takes per-value transitions keyed by value name). Other values keep\n * their transition.\n */\nexport function withoutMovement(keyframes: unknown, options: Record<string, unknown> | undefined): Record<string, unknown> | undefined {\n if (!keyframes || typeof keyframes !== 'object' || Array.isArray(keyframes)) return options;\n const keys = Object.keys(keyframes).filter(isMovementKey);\n if (!keys.length) return options;\n const out: Record<string, unknown> = { ...(options ?? {}) };\n for (const key of keys) out[key] = { type: 'tween', duration: 0, delay: 0, repeat: 0 };\n return out;\n}\n","import { Injectable, NgZone, PLATFORM_ID, inject } from '@angular/core';\nimport { withSvgPathContext } from '../utils/svg-path.utils';\nimport { MOTION_CONFIG, prefersReducedMotion, withoutMovement } from '../config/motion-config';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n animate as motionAnimate,\n inView as motionInView,\n stagger as motionStagger,\n spring as motionSpring,\n easeIn as motionEaseIn,\n easeOut as motionEaseOut,\n easeInOut as motionEaseInOut\n} from 'motion';\n\nconst noopControls = () => ({ stop: () => {} }) as any;\nconst linear = (t: number) => t;\n\n/**\n * Thin wrapper around Motion's imperative API.\n *\n * - SSR-safe: every call is a no-op on the server.\n * - Zone-friendly: animations and in-view observers run outside the Angular zone,\n * so animation frames and observer callbacks don't trigger app-wide change\n * detection in zone.js apps. (In zoneless apps this is free.)\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionAnimationService {\n private readonly platformId = inject(PLATFORM_ID);\n private readonly ngZone = inject(NgZone);\n private readonly isBrowser = isPlatformBrowser(this.platformId);\n private readonly config = inject(MOTION_CONFIG);\n\n /** True when animations should skip movement: the user asks for reduced motion (see provideMotionConfig). */\n reducedMotion(): boolean {\n return this.isBrowser && prefersReducedMotion(this.config);\n }\n\n animate(target: any, keyframes: any, options?: any): any {\n if (!this.isBrowser) {\n return noopControls();\n }\n\n try {\n // With reduced motion, movement jumps to its end; fades and colours still play\n if (this.reducedMotion()) options = withoutMovement(keyframes, options);\n return this.ngZone.runOutsideAngular(() => motionAnimate(target, withSvgPathContext(target, keyframes), options));\n } catch (e) {\n console.error('[ngx-motion] Error in animate:', e);\n return noopControls();\n }\n }\n\n /**\n * Observe when an element enters the viewport. Returns a stop function.\n * The callback runs outside the Angular zone.\n */\n inView(\n element: Element,\n onStart: (entry: IntersectionObserverEntry) => void | ((entry: IntersectionObserverEntry) => void),\n options?: { root?: Element | Document; margin?: string; amount?: 'some' | 'all' | number }\n ): () => void {\n if (!this.isBrowser) {\n return () => {};\n }\n return this.ngZone.runOutsideAngular(() =>\n motionInView(element, (el: Element, entry: IntersectionObserverEntry) => onStart(entry) as any, options as any)\n );\n }\n\n get easeIn() {\n return this.isBrowser ? motionEaseIn : linear;\n }\n\n get easeOut() {\n return this.isBrowser ? motionEaseOut : linear;\n }\n\n get easeInOut() {\n return this.isBrowser ? motionEaseInOut : linear;\n }\n\n stagger(duration: number, options?: any): any {\n if (!this.isBrowser) {\n return 0;\n }\n\n try {\n return motionStagger(duration, options);\n } catch (e) {\n console.error('[ngx-motion] Error in stagger:', e);\n return 0;\n }\n }\n\n /**\n * Returns an *ease* for spring-like easing in tween contexts (timelines,\n * keyframe arrays). Motion's spring() is a generator that needs keyframes, not\n * an easing factory, so calling it like this throws in Motion 12+; the previous\n * implementation swallowed that and fell back to easeInOut, which we keep.\n * Real springs are produced via `type: 'spring'` animation options instead.\n */\n get spring() {\n return (options?: { stiffness?: number; damping?: number }) => {\n if (!this.isBrowser) {\n return linear;\n }\n try {\n const generator = (motionSpring as any)({\n stiffness: options?.stiffness ?? 100,\n damping: options?.damping ?? 10\n });\n if (typeof generator === 'function') return generator;\n } catch {\n // fall through\n }\n return motionEaseInOut;\n };\n }\n}\n","import { isDevMode } from '@angular/core';\nimport { TransitionOptions } from '../types/motion-animation.types';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** Easing names Motion understands. */\nconst MOTION_EASINGS = new Set([\n 'linear', 'easeIn', 'easeOut', 'easeInOut', 'circIn', 'circOut', 'circInOut',\n 'backIn', 'backOut', 'backInOut', 'anticipate',\n]);\n\n/** Common long names (as on easings.net) for Motion's easings. */\nconst ALIASES: Record<string, string> = {\n easeInCirc: 'circIn', easeOutCirc: 'circOut', easeInOutCirc: 'circInOut',\n easeInBack: 'backIn', easeOutBack: 'backOut', easeInOutBack: 'backInOut',\n};\n\nconst warned = new Set<string>();\n\n/**\n * Resolve an easing name, cubic bezier, function or spring config to what Motion takes.\n */\nexport function getEasing(\n easingString: string | number[] | ((t: number) => number) | { type: 'spring'; stiffness?: number; damping?: number } | undefined,\n motionAnimation: MotionAnimationService\n): any {\n if (!easingString) return motionAnimation.easeInOut;\n\n // Array easing (cubic bezier)\n if (Array.isArray(easingString)) {\n return easingString;\n }\n\n // Spring configuration\n if (typeof easingString === 'object' && 'type' in easingString && easingString.type === 'spring') {\n return motionAnimation.spring({\n stiffness: easingString.stiffness || 100,\n damping: easingString.damping || 10\n });\n }\n\n // An easing function: Motion takes it as-is\n if (typeof easingString === 'function') return easingString;\n\n // Named easing strings\n if (typeof easingString === 'string') {\n if (easingString === 'ease-in') return motionAnimation.easeIn;\n if (easingString === 'ease-out') return motionAnimation.easeOut;\n if (easingString === 'ease-in-out' || easingString === 'ease') return motionAnimation.easeInOut;\n if (easingString === 'spring') return motionAnimation.spring();\n // Motion's own names (linear, easeOut, backOut, anticipate…) pass through\n if (MOTION_EASINGS.has(easingString)) return easingString;\n if (ALIASES[easingString]) return ALIASES[easingString];\n if (isDevMode() && !warned.has(easingString)) {\n warned.add(easingString);\n console.warn(`[ngx-motion] Unknown easing \"${easingString}\", using easeInOut. Use one of: ${[...MOTION_EASINGS].join(', ')}, a cubic bezier array or a function.`);\n }\n }\n\n return motionAnimation.easeInOut;\n}\n\n/**\n * Map Framer Motion repeatType to Motion One direction\n */\nexport function mapRepeatTypeToDirection(\n repeatType: TransitionOptions['repeatType'] | undefined\n): 'normal' | 'reverse' | 'alternate' | undefined {\n if (!repeatType) return undefined;\n\n // Aliases\n if (repeatType === 'forwards' || repeatType === 'loop') return 'normal';\n if (repeatType === 'reverse') return 'reverse';\n if (repeatType === 'pingPong' || repeatType === 'mirror') return 'alternate';\n\n // Default\n return 'normal';\n}\n\n/**\n * Normalize repeat value (convert boolean/number to number)\n */\nexport function normalizeRepeatValue(repeat: number | boolean | undefined): number {\n if (repeat === undefined) return 0;\n if (repeat === true) return Infinity;\n if (typeof repeat === 'number') return repeat;\n return 0;\n}\n\n/**\n * Get repeat value from transition object or fallback\n */\nexport function getRepeatValue(transitionObj: TransitionOptions, fallbackRepeat: boolean): number {\n if (transitionObj.repeat !== undefined) {\n if (transitionObj.repeat === true) {\n return Infinity;\n } else if (typeof transitionObj.repeat === 'number') {\n return transitionObj.repeat;\n }\n }\n\n return fallbackRepeat ? Infinity : 0;\n}\n","import { Injectable } from '@angular/core';\nimport type { AnimationOptions } from 'motion';\nimport { TransitionOptions, VariantWithTransition } from '../types/motion-animation.types';\nimport { MotionAnimationService } from './motion-animation.service';\nimport { getEasing, getRepeatValue, mapRepeatTypeToDirection } from '../utils/easing.utils';\n\nexport interface AnimationOptionsConfig {\n targetState?: VariantWithTransition;\n animateState?: VariantWithTransition;\n staggerDelay?: number;\n transition: TransitionOptions | Record<string, TransitionOptions>;\n delay: number;\n easing: string | number[] | { type: 'spring'; stiffness?: number; damping?: number };\n duration: number;\n repeat: boolean;\n onComplete?: () => void;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionAnimationOptionsService {\n\n constructor(private motionAnimation: MotionAnimationService) {}\n\n /**\n * Build animation options from configuration\n * Handles priority: stagger delay > state transition > global transition > defaults\n */\n getAnimationOptions(config: AnimationOptionsConfig): AnimationOptions {\n // Priority: 1. Stagger delay, 2. State-specific transition, 3. Global transition, 4. Individual properties\n const stateTransition = (config.targetState?.transition as TransitionOptions) ??\n (config.animateState?.transition as TransitionOptions);\n const globalTransition = (config.transition as TransitionOptions);\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n // Always prioritize stagger delay over any other delay settings (including 0)\n const delay = config.staggerDelay !== undefined && config.staggerDelay >= 0\n ? config.staggerDelay\n : (transitionObj.delay ?? config.delay);\n\n // Framer-style `{ type: 'spring', stiffness, damping }` on the transition itself\n const easeInput = transitionObj.type === 'spring'\n ? { type: 'spring' as const, stiffness: transitionObj.stiffness, damping: transitionObj.damping }\n : (transitionObj.ease ?? config.easing);\n\n // Detect if target contains keyframe arrays (avoid native spring in that case)\n let targetHasKeyframeArrays = false;\n if (config.targetState) {\n for (const k of Object.keys(config.targetState)) {\n if (k === 'transition' || k === 'at') continue;\n const v: any = config.targetState[k];\n if (Array.isArray(v)) {\n targetHasKeyframeArrays = true;\n break;\n }\n }\n }\n\n // If spring config and no keyframe arrays, prefer native spring options (no fixed duration)\n if (easeInput && typeof easeInput === 'object' && 'type' in easeInput &&\n easeInput.type === 'spring' && !targetHasKeyframeArrays) {\n const springOptions: any = {\n type: 'spring',\n stiffness: easeInput.stiffness ?? 100,\n damping: easeInput.damping ?? 10,\n delay,\n repeat: getRepeatValue(transitionObj, config.repeat),\n repeatDelay: transitionObj.repeatDelay,\n onComplete: config.onComplete\n };\n const direction = mapRepeatTypeToDirection(transitionObj.repeatType);\n if (direction) springOptions.direction = direction;\n if (transitionObj.repeatType) springOptions.repeatType = transitionObj.repeatType;\n return springOptions as AnimationOptions;\n }\n\n const ease = getEasing(easeInput, this.motionAnimation);\n\n const options: any = {\n duration: transitionObj.duration ?? config.duration,\n delay,\n repeat: getRepeatValue(transitionObj, config.repeat),\n repeatDelay: transitionObj.repeatDelay,\n onComplete: config.onComplete\n };\n\n const direction = mapRepeatTypeToDirection(transitionObj.repeatType);\n if (direction) options.direction = direction;\n if (transitionObj.repeatType) options.repeatType = transitionObj.repeatType;\n\n options.easing = ease; // Motion 11+\n options.ease = ease; // Back-compat\n\n return options as AnimationOptions;\n }\n\n /**\n * Get stagger value from transition configuration\n */\n getStaggerValue(\n animateState?: VariantWithTransition,\n transition?: TransitionOptions | Record<string, TransitionOptions>,\n defaultStaggerChildren: number = 0\n ): number {\n const stateTransition = animateState?.transition as TransitionOptions;\n const globalTransition = transition as TransitionOptions;\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n return transitionObj.staggerChildren ?? defaultStaggerChildren;\n }\n\n /**\n * Get delayChildren from transition configuration (state transition first,\n * then the transition input, then the delayChildren input), as in Framer Motion\n */\n getDelayChildren(\n animateState?: VariantWithTransition,\n transition?: TransitionOptions | Record<string, TransitionOptions>,\n defaultDelayChildren: number = 0\n ): number {\n const stateTransition = animateState?.transition as TransitionOptions;\n const globalTransition = transition as TransitionOptions;\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n return transitionObj.delayChildren ?? defaultDelayChildren;\n }\n\n /**\n * Get stagger direction from transition configuration\n */\n getStaggerDirection(\n animateState?: VariantWithTransition,\n transition?: TransitionOptions | Record<string, TransitionOptions>,\n defaultStaggerDirection: number = 1\n ): number {\n const stateTransition = animateState?.transition as TransitionOptions;\n const globalTransition = transition as TransitionOptions;\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n return transitionObj.staggerDirection ?? defaultStaggerDirection;\n }\n\n /**\n * Get 'when' property from transition configuration\n */\n getWhen(\n animateState?: VariantWithTransition,\n transition?: TransitionOptions | Record<string, TransitionOptions>\n ): 'beforeChildren' | 'afterChildren' | 'together' {\n const stateTransition = animateState?.transition as TransitionOptions;\n const globalTransition = transition as TransitionOptions;\n\n const transitionObj: TransitionOptions = stateTransition || globalTransition || {};\n\n return (transitionObj.when ?? 'together') as 'beforeChildren' | 'afterChildren' | 'together';\n }\n}\n","/**\n * Normalize keyframe times array to 0-1 range\n * Handles both normalized (0-1) and absolute time values\n */\nexport function normalizeTimes(times: number[] | undefined, duration: number): number[] | undefined {\n if (!times || times.length === 0) return undefined;\n\n // Check if any values are above 1 (indicating absolute times)\n const hasValuesAboveOne = times.some(t => t > 1);\n if (!hasValuesAboveOne) return times;\n\n // Find the maximum time value\n const maxT = Math.max(...times);\n\n // Ensure duration is valid (avoid division by zero)\n const safeDuration = Math.max(duration, 0.000001);\n\n // Determine divisor: use maxT if significantly larger than duration, else use duration\n const divisor = maxT > safeDuration * 1.001 ? maxT : safeDuration;\n\n // Normalize to 0-1 range\n return times.map(t => {\n const v = t / divisor;\n return v < 0 ? 0 : v > 1 ? 1 : v;\n });\n}\n\n/**\n * Calculate stagger delay for a child element\n * Takes into account the child's index and stagger direction\n */\nexport function calculateStaggerDelay(\n index: number,\n totalChildren: number,\n staggerValue: number,\n direction: number\n): number {\n let staggerIndex: number;\n\n if (direction >= 0) {\n // Forward direction: 0, 1, 2, 3...\n staggerIndex = index;\n } else {\n // Reverse direction: 3, 2, 1, 0...\n staggerIndex = totalChildren - 1 - index;\n }\n\n return staggerIndex * staggerValue;\n}\n\n/**\n * Calculate total duration including stagger for all children\n */\nexport function calculateTotalStaggerDuration(\n childCount: number,\n staggerValue: number,\n baseDelay: number,\n delayChildren: number\n): number {\n return baseDelay + delayChildren + (childCount * staggerValue);\n}\n","import { Injectable } from '@angular/core';\nimport { TransitionOptions } from '../types/motion-animation.types';\nimport { calculateStaggerDelay, calculateTotalStaggerDuration } from '../utils/timing.utils';\n\nexport interface StaggerConfig {\n childCount: number;\n staggerValue: number;\n staggerDirection: number;\n delayChildren: number;\n parentDelay: number;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionStaggerService {\n\n /**\n * Calculate the delay for a specific child in a stagger sequence\n */\n calculateChildDelay(\n index: number,\n config: StaggerConfig\n ): number {\n const staggerDelay = calculateStaggerDelay(\n index,\n config.childCount,\n config.staggerValue,\n config.staggerDirection\n );\n\n return config.parentDelay + config.delayChildren + staggerDelay;\n }\n\n /**\n * Calculate delays for all children in a stagger sequence\n */\n calculateAllChildDelays(config: StaggerConfig): number[] {\n const delays: number[] = [];\n\n for (let i = 0; i < config.childCount; i++) {\n delays.push(this.calculateChildDelay(i, config));\n }\n\n return delays;\n }\n\n /**\n * Calculate the total duration for a stagger animation sequence\n */\n calculateTotalDuration(config: StaggerConfig): number {\n return calculateTotalStaggerDuration(\n config.childCount,\n config.staggerValue,\n config.parentDelay,\n config.delayChildren\n );\n }\n\n /**\n * Determine the stagger index based on direction\n */\n getStaggerIndex(index: number, childCount: number, direction: number): number {\n if (direction >= 0) {\n return index; // Forward: 0, 1, 2, 3...\n } else {\n return childCount - 1 - index; // Reverse: 3, 2, 1, 0...\n }\n }\n}\n","/**\n * Default values for Motion One animations\n */\n\nexport const MOTION_DEFAULTS = {\n DURATION: 0.3,\n DELAY: 0,\n EXIT_DELAY: 0,\n DELAY_CHILDREN: 0,\n EASING: 'ease',\n OFFSET: '0px',\n STAGGER_CHILDREN: 0, // Framer Motion default: children animate together unless staggerChildren is set\n STAGGER_DIRECTION: 1,\n REPEAT: false,\n INVIEW_THRESHOLD: 0.1,\n INVIEW_DELAY: 50,\n INVIEW_MARGIN: '0px',\n INVIEW_ROOT_MARGIN: '0px',\n RESET_TIMEOUT: 10,\n STAGGER_TIMEOUT: 50,\n} as const;\n\n/**\n * Transform properties that need special handling\n */\nexport const TRANSFORM_PROPERTIES = ['x', 'y', 'rotate', 'scale', 'scaleX', 'scaleY'] as const;\n\n/**\n * Color properties that need normalization\n */\nexport const COLOR_PROPERTIES = ['backgroundColor', 'color', 'borderColor'] as const;\n\n/**\n * Properties that should be excluded from style extraction\n */\nexport const EXCLUDED_PROPERTIES = ['transition', 'at'] as const;\n\n/**\n * Identity matrix for transform operations\n */\nexport const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0] as const;\n","import { Injectable, PLATFORM_ID, Inject } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MOTION_DEFAULTS } from '../constants/motion-defaults.constants';\n\nexport interface IntersectionObserverConfig {\n root?: Element | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionInViewService {\n\n constructor(@Inject(PLATFORM_ID) private platformId: Object) {}\n\n /**\n * Create an IntersectionObserver with the given configuration\n */\n createObserver(\n callback: IntersectionObserverCallback,\n config: IntersectionObserverConfig = {}\n ): IntersectionObserver | null {\n if (!isPlatformBrowser(this.platformId)) {\n return null;\n }\n\n const observerConfig: IntersectionObserverInit = {\n root: config.root ?? null,\n rootMargin: config.rootMargin ?? MOTION_DEFAULTS.INVIEW_ROOT_MARGIN,\n threshold: config.threshold ?? MOTION_DEFAULTS.INVIEW_THRESHOLD\n };\n\n return new IntersectionObserver(callback, observerConfig);\n }\n\n /**\n * Create a standard IntersectionObserver for runInView functionality\n */\n createRunInViewObserver(\n element: HTMLElement,\n onEntry: () => void,\n onExit: () => void\n ): IntersectionObserver | null {\n return this.createObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n onEntry();\n } else {\n onExit();\n }\n });\n },\n {\n root: null,\n rootMargin: MOTION_DEFAULTS.INVIEW_ROOT_MARGIN,\n threshold: MOTION_DEFAULTS.INVIEW_THRESHOLD\n }\n );\n }\n\n /**\n * Parse margin string (e.g., \"0px\", \"10px 20px\")\n */\n parseMargin(margin: string): string {\n // Ensure margin is in valid format for IntersectionObserver\n if (!margin) return MOTION_DEFAULTS.INVIEW_MARGIN;\n return margin;\n }\n\n /**\n * Check if IntersectionObserver is supported\n */\n isSupported(): boolean {\n if (!isPlatformBrowser(this.platformId)) {\n return false;\n }\n return 'IntersectionObserver' in window;\n }\n\n /**\n * Safely disconnect an observer\n */\n disconnect(observer: IntersectionObserver | null | undefined): void {\n if (observer) {\n observer.disconnect();\n }\n }\n}\n","import { COLOR_PROPERTIES } from '../constants/motion-defaults.constants';\n\n/**\n * Check if a property is a color property\n */\nexport function isColorProperty(key: string): boolean {\n return COLOR_PROPERTIES.includes(key as any);\n}\n\n/**\n * Normalize color values to a consistent format\n * Converts named colors to hex values for consistent animation\n */\nexport function normalizeColor(color: any): string {\n if (color == null) return '';\n\n if (typeof color !== 'string') {\n try {\n return String(color);\n } catch {\n return '';\n }\n }\n\n // Already normalized formats\n if (color.startsWith('rgb') || color.startsWith('#')) {\n return color;\n }\n\n // Named color mappings\n const colorMap: Record<string, string> = {\n aqua: '#00ffff',\n red: '#ff0000',\n blue: '#0000ff',\n green: '#008000',\n yellow: '#ffff00',\n purple: '#800080',\n orange: '#ffa500',\n black: '#000000',\n white: '#ffffff',\n };\n\n return colorMap[color] || color;\n}\n\n/**\n * Normalize color values in an array or single value\n */\nexport function normalizeColorValue(value: any): any {\n if (Array.isArray(value)) {\n return value.map(v => normalizeColor(v));\n }\n return normalizeColor(value);\n}\n","import { Injectable, NgZone, inject } from '@angular/core';\nimport type { Target } from 'motion';\nimport { TimelineStep, TransitionOptions, VariantWithTransition } from '../types/motion-animation.types';\nimport { MotionAnimationService } from './motion-animation.service';\nimport { isColorProperty, normalizeColorValue } from '../utils/color.utils';\nimport { getEasing, getRepeatValue, mapRepeatTypeToDirection } from '../utils/easing.utils';\nimport { normalizeTimes } from '../utils/timing.utils';\n\nconst TRANSITION_OPTION_KEYS = new Set([\n 'duration', 'delay', 'ease', 'easing', 'type', 'stiffness', 'damping', 'mass',\n 'bounce', 'velocity', 'restSpeed', 'restDelta', 'repeat', 'repeatType', 'repeatDelay',\n 'staggerChildren', 'staggerDirection', 'delayChildren', 'when', 'times'\n]);\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionTimelineService {\n private readonly ngZone = inject(NgZone);\n\n constructor(private motionAnimation: MotionAnimationService) {}\n\n /**\n * Execute a timeline with orchestrated per-property animations\n */\n runTimeline(\n element: HTMLElement,\n timeline: TimelineStep[],\n targetState: VariantWithTransition,\n baseDelay: number,\n duration: number,\n easing: any,\n repeat: boolean,\n onComplete?: () => void\n ): { controls: any[]; maxEnd: number } {\n const controls: any[] = [];\n let maxEnd = 0;\n\n // Also animate any non-timeline props from the target state (e.g., opacity)\n const timelinePropsSet = new Set(timeline.map(s => s.prop));\n const nonTimelineTarget: any = {};\n\n Object.keys(targetState).forEach(k => {\n if (k === 'transition' || k === 'at') return;\n if (!timelinePropsSet.has(k)) {\n nonTimelineTarget[k] = targetState[k];\n }\n });\n\n if (Object.keys(nonTimelineTarget).length > 0) {\n const options: any = {\n duration,\n delay: baseDelay,\n easing,\n ease: easing,\n repeat: repeat ? Infinity : 0\n };\n\n const ctl = this.motionAnimation.animate(element as unknown as Target, nonTimelineTarget, options);\n controls.push(ctl);\n const nonEnd = (options.delay ?? 0) + (options.duration ?? duration);\n if (nonEnd > maxEnd) maxEnd = nonEnd;\n }\n\n // Execute each timeline step\n timeline.forEach(step => {\n const start = baseDelay + (step.atTime ?? 0) + (step.delay ?? 0);\n const stepDuration = step.duration;\n const value = step.keyframes !== undefined ? step.keyframes : step.to;\n const easeInput = step.ease ?? easing;\n\n const ease = getEasing(easeInput, this.motionAnimation);\n const options: any = {\n duration: stepDuration,\n delay: start,\n easing: ease,\n ease: ease\n };\n\n // Apply repeat controls if provided\n if (step.repeat !== undefined) {\n options.repeat = step.repeat === true ? Infinity : step.repeat;\n }\n if (step.repeatDelay !== undefined) {\n options.repeatDelay = step.repeatDelay;\n }\n\n const dir = mapRepeatTypeToDirection(step.repeatType);\n if (dir) options.direction = dir;\n if (step.repeatType) options.repeatType = step.repeatType;\n if (step.times) options.offset = normalizeTimes(step.times, stepDuration);\n\n const end = start + stepDuration;\n if (end > maxEnd) maxEnd = end;\n\n let v = value;\n if (isColorProperty(step.prop)) {\n v = normalizeColorValue(v);\n }\n\n const target = { [step.prop]: v } as any;\n const control = this.motionAnimation.animate(element as unknown as Target, target, options);\n controls.push(control);\n });\n\n // Set up completion callback\n if (onComplete) {\n this.ngZone.runOutsideAngular(() => setTimeout(() => onComplete(), maxEnd * 1000));\n }\n\n return { controls, maxEnd };\n }\n\n /**\n * Execute per-property animations with different timing for each property\n */\n runPerPropertyAnimations(\n element: HTMLElement,\n targetState: VariantWithTransition,\n baseDelay: number,\n duration: number,\n easing: any,\n repeat: boolean,\n onComplete?: () => void\n ): { controls: any[]; maxEnd: number } {\n const controls: any[] = [];\n const transitionMap = targetState.transition as Record<string, TransitionOptions>;\n const props = Object.keys(targetState).filter(k => k !== 'transition' && k !== 'at');\n\n let maxEnd = 0;\n\n props.forEach((prop) => {\n const value = (targetState as any)[prop];\n const conf = (transitionMap?.[prop] || {}) as TransitionOptions;\n const delay = baseDelay + (conf.delay ?? 0);\n const ease = getEasing(conf.ease ?? easing, this.motionAnimation);\n const propDuration = conf.duration ?? duration;\n\n const options: any = {\n duration: propDuration,\n delay,\n easing: ease,\n ease: ease,\n repeat: conf.repeat !== undefined ? getRepeatValue(conf, repeat) : (repeat ? Infinity : 0),\n repeatDelay: conf.repeatDelay\n };\n\n const dir = mapRepeatTypeToDirection(conf.repeatType);\n if (dir) options.direction = dir;\n if (conf.repeatType) options.repeatType = conf.repeatType;\n\n const times = (conf as any).times as number[] | undefined;\n if (times && Array.isArray(times)) {\n options.offset = normalizeTimes(times, propDuration);\n }\n\n const end = delay + propDuration;\n if (end > maxEnd) maxEnd = end;\n\n let finalValue = value;\n if (isColorProperty(prop)) {\n finalValue = normalizeColorValue(value);\n }\n\n const target = { [prop]: finalValue } as any;\n const control = this.motionAnimation.animate(element as unknown as Target, target, options);\n controls.push(control);\n });\n\n // Set up completion callback\n if (onComplete) {\n this.ngZone.runOutsideAngular(() => setTimeout(() => onComplete(), maxEnd * 1000));\n }\n\n return { controls, maxEnd };\n }\n\n /**\n * Check if a transition is a per-property map, e.g.\n * `{ opacity: { duration: 0.2 }, x: { duration: 1, ease: 'ease-out' } }`.\n *\n * It must be a non-empty object whose keys are not transition options and whose\n * values are all plain objects. Previously any transition without\n * duration/delay/ease (such as `{ type: 'spring', stiffness: 200 }` or\n * `{ staggerChildren: 0.1 }`) was misread as a per-property map.\n */\n isPerPropertyTransition(transition: any): boolean {\n if (!transition || typeof transition !== 'object' || Array.isArray(transition)) return false;\n\n const keys = Object.keys(transition);\n if (keys.length === 0) return false;\n\n return keys.every(key =>\n !TRANSITION_OPTION_KEYS.has(key) &&\n transition[key] !== null &&\n typeof transition[key] === 'object' &&\n !Array.isArray(transition[key])\n );\n }\n}\n","import { Injectable } from '@angular/core';\n\nexport interface GestureAnimationState {\n isAnimating: boolean;\n gestureType: 'hover' | 'tap' | 'focus' | null;\n targetState: string | null;\n controls: any;\n startTime: number;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MotionGestureService {\n private gestureStates = new Map<string, GestureAnimationState>();\n private readonly MIN_GESTURE_INTERVAL = 50; // Minimum ms between gesture triggers\n\n /**\n * Check if a gesture should be allowed based on timing\n * Prevents rapid-fire gesture triggers that cause aggressive spring behavior\n */\n shouldAllowGesture(elementId: string, gestureType: 'hover' | 'tap' | 'focus'): boolean {\n const state = this.gestureStates.get(elementId);\n\n if (!state) {\n return true;\n }\n\n // Allow gestures of different types immediately\n if (state.gestureType !== gestureType) {\n return true;\n }\n\n // Check if enough time has passed since last gesture of same type\n const timeSinceLastGesture = Date.now() - state.startTime;\n return timeSinceLastGesture >= this.MIN_GESTURE_INTERVAL;\n }\n\n /**\n * Register that a gesture animation is starting\n */\n startGesture(\n elementId: string,\n gestureType: 'hover' | 'tap' | 'focus',\n targetState: string,\n controls: any\n ): void {\n const existingState = this.gestureStates.get(elementId);\n\n // Stop any existing animation for this element\n if (existingState?.controls) {\n try {\n existingState.controls.stop();\n } catch (e) {\n // Animation may have already finished\n }\n }\n\n this.gestureStates.set(elementId, {\n isAnimating: true,\n gestureType,\n targetState,\n controls,\n startTime: Date.now()\n });\n }\n\n /**\n * Register that a gesture animation has ended\n */\n endGesture(elementId: string): void {\n const state = this.gestureStates.get(elementId);\n if (state) {\n state.isAnimating = false;\n state.gestureType = null;\n state.targetState = null;\n }\n }\n\n /**\n * Get the current gesture state for an element\n */\n getGestureState(elementId: string): GestureAnimationState | undefined {\n return this.gestureStates.get(elementId);\n }\n\n /**\n * Cancel any ongoing gesture animation for an element\n * Returns true if an animation was cancelled\n */\n cancelGesture(elementId: string): boolean {\n const state = this.gestureStates.get(elementId);\n\n if (state?.controls && state.isAnimating) {\n try {\n state.controls.stop();\n this.endGesture(elementId);\n return true;\n } catch (e) {\n // Animation may have already finished\n }\n }\n\n return false;\n }\n\n /**\n * Check if an element currently has an active gesture animation\n */\n isGestureActive(elementId: string, gestureType?: 'hover' | 'tap' | 'focus'): boolean {\n const state = this.gestureStates.get(elementId);\n\n if (!state || !state.isAnimating) {\n return false;\n }\n\n if (gestureType) {\n return state.gestureType === gestureType;\n }\n\n return true;\n }\n\n /**\n * Clear all gesture state (useful for cleanup)\n */\n clearElement(elementId: string): void {\n this.cancelGesture(elementId);\n this.gestureStates.delete(elementId);\n }\n\n /**\n * Clear all gesture states\n */\n clearAll(): void {\n this.gestureStates.forEach((_, elementId) => {\n this.cancelGesture(elementId);\n });\n this.gestureStates.clear();\n }\n}\n","import { TRANSFORM_PROPERTIES, IDENTITY_MATRIX } from '../constants/motion-defaults.constants';\n\n/**\n * Check if a property should be handled as a transform\n */\nexport function isTransformProperty(key: string): boolean {\n return TRANSFORM_PROPERTIES.includes(key as any);\n}\n\n/**\n * Create an identity matrix for transform operations\n */\nexport function createIdentityMatrix(): number[] {\n return [...IDENTITY_MATRIX];\n}\n\n/**\n * Parse a matrix string to array of numbers\n */\nexport function parseMatrix(matrixString: string): number[] {\n const match = matrixString.match(/matrix\\((.*)\\)/);\n if (!match) return createIdentityMatrix();\n return match[1].split(',').map(Number);\n}\n\n/**\n * Multiply two 2D transformation matrices\n */\nexport function multiplyMatrices(a: number[], b: number[]): number[] {\n return [\n a[0] * b[0] + a[2] * b[1], // a\n a[1] * b[0] + a[3] * b[1], // b\n a[0] * b[2] + a[2] * b[3], // c\n a[1] * b[2] + a[3] * b[3], // d\n a[0] * b[4] + a[2] * b[5] + a[4], // e\n a[1] * b[4] + a[3] * b[5] + a[5] // f\n ];\n}\n\n/**\n * Convert a matrix array to CSS matrix string\n */\nexport function matrixToCssString(matrix: number[]): string {\n return `matrix(${matrix.join(',')})`;\n}\n\n/**\n * Create a transformation matrix for a specific transform type\n */\nexport function createTransformMatrix(key: string, value: any): number[] {\n switch (key) {\n case 'x':\n return [1, 0, 0, 1, value, 0];\n case 'y':\n return [1, 0, 0, 1, 0, value];\n case 'rotate':\n const rad = (value * Math.PI) / 180;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n return [cos, sin, -sin, cos, 0, 0];\n case 'scale':\n return [value, 0, 0, value, 0, 0];\n case 'scaleX':\n return [value, 0, 0, 1, 0, 0];\n case 'scaleY':\n return [1, 0, 0, value, 0, 0];\n default:\n return createIdentityMatrix();\n }\n}\n\n/**\n * Apply a transform property to a result object\n * Handles keyframe arrays and individual values\n */\nexport function applyTransformProperty(\n result: Record<string, any>,\n key: string,\n value: any\n): void {\n // If keyframe array is provided, let Motion One handle it directly\n if (Array.isArray(value)) {\n result[key] = value;\n return;\n }\n\n // Initialize transform matrix if it doesn't exist\n if (!result['transform']) {\n result['transform'] = matrixToCssString(createIdentityMatrix());\n }\n\n // Parse current matrix\n const currentMatrix = parseMatrix(result['transform']);\n\n // Create new matrix based on the transform type\n const newMatrix = createTransformMatrix(key, value);\n\n // Multiply matrices\n const finalMatrix = multiplyMatrices(currentMatrix, newMatrix);\n\n // Apply the new matrix\n result['transform'] = matrixToCssString(finalMatrix);\n}\n\n/**\n * Normalize the transform property by trimming extra spaces\n */\nexport function normalizeTransformProperty(result: Record<string, any>): void {\n if (result['transform']) {\n result['transform'] = result['transform'].trim();\n }\n}\n","import { applySvgPath, isSvgPathKey } from './svg-path.utils';\nimport { VariantWithTransition } from '../types/motion-animation.types';\nimport { EXCLUDED_PROPERTIES } from '../constants/motion-defaults.constants';\nimport { isTransformProperty } from './transform.utils';\nimport { isColorProperty, normalizeColorValue } from './color.utils';\n\n/**\n * Extract only style properties from a variant (excluding transition and metadata)\n */\nexport function extractStyleProperties(variant: VariantWithTransition): Record<string, any> {\n if (!variant) return {};\n\n const result: Record<string, any> = {};\n\n for (const key in variant) {\n // Skip meta keys\n if (EXCLUDED_PROPERTIES.includes(key as any)) continue;\n\n // Allow raw transform strings to pass through\n if (key === 'transform') {\n result['transform'] = variant[key];\n continue;\n }\n\n // CRITICAL FIX: Pass transform properties directly to Motion One\n // Motion One can animate rotate, scale, x, y, etc. as individual properties\n // This provides much better spring animation interruption and avoids 3D transform issues\n if (isTransformProperty(key)) {\n // Pass the value directly - Motion One will handle it\n result[key] = variant[key];\n } else {\n applyStyleProperty(result, key, variant[key]);\n }\n }\n\n // Don't normalize transforms - let Motion One handle them natively\n // normalizeTransformProperty(result);\n\n return result;\n}\n\n/**\n * Apply a regular style property to the result object\n * Handles color normalization if needed\n */\nexport function applyStyleProperty(\n result: Record<string, any>,\n key: string,\n value: any\n): void {\n if (isColorProperty(key)) {\n result[key] = normalizeColorValue(value);\n } else {\n result[key] = value;\n }\n}\n\n/**\n * Check if a variant has any style properties to apply\n */\nexport function hasStyleProperties(variant: VariantWithTransition): boolean {\n if (!variant || typeof variant !== 'object') return false;\n\n for (const key in variant) {\n if (!EXCLUDED_PROPERTIES.includes(key as any)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Motion's shorthand transform keys, in the order Motion composes them.\n * Element.style has no `x`/`y`/`rotate`-as-number etc., so assigning these with\n * Object.assign(el.style, ...) silently did nothing.\n */\nconst TRANSFORM_ORDER = [\n 'transformPerspective', 'x', 'y', 'z', 'translateX', 'translateY', 'translateZ',\n 'scale', 'scaleX', 'scaleY', 'rotate', 'rotateX', 'rotateY', 'rotateZ',\n 'skew', 'skewX', 'skewY'\n] as const;\nconst TRANSFORM_KEYS = new Set<string>(TRANSFORM_ORDER);\n\nfunction withUnit(key: string, value: any): string {\n if (typeof value !== 'number') return String(value);\n if (key === 'transformPerspective' || key === 'x' || key === 'y' || key === 'z' || key.startsWith('translate')) {\n return `${value}px`;\n }\n if (key.startsWith('rotate') || key.startsWith('skew')) return `${value}deg`;\n return String(value); // scale\n}\n\nfunction transformFunction(key: string, value: any): string {\n const v = withUnit(key, value);\n switch (key) {\n case 'transformPerspective': return `perspective(${v})`;\n case 'x': return `translateX(${v})`;\n case 'y': return `translateY(${v})`;\n case 'z': return `translateZ(${v})`;\n default: return `${key}(${v})`;\n }\n}\n\nconst kebab = (key: string) => key.replace(/[A-Z]/g, c => '-' + c.toLowerCase());\n\n/** A keyframe array's first value is the resting value to show before animating. */\nfunction firstFrame(value: any): any {\n return Array.isArray(value) ? value[0] : value;\n}\n\n/**\n * Write styles to an element synchronously, translating Motion's shorthand\n * transform keys (x, y, rotate, scale, ...) into a CSS transform string.\n */\nexport function applyInlineStyles(el: HTMLElement | SVGElement, styles: Record<string, any>): void {\n if (!el?.style || !styles) return;\n\n const transforms: string[] = [];\n let rawTransform: string | undefined;\n let path: Record<string, unknown> | undefined;\n const svgShape = typeof SVGElement !== 'undefined' && el instanceof SVGElement && !(el instanceof SVGSVGElement);\n\n for (const key of Object.keys(styles)) {\n const value = firstFrame(styles[key]);\n if (value === undefined || value === null) continue;\n if (key === 'transform') {\n rawTransform = String(value);\n } else if (isSvgPathKey(key)) {\n (path ??= {})[key] = value;\n } else if (!TRANSFORM_KEYS.has(key)) {\n if (svgShape && !key.startsWith('--')) {\n // Motion animates an SVG shape's styles as attributes; an inline style\n // here would outrank them and the animation would never show\n el.style.removeProperty(kebab(key));\n el.setAttribute(kebab(key), String(value));\n } else {\n (el.style as any)[key] = value;\n }\n }\n }\n\n if (path) applySvgPath(el, path);\n\n for (const key of TRANSFORM_ORDER) {\n if (key in styles) {\n const value = firstFrame(styles[key]);\n if (value !== undefined && value !== null) transforms.push(transformFunction(key, value));\n }\n }\n\n if (rawTransform !== undefined || transforms.length > 0) {\n el.style.transform = [rawTransform, ...transforms].filter(Boolean).join(' ');\n }\n}\n","import { VariantWithTransition } from '../types/motion-animation.types';\n\n/**\n * Resolve a variant reference to its actual definition\n * Handles both string references and direct object definitions\n */\nexport function resolveVariant(\n variant: VariantWithTransition | string,\n variants: { [key: string]: VariantWithTransition }\n): VariantWithTransition {\n if (typeof variant === 'string') {\n return variants[variant] || {};\n } else if (typeof variant === 'object' && variant !== null) {\n return variant;\n } else {\n return {};\n }\n}\n\n/**\n * Extract metadata properties from a variant (properties that aren't styles)\n */\nexport function extractVariantMetadata(variant: VariantWithTransition): {\n transition?: any;\n at?: number;\n} {\n return {\n transition: variant.transition,\n at: variant.at\n };\n}\n\n/**\n * Check if a variant has any style properties (excluding metadata)\n */\nexport function hasStyleProperties(variant: VariantWithTransition): boolean {\n if (!variant || typeof variant !== 'object') return false;\n\n const keys = Object.keys(variant);\n const styleKeys = keys.filter(key => key !== 'transition' && key !== 'at');\n\n return styleKeys.length > 0;\n}\n\n/**\n * Check if a variant is empty or undefined\n */\nexport function isEmptyVariant(variant: VariantWithTransition | string | undefined): boolean {\n if (!variant) return true;\n if (typeof variant === 'string') return false; // String references are not empty\n if (typeof variant === 'object') {\n return Object.keys(variant).length === 0;\n }\n return true;\n}\n","import {\n Directive,\n Input,\n ElementRef,\n OnDestroy,\n Output,\n EventEmitter,\n OnChanges,\n SimpleChanges,\n HostListener,\n OnInit,\n PLATFORM_ID,\n Inject,\n AfterContentInit,\n NgZone,\n inject\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionOneService } from '../services/motion-one.service';\nimport { MotionAnimationService } from '../services/motion-animation.service';\nimport { MotionAnimationOptionsService } from '../services/motion-animation-options.service';\nimport { MotionStaggerService } from '../services/motion-stagger.service';\nimport { MotionInViewService } from '../services/motion-inview.service';\nimport { MotionTimelineService } from '../services/motion-timeline.service';\nimport { MotionGestureService } from '../services/motion-gesture.service';\nimport type { AnimationOptions, Target } from 'motion';\nimport { VariantWithTransition, TransitionOptions, TimelineStep } from '../types/motion-animation.types';\nimport { MOTION_DEFAULTS } from '../constants/motion-defaults.constants';\nimport { extractStyleProperties, applyInlineStyles } from '../utils/style-extraction.utils';\nimport { resolveVariant } from '../utils/variant.utils';\n\nlet uniqueIdCounter = 0;\n\n/** Element → its motionone directive, to find the nearest one in the DOM. */\nconst directiveByElement = new WeakMap<Element, MotionOneDirective>();\n\n/** Nearest motionone on an ancestor of `el`, searching no higher than `stop` (exclusive). */\nfunction nearestMotionAncestor(el: Element, stop: Element): MotionOneDirective | undefined {\n for (let node = el.parentElement; node && node !== stop; node = node.parentElement) {\n const found = directiveByElement.get(node);\n if (found) return found;\n }\n return undefined;\n}\n\n/** Where transforms rest when nothing else says. */\nconst NEUTRAL_TRANSFORMS: Record<string, number> = {\n x: 0, y: 0, z: 0, scale: 1, scaleX: 1, scaleY: 1, rotate: 0, rotateX: 0, rotateY: 0, rotateZ: 0, skew: 0, skewX: 0, skewY: 0,\n};\n\n@Directive({\n selector: '[motionone]',\n standalone: true,\n exportAs: 'motionone'\n})\nexport class MotionOneDirective implements OnInit, OnDestroy, OnChanges, AfterContentInit {\n @Input() initial: VariantWithTransition | string = {};\n @Input() animate: VariantWithTransition | string = {};\n @Input() exit: VariantWithTransition | string = {};\n @Input() inView: VariantWithTransition = {};\n @Input() duration: number = MOTION_DEFAULTS.DURATION;\n @Input() delay: number = MOTION_DEFAULTS.DELAY;\n @Input() delayChildren: number = MOTION_DEFAULTS.DELAY_CHILDREN;\n @Input() repeat: boolean = MOTION_DEFAULTS.REPEAT;\n @Input() exitDelay: number = MOTION_DEFAULTS.EXIT_DELAY;\n @Input() easing: string | number[] | { type: 'spring'; stiffness?: number; damping?: number } = MOTION_DEFAULTS.EASING;\n @Input() offset: string = MOTION_DEFAULTS.OFFSET;\n /** A style object, or a variant name: children with that variant animate too. */\n @Input() whileHover: VariantWithTransition | string = {};\n @Input() staggerChildren: number = MOTION_DEFAULTS.STAGGER_CHILDREN;\n @Input() staggerDirection: number = MOTION_DEFAULTS.STAGGER_DIRECTION;\n @Input() whileTap: VariantWithTransition | string = {};\n @Input() whileFocus: VariantWithTransition | string = {};\n @Input() whileInView: VariantWithTransition = {};\n @Input() runInView?: 'never' | 'once' | 'always';\n @Input() variants: { [key: string]: VariantWithTransition } = {};\n @Input() transition: TransitionOptions | Record<string, TransitionOptions> = {};\n @Input() timeline: TimelineStep[] | undefined;\n @Output() animationComplete = new EventEmitter<void>();\n\n // Public method to restart animations\n public restartAnimation() {\n this.cancelForReset();\n\n const initialVariant = this.getVariant(this.initial);\n const initialStyles = extractStyleProperties(initialVariant);\n\n const element = this.el.nativeElement;\n element.style.transition = 'none';\n this.setInlineStyles(initialStyles);\n element.offsetHeight;\n\n // Only the latest restart plays: rapid calls used to queue overlapping plays\n this.cancelScheduled(this.restartTimer);\n this.restartTimer = this.schedule(() => {\n this.restartTimer = undefined;\n element.style.transition = '';\n if (!this.isRunInViewEnabled) {\n // runInView elements are started by their in-view observer instead\n this.playAnimation(this.initial, this.animate);\n }\n }, MOTION_DEFAULTS.RESET_TIMEOUT);\n }\n\n private restartTimer: any;\n\n /**\n * Nearest ancestor motionone directive (through component boundaries).\n * Children register with it so a parent only orchestrates its *direct*\n * motion children; grandchildren are orchestrated by their own parent.\n */\n private parentMotion = inject(MotionOneDirective, { optional: true, skipSelf: true });\n private readonly motionChildren: MotionOneDirective[] = [];\n /** Set once this directive has wired up its children (see initChildren). */\n private childrenInitialized = false;\n /**\n * Values the element was last reset to via inline styles. Motion caches each\n * element's last animated values, so after a reset it would otherwise animate\n * from the stale cached value (i.e. not move at all). The next animation uses\n * these as explicit `[from, to]` keyframes.\n */\n private pendingFrom: Record<string, any> | null = null;\n\n /** Direct motionone children, in registration (DOM) order. */\n get childMotionDirectives(): MotionOneDirective[] {\n return this.motionChildren;\n }\n\n private controls: any = null;\n private childrenControls: any[] = [];\n public elementId: string;\n private hoverTimeout: any;\n private observer?: IntersectionObserver | null;\n /** Stop function returned by Motion's inView() */\n private inViewStop: (() => void) | null = null;\n private readonly ngZone = inject(NgZone);\n /** Removes gesture listeners attached in syncGestureListeners() */\n private gestureCleanups: (() => void)[] = [];\n private attachedGestures = new Set<'hover' | 'tap' | 'focus'>();\n /** Removes a pending window mouseup/touchend listener from an in-progress press */\n private pressEndCleanup: (() => void) | null = null;\n private isChild = false;\n private parentDirective: MotionOneDirective | null = null;\n private initialAnimationPlayed = false;\n private _skipStartStylesApplication = false;\n private staggerDelay: number | undefined = undefined;\n private childrenCount = 0;\n private childIndex = 0;\n private isStaggeredChild = false;\n // Track all setTimeout calls for proper cleanup on destroy\n private activeTimeouts: Set<any> = new Set();\n\n get scrollProgress() {\n return this.motionService.scrollYProgress();\n }\n\n private get isRunInViewEnabled(): boolean {\n return this.runInView === 'once' || this.runInView === 'always';\n }\n\n private get runInViewRepeat(): 'once' | 'always' {\n return this.runInView === 'always' ? 'always' : 'once';\n }\n\n constructor(\n public el: ElementRef,\n private motionService: MotionOneService,\n private motionAnimation: MotionAnimationService,\n private animationOptions: MotionAnimationOptionsService,\n private staggerService: MotionStaggerService,\n private inViewService: MotionInViewService,\n private timelineService: MotionTimelineService,\n private gestureService: MotionGestureService,\n @Inject(PLATFORM_ID) private platformId: Object\n ) {\n this.elementId = `motion-${uniqueIdCounter++}`;\n\n this.parentMotion?.motionChildren.push(this);\n directiveByElement.set(this.el.nativeElement, this);\n\n if (isPlatformBrowser(this.platformId)) {\n // Only give the element an id if it doesn't already have one\n if (!this.el.nativeElement.id) {\n this.el.nativeElement.setAttribute('id', this.elementId);\n }\n (this.el.nativeElement as any)._motionDirective = this;\n this.motionService.registerMotionElement(this);\n }\n }\n\n /** Write styles synchronously and remember them as the next animation's start values. */\n private setInlineStyles(styles: Record<string, any>) {\n if (!styles || Object.keys(styles).length === 0) return;\n applyInlineStyles(this.el.nativeElement, styles);\n this.pendingFrom = { ...(this.pendingFrom || {}), ...styles };\n }\n\n /** Animate this element, starting from any values it was just reset to. */\n private animateSelf(targetStyles: Record<string, any>, options: any): any {\n let keyframes = targetStyles;\n if (this.pendingFrom) {\n // Starting from a reset: the element was moved back without animating, so\n // the velocity of whatever was interrupted no longer applies. Inheriting it\n // made rapid restarts of a spring compound until it flew off-screen.\n options = { ...options, velocity: 0 };\n keyframes = { ...targetStyles };\n for (const key of Object.keys(targetStyles)) {\n if (key in this.pendingFrom && !Array.isArray(targetStyles[key])) {\n const from = this.pendingFrom[key];\n keyframes[key] = [Array.isArray(from) ? from[0] : from, targetStyles[key]];\n }\n }\n this.pendingFrom = null;\n }\n this.controls = this.motionAnimation.animate(this.el.nativeElement as Target, keyframes, options);\n return this.controls;\n }\n\n /**\n * setTimeout outside the Angular zone (so it doesn't trigger change detection),\n * tracked so it is cleared on destroy.\n */\n private schedule(fn: () => void, ms: number): any {\n const timeoutId = this.ngZone.runOutsideAngular(() =>\n setTimeout(() => {\n this.activeTimeouts.delete(timeoutId);\n fn();\n }, ms)\n );\n this.activeTimeouts.add(timeoutId);\n return timeoutId;\n }\n\n private cancelScheduled(timeoutId: any) {\n if (timeoutId === undefined || timeoutId === null) return;\n clearTimeout(timeoutId);\n this.activeTimeouts.delete(timeoutId);\n }\n\n /** Emit animationComplete back inside the zone, and only if someone is listening. */\n private emitComplete(): void {\n if (this.animationComplete.observed) {\n this.ngZone.run(() => this.animationComplete.emit());\n }\n }\n\n ngOnInit() {\n // A child is driven by its parent only if the parent hasn't wired up its\n // children yet; children added later (e.g. new @for items) animate themselves.\n this.isChild = !!this.parentMotion && !this.parentMotion.childrenInitialized;\n\n this.applyInitialStyles();\n\n if (isPlatformBrowser(this.platformId)) {\n this.syncGestureListeners();\n\n // runInView is set up in initChildren(), once children are known\n if (!this.isChild && !this.isRunInViewEnabled) {\n this.playAnimation(this.initial, this.animate);\n }\n\n // Setup inView/whileInView animations\n if (!this.isStaggeredChild &&\n ((this.inView && Object.keys(this.inView).length > 0) ||\n (this.whileInView && Object.keys(this.whileInView).length > 0))) {\n this.setupInViewAnimation();\n }\n }\n }\n\n ngAfterContentInit() {\n if (!isPlatformBrowser(this.platformId)) return;\n // Wait a tick so children inside nested components / control flow have registered\n this.schedule(() => this.initChildren(), 0);\n }\n\n /** Wire up direct children and start whatever this directive orchestrates. Idempotent. */\n private initChildren() {\n if (this.childrenInitialized) return;\n this.childrenInitialized = true;\n this.rehomeProjectedChildren();\n\n const children = this.motionChildren;\n this.childrenCount = children.length;\n children.forEach((child, index) => child.setParent(this, index, children.length));\n\n if (this.isRunInViewEnabled && !this.isChild) {\n // This element's in-view observer drives its children\n children.forEach(child => (child.isStaggeredChild = true));\n if (this.runInView === 'always' && children.length > 0) {\n this.setupRunInViewObserver();\n } else {\n this.setupMotionOneInView();\n }\n return;\n }\n\n if (children.length === 0) return;\n\n if (this.getStaggerValue() === 0) {\n // No stagger: in-view children watch their own visibility\n children.forEach(child => {\n if (child.isRunInViewEnabled) child.setupInViewAnimation();\n });\n } else {\n children.forEach(child => {\n if (child.isRunInViewEnabled) child.isStaggeredChild = true;\n });\n }\n\n // A nested parent waits for its own parent to play it (see playAsChild)\n if (!this.isChild && !this.isRunInViewEnabled) {\n this.applyStaggerToChildren();\n }\n }\n\n /**\n * DI registers content projected into a component (`<ng-content>`) with the\n * motionone around the component, not with the motionone the content is\n * rendered inside. Framer Motion uses the rendered tree, so hand each such\n * child to its nearest motionone ancestor in the DOM. Only ancestors inside\n * this element count (content moved elsewhere, e.g. an overlay, stays put).\n */\n private rehomeProjectedChildren() {\n const host = this.el.nativeElement as HTMLElement;\n for (const child of [...this.motionChildren]) {\n const owner = nearestMotionAncestor(child.el.nativeElement, host);\n if (!owner || owner === this) continue;\n this.motionChildren.splice(this.motionChildren.indexOf(child), 1);\n child.parentMotion = owner;\n owner.adoptChild(child);\n }\n }\n\n /** Take over a child rehomed from an outer motionone (see rehomeProjectedChildren). */\n private adoptChild(child: MotionOneDirective) {\n const list = this.motionChildren;\n // Keep DOM order, which is the stagger order\n const at = list.findIndex(c =>\n !!(child.el.nativeElement.compareDocumentPosition(c.el.nativeElement) & Node.DOCUMENT_POSITION_FOLLOWING));\n list.splice(at === -1 ? list.length : at, 0, child);\n if (this.childrenInitialized) {\n // Too late to be orchestrated: play like any child added after init\n child.isChild = false;\n if (child.isRunInViewEnabled) child.setupInViewAnimation();\n else child.playAnimation(child.initial, child.animate);\n }\n }\n\n /** Children this directive plays itself (in-view children play themselves when there's no stagger). */\n private childrenToPlay(): MotionOneDirective[] {\n // An in-view child watches its own visibility unless this parent drives it\n // (isStaggeredChild), in which case it's played here like any other child\n return this.getStaggerValue() === 0\n ? this.motionChildren.filter(child => !child.isRunInViewEnabled || child.isStaggeredChild)\n : this.motionChildren;\n }\n\n /** Called by the parent when it's this child's turn in the stagger. */\n private playAsChild() {\n // The parent's timer already applied the stagger slot; the child's own\n // transition.delay (if any) is added on top of it rather than discarded\n this.staggerDelay = undefined;\n try {\n if (this.motionChildren.length > 0) {\n this.initChildren();\n this.applyStaggerToChildren();\n } else {\n this.playAnimation(this.initial, this.animate);\n }\n } finally {\n this.staggerDelay = undefined;\n }\n }\n\n setParent(parent: MotionOneDirective, index: number, totalChildren: number) {\n this.parentDirective = parent;\n this.isChild = true;\n this.childIndex = index;\n this.childrenCount = totalChildren;\n }\n\n public completeResetToInitial() {\n this.forceResetToInitial();\n this.motionChildren.forEach(child => child.completeResetToInitial());\n }\n\n public forceResetToInitial() {\n this.cancelForReset();\n\n const initialVariant = this.getVariant(this.initial);\n const initialStyles = extractStyleProperties(initialVariant);\n\n this.el.nativeElement.style.transition = 'none';\n this.el.nativeElement.style.opacity = '';\n this.el.nativeElement.style.transform = '';\n this.setInlineStyles(initialStyles);\n this.el.nativeElement.offsetHeight;\n this.el.nativeElement.style.transition = '';\n\n this.initialAnimationPlayed = false;\n }\n\n public resetToInitialIfParentHasRunInView() {\n this.forceResetToInitial();\n }\n\n public parentExitViewportReset() {\n this.completeResetToInitial();\n }\n\n private setupRunInViewObserver() {\n if (!isPlatformBrowser(this.platformId)) return;\n\n const observer = this.ngZone.runOutsideAngular(() =>\n this.inViewService.createRunInViewObserver(\n this.el.nativeElement,\n () => this.handleViewportEntry(),\n () => this.handleViewportExit()\n )\n );\n\n if (observer) {\n this.observer = observer;\n this.observer.observe(this.el.nativeElement);\n }\n }\n\n private handleViewportEntry() {\n if (this.motionChildren.length > 0) {\n this.applyStaggerToChildren();\n } else {\n this.playAnimation(this.initial, this.animate);\n }\n }\n\n private handleViewportExit() {\n if (this.runInView === 'always') {\n if (this.motionChildren.length > 0) {\n this.motionChildren.forEach((child) => {\n if (child.controls) {\n child.controls.stop();\n child.controls = null;\n }\n child.playAnimation(child.animate, child.initial);\n child.initialAnimationPlayed = false;\n });\n }\n }\n }\n\n applyStaggerToChildren() {\n const staggerValue = this.getStaggerValue();\n const staggerDirection = this.getStaggerDirection();\n const delayChildren = this.animationOptions.getDelayChildren(\n this.getVariant(this.animate),\n this.transition,\n this.delayChildren\n );\n const parentDelay = (((this.transition as TransitionOptions)?.delay) ?? 0) as number;\n\n const childDirectives = this.childrenToPlay();\n const childCount = childDirectives.length;\n const when = this.getWhen();\n\n if (when !== 'afterChildren') {\n this.runSelfAnimation();\n }\n\n childDirectives.forEach((childDirective, index) => {\n const totalDelay = this.staggerService.calculateChildDelay(index, {\n childCount,\n staggerValue,\n staggerDirection,\n delayChildren,\n parentDelay\n });\n\n // The timer alone applies the stagger delay. (Previously the same delay was\n // also passed as the animation's own delay, doubling it, and the child's\n // transition input was mutated to clear its delay.)\n this.schedule(() => childDirective.playAsChild(), totalDelay * 1000);\n });\n\n if (when === 'afterChildren') {\n const totalChildrenDuration = this.staggerService.calculateTotalDuration({\n childCount,\n staggerValue,\n staggerDirection,\n delayChildren,\n parentDelay\n });\n const previous = this.staggerDelay;\n this.staggerDelay = totalChildrenDuration;\n this.runSelfAnimation();\n this.staggerDelay = previous;\n }\n }\n\n overrideDelay(delay: number) {\n this.staggerDelay = delay;\n }\n\n runSelfAnimation() {\n const options = this.getAnimationOptions();\n const targetStyles = extractStyleProperties(this.getVariant(this.animate));\n const startStyles = extractStyleProperties(this.getVariant(this.initial));\n\n if (!this.isStaggeredChild) {\n this.setInlineStyles(startStyles);\n }\n\n this.animateSelf(targetStyles, options);\n\n this.initialAnimationPlayed = true;\n }\n\n ngOnDestroy() {\n // Clear all pending setTimeout calls to prevent navigation blocking\n this.activeTimeouts.forEach(timeoutId => {\n clearTimeout(timeoutId);\n });\n this.activeTimeouts.clear();\n\n // Clear hover timeout\n if (this.hoverTimeout) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = null;\n }\n\n // Remove gesture listeners and any pending press-end listener\n this.gestureCleanups.forEach(cleanup => cleanup());\n this.gestureCleanups = [];\n this.attachedGestures.clear();\n this.pressEndCleanup?.();\n this.pressEndCleanup = null;\n\n // Clean up gesture state\n this.gestureService.clearElement(this.elementId);\n\n // Disconnect Motion's inView observer\n this.stopInView();\n\n // Disconnect intersection observer\n this.inViewService.disconnect(this.observer);\n this.observer = undefined;\n\n // Stop all animation controls\n if (this.controls) {\n try {\n this.controls.stop();\n } catch (e) {\n // Ignore errors if already stopped\n }\n this.controls = null;\n }\n\n // Stop all children animation controls\n this.childrenControls.forEach(control => {\n if (control) {\n try {\n control.stop();\n } catch (e) {\n // Ignore errors if already stopped\n }\n }\n });\n this.childrenControls = [];\n\n directiveByElement.delete(this.el.nativeElement);\n\n // Detach from parent; children clean up in their own ngOnDestroy\n if (this.parentMotion) {\n const i = this.parentMotion.motionChildren.indexOf(this);\n if (i !== -1) this.parentMotion.motionChildren.splice(i, 1);\n }\n\n // Unregister from motion service\n this.motionService.unregisterMotionElement(this);\n\n // Skip exit animation on destroy to prevent blocking\n // Exit animations should be handled by Angular's built-in animation system\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes['animate'] && changes['animate'].previousValue !== undefined) {\n const oldState = changes['animate'].previousValue;\n let newState = changes['animate'].currentValue;\n\n if (typeof newState === 'object') {\n this.playAnimation(oldState, newState);\n } else if (typeof newState === 'string' && this.variants?.[newState]) {\n newState = this.variants[newState];\n this.playAnimation(oldState, newState);\n }\n }\n\n if (changes['transition'] && !changes['transition'].firstChange) {\n this.playAnimation(this.initial, this.animate);\n }\n\n if ((changes['whileHover'] || changes['whileTap'] || changes['whileFocus']) &&\n isPlatformBrowser(this.platformId) && this.gestureListenersReady) {\n this.syncGestureListeners();\n }\n }\n\n private gestureListenersReady = false;\n\n /**\n * Attach only the gesture listeners this element actually uses, outside the\n * Angular zone. Previously every directive bound six host listeners, each of\n * which triggered app-wide change detection, and touchstart was non-passive.\n */\n private syncGestureListeners() {\n this.gestureListenersReady = true;\n const el: HTMLElement = this.el.nativeElement;\n const listen = (type: string, handler: (e: any) => void, options?: AddEventListenerOptions) => {\n this.ngZone.runOutsideAngular(() => el.addEventListener(type, handler, options));\n this.gestureCleanups.push(() => el.removeEventListener(type, handler, options));\n };\n\n if (!this.attachedGestures.has('hover') && this.hasKeys(this.whileHover)) {\n this.attachedGestures.add('hover');\n listen('mouseenter', () => this.onMouseEnter());\n listen('mouseleave', () => this.onMouseLeave());\n }\n if (!this.attachedGestures.has('tap') && this.hasKeys(this.whileTap)) {\n this.attachedGestures.add('tap');\n listen('mousedown', (e: Event) => this.onPress(e));\n listen('touchstart', (e: Event) => this.onPress(e), { passive: true });\n }\n if (!this.attachedGestures.has('focus') && this.hasKeys(this.whileFocus)) {\n this.attachedGestures.add('focus');\n listen('focus', () => this.onFocus());\n listen('blur', () => this.onBlur());\n }\n }\n\n private hasKeys(value: unknown): boolean {\n if (typeof value === 'string') return value.length > 0;\n return !!value && typeof value === 'object' && Object.keys(value).length > 0;\n }\n\n /** Where this element rests when a gesture ends: its animate state, else its initial one. */\n private restingState(): VariantWithTransition | string {\n return this.hasKeys(this.animate) ? this.animate : this.initial;\n }\n\n /** Values from before any gesture changed them, for keys the resting state doesn't set. */\n private gestureBase: Record<string, unknown> = {};\n\n /** Remember what a gesture is about to change, if nothing else says where it rests. */\n private captureGestureBase(gesture: VariantWithTransition | string) {\n if (!isPlatformBrowser(this.platformId)) return;\n const rest = resolveVariant(this.restingState(), this.variants);\n const style = getComputedStyle(this.el.nativeElement);\n for (const key of Object.keys(extractStyleProperties(resolveVariant(gesture, this.variants)))) {\n if (key in rest || key in this.gestureBase || key in NEUTRAL_TRANSFORMS) continue;\n this.gestureBase[key] = style.getPropertyValue(key.replace(/[A-Z]/g, c => '-' + c.toLowerCase())) || (style as unknown as Record<string, string>)[key];\n }\n }\n\n /**\n * Where to go when a gesture ends: the resting state, plus (as in Framer\n * Motion) neutral transforms and the earlier values of any other style the\n * gesture changed. Without this, an element with only whileHover stayed in\n * its hover state.\n */\n private restTarget(gesture: VariantWithTransition | string): VariantWithTransition | string {\n const rest = this.restingState();\n const resolved = resolveVariant(rest, this.variants);\n const missing = Object.keys(extractStyleProperties(resolveVariant(gesture, this.variants))).filter(k => !(k in resolved));\n if (!missing.length) return rest;\n const out: VariantWithTransition = { ...resolved };\n for (const key of missing) {\n const value = key in NEUTRAL_TRANSFORMS ? NEUTRAL_TRANSFORMS[key] : this.gestureBase[key];\n if (value !== undefined && value !== '') (out as Record<string, unknown>)[key] = value;\n }\n return out;\n }\n\n /** Gestures in progress on this element. */\n private readonly activeGestures = new Set<'hover' | 'tap' | 'focus'>();\n\n /** The gesture that shows: tap over focus over hover, as in Framer Motion. */\n private topGesture(): { type: 'hover' | 'tap' | 'focus'; value: VariantWithTransition | string } | undefined {\n const order: ['tap' | 'focus' | 'hover', VariantWithTransition | string][] = [['tap', this.whileTap], ['focus', this.whileFocus], ['hover', this.whileHover]];\n const top = order.find(([type, value]) => this.activeGestures.has(type) && this.hasKeys(value));\n return top && { type: top[0], value: top[1] };\n }\n\n private asVariant(v: VariantWithTransition | string): VariantWithTransition {\n return resolveVariant(v, this.variants);\n }\n\n /** Start a gesture; it only shows if no stronger gesture is on. */\n private beginGesture(type: 'hover' | 'tap' | 'focus', value: VariantWithTransition | string) {\n this.activeGestures.add(type);\n if (this.topGesture()?.type !== type) return;\n this.captureGestureBase(value);\n this.playAnimationToTarget(value, type);\n this.propagateGesture(value, true);\n }\n\n /** End a gesture: fall back to one still on (hover under a released tap), else to rest. */\n private endGesture(type: 'hover' | 'tap' | 'focus', value: VariantWithTransition | string) {\n const wasTop = this.topGesture()?.type === type;\n this.activeGestures.delete(type);\n if (!wasTop) return;\n const next = this.topGesture();\n if (!next) {\n this.playAnimationToTarget(this.restTarget(value));\n this.propagateGesture(value, false);\n return;\n }\n this.playAnimationToTarget({ ...this.asVariant(this.restTarget(value)), ...this.asVariant(next.value) }, next.type);\n if (typeof next.value === 'string') this.propagateGesture(next.value, true, value);\n else this.propagateGesture(value, false);\n }\n\n /** A pending staggered start from a parent's gesture, cancelled if the gesture ends first. */\n private gestureTimer: any;\n\n /**\n * Pass a gesture's variant name down the tree (Framer Motion's variant\n * propagation): while the parent is hovered, tapped or focused, every\n * descendant with a variant of that name animates to it, then returns to\n * where it rests. The parent's variant transition can stagger them\n * (staggerChildren, delayChildren, staggerDirection).\n */\n private propagateGesture(label: VariantWithTransition | string, active: boolean, ended?: VariantWithTransition | string) {\n if (typeof label !== 'string' || !label) return;\n const transition = (resolveVariant(label, this.variants)?.transition ?? {}) as Record<string, number>;\n // Stagger only on the way in, not when falling back from another gesture\n const each = active && !ended ? transition['staggerChildren'] ?? 0 : 0;\n const first = active && !ended ? transition['delayChildren'] ?? 0 : 0;\n const children = this.motionChildren;\n const reversed = (transition['staggerDirection'] ?? 1) < 0;\n children.forEach((child, i) => {\n const slot = reversed ? children.length - 1 - i : i;\n const run = () => {\n child.gestureTimer = undefined;\n const endedHere = typeof ended === 'string' && !!child.variants?.[ended];\n if (child.variants?.[label]) {\n if (active) child.captureGestureBase(label);\n if (!active) child.playAnimationToTarget(child.restTarget(label));\n // Falling back to this gesture from another: undo what that one changed too\n else if (endedHere) child.playAnimationToTarget({ ...child.asVariant(child.restTarget(ended!)), ...child.getVariant(label) });\n else child.playAnimationToTarget(label);\n } else if (active && endedHere) {\n child.playAnimationToTarget(child.restTarget(ended!));\n }\n child.propagateGesture(label, active, ended);\n };\n child.cancelScheduled(child.gestureTimer);\n child.gestureTimer = undefined;\n const delay = first + slot * each;\n if (delay > 0) child.gestureTimer = child.schedule(run, delay * 1000);\n else run();\n });\n }\n\n /**\n * Cancel running animations before writing reset styles. Motion's stop()\n * commits the current value on the next frame, which overwrote the reset\n * (an element leaving the view mid-animation froze half-way); cancel() doesn't.\n */\n private cancelForReset() {\n const cancel = (c: any) => {\n if (!c) return;\n try {\n typeof c.cancel === 'function' ? c.cancel() : c.stop();\n } catch {\n // already finished\n }\n };\n cancel(this.controls);\n this.controls = null;\n this.childrenControls.forEach(cancel);\n this.childrenControls = [];\n }\n\n private stopInView() {\n if (this.inViewStop) {\n this.inViewStop();\n this.inViewStop = null;\n }\n }\n\n /** Reset elements to their initial styles with a single forced reflow for the whole batch. */\n private resetToInitialStylesBatch(directives: MotionOneDirective[]) {\n const elements: HTMLElement[] = [];\n directives.forEach(directive => {\n directive.cancelForReset();\n const styles = extractStyleProperties(directive.getVariant(directive.initial));\n if (Object.keys(styles).length === 0) return;\n const el: HTMLElement = directive.el.nativeElement;\n el.style.transition = 'none';\n directive.setInlineStyles(styles);\n elements.push(el);\n });\n if (elements.length === 0) return;\n void elements[0].offsetHeight; // one reflow for all writes above\n elements.forEach(el => (el.style.transition = ''));\n }\n\n onMouseEnter() {\n if (this.hasKeys(this.whileHover)) {\n clearTimeout(this.hoverTimeout);\n\n // Check if we should allow this gesture (prevents aggressive rapid triggers)\n if (!this.gestureService.shouldAllowGesture(this.elementId, 'hover')) {\n return;\n }\n\n // Cancel any ongoing gesture animation state tracking\n this.gestureService.cancelGesture(this.elementId);\n\n // Don't stop the animation - Motion One will automatically interrupt it\n // and animate from the current position when we start a new animation\n // This creates smooth transitions even during rapid hovers\n\n // Animate to whileHover from current position\n // Motion One will automatically use current animated values as start\n this.beginGesture('hover', this.whileHover);\n }\n }\n\n onMouseLeave() {\n if (this.hasKeys(this.whileHover)) {\n clearTimeout(this.hoverTimeout);\n\n // Cancel the hover gesture state tracking\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate back to initial/animate state from current position\n // Note: hoverTimeout is tracked separately and cleared in ngOnDestroy\n this.hoverTimeout = this.ngZone.runOutsideAngular(() => setTimeout(() => {\n this.endGesture('hover', this.whileHover);\n }, 100));\n }\n }\n\n onPress(event: Event) {\n if (this.hasKeys(this.whileTap)) {\n // Check if we should allow this gesture (prevents aggressive rapid triggers)\n if (!this.gestureService.shouldAllowGesture(this.elementId, 'tap')) {\n return;\n }\n\n // Cancel gesture state tracking\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate to whileTap from current position\n this.beginGesture('tap', this.whileTap);\n\n if (isPlatformBrowser(this.platformId)) {\n const endEvent = event.type === 'mousedown' ? 'mouseup' : 'touchend';\n this.pressEndCleanup?.();\n const endListener = () => {\n this.pressEndCleanup = null;\n // Cancel the tap gesture state\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate back from current position\n this.endGesture('tap', this.whileTap);\n window.removeEventListener(endEvent, endListener);\n };\n this.ngZone.runOutsideAngular(() => window.addEventListener(endEvent, endListener));\n this.pressEndCleanup = () => window.removeEventListener(endEvent, endListener);\n }\n }\n }\n\n onFocus() {\n if (this.hasKeys(this.whileFocus)) {\n // Check if we should allow this gesture (prevents aggressive rapid triggers)\n if (!this.gestureService.shouldAllowGesture(this.elementId, 'focus')) {\n return;\n }\n\n // Cancel gesture state tracking\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate to whileFocus from current position\n this.beginGesture('focus', this.whileFocus);\n }\n }\n\n onBlur() {\n if (this.hasKeys(this.whileFocus)) {\n // Cancel the focus gesture state\n this.gestureService.cancelGesture(this.elementId);\n\n // Animate back from current position\n this.endGesture('focus', this.whileFocus);\n }\n }\n\n applyInitialValues() {\n this.setInlineStyles(extractStyleProperties(this.getVariant(this.initial)));\n }\n\n private applyInitialStyles() {\n const styles = extractStyleProperties(this.getVariant(this.initial));\n\n if (styles && Object.keys(styles).length > 0) {\n if (this.isRunInViewEnabled && isPlatformBrowser(this.platformId)) {\n this.el.nativeElement.style.transition = 'none';\n this.setInlineStyles(styles);\n this.el.nativeElement.offsetHeight;\n this.el.nativeElement.style.transition = '';\n } else {\n this.setInlineStyles(styles);\n }\n }\n }\n\n private applyAnimateStyles() {\n this.setInlineStyles(extractStyleProperties(this.getVariant(this.animate)));\n }\n\n public extractStyleProperties(variant: VariantWithTransition): Record<string, any> {\n return extractStyleProperties(variant);\n }\n\n private getAnimationOptions(targetState?: VariantWithTransition): AnimationOptions {\n return this.animationOptions.getAnimationOptions({\n targetState,\n animateState: this.getVariant(this.animate),\n staggerDelay: this.staggerDelay,\n transition: this.transition,\n delay: this.delay,\n easing: this.easing,\n duration: this.duration,\n repeat: this.repeat,\n onComplete: () => this.emitComplete()\n });\n }\n\n private getStaggerValue(): number {\n return this.animationOptions.getStaggerValue(\n this.getVariant(this.animate),\n this.transition,\n this.staggerChildren\n );\n }\n\n private getStaggerDirection(): number {\n return this.animationOptions.getStaggerDirection(\n this.getVariant(this.animate),\n this.transition,\n this.staggerDirection\n );\n }\n\n private getWhen(): 'beforeChildren' | 'afterChildren' | 'together' {\n return this.animationOptions.getWhen(\n this.getVariant(this.animate),\n this.transition\n );\n }\n\n /**\n * Play animation TO a target state from current position\n * Motion One will automatically use current animated values as the start\n */\n private playAnimationToTarget(\n targetState: VariantWithTransition | string,\n gestureType?: 'hover' | 'tap' | 'focus'\n ) {\n if (!targetState || !isPlatformBrowser(this.platformId)) return;\n\n const resolvedTargetState = resolveVariant(targetState, this.variants);\n\n if (resolvedTargetState.at !== undefined) {\n this.schedule(() => {\n this.animateToTarget(resolvedTargetState, gestureType);\n }, resolvedTargetState.at * 1000);\n return;\n }\n\n this.animateToTarget(resolvedTargetState, gestureType);\n }\n\n /**\n * Original playAnimation method - still used for initial animations and explicit start→end\n */\n private playAnimation(\n startState: VariantWithTransition | string,\n targetState: VariantWithTransition | string,\n gestureType?: 'hover' | 'tap' | 'focus'\n ) {\n if (!targetState || !isPlatformBrowser(this.platformId)) return;\n\n const resolvedStartState = resolveVariant(startState || this.initial, this.variants);\n const resolvedTargetState = resolveVariant(targetState || this.animate, this.variants);\n\n if (resolvedTargetState.at !== undefined) {\n this.schedule(() => {\n this.continueAnimation(resolvedTargetState, false, gestureType);\n }, resolvedTargetState.at * 1000);\n return;\n }\n\n this.continueAnimation(resolvedTargetState, false, gestureType);\n }\n\n /**\n * Animate to target from current position without explicit start state\n * Motion One automatically interrupts any conflicting animations and preserves velocity\n */\n private animateToTarget(\n resolvedTargetState: VariantWithTransition,\n gestureType?: 'hover' | 'tap' | 'focus'\n ) {\n // Timeline takes precedence\n if (this.timeline && this.timeline.length > 0) {\n this.runTimeline(resolvedTargetState);\n return;\n }\n\n // Per-property transition map\n const t: any = resolvedTargetState.transition;\n if (this.timelineService.isPerPropertyTransition(t)) {\n this.runPerPropertyAnimations(resolvedTargetState);\n return;\n }\n\n // Get animation options\n const options = this.getAnimationOptions(resolvedTargetState);\n const targetStyles = extractStyleProperties(resolvedTargetState);\n\n // Motion One automatically interrupts conflicting animations\n // By passing individual transform properties (rotate, scale, x, y),\n // Motion One can smoothly interpolate and preserve spring velocity\n this.animateSelf(targetStyles, options);\n\n // Register gesture animation if this is a gesture\n if (gestureType) {\n this.gestureService.startGesture(\n this.elementId,\n gestureType,\n typeof resolvedTargetState === 'string' ? resolvedTargetState : 'custom',\n this.controls\n );\n }\n }\n\n private continueAnimation(\n resolvedTargetState: VariantWithTransition,\n isInitialAnimation: boolean,\n gestureType?: 'hover' | 'tap' | 'focus'\n ) {\n // Timeline takes precedence\n if (this.timeline && this.timeline.length > 0) {\n this.runTimeline(resolvedTargetState);\n return;\n }\n\n // Per-property transition map\n const t: any = resolvedTargetState.transition;\n if (this.timelineService.isPerPropertyTransition(t)) {\n this.runPerPropertyAnimations(resolvedTargetState);\n return;\n }\n\n // Check for stagger on initial animation\n if (isInitialAnimation && !this.initialAnimationPlayed) {\n const staggerValue = this.getStaggerValue();\n if (staggerValue > 0 && this.motionChildren.length > 0) {\n const when = this.getWhen();\n if (when !== 'afterChildren') {\n this.runSelfAnimation();\n }\n return;\n }\n }\n\n // Normal animation\n const options = this.getAnimationOptions(resolvedTargetState);\n const targetStyles = extractStyleProperties(resolvedTargetState);\n\n this.animateSelf(targetStyles, options);\n\n // Register gesture animation if this is a gesture\n if (gestureType) {\n this.gestureService.startGesture(\n this.elementId,\n gestureType,\n typeof resolvedTargetState === 'string' ? resolvedTargetState : 'custom',\n this.controls\n );\n }\n\n if (isInitialAnimation) {\n this.initialAnimationPlayed = true;\n }\n\n // Note: plain (non-motionone) DOM children are not animated. They used to be\n // animated to the parent's target styles too, which compounded transforms\n // (a parent moving to x: 100 moved its children 200px).\n }\n\n private runPerPropertyAnimations(resolvedTargetState: VariantWithTransition) {\n const baseDelay = this.staggerDelay !== undefined && this.staggerDelay >= 0\n ? this.staggerDelay\n : (((resolvedTargetState.transition as TransitionOptions)?.delay) ?? this.delay);\n\n const result = this.timelineService.runPerPropertyAnimations(\n this.el.nativeElement,\n resolvedTargetState,\n baseDelay,\n this.duration,\n this.easing,\n this.repeat,\n () => this.emitComplete()\n );\n\n this.childrenControls = result.controls;\n }\n\n private runTimeline(resolvedTargetState: VariantWithTransition) {\n const baseDelay = this.staggerDelay !== undefined && this.staggerDelay >= 0\n ? this.staggerDelay\n : (((resolvedTargetState.transition as TransitionOptions)?.delay) ?? this.delay);\n\n const result = this.timelineService.runTimeline(\n this.el.nativeElement,\n this.timeline!,\n resolvedTargetState,\n baseDelay,\n this.duration,\n this.easing,\n this.repeat,\n () => this.emitComplete()\n );\n\n this.childrenControls = result.controls;\n }\n\n private setupInViewAnimation() {\n if (!isPlatformBrowser(this.platformId)) return;\n\n try {\n if (this.isRunInViewEnabled) {\n this.setupMotionOneInView();\n } else {\n const hasWhileInView = this.whileInView && Object.keys(this.whileInView).length > 0;\n const hasInView = this.inView && Object.keys(this.inView).length > 0;\n\n if (hasWhileInView) {\n this.setupWhileInViewAnimation();\n } else if (hasInView) {\n this.stopInView();\n this.inViewStop = this.motionAnimation.inView(\n this.el.nativeElement,\n () => this.runInViewAnimation(),\n { margin: this.offset, amount: 'some' }\n );\n }\n }\n } catch (error) {\n console.error('[ngx-motion] Error setting up inView observer:', error);\n }\n }\n\n runInViewAnimation() {\n if (this.inView && Object.keys(this.inView).length > 0) {\n this.playAnimation(this.initial, this.inView);\n } else if (this.whileInView && Object.keys(this.whileInView).length > 0) {\n this.playAnimation(this.initial, this.whileInView);\n }\n }\n\n private setupWhileInViewAnimation() {\n this.stopInView();\n this.inViewStop = this.motionAnimation.inView(\n this.el.nativeElement,\n () => this.playAnimation(this.initial, this.whileInView),\n { margin: this.offset, amount: 'some' }\n );\n }\n\n private setupMotionOneInView() {\n const margin = this.offset || MOTION_DEFAULTS.INVIEW_MARGIN;\n // A root in-view element drives its children. So does a nested one that its\n // parent left to watch its own visibility (not a staggered child): without\n // this its children (e.g. split-text letters) never played.\n if (this.motionChildren.length > 0 && (!this.isChild || !this.isStaggeredChild)) {\n if (this.isChild) {\n this.initChildren();\n this.motionChildren.forEach(child => (child.isStaggeredChild = true));\n }\n this.setupStaggerParentInView(margin);\n } else if (!this.isStaggeredChild) {\n this.setupIndividualElementInView(margin);\n }\n }\n\n /**\n * Motion's inView() calls onStart on enter; returning a function makes it keep\n * observing and call that function on leave. Returning nothing stops observing\n * after the first entry, which is what runInView=\"once\" wants.\n */\n private setupStaggerParentInView(margin: string) {\n this.stopInView();\n this.inViewStop = this.motionAnimation.inView(\n this.el.nativeElement,\n () => {\n const childDirectives = this.motionChildren;\n this.resetToInitialStylesBatch([this, ...childDirectives]);\n\n let pending: any = null;\n if (childDirectives.length > 0) {\n // Same orchestration as an on-load parent: stagger slots, delayChildren,\n // each child's own delay, and nested children played by their parent.\n // (Previously each child was animated flat, so grandchildren never\n // played and the children's own delays were dropped.)\n pending = this.schedule(() => this.applyStaggerToChildren(), MOTION_DEFAULTS.STAGGER_TIMEOUT);\n }\n\n if (this.runInViewRepeat === 'always') {\n // Left before the queued play ran: cancel it so it can't play off-screen\n return () => {\n this.cancelScheduled(pending);\n this.resetToInitialStylesBatch([this, ...childDirectives]);\n };\n }\n return undefined;\n },\n { margin, amount: 0.1 }\n );\n }\n\n private setupIndividualElementInView(margin: string) {\n this.stopInView();\n this.inViewStop = this.motionAnimation.inView(\n this.el.nativeElement,\n () => {\n this.resetToInitialStylesBatch([this]);\n const pending = this.schedule(() => {\n this.playAnimation(this.initial, this.animate);\n }, MOTION_DEFAULTS.STAGGER_TIMEOUT);\n\n if (this.runInViewRepeat === 'always') {\n // Left before the queued play ran: cancel it so it can't play off-screen\n return () => {\n this.cancelScheduled(pending);\n this.resetToInitialStylesBatch([this]);\n };\n }\n return undefined;\n },\n { margin, amount: 0.1 }\n );\n }\n\n runInitAnimation() {\n if (!isPlatformBrowser(this.platformId) || !this.initial || !this.animate) return;\n\n if (this.isChild && this.staggerDelay !== undefined && this.staggerDelay >= 0) {\n if (!this._skipStartStylesApplication) {\n const startStyles = extractStyleProperties(this.getVariant(this.initial));\n const element = this.el.nativeElement;\n element.style.transition = 'none';\n this.setInlineStyles(startStyles);\n } else {\n this._skipStartStylesApplication = false;\n }\n this.el.nativeElement.offsetHeight;\n\n this.schedule(() => {\n this.el.nativeElement.style.transition = '';\n this.playAnimation(this.initial, this.animate);\n }, 5);\n\n this.initialAnimationPlayed = true;\n } else {\n this.playAnimation(this.initial, this.animate);\n }\n }\n\n runExitAnimation(): Promise<void> {\n if (!isPlatformBrowser(this.platformId)) {\n return Promise.resolve();\n }\n\n if (!this.exit || Object.keys(this.exit).length === 0) {\n return Promise.resolve();\n }\n\n const exitTransition = (this.getVariant(this.exit).transition as TransitionOptions) ||\n (this.transition as TransitionOptions) ||\n {} as TransitionOptions;\n\n return new Promise<void>((resolve) => {\n const exitOptions: any = {\n duration: (exitTransition.duration ?? this.duration) as number,\n delay: (exitTransition.delay ?? this.exitDelay) as number,\n onComplete: () => {\n this.emitComplete();\n resolve();\n }\n };\n\n const options: any = this.animationOptions.getAnimationOptions({\n targetState: this.getVariant(this.exit),\n transition: this.transition,\n delay: this.delay,\n easing: this.easing,\n duration: this.duration,\n repeat: this.repeat\n });\n\n exitOptions.easing = options.easing || options.ease;\n exitOptions.ease = options.ease || options.easing;\n\n if (this.controls) {\n this.controls.stop();\n }\n\n this.childrenControls.forEach(control => {\n if (control) control.stop();\n });\n\n const exitStyles = extractStyleProperties(this.getVariant(this.exit));\n\n this.animateSelf(exitStyles, exitOptions);\n\n if (!exitOptions.duration) {\n resolve();\n }\n });\n }\n\n cancel() {\n if (this.controls) {\n this.controls.stop();\n }\n\n this.childrenControls.forEach(control => {\n if (control) control.stop();\n });\n\n this.applyAnimateStyles();\n }\n\n getDuration(): number {\n if (!isPlatformBrowser(this.platformId)) return 0;\n\n try {\n const animateTransition = (this.getVariant(this.exit)?.transition as TransitionOptions) ||\n (this.transition as TransitionOptions) ||\n {} as TransitionOptions;\n const duration = (animateTransition.duration ?? this.duration) as number;\n const delay = (animateTransition.delay ?? this.delay) as number;\n return (Number(duration) + Number(delay)) * 1000;\n } catch (error) {\n console.error('Error calculating duration:', error);\n return 0;\n }\n }\n\n getKeyByValue(object: any, key: any) {\n return Object.keys(object).find((k) => object[k] === key);\n }\n\n public triggerExitAnimation(): Promise<void> {\n return this.runExitAnimation();\n }\n\n @HostListener('motionExit')\n onMotionExit() {\n this.runExitAnimation();\n }\n\n public getVariant(variant: VariantWithTransition | string): VariantWithTransition {\n return resolveVariant(variant, this.variants);\n }\n}\n","import { Directive, Input, TemplateRef, ViewContainerRef, OnDestroy, EmbeddedViewRef, ChangeDetectorRef } from '@angular/core';\nimport { MotionOneDirective } from './motion-one.directive';\n\n/**\n * Structural directive for animated presence with proper enter/exit lifecycle.\n * Works with the existing motionone directive's animate and exit properties.\n * \n * Usage:\n * ```html\n * <div *motionIf=\"isVisible\">\n * <div motionone \n * [initial]=\"{ opacity: 0, scale: 0.8 }\" \n * [animate]=\"{ opacity: 1, scale: 1 }\"\n * [exit]=\"{ opacity: 0, scale: 0.8 }\">\n * Content that animates in and out\n * </div>\n * </div>\n * ```\n */\n@Directive({\n selector: '[motionIf]',\n standalone: true\n})\nexport class MotionIfDirective implements OnDestroy {\n private hasView = false;\n private currentView: EmbeddedViewRef<any> | null = null;\n private motionDirectives: MotionOneDirective[] = [];\n private exitTimeout: any;\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private cdr: ChangeDetectorRef\n ) {}\n\n /** True while exit animations run and the view is waiting to be removed. */\n private exiting = false;\n\n @Input() set motionIf(condition: boolean) {\n if (condition) {\n if (this.exiting) {\n this.cancelExit();\n } else if (!this.hasView) {\n this.enter();\n }\n } else if (this.hasView && !this.exiting) {\n this.exit();\n }\n }\n\n private enter() {\n // Each motionone in the new view starts its own enter animation, and parents\n // orchestrate their children (stagger). Previously this also replayed every\n // descendant at once on the next tick, which flattened any stagger.\n this.currentView = this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView = true;\n this.cdr.detectChanges();\n }\n\n /**\n * Shown again while the exit animation was still running: keep the existing\n * view (previously the pending timeout removed it anyway, so the content\n * vanished while the condition was true) and animate back in.\n */\n private cancelExit() {\n if (this.exitTimeout) {\n clearTimeout(this.exitTimeout);\n this.exitTimeout = null;\n }\n this.exiting = false;\n // Only the elements that ran an exit animation need to come back\n this.motionDirectives\n .filter(directive => directive.exit && Object.keys(directive.exit).length > 0)\n .forEach(directive => directive.runInitAnimation());\n }\n\n private exit() {\n if (!this.hasView || !this.currentView) return;\n\n // Look the directives up now: exit can happen before enter's lookup ran\n this.motionDirectives = this.findMotionDirectives(this.currentView);\n const directivesWithExit = this.motionDirectives.filter(\n directive => directive.exit && Object.keys(directive.exit).length > 0\n );\n\n if (directivesWithExit.length > 0) {\n this.exiting = true;\n directivesWithExit.forEach(directive => directive.runExitAnimation());\n\n // Remove the view after the longest exit animation\n const maxDuration = Math.max(\n ...directivesWithExit.map(d => d.getDuration()),\n 300\n );\n\n if (this.exitTimeout) {\n clearTimeout(this.exitTimeout);\n }\n this.exitTimeout = setTimeout(() => {\n this.exitTimeout = null;\n this.clearView();\n }, maxDuration);\n } else {\n // No exit animation, remove immediately\n this.clearView();\n }\n }\n\n private clearView() {\n if (this.hasView) {\n this.viewContainer.clear();\n this.hasView = false;\n this.exiting = false;\n this.currentView = null;\n this.motionDirectives = [];\n }\n }\n\n private findMotionDirectives(view: EmbeddedViewRef<any> | null): MotionOneDirective[] {\n if (!view) return [];\n \n const directives: MotionOneDirective[] = [];\n \n view.rootNodes.forEach((node: any) => {\n // Check if root node has motion directive\n if (node?._motionDirective) {\n directives.push(node._motionDirective);\n }\n \n // Search children recursively\n if (node?.querySelectorAll) {\n const elements = node.querySelectorAll('[motionone]');\n elements.forEach((el: any) => {\n if (el._motionDirective) {\n directives.push(el._motionDirective);\n }\n });\n }\n });\n \n return directives;\n }\n\n ngOnDestroy() {\n if (this.exitTimeout) {\n clearTimeout(this.exitTimeout);\n }\n this.clearView();\n }\n} ","import {\n Directive,\n Input,\n TemplateRef,\n ViewContainerRef,\n EmbeddedViewRef,\n ElementRef,\n effect,\n signal,\n DestroyRef,\n inject,\n ChangeDetectorRef,\n Renderer2\n} from '@angular/core';\nimport { MotionOneDirective } from './motion-one.directive';\n\n/**\n * Enhanced structural directive for animated presence with proper lifecycle management.\n * Automatically handles enter and exit animations for elements added/removed from DOM.\n * \n * Supports multiple integration patterns:\n * \n * Pattern 1 - Direct with motionone directive:\n * ```html\n * <div *motionPresence=\"show\">\n * <div motionone \n * [initial]=\"{ opacity: 0 }\" \n * [animate]=\"{ opacity: 1 }\"\n * [exit]=\"{ opacity: 0 }\">\n * Content\n * </div>\n * </div>\n * ```\n * \n * Pattern 2 - With animation callbacks:\n * ```html\n * <div *motionPresence=\"show; onEnter: handleEnter; onExit: handleExit\">\n * Content\n * </div>\n * ```\n */\n@Directive({\n selector: '[motionPresence]',\n standalone: true\n})\nexport class MotionPresenceDirective {\n private hasView = false;\n private currentView: EmbeddedViewRef<any> | null = null;\n private exitTimeout: any;\n private destroyRef = inject(DestroyRef);\n\n @Input() motionPresenceOnEnter?: () => void;\n @Input() motionPresenceOnExit?: () => Promise<void>;\n\n constructor(\n private templateRef: TemplateRef<any>,\n private viewContainer: ViewContainerRef,\n private cdr: ChangeDetectorRef\n ) {\n this.destroyRef.onDestroy(() => {\n if (this.exitTimeout) {\n clearTimeout(this.exitTimeout);\n }\n });\n }\n\n /** True while exit animations run. Bumped exitId cancels an exit in progress. */\n private exiting = false;\n private exitId = 0;\n\n @Input() set motionPresence(condition: boolean) {\n if (condition) {\n if (this.exiting) {\n this.cancelExit();\n } else if (!this.hasView) {\n this.enter();\n }\n } else if (this.hasView && !this.exiting) {\n this.exit();\n }\n }\n\n private enter() {\n // Each motionone in the new view starts its own enter animation, and parents\n // orchestrate their children (stagger). Previously this also replayed every\n // descendant at once on the next tick, which flattened any stagger.\n this.currentView = this.viewContainer.createEmbeddedView(this.templateRef);\n this.hasView = true;\n this.cdr.detectChanges();\n\n if (this.motionPresenceOnEnter) {\n const view = this.currentView;\n this.exitTimeout = setTimeout(() => {\n this.exitTimeout = null;\n if (this.currentView === view && !this.exiting) this.motionPresenceOnEnter?.();\n }, 0);\n }\n }\n\n /**\n * Shown again during the exit animation: keep the view and animate back in.\n * Previously the in-flight exit still cleared the view afterwards, so the\n * content disappeared while the condition was true.\n */\n private cancelExit() {\n this.exitId++;\n this.exiting = false;\n this.motionPresenceOnEnter?.();\n // Only the elements that ran an exit animation need to come back\n this.findMotionDirectives(this.currentView)\n .filter(directive => directive.exit && Object.keys(directive.exit).length > 0)\n .forEach(directive => directive.runInitAnimation());\n }\n\n private async exit() {\n if (!this.hasView || !this.currentView) return;\n\n const exitId = ++this.exitId;\n this.exiting = true;\n\n const exitPromises = this.findMotionDirectives(this.currentView)\n .filter(directive => directive.exit && Object.keys(directive.exit).length > 0)\n .map(directive => directive.runExitAnimation());\n\n if (exitPromises.length > 0) {\n await Promise.all(exitPromises);\n }\n\n if (this.motionPresenceOnExit && exitId === this.exitId) {\n await this.motionPresenceOnExit();\n }\n\n // Shown again (or exit restarted) while we were waiting\n if (exitId !== this.exitId || !this.exiting) return;\n\n this.viewContainer.clear();\n this.hasView = false;\n this.exiting = false;\n this.currentView = null;\n }\n\n private findMotionDirectives(view: EmbeddedViewRef<any> | null): MotionOneDirective[] {\n if (!view) return [];\n \n const directives: MotionOneDirective[] = [];\n \n view.rootNodes.forEach((node: any) => {\n if (node?._motionDirective) {\n directives.push(node._motionDirective);\n }\n \n // Search children\n if (node?.querySelectorAll) {\n const elements = node.querySelectorAll('[motionone]');\n elements.forEach((el: any) => {\n if (el._motionDirective) {\n directives.push(el._motionDirective);\n }\n });\n }\n });\n \n return directives;\n }\n}\n","import { Directive, ElementRef, NgZone, afterRenderEffect, inject, input, isDevMode, signal, untracked } from '@angular/core';\n// Imported here, not in MotionAnimationService, so apps that don't use scroll-linked values don't ship it.\nimport { scroll } from 'motion';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** Style keyframes spread across scroll progress: `{ y: [0, -120], opacity: [1, 0] }`. */\nexport type ScrollKeyframes = Record<string, (string | number)[]>;\n\n/**\n * Where a scroll range starts and ends, in Motion's offset syntax: pairs of\n * \"<target edge> <container edge>\", e.g. `['start end', 'end start']` (while the\n * element crosses the viewport) or `['start start', 'end end']` (while a tall\n * section scrolls past a pinned child).\n */\nexport type ScrollOffset = (string | number | [number | string, number | string])[];\n\n/** While the element crosses the visible area of its scroll container. */\nexport const SCROLL_WHILE_VISIBLE: ScrollOffset = ['start end', 'end start'];\n/** While a section taller than the viewport scrolls through it (for pinned/sticky stages). */\nexport const SCROLL_THROUGH: ScrollOffset = ['start start', 'end end'];\n\n/**\n * Scroll-linked values.\n *\n * Maps scroll progress (0 → 1) to styles, and exposes the progress and scroll\n * velocity as signals:\n *\n * <!-- parallax: moves up 120px and fades as it crosses the viewport -->\n * <img [motionScroll]=\"{ y: [0, -120], opacity: [1, 0] }\">\n *\n * <!-- page progress bar -->\n * <div class=\"bar\" [motionScroll]=\"{ scaleX: [0, 1] }\" scrollTarget=\"container\"></div>\n *\n * <!-- pinned stage: read progress from a tall wrapper -->\n * <section motionScroll #story=\"motionScroll\" [scrollOffset]=\"through\" style=\"height: 300vh\">\n * <div class=\"sticky\">{{ story.progress() }}</div>\n * </section>\n *\n * By default it tracks the host element against its nearest scrollable\n * ancestor (or the page). A scrolling ancestor must be positioned\n * (`position: relative` or similar) so offsets are measured from it. The keyframes run as a scroll-driven animation (using\n * the browser's ScrollTimeline when it can), so they never trigger change\n * detection. Reading `progress()` or `velocity()` in a template re-renders that\n * view as you scroll; keep those reads small.\n *\n * With `prefers-reduced-motion: reduce`, keyframes are not applied (the element\n * keeps its normal styles) unless `respectReducedMotion` is false; progress is\n * still tracked.\n */\n@Directive({\n selector: '[motionScroll]',\n exportAs: 'motionScroll',\n})\nexport class MotionScrollDirective {\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly motion = inject(MotionAnimationService);\n private readonly zone = inject(NgZone);\n\n /** Keyframes per style, spread across the scroll range. Empty to only track progress. */\n readonly motionScroll = input<ScrollKeyframes | '' | null | undefined>('');\n /**\n * What to track: the host ('self', default), another element, or the whole\n * scroll container ('container', e.g. for a page progress bar).\n */\n readonly scrollTarget = input<'self' | 'container' | Element>('self');\n /** Scroll container: nearest scrollable ancestor ('auto', default), the page ('page') or an element. */\n readonly scrollContainer = input<'auto' | 'page' | Element>('auto');\n /** Start and end of the range. Defaults to SCROLL_WHILE_VISIBLE for an element target. */\n readonly scrollOffset = input<ScrollOffset | undefined>(undefined);\n readonly scrollAxis = input<'x' | 'y'>('y');\n /** Extra animation options for the keyframes, e.g. `{ ease: 'easeOut' }` or `{ times: [0, 0.3, 1] }`. */\n readonly scrollTransition = input<Record<string, unknown> | undefined>(undefined);\n readonly respectReducedMotion = input(true);\n\n private readonly _progress = signal(0);\n private readonly _velocity = signal(0);\n /** Scroll progress through the range, 0 → 1. */\n readonly progress = this._progress.asReadonly();\n /** Scroll velocity along the axis, in px/s. */\n readonly velocity = this._velocity.asReadonly();\n\n constructor() {\n // After render: the element is in the DOM and styled, so the scroll container can be found. Browser only.\n afterRenderEffect(onCleanup => {\n const keyframes = this.motionScroll();\n const targetInput = this.scrollTarget();\n const containerInput = this.scrollContainer();\n const axis = this.scrollAxis();\n const transition = this.scrollTransition();\n const respect = this.respectReducedMotion();\n const offsetInput = this.scrollOffset();\n\n untracked(() => {\n const container = containerInput === 'page' ? undefined\n : containerInput === 'auto' ? scrollParent(this.el, axis) : containerInput;\n if (container && isDevMode() && getComputedStyle(container).position === 'static') {\n console.warn('[ngx-motion] motionScroll: the scroll container should be positioned (e.g. position: relative), ' +\n 'otherwise scroll ranges are measured from the wrong origin.', container);\n }\n const target = targetInput === 'container' ? undefined : targetInput === 'self' ? this.el : targetInput;\n const offset = offsetInput ?? (target ? SCROLL_WHILE_VISIBLE : undefined);\n const options = { container, target, axis, offset };\n\n const stops: (() => void)[] = [];\n stops.push(this.scroll((p: number, info: any) => {\n this._progress.set(p);\n this._velocity.set(info?.[axis]?.velocity ?? 0);\n }, options));\n\n const reduced = respect && this.motion.reducedMotion();\n if (keyframes && Object.keys(keyframes).length && !reduced) {\n const animation = this.motion.animate(this.el, keyframes, { ease: 'linear', ...transition, duration: 1 });\n stops.push(this.scroll(animation, options));\n stops.push(() => animation.stop?.());\n }\n onCleanup(() => stops.forEach(stop => stop()));\n });\n });\n }\n\n private scroll(onScroll: any, options: object): () => void {\n try {\n return this.zone.runOutsideAngular(() => scroll(onScroll, options as any));\n } catch (e) {\n console.error('[ngx-motion] motionScroll:', e);\n return () => {};\n }\n }\n}\n\n/** The nearest ancestor that scrolls on `axis`, or undefined for the page. */\nfunction scrollParent(el: HTMLElement, axis: 'x' | 'y'): HTMLElement | undefined {\n for (let node = el.parentElement; node && node !== document.body && node !== document.documentElement; node = node.parentElement) {\n const overflow = getComputedStyle(node)[axis === 'y' ? 'overflowY' : 'overflowX'];\n if (overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay') return node;\n }\n return undefined;\n}\n","import { DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, afterNextRender, inject, input, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** Spring used by the pointer directives unless you pass your own. */\nexport const POINTER_SPRING = { type: 'spring', stiffness: 260, damping: 20, mass: 0.6 };\n\n\n\n/**\n * Adds listeners outside Angular's zone (pointer moves never need change\n * detection; signals they set still update views) and removes them on destroy.\n * Call in an injection context.\n */\nfunction listener() {\n const zone = inject(NgZone);\n const destroyRef = inject(DestroyRef);\n return (target: EventTarget, type: string, fn: (e: PointerEvent) => void, options?: AddEventListenerOptions) => {\n const h = fn as EventListener;\n zone.runOutsideAngular(() => target.addEventListener(type, h, options));\n destroyRef.onDestroy(() => target.removeEventListener(type, h, options));\n };\n}\n\n/**\n * Magnetic pull: while a mouse pointer is over (or near) the element, it leans\n * toward the pointer, then springs back when the pointer leaves.\n *\n * <button motionMagnetic>Get started</button>\n * <a [motionMagnetic]=\"0.5\" [magneticRadius]=\"60\">Strong pull, wide reach</a>\n *\n * Moves the element with `x`/`y`, so it composes with scale or rotate from\n * other ngx-motion directives. Touch input and reduced motion are ignored.\n */\n@Directive({ selector: '[motionMagnetic]', exportAs: 'motionMagnetic' })\nexport class MotionMagneticDirective {\n /** How far it follows: 0 (none) to 1 (centre sits under the pointer). Default 0.3. */\n readonly motionMagnetic = input<number | ''>('');\n /** Extra reach around the element, in px. */\n readonly magneticRadius = input(24);\n readonly magneticTransition = input<Record<string, unknown>>(POINTER_SPRING);\n\n private readonly _active = signal(false);\n /** True while the pointer is within reach. */\n readonly active = this._active.asReadonly();\n\n constructor() {\n const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const motion = inject(MotionAnimationService);\n const listen = listener();\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (motion.reducedMotion()) return;\n let x = 0, y = 0;\n listen(document, 'pointermove', e => {\n if (e.pointerType !== 'mouse') return;\n // Measure the resting box: undo the current pull\n const r = el.getBoundingClientRect();\n const left = r.left - x, top = r.top - y, reach = this.magneticRadius();\n const inside = e.clientX >= left - reach && e.clientX <= left + r.width + reach && e.clientY >= top - reach && e.clientY <= top + r.height + reach;\n if (!inside && !this._active()) return;\n const strength = this.motionMagnetic() === '' ? 0.3 : Number(this.motionMagnetic());\n x = inside ? (e.clientX - (left + r.width / 2)) * strength : 0;\n y = inside ? (e.clientY - (top + r.height / 2)) * strength : 0;\n this._active.set(inside);\n motion.animate(el, { x, y }, this.magneticTransition());\n }, { passive: true });\n });\n }\n}\n\n/**\n * 3D tilt toward the pointer, like a card under a light. Also sets\n * `--motion-pointer-x` / `--motion-pointer-y` (0%–100%) on the element for a\n * glare or spotlight in CSS:\n *\n * <article [motionTilt]=\"12\">…</article>\n * .card::after { background: radial-gradient(circle at var(--motion-pointer-x) var(--motion-pointer-y), #fff3, transparent 50%); }\n *\n * Springs back flat when the pointer leaves. With reduced motion it doesn't\n * tilt, but still sets the pointer variables.\n */\n@Directive({ selector: '[motionTilt]', exportAs: 'motionTilt' })\nexport class MotionTiltDirective {\n /** Maximum tilt in degrees. Default 10. */\n readonly motionTilt = input<number | ''>('');\n /** Scale while hovered. */\n readonly tiltScale = input(1.02);\n /** Perspective in px: lower is more dramatic. */\n readonly tiltPerspective = input(900);\n readonly tiltTransition = input<Record<string, unknown>>({ type: 'spring', stiffness: 300, damping: 26 });\n\n private readonly _hovering = signal(false);\n readonly hovering = this._hovering.asReadonly();\n\n constructor() {\n const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const motion = inject(MotionAnimationService);\n const listen = listener();\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const reduced = motion.reducedMotion();\n const max = () => (this.motionTilt() === '' ? 10 : Number(this.motionTilt()));\n listen(el, 'pointermove', e => {\n if (e.pointerType === 'touch') return;\n const r = el.getBoundingClientRect();\n const px = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width));\n const py = Math.min(1, Math.max(0, (e.clientY - r.top) / r.height));\n el.style.setProperty('--motion-pointer-x', `${(px * 100).toFixed(1)}%`);\n el.style.setProperty('--motion-pointer-y', `${(py * 100).toFixed(1)}%`);\n if (!this._hovering()) this._hovering.set(true);\n if (reduced) return;\n motion.animate(el, {\n rotateY: (px - 0.5) * 2 * max(), rotateX: -(py - 0.5) * 2 * max(), scale: this.tiltScale(),\n transformPerspective: this.tiltPerspective(),\n }, this.tiltTransition());\n }, { passive: true });\n listen(el, 'pointerleave', () => {\n this._hovering.set(false);\n if (!reduced) motion.animate(el, { rotateX: 0, rotateY: 0, scale: 1 }, this.tiltTransition());\n });\n });\n }\n}\n\n/**\n * Follows the pointer around a container on a spring: cursor blobs, \"View\"\n * bubbles, spotlights. Position it absolutely at the container's top-left; it\n * is centred on the pointer and scales in when the pointer enters the\n * container and out when it leaves.\n *\n * <section style=\"position: relative\">\n * <div class=\"glow\" motionFollowPointer></div>\n * </section>\n *\n * Mouse and pen only. With reduced motion it jumps to the pointer instead of\n * springing.\n */\n@Directive({ selector: '[motionFollowPointer]', exportAs: 'motionFollowPointer' })\nexport class MotionFollowPointerDirective {\n /** The area it follows within: the parent element (default) or the whole window. */\n readonly motionFollowPointer = input<'parent' | 'window' | Element | ''>('');\n readonly followTransition = input<Record<string, unknown>>({ type: 'spring', stiffness: 180, damping: 22, mass: 0.7 });\n /** Scale in and out with the pointer entering and leaving. Set false to keep it shown. */\n readonly followHide = input(true);\n\n private readonly _active = signal(false);\n /** True while the pointer is inside the area. */\n readonly active = this._active.asReadonly();\n\n constructor() {\n const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const motion = inject(MotionAnimationService);\n const listen = listener();\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const reduced = motion.reducedMotion();\n const mode = this.motionFollowPointer();\n const area: HTMLElement | null = mode instanceof Element ? (mode as HTMLElement) : mode === 'window' ? null : el.parentElement;\n if (this.followHide()) motion.animate(el, { scale: 0, opacity: 0 }, { duration: 0 });\n let placed = false;\n\n listen(area ?? document, 'pointermove', e => {\n if (e.pointerType === 'touch') return;\n // Relative to the element's own offset parent, centred on the pointer\n const origin = (el.offsetParent as HTMLElement | null)?.getBoundingClientRect() ?? { left: 0, top: 0 };\n const x = e.clientX - origin.left - el.offsetLeft - el.offsetWidth / 2;\n const y = e.clientY - origin.top - el.offsetTop - el.offsetHeight / 2;\n // The first move jumps there, so it doesn't fly in from the corner\n motion.animate(el, { x, y }, reduced || !placed ? { duration: 0 } : this.followTransition());\n placed = true;\n if (!this._active()) {\n this._active.set(true);\n if (this.followHide()) motion.animate(el, { scale: 1, opacity: 1 }, { duration: reduced ? 0 : 0.25 });\n }\n }, { passive: true });\n listen(area ?? document.documentElement, 'pointerleave', () => {\n this._active.set(false);\n placed = false;\n if (this.followHide()) motion.animate(el, { scale: 0, opacity: 0 }, { duration: reduced ? 0 : 0.2 });\n });\n });\n }\n}\n","import { DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, afterNextRender, inject, input, output, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** Limits for the drag offset, in px from where the element rests. */\nexport interface DragBounds { top?: number; right?: number; bottom?: number; left?: number; }\n\n/** Offsets the element settles on after a release, per axis. */\nexport interface DragSnap { x?: number[]; y?: number[]; }\n\nexport interface DragInfo {\n /** Current offset from the resting position. */\n x: number;\n y: number;\n /** Offset since the drag started. */\n offset: { x: number; y: number };\n /** Pointer velocity in px/s. */\n velocity: { x: number; y: number };\n}\n\nconst SETTLE = { type: 'spring', stiffness: 380, damping: 38 };\n\n/**\n * Settings another directive on the same element can impose (e.g. a reorder\n * item fixes the axis and always settles back to its slot).\n * @internal\n */\nexport interface DragOverrides {\n axis?: 'x' | 'y' | 'both';\n constraints?: DragBounds;\n elastic?: number;\n momentum?: boolean;\n}\n\n/**\n * Drag with constraints, elastic edges, momentum and snap points.\n *\n * <div motionDrag>free drag</div>\n * <div motionDrag=\"x\" dragConstraints=\"parent\">a track inside its window</div>\n * <div motionDrag=\"x\" [dragSnap]=\"{ x: [0, -320, -640] }\" (dragEnd)=\"onEnd($event)\">a snapping carousel</div>\n *\n * - Moves the element with `x`/`y`, so it composes with whileTap scale etc.\n * Don't give the element a CSS transform of its own (wrap it instead).\n * - Starts after the pointer moves `dragThreshold` px, so clicks on links and\n * buttons inside still work; the click that ends a drag is swallowed.\n * - Sets `touch-action` so the other axis keeps scrolling on touch screens.\n * - On release it glides on (momentum) and settles inside the constraints, or\n * on the snap point nearest to where it was heading.\n */\n@Directive({\n selector: '[motionDrag]',\n exportAs: 'motionDrag',\n host: { '[style.touch-action]': 'touchAction()', '[class.motion-dragging]': 'dragging()' },\n})\nexport class MotionDragDirective {\n /** Axis: 'x', 'y', or both (default, also for an empty attribute). */\n readonly motionDrag = input<'x' | 'y' | 'both' | ''>('');\n /** 'parent' keeps the element within its parent; or pixel bounds from the resting position; or an element. */\n readonly dragConstraints = input<'parent' | DragBounds | Element | null>(null);\n /** How far it stretches past the constraints: 0 (hard stop) to 1 (no resistance). */\n readonly dragElastic = input(0.35);\n /** Keep moving after release, in the direction it was thrown. */\n readonly dragMomentum = input(true);\n readonly dragSnap = input<DragSnap | null>(null);\n /** Spring used to settle after release and for moveTo(). */\n readonly dragTransition = input<Record<string, unknown>>(SETTLE);\n readonly dragThreshold = input(3);\n readonly dragDisabled = input(false);\n\n readonly dragStart = output<DragInfo>();\n readonly dragMove = output<DragInfo>();\n readonly dragEnd = output<DragInfo>();\n\n private readonly _x = signal(0);\n private readonly _y = signal(0);\n private readonly _dragging = signal(false);\n /** Offset from the resting position, updated as it moves (also while settling). */\n readonly x = this._x.asReadonly();\n readonly y = this._y.asReadonly();\n readonly dragging = this._dragging.asReadonly();\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly motion = inject(MotionAnimationService);\n private readonly zone = inject(NgZone);\n private settle?: { stop(): void; then(fn: () => void): Promise<void> };\n private raf = 0;\n /** Offset when the current drag started, and its limits (both in offset space). */\n private start = { x: 0, y: 0 };\n private limits: Required<DragBounds> = { top: -Infinity, left: -Infinity, right: Infinity, bottom: Infinity };\n\n /** @internal Set by directives that build on drag (see DragOverrides). */\n readonly overrides = signal<DragOverrides>({});\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n afterNextRender(() => this.zone.runOutsideAngular(() => this.bind(destroyRef)));\n destroyRef.onDestroy(() => { cancelAnimationFrame(this.raf); this.settle?.stop(); });\n }\n\n touchAction() {\n const axis = this.axis();\n return this.dragDisabled() ? null : axis === 'x' ? 'pan-y' : axis === 'y' ? 'pan-x' : 'none';\n }\n\n /** Move to an offset (e.g. from prev/next buttons), on the drag spring unless you pass a transition. */\n moveTo(x: number, y = this._y(), transition: Record<string, unknown> = this.dragTransition()) {\n this.zone.runOutsideAngular(() => this.glide({ x, y }, transition, { x: 0, y: 0 }));\n }\n\n /**\n * The element's resting place moved by (dx, dy) in the layout (e.g. it was\n * moved in the DOM mid-drag). Shift the offset the other way so it stays\n * where it is on screen, under the pointer.\n */\n rebase(dx: number, dy: number) {\n if (!dx && !dy) return;\n this.start = { x: this.start.x - dx, y: this.start.y - dy };\n const x = this._x() - dx, y = this._y() - dy;\n this._x.set(x); this._y.set(y);\n this.motion.animate(this.el, { x, y }, { duration: 0 });\n if (this._dragging()) this.limits = this.bounds();\n }\n\n private axis() { return this.overrides().axis ?? this.motionDrag(); }\n private axisX() { return this.axis() !== 'y'; }\n private axisY() { return this.axis() !== 'x'; }\n\n /** The offset actually on screen (mid-animation included). */\n private read() {\n const m = new DOMMatrix(getComputedStyle(this.el).transform);\n return { x: m.m41, y: m.m42 };\n }\n\n /** Animate to an offset, keeping the x/y signals in step each frame. */\n private glide(to: { x: number; y: number }, t: Record<string, unknown>, velocity: { x: number; y: number }) {\n this.settle?.stop();\n const settle = this.motion.animate(this.el, to, { ...t, x: { ...t, velocity: velocity.x }, y: { ...t, velocity: velocity.y } });\n this.settle = settle;\n cancelAnimationFrame(this.raf);\n const tick = () => {\n if (this.settle !== settle) return;\n const p = this.read();\n this._x.set(p.x); this._y.set(p.y);\n this.raf = requestAnimationFrame(tick);\n };\n this.raf = requestAnimationFrame(tick);\n settle.then(() => {\n if (this.settle !== settle) return;\n cancelAnimationFrame(this.raf);\n this.settle = undefined;\n this._x.set(to.x); this._y.set(to.y);\n });\n }\n\n private bounds(): Required<DragBounds> {\n const c = this.overrides().constraints ?? this.dragConstraints();\n const none = { top: -Infinity, left: -Infinity, right: Infinity, bottom: Infinity };\n if (!c) return none;\n if (c === 'parent' || c instanceof Element) {\n const box = c === 'parent' ? this.el.parentElement : (c as Element);\n if (!box) return none;\n const p = box.getBoundingClientRect();\n const r = this.el.getBoundingClientRect();\n // Resting box: where it would be with no drag offset\n const left = r.left - this._x(), top = r.top - this._y();\n // Between \"left edges aligned\" and \"right edges aligned\": keeps a smaller\n // element inside the box, and a larger one (a carousel track) covering it\n const ax = p.left - left, bx = p.right - (left + r.width);\n const ay = p.top - top, by = p.bottom - (top + r.height);\n return { left: Math.min(ax, bx), right: Math.max(ax, bx), top: Math.min(ay, by), bottom: Math.max(ay, by) };\n }\n const b = c as DragBounds;\n return { top: b.top ?? -Infinity, left: b.left ?? -Infinity, right: b.right ?? Infinity, bottom: b.bottom ?? Infinity };\n }\n\n private elastic(v: number, min: number, max: number) {\n const e = this.overrides().elastic ?? this.dragElastic();\n if (v < min) return min + (v - min) * e;\n if (v > max) return max + (v - max) * e;\n return v;\n }\n\n private target(pos: number, v: number, min: number, max: number, snap: number[] | undefined) {\n // Where a throw would carry it (as a decaying glide), then held inside the bounds\n const projected = (this.overrides().momentum ?? this.dragMomentum()) ? pos + v * 0.2 : pos;\n if (snap?.length) {\n const within = snap.filter(s => s >= min && s <= max);\n const points = within.length ? within : snap;\n return points.reduce((best, s) => (Math.abs(s - projected) < Math.abs(best - projected) ? s : best), points[0]);\n }\n return Math.min(max, Math.max(min, projected));\n }\n\n private info(velocity: { x: number; y: number }): DragInfo {\n const x = this._x(), y = this._y(), start = this.start;\n return { x, y, offset: { x: x - start.x, y: y - start.y }, velocity };\n }\n\n private bind(destroyRef: DestroyRef) {\n const el = this.el;\n const on = <K extends keyof HTMLElementEventMap>(t: EventTarget, type: K, fn: (e: HTMLElementEventMap[K]) => void, opts?: AddEventListenerOptions) => {\n t.addEventListener(type, fn as EventListener, opts);\n destroyRef.onDestroy(() => t.removeEventListener(type, fn as EventListener, opts));\n };\n\n let pointer: number | null = null;\n let origin = { x: 0, y: 0 }, last = { x: 0, y: 0, t: 0 }, velocity = { x: 0, y: 0 };\n let moved = false;\n let swallowClick = false;\n\n const set = (x: number, y: number) => {\n this._x.set(x); this._y.set(y);\n this.motion.animate(el, { x, y }, { duration: 0 });\n };\n\n on(el, 'dragstart', e => e.preventDefault());\n on(el, 'pointerdown', e => {\n if (this.dragDisabled() || e.button !== 0 || pointer !== null) return;\n pointer = e.pointerId;\n moved = false;\n // Catch it mid-settle where it is\n this.settle?.stop();\n this.settle = undefined;\n cancelAnimationFrame(this.raf);\n const now = this.read();\n this._x.set(now.x); this._y.set(now.y);\n origin = { x: e.clientX, y: e.clientY };\n this.start = { x: now.x, y: now.y };\n last = { x: e.clientX, y: e.clientY, t: e.timeStamp };\n velocity = { x: 0, y: 0 };\n });\n // Moves and release are heard on the window from pointerdown on: a quick first\n // movement can leave the element before the drag has started\n on(window, 'pointermove', e => {\n if (e.pointerId !== pointer) return;\n const dx = this.axisX() ? e.clientX - origin.x : 0;\n const dy = this.axisY() ? e.clientY - origin.y : 0;\n if (!moved) {\n if (Math.hypot(dx, dy) < this.dragThreshold()) return;\n moved = true;\n this.limits = this.bounds();\n el.setPointerCapture(e.pointerId);\n this._dragging.set(true);\n this.dragStart.emit(this.info(velocity));\n }\n const dt = Math.max(1, e.timeStamp - last.t) / 1000;\n // Smoothed pointer velocity\n velocity = {\n x: velocity.x * 0.2 + ((e.clientX - last.x) / dt) * 0.8,\n y: velocity.y * 0.2 + ((e.clientY - last.y) / dt) * 0.8,\n };\n last = { x: e.clientX, y: e.clientY, t: e.timeStamp };\n const start = this.start, bounds = this.limits;\n set(\n this.axisX() ? this.elastic(start.x + dx, bounds.left, bounds.right) : start.x,\n this.axisY() ? this.elastic(start.y + dy, bounds.top, bounds.bottom) : start.y,\n );\n this.dragMove.emit(this.info(velocity));\n });\n const end = (e: PointerEvent) => {\n if (e.pointerId !== pointer) return;\n pointer = null;\n if (!moved) return;\n swallowClick = true;\n setTimeout(() => (swallowClick = false));\n // A pause before letting go means no throw\n if (e.timeStamp - last.t > 80) velocity = { x: 0, y: 0 };\n if (!this.axisX()) velocity.x = 0;\n if (!this.axisY()) velocity.y = 0;\n this._dragging.set(false);\n const snap = this.dragSnap(), bounds = this.limits, start = this.start;\n const x = this.target(this._x(), velocity.x, bounds.left, bounds.right, this.axisX() ? snap?.x : undefined);\n const y = this.target(this._y(), velocity.y, bounds.top, bounds.bottom, this.axisY() ? snap?.y : undefined);\n this.glide({ x, y }, this.dragTransition(), velocity);\n this.dragEnd.emit({ x, y, offset: { x: x - start.x, y: y - start.y }, velocity });\n };\n on(window, 'pointerup', end);\n on(window, 'pointercancel', end);\n // The click that ends a drag is not a click\n on(el, 'click', e => { if (swallowClick) { e.preventDefault(); e.stopPropagation(); swallowClick = false; } }, { capture: true });\n }\n}\n","import { DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, afterNextRender, inject, input, output, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\ntype Point = { x: number; y: number };\n\nexport interface PanInfo {\n /** Pointer position, relative to the viewport. */\n point: Point;\n /** Movement since the last event. */\n delta: Point;\n /** Movement since the pan started (from where the pointer went down). */\n offset: Point;\n /** Pointer velocity in px/s. */\n velocity: Point;\n}\n\nexport type SwipeDirection = 'left' | 'right' | 'up' | 'down';\nexport interface SwipeInfo extends PanInfo { direction: SwipeDirection; }\n\n/** Neutral values the `whilePan` transforms return to. */\nconst NEUTRAL: Record<string, number> = {\n x: 0, y: 0, z: 0, rotate: 0, rotateX: 0, rotateY: 0, rotateZ: 0, skew: 0, skewX: 0, skewY: 0,\n scale: 1, scaleX: 1, scaleY: 1, scaleZ: 1,\n};\nconst RELEASE = { type: 'spring', stiffness: 500, damping: 35 };\n\n/**\n * Pan and swipe gestures: pointer movement reported as events, without moving\n * the element (use motionDrag for that).\n *\n * <div motionPan (pan)=\"rotate($event.delta.x)\" (swipe)=\"onSwipe($event.direction)\"\n * [whilePan]=\"{ scale: 0.97 }\">…</div>\n *\n * - A pan starts once the pointer has moved `panThreshold` px; clicks still work.\n * - `swipe` fires on release when the pan went far enough (`swipeDistance`) or\n * fast enough (`swipeVelocity`) along its main axis.\n * - `whilePan` styles apply while panning. On release, transforms (x, scale,\n * rotate…) return to neutral and other styles to what they were before.\n * - `panAxis` limits panning to one axis and lets the other scroll on touch\n * screens (sets `touch-action`).\n */\n@Directive({\n selector: '[motionPan]',\n exportAs: 'motionPan',\n host: { '[style.touch-action]': 'touchAction()', '[class.motion-panning]': 'panning()' },\n})\nexport class MotionPanDirective {\n /** Axis to pan on: 'x', 'y' or both (default, also for an empty attribute). */\n readonly motionPan = input<'x' | 'y' | 'both' | ''>('');\n readonly panThreshold = input(3);\n readonly swipeDistance = input(50);\n readonly swipeVelocity = input(500);\n readonly whilePan = input<Record<string, unknown> | null>(null);\n readonly panTransition = input<Record<string, unknown>>(RELEASE);\n readonly panDisabled = input(false);\n\n readonly panStart = output<PanInfo>();\n readonly pan = output<PanInfo>();\n readonly panEnd = output<PanInfo>();\n readonly swipe = output<SwipeInfo>();\n\n private readonly _panning = signal(false);\n readonly panning = this._panning.asReadonly();\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly motion = inject(MotionAnimationService);\n private readonly zone = inject(NgZone);\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n afterNextRender(() => this.zone.runOutsideAngular(() => this.bind(destroyRef)));\n }\n\n touchAction() {\n const axis = this.motionPan();\n return this.panDisabled() ? null : axis === 'x' ? 'pan-y' : axis === 'y' ? 'pan-x' : 'none';\n }\n\n /** The swipe a pan describes, if it went far or fast enough. */\n static swipeOf(info: PanInfo, distance: number, speed: number, axis: 'x' | 'y' | 'both' | '' = ''): SwipeDirection | null {\n const horizontal = axis === 'x' || (axis !== 'y' && Math.abs(info.offset.x) >= Math.abs(info.offset.y));\n const d = horizontal ? info.offset.x : info.offset.y;\n const v = horizontal ? info.velocity.x : info.velocity.y;\n // A fast flick counts only when it goes the same way as the pan\n if (Math.abs(d) < distance && (Math.abs(v) < speed || Math.sign(v) !== Math.sign(d))) return null;\n return horizontal ? (d > 0 ? 'right' : 'left') : (d > 0 ? 'down' : 'up');\n }\n\n private bind(destroyRef: DestroyRef) {\n const el = this.el;\n const on = <K extends keyof HTMLElementEventMap>(t: EventTarget, type: K, fn: (e: HTMLElementEventMap[K]) => void, opts?: AddEventListenerOptions) => {\n t.addEventListener(type, fn as EventListener, opts);\n destroyRef.onDestroy(() => t.removeEventListener(type, fn as EventListener, opts));\n };\n\n let pointer: number | null = null;\n let moved = false, swallowClick = false;\n let origin: Point = { x: 0, y: 0 }, last = { x: 0, y: 0, t: 0 }, velocity: Point = { x: 0, y: 0 }, delta: Point = { x: 0, y: 0 };\n let rest: Record<string, unknown> = {};\n\n const info = (e: PointerEvent): PanInfo => {\n const axis = this.motionPan();\n return {\n point: { x: e.clientX, y: e.clientY },\n delta: { x: axis === 'y' ? 0 : delta.x, y: axis === 'x' ? 0 : delta.y },\n offset: { x: axis === 'y' ? 0 : e.clientX - origin.x, y: axis === 'x' ? 0 : e.clientY - origin.y },\n velocity: { x: axis === 'y' ? 0 : velocity.x, y: axis === 'x' ? 0 : velocity.y },\n };\n };\n const emit = <T>(out: { emit(v: T): void }, v: T) => this.zone.run(() => out.emit(v));\n\n on(el, 'pointerdown', e => {\n if (this.panDisabled() || e.button !== 0 || pointer !== null) return;\n pointer = e.pointerId;\n moved = false;\n origin = { x: e.clientX, y: e.clientY };\n last = { x: e.clientX, y: e.clientY, t: e.timeStamp };\n velocity = { x: 0, y: 0 };\n });\n on(window, 'pointermove', e => {\n if (e.pointerId !== pointer) return;\n const axis = this.motionPan();\n const dx = axis === 'y' ? 0 : e.clientX - origin.x, dy = axis === 'x' ? 0 : e.clientY - origin.y;\n if (!moved) {\n if (Math.hypot(dx, dy) < this.panThreshold()) return;\n moved = true;\n el.setPointerCapture?.(e.pointerId);\n this._panning.set(true);\n const to = this.whilePan();\n if (to) {\n const { transition, ...styles } = to;\n rest = this.restingValues(styles);\n this.motion.animate(el, styles, (transition as Record<string, unknown>) ?? this.panTransition());\n }\n delta = { x: 0, y: 0 };\n emit(this.panStart, info(e));\n }\n const dt = Math.max(1, e.timeStamp - last.t) / 1000;\n delta = { x: e.clientX - last.x, y: e.clientY - last.y };\n velocity = { x: velocity.x * 0.2 + (delta.x / dt) * 0.8, y: velocity.y * 0.2 + (delta.y / dt) * 0.8 };\n last = { x: e.clientX, y: e.clientY, t: e.timeStamp };\n emit(this.pan, info(e));\n });\n const end = (e: PointerEvent) => {\n if (e.pointerId !== pointer) return;\n pointer = null;\n if (!moved) return;\n swallowClick = true;\n setTimeout(() => (swallowClick = false));\n if (e.timeStamp - last.t > 80) velocity = { x: 0, y: 0 };\n delta = { x: 0, y: 0 };\n this._panning.set(false);\n if (this.whilePan()) this.motion.animate(el, rest, this.panTransition());\n const done = info(e);\n emit(this.panEnd, done);\n const direction = e.type === 'pointerup' ? MotionPanDirective.swipeOf(done, this.swipeDistance(), this.swipeVelocity(), this.motionPan()) : null;\n if (direction) emit(this.swipe, { ...done, direction });\n };\n on(window, 'pointerup', end);\n on(window, 'pointercancel', end);\n on(el, 'click', e => { if (swallowClick) { e.preventDefault(); e.stopPropagation(); swallowClick = false; } }, { capture: true });\n }\n\n /** What each whilePan style returns to: neutral for transforms, the current value for the rest. */\n private restingValues(to: Record<string, unknown>) {\n const style = getComputedStyle(this.el);\n const rest: Record<string, unknown> = {};\n for (const key of Object.keys(to)) {\n if (key in NEUTRAL) rest[key] = NEUTRAL[key];\n else rest[key] = style.getPropertyValue(key.replace(/[A-Z]/g, c => '-' + c.toLowerCase())) || (style as unknown as Record<string, string>)[key];\n }\n return rest;\n }\n}\n","import {\n DestroyRef, Directive, ElementRef, Injector, NgZone, afterNextRender, effect, forwardRef, inject, input, model, output,\n} from '@angular/core';\nimport { MotionAnimationService } from '../services/motion-animation.service';\nimport { MotionDragDirective } from './motion-drag.directive';\n\nconst LAYOUT_SPRING = { type: 'spring', stiffness: 550, damping: 45 };\n\n/**\n * Drag-to-reorder lists, like Framer Motion's Reorder.Group / Reorder.Item.\n *\n * <ul [(motionReorderGroup)]=\"items\" reorderAxis=\"y\">\n * @for (item of items(); track item) {\n * <li [motionReorderItem]=\"item\" tabindex=\"0\">{{ item }}</li>\n * }\n * </ul>\n *\n * - Drag an item along the axis; once it passes the middle of its neighbour\n * the array is reordered (two-way bound, so `items` updates as you drag)\n * and the other items glide to their new places.\n * - On release it springs into its new slot and `reorderEnd` fires with the\n * final order.\n * - Keyboard: on a focused item, Alt + arrow keys move it one place.\n * - Track items by identity in `@for` (not `$index`), so the elements move\n * with their values. Items can have different sizes.\n */\n@Directive({\n selector: '[motionReorderGroup]',\n exportAs: 'motionReorderGroup',\n})\nexport class MotionReorderGroupDirective<T = unknown> {\n /** The values, in order. Bind two-way: `[(motionReorderGroup)]=\"items\"`. */\n readonly motionReorderGroup = model.required<T[]>();\n readonly reorderAxis = input<'x' | 'y'>('y');\n /** Spring the other items move on. */\n readonly reorderTransition = input<Record<string, unknown>>(LAYOUT_SPRING);\n /** The order after a drag or key move ends. */\n readonly reorderEnd = output<T[]>();\n\n private readonly items = new Set<MotionReorderItemDirective<T>>();\n private readonly motion = inject(MotionAnimationService);\n private readonly zone = inject(NgZone);\n private readonly injector = inject(Injector);\n /** A reorder waiting for the DOM to catch up. */\n private pending = false;\n\n /** @internal */\n register(item: MotionReorderItemDirective<T>) {\n this.items.add(item);\n return () => this.items.delete(item);\n }\n\n /** @internal An item moved by `offset` along the axis while dragged: swap it with a neighbour it has passed. */\n dragged(item: MotionReorderItemDirective<T>, offset: number, direction: number) {\n if (this.pending || !direction) return;\n const values = this.motionReorderGroup();\n const i = values.indexOf(item.motionReorderItem());\n if (i < 0) return;\n const lo = this.pos(item.el) + offset, hi = lo + this.size(item.el);\n const neighbour = this.find(values[i + direction]);\n if (!neighbour) return;\n const middle = this.pos(neighbour.el) + this.size(neighbour.el) / 2;\n if (direction > 0 ? hi > middle : lo < middle) this.move(item, i + direction);\n }\n\n /** @internal Move an item to a new index, animating the others into place. */\n move(item: MotionReorderItemDirective<T>, to: number) {\n const values = this.motionReorderGroup();\n const from = values.indexOf(item.motionReorderItem());\n if (from < 0 || to < 0 || to >= values.length || to === from || this.pending) return false;\n const before = new Map([...this.items].map(it => [it, this.pos(it.el)]));\n const next = [...values];\n next.splice(to, 0, ...next.splice(from, 1));\n this.pending = true;\n // Register before the change: set from outside the zone, the render runs\n // synchronously as zone.run exits, and a hook registered after it would\n // wait a frame, painting the moved items at their new places first.\n afterNextRender(() => {\n this.pending = false;\n const axis = this.reorderAxis();\n for (const it of this.items) {\n const was = before.get(it);\n if (was === undefined) continue;\n const moved = this.pos(it.el) - was;\n if (!moved) continue;\n if (it === item && it.drag.dragging()) {\n // Keep it under the pointer\n it.drag.rebase(axis === 'x' ? moved : 0, axis === 'y' ? moved : 0);\n } else {\n // Start from where it was on screen and glide into its new place\n const m = new DOMMatrix(getComputedStyle(it.el).transform);\n const now = (axis === 'x' ? m.m41 : m.m42) - moved;\n // Put it back where it was before this frame paints; the animation's first frame comes later\n it.el.style.transform = axis === 'x' ? `translateX(${now}px)` : `translateY(${now}px)`;\n this.zone.runOutsideAngular(() => this.motion.animate(it.el, { [axis]: [now, 0] }, this.reorderTransition()));\n }\n }\n }, { injector: this.injector });\n this.zone.run(() => this.motionReorderGroup.set(next));\n return true;\n }\n\n /** @internal */\n ended() {\n this.reorderEnd.emit(this.motionReorderGroup());\n }\n\n private find(value: T | undefined) {\n if (value === undefined) return undefined;\n for (const it of this.items) if (it.motionReorderItem() === value) return it;\n return undefined;\n }\n // Layout position (transforms ignored), so items mid-animation still count where they will land\n private pos(el: HTMLElement) { return this.reorderAxis() === 'x' ? el.offsetLeft : el.offsetTop; }\n private size(el: HTMLElement) { return this.reorderAxis() === 'x' ? el.offsetWidth : el.offsetHeight; }\n}\n\n/**\n * An item in a `motionReorderGroup`. Draggable along the group's axis; it\n * springs back into its slot on release. Accepts motionDrag's `dragTransition`\n * and `dragDisabled`, and emits `dragStart` / `dragMove` / `dragEnd`. Raised\n * (z-index 1) while it is away from its slot.\n */\n@Directive({\n selector: '[motionReorderItem]',\n exportAs: 'motionReorderItem',\n hostDirectives: [{\n directive: MotionDragDirective,\n inputs: ['dragTransition', 'dragDisabled'],\n outputs: ['dragStart', 'dragMove', 'dragEnd'],\n }],\n host: {\n '[style.position]': '\"relative\"',\n '[style.z-index]': 'raised() ? 1 : null',\n '(keydown)': 'onKey($event)',\n },\n})\nexport class MotionReorderItemDirective<T = unknown> {\n readonly motionReorderItem = input.required<T>();\n\n /** @internal */\n readonly drag = inject(MotionDragDirective, { self: true });\n /** @internal */\n readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly group = inject<MotionReorderGroupDirective<T>>(forwardRef(() => MotionReorderGroupDirective));\n\n constructor() {\n const unregister = this.group.register(this);\n inject(DestroyRef).onDestroy(unregister);\n effect(() => {\n // Free along the axis, and always back to the slot on release\n this.drag.overrides.set({ axis: this.group.reorderAxis(), constraints: { top: 0, right: 0, bottom: 0, left: 0 }, elastic: 1, momentum: false });\n });\n let last = 0;\n this.drag.dragStart.subscribe(() => (last = 0));\n this.drag.dragMove.subscribe(() => {\n const offset = this.offset();\n const direction = Math.sign(offset - last);\n last = offset;\n this.group.dragged(this, offset, direction);\n });\n this.drag.dragEnd.subscribe(() => this.group.ended());\n }\n\n raised() {\n return this.drag.dragging() || this.drag.x() !== 0 || this.drag.y() !== 0;\n }\n\n onKey(e: KeyboardEvent) {\n if (!e.altKey || e.target !== this.el) return;\n const axis = this.group.reorderAxis();\n const step = axis === 'y'\n ? (e.key === 'ArrowUp' ? -1 : e.key === 'ArrowDown' ? 1 : 0)\n : (e.key === 'ArrowLeft' ? -1 : e.key === 'ArrowRight' ? 1 : 0);\n if (!step) return;\n e.preventDefault();\n const values = this.group.motionReorderGroup();\n const i = values.indexOf(this.motionReorderItem());\n if (this.group.move(this, i + step)) {\n // Moving the element in the DOM can drop focus\n afterNextRender(() => { this.el.focus(); this.group.ended(); }, { injector: this.injector });\n }\n }\n\n private readonly injector = inject(Injector);\n private offset() { return this.group.reorderAxis() === 'x' ? this.drag.x() : this.drag.y(); }\n}\n","import { DestroyRef, Directive, ElementRef, Injectable, NgZone, PLATFORM_ID, afterEveryRender, inject, input, output, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/** A layout box: centre and size, in layout coordinates (transforms and scrolling ignored). */\ninterface Box { cx: number; cy: number; w: number; h: number; }\n/** The directive's own transform: offset from the layout box, and scale. */\ninterface Offset { x: number; y: number; sx: number; sy: number; }\n\nconst NONE: Offset = { x: 0, y: 0, sx: 1, sy: 1 };\nconst LAYOUT_SPRING = { type: 'spring', stiffness: 300, damping: 34, mass: 1 };\nconst CORNERS = ['TopLeft', 'TopRight', 'BottomRight', 'BottomLeft'] as const;\n\n/** What the registry needs from a member. @internal */\ninterface Member {\n /** Become the visible one again and fly in from where the last lead was (viewport box). */\n resume(from: Box | undefined): void;\n setHidden(hidden: boolean): void;\n}\n\n/**\n * Shared layout ids. For each id: the mounted elements (the newest one, the\n * lead, is shown and the others are hidden) and where the id was last drawn,\n * in viewport coordinates so it holds across scroll containers.\n * @internal\n */\n@Injectable({ providedIn: 'root' })\nexport class MotionLayoutRegistry {\n private readonly seen = new Map<string, { owner: object; box: Box }>();\n private readonly stacks = new Map<string, Member[]>();\n\n record(id: string, owner: object, box: Box) { this.seen.set(id, { owner, box }); }\n /** The box another element left for this id, if any. */\n from(id: string, owner: object): Box | undefined {\n const s = this.seen.get(id);\n return s && s.owner !== owner ? s.box : undefined;\n }\n\n /** A new element with this id: it leads, and the one it took over from is hidden. */\n join(id: string, m: Member) {\n const stack = this.stacks.get(id) ?? [];\n stack.at(-1)?.setHidden(true);\n stack.push(m);\n this.stacks.set(id, stack);\n }\n\n /** An element with this id is going: if it led, the one before it comes back from its box. */\n leave(id: string, m: Member) {\n const stack = this.stacks.get(id) ?? [];\n const wasLead = stack.at(-1) === m;\n const i = stack.indexOf(m);\n if (i >= 0) stack.splice(i, 1);\n if (!stack.length) this.stacks.delete(id);\n const last = this.seen.get(id);\n if (wasLead && stack.length) {\n stack.at(-1)!.resume(last?.owner === m ? last.box : undefined);\n } else if (last?.owner === m) {\n // Keep the box for a moment: the element taking over usually mounts in the same render\n setTimeout(() => { if (this.seen.get(id) === last) this.seen.delete(id); }, 1000);\n }\n }\n}\n\n/**\n * Layout animations, like Framer Motion's `layout` and `layoutId`.\n *\n * <!-- Glides to its new place (and size) whenever the layout changes -->\n * <li motionLayout>…</li>\n * <div motionLayout=\"position\">only moves; size changes jump</div>\n *\n * <!-- Shared element: a new element with the same id starts where the old one was -->\n * @for (tab of tabs; track tab) {\n * <button (click)=\"active = tab\">{{ tab }}\n * @if (active === tab) { <span class=\"underline\" motionLayoutId=\"underline\"></span> }\n * </button>\n * }\n *\n * After every render it measures the element's layout box (offsets, so\n * transforms and scrolling don't count). When the box has changed, it jumps\n * back to where it was drawn (FLIP) and springs to the new place: x/y for\n * position, scaleX/scaleY for size. Every element is measured after every\n * render, so siblings that weren't re-rendered animate too (no LayoutGroup\n * needed). Interrupted animations continue from where they are. Resizing the\n * window re-measures without animating, and with reduced motion it doesn't\n * animate.\n *\n * Shared ids: while two elements with the same id are mounted (a thumbnail\n * and its open lightbox), the newer one is shown and the older one hidden;\n * when the newer one is removed, the older one reappears and flies back from\n * where it was.\n *\n * - Size changes scale the element. Corner radii are corrected; mark content\n * with `motionLayoutCorrect` to counter-scale it (it keeps its own size),\n * or use \"position\".\n * - Uses transform (centre origin); don't give the element a CSS transform\n * of its own, wrap it instead.\n * - Has the class `motion-layout-animating` while it moves (to raise it with\n * a z-index, for example).\n */\n@Directive({\n selector: '[motionLayout], [motionLayoutId]',\n exportAs: 'motionLayout',\n})\nexport class MotionLayoutDirective implements Member {\n /** What animates: both (default, also for an empty attribute), 'position' or 'size'. */\n readonly motionLayout = input<'position' | 'size' | 'both' | '' | boolean>('');\n /** Shared layout id: an element with the same id that appears takes over from this one. */\n readonly motionLayoutId = input<string | null | undefined>(null);\n readonly layoutTransition = input<Record<string, unknown>>(LAYOUT_SPRING);\n readonly layoutAnimationStart = output<void>();\n readonly layoutAnimationComplete = output<void>();\n\n private readonly _animating = signal(false);\n readonly animating = this._animating.asReadonly();\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly motion = inject(MotionAnimationService);\n private readonly registry = inject(MotionLayoutRegistry);\n private prev: Box | null = null;\n /** Layout box to viewport offset (scrolling), measured for shared ids only. */\n private shift = { x: 0, y: 0 };\n private cur: Offset = NONE;\n private controls?: { stop(): void };\n private run?: object;\n /** Measure again without animating (after a window resize). */\n private resnap = false;\n /** The id this element joined the registry with. */\n private joined: string | null = null;\n /** Fly in from here (a viewport box) at the next update: the lead with our id went away. */\n private resumeFrom: Box | undefined;\n /** Corner radii (px) while scaling; null when there are none to correct. */\n private radii: number[] | null = null;\n /** The element's own inline border-radius, put back afterwards. */\n private inlineRadius = '';\n private readonly reduced = inject(MotionAnimationService).reducedMotion();\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n afterEveryRender({ earlyRead: () => this.measure(), write: box => this.update(box) });\n // A window resize moves things without animating: re-measure now, and snap\n // whatever renders before the next frame (breakpoint changes and the like)\n let raf = 0;\n const resize = () => {\n this.resnap = true;\n this.controls?.stop();\n this.controls = undefined;\n if (this.run) { this.run = undefined; this._animating.set(false); }\n if (this.cur !== NONE) this.apply(NONE);\n this.prev = this.measure() ?? this.prev;\n // Shared ids hand over from where this is now, not from before the resize\n const id = this.motionLayoutId();\n if (id && this.prev) this.registry.record(id, this, this.shifted(this.visual(this.prev)));\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(() => (this.resnap = false));\n };\n inject(NgZone).runOutsideAngular(() => window.addEventListener('resize', resize));\n destroyRef.onDestroy(() => {\n window.removeEventListener('resize', resize);\n cancelAnimationFrame(raf);\n this.controls?.stop();\n if (this.joined) this.registry.leave(this.joined, this);\n });\n }\n\n /** @internal */\n setHidden(hidden: boolean) {\n this.el.style.visibility = hidden ? 'hidden' : '';\n }\n\n /** @internal */\n resume(from: Box | undefined) {\n this.setHidden(false);\n this.resumeFrom = from;\n }\n\n private mode() {\n const m = this.motionLayout();\n return m === 'position' || m === 'size' ? m : 'both';\n }\n\n /** Layout box from offsets: unaffected by transforms (ours or anyone's) and by scrolling. */\n private measure(): Box | null {\n const el = this.el;\n if (!el.isConnected || (!el.offsetWidth && !el.offsetHeight && !el.offsetParent)) return null;\n let x = 0, y = 0;\n for (let n: HTMLElement | null = el; n; n = n.offsetParent as HTMLElement | null) { x += n.offsetLeft; y += n.offsetTop; }\n const w = el.offsetWidth, h = el.offsetHeight;\n const box = { cx: x + w / 2, cy: y + h / 2, w, h };\n if (this.motionLayoutId()) {\n // Our transform keeps the centre at layout centre + (x, y)\n const r = el.getBoundingClientRect();\n this.shift = { x: r.left + r.width / 2 - this.cur.x - box.cx, y: r.top + r.height / 2 - this.cur.y - box.cy };\n }\n return box;\n }\n\n /** A box in layout coordinates moved to (or, with -1, from) viewport coordinates. */\n private shifted(b: Box, sign = 1): Box {\n return { ...b, cx: b.cx + sign * this.shift.x, cy: b.cy + sign * this.shift.y };\n }\n\n /** Where the element is drawn: its layout box moved and scaled by our transform. */\n private visual(b: Box, o = this.cur): Box {\n return { cx: b.cx + o.x, cy: b.cy + o.y, w: b.w * o.sx, h: b.h * o.sy };\n }\n\n private update(box: Box | null) {\n const id = this.motionLayoutId() || null;\n if (id !== this.joined) {\n if (this.joined) this.registry.leave(this.joined, this);\n if (id) this.registry.join(id, this);\n this.joined = id;\n }\n if (!box) return;\n let from: Box | undefined;\n if (this.resumeFrom) {\n from = this.shifted(this.resumeFrom, -1);\n this.resumeFrom = undefined;\n } else if (!this.prev) {\n const seen = id && this.registry.from(id, this);\n if (seen) from = this.shifted(seen, -1);\n } else if (!same(this.prev, box)) {\n from = this.visual(this.prev);\n }\n this.prev = box;\n if (from && !this.resnap && !this.reduced) this.animateFrom(from, box);\n if (id) this.registry.record(id, this, this.shifted(this.visual(box)));\n }\n\n private animateFrom(from: Box, to: Box) {\n const mode = this.mode();\n const start: Offset = {\n x: mode === 'size' ? 0 : from.cx - to.cx,\n y: mode === 'size' ? 0 : from.cy - to.cy,\n sx: mode === 'position' || !to.w ? 1 : from.w / to.w,\n sy: mode === 'position' || !to.h ? 1 : from.h / to.h,\n };\n if (Math.abs(start.x) < 0.5 && Math.abs(start.y) < 0.5 && Math.abs(start.sx - 1) < 0.005 && Math.abs(start.sy - 1) < 0.005) return;\n this.controls?.stop();\n if (!this.radii) this.readRadii();\n this.apply(start);\n if (!this._animating()) { this._animating.set(true); this.layoutAnimationStart.emit(); }\n const id = this.motionLayoutId();\n // This run's token: updates from a run that finished or was replaced are ignored\n const run = {};\n this.run = run;\n const controls = this.motion.animate(0, 1, {\n ...this.layoutTransition(),\n onUpdate: (p: number) => {\n if (this.run !== run) return;\n this.apply(lerp(start, NONE, p));\n if (id && this.prev) this.registry.record(id, this, this.shifted(this.visual(this.prev)));\n },\n });\n this.controls = controls;\n Promise.resolve(controls).then(() => {\n if (this.run !== run) return;\n this.run = undefined;\n this.controls = undefined;\n this.apply(NONE);\n this._animating.set(false);\n this.layoutAnimationComplete.emit();\n }, () => {});\n }\n\n /** The element's own corner radii in px (percentages scale with the box already, so they're left alone). */\n private readRadii() {\n if (this.mode() === 'position') return;\n const cs = getComputedStyle(this.el);\n const r = CORNERS.map(c => cs[`border${c}Radius`]);\n if (r.some(v => v.includes('%'))) return;\n const px = r.map(v => parseFloat(v) || 0);\n if (px.some(v => v > 0)) { this.radii = px; this.inlineRadius = this.el.style.borderRadius; }\n }\n\n /**\n * Set our transform. Written straight to the style (not through Motion's\n * next frame), so what's drawn always matches `cur`: measuring and\n * interrupting read the same position the user sees.\n */\n private apply(o: Offset) {\n this.cur = o;\n const still = o === NONE;\n this.el.style.transform = still ? '' : `translate(${o.x}px, ${o.y}px) scale(${o.sx}, ${o.sy})`;\n this.el.classList.toggle('motion-layout-animating', !still);\n if (this.mode() === 'position') return;\n const flat = still || (o.sx === 1 && o.sy === 1);\n // Corners keep their shape: each radius divided by the scale on its axis\n if (this.radii) {\n const r = this.radii;\n this.el.style.borderRadius = flat ? this.inlineRadius : `${r.map(v => `${v / o.sx}px`).join(' ')} / ${r.map(v => `${v / o.sy}px`).join(' ')}`;\n if (still) this.radii = null;\n }\n // Counter-scale marked content so it keeps its size while the box scales\n const inverse = flat ? '' : `scale(${1 / o.sx}, ${1 / o.sy})`;\n this.el.querySelectorAll<HTMLElement>('[motionLayoutCorrect]').forEach(c => (c.style.transform = inverse));\n }\n}\n\nfunction same(a: Box, b: Box) {\n return Math.abs(a.cx - b.cx) < 0.5 && Math.abs(a.cy - b.cy) < 0.5 && Math.abs(a.w - b.w) < 0.5 && Math.abs(a.h - b.h) < 0.5;\n}\nfunction lerp(a: Offset, b: Offset, p: number): Offset {\n return { x: a.x + (b.x - a.x) * p, y: a.y + (b.y - a.y) * p, sx: a.sx + (b.sx - a.sx) * p, sy: a.sy + (b.sy - a.sy) * p };\n}\n","import {\n DestroyRef, ElementRef, Injector, NgZone, PLATFORM_ID, Signal, afterNextRender, assertInInjectionContext, effect, inject, signal, untracked,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { MotionAnimationService } from '../services/motion-animation.service';\nimport { scroll as motionScroll, transform as motionTransform } from 'motion';\n\nconst BRAND = Symbol('MotionSignal');\n\n/**\n * A value that changes often (every frame while something moves), like\n * Framer Motion's MotionValue, that is also an Angular signal.\n *\n * - Read it in a template (`{{ x() }}`) and that view updates as it changes.\n * - Or bind it with `[motionStyle]`: the directive listens with `on()` and\n * writes the style directly, so nothing re-renders while it moves.\n */\nexport interface MotionSignal<T = number> extends Signal<T> {\n /** The current value, without tracking it. */\n get(): T;\n /** Called synchronously on every change, outside change detection. Returns a function that stops listening. */\n on(listener: (value: T) => void): () => void;\n /** How fast it is changing, per second (numbers only; 0 once it settles). */\n getVelocity(): number;\n}\n\nexport interface WritableMotionSignal<T = number> extends MotionSignal<T> {\n set(value: T): void;\n}\n\n/** A spring-driven value: `set()` springs to the new target, `jump()` goes there at once. */\nexport interface SpringSignal extends MotionSignal<number> {\n set(target: number): void;\n jump(value: number): void;\n}\n\n/** Anything these functions accept as an input: a motion signal or any Angular signal. */\nexport type MotionSource<T = number> = MotionSignal<T> | Signal<T>;\n\nexport interface MotionSignalOptions {\n /** For calls outside an injection context (constructor or field initialiser). */\n injector?: Injector;\n}\n\nexport function isMotionSignal<T = unknown>(value: unknown): value is MotionSignal<T> {\n return typeof value === 'function' && (value as unknown as Record<symbol, unknown>)[BRAND] === true;\n}\n\n/** Settled after this long without a change: velocity reads 0. */\nconst SETTLE_MS = 50;\n/** Velocity is measured over at least about a frame. */\nconst MIN_SPAN_MS = 16;\n\n/**\n * A writable motion signal (Framer Motion's `useMotionValue`).\n *\n * readonly x = motionSignal(0);\n * (dragMove)=\"x.set($event.x)\"\n */\nexport function motionSignal<T = number>(initial: T): WritableMotionSignal<T> {\n const state = signal(initial);\n const listeners = new Set<(value: T) => void>();\n /** Recent numeric samples, for velocity: several sets within one frame must not divide by ~0 ms. */\n let samples: { t: number; v: number }[] = [];\n let lastTime = 0;\n const now = () => (typeof performance !== 'undefined' ? performance.now() : Date.now());\n\n const read = (() => state()) as WritableMotionSignal<T>;\n Object.defineProperty(read, BRAND, { value: true });\n read.get = () => untracked(state);\n read.on = listener => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n read.getVelocity = () => {\n const t = now();\n if (t - lastTime > SETTLE_MS || samples.length < 2) return 0;\n const last = samples[samples.length - 1];\n // Measure against the newest sample at least a frame older than the last one\n let ref = samples[0];\n for (let i = samples.length - 2; i >= 0; i--) if (last.t - samples[i].t >= MIN_SPAN_MS) { ref = samples[i]; break; }\n const dt = last.t - ref.t;\n return dt >= MIN_SPAN_MS / 2 ? ((last.v - ref.v) / dt) * 1000 : 0;\n };\n read.set = value => {\n const previous = untracked(state);\n if (Object.is(previous, value)) return;\n const t = now();\n if (typeof value === 'number') {\n // A fresh start after a pause: no velocity carried over from before it\n if (t - lastTime > SETTLE_MS) samples = [];\n samples.push({ t, v: value });\n if (samples.length > 8) samples = samples.slice(-8);\n }\n lastTime = t;\n state.set(value);\n for (const listener of [...listeners]) listener(value);\n };\n return read;\n}\n\n/**\n * A value derived from others (Framer Motion's `useTransform`).\n *\n * // Map a range: -200..200 px → 0..1..0 opacity (clamped; colours and units work too)\n * readonly opacity = mapSignal(x, [-200, 0, 200], [0, 1, 0]);\n * readonly colour = mapSignal(x, [-200, 200], ['#f43f5e', '#22c55e']);\n *\n * // Or a function of one or more sources\n * readonly label = mapSignal(x, v => `${Math.round(v)}px`);\n * readonly area = mapSignal([w, h], ([w, h]) => w * h);\n *\n * Plain Angular signals are accepted as sources too; they update it on the\n * next change detection, so call it in an injection context for those.\n */\nexport function mapSignal<O>(source: MotionSource<number>, input: number[], output: O[], options?: MotionSignalOptions & { clamp?: boolean; ease?: unknown }): MotionSignal<O>;\nexport function mapSignal<I, O>(source: MotionSource<I>, map: (value: I) => O, options?: MotionSignalOptions): MotionSignal<O>;\nexport function mapSignal<O>(sources: MotionSource<any>[], map: (values: any[]) => O, options?: MotionSignalOptions): MotionSignal<O>;\nexport function mapSignal(\n source: MotionSource<any> | MotionSource<any>[],\n mapOrInput: ((value: any) => unknown) | number[],\n outputOrOptions?: unknown[] | (MotionSignalOptions & { clamp?: boolean; ease?: unknown }),\n rangeOptions?: MotionSignalOptions & { clamp?: boolean; ease?: unknown },\n): MotionSignal<unknown> {\n const sources = Array.isArray(source) ? source : [source];\n let compute: () => unknown;\n let options: MotionSignalOptions | undefined;\n const value = (s: MotionSource<any>) => (isMotionSignal(s) ? s.get() : untracked(s));\n\n if (typeof mapOrInput === 'function') {\n const map = mapOrInput;\n options = outputOrOptions as MotionSignalOptions | undefined;\n compute = Array.isArray(source) ? () => map(sources.map(value)) : () => map(value(sources[0]));\n } else {\n options = rangeOptions;\n const mapper = motionTransform(mapOrInput, outputOrOptions as unknown[], { clamp: rangeOptions?.clamp ?? true, ease: rangeOptions?.ease as never });\n compute = () => mapper(value(sources[0]));\n }\n\n const out = motionSignal(compute());\n connect(sources, () => out.set(compute()), options);\n return out;\n}\n\n/**\n * A value that follows a target on a spring (Framer Motion's `useSpring`).\n *\n * // Springs towards whatever it's set to\n * readonly count = springSignal(0, { stiffness: 120, damping: 20 });\n * count.set(1200);\n *\n * // Or follows another value, smoothing it out\n * readonly smoothX = springSignal(x);\n *\n * Keeps its speed when the target changes mid-way. With reduced motion (and\n * on the server) it goes straight to the target. Call it in an injection\n * context, or pass `injector`.\n */\nexport function springSignal(\n source: number | MotionSource<number>,\n options: MotionSignalOptions & { stiffness?: number; damping?: number; mass?: number; restDelta?: number; restSpeed?: number } = {},\n): SpringSignal {\n const injector = injectorFor(springSignal, options);\n const zone = injector.get(NgZone);\n const browser = isPlatformBrowser(injector.get(PLATFORM_ID)) && typeof requestAnimationFrame !== 'undefined';\n const reduced = browser && injector.get(MotionAnimationService).reducedMotion();\n const { stiffness = 300, damping = 30, mass = 1, restDelta = 0.01, restSpeed = 0.05 } = options;\n\n const start = typeof source === 'number' ? source : isMotionSignal<number>(source) ? source.get() : untracked(source);\n const value = motionSignal(start);\n // The spring is integrated here, once per frame. A new target only moves the\n // goal: nothing restarts, so a target that changes every frame (a pointer,\n // a drag) is followed smoothly, keeping position and speed.\n let position = start;\n let velocity = 0;\n let target = start;\n let raf = 0;\n let last = 0;\n\n const stop = () => { if (raf) cancelAnimationFrame(raf); raf = 0; };\n const step = (time: number) => {\n // Long gaps (a background tab) are capped, so it doesn't leap\n let dt = Math.min(time > last ? time - last : 16, 64) / 1000;\n last = time;\n // Small fixed sub-steps keep stiff springs stable\n while (dt > 0) {\n const h = Math.min(dt, 0.004);\n const accel = (-stiffness * (position - target) - damping * velocity) / mass;\n velocity += accel * h;\n position += velocity * h;\n dt -= h;\n }\n if (Math.abs(velocity) < restSpeed && Math.abs(position - target) < restDelta) {\n position = target;\n velocity = 0;\n raf = 0;\n } else {\n raf = requestAnimationFrame(step);\n }\n value.set(position);\n };\n\n const out = (() => value()) as SpringSignal;\n Object.defineProperty(out, BRAND, { value: true });\n out.get = value.get;\n out.on = value.on;\n out.getVelocity = () => velocity;\n out.jump = v => {\n stop();\n position = target = v;\n velocity = 0;\n value.set(v);\n };\n out.set = next => {\n if (!browser || reduced) return out.jump(next);\n target = next;\n if (raf || (position === target && velocity === 0)) return;\n last = performance.now();\n zone.runOutsideAngular(() => (raf = requestAnimationFrame(step)));\n };\n\n if (typeof source !== 'number') connect([source], () => out.set(isMotionSignal<number>(source) ? source.get() : untracked(source)), options);\n injector.get(DestroyRef).onDestroy(stop);\n return out;\n}\n\n/**\n * How fast another value is changing, per second (Framer Motion's\n * `useVelocity`); back to 0 once it stops. Call it in an injection context,\n * or pass `injector`.\n *\n * readonly speed = velocitySignal(scrollY);\n * readonly skew = mapSignal(speed, [-2000, 2000], [-8, 8]);\n */\nexport function velocitySignal(source: MotionSignal<number>, options: MotionSignalOptions = {}): MotionSignal<number> {\n const injector = injectorFor(velocitySignal, options);\n const zone = injector.get(NgZone);\n const out = motionSignal(0);\n let raf = 0;\n const check = () => {\n raf = 0;\n const v = source.getVelocity();\n out.set(v);\n if (v !== 0) raf = requestAnimationFrame(check);\n };\n const stop = source.on(() => {\n out.set(source.getVelocity());\n // Keep checking each frame, so it falls to 0 when the source stops\n if (!raf && typeof requestAnimationFrame !== 'undefined') zone.runOutsideAngular(() => (raf = requestAnimationFrame(check)));\n });\n injector.get(DestroyRef).onDestroy(() => {\n stop();\n if (raf) cancelAnimationFrame(raf);\n });\n return out;\n}\n\nexport interface ScrollSignals {\n /** 0 to 1 through the scroll range. */\n progress: MotionSignal<number>;\n /** Scroll position in px. */\n offset: MotionSignal<number>;\n /** Scroll speed in px per second. */\n velocity: MotionSignal<number>;\n}\n\ntype ElementSource = Element | ElementRef<Element> | (() => Element | ElementRef<Element> | null | undefined) | null | undefined;\n\n/**\n * Scroll position as motion signals (Framer Motion's `useScroll`). The page by\n * default; pass a scrolling `container` and/or a `target` element whose\n * progress through it you want (with `offset`). Element options can be\n * functions, so `viewChild` signals work. Call it in an injection context, or\n * pass `injector`.\n *\n * readonly scrollY = scrollSignal();\n * readonly width = mapSignal(this.scrollY.progress, [0, 1], ['0%', '100%']);\n */\nexport function scrollSignal(\n options: MotionSignalOptions & { container?: ElementSource; target?: ElementSource; offset?: string[]; axis?: 'x' | 'y' } = {},\n): ScrollSignals {\n const injector = injectorFor(scrollSignal, options);\n const progress = motionSignal(0);\n const offset = motionSignal(0);\n const velocity = motionSignal(0);\n let cancel: (() => void) | undefined;\n\n if (isPlatformBrowser(injector.get(PLATFORM_ID))) {\n afterNextRender(() => {\n const resolve = (e: ElementSource): Element | undefined => {\n const v = typeof e === 'function' ? e() : e;\n return v instanceof ElementRef ? v.nativeElement : v ?? undefined;\n };\n const container = resolve(options.container);\n const target = resolve(options.target);\n const axis = options.axis ?? 'y';\n injector.get(NgZone).runOutsideAngular(() => {\n cancel = motionScroll((p: number, info: { x: AxisInfo; y: AxisInfo }) => {\n progress.set(p);\n offset.set(info[axis].current);\n velocity.set(info[axis].velocity);\n }, { container: container as HTMLElement | undefined, target, offset: options.offset as never, axis });\n });\n }, { injector });\n }\n injector.get(DestroyRef).onDestroy(() => cancel?.());\n return { progress, offset, velocity };\n}\n\ninterface AxisInfo { current: number; velocity: number; }\n\n/** Run `update` whenever any source changes: motion signals directly, Angular signals via an effect. */\nfunction connect(sources: MotionSource<any>[], update: () => void, options?: MotionSignalOptions) {\n const stops = sources.filter(isMotionSignal).map(s => s.on(update));\n const plain = sources.filter(s => !isMotionSignal(s));\n const injector = options?.injector ?? tryInject();\n if (plain.length) {\n if (!injector) throw new Error('ngx-motion: a plain Angular signal source needs an injection context or the `injector` option.');\n effect(() => { for (const s of plain) s(); untracked(update); }, { injector });\n }\n if (stops.length && injector) injector.get(DestroyRef).onDestroy(() => stops.forEach(stop => stop()));\n}\n\nfunction tryInject(): Injector | undefined {\n try { return inject(Injector); } catch { return undefined; }\n}\n\nfunction injectorFor(fn: Function, options: MotionSignalOptions): Injector {\n if (options.injector) return options.injector;\n assertInInjectionContext(fn);\n return inject(Injector);\n}\n","import { Directive, ElementRef, effect, inject, input, isSignal, untracked } from '@angular/core';\nimport { MotionSignal, isMotionSignal } from '../values/motion-signals';\nimport { applySvgPath, isSvgPathKey } from '../utils/svg-path.utils';\n\n/** Transform shortcuts, in the order they are applied (as in Framer Motion). */\nconst TRANSFORMS = ['x', 'y', 'z', 'scale', 'scaleX', 'scaleY', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'skewX', 'skewY'] as const;\nconst TRANSFORM_FN: Record<string, string> = { x: 'translateX', y: 'translateY', z: 'translateZ' };\n/** Numbers are written as-is for these; other numbers get px. */\nconst UNITLESS = new Set(['opacity', 'zIndex', 'fontWeight', 'lineHeight', 'flex', 'flexGrow', 'flexShrink', 'order', 'zoom', 'fillOpacity', 'strokeOpacity']);\n\nexport type MotionStyleValue = MotionSignal<number | string> | (() => number | string) | number | string | null | undefined;\n\n/**\n * Binds styles to motion signals (Framer Motion's `style={{ x, opacity }}`).\n * Each change is written straight to the element, without change detection,\n * so values that change every frame cost nothing to render.\n *\n * <div [motionStyle]=\"{ x: smoothX, rotate: tilt, opacity: fade, backgroundColor: colour }\"></div>\n *\n * - Transform shortcuts: x, y, z (px), scale, scaleX, scaleY, rotate,\n * rotateX/Y/Z, skewX/Y (deg). They are combined into `transform`, so don't\n * animate the same element's transform another way.\n * - SVG line drawing: pathLength, pathOffset, pathSpacing (0 to 1), e.g.\n * `{ pathLength: scroll.progress }` draws a line as the page scrolls.\n * - Other styles take camelCase names; numbers get px except unitless ones\n * (opacity, zIndex, …). CSS custom properties (`'--progress'`) take any value.\n * - Values can be motion signals, plain Angular signals (updated with change\n * detection) or constants.\n */\n@Directive({ selector: '[motionStyle]' })\nexport class MotionStyleDirective {\n readonly motionStyle = input<Record<string, MotionStyleValue> | null>(null);\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly transform = new Map<string, number | string>();\n\n constructor() {\n effect(onCleanup => {\n const styles = this.motionStyle() ?? {};\n const stops: (() => void)[] = [];\n for (const [key, v] of Object.entries(styles)) {\n if (isMotionSignal<number | string>(v)) {\n this.write(key, v.get());\n stops.push(v.on(value => this.write(key, value)));\n } else if (isSignal(v) || typeof v === 'function') {\n // A plain signal: read here, so this effect re-runs when it changes\n const value = (v as () => number | string)();\n untracked(() => this.write(key, value));\n } else {\n this.write(key, v);\n }\n }\n onCleanup(() => {\n stops.forEach(stop => stop());\n // Keys that are no longer bound go back to the stylesheet\n for (const key of Object.keys(styles)) if (!(key in (untracked(this.motionStyle) ?? {}))) this.write(key, null);\n });\n });\n }\n\n private write(key: string, value: number | string | null | undefined) {\n if (isSvgPathKey(key)) return applySvgPath(this.el, { [key]: value });\n if ((TRANSFORMS as readonly string[]).includes(key)) {\n if (value == null) this.transform.delete(key); else this.transform.set(key, value);\n this.el.style.transform = this.transformString();\n return;\n }\n const css = value == null ? '' : typeof value === 'number' && !UNITLESS.has(key) && !key.startsWith('--') ? `${value}px` : String(value);\n if (key.startsWith('--')) this.el.style.setProperty(key, css);\n else (this.el.style as unknown as Record<string, string>)[key] = css;\n }\n\n private transformString() {\n let out = '';\n for (const key of TRANSFORMS) {\n const v = this.transform.get(key);\n if (v === undefined) continue;\n const unit = typeof v !== 'number' ? '' : key === 'x' || key === 'y' || key === 'z' ? 'px' : key.startsWith('scale') ? '' : 'deg';\n out += `${TRANSFORM_FN[key] ?? key}(${v}${unit}) `;\n }\n return out.trim();\n }\n}\n","import { DestroyRef, ElementRef, Injector, NgZone, PLATFORM_ID, assertInInjectionContext, inject } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { createScopedAnimate } from 'motion';\nimport { MotionAnimationService } from '../services/motion-animation.service';\nimport { withSvgPathContext } from '../utils/svg-path.utils';\nimport { withoutMovement } from '../config/motion-config';\nimport { MotionSignal, isMotionSignal } from '../values/motion-signals';\n\n/** What injectAnimate resolves selectors in: an element, an ElementRef, or a function returning one (a viewChild). */\nexport type AnimateScope = Element | ElementRef<Element> | (() => Element | ElementRef<Element> | null | undefined);\n\n/** The running animation: await it (or `.finished`), or stop, pause, play, complete it. */\nexport interface AnimationControls extends PromiseLike<void> {\n readonly finished: Promise<unknown>;\n stop(): void;\n cancel(): void;\n complete(): void;\n play(): void;\n pause(): void;\n time: number;\n speed: number;\n readonly duration: number;\n}\n\ntype Target = string | Element | Element[] | NodeListOf<Element> | ElementRef<Element>;\ntype Keyframes = Record<string, unknown>;\ntype Options = Record<string, unknown>;\n/** A step of a sequence: [target, keyframes, options?], [signal, to, options?] or a label. */\nexport type SequenceStep = [Target | MotionSignal<number>, unknown, Options?] | string;\n\n/** A number signal it can animate: a motionSignal or springSignal (springs are moved frame by frame). */\ntype NumberSignal = MotionSignal<number> & ({ set(v: number): void } | { jump(v: number): void });\n\nexport interface ScopedAnimate {\n /** Animate elements (or a CSS selector, looked up inside the scope). */\n (target: Target, keyframes: Keyframes, options?: Options): AnimationControls;\n /** Animate a number signal to a value (or through keyframes). */\n (signal: NumberSignal, to: number | number[], options?: Options): AnimationControls;\n /** Play a sequence: steps run one after another; `at` places a step on the timeline. */\n (sequence: SequenceStep[], options?: Options): AnimationControls;\n /** Stop everything started with this function. */\n stop(): void;\n}\n\nexport interface InjectAnimateOptions {\n /** Where selectors are looked up. Defaults to the host element of the component or directive. */\n scope?: AnimateScope;\n injector?: Injector;\n}\n\n/**\n * Animate from code (Framer Motion's `useAnimate`), for animations a template\n * state doesn't express: after a request, in a sequence, from a service.\n *\n * private readonly animate = injectAnimate();\n *\n * async save() {\n * await this.animate('.card', { scale: 0.95 }, { duration: 0.1 });\n * await this.animate([\n * ['.card', { scale: 1 }, { type: 'spring', stiffness: 400 }],\n * ['.tick', { pathLength: [0, 1], opacity: 1 }, { at: '-0.1' }],\n * ['li', { opacity: [0, 1], y: [8, 0] }, { delay: stagger(0.05) }],\n * ]);\n * }\n *\n * - Selectors are looked up inside the host element (or `scope`), so they\n * never match another component's elements.\n * - Every animation it started is stopped when the component is destroyed.\n * - Runs outside Angular's change detection; does nothing on the server.\n * - With reduced motion, movement jumps to its end (see provideMotionConfig).\n * - Also animates number signals: `animate(this.count, 100)`.\n *\n * Call it in an injection context (a field or the constructor), or pass `injector`.\n */\nexport function injectAnimate(options: InjectAnimateOptions = {}): ScopedAnimate {\n if (!options.injector) assertInInjectionContext(injectAnimate);\n const injector = options.injector ?? inject(Injector);\n const motion = injector.get(MotionAnimationService);\n const zone = injector.get(NgZone);\n const browser = isPlatformBrowser(injector.get(PLATFORM_ID));\n const host = injector.get(ElementRef, null);\n\n const resolve = (s: AnimateScope | undefined): Element | undefined => {\n const v = typeof s === 'function' ? s() : s;\n return v instanceof ElementRef ? v.nativeElement : v ?? undefined;\n };\n // Motion reads scope.current when it looks up selectors\n const scope = {\n get current() { return resolve(options.scope) ?? (host?.nativeElement as Element | undefined); },\n animations: [] as { stop(): void }[],\n };\n const scoped = createScopedAnimate(scope as never) as unknown as (...args: unknown[]) => AnimationControls;\n const running = new Set<AnimationControls>();\n\n const element = (t: unknown) => (t instanceof ElementRef ? t.nativeElement : t);\n\n /** One target: elements get SVG path handling and reduced motion; signals get frames. */\n const prepare = (target: unknown, keyframes: unknown, opts: Options | undefined): [unknown, unknown, Options | undefined] => {\n if (isMotionSignal<number>(target)) {\n const sig = target as NumberSignal;\n const write = writer(sig);\n const to = Array.isArray(keyframes) ? keyframes : [sig.get(), keyframes];\n return [to, { ...opts, onUpdate: (v: number) => { write(v); (opts?.['onUpdate'] as ((v: number) => void) | undefined)?.(v); } }, undefined];\n }\n const el = element(target);\n let o = opts;\n if (motion.reducedMotion()) o = withoutMovement(keyframes, o);\n return [el, el instanceof Element ? withSvgPathContext(el, keyframes as Keyframes) : keyframes, o];\n };\n\n const animate = ((first: unknown, second?: unknown, third?: Options) => {\n if (!browser) return done();\n let controls: AnimationControls;\n if (Array.isArray(first) && first.some(Array.isArray)) {\n // A sequence: prepare each step\n const steps = (first as SequenceStep[]).map(step => {\n if (!Array.isArray(step)) return step;\n const [target, keyframes, opts] = step;\n if (isMotionSignal<number>(target)) {\n // In a sequence a signal is animated as an object whose value writes to it\n const write = writer(target as NumberSignal);\n const proxy = { get v() { return (target as NumberSignal).get(); }, set v(x: number) { write(x); } };\n const to = Array.isArray(keyframes) ? keyframes : [proxy.v, keyframes];\n return opts ? [proxy, { v: to }, opts] : [proxy, { v: to }];\n }\n const [t, k, o] = prepare(target, keyframes, opts);\n return o === undefined ? [t, k] : [t, k, o];\n });\n controls = zone.runOutsideAngular(() => scoped(steps, second));\n } else if (isMotionSignal(first)) {\n const [values, opts] = prepare(first, second, third);\n // Motion's single-value form: animate(from, keyframes, options)\n controls = zone.runOutsideAngular(() => scoped((values as number[])[0], values, opts));\n } else {\n const [t, k, o] = prepare(first, second, third);\n controls = zone.runOutsideAngular(() => scoped(t, k, o));\n }\n running.add(controls);\n controls.finished.then(() => running.delete(controls), () => running.delete(controls));\n return controls;\n }) as ScopedAnimate;\n\n animate.stop = () => {\n for (const c of running) c.stop();\n running.clear();\n };\n injector.get(DestroyRef).onDestroy(animate.stop);\n return animate;\n}\n\n/** Springs are moved frame by frame with jump(), so they don't spring on top. */\nfunction writer(sig: NumberSignal): (v: number) => void {\n return 'jump' in sig ? v => sig.jump(v) : v => (sig as { set(v: number): void }).set(v);\n}\n\n/** Finished controls, for the server. */\nfunction done(): AnimationControls {\n const finished = Promise.resolve();\n return {\n finished, time: 0, speed: 1, duration: 0,\n stop() {}, cancel() {}, complete() {}, play() {}, pause() {},\n then: (onFulfilled, onRejected) => finished.then(onFulfilled, onRejected),\n };\n}\n\nexport { stagger } from 'motion';\n"],"mappings":";;;;;;AA2BE,IAAa,mBAAb,MAAa,iBAAgB;CA4BC;CACG;CACrB;CA7BF,iBAAkC,CAAA;CACzB,mBAAmB,OAAO,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,CAAA,CAAA;CACrC,uBAA4C;CAMpD,IAAI,kBAAe;EACjB,KAAK,qBAAoB;EACzB,OAAO,KAAK;CACd;CACA,oBAA4B;CAGpB,yBAAyB,IAAI,QAAO;CAGpC,0BAA0B,IAAI,QAAO;CAGrC,uCAA4C,IAAI,IAAG;CAGnD,wCAA6C,IAAI,IAAG;CAE5D,YAC4B,UACG,YACrB,QAAc;EAFI,KAAA,WAAA;EACG,KAAA,aAAA;EACrB,KAAA,SAAA;CACP;CAEH,cAAW;EACT,KAAK,uBAAsB;EAC3B,KAAK,uBAAuB;EAC5B,KAAK,uBAAuB,SAAQ;EACpC,KAAK,wBAAwB,SAAQ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