mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 14:27:26 +00:00
* chore(studio): upgrade Tailwind CSS to v4 through the Vite plugin Studio moves from Tailwind 3.4 to 4.3.3, loaded by @tailwindcss/vite instead of PostCSS. The JS config becomes an @theme block in studio.css carrying the same studio.* and panel.* colors, with explicit @source globs so the gitignored data/projects tree is never scanned. The official upgrade tool renamed the utilities, but it rewrites bare words inside any string, so its edits to event names, CSS property names, filter function names, status enum values and prose were reverted by hand. Nothing in Studio relied on the v3 default border color, ring width or ring color, so the tool's compatibility shim was dropped rather than kept. * chore(studio): note the duplicated palette between theme css and preset * fix(studio): keep the pointer cursor on buttons after the Tailwind v4 upgrade v4 preflight dropped the pointer cursor on enabled buttons, so add it back in one base rule. Also migrate the last outline-none to outline-hidden. * fix(studio): keep the Renders Export button at its shipped 14px size * chore(studio): allow the tailwind v4 config deletions in the deletion guard
227 lines
8.7 KiB
TypeScript
227 lines
8.7 KiB
TypeScript
import { Eye, Layers } from "../../icons/SystemIcons";
|
|
import type { DomEditSelection } from "./domEditingTypes";
|
|
import { canHideSelections } from "../../utils/timelineInspector";
|
|
|
|
function FlatEmptyState() {
|
|
return (
|
|
<div className="flex h-full flex-col items-center justify-center gap-2.5 px-8 py-10 text-center">
|
|
<span className="flex h-11 w-11 items-center justify-center rounded-xl border border-panel-border-input bg-panel-input text-panel-text-3">
|
|
<svg
|
|
width="20"
|
|
height="20"
|
|
viewBox="0 0 20 20"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
strokeWidth="1.4"
|
|
>
|
|
<path d="M4 3l6 14 2-6 6-2z" strokeLinejoin="round" />
|
|
</svg>
|
|
</span>
|
|
<div className="text-[13px] font-semibold text-panel-text-0">Nothing selected</div>
|
|
<div className="max-w-[250px] text-[11px] leading-normal text-panel-text-3">
|
|
Click any element on the canvas to edit it, or drag to select several.
|
|
</div>
|
|
<div className="mt-2 flex w-full flex-col gap-1.5">
|
|
<span className="flex items-center justify-between rounded-lg border border-panel-border bg-panel-bg px-3 py-2">
|
|
<span className="flex items-center gap-2 text-[11px] text-panel-text-2">
|
|
<span className="text-panel-danger">●</span>
|
|
Record a gesture
|
|
</span>
|
|
<span className="rounded-sm border border-panel-border-input px-[5px] py-px font-mono text-[9px] text-panel-text-5">
|
|
R
|
|
</span>
|
|
</span>
|
|
<span className="flex items-center justify-between rounded-lg border border-panel-border bg-panel-bg px-3 py-2">
|
|
<span className="flex items-center gap-2 text-[11px] text-panel-text-2">
|
|
<span className="text-panel-accent">✦</span>
|
|
Describe a change to the agent
|
|
</span>
|
|
<span className="rounded-sm border border-panel-border-input px-[5px] py-px font-mono text-[9px] text-panel-text-5">
|
|
⌘K
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function elementKindGlyph(element: DomEditSelection): { glyph: string; className: string } {
|
|
if (element.tagName === "video" || element.tagName === "audio" || element.tagName === "img") {
|
|
return { glyph: "◆", className: "bg-panel-media/10 text-panel-media" };
|
|
}
|
|
if (element.textFields?.length > 0) {
|
|
return { glyph: "T", className: "bg-panel-accent/10 text-panel-accent" };
|
|
}
|
|
return { glyph: "▦", className: "bg-panel-container/10 text-panel-container" };
|
|
}
|
|
|
|
function FlatMultiSelectState({
|
|
multiSelectCount,
|
|
multiSelectedElements = [],
|
|
onGroupSelection,
|
|
onHideAllSelected,
|
|
onClearSelection,
|
|
}: {
|
|
multiSelectCount: number;
|
|
multiSelectedElements?: DomEditSelection[];
|
|
onGroupSelection?: () => void;
|
|
onHideAllSelected?: () => void;
|
|
onClearSelection?: () => void;
|
|
}) {
|
|
// One predicate for both actions and for the handler's own refusal, so the
|
|
// button and the refusal cannot disagree about what audio is.
|
|
const hasAudio = !canHideSelections(multiSelectedElements);
|
|
return (
|
|
<div className="flex flex-col gap-3 px-4 py-3">
|
|
<div className="flex items-center gap-3 rounded-xl border border-panel-border bg-panel-surface p-3">
|
|
<span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-panel-accent/10 text-panel-accent">
|
|
<Layers size={16} />
|
|
</span>
|
|
<div className="min-w-0 flex-1">
|
|
<div className="text-[13px] font-semibold text-panel-text-0">
|
|
{multiSelectCount} elements selected
|
|
</div>
|
|
<div className="mt-px font-mono text-[10px] text-panel-text-3">
|
|
shift-click to add or remove
|
|
</div>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
data-flat-multiselect-clear="true"
|
|
aria-label="Clear selection"
|
|
onClick={onClearSelection}
|
|
className="flex h-[26px] w-[26px] shrink-0 items-center justify-center text-panel-text-3"
|
|
>
|
|
<svg
|
|
width="13"
|
|
height="13"
|
|
viewBox="0 0 16 16"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
strokeWidth="1.5"
|
|
>
|
|
<path d="M3 3l10 10M13 3L3 13" />
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div className="flex flex-col gap-1">
|
|
{multiSelectedElements.map((element) => {
|
|
const { glyph, className } = elementKindGlyph(element);
|
|
return (
|
|
<span
|
|
key={`${element.id ?? element.selector ?? ""}:${element.selectorIndex ?? 0}`}
|
|
className="flex items-center gap-2 rounded-lg border border-panel-border bg-panel-bg px-2.5 py-[7px]"
|
|
>
|
|
<span
|
|
className={`flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-sm text-[9px] font-bold ${className}`}
|
|
>
|
|
{glyph}
|
|
</span>
|
|
<span className="min-w-0 flex-1 truncate text-[11px] text-panel-text-1">
|
|
{element.label}
|
|
</span>
|
|
<span className="shrink-0 font-mono text-[9px] text-panel-text-4">
|
|
{element.id ? `#${element.id}` : element.selector}
|
|
</span>
|
|
</span>
|
|
);
|
|
})}
|
|
</div>
|
|
{/* Neither action applies to audio, so the row goes rather than showing
|
|
an empty frame. Grouping is the LAYOUT grouper — a positioned wrapper
|
|
around a bounding box, and an <audio> clip has none (grouping two
|
|
produced a 0x0 div with inline left/top on elements that are never
|
|
laid out). Hiding is visibility, which for audio doubles as mute; the
|
|
timeline already withholds the eye on an audio track
|
|
(`visible={!isAudioTrack}`) and this panel was the way back to the
|
|
same write. Both handlers refuse it too — they own keyboard paths no
|
|
hidden button can gate. */}
|
|
{!hasAudio && (
|
|
<div className="flex gap-2">
|
|
<button
|
|
type="button"
|
|
data-flat-multiselect-group="true"
|
|
onClick={onGroupSelection}
|
|
className="flex h-[34px] flex-1 items-center justify-center gap-2 rounded-lg bg-panel-hover text-[11px] font-semibold text-panel-text-0"
|
|
>
|
|
<Layers size={13} />
|
|
Group selection
|
|
</button>
|
|
<button
|
|
type="button"
|
|
data-flat-multiselect-hide-all="true"
|
|
onClick={onHideAllSelected}
|
|
className="flex h-[34px] items-center gap-1.5 rounded-lg border border-panel-border-input bg-panel-input px-3 text-[11px] font-medium text-panel-text-2"
|
|
>
|
|
<Eye size={13} />
|
|
Hide all
|
|
</button>
|
|
</div>
|
|
)}
|
|
<span className="text-center text-[10px] text-panel-text-5">
|
|
Select a single element to edit its properties
|
|
</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function PropertyPanelEmptyState({
|
|
multiSelectCount,
|
|
flat,
|
|
multiSelectedElements,
|
|
onGroupSelection,
|
|
onHideAllSelected,
|
|
onClearSelection,
|
|
}: {
|
|
multiSelectCount: number;
|
|
flat?: boolean;
|
|
multiSelectedElements?: DomEditSelection[];
|
|
onGroupSelection?: () => void;
|
|
onHideAllSelected?: () => void;
|
|
onClearSelection?: () => void;
|
|
}) {
|
|
if (flat) {
|
|
return multiSelectCount > 1 ? (
|
|
<FlatMultiSelectState
|
|
multiSelectCount={multiSelectCount}
|
|
multiSelectedElements={multiSelectedElements}
|
|
onGroupSelection={onGroupSelection}
|
|
onHideAllSelected={onHideAllSelected}
|
|
onClearSelection={onClearSelection}
|
|
/>
|
|
) : (
|
|
<FlatEmptyState />
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-full flex-col bg-neutral-900">
|
|
<div className="flex flex-1 flex-col items-center justify-center px-6 text-center">
|
|
{multiSelectCount > 1 ? (
|
|
<>
|
|
<Layers size={18} className="mb-3 text-neutral-600" />
|
|
<p className="text-sm font-medium text-neutral-200">
|
|
{multiSelectCount} elements selected
|
|
</p>
|
|
<p className="mt-2 max-w-[260px] text-xs leading-5 text-neutral-500">
|
|
Select a single element to edit its properties. Click an element in the preview or use
|
|
the timeline layer panel.
|
|
</p>
|
|
</>
|
|
) : (
|
|
<>
|
|
<Eye size={18} className="mb-3 text-neutral-600" />
|
|
<p className="text-sm font-medium text-neutral-200">
|
|
Select an element in the preview.
|
|
</p>
|
|
<p className="mt-2 max-w-[260px] text-xs leading-5 text-neutral-500">
|
|
The inspector is tuned for element edits with safer geometry controls, color picking,
|
|
and cleaner grouped layer controls.
|
|
</p>
|
|
</>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|