Icard/angular-clarity-master(work.../node_modules/primeng/fesm2022/primeng-animateonscroll.mjs...

1 line
12 KiB
Plaintext

{"version":3,"file":"primeng-animateonscroll.mjs","sources":["../../src/app/components/animateonscroll/animateonscroll.ts","../../src/app/components/animateonscroll/primeng-animateonscroll.ts"],"sourcesContent":["import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { AfterViewInit, Directive, ElementRef, Input, NgModule, Renderer2, OnInit, Inject, PLATFORM_ID, booleanAttribute, numberAttribute } from '@angular/core';\nimport { DomHandler } from 'primeng/dom';\n\ninterface AnimateOnScrollOptions {\n root?: HTMLElement;\n rootMargin?: string;\n threshold?: number;\n}\n\n/**\n * AnimateOnScroll is used to apply animations to elements when entering or leaving the viewport during scrolling.\n * @group Components\n */\n@Directive({\n selector: '[pAnimateOnScroll]',\n host: {\n '[class.p-animateonscroll]': 'true'\n }\n})\nexport class AnimateOnScroll implements OnInit, AfterViewInit {\n /**\n * Selector to define the CSS class for enter animation.\n * @group Props\n */\n @Input() enterClass: string | undefined;\n /**\n * Selector to define the CSS class for leave animation.\n * @group Props\n */\n @Input() leaveClass: string | undefined;\n /**\n * Specifies the root option of the IntersectionObserver API.\n * @group Props\n */\n @Input() root: HTMLElement | undefined | null;\n /**\n * Specifies the rootMargin option of the IntersectionObserver API.\n * @group Props\n */\n @Input() rootMargin: string | undefined;\n /**\n * Specifies the threshold option of the IntersectionObserver API\n * @group Props\n */\n @Input({ transform: numberAttribute }) threshold: number | undefined;\n /**\n * Whether the scroll event listener should be removed after initial run.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) once: boolean = true;\n\n observer: IntersectionObserver | undefined;\n\n resetObserver: any;\n\n isObserverActive: boolean = false;\n\n animationState: any;\n\n animationEndListener: VoidFunction | undefined;\n\n constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, private host: ElementRef, public el: ElementRef, public renderer: Renderer2) {}\n\n ngOnInit() {\n if (isPlatformBrowser(this.platformId)) {\n this.renderer.setStyle(this.host.nativeElement, 'opacity', this.enterClass ? '0' : '');\n }\n }\n\n ngAfterViewInit() {\n if (isPlatformBrowser(this.platformId)) {\n this.bindIntersectionObserver();\n }\n }\n\n get options(): AnimateOnScrollOptions {\n return {\n root: this.root,\n rootMargin: this.rootMargin,\n threshold: this.threshold\n };\n }\n\n bindIntersectionObserver() {\n this.observer = new IntersectionObserver(([entry]) => {\n if (this.isObserverActive) {\n if (entry.boundingClientRect.top > 0) {\n entry.isIntersecting ? this.enter() : this.leave();\n }\n } else if (entry.isIntersecting) {\n this.enter();\n }\n\n this.isObserverActive = true;\n }, this.options);\n\n setTimeout(() => this.observer.observe(this.host.nativeElement), 0);\n\n // Reset\n\n this.resetObserver = new IntersectionObserver(\n ([entry]) => {\n if (entry.boundingClientRect.top > 0 && !entry.isIntersecting) {\n this.host.nativeElement.style.opacity = this.enterClass ? '0' : '';\n DomHandler.removeMultipleClasses(this.host.nativeElement, [this.enterClass, this.leaveClass]);\n\n this.resetObserver.unobserve(this.host.nativeElement);\n }\n\n this.animationState = undefined;\n },\n { ...this.options, threshold: 0 }\n );\n }\n\n enter() {\n if (this.animationState !== 'enter' && this.enterClass) {\n this.host.nativeElement.style.opacity = '';\n DomHandler.removeMultipleClasses(this.host.nativeElement, this.leaveClass);\n DomHandler.addMultipleClasses(this.host.nativeElement, this.enterClass);\n\n this.once && this.unbindIntersectionObserver();\n\n this.bindAnimationEvents();\n this.animationState = 'enter';\n }\n }\n\n leave() {\n if (this.animationState !== 'leave' && this.leaveClass) {\n this.host.nativeElement.style.opacity = this.enterClass ? '0' : '';\n DomHandler.removeMultipleClasses(this.host.nativeElement, this.enterClass);\n DomHandler.addMultipleClasses(this.host.nativeElement, this.leaveClass);\n\n this.bindAnimationEvents();\n this.animationState = 'leave';\n }\n }\n\n bindAnimationEvents() {\n if (!this.animationEndListener) {\n this.animationEndListener = this.renderer.listen(this.host.nativeElement, 'animationend', () => {\n DomHandler.removeMultipleClasses(this.host.nativeElement, [this.enterClass, this.leaveClass]);\n !this.once && this.resetObserver.observe(this.host.nativeElement);\n this.unbindAnimationEvents();\n });\n }\n }\n\n unbindAnimationEvents() {\n if (this.animationEndListener) {\n this.animationEndListener();\n this.animationEndListener = null;\n }\n }\n\n unbindIntersectionObserver() {\n this.observer?.unobserve(this.host.nativeElement);\n this.resetObserver?.unobserve(this.host.nativeElement);\n this.isObserverActive = false;\n }\n\n ngOnDestroy() {\n this.unbindAnimationEvents();\n this.unbindIntersectionObserver();\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [AnimateOnScroll],\n declarations: [AnimateOnScroll]\n})\nexport class AnimateOnScrollModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;AAUA;;;AAGG;MAOU,eAAe,CAAA;AA0Cc,IAAA,QAAA,CAAA;AAAiD,IAAA,UAAA,CAAA;AAAyB,IAAA,IAAA,CAAA;AAAyB,IAAA,EAAA,CAAA;AAAuB,IAAA,QAAA,CAAA;AAzChK;;;AAGG;AACM,IAAA,UAAU,CAAqB;AACxC;;;AAGG;AACM,IAAA,UAAU,CAAqB;AACxC;;;AAGG;AACM,IAAA,IAAI,CAAiC;AAC9C;;;AAGG;AACM,IAAA,UAAU,CAAqB;AACxC;;;AAGG;AACoC,IAAA,SAAS,CAAqB;AACrE;;;AAGG;IACqC,IAAI,GAAY,IAAI,CAAC;AAE7D,IAAA,QAAQ,CAAmC;AAE3C,IAAA,aAAa,CAAM;IAEnB,gBAAgB,GAAY,KAAK,CAAC;AAElC,IAAA,cAAc,CAAM;AAEpB,IAAA,oBAAoB,CAA2B;IAE/C,WAAsC,CAAA,QAAkB,EAA+B,UAAe,EAAU,IAAgB,EAAS,EAAc,EAAS,QAAmB,EAAA;QAA7I,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;QAA+B,IAAU,CAAA,UAAA,GAAV,UAAU,CAAK;QAAU,IAAI,CAAA,IAAA,GAAJ,IAAI,C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