Skip to content

feat(theme): refresh the canonical tokens from the hosts and pin what they send - #5

Merged
andrii-bodnar merged 4 commits into
mainfrom
feat/canonical-tokens-from-hosts
Oct 14, 2026
Merged

andrii-bodnar merged 4 commits into
mainfrom
feat/canonical-tokens-from-hosts

Conversation

@acsy

@acsy acsy commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Both Crowdin hosts now run on raven (crowdin.com for a while, Enterprise since the redesign v2 merge). The registry still carried a hand-copied snapshot of the pre-raven palette, and the app-theme bridge read a host variable that Enterprise v2 no longer sends.

  • Bridge reads --crowdin-primary-foreground (raven's own name, sent by both hosts) for primary-foreground and sidebar-primary-foreground. The old --crowdin-primary-btn-color was a crowdin.com-only alias; on Enterprise v2 the bridge would have fallen back to white text on the #f4f4f4 dark primary.
  • Canonical theme literals and bridge fallbacks are now exactly what crowdin.com sends for each token's host variable: the neutral #262626 / #f4f4f4 scale, level-2/3/0 surfaces, alpha-based text colors. No more oklch snapshot of the blue-tinted gray and green dark primary.
  • Host fixtures in tests/hosts/*.json pin the variables each host sends to app iframes, captured with pnpm capture-host <name> <css-variables.js> (trimmed to what the bridge reads plus their var() chains). New tests require every bridged variable on every captured host and the theme literals to equal crowdin.com's values, so a renamed or dropped host variable fails in CI instead of in production.
  • Showcase "Simulate host" palettes are generated from the same fixtures (site/scripts/gen-host-sim.mjs); the hand-written host-sim.css with the pre-raven palette is gone.
  • .idea/ is ignored.

Deployment note

The registry is not a runtime dependency: apps bake the bridge in at shadcn add time. Apps that installed the previous app-theme keep reading --crowdin-primary-btn-color until they re-add it, so they should be updated before or alongside the Enterprise v2 rollout.

Test plan

  • pnpm test (21 tests)
  • pnpm validate
  • pnpm build
  • pnpm smoke (60 items installed into the fixture app, typechecked, CSS compiled)
  • pnpm site:build
  • Showcase with "Simulate host" off, crowdin.com, and Enterprise in both themes: neutral primary everywhere, no green

🤖 Generated with Claude Code

acsy and others added 3 commits October 14, 2026 11:42
… they send

Both hosts now run on raven: crowdin.com for a while, Enterprise since the
redesign v2 merge. The registry still carried a hand-copied snapshot of the
old blue-tinted palette (navy foregrounds, green dark primary), and the
bridge read --crowdin-primary-btn-color, a frontend-only alias that the
Enterprise redesign dropped - primary-foreground would have fallen back to
white on a #f4f4f4 dark primary.

- app-theme reads --crowdin-primary-foreground (raven's own name, sent by
  both hosts) for primary-foreground and sidebar-primary-foreground.
- theme literals and the bridge fallbacks are exactly what crowdin.com
  sends for each token's host variable: the neutral #262626 / #f4f4f4
  scale, level-2/level-3/level-0 surfaces, alpha-based text colors.
- tests/hosts/*.json pin the variables each host sends to app iframes,
  captured with `pnpm capture-host <name> <css-variables.js>` (trimmed to
  what the bridge reads plus their var() chains). Tests require every
  bridged variable on every captured host and the theme literals to equal
  crowdin.com's values, so a renamed or dropped host variable fails here
  instead of in production.
- the showcase "Simulate host" palettes are generated from the same
  fixtures (site/scripts/gen-host-sim.mjs); the hand-written host-sim.css
  with the pre-raven palette is gone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…data

The registry is public and must not reference the private product repos.
tests/hosts/*.json now describe their source as the host's window.cssVariables
(what AP.getCssVariables delivers to app iframes) and the README says to
refresh them from the browser console on the host.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The dark host simulation currently retains light-only fixture variables because both generated selectors match in dark mode.

1 open finding
What changed in this PR

Refreshes canonical theme tokens from current Crowdin host palettes and keeps the showcase synchronized with captured host fixtures.

Changes:

  • Updates theme values and host-variable mappings.
  • Adds host fixtures, validation tests, and generated simulation CSS.
  • Updates showcase build scripts, documentation, and ignore rules.
File Description
tests/​hosts/​enterprise.json Adds Enterprise palette fixture.
tests/​hosts/​crowdin-com.json Adds crowdin.com palette fixture.
site/​src/​index.css Imports generated host simulation CSS.
site/​src/​host-sim.css Removes handwritten simulation palette.
site/​src/​app.tsx Aligns the crowdin.com host identifier.
site/​scripts/​gen-theme.test.mjs Derives assertions from bridge configuration.
site/​scripts/​gen-host-sim.test.mjs Tests host simulation generation.
site/​scripts/​gen-host-sim.mjs Generates simulation CSS from fixtures.
site/​package.json Generates simulation CSS before builds and development.
scripts/​registry.test.mjs Validates host variables and canonical values.
registry.json Refreshes tokens and bridge fallbacks.
README.md Documents host fixture maintenance.
.gitignore Ignores JetBrains settings.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread site/scripts/gen-host-sim.mjs Outdated
The light block matched <html class="dark"> too, so dark mode got the union
of both fixtures: light-only variables such as --crowdin-gray-012 stayed
active with their light values. Nothing bridged reads them today, but the
simulation should be exactly the host's dark map. The light selector now
excludes .dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andrii-bodnar
andrii-bodnar merged commit 4116802 into main Oct 14, 2026
1 check passed
@andrii-bodnar
andrii-bodnar deleted the feat/canonical-tokens-from-hosts branch October 14, 2026 09:11
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.

3 participants