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