import { Interpolation as SCInterpolation } from 'styled-components'; import { Enterprise as EnterpriseVariables } from './enterprise'; import { Prisma as PrismaVariables } from './prisma'; type ColorScheme = 'light' | 'dark'; type Density = 'comfortable' | 'compact'; interface ThemeSettingsBase { colorScheme: ColorScheme; density: Density; isPrisma: boolean; isEnterprise: boolean; isComfortable: boolean; isCompact: boolean; isDark: boolean; isLight: boolean; } interface ThemeSettings extends ThemeSettingsBase { family: T extends Enterprise ? 'enterprise' : 'prisma'; } type Enterprise = EnterpriseVariables & ThemeSettingsBase & { family: 'enterprise'; isEnterprise: true; }; type Prisma = PrismaVariables & ThemeSettingsBase & { family: 'prisma'; isPrisma: true; }; type CustomizeTheme = { bivarianceHack(theme: T): T; }['bivarianceHack']; type CustomizerSetting = { customizer?: CustomizeTheme; }; type ThemedProps = { theme: { splunkThemeV1: ThemeSettings; }; }; type OptionalThemedProps = { theme?: { splunkThemeV1?: Partial> & CustomizerSetting; }; }; type AnyTheme = Enterprise | Prisma; type VariableName = keyof T; type VariableNameExclusiveEnterprise = Exclude, VariableName>; type VariableNameExclusivePrisma = Exclude, VariableName>; type Variable> = T[V]; type VariableInterpolation> = (props: OptionalThemedProps) => Variable; type UnsafeVariableInterpolation> = (props: OptionalThemedProps) => Variable | undefined; type Variables = { [V in VariableName]: VariableInterpolation; }; type VariablesExclusiveEnterprise = { [V in VariableNameExclusiveEnterprise]: UnsafeVariableInterpolation; }; type VariablesExclusivePrisma = { [V in VariableNameExclusivePrisma]: UnsafeVariableInterpolation; }; type AllVariables = { [V in VariableName]: VariableInterpolation; } & VariablesExclusiveEnterprise & VariablesExclusivePrisma; type Interpolation = (props: OptionalThemedProps & A) => InterpolationResult; type InterpolationResult = Interpolation | SCInterpolation & A> | string | number | null; type Tree = { enterprise?: TreeOrInterpolationResult; prisma?: TreeOrInterpolationResult; light?: TreeOrInterpolationResult; dark?: TreeOrInterpolationResult; compact?: TreeOrInterpolationResult; comfortable?: TreeOrInterpolationResult; }; type TreeOrInterpolationResult = Tree | InterpolationResult; type ObjKeys = (o: T) => Extract[]; export { AllVariables, AnyTheme, ColorScheme, CustomizerSetting, CustomizeTheme, Density, Enterprise, Interpolation, InterpolationResult, ObjKeys, OptionalThemedProps, Prisma, ThemedProps, ThemeSettings, Tree, TreeOrInterpolationResult, Variable, VariableInterpolation, VariableName, Variables, };