@twstyled/theme
Version:
Runtime theming support for twstyled -- the full-featured Tailwind CSS + CSS in JS Compiler
32 lines (31 loc) • 1.16 kB
TypeScript
import { Theme } from './types';
/**
* Allows for nested scales with shorthand values
* @example
* {
* colors: {
* primary: { __default: '#00f', light: '#33f' }
* }
* }
* css({ color: 'primary' }); // { color: '#00f' }
* css({ color: 'primary.light' }) // { color: '#33f' }
*/
export declare const THEME_TW_DEFAULT_KEY = "__default";
/**
* Extracts value under path from a deeply nested object.
* Used for Themes, variants and Theme UI style objects.
* Given a path to object with `__default` key, returns the value under that key.
*
* @param obj a theme, variant or style object
* @param path path separated with dots (`.`)
* @param fallback default value returned if get(obj, path) is not found
*/
export declare function get(obj: object, path: string | number | undefined, fallback?: unknown, p?: number, undef?: unknown): any;
declare const merge: {
(a: Theme, b: Theme): Theme;
all: typeof mergeAll;
};
declare function mergeAll<A, B>(a: A, b: B): A & B;
declare function mergeAll<A, B, C>(a: A, b: B, c: C): A & B & C;
declare function mergeAll<A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
export { merge };