jb-notification
Version:
notification web component
2 lines • 2.35 kB
JavaScript
function t(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)}require("jb-notification");var e,i,n,o,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,i){this.onAttributeChange(t,i)}onAttributeChange(t,e){}};!customElements.get("jb-notification-wrapper")&&window.customElements.define("jb-notification-wrapper",r);i=new WeakMap,e=new WeakSet,n=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,i,t,"f")},o=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},exports.NotificationManager=class{get wrapperDom(){return t(this,i,"f")}constructor(){e.add(this),i.set(this,void 0),t(this,e,"m",n).call(this)}new(i){const{title:n,type:r,desc:a}=i,s=t(this,e,"m",o).call(this,{title:n,type:r,desc:a});this.wrapperDom?.appendChild(s),s.show()}onNotificationClose(t){this.wrapperDom.removeChild(t.target)}};
//# sourceMappingURL=jb-notification-manager.cjs.js.map