import { PropertiesFallback , Pseudos } from "csstype" ; export type Length = number ; export type Nil = null | undefined ; export type Primitive = number | string ; export type Key = string ; export type Keys = Key [ ] ; export interface NestedArray < T > extends Array < T | NestedArray < T > > { } export type Func = ( ... args : any [ ] ) => any ; export type Pred = ( ... args : any [ ] ) => boolean ; export type CSSProperties = PropertiesFallback < Primitive > ; export type CSSPseudos < P > = { [ K in Pseudos ] ? : CSSProperties & P ; } ; export type CSSStyleObject < P > = CSSProperties & CSSPseudos < P > & P ; export type ResponsivePropArray < T > = T [ ] ; export interface ResponsivePropObject < T > { [ key ] : T ; } export type ResponsiveProp < T > = ResponsivePropArray < T > | ResponsivePropObject < T > ; export type Prop < T > = T | ResponsiveProp < T > | Nil ; export interface AliasObject < T > { [ key ] : AliasObject < T > | T ; } export interface Alias < T = Primitive > { alias : Key ; value : AliasObject < T > | T ; } export type ThemeArrayValue < T > = Alias < T > | T ; export type ThemeArray < T = Primitive > = ThemeArrayValue < T > [ ] ; export interface ThemeObject < T = Primitive > { [ key ] : ThemeObject < T > | ThemeArray < T > | T ; } export type ThemeValue < T = Primitive > = ThemeArray < T > | ThemeObject < T > | Nil ; export type Breakpoints < T = Primitive > = ThemeArray < T > | Nil ; export interface Theme { [ key ] : ThemeValue ; breakpoints ? : Breakpoints ; animations ? : ThemeValue ; transitions ? : ThemeValue ; borders ? : ThemeValue ; borderRadii ? : ThemeValue ; borderStyles ? : ThemeValue ; borderWidths ? : ThemeValue ; colors ? : ThemeValue ; opacities ? : ThemeValue ; sizes ? : ThemeValue ; widths ? : ThemeValue ; minWidths ? : ThemeValue ; maxWidths ? : ThemeValue ; heights ? : ThemeValue ; minHeights ? : ThemeValue ; maxHeights ? : ThemeValue ; zIndices ? : ThemeValue ; outlines ? : ThemeValue ; outlineOffsets ? : ThemeValue ; outlineStyles ? : ThemeValue ; outlineWidths ? : ThemeValue ; boxShadows ? : ThemeValue ; textShadows ? : ThemeValue ; spaces ? : ThemeValue ; fontSizes ? : ThemeValue ; fontFamilies ? : ThemeValue ; fontWeights ? : ThemeValue ; lineHeights ? : ThemeValue ; letterSpacings ? : ThemeValue ; textStyles ? : ThemeValue ; colorStyles ? : ThemeValue ; buttonStyles ? : ThemeValue ; globalStyles ? : ThemeValue ; components ? : ThemeValue ; } export interface ThemeProps { theme ? : Theme ; } export interface Props extends ThemeProps { [ key ] : any ; } export type StyleValue = number | string | string [ ] | Nil ; export interface Style { [ key ] : StyleValue ; } export interface StyleObject < S extends Style > { [ key ] : StyleObject < S > | StyleValue ; } export type StyleArray < S extends Style > = StyleObject < S > [ ] ; export type StyleOptionsKeys = "propsKeys" | "styleKeys" | "themeKeys" ; export interface StyleOptions { propsKeys : Keys ; styleKeys ? : Keys | null ; themeKeys ? : Keys ; transform ? : ValueTransformFunction ; renderers ? : AnyRenderFunction [ ] ; defaults ? : ThemeValue ; } export interface ComposeOptions { renderers : AnyRenderFunction [ ] ; name : string ; } export interface ComposedRenderOptions { propsKeys : Keys ; styleKeys : Keys ; themeKeys : Keys ; renderers : AnyRenderFunction [ ] ; } export type FilterInitial < P > = ( props : P ) => Partial < P > ; export type FilterReducer < P > = ( acc : Partial < P > , key : keyof P , props : P ) => Partial < P > ; export interface FilterOptions < P > { propsKeys ? : Keys ; renderers ? : AnyRenderFunction [ ] ; initial : FilterInitial < P > ; reducer : FilterReducer < P > ; } export type OmitOptions < P > = Omit < FilterOptions < P > , "initial" | "reducer" > ; export type PickOptions < P > = Omit < FilterOptions < P > , "initial" | "reducer" > ; export type VariantOptions = Omit < StyleOptions , "styleKeys" > ; export type InterpolateOptions = ComposeOptions ; export type FilterFunction < P extends ThemeProps > = ( value : P ) => Partial < P > ; export type OmitFunction < P > = FilterFunction < P > ; export type PickFunction < P > = FilterFunction < P > ; export type ValueTransformFunction = ( value : any ) => any ; export interface StyleTransformFunction < P extends ThemeProps , S extends Style > { ( style ? , theme ? ) : StyleObject < S > | null ; renderer : ComposedRenderFunction < P , S > ; options : InterpolateOptions ; } export type RenderFunctionType = "style" | "compose" | "variant" ; export interface RenderFunction < P extends ThemeProps , S extends Style > { ( props ) : StyleArray < S > | null ; type : RenderFunctionType ; options : StyleOptions ; transformer ? : StyleTransformFunction < P , S > ; } export interface ComposedRenderFunction < P extends ThemeProps , S extends Style > extends RenderFunction < P , S > { options : ComposedRenderOptions ; } export type AnyRenderFunction = RenderFunction < any , any > ;