{"version":3,"file":"ngx-autohide.mjs","sources":["../../../projects/ngx-autohide/src/lib/directives/ngx-autohide.directive.ts","../../../projects/ngx-autohide/src/lib/ngx-autohide.module.ts","../../../projects/ngx-autohide/src/public-api.ts","../../../projects/ngx-autohide/src/ngx-autohide.ts"],"sourcesContent":["import { animate, AnimationBuilder, AnimationMetadata, style } from '@angular/animations';\nimport { Directive, ElementRef, Input, OnInit } from '@angular/core';\n\n@Directive({\n  selector: '[ngxAutohide]'\n})\nexport class NgxAutohideDirective implements OnInit {\n\n  @Input() timings: number = DEFAULT_TIME;\n\n  constructor(\n    private el: ElementRef, \n    private builder: AnimationBuilder\n  ) { }\n\n  ngOnInit(): void {\n    // based on a time to hide the element\n    const factory = this.builder.build(this.fadeOut());\n    const player = factory.create(this.el.nativeElement);\n    player.onDone(() => {\n      // after the animation is done, the element is removed\n      this.el.nativeElement.remove();\n    });\n    player.play();\n  }\n\n  /**\n  * This is the fadeOut function that set the fade out effect for the AnimationBuilder\n  * @returns returns an AnimationMetadata array \n  */\n  private fadeOut(): AnimationMetadata[] {\n    return [\n      style({ opacity: '*' }),\n      animate(this.timings + 'ms ease-in', style({ opacity: 0 })),\n    ];\n  }\n\n}\n\nexport const DEFAULT_TIME: number = 5000;","import { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\n// Directive\nimport { NgxAutohideDirective } from './directives/ngx-autohide.directive';\n\n\n\n@NgModule({\n  declarations: [\n    NgxAutohideDirective\n  ],\n  imports: [\n    FormsModule,\n  ],\n  exports: [\n    NgxAutohideDirective\n  ]\n})\nexport class NgxAutohideModule { }\n","/*\n * Public API Surface of ngx-autohide\n */\n\nexport * from './lib/directives/ngx-autohide.directive';\n\nexport * from './lib/ngx-autohide.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAMa,oBAAoB;IAI/B,YACU,EAAc,EACd,OAAyB;QADzB,OAAE,GAAF,EAAE,CAAY;QACd,YAAO,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