@hilux/ngx-motion 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -275,6 +275,12 @@ The directives work seamlessly with Angular's new control flow syntax:
275
275
  | `transition={{ type: 'spring' }}` | `[transition]="{ type: 'spring' }"` |
276
276
  | `<AnimatePresence>` | `*motionIf` or `*motionPresence` |
277
277
 
278
+ ## Changelog
279
+
280
+ **2.0.1**
281
+ - `delayChildren` set inside `[transition]` is now honoured, as in Framer Motion. Before, only the `[delayChildren]` input was read.
282
+ - A `runInView` parent now orchestrates its children fully when it scrolls into view: stagger slots, `delayChildren`, each child's own `delay`, and nested children. Before, its direct children animated flat, grandchildren never played, and an in-view child inside it never played.
283
+
278
284
  ## Upgrading from 1.x
279
285
 
280
286
  2.0 fixes several behaviours, some of which change how existing animations look:
@@ -389,6 +389,9 @@ var MotionAnimationOptionsService = class MotionAnimationOptionsService {
389
389
  getStaggerValue(animateState, transition, defaultStaggerChildren = 0) {
390
390
  return (animateState?.transition || transition || {}).staggerChildren ?? defaultStaggerChildren;
391
391
  }
392
+ getDelayChildren(animateState, transition, defaultDelayChildren = 0) {
393
+ return (animateState?.transition || transition || {}).delayChildren ?? defaultDelayChildren;
394
+ }
392
395
  getStaggerDirection(animateState, transition, defaultStaggerDirection = 1) {
393
396
  return (animateState?.transition || transition || {}).staggerDirection ?? defaultStaggerDirection;
394
397
  }
@@ -1139,7 +1142,7 @@ var MotionOneDirective = class MotionOneDirective {
1139
1142
  }
1140
1143
  }
1141
1144
  childrenToPlay() {
1142
- return this.getStaggerValue() === 0 ? this.motionChildren.filter((child) => !child.isRunInViewEnabled) : this.motionChildren;
1145
+ return this.getStaggerValue() === 0 ? this.motionChildren.filter((child) => !child.isRunInViewEnabled || child.isStaggeredChild) : this.motionChildren;
1143
1146
  }
