UNPKG

1.87 kBTypeScriptView Raw
1import type { PropertiesFallback } from "csstype";
2import type { Conditions } from "./generated/conditions.gen";
3import type { CssVarProperties, SystemProperties } from "./generated/system.gen";
4import type { AnySelector, Selectors } from "./selectors";
5type String = string & {};
6type Number = number & {};
7export type CssProperty = keyof PropertiesFallback;
8export interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties {
9 initialLetterAlign?: String;
10}
11export interface CssKeyframes {
12 [name: string]: {
13 [time: string]: CssProperties;
14 };
15}
16export type KeyframeIdentityFn = (keyframes: CssKeyframes) => CssKeyframes;
17export type Condition = keyof Conditions;
18export type ConditionalValue<V> = V | Array<V | null> | {
19 [K in keyof Conditions]?: ConditionalValue<V>;
20};
21export type Nested<P> = P & {
22 [K in Selectors]?: Nested<P>;
23} & {
24 [K in AnySelector]?: Nested<P>;
25} & {
26 [K in keyof Conditions]?: Nested<P>;
27};
28export type MinimalNested<P> = {
29 [K in keyof Conditions]?: Nested<P>;
30};
31export type NestedCssProperties = Nested<CssProperties>;
32export type SystemStyleObject = Nested<SystemProperties & CssVarProperties>;
33export type SystemStyleIdentityFn = (style: SystemStyleObject) => SystemStyleObject;
34export interface GlobalStyleObject {
35 [selector: string]: SystemStyleObject;
36}
37export type GlobalStyleIdentityFn = (global: GlobalStyleObject) => GlobalStyleObject;
38type FilterStyleObject<P extends string> = {
39 [K in P]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown;
40};
41export type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>;
42interface WithCss {
43 css?: SystemStyleObject;
44}
45type StyleProps = SystemProperties & MinimalNested<SystemStyleObject>;
46export type JsxStyleProps = StyleProps & WithCss;
47export {};