Skip to content

feat(core): color a dock-bar entry's badge via a new badgeVariant field - #528

Open
dvcolomban wants to merge 2 commits into
vitejs:mainfrom
dvcolomban:dvcol/dock-badge-variant
Open

feat(core): color a dock-bar entry's badge via a new badgeVariant field#528
dvcolomban wants to merge 2 commits into
vitejs:mainfrom
dvcolomban:dvcol/dock-badge-variant

Conversation

@dvcolomban

@dvcolomban dvcolomban commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Why

DockEntry's badge is a plain string label with a fixed gray fill — no way to color it. json-render's own Tabs component already supports this one level down (TabDescriptor.badgeVariant, with a real variant→color map, used today by tab strips inside a dock's own content); the dock-bar entry itself has no equivalent, even though it's the same kind of label.

What changed

  • badgeVariant?: 'default' | 'info' | 'success' | 'warning' | 'danger' on DevframeDockEntryBase, declared via the same declare module '@devframes/hub/types' merge this package already uses for DevframeDockEntryRegistry — no new field on the hub package itself.
  • DockEntry.vue/DockEntries.vue thread it through, reusing Tabs.ts's own colors token map rather than inventing a second one.
  • Backward-compatible by construction: DockEntry.vue falls back to its pre-existing bg-gray-6/text-white classes at 'default'/unset, and only switches to an inline-styled fill for an explicit non-default variant — every existing badge consumer keeps its current look, unchanged.

Linked Issues

Additional context

Verified with pnpm build, pnpm test (updated the public-API .d.ts snapshot for the new export, 381 passing total), pnpm typecheck, pnpm lint — all green.

DockEntry's badge has always been a plain count with a fixed gray fill — no
way to distinguish, at a glance, "this count is provisional" from "this is
the settled value". json-render's own Tabs component already solved this one
level down (TabDescriptor.badgeVariant, with a real variant→color map); this
carries that same variant set up to the dock-bar entry itself.

badgeVariant is declared via the existing DevframeDockEntryRegistry
declaration-merge pattern this package already uses, staying optional so
every existing badge consumer keeps its current look unchanged. DockEntry.vue
falls back to its pre-existing bg-gray-6/text-white classes at 'default'/
unset, and only switches to an inline-styled fill (reusing Tabs.ts's own
colors map) for a non-default variant.
@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@528

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@528

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@528

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@528

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@528

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@528

commit: 8120068

…ents

The tab-badge fill (colors[variant].bg, alpha 0.15) read as too faint
reused on the dock bar — boosted via CSS relative-color syntax instead of
adding a second color table.
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