Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Pane toolbar, section summary, status bar and shared toggle/selection rules

Bitti2ad3b0791c62
diff --git a/src/components/ui/Chrome.tsx b/src/components/ui/Chrome.tsx
index 9b0c5ae..8d5e11d 100644
--- a/src/components/ui/Chrome.tsx
+++ b/src/components/ui/Chrome.tsx
@@ -87,10 +87,17 @@ export function CommandBarSeparator() {
}
/* --- PaneHeader ------------------------------------------------------------------------
- 32px, 12px semibold title, actions on the trailing edge. */
+ A pane's toolbar: a 36px (--chrome-row) strip on --surface-chrome with a
+ --stroke-divider bottom edge. Views lead (a compact SelectorBar), actions
+ sit on the trailing edge. It is only there when the pane HAS views or
+ actions, and it should not carry a title — a pane is headed by what it
+ holds (ItemHeader) or starts with its content. `title` survives for the
+ callers that still pass one: 12px semibold at the leading edge. */
export interface PaneHeaderProps {
- title: ReactNode;
+ title?: ReactNode;
+ /** Leading content after the title: the pane's views, e.g. <SelectorBar compact …/>. */
+ views?: ReactNode;
actions?: ReactNode;
/** Id for the title, so the pane can be aria-labelledby it. */
id?: string;
@@ -99,11 +106,12 @@ export interface PaneHeaderProps {
level?: 2 | 3 | 4;
}
-export function PaneHeader({ title, actions, id, className, level = 2 }: PaneHeaderProps) {
+export function PaneHeader({ title, views, actions, id, className, level = 2 }: PaneHeaderProps) {
const Heading = `h${level}` as "h2";
return (
<div className={cx("ui-pane-header", className)}>
- <Heading id={id} className="ui-pane-header__title">{title}</Heading>
+ {title !== undefined && <Heading id={id} className="ui-pane-header__title">{title}</Heading>}
+ {views && <div className="ui-pane-header__views">{views}</div>}
{actions && <div className="ui-pane-header__actions">{actions}</div>}
</div>
);
@@ -202,7 +210,9 @@ export function TextField({ value, onChange, icon, trailing, className, inputCla
}
/* --- StatusBar ----------------------------------------------------------------------------
- A 24px bar along the bottom of a window or pane, 12px text. It is a
+ A 24px (--chrome-row-sm) strip on --surface-chrome along the bottom of a
+ window or pane, 12px text: labelled mono values on the leading side, state
+ on the trailing side. It is a
labelled region, not a live region: a playhead timecode would otherwise be
read out every frame. Put role="status" on the one item that should speak. */
diff --git a/src/components/ui/Controls.tsx b/src/components/ui/Controls.tsx
index 1d1531b..11e16b7 100644
--- a/src/components/ui/Controls.tsx
+++ b/src/components/ui/Controls.tsx
@@ -325,7 +325,10 @@ export function Expander({ header, description, icon, children, expanded, defaul
/* --- SelectorBar -----------------------------------------------------------------------
Text tabs with a 3×16px accent pill under the selected one. role=tablist,
- arrow keys / Home / End move and select (automatic activation). */
+ arrow keys / Home / End move and select (automatic activation).
+ `compact` is the 24px segmented form that sits in a pane toolbar
+ (PaneHeader `views`): 12px segments in one hairline box, the selected one
+ raised on the control fill. */
export interface SelectorBarItem<V extends string = string> {
value: V;
@@ -342,9 +345,11 @@ export interface SelectorBarProps<V extends string = string> {
onChange: (value: V) => void;
"aria-label"?: string;
className?: string;
+ /** The 24px segmented form for pane toolbars. */
+ compact?: boolean;
}
-export function SelectorBar<V extends string = string>({ items, value, onChange, className, ...aria }: SelectorBarProps<V>) {
+export function SelectorBar<V extends string = string>({ items, value, onChange, className, compact, ...aria }: SelectorBarProps<V>) {
const refs = useRef<(HTMLButtonElement | null)[]>([]);
const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
const enabled = items.map((item, index) => (item.disabled ? -1 : index)).filter((index) => index >= 0);
@@ -360,7 +365,7 @@ export function SelectorBar<V extends string = string>({ items, value, onChange,
refs.current[next]?.focus();
};
return (
- <div role="tablist" aria-label={aria["aria-label"]} className={cx("ui-selector-bar", className)} onKeyDown={onKeyDown}>
+ <div role="tablist" aria-label={aria["aria-label"]} className={cx("ui-selector-bar", compact && "ui-selector-bar--compact", className)} onKeyDown={onKeyDown}>
{items.map((item, index) => {
const selected = item.value === value;
return (
diff --git a/src/components/ui/PropRow.tsx b/src/components/ui/PropRow.tsx
index 045277d..8ab5de0 100644
--- a/src/components/ui/PropRow.tsx
+++ b/src/components/ui/PropRow.tsx
@@ -1,11 +1,16 @@
/* PropRow + PropSection — dense inspector rows.
- A row is a grid: 104px label | value | 20px reset. 28px min height, the
- label in 12px secondary ink. Give it `scrub` and dragging horizontally on
+ A row is a grid: label (--prop-label, 104px) | value | 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
appears only when the value differs from its default.
+ A section header is a 28px (--section-row) strip on --surface-chrome with
+ a --line above and below: chevron, 12px semibold title, and an optional
+ right-aligned `summary` (a count, "1 changed") that stays visible while
+ the section is collapsed.
+
<PropSection title="Transform" persistKey="clip.transform">
<PropRow label="Opacity" htmlFor="opacity" value={opacity} defaultValue={100}
onReset={() => setOpacity(100)} scrub={{ value: opacity, onChange: setOpacity, min: 0, max: 100 }}>
@@ -127,6 +132,8 @@ export interface PropSectionProps {
onOpenChange?: (open: boolean) => void;
/** Remember the open state in localStorage under "slopus.section.<key>". */
persistKey?: string;
+ /** Right-aligned in the header, visible when collapsed too: a count or "1 changed". */
+ summary?: ReactNode;
/** Buttons at the header's trailing edge (compact icon buttons). */
actions?: ReactNode;
className?: string;
@@ -142,7 +149,7 @@ function readOpen(key: string | undefined, fallback: boolean) {
}
}
-export function PropSection({ title, children, open, defaultOpen = true, onOpenChange, persistKey, actions, className }: PropSectionProps) {
+export function PropSection({ title, children, open, defaultOpen = true, onOpenChange, persistKey, summary, actions, className }: PropSectionProps) {
const [inner, setInner] = useState(() => readOpen(persistKey, defaultOpen));
const isOpen = open ?? inner;
const contentId = useId();
@@ -159,7 +166,8 @@ export function PropSection({ title, children, open, defaultOpen = true, onOpenC
<div className="ui-prop-section__header">
<button type="button" className="ui-prop-section__toggle" aria-expanded={isOpen} aria-controls={contentId} onClick={toggle}>
<ChevronDown size={12} aria-hidden="true" className="ui-prop-section__chevron" />
- <span>{title}</span>
+ <span className="ui-prop-section__title">{title}</span>
+ {summary !== undefined && summary !== null && summary !== false && <span className="ui-prop-section__summary">{summary}</span>}
</button>
{actions && <span className="ui-prop-section__actions">{actions}</span>}
</div>
diff --git a/src/styles/controls.css b/src/styles/controls.css
index 2a4598f..e1d300d 100644
--- a/src/styles/controls.css
+++ b/src/styles/controls.css
@@ -153,11 +153,8 @@
color: var(--text-disabled);
}
-.icon-button--active {
- color: var(--accent-on-soft);
- border-color: var(--accent-line);
- background: var(--accent-soft);
-}
+/* A toggle icon button that is on (.icon-button--checked / aria-pressed)
+ takes the shared on-state in ui.css ("Toggle on-state"). */
.icon-button--strong {
border-color: var(--stroke-control);
diff --git a/src/styles/titlebar.css b/src/styles/titlebar.css
index cf59fb2..8297bf0 100644
--- a/src/styles/titlebar.css
+++ b/src/styles/titlebar.css
@@ -174,10 +174,7 @@
right: 5px;
}
-/* A toggle button that is on (the agent pane shown). */
-.icon-button--checked {
- background: var(--fill-subtle-hover);
-}
+/* The Agent toggle's on-state is the shared one (ui.css, "Toggle on-state"). */
.titlebar-separator {
flex: none;
diff --git a/src/styles/ui.css b/src/styles/ui.css
index 83ef814..068d623 100644
--- a/src/styles/ui.css
+++ b/src/styles/ui.css
@@ -652,10 +652,20 @@
========================================================================== */
.ui-prop-section__header {
- height: 28px;
+ height: var(--section-row);
display: flex;
align-items: center;
+ border-top: 1px solid var(--line);
border-bottom: 1px solid var(--line);
+ background: var(--surface-chrome);
+}
+
+/* One line between two headers, not two: a collapsed section's bottom edge
+ is the next header's top edge. The first section in its container sits
+ under a toolbar or item header that already draws a divider. */
+.ui-prop-section:not(.ui-prop-section--open) + .ui-prop-section > .ui-prop-section__header,
+.ui-prop-section:first-child > .ui-prop-section__header {
+ border-top-color: transparent;
}
.ui-prop-section__toggle {
@@ -667,7 +677,7 @@
gap: var(--space-1);
padding: 0 var(--space-2);
border: 0;
- border-radius: var(--radius-sm);
+ border-radius: 0;
color: var(--text-primary);
background: transparent;
font-size: var(--text-xs);
@@ -677,6 +687,25 @@
transition: var(--transition-control);
}
+.ui-prop-section__title {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+/* A count or "1 changed" at the trailing edge, there whether the section is
+ open or not: it is how a collapsed section says what it holds. */
+.ui-prop-section__summary {
+ flex: none;
+ margin-left: auto;
+ padding-left: var(--space-2);
+ color: var(--text-muted);
+ font-weight: var(--weight-regular);
+ font-variant-numeric: tabular-nums;
+ white-space: nowrap;
+}
+
.ui-prop-section__toggle:hover { background: var(--fill-subtle-hover); }
.ui-prop-section__toggle:active { background: var(--fill-subtle-pressed); }
@@ -707,7 +736,7 @@
.ui-prop-row {
min-height: 28px;
display: grid;
- grid-template-columns: 104px minmax(0, 1fr) 20px;
+ grid-template-columns: var(--prop-label) minmax(0, 1fr) 20px;
align-items: center;
column-gap: var(--space-2);
}
@@ -1347,6 +1376,40 @@
place-items: center;
}
+/* Compact: the 24px segmented control a pane toolbar holds its views in.
+ One hairline box on the segmented wash; the selected segment is raised on
+ the control fill and keeps the accent pill, pulled in to the box's edge. */
+.ui-selector-bar--compact {
+ height: var(--control-sm);
+ align-items: stretch;
+ gap: 0;
+ padding: 1px;
+ border: 1px solid var(--stroke-control);
+ border-radius: var(--radius-md);
+ background: var(--wash-1);
+}
+
+.ui-selector-bar--compact .ui-selector-bar__item {
+ min-height: 0;
+ gap: var(--space-1);
+ padding: 0 var(--space-2);
+ border-radius: 3px;
+ font-size: var(--text-xs);
+ line-height: var(--leading-snug);
+}
+
+.ui-selector-bar--compact .ui-selector-bar__item--selected {
+ background: var(--fill-control);
+ box-shadow: 0 0 0 1px var(--stroke-control);
+}
+
+.ui-selector-bar--compact .ui-selector-bar__item--selected::after {
+ bottom: 0;
+ width: 12px;
+ height: 2px;
+ margin-left: -6px;
+}
+
/* ============================================================================
CommandBar
========================================================================== */
@@ -1424,15 +1487,7 @@
color: var(--text-disabled);
}
-.ui-cmd--pressed {
- border-color: var(--accent-line);
- color: var(--accent-on-soft);
- background: var(--accent-soft);
-}
-
-.ui-cmd--pressed:hover:not(:disabled) {
- background: var(--accent-soft-strong);
-}
+/* .ui-cmd--pressed: see "Toggle on-state" below. */
.ui-cmd__icon {
width: 16px;
@@ -1446,12 +1501,19 @@
========================================================================== */
.ui-pane-header {
- min-height: var(--control-md);
+ height: var(--chrome-row);
+ flex: none;
display: flex;
align-items: center;
- justify-content: space-between;
gap: var(--space-2);
padding: 0 var(--space-1) 0 var(--space-3);
+ border-bottom: 1px solid var(--stroke-divider);
+ background: var(--surface-chrome);
+}
+
+/* No title: the views sit where the title would have. */
+.ui-pane-header:not(:has(> .ui-pane-header__title)) {
+ padding-left: var(--space-2);
}
.ui-pane-header__title {
@@ -1467,11 +1529,281 @@
white-space: nowrap;
}
+.ui-pane-header__views {
+ min-width: 0;
+ display: flex;
+ align-items: center;
+ gap: var(--space-2);
+}
+
.ui-pane-header__actions {
flex: none;
display: flex;
align-items: center;
gap: 2px;
+ margin-left: auto;
+}
+
+/* ============================================================================
+ ItemHeader — heads a pane that shows one selected thing
+ ========================================================================== */
+
+.ui-item-header {
+ height: var(--item-header);
+ flex: none;
+ display: flex;
+ align-items: center;
+ gap: var(--space-3);
+ padding: 0 var(--space-1) 0 var(--space-3);
+ border-bottom: 1px solid var(--stroke-divider);
+ background: var(--surface-chrome);
+}
+
+/* The kind chip: the kind's glyph in white on the kind's colour (--item-kind,
+ set from the `color` prop). A custom chip (a thumbnail, a reference's art)
+ fills the same 28px square. */
+.ui-item-header__chip {
+ width: 28px;
+ height: 28px;
+ flex: none;
+ display: grid;
+ place-items: center;
+ overflow: hidden;
+ border-radius: var(--radius-sm);
+ color: var(--on-accent);
+ background: var(--item-kind, var(--panel-3));
+}
+
+.ui-item-header__chip--custom > img,
+.ui-item-header__chip--custom > video {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+
+.ui-item-header__text {
+ flex: 1;
+ min-width: 0;
+ display: grid;
+}
+
+.ui-item-header__name {
+ min-width: 0;
+ margin: 0;
+ overflow: hidden;
+ color: var(--text-primary);
+ font-family: var(--font-sans);
+ font-size: var(--text-base);
+ font-weight: var(--weight-semibold);
+ line-height: var(--leading-normal);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.ui-item-header__name--custom {
+ display: flex;
+ overflow: visible;
+}
+
+/* Rename in place: the input reads as the heading until the mouse or the
+ caret is on it, then shows the text field it is. The 20px height keeps the
+ header at 48px; the negative margin keeps the text where a heading's is. */
+.ui-item-header__input {
+ flex: 1;
+ min-width: 0;
+ height: 20px;
+ margin: 0 0 0 calc(-1 * var(--space-1));
+ padding: 0 var(--space-1);
+ border: 1px solid transparent;
+ border-radius: var(--radius-sm);
+ color: var(--text-primary);
+ background: transparent;
+ font: inherit;
+ transition: var(--transition-control);
+}
+
+.ui-item-header__input:hover:not(:focus) {
+ background: var(--fill-subtle-hover);
+}
+
+.ui-item-header__input:focus {
+ border-color: var(--stroke-control);
+ background: var(--fill-input-focus);
+}
+
+.ui-item-header__meta {
+ min-width: 0;
+ overflow: hidden;
+ color: var(--text-muted);
+ font-size: var(--text-xs);
+ line-height: var(--leading-snug);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.ui-item-header__actions {
+ flex: none;
+ display: flex;
+ align-items: center;
+ gap: 2px;
+}
+
+/* ============================================================================
+ EmptyState — the compact one every pane shares
+ ========================================================================== */
+
+.ui-empty-state {
+ box-sizing: border-box;
+ width: 100%;
+ min-height: 100%;
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: var(--space-6) var(--space-4);
+ text-align: center;
+}
+
+.ui-empty-state__icon {
+ display: grid;
+ place-items: center;
+ margin-bottom: var(--space-3);
+ color: var(--text-muted);
+}
+
+.ui-empty-state__icon > svg {
+ width: 32px;
+ height: 32px;
+}
+
+.ui-empty-state__title {
+ margin: 0;
+ color: var(--text-primary);
+ font-size: var(--text-base);
+ font-weight: var(--weight-semibold);
+ line-height: var(--leading-normal);
+}
+
+.ui-empty-state__description {
+ max-width: 36ch;
+ margin: var(--space-1) 0 0;
+ color: var(--text-muted);
+ font-size: var(--text-xs);
+ line-height: var(--leading-snug);
+}
+
+.ui-empty-state__action {
+ margin-top: var(--space-4);
+}
+
+/* ============================================================================
+ Selectable item — one rule for list rows, tiles and cards
+ ----------------------------------------------------------------------------
+ Anything the user picks from a set (a scene card, a media card, a shot, a
+ reference tile, a project card) takes `.ui-selectable` and states its
+ selection as aria-selected="true" (listbox / grid options),
+ aria-pressed="true" (toggle-button cards) or `.is-selected`:
+
+ rest transparent
+ hover --fill-subtle-hover
+ selected --accent-soft (one step stronger under the mouse), plus the
+ Fluent 3×16 accent pill at the inline start, like NavItem's
+
+ The pill is a ::before, so the element must not use ::before itself; it is
+ positioned against the element (position: relative is set here).
+ `--separated` adds the --line under a list row. `--card` is for a card
+ with its own stroke and art, where a pill would sit on the thumbnail: the
+ selected card gets an accent ring on its edge instead of the pill. */
+
+.ui-selectable {
+ position: relative;
+ background: transparent;
+ transition: var(--transition-control);
+}
+
+.ui-selectable--separated {
+ border-bottom: 1px solid var(--line);
+}
+
+.ui-selectable:hover {
+ background: var(--fill-subtle-hover);
+}
+
+.ui-selectable.is-selected,
+.ui-selectable[aria-selected="true"],
+.ui-selectable[aria-pressed="true"] {
+ background: var(--accent-soft);
+}
+
+.ui-selectable.is-selected:hover,
+.ui-selectable[aria-selected="true"]:hover,
+.ui-selectable[aria-pressed="true"]:hover {
+ background: var(--accent-soft-strong);
+}
+
+.ui-selectable:not(.ui-selectable--card).is-selected::before,
+.ui-selectable:not(.ui-selectable--card)[aria-selected="true"]::before,
+.ui-selectable:not(.ui-selectable--card)[aria-pressed="true"]::before {
+ content: "";
+ position: absolute;
+ inset-inline-start: 0;
+ top: 50%;
+ width: 3px;
+ height: 16px;
+ margin-top: -8px;
+ border-radius: var(--radius-pill);
+ background: var(--accent);
+ pointer-events: none;
+}
+
+.ui-selectable--card.is-selected,
+.ui-selectable--card[aria-selected="true"],
+.ui-selectable--card[aria-pressed="true"] {
+ border-color: var(--accent);
+ box-shadow: inset 0 0 0 1px var(--accent);
+}
+
+/* ============================================================================
+ Toggle on-state — one look for every on/off button
+ ----------------------------------------------------------------------------
+ A toggle that is on (the agent pane shown, safe areas visible, a
+ CommandBarButton with `pressed`) wears the accent tint: --accent-soft fill
+ and the readable accent on its icon, one step stronger under the mouse.
+ Give the button aria-pressed and one of: .icon-button--checked (or just
+ aria-pressed="true" on an .icon-button), .ui-cmd--pressed (CommandBarButton
+ does it), or `.ui-toggle-button` on any other button. An on button stays
+ tinted under the mouse instead of falling back to the neutral hover, which
+ is what made the old pressed fill look fainter than hover. */
+
+.ui-cmd--pressed,
+.ui-cmd[aria-pressed="true"],
+.icon-button.icon-button--checked,
+.icon-button[aria-pressed="true"],
+.ui-toggle-button[aria-pressed="true"],
+.ui-toggle-button.is-checked {
+ color: var(--accent-bright);
+ background: var(--accent-soft);
+}
+
+.ui-cmd--pressed:hover:not(:disabled),
+.ui-cmd[aria-pressed="true"]:hover:not(:disabled),
+.icon-button.icon-button--checked:hover:not(:disabled),
+.icon-button[aria-pressed="true"]:hover:not(:disabled),
+.ui-toggle-button[aria-pressed="true"]:hover:not(:disabled),
+.ui-toggle-button.is-checked:hover:not(:disabled) {
+ color: var(--accent-bright);
+ background: var(--accent-soft-strong);
+}
+
+.ui-cmd--pressed:active:not(:disabled),
+.ui-cmd[aria-pressed="true"]:active:not(:disabled),
+.icon-button.icon-button--checked:active:not(:disabled),
+.icon-button[aria-pressed="true"]:active:not(:disabled),
+.ui-toggle-button[aria-pressed="true"]:active:not(:disabled),
+.ui-toggle-button.is-checked:active:not(:disabled) {
+ color: var(--accent-bright);
+ background: var(--accent-soft);
}
/* ============================================================================
@@ -1682,15 +2014,16 @@
========================================================================== */
.ui-statusbar {
- min-height: var(--control-sm);
+ min-height: var(--chrome-row-sm);
+ flex: none;
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-4);
padding: 0 var(--space-3);
- border-top: 1px solid var(--line);
+ border-top: 1px solid var(--stroke-divider);
color: var(--text-secondary);
- background: var(--layer);
+ background: var(--surface-chrome);
font-size: var(--text-xs);
line-height: var(--leading-snug);
}