feat(hub-ui): inherit panel accents from startup branding - #384
Conversation
Expose a framework-neutral theme handshake for iframe panels and connect hub-ui branding to built-in SPAs through their primary design tokens. Preserve standalone defaults, status colors, and independent chart and preview palettes. Include protocol tests, documentation, and API snapshots.
|
@SaKaNa-Y is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
|
I noticed that Vite DevTools’ accent color doesn’t carry through to the built-in iframe panels, so I added a mechanism that lets panels opt into the host’s accent color. I’m not sure whether this aligns with your design intentions, and I’d love to hear your thoughts. |
◈ PR Lens
Architecture 12 components touched across 6 lanes. Play the interactive walkthrough Inside the changed components — 2 viewsComponent view — Theme Derivation & RPC Connection Startup branding extraction via client RPC and CSS custom property derivation across shadow and light DOM surfaces. Component view — Built-in Devframe Panels Built-in devframe iframe SPAs applying startup panel branding and adopting shared design tokens. Data flow
Follow each request, response and payload View
Tip Open a diagram on the canvas, then press W or click play to walk through the change one step at a time 🪧 More tips
Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
| A SPA can adopt its hub UI provider's primary accent with `watchDevframeTheme()`. Map the hint to your own UI token and retain separate tokens for brand graphics, status colors, and charts: | ||
|
|
||
| ```ts | ||
| import { watchDevframeTheme } from 'devframe/client' |
There was a problem hiding this comment.
Ideally, I would like to avoid introducing these APIs, as devframe itself should be agnostic, the theme is more like a hub-ui concept. And if possible, I'd also like to keep this at CSS level as much as possible instead of relying on JS apis.
There was a problem hiding this comment.
Thanks for pointing that out! Reusing the branding from the existing connection metadata looks feasible. I’ll update the implementation to use that and keep the styling in CSS as much as possible, without introducing new theme APIs or a separate communication channel.
Replace the proposed public theme APIs and message channel with existing connection metadata and the shared hub UI primary ramp. Apply one CSS input at startup and preserve standalone defaults. Use the existing active-color token for query matches and track shared CSS and adapter inputs in all nine panel build tasks. Replace protocol tests with startup branding and cleanup coverage.
|
Updated the implementation to read The panel adapter now sets only Standalone defaults and independent status/preview palettes are preserved. Configuration changes take effect after a panel reload. Git and Inspector browser checks passed, and the test suite reports 1525 passed and 9 skipped. |
|
Reworked the implementation to reuse the existing CSS and connection metadata, reduce reliance on JS APIs, and slightly adjust the query-completion highlight color. |
Consolidate the two near-identical primary-ramp.css files (hub-ui's and json-render-ui's) into a single design/primary-ramp.css, next to the ramp contract it must match (OVERRIDABLE_PRIMARY_STOPS in design/uno.config.ts). Panels, both shadow-root build-css scripts, and the Storybook preview now read the one shared file, and the nine panel build tasks track design/** instead of listing two shared files each.

Important
Please take a moment to read this. Thank you!
I should include a brief explanation of the problem in my own words in every PR. If that explanation is missing, please @mention me and do not merge this PR until I have added it. You may also leave this PR unaddressed (because this means I have not fulfilled my responsibilities as the author).
If my explanation is unclear or difficult to follow, please ask me to clarify or provide reproduction steps or supporting evidence.
I welcome suggestions and counterarguments, especially questions about anything I may have overlooked. (Your feedback helps me learn and improve. 🙏)
I hold myself to this standard for every PR, regardless of its size.
Intent
Let built-in devframe panels inherit the hub UI provider's primary accent. A branded dock can otherwise appear blue while its Git and Inspector panels retain green accents.
Behavior and implementation
branding.primaryColorfrom existing connection metadata when an iframe SPA starts, and set--devframe-primarythrough an internal design adapter.Branding is applied at startup; panels must reload to pick up changed configuration. Runtime theme broadcasts and arbitrary external iframe theming are outside this implementation.
This extends the branding work in #177. #203 and #253 concern dock and popup branding; #382 concerns SVG mask icons.
Verification
pnpm lint,pnpm knip,pnpm typecheck, andpnpm build: completed successfully. Knip emitted UnoCSS configuration lookup messages.pnpm exec vitest run: 1525 passed, 9 skipped.The other seven panel SPAs were built and their entry points reviewed, but were not individually exercised in the browser.