@aidenlx/player
Version:
Headless web components that make integrating media on the a web a breeze.
11 lines (9 loc) • 1.64 kB
JavaScript
import{a as f}from"./chunk.ZSS4272G.js";import{a as s,b as v}from"./chunk.KCC3AAG2.js";import{D as p,R as u,T as d,a as r,b as n,da as l,ia as h,j as c,ja as m}from"./chunk.PWTX2M5C.js";var t=class extends m{constructor(){super(...arguments);this.i=new c;this.ws=f.consume(this);this.__value=0;this.type="current";this.showHours=!1;this.padHours=!1;this.decimalPlaces=2}static get styles(){return[h`
:host {
display: inline-block;
contain: content;
}
:host([hidden]) {
display: none;
}
`]}get It(){return this.ws.value}connectedCallback(){super.connectedCallback(),this.Te()}update(e){(e.has("type")||e.has("format"))&&this.Te(),super.update(e)}disconnectedCallback(){this.i.empty(),super.disconnectedCallback()}render(){return n`${this.ke()}`}Te(){this.i.empty();let e=this.It[this.type==="current"?"value":"pointerValue"],o=(this.format==="percent"?this.Cs(e):e).subscribe(i=>{this.__value=i});this.i.add(o)}Cs(e){return u([e,this.It.min,this.It.max],([a,o,i])=>{let y=i-o;return a/y*100})}ke(){switch(this.format){case"percent":return this.xs();case"time":return this.Ps();default:return`${this.__value}`}}xs(){return`${p(this.__value,this.decimalPlaces)}%`}Ps(){return l(this.__value,this.padHours,this.showHours)}};r([v()],t.prototype,"__value",2),r([s()],t.prototype,"type",2),r([s()],t.prototype,"format",2),r([s({attribute:"show-hours",type:Boolean})],t.prototype,"showHours",2),r([s({attribute:"pad-hours",type:Boolean})],t.prototype,"padHours",2),r([s({attribute:"decimal-places",type:Number})],t.prototype,"decimalPlaces",2);d("vds-slider-value-text",t);