{"version":3,"file":"deja-js-component-snackbar.mjs","sources":["../../../../projects/deja-js/component/snackbar/snackbar.component.ts","../../../../projects/deja-js/component/snackbar/index.ts","../../../../projects/deja-js/component/snackbar/deja-js-component-snackbar.ts"],"sourcesContent":["/*\n *  @license\n *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.\n *\n *  Use of this source code is governed by an Apache-2.0 license that can be\n *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE\n */\n\nimport { AfterViewInit, Component, ElementRef, EventEmitter, HostListener, Input, OnDestroy, OnInit, Output } from '@angular/core';\nimport { Destroy } from '@deja-js/component/core';\nimport { debounce, delay, Subject, Subscription, take, takeUntil, tap, timer } from 'rxjs';\n\ninterface IAnimation {\n    before: CSSStyleDeclaration;\n    after: CSSStyleDeclaration;\n    delay?: number;\n    duration: number;\n    easing: string;\n}\n\n@Component({\n    selector: 'deja-snackbar',\n    styleUrls: ['./snackbar.component.scss'],\n    template: '<ng-content></ng-content>'\n\n})\nexport class DejaSnackbarComponent extends Destroy implements OnInit, AfterViewInit, OnDestroy {\n\n    /**\n     * all snackbar instances\n     */\n    private static INSTANCES: DejaSnackbarComponent[] = [];\n\n    /**\n * callback used to negate the boolean responsible for the presence of the snackbar on the dom (see demo)\n */\n    // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n    @Output() public readonly onAnimationDone = new EventEmitter();\n\n    /**\n     * inner container\n     */\n    // @ViewChild('container') public host;\n\n    /**\n     * specify delay for the enter animation\n     */\n    @Input() public delay = 0;\n\n    /**\n     * specify lifetime of the snackbar on the screen\n     */\n    @Input() public duration = 0;\n\n    /**\n     * set a container for the snackbar instead of default behavior (viewport)\n     */\n    @Input() public outerContainerElement: HTMLElement;\n\n    /**\n     * inner container element, represent the snackbar since the host has no height width and a position relative to it's html declaration\n     */\n    private host: HTMLElement;\n\n    /**\n     * height of the inner container element\n     */\n    private height: number;\n\n    /**\n     * vertical space between snackbar\n     */\n    private marginTop = 6;\n\n    /**\n     * snackbar creation timestamp, used for calculation, forthe adapt animation\n     */\n    private timestamp: number = +new Date();\n\n    /**\n     * enter animation duration\n     */\n    private enterAnimationDuration = 350;\n\n    /**\n     * leave animation duration\n     */\n    private leaveAnimationDuration = 175;\n\n    /**\n     * adapt animation duration\n     */\n    private adaptAnimationDuration = 225;\n\n    /**\n     * string representation of the alignment, used for statements and initial final position\n     */\n    private anchor: string;\n\n    /**\n     * object representation of the alignment, used to filter incompatible alignments and build the string representation\n     */\n    private _alignments = {} as {\n        [prop: string]: boolean;\n        top: boolean;\n        right: boolean;\n        bottom: boolean;\n        left: boolean;\n    };\n\n    private animate$ = new Subject<IAnimation>();\n    private animate$sub: Subscription;\n\n    /**\n     * _alignments setter\n     */\n    @Input() public set alignment(value: string) {\n        this._alignments = {\n            bottom: false,\n            left: false,\n            right: false,\n            top: false\n        };\n\n        // set _alignments\n        if (value) {\n            value.split(/\\s+/g).forEach((align: string) => this._alignments[align] = true);\n        }\n\n        // filter incompatible alignments\n        this._alignments.bottom = this._alignments.top && this._alignments.bottom ? false : this._alignments.bottom;\n        this._alignments.left = this._alignments.right && this._alignments.left ? false : this._alignments.left;\n    }\n\n    /**\n     * Creates an instance of DejaSnackbarComponent.\n     *\n     * @param elementRef\n     * @param renderer\n     */\n    public constructor(private elementRef: ElementRef<HTMLElement>) {\n        super();\n\n        if (!DejaSnackbarComponent.INSTANCES) {\n            DejaSnackbarComponent.INSTANCES = [];\n        }\n\n        DejaSnackbarComponent.INSTANCES.push(this);\n\n        const applyParams = (styles: CSSStyleDeclaration): void => {\n            Object.keys(styles)\n                .forEach(key => {\n                    // eslint-disable-next-line @typescript-eslint/no-explicit-any,  @typescript-eslint/no-unsafe-assignment,  @typescript-eslint/no-unsafe-member-access\n                    (<any> this.host.style)[key] = (<any>styles)[key];\n                });\n        };\n\n        this.animate$sub = this.animate$.pipe(\n            tap(animation => applyParams(animation.before)),\n            delay(1),\n            tap(animation => {\n                this.host.style.transitionDuration = `${animation.duration}ms`;\n                this.host.style.transitionTimingFunction = animation.easing;\n                this.host.style.transitionProperty = Object.keys(animation.before).join(',');\n            }),\n            debounce(animation => timer(animation.delay || 1)),\n            tap(animation => applyParams(animation.after)),\n            debounce(animation => timer(animation.duration)),\n            takeUntil(this.destroyed$)\n        ).subscribe(() => {\n            this.host.style.transitionDuration = '';\n            this.host.style.transitionTimingFunction = '';\n            this.host.style.transitionProperty = '';\n        });\n    }\n\n    /**\n     * used to recalculate the position of the snackbar on the X axis when resizing / changing from landscape to portrait and vice versa\n     *\n     * @param event\n     */\n    @HostListener('window:resize', [])\n    public onResize(): void {\n        this.setNewWidth();\n    }\n\n    /**\n     * onInit hook\n     */\n    public ngOnInit(): void {\n        // Choose animation depending on alignment\n        const anchors = [] as string[];\n\n        Object.keys(this._alignments).forEach(key => {\n            if (this._alignments[key]) {\n                anchors.push(key);\n            }\n        });\n\n        anchors.sort((x, y) => x > y ? 1 : -1);\n        const anchor = anchors.reduce((acc, curr) => {\n            if (acc === '') {\n                acc += curr;\n            } else {\n                acc += `-${curr}`;\n            }\n            return acc;\n        }, '');\n\n        this.anchor = anchor;\n    }\n\n    /**\n     * afterviewInit hook\n     */\n    public ngAfterViewInit(): void {\n        this.host = this.elementRef.nativeElement;\n\n        if (!this.outerContainerElement) {\n            // Set default outer container if none specified\n            this.outerContainerElement = this.host.ownerDocument.body;\n        } else {\n            // Otherwise, set inner container position to absolute for correct placement of snackbars\n            this.host.classList.add('absolute');\n        }\n\n        this.height = this.host.getBoundingClientRect().height;\n        this.setPosition();\n        this.launchEnterAnimation();\n\n        // if a duration has been been specified, launch the 'leave' animation after snackbar's lifetime flow, then emit amination done\n        timer(this.duration + this.delay).pipe(\n            take(1),\n            tap(() => {\n                if (this.duration) {\n                    this.launchLeaveAnimation();\n                }\n            }),\n            delay(this.leaveAnimationDuration),\n            takeUntil(this.destroyed$)\n        ).subscribe(() => this.onAnimationDone.emit());\n    }\n\n    /**\n     * onDestroy hook\n     */\n    public ngOnDestroy(): void {\n        super.ngOnDestroy();\n\n        // check if snackbars have to move (if they were created after the one deleted)\n        if (DejaSnackbarComponent.INSTANCES.length) {\n            DejaSnackbarComponent.INSTANCES\n                .filter(instance => this.outerContainerElement === instance.outerContainerElement)\n                .filter(instance => this.anchor === instance.anchor)\n                .forEach(instance => {\n                    if (instance.timestamp > this.timestamp) {\n                        instance.launchAdaptAnimation(this.height);\n                    }\n                });\n        }\n        // remove the soon to be destroyed snackbar from the instances array\n        DejaSnackbarComponent.INSTANCES = DejaSnackbarComponent.INSTANCES\n            .filter(instance => this !== instance);\n\n        this.animate$sub.unsubscribe();\n    }\n\n    /**\n     * emit animation done\n     *\n     * @param event\n     */\n    protected animationDone(event: Event): void {\n        this.onAnimationDone.emit(event);\n    }\n\n    protected increaseElevation(): void {\n        const zIndex = window.getComputedStyle(this.host).zIndex;\n        this.host.style.zIndex = (+zIndex + 1).toString();\n    }\n\n    protected decreaseElevation(): void {\n        const zIndex = window.getComputedStyle(this.host).zIndex;\n        this.host.style.zIndex = (+zIndex - 1).toString();\n    }\n\n    /**\n     * compute cumulated height of all snackbars, precedent instance height, width and height of the innerContainer\n     *\n     * @return cumulated height of all snackbars, precedent instance height, width and height of the innerContainer\n     */\n    private computePosition(): { innerContainerWidth: number; innerContainerHeight: number; precedentInstanceHeight: number; computedHeight: number } {\n        // Inner container\n        const innerContainerElementBounds = this.host.getBoundingClientRect();\n        const innerContainerWidth = innerContainerElementBounds.width;\n        const innerContainerHeight = innerContainerElementBounds.height;\n\n        // Instances sharing the same outer container and the same anchor\n        const instancesInSameZone = DejaSnackbarComponent.INSTANCES\n            .filter((instance: DejaSnackbarComponent) => this.outerContainerElement === instance.outerContainerElement)\n            .filter((instance: DejaSnackbarComponent) => this.anchor === instance.anchor)\n            .filter((instance: DejaSnackbarComponent) => this !== instance);\n\n        let precedentInstanceHeight = 0;\n\n        if (instancesInSameZone) {\n            const precedentInstance = instancesInSameZone[instancesInSameZone.length - 1];\n\n            if (precedentInstance) {\n                const innerContainerElement = precedentInstance.elementRef.nativeElement;\n                precedentInstanceHeight = innerContainerElement.getBoundingClientRect().height;\n            }\n        }\n\n        // computed height of inner containers, sharing the same outer container and the same anchor\n        const computedHeight = instancesInSameZone\n            .map((instance: DejaSnackbarComponent) => {\n                const innerContainerElement = instance.elementRef.nativeElement;\n                return innerContainerElement.getBoundingClientRect().height;\n            })\n            .reduce((acc, curr) => {\n                acc += curr + this.marginTop;\n                return acc;\n            }, 0);\n\n        return {\n            innerContainerWidth,\n            innerContainerHeight,\n            precedentInstanceHeight,\n            computedHeight\n        };\n    }\n\n    /**\n     * set the final position of the snackbar\n     */\n    private setPosition(): void {\n\n        const { innerContainerWidth, innerContainerHeight, computedHeight } = this.computePosition();\n\n        if (this.anchor === 'left') {\n            this.host.style.left = `${2}%`;\n            this.host.style.bottom = `calc(${33}% + ${computedHeight}px)`;\n        }\n        if (this.anchor === 'right') {\n            this.host.style.left = `calc(${98}% - ${innerContainerWidth}px)`;\n            this.host.style.bottom = `calc(${33}% + ${computedHeight}px)`;\n        }\n        if (this.anchor === 'top') {\n            this.host.style.left = `calc(${50}% - ${innerContainerWidth / 2}px )`;\n            this.host.style.bottom = `calc(${92}% - ${innerContainerHeight}px)`;\n        }\n        if (this.anchor === 'bottom') {\n            this.host.style.left = `calc(${50}% - ${innerContainerWidth / 2}px )`;\n            this.host.style.bottom = `calc(${2}% + ${computedHeight}px)`;\n        }\n\n        if (this.anchor === 'bottom-left') {\n            this.host.style.left = `${2}%`;\n            this.host.style.bottom = `calc(${2}% + ${computedHeight}px)`;\n        }\n        if (this.anchor === 'bottom-right') {\n            this.host.style.left = `calc(${98}% - ${innerContainerWidth}px)`;\n            this.host.style.bottom = `calc(${2}% + ${computedHeight}px)`;\n        }\n        if (this.anchor === 'left-top') {\n            this.host.style.left = `${2}%`;\n            this.host.style.bottom = `calc(${92}% - ${innerContainerHeight}px - ${computedHeight}px)`;\n        }\n        if (this.anchor === 'right-top') {\n            this.host.style.left = `calc(${98}% - ${innerContainerWidth}px)`;\n            this.host.style.bottom = `calc(${92}% - ${innerContainerHeight}px - ${computedHeight}px)`;\n        }\n\n    }\n\n    /**\n     * recalculate X position for the snackbar (see @HostListener)\n     */\n    private setNewWidth(): void {\n        const { innerContainerWidth } = this.computePosition();\n\n        if (this.anchor === 'top' || this.anchor === 'bottom') {\n            this.elementRef.nativeElement.style.left = `calc(${50}% - ${innerContainerWidth / 2}px )`;\n        }\n    }\n\n    /**\n     * launch adapt animation (snackbar disposal trigger this method)\n     * important note:\n     * matrix retrieval is used instead of translate Y because using translateY in enter and adapt animation seems\n     * to cause unexpected behavior (understand bug)\n     * there is also a known bug, if you close a snackbar which share anchor and container with an other one created at the same moment\n     * adaptation of the position will not be performed correctly, see demo for more information about how to avoid this behavior\n     *\n     * @param height\n     */\n    private launchAdaptAnimation(height: number): void {\n\n        let direction = 1;\n        if (this._alignments.top) {\n            direction = -1;\n        }\n\n        const transform = window.getComputedStyle(this.host).transform;\n        const sixth = parseFloat(transform\n            .split(',')\n            .slice(-1)\n            .pop());\n\n        this.animate$.next({\n            before: {\n                transform: `${transform}`\n            },\n            after: {\n                transform: `matrix(1,0,0,1,0,${sixth + ((height + this.marginTop) * direction)})`\n            },\n            duration: this.adaptAnimationDuration,\n            easing: 'ease'\n        } as IAnimation);\n    }\n\n    /**\n     * launch enter animation (snackbar instanciation trigger this method)\n     */\n    private launchEnterAnimation(): void {\n        let direction = -1;\n        if (this._alignments.top) {\n            direction = 1;\n        }\n\n        this.animate$.next({\n            before: {\n                opacity: '0',\n                transform: `translateY(${direction * 200}%)`\n            },\n            after: {\n                opacity: '1',\n                transform: 'translateY(0)'\n            },\n            delay: this.delay,\n            duration: this.enterAnimationDuration,\n            easing: 'ease'\n        } as IAnimation);\n    }\n\n    /**\n     * launch leave animation (snackbar lifetime flow trigger this animation)\n     */\n    private launchLeaveAnimation(): void {\n        this.animate$.next({\n            before: {\n                opacity: '1'\n            },\n            after: {\n                opacity: '0'\n            },\n            duration: this.leaveAnimationDuration,\n            easing: 'ease'\n        } as IAnimation);\n    }\n}\n","/*\n *  @license\n *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.\n *\n *  Use of this source code is governed by an Apache-2.0 license that can be\n *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE\n */\n\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { DejaSnackbarComponent } from './snackbar.component';\n\n@NgModule({\n    declarations: [DejaSnackbarComponent],\n    exports: [DejaSnackbarComponent],\n    imports: [\n        CommonModule\n    ]\n})\nexport class DejaSnackbarModule { }\n\nexport * from './snackbar.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;AAoBG,MAAO,qBAAsB,SAAQ,OAAO,CAAA;AA4G9C;;;;;AAKG;AACH,IAAA,WAAA,CAA2B,UAAmC,EAAA;AAC1D,QAAA,KAAK,EAAE,CAAC;QADe,IAAU,CAAA,UAAA,GAAV,UAAU,CAAyB;AA3G9D;;AAED;;AAE2B,QAAA,IAAA,CAAA,eAAe,GAAG,IAAI,YAAY,EAAE,CAAC;AAE/D;;AAEG;;AAGH;;AAEG;QACa,IAAK,CAAA,KAAA,GAAG,CAAC,CAAC;AAE1B;;AAEG;QACa,IAAQ,CAAA,QAAA,GAAG,CAAC,CAAC;AAiB7B;;AAEG;QACK,IAAS,CAAA,SAAA,GAAG,CAAC,CAAC;AAEtB;;AAEG;AACK,QAAA,IAAA,CAAA,SAAS,GAAW,CAAC,IAAI,IAAI,EAAE,CAAC;AAExC;;AAEG;QACK,IAAsB,CAAA,sBAAA,GAAG,GAAG,CAAC;AAErC;;AAEG;QACK,IAAsB,CAAA,sBAAA,GAAG,GAAG,CAAC;AAErC;;AAEG;QACK,IAAsB,CAAA,sBAAA,GAAG,GAAG,CAAC;AAOrC;;AAEG;QACK,IAAW,CAAA,WAAA,GAAG,EAMrB,CAAC;AAEM,QAAA,I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