@scandit/web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
1 lines • 1.82 kB
JavaScript
import {Color,ScanditIconBuilder,ScanditIconType,ScanditIconShape}from'@scandit/web-datacapture-core';import {gray900}from'@scandit/web-datacapture-core/build/js/private/ui/colors.js';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var r=Color.fromRGBA(255,255,255,1),e=class e extends ScanditHTMLElement{constructor(){super();this.onPressedHandler=this.onPressed.bind(this);this.onReleasedHandler=this.onReleased.bind(this);let t=this.attachShadow({mode:"open"});t.innerHTML=html`<button type="button"><slot></slot></button>`,t.append(e.createStyleElement().cloneNode(true));}static create(){return document.createElement(e.tag)}static register(){defineCustomElements({[e.tag]:e});}static createStyleElement(){return css`:host[hidden]{display:none}:host button{background:none;border:none;display:flex;margin:0;outline:none;padding:0;-webkit-tap-highlight-color:transparent}`}async connectedCallback(){var o,n,i;let t=new ScanditIconBuilder;this.icon=await t.withIcon(ScanditIconType.CameraSwitch).withBackgroundShape(ScanditIconShape.Circle).withBackgroundColor(gray900.withAlpha(.3)).withBackgroundStrokeColor(gray900).withWidth(36).withHeight(36).withIconSize(28).build(),(o=this.shadowRoot)==null||o.append(this.icon),(n=this.shadowRoot)==null||n.addEventListener("pointerdown",this.onPressedHandler),(i=this.shadowRoot)==null||i.addEventListener("pointerup",this.onReleasedHandler);}disconnectedCallback(){var t,o;(t=this.shadowRoot)==null||t.removeEventListener("pointerdown",this.onPressedHandler),(o=this.shadowRoot)==null||o.removeEventListener("pointerup",this.onReleasedHandler);}onPressed(){this.icon.iconColor=r.withAlpha(.3);}onReleased(){this.icon.iconColor=r;}};e.tag="scandit-check-switch-camera-button";var s=e;export{s as a};