Skip to content

Add Theme Preview as a built-in plugin - #2505

Open
brsbl wants to merge 1 commit into
mainfrom
bb/theme-preview-builtin-thr_bvzn6tvjyr
Open

Add Theme Preview as a built-in plugin#2505
brsbl wants to merge 1 commit into
mainfrom
bb/theme-preview-builtin-thr_bvzn6tvjyr

Conversation

@brsbl

@brsbl brsbl commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

What was wrong

Theme Preview lived in the external bb-plugins repo, 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:

Area Contents
Preview Fluid mock of the bb window with view toggles (thread, new, split, settings)
Style sheet Foundation surfaces lead, then derived families, typography, corner radius
Components Live bb controls: hover, focus, checked, disabled
Overlays Menu, dialog, popover, tooltip, hover card, toast, interactive thread list

Key properties:

  • Vendored components, not lookalikes. Every control is a @bb/shared-ui component, so the preview inherits bb's real geometry, focus behaviour and responsive overlay handling.
  • Measured, not authored. Colour values and contrast ratios are read 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.
  • Fluid, never scaled. The mock composes from natural panel widths; panels join or leave by width. No CSS zoom.
  • Drift-guarded. 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 rather than silently drifting.

How I verified

  • turbo run typecheck test --filter=bb-plugin-theme-preview — 49/49 tests green, typecheck clean
  • turbo run test --filter=@bb/server (builtin plugin reconciliation) — 25/25 green
  • Live QA in the branch web app via Chrome for Testing 151 at 390 / 768 / 1440 / 1600 / 3440 widths, light and dark, plus a non-default palette (Nord): selector, overlays, tooltip delay, thread-list hover and expansion, typography preview, inputs, switches, checkboxes, buttons. Zero console errors.
  • Real Safari 26.5.2 verified an earlier milestone; the three most recent change sets are Chrome-only so far and still need a Safari pass.

Follow-ups

  • Next phase (making the remaining controls interactive) is handed to a dedicated worker.
  • Safari re-verification of the most recent change sets.
  • Migration note: users with the external theme-preview path 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

AGENT GENERATED

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>
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