{ "version": 3, "sources": ["src/app/shared/scroll/on-scroll-view.directive.ts"], "sourcesContent": ["import { Directive, OnInit, OnDestroy, Input, Output, EventEmitter, ElementRef, NgZone, Inject } from '@angular/core';\r\nimport { Platform } from '@angular/cdk/platform';\r\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\r\nimport { IntersectionObserverService, IntersectionTarget } from './intersection-observer.service';\r\n\r\nexport interface IntersectionState {\r\n isVisible: boolean;\r\n ratio: number;\r\n}\r\n@Directive({\r\n selector: '[onScrollView]',\r\n standalone: true\r\n})\r\nexport class OnScrollViewDirective implements OnInit, OnDestroy, IntersectionTarget {\r\n\r\n constructor(\r\n public elRef: ElementRef,\r\n @Inject('OnScrollViewIOS') private intersectionObserverService: IntersectionObserverService,\r\n private zone: NgZone,\r\n private platform: Platform\r\n ) { }\r\n\r\n // /** Emits at the end of the animation */\r\n @Output() viewStateChange = new EventEmitter();\r\n\r\n /** When true, triggers the animation on element scrolling in the viewport */\r\n @Input('once') set detectOnce(value: boolean) { this.once = coerceBooleanProperty(value); }\r\n public once = false;\r\n\r\n /** Specifies the amout of visibility triggering AOS */\r\n @Input() threshold = 0.2;\r\n\r\n ngOnInit(): void {\r\n // Triggers the animation based on the input flags\r\n if (this.platform.isBrowser) {\r\n // Attached this directive the LazyViewport so that we can be alerted to changes\r\n // in this element's visibility on the page.\r\n this.intersectionObserverService.addTarget(this);\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n if (this.platform.isBrowser) {\r\n // If we haven't detached from the LazyViewport, do so now.\r\n this.intersectionObserverService.removeTarget(this.elRef);\r\n }\r\n\r\n }\r\n\r\n public updateVisibility(isVisible: boolean, ratio: number): void {\r\n if (isVisible && this.once) {\r\n this.intersectionObserverService.removeTarget(this.elRef);\r\n }\r\n this.zone.run(() => {\r\n this.viewStateChange.emit({\r\n isVisible: isVisible,\r\n ratio: ratio\r\n });\r\n });\r\n\r\n }\r\n}\r\n"], "mappings": "oJAaA,IAAaA,GAAqB,IAAA,CAA5B,IAAOA,EAAP,MAAOA,CAAqB,CAEhCC,YACSC,EAC4BC,EAC3BC,EACAC,EAAkB,CAHnB,KAAAH,MAAAA,EAC4B,KAAAC,4BAAAA,EAC3B,KAAAC,KAAAA,EACA,KAAAC,SAAAA,EAIA,KAAAC,gBAAkB,IAAIC,EAIzB,KAAAC,KAAO,GAGL,KAAAC,UAAY,EAVjB,CAMJ,IAAmBC,WAAWC,EAAc,CAAI,KAAKH,KAAOI,EAAsBD,CAAK,CAAG,CAM1FE,UAAQ,CAEF,KAAKR,SAASS,WAGhB,KAAKX,4BAA4BY,UAAU,IAAI,CAEnD,CAEAC,aAAW,CACL,KAAKX,SAASS,WAEhB,KAAKX,4BAA4Bc,aAAa,KAAKf,KAAK,CAG5D,CAEOgB,iBAAiBC,EAAoBC,EAAa,CACnDD,GAAa,KAAKX,MACpB,KAAKL,4BAA4Bc,aAAa,KAAKf,KAAK,EAE1D,KAAKE,KAAKiB,IAAI,IAAK,CACjB,KAAKf,gBAAgBgB,KAAK,CACxBH,UAAWA,EACXC,MAAOA,EACR,CACH,CAAC,CAEH,yCA/CWpB,GAAqBuB,EAAAC,CAAA,EAAAD,EAItB,iBAAiB,EAAAA,EAAAE,CAAA,EAAAF,EAAAG,CAAA,CAAA,CAAA,sBAJhB1B,EAAqB2B,UAAA,CAAA,CAAA,GAAA,eAAA,EAAA,CAAA,EAAAC,OAAA,CAAAlB,WAAA,CAAA,EAAA,OAAA,YAAA,EAAAD,UAAA,WAAA,EAAAoB,QAAA,CAAAvB,gBAAA,iBAAA,EAAAwB,WAAA,EAAA,CAAA,EAA5B,IAAO9B,EAAP+B,SAAO/B,CAAqB,GAAA", "names": ["OnScrollViewDirective", "constructor", "elRef", "intersectionObserverService", "zone", "platform", "viewStateChange", "EventEmitter", "once", "threshold", "detectOnce", "value", "coerceBooleanProperty", "ngOnInit", "isBrowser", "addTarget", "ngOnDestroy", "removeTarget", "updateVisibility", "isVisible", "ratio", "run", "emit", "\u0275\u0275directiveInject", "ElementRef", "NgZone", "Platform", "selectors", "inputs", "outputs", "standalone", "_OnScrollViewDirective"] }