Repository navigation
packages/theme: add the @goauthentik/theme design-system package - #23341
Conversation
✅ Deploy Preview for authentik-storybook 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #23341 +/- ##
==========================================
+ Coverage 90.86% 91.50% +0.64%
==========================================
Files 1150 1150
Lines 72619 72619
Branches 3875 3875
==========================================
+ Hits 65982 66449 +467
+ Misses 6602 6135 -467
Partials 35 35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
This should also be added to CODEOWNERS and maybe to .github/workflows/packages-npm-publish.yml |
7417cda to
105b0b1
Compare
There was a problem hiding this comment.
Pull request overview
Adds new workspace packages to support authentik’s emerging design system: a Styleframe-powered token package (@goauthentik/theme) and an assets-only fonts package (@goauthentik/fonts), plus the minimal web build wiring needed to consume workspace TypeScript sources and correctly emit/embed cross-workspace assets.
Changes:
- Introduces
packages/themewith token modules, Styleframe configuration, and build scripts to emit CSS + DTCG JSON. - Introduces
packages/fontsto own RedHat variable font assets and a canonicalfaces.css, and switches web global CSS to import it. - Updates the web esbuild configuration to set
outbaseto the monorepo root and opt into thebundlerconditional export resolution, plus workspace/link dependency wiring.
Reviewed changes
Copilot reviewed 34 out of 44 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/styles/interface.global.css | Switches global font-face import to @goauthentik/fonts. |
| web/src/styles/flows.global.css | Switches flow UI font-face import to @goauthentik/fonts. |
| web/scripts/build-web.mjs | Sets outbase to monorepo root and adds bundler condition for conditional exports. |
| web/pnpm-workspace.yaml | Excludes packages/theme from web workspace importers to avoid Dependabot lockfile artifacts. |
| web/pnpm-lock.yaml | Adds linked @goauthentik/fonts and @goauthentik/theme to web importer. |
| web/package.json | Adds link dependencies on @goauthentik/fonts and @goauthentik/theme; removes #fonts import mapping. |
| pnpm-workspace.yaml | Registers packages/fonts and packages/theme in the root workspace. |
| pnpm-lock.yaml | Adds dependency graph entries for the new packages and their toolchain deps. |
| packages/theme/tsconfig.json | TypeScript configuration for the theme package build. |
| packages/theme/styleframe.config.ts | Styleframe CLI config entrypoint exporting the configured singleton instance. |
| packages/theme/src/tokens/z-index.ts | Adds z-index token scale. |
| packages/theme/src/tokens/utopia-typography.ts | Adds responsive typography scale generation (utopia-core). |
| packages/theme/src/tokens/utopia-spacing.ts | Adds responsive spacing scale generation (utopia-core). |
| packages/theme/src/tokens/typography.ts | Adds font family/size/weight/line-height tokens. |
| packages/theme/src/tokens/spacing.ts | Adds fixed spacing token scale. |
| packages/theme/src/tokens/shape.ts | Adds radius and border-width tokens. |
| packages/theme/src/tokens/shadow.ts | Adds shadow tokens + dark theme overrides. |
| packages/theme/src/tokens/motion.ts | Adds duration/easing tokens + reduced-motion variants. |
| packages/theme/src/tokens/index.ts | Re-exports all public token modules. |
| packages/theme/src/tokens/fonts.ts | Adds concrete font stack tokens referencing @goauthentik/fonts-provided faces. |
| packages/theme/src/tokens/color.ts | Adds semantic color tokens + dark theme overrides with OKLCH transform. |
| packages/theme/src/tokens/color-libs.ts | Adds OKLCH conversion/transform helpers for color token emission. |
| packages/theme/src/shared.ts | Defines the singleton Styleframe instance and shared helpers. |
| packages/theme/src/node.ts | Node-only build helper to transpile tokens to CSS and optionally write files. |
| packages/theme/src/index.ts | Browser-safe public entrypoint exporting primitives + tokens. |
| packages/theme/package.json | Declares @goauthentik/theme exports (including conditional exports) and build/lint scripts. |
| packages/theme/LICENSE.txt | Adds MIT license for the theme package. |
| packages/theme/eslint.css.mjs | Adds CSS linting configuration for generated CSS output. |
| packages/theme/eslint.config.mjs | Adds JS/TS lint configuration for the theme package sources. |
| packages/theme/build.mjs | Generates dist/index.css plus per-category CSS slices from Styleframe output. |
| packages/theme/.prettierignore | Prettier ignore rules for the theme package (dist/out/etc.). |
| packages/theme/.gitignore | Gitignore for theme-local artifacts. |
| packages/fonts/RedHatMonoVF.woff2 | Adds font asset (woff2). |
| packages/fonts/RedHatMonoVF-Italic.woff2 | Adds font asset (woff2). |
| packages/fonts/package.json | Declares @goauthentik/fonts as an assets-only package exporting faces.css. |
| packages/fonts/OFL.txt | Adds SIL OFL text for the bundled RedHat fonts. |
| packages/fonts/faces.css | Adds canonical @font-face rules for RedHat variable fonts. |
| packages/fonts/.prettierignore | Prettier ignore rules for the fonts package. |
| locale/en/dictionaries/software-terms.txt | Adds spellcheck allow-words for new terminology used in the PR. |
| CODEOWNERS | Assigns CODEOWNERS for packages/fonts to the frontend team. |
Files not reviewed (2)
- pnpm-lock.yaml: Generated file
- web/pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Browser-safe: no Node-only dependencies. Build helpers that touch the | ||
| * filesystem live in `./lib/node.js` (exposed via the `./build` subpath). |
There was a problem hiding this comment.
Fixed — the comment now points at ./node.ts via the ./build subpath.
105b0b1 to
364d335
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 44 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- pnpm-lock.yaml: Generated file
- web/pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (6)
packages/theme/src/tokens/utopia-typography.ts:28
- The error message here refers to “utopia spacing”, but this module is generating the typography scale via
calculateTypeScale.
packages/theme/src/index.ts:9 - This comment references
./lib/node.js, but the Node-only helper entry issrc/node.tsand is exposed via the./build(and./node) export paths.
* filesystem live in `./lib/node.js` (exposed via the `./build` subpath).
packages/theme/styleframe.config.ts:8
- The comment mentions importing
./lib/tokens/index.js, but this file imports./src/tokens/index.js. Updating the comment avoids confusion for future maintainers.
packages/theme/src/shared.ts:22 - Project docs/conventions indicate the product name should be written as lowercase
authentik. This comment uses “Authentik-specific”.
* Authentik-specific styleframe configuration.
packages/theme/src/tokens/utopia-spacing.ts:24
calculateSpaceScale(...).sizesis accessed before checking for an undefined return value. IfcalculateSpaceScaleever returnsundefined, this will throw a TypeError before the intended error message is raised.
packages/fonts/package.json:5- This package includes Red Hat font binaries under the SIL Open Font License (see
OFL.txt), but thelicensefield is set to MIT. The package metadata should reflect the license of the distributed artifacts.
"license": "MIT",
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-22d53361469af09e445fb321d24861e438b1f1c8
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-22d53361469af09e445fb321d24861e438b1f1c8Afterwards, run the upgrade commands from the latest release notes. |
364d335 to
aac7050
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 31 changed files in this pull request and generated no new comments.
Files not reviewed (2)
- pnpm-lock.yaml: Generated file
- web/pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (4)
packages/theme/package.json:32
package.jsondefines anexportsmap but does not export the package root ("."). With conditional exports present,import "@goauthentik/theme"will fail because only subpaths like@goauthentik/theme/browserare exported.
"exports": {
"./package.json": "./package.json",
"./types": "./src/index.ts",
"./node": {
"types": "./src/node.ts",
packages/theme/styleframe.config.ts:10
- The comment says importing
./lib/tokens/index.jstriggers registration side-effects, but the file actually imports./src/tokens/index.js. This can confuse future maintainers and reviewers when chasing where tokens are registered.
* Importing `./lib/tokens/index.js` triggers the side-effects that register
* every token against the shared instance; we re-export `instance` as the
* default export so the CLI's `dtcg export` and `build` commands operate on
packages/theme/src/shared.ts:23
- Product name should be lowercase “authentik” in prose/comments (project convention). This comment uses “Authentik-specific”.
/**
* Authentik-specific styleframe configuration.
*
packages/theme/src/tokens/utopia-typography.ts:29
- This error message is in the typography token module but says “utopia spacing”, which is misleading when debugging failures.
if (utopiaSizes === undefined) {
throw new Error("Failed to parse utopiaScale configuration for utopia spacing.");
}
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
599ae4d to
d4f353b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 43 out of 60 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- pnpm-lock.yaml: Generated file
- web/pnpm-lock.yaml: Generated file
Suppressed comments (5)
packages/theme/src/shared.ts:13
- This doc comment says the name function rewrites
color.primarytoak-color-primary, but the actual implementation prefixesak-global--and uses--separators (e.g.ak-global--color--primary). This mismatch makes it harder to reason about the emitted variable names when consuming the package.
packages/theme/src/tokens/z-index.ts:6 - The comment references an emitted variable name of
--ak-z-index-md, but this package emits--ak-global--z-index--md(seeauthentikStyleframeOptions.variables.nameinsrc/shared.ts).
packages/theme/src/tokens/typography.ts:7 - The doc comment references
--ak-font-family-*variables, but the actual emitted variables (and the aliases below) use the--ak-global--font-family--*names. Updating the comment avoids pointing consumers at variable names that don’t exist.
web/docs/arch/2026-06-18-How-CSS-Is-Made-And-Next-Steps.md:38 - This import-order doc is now out of date: the PatternFly icon sheets no longer include
@font-facedeclarations (they’ve moved to@goauthentik/fonts/icons.cssand are imported by the entrypoints). The list item describingpatternfly-*-icons.cssshould reflect that it now vendors only icon classes.
packages/theme/demo/demo.css:5 - The CSS custom property defined here is
--demo-page-max-width, but the rest of the stylesheet usesvar(--demo-page-max)(e.g. lines 73, 105, 163, 634). That means thosemax-widthdeclarations resolve to an unset variable and won’t apply as intended.
:root {
--demo-page-max-width: 78rem;
--demo-col-min: 14rem;
--demo-hairline: color-mix(in oklab, var(--ak-global--color--border) 60%, transparent);
kensternberg-authentik
left a comment
There was a problem hiding this comment.
Good for now. Something to build off of.
20c550e to
aa2665c
Compare
aa2665c to
d1dcd6e
Compare
Dependency ReviewThe following issues were found:
|
Extract the bundled web fonts out of web/ into a dedicated @goauthentik/fonts workspace package: the RedHat variable faces, the PatternFly pficon icon face, and the FontAwesome Free solid face, each with its upstream license recorded under licenses/. web/ now pulls the faces and icons from the package's @goauthentik/fonts/faces.css and @goauthentik/fonts/icons.css entry points instead of the old #fonts/* import and the inlined pficon.scss vendor sheet. Anchor esbuild's [dir] at the monorepo root via outbase so assets pulled from the out-of-web package no longer resolve to a "_.._" segment, which Go's //go:embed silently drops from the embedded outpost build. Co-Authored-By: Ken Sternberg <[email protected]>
Add @goauthentik/theme, which defines authentik's design tokens (color, typography, fonts, spacing, shape, shadow, motion, z-index) in TypeScript and builds them into CSS via styleframe. Token names carry a distinct separator per category so the token type is recoverable from the name alone. That is worth the verbosity: it keeps the DX legible and leaves room for automatic theme management and future tooling built on top of the token set. Co-Authored-By: Ken Sternberg <[email protected]>
Add a self-contained demo page, built by build-demo.mjs, that renders every theme token — colors, typography, spacing, shape, shadow, motion — so the design system can be eyeballed in isolation while it evolves. Co-Authored-By: Ken Sternberg <[email protected]>
a44063f to
22d5336
Compare
) * packages/fonts: add @goauthentik/fonts package Extract the bundled web fonts out of web/ into a dedicated @goauthentik/fonts workspace package: the RedHat variable faces, the PatternFly pficon icon face, and the FontAwesome Free solid face, each with its upstream license recorded under licenses/. web/ now pulls the faces and icons from the package's @goauthentik/fonts/faces.css and @goauthentik/fonts/icons.css entry points instead of the old #fonts/* import and the inlined pficon.scss vendor sheet. Anchor esbuild's [dir] at the monorepo root via outbase so assets pulled from the out-of-web package no longer resolve to a "_.._" segment, which Go's //go:embed silently drops from the embedded outpost build. Co-Authored-By: Ken Sternberg <[email protected]> * packages/theme: add @goauthentik/theme design-system package Add @goauthentik/theme, which defines authentik's design tokens (color, typography, fonts, spacing, shape, shadow, motion, z-index) in TypeScript and builds them into CSS via styleframe. Token names carry a distinct separator per category so the token type is recoverable from the name alone. That is worth the verbosity: it keeps the DX legible and leaves room for automatic theme management and future tooling built on top of the token set. Co-Authored-By: Ken Sternberg <[email protected]> * web/theme: add a demo page for the theme tokens Add a self-contained demo page, built by build-demo.mjs, that renders every theme token — colors, typography, spacing, shape, shadow, motion — so the design system can be eyeballed in isolation while it evolves. Co-Authored-By: Ken Sternberg <[email protected]> * Heal lockfile. * Fix spelling. * Fix grouping. --------- Co-authored-by: Ken Sternberg <[email protected]>
) * packages/fonts: add @goauthentik/fonts package Extract the bundled web fonts out of web/ into a dedicated @goauthentik/fonts workspace package: the RedHat variable faces, the PatternFly pficon icon face, and the FontAwesome Free solid face, each with its upstream license recorded under licenses/. web/ now pulls the faces and icons from the package's @goauthentik/fonts/faces.css and @goauthentik/fonts/icons.css entry points instead of the old #fonts/* import and the inlined pficon.scss vendor sheet. Anchor esbuild's [dir] at the monorepo root via outbase so assets pulled from the out-of-web package no longer resolve to a "_.._" segment, which Go's //go:embed silently drops from the embedded outpost build. Co-Authored-By: Ken Sternberg <[email protected]> * packages/theme: add @goauthentik/theme design-system package Add @goauthentik/theme, which defines authentik's design tokens (color, typography, fonts, spacing, shape, shadow, motion, z-index) in TypeScript and builds them into CSS via styleframe. Token names carry a distinct separator per category so the token type is recoverable from the name alone. That is worth the verbosity: it keeps the DX legible and leaves room for automatic theme management and future tooling built on top of the token set. Co-Authored-By: Ken Sternberg <[email protected]> * web/theme: add a demo page for the theme tokens Add a self-contained demo page, built by build-demo.mjs, that renders every theme token — colors, typography, spacing, shape, shadow, motion — so the design system can be eyeballed in isolation while it evolves. Co-Authored-By: Ken Sternberg <[email protected]> * Heal lockfile. * Fix spelling. * Fix grouping. --------- Co-authored-by: Ken Sternberg <[email protected]>
* packages/theme: add the @goauthentik/theme design-system package (#23341) * packages/fonts: add @goauthentik/fonts package Extract the bundled web fonts out of web/ into a dedicated @goauthentik/fonts workspace package: the RedHat variable faces, the PatternFly pficon icon face, and the FontAwesome Free solid face, each with its upstream license recorded under licenses/. web/ now pulls the faces and icons from the package's @goauthentik/fonts/faces.css and @goauthentik/fonts/icons.css entry points instead of the old #fonts/* import and the inlined pficon.scss vendor sheet. Anchor esbuild's [dir] at the monorepo root via outbase so assets pulled from the out-of-web package no longer resolve to a "_.._" segment, which Go's //go:embed silently drops from the embedded outpost build. Co-Authored-By: Ken Sternberg <[email protected]> * packages/theme: add @goauthentik/theme design-system package Add @goauthentik/theme, which defines authentik's design tokens (color, typography, fonts, spacing, shape, shadow, motion, z-index) in TypeScript and builds them into CSS via styleframe. Token names carry a distinct separator per category so the token type is recoverable from the name alone. That is worth the verbosity: it keeps the DX legible and leaves room for automatic theme management and future tooling built on top of the token set. Co-Authored-By: Ken Sternberg <[email protected]> * web/theme: add a demo page for the theme tokens Add a self-contained demo page, built by build-demo.mjs, that renders every theme token — colors, typography, spacing, shape, shadow, motion — so the design system can be eyeballed in isolation while it evolves. Co-Authored-By: Ken Sternberg <[email protected]> * Heal lockfile. * Fix spelling. * Fix grouping. --------- Co-authored-by: Ken Sternberg <[email protected]> * web/elements/ak-mdx: drop React + runtime MDX eval, use unified pipeline Replace `@mdx-js/mdx`'s `evaluate`/`run` (which depends on `'unsafe-eval'` in the page CSP) with a pure `unified`/remark/rehype pipeline. URL-mode content now arrives from the build-time `mdx-plugin` as pre-rendered HTML and is stamped through a Trusted Types passthrough policy (`CompiledMarkdownTrustPolicy`) so admin-side custom elements like `<ak-alert>` and `<ak-md-a>` survive. Content-mode (admin-supplied markdown) is compiled in-browser via `compileRuntimeMarkdown` and routed through the existing `BrandedHTMLPolicy` (DOMPurify). `<ak-md-a>` replaces the React `MDXAnchor`/`MDXWrapper` pair: a tiny Lit custom element with `display: contents` that intercepts in-doc fragment clicks for shadow-root scrolling. The remark plugins gain `caution` and `tip` admonition types and promote `:::name[Title]` directive labels to `<strong>`. `one-dark.css` learns `:host` so syntax-highlighted code blocks inherit the palette inside `<ak-mdx>`'s shadow tree. Removes `@mdx-js/mdx`, `react`, `react-dom`, `rehype-mermaid`, and `remark-mdx-frontmatter`. Adds `unified`, `remark-parse`, `remark-rehype`, and `mdast-util-to-string`. Co-Authored-By: Agent <[email protected]> * web/bundler/mdx-plugin: pre-render markdown to HTML at build time Compile each `.md` / `.mdx` file through a build-time `unified` pipeline (remark-parse, GFM, frontmatter, directives, custom admonition/headings/ lists transforms; rehype-rehype, anchor wrapping, syntax highlighting, mermaid extraction) and emit a JSON envelope of `{ content: HTML, frontmatter, publicPath, publicDirectory }`. The on-load result still ships via the `file` loader so the runtime side keeps its existing fetch path. The compiled HTML uses `<ak-md-a>` and `<ak-alert>` custom elements so `<ak-mdx>` can stamp it directly into shadow DOM with no client-side JavaScript evaluation. Plugin is split across four sibling files (`node.js`, `compile.js`, `remark.js`, `rehype.js`) so each concern lives in its own module. The title/wrapper HTML is built as a hast tree and serialized through `hast-util-to-html` rather than string-concatenated, dropping the hand-rolled `escapeHTML` helper and unifying escape semantics with the rest of the document. Co-Authored-By: Agent <[email protected]> * web/test: e2e ak-mdx pipeline via OAuth2 provider docs The OAuth2 provider docs page exercises the full pipeline in one place: frontmatter title, multiple H2 slugs, `:::caution`/`:::info` admonitions (with and without titles), relative-doc links, external links, and an embedded mermaid sequence diagram. Tests boot the admin UI, provision a fresh OAuth2 provider, navigate to its view page, and assert against the compiled DOM inside `<ak-mdx>`'s shadow root. Co-Authored-By: Agent <[email protected]> * web/elements/ak-mdx: sanitize replacer output, note pipeline drift Address PR review feedback on the URL-mode trust boundary. `<ak-mdx>`'s `replacers` hook runs over pre-rendered build-time HTML before it is stamped into the DOM, and consumers (e.g. `ProxyProviderViewPage`) splice admin-controlled values such as `provider.externalHost` into it. The old React pipeline ran replacers on raw markdown that was then compiled, so those values were HTML-escaped on serialization; the new URL mode passed the post-replacer HTML straight through, dropping that guarantee. Replace the passthrough `CompiledMarkdownTrustPolicy` with `CompiledMarkdownSanitizePolicy`: a DOMPurify policy that whitelists the custom elements (`<ak-alert>`, `<ak-md-a>`, `<ak-diagram>`) and the `part`/`level` attributes our pipeline emits, and strips anything else a replacer could inject. Also add a reciprocal drift note to the runtime `markdown.ts` pointing at `bundler/mdx-plugin/`, mirroring the existing note on the bundler side. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * Fix anchor slugification. * Spellcheck. --------- Co-authored-by: Ken Sternberg <[email protected]> Co-authored-by: Agent <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

Adds
@goauthentik/theme, the Styleframe-based TypeScript design-system package: typed token modules compiled withtsgo, hex tooklch()color output withref()build-time name checks, and a build that emits a self-containedindex.cssplus per-category files and DTCG JSON.Foundation for the design-language work. No visual change on its own until the app consumes the tokens (that lands separately in #22523).
The fonts that were originally part of this branch are split out into #24461.
How it resolves
The package is a member of the repo-root pnpm workspace, and
webdepends on it withlink:../packages/theme— followingpackages/georather than symlinking it underweb/packages/.Its TypeScript entry points resolve to
src/under thetypes,nodeandbundlerconditions, withdefaultandpublishConfig.exportspointing at the builtdist/.web's ESBuild build now opts into thebundlercondition, so bundling the tokens needs no prior build of the package. No package in web's dependency tree declares that condition, so resolution is otherwise unchanged.The generated CSS has no source form and does still require a build. Nothing in
webimports it yet, so that wiring belongs with #22523, which adds the@importand can build the CSS in the bundler via the package's ownbuild()helper.Tokens and fonts are decoupled
The font-family tokens name the RedHat faces but this package ships no font bytes. The
@font-facerules live in@goauthentik/fonts(#24461), so a consumer that does not load them falls through to the platform stacks.Co-Authored-By: Ken Sternberg [email protected]