jb-notification
Version:
notification web component
2 lines • 2.63 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jb-notification")):"function"==typeof define&&define.amd?define(["exports","jb-notification"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).JBNotificationManager={},t.JBNotification)}(this,(function(t,e){function i(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)}var n,o,a,r,s=class extends HTMLElement{constructor(){super(),this.initWebComponent()}initWebComponent(){const t=this.attachShadow({mode:"open"}),e=document.createElement("template");e.innerHTML='<style>.jb-notification-wrapper-web-component{position:var(--jb-notification-wrapper-position, absolute);box-sizing:border-box;overflow:hidden;display:flex;align-items:center;flex-direction:column;gap:.5rem;width:100vw;height:100vh;padding-top:var(--jb-notification-wrapper-padding-top, 64px);z-index:9999;top:0;left:0;pointer-events:none}</style>\n\n <div class="jb-notification-wrapper-web-component">\n <slot></slot>\n </div>\n ',t.appendChild(e.content.cloneNode(!0))}static get observedAttributes(){return["x-position","y-position"]}attributeChangedCallback(t,e,i){this.onAttributeChange(t,i)}onAttributeChange(t,e){}};!customElements.get("jb-notification-wrapper")&&window.customElements.define("jb-notification-wrapper",s);o=new WeakMap,n=new WeakSet,a=function(){const t=document.createElement("jb-notification-wrapper");document.body.appendChild(t),function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,i):o?o.value=i:e.set(t,i)}(this,o,t,"f")},r=function(t){const{title:e,type:i,desc:n}=t,o=document.createElement("jb-notification");return o.title=e,i&&(o.type=i),n&&(o.description=n),o.addEventListener("close",this.onNotificationClose.bind(this)),o},t.NotificationManager=class{get wrapperDom(){return i(this,o,"f")}constructor(){n.add(this),o.set(this,void 0),i(this,n,"m",a).call(this)}new(t){const{title:e,type:o,desc:a}=t,s=i(this,n,"m",r).call(this,{title:e,type:o,desc:a});this.wrapperDom?.appendChild(s),s.show()}onNotificationClose(t){this.wrapperDom.removeChild(t.target)}}}));
//# sourceMappingURL=jb-notification-manager.umd.js.map