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.
TypeScript agent-skillsagentic-aiai-agentsai-videobyokclaude-codecodexdeepseek-harnessdsh-plugingenerative-ailocal-firstmcpmotionmotion-graphicsmultimodalopenmotionreverse-engineeringvideo-editingvideo-generationworkbuddy
fix(studio): clarify asset actions and elevate global feedback
open-design-crew[bot]13247b2a641c
diff --git a/docs/product/architecture.md b/docs/product/architecture.mdindex 8e9552bf..176bf14e 100644--- a/docs/product/architecture.md+++ b/docs/product/architecture.md@@ -20,14 +20,14 @@ Model Gateway remains a shared media-generation backend for MCP, using local Cod- 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.- An empty, loaded root composition shows a centered import/drop prompt over the mounted preview and hides transport controls, including the placeholder duration. The empty state requires both no timeline clips and no authored preview content; loading, failed previews and nested compositions retain their existing states. Import uses the existing timeline gateway and file-drop pipeline. The empty timeline retains its drop target and ruler, with a muted dashed track sketch instead of a duplicate import prompt or button. Empty timelines disable zoom controls. A confirmed empty composition blocks new exports at both the settings button and the shared editor render-start handler, while existing export history remains available. Properties distinguish no content from no selection; small panel empty states share muted text and icon sizing. Preview zoom percentage and Fit sit in the MVP preview header, outside the picture. Clicking the percentage opens 50%, 75%, 100%, 150% and 200% presets in a compact opaque menu. The MVP hides the corner position navigator; existing zoom gestures and Fit remain available. Browser fullscreen is unavailable in the MVP, including its playback button and keyboard entry; workspace preview expansion remains available. Playback controls respond to their own container width: secondary-button gaps narrow below 420px, and speed/loop controls hide below 420px so timecode, play/pause and volume remain on one row. Preview and track volume use upward floating vertical sliders, opened by hover or keyboard focus; clicking the speaker still toggles mute.- The composition list places the full video first, preserves the remaining clip order, and marks the live preview target. Queued, loading, missing and failed covers share a muted gray OD placeholder without failure text; decoded covers replace it automatically. A confirmed empty root is omitted from this list using the same loaded-preview content check; when no clips remain, the panel shows a brief empty state. 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. Clearing the title and committing with blur or Enter saves the localized Untitled default; Escape cancels. A logo-only community link sits immediately before Export and opens the public Discord community in every interface language, with a localized accessible tooltip; external links open separately from the editor. Transient save/error status remains available. Workspace and export failures show concise causes and available next steps, with raw diagnostics behind expandable, copyable details. Workspace connection failures use a persistent single-line feedback toast at the top center with a Reconnecting status and no buttons or diagnostic details. The Reconnecting ellipsis animates without changing the toast width; reduced-motion preferences keep it static. Automatic polling waits 1.8 seconds after each completed attempt and removes the toast on recovery; it has no overall retry limit or explicit per-request timeout and does not start a stopped service. Other notice dismissal does not bypass write guards. Toasts stack at the top center of the editor; identical notices replace their previous instance. Error toasts use the compact neutral feedback surface and concise recognized causes, with a dismiss button and no details icon or expandable diagnostics. Detailed error panels retain their diagnostic controls. Informational toasts disappear after three seconds without a close control; actionable error notices remain dismissible and do not auto-expire. Save-queue pauses use a brief, localized feedback toast without paths, diagnostics or a retry action; it expires after three seconds without clearing the write guard or claiming that failed edits were saved. The template library reuses the website catalog layout: brand/use-case/video-type facets, configured featured templates, search and sorting, without site navigation, promotional hero or footer. Prism metadata and local cache updates drive the list. The catalog selects the editor locale from a shared multilingual publication, falling back to English and then the Resource default; template-copy prompts support the same eleven UI languages. Previews, author/source links and editable-project opening remain available. The detail view keeps the motion.md download action (`motionDocumentUrl`) above its guide content (`styleDescription`, `reviewFocus`, `motionGuideUrl`). Recreate opens a separate prompt dialog; copied instructions never occupy the guide area.-- The asset panel shows only the current project, with compact search/import controls, type filters, and a dedicated scrollable list. User-uploaded audio rows in My assets show full filenames with their original extensions and wrap long names within the panel; the generic Audio label is omitted, while duration and specific BGM/SFX/Voice labels remain when available. Official library sources and presentation are unchanged. Usage filtering is omitted; used assets still sort first within each type. In both My assets and the official animation library, hover plays only the card thumbnail, while clicking opens a centered modal preview over a gray full-editor backdrop. The modal reuses Studio-styled playback, volume and speed controls; its play button stays centered, and speed/loop controls hide below 420px to avoid overlap. Volume and loop icons are 16px inside 28px buttons, and playback speed text is 12px; closing it restores access to the paused composition; previewing media does not add it to the project. The global cache view remains in source but has no editor entry in the MVP.+- 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. Clearing the title and committing with blur or Enter saves the localized Untitled default; Escape cancels. A logo-only community link sits immediately before Export and opens the public Discord community in every interface language, with a localized accessible tooltip; external links open separately from the editor. Transient save/error status remains available. Workspace and export failures show concise causes and available next steps, with raw diagnostics behind expandable, copyable details. Workspace connection failures use a persistent single-line feedback toast at the top center with a Reconnecting status and no buttons or diagnostic details. The Reconnecting ellipsis animates without changing the toast width; reduced-motion preferences keep it static. Automatic polling waits 1.8 seconds after each completed attempt and removes the toast on recovery; it has no overall retry limit or explicit per-request timeout and does not start a stopped service. Other notice dismissal does not bypass write guards. Editor toasts stack at the top center; editor, connection and template-copy feedback share a top-layer host above native dialogs and ordinary overlays, without taking focus. Template-copy feedback retains its existing placement and three-second lifetime; identical notices replace their previous instance. Error toasts use the compact neutral feedback surface and concise recognized causes, with a dismiss button and no details icon or expandable diagnostics. Detailed error panels retain their diagnostic controls. Informational toasts disappear after three seconds without a close control; actionable error notices remain dismissible and do not auto-expire. Save-queue pauses use a brief, localized feedback toast without paths, diagnostics or a retry action; it expires after three seconds without clearing the write guard or claiming that failed edits were saved. The template library reuses the website catalog layout: brand/use-case/video-type facets, configured featured templates, search and sorting, without site navigation, promotional hero or footer. Prism metadata and local cache updates drive the list. The catalog selects the editor locale from a shared multilingual publication, falling back to English and then the Resource default; template-copy prompts support the same eleven UI languages. Previews, author/source links and editable-project opening remain available. The detail view keeps the motion.md download action (`motionDocumentUrl`) above its guide content (`styleDescription`, `reviewFocus`, `motionGuideUrl`). Recreate opens a separate prompt dialog; copied instructions never occupy the guide area.+- The asset panel shows only the current project, with compact search/import controls, type filters, and a dedicated scrollable list. User-uploaded audio rows in My assets show full filenames with their original extensions and wrap long names within the panel; the generic Audio label is omitted, while duration and specific BGM/SFX/Voice labels remain when available. Official library sources and presentation are unchanged. Assets referenced by the current composition carry an In use badge (已使用 in Chinese); unused assets have no badge. MVP My assets deletion invokes the existing file-deletion handler directly from the menu, without a second confirmation; the full editor retains its confirmation. This does not introduce a new undo mechanism or alter official catalog assets. Usage filtering is omitted; used assets still sort first within each type. In both My assets and the official animation library, hover plays only the card thumbnail, while clicking opens a centered modal preview over a gray full-editor backdrop. The modal reuses Studio-styled playback, volume and speed controls; its play button stays centered, and speed/loop controls hide below 420px to avoid overlap. Volume and loop icons are 16px inside 28px buttons, and playback speed text is 12px; closing it restores access to the paused composition; previewing media does not add it to the project. The global cache view remains in source but has no editor entry in the MVP.- Panel positions are fixed. Export settings and render history live in a compact popover below the header Export button, outside the right panel. Both side groups can temporarily collapse into 48px vertical icon rails, giving their width to preview; the rail toggle restores the previous width and tab, while a module icon opens that module. Collapse does not remove panels or remount the player. Opening the MVP starts both sides collapsed and the timeline at 30% of the available dock height (subject to minimum sizes); users can then drag the divider to enlarge or reduce it. The fixed layout reserves at least 360px for preview, 260px for each expanded side panel. Side availability retains the existing conservative breakpoints, independently of the resizable minimums: below 740px both side groups and rails hide; from 740px to 1011px only one side can expand; wider hosts allow both only when their requested widths leave the preview floor intact. Opening a side through a toggle, module shortcut or programmatic activation uses the same fit check and closes the opposite side when necessary. Shrinking the host collapses expanded sides when they no longer fit; widening restores collapsed rails without automatically reopening panels. At widths smaller than the preview floor, preview uses the available workspace. Remembered expanded side widths remain available when reopening a side. Divider hover and drag change only the thin line to green. Divider resizing and per-project expanded-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. Menu selections consistently use check icons, and the language menu is 180px wide. Expanded side-panel tabs remain text-only; collapsed rails use the corresponding panel icons. Brand artwork and timeline geometry are separate from control icons.- The editor startup shell and project/editor loading boundaries share a centered, theme-aware OD symbol without adding a minimum loading delay. Below 700px of workspace content width, the editor header stays on one row: undo/redo and version history hide, the template library becomes icon-only, the project title truncates, and Export stays at the right edge.- MVP audio-bearing tracks expose a single speaker button before visibility in the track header: click toggles mute, while hover or keyboard focus opens a compact volume slider, writing every audio/video clip in that row through native saves and undo. Video visibility remains separate, and preview-monitor volume remains a playback preference. Clip-count badges are omitted to make room for these controls. The audio-meter toolbar toggle, meter display and audio FX entry points (track presets, group effects and inspector rack) are omitted in the MVP. The media inspector exposes speed, media start, loop and Fit; Fit uses the same shared menu surface as font controls. It omits the source-path row, Position, path-copy, cutout controls, gain/volume automation, speed automation/presets, audio fades, mute and audio-track toggles. Color fields retain their selected preview until an asynchronous save settles, and roll back on rejection. Existing authored media/audio values remain intact, with track mute and volume available in the timeline. Track audio controls use cached source audio-track detection independently of mute and gain; unknown video sources retain controls until confirmed silent. Track volume sliders cover 0–100% and show effective zero output while muted, retaining the saved volume for unmute.- MVP timeline clips omit visible name bands, giving their space to thumbnails or waveforms. Videos with embedded audio show video frames only; independent audio clips retain waveforms. MVP fade handles are hidden while authored effects and trimming remain intact. Ruler text counter-scales during zoom animation so glyphs keep their width. Track headers, hover titles, accessible clip names, the FX badge and track visibility controls remain available. Volume badges are omitted in the MVP; the track speaker retains the volume readout.-- Export offers native MP4, MOV, WebM and GIF. GIF includes loop-count controls and a 30 fps limit. MOV and WebP use short format names; ProRes appears in the MOV format help. WebP remains disabled; its encoding backend is not implemented.+- Export history shows the filename and relative export time, without render-duration metadata. Filenames use 12px medium text, dates use 11px text with 4px top spacing, and the text block reserves an additional 8px before download/delete actions; long filenames truncate with the full value available on hover. Export offers native MP4, MOV, WebM and GIF. GIF includes loop-count controls and a 30 fps limit. MOV and WebP use short format names; ProRes appears in the MOV format help. WebP remains disabled; its encoding backend is not implemented.- 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. Overlay surfaces share subtle entrance motion; Base UI popovers and media-preview dialogs also retain their surfaces through a short exit. Tooltip hover delay is 200ms, with instant keyboard-focus hints. Reduced-motion preferences disable overlay transitions; dock expansion keeps its separate animation.- The MVP does not open an Agent prompt or media-action popover from clip selection, time-range selection or ruler clicks.diff --git a/docs/reviews/motion-mvp-ui-followup/asset-delete-after.png b/docs/reviews/motion-mvp-ui-followup/asset-delete-after.pngnew file mode 100644index 00000000..3351e46aBinary files /dev/null and b/docs/reviews/motion-mvp-ui-followup/asset-delete-after.png differdiff --git a/docs/reviews/motion-mvp-ui-followup/asset-delete-menu.png b/docs/reviews/motion-mvp-ui-followup/asset-delete-menu.pngnew file mode 100644index 00000000..c8568d7aBinary files /dev/null and b/docs/reviews/motion-mvp-ui-followup/asset-delete-menu.png differdiff --git a/docs/reviews/motion-mvp-ui-followup/export-record-after.png b/docs/reviews/motion-mvp-ui-followup/export-record-after.pngnew file mode 100644index 00000000..80844fbdBinary files /dev/null and b/docs/reviews/motion-mvp-ui-followup/export-record-after.png differdiff --git a/docs/reviews/motion-mvp-ui-followup/export-record-before.png b/docs/reviews/motion-mvp-ui-followup/export-record-before.pngnew file mode 100644index 00000000..2c115a7cBinary files /dev/null and b/docs/reviews/motion-mvp-ui-followup/export-record-before.png differdiff --git a/docs/reviews/motion-mvp-ui-followup/interaction-update.md b/docs/reviews/motion-mvp-ui-followup/interaction-update.mdindex 031e406c..b0039ade 100644--- a/docs/reviews/motion-mvp-ui-followup/interaction-update.md+++ b/docs/reviews/motion-mvp-ui-followup/interaction-update.md@@ -71,3 +71,25 @@ My assets now shows each uploaded audio file's full name, including its original| Remote WorkBuddy and six-codec playback | Unverified | Local rendering tests only; no claims of remote or codec acceptance. |Validation: 47 cases in five targeted files passed in the assembled PR checkout; `npm run check`, Studio typecheck, production build and scoped diff whitespace checks passed. The main checkout was also rebuilt and browser-checked. Existing uncommitted work and other contributors' commits remain preserved.+++## Asset actions, feedback layers and export readability (2026-11-12)++My assets now labels current-composition references as **In use** (**已使用** in Chinese), replacing Added; unused assets have no badge. Delete invokes the existing file handler once and closes the MVP menu immediately. The full editor retains its confirmation, and official library assets are unchanged. No new undo or restore behavior is implied.++Editor notices, connection feedback and legacy template-copy feedback share a browser top-layer host. Feedback moves under the active native modal so dismiss controls remain interactive, while its non-modal popover stays above modal backdrops. Later native dialogs and popovers refresh the ordering; cleanup restores the original node and releases observers. The copy toast retains its existing position and three-second timer. No template-layout redesign is included.++Export records omit elapsed render duration. Titles change from 11px to 12px medium, dates from 9px to 11px, with 4px top spacing and 8px extra room before actions. Long titles truncate earlier and expose the full filename on hover. On the real editor, title-to-download-button spacing increased from 10px to 18px. Export controls and stored render metadata remain intact.++| Check | Result | Evidence / boundary |+| --- | --- | --- |+| Export content, typography, long title and action clearance | Pass | Existing real export opened after rebuilding 4173; no new render or deletion. [Before](export-record-before.png), [after](export-record-after.png). |+| Used/unused assets and Chinese/English labels | Pass | Deterministic component cases; real editor shows In use. Isolated audio component shows 已使用. |+| MVP deletion, repeated input, full-editor cancel | Pass | Regression cases and isolated production menu: [menu](asset-delete-menu.png), [one callback without confirmation](asset-delete-after.png). Real project files were not deleted. Existing server failure handling is unchanged. |+| Feedback above nested native dialogs, pointer access and focus | Pass | Production toast/portal harness: remains visible across nested modal open/close; dismiss works without closing the dialog; focus stays on modal controls. [Nested overlay](toast-above-nested-dialog.png). |+| Template copy and expiry | Pass, isolated | Original mountConnection/template-gallery components with an existing catalog record and isolated integration response. Clipboard success puts the toast in the active preview's top layer; expiration removes the visible state and restores its node. Reopen/copy works. [Copy feedback](template-copy-toast-top.png). |+| Live template catalog and remote WorkBuddy | Unverified | The main runtime catalog returned unavailable, including one retry. The isolated copy test does not prove live catalog recovery or remote-host acceptance. |+| Empty/loading/import/encoding and agent workflows | Not applicable | No changes to their data or state transitions. No new assets, exports, or timeline/media/volume edits were performed. |+| Older browser without Popover API | Unverified | The modal-parent fallback is source-inspected; browser verification used a host supporting native popovers. |++The assembled PR checkout passed `npm run check`, Studio typecheck, production build, 63 targeted tests in five files and `git diff --check`. The main checkout passed its typecheck, build and 62 targeted tests; its broader design check still reports existing raw UI colors in `studio/src/motion/theme.css`, outside this change. Main-checkout uncommitted work is retained. The PR increment preserves its newer privacy settings, community links, catalog implementation, translations and tests instead of replacing whole files from the older main checkout.diff --git a/docs/reviews/motion-mvp-ui-followup/template-copy-toast-top.png b/docs/reviews/motion-mvp-ui-followup/template-copy-toast-top.pngnew file mode 100644index 00000000..dfa00097Binary files /dev/null and b/docs/reviews/motion-mvp-ui-followup/template-copy-toast-top.png differdiff --git a/docs/reviews/motion-mvp-ui-followup/toast-above-nested-dialog.png b/docs/reviews/motion-mvp-ui-followup/toast-above-nested-dialog.pngnew file mode 100644index 00000000..94f2acd4Binary files /dev/null and b/docs/reviews/motion-mvp-ui-followup/toast-above-nested-dialog.png differdiff --git a/studio/src/components/FeedbackLayer.test.tsx b/studio/src/components/FeedbackLayer.test.tsxnew file mode 100644index 00000000..9aaa5975--- /dev/null+++ b/studio/src/components/FeedbackLayer.test.tsx@@ -0,0 +1,42 @@+// @vitest-environment happy-dom+import React, { act } from 'react';+import { createRoot } from 'react-dom/client';+import { afterEach, expect, it, vi } from 'vitest';+import { FeedbackLayer } from './FeedbackLayer';+import { mountFeedbackLayer } from '../../../web/feedback-layer';++(globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;+afterEach(() => { document.body.innerHTML = ''; vi.restoreAllMocks(); });++it('escapes a clipping ancestor and retains interactive portal content', () => {+ const host = document.createElement('div'); document.body.append(host);+ host.style.overflow = 'hidden'; const root = createRoot(host); const dismiss = vi.fn();+ act(() => root.render(<FeedbackLayer><button onClick={dismiss}>Dismiss</button></FeedbackLayer>));+ expect(host.querySelector('button')).toBeNull();+ act(() => document.querySelector<HTMLButtonElement>('button')!.click());+ expect(dismiss).toHaveBeenCalledOnce();+ act(() => root.unmount());+ expect(document.querySelector('.motion-feedback-layer')).toBeNull();+});++it('follows nested modal open/close and restores the original feedback node on cleanup', async () => {+ const origin = document.createElement('div'); const feedback = document.createElement('div');+ origin.append(feedback); document.body.append(origin);+ const dialogs = [document.createElement('dialog'), document.createElement('dialog')];+ for (const dialog of dialogs) {+ document.body.append(dialog);+ const matches = dialog.matches.bind(dialog);+ vi.spyOn(dialog, 'matches').mockImplementation(selector => selector === ':modal' ? dialog.open : matches(selector));+ }+ const stop = mountFeedbackLayer(feedback);+ expect(feedback.parentElement).toBe(document.body);+ dialogs[0].open = true; await new Promise(resolve => setTimeout(resolve, 0));+ expect(feedback.parentElement).toBe(dialogs[0]);+ dialogs[1].open = true; await new Promise(resolve => setTimeout(resolve, 0));+ expect(feedback.parentElement).toBe(dialogs[1]);+ dialogs[1].open = false; await new Promise(resolve => setTimeout(resolve, 0));+ expect(feedback.parentElement).toBe(dialogs[0]);+ stop(); expect(feedback.parentElement).toBe(origin);+ dialogs[0].open = false; await new Promise(resolve => setTimeout(resolve, 0));+ expect(feedback.parentElement).toBe(origin);+});diff --git a/studio/src/components/FeedbackLayer.tsx b/studio/src/components/FeedbackLayer.tsxnew file mode 100644index 00000000..a4e389dc--- /dev/null+++ b/studio/src/components/FeedbackLayer.tsx@@ -0,0 +1,23 @@+import { useLayoutEffect, useState, type ReactNode } from 'react';+import { createPortal } from 'react-dom';+import { mountFeedbackLayer } from '../../../web/feedback-layer';++/** The container may move between native dialogs; React retains portal ownership. */+export function FeedbackLayer({ children }: { children: ReactNode }) {+ const [container] = useState(() => {+ const node = document.createElement('div');+ node.className = 'motion-feedback-layer';+ Object.assign(node.style, {+ position: 'fixed', inset: '0', margin: '0', padding: '0', border: '0',+ width: '100%', height: '100%', maxWidth: 'none', maxHeight: 'none',+ background: 'transparent', overflow: 'visible', pointerEvents: 'none', zIndex: '2147483647',+ });+ return node;+ });+ useLayoutEffect(() => {+ document.body.append(container);+ const unmount = mountFeedbackLayer(container);+ return () => { unmount(); container.remove(); };+ }, [container]);+ return createPortal(children, container);+}diff --git a/studio/src/components/StudioOverlays.tsx b/studio/src/components/StudioOverlays.tsxindex 65e71e7e..ee81c1b1 100644--- a/studio/src/components/StudioOverlays.tsx+++ b/studio/src/components/StudioOverlays.tsx@@ -1,3 +1,4 @@+import { FeedbackLayer } from "./FeedbackLayer";import { useI18n } from "../i18n/I18n";import { memo, type ComponentProps } from "react";import { LintModal } from "./LintModal";@@ -83,7 +84,7 @@ export const StudioOverlays = memo(function StudioOverlays({/>)}{/* Center notices above the editor; gaps remain transparent to pointer input. */}- <div className="pointer-events-none absolute top-16 left-1/2 z-91 flex w-[min(420px,calc(100%-48px))] -translate-x-1/2 flex-col items-center gap-2">+ {toasts.length > 0 && <FeedbackLayer><div className="pointer-events-none absolute top-16 left-1/2 z-91 flex w-[min(420px,calc(100%-48px))] -translate-x-1/2 flex-col items-center gap-2">{toasts.map((toast) => (<StudioToastkey={toast.id}@@ -94,7 +95,7 @@ export const StudioOverlays = memo(function StudioOverlays({onDismiss={() => dismissToast(toast.id)}/>))}- </div>+ </div></FeedbackLayer>}{host?.feedback !== false && (<div className="absolute bottom-6 right-6 z-91"><StudioFeedbackCard />diff --git a/studio/src/components/renders/RenderQueueInfo.tsx b/studio/src/components/renders/RenderQueueInfo.tsxindex aa36e37e..ffa87088 100644--- a/studio/src/components/renders/RenderQueueInfo.tsx+++ b/studio/src/components/renders/RenderQueueInfo.tsx@@ -1,15 +1,6 @@import { useI18n } from "../../i18n/I18n";import type { RenderJob } from "./useRenderQueue";-function formatDuration(ms: number, locale: string): string {- const unit = (value: number, unit: string) => new Intl.NumberFormat(locale, {- style: 'unit', unit, unitDisplay: 'short', maximumFractionDigits: 0,- }).format(value);- if (ms < 1000) return unit(ms, 'millisecond');- const seconds = Math.round(ms / 1000);- return seconds < 60 ? unit(seconds, 'second') : `${unit(Math.floor(seconds / 60), 'minute')} ${unit(seconds % 60, 'second')}`;-}-function formatTimeAgo(timestamp: number, locale: string): string {const diff = Date.now() - timestamp;const formatter = new Intl.RelativeTimeFormat(locale, { numeric: 'auto', style: 'short' });@@ -22,9 +13,9 @@ export function RenderQueueInfo({ job }: { job: RenderJob }) {const { t, locale } = useI18n();const isRendering = job.status === "rendering";return (- <div className="flex-1 min-w-0">+ <div className="flex-1 min-w-0 pr-2"><div className="flex items-center gap-1.5">- <span className="text-step-11 font-medium text-text-2 truncate">{job.filename}</span>+ <span title={job.filename} className="text-step-12 font-medium text-text-2 truncate">{job.filename}</span></div>{isRendering && (@@ -54,13 +45,8 @@ export function RenderQueueInfo({ job }: { job: RenderJob }) {)}{!isRendering && (- <div className="flex flex-wrap items-center gap-x-1 text-step-9 text-text-5">+ <div className="mt-1 text-step-11 text-text-5"><span>{formatTimeAgo(job.createdAt, locale)}</span>- {job.status === "complete" && job.durationMs !== undefined && (- <span className="whitespace-nowrap">- · {t("Took {value0}", { value0: formatDuration(job.durationMs, locale) })}- </span>- )}</div>)}</div>diff --git a/studio/src/components/sidebar/AssetCard.test.tsx b/studio/src/components/sidebar/AssetCard.test.tsxindex 1f1da86e..d0b136b5 100644--- a/studio/src/components/sidebar/AssetCard.test.tsx+++ b/studio/src/components/sidebar/AssetCard.test.tsx@@ -8,6 +8,7 @@ import { useAssetPreviewStore } from "../../utils/assetPreviewStore";import { AssetCard } from "./AssetCard";import { AudioRow } from "./AudioRow";import { InlineAssetRename } from "./InlineAssetRename";+import { I18nProvider } from "../../i18n/I18n";(globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;@@ -102,6 +103,20 @@ describe("AssetCard click behavior", () => {copyFeedback: null,};+ it.each([['zh-CN', '已使用'], ['en', 'In use']] as const)("labels only referenced assets as in use in %s", (locale, label) => {+ const host = mount(<I18nProvider initialLocale={locale}>+ <AssetCard {...cardProps} asset="assets/used.png" used />+ <AssetCard {...cardProps} asset="assets/unused.png" used={false} />+ <AudioRow {...cardProps} asset="assets/music.mp3" used />+ </I18nProvider>);+ const rows = [...host.querySelectorAll('[draggable="true"]')];+ expect(rows[0].textContent).toContain(label);+ expect(rows[1].textContent).not.toContain(label);+ expect(rows[2].textContent).toContain(label);+ expect(host.textContent).not.toContain('Added');+ expect(host.textContent).not.toContain('已添加');+ });+it("clears an open preview overlay when clicking an already-added asset (reveal branch)", () => {usePlayerStore.getState().setElements([clip({ id: "img1", src: "assets/logo.png" })]);// Preview overlay is open on ANOTHER asset — the reveal must dismiss it,diff --git a/studio/src/components/sidebar/AssetCard.tsx b/studio/src/components/sidebar/AssetCard.tsxindex 15772bd8..27cf015e 100644--- a/studio/src/components/sidebar/AssetCard.tsx+++ b/studio/src/components/sidebar/AssetCard.tsx@@ -269,10 +269,10 @@ export function AssetCard({</div>)}- {/* "Added" badge — top-left */}+ {/* Current-composition usage badge — top-left */}{used && (<span className="absolute top-1 left-1 text-[9px] font-semibold leading-none px-1.5 py-[3px] rounded-sm bg-neutral-950/80 text-panel-text-1">- {t("Added")}</span>+ {t("In use")}</span>)}{/* Duration badge — top-right, media only */}@@ -374,7 +374,7 @@ export function FontRow({<span className="text-[10px] text-neutral-600 truncate">{extension}</span>{used && (<span className="text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm">- {t("in use")}</span>+ {t("In use")}</span>)}<CopyChip feedback={copyFeedback} asset={asset} /></div>diff --git a/studio/src/components/sidebar/AssetContextMenu.test.tsx b/studio/src/components/sidebar/AssetContextMenu.test.tsxindex a66e13c1..278ca30b 100644--- a/studio/src/components/sidebar/AssetContextMenu.test.tsx+++ b/studio/src/components/sidebar/AssetContextMenu.test.tsx@@ -14,7 +14,7 @@ afterEach(() => {vi.restoreAllMocks();});-function mount(x = 100, y = 200) {+function mount(x = 100, y = 200, mvpEditor = true) {const host = document.createElement("div");host.style.overflow = "hidden";host.style.containerType = "inline-size";@@ -23,7 +23,7 @@ function mount(x = 100, y = 200) {const callbacks = { onClose: vi.fn(), onCopy: vi.fn(), onRename: vi.fn(), onDelete: vi.fn() };act(() => root.render(<I18nProvider initialLocale="zh-CN">- <StudioHostContext.Provider value={{ mvpEditor: true }}>+ <StudioHostContext.Provider value={{ mvpEditor }}><ContextMenu x={x} y={y} asset="assets/clip.mp4" {...callbacks} /></StudioHostContext.Provider></I18nProvider>,@@ -46,15 +46,32 @@ it("escapes the clipping panel while retaining locale and MVP menu actions", ()click("重命名");expect(document.querySelector("input")?.value).toBe("clip.mp4");click("取消");- click("删除");- expect(menu.textContent).toContain("clip.mp4?");- click("取消");expect(onDelete).not.toHaveBeenCalled();expect(onRename).not.toHaveBeenCalled();act(() => document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true })));expect(onClose).toHaveBeenCalledOnce();});+it("deletes an MVP asset once directly from the menu and closes without a confirmation", () => {+ const { onDelete, onClose } = mount();+ click("删除");+ click("删除");+ expect(onDelete).toHaveBeenCalledExactlyOnceWith("assets/clip.mp4");+ expect(onClose).toHaveBeenCalledOnce();+ expect(document.querySelector('[role="menu"]')?.textContent).not.toContain("clip.mp4?");+ expect(document.querySelector('[role="menu"]')?.textContent).not.toContain("取消");+});++it("retains the full editor confirmation and permits cancelling it", () => {+ const { onDelete, onClose } = mount(100, 200, false);+ click("删除");+ expect(document.querySelector('[role="menu"]')?.textContent).toContain("clip.mp4?");+ expect(onDelete).not.toHaveBeenCalled();+ click("取消");+ expect(onDelete).not.toHaveBeenCalled();+ expect(onClose).not.toHaveBeenCalled();+});+it("keeps menus opened at the bottom right inside the viewport", () => {vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockReturnValue({ width: 160, height: 60 } as DOMRect);mount(window.innerWidth, window.innerHeight);diff --git a/studio/src/components/sidebar/AssetContextMenu.tsx b/studio/src/components/sidebar/AssetContextMenu.tsxindex ea610c22..5ba79473 100644--- a/studio/src/components/sidebar/AssetContextMenu.tsx+++ b/studio/src/components/sidebar/AssetContextMenu.tsx@@ -44,6 +44,13 @@ export function ContextMenu({const [mode, setMode] = useState<"menu" | "confirm-delete" | "rename">("menu");const [renameDraft, setRenameDraft] = useState(() => filename(asset));const [renameError, setRenameError] = useState<string | null>(null);+ const deleteRequestedRef = useRef(false);+ const deleteAsset = () => {+ if (deleteRequestedRef.current) return;+ deleteRequestedRef.current = true;+ onDelete?.(asset);+ onClose();+ };// Clamp the menu inside the viewport once it has a size.useLayoutEffect(() => {@@ -158,7 +165,7 @@ export function ContextMenu({{onDelete && (<buttonrole="menuitem"- onClick={() => setMode("confirm-delete")}+ onClick={() => mvp ? deleteAsset() : setMode("confirm-delete")}className={`${menuClasses.row} ${menuClasses.rowDanger} active:bg-neutral-700/70 transition-colors`}>{t("Delete")}</button>@@ -168,10 +175,7 @@ export function ContextMenu({{mode === "confirm-delete" && (<DeleteConfirmname={filename(asset)}- onConfirm={() => {- onDelete?.(asset);- onClose();- }}+ onConfirm={deleteAsset}onCancel={() => setMode("menu")}/>)}diff --git a/studio/src/components/sidebar/AudioRow.tsx b/studio/src/components/sidebar/AudioRow.tsxindex d329f5a8..62b4696d 100644--- a/studio/src/components/sidebar/AudioRow.tsx+++ b/studio/src/components/sidebar/AudioRow.tsx@@ -276,7 +276,7 @@ export function AudioRow({)}{used && (<span className="text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm shrink-0">- {t("in use")}</span>+ {t("In use")}</span>)}{(isCopied || copyFailed) && (<spandiff --git a/studio/src/i18n/zh-CN.json b/studio/src/i18n/zh-CN.jsonindex ed9035be..455547e0 100644--- a/studio/src/i18n/zh-CN.json+++ b/studio/src/i18n/zh-CN.json@@ -311,7 +311,7 @@"Import media": "导入媒体","Importing…": "正在导入…","In": "入场",- "In use": "使用中",+ "In use": "已使用","In-point": "入点","Inferred from this element's animation. Edit to pin an explicit clip range.": "根据元素动画推算,编辑以指定片段范围。","Inferred from this element’s animation. Edit to pin an explicit clip range.": "根据元素动画推算,编辑以指定片段范围。",diff --git a/studio/src/motion/MotionStudioHost.test.tsx b/studio/src/motion/MotionStudioHost.test.tsxindex 8c8590f1..032861fc 100644--- a/studio/src/motion/MotionStudioHost.test.tsx+++ b/studio/src/motion/MotionStudioHost.test.tsx@@ -251,7 +251,7 @@ it.each(['zh-CN', 'en', 'ja', 'ko', 'de', 'fr', 'ru', 'es', 'pt-BR', 'it', 'tr']it('shows connection failure as a one-line reconnecting toast and removes it on recovery', () => {state.connectionError = 'Failed to fetch /private/project';render();- const toast = container.querySelector('[data-testid="motion-connection-toast"]')!;+ const toast = document.querySelector('[data-testid="motion-connection-toast"]')!;expect(toast.textContent).toContain('连接已断开');expect(toast.querySelector('.sr-only')?.textContent).toBe('重连中…');expect(toast.querySelector('[aria-hidden="true"]')?.textContent).toBe('重连中...');@@ -261,8 +261,8 @@ it('shows connection failure as a one-line reconnecting toast and removes it onexpect(toast.textContent).not.toMatch(/private|details|详情/);expect(toast.querySelector('button')).toBeNull();render();- expect(container.querySelectorAll('[data-testid="motion-connection-toast"]')).toHaveLength(1);+ expect(document.querySelectorAll('[data-testid="motion-connection-toast"]')).toHaveLength(1);state.connectionError = '';render();- expect(container.querySelector('[data-testid="motion-connection-toast"]')).toBeNull();+ expect(document.querySelector('[data-testid="motion-connection-toast"]')).toBeNull();});diff --git a/studio/src/motion/WorkspaceFrame.tsx b/studio/src/motion/WorkspaceFrame.tsxindex 48abf573..a423e750 100644--- a/studio/src/motion/WorkspaceFrame.tsx+++ b/studio/src/motion/WorkspaceFrame.tsx@@ -1,3 +1,4 @@+import { FeedbackLayer } from "../components/FeedbackLayer";import { createContext, useContext, useState, useRef, useCallback, lazy, Suspense, type ReactNode } from 'react';import { useI18n } from '../i18n/I18n';import { LanguageMenu } from '../i18n/LanguageMenu';@@ -79,10 +80,10 @@ export function WorkspaceFrame({ children, waitForSaves, projectId, sessionId, b</Dialog.Portal><div className="motion-workspace-content">{visibleNotice && (workspace.error && workspace.errorSource === 'connection' && isConnectionFailure(notice)- ? <div data-testid="motion-connection-toast" className="pointer-events-none absolute top-16 left-1/2 z-91 flex max-w-[calc(100%-32px)] -translate-x-1/2 justify-center">+ ? <FeedbackLayer><div data-testid="motion-connection-toast" className="pointer-events-none absolute top-16 left-1/2 z-91 flex max-w-[calc(100%-32px)] -translate-x-1/2 justify-center"><StudioToast message="Connection lost." tone="error" presentation="feedback" singleLinestatus="Reconnecting…" />- </div>+ </div></FeedbackLayer>: <ErrorNotice key={noticeKey} message={notice}onDismiss={() => { setDismissedNotice(noticeKey); if (workspace.error) workspace.clearError(); }} />)}{children}diff --git a/web/connect.css b/web/connect.cssindex e978c694..8c0fe755 100644--- a/web/connect.css+++ b/web/connect.css@@ -817,6 +817,9 @@font-size: var(--motion-text-sm);}.connect-copy-feedback {+ margin: 0;+ top: auto;+ right: auto;position: fixed;z-index: 200;left: 50%;diff --git a/web/connect.ts b/web/connect.tsindex 7c0767c0..58dcbf67 100644--- a/web/connect.ts+++ b/web/connect.ts@@ -1,3 +1,4 @@+import { mountFeedbackLayer } from './feedback-layer';import { integrationHost, hostNames, hostDescriptions, setupPrompt, manualConnection, agentGuide, apiDiscoveryCommand } from '../shared/integration';import type { IntegrationInfo } from '../shared/integration';import { mountTemplates } from './template-gallery';@@ -10,6 +11,8 @@ export function mountConnection(root: HTMLElement, options: { close: () => void;let host = integrationHost(options.initialHost ?? null), info: IntegrationInfo | null = null;let checking = false;let feedbackTimer: ReturnType<typeof setTimeout>;+ const feedback = element('connect-feedback');+ let releaseFeedback: (() => void) | undefined;const copiedButtons = new Map<HTMLButtonElement, Node[]>();let galleryController: ReturnType<typeof mountTemplates> | undefined;const lifetime = new AbortController();@@ -26,14 +29,15 @@ export function mountConnection(root: HTMLElement, options: { close: () => void;}function resetCopied() {copiedButtons.forEach((nodes, button) => button.replaceChildren(...nodes)); copiedButtons.clear();- clearTimeout(feedbackTimer); element('connect-feedback').classList.remove('is-visible');+ clearTimeout(feedbackTimer); feedback.classList.remove('is-visible');+ releaseFeedback?.(); releaseFeedback = undefined;}async function copy(value: string, label: string, button?: HTMLButtonElement) {try {await navigator.clipboard.writeText(value); resetCopied();if (button) { copiedButtons.set(button, [...button.childNodes]); buttonLabel(button, 'Copied', 'check'); }- language.text(element('connect-feedback'), '{label} copied. Paste it into {host}.', () => ({ label: t(label), host: hostNames[host] }));- element('connect-feedback').classList.add('is-visible'); feedbackTimer = setTimeout(resetCopied, 3000);+ language.text(feedback, '{label} copied. Paste it into {host}.', () => ({ label: t(label), host: hostNames[host] }));+ feedback.classList.add('is-visible'); releaseFeedback = mountFeedbackLayer(feedback); feedbackTimer = setTimeout(resetCopied, 3000);} catch {element<HTMLTextAreaElement>('copy-fallback').value = value;element<HTMLDialogElement>('copy-dialog').showModal();diff --git a/web/feedback-layer.ts b/web/feedback-layer.tsnew file mode 100644index 00000000..b39aef70--- /dev/null+++ b/web/feedback-layer.ts@@ -0,0 +1,53 @@+/** Keep transient feedback above native dialogs as well as ordinary overlays.+ * Parent it inside the active modal so its dismiss controls are not inert. */+export function mountFeedbackLayer(element: HTMLElement): () => void {+ const doc = element.ownerDocument;+ const marker = doc.createComment('feedback origin');+ element.before(marker);+ const originalPopover = element.getAttribute('popover');+ const canPopover = typeof element.showPopover === 'function';+ let dialogs = Array.from(doc.querySelectorAll<HTMLDialogElement>('dialog[open]'));+ const isModal = (dialog: HTMLDialogElement) => {+ try { return dialog.matches(':modal'); } catch { return dialog.open; }+ };+ const refresh = () => {+ dialogs = dialogs.filter(dialog => dialog.isConnected && dialog.open);+ const parent = dialogs.filter(isModal).at(-1) ?? doc.body;+ if (canPopover && element.matches(':popover-open')) element.hidePopover();+ if (element.parentElement !== parent) parent.append(element);+ if (canPopover) element.showPopover();+ };+ if (canPopover) element.setAttribute('popover', 'manual');+ refresh();+ const observer = new MutationObserver(records => {+ let changed = false;+ for (const record of records) {+ if (record.type === 'attributes' && record.target instanceof HTMLDialogElement) {+ const dialog = record.target;+ dialogs = dialogs.filter(item => item !== dialog);+ if (dialog.open) dialogs.push(dialog);+ changed = true;+ }+ }+ if (changed || dialogs.some(dialog => !dialog.isConnected)) refresh();+ });+ observer.observe(doc.body, { subtree: true, childList: true, attributes: true, attributeFilter: ['open'] });+ const onToggle = (event: Event) => {+ const target = event.target;+ // An unrelated popover opened later must not cover existing feedback.+ if (target instanceof HTMLElement && target !== element && !target.hasAttribute('data-feedback-layer')+ && target.hasAttribute('popover') && target.matches(':popover-open')) refresh();+ };+ element.setAttribute('data-feedback-layer', '');+ doc.addEventListener('toggle', onToggle, true);+ return () => {+ observer.disconnect();+ doc.removeEventListener('toggle', onToggle, true);+ if (canPopover && element.matches(':popover-open')) element.hidePopover();+ if (originalPopover === null) element.removeAttribute('popover');+ else element.setAttribute('popover', originalPopover);+ element.removeAttribute('data-feedback-layer');+ if (marker.parentNode) marker.replaceWith(element);+ else element.remove();+ };+}