UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

8 lines (5 loc) 1.36 kB
import { j, k } from './chunk-DVHTYKDX.js'; import { g } from './chunk-YBD5JYCX.js'; import { ScanditHTMLElement, css, defineCustomElements } from '@scandit/web-datacapture-core/build/js/private/utils/index.js'; var r=class extends ScanditHTMLElement{constructor(){super(...arguments);this.styleElement=css`${g}{height:100dvh;left:0;opacity:0;pointer-events:none;position:fixed;top:0;user-select:none;width:100dvw}${g}[success]{background:var(${j})}${g}[error]{background:var(${k})}`;}get success(){return this.hasAttribute("success")}set success(e){this.toggleAttribute("error",!e),this.toggleAttribute("success",e);}get error(){return this.hasAttribute("error")}set error(e){this.toggleAttribute("error",e),this.toggleAttribute("success",!e);}static create(){return defineCustomElements({[g]:this}),document.createElement(g)}async fadeIn(e,i){await this.animate([{opacity:"0"},{opacity:e}],{duration:i,easing:"linear"}).finished;}async fadeOut(e,i){await this.animate([{opacity:e},{opacity:"0"}],{duration:i,easing:"linear"}).finished;}async emitSuccessFeedback(){this.success=!0,await this.fadeIn("1",200),await this.fadeOut("1",0);}async emitErrorFeedback(){this.error=!0,await this.fadeIn("1",100),await this.fadeOut("1",100),await this.fadeIn("0.5",100),await this.fadeOut("0.5",0);}connectedCallback(){this.append(this.styleElement);}}; export { r as a };