UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

42 lines (41 loc) 1.92 kB
import { CSSProperties } from 'glamor'; import { CssPropertyStyle } from '../style.interface'; export interface ConverterType { id: string; } /** * A converter is a class that can convert a value from one type to another */ export default class Converter { id: string; constructor(props: ConverterType); /** * Converts CssPropertyStyle to raw Css in Js here it will be equivalent to * one line (one property) in a css style sheet * It takes into account StyleToken references * for instance, if values contain string references such as 'theme.colors.primary' * it will not be converted into the actual color value, if user makes * keepReferenceValue = true, it will still be 'theme.colors.primary' * @param value CssPropertyStyle * @returns CSSProperties */ static cssPropertyStyleToCssProperty: (value: CssPropertyStyle, keepReferenceValue?: boolean) => CSSProperties; /** * Converts CssPropertyStyle[] to raw Css in Js here it will be equivalent to * multiple lines (multiple properties) in a css style sheet * It takes into account StyleToken references * for instance, if values contain string references such as 'theme.colors.primary' * it will not be converted into the actual color value, if user makes * keepReferenceValue = true, it will still be 'theme.colors.primary' * @param value CssPropertyStyle[] * @param keepReferenceValue @optional if true, it will keep the reference value * @returns CSSProperties */ static toCssObjectFromCssPropertyStyleList: (value: CssPropertyStyle[], keepReferenceValue?: boolean) => CSSProperties; /** * Converts raw Css in Js to CssPropertyStyle[] * @param value a raw css in js object to CssPropertyStyle * @returns CssPropertyStyle */ static cssPropertyToCssPropertyStyle: (value: CSSProperties) => CssPropertyStyle[]; }