/
index.d.ts
168 lines (144 loc) · 4.21 KB
/
index.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
158
159
160
161
162
163
164
165
166
167
168
// Type definitions for gitalk 1.5
// Project: https://github.com/gitalk/gitalk
// Definitions by: Chen Junda<https://github.com/viccrubs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { FlipMoveProps } from "react-flip-move";
/*~ If this module is a UMD module that exposes a global variable 'myLib' when
*~ loaded outside a module loader environment, declare that global here.
*~ Otherwise, delete this declaration.
*/
export as namespace Gitalk;
export default Gitalk;
/*~ You can declare types that are available via importing the module */
declare class Gitalk {
/**
* Construct a Gitalk instance.
* @param options Gitalk options
*/
constructor(options: Gitalk.GitalkOptions);
/**
* Init render and mount plugin.
* @param element the element or the selector to the element.
*/
render(element: string | HTMLElement): void;
}
declare namespace Gitalk {
interface GitalkOptions {
/**
* GitHub Application Client ID.
*/
clientID: string;
/**
* GitHub Application Client Secret.
*/
clientSecret: string;
/**
* Name of Github repository.
*/
repo: string;
/**
* GitHub repository owner.
* Can be personal user or organization.
*/
owner: string;
/**
* GitHub repository owner and collaborators.
* (Users who having write access to this repository)
*/
admin: string[];
/**
* The unique id of the page.
* Length must less than 50.
*
* @default location.href
*/
id?: string;
/**
* The issue ID of the page.
* If the number attribute is not defined, issue will be located using id.
*
* @default -1
*/
number?: number;
/**
* GitHub issue labels.
*
* @default ['Gitalk']
*/
labels?: string[];
/**
* GitHub issue title.
*
* @default document.title
*/
title?: string;
/**
* GitHub issue body.
*
* @default location.href + header.meta[description]
*/
body?: string;
/**
* Localization language key.
* en, zh-CN and zh-TW are currently available.
*
* @default navigator.language || navigator.userLanguage
*/
language?: string;
/**
* Pagination size, with maximum 100.
*
* @default 10
*/
perPage?: number;
/**
* Facebook-like distraction free mode.
*
* @default false
*/
distractionFreeMode?: boolean;
/**
* Comment sorting direction.
* Available values are last and first.
*
* @default "last"
*/
pagerDirection?: "last" | "first";
/**
* By default, Gitalk will create a corresponding github issue for your every single page automatically when the logined user is belong to the admin users.
* You can create it manually by setting this option to true.
*
* @default false
*/
createIssueManually?: boolean;
/**
* GitHub oauth request reverse proxy for CORS.
* [Why need this?](https://github.com/isaacs/github/issues/330)
*
* @default "https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token"
*/
proxy?: string;
/**
* Comment list animation.
*
* [Reference](https://github.com/joshwcomeau/react-flip-move/blob/master/documentation/enter_leave_animations.md)
*
* Default value:
* ```js
* {
* staggerDelayBy: 150,
* appearAnimation: 'accordionVertical',
* enterAnimation: 'accordionVertical',
* leaveAnimation: 'accordionVertical',
* }
* ```
*/
flipMoveOptions?: FlipMoveProps;
/**
* Enable hot key (cmd|ctrl + enter) submit comment.
*
* @default true
*/
enableHotKey?: boolean;
}
}