forked from openstyles/stylus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.types.d.ts
144 lines (128 loc) · 2.75 KB
/
.types.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
declare interface StyleObj {
enabled: boolean;
id: number;
name: string;
sections: StyleSection[];
_id: string;
_rev: number;
/* optional */
author?: string;
customName?: string;
description?: string;
exclusions?: string[];
inclusions?: string[];
installDate?: number;
installationUrl?: string;
md5Url?: string;
originalDigest?: string;
originalMd5?: string;
preferScheme?: 'none' | 'dark' | 'light';
sourceCode?: string;
updatable?: boolean;
updateDate?: number;
updateUrl?: string;
url?: string;
usercssData?: UsercssData;
_usw?: USWorldData;
}
declare interface StyleMapData {
style: StyleObj;
preview?: StyleObj;
appliesTo: Set<string>;
}
declare interface StyleSection {
code: string[];
urls?: string[];
urlPrefixes?: string[];
domains?: string[];
regexps?: string[];
}
declare interface CachedInjectedStyles {
maybeMatch: Set<number>;
sections: InjectedStyles;
}
declare interface Injection {
cfg: InjectionConfig;
sections: InjectedStyle[];
}
declare interface InjectedStyles {
[styleId: string]: InjectedStyle
}
declare interface InjectedStyle {
id: number,
code: string[],
name: string,
}
declare interface InjectionConfig {
name?: boolean;
top?: string | false;
off?: boolean;
order?: InjectionOrder;
}
declare interface InjectionOrder {
main: InjectionOrderGroup;
prio: InjectionOrderGroup;
}
declare interface InjectionOrderGroup {
[id: string]: number;
}
declare interface UsercssData {
name: string;
namespace: string;
version: string;
/* optional fields */
author?: string;
description?: string;
homepageURL?: string;
license?: string;
preprocessor?: 'default' | 'uso' | 'less' | 'stylus';
supportURL?: string;
updateURL?: string;
vars?: {[name: string]: UsercssVar};
}
declare type UsercssVar =
UsercssVarBase |
UsercssVarRange |
UsercssVarSelect;
declare type UsercssVarValue = string | number | boolean | null;
declare interface UsercssVarBase {
type: string;
label: string;
name: string;
value: UsercssVarValue;
default: UsercssVarValue;
}
declare interface UsercssVarRange extends UsercssVarBase {
value: number | null;
min?: number;
max?: number;
step?: number;
units?: string;
}
declare interface UsercssVarSelect extends UsercssVarBase {
default: string | null;
value: string | null;
options: {
name: string,
label: string,
value: UsercssVarValue,
isDefault?: boolean
}[];
}
declare interface USWorldData {
created_at: number;
description: string;
display_name: string;
homepage: string;
id: number;
license: string;
mirror_url: string;
name: string;
notes: string;
original: string;
preview_url: string;
token: string;
updated_at: number;
user_id: number;
username: string;
}