mirror of
https://github.com/goauthentik/authentik
synced 2026-05-14 19:06:39 +02:00
* web/core/templates: make it possible for interfaces to designate alternative stylesheets
## What
Moves the stylesheet invocation in `theme.html` to `skeleton.html`, give it a block and a block name so that pages using `skeleton.html` can override or extend it as needed.
## Why
The biggest wall we’re hitting right now is the lack of flexibility at the very top of the CSS. We simply use the same CSS file for *too much*, when really we should be thinking in terms of leaner, more targeted top-level CSS for some things, and more rich and expressive CSS when it’s necessary.
The style sheet was being loaded unconditionally in `theme.html`; it’s not in a conditional statement or overridable where it was; `skeleton` just loads it blindly. This change lets `theme.html` be what it is meant to be, an isolated container for the JavaScript logic for discerning the color mode, while enabling CSS developers to elide the stylesheet, provide alternative stylesheets, or (using `{{ block.super}}`) amend or extend the default stylesheet.
* Isolated flows to have their own CSS barrel file.
* Missed a spot.
100 lines
2.8 KiB
JavaScript
100 lines
2.8 KiB
JavaScript
/**
|
|
* @file Paths used by the web package.
|
|
*
|
|
* @runtime node
|
|
*/
|
|
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { DistDirectoryName } from "#paths";
|
|
|
|
const relativeDirname = dirname(fileURLToPath(import.meta.url));
|
|
|
|
//#region Base paths
|
|
|
|
/**
|
|
* @typedef {'@goauthentik/web'} WebPackageIdentifier
|
|
*/
|
|
|
|
/**
|
|
* The root of the web package.
|
|
*
|
|
* @runtime node
|
|
*/
|
|
export const PackageRoot = /** @type {WebPackageIdentifier} */ (resolve(relativeDirname, ".."));
|
|
|
|
/**
|
|
* Path to the web package's distribution directory.
|
|
*
|
|
* This is where the built files are located after running the build process.
|
|
*
|
|
* @runtime node
|
|
*/
|
|
export const DistDirectory = /** @type {`${WebPackageIdentifier}/${DistDirectoryName}`} */ (
|
|
resolve(PackageRoot, DistDirectoryName)
|
|
);
|
|
|
|
//#endregion
|
|
|
|
//#region Entry points
|
|
|
|
/**
|
|
* @typedef {{ in: string, out: string }} EntryPointTarget
|
|
*
|
|
* ESBuild entrypoint target.
|
|
* Matches the type defined in the ESBuild context.
|
|
*/
|
|
|
|
/**
|
|
* Entry points available for building.
|
|
*
|
|
* @satisfies {Record<string, EntryPointTarget>}
|
|
*
|
|
* @runtime node
|
|
*/
|
|
export const EntryPoint = /** @type {const} */ ({
|
|
Admin: {
|
|
in: resolve(PackageRoot, "src", "admin", "AdminInterface", "index.entrypoint.ts"),
|
|
out: resolve(DistDirectory, "admin", "AdminInterface"),
|
|
},
|
|
User: {
|
|
in: resolve(PackageRoot, "src", "user", "index.entrypoint.ts"),
|
|
out: resolve(DistDirectory, "user", "UserInterface"),
|
|
},
|
|
Flow: {
|
|
in: resolve(PackageRoot, "src", "flow", "index.entrypoint.ts"),
|
|
out: resolve(DistDirectory, "flow", "FlowInterface"),
|
|
},
|
|
StandaloneAPI: {
|
|
in: resolve(PackageRoot, "src", "standalone", "api-browser/index.entrypoint.ts"),
|
|
out: resolve(DistDirectory, "standalone", "api-browser", "index"),
|
|
},
|
|
StandaloneLoading: {
|
|
in: resolve(PackageRoot, "src", "standalone", "loading/index.entrypoint.ts"),
|
|
out: resolve(DistDirectory, "standalone", "loading", "index"),
|
|
},
|
|
RAC: {
|
|
in: resolve(PackageRoot, "src", "rac", "index.entrypoint.ts"),
|
|
out: resolve(DistDirectory, "rac", "index"),
|
|
},
|
|
Polyfill: {
|
|
in: resolve(PackageRoot, "src", "polyfill", "index.entrypoint.ts"),
|
|
out: resolve(DistDirectory, "poly"),
|
|
},
|
|
InterfaceStyles: {
|
|
in: resolve(PackageRoot, "src", "styles", "authentik", "interface.global.css"),
|
|
out: resolve(DistDirectory, "styles", "interface"),
|
|
},
|
|
StaticStyles: {
|
|
in: resolve(PackageRoot, "src", "styles", "authentik", "static.global.css"),
|
|
out: resolve(DistDirectory, "styles", "static"),
|
|
},
|
|
FlowsStyles: {
|
|
in: resolve(PackageRoot, "src", "styles", "authentik", "flows.global.css"),
|
|
out: resolve(DistDirectory, "styles", "flow"),
|
|
},
|
|
});
|
|
|
|
//#endregion
|