Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(inspector): pick fixed choices from rows of buttons
EtienneLescot5d0435807827
diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.cssindex ae3871c5f..2853b9957 100644--- a/src/components/ai-edition/NewEditorShell.module.css+++ b/src/components/ai-edition/NewEditorShell.module.css@@ -887,6 +887,12 @@color: var(--fg-2);margin: 4px var(--sp-4) 8px;}+/* The current value, after the label, when the control below only shows it as a picture. */+.sectionLabelValue {+ margin-left: 6px;+ font-weight: 400;+ color: var(--muted);+}/* The same label where there is no pane inset to honour (dialogs). */.groupLabel {display: block;@@ -1054,7 +1060,9 @@gap: 6px 10px;padding: 4px var(--sp-4);}-.field label {+/* `.fieldLabel` names a control that is not one labelable element (a ChoiceRow's group). */+.field label,+.fieldLabel {font: 500 13px/1.3 var(--font-body);color: var(--fg-2);}@@ -1100,6 +1108,51 @@ textarea.control {.control:disabled,.field select:disabled,.field input:disabled { opacity: 0.5; cursor: not-allowed; }+/* A `.field` whose control needs the row's full width (a ChoiceRow): label on top. */+.field.fieldStack { grid-template-columns: minmax(0, 1fr); }++/* ─── choice row (ChoiceRow: a few fixed values, one button each) ─── */+/* The picked value carries the app's one selected look: accent border on the accent tint. */+.choiceRow {+ display: grid;+ gap: 4px;+}+.choiceBtn {+ min-width: 0;+ min-height: 32px;+ padding: 0 6px;+ display: inline-flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 3px;+ border: 1px solid transparent;+ border-radius: var(--r-md);+ background: color-mix(in oklab, var(--fg) 6%, transparent);+ color: var(--fg-2);+ font: 500 12.5px/1.2 var(--font-body);+ font-variant-numeric: tabular-nums;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ cursor: pointer;+ transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease);+}+.choiceBtn:hover:not(:disabled) { background: color-mix(in oklab, var(--fg) 11%, transparent); }+.choiceBtn.isActive {+ border-color: var(--accent);+ background: var(--accent-soft);+ color: var(--fg);+}+.choiceBtn:disabled { opacity: 0.5; cursor: not-allowed; }+.choiceRowTiles .choiceBtn { min-height: 44px; }+/* Under an icon, the name shrinks to one line and ellipsises rather than widening the column. */+.choiceBtnLabel {+ max-width: 100%;+ overflow: hidden;+ text-overflow: ellipsis;+ font-size: 12px;+}/* ─── bg thumb grid ────────────────────────────────────────────── */.bgGrid {diff --git a/src/components/ai-edition/RightPanes.backgroundMotion.test.tsx b/src/components/ai-edition/RightPanes.backgroundMotion.test.tsxindex aef460a58..3cf1e798e 100644--- a/src/components/ai-edition/RightPanes.backgroundMotion.test.tsx+++ b/src/components/ai-edition/RightPanes.backgroundMotion.test.tsx@@ -3,7 +3,7 @@// other wallpaper it must be dead and say why, not hold a choice that changes nothing on screen.import "@testing-library/jest-dom";-import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it } from "vitest";import { I18nProvider } from "@/contexts/I18nContext";import { LOCALE_STORAGE_KEY } from "@/i18n/config";@@ -28,7 +28,8 @@ function renderWith(legacyEditor: Record<string, unknown>) {);}-const control = () => screen.getByRole("combobox", { name: "Animation" });+const control = () => screen.getByRole("group", { name: "Animation" });+const choice = (name: string) => within(control()).getByRole("button", { name });beforeEach(() => {localStorage.clear();@@ -44,11 +45,11 @@ afterEach(() => {describe("background animation control", () => {it("animates a gradient wallpaper", () => {renderWith({ wallpaper: "linear-gradient(135deg, #2b3a67, #b8577f)" });- expect(control()).toBeEnabled();- expect(control()).toHaveValue("none");+ expect(choice("Aurora")).toBeEnabled();+ expect(choice("None")).toHaveAttribute("aria-pressed", "true");expect(screen.queryByText(REASON)).not.toBeInTheDocument();- fireEvent.change(control(), { target: { value: "aurora" } });+ fireEvent.click(choice("Aurora"));expect(useProjectStore.getState().document?.legacyEditor).toMatchObject({wallpaperMotion: "aurora",});@@ -56,8 +57,10 @@ describe("background animation control", () => {it("is disabled with its reason on an image, and keeps the stored choice", () => {renderWith({ wallpaper: "/wallpapers/wallpaper1.jpg", wallpaperMotion: "waves" });- expect(control()).toBeDisabled();- expect(control()).toHaveValue("none");+ for (const button of within(control()).getAllByRole("button")) {+ expect(button).toBeDisabled();+ }+ expect(choice("None")).toHaveAttribute("aria-pressed", "true");expect(screen.getByText(REASON)).toBeInTheDocument();expect(useProjectStore.getState().document?.legacyEditor).toMatchObject({wallpaperMotion: "waves",diff --git a/src/components/ai-edition/RightPanes.i18n.test.tsx b/src/components/ai-edition/RightPanes.i18n.test.tsxindex 6e59f67da..832253c68 100644--- a/src/components/ai-edition/RightPanes.i18n.test.tsx+++ b/src/components/ai-edition/RightPanes.i18n.test.tsx@@ -61,8 +61,8 @@ describe("right-rail panes are localized", () => {it("renders the layout pane in Japanese", () => {renderIn("ja-JP", <LayoutPane />);expect(screen.getByRole("heading", { name: "カメラレイアウト" })).toBeInTheDocument();- // the preset <option> labels come from the shared layout.* catalog- expect(screen.getByRole("option", { name: "ピクチャーインピクチャ" })).toBeInTheDocument();+ // the preset tiles are named from the shared layout.* catalog+ expect(screen.getByRole("button", { name: "ピクチャーインピクチャ" })).toBeInTheDocument();});it("renders the cursor pane in French", () => {diff --git a/src/components/ai-edition/RightPanes.layout.test.tsx b/src/components/ai-edition/RightPanes.layout.test.tsxindex fd7663a65..48b981d31 100644--- a/src/components/ai-edition/RightPanes.layout.test.tsx+++ b/src/components/ai-edition/RightPanes.layout.test.tsx@@ -85,9 +85,14 @@ describe("LayoutPane camera availability", () => {it("shows No webcam without overwriting the saved camera preset", () => {renderLayout(seedProject(false));- const preset = screen.getByRole("combobox", { name: "Preset" });- expect(preset).toBeDisabled();- expect(preset).toHaveValue("no-webcam");+ const preset = screen.getByRole("group", { name: "Preset" });+ for (const tile of within(preset).getAllByRole("button")) {+ expect(tile).toBeDisabled();+ }+ expect(within(preset).getByRole("button", { name: "No webcam" })).toHaveAttribute(+ "aria-pressed",+ "true",+ );expect(useProjectStore.getState().document?.legacyEditor).toMatchObject({webcamLayoutPreset: "picture-in-picture",});@@ -111,9 +116,14 @@ describe("LayoutPane camera availability", () => {const user = userEvent.setup();renderLayout(seedProject(true));- const preset = screen.getByRole("combobox", { name: "Preset" });- expect(preset).toBeEnabled();- expect(preset).toHaveValue("picture-in-picture");+ const preset = screen.getByRole("group", { name: "Preset" });+ for (const tile of within(preset).getAllByRole("button")) {+ expect(tile).toBeEnabled();+ }+ expect(within(preset).getByRole("button", { name: "Picture in picture" })).toHaveAttribute(+ "aria-pressed",+ "true",+ );expect(screen.getByText("Camera shape")).toBeInTheDocument();expect(screen.getByText("Shrink on zoom")).toBeInTheDocument();expect(screen.getByText("Webcam size")).toBeInTheDocument();diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsxindex bf11ade54..cbed3b46a 100644--- a/src/components/ai-edition/RightPanes.tsx+++ b/src/components/ai-edition/RightPanes.tsx@@ -413,21 +413,18 @@ function BackgroundSection() {gradient can move; on anything else the control says so instead of holding achoice that changes nothing on screen. The stored choice is kept and comes backwith the next gradient. */}- <div className={styles.field}>- <label htmlFor="background-motion">{ts("background.motion")}</label>- <select- id="background-motion"+ <div className={`${styles.field} ${styles.fieldStack}`}>+ <span className={styles.fieldLabel}>{ts("background.motion")}</span>+ <ChoiceRow<WallpaperMotion>+ label={ts("background.motion")}+ options={WALLPAPER_MOTIONS.map((motion) => ({+ value: motion,+ label: ts(WALLPAPER_MOTION_LABEL_KEYS[motion]),+ }))}value={motionApplies ? settings.wallpaperMotion : "none"}disabled={!hasDocument || !motionApplies}- title={motionApplies ? undefined : ts("background.motionGradientOnly")}- onChange={(e) => void set({ wallpaperMotion: e.target.value as WallpaperMotion })}- >- {WALLPAPER_MOTIONS.map((motion) => (- <option key={motion} value={motion}>- {ts(WALLPAPER_MOTION_LABEL_KEYS[motion])}- </option>- ))}- </select>+ onChange={(motion) => void set({ wallpaperMotion: motion })}+ /></div>{motionApplies ? null : (<p@@ -2833,11 +2830,43 @@ export function VideoEffectsPane() {// ─── Layout (webcam)──────────────────────────────────────────────+// Each preset draws itself (viewBox 0 0 32 22): the recording as an outline, the camera filled.const WEBCAM_PRESETS = [- { value: "picture-in-picture", labelKey: "layout.pictureInPicture" },- { value: "dual-frame", labelKey: "layout.dualFrame" },- { value: "vertical-stack", labelKey: "layout.verticalStack" },- { value: "no-webcam", labelKey: "layout.noWebcam" },+ {+ value: "picture-in-picture",+ labelKey: "layout.pictureInPicture",+ icon: (+ <>+ <rect x="1.5" y="1.5" width="29" height="19" rx="3" />+ <rect x="19.5" y="11" width="8.5" height="6.5" rx="1.5" fill="currentColor" stroke="none" />+ </>+ ),+ },+ {+ value: "dual-frame",+ labelKey: "layout.dualFrame",+ icon: (+ <>+ <rect x="1.5" y="3.5" width="18" height="15" rx="2.5" />+ <rect x="21.5" y="3.5" width="9" height="15" rx="2.5" fill="currentColor" stroke="none" />+ </>+ ),+ },+ {+ value: "vertical-stack",+ labelKey: "layout.verticalStack",+ icon: (+ <>+ <rect x="6.5" y="1.5" width="19" height="11" rx="2" />+ <rect x="6.5" y="14" width="19" height="6.5" rx="2" fill="currentColor" stroke="none" />+ </>+ ),+ },+ {+ value: "no-webcam",+ labelKey: "layout.noWebcam",+ icon: <rect x="1.5" y="1.5" width="29" height="19" rx="3" />,+ },] as const;// Webcam size (% of frame width) that maps to the native compositor's default PiP webcam@@ -2991,23 +3020,41 @@ export function LayoutPane() {};return (<Pane title={ts("layout.title")} icon={<Camera size={16} />} helpText={helpText}>- <div className={styles.sectionLabel}>{ts("layout.preset")}</div>- <div className={styles.field}>- <label htmlFor="layout-preset">{ts("layout.preset")}</label>- <select- id="layout-preset"+ {/* The heading names the current layout: the tiles below only draw theirs. */}+ <div className={styles.sectionLabel}>+ {ts("layout.preset")}+ <span className={styles.sectionLabelValue}>+ {ts(+ WEBCAM_PRESETS.find((p) => p.value === effectiveLayoutPreset)?.labelKey ??+ "layout.noWebcam",+ )}+ </span>+ </div>+ <div style={{ padding: "0 var(--sp-4) 12px" }}>+ <ChoiceRow<(typeof WEBCAM_PRESETS)[number]["value"]>+ label={ts("layout.preset")}+ tiles+ options={WEBCAM_PRESETS.map((p) => ({+ value: p.value,+ label: ts(p.labelKey),+ icon: (+ <svg+ viewBox="0 0 32 22"+ width={32}+ height={22}+ fill="none"+ stroke="currentColor"+ strokeWidth="1.75"+ aria-hidden="true"+ >+ {p.icon}+ </svg>+ ),+ }))}value={effectiveLayoutPreset}disabled={layoutControlsDisabled}- onChange={(e) =>- void set({ webcamLayoutPreset: e.target.value as typeof settings.webcamLayoutPreset })- }- >- {WEBCAM_PRESETS.map((p) => (- <option key={p.value} value={p.value}>- {ts(p.labelKey)}- </option>- ))}- </select>+ onChange={(preset) => void set({ webcamLayoutPreset: preset })}+ /></div><div className={styles.paneRow}><span className={styles.label}>{ts("layout.mirrorWebcam")}</span>@@ -3712,6 +3759,102 @@ export function Toggle({);}+/** Un choix parmi quelques valeurs fixes, en une rangée de boutons : tout est visible et un clic+ * suffit, là où un `<select>` demandait d'ouvrir puis de choisir (même motif que le niveau de+ * zoom, #694). Des boutons `aria-pressed` dans un `role="group"` nommé, comme+ * `TranscriptLaneSwitch`, donc chaque choix reste un arrêt de tabulation. Les flèches passent+ * d'un choix au voisin depuis le bouton qui a le focus. Ni elles ni Espace/Entrée ne remontent+ * jusqu'aux raccourcis de l'éditeur, qui écoutent sur `window` : Espace y lance la lecture (et+ * son `preventDefault` tuait l'activation du bouton), les flèches y déplacent la tête. */+export function ChoiceRow<T extends string | number>({+ label,+ options,+ value,+ onChange,+ disabled,+ columns,+ tiles,+ display,+}: {+ label: string;+ options: ReadonlyArray<{ value: T; label: string; icon?: ReactNode }>;+ value: T;+ onChange: (next: T) => void;+ disabled?: boolean;+ /** Colonnes de la grille ; par défaut, toutes les options sur une rangée. */+ columns?: number;+ /** Des vignettes plus hautes, pour des icônes qui dessinent le choix. */+ tiles?: boolean;+ /** Ce que montre un bouton. Par défaut l'icône s'il y en a une, et alors `label` lui sert de+ * nom ; sinon le texte. */+ display?: "text" | "icon" | "both";+}) {+ const buttonsRef = useRef<Array<HTMLButtonElement | null>>([]);+ const mode = display ?? (options.some((o) => o.icon) ? "icon" : "text");+ return (+ <div+ role="group"+ aria-label={label}+ className={`${styles.choiceRow} ${tiles ? styles.choiceRowTiles : ""}`}+ style={{ gridTemplateColumns: `repeat(${columns ?? options.length}, minmax(0, 1fr))` }}+ onKeyDown={(e) => {+ if (e.key === "Enter" || e.key === " ") {+ e.nativeEvent.stopPropagation();+ return;+ }+ const step =+ e.key === "ArrowRight" || e.key === "ArrowDown"+ ? 1+ : e.key === "ArrowLeft" || e.key === "ArrowUp"+ ? -1+ : 0;+ if (step === 0) return;+ e.preventDefault();+ e.nativeEvent.stopPropagation();+ const focused = buttonsRef.current.findIndex((b) => b === document.activeElement);+ const from = focused >= 0 ? focused : options.findIndex((o) => o.value === value);+ const next = options[from + step];+ if (!next) return;+ buttonsRef.current[from + step]?.focus();+ if (next.value !== value) onChange(next.value);+ }}+ >+ {options.map((option, i) => {+ const pressed = option.value === value;+ return (+ <button+ key={String(option.value)}+ ref={(el) => {+ buttonsRef.current[i] = el;+ }}+ type="button"+ className={`${styles.choiceBtn} ${pressed ? styles.isActive : ""}`}+ aria-pressed={pressed}+ aria-label={mode === "icon" ? option.label : undefined}+ // Always: a label cut short by a narrow pane still reads in full on hover.+ title={option.label}+ disabled={disabled}+ // Re-choisir la valeur en place n'est pas une modification : ni sauvegarde ni+ // entrée d'annulation.+ onClick={() => {+ if (!pressed) onChange(option.value);+ }}+ >+ {mode === "text" ? option.label : null}+ {mode === "icon" ? option.icon : null}+ {mode === "both" ? (+ <>+ {option.icon}+ <span className={styles.choiceBtnLabel}>{option.label}</span>+ </>+ ) : null}+ </button>+ );+ })}+ </div>+ );+}+/** Le slider commun des panneaux — exporté pour que l'inspecteur V4 s'en serve au lieu de* restyler un `<input type="range">` isolé qui ne ressemblait à rien de l'app. Il porte aussi* la bonne cadence : `onChange` en direct, `onCommit` à la fin du geste. */diff --git a/src/components/ai-edition/v4/FloatingInspector.tsx b/src/components/ai-edition/v4/FloatingInspector.tsxindex cc209df16..545bd10b9 100644--- a/src/components/ai-edition/v4/FloatingInspector.tsx+++ b/src/components/ai-edition/v4/FloatingInspector.tsx@@ -1,14 +1,26 @@import {+ ArrowDown,+ ArrowDownLeft,+ ArrowDownRight,+ ArrowLeft,+ ArrowRight,+ ArrowUp,+ ArrowUpLeft,+ ArrowUpRight,AudioLines,Camera,ChevronRight,+ EyeOff,FileText,+ ImageIcon,+ type LucideIcon,Maximize2,MousePointer2,Pencil,Scissors,SlidersHorizontal,Trash2,+ Type,Undo2,X,ZoomIn,@@ -48,6 +60,7 @@ import shell from "../NewEditorShell.module.css";import {AudioPane,AudioTrackPane,+ ChoiceRow,CursorPane,LayoutPane,SliderCell,@@ -312,6 +325,17 @@ function paneRow(label: string, control: React.ReactNode) {);}+/** Un libellé au-dessus de son contrôle, pour ceux qui prennent toute la largeur du panneau+ * (une `ChoiceRow`) : à côté d'un libellé, ils n'auraient plus la place de montrer leurs choix. */+function paneStack(label: string, control: React.ReactNode) {+ return (+ <div style={{ display: "flex", flexDirection: "column", gap: 6 }}>+ <span style={{ fontSize: 13, color: "var(--fg-2)", fontWeight: 500 }}>{label}</span>+ {control}+ </div>+ );+}+/** Clé i18n (`zoom.camera.preset.*` / `zoom.camera.description.*`) de chaque caméra 3D. */const CAMERA_KEYS: Record<Rotation3DPreset, string> = {iso: "iso",@@ -350,18 +374,19 @@ function ClickImpactToggle({type AnnotationKind = AxcutAnnotationRegion["type"];type ArrowDirectionKind = NonNullable<AxcutAnnotationRegion["figureData"]>["arrowDirection"];-/** Les huit directions de `ArrowSvgs.tsx`, dans l'ordre où elles y sont définies, chacune avec- * la flèche qui la montre : aucune langue n'a de libellé pour elles, et la valeur brute- * (« up-right ») s'affichait telle quelle. */-const ARROW_DIRECTIONS: Array<[ArrowDirectionKind, string]> = [- ["up", "↑"],- ["down", "↓"],- ["left", "←"],- ["right", "→"],- ["up-right", "↗"],- ["up-left", "↖"],- ["down-right", "↘"],- ["down-left", "↙"],+/** Les huit directions de `ArrowSvgs.tsx`, dans l'ordre d'une boussole (du haut, dans le sens+ * des aiguilles d'une montre), chacune avec la flèche qui la montre. Aucune langue n'a de+ * libellé pour elles, et la valeur brute (« up-right ») s'affichait telle quelle : le caractère+ * fléché sert de nom accessible. */+const ARROW_DIRECTIONS: Array<{ value: ArrowDirectionKind; glyph: string; Icon: LucideIcon }> = [+ { value: "up", glyph: "↑", Icon: ArrowUp },+ { value: "up-right", glyph: "↗", Icon: ArrowUpRight },+ { value: "right", glyph: "→", Icon: ArrowRight },+ { value: "down-right", glyph: "↘", Icon: ArrowDownRight },+ { value: "down", glyph: "↓", Icon: ArrowDown },+ { value: "down-left", glyph: "↙", Icon: ArrowDownLeft },+ { value: "left", glyph: "←", Icon: ArrowLeft },+ { value: "up-left", glyph: "↖", Icon: ArrowUpLeft },];/** Défauts du schéma, pour compléter un `blurData` absent sans écraser ce qui existe. */@@ -443,27 +468,19 @@ export function SpeedControl({setDraft("");};- // A custom speed matches no preset, so surface it as its own option — otherwise the select- // would fall back to rendering its first entry and misreport the region.- const options = SPEED_PRESETS.includes(region.speed)- ? SPEED_PRESETS- : [...SPEED_PRESETS, region.speed].sort((a, b) => a - b);-return (<>- {paneRow(+ {/* The presets as buttons, six to a row like the zoom levels. A custom speed presses+ none of them; the field below shows it as its placeholder. */}+ {paneStack(ts("speed.playbackSpeed"),- <select+ <ChoiceRow<number>+ label={ts("speed.playbackSpeed")}+ columns={6}+ options={SPEED_PRESETS.map((speed) => ({ value: speed, label: `${speed}×` }))}value={region.speed}- onChange={(e) => void tl.updateSpeedValue(region.id, Number(e.target.value))}- className={shell.control}- >- {options.map((speed) => (- <option key={speed} value={speed}>- {speed}×- </option>- ))}- </select>,+ onChange={(speed) => void tl.updateSpeedValue(region.id, speed)}+ />,)}{paneRow(ts("speed.customPlaybackSpeed"),@@ -735,24 +752,32 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }blur were unreachable even though the compositor renders all four and everylabel here already shipped translated. Converting keeps the span and box, soa mistake costs one more click rather than redrawing the region. */}- {paneRow(+ {paneStack(ts("annotation.type"),- <select+ <ChoiceRow<AnnotationKind>+ label={ts("annotation.type")}+ display="both"+ tiles+ options={[+ { value: "text", label: ts("annotation.typeText"), icon: <Type size={16} /> },+ {+ value: "image",+ label: ts("annotation.typeImage"),+ icon: <ImageIcon size={16} />,+ },+ {+ value: "figure",+ label: ts("annotation.typeArrow"),+ icon: <ArrowUpRight size={16} />,+ },+ { value: "blur", label: ts("annotation.typeBlur"), icon: <EyeOff size={16} /> },+ ]}value={region.type}- onChange={(e) => {- tl.updateAnnotationLive(- region.id,- convertAnnotationKind(region, e.target.value as AnnotationKind),- );+ onChange={(kind) => {+ tl.updateAnnotationLive(region.id, convertAnnotationKind(region, kind));void tl.commitAnnotationChange();}}- className={shell.control}- >- <option value="text">{ts("annotation.typeText")}</option>- <option value="image">{ts("annotation.typeImage")}</option>- <option value="figure">{ts("annotation.typeArrow")}</option>- <option value="blur">{ts("annotation.typeBlur")}</option>- </select>,+ />,)}{region.type === "text" ? (<div style={{ display: "flex", flexDirection: "column", gap: 6 }}>@@ -803,28 +828,26 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }) : null}{region.type === "figure" ? (<>- {paneRow(+ {paneStack(ts("annotation.arrowDirection"),- <select+ <ChoiceRow<ArrowDirectionKind>+ label={ts("annotation.arrowDirection")}+ options={ARROW_DIRECTIONS.map(({ value, glyph, Icon }) => ({+ value,+ label: glyph,+ icon: <Icon size={16} />,+ }))}value={region.figureData?.arrowDirection ?? "right"}- onChange={(e) => {+ onChange={(arrowDirection) => {tl.updateAnnotationLive(region.id, {figureData: {...(region.figureData ?? { color: "#34B27B", strokeWidth: 4 }),- arrowDirection: e.target.value as ArrowDirectionKind,+ arrowDirection,},});void tl.commitAnnotationChange();}}- aria-label={ts("annotation.arrowDirection")}- className={shell.control}- >- {ARROW_DIRECTIONS.map(([d, glyph]) => (- <option key={d} value={d}>- {glyph}- </option>- ))}- </select>,+ />,)}{paneRow(ts("annotation.arrowColor"),@@ -865,52 +888,48 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }) : null}{region.type === "blur" ? (<>- {paneRow(+ {paneStack(ts("annotation.blurType"),- <select+ <ChoiceRow<"blur" | "mosaic">+ label={ts("annotation.blurType")}+ options={[+ { value: "blur", label: ts("annotation.blurTypeBlur") },+ { value: "mosaic", label: ts("annotation.blurTypeMosaic") },+ ]}value={region.blurData?.type ?? "mosaic"}- onChange={(e) => {+ onChange={(type) => {tl.updateAnnotationLive(region.id, {- blurData: {- ...(region.blurData ?? BLUR_DEFAULTS),- type: e.target.value as "blur" | "mosaic",- },+ blurData: { ...(region.blurData ?? BLUR_DEFAULTS), type },});void tl.commitAnnotationChange();}}- className={shell.control}- >- <option value="blur">{ts("annotation.blurTypeBlur")}</option>- <option value="mosaic">{ts("annotation.blurTypeMosaic")}</option>- </select>,+ />,)}- {paneRow(+ {paneStack(ts("annotation.blurShape"),- <select+ <ChoiceRow<"rectangle" | "oval" | "freehand">+ label={ts("annotation.blurShape")}+ options={[+ { value: "rectangle", label: ts("annotation.blurShapeRectangle") },+ { value: "oval", label: ts("annotation.blurShapeOval") },+ // Le tracé libre n'est plus proposé à la création : sa saisie était cassée et+ // le rendu ne couvrait que la boîte englobante. Un outil de confidentialité+ // à moitié fiable vaut moins que pas d'outil, parce qu'on lui fait confiance.+ // Le choix reste visible pour une annotation qui l'utilise déjà, avec la+ // phrase qui dit ce que le rendu en fait — plutôt que de le faire disparaître+ // d'un projet existant.+ ...(region.blurData?.shape === "freehand"+ ? [{ value: "freehand" as const, label: ts("annotation.blurShapeFreehand") }]+ : []),+ ]}value={region.blurData?.shape ?? "rectangle"}- onChange={(e) => {+ onChange={(shape) => {tl.updateAnnotationLive(region.id, {- blurData: {- ...(region.blurData ?? BLUR_DEFAULTS),- shape: e.target.value as "rectangle" | "oval" | "freehand",- },+ blurData: { ...(region.blurData ?? BLUR_DEFAULTS), shape },});void tl.commitAnnotationChange();}}- className={shell.control}- >- <option value="rectangle">{ts("annotation.blurShapeRectangle")}</option>- <option value="oval">{ts("annotation.blurShapeOval")}</option>- {/* Le tracé libre n'est plus proposé à la création : sa saisie était cassée et- le rendu ne couvrait que la boîte englobante. Un outil de confidentialité- à moitié fiable vaut moins que pas d'outil, parce qu'on lui fait confiance.- L'option reste visible pour une annotation qui l'utilise déjà, avec la- phrase qui dit ce que le rendu en fait — plutôt que de la faire disparaître- d'un projet existant. */}- {region.blurData?.shape === "freehand" ? (- <option value="freehand">{ts("annotation.blurShapeFreehand")}</option>- ) : null}- </select>,+ />,)}{region.blurData?.shape === "freehand" ? (// Say it rather than let the user discover it: the compositor masks the@@ -975,31 +994,26 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }): null}{region.type === "text"- ? paneRow(+ ? paneStack(ts("textAnimation.title"),// Les sept animations existaient : nommées dans le schéma, traduites dans les// treize langues, transportées jusqu'au compositeur — et injouables, faute de- // ce sélecteur.- <select- aria-label={ts("textAnimation.selectAnimation")}+ // ce sélecteur. Trois par rangée : « Typewriter » et ses traductions tiennent.+ <ChoiceRow<AnnotationTextAnimation>+ label={ts("textAnimation.selectAnimation")}+ columns={3}+ options={TEXT_ANIMATION_VALUES.map((value) => ({+ value,+ label: ts(`textAnimation.${value === "slide-left" ? "slideLeft" : value}`),+ }))}value={region.style?.textAnimation ?? "none"}- onChange={(e) => {+ onChange={(textAnimation) => {tl.updateAnnotationLive(region.id, {- style: {- ...region.style,- textAnimation: e.target.value as AnnotationTextAnimation,- },+ style: { ...region.style, textAnimation },});void tl.commitAnnotationChange();}}- className={shell.control}- >- {TEXT_ANIMATION_VALUES.map((value) => (- <option key={value} value={value}>- {ts(`textAnimation.${value === "slide-left" ? "slideLeft" : value}`)}- </option>- ))}- </select>,+ />,): null}{region.type === "text"diff --git a/src/components/ai-edition/v4/SpeedControl.test.tsx b/src/components/ai-edition/v4/SpeedControl.test.tsxindex 50a9673ab..639be608a 100644--- a/src/components/ai-edition/v4/SpeedControl.test.tsx+++ b/src/components/ai-edition/v4/SpeedControl.test.tsx@@ -72,12 +72,23 @@ describe("SpeedControl", () => {expect(field).toHaveValue("");});- it("surfaces a custom speed as its own option instead of misreporting a preset", () => {- // 25× matches no preset. Without an injected <option> the select would fall back to- // rendering its first entry, telling the user the region runs at 0.25×.+ it("picks a preset in one click, and leaves the current one alone", () => {+ const { updateSpeedValue } = renderControl(1);+ expect(screen.getByRole("button", { name: "1×" })).toHaveAttribute("aria-pressed", "true");+ fireEvent.click(screen.getByRole("button", { name: "2×" }));+ expect(updateSpeedValue).toHaveBeenCalledWith("sp1", 2);+ // Re-pressing the current speed is not an edit: no save, no undo entry.+ updateSpeedValue.mockClear();+ fireEvent.click(screen.getByRole("button", { name: "1×" }));+ expect(updateSpeedValue).not.toHaveBeenCalled();+ });++ it("does not misreport a custom speed as a preset", () => {+ // 25× matches no preset: no button may claim it, and the field reads it back instead.renderControl(25);- const select = screen.getByRole("combobox") as HTMLSelectElement;- expect(select.value).toBe("25");- expect(Array.from(select.options).map((o) => o.value)).toContain("25");+ for (const button of screen.getAllByRole("button")) {+ expect(button).toHaveAttribute("aria-pressed", "false");+ }+ expect(screen.getByPlaceholderText("25×")).toBeInTheDocument();});});