From 489080ca56b8819523ff82d3fa9715d56cd439fb Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Wed, 22 Apr 2026 20:25:46 -0500 Subject: [PATCH] webkit --- .../components/tools/device_settings.js | 215 ++++++++++-------- 1 file changed, 119 insertions(+), 96 deletions(-) diff --git a/starpilot/system/the_pond/assets/components/tools/device_settings.js b/starpilot/system/the_pond/assets/components/tools/device_settings.js index abb238274..6185b644e 100644 --- a/starpilot/system/the_pond/assets/components/tools/device_settings.js +++ b/starpilot/system/the_pond/assets/components/tools/device_settings.js @@ -44,15 +44,29 @@ function getSectionsWithSlug() { } function isGroupParam(param) { - return param?.ui_type === "group" + return !!param && param.ui_type === "group" } function isParamEnabledForChildren(paramOrKey) { - const param = typeof paramOrKey === "string" ? state.paramMetaByKey[paramOrKey] : paramOrKey + const isKey = typeof paramOrKey === "string" + const param = isKey ? state.paramMetaByKey[paramOrKey] : paramOrKey if (isGroupParam(param)) return true - const key = typeof paramOrKey === "string" ? paramOrKey : param?.key - return !!state.values[key] + const key = isKey ? paramOrKey : (param && param.key) + return !!(key && state.values[key]) +} + +function getEventValue(event) { + const source = event && (event.currentTarget || event.target) + if (!source || !("value" in source)) return "" + return String(source.value || "") +} + +function updateSearchFilter(event) { + const nextFilter = getEventValue(event) + if (state.filter === nextFilter) return + state.filter = nextFilter + scheduleSyncInputs() } function toSelectValue(value) { @@ -737,6 +751,104 @@ function renderSettingRow(p) { const isChild = p.parent_key ? "ds-child-modifier" : "" const lockReason = getSettingLockReason(p) const isLocked = lockReason !== "" + let rowControl = "" + + if (isNumeric) { + rowControl = html` +
+ ${(() => { + const bounds = numericBounds(p) + const currentNumeric = resolveCurrentNumericValue(p, bounds) + const precision = stepPrecision(bounds.step, p.precision) + const epsilon = Math.pow(10, -(precision + 2)) + const updating = isNumericUpdating(p.key) + const canDecrease = !updating && currentNumeric > (Number(bounds.min) + epsilon) + const canIncrease = !updating && currentNumeric < (Number(bounds.max) - epsilon) + const defaultNumeric = resolveDefaultNumericValue(p, bounds) + const defaultLabel = defaultNumeric !== null + ? formatSliderValue(defaultNumeric, String(bounds.step), p.precision, p.key) + : "N/A" + const canReset = !updating && defaultNumeric !== null && Math.abs(defaultNumeric - currentNumeric) > epsilon + const stepLabel = formatStepValue(bounds.step, precision) + return html` +
+ +
+ ${formatSliderValue(bounds.min, String(bounds.step), p.precision, p.key)} to ${formatSliderValue(bounds.max, String(bounds.step), p.precision, p.key)} + Step: ${stepLabel} per click + Default: ${defaultLabel} +
+ + +
+ +
+
+ ` + })()} +
+ ` + } else if (p.ui_type === "dropdown") { + rowControl = html` + + ` + } else if (p.ui_type === "color") { + rowControl = html` +
+ + +
+ ` + } else if (!isGroup) { + rowControl = html` + + ` + } return html`
@@ -761,94 +873,7 @@ function renderSettingRow(p) { }}` : ""}
- ${isNumeric ? html` -
- ${(() => { - const bounds = numericBounds(p) - const currentNumeric = resolveCurrentNumericValue(p, bounds) - const precision = stepPrecision(bounds.step, p.precision) - const epsilon = Math.pow(10, -(precision + 2)) - const updating = isNumericUpdating(p.key) - const canDecrease = !updating && currentNumeric > (Number(bounds.min) + epsilon) - const canIncrease = !updating && currentNumeric < (Number(bounds.max) - epsilon) - const defaultNumeric = resolveDefaultNumericValue(p, bounds) - const defaultLabel = defaultNumeric !== null - ? formatSliderValue(defaultNumeric, String(bounds.step), p.precision, p.key) - : "N/A" - const canReset = !updating && defaultNumeric !== null && Math.abs(defaultNumeric - currentNumeric) > epsilon - const stepLabel = formatStepValue(bounds.step, precision) - return html` -
- -
- ${formatSliderValue(bounds.min, String(bounds.step), p.precision, p.key)} to ${formatSliderValue(bounds.max, String(bounds.step), p.precision, p.key)} - Step: ${stepLabel} per click - Default: ${defaultLabel} -
- - -
- -
-
- ` - })()} -
- ` : p.ui_type === "dropdown" ? html` - - ` : p.ui_type === "color" ? html` -
- - -
- ` : isGroup ? "" : html` - - `} + ${rowControl} ` } @@ -915,10 +940,8 @@ export function DeviceSettings({ params }) { @keydown="${(e) => { if (e.key === "Escape") clearSearchFilter() }}" - @input="${(e) => { - state.filter = e.target.value - scheduleSyncInputs() - }}" /> + @input="${updateSearchFilter}" + @change="${updateSearchFilter}" /> ${() => state.filter ? html`