jb-notification
Version:
notification web component
2 lines • 2.36 kB
JavaScript
import"jb-notification";function t(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)}var e,n,o,i,r=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,n){this.onAttributeChange(t,n)}onAttributeChange(t,e){}};!customElements.get("jb-notification-wrapper")&&window.customElements.define("jb-notification-wrapper",r);var a=class{get wrapperDom(){return t(this,n,"f")}constructor(){e.add(this),n.set(this,void 0),t(this,e,"m",o).call(this)}new(n){const{title:o,type:r,desc:a}=n,s=t(this,e,"m",i).call(this,{title:o,type:r,desc:a});this.wrapperDom?.appendChild(s),s.show()}onNotificationClose(t){this.wrapperDom.removeChild(t.target)}};n=new WeakMap,e=new WeakSet,o=function(){const t=document.createElement("jb-notification-wrapper");document.body.appendChild(t),function(t,e,n,o,i){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?i.call(t,n):i?i.value=n:e.set(t,n)}(this,n,t,"f")},i=function(t){const{title:e,type:n,desc:o}=t,i=document.createElement("jb-notification");return i.title=e,n&&(i.type=n),o&&(i.description=o),i.addEventListener("close",this.onNotificationClose.bind(this)),i};export{a as NotificationManager};
//# sourceMappingURL=jb-notification-manager.js.map