The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
A11y and small fixes: shortcuts per platform, names, posters, Faceless Next
Claude746b24af6791
diff --git a/src/components/canvas/nodes.tsx b/src/components/canvas/nodes.tsxindex f0578162..0741507b 100644--- a/src/components/canvas/nodes.tsx+++ b/src/components/canvas/nodes.tsx@@ -92,6 +92,7 @@ import {import { OPERATION_LABELS, type Engine, type MediaKind, type ModelDef, type OutputFile } from "@/lib/catalog/types";import { formatCost } from "@/lib/format";import { matchSpokenLanguage, spokenLanguageName, spokenLanguageOptions } from "@/lib/speech-languages";+import { keyCombo } from "@/lib/keys";import { cn } from "@/lib/utils";import { NodeIcon, PORT_COLOR, useEditorActions, useEditorGlobals, useEditorSelector, useNodeResults, useNodeView, type EditorSnapshot, type NodeResults } from "./canvas-context";@@ -274,7 +275,7 @@ function MenuItems({ id, kit, items, canConnect, onRename }: { id: string; kit:<DisconnectItems id={id} kit={kit} /></kit.SubContent></kit.Sub>- {entry({ label: "Duplicate", icon: Copy, onSelect: () => actions.duplicate(id), shortcut: "⌘D", separatorBefore: true })}+ {entry({ label: "Duplicate", icon: Copy, onSelect: () => actions.duplicate(id), shortcut: keyCombo("D"), separatorBefore: true })}{entry({ label: "Delete", icon: Trash2, onSelect: () => actions.remove(id), shortcut: "⌫", destructive: true })}</>);diff --git a/src/components/cinema/director-panel.tsx b/src/components/cinema/director-panel.tsxindex a35fc0c6..2c8df32b 100644--- a/src/components/cinema/director-panel.tsx+++ b/src/components/cinema/director-panel.tsx@@ -571,6 +571,7 @@ export function EmotionChip({ settings, onChange, characters }: { settings: Direconst emotions = settings.emotions ?? {};const active = characters.filter((c) => emotions[c.handle.toLowerCase()]);const first = active[0] ? emotionStep(emotions[active[0].handle.toLowerCase()]) : undefined;+ const chipLabel = first ? `${first.name}${active.length > 1 ? ` +${active.length - 1}` : ""}` : "Emotions";const set = (handle: string, v: { family: string; step: number } | null) => {const next = { ...emotions };if (v) next[handle.toLowerCase()] = v;@@ -580,7 +581,7 @@ export function EmotionChip({ settings, onChange, characters }: { settings: Direreturn (<Popover><PopoverTrigger asChild>- <DirectorChip icon={Smile} label={first ? `${first.name}${active.length > 1 ? ` +${active.length - 1}` : ""}` : "Emotions"} active={active.length > 0} aria-label="Emotion wheel">+ <DirectorChip icon={Smile} label={chipLabel} active={active.length > 0} aria-label={`${chipLabel}: emotion wheel`}>{first && <span className="size-2.5 shrink-0 rounded-full" style={{ background: first.color }} />}</DirectorChip></PopoverTrigger>diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsxindex 67dd4f09..52b392d2 100644--- a/src/components/cinema/prompt-bar.tsx+++ b/src/components/cinema/prompt-bar.tsx@@ -120,7 +120,7 @@ function PickChip<T extends string | number>({return (<DropdownMenu><DropdownMenuTrigger asChild>- <button type="button" className={cn(chip, chipIdle)} aria-label={label}>+ <button type="button" className={cn(chip, chipIdle)} aria-label={`${label}: ${f(value)}`}><Icon className="size-3.5" />{f(value)}</button>@@ -150,7 +150,7 @@ function DurationChip({ value, effective, onChange }: { value: number; effectivereturn (<Popover><PopoverTrigger asChild>- <button type="button" className={cn(chip, chipIdle)} aria-label="Duration">+ <button type="button" className={cn(chip, chipIdle)} aria-label={effective && effective !== value ? `Duration: ${value}s ${effective}s, the model makes ${effective}s` : `Duration: ${value}s`}><Clock className="size-3.5" />{effective && effective !== value ? (<span>@@ -730,7 +730,7 @@ export function PromptBar(props: PromptBarProps) {{/* Model */}<DropdownMenu><DropdownMenuTrigger asChild disabled={!pickable}>- <button type="button" className={cn(chip, chipIdle, "max-w-[220px] disabled:opacity-100")} aria-label="Model">+ <button type="button" className={cn(chip, chipIdle, "max-w-[220px] disabled:opacity-100")} aria-label={`Model: ${model.name}`}><Sparkles className="size-3.5 shrink-0" /><span className="truncate">{model.name}</span>{pickable && <ChevronDown className="size-3 shrink-0 opacity-60" />}diff --git a/src/components/faceless/episode-wizard.tsx b/src/components/faceless/episode-wizard.tsxindex 765e3c0b..a59d3687 100644--- a/src/components/faceless/episode-wizard.tsx+++ b/src/components/faceless/episode-wizard.tsx@@ -142,8 +142,15 @@ export function EpisodeWizard({ channelId, picker }: { channelId: string; pickerif (error && /not found/i.test((error as Error).message)) return <NotFoundState title="This channel doesn't exist" />;+ // Next waits for a topic (or a pasted script); the line beside it says so and takes you to the topics.+ const ready = !!topic || (scriptMode === "pasted" && !!script.trim());+ const focusTopics = () => {+ const el = document.querySelector<HTMLElement>('[aria-label="Suggested topics"] [role="radio"][tabindex="0"]') ?? document.getElementById(ownId);+ el?.scrollIntoView({ block: "center", behavior: "smooth" });+ el?.focus({ preventScroll: true });+ };const next = () => {- if (!topic && !(scriptMode === "pasted" && script.trim())) return void toast("Pick a topic, or write your own", { id: "faceless-blocker" });+ if (!ready) return void toast("Pick a topic, or write your own", { id: "faceless-blocker" });setStep(2);window.scrollTo({ top: 0, behavior: "smooth" });};@@ -356,8 +363,16 @@ export function EpisodeWizard({ channelId, picker }: { channelId: string; picker</>) : (<>- <p className="min-w-0 flex-1 truncate text-[13px] text-muted-foreground">{topic ? `Topic: ${topic}` : "Pick a topic to continue"}</p>- <Button onClick={next} className="rounded-full">+ {ready ? (+ <p className="min-w-0 flex-1 truncate text-[13px] text-muted-foreground">{topic ? `Topic: ${topic}` : "Your script is ready to split"}</p>+ ) : (+ <p className="min-w-0 flex-1 truncate text-[13px] text-muted-foreground">+ <button type="button" onClick={focusTopics} className="underline decoration-border-strong underline-offset-2 hover:text-foreground hover:decoration-current">+ Pick a topic to continue+ </button>+ </p>+ )}+ <Button onClick={next} disabled={!ready} className="rounded-full">Next <ArrowRight /></Button></>diff --git a/src/components/security-settings.tsx b/src/components/security-settings.tsxindex fc6bf938..5b9a4677 100644--- a/src/components/security-settings.tsx+++ b/src/components/security-settings.tsx@@ -97,7 +97,7 @@ function McpSnippet({ token, needsToken }: { token: string | null; needsToken: b<div className="space-y-1.5 sm:w-[36rem] sm:max-w-full"><p className="text-[12px] font-medium">Connect an agent over MCP</p><div className="flex items-center gap-2 rounded-lg bg-muted px-2.5 py-2">- <code className="min-w-0 flex-1 overflow-x-auto font-mono text-[11px] whitespace-nowrap">{cmd}</code>+ <code tabIndex={0} aria-label="MCP command" className="min-w-0 flex-1 overflow-x-auto rounded-sm font-mono text-[11px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring">{cmd}</code><buttontype="button"onClick={() => void copyWithToast(cmd)}diff --git a/src/components/studio/result-media.tsx b/src/components/studio/result-media.tsxindex 63a6283e..17835632 100644--- a/src/components/studio/result-media.tsx+++ b/src/components/studio/result-media.tsx@@ -3,7 +3,7 @@import { AudioLines, Box, FileText, Layers } from "lucide-react";import { createElement, useEffect, useState } from "react";import type { Generation, OutputFile } from "@/lib/catalog/types";-import { cuesOf, cueTime, isLayered, layerInfo, modelPreview, textOf } from "@/lib/output-actions";+import { cuesOf, cueTime, isLayered, layerInfo, modelPreview, textOf, videoPoster } from "@/lib/output-actions";import { cn } from "@/lib/utils";/** Any result as a tile picture: image, video (plays on hover), audio, text card, 3D preview. */@@ -17,8 +17,8 @@ export function MediaThumb({inset,}: {output: OutputFile;- /** The generation it belongs to (3D models show a sibling turntable or poster). */- g?: Pick<Generation, "outputs">;+ /** The generation it belongs to (3D models show a sibling turntable or poster; a clip, its start frame as poster). */+ g?: Pick<Generation, "outputs"> & Partial<Pick<Generation, "op" | "request">>;className?: string;autoPlay?: boolean;/** Letterbox instead of crop (Library "Fit"). */@@ -30,13 +30,16 @@ export function MediaThumb({}) {const object = fit ? "object-contain" : "object-cover";if (output.kind === "video") {+ // With a poster the clip isn't fetched until it plays (a grid of clips no longer loads every one's metadata).+ const poster = videoPoster(g, output);return (<videosrc={`${output.url}#t=0.1`}+ poster={poster}mutedloopplaysInline- preload="metadata"+ preload={poster ? "none" : "metadata"}autoPlay={autoPlay}onMouseEnter={(e) => void e.currentTarget.play().catch(() => {})}onMouseLeave={(e) => {diff --git a/src/components/studio/sketch-editor.tsx b/src/components/studio/sketch-editor.tsxindex 99169282..ae4ce354 100644--- a/src/components/studio/sketch-editor.tsx+++ b/src/components/studio/sketch-editor.tsx@@ -9,6 +9,7 @@ import { Slider } from "@/components/ui/slider";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";import { uploadFile } from "@/lib/api";import type { MotionPaths } from "@/lib/motion-paths";+import { keyCombo, useModKey } from "@/lib/keys";import { cn } from "@/lib/utils";/**@@ -168,6 +169,7 @@ function SketchCanvas({onDone: (r: SketchResult) => void;escapeRef: React.RefObject<() => boolean>;}) {+ const mod = useModKey();const wrap = useRef<HTMLDivElement>(null);const canvas = useRef<HTMLCanvasElement>(null);const ring = useRef<HTMLSpanElement>(null);@@ -522,7 +524,7 @@ function SketchCanvas({)}</div><DialogFooter className="items-center">- <p className="mr-auto hidden text-[12px] text-muted-foreground sm:block">[ ] brush size · ⌘Z undo · ⇧⌘Z redo{mode === "draw" ? " · T note" : ""}</p>+ <p className="mr-auto hidden text-[12px] text-muted-foreground sm:block">[ ] brush size · {keyCombo("Z", { mod })} undo · {keyCombo("Z", { mod, shift: true })} redo{mode === "draw" ? " · T note" : ""}</p><Button variant="ghost" onClick={() => onOpenChange(false)}>Cancel</Button>diff --git a/src/lib/composer.ts b/src/lib/composer.tsindex 2e8e9802..f5044ee3 100644--- a/src/lib/composer.ts+++ b/src/lib/composer.ts@@ -174,6 +174,8 @@ export function missingMessage(m: MissingSlot): string {return `Add ${orList(m.group.map((s) => slotMessage(s.label).replace(/^Add /, "")))}`;}+const WRITE_PROMPT = "Write a prompt first";+export interface Blocker {message: string;/** The attachment to point at (pulse) when Generate is pressed ("mask": the Paint area tile). */@@ -219,8 +221,9 @@ export function blockerFor(s: {if (s.missing) return { message: missingMessage(s.missing), slot: s.missing.key };if (s.uploading) return { message: "Uploading…", quiet: true };if (s.maskMissing) return { message: "Paint the area to change", slot: "mask" };- if (s.planError) return { message: s.planError };- if (s.promptMissing) return { message: "Write a prompt first", quiet: true };+ // The planner says "Write a prompt first" too (an empty prompt on a model that needs one): as quiet as the composer's own.+ if (s.planError) return s.planError === WRITE_PROMPT ? { message: WRITE_PROMPT, quiet: true } : { message: s.planError };+ if (s.promptMissing) return { message: WRITE_PROMPT, quiet: true };return null;}diff --git a/src/lib/keys.ts b/src/lib/keys.tsindex 95eaa344..91657172 100644--- a/src/lib/keys.ts+++ b/src/lib/keys.ts@@ -10,6 +10,16 @@ export function modKey(): "⌘" | "Ctrl" {return typeof navigator !== "undefined" && isApplePlatform(navigator.platform) ? "⌘" : "Ctrl";}+/**+ * A shortcut as this keyboard writes it: "⌘D" / "⇧⌘Z" on Apple devices, "Ctrl+D" / "Ctrl+Shift+Z"+ * elsewhere. `mod` defaults to this browser's (modKey).+ */+export function keyCombo(key: string, opts: { shift?: boolean; mod?: "⌘" | "Ctrl" } = {}): string {+ const mod = opts.mod ?? modKey();+ if (mod === "⌘") return `${opts.shift ? "⇧" : ""}⌘${key}`;+ return `Ctrl+${opts.shift ? "Shift+" : ""}${key}`;+}+const noop = () => () => {};/**diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.tsindex 22e83296..83aedfd3 100644--- a/src/lib/output-actions.ts+++ b/src/lib/output-actions.ts@@ -228,6 +228,20 @@ export function isLayered(g: Pick<Generation, "op" | "outputs">): boolean {return (g.op === "layers" || g.op === "text-layers" || g.outputs.some((o) => !!(o.meta && ("layer" in o.meta || "z" in o.meta)))) && g.outputs.length > 1;}+/**+ * A still for a clip's tile, shown before it loads (and where the browser can't decode it): the+ * output's own meta.poster / thumbnail, else, for a clip made from a start frame (image-to-video,+ * start + end frame), that frame. Undefined when there's nothing better than the clip's first frame.+ */+export function videoPoster(g: Partial<Pick<Generation, "op" | "request">> | undefined, o: Pick<OutputFile, "kind" | "meta">): string | undefined {+ if (o.kind !== "video") return undefined;+ const m = (o.meta ?? {}) as Record<string, unknown>;+ const own = ["poster", "thumbnail"].map((k) => m[k]).find((v): v is string => typeof v === "string" && v.length > 0);+ if (own) return own;+ if (g?.op !== "i2v" && g?.op !== "flf2v") return undefined;+ return g.request?.inputs?.images?.[0] || undefined;+}+/** A 3D model's still and turntable: meta.poster / meta.preview, meta.video / meta.turntable, or a sibling output. */export function modelPreview(g: Pick<Generation, "outputs">, o: OutputFile): { poster?: string; video?: string } {const m = (o.meta ?? {}) as Record<string, unknown>;diff --git a/tests/composer.test.ts b/tests/composer.test.tsindex 30c2d0c5..76595385 100644--- a/tests/composer.test.ts+++ b/tests/composer.test.ts@@ -176,7 +176,8 @@ describe("blockers", () => {expect(blockerLine(blockerFor({ ...base, planError: "Pick a voice" }), false)).toBe("touch");expect(blockerLine(blockerFor({ ...base, engineError: "Face Swap has no cloud version yet" }), true)).toBe("always");// Never for what passes by itself or is plain to see: loading, uploading, the empty prompt box.- for (const quiet of [blockerFor({ ...base, loading: "Loading models…" }), blockerFor({ ...base, uploading: true }), blockerFor({ ...base, promptMissing: true })]) {+ const plannerPrompt = blockerFor({ ...base, planError: "Write a prompt first", promptMissing: true });+ for (const quiet of [blockerFor({ ...base, loading: "Loading models…" }), blockerFor({ ...base, uploading: true }), blockerFor({ ...base, promptMissing: true }), plannerPrompt]) {expect(blockerLine(quiet, true)).toBeNull();}expect(blockerLine(null, true)).toBeNull();diff --git a/tests/keys.test.ts b/tests/keys.test.tsindex d9c1a456..8ea6c24d 100644--- a/tests/keys.test.ts+++ b/tests/keys.test.ts@@ -1,5 +1,5 @@import { afterEach, describe, expect, it, vi } from "vitest";-import { isApplePlatform, modKey } from "@/lib/keys";+import { isApplePlatform, keyCombo, modKey } from "@/lib/keys";describe("modifier key name", () => {afterEach(() => vi.unstubAllGlobals());@@ -18,3 +18,12 @@ describe("modifier key name", () => {expect(modKey()).toBe("Ctrl");});});++describe("shortcuts as the keyboard writes them", () => {+ it("uses Apple's symbols on Apple devices and words with + elsewhere", () => {+ expect(keyCombo("D", { mod: "⌘" })).toBe("⌘D");+ expect(keyCombo("Z", { mod: "⌘", shift: true })).toBe("⇧⌘Z");+ expect(keyCombo("D", { mod: "Ctrl" })).toBe("Ctrl+D");+ expect(keyCombo("Z", { mod: "Ctrl", shift: true })).toBe("Ctrl+Shift+Z");+ });+});diff --git a/tests/ux-flows.test.ts b/tests/ux-flows.test.tsindex c7607e8a..a9f35508 100644--- a/tests/ux-flows.test.ts+++ b/tests/ux-flows.test.ts@@ -3,7 +3,7 @@ import { directorPicks } from "@/components/cinema/draft";import type { Generation, OutputFile } from "@/lib/catalog/types";import { leftLabel, timeLeft, untitledName } from "@/lib/format";import { toggleAll } from "@/lib/library";-import { nextSteps } from "@/lib/output-actions";+import { nextSteps, videoPoster } from "@/lib/output-actions";function gen(outputs: Partial<OutputFile>[], over: Partial<Generation> = {}): Generation {return {@@ -102,3 +102,20 @@ describe("Library: select a whole day, or everything", () => {expect([...toggleAll(new Set(["x"]), [])]).toEqual(["x"]);});});++describe("video tiles have a poster", () => {+ const clip = { kind: "video" as const, url: "/api/files/clip.mp4" };+ it("uses the output's own still, else the start frame it was made from", () => {+ expect(videoPoster(gen([clip], { op: "t2v" }), { ...clip, meta: { poster: "/api/files/p.jpg" } })).toBe("/api/files/p.jpg");+ const i2v = gen([clip], { op: "i2v", request: { feature: "video", modelId: "m", prompt: "", inputs: { images: ["/api/files/start.png"] } } });+ expect(videoPoster(i2v, clip)).toBe("/api/files/start.png");+ expect(videoPoster({ ...i2v, op: "flf2v" }, clip)).toBe("/api/files/start.png");+ });+ it("has none when nothing better than the clip's first frame is known", () => {+ expect(videoPoster(gen([clip], { op: "t2v" }), clip)).toBeUndefined();+ // A restyle's input image isn't its first frame.+ expect(videoPoster(gen([clip], { op: "v2v", request: { feature: "video", modelId: "m", prompt: "", inputs: { images: ["/api/files/ref.png"] } } }), clip)).toBeUndefined();+ expect(videoPoster(undefined, clip)).toBeUndefined();+ expect(videoPoster(gen([{ kind: "image" }]), { kind: "image" })).toBeUndefined();+ });+});