@mochabug/adapt-web
Version:
Browser client library for Adapt automation platform
43 lines (42 loc) • 1.63 kB
TypeScript
/**
* Theming system for AdaptAutomation.
*
* Two approaches:
* 1. CSS-only: set `--mb-adapt-*` variables on any ancestor element
* 2. JS theme prop: pass an `AdaptTheme` object for semantic token-based theming
*
* For advanced effects (animations, pseudo-elements, @keyframes), write standard
* CSS targeting the component's class names (e.g. `.mb-adapt .mb-group-header`).
* There is no Shadow DOM — all classes are in the light DOM.
*/
export interface AdaptTheme {
/** 'light' | 'dark' — controls dark mode class + shadow/border defaults */
mode?: "light" | "dark";
/** Primary/accent color — derives separator, drop target, status icon colors */
primary?: string;
/** Main background */
background?: string;
/** Surface color (panels, tabs, cards) */
surface?: string;
/** Primary text color */
text?: string;
/** Secondary/muted text */
textSecondary?: string;
/** Border/separator color */
border?: string;
/** Font family */
font?: string;
/**
* Direct CSS variable overrides — for complete customization.
* Keys are variable names WITHOUT the `--mb-adapt-` prefix.
* These override everything, including derived values from tokens above.
*
* @example { 'fork-tab-bg': '#1a1a2e', 'cap-spinner-color': '#ff0000' }
*/
vars?: Record<string, string>;
}
/**
* Resolve a theme object into a map of `--mb-adapt-*` CSS custom properties.
* Semantic tokens are expanded to specific variables; `vars` overrides win last.
*/
export declare function resolveTheme(theme: AdaptTheme): Record<string, string>;