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