import { Slider , Offset } from './slider.js' ; import { hsvaToHslString } from '../utils/convert.js' ; import { clamp , round } from '../utils/math.js' ; import type { HsvaColor } from '../types' ; export class Hue extends Slider { declare h : number ; constructor ( root ) { super ( root , 'hue' , 'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"' , false ) ; } update ( { h } ) { this . h = h ; this . style ( [ { left : `${ ( h / 360 ) * 100 }%` , color : hsvaToHslString ( { h , s : 100 , v : 100 , a : 1 } ) } ] ) ; this . el . setAttribute ( 'aria-valuenow' , `${ round ( h ) }` ) ; } getMove ( offset , key ? ) { return { h : key ? clamp ( this . h + offset . x * 360 , 0 , 360 ) : 360 * offset . x } ; } }