feat(studio): fold variables into the design panel + summonable manager#2101
Conversation
miguel-heygen
left a comment
There was a problem hiding this comment.
Re-reviewing the updated stack at 35f2b4527. The design direction is right: the permanent Variables tab is removed from the tab union (packages/studio/src/utils/studioHelpers.ts:16), stale tab=variables URLs now normalize away (packages/studio/src/utils/studioUrlState.ts:22), and the full manager becomes summonable from the Design surface instead of occupying a permanent tab (packages/studio/src/components/StudioRightPanel.tsx:507). Focused local coverage passes after building workspace deps: studioUrlState.test.ts + variablePromoteIntegration.test.ts = 15/15.
Blocker
packages/studio/src/components/editor/PromotableControl.tsx:88opens the Variables manager with only a global boolean, while the manager renders the right panel'ssdkSession(packages/studio/src/components/StudioRightPanel.tsx:582,packages/studio/src/components/panels/VariablesManagerSlideOver.tsx:97). That session is the active/master composition session. But Design-panel promotion itself deliberately targetsselection.sourceFile || activeCompPath || "index.html"(packages/studio/src/components/DesignPanelPromoteProvider.tsx:33) so selecting an element inside an inlined sub-composition edits the sub-comp file, not the host. Result: promote/bound-state works againstcompositions/card.html, then clicking the bound chip opens a manager for the host composition and the variable you just bound is missing or edits the wrong file. This regresses exactly the sub-composition variable workflow the stack adds. Fix shape: make the manager store/open carry a target path (or target session) and have the bound chip open it for the sameselection.sourceFilesession thatVariablePromoteProvideruses; the header trigger can keep using the active/master target.
Important follow-ups still present from prior stack review
packages/sdk/src/types.ts:457still saysgetVariableValues()mirrors runtimegetVariables()exactly, but the implementation is now intentionally per-file/per-declaration-element scoped. That is the right product model for Studio sessions, but the public hover docs should say that rather than promising bundled-document runtime parity.docs/concepts/compositions.mdx:134andpackages/lint/src/rules/composition.ts:671still tell authors to declare variables on<html>only. The runtime/lint implementation now supports<html>plus template/fragment root divs, so these should be updated to avoid teaching the old model.
— Magi
Verdict: REQUEST CHANGES
Reasoning: The tab-removal/summonable-manager direction is good, but the manager currently opens the wrong composition session for selected sub-composition elements, breaking the core Design-panel variable flow until it carries the same target path as promotion.
Retire the dedicated Variables tab (Miguel's feedback: variables shouldn't need their own tab). Variable creation and default-editing already live inline in the Design panel via the promote pill / bound chip; this moves the full list into an on-demand slide-over summoned by a "Variables" button in the inspector header (and by clicking a bound control's chip). The slide-over hosts the existing VariablesPanel unchanged, so the "Bind selected" card — bind-to-existing / define-once-bind-many — is preserved. The button carries the "previewing N overrides" signal so it stays visible while the manager is closed. Adversarially reviewed by two design subagents before building.
Addresses Miguel's CHANGES_REQUESTED on #2101: the bound chip opened the manager with only a global boolean, so it rendered the host/master session even when the element and its promoted variable live in an inlined sub-composition file. The manager store now carries a targetPath; the bound chip passes the promote context's targetPath, and the slide-over opens a session for it (VariablesPanel gains compPathOverride so declarations, persist target, handoff, and other-comps exclusion all key off that file). The header trigger still targets the active composition.
35f2b45 to
dbaa962
Compare
bdc5a8d to
16a797d
Compare
|
Thanks @miguel-heygen — all three addressed. Blocker (manager opened the wrong session for sub-comp elements) — fixed. The manager store now carries a Follow-up 1 — Follow-up 2 — Full studio suite green (1428). Live browser UX still wants a human pass (agent-browser canvas driving is unreliable here). Re-requesting review. |
|
Closing this — we're reverting to the dedicated Variables tab (#2050) rather than folding the overview into a summoned surface. Rationale: the inline promote/edit in the Design panel (#2071 — the |

What
Retires the dedicated Variables tab and folds variable management into the Design panel, per Miguel's feedback ("variables doesn't need a new tab… can we modify them directly in the design panel"). Stacked on #2084.
Design rationale (adversarially reviewed)
Before building, I ran two design subagents — one attacking the "just fold it in" proposal, one steelmanning it. They converged on:
◇ varpromote pill /◆ {id}bound chip), so the tab was a redundant second home.VariablesPanelunchanged, which still contains the "Bind selected" card.How
◆ Variablestrigger in the inspector header (VariablesManagerTrigger) opens an on-demand slide-over; accent-styled + count when preview overrides are active.VariablesManagerSlideOver— right-anchored overlay hostingVariablesPanelverbatim (declare / edit / remove / preview / handoff / other-comps / bind-to-existing). Closes on backdrop click or Esc.◆chip in the Design panel is now clickable → opens the manager (manage-where-you-see-it).StudioRightPanel,RightPanelTab, andVALID_TABS;?tab=variablesdeep links fall back to the default. Selection-outline logic that special-cased the old tab is simplified (the manager overlays the Design panel, so bounds already show).Follow-up (deferred, not a regression)
Per-control "New variable / Bind to existing…" on the
◇pill (bind-to-existing from the control itself) — the capability is preserved today via the manager's bind card; this would add locality. Left for a follow-up.Testing
Full studio suite green (1423). Typecheck + lint + fallow + filesize gates pass.⚠️ Live browser UX (slide-over layout, chip-opens-manager, override-signal accent) wants a human pass — agent-browser canvas-selection driving is unreliable in this repo.
🤖 Generated with Claude Code