/
renderer.d.ts
66 lines (58 loc) · 2.14 KB
/
renderer.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
declare module '@getflywheel/local/renderer' {
import { FC, ReactNode } from 'react';
type ReactNodeLike = ReactNode | string | number;
export interface ConfirmArgs {
title: ReactNodeLike
message?: ReactNodeLike
messageBottom?: ReactNodeLike
messageCheckbox?: ReactNodeLike
checkboxLabel?: string
buttonText?: string
buttonDisabled?: boolean
onSubmit?: (...any) => any
cancelButtonText: string
buttonClass: string
topIcon: any
topIconColor: any
largeConfirmButtonText: string
showBottomHr: boolean
}
/**
* Utility function to send an IPC event to the renderer thread and await either a success or error response and
* return it as a Promise.
*
* The channel will automatically be tokenized to ensure a response came from the expected request.
*
* @see LocalMain.addIpcAsyncListener()
*/
export function ipcAsync(channel: string, ...additionalArgs: any[]): Promise<any>;
export function confirm(args: ConfirmArgs): Promise<any>;
interface MenuContentRowItem {
/* The name of the row to render on the left hand side (left column) of the row */
name: string;
/* the component to render on the right hand side (right column) of the row */
component: FC;
}
export interface PreferencesSection {
/* The name to call the section. If this is omitted, a subheader will not be created */
subHeader?: string;
/* the single row item or list of row itmes to render in the section */
rows: MenuContentRowItem | MenuContentRowItem[];
}
/**
* Interface describing the expected shape for a config object that adds a new item to the
* settings view via the 'preferencesMenuItems' filter hook
*/
export interface AddonSettingsItem {
/* the sub path that the menu should be mounted under for React Router */
path: string;
/* the display name to show in the sidebar and title section of "Preferences" */
displayName: string;
/* The section, or sections to render */
sections: FC | PreferencesSection[];
/* the function to call on click of the apply button */
onApply: () => void;
/* additional props to pass to MenuContentRowItem(s) or the section override component */
sectionsProps?: GenericObject;
}
}