UNPKG

@creaditor/newsletter-starterkit

Version:

Creaditor Newsletter Editor - Starterkit for creating beautiful email newsletters

30 lines (29 loc) 1.6 kB
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[132],{90132:(e,t,r)=>{r.r(t),r.d(t,{EyeDroppper:()=>n});var s=r(56666),i=r(21293);const o=r(80184);class n extends i.oi{constructor(){super(),(0,s.Z)(this,"openEyeDropper",(async()=>{const e=new AbortController;try{let e=new EyeDropper;const{sRGBHex:t}=await e.open(),r=o(t).setAlpha(1).toRgbString();this.value=this.color=r,this.dispatchEvent(this.event)}catch(e){console.error(e)}e.abort()})),this.isValid=!!window.EyeDropper,this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0})}render(){return this.isValid?i.dy` <svg tabIndex="0" @click=${this.openEyeDropper} width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" > <path d="m20.71 5.63-2.34-2.34a.9959.9959 0 0 0-1.41 0l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.4-1.03.01-1.42zM6.92 19 5 17.08l8.06-8.06 1.92 1.92L6.92 19z" ></path> </svg> `:null}}(0,s.Z)(n,"styles",i.iv` :host { position: relative; display: inline-block; } svg { cursor: pointer; } svg:hover { fill: var(--primary); } svg:active { transform: scale(1.1); fill: var(--dark); } `),(0,s.Z)(n,"properties",{value:{type:String,reflect:!0},color:{type:String,reflect:!0}}),customElements.define("cdtr-eye-dropper",n)}}]);