import { html, nothing, type TemplateResult } from 'lit'; import type { NuiType } from '../../types/nui-type.js'; import { formatKnobValue, getKnobPaths } from './knob-math.js'; export interface NuiKnobViewState { value: number; min: number; max: number; size: number; strokeWidth: number; showValue: boolean; valueTemplate: string; valueColor: string; rangeColor: string; textColor: string; disabled: boolean; readonly: boolean; tabindex: number; ariaLabel: string; ariaLabelledby: string; nuiType: NuiType; knobClass: string; } export function getKnobClass(knobClass: string): string { return ['nui-knob', knobClass].filter(Boolean).join(' '); } export function renderKnob(state: NuiKnobViewState): TemplateResult { const paths = getKnobPaths(state.value, state.min, state.max); const valueStroke = state.valueColor || 'var(--nui-primary-color)'; const rangeStroke = state.rangeColor || 'var(--nui-card-border)'; const textStyle = state.textColor ? `color: ${state.textColor}` : nothing; return html`