Skip to content

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

Open
jrusso1020 wants to merge 1 commit into
07-07-feat_studio-server_preview_variable_injection_render_variables_forwardingfrom
07-07-feat_studio_variables_inspector_panel_with_live_preview_values
Open

feat(studio): variables inspector panel with live preview values#2050
jrusso1020 wants to merge 1 commit into
07-07-feat_studio-server_preview_variable_injection_render_variables_forwardingfrom
07-07-feat_studio_variables_inspector_panel_with_live_preview_values

Conversation

@jrusso1020

@jrusso1020 jrusso1020 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

What

Fifth PR of the template-variables stack: the Studio UI. Everything here is a thin client over the SDK surface from #2046#2048 — no bespoke parsing or schema logic lives in Studio.

  • New Variables tab in the right inspector: declared schema with type badges, descriptions, usage info (unused badges, one-click Declare for script-read-but-undeclared ids, honest degradation when access is dynamic)
  • Preview with values: per-type controls (text, number w/ range, color, boolean, enum; font/image as text for v1) write ephemeral overrides that ride the preview URL as ?variables= — the server injects them exactly like render time. Overrides survive soft reloads and hard remounts, a header pill shows defaults-vs-custom with one-click reset, validation issues render as an error strip
  • Schema editing: add / edit / remove declarations and per-row "Set default", persisted through the standard single-writer path (undo history, self-write echo suppression, preview reload); can() failures surface as toasts
  • Review fixes absorbed: slider/color commit on release instead of per-drag-tick (each commit reloads the preview iframe), edit-form round-trip preserves unmodeled declaration metadata (font source, brandRole, unit, …) via mergeDeclarationEdit, clipboard copy uses the shared Safari-safe helper, panel subscribes to session change events
  • PanelTabButton extracted (the tab bar was 5 copies of the same 15-line button)

Why

The docs have long described a Studio variables panel that didn't exist. This is the trust loop: see the schema, try values against the live preview, persist the ones you like — with undo.

Test plan

  • Typecheck + studio suite (1392) + browser build
  • Driven end-to-end in a real browser session: all five control types commit and update the preview; pill/reset/override-equality-drop; Set default persists to disk (incl. --{id} CSS compat prop) and undo restores the file verbatim; add/remove write valid schema to disk (see fix(studio): code-review and live-test fixes for the variables stack #2052 for the full test log)

🤖 Generated with Claude Code

Fifth PR of the template-variables Studio stack — the UI. Everything here
is a thin client over the SDK surface from the earlier PRs; no bespoke
parsing or schema logic lives in Studio.

- new "Variables" tab in the right inspector panel: lists the declared
  schema (getVariableDeclarations) with type badges, descriptions, and
  usage info (getVariableUsage) — unused declarations get a badge,
  script-read-but-undeclared ids get a one-click Declare action, and
  dynamic access degrades the display to "may be incomplete".
- preview with values: per-type controls (text, number w/ range, color,
  boolean, enum select; font/image as text for v1) write ephemeral
  overrides that ride the preview URL as ?variables= — the server injects
  window.__hfVariables exactly like render time, so the preview is
  render-truthful. Overrides survive soft reloads and hard remounts
  (both URL builders route through applyPreviewVariablesToUrl), a header
  pill shows defaults-vs-custom state with one-click reset, and
  validateVariableValues issues render as an error strip.
- schema editing: add / edit / remove declarations and "set default"
  via the SDK ops (declareVariable / updateVariableDeclaration /
  removeVariableDeclaration / setVariableValue), persisted through the
  standard single-writer path (undo history, self-write echo
  suppression, preview reload). can() failures surface as toasts.
- sdk: re-export the per-type variable interfaces (StringVariable,
  NumberVariable, …) for typed consumers.
- StudioRightPanel: extract PanelTabButton (the tab bar was 5 copies of
  the same 15-line button).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jrusso1020 jrusso1020 force-pushed the 07-07-feat_studio-server_preview_variable_injection_render_variables_forwarding branch from c843527 to dc24770 Compare July 8, 2026 08:00
@jrusso1020 jrusso1020 force-pushed the 07-07-feat_studio_variables_inspector_panel_with_live_preview_values branch from dc052d3 to f2a1662 Compare July 8, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant