memlnaut-nisps/manifold/src/console/shared-ui.tsx
monkey-w1n5t0n ae2657a01b refactor(manifold): one applyCurve, one GROUP_COLOR — and make the knob honest
Phase 3 (L38, ST4).

L38 is a REAL, VISIBLE behaviour change, and it is a bug fix rather than a wash.
There were two divergent applyCurve implementations: model.ts's
(`e = 0.25 + c*1.75`, linear at c≈0.43) drove the on-screen bars, while
mapping.ts's spec-anchored version (0.5 = exactly linear, symmetric in
log-exponent space) drove `mapOutput` — i.e. the value actually sent to MIDI/OSC/
VCV. So the display disagreed with the signal at every curve setting except the
shared endpoint. mapping.ts's survives; model.ts's is deleted and re-exported.
Displayed values now move visibly, and they now match what is transmitted.

That unification exposed a third copy the finding did not mention: CurvePad.tsx
inlined the same deleted formula to draw the curve-knob preview and its numeric
readout. Left alone it would have matched NEITHER implementation — the knob
would have drawn one response while the bars and the output used another.
CurvePad now calls the same applyCurve, so knob, bars and transmitted value are
one thing. The readout shows the actual exponent.

ST4: GROUP_COLOR was duplicated across four files (Phase 1's ReadoutStrip
deletion removed a fifth). All four now import the single map in model.ts —
including OutputStage.tsx's OUT_GROUP_COLOR, which was outside the sweep's scope
and would have been the last survivor.

NOT done, deliberately: ST4 also invited replacing the fixed map with a
hash-to-palette function, because its keys (formant/pitch/amp/filter/fx/mod) are
JSX-era placeholders that do not match the real schema group strings
(verb/sequencer/general/filterbank/delays/eq/midi/...), so most groups currently
fall through to the accent colour. That is a visual redesign, not a
deduplication, and it should be one deliberate change now that every consumer
reads one map.

Gates: typecheck clean, 17/17 unit tests, 33 e2e specs.
2026-07-21 14:02:48 +02:00

44 lines
1.4 KiB
TypeScript

/**
* Console — shared chrome. Ported from `shared-ui.jsx`.
*
* AltitudeNav and CompactAxis were deleted 2026-07 (simplification audit S15) —
* both were part of the dead focus/altitude system (setFocus was never called;
* Manifold ships a single "composite" altitude). MiniMeters survives — it is
* the live glanceable output readout used by CompositeStage's minimap.
*/
import { GROUP_COLOR } from './model';
import type { MFParam } from './model';
/** MiniMeters — glanceable read-only output bars (no interaction). */
export function MiniMeters({ params, values }: { params: MFParam[]; values: number[] }) {
return (
<div style={{ display: 'flex', alignItems: 'flex-end', gap: 2, height: 40 }}>
{values.map((v, i) => (
<div
key={i}
title={`${params[i]?.name}: ${v.toFixed(2)}`}
style={{
width: 5,
height: '100%',
background: 'var(--bg-2)',
borderRadius: 1,
position: 'relative',
overflow: 'hidden',
}}
>
<div
style={{
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
height: `${v * 100}%`,
background: `var(${GROUP_COLOR[params[i]?.group] || '--accent'})`,
opacity: 0.3 + v * 0.6,
}}
/>
</div>
))}
</div>
);
}