@theemo/build
Version:
Theme Builder
104 lines (103 loc) • 2.57 kB
TypeScript
import { CustomAtRules, TransformOptions } from "lightningcss";
import { ColorContrast, ColorContrastFeature, ColorSchemeFeature, CustomFeature, Motion, MotionFeature } from "@theemo/theme";
//#region src/features.d.ts
interface CustomBuildFeature extends Omit<CustomFeature, "options"> {
/**
* Use options to point at a CSS file for that option
*
* @example
*
* ```json
* {
* "options": {
* "option-a": "build/option-a.css",
* "option-b": "build/option-b.css"
* }
* }
* ```
*/
options: Record<string, string>;
}
type ColorSchemeBuildFeature = ColorSchemeFeature;
interface ColorContrastBuildFeature extends Omit<ColorContrastFeature, "options"> {
/**
* Use options to point at a CSS file for that option
*
* @example
*
* ```json
* {
* "options": {
* "less": "build/contrast-less.css",
* "more": "build/contrast-more.css"
* }
* }
* ```
*/
options: Record<ColorContrast, string>;
}
interface MotionBuildFeature extends Omit<MotionFeature, "options"> {
/**
* Use options to point at a CSS file for that option
*
* @example
*
* ```json
* {
* "options": {
* "no-preference": "build/motion.css",
* "reduce": "build/motion-reduce.css"
* }
* }
* ```
*/
options: Record<Motion, string>;
}
type BuildFeature = ColorSchemeBuildFeature | ColorContrastBuildFeature | MotionBuildFeature | CustomBuildFeature;
//#endregion
//#region src/config.d.ts
/**
* Config for building a theme
*/
interface BuildConfig {
/**
* Specify the output directory
*
* @default `dist`
*/
outDir?: string;
/**
* The files that will be concatenated into the output file
*/
files?: string[];
/**
* Instructions for how to build the features
*/
features?: BuildFeature[];
/**
* Wrap the outputted file in a CSS `@layer`
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@layer
*/
layerName?: string;
/**
* Lightning CSS is used for postprocess. You can pass options to lightning
* css here or turn it off entirely.
*
* @default `true`
*/
lightningcss?: boolean | Omit<TransformOptions<CustomAtRules>, "code" | "filename">;
}
// types for optional keys
// by https://gist.github.com/eddiemoore/7873191f366675e520e802a9fb2531d8
//#endregion
//#region src/build.d.ts
/**
* Build a theme, which can be managed by theemo
*
* @param config The configuration for the theme and its behavior
*/
declare function build(config: BuildConfig): void;
//#endregion
export { BuildConfig, build };
//# sourceMappingURL=index.d.ts.map