@scandit/web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
1 lines • 2.17 kB
JavaScript
import {a as a$1}from'./chunk-OIFWCYQI.js';import {a}from'./chunk-CYVVGAZ4.js';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var l=(e=>(e[e.Top="top-center"]="Top",e[e.Bottom="bottom-center"]="Bottom",e[e.Left="left-center"]="Left",e[e.Right="right-center"]="Right",e))(l||{}),r=class r extends ScanditHTMLElement{constructor(){super();this.isEntirePopoverTappable=false;this.annotationTrigger="highlightTap";this.onPointerUpListener=this.onPointerUp.bind(this);this.anchor=l.Bottom;let t=this.attachShadow({mode:"open"});t.innerHTML=html`<div class="container" role="group"><slot></slot></div>`,t.append(r.createStyleElement().cloneNode(true));}updatePosition(t,o,e){a(this,t,o,0);}get barcode(){return this._barcode}set barcode(t){this._barcode=t;}set direction(t){this.setAttribute("direction",t);}get direction(){var t;return (t=this.getAttribute("direction"))!=null?t:"horizontal"}static register(){defineCustomElements({[r.tag]:r});}static create(t){r.register();let o=document.createElement(r.tag);return o.barcode=t,o}static createStyleElement(){return css`:host{background-color:unset;border:none;border-radius:14px;margin:0;overflow:hidden;padding:0}:host([direction=horizontal]) .container{flex-direction:row}:host([direction=vertical]) .container{flex-direction:column}.container{backdrop-filter:blur(16px);background:#ffffffb3;box-shadow:0 6px 10px 4px #12161926;display:flex;gap:14px}`}connectedCallback(){let t=Array.from(this.querySelectorAll(a$1.tag));for(let[o,e]of Object.entries(t))e.setAttribute("data-position",o);this.addEventListener("pointerup",this.onPointerUpListener);}disconnectedCallback(){this.removeEventListener("pointerup",this.onPointerUpListener);}onPointerUp(t){var e,a,p,i,c;if(this.isEntirePopoverTappable){(a=(e=this.listener)==null?void 0:e.onPopoverTapped)==null||a.call(e,this);return}let o=(p=t.target)==null?void 0:p.closest(a$1.tag);o&&((c=(i=this.listener)==null?void 0:i.onPopoverButtonTapped)==null||c.call(i,this,o,Number(o.getAttribute("data-position"))));}};r.tag="scandit-barcode-ar-popover-annotation";var d=r;export{l as a,d as b};