: asapien/superpulse

commit de9c482875652ec8cf28abc82d1e677d48ab8fdd
parent eb9f669e9f7600bd20f025594452639ceed12b41
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Wed, 7 Oct 2026 17:18:10 +0530

Keep theme colors out of TVA data
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tva-control.js b/tva-control.js
@@ -187,7 +187,7 @@
     function refresh() { if (!chart) { render(); syncBlinkTimer(); return; } if (mode !== 'timeline') { render(); syncBlinkTimer(); return; } const nextConfig = timelineConfig(); chart.data.labels = nextConfig.data.labels; nextConfig.data.datasets.forEach((dataset, index) => { if (chart.data.datasets[index]) chart.data.datasets[index].data = dataset.data; }); const metricDataset = chart.data.datasets[metricDatasetIndex]; if (metricDataset) metricDataset.data = values(); Object.assign(chart.options.scales.y, zoomBounds(values())); syncControls(); syncBlinkTimer(); chart.update('none'); }
     function switchMode(next) { mode = next; render(); syncBlinkTimer(); }
     render(); syncBlinkTimer();
-    function publicData() { const out = { ...clone(state), updatedAt: clone(updatedAtByKey) }; delete out.uiColors; return out; }
+    function publicData() { const out = { ...clone(state), updatedAt: clone(updatedAtByKey) }; delete out.uiColors; if (out.colors) { if (!(init.colors && init.colors.normal)) delete out.colors.normal; if (!(init.colors && init.colors.stale)) delete out.colors.stale; } return out; }
     function touchChanged(patch) { const now = Date.now(); Object.entries(patch || {}).forEach(([raw, val]) => { const key = aliases[raw] || raw; if (metricKeys.includes(key) && val !== undefined && val !== null) updatedAtByKey[key] = now; }); if (patch && patch.updatedAt && typeof patch.updatedAt === 'object') Object.entries(patch.updatedAt).forEach(([raw, value]) => { const key = aliases[raw] || raw; const timestamp = typeof value === 'string' ? Date.parse(value) : number(value, NaN); if (metricKeys.includes(key) && Number.isFinite(timestamp)) updatedAtByKey[key] = timestamp; }); }
     return { update(patch) { const before = values(); state = mergeData(state, patch, aliases); resolveUiColors(); if (values().some((v, i) => v !== before[i])) previousMetricValues = before; touchChanged(patch); refresh(); }, setData(next) { previousMetricValues = values(); state = mergeData(baseState(), next, aliases); resolveUiColors(); updatedAtByKey = Object.fromEntries(metricKeys.map(k => [k, Date.now()])); refresh(); }, refreshTheme() { resolveUiColors(); render(); syncBlinkTimer(); }, getData() { return publicData(); }, destroy() { if (blinkId) clearInterval(blinkId); if (staleSweepId) clearInterval(staleSweepId); container.classList.remove('tva-border-alert'); container.style.removeProperty('--tva-border-alert-color'); if (chart) chart.destroy(); controls.remove(); alertBadge.remove(); } };
   };