Skip to content

Open source CapCut alternative.

TypeScript

feat(site): the settings panel floats over the editor

David Lef813d000b443
diff --git a/site/src/cut/components/Editor.tsx b/site/src/cut/components/Editor.tsx
index 8304e60e..d1f910ab 100644
--- a/site/src/cut/components/Editor.tsx
+++ b/site/src/cut/components/Editor.tsx
@@ -1282,11 +1282,9 @@ export function Editor({
copying={copying}
/>
)}
- <div
- className={`grid min-h-0 ${
- hasInspector ? "grid-cols-[auto_minmax(0,1fr)_auto]" : "grid-cols-[auto_minmax(0,1fr)]"
- }`}
- >
+ {/* The inspector floats over this row rather than taking a column of
+ it, so the preview keeps the full width and runs under the panel. */}
+ <div className="relative grid min-h-0 grid-cols-[auto_minmax(0,1fr)]">
<SidePanel projectId={projectId} onImport={importFiles} importing={importing > 0} />
<div className="grid min-h-0 min-w-0">
<Preview />
@@ -1313,12 +1311,12 @@ export function Editor({
)}
{exportOpen && <ExportDialog />}
{shareGone && (
- <div className="fixed top-14 left-1/2 z-50 -translate-x-1/2 rounded-full bg-foreground/90 px-3.5 py-1.5 text-xs font-medium text-background shadow-lg">
+ <div className="fixed top-14 left-1/2 z-50 max-w-[calc(100%-2rem)] -translate-x-1/2 rounded-full bg-foreground/90 px-3.5 py-1.5 text-center text-xs font-medium text-background shadow-lg">
This share is no longer available.
</div>
)}
{conflictReloaded && (
- <div className="fixed top-14 left-1/2 z-50 flex -translate-x-1/2 items-center gap-1.5 rounded-full bg-foreground/90 py-1.5 pr-1.5 pl-3.5 text-background shadow-lg">
+ <div className="fixed top-14 left-1/2 z-50 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-1.5 rounded-full bg-foreground/90 py-1.5 pr-1.5 pl-3.5 text-background shadow-lg">
<span className="text-xs font-medium">Reloaded a newer version saved elsewhere.</span>
<Button
variant="ghost"
diff --git a/site/src/cut/components/Inspector.tsx b/site/src/cut/components/Inspector.tsx
index 869f1689..c4aec825 100644
--- a/site/src/cut/components/Inspector.tsx
+++ b/site/src/cut/components/Inspector.tsx
@@ -182,8 +182,17 @@ export function Inspector() {
selection?.kind === "overlay" ? s.overlays.find((o) => o.id === selection.id) : undefined
);
+ // The panel floats over the editor: the preview runs the full width of the
+ // row and passes under it. While the timeline is folded away its own button
+ // holds this corner, so the panel stops above it.
+ const timelineOpen = useEditor((s) => s.timelineOpen);
return (
- <aside data-field-panel="" className="relative flex min-h-0 bg-muted/40">
+ <aside
+ className={cn(
+ "pointer-events-none absolute inset-y-0 right-0 z-30 flex items-start gap-2 p-3",
+ !timelineOpen && "pb-14"
+ )}
+ >
{/* Keyed on what is selected: picking something else builds a fresh
column, so it opens on that thing's own fields. */}
<InspectorColumn
@@ -282,7 +291,10 @@ function InspectorColumn({
onToggle={() => setOpen(!open)}
/>
{open && (
- <div className="flex min-h-0 w-[272px] shrink-0 flex-col border-l border-border bg-card">
+ <div
+ data-field-panel=""
+ className="pointer-events-auto flex max-h-full w-[272px] shrink-0 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-xl"
+ >
{clip ? (
<ClipColumn clip={clip} tab={shown} />
) : overlay && shown === ANIM_TAB.id ? (
@@ -345,7 +357,7 @@ function InspectorRail({
// visible from any view.
const baking = useMatteBakes((s) => !!clipId && s.jobs[clipId]?.status === "running");
return (
- <div className={cn("shrink-0 px-2 pt-2", !open && "absolute top-0 right-0 z-10")}>
+ <div className="pointer-events-auto shrink-0">
<div className="flex flex-col items-center gap-1 rounded-xl border bg-background p-1 shadow-md">
<RailButton id="home" label="Home" Icon={House} active={view === "main"} onClick={() => onPick("main")} />
{tabs.map(({ id, label, Icon }) => (
diff --git a/site/src/cut/server/ai/catalog.ts b/site/src/cut/server/ai/catalog.ts
index 23ba4289..255e3a5a 100644
--- a/site/src/cut/server/ai/catalog.ts
+++ b/site/src/cut/server/ai/catalog.ts
@@ -552,13 +552,13 @@ Attachments: media files dropped on the chat import into project media by themse
A link to a Donkey Cut project (…/app/p/<id>) or a share (…/s/<token>) is a document you can read whole. read_project returns it in the editor_state shape — every clip with its id, trims, rate, framing, grade, look, mask, keyframes and animations; the transition bars; titles, shapes and stickers with their keyframes; the soundtrack; the caption look and cues; aspect and background — and each source under \`media\` with its id, its observed notes and its transcript. \`unobserved\` lists video sources with neither. \`partial\` on a share names what its owner withheld.
The document is the edit. Never watch_video a reference to reconstruct what read_project already states. Watch a reference source (watch_video with project_link and its asset_id or clip_id) only to see footage whose notes leave its content unclear; that look decides a mapping and writes nothing to the reference.
**Scope is the user's.** "Replicate this" is the whole edit; "use the title from this", "bring over the music", "grade my clip like theirs", "the caption style" are items. replicate_project takes \`items\` (any ids from read_project: clips on any track, soundtrack clips, elements, cues, transition bars) and brings only those, timed from the earliest; a chosen clip brings the bars playing on it. A single clip's treatment onto footage already here is a mapping: items:[that clip], media:[{source_asset_id, asset_id: the clip here}] — its grade, look, mask, keys and animations land on a new clip cut from the user's asset; delete the old one only if they asked for a replacement. A style alone with no clip — a grade, a caption look — is also readable straight off read_project and applied with the ordinary tools (set_color_grade, set_caption_look). Files alone go through copy_project_media.
-**Mapping roles.** Each reference source the chosen items use plays from one of this project's assets or copies across. Match by content — a talking-head source to the talking-head here, b-roll to b-roll — using the reference's notes and transcripts against this project's (\`media\` in editor_state, watch_video on anything unseen). One asset here may play several reference parts. Video and stills stand in for video; audio for audio. Leave unmapped whatever has no counterpart — music, stickers, images, fonts, a clip the user wants as-is — and it copies from the reference into this project, on a card in this chat.
+**Mapping roles.** A look meant to be reproduced — type, weight, spacing, colour, edge treatment — is watched with detail original; a contact-sheet cell has already thrown those away. Each reference source the chosen items use plays from one of this project's assets or copies across. Match by content — a talking-head source to the talking-head here, b-roll to b-roll — using the reference's notes and transcripts against this project's (\`media\` in editor_state, watch_video on anything unseen). One asset here may play several reference parts. Video and stills stand in for video; audio for audio. Leave unmapped whatever has no counterpart — music, stickers, images, fonts, a clip the user wants as-is — and it copies from the reference into this project, on a card in this chat.
**After replicate_project.** Clips land after the current end of track 0 (an empty project is the natural target; with a cut already there, say where the copy landed). Read \`adjustments\`: a trim clamped to a shorter source, a still holding a clip's length — fix or report each. Then make the edit the user's: rewrite each title's text for their subject (update_overlay), generate captions when the reference wore them (subtitles_generate; the caption look is already applied for the whole edit), refine_speech_cuts on the user's speech clips, and check a frame with capture_frame. With the whole edit the reference's aspect, background and caption look come too; with \`items\` pass frame / caption_look when the user wants them. Background removal on a reference clip stays behind (its matte was baked from that footage): set_removal on the new clip when they want it.
Templates (save_template / template_add) ride the same rail and now keep grades, masks, keyframes, transitions and stickers; a whole-project template's frame and caption look are applied only by replicate_project.`,
"publish-and-export": `# Publish & export
Publish tab fields (set_publish): caption (TikTok limit 4,000 chars INCLUDING tags/emoji; hook in the first line), tags (3–5 focused tags recommended; stored space-separated, rendered as #tags), soundTitle (TikTok lets you rename the sound once after posting), handle (shown as @handle in platform previews).
-Export (open_export): one-click presets — Share (1080p H.264 MP4, plays everywhere), Best (source size, H.264 MP4, high quality), Social 4K (the cut upscaled to 4K in H.264, because TikTok, Reels and YouTube transcode a 4K upload on a higher bitrate rung than a 1080p one, so it comes back sharper), Small (720p, fastest), Master (source size, ProRes 422 HQ in a MOV with PCM audio, for handing to another editor) — and an Advanced panel with every axis: file name (the project's until typed over), range (the whole video, or the span from the first selected item's start to the last one's end when something is selected), format (MP4 or MOV), codec (H.264, HEVC at about half the size for newer devices, ProRes 422 HQ), resolution (Source, which matches the sharpest clip on the timeline along the project aspect with a 1080p floor and a 4K cap; the named rungs below it; and the named rungs above it as marked upscales: 4K, 1440p, 1080p, 720p), frame rate (Source, the rate the footage plays at, read from the files; or 24, 30, 60), quality (High, Balanced, Small, or a typed bitrate in Mbps), audio (AAC or uncompressed PCM), and a captions file — the subtitle track saved as an SRT to the browser's Downloads folder (the video lands in the project's exports), one per visible language, for platforms that take their own captions. ProRes and PCM take a MOV. Every preset runs at the source frame rate. The dialog shows the size the choice will land at. H.264 files carry the High profile and HEVC files the Main profile; both key every two seconds, what the platforms ask for. An engine from an older Donkey app cannot take a range or a typed name, and the export says to update the app. Every export renders at the project aspect ratio, titles and subtitles burned in. Files land in the project's exports/ folder and appear in the Media tab's Exports section, where each can be previewed plain or in TikTok/Instagram/YouTube chrome with the publish metadata rendered in place, revealed in Finder, or deleted.`,
+Export (open_export): one-click presets — Share (1080p H.264 MP4, plays everywhere), Best (source size, H.264 MP4, high quality), Social 4K (the cut upscaled to 4K in H.264, because TikTok, Reels and YouTube transcode a 4K upload on a higher bitrate rung than a 1080p one, so it comes back sharper), Small (720p, fastest), Master (source size, ProRes 4444 in a MOV with PCM audio, for handing to another editor or archiving the cut) — and an Advanced panel with every axis: file name (the project's until typed over), range (the whole video, or the span from the first selected item's start to the last one's end when something is selected), format (MP4 or MOV), codec (H.264, HEVC at about half the size for newer devices, ProRes 422 HQ, ProRes 4444), resolution (Source, which matches the sharpest clip on the timeline along the project aspect with a 1080p floor and a 4K cap; the named rungs below it; and the named rungs above it as marked upscales: 4K, 1440p, 1080p, 720p), frame rate (Source, the rate the footage plays at, read from the files; or 24, 30, 60), quality (High, Balanced, Small, or a typed bitrate in Mbps), audio (AAC or uncompressed PCM), and a captions file — the subtitle track saved as an SRT to the browser's Downloads folder (the video lands in the project's exports), one per visible language, for platforms that take their own captions. ProRes and PCM take a MOV, and ProRes sets its own rate, so the quality scale and a typed bitrate grey out. A ProRes 4444 master keeps every pixel's own color: the whole composite is built at 4:4:4 for it, so titles, captions and stickers land in the file without the color smearing a 4:2:0 delivery gives them. The other formats subsample, which is what H.264 and HEVC do at the encoder anyway. Every preset runs at the source frame rate. The dialog shows the size the choice will land at. H.264 files carry the High profile and HEVC files the Main profile; both key every two seconds, what the platforms ask for. An engine from an older Donkey app cannot take a range or a typed name, and the export says to update the app. Every export renders at the project aspect ratio, titles and subtitles burned in. Files land in the project's exports/ folder and appear in the Media tab's Exports section, where each can be previewed plain or in TikTok/Instagram/YouTube chrome with the publish metadata rendered in place, revealed in Finder, or deleted.`,
};
/** System prompt shared by all providers. */