Land camera-native raw profiles, real ICC soft proofing and 16-bit proxies.

Camera profiles, proofing tables and the half-float sidecar all have to agree
with the pixels the editor actually grades, so they land together with the
preset filter menu that was unusable while thumbnails streamed in.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-28 03:59:55 +00:00
parent 6dfddffc14
commit 0c113e7a91
53 changed files with 9217 additions and 476 deletions
+71 -3
View File
@@ -2,16 +2,33 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { buildSampler, clamp01 } from '../lib/curves';
import type { CurvePoint } from '../types';
export type ParametricKey = 'highlights' | 'lights' | 'darks' | 'blacks';
interface Props {
points: CurvePoint[];
onChange: (points: CurvePoint[]) => void;
color: string;
/** Region tone shaper values, shown as draggable dots on the curve. */
parametric?: Record<ParametricKey, number>;
onParametric?: (key: ParametricKey, value: number) => void;
}
export default function CurveEditor({ points, onChange, color }: Props) {
/** Lightroom-scale zones: the four regions share the diagonal evenly. */
const ZONES: { key: ParametricKey; label: string; x: number }[] = [
{ key: 'highlights', label: 'Highlights', x: 0.875 },
{ key: 'lights', label: 'Lights', x: 0.625 },
{ key: 'darks', label: 'Darks', x: 0.375 },
{ key: 'blacks', label: 'Blacks', x: 0.125 },
];
/** Full slider travel moves a zone dot a quarter of the graph. */
const ZONE_TRAVEL = 0.18;
export default function CurveEditor({ points, onChange, color, parametric, onParametric }: Props) {
const svgRef = useRef<SVGSVGElement>(null);
const pointsRef = useRef(points);
const [drag, setDrag] = useState<number | null>(null);
const [paramDrag, setParamDrag] = useState<ParametricKey | null>(null);
const [hover, setHover] = useState<number | null>(null);
useEffect(() => {
@@ -42,6 +59,12 @@ export default function CurveEditor({ points, onChange, color }: Props) {
const handleDown = (e: React.PointerEvent<SVGSVGElement>) => {
e.preventDefault();
const paramAttr = (e.target as Element).getAttribute('data-param');
if (paramAttr && parametric && onParametric) {
setParamDrag(paramAttr as ParametricKey);
e.currentTarget.setPointerCapture(e.pointerId);
return;
}
const idxAttr = (e.target as Element).getAttribute('data-idx');
let idx: number;
if (idxAttr !== null) {
@@ -57,6 +80,15 @@ export default function CurveEditor({ points, onChange, color }: Props) {
};
const handleMove = (e: React.PointerEvent<SVGSVGElement>) => {
if (paramDrag && parametric && onParametric) {
const zone = ZONES.find((item) => item.key === paramDrag);
if (!zone) return;
const p = toNorm(e.clientX, e.clientY);
const base = sampler(zone.x);
const value = ((p.y - base) / ZONE_TRAVEL) * 100;
onParametric(paramDrag, Math.round(Math.max(-100, Math.min(100, value))));
return;
}
if (drag === null) return;
const pts = pointsRef.current;
const idx = drag;
@@ -68,7 +100,10 @@ export default function CurveEditor({ points, onChange, color }: Props) {
onChange(next);
};
const handleUp = () => setDrag(null);
const handleUp = () => {
setDrag(null);
setParamDrag(null);
};
const removePoint = (idx: number) => {
const pts = pointsRef.current;
@@ -101,6 +136,37 @@ export default function CurveEditor({ points, onChange, color }: Props) {
</g>
))}
<line x1="0" y1="100" x2="100" y2="0" className="curve-diag" />
{parametric &&
onParametric &&
ZONES.map((zone) => {
const value = parametric[zone.key] ?? 0;
const y = clamp01(sampler(zone.x) + (value / 100) * ZONE_TRAVEL);
return (
<g key={zone.key} style={{ cursor: 'ns-resize' }}>
<line
x1={zone.x * 100}
y1="0"
x2={zone.x * 100}
y2="100"
stroke="rgba(255,255,255,0.12)"
strokeDasharray="2 3"
vectorEffect="non-scaling-stroke"
/>
<circle
data-param={zone.key}
cx={zone.x * 100}
cy={(1 - y) * 100}
r={paramDrag === zone.key ? 3.2 : 2.3}
fill="#141416"
stroke="#f0c86a"
strokeWidth="1.4"
vectorEffect="non-scaling-stroke"
>
<title>{`${zone.label}: ${value > 0 ? '+' : ''}${value}`}</title>
</circle>
</g>
);
})}
<path d={path} fill="none" stroke={color} strokeWidth="1.6" vectorEffect="non-scaling-stroke" />
{points.map((p, i) => (
<circle
@@ -116,7 +182,9 @@ export default function CurveEditor({ points, onChange, color }: Props) {
/>
))}
</svg>
<div className="curve-hint">Click to add a point · drag to shape · double-click a point to remove</div>
<div className="curve-hint">
Click to add a point · drag to shape · drag the four gold dots for highlights, lights, darks and blacks
</div>
</div>
);
}