Repository navigation
web: adopt @goauthentik/theme tokens in the app styles - #22523
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22523 +/- ##
=======================================
Coverage 92.12% 92.12%
=======================================
Files 1177 1177
Lines 76842 76842
Branches 4121 4121
=======================================
+ Hits 70789 70791 +2
+ Misses 6000 5998 -2
Partials 53 53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
de3ad20 to
a9f947d
Compare
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
dewi-tik
left a comment
There was a problem hiding this comment.
Some minor suggestions otherwise LGTM for docs
a9f947d to
3f66dd4
Compare
b9785e0 to
7a6a799
Compare
b40740c to
4c5e76e
Compare
4c5e76e to
5f56177
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the web/ UI styling system to consume semantic design tokens from @goauthentik/theme, bridging those tokens onto existing PatternFly 4 variables to keep legacy CSS working while transitioning to the new token surface.
Changes:
- Import
@goauthentik/theme/index.cssinto the global theme variables entrypoint and add a PF4/legacy bridge stylesheet. - Apply the token bridge to Shadow DOM PatternFly base styles so adopted stylesheets track the global token→PF mapping.
- Migrate
ak-draweroff the removed--ak-v2-global--*globals to semantic tokens / component-local vars.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/styles/shadow/patternfly-base.css | Imports the token bridge into the Shadow DOM PatternFly base sheet. |
| web/src/styles/global/theme/variables.css | Imports the theme package CSS and the token bridge; removes the old --ak-v2-global--* block. |
| web/src/styles/global/theme/token-bridge.css | New bridge mapping semantic --ak-* tokens onto PF4 variables (and legacy --ak-accent). |
| web/src/elements/ak-drawer/ak-drawer.styles.ts | Switches drawer transforms/gap to semantic/private tokens. |
| web/src/elements/ak-drawer/ak-drawer.root.css | Replaces drawer’s dependencies on removed V2 globals with semantic tokens and local shadow vars. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6a13d80 to
6b00efe
Compare
6b00efe to
6d02270
Compare
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
1df37f8 to
15c753a
Compare
As an experiment, I have added three visual comparisons: - dashboard - event notification rules table - new prompt form … which provides a wide variety of controls that I can see and compare. As we move toward a more robust testing scheme *and* toward a more dispersed repository of artifacts (theme, elements, etc), I wanted a way to ensure that our upgrades to Patternfly and components didn’t break anything. I spent the day learning much more about Playwright and the snapshot tests. I don’t think @BeryJu’s concern for snapshot size isn’t wholly warranted. I’ve manually restricted the viewport to 1280x800, so each snapshot pair (“light” and “dark”) is about 220Kb. The current project repo is 795Mb in size; it would take 40 tests to increase the size of the repository by 1%. If we have half that many snapshot pairs by next year, I’ll be delighted. One challenge these tests present is that they should be run on a completely fresh database with no modifications; the dashboard and notifications page should reflect only the default status of an authentik instance when it comes up. The purpose of the snapshots isn’t to record the utility of the front-end; it’s to record and preserve the appearance of select elements in the page.
Generates the PatternFly 4 variables from the theme source instead of maintaining them by hand: moves the token modules from src/tokens/ to src/authentik/, and adds src/patternfly/ which emits the PF variables from those tokens. Known gaps: 17 colors remain unmapped and undefined; PatternFly dark mode is not emitted yet; the linter cannot compare PatternFly and authentik colors because the theme is authored in oklch.
Replace the committed page snapshots with a local visual comparison workflow. `pnpm run test:visual` screenshots every Storybook story in light and dark, and compares it against the merge-base with origin/main. Baselines are recorded on demand from a temporary worktree and cached in the git-ignored `.visual/` store, keyed by commit and platform, so no images are committed. A `pages` suite covers admin screens without generated data (login, a modal form, a wizard) on a running instance. Also break an import cycle between the notifications mixin and the drawer components, which broke the Page Navbar story.
Build packages/theme before the web build, Storybook, and watch, and import its generated CSS after the legacy variables in the theme layer so the generated PatternFly variables take precedence.
PatternFly names text colors by the color of the text itself: --pf-global--Color--dark-100 is dark text (#151515) for light surfaces, and --pf-global--Color--light-100 is light text for dark surfaces. The bridge mapped them the other way around, so components that set --pf-global--Color--100 from dark-100 (Page, Alert, Table, and others) rendered white text in light mode.
Add ink.pin-light.muted (#6a6e73) and map --pf-global--Color--dark-200 to it. PatternFly uses dark-200 for helper and placeholder text on light surfaces; it was mapped to full-strength ink.
Building web in the container only installs the web workspace, so it can't build packages/theme, which belongs to the root workspace and has its own dependencies. Commit the theme's generated CSS instead, the same way the API client is committed, and drop the theme build from the web build graph. `pnpm run build:theme` regenerates it; `pnpm run lint:theme` fails when the committed copy is out of date.
Node runs TypeScript directly now, so replace build.mjs, build-demo.mjs, lint-bridge.mjs, reference.css.js, and stylelint.config.mjs with .ts equivalents. JSDoc typedefs become interfaces. lint-bridge's array and CSS branches returned a bare string instead of a [kind, value] pair, and its ref branch passed an extra argument that shifted every parameter; both are fixed. Its output is unchanged for the current tokens. The generated header also names the current source directory; it still pointed at the old src/tokens/.
Replaces the drawer's --ak-v2-global--* references with the --ak-global--* tokens from the generated theme, and gives the drawer its own directional shadows and RTL inverse multiplier. The multiplier was previously read from --ak-v2-global--inverse--multiplier, which nothing defined. Co-Authored-By: Ken Sternberg <[email protected]>
The variable face covers 300-700, but the @font-face rules declared 400 500, so light text rendered at 400 and bold was capped at 500.
pnpm can place workspace links in a package's own node_modules (for example `@goauthentik/fonts` under packages/docusaurus-config), and a read-only bind mount of the package source over that directory hides them from the docs build. Copy docusaurus-config and fonts into the image before the root install instead, so those links survive.
Replaces docusaurus-config's hand-written @font-face rules and the modified RedHat copies in website/static/fonts with the faces from @goauthentik/fonts, so the docs and the web UI share one set of fonts.
Drops file headers, restated JSDoc, commented-out reference values, and exploratory notes added on this branch, keeping only comments that explain something surprising.
15c753a to
006bf1f
Compare
This PR composes several changes across multiple packages to improve theming, font management, and visual consistency in the web application.
packages/theme: generate the PatternFly 4--pf-global--*variables from authentik's tokens, and fix the mappings that didn't match PatternFly 4 (info, warning, danger, success, disabled,Color--300,primary-color--dark-100).packages/theme:lint:bridgecompares the generated variables against PatternFly 4's defaults and fails on mismatches; it runs as part ofcheck.web: load the generated theme stylesheet, which is committed so container builds don't need to buildpackages/themeweb:ak-drawermoves onto the generated tokens, fixing its RTL transforms and its dark shadows in nested dark sections.web: visual comparisons that screenshot the working tree against the base branch (pnpm run test:visual).packages/fonts: declare RedHatText's full 300–700 weight range.website: the docs load their fonts from@goauthentik/fontsinstead of the copies inwebsite/static/fonts, plus sidebar and menu typography adjustments.web: fix the user switcher overflow.Co-Authored-By: Ken Sternberg [email protected]