forked from emotion-js/emotion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
92 lines (77 loc) · 2.43 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
91
92
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 2.3
import * as CSS from 'csstype';
export type CSSBaseObject = CSS.PropertiesFallback<number | string>;
export type CSSPseudoObject = { [K in CSS.Pseudos]?: CSSObject };
export interface CSSOthersObject {
[propertiesName: string]: Interpolation;
}
export interface CSSObject extends CSSBaseObject, CSSPseudoObject, CSSOthersObject {}
export interface ArrayInterpolation extends Array<Interpolation> {}
export interface ClassInterpolation extends Function {
__emotion_real: any;
__emotion_styles: Array<Interpolation>;
__emotion_base: ClassInterpolation;
__emotion_target: string;
__emotion_forwardProp: undefined | null | ((arg: string) => boolean);
}
export type Interpolation =
| undefined | null | boolean | string | number
| TemplateStringsArray
| CSSObject
| ArrayInterpolation
| ClassInterpolation
;
export interface ArrayClassNameArg extends Array<ClassNameArg> {}
export type ClassNameArg =
| undefined | null | boolean | string
| { [key: string]: boolean }
| ArrayClassNameArg
;
export interface StyleSheet {
inject(): void;
speedy(bool: boolean): void;
insert(rule: string, sourceMap?: string): void;
flush(): void;
}
export interface EmotionCache {
registered: {
[key: string]: string;
};
inserted: {
[key: string]: string;
};
nonce?: string;
key: string;
}
export interface Emotion {
flush(): void;
hydrate(ids: Array<string>): void;
cx(...classNames: Array<ClassNameArg>): string;
merge(className: string, sourceMap?: string): string;
getRegisteredStyles(registeredStyles: Array<string>, classNames: string): string;
css(...args: Array<Interpolation>): string;
injectGlobal(...args: Array<Interpolation>): void;
keyframes(...args: Array<Interpolation>): string;
sheet: StyleSheet;
caches: EmotionCache;
}
export interface EmotionBaseContext {
__SECRET_EMOTION__?: Emotion;
}
export interface EmotionContext extends EmotionBaseContext {
[key: string]: any;
}
export type StylisPlugins =
| null
| ((...args: Array<any>) => any)
| Array<(...args: Array<any>) => any>
;
export interface EmotionOption {
nonce?: string;
stylisPlugins?: StylisPlugins;
prefix?: boolean | ((key: string, value: string, context: 1 | 2 | 3) => boolean);
key?: string;
container?: HTMLElement;
}
export default function createEmotion(context: EmotionContext, options?: EmotionOption): Emotion;