UNPKG

@huluvu424242/honey-slideshow

Version:

Text to Speech component wich is reading texts from DOM elements.

1 lines 3.04 kB
import{r as t,i as n,j as i,h as a,g as e,H as o}from"./p-4a369965.js";import{g as r}from"./p-97eca155.js";const s=class{constructor(n){t(this,n),this.type="bounded"}async addRipple(t,a){return new Promise(e=>{n(()=>{const n=this.el.getBoundingClientRect(),o=n.width,r=n.height,s=Math.sqrt(o*o+r*r),f=Math.max(r,o),u=this.unbounded?f:s+c,p=Math.floor(f*l),d=u/p;let b=t-n.left,w=a-n.top;this.unbounded&&(b=.5*o,w=.5*r);const k=b-.5*p,g=w-.5*p,h=.5*o-b,y=.5*r-w;i(()=>{const t=document.createElement("div");t.classList.add("ripple-effect");const n=t.style;n.top=g+"px",n.left=k+"px",n.width=n.height=p+"px",n.setProperty("--final-scale",""+d),n.setProperty("--translate-end",`${h}px, ${y}px`),(this.el.shadowRoot||this.el).appendChild(t),setTimeout(()=>{e(()=>{m(t)})},325)})})})}get unbounded(){return"unbounded"===this.type}render(){const t=r(this);return a(o,{role:"presentation",class:{[t]:!0,unbounded:this.unbounded}})}get el(){return e(this)}},m=t=>{t.classList.add("fade-out"),setTimeout(()=>{t.remove()},200)},c=10,l=.5;s.style=":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:strict;pointer-events:none}:host(.unbounded){contain:layout size style}.ripple-effect{border-radius:50%;position:absolute;background-color:currentColor;color:inherit;contain:strict;opacity:0;-webkit-animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;will-change:transform, opacity;pointer-events:none}.fade-out{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale, 1));transform:translate(var(--translate-end)) scale(var(--final-scale, 1));-webkit-animation:150ms fadeOutAnimation forwards;animation:150ms fadeOutAnimation forwards}@-webkit-keyframes rippleAnimation{from{-webkit-animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transform:scale(1);transform:scale(1)}to{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale, 1));transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@keyframes rippleAnimation{from{-webkit-animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transform:scale(1);transform:scale(1)}to{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale, 1));transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@-webkit-keyframes fadeInAnimation{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:0.16}}@keyframes fadeInAnimation{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:0.16}}@-webkit-keyframes fadeOutAnimation{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0.16}to{opacity:0}}@keyframes fadeOutAnimation{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0.16}to{opacity:0}}";export{s as ion_ripple_effect}