feat(client): add opt-in panel accent inheritance - #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 8 components touched across 5 lanes. Inside the changed components — 2 viewsComponent view — Hub UI theme provider The iframe view host and branding state powering theme provision to embedded panels. Component view — Panel theme synchronization How panel SPAs use the design helper and theme protocol to apply the primary accent ramp. Data flow
View
Tip The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change. 🪧 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. |
Intent
A hub UI provider can customize its primary color, while iframe SPAs retain their own accent. For example, Vite DevTools uses a blue dock but the built-in Git and Inspector panels keep green title icons. Add an opt-in way for panels to adopt the embedding UI's accent.
Behavior and implementation
watchDevframeTheme()andprovideDevframeTheme()fromdevframe/client. The callback exposes an optionalprimaryColor; each SPA chooses how to map it to UI tokens.@devframes/hub-uiofferbranding.primaryColorto iframe panels. The handshake supports either startup order, reloads, preserved iframe remounts, and cross-origin documents with non-opaque origins. Messages are checked against the corresponding window, and updates target the requesting origin.This extends the branding work in #177 with explicit panel opt-in. #203 and #253 cover dock rendering and popup branding; #382 covers SVG mask icons. Unsubscribed third-party SPAs keep their own appearance. Dark-mode preferences are unchanged.
Verification
pnpm exec vitest run: 1527 passed, 9 skipped, including 9 theme protocol tests.pnpm exec eslint --cache,pnpm exec knip, andpnpm typecheck: passed.