import { CSSInterpolation as CSSI, CSSObject as CSSO } from '@emotion/serialize'; import { ColorProp as ColorPropType } from '@stage-ui/system/props/color'; import { OverridesProp as OverridesPropType } from '@stage-ui/system/props/overrides'; import { SpaceProp as SpacePropType } from '@stage-ui/system/props/space'; import { BreakpointProp as BreakpointPropType } from '@stage-ui/system/props/breakpoint'; import ColorType from 'color'; import CSS from 'csstype'; import { AllProps as AllPropsType } from './props/types'; import { ResolvedStyleProps } from './props'; declare global { namespace Stage { type Sizes = 'xs' | 's' | 'm' | 'l' | 'xl'; type CSSInterpolation = CSSI; type CSSObject = CSSO; type ColorDefinition = string | [number, number, number, number?]; type Color = ColorType; type ColorShades = { 50: C; 100: C; 200: C; 300: C; 400: C; 500: C; 600: C; 700: C; 800: C; 900: C; }; type ColorAccentsShades = { A100: C; A200: C; A400: C; A700: C; }; type ColorMain = { primary: C; secondary: C; surface: C; background: C; border: C; text: C; onPrimary: C; onSecondary: C; onSurface: C; onBackground: C; error: C; warning: C; success: C; info: C; black: C; white: C; /** @deprecated this field */ surfaceVariant: C; /** @deprecated this field */ backgroundVariant: C; /** @deprecated this field */ light: C; /** @deprecated this field */ lightest: C; /** @deprecated this field */ hard: C; /** @deprecated this field */ hardest: C; }; type ColorCustom = { /** @deprecated this field */ palette: Record; }; type ColorPalette = { gray: ColorShades; yellow: ColorShades & ColorAccentsShades; orange: ColorShades & ColorAccentsShades; red: ColorShades; rose: ColorShades; pink: ColorShades; green: ColorShades; lightGreen: ColorShades & ColorAccentsShades; lime: ColorAccentsShades; teal: ColorShades; cyan: ColorShades & ColorAccentsShades; lightBlue: ColorShades & ColorAccentsShades; blue: ColorShades & ColorAccentsShades; indigo: ColorShades; purple: ColorShades; }; type ColorNames = LiteralUnion, string>; type Colors = ColorMain & ColorPalette & (Definition extends true ? Partial> : ColorCustom); interface ThemeMain { name: string; color: Colors; breakpoints: string[]; radius: Record; spacing: Record; } interface ThemeAssets { global?: Stage.CSSInterpolation; border: { width: string; style: CSS.Properties['borderStyle']; color: string; }; shadow: Record; innerShadow: Record; focus: CSSObject; field: Record; typography: { header: Record; text: Record; paragraph: Record; article: { header: Record; paragraph: CSSObject; }; }; } interface ThemeOverrides { } type ThemeComponentOverrides = ((props: Props, styleProps: ResolvedStyleProps) => OverridesClassesDefinition) | OverridesClassesDefinition; interface Theme extends ThemeMain { assets: ThemeAssets; overrides: ThemeOverrides; replace: (theme: ReplaceTheme) => Theme; } interface ThemeDefinition { main: ThemeMain; assets: ((main: ThemeMain) => ThemeAssets) | ThemeAssets; overrides?: ((main: ThemeMain, assets: ThemeAssets) => Stage.ThemeOverrides) | Stage.ThemeOverrides; } interface ReplaceTheme { main?: DeepPartial; assets?: ((main: Stage.ThemeMain) => DeepPartial) | DeepPartial; overrides?: ((main: Stage.ThemeMain, assets: Stage.ThemeAssets) => Stage.ThemeOverrides) | Stage.ThemeOverrides; } type ClassStateDefinition = Record | void; type ClassesSchemaDefinition = Record; type CreateClasses = (theme: Stage.Theme, props: Props, styleProps: ResolvedStyleProps) => Stage.ClassesDefinition; type OverridesClassesDefinition = Partial<{ [ClassName in keyof ClassesSchema]: ClassesSchema[ClassName] extends void ? Stage.CSSInterpolation : FunctionClassDefinition> | Stage.CSSInterpolation; }>; type ClassesDefinition = { [ClassName in keyof ClassesSchema]: ClassesSchema[ClassName] extends void ? Stage.CSSInterpolation : FunctionClassDefinition>; }; type FunctionClassDefinition> = (state: ClassState) => Stage.CSSInterpolation; type Classes = { [ClassName in keyof ClassesSchema]: ClassesSchema[ClassName] extends void ? Stage.CSSInterpolation : FunctionClass; }; type FunctionClass = (state: ClassSchema) => Stage.CSSInterpolation; type AllProps = AllPropsType; type ColorProp = ColorPropType; type OverridesProp = OverridesPropType; type SpaceProp = SpacePropType; type BreakpointProp = BreakpointPropType; type Primitive = null | undefined | string | number | boolean | symbol | bigint; type FilterStartingWith = Set extends `${Needle}${string}` ? Set : never; type DeepPartial = { [P in keyof T]?: T[P] extends Array ? Array> : T[P] extends ReadonlyArray ? ReadonlyArray> : DeepPartial; }; type LiteralUnion = LiteralType | (BaseType & Record); } } declare module 'csstype' { interface Properties { display?: 'block' | 'inline' | 'inline-block' | 'inline-table' | 'list-item' | 'none' | 'run-in' | 'table' | 'table-caption' | 'table-cell' | 'table-column-group' | 'table-column' | 'table-footer-group' | 'table-header-group' | 'table-row' | 'table-row-group' | 'flex' | 'grid'; overflow?: 'auto' | 'hidden' | 'scroll' | 'visible' | 'inherit'; } } export { default as Provider } from './components/Provider'; export { default as useTheme } from './hooks/useTheme'; export { default as useSystem } from './hooks/useSystem'; export { default as useBreakpoints } from './hooks/useBreakpoints'; export { default as useAppearance } from './hooks/useAppearance'; export { default as breakpointProp } from './props/breakpoint'; export { default as colorProp } from './props/color'; export { default as overridesProp } from './props/overrides'; export { default as sizeProp } from './props/size'; export { default as spaceProp } from './props/space'; export { light as lightTheme } from './themes'; export { dark as darkTheme } from './themes'; export { default as getCurrentBreakpoint } from './utils/getCurrentBreakpoint'; export { default as createID } from './utils/createID'; export { default as createTheme } from './utils/createTheme'; export { default as getFontSize } from './utils/getFontSize'; export { default as isBrowser } from './utils/isBrowser'; export { default as isFunction } from './utils/isFunction'; export { default as isObject } from './utils/isObject'; export { default as isRem } from './utils/isRem'; export { default as isWebKit } from './utils/isWebKit'; export { default as mergeObjects } from './utils/mergeObjects'; export { default as toFloat } from './utils/toFloat'; export { default as toPixel } from './utils/toPixel'; export { default as toPx } from './utils/toPx'; export { default as toRem } from './utils/toRem'; export { default as createGradient } from './utils/createGradient';