Skip to content

feat: theming v2 with design tokens, theme files, and editor#115

Merged
PAMulligan merged 9 commits into
mainfrom
73-theming-v2-design-tokens
Jun 11, 2026
Merged

feat: theming v2 with design tokens, theme files, and editor#115
PAMulligan merged 9 commits into
mainfrom
73-theming-v2-design-tokens

Conversation

@PAMulligan

Copy link
Copy Markdown
Contributor

Closes #73

Summary

Upgrades the accent-color-only API to a full design-token system. Design doc: docs/plans/2026-06-11-theming-v2-design.md.

Acceptance criteria

  • All visual decisions as CSS custom properties — every color, radius, shadow, and font resolves through a --cl-* token (--cl-color-accent, --cl-color-surface, --cl-radius-md, --cl-shadow-elevated, ...). Dark mode reassigns color tokens via the [data-claudius-dark] block instead of hard-coded dark: utilities.
  • JSON schema published — source of truth in widget/src/theme/theme.v1.schema.json, byte-identical copy (drift-guarded by a test) served at https://claudius-docs.pages.dev/schema/theme.v1.json the moment this merges (docs auto-deploy). The issue named claudius.dev, which is not attached yet — same "or equivalent" precedent as Replace README-heavy docs with a proper docs site (Astro Starlight) #74; the path carries over when the domain lands.
  • theme: ClaudiusTheme | string — the prop now accepts mode strings (unchanged behavior), built-in names, inline theme objects, or a URL to a theme JSON file (fetched with abort/fallback; the widget never breaks on a bad theme URL). accentColor still works and wins over the theme accent.
  • Built-in themesdefault, minimal, playful, corporate, exported as builtinThemes, all schema-validated in tests.
  • Theme editor with JSON export — live at /theme-editor/ on the docs site with grouped token controls, light/dark preview, presets, and download/copy export. The issue placed this on the playground site, which does not exist yet (Public demo / playground site with live config editor #48/Public playground and demo site #83) — the docs site is its interim home and the editor moves when the playground lands.
  • Documented migration path/migration/accent-color-to-themes/ plus a rewritten theming reference with the full token table.

Compatibility

No breaking changes (the CDN @1 channel auto-updates, so this was a hard constraint):

  • theme: "light" | "dark" | "auto", accentColor, and external --claudius-* overrides keep their exact behavior (legacy vars stay first in each var() chain and win)
  • Default light/dark appearance is unchanged
  • One intentional fix, called out in the migration guide: user message bubbles now follow accentColor/theme accent (previously the header recolored but user bubbles stayed blue)

Verification

  • Widget: 257/257 tests (37 new for the theme engine, prop wiring, and schema), typecheck clean, lint clean (2 pre-existing warnings), lib + embed builds pass (bundle +1.3 KB gzip)
  • Worker: 23/23 (untouched, regression check)
  • Docs: 57 pages build green incl. the editor page and Pagefind index

🤖 Generated with Claude Code

Paul Mulligan and others added 8 commits June 11, 2026 01:37
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every color, radius, shadow, and font now resolves through a --cl-*
custom property. Dark mode reassigns color tokens via the
[data-claudius-dark] block instead of per-class dark: variants. Legacy
--claudius-* properties stay first in each var() chain so existing
external overrides keep winning. Default light/dark appearance is
unchanged; accentColor now feeds --cl-color-accent (and therefore also
the user bubble, which previously ignored it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
useTheme resolves the union: mode strings keep their existing meaning,
built-in names map to bundled themes, other strings are fetched as theme
JSON (falling back to defaults on any failure), and objects apply
directly. accentColor still wins over the theme accent. Exports
builtinThemes and the ClaudiusTheme types.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Source of truth lives next to the theme types; the byte-identical copy in
docs/public/schema/ is served at
https://claudius-docs.pages.dev/schema/theme.v1.json. AJV validates the
built-ins and rejection cases in tests (dev-only dependency).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying chat-widget with  Cloudflare Pages  Cloudflare Pages

Latest commit: 193e760
Status: ✅  Deploy successful!
Preview URL: https://be4c7392.chat-widget-ejc.pages.dev
Branch Preview URL: https://73-theming-v2-design-tokens-wz5t.chat-widget-ejc.pages.dev

View logs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@PAMulligan
PAMulligan merged commit 96dbdc0 into main Jun 11, 2026
6 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.

Theming v2: design tokens via CSS custom properties + JSON schema for theme files

1 participant