forked from darkreader/darkreader
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefinitions.d.ts
More file actions
265 lines (234 loc) · 6.21 KB
/
Copy pathdefinitions.d.ts
File metadata and controls
265 lines (234 loc) · 6.21 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
import type {ParsedColorSchemeConfig} from './utils/colorscheme-parser';
import type {FilterMode} from './generators/css-filter';
import type {DebugMessageTypeBGtoCS, DebugMessageTypeBGtoUI, DebugMessageTypeCStoBG, MessageTypeBGtoCS, MessageTypeBGtoUI, MessageTypeCStoBG, MessageTypeCStoUI, MessageTypeUItoBG, MessageTypeUItoCS} from './utils/message';
import type {AutomationMode} from './utils/automation';
import type {ThemeEngine} from './generators/theme-engines';
export type ColorScheme = 'dark' | 'light';
export interface ExtensionData {
isEnabled: boolean;
isReady: boolean;
isAllowedFileSchemeAccess: boolean;
settings: UserSettings;
news: News[];
shortcuts: Shortcuts;
colorScheme: ParsedColorSchemeConfig;
forcedScheme: 'dark' | 'light' | null;
activeTab: TabInfo;
uiHighlights: string[];
}
export interface DevToolsData {
dynamicFixesText: string;
filterFixesText: string;
staticThemesText: string;
}
export interface TabData {
type: MessageTypeBGtoCS;
data?: any;
}
export interface ExtensionActions {
changeSettings(settings: Partial<UserSettings>): void;
setTheme(theme: Partial<Theme>): void;
setShortcut(command: string, shortcut: string): Promise<string | null>;
toggleActiveTab(): void;
markNewsAsRead(ids: string[]): void;
markNewsAsDisplayed(ids: string[]): void;
loadConfig(options: {local: boolean}): void;
applyDevDynamicThemeFixes(text: string): Promise<void>;
resetDevDynamicThemeFixes(): void;
applyDevInversionFixes(text: string): Promise<void>;
resetDevInversionFixes(): void;
applyDevStaticThemes(text: string): Promise<void>;
resetDevStaticThemes(): void;
hideHighlights(ids: string[]): void;
}
export interface ExtWrapper {
data: ExtensionData;
actions: ExtensionActions;
}
export type ViewProps = ExtWrapper & {
fonts?: string[];
};
export interface Theme {
mode: FilterMode;
brightness: number;
contrast: number;
grayscale: number;
sepia: number;
useFont: boolean;
fontFamily: string;
textStroke: number;
engine: ThemeEngine;
stylesheet: string;
darkSchemeBackgroundColor: string;
darkSchemeTextColor: string;
lightSchemeBackgroundColor: string;
lightSchemeTextColor: string;
scrollbarColor: '' | 'auto' | string;
selectionColor: '' | 'auto' | string;
styleSystemControls: boolean;
lightColorScheme: string;
darkColorScheme: string;
immediateModify: boolean;
}
export interface CustomSiteConfig {
url: string[];
theme: Theme;
builtIn?: boolean;
}
export interface ThemePreset {
id: string;
name: string;
urls: string[];
theme: Theme;
}
export interface Automation {
enabled: boolean;
mode: AutomationMode;
behavior: 'OnOff' | 'Scheme';
}
export interface UserSettings {
schemeVersion: number;
enabled: boolean;
fetchNews: boolean;
theme: Theme;
presets: ThemePreset[];
customThemes: CustomSiteConfig[];
enabledByDefault: boolean;
enabledFor: string[];
disabledFor: string[];
changeBrowserTheme: boolean;
syncSettings: boolean;
syncSitesFixes: boolean;
automation: Automation;
time: TimeSettings;
location: LocationSettings;
previewNewDesign: boolean;
previewNewestDesign: boolean;
enableForPDF: boolean;
enableForProtectedPages: boolean;
enableContextMenus: boolean;
detectDarkTheme: boolean;
}
export interface TimeSettings {
activation: string;
deactivation: string;
}
export interface LocationSettings {
latitude: number | null;
longitude: number | null;
}
export interface TabInfo {
url: string;
id: number | null;
documentId: string | null;
isProtected: boolean;
isInjected: boolean | null;
isInDarkList: boolean;
isDarkThemeDetected: boolean | null;
}
export interface MessageCStoBG {
id?: string;
scriptId?: string;
type: MessageTypeCStoBG;
data?: any;
}
export interface MessageUItoCS {
type: MessageTypeUItoCS;
}
export interface MessageCStoUI {
type: MessageTypeCStoUI;
data: any;
}
export interface MessageBGtoCS {
id?: string;
scriptId?: string;
type: MessageTypeBGtoCS;
data?: any;
error?: any;
}
export interface MessageUItoBG {
type: MessageTypeUItoBG;
data?: any;
error?: any;
}
export interface MessageBGtoUI {
type: MessageTypeBGtoUI;
data?: any;
}
export interface DebugMessageBGtoCS {
type: DebugMessageTypeBGtoCS;
}
export interface DebugMessageBGtoUI {
type: DebugMessageTypeBGtoUI;
}
export interface DebugMessageCStoBG {
type: DebugMessageTypeCStoBG;
data?: any;
}
export interface Shortcuts {
[name: string]: string;
}
export interface DynamicThemeFix {
url: string[];
invert: string[];
css: string;
ignoreInlineStyle: string[];
ignoreImageAnalysis: string[];
disableStyleSheetsProxy: boolean;
disableCustomElementRegistryProxy: boolean;
}
export interface InversionFix {
url: string[];
invert: string[];
noinvert: string[];
removebg: string[];
css: string;
}
export interface DetectorHint {
url: string[];
target: string;
match: string[];
noDarkTheme: boolean;
systemTheme: boolean;
}
export interface StaticTheme {
url: string[];
neutralBg?: string[];
neutralBgActive?: string[];
neutralText?: string[];
neutralTextActive?: string[];
neutralBorder?: string[];
redBg?: string[];
redBgActive?: string[];
redText?: string[];
redTextActive?: string[];
redBorder?: string[];
greenBg?: string[];
greenBgActive?: string[];
greenText?: string[];
greenTextActive?: string[];
greenBorder?: string[];
blueBg?: string[];
blueBgActive?: string[];
blueText?: string[];
blueTextActive?: string[];
blueBorder?: string[];
fadeBg?: string[];
fadeText?: string[];
transparentBg?: string[];
noImage?: string[];
invert?: string[];
noCommon?: boolean;
}
export interface News {
id: string;
date: string;
url: string;
headline: string;
read?: boolean;
displayed?: boolean;
badge?: string;
icon?: string;
}
// These values need to match those in Manifest
export type Command = 'toggle' | 'addSite' | 'switchEngine';