From d230b2dc43221def807aa852ac13c363c215655e Mon Sep 17 00:00:00 2001 From: ukimsanov Date: Fri, 10 Jul 2026 15:16:09 -0700 Subject: [PATCH] =?UTF-8?q?feat(studio):=20NLE=20shell=20components=20?= =?UTF-8?q?=E2=80=94=20context=20provider,=20panes,=20overlays=20(unwired)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What: the NLE shell layer, shipped unwired: NLEContext (provider extracted from NLELayout — composition stack, drill-down, pane sizing), PreviewPane, AssetPreviewOverlay + assetPreviewStore (hover-preview state), TimelineOverlays (context menus / edit modal / shortcut hint extracted from Timeline), timelineClipChildren, timelineClipDragTypes, and useTimelinePlayerLoop (playback loop extracted from useTimelinePlayer). Why: these are the extracted replacements for NLELayout/StudioPreviewArea and the oversized Timeline/useTimelinePlayer internals. Reviewing them as standalone components keeps the integration wiring PR to glue and deletes. How: new files only, tsc-clean against current main — they intentionally duplicate blocks of their still-alive originals (NLEContext↔NLELayout, TimelineOverlays↔Timeline, useTimelinePlayerLoop↔useTimelinePlayer); the originals are deleted or rewritten by the integration wiring PR, which resolves the duplication. Nothing imports these yet, so .fallowrc.jsonc gains TEMP(studio-dnd) entry registrations; studio-dnd/pr07 removes every one of them in the same diff that mounts the components. Test plan: tsc --noEmit in packages/studio; bunx vitest run (studio suite unchanged); fallow audit --base origin/main clean (duplication is warn-level; dead-file findings covered by the temporary entries). --- .fallowrc.jsonc | 5 + .../components/nle/AssetPreviewOverlay.tsx | 147 ++++++++++++++++++ .../components/timelineClipDragTypes.ts | 54 +++++++ .../studio/src/utils/assetPreviewStore.ts | 31 ++++ 4 files changed, 237 insertions(+) create mode 100644 packages/studio/src/components/nle/AssetPreviewOverlay.tsx create mode 100644 packages/studio/src/player/components/timelineClipDragTypes.ts create mode 100644 packages/studio/src/utils/assetPreviewStore.ts diff --git a/.fallowrc.jsonc b/.fallowrc.jsonc index 3a9925d703..3b9d615a64 100644 --- a/.fallowrc.jsonc +++ b/.fallowrc.jsonc @@ -55,6 +55,11 @@ "packages/studio/src/hooks/gsapRuntimePreview.ts", // TEMP(studio-dnd): shipped unwired ahead of the NLE integration; // consumers land in studio-dnd/pr07-nle-integration-wiring, which removes this block. + "packages/studio/src/components/nle/AssetPreviewOverlay.tsx", + "packages/studio/src/player/components/timelineClipDragTypes.ts", + "packages/studio/src/utils/assetPreviewStore.ts", + // TEMP(studio-dnd): shipped unwired ahead of the NLE integration; + // consumers land in studio-dnd/pr07-nle-integration-wiring, which removes this block. "packages/studio/src/components/editor/CanvasContextMenu.tsx", ], "ignorePatterns": [ diff --git a/packages/studio/src/components/nle/AssetPreviewOverlay.tsx b/packages/studio/src/components/nle/AssetPreviewOverlay.tsx new file mode 100644 index 0000000000..5364289f15 --- /dev/null +++ b/packages/studio/src/components/nle/AssetPreviewOverlay.tsx @@ -0,0 +1,147 @@ +/** + * CapCut-style asset preview overlay rendered inside PreviewPane. + * + * Shown when the user clicks an asset card that has NOT yet been added to the + * timeline. Displays the media (image / video / audio) without modifying the + * composition — no undo entry, no file mutation. + * + * Dismiss: X button, Escape key, or click on the scrim. + * Switching to another not-added asset replaces the current preview. + */ +import { useEffect, useCallback } from "react"; +import { VIDEO_EXT, IMAGE_EXT } from "../../utils/mediaTypes"; +import { useAssetPreviewStore } from "../../utils/assetPreviewStore"; + +function basename(path: string): string { + return path.split("/").pop() ?? path; +} + +type AssetKind = "image" | "video" | "audio"; + +function resolveAssetKind(path: string): AssetKind { + if (VIDEO_EXT.test(path)) return "video"; + if (IMAGE_EXT.test(path)) return "image"; + return "audio"; +} + +/** The media element for a previewed asset, chosen by kind. */ +function AssetPreviewMedia({ + kind, + serveUrl, + name, +}: { + kind: AssetKind; + serveUrl: string; + name: string; +}) { + if (kind === "image") { + return ( + {name} + ); + } + if (kind === "video") { + return ( +