Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

Merge feature/motion and preserve MVP editor integration

罗高1381c068ee9e
diff --cc README.md
index 585bb447,cbf4d177..7baf8ec0
--- a/README.md
+++ b/README.md
@@@ -52,9 -52,9 +52,9 @@@ These are the editorial directions for
These frames come from the bundled [Hyperframes examples](template-library/NOTICE.md). Pick a template and ask Codex:
- > Keep the opening and the pace of the reveal. Use our logo and the product screenshots in this repo. Hold the second screen long enough to read the new headline. Give me the editable project and an MP4.
+ > Keep the opening and the pace of the reveal. Use our logo and the product screenshots in this repo. Hold the second screen long enough to read the new headline.
-The gallery's **one-click recreate** action copies the selected reference and instructions for your Agent. A bundled or Prism template opens directly; external footage needs analysis and reconstruction. In Studio you can change the text, timing, layout and assets, or ask your Agent to make the same edit. Imported footage stays a clip.
+The gallery's **one-click recreate** action copies the selected reference and instructions for your Agent. A bundled or Prism template opens directly; external footage needs analysis and reconstruction. The MVP Studio keeps text, color, position/size, asset import, timeline edits, preview and export, plus contextual Ask Agent. Advanced editing and generation remain available to the Agent. Imported footage stays a clip.
![The editor showing the Product Promo preview, compositions and timeline.](docs/readme/editor.jpg)
diff --cc docs/product/architecture.md
index 694daacb,a2b9ba6b..82d30ea4
--- a/docs/product/architecture.md
+++ b/docs/product/architecture.md
@@@ -15,16 -15,8 +15,16 @@@ Model Gateway remains a shared media-ge
已确认的体验原则:
- Agent 与用户操作同一份工程,修改能在工作室继续编辑。
- - The project sidebar opens as a modal drawer over the editor at every viewport size. It starts closed, leaves the editor dimensions unchanged, and closes via its button, outside click or Escape. The header toggle remains mounted for focus restoration; theme and language switching live in the drawer footer. Project rows show names without dates; the heading offers a New project button instead of a count. Creation uses the existing save and revision guards before opening the blank project.
-- 全部页面共享左侧会话列表,一个会话可拥有多个工程。左侧会话和右侧浏览器顶格并列,工程工具与编辑器完整从属于浏览器 Tab;两侧可独立收起、恢复。移除全局顶栏,设置收纳在侧栏;列表可从会话顶部完全折叠,隐藏会话时由浏览器顶部恢复。
-- MCP 接入、模板发现、预览和复制指令在一个弹框里完成,保留编辑器上下文。
++- The project sidebar opens as a modal drawer over the editor at every viewport size. It starts closed, leaves the editor dimensions unchanged, and closes via its button, outside click or Escape. The header toggle remains mounted for focus restoration; privacy, theme and language settings live in the drawer footer. Error and empty-session views retain a drawer toggle so users can select an existing project or create one. Project rows show names without dates; the heading offers a New project button instead of a count. Creation uses the existing save and revision guards before opening the blank project.
+- Preview zoom percentage and Fit sit in the MVP preview header, outside the picture; fullscreen retains the in-view controls.
+- The composition list marks the live preview target, including the full video. The MVP omits the duplicate preview breadcrumb; composition switching and existing return shortcuts remain available.
+- The editor header keeps the OpenDesign logo, drawer toggle and template library on the left, centers the editable project name, and places undo/redo and export on the right. Transient save/error status remains available. The template modal preserves previews and author/source links, without integration setup sections.
+- The asset panel shows only the current project, with compact search/import controls, type filters, and a dedicated scrollable list. Usage filtering is omitted; used assets still sort first within each type. The global cache view remains in source but has no editor entry in the MVP.
+- Panel positions are fixed. Divider resizing and per-project size persistence remain; panel movement, closing and layout presets are absent. Preview alone can temporarily expand within the editor workspace, keeping the host chat visible and the player mounted. Its header button or Escape restores the previous layout and playback position; expansion is not persisted across reloads.
+- MVP controls share a locally bundled Remix Icon 4.9.1 set with the reference design system. Side-panel tabs remain text-only; brand artwork and timeline geometry are separate from control icons.
+- Timeline clips omit a title that duplicates the track header, giving its space to the preview. Distinct clip names, accessible labels, status badges and track visibility controls remain available.
+- The MVP omits the standalone timeline title strip to give its space to tracks, retaining the tool row and ruler.
+- The MVP shows Select and Split as adjacent timeline tools. Split at playhead remains available by keyboard shortcut, without a duplicate toolbar button. Tooltips add a short explanation for less familiar controls while simple actions retain a name-only hint.
- 模板先展示真实成片效果;作者、出处、内容种类和有来源的热度帮助选择。
- 交给 Agent 的复刻指令保持简短;详细配置、模板 ID 和流程由参数化指引链接承载。
- 导出成功需要真实产物与验证证据;技术检查与画面、声音、播放器检查分别记录。
@@@ -50,12 -42,11 +50,11 @@@
## 核心用户流程
-1. 用户在首页切到 Motion 模式,选择 Motion 模板并提交需求创建会话;也可直接新建空白创作,或打开左侧已有会话。内置模板复制为该会话的工程,外部参考由 Agent 制作。
-2. 需要 Agent 时选择 Codex、Claude Code、DeepSeek Harness 或通用 stdio 客户端。接入配置绑定当前工作区;Agent 验证工具和数据目录,读取当前工程与制作规范。 安装后先介绍能力、邀请并等待选择;接受首次体验即确认 `product-promo` 示例内容、独立 20 秒工程及右侧可编辑页面,用户没有要求时不导出 MP4。Agent 不再问素材/模板确认,实际打开宿主面板并检查工程载入与播放。Successful first-run delivery uses one completion sentence and an LLM-generated contextual invitation to the user's next video, following the [first-run defaults](../../skills/motion-production/references/templates.md#first-run-experience-defaults); the editable project stays open on the right. 宿主没有面板能力时明确提供链接作为降级,不能冒称已打开;实际行为按客户端验证。
-3. 用户在会话补充需求并复制给外部 Agent。一期 Agent 用 `motion_get_project` 读取明确工程及其 sessionId、需求、来源与版本,按本轮意图选择入口或直接继续已选范围;编辑前校验工程归属。For original creation, reference-video recreation and editable-template production, the Agent automatically calls `motion_open_preview({projectId})` after the requested HTML is saved and visibly opens its exact `previewUrl` in the host browser, before export or delivery; no extra user request is required. The project open in the editor is the deliverable: exports serve the Agent's checks, and MP4 files are handed over only when the user asks for them (motion-video-to-template still delivers its template ZIP). The shared [editable preview handoff](../../skills/motion-production/references/native.md#editable-preview-handoff) defines readiness, host checks and capability limitations. Continued content edits, including motion-production work, return a project/revision/version-bound previewHandoff after saving or restoring. Reuse the native project tab: present it when the calling chat is active, otherwise queue it without switching chats and resolve the latest version when the user returns. Only this turn's explicit presentation=now request permits switching back; explicit background requests suppress presentation. Codex IAB synchronizes visibility within the calling chat. A queued acknowledgment is separate from observed visibility and live-content freshness; record_display rejects stale content identities, and stored previewDisplay remains historical host-reported evidence rather than a live server measurement. 旧 design_* handler 仅留内部兼容。
+1. The user creates a blank project or opens an existing one from the sidebar, asks an external Agent to create a project, or chooses a template in the editor. Bundled templates create independent project copies; external references require Agent reconstruction.
- 2. The Agent uses the existing MCP integration and verifies the selected project, revision and workflow. Integration setup remains available outside the MVP editor.
- 3. `motion_open_preview({projectId})` opens the project directly. Project switching waits for pending saves and reloads the document to release the previous edit session. Opening a bookmark warms only its scoped native context without switching other editor tabs. Rendering and write conflicts continue to block unsafe switches.
- The existing [first-run defaults](../../skills/motion-production/references/templates.md#first-run-experience-defaults) and [editable preview handoff](../../skills/motion-production/references/native.md#editable-preview-handoff) still govern Agent delivery. Original creation, recreation and template production open the saved project before export; continued edits reuse its visible editor unless the user requests background work. First-run delivery retains the playable MP4 and contextual follow-up.
++2. The Agent uses the existing MCP integration and verifies the selected project, revision and workflow. Integration setup remains available outside the MVP editor. After installation, introduce the capabilities and wait for a choice; accepting the first-run experience selects the independent 20-second `product-promo` project and its editable host panel. Do not ask for another material/template confirmation or export an MP4 unless requested. Check that the project loads and plays; a host without a panel uses an explicit link fallback. Follow the [first-run defaults](../../skills/motion-production/references/templates.md#first-run-experience-defaults) for the completion sentence and contextual invitation.
++3. `motion_open_preview({projectId})` opens the project directly. Project switching waits for pending saves and reloads the document to release the previous edit session. Opening a bookmark warms only its scoped native context without switching other editor tabs. Rendering and write conflicts continue to block unsafe switches. Original creation, reference recreation and template production automatically open the saved project before delivery; the open editor is the deliverable, and video files are handed over only when requested (video-to-template still delivers its template ZIP). Continued edits and restores return a project/revision/version-bound previewHandoff. Reuse the native project tab: present it when the calling chat is active, otherwise queue it without switching chats and resolve the latest version when the user returns. Only this turn's explicit `presentation=now` request permits switching back; explicit background requests suppress presentation. Codex IAB synchronizes visibility within the calling chat. A queued acknowledgment is separate from observed visibility and live-content freshness; `record_display` rejects stale content identities, and stored previewDisplay remains historical host-reported evidence. The shared [editable preview handoff](../../skills/motion-production/references/native.md#editable-preview-handoff) defines readiness, host checks and capability limitations.
4. Agent 根据本轮目标直接选择 Skill:motion-director 负责原创、局部/整体叙事动作声音重新设计和创作审片;motion-template-to-video 负责已有模板出片;motion-recreate 负责参考作品重建(已接入实际流程、独立参考与测量脚本);motion-video-to-template 负责可复用模板生产;motion-production 承接既定决定下的工程操作、预览、技术检查、排错和导出。共享规则同源引用,已有 production/start 保留导航,无需前置总路由。项目来源与画面锁定不固定入口;保持项和已完成操作继续有效。
-5. Agent 导入素材或通过 Model Gateway 生成图片/视频/音频,完成后写入原生工程。用户在右侧浏览器 Tab 的 Motion Artifact Viewer 预览与编辑,可从空时间轴、素材面板或时间轴选区生成并放入指定时段;选中图片可交给 Codex 参考修改,确认后只替换素材引用并保留原生撤销。也可新增同会话的另一个工程,关闭浏览器继续会话、收起会话沉浸浏览。发生 revision 冲突时重新读取并合并。 按共享 context 补齐缺少的正文并先返回模型再执行;修改按共享 edit 核对保持项、相邻关系与后续延续。
+5. The Agent imports or generates media through the existing backend. In the editor, the user imports assets, edits text/solid color/opacity/geometry, previews, and edits clips on the timeline. Element, clip and time-range prompts still provide Ask Agent. Generation, image replacement, advanced style/animation controls, code and version-history panels are hidden without rewriting existing source content or removing Agent capabilities.
6. 完成画面、文案、声音检查后,按用户要求导出固定 revision 的快照,等待真实产物并验证。
后续需求应注明改变了哪一步、影响哪些角色,以及用户能观察到的完成条件。
diff --cc studio/src/motion/ConnectionDialog.tsx
index 781cc280,8118f903..f569b733
--- a/studio/src/motion/ConnectionDialog.tsx
+++ b/studio/src/motion/ConnectionDialog.tsx
@@@ -53,9 -43,9 +53,9 @@@ export function ConnectionDialog(props
<input id="template-search" className="ui-input connection-search" type="search" maxLength={200} placeholder={t("Search templates, creators, styles…")} aria-label={t("Search templates")} />
<button id="connection-templates" className="ui-button ui-button--ghost ui-button--sm" onClick={() => controller.current?.showTemplates()}>{t("View all templates")}</button>
</div>
- <button id="close-connections" className="ui-button ui-button--ghost ui-button--icon" aria-label={t("Close MCP connection")} disabled={props.busy} onClick={props.onClose}><MotionIcon name="close" /></button>
+ <button id="close-connections" className="ui-button ui-button--ghost ui-button--icon" aria-label={t(mvp ? "Close template library" : "Close MCP connection")} disabled={props.busy} onClick={props.onClose}><MotionIcon name="close" /></button>
</div>
- {(props.error || props.busy) && <p className="connect-error" role="status">{props.error ? t(props.error) : t('Preparing editable project…')}</p>}
+ {props.error ? <p className="connect-error" role="alert">{t(props.error)}</p> : props.busy && <p className="connect-progress" role="status"><span className="connect-progress-spinner" aria-hidden="true" />{t('Preparing editable project…')}</p>}
<div id="connection-root" ref={root} />
</dialog>;
}
diff --cc studio/src/motion/MotionApp.test.tsx
index ddb53677,ddb53677..c4800301
--- a/studio/src/motion/MotionApp.test.tsx
+++ b/studio/src/motion/MotionApp.test.tsx
@@@ -1,8 -1,8 +1,13 @@@
// @vitest-environment happy-dom
import { afterEach, expect, it, vi } from 'vitest';
--import { resolveWorkspaceProject } from './MotionApp';
++import React, { act } from 'react';
++import { createRoot } from 'react-dom/client';
++import { MotionApp, resolveWorkspaceProject } from './MotionApp';
++import { I18nProvider } from '../i18n/I18n';
++import { trackMotion } from './tracking';
vi.mock('../App', () => ({ StudioApp: () => null }));
++vi.mock('./tracking', () => ({ trackMotion: vi.fn() }));
const id = '11111111-1111-1111-1111-111111111111';
afterEach(() => vi.unstubAllGlobals());
it('resolves a bookmark without switching another page globally', async () => {
@@@ -12,6 -12,6 +17,27 @@@
expect(fetcher.mock.calls.map(call => call[0])).toEqual(['/motion-api/projects', `/motion-api/preview/open?projectId=${id}`]);
expect(fetcher.mock.calls[1][1]).toEqual({ method: 'POST', signal: expect.any(AbortSignal) });
});
++
++it('records the root editor as Studio after its active project resolves', async () => {
++ const artifact = { id: 'project', kind: 'motion-project', projectId: 'project', title: 'Existing project' };
++ const catalog = { activeId: 'project', projects: [{ id: 'project', title: 'Existing project' }], sessions: [{ id: 'project', artifacts: [artifact] }] };
++ history.replaceState(null, '', '/');
++ vi.mocked(trackMotion).mockClear();
++ vi.stubGlobal('fetch', vi.fn(async (url: string) => new Response(JSON.stringify(
++ url.endsWith('/projects') ? catalog : url.includes('/sessions/') ? { id: 'project', artifacts: [artifact] } : { projectId: 'project', revision: 'r' },
++ ))));
++ const container = document.createElement('div');
++ document.body.append(container);
++ const root = createRoot(container);
++ try {
++ await act(async () => root.render(<I18nProvider><MotionApp /></I18nProvider>));
++ expect(trackMotion).toHaveBeenCalledExactlyOnceWith('page_view', expect.objectContaining({ page_name: 'studio', has_project: true }));
++ } finally {
++ act(() => root.unmount());
++ container.remove();
++ history.replaceState(null, '', '/');
++ }
++});
it('invalid, deleted and conflicting links cannot silently open a different project', async () => {
const fetcher = vi.fn(async () => new Response(JSON.stringify({ activeId: 'project', projects: [{ id: 'project' }] })));
vi.stubGlobal('fetch', fetcher);
@@@ -33,3 -33,3 +59,26 @@@ it('does not mount a bookmark when its
vi.stubGlobal('fetch', fetcher);
await expect(resolveWorkspaceProject(id, new AbortController().signal)).rejects.toThrow('Native opening timed out');
});
++
++it.each(['deleted project', 'empty session'])('keeps the project drawer reachable from a %s', async route => {
++ const artifact = { id: 'project', kind: 'motion-project', projectId: 'project', title: 'Existing project' };
++ const catalog = { activeId: 'project', projects: [{ id: 'project', title: 'Existing project' }], sessions: [{ id: 'project', artifacts: [artifact] }] };
++ history.replaceState(null, '', route === 'empty session' ? `/?session=${id}` : `/?project=${id}`);
++ vi.stubGlobal('fetch', vi.fn(async (url: string) => new Response(JSON.stringify(
++ url.endsWith('/projects') ? catalog : url.includes('/sessions/') ? { id, artifacts: [] } : { projectId: 'project', revision: 'r' },
++ ))));
++ const container = document.createElement('div');
++ document.body.append(container);
++ const root = createRoot(container);
++ try {
++ await act(async () => root.render(<I18nProvider><MotionApp /></I18nProvider>));
++ const toggle = container.querySelector<HTMLButtonElement>('.motion-workspace-menu');
++ expect(toggle).not.toBeNull();
++ await act(async () => toggle!.click());
++ expect(document.querySelector('.motion-session')?.textContent).toContain('Existing project');
++ } finally {
++ act(() => root.unmount());
++ container.remove();
++ history.replaceState(null, '', '/');
++ }
++});
diff --cc studio/src/motion/MotionApp.tsx
index 56c4434a,81a94cb2..5266843c
--- a/studio/src/motion/MotionApp.tsx
+++ b/studio/src/motion/MotionApp.tsx
@@@ -1,10 -1,13 +1,11 @@@
- import { useEffect, useState } from 'react';
+ import { useEffect, useRef, useState } from 'react';
import { useI18n } from '../i18n/I18n';
--import { WorkspaceFrame } from './WorkspaceFrame';
-import { MotionHome } from './MotionHome';
++import { WorkspaceFrame, WorkspaceMenuButton } from './WorkspaceFrame';
import { motionApi, type ProjectCatalog } from './useWorkspace';
import { requestedProject, validWorkspaceProject } from './workspaceRouting';
-import { MotionSessionFrame } from './MotionSessionFrame';
import type { SessionDetail, SessionArtifact } from '../../../shared/session';
import { ArtifactViewer } from './ArtifactViewer';
+ import { trackMotion } from './tracking';
const noPendingSaves = async () => {};
@@@ -24,7 -27,18 +25,16 @@@ export function MotionApp()
const [ready, setReady] = useState<{ sessionId: string; artifact?: SessionArtifact } | null>(null);
const [error, setError] = useState('');
const [attempt, retry] = useState(0);
+ const view = useRef({ id: crypto.randomUUID(), started: performance.now(), sent: false });
+ useEffect(() => {
- const home = projectId === null && sessionId === null;
- if (view.current.sent || (!home && !ready && !error)) return;
++ if (view.current.sent || (!ready && !error)) return;
+ view.current.sent = true;
+ const embedded = new URLSearchParams(location.search).get('embed') === '1';
- if (home || ready) void trackMotion('page_view', { page_name: home ? 'home' : 'studio', view_id: view.current.id, embedded, has_project: Boolean(ready?.artifact) });
- if (!home && error) void trackMotion('studio_load_result', { load_id: view.current.id, outcome: 'failure', embedded,
++ if (ready) void trackMotion('page_view', { page_name: 'studio', view_id: view.current.id, embedded, has_project: Boolean(ready.artifact) });
++ if (error) void trackMotion('studio_load_result', { load_id: view.current.id, outcome: 'failure', embedded,
+ duration_ms: Math.min(86_400_000, Math.round(performance.now() - view.current.started)) });
+ }, [projectId, sessionId, ready, error]);
useEffect(() => {
- if (projectId === null && sessionId === null) return;
const controller = new AbortController();
setError('');
async function resolve() {
@@@ -46,7 -59,8 +56,7 @@@
void resolve().catch(err => { if (!controller.signal.aborted) setError((err as Error).message); });
return () => controller.abort();
}, [projectId, sessionId, attempt]);
- if (error) return <WorkspaceFrame waitForSaves={noPendingSaves}><div className="motion-route-state" role="alert"><h1>{t('Could not open project')}</h1><p>{t(error)}</p><div><a className="motion-button" href="/">{t('Open active project')}</a><button className="motion-button" onClick={() => retry(value => value + 1)}>{t('Retry')}</button></div></div></WorkspaceFrame>;
- if (projectId === null && sessionId === null) return <WorkspaceFrame waitForSaves={noPendingSaves}><MotionHome /></WorkspaceFrame>;
- if (error) return <WorkspaceFrame waitForSaves={noPendingSaves}><div className="motion-route-state" role="alert"><h1>{t('Could not open project')}</h1><p>{t(error)}</p><div><a className="motion-button" href="/">{t('Back to home')}</a><button className="motion-button" onClick={() => retry(value => value + 1)}>{t('Retry')}</button></div></div></WorkspaceFrame>;
++ if (error) return <WorkspaceFrame waitForSaves={noPendingSaves}><div className="motion-route-state" role="alert"><h1>{t('Could not open project')}</h1><p>{t(error)}</p><div><WorkspaceMenuButton /><a className="motion-button" href="/">{t('Open active project')}</a><button className="motion-button" onClick={() => retry(value => value + 1)}>{t('Retry')}</button></div></div></WorkspaceFrame>;
const loading = <div className="motion-route-state" role="status">{t('Opening project…')}</div>;
- return ready ? <WorkspaceFrame waitForSaves={noPendingSaves} projectId={ready.artifact?.projectId} sessionId={ready.sessionId}>{ready.artifact ? <ArtifactViewer artifact={ready.artifact} /> : <div className="motion-route-state">{t('Create a project with your Agent to start editing.')}</div>}</WorkspaceFrame> : loading;
- return ready ? <WorkspaceFrame waitForSaves={noPendingSaves} projectId={ready.artifact?.projectId} sessionId={ready.sessionId}><MotionSessionFrame sessionId={ready.sessionId} projectId={ready.artifact?.projectId}>{ready.artifact && <ArtifactViewer artifact={ready.artifact} />}</MotionSessionFrame></WorkspaceFrame> : loading;
++ return ready ? <WorkspaceFrame waitForSaves={noPendingSaves} projectId={ready.artifact?.projectId} sessionId={ready.sessionId}>{ready.artifact ? <ArtifactViewer artifact={ready.artifact} /> : <div className="motion-route-state"><WorkspaceMenuButton />{t('Create a project with your Agent to start editing.')}</div>}</WorkspaceFrame> : loading;
}
diff --cc studio/src/motion/MotionStudioHost.test.tsx
index b2ab7f8f,b3b11ee4..b86b7e82
--- a/studio/src/motion/MotionStudioHost.test.tsx
+++ b/studio/src/motion/MotionStudioHost.test.tsx
@@@ -52,27 -53,19 +52,28 @@@ function render(historyBusy = false)
handleCaptureFrameClick={vi.fn()} refreshCaptureFrameTime={vi.fn()} inspectorButtonActive={false}
inspectorPanelActive={false} onExport={state.export} /></MotionEditorFrame></MotionStudioHost>));
}
+function openSidebar() {
+ act(() => container.querySelector<HTMLButtonElement>('.motion-workspace-menu')!.click());
+}
const button = (text: string) => [...container.querySelectorAll('button')].find(el => el.textContent === text)!;
-it('shares project sessions outside the native editor while Export keeps the native callback', () => {
+it('keeps project switching, templates, history actions and native export in the MVP', () => {
render();
const header = container.querySelector('.motion-studio-header')!;
- const project = container.querySelector<HTMLButtonElement>('.motion-session[title="Second"]')!;
+ openSidebar();
+ const project = document.querySelector<HTMLButtonElement>('.motion-session[title="Second"]')!;
expect(header.contains(project)).toBe(false);
- expect(container.querySelector('.motion-session[aria-current="page"]')?.textContent).toContain('Demo');
- for (const text of ['模板库', '预览', '布局', '历史', '导出']) expect(header.contains(button(text))).toBe(true);
+ expect(document.querySelector('.motion-session[aria-current="page"]')?.textContent).toContain('Demo');
+ for (const text of ['模板库', '导出']) expect(header.contains(button(text))).toBe(true);
expect(container.querySelector('.motion-workspace-topbar')).toBeNull();
- expect(container.querySelector('.motion-sidebar-nav')?.textContent).toContain('连接 Agent');
- expect(container.querySelector('.motion-sidebar-settings [aria-label="模型设置"]')).not.toBeNull();
- expect(container.querySelector('.motion-sidebar-settings [aria-label="语言"]')).not.toBeNull();
+ for (const text of ['预览', '布局', '历史', '连接 Agent', '新建会话', '首页']) expect(button(text)).toBeUndefined();
+ expect(container.querySelector('.motion-save-state')).toBeNull();
+ expect(container.querySelector('a[download]')).toBeNull();
+ expect(document.querySelector('.motion-brand')?.tagName).toBe('DIV');
+ expect(document.querySelector('.motion-sidebar-settings [aria-label="模型设置"]')).toBeNull();
++ expect(document.querySelector('.motion-sidebar-settings [aria-label="隐私设置"]')).not.toBeNull();
+ expect(header.querySelector('[aria-label="语言"]')).toBeNull();
+ expect(document.querySelector('.motion-sidebar-settings [aria-label="语言"]')).not.toBeNull();
act(() => container.querySelector<HTMLButtonElement>('[aria-label="撤销"]')!.click());
act(() => container.querySelector<HTMLButtonElement>('[aria-label="重做"]')!.click());
expect(state.undo).toHaveBeenCalledOnce();
diff --cc studio/src/motion/MotionStudioHost.tsx
index d7e002b4,8bba33b4..05a2b5c8
--- a/studio/src/motion/MotionStudioHost.tsx
+++ b/studio/src/motion/MotionStudioHost.tsx
@@@ -6,19 -8,14 +6,21 @@@ import { TimelineHistoryButtons } from
import { isStudioEditSaving } from '../utils/studioPendingEdits';
import { MotionIcon } from './icons';
import { StudioHostContext, type StudioHost } from './StudioHost';
-import { WorkspaceFrame, useWorkspaceChrome, useOptionalWorkspaceChrome } from './WorkspaceFrame';
-import { MotionLayoutMenu, MotionPreviewButton } from './MotionLayoutControls';
-import { MotionHistoryPanel } from './MotionHistoryPanel';
+import { WorkspaceFrame, WorkspaceMenuButton, useWorkspaceChrome, useOptionalWorkspaceChrome } from './WorkspaceFrame';
import { MotionHistoryProvider, useMotionHistoryOperation } from './MotionHistoryState';
-import { MediaGatewayProvider, useMediaGateway } from './MediaGatewayContext';
+import { MediaGatewayProvider } from './MediaGatewayContext';
+import { useShownStudioTheme } from '../utils/studioTheme';
+ import { workspacePresentation } from '../../../shared/workspace-url';
+ import { trackMotion } from './tracking';
+function WorkspaceBrand() {
+ const theme = useShownStudioTheme();
+ return <span className="motion-header-brand">
+ <WorkspaceMenuButton />
+ <img src={`/web/design-system/opendesign-${theme === 'dark' ? 'light' : 'dark'}.svg`} alt="OpenDesign" width="104" height="18" />
+ </span>;
+}
+
export function MotionEditorFrame({ children }: { children: ReactNode }) {
const { t } = useI18n();
const { projectId, waitForPendingDomEditSaves, writeBlockedReason, renderQueue } = useStudioShellContext();
diff --cc studio/src/motion/WorkspaceFrame.tsx
index e25f0c93,e97c2379..2192d264
--- a/studio/src/motion/WorkspaceFrame.tsx
+++ b/studio/src/motion/WorkspaceFrame.tsx
@@@ -1,15 -1,15 +1,17 @@@
- import { createContext, useContext, useState, useRef, useCallback, type ReactNode } from 'react';
-import { createContext, useContext, useEffect, useState, useRef, useCallback, lazy, Suspense, type ReactNode } from 'react';
++import { createContext, useContext, useState, useRef, useCallback, lazy, Suspense, type ReactNode } from 'react';
import { useI18n } from '../i18n/I18n';
+import { LanguageMenu } from '../i18n/LanguageMenu';
import { ConnectionDialog } from './ConnectionDialog';
import { MotionIcon } from './icons';
import { useWorkspace } from './useWorkspace';
import { ThemeToggle } from '../components/ThemeToggle';
-import { LanguageMenu } from '../i18n/LanguageMenu';
+import { Tooltip } from '../components/ui/Tooltip';
+import { Dialog } from '@base-ui/react/dialog';
+import { useShownStudioTheme } from '../utils/studioTheme';
import { workspacePresentation } from '../../../shared/workspace-url';
-const ModelSettings = lazy(() => import('./ModelSettings').then(module => ({ default: module.ModelSettings })));
+ const PrivacySettings = lazy(() => import('./PrivacySettings').then(module => ({ default: module.PrivacySettings })));
+
type WorkspaceChrome = {
workspace: ReturnType<typeof useWorkspace>;
switchingDisabled: boolean;
@@@ -76,39 -92,50 +78,45 @@@ export function WorkspaceFrame({ childr
</WorkspaceChromeContext.Provider>;
}
-function ModelSettingsButton() {
- const { t } = useI18n();
- const { openModelSettings } = useWorkspaceChrome();
- return <button className="motion-icon-button" aria-label={t('Model settings')} title={t('Model settings')} onClick={openModelSettings}><MotionIcon name="sliders" /></button>;
-}
-
+ function PrivacySettingsButton() {
+ const { t } = useI18n(); const [open, setOpen] = useState(false);
+ return <><button className="motion-icon-button" aria-label={t('Privacy settings')} title={t('Privacy settings')} onClick={() => setOpen(true)}><MotionIcon name="eye" /></button>
+ {open && <Suspense fallback={null}><PrivacySettings onClose={() => setOpen(false)} /></Suspense>}</>;
+ }
+
function WorkspaceSidebar({ currentId, close }: { currentId?: string; close: () => void }) {
- const { t, formatDate } = useI18n();
- const { workspace, switchingDisabled, openConnections } = useWorkspaceChrome();
+ const { t } = useI18n();
+ const theme = useShownStudioTheme();
+ const { workspace, switchingDisabled } = useWorkspaceChrome();
const [query, setQuery] = useState('');
- const sessions = workspace.sessions ?? workspace.projects;
- const filtered = sessions.filter(project => project.title.toLocaleLowerCase().includes(query.toLocaleLowerCase()));
+ const projects = workspace.projects;
+ const filtered = projects.filter(project => project.title.toLocaleLowerCase().includes(query.toLocaleLowerCase()));
return <aside className="motion-sidebar" aria-label={t('Workspace navigation')}>
<div className="motion-sidebar-brand">
- <button className="motion-brand" disabled={switchingDisabled} onClick={() => void workspace.home()} aria-label={t('OpenDesign home')} title={t('OpenDesign home')}>
- <span className="motion-brand-mark"><MotionIcon name="layers" size={18} /></span><strong>OpenDesign</strong>
- </button>
- <button className="motion-icon-button motion-sidebar-close" onClick={close} aria-label={t('Close conversation list')}><MotionIcon name="close" /></button>
+ <Dialog.Close className="motion-icon-button" aria-label={t('Close project list')}><MotionIcon name="sidebar" size={16} /></Dialog.Close>
+ <div className="motion-brand">
+ <img className="motion-brand-logo" src={`/web/design-system/opendesign-${theme === 'dark' ? 'light' : 'dark'}.svg`} alt="OpenDesign" width="104" height="18" />
+ </div>
</div>
- <button className="motion-button motion-button-primary motion-sidebar-new" title={t('New conversation')} disabled={switchingDisabled} onClick={() => void workspace.startSession()}><MotionIcon name="plus" /><span>{t('New conversation')}</span></button>
- <nav className="motion-sidebar-nav" aria-label={t('Main navigation')}>
- <button aria-current={!currentId ? 'page' : undefined} title={t('Home')} disabled={switchingDisabled} onClick={() => { if (currentId) void workspace.home(); else close(); }}><MotionIcon name="home" /><span>{t('Home')}</span></button>
- <button title={t('Connect Agent')} onClick={openConnections}><MotionIcon name="plug" /><span>{t('Connect Agent')}</span></button>
- </nav>
- <div className="motion-session-heading"><span>{t('Sessions')}</span><span>{sessions.length}</span></div>
- <label className="motion-session-search"><MotionIcon name="search" /><input type="search" value={query} onChange={event => setQuery(event.target.value)} placeholder={t('Search conversations…')} aria-label={t('Search conversations')} /></label>
- <nav className="motion-session-list" aria-label={t('Conversation list')}>
- {!workspace.status && !workspace.error && <p className="motion-session-empty" role="status">{t('Loading conversations…')}</p>}
- {workspace.status && !filtered.length && <p className="motion-session-empty">{t(query ? 'No matching conversations' : 'Create your first conversation')}</p>}
+ <div className="motion-session-heading">
+ <span>{t('Projects')}</span>
+ <Tooltip label={t('New project')}>
+ <button type="button" className="motion-icon-button" aria-label={t('New project')} disabled={switchingDisabled} onClick={() => void workspace.create()}>
+ <MotionIcon name="plus" size={16} />
+ </button>
+ </Tooltip>
+ </div>
+ <label className="motion-session-search"><MotionIcon name="search" /><input type="search" value={query} onChange={event => setQuery(event.target.value)} placeholder={t('Search projects…')} aria-label={t('Search projects')} /></label>
+ <nav className="motion-session-list" aria-label={t('Project list')}>
+ {!workspace.status && !workspace.error && <p className="motion-session-empty" role="status">{t('Loading projects…')}</p>}
+ {workspace.status && !filtered.length && <p className="motion-session-empty">{t(query ? 'No matching projects' : 'Create a project with your Agent to start editing.')}</p>}
{filtered.map(project => <button key={project.id} className="motion-session" aria-current={currentId === project.id ? 'page' : undefined}
- title={project.title} disabled={switchingDisabled} onClick={() => { if (project.id === currentId) close(); else void workspace.openSession(project.id); }}>
- <MotionIcon name="message" /><span><strong>{project.title}</strong><small>{project.openedAt || project.createdAt ? formatDate((project.openedAt || project.createdAt)!, { month: 'short', day: 'numeric' }) : t('Local project')}</small></span>
+ title={project.title} disabled={switchingDisabled} onClick={() => { if (project.id === currentId) close(); else void workspace.open('projects', project.id); }}>
+ <MotionIcon name="message" /><span><strong>{project.title}</strong></span>
</button>)}
</nav>
<footer className="motion-sidebar-footer">
- <div className="motion-sidebar-settings"><ThemeToggle /><LanguageMenu /></div>
- <div className="motion-sidebar-identity"><MotionIcon name="folder" /><span><strong>{t('My workspace')}</strong><small>{t('Saved on this device')}</small></span></div>
- <div className="motion-sidebar-settings"><ModelSettingsButton /><PrivacySettingsButton /><ThemeToggle /><LanguageMenu /></div>
++ <div className="motion-sidebar-settings"><PrivacySettingsButton /><ThemeToggle /><LanguageMenu /></div>
</footer>
</aside>;
}
diff --cc studio/src/motion/theme.css
index 2b2dcb7f,ae366816..d8edddc6
--- a/studio/src/motion/theme.css
+++ b/studio/src/motion/theme.css
@@@ -286,55 -246,3 +286,55 @@@ button, input, select, textarea { font-
:root[data-motion-ui] .hf-od-field {
--color-accent: var(--motion-selected);
}
+/* Pointer focus must not leave a second frame around boxed controls. */
+:root[data-motion-ui] .hf-od-field:focus-within { outline: none; }
+:root[data-motion-ui] .hf-od-field:is(:focus-visible, :has(:focus-visible)) {
+ border-color: var(--motion-border-strong);
+ background: var(--motion-inset);
+}
+
+/* Preview identity follows the live composition, including full-video navigation. */
+:root[data-motion-ui] .motion-composition-card[aria-current="true"] { background: var(--motion-inset); }
+:root[data-motion-ui] .motion-composition-card[aria-current="true"] .motion-composition-name { color: var(--motion-strong); font-weight: 600; }
+
+:root[data-motion-ui] .hf-od-floating-surface.motion-speed-menu { background: var(--motion-raised); border: 0; outline: none; box-shadow: var(--motion-shadow-sm); }
+
- /* Equal side columns keep the project name centered in the editor. */
- .motion-studio-header.motion-studio-header-centered { padding-block: 11.5px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
++/* Equal side columns center the title; narrow hosts preserve the controls before the title. */
++.motion-studio-header.motion-studio-header-centered { padding-block: 11.5px; display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 1fr) minmax(max-content, 1fr); gap: 12px; }
+.motion-studio-header.motion-studio-header-centered > div { min-width: 0; width: auto; }
+.motion-studio-header.motion-studio-header-centered > div:last-child { justify-self: end; flex-wrap: nowrap; }
+.motion-studio-header-centered .motion-workspace-actions { padding-right: 0; margin-right: 0; border-right: 0; }
+.motion-header-brand { display: inline-flex; align-items: center; gap: 10px; }
+.motion-header-brand img { display: block; width: 104px; height: auto; }
+.motion-header-project .motion-project-control { justify-content: center; }
+/* Keep one input mounted with stable geometry before, during and after editing. */
+.motion-header-project .motion-project-name-input {
+ box-sizing: border-box;
+ width: min(320px, 100%);
+ min-width: 0;
+ height: 28px;
+ padding: 4px 8px;
+ border: 1px solid transparent;
+ border-radius: var(--motion-radius-sm);
+ background: transparent;
+ color: var(--motion-strong);
+ line-height: 18px;
+ text-align: center;
+ text-overflow: ellipsis;
+}
+:root[data-motion-ui] .motion-studio-header-centered :is(button, .motion-project-name-input) {
+ font-size: var(--motion-text-md);
+ line-height: 18px;
+}
+:root[data-motion-ui] .motion-project-name-input:is(:hover, :focus) {
+ border-color: var(--motion-border);
+ background: var(--motion-bg);
+ outline: none;
+ box-shadow: none;
+}
+.motion-header-project .motion-save-state { position: absolute; top: 100%; white-space: nowrap; }
+.motion-header-project .motion-project-control { position: relative; }
+@media (max-width: 700px) {
+ .motion-studio-header.motion-studio-header-centered { grid-template-columns: auto minmax(0, 1fr); }
+ .motion-studio-header.motion-studio-header-centered > div:last-child { grid-column: 1 / -1; }
+}