-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.d.ts
90 lines (79 loc) · 2.23 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { DetailedReactHTMLElement } from "react";
import "react-native";
import { ImageStyle, TextStyle, ViewStyle } from "react-native";
export type StyleProperty =
| ViewStyle
| TextStyle
| ImageStyle
| { [k: string]: ViewStyle | TextStyle | ImageStyle };
export type NamedStyles<T> = {
[P in keyof T]: StyleProperty;
};
type BaseStyle<UserStyles> = {
[Element in keyof UserStyles]: {
[Property in keyof UserStyles[Element] as Property extends
| `@media${string}`
| `:${string}`
? never
: Property]: UserStyles[Element][Property];
};
};
type ResponsiveStyle<UserStyles> = {
[Element in keyof UserStyles]: {
[P in {
[Property in keyof UserStyles[Element]]: Property extends
| `@media${string}`
| `:${string}`
? {
[QueryProperty in keyof UserStyles[Element][Property]]: [
QueryProperty,
UserStyles[Element][Property][QueryProperty]
];
}[keyof UserStyles[Element][Property]]
: never;
}[keyof UserStyles[Element]] as P[0]]?: P[1];
};
};
type ComputedStyle<UserStyles> = BaseStyle<UserStyles> &
ResponsiveStyle<UserStyles>;
export declare function create<
UserStyles extends NamedStyles<UserStyles> | NamedStyles<any>
>(
styles: UserStyles | NamedStyles<UserStyles>
): {
fullStyles: UserStyles;
ids: Record<keyof UserStyles, string>;
styles: ComputedStyle<UserStyles>;
};
export declare function process<
UserStyles extends NamedStyles<UserStyles> | NamedStyles<any>
>(
styles: UserStyles | NamedStyles<UserStyles>
): {
styles: UserStyles;
fullStyles: UserStyles;
ids: string;
};
export function flush(): DetailedReactHTMLElement<
{
id: string;
key: string;
dangerouslySetInnerHTML: {
__html: string;
};
},
HTMLElement
>;
// Prop dataSet not available in typescript: https://github.com/necolas/react-native-web/issues/1668
// Workaround fix implemented from: https://github.com/necolas/react-native-web/issues/1684#issuecomment-712297248
declare module "react-native" {
interface ViewProps {
dataSet?: Record<string, string>;
}
interface TextProps {
dataSet?: Record<string, string>;
}
interface ImageProps {
dataSet?: Record<string, string>;
}
}