Add Theme Preview as a built-in plugin - #2505
Open
brsbl wants to merge 1 commit into
Open
Conversation
Theme Preview moves from the external bb-plugins repo into bb as a built-in so it evolves with the product instead of being a second design-system implementation. What it is: a panel that renders a maintained fixture of the bb UI under the live theme, so a palette can be judged against real product composition and against isolated specimens. Structure follows an explicit four-area taxonomy (taxonomy.ts), which both the app and the coverage tests read: - Preview: a fluid mock of the bb window with view toggles. Components keep their natural size and panels join or leave the composition by width; nothing is scaled. - Style sheet: the foundation surfaces lead, followed by the derived families, typography and corner radius. Every entry is one addressable `data-tp-specimen` element so a later version can attach editors. - Components: live bb controls covering hover, focus, checked, disabled. - Overlays: menu, dialog, popover, tooltip, hover card, toast, plus an interactive thread list, opened deliberately one at a time. Every control is a vendored @bb/shared-ui component rather than a lookalike, so the preview inherits bb's real geometry and behaviour. Colour values and contrast ratios are measured from the running document at runtime; status ratios measure the pair the product actually paints (text token over its 15%/18% wash), not the raw token on canvas. fixture-anatomy.test.ts pins the fixture to the app source it mirrors, so renaming a token or class the preview paints fails these tests instead of silently drifting. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Theme Preview lived in the external
bb-pluginsrepo, so it was a second design-system implementation maintained apart from bb. It could not consume bb's own components, and it drifted from the product whenever bb's tokens or surfaces changed.What changed
Theme Preview becomes a built-in plugin under
plugins/theme-preview, registered in the Interface category.Structure follows an explicit four-area taxonomy (
taxonomy.ts), read by both the app and the coverage tests:Key properties:
@bb/shared-uicomponent, so the preview inherits bb's real geometry, focus behaviour and responsive overlay handling.fixture-anatomy.test.tspins the fixture to the app source it mirrors, so renaming a token or class the preview paints fails these tests rather than silently drifting.How I verified
turbo run typecheck test --filter=bb-plugin-theme-preview— 49/49 tests green, typecheck cleanturbo run test --filter=@bb/server(builtin plugin reconciliation) — 25/25 greenFollow-ups
theme-previewpath install keep working — the reconciler skips a shadowed id with a warning. Removing that install is the deliberate swap once this ships.BB-Thread-ID: thr_b2mmedy33p