@scandit/web-datacapture-core
Version:
Scandit Data Capture SDK for the Web
1 lines • 1.8 kB
JavaScript
import {a}from'../../../chunks/chunk-EV4OEANA.js';import {a as a$2}from'../../../chunks/chunk-3A4KLILV.js';import {a as a$1}from'../../../chunks/chunk-MU6SADSF.js';import {a as a$3}from'../../../chunks/chunk-LSZZVJ6B.js';var e=class e extends a{constructor(){super();this.fadeInKeyframes=[{opacity:0},{opacity:1}];this.fadeOutKeyframes=[{opacity:1},{opacity:0}];this.animationOptions={duration:200,easing:"ease",fill:"forwards"};let t=this.attachShadow({mode:"open"});t.innerHTML=a$1`<div class="backdrop"></div>`,t.append(e.createStyleElement().cloneNode(true));}static get observedAttributes(){return ["open"]}get open(){return this.hasAttribute("open")}set open(t){this.toggleAttribute("open",t);}static create(){return e.register(),document.createElement(e.tag)}static register(){a$2({[e.tag]:e});}static createStyleElement(){return a$3`:host{display:none;height:100%;inset:0;position:absolute;width:100%}.open,:host([open]){display:block;pointer-events:none;z-index:1}.backdrop{background:rgba(0,0,0,.5);height:100%;position:absolute;width:100%}`}attributeChangedCallback(t,i,a){t==="open"&&(a==null?this.hide():this.show());}async show(){var t,i;if(this.style.display!=="block"){(t=this.fadeOutAnimation)==null||t.cancel(),(i=this.fadeInAnimation)==null||i.cancel(),this.style.display="block",this.fadeInAnimation=this.animate(this.fadeInKeyframes,this.animationOptions);try{await this.fadeInAnimation.finished;}catch(a){}}}async hide(){var t,i;if(this.style.display!=="none"){(t=this.fadeInAnimation)==null||t.cancel(),(i=this.fadeOutAnimation)==null||i.cancel(),this.fadeOutAnimation=this.animate(this.fadeOutKeyframes,this.animationOptions);try{await this.fadeOutAnimation.finished;}catch(a){}finally{this.style.display="none";}}}};e.tag="scandit-backdrop";var l=e;export{l as Backdrop};