{"version":3,"sources":["../src/icons/close.svg","../src/icons/error.svg","../src/icons/info.svg","../src/icons/success.svg","../src/icons/warning.svg","../src/utils.ts","../src/consts.ts","../src/effects.ts","../src/index.ts"],"names":["close_default","error_default","info_default","success_default","warning_default","stringToHTML","__name","strHTML","getSvgNode","svg","doc","CLASSNAMES","NOTIFY_STATUS_ENUMS","NOTIFY_TYPE_ENUMS","NOTIFY_ANIMATION_ENUMS","ICONS","fadeIn","self","fadeOut","slideIn","slideOut","_Notify","args","callback","notificationsGap","notificationsPadding","status","effect","type","title","text","showIcon","customIcon","customClass","speed","showCloseButton","autoclose","autotimeout","position","customWrapper","container","closeWrapper","className","contentWrapper","titleElement","textElement","computedIcon","iconWrapper","observer","entries","Notify"],"mappings":"qFAAA,IAAAA,EAAA;AAAA;AAAA;ECAA,IAAAC,EAAA;AAAA;AAAA;ECAA,IAAAC,EAAA;AAAA;AAAA;ECAA,IAAAC,EAAA;AAAA;AAAA;ECAA,IAAAC,EAAA;AAAA;AAAA;ECAO,IAAMC,EAAeC,EAACC,GACZ,IAAI,UAAU,EAEd,gBAAgBA,EADnB,WACmC,EAEpC,KAAK,WAAW,CAAC,EALF,gBAQfC,EAAaF,EAACG,GAAgB,CACzC,IAAMC,EAAM,IAAI,UAAU,EAAE,gBAAgBD,EAAK,iBAAiB,EAElE,OADa,SAAS,WAAWC,EAAI,gBAAiB,EAAI,EAC9C,SACd,EAJ0B,cCDnB,IAAMC,EAAa,CACxB,UAAW,6BACX,OAAQ,YACR,eAAgB,oBAChB,YAAa,iBACb,aAAc,kBACd,aAAc,kBACd,YAAa,iBACb,YAAa,iBACb,YAAa,iBACb,UAAW,eACX,QAAS,aACT,SAAU,cACV,OAAQ,YACR,UAAW,eACX,eAAgB,oBAChB,cAAe,mBACf,aAAc,kBACd,eAAgB,oBAChB,eAAgB,oBAChB,YAAa,iBACb,YAAa,iBACb,eAAgB,oBAChB,aAAc,kBACd,gBAAiB,qBACjB,iBAAkB,qBACpB,EAEaC,EAA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\n","\n \n\n","export const stringToHTML = (strHTML: string): HTMLElement => {\n const parser = new DOMParser(),\n content = 'text/html',\n DOM = parser.parseFromString(strHTML, content)\n\n return DOM.body.childNodes[0] as HTMLElement\n}\n\nexport const getSvgNode = (svg: string) => {\n const doc = new DOMParser().parseFromString(svg, 'application/xml')\n const node = document.importNode(doc.documentElement, true)\n return node.outerHTML\n}\n","import SvgClose from './icons/close.svg'\nimport SvgError from './icons/error.svg'\nimport SvgInfo from './icons/info.svg'\nimport SvgSuccess from './icons/success.svg'\nimport SvgWarning from './icons/warning.svg'\nimport { getSvgNode } from './utils'\n\nexport const CLASSNAMES = {\n CONTAINER: 'sn-notifications-container',\n NOTIFY: 'sn-notify',\n NOTIFY_CONTENT: 'sn-notify-content',\n NOTIFY_ICON: 'sn-notify-icon',\n NOTIFY_CLOSE: 'sn-notify-close',\n NOTIFY_TITLE: 'sn-notify-title',\n NOTIFY_TEXT: 'sn-notify-text',\n IS_X_CENTER: 'sn-is-x-center',\n IS_Y_CENTER: 'sn-is-y-center',\n IS_CENTER: 'sn-is-center',\n IS_LEFT: 'sn-is-left',\n IS_RIGHT: 'sn-is-right',\n IS_TOP: 'sn-is-top',\n IS_BOTTOM: 'sn-is-bottom',\n NOTIFY_OUTLINE: 'sn-notify-outline',\n NOTIFY_FILLED: 'sn-notify-filled',\n NOTIFY_ERROR: 'sn-notify-error',\n NOTIFY_WARNING: 'sn-notify-warning',\n NOTIFY_SUCCESS: 'sn-notify-success',\n NOTIFY_INFO: 'sn-notify-info',\n NOTIFY_FADE: 'sn-notify-fade',\n NOTIFY_FADE_IN: 'sn-notify-fade-in',\n NOTIFY_SLIDE: 'sn-notify-slide',\n NOTIFY_SLIDE_IN: 'sn-notify-slide-in',\n NOTIFY_AUTOCLOSE: 'sn-notify-autoclose'\n} as const\n\nexport const NOTIFY_STATUS_ENUMS = {\n ERROR: 'error',\n WARNING: 'warning',\n SUCCESS: 'success',\n INFO: 'info'\n} as const\n\nexport const NOTIFY_TYPE_ENUMS = {\n OUTLINE: 'outline',\n FILLED: 'filled'\n} as const\n\nexport const NOTIFY_ANIMATION_ENUMS = {\n FADE: 'fade',\n SLIDE: 'slide'\n} as const\n\nexport const ICONS = {\n CLOSE: getSvgNode(SvgClose),\n SUCCESS: getSvgNode(SvgSuccess),\n ERROR: getSvgNode(SvgError),\n WARNING: getSvgNode(SvgWarning),\n INFO: getSvgNode(SvgInfo)\n}\n","import { CLASSNAMES } from './consts'\nimport type Notify from './index'\n\nexport const fadeIn = (self: Notify): void => {\n self.wrapper.classList.add(CLASSNAMES.NOTIFY_FADE)\n setTimeout(() => {\n self.wrapper.classList.add(CLASSNAMES.NOTIFY_FADE_IN)\n }, 100)\n}\n\nexport const fadeOut = (self: Notify): void => {\n self.wrapper.classList.remove(CLASSNAMES.NOTIFY_FADE_IN)\n setTimeout(() => {\n self.wrapper.remove()\n }, self.speed)\n}\n\nexport const slideIn = (self: Notify): void => {\n self.wrapper.classList.add(CLASSNAMES.NOTIFY_SLIDE)\n setTimeout(() => {\n self.wrapper.classList.add(CLASSNAMES.NOTIFY_SLIDE_IN)\n }, 100)\n}\nexport const slideOut = (self: Notify): void => {\n self.wrapper.classList.remove(CLASSNAMES.NOTIFY_SLIDE_IN)\n setTimeout(() => {\n self.wrapper.remove()\n }, self.speed)\n}\n","import { CLASSNAMES, ICONS, NOTIFY_ANIMATION_ENUMS, NOTIFY_STATUS_ENUMS, NOTIFY_TYPE_ENUMS } from './consts'\nimport { fadeIn, fadeOut, slideIn, slideOut } from './effects'\nimport './style.css'\nimport type { IArgs, NotifyEffect, NotifyPosition, NotifyStatus, NotifyType } from './types'\nimport { stringToHTML } from './utils'\n\nexport default class Notify {\n wrapper: HTMLElement\n customWrapper: string\n container: HTMLElement\n status: NotifyStatus\n type: NotifyType\n effect: NotifyEffect\n position: NotifyPosition\n title: string\n text: string\n showIcon: boolean\n customIcon: string\n showCloseButton: boolean\n customClass: string\n speed: number\n autoclose: boolean\n autotimeout: number\n notificationsGap: number\n notificationsPadding: number\n selectedNotifyInEffect: (self: Notify) => void\n selectedNotifyOutEffect: (self: Notify) => void\n\n constructor(args: IArgs) {\n const {\n notificationsGap = 20,\n notificationsPadding = 20,\n status = 'success',\n effect = NOTIFY_ANIMATION_ENUMS.FADE,\n type = 'outline',\n title,\n text,\n showIcon = true,\n customIcon = '',\n customClass = '',\n speed = 500,\n showCloseButton = true,\n autoclose = true,\n autotimeout = 3000,\n position = 'right top',\n customWrapper = ''\n } = args\n\n this.customWrapper = customWrapper\n this.status = status\n this.title = title\n this.text = text\n this.showIcon = showIcon\n this.customIcon = customIcon\n this.customClass = customClass\n this.speed = speed\n this.effect = effect\n this.showCloseButton = showCloseButton\n this.autoclose = autoclose\n this.autotimeout = autotimeout\n this.notificationsGap = notificationsGap\n this.notificationsPadding = notificationsPadding\n this.type = type\n this.position = position\n\n if (!this.checkRequirements()) {\n console.error(\"You must specify 'title' or 'text' at least.\")\n return\n }\n\n // set outer container for all Notify's\n this.setContainer()\n\n // set wrapper for each Notify\n this.setWrapper()\n\n this.setPosition()\n\n // set icon in the left\n if (this.showIcon) this.setIcon()\n\n // set close button\n if (this.showCloseButton) this.setCloseButton()\n\n // set title, text\n this.setContent()\n\n // add the Notify to our container\n this.container.prepend(this.wrapper)\n\n // init effect\n this.setEffect()\n this.notifyIn(this.selectedNotifyInEffect)\n\n // init autoclose\n if (this.autoclose) this.autoClose()\n\n // check whether Notify is visible\n this.setObserver()\n }\n\n private checkRequirements(): boolean {\n return !!(this.title || this.text)\n }\n\n private setContainer(): void {\n const container: HTMLElement = document.querySelector(`.${CLASSNAMES.CONTAINER}`)\n if (container) {\n this.container = container\n } else {\n this.container = document.createElement('div')\n this.container.classList.add(CLASSNAMES.CONTAINER)\n document.body.appendChild(this.container)\n }\n\n if (this.notificationsPadding) {\n this.container.style.setProperty('--sn-notifications-padding', `${this.notificationsPadding}px`)\n }\n\n if (this.notificationsGap) {\n this.container.style.setProperty('--sn-notifications-gap', `${this.notificationsGap}px`)\n }\n }\n\n private setPosition(): void {\n this.container.classList[this.position === 'center' ? 'add' : 'remove'](CLASSNAMES.IS_CENTER)\n this.container.classList[this.position.includes('left') ? 'add' : 'remove'](CLASSNAMES.IS_LEFT)\n this.container.classList[this.position.includes('right') ? 'add' : 'remove'](CLASSNAMES.IS_RIGHT)\n this.container.classList[this.position.includes('top') ? 'add' : 'remove'](CLASSNAMES.IS_TOP)\n this.container.classList[this.position.includes('bottom') ? 'add' : 'remove'](CLASSNAMES.IS_BOTTOM)\n this.container.classList[this.position.includes('x-center') ? 'add' : 'remove'](CLASSNAMES.IS_X_CENTER)\n this.container.classList[this.position.includes('y-center') ? 'add' : 'remove'](CLASSNAMES.IS_Y_CENTER)\n }\n\n private setCloseButton(): void {\n const closeWrapper = document.createElement('div')\n closeWrapper.classList.add(CLASSNAMES.NOTIFY_CLOSE)\n closeWrapper.innerHTML = ICONS.CLOSE\n this.wrapper.appendChild(closeWrapper)\n\n closeWrapper.addEventListener('click', () => {\n this.close()\n })\n }\n\n private setWrapper(): void {\n if (this.customWrapper) {\n this.wrapper = stringToHTML(this.customWrapper)\n } else {\n this.wrapper = document.createElement('div')\n }\n this.wrapper.style.setProperty('--sn-notify-transition-duration', `${this.speed}ms`)\n\n // set classes\n this.wrapper.classList.add(CLASSNAMES.NOTIFY)\n\n switch (this.type) {\n case NOTIFY_TYPE_ENUMS.OUTLINE:\n this.wrapper.classList.add(CLASSNAMES.NOTIFY_OUTLINE)\n break\n case NOTIFY_TYPE_ENUMS.FILLED:\n this.wrapper.classList.add(CLASSNAMES.NOTIFY_FILLED)\n break\n default:\n this.wrapper.classList.add(CLASSNAMES.NOTIFY_OUTLINE)\n }\n\n switch (this.status) {\n case NOTIFY_STATUS_ENUMS.SUCCESS:\n this.wrapper.classList.add(CLASSNAMES.NOTIFY_SUCCESS)\n break\n case NOTIFY_STATUS_ENUMS.ERROR:\n this.wrapper.classList.add(CLASSNAMES.NOTIFY_ERROR)\n break\n case NOTIFY_STATUS_ENUMS.WARNING:\n this.wrapper.classList.add(CLASSNAMES.NOTIFY_WARNING)\n break\n case NOTIFY_STATUS_ENUMS.INFO:\n this.wrapper.classList.add(CLASSNAMES.NOTIFY_INFO)\n break\n }\n\n if (this.autoclose) {\n this.wrapper.classList.add(CLASSNAMES.NOTIFY_AUTOCLOSE)\n this.wrapper.style.setProperty('--sn-notify-autoclose-timeout', `${this.autotimeout + this.speed}ms`)\n }\n\n if (this.customClass) {\n const classes = this.customClass.split(' ')\n classes.forEach((className) => {\n this.wrapper.classList.add(className)\n })\n }\n }\n\n private setContent(): void {\n const contentWrapper = document.createElement('div')\n contentWrapper.classList.add(CLASSNAMES.NOTIFY_CONTENT)\n\n let titleElement, textElement\n\n if (this.title) {\n titleElement = document.createElement('div')\n titleElement.classList.add(CLASSNAMES.NOTIFY_TITLE)\n titleElement.textContent = this.title.trim()\n if (!this.showCloseButton) titleElement.style.paddingRight = '0'\n }\n\n if (this.text) {\n textElement = document.createElement('div')\n textElement.classList.add(CLASSNAMES.NOTIFY_TEXT)\n textElement.innerHTML = this.text.trim()\n if (!this.title) textElement.style.marginTop = '0'\n }\n\n this.wrapper.appendChild(contentWrapper)\n if (this.title) contentWrapper.appendChild(titleElement)\n if (this.text) contentWrapper.appendChild(textElement)\n }\n\n private setIcon(): void {\n const computedIcon = (status: NotifyStatus) => {\n switch (status) {\n case NOTIFY_STATUS_ENUMS.SUCCESS:\n return ICONS.SUCCESS\n case NOTIFY_STATUS_ENUMS.ERROR:\n return ICONS.ERROR\n case NOTIFY_STATUS_ENUMS.WARNING:\n return ICONS.WARNING\n case NOTIFY_STATUS_ENUMS.INFO:\n return ICONS.INFO\n }\n }\n\n const iconWrapper = document.createElement('div')\n iconWrapper.classList.add(CLASSNAMES.NOTIFY_ICON)\n iconWrapper.innerHTML = this.customIcon || computedIcon(this.status)\n if (this.status || this.customIcon) this.wrapper.appendChild(iconWrapper)\n }\n\n private setObserver(): void {\n const observer = new IntersectionObserver(\n (entries) => {\n if (!(entries[0].intersectionRatio <= 0)) {\n return\n } else {\n this.close()\n }\n },\n {\n threshold: 0\n }\n )\n\n setTimeout(() => {\n observer.observe(this.wrapper)\n }, this.speed)\n }\n\n private notifyIn(callback: (p: Notify) => void): void {\n callback(this)\n }\n\n private notifyOut = (callback: (p: Notify) => void): void => {\n callback(this)\n }\n\n private autoClose(): void {\n setTimeout(() => {\n this.close()\n }, this.autotimeout + this.speed)\n }\n\n public close(): void {\n this.notifyOut(this.selectedNotifyOutEffect)\n }\n\n private setEffect(): void {\n switch (this.effect) {\n case NOTIFY_ANIMATION_ENUMS.FADE:\n this.selectedNotifyInEffect = fadeIn\n this.selectedNotifyOutEffect = fadeOut\n break\n case NOTIFY_ANIMATION_ENUMS.SLIDE:\n this.selectedNotifyInEffect = slideIn\n this.selectedNotifyOutEffect = slideOut\n break\n default:\n this.selectedNotifyInEffect = fadeIn\n this.selectedNotifyOutEffect = fadeOut\n }\n }\n}\n\n;(globalThis as any).Notify = Notify\n"]}