
* tests/e2e: add test for authentication flow in compatibility mode Signed-off-by: Jens Langhammer <jens@goauthentik.io> * web: Add prefix class to CSS for easier debugging of constructed stylesheets. - Use CSS variables for highlighter. * web: Fix issue where MDX components apply styles out of order. * web: Fix hover color. * web: Fix CSS module types. Clean up globals. * web: Fix issues surrounding availability of shadow root in compatibility mode. * web: Fix typo. * web: Partial fixes for storybook dark theme. * web: Fix overflow. * web: Fix issues surrounding competing interfaces attempting to apply styles. * fix padding in ak-alert in. markdown Signed-off-by: Jens Langhammer <jens@goauthentik.io> * web: Minimize use of sub-module exports. --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Teffen Ellis <teffen@sister.software>
70 lines
1.8 KiB
JavaScript
70 lines
1.8 KiB
JavaScript
/**
|
|
* @file Storybook configuration.
|
|
* @import { StorybookConfig } from "@storybook/web-components-vite";
|
|
* @import { InlineConfig, Plugin } from "vite";
|
|
*/
|
|
import { cwd } from "process";
|
|
import postcssLit from "rollup-plugin-postcss-lit";
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
const NODE_ENV = process.env.NODE_ENV || "development";
|
|
|
|
const CSSImportPattern = /import [\w\$]+ from .+\.(css)/g;
|
|
const JavaScriptFilePattern = /\.m?(js|ts|tsx)$/;
|
|
|
|
/**
|
|
* @satisfies {Plugin<never>}
|
|
*/
|
|
const inlineCSSPlugin = {
|
|
name: "inline-css-plugin",
|
|
transform: (source, id) => {
|
|
if (!JavaScriptFilePattern.test(id)) return;
|
|
|
|
const code = source.replace(CSSImportPattern, (match) => {
|
|
return `${match}?inline`;
|
|
});
|
|
|
|
return {
|
|
code,
|
|
};
|
|
},
|
|
};
|
|
|
|
/**
|
|
* @satisfies {StorybookConfig}
|
|
*/
|
|
const config = {
|
|
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
addons: [
|
|
"@storybook/addon-controls",
|
|
"@storybook/addon-links",
|
|
"@storybook/addon-essentials",
|
|
"storybook-addon-mock",
|
|
],
|
|
framework: {
|
|
name: "@storybook/web-components-vite",
|
|
options: {},
|
|
},
|
|
docs: {
|
|
autodocs: "tag",
|
|
},
|
|
viteFinal({ plugins = [], ...config }) {
|
|
/**
|
|
* @satisfies {InlineConfig}
|
|
*/
|
|
const mergedConfig = {
|
|
...config,
|
|
define: {
|
|
"process.env.NODE_ENV": JSON.stringify(NODE_ENV),
|
|
"process.env.CWD": JSON.stringify(cwd()),
|
|
"process.env.AK_API_BASE_PATH": JSON.stringify(process.env.AK_API_BASE_PATH || ""),
|
|
},
|
|
plugins: [inlineCSSPlugin, ...plugins, postcssLit(), tsconfigPaths()],
|
|
};
|
|
|
|
return mergedConfig;
|
|
},
|
|
};
|
|
|
|
export default config;
|