import { BoxShadowColorSchemes , ColorColorSchemes , ColorSchemeSection , FontSizeValues , OrbitTheme } from "./orbitTheme" ; import { isNil } from "../../../shared" ; export class ThemeAccessor { private theme ; constructor ( theme ) { this . theme = theme ; } private getColorSchemeValue < C , L , D > ( values , key , colorScheme ) { let section = values [ colorScheme ] ; if ( ! isNil ( section ) ) { return section [ key ] ; } section = values . common ; if ( ! isNil ( section ) ) { return section [ key ] ; } } getName ( ) { return ! isNil ( this . theme ) ? this . theme . name : "" ; } getSpace ( index ) { return ! isNil ( this . theme ) ? this . theme . space [ index - 1 ] : "" ; } getSizing ( index ) { return ! isNil ( this . theme ) ? this . theme . sizing [ index - 1 ] : "" ; } getFontSize ( key ) { return ! isNil ( this . theme ) ? this . theme . fontSizes [ key ] : "" ; } getLineHeight ( index ) { return ! isNil ( this . theme ) ? this . theme . lineHeights [ index - 1 ] : 0 ; } getBorderRadius ( index ) { return ! isNil ( this . theme ) ? this . theme . borderRadii [ index - 1 ] : "" ; } getBoxShadow ( key , colorScheme = "light" ) { return ! isNil ( this . theme ) ? this . getColorSchemeValue ( this . theme . boxShadows , key , colorScheme ) : "" ; } getColor ( key , colorScheme = "light" ) { return ! isNil ( this . theme ) ? this . getColorSchemeValue ( this . theme . colors , key , colorScheme ) : "" ; } }