feat(studio): variables inspector panel with live preview values

This commit is contained in:
James
2026-07-09 13:31:03 -07:00
parent 2e0b884521
commit b34ad85165
12 changed files with 1311 additions and 59 deletions
@@ -7,7 +7,6 @@ import {
type MutableRefObject,
type PointerEvent as ReactPointerEvent,
} from "react";
import { Tooltip } from "./ui";
import { PropertyPanel } from "./editor/PropertyPanel";
import { LayersPanel } from "./editor/LayersPanel";
import { CaptionPropertyPanel } from "../captions/components/CaptionPropertyPanel";
@@ -15,6 +14,8 @@ import { BlockParamsPanel } from "./editor/BlockParamsPanel";
import { RenderQueue } from "./renders/RenderQueue";
import { SlideshowPanel } from "./panels/SlideshowPanel";
import type { SceneInfo } from "./panels/SlideshowPanel";
import { VariablesPanel } from "./panels/VariablesPanel";
import { PanelTabButton } from "./PanelTabButton";
import type { RenderJob } from "./renders/useRenderQueue";
import type { BlockParam } from "@hyperframes/core/registry";
import type { IframeWindow } from "../player/lib/playbackTypes";
@@ -461,64 +462,38 @@ export function StudioRightPanel({
<div className="flex min-w-0 items-center gap-1 overflow-hidden border-b border-neutral-800 px-3 py-2">
{STUDIO_INSPECTOR_PANELS_ENABLED && (
<>
<Tooltip label="Element styles and properties" side="bottom">
<button
type="button"
onClick={() => handleInspectorPaneButtonClick("design")}
aria-pressed={designPaneOpen}
className={`h-8 rounded-xl px-3 text-[11px] font-medium transition-colors active:scale-[0.98] ${
designPaneOpen
? "bg-neutral-800 text-white"
: "text-neutral-500 hover:bg-neutral-800/70 hover:text-neutral-200"
}`}
>
Design
</button>
</Tooltip>
<Tooltip label="Composition layer stack" side="bottom">
<button
type="button"
onClick={() => handleInspectorPaneButtonClick("layers")}
aria-pressed={layersPaneOpen}
className={`h-8 rounded-xl px-3 text-[11px] font-medium transition-colors active:scale-[0.98] ${
layersPaneOpen
? "bg-neutral-800 text-white"
: "text-neutral-500 hover:bg-neutral-800/70 hover:text-neutral-200"
}`}
>
Layers
</button>
</Tooltip>
<PanelTabButton
label="Design"
tooltip="Element styles and properties"
active={designPaneOpen}
onClick={() => handleInspectorPaneButtonClick("design")}
/>
<PanelTabButton
label="Layers"
tooltip="Composition layer stack"
active={layersPaneOpen}
onClick={() => handleInspectorPaneButtonClick("layers")}
/>
</>
)}
<Tooltip label="Render queue and exports" side="bottom">
<button
type="button"
onClick={() => setRightPanelTab("renders")}
aria-pressed={rightPanelTab === "renders"}
className={`h-8 rounded-xl px-3 text-[11px] font-medium transition-colors active:scale-[0.98] ${
rightPanelTab === "renders"
? "bg-neutral-800 text-white"
: "text-neutral-500 hover:bg-neutral-800/70 hover:text-neutral-200"
}`}
>
{renderJobs.length > 0 ? `Renders (${renderJobs.length})` : "Renders"}
</button>
</Tooltip>
<Tooltip label="Slideshow branching editor" side="bottom">
<button
type="button"
onClick={() => setRightPanelTab("slideshow")}
aria-pressed={rightPanelTab === "slideshow"}
className={`h-8 rounded-xl px-3 text-[11px] font-medium transition-colors active:scale-[0.98] ${
rightPanelTab === "slideshow"
? "bg-neutral-800 text-white"
: "text-neutral-500 hover:bg-neutral-800/70 hover:text-neutral-200"
}`}
>
Slideshow
</button>
</Tooltip>
<PanelTabButton
label={renderJobs.length > 0 ? `Renders (${renderJobs.length})` : "Renders"}
tooltip="Render queue and exports"
active={rightPanelTab === "renders"}
onClick={() => setRightPanelTab("renders")}
/>
<PanelTabButton
label="Slideshow"
tooltip="Slideshow branching editor"
active={rightPanelTab === "slideshow"}
onClick={() => setRightPanelTab("slideshow")}
/>
<PanelTabButton
label="Variables"
tooltip="Template variables — declare, preview with values"
active={rightPanelTab === "variables"}
onClick={() => setRightPanelTab("variables")}
/>
</div>
<div className="min-h-0 min-w-0 flex-1 overflow-hidden">
{rightPanelTab === "block-params" && activeBlockParams ? (
@@ -535,6 +510,13 @@ export function StudioRightPanel({
onPersist={onPersistSlideshow}
onPersistNotes={onPersistSlideshowNotes}
/>
) : rightPanelTab === "variables" ? (
<VariablesPanel
sdkSession={sdkSession}
reloadPreview={reloadPreview}
domEditSaveTimestampRef={domEditSaveTimestampRef}
recordEdit={recordEdit}
/>
) : layersPaneOpen && designPaneOpen ? (
<div ref={splitContainerRef} className="flex h-full min-h-0 min-w-0 flex-col">
<div