{"version":3,"file":"bravobit-bb-foundation-notifications.mjs","sources":["../../../projects/bb-foundation/notifications/src/lib/notifications.interfaces.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-item/notifications-item.component.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-item/notifications-item.component.html","../../../projects/bb-foundation/notifications/src/lib/notifications-list/notifications-list.component.ts","../../../projects/bb-foundation/notifications/src/lib/notifications-list/notifications-list.component.html","../../../projects/bb-foundation/notifications/src/lib/notifications.service.ts","../../../projects/bb-foundation/notifications/src/lib/notifications.config.ts","../../../projects/bb-foundation/notifications/src/lib/notifications.module.ts","../../../projects/bb-foundation/notifications/src/bravobit-bb-foundation-notifications.ts"],"sourcesContent":["import {InjectionToken, TemplateRef} from '@angular/core';\nimport {Observable} from 'rxjs';\n\nexport interface Notification {\n    content: string | TemplateRef<any>;\n    type: NotificationType;\n\n    id?: number;\n\n    timeout?: number;\n    localize?: boolean;\n    dismiss?: boolean;\n    dismissText?: string;\n    actions?: NotificationAction[];\n\n    color?: string;\n    backgroundColor?: string;\n\n    destroy?: () => void;\n}\n\nexport interface NotificationAction {\n    title: string;\n    callback?: () => any;\n    type?: 'default' | 'cancel';\n}\n\nexport enum NotificationType {\n    Success = 'success',\n    Error = 'error',\n    Warning = 'warning',\n    Info = 'info',\n    Custom = 'custom'\n}\n\nexport class NotificationsConfig {\n    mode?: 'append' | 'prepend';\n    timeout?: number;\n    dismiss?: boolean;\n    localize?: boolean;\n    dismissText?: string;\n}\n\nexport const NOTIFICATIONS_DATA: InjectionToken<Observable<Notification[]>> = new InjectionToken('notifications data');\n\nexport const NOTIFICATIONS_CONFIG: InjectionToken<NotificationsConfig> = new InjectionToken('notifications config');\n","import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostBinding, inject, Input, NgZone, OnDestroy, OnInit, ViewChild, ViewEncapsulation} from '@angular/core';\nimport {Notification, NotificationAction, NotificationsConfig} from '../notifications.interfaces';\nimport {BbLocalize} from '@bravobit/bb-foundation/localize';\nimport {BbTemplate} from '@bravobit/bb-foundation/utils';\nimport {Platform} from '@angular/cdk/platform';\nimport {WINDOW} from '@bravobit/bb-foundation';\n\n@Component({\n    selector: 'bb-notifications-item',\n    templateUrl: './notifications-item.component.html',\n    styleUrls: ['./notifications-item.component.scss'],\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    encapsulation: ViewEncapsulation.None,\n    host: {'role': 'alert'},\n    imports: [BbLocalize, BbTemplate]\n})\nexport class BbNotificationsItem implements OnInit, OnDestroy {\n\n    // Dependencies.\n    private readonly _zone: NgZone = inject(NgZone);\n    private readonly _platform: Platform = inject(Platform);\n    private readonly _changeDetection: ChangeDetectorRef = inject(ChangeDetectorRef);\n\n    // Dependencies.\n    private readonly _config?: NotificationsConfig = inject(NotificationsConfig, {optional: true});\n    private readonly _window?: Window = inject(WINDOW, {optional: true});\n\n    // Readonly data.\n    readonly dismissText: string = this._config?.dismissText ?? null;\n\n    // Inputs.\n    @Input() notification: Notification | null = null;\n\n    // Elements.\n    @ViewChild('progress', {static: false}) progressElementRef: ElementRef<SVGCircleElement>;\n\n    // Data.\n    private _progress: number = 0;\n    private _count: number = 0;\n\n    // Helper variables.\n    private _steps: number;\n    private _speed: number;\n    private _timer: number;\n    private _startTime: number;\n    private _difference: number;\n\n    // Data.\n    private readonly _radius = 19;\n    private readonly _circumference = this._radius * 2 * Math.PI;\n\n    @HostBinding('class')\n    get getClass() {\n        return `bb-notifications-item ${this.notification.type}`;\n    }\n\n    get progressStrokeArray() {\n        const value = Math.floor(this._circumference);\n        return `${value}, ${value}`;\n    }\n\n    get progressStrokeOffset() {\n        return Math.floor(this._circumference - this._progress / 100 * this._circumference);\n    }\n\n    ngOnInit() {\n        // Check if the notification timeout is not 0 and the platform is a browser.\n        if (this.notification.timeout <= 0 || !this._platform.isBrowser) {\n            this.notification.dismiss = true;\n            return;\n        }\n\n        // Start the timeout.\n        this.startTimeout();\n    }\n\n    ngOnDestroy() {\n        this._timer && this._window?.clearTimeout?.(this._timer);\n    }\n\n    callActionAndDestroy(notification: Notification, action: NotificationAction) {\n        action?.callback?.();\n        notification?.destroy?.();\n    }\n\n    private startTimeout() {\n        this._steps = this.notification.timeout / 10;\n        this._speed = this.notification.timeout / this._steps;\n        this._startTime = Date.now();\n        this._zone.runOutsideAngular(() => this._timer = this.setTimeout(this.instance, this._speed));\n    }\n\n    private instance = () => {\n        this._difference = (Date.now() - this._startTime) - (this._count * this._speed);\n\n        if (this._count++ === this._steps) {\n            this.notification.destroy();\n        }\n\n        this._progress += 100 / this._steps;\n        this._timer = this.setTimeout(this.instance, this._speed - this._difference);\n        this._zone.run(() => this._changeDetection.detectChanges());\n    };\n\n    private setTimeout(method: () => void, timeout: number) {\n        if (!this._window || !this._window.setTimeout) {\n            return null;\n        }\n\n        return this._window.setTimeout(method, timeout);\n    }\n\n}\n","<div class=\"notification-content-wrapper\">\n    <div [style.color]=\"notification?.color\"\n         [style.background-color]=\"notification?.backgroundColor\"\n         class=\"notification-icon-wrapper\">\n        <svg xmlns=\"http://www.w3.org/2000/svg\"\n             viewBox=\"0 0 16 20\"\n             class=\"notification-icon\">\n            <path\n                d=\"M8 20c1.1 0 2-.923 2-2.051H6C6 19.077 6.9 20 8 20Zm6-6.154V8.718c0-3.18-1.6-5.744-4.5-6.462v-.718C9.5.718 8.8 0 8 0S6.5.718 6.5 1.538v.718C3.6 2.974 2 5.538 2 8.718v5.128l-2 2.051v1.026h16v-1.026l-2-2.05Z\">\n            </path>\n        </svg>\n\n        @if (notification?.timeout > 0) {\n            <svg class=\"notification-progress-ring\"\n                 viewBox=\"0 0 40 40\"\n                 role=\"progressbar\">\n                <circle #progress\n                        [attr.stroke-dasharray]=\"progressStrokeArray\"\n                        [attr.stroke-dashoffset]=\"progressStrokeOffset\"\n                        [style.stroke]=\"notification?.color\"\n                        class=\"notification-progress-circle\"\n                        stroke-width=\"2\"\n                        fill=\"transparent\"\n                        r=\"19\"\n                        cx=\"20\"\n                        cy=\"20\">\n                </circle>\n            </svg>\n        }\n    </div>\n\n    <div class=\"notification-content\">\n        <ng-template [bbTemplate]=\"notification?.content\">\n            @if (notification?.localize) {\n                {{ $any(notification?.content) | bbLocalize }}\n            } @else {\n                {{ notification?.content }}\n            }\n        </ng-template>\n    </div>\n</div>\n\n@if (notification?.actions?.length > 0 || notification?.dismiss) {\n    <div class=\"notification-actions\">\n        @for (action of notification?.actions; track $index) {\n            <button [class.destructive]=\"action?.type === 'cancel'\"\n                    (click)=\"callActionAndDestroy(notification, action)\"\n                    type=\"button\"\n                    class=\"notification-actions-button\">\n                <span class=\"notification-actions-button-highlight\">\n                    @if (notification?.localize) {\n                        {{ action?.title | bbLocalize }}\n                    } @else {\n                        {{ action?.title }}\n                    }\n                </span>\n            </button>\n        }\n        @if (notification?.dismiss) {\n            <button (click)=\"notification?.destroy()\"\n                    class=\"notification-actions-button destructive\"\n                    type=\"button\">\n                <span\n                    class=\"notification-actions-button-highlight\">{{ notification?.dismissText ?? dismissText }}</span>\n            </button>\n        }\n    </div>\n}\n","import {ChangeDetectionStrategy, Component, inject, OnInit, ViewEncapsulation} from '@angular/core';\nimport {BbNotificationsItem} from '../notifications-item/notifications-item.component';\nimport {Notification, NOTIFICATIONS_DATA} from '../notifications.interfaces';\nimport {AsyncPipe} from '@angular/common';\nimport {map} from 'rxjs/operators';\nimport {Observable} from 'rxjs';\n\n@Component({\n    selector: 'bb-notifications-list',\n    templateUrl: './notifications-list.component.html',\n    styleUrls: ['./notifications-list.component.scss'],\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    encapsulation: ViewEncapsulation.None,\n    host: {\n        'class': 'bb-notifications-list',\n        'role': 'list'\n    },\n    imports: [AsyncPipe, BbNotificationsItem]\n})\nexport class BbNotificationsList implements OnInit {\n\n    // Dependencies.\n    private readonly _data$: Observable<Notification[]> = inject(NOTIFICATIONS_DATA);\n\n    // Data.\n    data$: Observable<{\n        notification?: Notification,\n        styles?: { offset?: number, scale?: string }\n    }[]>;\n\n    ngOnInit() {\n        this.setData();\n    }\n\n    private setData() {\n        this.data$ = this._data$.pipe(\n            map(notifications => {\n                return notifications.map((notification, index) => {\n                    const scale = Math.max(0.9, 1 - (index * 0.02));\n                    return {\n                        notification,\n                        styles: {\n                            offset: Math.min(index, 5),\n                            scale: `scale(${scale})`\n                        }\n                    };\n                });\n            })\n        );\n    }\n\n}\n","@if (data$ | async; as data) {\n    <div class=\"notifications-list-wrapper\">\n        @for (item of data; track item?.notification?.id) {\n            <bb-notifications-item [notification]=\"item?.notification\"\n                                   [style.z-index]=\"item?.notification?.id\"\n                                   [style.margin-top.rem]=\"item?.styles?.offset\"\n                                   [style.transform]=\"item?.styles?.scale\"\n                                   animate.leave=\"leaving\">\n            </bb-notifications-item>\n        }\n    </div>\n}\n","import {ApplicationRef, ComponentRef, createComponent, createEnvironmentInjector, EnvironmentInjector, inject, Injectable, TemplateRef, DOCUMENT} from '@angular/core';\nimport {Notification, NotificationAction, NOTIFICATIONS_CONFIG, NOTIFICATIONS_DATA, NotificationsConfig, NotificationType} from './notifications.interfaces';\nimport {BbNotificationsList} from './notifications-list/notifications-list.component';\nimport {Localize} from '@bravobit/bb-foundation/localize';\nimport {Platform} from '@angular/cdk/platform';\nimport {BehaviorSubject} from 'rxjs';\n\nlet nextUniqueId = 0;\n\n@Injectable({\n    providedIn: 'root'\n})\nexport class Notifications {\n\n    // Dependencies.\n    private _platform: Platform = inject(Platform);\n    private _applicationRef: ApplicationRef = inject(ApplicationRef);\n    private _environmentInjector: EnvironmentInjector = inject(EnvironmentInjector);\n    private _localize?: Localize = inject(Localize, {optional: true});\n    private _config?: NotificationsConfig = inject(NOTIFICATIONS_CONFIG, {optional: true});\n    private _document?: Document = inject(DOCUMENT, {optional: true});\n\n    // Reference to the list.\n    private _componentRef: ComponentRef<BbNotificationsList>;\n\n    // The default settings for the notifications.\n    private readonly _defaultMode: 'prepend' | 'append' = this._config?.mode ?? 'prepend';\n    private readonly _defaultTimeout: number = this._config?.timeout ?? 8_000;\n    private readonly _defaultLocalize: boolean = this._config?.localize ?? false;\n    private readonly _defaultDismiss: boolean = this._config?.dismiss ?? true;\n    private readonly _defaultDismissText: string = this._config?.dismissText ?? 'Dismiss';\n\n    // The data containing the notifications.\n    private _notifications$ = new BehaviorSubject<Notification[]>([]);\n\n    constructor() {\n        this.createElement();\n    }\n\n    success(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n        return this.create({content, timeout, actions, type: NotificationType.Success});\n    }\n\n    error(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n        return this.create({content, timeout, actions, type: NotificationType.Error});\n    }\n\n    warn(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n        return this.create({content, timeout, actions, type: NotificationType.Warning});\n    }\n\n    info(content: string | TemplateRef<any>, actions: NotificationAction[] = [], timeout = this._defaultTimeout) {\n        return this.create({content, timeout, actions, type: NotificationType.Info});\n    }\n\n    create(notification: Notification) {\n        const item = this.compose(notification);\n        item.destroy = () => this.pull(item);\n        return this.push(item);\n    }\n\n    private push(notification: Notification) {\n        // Get the current list.\n        const oldList = this._notifications$.getValue();\n\n        // Check which mode is activated.\n        let newList: Notification[];\n        switch (this._defaultMode) {\n            case 'append':\n                newList = [...oldList, notification];\n                break;\n            case 'prepend':\n            default:\n                newList = [notification, ...oldList];\n        }\n\n        // Push the new notifications.\n        this._notifications$.next(newList);\n\n        // Return the notification for further use.\n        return notification;\n    }\n\n    private pull(notification: Notification) {\n        // Get the current list.\n        const newList = this._notifications$\n            .getValue()\n            .filter(item => item?.id !== notification?.id);\n\n        // Push a new list.\n        this._notifications$.next(newList);\n    }\n\n    private compose(notification: Notification) {\n        // Attach a random id to the notification.\n        notification.id = ++nextUniqueId % 99999;\n\n        // Set all properties.\n        notification.type = notification?.type ?? NotificationType.Custom;\n        notification.content = notification?.content ?? null;\n        notification.timeout = notification?.timeout ?? this._defaultTimeout;\n        notification.localize = notification?.localize ?? this._defaultLocalize;\n        notification.dismiss = notification?.dismiss ?? this._defaultDismiss;\n\n        // Dismiss text localization.\n        const dismissText = notification.dismissText ?? this._defaultDismissText;\n        notification.dismissText = this._defaultLocalize && this._localize\n            ? this._localize.translate(dismissText)\n            : dismissText;\n\n        // Return the composed notification.\n        return notification;\n    }\n\n    private createElement() {\n        const environmentInjector = createEnvironmentInjector([\n            {provide: NOTIFICATIONS_DATA, useValue: this._notifications$}\n        ], this._environmentInjector);\n\n        this._componentRef = createComponent(BbNotificationsList, {environmentInjector});\n        this._applicationRef.attachView(this._componentRef.hostView);\n\n        if (!this._platform.isBrowser) {\n            return;\n        }\n\n        try {\n            this._document.body.appendChild(this._componentRef?.location?.nativeElement);\n        } catch {\n            // Don't do anything, because it must've failed.\n        }\n    }\n\n}\n","import {NOTIFICATIONS_CONFIG, NotificationsConfig} from './notifications.interfaces';\nimport {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';\n\nexport function provideNotificationsConfig(config: NotificationsConfig): EnvironmentProviders {\n    return makeEnvironmentProviders([\n        {provide: NOTIFICATIONS_CONFIG, useValue: config ?? {}}\n    ]);\n}\n","import {provideNotificationsConfig} from './notifications.config';\nimport {NotificationsConfig} from './notifications.interfaces';\nimport {ModuleWithProviders, NgModule} from '@angular/core';\n\n@NgModule()\nexport class NotificationsModule {\n\n    static forRoot(config?: NotificationsConfig): ModuleWithProviders<NotificationsModule> {\n        return {\n            ngModule: NotificationsModule,\n            providers: [\n                provideNotificationsConfig(config)\n            ]\n        };\n    }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;IA2BY;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AACxB,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,gBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,gBAAA,CAAA,M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