-
Notifications
You must be signed in to change notification settings - Fork 9
/
types.tsx
40 lines (29 loc) · 1 KB
/
types.tsx
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
export interface ExtensionSchema<ExtensionOptions extends any> {
name: string
options: ExtensionOptions
}
export abstract class ExtensionWidget<ExtensionOptions extends any> {
public schema: ExtensionSchema<ExtensionOptions>
abstract render(): React.ReactNode
abstract isPreviewReady: boolean
abstract loadPreview(): Promise<React.ReactNode>
constructor(name: string, options: ExtensionOptions) {
this.schema = {
name,
options
}
}
}
export abstract class AnyExtensionWidget extends ExtensionWidget<any> {}
export interface Extension<Widget extends ExtensionWidget<any>> {
/** Extension name that is being used in IPFS */
name: string
/** A method to construct the Extension class from options data from IPFS. */
initialize: (options: any) => Widget
/** Label to show in Extension Selector. */
label: string
/** Icon to be used in the Extension Selector. */
icon?: React.ReactNode
/** Modal built to take input for the Extension. */
modal: React.ReactNode
}