{"version":3,"file":"notify-toaster.mjs","sources":["../../../projects/notify/src/lib/notify.service.ts","../../../projects/notify/src/lib/notify.component.ts","../../../projects/notify/src/lib/notify-alert.component.html","../../../projects/notify/src/lib/notify-container.component.ts","../../../projects/notify/src/lib/notify.module.ts","../../../projects/notify/src/public-api.ts","../../../projects/notify/src/notify-toaster.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Alert } from './notify-alert.interface'\nimport { AlertType } from './notify-alert.type';\nimport { Observable, BehaviorSubject } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class NotifyService {\n  subject: BehaviorSubject<Alert>;\n  toast$: Observable<Alert>;\n\n  constructor() {\n    this.subject = new BehaviorSubject<Alert>(null!);\n    this.toast$ = this.subject.asObservable()\n      .pipe(filter(toast => toast !== null));\n  }\n\n  show(type: AlertType,  body?: string, delay?: number) {\n    this.subject.next({ type, body, delay });\n  }\n}\n","\nimport { Component, Input, Output, EventEmitter } from '@angular/core';\nimport { Alert } from './notify-alert.interface';\n@Component({\n  selector: 'lib-notify',\n  templateUrl: './notify-alert.component.html',\n  styleUrl: './notify-alert.component.css'\n})\nexport class NotifyComponent {\n  @Input()\n  alert!: Alert;\n  @Input()\n  i!: number;\n\n  @Output() remove = new EventEmitter<number>();\n\n\n}\n","<div class=\"alert alert-{{alert.type}}\" \n  [style.bottom.px]=\"i*100\">\n  <span class=\"{{alert.type}}\"></span>\n  <p>{{alert.body}}</p>\n  <a class=\"close\" (click)=\"remove.emit(i)\">&times;</a>\n  </div>","import { Component, Input, OnInit } from '@angular/core';\nimport { NotifyService } from './notify.service';\nimport { Alert } from './notify-alert.interface';\n\n@Component({\n  selector: 'app-notify-container',\n  template: `\n    <lib-notify *ngFor=\"let toast of toasts; let i=index\" \n      [alert]=\"toast\" [i]=\"i\"\n      (remove)=\"remove($event)\"></lib-notify>\n  `,\n  styles: [],\n})\nexport class NoftifyContainerComponent implements OnInit {\n  toasts: Alert[] = [];\n\n  constructor(public service: NotifyService) {}\n\n  ngOnInit() {\n    this.service.toast$.subscribe((toast) => {\n      this.toasts = [toast, ...this.toasts];\n      setTimeout(() => this.toasts.pop(), toast.delay || 6000);\n    });\n  }\n\n  remove(index: number) {\n    this.toasts = this.toasts.filter((v, i) => i !== index);\n    // this.toasts.splice(index, 1);\n  }\n}\n","import { NgModule } from '@angular/core';\nimport { NotifyComponent } from './notify.component';\n\nimport { NoftifyContainerComponent } from './notify-container.component';\nimport { BrowserModule } from '@angular/platform-browser'\n@NgModule({\n  declarations: [\n    NotifyComponent,\n    NoftifyContainerComponent\n  ],\n  imports: [\n    BrowserModule\n  ],\n  exports: [\n    NotifyComponent,\n    NoftifyContainerComponent\n  ]\n})\nexport class NotifyModule { }\n","/*\n * Public API Surface of notify\n */\n\nexport * from './lib/notify.service';\nexport * from './lib/notify.component';\nexport * from './lib/notify.module';\nexport * from './lib/notify-container.component';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.NotifyService","i3.NotifyComponent"],"mappings":";;;;;;;MASa,aAAa,CAAA;AAIxB,IAAA,WAAA,GAAA;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAQ,IAAK,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;AACtC,aAAA,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC;KAC1C;AAED,IAAA,IAAI,CAAC,IAAe,EAAG,IAAa,EAAE,KAAc,EAAA;AAClD,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;KAC1C;8GAZU,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAAb,IAAA,SAAA,IAA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