Skip to content

refactor(styles): replace bracket escapes with design tokens - #214

Merged
JakeGinnivan merged 3 commits into
mainfrom
jakeginnivan/replace-bracket-escapes-with-tokens
Oct 26, 2026
Merged

JakeGinnivan merged 3 commits into
mainfrom
jakeginnivan/replace-bracket-escapes-with-tokens

Conversation

@JakeGinnivan

Copy link
Copy Markdown
Contributor

Summary

Bracket escapes (w="[180px]", outline="[2px solid ...]") skip the token system, so a downstream fork's theme can't reach them. This replaces 185 of the 207 in core/website with design tokens.

 panda.config.ts
   tokens
+    colors   tier.{platinum,gold,silver,bronze}.{bg,fg}   # fixed, not themed
+    zIndex   raised
+    borders  focus, focus-chrome, focus-admin, focus-on-dark, transparent, tab-indicator
+    shadows  admin-card, current-row (+ theme shadows)
+    sizes    page-max-w, px, and exact steps 22.5 … 200
+  utilities.extend
+    top/right/bottom/left/insetStart/insetEnd: half (50%), full (100%)
  • Public pages stay pixel-identical. Where a value fell between steps on the 4px grid, I added the exact step (sizes.27.5 = 110px) instead of rounding. Admin pages round to the nearest existing token.
  • Skip link now uses Panda's srOnly instead of a hand-written hidden box.
  • The 22 escapes left have no token form: calc(), anchor(), max(), em and ch units, dvh/vh fractions, and brightness(). One is on the header logo line, which feat(blog): migrate every Medium post onto the site and retire blog.dddperth.com #209 also edits.
  • Removes hero/circle-date.tsx, which nothing imported.

Evidence

  • Before: 207 bracket escapes in core/website/app + panda.config.ts.
    After: 22.
  • Typecheck is clean, ESLint has 0 errors, vitest passes 874/874 (after rebasing onto 0d48e2f), and react-router build succeeds.
  • pnpm vr passed 81/81 against the existing baselines on the first two commits, with no baselines regenerated.
  • Not run: pnpm vr on the last commit (srOnly + insets), because Docker was down. I checked the generated CSS instead: it contains top: 50%, inset-inline-start: 50%, top: 100%, the srOnly clip rule, and clip: auto on focus.

Merge Danger

Door: two-way

Pure style refactor; revert restores it.

Blast Radius: layout

On public pages, a token resolving to the wrong value would change the layout, which the VR gate catches. Admin pages aren't in the VR suite, so the ±2px rounding there is visually unverified. Forks get new token names and can theme them. The VR suite takes no focused screenshots, so check the skip link by pressing Tab on any page. #209 will conflict in hero-panel.tsx and mdx-image.tsx.

Bracketed values bypass Panda's token system, so a downstream fork's theme
can't reach them. Colours, borders, focus outlines and shadows now go through
tokens that reference theme colours (borders.focus, focus-chrome,
focus-admin, focus-on-dark, shadows.current-row, colors.tier.*), and px sizes
use the size scale. Values with no token equivalent (calc, anchor(), %, em,
vh) stay bracketed, and properties with no token category take plain CSS.

circle-date.tsx had no importers and is removed rather than converted.
…teps

Rounding to the nearest preset size moved the home, sponsors and agenda
baselines (sponsor cards 120px -> 128px, hero art up to 28px taller). The
size scale now carries the 4px-grid steps those pages were laid out at
(sizes.30 = 7.5rem = 120px, and so on), so they stay tokens without moving.
pnpm vr: 81/81 against the existing baselines.
The skip link's hand-written visually-hidden box becomes Panda's srOnly
utility, with clip reset on focus. Inset utilities gain half (50%) and
full (100%), replacing the last [50%] and [100%] escapes. spacing.px is
dropped now that nothing uses it.
@JakeGinnivan
JakeGinnivan merged commit b93055a into main Oct 26, 2026
3 checks passed
@JakeGinnivan
JakeGinnivan deleted the jakeginnivan/replace-bracket-escapes-with-tokens branch October 26, 2026 01:34
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