Skip to content

feat: cockpit dark mode token system#298

Merged
blove merged 17 commits into
mainfrom
dark-mode-token-system
May 13, 2026
Merged

feat: cockpit dark mode token system#298
blove merged 17 commits into
mainfrom
dark-mode-token-system

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 13, 2026

Summary

  • Splits @ngaf/design-tokens into invariant baseTokens + small lightOverrides / darkOverrides; cssVars(theme) resolves at runtime in @ngaf/ui-react.
  • Cockpit defaults to dark, with a light toggle in the sidebar footer. theme cookie is the source of truth; useTransition + synchronous DOM updates make the toggle feel instant before the server confirms.
  • Adds <ThemedFrame> + useEmbeddedTheme() to @ngaf/ui-react for per-frame postMessage theme sync — replaces the run-mode iframe wrapper. Embedded examples opt in by calling useEmbeddedTheme() (cacheplane adoption is a separate follow-up).
  • Flips the cockpit OG image to the dark canvas so the social preview matches the live product.
  • Bumps @ngaf/design-tokens 0.0.31 → 0.0.32 and @ngaf/ui-react 0.0.29 → 0.0.30 (patch-only per the release rule).

Out of scope: marketing site, docs, email renderings (all explicitly excluded in the spec).

Spec: docs/superpowers/specs/2026-05-13-cockpit-dark-mode-design.md
Plan: docs/superpowers/plans/2026-05-13-cockpit-dark-mode.md

Test plan

  • pnpm nx run-many -t lint,test -p design-tokens,ui-react,cockpit — green
  • pnpm nx e2e cockpit — 6/6 (3 new dark-mode tests + existing cockpit nav)
  • Manual: visit cockpit, confirm dark on first load, toggle to light, reload, confirm persistence
  • Manual: curl --ipv4 -o /tmp/og-cockpit.png http://localhost:4201/opengraph-image and eyeball dark canvas

🤖 Generated with Claude Code

blove and others added 16 commits May 13, 2026 09:59
Spec for cockpit-only dark mode: dark by default with light toggle,
typed `cssVars(theme)` resolution, cookie source of truth, per-frame
postMessage sync for embedded iframes, paired OG image flip.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
15 bite-sized tasks covering token split, cssVars(theme), ThemeProvider,
ThemedFrame, useEmbeddedTheme, ThemeToggle, cookie route, layout wiring,
sidebar footer, RunMode iframe wrap, OG flip, e2e, version bumps, PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- @ngaf/design-tokens: 0.0.31 → 0.0.32
- @ngaf/ui-react:      0.0.29 → 0.0.30

Also includes follow-ups required to keep the check stack green after
Task 10 added <ThemeToggle> (which calls useRouter from next/navigation)
to the cockpit sidebar:

- apps/cockpit/test-setup.ts: mock next/navigation so renderToStaticMarkup
  tests of CockpitSidebar / CockpitShell don't trip the "expected app
  router to be mounted" invariant.
- apps/cockpit/vite.config.mts: wire setupFiles to the new test-setup.ts.
- libs/ui-react/src/lib/themed-frame.spec.tsx: replace non-null assertion
  with explicit guard to clear the @typescript-eslint/no-non-null-assertion
  lint warning.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 13, 2026 5:07pm

Request Review

54 website consumers use `tokens.colors.X`, `colors.textPrimary`, etc.
directly. Restore the original shapes as light-theme aliases so the
website (light-only) keeps working without per-file migration. New
theme-aware API (baseTokens, lightOverrides, darkOverrides, cssVars(theme))
is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@blove blove merged commit 8b0633f into main May 13, 2026
14 checks passed
blove added a commit that referenced this pull request May 15, 2026
…s) (#333)

* docs: dark palette alignment design

Sibling of #321 (light palette refresh). Aligns design-tokens dark
palette to chat lib's neutral-dark aesthetic (rgb(17,17,17) canvas,
rgb(28,28,28) surface, etc.) instead of the original brand-blue
undertone shipped in #298. Embedded chat in cockpit dark mode now
visually unifies with cockpit chrome.

Reverses decision D from the original cockpit dark mode brainstorming
in favor of design-system cohesion. Accent family stays unchanged
(brand identity preserved).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(design-tokens): align dark palette to neutral grays

Reverses #298's brand-blue undertone in dark mode in favor of cohesion
with the @ngaf/chat lib's neutral-dark aesthetic. Embedded chat surfaces
in cockpit dark mode now unify visually with cockpit chrome — no iframe
color seam. Accent family unchanged (brand identity preserved).

* test(design-tokens): update dark-theme css-vars assertions

Aligns --ds-canvas and --ds-text-primary expectations with the new
neutral-dark palette.

* test(cockpit): update dark-mode e2e canvas assertion

Aligns the default-dark --ds-canvas expectation with the new
neutral-dark palette.

* chore(design-tokens): bump to 0.0.35

Patch bump for dark palette alignment.

* test(example-layouts): update dark-theme install-embedded-theme assertion

Aligns the default-dark --ds-canvas expectation with the new
neutral-dark palette.

* test(example-layouts): fix stale #fafbfc light-canvas assertions

Pre-existing test drift missed by #321 (light palette refresh —
canvas changed to rgb(255, 255, 255)). Caught while updating the
dark assertion in this PR.

---------

Co-authored-by: Claude Opus 4.7 <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