Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Align inspector fields and reclaim slider space

Bittid1fae692eae4
diff --git a/src/components/ui/PropRow.tsx b/src/components/ui/PropRow.tsx
index eab051b..fc114ee 100644
--- a/src/components/ui/PropRow.tsx
+++ b/src/components/ui/PropRow.tsx
@@ -1,6 +1,6 @@
/* PropRow + PropSection — dense inspector rows.
- A row is a grid: label (--prop-label, 104px) | value | 20px reset. 28px
+ A row is a grid: label (--prop-label, 104px) | value | optional 20px reset. 28px
min height, the label in 12px secondary ink. Give it `scrub` and dragging horizontally on
the label changes the number (ew-resize cursor, pointer capture, `step` per
pixel, Shift ×10) — the way every node editor does it. The reset button
@@ -59,6 +59,7 @@ export function PropRow({ label, tooltip, htmlFor, children, value, defaultValue
const [scrubbing, setScrubbing] = useState(false);
const suppressClick = useRef(false);
const isModified = modified ?? (defaultValue !== undefined && value !== undefined && !Object.is(value, defaultValue));
+ const hasReset = Boolean(onReset) || defaultValue !== undefined;
const clamp = (next: number) => Math.min(scrub?.max ?? Infinity, Math.max(scrub?.min ?? -Infinity, next));
const round = (next: number, step: number) => {
@@ -96,7 +97,7 @@ export function PropRow({ label, tooltip, htmlFor, children, value, defaultValue
};
return (
- <div className={cx("ui-prop-row", scrubbing && "ui-prop-row--scrubbing", className)}>
+ <div className={cx("ui-prop-row", hasReset && "ui-prop-row--resettable", scrubbing && "ui-prop-row--scrubbing", className)}>
<label
className={cx("ui-prop-row__label", scrub && "ui-prop-row__label--scrub")}
htmlFor={htmlFor}
@@ -122,7 +123,7 @@ export function PropRow({ label, tooltip, htmlFor, children, value, defaultValue
>
<Reset12 aria-hidden="true" />
</button>
- ) : <span className="ui-prop-row__reset-spacer" aria-hidden="true" />}
+ ) : hasReset ? <span className="ui-prop-row__reset-spacer" aria-hidden="true" /> : null}
</div>
);
}
diff --git a/src/components/workspace/SliderNumberInput.tsx b/src/components/workspace/SliderNumberInput.tsx
index f3ee3b6..8a0e074 100644
--- a/src/components/workspace/SliderNumberInput.tsx
+++ b/src/components/workspace/SliderNumberInput.tsx
@@ -2,8 +2,7 @@ import type { ComponentProps } from "react";
import { Slider } from "../ui";
import { CommittedNumberInput } from "./CommittedNumberInput";
-/** One bounded value, editable by dragging or typing, with shared column widths
- * so ranges, values and optional units do not shift neighboring controls. */
+/** A flexible slider, fixed-width number field, and an optional trailing unit. */
export function SliderNumberInput({ minimum, maximum, value, step = 1, sliderLabel, suffix, disabled, onCommit, ...input }: Omit<ComponentProps<typeof CommittedNumberInput>, "step"> & {
step?: number;
sliderLabel?: string;
@@ -11,13 +10,14 @@ export function SliderNumberInput({ minimum, maximum, value, step = 1, sliderLab
}) {
const label = input["aria-label"] ?? "Value";
const range = `${minimum} to ${maximum}`;
+ const unit = suffix?.trim();
const change = (next: number) => { if (!disabled) onCommit(next); };
- return <div className="slider-number">
+ return <div className={`slider-number${unit ? " slider-number--unit" : ""}`}>
<Slider aria-label={sliderLabel ?? `${label} slider`} min={minimum} max={maximum} step={step}
value={value} disabled={disabled} title={range} onChange={change} />
<CommittedNumberInput {...input} className={`text-field slider-number__input ${input.className ?? ""}`}
minimum={minimum} maximum={maximum} step={step} value={value} disabled={disabled} title={input.title ?? range} onCommit={change} />
- <span className="slider-number__unit" aria-hidden="true">{suffix?.trim()}</span>
+ {unit && <span className="slider-number__unit" aria-hidden="true">{unit}</span>}
</div>;
}
diff --git a/src/styles/music.css b/src/styles/music.css
index 9cf2828..6a38e4a 100644
--- a/src/styles/music.css
+++ b/src/styles/music.css
@@ -46,10 +46,6 @@
.music-empty p { max-width: 340px; color: var(--text-secondary); }
.music-inspector { grid-column: 3; grid-row: 1 / -1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface-pane); }
.music-inspector__fields { overflow-y: auto; min-height: 0; flex: 1; }
-/* Music has no row reset buttons: use that trailing gutter for units, keeping
- number fields aligned with Seed and giving the full value column to sliders. */
-.music-inspector .slider-number { position: relative; grid-template-columns: minmax(0, 1fr) 64px; }
-.music-inspector .slider-number__unit { position: absolute; left: calc(100% + var(--space-1)); grid-column: auto; white-space: nowrap; }
.music-prompt { display: flex; flex-direction: column; gap: var(--space-1); color: var(--text-secondary); margin-top: var(--space-2); }
.music-prompt textarea { width: 100%; height: auto; padding: var(--space-2); line-height: var(--leading-normal); resize: vertical; }
.music-inspector > .inspector-actions p, .music-inspector__empty { color: var(--text-secondary); font-size: var(--text-xs); }
diff --git a/src/styles/timeline.css b/src/styles/timeline.css
index 132181a..701d620 100644
--- a/src/styles/timeline.css
+++ b/src/styles/timeline.css
@@ -836,17 +836,13 @@
.clip-effect__body {
min-width: 0;
margin: 0;
- padding: var(--space-1) var(--space-1) var(--space-2) var(--space-2);
+ padding: var(--space-1) var(--space-2) var(--space-2);
border: 0;
border-top: 1px solid var(--line);
display: grid;
gap: 2px;
}
-.clip-effect__body .ui-prop-row {
- grid-template-columns: var(--prop-label) minmax(0, 1fr) 20px;
-}
-
.clip-effect__body .ui-slider,
.clip-effect__body input[type="range"] {
flex: 1;
diff --git a/src/styles/ui.css b/src/styles/ui.css
index ad1546b..68c1453 100644
--- a/src/styles/ui.css
+++ b/src/styles/ui.css
@@ -763,17 +763,21 @@
.ui-prop-section__content {
display: grid;
gap: 2px;
- padding: var(--space-1) var(--space-2) var(--space-2) var(--space-3);
+ padding: var(--space-1) var(--space-3) var(--space-2);
}
.ui-prop-row {
min-height: 28px;
display: grid;
- grid-template-columns: var(--prop-label) minmax(0, 1fr) 20px;
+ grid-template-columns: var(--prop-label) minmax(0, 1fr);
align-items: center;
column-gap: var(--space-2);
}
+.ui-prop-row--resettable {
+ grid-template-columns: var(--prop-label) minmax(0, 1fr) 20px;
+}
+
/* Main panel actions keep their size as the inspector grows. Split Generate
buttons size as one unit, leaving the options arrow at its normal width. */
.inspector-action,
@@ -853,7 +857,7 @@
.slider-number {
display: grid;
- grid-template-columns: minmax(0, 1fr) 64px 32px;
+ grid-template-columns: minmax(0, 1fr) 64px;
align-items: center;
gap: var(--space-1);
flex: 1;
@@ -865,6 +869,10 @@
min-width: 0;
}
+.slider-number--unit {
+ grid-template-columns: minmax(0, 1fr) 64px max-content;
+}
+
.ui-prop-row__value .slider-number > .slider-number__input.text-field {
grid-column: 2;
grid-row: 1;
@@ -880,6 +888,7 @@
grid-column: 3;
grid-row: 1;
text-align: left;
+ white-space: nowrap;
color: var(--text-secondary);
font-size: var(--text-xs);
}