@fluentui/styles
Version:
A set of styling utilities for CSS-in-JS.
129 lines (128 loc) • 5.68 kB
TypeScript
import * as CSS from 'csstype';
export declare type DebugData = {
componentName: string;
siteVariables: Object[];
componentVariables: Object[];
componentStyles: Record<string, Object[]>;
};
export declare type Extendable<T, V = any> = T & {
[key: string]: V;
};
export declare type ObjectOrFunc<TResult, TArg = {}> = ((arg: TArg) => TResult) | TResult;
export declare type AnimationKeyFrame = Record<'from' | 'to' | string, CSSCustom>;
export interface AnimationName<P = Record<string, any>> {
keyframe?: AnimationKeyFrame | ((params: P) => AnimationKeyFrame);
params?: P;
}
declare type CSSProperties = Omit<CSS.Properties<number | string>, 'animationName'> & {
speak?: CSS.Globals | 'none' | 'normal' | 'spell-out';
WebkitFontSmoothing?: CSS.Globals | 'auto' | 'none' | 'antialiased' | 'subpixel-antialiased';
MozOsxFontSmoothing?: CSS.Globals | 'auto' | 'grayscale';
'-webkit-appearance'?: never;
'-webkit-box-orient'?: never;
'-webkit-font-smoothing'?: never;
'-webkit-line-clamp'?: never;
'-webkit-text-fill-color'?: never;
};
declare type CSSObject = CSSProperties & CSSPseudos & {
animationName?: AnimationName<any> | AnimationKeyFrame | string | 'none';
};
declare type CSSCustom = {
[prop: string]: number | string | ICSSInJSStyle;
};
declare type CSSPseudos = {
[K in CSS.Pseudos]?: CSSObject & {
content?: string;
};
};
export declare type ICSSInJSStyle = CSSObject | CSSCustom;
export interface ThemeAnimation<KP = {}> {
keyframe: ((kp: KP) => object) | object | string;
delay?: string;
direction?: string;
duration?: string;
fillMode?: string;
iterationCount?: string;
playState?: string;
timingFunction?: string;
keyframeParams?: KP;
}
export interface FontFaceProps {
fontStretch?: string;
fontStyle?: string;
fontVariant?: string;
fontWeight?: number;
localAlias?: string | string[];
unicodeRange?: string;
}
export interface FontFace {
name: string;
paths: string[];
props: FontFaceProps;
}
export declare type FontFaces = FontFace[];
export interface SiteVariablesInput extends Record<string, any> {
}
export interface SiteVariablesPrepared extends SiteVariablesInput {
fontSizes: Record<string, string>;
}
export declare type ComponentVariablesObject = any;
export declare type ComponentVariablesInput = ComponentVariablesObject | ComponentVariablesPrepared;
export declare type ComponentVariablesPrepared = (siteVariables?: SiteVariablesPrepared) => ComponentVariablesObject;
export declare type ComponentSlotStyle<TProps = {}, TVars = {}> = ComponentSlotStyleFunction<TProps, TVars> | ICSSInJSStyle;
export declare type PropsWithVarsAndStyles = Extendable<{
variables?: ComponentVariablesInput;
styles?: ComponentSlotStyle;
}>;
export interface ComponentSlotStylesInput<TProps = {}, TVars = {}> extends Record<string, ComponentSlotStyle<TProps, TVars>> {
}
export interface ComponentSlotStylesPrepared<TProps = {}, TVars = {}> extends Record<string, ComponentSlotStyleFunction<TProps, TVars>> {
}
export interface ComponentSlotStylesResolved extends Record<string, ICSSInJSStyle> {
}
export interface ComponentStyleFunctionParam<TProps extends PropsWithVarsAndStyles = PropsWithVarsAndStyles, TVars extends ComponentVariablesObject = ComponentVariablesObject> {
props: TProps;
variables: TVars;
theme: ThemePrepared;
rtl: boolean;
disableAnimations: boolean;
}
export declare type ComponentSlotStyleFunction<TProps = {}, TVars = {}> = (styleParam: ComponentStyleFunctionParam<TProps, TVars>) => ICSSInJSStyle;
export interface ComponentSlotStylesPrepared<TProps = {}, TVars = {}> extends Record<string, ComponentSlotStyleFunction<TProps, TVars>> {
}
export declare type StaticStyleObject = Record<string, ICSSInJSStyle>;
export declare type StaticStyleRenderable = string | StaticStyleObject;
export declare type StaticStyleFunction = (siteVariables?: SiteVariablesPrepared) => StaticStyleObject;
export declare type StaticStyle = StaticStyleRenderable | StaticStyleFunction;
export declare type StaticStyles = StaticStyle[];
export declare type ThemeComponentVariablesInput<ThemeStylesProps = any> = {
[K in keyof ThemeStylesProps]?: ComponentVariablesInput;
} & Record<string, any>;
export declare type ThemeComponentVariablesPrepared<ThemeStylesProps = any> = {
[K in keyof ThemeStylesProps]?: ComponentVariablesPrepared;
} & Record<string, any>;
export declare type ThemeComponentStylesInput<ThemeStylesProps = any> = {
[K in keyof ThemeStylesProps]?: ComponentSlotStylesInput<ThemeStylesProps[K]>;
} & Record<string, ComponentSlotStylesInput | undefined>;
export declare type ThemeComponentStylesPrepared<ThemeStylesProps = any> = {
[K in keyof ThemeStylesProps]?: ComponentSlotStylesPrepared<ThemeStylesProps[K]>;
} & Record<string, ComponentSlotStylesPrepared | undefined>;
export interface ThemeInput<ThemeStylesProps extends Record<string, any> = any> {
siteVariables?: SiteVariablesInput;
componentVariables?: ThemeComponentVariablesInput<ThemeStylesProps>;
componentStyles?: ThemeComponentStylesInput<ThemeStylesProps>;
fontFaces?: FontFaces;
staticStyles?: StaticStyles;
animations?: {
[key: string]: ThemeAnimation;
};
}
export interface ThemePrepared<ThemeStylesProps extends Record<string, any> = any> {
siteVariables: SiteVariablesPrepared;
componentVariables: ThemeComponentVariablesPrepared<ThemeStylesProps>;
componentStyles: ThemeComponentStylesPrepared<ThemeStylesProps>;
fontFaces: FontFaces;
staticStyles: StaticStyles;
animations: Record<string, ThemeAnimation>;
}
export {};