-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzlib.d.ts
157 lines (135 loc) · 5.38 KB
/
zlib.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
145
146
147
148
149
150
151
152
153
154
155
156
157
// declare namespace React {
// export interface ReactElement {}
// export interface ComponentClass {}
// export type DispatchWithoutAction = () => void;
// }
interface ReactComponent {
component: any;
selector: string | null;
filter: (m) => boolean;
forceUpdateAll: () => void;
}
declare module "@zlibrary/discord" {
export const APIModule: { get: (options, callback?: (data: any) => void) => Promise<any> };
export const MessageStore: { getMessage: (channelId: string, messageId: string) => any };
export const DiscordConstants: {
Endpoints: { MESSAGES: (channelId: string) => string; };
};
export const MessageActions: {
sendMessage: (channelId: string, options: { content?: string }) => Promise<any>;
};
export const Dispatcher: {
dirtyDispatch: (options: { type: string }) => void
};
export const ModalActions: {
openModal: (props: { onClose: () => void, transitionState: "1" | "2" | "3" }) => any;
};
export const ElectronModule: {
readClipboard(): string;
}
}
declare module "@zlibrary" {
type PatcherCallback = (thisObject: any, methodArguments: any[], returnValue: any) => any;
export const Logger: {
log: (...message: any) => void,
warn: (...message: any) => void,
error: (...message: any) => void,
stacktrace: (...message: any) => void,
info: (...message: any) => void,
debug: (...messsage: any) => void,
err: (...message: any) => void
};
export class Utilities {
static getNestedProp(object: any, path: string): any;
static findInTree(tree: any, filter: (item: any) => Boolean): any;
static findInReactTree(tree: any, filter: (item: any) => Boolean): any;
static formatString(string: string, options: object): string;
static suppressErrors(func: Function, description: string): (...args) => any;
}
export class ReactComponents {
static getComponentByName(name: string, selector: string): Promise<ReactComponent>;
}
export const Patcher: {
unpatchAll: () => void,
after: (module: any, method: string, callback: PatcherCallback) => () => void,
before: (module: any, method: string, callback: PatcherCallback) => () => void,
instead: (module: any, method: string, callback: PatcherCallback) => () => void,
}
export const Components: {
ErrorBoundary: any;
}
export * as DiscordModules from "@zlibrary/discord";
export class WebpackModules {
static getByProps(...props: string[]): void | any;
static getByDisplayName(displayName: string): void | any;
static getByPrototypes(...prototypes: string[]): void | any;
static getModule(filter: (m: any) => Boolean, first?: true): void | any;
static getModules(filter: (m: any) => Boolean, first?: true): void | any;
static find(filter: (m: any) => Boolean): void | any;
static findAll(filter: (m: any) => Boolean): void | any[];
static findByUniqueProperties(props: string[], first?: false): any | any[];
}
export class ColorConverter {
static hex2int(hex: string): number;
static int2hex(int: number): string;
static getDarkness(int: number): number;
}
export class ReactTools {
static getOwnerInstance(node: Node): any;
static createWrappedElement(element: Node): React.ReactElement;
static wrapElement(element: Node): React.ComponentClass;
}
export class DOMTools {
static parseHTML(htmlString: string): Node | Node[];
}
export class PluginUtilities {
static loadSettings(pluginName: string, defaultConfig: object): object;
static saveSettings(pluginName: string, settings: object): void;
}
type MenuItem = { label: string, action: (event: any) => void };
export class DCM {
static buildMenuChildren(setup: Array<MenuItem>): any;
static buildMenuItem(options: MenuItem): any;
}
export class DiscordContextMenu extends DCM { }
type ToastOptions = {
type?: "info" | "error" | "warning" | "success";
timeout?: number;
};
export class Toasts {
static show(content: string, options?: ToastOptions): void;
static success(content: string, options?: ToastOptions): void;
static warning(content: string, options?: ToastOptions): void;
static error(content: string, options?: ToastOptions): void;
static info(content: string, options?: ToastOptions): void;
}
type ConfirmModalOptions = {
cancelText: string;
confirmText: string;
onConfirm: () => void;
onCancel: () => void;
danger: boolean;
};
export class Modals {
static showConfirmationModal(title: string, content: string, options?: ConfirmModalOptions): void
}
export class Popouts {
static showUserPopout(element: Element, user: UserObject, options?: any): void;
}
}
declare module "@zlibrary/plugin" {
export default class BasePlugin {
getName(): string;
getAuthor(): string;
getDescription(): string;
getVersion(): string;
onStart(): void;
onStop(): void;
onSwitch(): void;
obsever(mutation: any): void;
buildSettingsPanel(): {
getElement: () => Node,
addListener: (callback: () => void) => void
};
}
}