Skip to content

feat: cockpit examples theme sync — stage 1 (library + pilot)#301

Merged
blove merged 8 commits into
mainfrom
examples-theme-sync
May 13, 2026
Merged

feat: cockpit examples theme sync — stage 1 (library + pilot)#301
blove merged 8 commits into
mainfrom
examples-theme-sync

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 13, 2026

Summary

Stage 1 of cockpit example theme sync (spec: docs/superpowers/specs/2026-05-13-cockpit-examples-theme-sync-design.md, plan: docs/superpowers/plans/2026-05-13-cockpit-examples-theme-sync-stage-1.md).

  • cssVars(theme) relocated from @ngaf/ui-react@ngaf/design-tokens (pure TS, framework-agnostic). @ngaf/ui-react re-exports for React consumers — cockpit's import path is unchanged.
  • installEmbeddedTheme() added to @ngaf/example-layouts — vanilla TS helper that applies the cssVars(theme) palette to <html> and listens for ngaf:theme postMessage from cockpit's <ThemedFrame> host. Defaults to dark, posts ngaf:theme-request on init for handshake.
  • @ngaf/example-layouts/theme.css added — Tailwind v4 entry + @custom-variant dark (&:where([data-theme="dark"] *)) + namespace bridge (legacy --ngaf-chat-*--ds-*).
  • Workspace Tailwind v4 setup@tailwindcss/postcss + tailwindcss at workspace devDeps; postcss.config.mjs at repo root mirroring the website's config.
  • Pilot migration: cockpit/chat/timeline/angular drops the v3 CDN, swaps hardcoded bg-gray-950 text-gray-100 for CSS-variable utilities, calls installEmbeddedTheme() from main.ts.

Stage 2 (remaining 31 Angular example apps in waves grouped by library) ships in a separate PR after this pilot is approved.

Known follow-up

The pilot's styles.css imports theme.css via a 5-level relative path (@import "../../../../../libs/example-layouts/src/theme.css") rather than the package import @import "@ngaf/example-layouts/theme.css". esbuild's CSS resolver in @angular/build:application uses Node module resolution and doesn't consult tsconfig paths or pnpm workspace symlinks (root package.json has no workspaces field). Every Stage 2 app needs the same 5-level relative path, which is a constant pattern — workable for now, but cleaner to resolve before fanning out to 31 apps. Options: real npm/pnpm workspace setup, manual symlink, or per-app re-export of the CSS.

Test plan

  • pnpm nx run-many -t lint,test -p design-tokens,ui-react,example-layouts,cockpit — green
  • pnpm nx e2e cockpit — 6/6 green
  • pnpm nx build website — green (85 prerendered pages)
  • pnpm nx build cockpit-chat-timeline-angular — green
  • Manual chrome MCP smoke: cockpit `chat/timeline` capability, verify light + dark flip in embedded iframe — screenshots to be attached pre-merge

🤖 Generated with Claude Code

blove and others added 8 commits May 13, 2026 10:50
Spec for syncing 32 Angular example apps with cockpit theme via
postMessage + migrating Tailwind v3 CDN → v4 centralized in
@ngaf/example-layouts. TS-source-of-truth palette via cssVars(theme)
relocated to @ngaf/design-tokens.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
8 tasks: cssVars relocation to @ngaf/design-tokens, installEmbeddedTheme
in @ngaf/example-layouts, theme.css with Tailwind v4 + dark variant +
namespace bridge, workspace PostCSS config, chat-timeline pilot migration,
version bumps, chrome MCP smoke, PR ship.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Pilot migration for cockpit examples theme sync (Stage 1, Task 5):
- index.html: drop v3 Tailwind CDN script and hardcoded body classes
- styles.css: import @ngaf/example-layouts theme.css and set --ds-* globals
- main.ts: call installEmbeddedTheme() before bootstrap
- timeline.component.ts: replace --chat-* inline-style fallbacks with --ds-*

Theme.css imported via relative path since @ngaf/example-layouts is not
symlinked in node_modules; revisit if workspace layout changes.

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:54pm

Request Review

@blove blove merged commit 14f1299 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