Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

Rebuild the Text panel on the wc-ui-rnd inspector

Jareer8938ec34fbc2
diff --git a/desktop/package-lock.json b/desktop/package-lock.json
index e0fb1b4c..94ac7130 100644
--- a/desktop/package-lock.json
+++ b/desktop/package-lock.json
@@ -9,6 +9,7 @@
"version": "0.2.0",
"license": "MPL-2.0",
"dependencies": {
+ "@fontsource-variable/inter": "^5.3.0",
"@heroicons/react": "^2.2.0",
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-dialog": "^2.7.2",
@@ -1111,6 +1112,15 @@
}
}
},
+ "node_modules/@fontsource-variable/inter": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/@fontsource-variable/inter/-/inter-5.3.0.tgz",
+ "integrity": "sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==",
+ "license": "OFL-1.1",
+ "funding": {
+ "url": "https://github.com/sponsors/ayuhito"
+ }
+ },
"node_modules/@heroicons/react": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.2.0.tgz",
diff --git a/desktop/package.json b/desktop/package.json
index 3aba2d83..74879ba5 100644
--- a/desktop/package.json
+++ b/desktop/package.json
@@ -15,6 +15,7 @@
"lint": "eslint ."
},
"dependencies": {
+ "@fontsource-variable/inter": "^5.3.0",
"@heroicons/react": "^2.2.0",
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-dialog": "^2.7.2",
diff --git a/desktop/src/components/RightPanel.tsx b/desktop/src/components/RightPanel.tsx
index 9a0e06cc..73918650 100644
--- a/desktop/src/components/RightPanel.tsx
+++ b/desktop/src/components/RightPanel.tsx
@@ -14,6 +14,7 @@ import { AdjustPanel } from "./AdjustPanel";
import { EffectsPanel } from "./EffectsPanel";
import { FiltersPanel } from "./FiltersPanel";
import { Inspector } from "./Inspector";
+import inspector from "./inspector/inspector.module.css";
import { Panel } from "./Panel";
import { TextPanel } from "./TextPanel";
@@ -118,7 +119,14 @@ export const RightPanel = memo(function RightPanel({
const single = tabs.length === 1;
return (
- <Panel title={single ? t(tabs[0].labelKey) : undefined}>
+ // The Text tab is the first panel on the new inspector chrome, which brings
+ // its own palette rather than borrowing this app's. `inspector.shell` hands
+ // that palette to the heading strip above it too, so the panel is one
+ // surface instead of a light header sitting on a near-black body.
+ <Panel
+ title={single ? t(tabs[0].labelKey) : undefined}
+ className={active === "text" ? inspector.shell : ""}
+ >
{!single && (
<div className="sticky top-0 z-10 border-b border-hairline bg-panel px-2 pb-2 pt-2">
<div className="flex rounded-lg bg-sunken p-0.5">
diff --git a/desktop/src/components/TextPanel.tsx b/desktop/src/components/TextPanel.tsx
index d21f61d6..d9ecbf62 100644
--- a/desktop/src/components/TextPanel.tsx
+++ b/desktop/src/components/TextPanel.tsx
@@ -1,8 +1,21 @@
+import { useState } from "react";
+
import type { Clip, CustomFont } from "../lib/editor";
import { t, useLocale } from "../lib/i18n";
-import { FONTS, WEIGHTS, type TextStyle } from "../lib/text";
-import { Group, Slider, Toggle } from "./controls";
+import { FONTS, textCss, WEIGHTS, type TextStyle } from "../lib/text";
import { Icon } from "./Icon";
+import { clamp } from "./inspector/base";
+import {
+ ColourField,
+ HelpButton,
+ Note,
+ Param,
+ Row,
+ Section,
+ SwitchRow,
+} from "./inspector/controls";
+import { SegmentedControl, Select, type SelectOption } from "./inspector/fields";
+import styles from "./inspector/inspector.module.css";
import { Empty } from "./Panel";
/**
@@ -15,7 +28,29 @@ import { Empty } from "./Panel";
*
* The preview overlay and the export rasteriser both read these numbers
* through `textCss`, so what is on screen is what gets burned in.
+ *
+ * This is the first panel on the new inspector chrome in `./inspector`:
+ * hairline sections instead of shouty group headings, faders paired with a
+ * scrubbable field, and a specimen of the title pinned to the top. The
+ * settings and their bounds are unchanged - only the way they are handled is.
+ */
+
+/** Bounds shared with the monitor's corner drag; see Preview.tsx. */
+const MIN_FONT_SIZE = 0.02;
+const MAX_FONT_SIZE = 0.4;
+
+/*
+ * The specimen's scale.
+ *
+ * A fraction of the frame height means nothing in a 62px strip, so the sample
+ * reads the size against a nominal surface and then holds the result to
+ * something legible. The monitor beside this panel is the truth for scale and
+ * placement; the specimen is here to judge face, weight, colour and outline.
*/
+const SAMPLE_SURFACE = 190;
+const SAMPLE_MIN = 11;
+const SAMPLE_MAX = 34;
+
export function TextPanel({
clip,
fonts,
@@ -35,6 +70,8 @@ export function TextPanel({
onRemoveFont: (family: string) => void;
}) {
const { t } = useLocale();
+ const [shadowHelp, setShadowHelp] = useState(false);
+ const [plateHelp, setPlateHelp] = useState(false);
if (!clip || clip.kind !== "text" || !clip.text) {
return (
@@ -57,121 +94,134 @@ export function TextPanel({
);
};
- // Discrete controls commit immediately; sliders and the textarea echo
- // live and commit on release or blur.
+ // Discrete controls commit immediately; faders and the textarea echo live
+ // and commit on release or blur.
const commitSet = (patch: Partial<TextStyle>) => {
set(patch);
onCommit();
};
- const custom: CustomFont[] = fonts;
+ const commitClip = (patch: Partial<Clip>) => {
+ onChange(patch);
+ onCommit();
+ };
+
+ const families: SelectOption<string>[] = [
+ ...FONTS.filter((font) => font.bundled).map((font) => ({
+ value: font.value,
+ label: font.label,
+ group: t("textPanel.bundled"),
+ fontFamily: font.value,
+ })),
+ ...fonts.map((font) => ({
+ value: `"${font.family}"`,
+ label: font.family,
+ note: font.missing ? t("textPanel.fileMissing") : undefined,
+ group: t("textPanel.yours"),
+ // A missing face has nothing to draw itself in, so its row stays in the
+ // panel's own type rather than silently borrowing the fallback's.
+ fontFamily: font.missing ? undefined : `"${font.family}"`,
+ })),
+ ...FONTS.filter((font) => !font.bundled).map((font) => ({
+ value: font.value,
+ label: font.label,
+ group: t("textPanel.system"),
+ fontFamily: font.value,
+ })),
+ ];
+
+ // The specimen is scaled to be readable rather than true, so the plate and
+ // the outline - which `textCss` derives from the size - stay in proportion
+ // to what is drawn instead of to the frame.
+ const samplePx = clamp(style.fontSize * SAMPLE_SURFACE, SAMPLE_MIN, SAMPLE_MAX);
+ const sample = textCss(style, samplePx / Math.max(style.fontSize, 0.001));
return (
- <div className="px-3 py-3">
- <Group title={t("textPanel.content")}>
- <textarea
- value={style.content}
- onChange={(event) => set({ content: event.target.value })}
- onBlur={onCommit}
- rows={3}
- spellCheck={false}
- placeholder={t("textPanel.placeholder")}
- className="mb-3 w-full resize-y rounded-lg border border-hairline-strong bg-sunken px-2.5
- py-2 text-[13px] leading-snug text-primary outline-none
- placeholder:text-tertiary focus:border-accent"
- />
- </Group>
+ <div className={styles.kit}>
+ <div
+ className={styles.sample}
+ style={{
+ justifyContent:
+ style.align === "left" ? "flex-start" : style.align === "right" ? "flex-end" : "center",
+ }}
+ >
+ {style.content.trim() === "" ? (
+ <span className={styles.samplePlaceholder}>{t("textPanel.placeholder")}</span>
+ ) : (
+ <span
+ className={styles.sampleText}
+ style={{ ...sample, display: "inline-block", whiteSpace: "nowrap" }}
+ >
+ {style.content}
+ </span>
+ )}
+ </div>
- <Group title={t("textPanel.font")}>
- <select
- value={style.fontFamily}
- onChange={(event) => commitSet({ fontFamily: event.target.value })}
- className="mb-2 w-full cursor-pointer rounded-lg border border-hairline-strong bg-sunken
- px-2.5 py-2 text-[12px] text-primary outline-none focus:border-accent"
- >
- <optgroup label={t("textPanel.bundled")}>
- {FONTS.filter((font) => font.bundled).map((font) => (
- <option key={font.value} value={font.value}>
- {font.label}
- </option>
- ))}
- </optgroup>
- {custom.length > 0 && (
- <optgroup label={t("textPanel.yours")}>
- {custom.map((font) => (
- <option key={font.family} value={`"${font.family}"`}>
- {font.family}
- {font.missing ? ` ${t("textPanel.fileMissing")}` : ""}
- </option>
- ))}
- </optgroup>
- )}
- <optgroup label={t("textPanel.system")}>
- {FONTS.filter((font) => !font.bundled).map((font) => (
- <option key={font.value} value={font.value}>
- {font.label}
- </option>
- ))}
- </optgroup>
- </select>
+ <Section title={t("textPanel.content")}>
+ <Row stack>
+ <textarea
+ className={styles.textarea}
+ value={style.content}
+ spellCheck={false}
+ aria-label={t("textPanel.content")}
+ placeholder={t("textPanel.placeholder")}
+ onChange={(event) => set({ content: event.target.value })}
+ onBlur={onCommit}
+ />
+ </Row>
+ </Section>
- <button
- type="button"
- onClick={onAddFont}
- className="mb-3 flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg
- border border-dashed border-hairline-strong px-3 py-2 text-[11px]
- text-secondary transition-colors hover:border-accent hover:bg-hover
- hover:text-primary"
- >
- <Icon name="import" size={12} />
- {t("textPanel.addFontFile")}
- </button>
+ <Section title={t("textPanel.font")}>
+ <Row stack>
+ <Select
+ options={families}
+ value={style.fontFamily}
+ onChange={(fontFamily) => commitSet({ fontFamily })}
+ aria-label={t("textPanel.font")}
+ />
+ </Row>
- {custom.length > 0 && (
- <ul className="mb-3 space-y-1">
- {custom.map((font) => (
- <li
- key={font.family}
- className="flex items-center gap-2 rounded-md px-2 py-1 text-[11px] hover:bg-hover"
- >
- <span
- className="min-w-0 flex-1 truncate text-secondary"
- style={{ fontFamily: `"${font.family}"` }}
- title={font.path}
- >
- {font.family}
- </span>
- <button
- type="button"
- aria-label={t("textPanel.removeFont", { name: font.family })}
- onClick={() => onRemoveFont(font.family)}
- className="shrink-0 cursor-pointer text-tertiary hover:text-danger"
- >
- <Icon name="close" size={11} />
- </button>
- </li>
- ))}
- </ul>
- )}
+ <Row stack>
+ <button type="button" className={styles.dashed} onClick={onAddFont}>
+ <Icon name="import" size={12} />
+ {t("textPanel.addFontFile")}
+ </button>
+ </Row>
- <select
- value={style.fontWeight}
- onChange={(event) => commitSet({ fontWeight: Number(event.target.value) })}
- className="mb-3 w-full cursor-pointer rounded-lg border border-hairline-strong bg-sunken
- px-2.5 py-2 text-[12px] text-primary outline-none focus:border-accent"
- >
- {WEIGHTS.map((weight) => (
- <option key={weight.value} value={weight.value}>
- {weight.label}
- </option>
- ))}
- </select>
+ {fonts.map((font) => (
+ <div key={font.family} className={styles.fontRow}>
+ <span
+ className={styles.fontName}
+ style={{ fontFamily: font.missing ? undefined : `"${font.family}"` }}
+ title={font.path}
+ >
+ {font.family}
+ </span>
+ <button
+ type="button"
+ className={styles.fontRemove}
+ aria-label={t("textPanel.removeFont", { name: font.family })}
+ onClick={() => onRemoveFont(font.family)}
+ >
+ <Icon name="close" size={11} />
+ </button>
+ </div>
+ ))}
- <Slider
+ <Row stack>
+ <Select
+ options={WEIGHTS}
+ value={style.fontWeight}
+ onChange={(fontWeight) => commitSet({ fontWeight })}
+ aria-label={t("textPanel.weight")}
+ />
+ </Row>
+
+ <Param
label={t("textPanel.size")}
value={style.fontSize}
- min={0.02}
- max={0.4}
+ min={MIN_FONT_SIZE}
+ max={MAX_FONT_SIZE}
step={0.005}
// Shown as a share of frame height, which is the thing it actually
// is. Points would be a lie: the frame can be any resolution.
@@ -181,55 +231,71 @@ export function TextPanel({
onReset={() => commitSet({ fontSize: 0.09 })}
/>
- <Toggle
+ <SwitchRow
label={t("textPanel.italic")}
checked={style.italic}
onChange={(italic) => commitSet({ italic })}
/>
- </Group>
+ </Section>
- <Group title={t("textPanel.colour")}>
- <Swatch
+ <Section title={t("textPanel.colour")}>
+ <ColourField
label={t("textPanel.fill")}
value={style.color}
onChange={(color) => commitSet({ color })}
/>
- <Slider
+ <Param
label={t("textPanel.opacity")}
value={style.opacity}
min={0}
max={1}
+ step={0.01}
format={(value) => `${Math.round(value * 100)}%`}
onChange={(opacity) => set({ opacity })}
onCommit={onCommit}
onReset={() => commitSet({ opacity: 1 })}
/>
- <Toggle
+ <SwitchRow
label={t("textPanel.dropShadow")}
- hint={t("textPanel.dropShadowHint")}
checked={style.shadow}
onChange={(shadow) => commitSet({ shadow })}
+ help={
+ <HelpButton
+ label={t("textPanel.about", { name: t("textPanel.dropShadow") })}
+ open={shadowHelp}
+ onToggle={() => setShadowHelp((on) => !on)}
+ />
+ }
/>
+ {shadowHelp && <Note>{t("textPanel.dropShadowHint")}</Note>}
- <Toggle
+ <SwitchRow
label={t("textPanel.plate")}
- hint={t("textPanel.plateHint")}
checked={style.background !== ""}
onChange={(on) => commitSet({ background: on ? "#000000" : "" })}
+ help={
+ <HelpButton
+ label={t("textPanel.about", { name: t("textPanel.plate") })}
+ open={plateHelp}
+ onToggle={() => setPlateHelp((on) => !on)}
+ />
+ }
/>
+ {plateHelp && <Note>{t("textPanel.plateHint")}</Note>}
{style.background !== "" && (
- <Swatch
- label={t("textPanel.plateColour")}
+ <ColourField
+ label={t("textPanel.colour")}
+ name={t("textPanel.plateColour")}
value={style.background}
onChange={(background) => commitSet({ background })}
/>
)}
- </Group>
+ </Section>
- <Group title={t("textPanel.outline")}>
- <Slider
+ <Section title={t("textPanel.outline")}>
+ <Param
label={t("textPanel.width")}
value={style.strokeWidth}
min={0}
@@ -241,41 +307,30 @@ export function TextPanel({
onReset={() => commitSet({ strokeWidth: 0 })}
/>
{style.strokeWidth > 0 && (
- <Swatch
- label={t("textPanel.outlineColour")}
+ <ColourField
+ label={t("textPanel.colour")}
+ name={t("textPanel.outlineColour")}
value={style.strokeColor}
onChange={(strokeColor) => commitSet({ strokeColor })}
/>
)}
- </Group>
+ </Section>
- <Group title={t("textPanel.layout")}>
- <div className="mb-3 flex rounded-lg bg-sunken p-0.5">
- {(["left", "center", "right"] as const).map((align) => (
- <button
- key={align}
- type="button"
- aria-pressed={style.align === align}
- onClick={() => commitSet({ align })}
- className={`flex-1 cursor-pointer rounded-[6px] px-2 py-1 text-[11px] capitalize
- transition-colors ${
- style.align === align
- ? "bg-panel text-primary shadow-[0_1px_2px_rgba(0,0,0,0.14)]"
- : "text-secondary hover:text-primary"
- }`}
- >
- {t(
- align === "left"
- ? "textPanel.alignLeft"
- : align === "center"
- ? "textPanel.alignCenter"
- : "textPanel.alignRight",
- )}
- </button>
- ))}
- </div>
+ <Section title={t("textPanel.layout")}>
+ <Row stack>
+ <SegmentedControl
+ options={[
+ { value: "left" as const, label: t("textPanel.alignLeft") },
+ { value: "center" as const, label: t("textPanel.alignCenter") },
+ { value: "right" as const, label: t("textPanel.alignRight") },
+ ]}
+ value={style.align}
+ onChange={(align) => commitSet({ align })}
+ aria-label={t("textPanel.layout")}
+ />
+ </Row>
- <Slider
+ <Param
label={t("textPanel.lineHeight")}
value={style.lineHeight}
min={0.8}
@@ -287,7 +342,7 @@ export function TextPanel({
onReset={() => commitSet({ lineHeight: 1.2 })}
/>
- <Slider
+ <Param
label={t("textPanel.tracking")}
value={style.tracking}
min={-0.1}
@@ -298,84 +353,43 @@ export function TextPanel({
onCommit={onCommit}
onReset={() => commitSet({ tracking: 0 })}
/>
- </Group>
+ </Section>
- <Group title={t("textPanel.position")}>
- {/*
- Offsets are fractions of the frame, and centred is zero - so the
- reset on each is "put it back in the middle", and a title composed
- here sits in the same place at any export resolution.
- */}
- <Slider
+ {/*
+ Offsets are fractions of the frame, and centred is zero - so the reset
+ on each is "put it back in the middle", and a title composed here sits
+ in the same place at any export resolution.
+ */}
+ <Section title={t("textPanel.position")}>
+ <Param
label={t("textPanel.horizontal")}
value={clip.offsetX}
min={-0.5}
max={0.5}
step={0.005}
- format={(value) =>
- Math.abs(value) < 0.0025 ? t("textPanel.centred") : `${(value * 100).toFixed(1)}%`
- }
+ format={centred}
onChange={(offsetX) => onChange({ offsetX })}
onCommit={onCommit}
- onReset={() => { onChange({ offsetX: 0 }); onCommit(); }}
+ onReset={() => commitClip({ offsetX: 0 })}
/>
- <Slider
+ <Param
label={t("textPanel.vertical")}
value={clip.offsetY}
min={-0.5}
max={0.5}
step={0.005}
- format={(value) =>
- Math.abs(value) < 0.0025 ? t("textPanel.centred") : `${(value * 100).toFixed(1)}%`
- }
+ format={centred}
onChange={(offsetY) => onChange({ offsetY })}
onCommit={onCommit}
- onReset={() => { onChange({ offsetY: 0 }); onCommit(); }}
+ onReset={() => commitClip({ offsetY: 0 })}
/>
- </Group>
+ </Section>
</div>
);
}
-/** A colour well plus its hex, because one of the two is always the faster way. */
-function Swatch({
- label,
- value,
- onChange,
-}: {
- label: string;
- value: string;
- onChange: (value: string) => void;
-}) {
- return (
- <div className="mb-3 flex items-center justify-between gap-3">
- <span className="text-[12px] text-primary">{label}</span>
- <span className="flex items-center gap-2">
- <input
- type="text"
- value={value}
- spellCheck={false}
- onChange={(event) => {
- const next = event.target.value;
- // Only commit a complete colour: repainting on "#f" would flash
- // the title black on the way to "#ff0000".
- if (/^#[0-9a-f]{6}$/i.test(next) || /^#[0-9a-f]{3}$/i.test(next)) onChange(next);
- }}
- className="w-[76px] rounded-md border border-hairline-strong bg-sunken px-1.5 py-1
- text-right font-technical text-[11px] text-secondary outline-none
- focus:border-accent"
- />
- <input
- type="color"
- value={value}
- onChange={(event) => onChange(event.target.value)}
- aria-label={label}
- className="h-[26px] w-[34px] cursor-pointer rounded-md border border-hairline-strong
- bg-transparent p-0.5"
- />
- </span>
- </div>
- );
+function centred(value: number): string {
+ return Math.abs(value) < 0.0025 ? t("textPanel.centred") : `${(value * 100).toFixed(1)}%`;
}
function firstLineOf(content: string): string {
diff --git a/desktop/src/components/inspector/base.ts b/desktop/src/components/inspector/base.ts
new file mode 100644
index 00000000..387a8610
--- /dev/null
+++ b/desktop/src/components/inspector/base.ts
@@ -0,0 +1,153 @@
+import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
+import type { PointerEvent as ReactPointerEvent } from "react";
+
+/**
+ * The plumbing under the inspector controls: class joining, number hygiene,
+ * and the one drag gesture every scrubbing control in the panel shares.
+ *
+ * Ported from the wc-ui-rnd design study alongside `inspector.module.css`.
+ * Nothing here knows about clips or the engine - these are the parts a Fader
+ * and a NumberField would need in any application.
+ */
+
+export const cx = (...parts: Array<string | false | null | undefined>): string =>
+ parts.filter(Boolean).join(" ");
+
+export const clamp = (value: number, min: number, max: number): number =>
+ Math.min(max, Math.max(min, value));
+
+export const roundTo = (value: number, decimals: number): number =>
+ Number(value.toFixed(clamp(decimals, 0, 12)));
+
+/** Decimals present in a literal step, so `step={0.005}` implies 3 digits. */
+export const decimalsOf = (step: number): number => {
+ const [, fraction = ""] = String(step).split(".");
+ return fraction.length;
+};
+
+export interface DragInfo {
+ /** Pointer travel since pointerdown, in px. */
+ dx: number;
+ dy: number;
+ /** Current viewport position, in px. */
+ x: number;
+ y: number;
+ shiftKey: boolean;
+ altKey: boolean;
+ /** Flips true once the pointer passes `threshold` - tells a click from a drag. */
+ moved: boolean;
+}
+
+export interface PointerDragOptions {
+ onStart?: (info: DragInfo) => void;
+ onMove?: (info: DragInfo) => void;
+ onEnd?: (info: DragInfo) => void;
+ /** Px of travel before the gesture counts as a drag. Default 3. */
+ threshold?: number;
+ /** Cursor forced on the document while the gesture is live. */
+ cursor?: string;
+ disabled?: boolean;
+}
+
+/**
+ * The drag gesture shared by every scrubbing control.
+ *
+ * Pointer capture keeps the stream alive when the pointer leaves the element
+ * or the window, which is what lets a fader keep tracking once you have run
+ * off the end of it. Returns the `onPointerDown` handler for the drag surface.
+ */
+export function usePointerDrag(options: PointerDragOptions) {
+ // Latest-ref, so the handler installed on pointerdown always calls the
+ // current callbacks rather than the ones captured when the drag began.
+ const latest = useRef(options);
+ latest.current = options;
+
+ const teardown = useRef<(() => void) | null>(null);
+ useEffect(() => () => teardown.current?.(), []);
+
+ return useCallback((event: ReactPointerEvent<Element>) => {
+ const { disabled, threshold = 3, cursor } = latest.current;
+ if (disabled || event.button !== 0) return;
+
+ // React reuses the event object's currentTarget after the handler returns.
+ const target = event.currentTarget;
+ const { pointerId } = event;
+ const startX = event.clientX;
+ const startY = event.clientY;
+ let moved = false;
+
+ teardown.current?.();
+ target.setPointerCapture(pointerId);
+
+ const previousCursor = document.body.style.cursor;
+ const previousSelect = document.body.style.userSelect;
+ if (cursor) document.body.style.cursor = cursor;
+ document.body.style.userSelect = "none";
+
+ const info = (moveEvent: PointerEvent): DragInfo => ({
+ dx: moveEvent.clientX - startX,
+ dy: moveEvent.clientY - startY,
+ x: moveEvent.clientX,
+ y: moveEvent.clientY,
+ shiftKey: moveEvent.shiftKey,
+ altKey: moveEvent.altKey,
+ moved,
+ });
+
+ const handleMove = (moveEvent: PointerEvent) => {
+ if (!moved && Math.hypot(moveEvent.clientX - startX, moveEvent.clientY - startY) > threshold) {
+ moved = true;
+ }
+ latest.current.onMove?.(info(moveEvent));
+ };
+
+ const handleEnd = (endEvent: PointerEvent) => {
+ const final = info(endEvent);
+ teardown.current?.();
+ latest.current.onEnd?.(final);
+ };
+
+ teardown.current = () => {
+ window.removeEventListener("pointermove", handleMove);
+ window.removeEventListener("pointerup", handleEnd);
+ window.removeEventListener("pointercancel", handleEnd);
+ document.body.style.cursor = previousCursor;
+ document.body.style.userSelect = previousSelect;
+ if (target.hasPointerCapture(pointerId)) target.releasePointerCapture(pointerId);
+ teardown.current = null;
+ };
+
+ window.addEventListener("pointermove", handleMove);
+ window.addEventListener("pointerup", handleEnd);
+ window.addEventListener("pointercancel", handleEnd);
+
+ latest.current.onStart?.({
+ dx: 0,
+ dy: 0,
+ x: startX,
+ y: startY,
+ shiftKey: event.shiftKey,
+ altKey: event.altKey,
+ moved: false,
+ });
+ }, []);
+}
+
+/** Measures an element's content box, for geometry that has to match the DOM. */
+export function useElementSize<T extends HTMLElement>() {
+ const ref = useRef<T>(null);
+ const [size, setSize] = useState({ width: 0, height: 0 });
+
+ useLayoutEffect(() => {
+ const element = ref.current;
+ if (!element) return;
+ const observer = new ResizeObserver((entries) => {
+ const rect = entries[0]?.contentRect;
+ if (rect) setSize({ width: rect.width, height: rect.height });
+ });
+ observer.observe(element);
+ return () => observer.disconnect();
+ }, []);
+
+ return [ref, size] as const;
+}
diff --git a/desktop/src/components/inspector/controls.tsx b/desktop/src/components/inspector/controls.tsx
new file mode 100644
index 00000000..eb0375a8
--- /dev/null
+++ b/desktop/src/components/inspector/controls.tsx
@@ -0,0 +1,362 @@
+import { useRef, useState } from "react";
+import type { KeyboardEvent, ReactNode } from "react";
+
+import { useLocale } from "../../lib/i18n";
+import { clamp, cx, decimalsOf, roundTo, usePointerDrag } from "./base";
+import { NumberField } from "./fields";
+import styles from "./inspector.module.css";
+
+/**
+ * The inspector's repeating parts: a section, a row, a fader, the parameter
+ * that pairs the two, a switch, a help disclosure and a colour well.
+ *
+ * Ported from the wc-ui-rnd design study and wired to this app's editing
+ * contract: `onChange` echoes live while a gesture is in flight, `onCommit`
+ * ends it and turns everything echoed into a single engine command. A control
+ * that changes without ever committing leaves the edit local, so every path
+ * out of a gesture here ends in a commit.
+ */
+
+/* ── section and row ──────────────────────────────────────────────────────── */
+
+export function Section({ title, children }: { title: string; children: ReactNode }) {
+ return (
+ <div className={styles.section}>
+ <div className={styles.sectionHeader}>
+ <span className={styles.sectionTitle}>{title}</span>
+ </div>
+ <div className={styles.sectionBody}>{children}</div>
+ </div>
+ );
+}
+
+export function Row({
+ label,
+ stack = false,
+ children,
+}: {
+ label?: string;
+ /** Stack the controls instead of laying them out in one line. */
+ stack?: boolean;
+ children: ReactNode;
+}) {
+ return (
+ <div className={styles.row}>
+ {label !== undefined && <span className={styles.rowLabel}>{label}</span>}
+ <div className={cx(styles.controls, stack && styles.stacked)}>{children}</div>
+ </div>
+ );
+}
+
+/* ── fader ────────────────────────────────────────────────────────────────── */
+
+/** Horizontal fader. Click to jump, drag to ride, double-click to reset. */
+export function Fader({
+ value,
+ onChange,
+ onCommit,
+ onReset,
+ min,
+ max,
+ step,
+ valueText,
+ "aria-label": ariaLabel,
+}: {
+ value: number;
+ onChange: (value: number) => void;
+ onCommit?: () => void;
+ /** Double-click restores this. Omitted means double-click does nothing. */
+ onReset?: () => void;
+ min: number;
+ max: number;
+ step: number;
+ /** What a screen reader says instead of the bare number. */
+ valueText?: string;
+ "aria-label"?: string;
+}) {
+ const track = useRef<HTMLDivElement>(null);
+ const digits = decimalsOf(step);
+ const span = max - min || 1;
+
+ const settle = (next: number) => onChange(roundTo(clamp(next, min, max), digits));
+
+ // The rail is inset from the track by the border plus 2px. Measuring against
+ // the rail rather than the track is what puts the cap under the pointer at
+ // both ends instead of a few px short of them.
+ const INSET = 3;
+ const applyAt = (clientX: number) => {
+ const rect = track.current?.getBoundingClientRect();
+ if (!rect) return;
+ const usable = rect.width - INSET * 2;
+ if (usable <= 0) return;
+ settle(min + clamp((clientX - rect.left - INSET) / usable, 0, 1) * span);
+ };
+
+ const beginDrag = usePointerDrag({
+ threshold: 0,
+ cursor: "ew-resize",
+ onStart: ({ x }) => applyAt(x),
+ onMove: ({ x }) => applyAt(x),
+ onEnd: () => onCommit?.(),
+ });
+
+ const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
+ // Same modifier grammar as the number field: shift coarsens, alt refines.
+ const scale = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;
+ const moves: Record<string, number> = {
+ ArrowRight: step * scale,
+ ArrowUp: step * scale,
+ ArrowLeft: -step * scale,
+ ArrowDown: -step * scale,
+ PageUp: step * 10,
+ PageDown: -step * 10,
+ };
+ if (event.key === "Home") {
+ event.preventDefault();
+ settle(min);
+ } else if (event.key === "End") {
+ event.preventDefault();
+ settle(max);
+ } else if (event.key in moves) {
+ event.preventDefault();
+ settle(value + (moves[event.key] ?? 0));
+ }
+ };
+
+ const percent = clamp((value - min) / span, 0, 1) * 100;
+
+ return (
+ <div
+ ref={track}
+ className={styles.fader}
+ role="slider"
+ tabIndex={0}
+ aria-label={ariaLabel}
+ aria-valuenow={value}
+ aria-valuemin={min}
+ aria-valuemax={max}
+ aria-valuetext={valueText}
+ onPointerDown={beginDrag}
+ onKeyDown={onKeyDown}
+ // One commit per burst of keys, on release, for the same reason a drag
+ // commits once: undo should step over the adjustment, not through it.
+ onKeyUp={() => onCommit?.()}
+ onDoubleClick={onReset}
+ >
+ <div className={styles.rail}>
+ <span className={styles.fill} style={{ width: `${percent}%` }} />
+ <span
+ className={styles.cap}
+ style={{ left: `${percent}%`, transform: `translateX(-${percent}%)` }}
+ />
+ </div>
+ </div>
+ );
+}
+
+/* ── parameter ────────────────────────────────────────────────────────────── */
+
+/**
+ * The panel's repeating unit: a name and its value in the unit a person thinks
+ * in, over a fader and the raw number. Two ways to the same value - ride the
+ * fader for a feel, scrub or type the field for a figure.
+ */
+export function Param({
+ label,
+ value,
+ onChange,
+ onCommit,
+ onReset,
+ min,
+ max,
+ step,
+ format,
+ help,
+}: {
+ label: string;
+ value: number;
+ onChange: (value: number) => void;
+ onCommit?: () => void;
+ onReset?: () => void;
+ min: number;
+ max: number;
+ step: number;
+ /** The readout beside the label: the value in the unit a person thinks in. */
+ format: (value: number) => string;
+ help?: ReactNode;
+}) {
+ const { t } = useLocale();
+ const text = format(value);
+
+ return (
+ <Row stack>
+ <div className={styles.head}>
+ <span className={styles.labelGroup}>
+ <span
+ className={cx(styles.label, onReset && styles.resettable)}
+ title={onReset ? t("controls.resetHint") : undefined}
+ onDoubleClick={onReset}
+ >
+ {label}
+ </span>
+ {help}
+ </span>
+ <span className={styles.readout}>{text}</span>
+ </div>
+ <div className={styles.body}>
+ <Fader
+ value={value}
+ onChange={onChange}
+ onCommit={onCommit}
+ onReset={onReset}
+ min={min}
+ max={max}
+ step={step}
+ valueText={text}
+ aria-label={label}
+ />
+ <div className={styles.numberSlot}>
+ <NumberField
+ value={value}
+ onChange={onChange}
+ onCommit={onCommit}
+ min={min}
+ max={max}
+ step={step}
+ aria-label={t("controls.sliderValue", { label })}
+ />
+ </div>
+ </div>
+ </Row>
+ );
+}
+
+/* ── switch ───────────────────────────────────────────────────────────────── */
+
+/** A labelled switch on one line. Discrete, so it commits as it changes. */
+export function SwitchRow({
+ label,
+ checked,
+ onChange,
+ help,
+}: {
+ label: string;
+ checked: boolean;
+ onChange: (checked: boolean) => void;
+ /** A `HelpButton`, for the settings that need a sentence rather than a name. */
+ help?: ReactNode;
+}) {
+ return (
+ <Row>
+ <div className={styles.switchRow}>
+ <span className={styles.label}>{label}</span>
+ {help}
+ <button
+ type="button"
+ role="switch"
+ aria-checked={checked}
+ aria-label={label}
+ onClick={() => onChange(!checked)}
+ className={cx(styles.switch, checked && styles.switchOn)}
+ >
+ <span className={styles.thumb} />
+ </button>
+ </div>
+ </Row>
+ );
+}
+
+/* ── help disclosure ──────────────────────────────────────────────────────── */
+
+/**
+ * A tooltip hides the answer again the moment the pointer moves, and reaching
+ * one from the keyboard takes machinery. This toggles a line of prose the
+ * caller renders where it belongs instead.
+ */
+export function HelpButton({
+ label,
+ open,
+ onToggle,
+}: {
+ label: string;
+ open: boolean;
+ onToggle: () => void;
+}) {
+ return (
+ <button
+ type="button"
+ className={cx(styles.help, open && styles.helpOn)}
+ aria-label={label}
+ aria-expanded={open}
+ onClick={onToggle}
+ >
+ ?
+ </button>
+ );
+}
+
+export function Note({ children }: { children: ReactNode }) {
+ return <p className={styles.note}>{children}</p>;
+}
+
+/* ── colour ───────────────────────────────────────────────────────────────── */
+
+const HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
+
+/**
+ * A colour well and its hex, because one of the two is always the faster way.
+ *
+ * The typed hex is held as a draft until it is a whole colour: repainting on
+ * "#f" would flash the title black on the way to "#ff0000". The well itself
+ * paints live, since dragging around a picker with no feedback is guesswork.
+ */
+export function ColourField({
+ label,
+ name = label,
+ value,
+ onChange,
+}: {
+ /** The row's visible label. Short: the section above already says which. */
+ label: string;
+ /** What the control is called out of that context, for a screen reader. */
+ name?: string;
+ value: string;
+ onChange: (value: string) => void;
+}) {
+ const [draft, setDraft] = useState<string | null>(null);
+
+ const commit = (text: string) => {
+ const candidate = text.trim().replace(/^#?/, "#");
+ if (HEX.test(candidate)) onChange(candidate.toLowerCase());
+ setDraft(null);
+ };
+
+ return (
+ <Row label={label}>
+ <input
+ className={styles.hex}
+ value={draft ?? value}
+ spellCheck={false}
+ aria-label={name}
+ onChange={(event) => setDraft(event.target.value)}
+ onBlur={(event) => commit(event.target.value)}
+ onKeyDown={(event) => {
+ if (event.key === "Enter") event.currentTarget.blur();
+ if (event.key === "Escape") {
+ setDraft(null);
+ event.currentTarget.blur();
+ }
+ }}
+ />
+ <span className={styles.swatch} style={{ background: value }}>
+ <input
+ type="color"
+ className={styles.swatchInput}
+ value={value}
+ aria-label={name}
+ onChange={(event) => onChange(event.target.value)}
+ />
+ </span>
+ </Row>
+ );
+}
diff --git a/desktop/src/components/inspector/fields.tsx b/desktop/src/components/inspector/fields.tsx
new file mode 100644
index 00000000..3eb741c2
--- /dev/null
+++ b/desktop/src/components/inspector/fields.tsx
@@ -0,0 +1,452 @@
+import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
+import type { KeyboardEvent, PointerEvent as ReactPointerEvent } from "react";
+import { createPortal } from "react-dom";
+
+import { Icon } from "../Icon";
+import { clamp, cx, decimalsOf, roundTo, useElementSize, usePointerDrag } from "./base";
+import styles from "./inspector.module.css";
+
+/**
+ * The three value pickers: a scrubbable number, a listbox, and a segmented
+ * row. Ported from the wc-ui-rnd design study.
+ *
+ * All three take the app's editing contract rather than the study's plain
+ * `onChange`: a gesture echoes live and *commits* once, so undo undoes the
+ * drag instead of sixty frames of it. Discrete controls - the listbox, the
+ * segments - change and commit in the same tick, which is why only the number
+ * field carries an explicit `onCommit`.
+ */
+
+/* ── number field ─────────────────────────────────────────────────────────── */
+
+export function NumberField({
+ value,
+ onChange,
+ onCommit,
+ min = Number.NEGATIVE_INFINITY,
+ max = Number.POSITIVE_INFINITY,
+ step = 1,
+ /** Drag distance in px that advances the value by one `step`. */
+ pxPerStep = 2,
+ "aria-label": ariaLabel,
+}: {
+ value: number;
+ onChange: (value: number) => void;
+ onCommit?: () => void;
+ min?: number;
+ max?: number;
+ step?: number;
+ pxPerStep?: number;
+ "aria-label"?: string;
+}) {
+ const digits = decimalsOf(step);
+ const input = useRef<HTMLInputElement>(null);
+ const origin = useRef(value);
+ const reverting = useRef(false);
+ // Null means "showing the value"; a string means "being typed into", and
+ // the project is not touched until that entry commits.
+ const [draft, setDraft] = useState<string | null>(null);
+ const editing = draft !== null;
+
+ const shown = roundTo(value, Math.max(digits, 3));
+
+ const settle = (next: number, fine: boolean) =>
+ onChange(roundTo(clamp(next, min, max), fine ? digits + 1 : digits));
+
+ const beginDrag = usePointerDrag({
+ disabled: editing,
+ cursor: "ew-resize",
+ onStart: () => {
+ origin.current = value;
+ },
+ onMove: ({ dx, shiftKey, altKey, moved }) => {
+ if (!moved) return;
+ // Shift coarsens, Alt refines - the same grammar the fader's arrow keys
+ // use, so one modifier means one thing across the panel.
+ const scale = shiftKey ? 10 : altKey ? 0.1 : 1;
+ settle(origin.current + (dx / pxPerStep) * step * scale, altKey);
+ },
+ onEnd: ({ moved }) => {
+ // A press that never travelled is a click: fall through to text entry.
+ if (moved) onCommit?.();
+ else input.current?.focus();
+ },
+ });
+
+ const commitTyped = (raw: string) => {
+ const parsed = Number.parseFloat(raw.replace(",", ".").replace(/[^\d.eE+-]/g, ""));
+ if (Number.isFinite(parsed)) {
+ onChange(roundTo(clamp(parsed, min, max), Math.max(digits, 3)));
+ onCommit?.();
+ }
+ };
+
+ const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
+ if (event.key === "ArrowUp" || event.key === "ArrowDown") {
+ event.preventDefault();
+ const scale = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;
+ const direction = event.key === "ArrowUp" ? 1 : -1;
+ const typed = draft !== null ? Number.parseFloat(draft) : Number.NaN;
+ const base = Number.isFinite(typed) ? typed : value;
+ const next = roundTo(
+ clamp(base + direction * step * scale, min, max),
+ event.altKey ? digits + 1 : digits,
+ );
+ onChange(next);
+ onCommit?.();
+ if (draft !== null) setDraft(String(next));
+ } else if (event.key === "Enter") {
+ event.preventDefault();
+ input.current?.blur();
+ } else if (event.key === "Escape") {
+ event.preventDefault();
+ reverting.current = true;
+ input.current?.blur();
+ }
+ };
+
+ return (
+ <div
+ className={cx(styles.field, editing && styles.editing)}
+ onPointerDown={(event: ReactPointerEvent<HTMLDivElement>) => {
+ if (editing) return;
+ event.preventDefault(); // withhold focus until the gesture resolves
+ beginDrag(event);
+ }}
+ >
+ <input
+ ref={input}
+ className={styles.fieldInput}
+ value={draft ?? String(shown)}
+ spellCheck={false}
+ autoComplete="off"
+ inputMode="decimal"
+ role="spinbutton"
+ aria-label={ariaLabel}
+ aria-valuenow={value}
+ aria-valuemin={Number.isFinite(min) ? min : undefined}
+ aria-valuemax={Number.isFinite(max) ? max : undefined}
+ onFocus={() => setDraft(String(shown))}
+ onBlur={() => {
+ if (draft !== null && !reverting.current) commitTyped(draft);
+ reverting.current = false;
+ setDraft(null);
+ }}
+ onKeyDown={onKeyDown}
+ onChange={(event) => setDraft(event.target.value)}
+ />
+ </div>
+ );
+}
+
+/* ── select ───────────────────────────────────────────────────────────────── */
+
+export interface SelectOption<T> {
+ value: T;
+ label: string;
+ /** Heading this option sits under. Consecutive options share one heading. */
+ group?: string;
+ /** Rendered after the label in a dimmer voice, e.g. "(file missing)". */
+ note?: string;
+ /** The face to draw the label in, for a font picker that shows its fonts. */
+ fontFamily?: string;
+}
+
+const TYPEAHEAD_WINDOW = 600;
+const OPEN_KEYS = ["ArrowDown", "ArrowUp", "Enter", " "];
+
+/**
+ * A listbox, not a native `<select>`.
+ *
+ * The native control cannot show a font in its own face, group with the app's
+ * own headings, or be styled to match anything around it. This is keyboard
+ * complete - arrows, Home/End, typeahead, Escape - and flips above the
+ * trigger when there is no room below it, which in a right-hand panel there
+ * often is not.
+ */
+export function Select<T extends string | number>({
+ options,
+ value,
+ onChange,
+ "aria-label": ariaLabel,
+}: {
+ options: readonly SelectOption<T>[];
+ value: T;
+ onChange: (value: T) => void;
+ "aria-label"?: string;
+}) {
+ const id = useId();
+ const root = useRef<HTMLDivElement>(null);
+ const trigger = useRef<HTMLButtonElement>(null);
+ const list = useRef<HTMLUListElement>(null);
+ const typeahead = useRef({ query: "", at: 0 });
+
+ const [box, setBox] = useState<{ left: number; top: number; width: number } | null>(null);
+ const [active, setActive] = useState(0);
+ const open = box !== null;
+
+ const selectedIndex = options.findIndex((option) => option.value === value);
+ const selected = selectedIndex >= 0 ? options[selectedIndex] : undefined;
+
+ const close = (refocus: boolean) => {
+ setBox(null);
+ if (refocus) trigger.current?.focus();
+ };
+
+ const openList = () => {
+ const rect = trigger.current?.getBoundingClientRect();
+ if (!rect) return;
+ setActive(selectedIndex >= 0 ? selectedIndex : 0);
+ // Opened downwards from the trigger; the layout effect below flips it up
+ // before paint if the list turns out not to fit there.
+ setBox({ left: rect.left, top: rect.bottom + 4, width: rect.width });
+ };
+
+ const commit = (index: number) => {
+ const option = options[index];
+ if (!option) return;
+ onChange(option.value);
+ close(true);
+ };
+
+ // Correct the placement and hand the list focus once it is in the DOM but
+ // before paint, so a list that has to open upwards never flashes downwards.
+ useLayoutEffect(() => {
+ if (!open) return;
+ const anchor = trigger.current;
+ const element = list.current;
+ if (!anchor || !element) return;
+ const rect = anchor.getBoundingClientRect();
+ const height = element.offsetHeight;
+ const up = rect.bottom + height + 8 > window.innerHeight && rect.top > height + 8;
+ const top = up ? rect.top - height - 4 : rect.bottom + 4;
+ setBox((current) =>
+ current && current.top === top ? current : { left: rect.left, top, width: rect.width },
+ );
+ element.focus();
+ }, [open]);
+
+ useEffect(() => {
+ if (!open) return;
+ const onPointerDown = (event: PointerEvent) => {
+ const target = event.target as Node;
+ if (!root.current?.contains(target) && !list.current?.contains(target)) setBox(null);
+ };
+ // The list is placed against the trigger's box, so anything that moves the
+ // trigger - the panel scrolling, the window resizing - orphans it. Closing
+ // is the honest response; a list that follows would still be a list nobody
+ // meant to leave open.
+ const dismiss = () => setBox(null);
+ document.addEventListener("pointerdown", onPointerDown, true);
+ window.addEventListener("scroll", dismiss, true);
+ window.addEventListener("resize", dismiss);
+ return () => {
+ document.removeEventListener("pointerdown", onPointerDown, true);
+ window.removeEventListener("scroll", dismiss, true);
+ window.removeEventListener("resize", dismiss);
+ };
+ }, [open]);
+
+ useEffect(() => {
+ if (!open) return;
+ list.current?.querySelector<HTMLElement>('[data-active="true"]')?.scrollIntoView({
+ block: "nearest",
+ });
+ }, [open, active]);
+
+ const onListKeyDown = (event: KeyboardEvent<HTMLUListElement>) => {
+ const last = options.length - 1;
+ switch (event.key) {
+ case "ArrowDown":
+ event.preventDefault();
+ setActive((current) => (current >= last ? 0 : current + 1));
+ return;
+ case "ArrowUp":
+ event.preventDefault();
+ setActive((current) => (current <= 0 ? last : current - 1));
+ return;
+ case "Home":
+ event.preventDefault();
+ setActive(0);
+ return;
+ case "End":
+ event.preventDefault();
+ setActive(last);
+ return;
+ case "Enter":
+ case " ":
+ event.preventDefault();
+ commit(active);
+ return;
+ case "Escape":
+ event.preventDefault();
+ close(true);
+ return;
+ case "Tab":
+ close(false);
+ return;
+ default:
+ break;
+ }
+
+ // Typeahead: printable keys jump to the first option with that prefix.
+ if (event.key.length !== 1 || event.metaKey || event.ctrlKey) return;
+ const now = Date.now();
+ const state = typeahead.current;
+ state.query = now - state.at > TYPEAHEAD_WINDOW ? event.key : state.query + event.key;
+ state.at = now;
+ const query = state.query.toLowerCase();
+ const match = options.findIndex((option) => option.label.toLowerCase().startsWith(query));
+ if (match >= 0) setActive(match);
+ };
+
+ return (
+ <div ref={root} className={styles.select}>
+ <button
+ ref={trigger}
+ type="button"
+ className={cx(styles.trigger, open && styles.open)}
+ aria-haspopup="listbox"
+ aria-expanded={open}
+ aria-label={ariaLabel}
+ onClick={() => (open ? close(true) : openList())}
+ onKeyDown={(event) => {
+ if (OPEN_KEYS.includes(event.key)) {
+ event.preventDefault();
+ openList();
+ }
+ }}
+ >
+ <span className={styles.triggerLabel} style={{ fontFamily: selected?.fontFamily }}>
+ {selected?.label ?? String(value)}
+ </span>
+ <Icon name="chevronDown" size={12} className={styles.chevron} />
+ </button>
+
+ {box &&
+ createPortal(
+ <ul
+ ref={list}
+ role="listbox"
+ tabIndex={-1}
+ aria-label={ariaLabel}
+ aria-activedescendant={`${id}-option-${active}`}
+ className={cx(styles.vars, styles.list)}
+ style={{ left: box.left, top: box.top, minWidth: box.width }}
+ onKeyDown={onListKeyDown}
+ >
+ {options.map((option, index) => (
+ <li key={String(option.value)}>
+ {option.group !== undefined && option.group !== options[index - 1]?.group && (
+ <div className={styles.optionGroup} aria-hidden>
+ {option.group}
+ </div>
+ )}
+ <div
+ id={`${id}-option-${index}`}
+ role="option"
+ aria-selected={option.value === value}
+ data-active={index === active}
+ className={styles.option}
+ onPointerEnter={() => setActive(index)}
+ onClick={() => commit(index)}
+ >
+ <span className={styles.optionLabel} style={{ fontFamily: option.fontFamily }}>
+ {option.label}
+ {option.note ? ` ${option.note}` : ""}
+ </span>
+ {option.value === value && (
+ <Icon name="check" size={12} className={styles.check} />
+ )}
+ </div>
+ </li>
+ ))}
+ </ul>,
+ document.body,
+ )}
+ </div>
+ );
+}
+
+/* ── segmented control ────────────────────────────────────────────────────── */
+
+/** Single-select row with a thumb that slides to the active segment. */
+export function SegmentedControl<T extends string>({
+ options,
+ value,
+ onChange,
+ "aria-label": ariaLabel,
+}: {
+ options: readonly { value: T; label: string }[];
+ value: T;
+ onChange: (value: T) => void;
+ "aria-label"?: string;
+}) {
+ const [ref, size] = useElementSize<HTMLDivElement>();
+ const buttons = useRef<Array<HTMLButtonElement | null>>([]);
+ const [thumb, setThumb] = useState<{ left: number; width: number } | null>(null);
+ const index = options.findIndex((option) => option.value === value);
+
+ useLayoutEffect(() => {
+ const element = index >= 0 ? buttons.current[index] : null;
+ const next = element ? { left: element.offsetLeft, width: element.offsetWidth } : null;
+ // Same geometry, same object: `options` is rebuilt per render wherever its
+ // labels are translated, so re-running this effect must not restart it.
+ setThumb((current) =>
+ current?.left === next?.left && current?.width === next?.width ? current : next,
+ );
+ }, [index, options, size.width]);
+
+ const move = (direction: 1 | -1) => {
+ const count = options.length;
+ const next = ((index < 0 ? 0 : index) + direction + count) % count;
+ onChange(options[next].value);
+ buttons.current[next]?.focus();
+ };
+
+ return (
+ <div
+ ref={ref}
+ role="radiogroup"
+ aria-label={ariaLabel}
+ className={styles.segGroup}
+ onKeyDown={(event) => {
+ if (event.key === "ArrowRight" || event.key === "ArrowDown") {
+ event.preventDefault();
+ move(1);
+ } else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
+ event.preventDefault();
+ move(-1);
+ }
+ }}
+ >
+ {thumb && (
+ <span
+ className={styles.segThumb}
+ aria-hidden
+ style={{ transform: `translateX(${thumb.left}px)`, width: thumb.width }}
+ />
+ )}
+ {options.map((option, position) => {
+ const on = option.value === value;
+ return (
+ <button
+ key={option.value}
+ ref={(element) => {
+ buttons.current[position] = element;
+ }}
+ type="button"
+ role="radio"
+ aria-checked={on}
+ // Roving tabindex keeps the group a single tab stop.
+ tabIndex={on || (index < 0 && position === 0) ? 0 : -1}
+ className={cx(styles.segment, on && styles.segmentOn)}
+ onClick={() => onChange(option.value)}
+ >
+ {option.label}
+ </button>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/desktop/src/components/inspector/inspector.module.css b/desktop/src/components/inspector/inspector.module.css
new file mode 100644
index 00000000..eed26891
--- /dev/null
+++ b/desktop/src/components/inspector/inspector.module.css
@@ -0,0 +1,748 @@
+@import "@fontsource-variable/inter";
+
+/*
+ * The new inspector's chrome.
+ *
+ * Ported from the wc-ui-rnd design study, tokens and all. The study is not a
+ * restyle of this app's palette and is not treated as one: its dark ground and
+ * lime accent come across verbatim in `.vars` below, so this panel looks the
+ * way the study looks whichever theme the rest of the window is in. That is
+ * the point of the experiment - the study's surface is what is being tried,
+ * and a panel repainted in the old palette would be trying nothing.
+ *
+ * The typeface comes across too. Inter is what the study is drawn in, so it is
+ * bundled (@fontsource-variable/inter, one variable file covering 100-900)
+ * rather than named and left to fall back to whatever the machine has, and
+ * this subtree is set in it instead of the app's Synonym and Cabinet.
+ *
+ * Scope: the Text panel today, and the shape the other right-hand panels are
+ * expected to grow into. Deleting this directory and the imports of it, plus
+ * the shell class in RightPanel, is the whole rollback.
+ */
+
+/* Design tokens, from the study's `styles/tokens.css`. Every rule below reads
+ these and nothing else - no app token, no literal colour - which is what
+ keeps the retheme to this one block. */
+.vars {
+ --cp-font: 'Inter Variable', 'Inter', ui-sans-serif, system-ui, -apple-system,
+ 'Segoe UI', Roboto, sans-serif;
+ --cp-fs-sm: 11px;
+ --cp-fs: 12px;
+ --cp-fs-lg: 13px;
+
+ /* surfaces */
+ --cp-panel: #0d0d0d;
+ --cp-raised: #161616;
+ --cp-well: #111;
+ --cp-field: #1f1f1f;
+ --cp-field-hover: #272727;
+ --cp-field-active: #303030;
+
+ /* hairlines */
+ --cp-line: #232323;
+ --cp-line-strong: #363636;
+
+ /* text */
+ --cp-fg: #ededed;
+ --cp-fg-muted: #8b8b8b;
+ --cp-fg-dim: #5c5c5c;
+
+ /* accents */
+ --cp-accent: #cbf53f;
+ --cp-accent-hover: #d9ff63;
+ --cp-accent-soft: rgb(203 245 63 / 0.2);
+ /* Ink for text and glyphs sitting ON the accent. A bright accent needs a
+ dark one; swap this back to #fff the day the accent goes dark again. */
+ --cp-on-accent: #15220a;
+ --cp-danger: #ff453a;
+
+ --cp-r-xs: 3px;
+ --cp-r-sm: 5px;
+ --cp-r: 7px;
+
+ --cp-h: 28px; /* standard control height */
+ --cp-gap: 6px;
+ --cp-pad: 14px; /* panel horizontal padding */
+ --cp-label-w: 62px;
+
+ --cp-focus: 0 0 0 1px var(--cp-accent), 0 0 0 3px var(--cp-accent-soft);
+ --cp-ease: cubic-bezier(0.4, 0, 0.2, 1);
+
+ font-family: var(--cp-font);
+ /* The app tightens its own face optically; Inter is drawn tight already. */
+ letter-spacing: normal;
+}
+
+/*
+ * The panel shell, worn by the app's own `Panel` around this body.
+ *
+ * The heading strip above the body is drawn by components/Panel.tsx out of the
+ * app's palette, and a light strip on top of the study's near-black reads as a
+ * seam rather than a panel. This hands that chrome the study's ground, padding
+ * and title voice instead - the only place the two systems touch, and the
+ * reason it is a class passed in rather than a change to the shared component.
+ */
+.shell {
+ composes: vars;
+ /* The scroll thumb is drawn by the `thin-scroll` utility off this token. */
+ --color-hairline-strong: var(--cp-line-strong);
+}
+
+/* Doubled selector so the ground beats the shell's own `bg-panel` utility
+ whichever stylesheet the bundler emits first - the trick the study uses for
+ its own cross-module overrides. `composes` has to stay on the plain class. */
+.shell.shell {
+ background: var(--cp-panel);
+}
+
+.shell > header {
+ height: 42px;
+ padding: 0 var(--cp-pad);
+ border-bottom-color: var(--cp-line);
+}
+
+.shell > header h2 {
+ color: var(--cp-fg);
+ font-size: var(--cp-fs-lg);
+ font-weight: 500;
+ letter-spacing: normal;
+ text-transform: none;
+}
+
+/* The panel body. `.vars` is a class of its own because the listbox escapes
+ this subtree - see `.list` - and has to carry the tokens with it. */
+.kit {
+ composes: vars;
+ padding-bottom: 8px;
+ color: var(--cp-fg);
+ font-size: var(--cp-fs);
+}
+
+/* ── section ─────────────────────────────────────────────────────────────── */
+
+.section {
+ border-top: 1px solid var(--cp-line);
+ padding-bottom: 8px;
+}
+
+.section:first-child { border-top: 0; }
+
+.sectionHeader {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+ height: 34px;
+ padding: 0 var(--cp-pad);
+}
+
+.sectionTitle {
+ min-width: 0;
+ color: var(--cp-fg);
+ font-size: var(--cp-fs-lg);
+ font-weight: 500;
+}
+
+.sectionBody {
+ display: flex;
+ flex-direction: column;
+ gap: var(--cp-gap);
+}
+
+/* ── row ─────────────────────────────────────────────────────────────────── */
+
+/*
+ * One line of the form: muted label on the left, controls on the right.
+ * Controls with `flex: 1 1 0` split what is left evenly, which is what gives
+ * paired fields their equal columns.
+ */
+.row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-height: var(--cp-h);
+ padding: 0 var(--cp-pad);
+}
+
+.rowLabel {
+ flex: none;
+ width: var(--cp-label-w);
+ color: var(--cp-fg-muted);
+ font-size: var(--cp-fs);
+ user-select: none;
+}
+
+.controls {
+ display: flex;
+ align-items: center;
+ gap: var(--cp-gap);
+ flex: 1 1 auto;
+ min-width: 0;
+}
+
+.stacked {
+ flex-direction: column;
+ align-items: stretch;
+}
+
+/* ── parameter ───────────────────────────────────────────────────────────── */
+
+.head {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 8px;
+ min-width: 0;
+}
+
+.labelGroup {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ min-width: 0;
+}
+
+.label {
+ overflow: hidden;
+ color: var(--cp-fg);
+ font-size: var(--cp-fs);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.resettable { cursor: pointer; }
+
+/* The formatted value lives up here beside the label, the raw one lives in the
+ field below. One says what the setting means, the other is what you edit. */
+.readout {
+ flex: none;
+ color: var(--cp-fg-dim);
+ font-size: var(--cp-fs-sm);
+ font-variant-numeric: tabular-nums;
+}
+
+.body {
+ display: flex;
+ align-items: center;
+ gap: var(--cp-gap);
+}
+
+.numberSlot {
+ flex: none;
+ width: 62px;
+}
+
+/* ── fader ───────────────────────────────────────────────────────────────── */
+
+.fader {
+ position: relative;
+ flex: 1 1 0;
+ min-width: 0;
+ height: var(--cp-h);
+ border: 1px solid var(--cp-line);
+ border-radius: var(--cp-r);
+ background: var(--cp-well);
+ cursor: ew-resize;
+ touch-action: none;
+}
+
+.fader:hover { border-color: var(--cp-line-strong); }
+.fader:focus-visible { outline: none; box-shadow: var(--cp-focus); }
+
+.rail {
+ position: absolute;
+ inset: 2px;
+}
+
+.fill {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ border-radius: var(--cp-r-xs);
+ background: var(--cp-accent-soft);
+}
+
+/* A bar, not a bead: flat edges land on a value with a precision a circle
+ never has, and at zero the bar still sits inside the track rather than
+ half-hanging off its left edge. */
+.cap {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: 3px;
+ border-radius: 2px;
+ background: var(--cp-accent);
+ transition: background 100ms var(--cp-ease);
+}
+
+/* ── number field ────────────────────────────────────────────────────────── */
+
+.field {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ flex: 1 1 0;
+ min-width: 0;
+ height: var(--cp-h);
+ padding: 0 8px;
+ border-radius: var(--cp-r);
+ background: var(--cp-field);
+ color: var(--cp-fg);
+ font-size: var(--cp-fs);
+ cursor: ew-resize;
+ transition: background 120ms var(--cp-ease), box-shadow 120ms var(--cp-ease);
+}
+
+.field:hover { background: var(--cp-field-hover); }
+
+.editing {
+ cursor: text;
+ background: var(--cp-field-hover);
+ box-shadow: var(--cp-focus);
+}
+
+.fieldInput {
+ flex: 1 1 auto;
+ width: 100%;
+ min-width: 0;
+ padding: 0;
+ border: 0;
+ outline: none;
+ background: none;
+ color: inherit;
+ font: inherit;
+ font-variant-numeric: tabular-nums;
+ text-align: right;
+ cursor: inherit;
+}
+
+/* ── select ──────────────────────────────────────────────────────────────── */
+
+.select {
+ position: relative;
+ flex: 1 1 0;
+ min-width: 0;
+}
+
+.trigger {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ width: 100%;
+ height: var(--cp-h);
+ padding: 0 6px 0 8px;
+ border: 0;
+ border-radius: var(--cp-r);
+ background: var(--cp-field);
+ color: var(--cp-fg);
+ font: inherit;
+ font-size: var(--cp-fs);
+ text-align: left;
+ cursor: pointer;
+ transition: background 120ms var(--cp-ease), box-shadow 120ms var(--cp-ease);
+}
+
+.trigger:hover { background: var(--cp-field-hover); }
+.trigger:focus-visible { outline: none; box-shadow: var(--cp-focus); }
+.open { background: var(--cp-field-hover); box-shadow: var(--cp-focus); }
+
+.triggerLabel {
+ flex: 1 1 auto;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.chevron {
+ flex: none;
+ color: var(--cp-fg-muted);
+}
+
+/*
+ * The list carries the study's own floating material, and its row highlight is
+ * a filled row rather than a hover tint - so arrowing through a font list
+ * shows where the keyboard is without a second selection mark.
+ *
+ * It is positioned from script and mounted at the document root, because the
+ * panel body scrolls: a dropdown laid out inside it is clipped by it, and a
+ * font list is exactly the one that is too long to fit.
+ */
+.list {
+ position: fixed;
+ z-index: 60;
+ max-height: 240px;
+ margin: 0;
+ padding: 4px;
+ overflow-y: auto;
+ list-style: none;
+ background: var(--cp-raised);
+ border: 1px solid var(--cp-line-strong);
+ border-radius: var(--cp-r);
+ box-shadow: 0 12px 28px rgb(0 0 0 / 0.55);
+ outline: none;
+ animation: pop 110ms var(--cp-ease);
+}
+
+@keyframes pop {
+ from { opacity: 0; transform: translateY(-3px); }
+ to { opacity: 1; transform: none; }
+}
+
+.optionGroup {
+ padding: 6px 8px 3px;
+ color: var(--cp-fg-dim);
+ font-size: var(--cp-fs-sm);
+ font-weight: 600;
+ letter-spacing: 0.04em;
+ text-transform: uppercase;
+}
+
+.option {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: 26px;
+ padding: 0 6px;
+ border-radius: var(--cp-r-sm);
+ color: var(--cp-fg-muted);
+ font-size: var(--cp-fs);
+ white-space: nowrap;
+ cursor: pointer;
+}
+
+.option[data-active='true'] {
+ background: var(--cp-accent);
+ color: var(--cp-on-accent);
+}
+
+.optionLabel {
+ flex: 1 1 auto;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.check {
+ flex: none;
+ color: var(--cp-accent);
+}
+
+.option[data-active='true'] .check { color: var(--cp-on-accent); }
+
+/* ── segmented control ───────────────────────────────────────────────────── */
+
+.segGroup {
+ position: relative;
+ display: flex;
+ flex: 1 1 0;
+ min-width: 0;
+ height: var(--cp-h);
+ padding: 2px;
+ border: 1px solid var(--cp-line);
+ border-radius: var(--cp-r);
+ background: var(--cp-well);
+}
+
+.segThumb {
+ position: absolute;
+ top: 2px;
+ bottom: 2px;
+ left: 0;
+ border-radius: var(--cp-r-sm);
+ background: var(--cp-field-hover);
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
+ transition: transform 180ms var(--cp-ease), width 180ms var(--cp-ease);
+ pointer-events: none;
+}
+
+.segment {
+ position: relative;
+ flex: 1 1 0;
+ min-width: 0;
+ display: grid;
+ place-items: center;
+ padding: 0 8px;
+ border: 0;
+ border-radius: var(--cp-r-sm);
+ background: none;
+ color: var(--cp-fg-muted);
+ font: inherit;
+ font-size: var(--cp-fs);
+ /* Segment labels are single words, and the catalogs hold them lowercase so
+ they read as prose elsewhere. */
+ text-transform: capitalize;
+ white-space: nowrap;
+ cursor: pointer;
+ transition: color 140ms var(--cp-ease);
+}
+
+.segment:hover { color: var(--cp-fg); }
+.segment:focus-visible { outline: none; box-shadow: var(--cp-focus); }
+.segmentOn { color: var(--cp-fg); }
+
+/* ── switch ──────────────────────────────────────────────────────────────── */
+
+.switchRow {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ width: 100%;
+ min-width: 0;
+}
+
+.switch {
+ position: relative;
+ flex: none;
+ margin-left: auto;
+ width: 34px;
+ height: 20px;
+ padding: 0;
+ border: 1px solid var(--cp-line-strong);
+ border-radius: 999px;
+ background: var(--cp-field);
+ cursor: pointer;
+ transition: background 140ms var(--cp-ease), border-color 140ms var(--cp-ease);
+}
+
+.switch:hover { background: var(--cp-field-hover); }
+.switch:focus-visible { outline: none; box-shadow: var(--cp-focus); }
+
+.switchOn,
+.switchOn:hover {
+ border-color: var(--cp-accent);
+ background: var(--cp-accent);
+}
+
+.thumb {
+ position: absolute;
+ top: 2px;
+ left: 2px;
+ width: 14px;
+ height: 14px;
+ border-radius: 50%;
+ background: #fff;
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
+ transition: transform 140ms var(--cp-ease);
+}
+
+.switchOn .thumb { transform: translateX(14px); }
+
+/* ── help disclosure ─────────────────────────────────────────────────────── */
+
+/*
+ * A tooltip hides the answer again the moment the pointer moves, and reaching
+ * one from the keyboard takes machinery. This toggles a line of prose the
+ * caller renders where it belongs instead.
+ */
+.help {
+ display: grid;
+ place-items: center;
+ flex: none;
+ width: 14px;
+ height: 14px;
+ padding: 0;
+ border: 1px solid var(--cp-line-strong);
+ border-radius: 50%;
+ background: none;
+ color: var(--cp-fg-dim);
+ font: inherit;
+ font-size: 9px;
+ line-height: 1;
+ cursor: pointer;
+ transition: color 100ms var(--cp-ease), border-color 100ms var(--cp-ease);
+}
+
+.help:hover { color: var(--cp-fg-muted); border-color: var(--cp-fg-dim); }
+.help:focus-visible { outline: none; box-shadow: var(--cp-focus); }
+
+.helpOn {
+ border-color: var(--cp-accent);
+ color: var(--cp-accent);
+}
+
+.note {
+ margin: 0;
+ padding: 0 var(--cp-pad) 2px;
+ color: var(--cp-fg-dim);
+ font-size: var(--cp-fs);
+ line-height: 1.5;
+}
+
+/* ── text entry ──────────────────────────────────────────────────────────── */
+
+.textarea {
+ width: 100%;
+ min-height: 72px;
+ padding: 8px 10px;
+ border: 1px solid var(--cp-line);
+ border-radius: var(--cp-r);
+ background: var(--cp-well);
+ color: var(--cp-fg);
+ font: inherit;
+ font-size: var(--cp-fs-lg);
+ line-height: 1.5;
+ resize: vertical;
+ outline: none;
+}
+
+.textarea::placeholder { color: var(--cp-fg-dim); }
+.textarea:hover { border-color: var(--cp-line-strong); }
+.textarea:focus { box-shadow: var(--cp-focus); }
+
+/* An import target has to look like one before it is used, so it is dashed
+ at rest rather than only while a file is over it. */
+.dashed {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ width: 100%;
+ height: var(--cp-h);
+ border: 1px dashed var(--cp-line-strong);
+ border-radius: var(--cp-r);
+ background: none;
+ color: var(--cp-fg-muted);
+ font: inherit;
+ font-size: var(--cp-fs);
+ cursor: pointer;
+ transition: color 100ms var(--cp-ease), border-color 100ms var(--cp-ease);
+}
+
+.dashed:hover { border-color: var(--cp-fg-dim); color: var(--cp-fg); }
+.dashed:focus-visible { outline: none; box-shadow: var(--cp-focus); }
+
+/* ── colour ──────────────────────────────────────────────────────────────── */
+
+.hex {
+ flex: 1 1 auto;
+ min-width: 0;
+ height: var(--cp-h);
+ padding: 0 10px;
+ border: 1px solid var(--cp-line);
+ border-radius: var(--cp-r);
+ background: var(--cp-well);
+ color: var(--cp-fg);
+ font: inherit;
+ font-size: var(--cp-fs);
+ font-variant-numeric: tabular-nums;
+ text-transform: lowercase;
+ outline: none;
+}
+
+.hex:hover { border-color: var(--cp-line-strong); }
+.hex:focus { box-shadow: var(--cp-focus); }
+
+.swatch {
+ position: relative;
+ flex: none;
+ width: 44px;
+ height: var(--cp-h);
+ padding: 0;
+ overflow: hidden;
+ border: 1px solid var(--cp-line-strong);
+ border-radius: var(--cp-r);
+ cursor: pointer;
+}
+
+.swatch:focus-within { box-shadow: var(--cp-focus); }
+
+/* The native picker is the whole hit area, blown up past the edges so no
+ platform chrome of its own shows through the swatch. */
+.swatchInput {
+ position: absolute;
+ inset: -8px;
+ width: calc(100% + 16px);
+ height: calc(100% + 16px);
+ padding: 0;
+ border: 0;
+ background: none;
+ opacity: 0;
+ cursor: pointer;
+}
+
+/* ── font list ───────────────────────────────────────────────────────────── */
+
+.fontRow {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ height: 24px;
+ padding: 0 var(--cp-pad);
+ color: var(--cp-fg-muted);
+ font-size: var(--cp-fs);
+}
+
+.fontRow:hover { background: var(--cp-field); }
+
+.fontName {
+ flex: 1 1 auto;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.fontRemove {
+ display: grid;
+ place-items: center;
+ flex: none;
+ width: 18px;
+ height: 18px;
+ padding: 0;
+ border: 0;
+ border-radius: var(--cp-r-xs);
+ background: none;
+ color: var(--cp-fg-dim);
+ cursor: pointer;
+}
+
+.fontRemove:hover { color: var(--cp-danger); }
+.fontRemove:focus-visible { outline: none; box-shadow: var(--cp-focus); }
+
+/* ── sample ──────────────────────────────────────────────────────────────── */
+
+/*
+ * A strip of the title as it will look, pinned above the controls.
+ *
+ * The program monitor next to this panel is the truth for scale and position,
+ * so the sample does not try to be a second one: it is a type specimen, held
+ * to a readable size, for judging face, weight, colour and outline without
+ * hunting for the words in the frame.
+ */
+.sample {
+ position: sticky;
+ top: 0;
+ z-index: 5;
+ display: flex;
+ align-items: center;
+ height: 62px;
+ padding: 0 var(--cp-pad);
+ overflow: hidden;
+ border-bottom: 1px solid var(--cp-line);
+ background: var(--cp-well);
+}
+
+.sampleText {
+ max-width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.samplePlaceholder {
+ color: var(--cp-fg-dim);
+ font-size: var(--cp-fs);
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .list { animation: none; }
+
+ .cap,
+ .thumb,
+ .switch,
+ .segThumb,
+ .segment {
+ transition: none;
+ }
+}
diff --git a/desktop/src/locales/en.json b/desktop/src/locales/en.json
index 84288f3d..637e4fde 100644
--- a/desktop/src/locales/en.json
+++ b/desktop/src/locales/en.json
@@ -404,6 +404,7 @@
"text.weight.light": "Light",
"text.weight.medium": "Medium",
"text.weight.regular": "Regular",
+ "textPanel.about": "About {name}",
"textPanel.addFontFile": "Add font file",
"textPanel.alignCenter": "center",
"textPanel.alignLeft": "left",
@@ -438,6 +439,7 @@
"textPanel.system": "System",
"textPanel.tracking": "Tracking",
"textPanel.vertical": "Vertical",
+ "textPanel.weight": "Weight",
"textPanel.width": "Width",
"textPanel.yours": "Yours",
"time.relative.daysAgo.one": "yesterday",
diff --git a/desktop/src/locales/zh-CN.json b/desktop/src/locales/zh-CN.json
index 04fd7bf1..5365113f 100644
--- a/desktop/src/locales/zh-CN.json
+++ b/desktop/src/locales/zh-CN.json
@@ -404,6 +404,7 @@
"text.weight.light": "细体",
"text.weight.medium": "中等",
"text.weight.regular": "常规",
+ "textPanel.about": "关于{name}",
"textPanel.addFontFile": "添加字体文件",
"textPanel.alignCenter": "居中",
"textPanel.alignLeft": "左对齐",
@@ -438,6 +439,7 @@
"textPanel.system": "系统",
"textPanel.tracking": "字距",
"textPanel.vertical": "垂直",
+ "textPanel.weight": "字重",
"textPanel.width": "宽度",
"textPanel.yours": "自定义",
"time.relative.daysAgo.one": "昨天",