1144
1147
  playAsChild() {
1145
1148
  this.staggerDelay = void 0;
@@ -1206,7 +1209,7 @@ var MotionOneDirective = class MotionOneDirective {
1206
1209
  applyStaggerToChildren() {
1207
1210
  const staggerValue = this.getStaggerValue();
1208
1211
  const staggerDirection = this.getStaggerDirection();
1209
- const delayChildren = this.delayChildren;
1212
+ const delayChildren = this.animationOptions.getDelayChildren(this.getVariant(this.animate), this.transition, this.delayChildren);
1210
1213
  const parentDelay = this.transition?.delay ?? 0;
1211
1214
  const childDirectives = this.childrenToPlay();
1212
1215
  const childCount = childDirectives.length;
@@ -1563,20 +1566,7 @@ var MotionOneDirective = class MotionOneDirective {
1563
1566
  const childDirectives = this.motionChildren;
1564
1567
  this.resetToInitialStylesBatch([this, ...childDirectives]);
1565
1568
  let pending = null;
1566
- if (childDirectives.length > 0) pending = this.schedule(() => {
1567
- const staggerValue = this.getStaggerValue();
1568
- childDirectives.forEach((child, index) => {
1569
- const childAnimateStyles = child.extractStyleProperties(child.getVariant(child.animate));
1570
- const options = child.getAnimationOptions();
1571
- options.delay = index * staggerValue;
1572
- child.animateSelf(childAnimateStyles, options);
1573
- });
1574
- const parentAnimateStyles = extractStyleProperties(this.getVariant(this.animate));
1575
- if (Object.keys(parentAnimateStyles).length > 0) {
1576
- const parentOptions = this.getAnimationOptions();
1577
- this.animateSelf(parentAnimateStyles, parentOptions);
1578
- }
1579
- }, MOTION_DEFAULTS.STAGGER_TIMEOUT);
1569
+ if (childDirectives.length > 0) pending = this.schedule(() => this.applyStaggerToChildren(), MOTION_DEFAULTS.STAGGER_TIMEOUT);
1580
1570
  if (this.runInViewRepeat === "always") return () => {
1581
1571
  this.cancelScheduled(pending);
1582
1572
  this.resetToInitialStylesBatch([this, ...childDirectives]);
@@ -1 +1 @@
1
- {"version":3,"file":"hilux-ngx-motion.mjs","names":["motionAnimate","motionInView","motionEaseIn","motionEaseOut","motionEaseInOut","motionStagger","motionSpring","hasStyleProperties","globalTransition"],"sources":["../../../projects/ngx-motion/src/lib/services/motion-one.service.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"],"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 ","import { Injectable, NgZone, PLATFORM_ID, inject } from '@angular/core';\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\n animate(target: any, keyframes: any, options?: any): any {\n if (!this.isBrowser) {\n return noopControls();\n }\n\n try {\n return this.ngZone.runOutsideAngular(() => motionAnimate(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 { TransitionOptions } from '../types/motion-animation.types';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/**\n * Resolve easing string/config to Motion One easing function\n */\nexport function getEasing(\n easingString: string | 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 // 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 }\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 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 { 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\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, styles: Record<string, any>): void {\n if (!el?.style || !styles) return;\n\n const transforms: string[] = [];\n let rawTransform: string | undefined;\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 (!TRANSFORM_KEYS.has(key)) {\n (el.style as any)[key] = value;\n }\n }\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 return this.getStaggerValue() === 0\n ? this.motionChildren.filter(child => !child.isRunInViewEnabled)\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.delayChildren;\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 if (this.motionChildren.length > 0 && !this.isChild) {\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 pending = this.schedule(() => {\n const staggerValue = this.getStaggerValue();\n childDirectives.forEach((child, index) => {\n const childAnimateStyles = child.extractStyleProperties(child.getVariant(child.animate));\n const options: any = child.getAnimationOptions();\n options.delay = index * staggerValue;\n child.animateSelf(childAnimateStyles, options);\n });\n\n const parentAnimateStyles = extractStyleProperties(this.getVariant(this.animate));\n if (Object.keys(parentAnimateStyles).length > 0) {\n const parentOptions = this.getAnimationOptions();\n this.animateSelf(parentAnimateStyles, parentOptions);\n }\n }, 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 direct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AAI,MAAM,kBAER,AADiB,KAAK,iBAAiB,aACvC,CAAA,CAAS,SAAS,OAAW;IAC3B,IAAI,GAAG,kBACL,WAAW,KAAK,GAAG,gBAAgB;GAEvC,CAAC;EAEL,CAAC;EAED,OAAO;CACT;CAtHW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAuB,MAAA;GAAA,EAAA,OAAA,YAAA;GAAA,EAAA,OAAA,iBAAA;GAAA,EAAA,OAAA,kBAAA;EAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAvB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAuB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,uBAAA;GAAA,sBAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAvB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAJnC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,YAAY;EACb,CAAA;;;;;;;;E,0BAOE,MAAA,M;E,yBACA,MAAA,M;E,mBAkBA,MAAA,M"}
1
+ {"version":3,"file":"hilux-ngx-motion.mjs","names":["motionAnimate","motionInView","motionEaseIn","motionEaseOut","motionEaseInOut","motionStagger","motionSpring","hasStyleProperties","globalTransition"],"sources":["../../../projects/ngx-motion/src/lib/services/motion-one.service.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"],"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 ","import { Injectable, NgZone, PLATFORM_ID, inject } from '@angular/core';\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\n animate(target: any, keyframes: any, options?: any): any {\n if (!this.isBrowser) {\n return noopControls();\n }\n\n try {\n return this.ngZone.runOutsideAngular(() => motionAnimate(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 { TransitionOptions } from '../types/motion-animation.types';\nimport { MotionAnimationService } from '../services/motion-animation.service';\n\n/**\n * Resolve easing string/config to Motion One easing function\n */\nexport function getEasing(\n easingString: string | 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 // 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 }\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 { 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\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, styles: Record<string, any>): void {\n if (!el?.style || !styles) return;\n\n const transforms: string[] = [];\n let rawTransform: string | undefined;\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 (!TRANSFORM_KEYS.has(key)) {\n (el.style as any)[key] = value;\n }\n }\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 if (this.motionChildren.length > 0 && !this.isChild) {\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 });\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AA;GAAA,EAAA,OAAA,YAAA;GAAA,EAAA,OAAA,iBAAA;GAAA,EAAA,OAAA,kBAAA;EAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAvB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAuB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,uBAAA;GAAA,sBAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAvB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAJnC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,YAAY;EACb,CAAA;;;;;;;;E,0BAOE,MAAA,M;E,yBACA,MAAA,M;E,mBAkBA,MAAA,M"}
package/package.json CHANGED
@@ -52,5 +52,5 @@
52
52
  "default": "./package.json"
53
53
  }
54
54
  },
55
- "version": "2.0.0"
55
+ "version": "2.0.1"
56
56
  }
@@ -232,6 +232,11 @@ declare class MotionAnimationOptionsService {
232
232
  * Get stagger value from transition configuration
233
233
  */
234
234
  getStaggerValue(animateState?: VariantWithTransition, transition?: TransitionOptions | Record<string, TransitionOptions>, defaultStaggerChildren?: number): number;
235
+ /**
236
+ * Get delayChildren from transition configuration (state transition first,
237
+ * then the transition input, then the delayChildren input), as in Framer Motion
238
+ */
239
+ getDelayChildren(animateState?: VariantWithTransition, transition?: TransitionOptions | Record<string, TransitionOptions>, defaultDelayChildren?: number): number;
235
240
  /**
236
241
  * Get stagger direction from transition configuration
237
242
  */