UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

1 lines 1.41 kB
import {j,k}from'./chunk-DVHTYKDX.js';import {g}from'./chunk-YBD5JYCX.js';import {ScanditHTMLElement,css,defineCustomElements,safeAwaitAnimation}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var c=class n extends ScanditHTMLElement{constructor(){super(...arguments);this.styleElement=css`${g}{height:var(--dvh);left:0;opacity:0;pointer-events:none;position:absolute;top:0;user-select:none;width:var(--dvw)}${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]:n}),document.createElement(g)}async fadeIn(e,a){let i=this.animate([{opacity:"0"},{opacity:e}],{duration:a,easing:"linear"});await safeAwaitAnimation(i);}async fadeOut(e,a){let i=this.animate([{opacity:e},{opacity:"0"}],{duration:a,easing:"linear"});await safeAwaitAnimation(i);}async emitSuccessFeedback(){this.success=true,await this.fadeIn("1",200),await this.fadeOut("1",0);}async emitErrorFeedback(){this.error=true,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{c as a};