UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

1 lines 1.68 kB
import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var e=class e extends ScanditHTMLElement{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=html`<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(){defineCustomElements({[e.tag]:e});}static createStyleElement(){return css`: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,.3);height:100%;position:absolute;width:100%}`}attributeChangedCallback(t,i,n){t==="open"&&(n==null?this.hide():this.show());}async show(){var t,i;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),await this.fadeInAnimation.finished);}async hide(){var t,i;this.style.display!=="none"&&((t=this.fadeInAnimation)==null||t.cancel(),(i=this.fadeOutAnimation)==null||i.cancel(),this.fadeOutAnimation=this.animate(this.fadeOutKeyframes,this.animationOptions),await this.fadeOutAnimation.finished,this.style.display="none");}};e.tag="scandit-backdrop";var a=e;export{a};