Skip to content

Add /legacy/tokens.css CSS shim for design-system migration#36

Open
MaxGhenis wants to merge 1 commit into
mainfrom
feat/legacy-tokens-css
Open

Add /legacy/tokens.css CSS shim for design-system migration#36
MaxGhenis wants to merge 1 commit into
mainfrom
feat/legacy-tokens-css

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Summary

Ship a CSS-side companion to the existing JS @policyengine/ui-kit/legacy shim. Mirrors the --pe-color-* / --pe-font-* / --pe-space-* / --pe-radius-* :root block that @policyengine/design-system@0.3.0 shipped via dist/tokens.css, exposed under a new ./legacy/tokens.css subpath export.

Why

The JS-only legacy shim lets from '@policyengine/design-system'from '@policyengine/ui-kit/legacy' work mechanically, but consumers whose globals.css referenced var(--pe-color-primary-500) etc. silently broke after the migration — those custom properties had nowhere to come from once tokens.css stopped being imported.

I just hit this in working-Americans-tax-cut-act- (the live page rendered with bg-primary-500 resolving to nothing — white hero text on white background). The fix there was to inline the hex values directly in the @theme block. With this PR, the cleaner fix is a one-line import bump:

- @import "@policyengine/design-system/tokens.css";
+ @import "@policyengine/ui-kit/legacy/tokens.css";

Values

Bit-identical to design-system 0.3.0 dist/tokens.css (verified by diffing the tarball). Covers ~50 CSS variables: primary/gray/semantic/bg/text/border colors, font families/sizes/weights/line-heights, space scale, border radii.

Scope

  • src/legacy/tokens.css — new file, mirrors design-system 0.3.0 tokens
  • package.json: new ./legacy/tokens.css subpath export pointing at the file; src/legacy added to files; version bumped 0.10.1 → 0.11.0
  • changelog.d/feat-legacy-tokens-css.added.md — towncrier fragment

New code should keep using @policyengine/ui-kit/theme.css (shadcn-style tokens — --primary, --background, etc.) — /legacy is the back-compat surface only.

Verification

  • bun install — clean
  • bun run build — clean (no regression in bundle sizes)
  • bun run test — 302/302 pass
  • Manual: imported into a scratch Tailwind v4 app, confirmed bg-[var(--pe-color-primary-500)] renders teal again

The JS-only @policyengine/ui-kit/legacy shim makes the import-path rename
from @policyengine/design-system mechanical for code, but consumers'
globals.css that referenced \`var(--pe-color-*)\` aliases shipped by
design-system's tokens.css broke after the migration — those CSS
variables had nowhere to come from.

Ship src/legacy/tokens.css with the same :root { --pe-color-*, --pe-font-*,
--pe-space-*, --pe-radius-* } block design-system 0.3.0 shipped, expose
it via the new ./legacy/tokens.css subpath export, and add src/legacy to
the published files. Consumers migrating now flip one import line
instead of inlining hex values per repo:

  - @import "@policyengine/design-system/tokens.css";
  + @import "@policyengine/ui-kit/legacy/tokens.css";

Mirrors design-system 0.3.0 values bit-identical (verified by diffing
against the tarball). New code should keep using the canonical
@policyengine/ui-kit/theme.css (shadcn-style tokens); /legacy is the
back-compat surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

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

Project Deployment Actions Updated (UTC)
policyengine-ui-kit Ready Ready Preview, Comment May 12, 2026 2:50pm

Request Review

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