Add reactive plugin appearance and built-in palette contracts - #2243
Open
ymichael wants to merge 9 commits into
Open
Add reactive plugin appearance and built-in palette contracts#2243ymichael wants to merge 9 commits into
ymichael wants to merge 9 commits into
Conversation
ymichael
force-pushed
the
bb/add-reactive-plugin-appearance-api-thr_3rvv9swj6u
branch
2 times, most recently
from
August 21, 2026 22:18
edba98e to
a3c9b6c
Compare
ymichael
force-pushed
the
bb/add-reactive-plugin-appearance-api-thr_3rvv9swj6u
branch
from
August 22, 2026 00:03
b0baa2c to
0eb160c
Compare
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
Plugin JavaScript consumers had no supported semantic contract for BB's client light/dark appearance even though the app already owns reactive mode and preference stores. Monaco 0.1.0 consequently observes BB's private root
darkclass to choosevs/vs-dark, while Theme Toggle 0.2.1 reads the privatebb.themestorage key, dispatches a synthetic storage event, callsmatchMedia, and mutates that root class from a content-script menu. Appearance access is a client-wide capability; coupling it separately to footer-action and content-script contexts would make the API depend on where code happened to run rather than what it needed.The live marketplace audit also showed that mode must stay separate from palettes: Ayu 0.2.2 and Tokyo Night 0.1.0 already use
bb.themes/bb.sdk.theme; Fonts 0.1.0 is only partially covered because it additionally needs a future palette-change notification, not speculative palette values or CSS tokens here.Separately,
bb.sdk.theme.catalog()omitted BB's own bundled palettes. Theme Toggle therefore copies the six built-in ids, names, and descriptions into its server code before appending the catalog's custom and plugin palettes; that copy can silently drift from BB's canonical list and ordering.What changed
colorMode, client-localcolorModePreference, andsetColorModePreference(...).experimental_appearanceexternal store from@get-bb/plugin-sdk/app:getSnapshot()supports point-of-use reads from any plugin module, callback, content script, or setup code.subscribe(listener)supports non-React reactivity and returns its cleanup function.experimental_useAppearance()is the React convenience wrapper over the same store for Monaco-style consumers.sidebarFooterAction.runstill receives onlyopenSettings, andPluginContentScriptContextstill contains lifecycle plus its existing optional thread-row status API. There are no appearance-specific footer/content-script adapters.vs/vs-darkmapping, and a palette-switcher fixture builds its choices from the SDK theme catalog.bb.sdk.theme.catalog()with requiredexperimental_builtInmetadata sourced from BB's canonicalbuiltInThemeslist. Built-in ids retain their exact string union; the field contains only id, name, description, and canonical display order.bb theme listto consumecatalog.experimental_builtInwhile preserving its existingbuiltInThemesJSON output key.AppToasteron BB's internal theme hook; first-party app chrome does not consume the plugin facade.docs/api_to_audit.md, updated the canonicalbb-plugin-authoringskill and SDK test harness, and bumped the plugin SDK from0.4.13to0.4.14(Plugin API Tester requires it).HOST_DAEMON_PROTOCOL_VERSIONis unchanged.Measured from the branch base (
0e12ccca7) with clean Turbo builds:4bc815bf2, adds 688 raw / 220 gzip bytes of optional plugin JavaScript and 9,279 raw / 955 gzip bytes of scoped plugin CSS. It adds no dependency and does not affect app boot.How you verified
pnpm exec turbo run typecheck --filter=@bb/server --filter=@bb/cli --filter=@bb/sdk --filter=@bb/server-contract --filter=@get-bb/plugin-sdk— 9/9 tasks passed.pnpm exec turbo run build --filter=@bb/server --filter=@bb/cli --filter=@bb/sdk --filter=@bb/server-contract --filter=@get-bb/plugin-sdk --filter=@bb/app— 9/9 tasks passed.pnpm exec turbo run test --filter=@bb/server --force -- test/system/appearance.test.ts— 14 tests passed, including canonical catalog mapping.pnpm exec turbo run test --filter=@get-bb/plugin-sdk --force -- src/testing/__tests__/fake-plugin-host.test.ts— 44 tests passed, including the palette-switcher contract fixture.pnpm exec turbo run test --filter=@bb/sdk --force -- test/public-types.test.ts— 9 tests passed, including the exact built-in id union.pnpm exec turbo run test --filter=@bb/server --force -- test/services/plugins/plugin-authoring-docs.test.ts— 14 tests passed.pnpm exec turbo run typecheck --filter=bb-plugin-plugin-api-tester— 4/4 tasks passed.pnpm exec turbo run test --filter=bb-plugin-plugin-api-tester --force— 1 focused behavior test passed, covering panel writes, external reactivity, pressed state, and absence of a footer contribution.pnpm exec turbo run build --filter=bb-app— 11/11 tasks passed; the packaged plugin contains no footer-action registration.git diff --check— passed.Fixes: no linked issue.