1 | import { CSSRules, Directive, Token } from 'twind';
|
2 | export * from 'twind/css';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | declare type StrictMorphVariant<T> = T extends number ? `${T}` | T : T extends 'true' ? true | T : T extends 'false' ? false | T : T;
|
12 | declare type MorphVariant<T> = T extends number ? `${T}` | T : T extends 'true' ? boolean | T : T extends 'false' ? boolean | T : T extends `${number}` ? number | T : T;
|
13 | declare type StyleToken = string | CSSRules | Directive<CSSRules>;
|
14 | declare type VariantsOf<T> = T extends Style<infer Variants> ? {
|
15 | [key in keyof Variants]: MorphVariant<keyof Variants[key]>;
|
16 | } : never;
|
17 | declare type DefaultVariants<Variants> = {
|
18 | [key in keyof Variants]?: StrictMorphVariant<keyof Variants[key]> | (Record<string, StrictMorphVariant<keyof Variants[key]>> & {
|
19 | initial?: StrictMorphVariant<keyof Variants[key]>;
|
20 | });
|
21 | };
|
22 | declare type VariantsProps<Variants> = {
|
23 | [key in keyof Variants]?: MorphVariant<keyof Variants[key]> | (Record<string, MorphVariant<keyof Variants[key]>> & {
|
24 | initial?: MorphVariant<keyof Variants[key]>;
|
25 | });
|
26 | };
|
27 | declare type VariantMatchers<Variants> = {
|
28 | [key in keyof Variants]?: StrictMorphVariant<keyof Variants[key]>;
|
29 | };
|
30 | interface StyleConfig<Variants, BaseVariants = {}> {
|
31 | base?: StyleToken;
|
32 | variants?: Variants & {
|
33 | [variant in keyof BaseVariants]?: {
|
34 | [key in keyof BaseVariants[variant]]?: StyleToken;
|
35 | };
|
36 | };
|
37 | defaults?: DefaultVariants<Variants & BaseVariants>;
|
38 | matches?: (VariantMatchers<Variants & BaseVariants> & {
|
39 | use: StyleToken;
|
40 | })[];
|
41 | }
|
42 | interface StyleFunction {
|
43 | <Variants>(config?: StyleConfig<Variants>): Style<Variants> & string;
|
44 | <Variants, BaseVariants>(base: Style<BaseVariants>, config?: StyleConfig<Variants, BaseVariants>): Style<BaseVariants & Variants> & string;
|
45 | }
|
46 | interface BaseStyleProps {
|
47 | tw?: Token;
|
48 | css?: CSSRules;
|
49 | class?: string;
|
50 | className?: string;
|
51 | }
|
52 | declare type StyleProps<Variants> = VariantsProps<Variants> & BaseStyleProps;
|
53 | interface Style<Variants> {
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | (props?: StyleProps<Variants>): Directive<CSSRules>;
|
69 | |
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 | toString(): string;
|
87 | |
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | readonly className: string;
|
101 | |
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | readonly selector: string;
|
119 | }
|
120 | declare const style: StyleFunction;
|
121 |
|
122 | export { BaseStyleProps, DefaultVariants, MorphVariant, StrictMorphVariant, Style, StyleConfig, StyleFunction, StyleProps, StyleToken, VariantMatchers, VariantsOf, VariantsProps, style };
|
123 |
|