gitalk-react 1.0.0-beta.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README-zh-CN.md +159 -57
  2. package/README.md +142 -40
  3. package/dist/gitalk-dark.css +1 -1
  4. package/dist/gitalk-light.css +1 -1
  5. package/dist/gitalk.browser.full.js +102 -0
  6. package/dist/gitalk.browser.js +94 -0
  7. package/dist/gitalk.cjs +94 -0
  8. package/dist/gitalk.d.cts +14 -0
  9. package/dist/gitalk.d.mts +174 -0
  10. package/dist/gitalk.js +7427 -12628
  11. package/package.json +67 -44
  12. package/proxy-server/.env.example +6 -0
  13. package/proxy-server/README.md +38 -0
  14. package/proxy-server/server.mjs +110 -0
  15. package/dist/gitalk.d.ts +0 -455
  16. package/dist/gitalk.umd.cjs +0 -123
  17. package/lib/assets/arrow-down.svg +0 -1
  18. package/lib/assets/edit.svg +0 -3
  19. package/lib/assets/github.svg +0 -3
  20. package/lib/assets/heart-filled.svg +0 -3
  21. package/lib/assets/heart.svg +0 -3
  22. package/lib/assets/reply.svg +0 -3
  23. package/lib/assets/tip.svg +0 -8
  24. package/lib/components/action.tsx +0 -21
  25. package/lib/components/avatar.tsx +0 -42
  26. package/lib/components/button.tsx +0 -35
  27. package/lib/components/comment-textarea.tsx +0 -164
  28. package/lib/components/comment.tsx +0 -185
  29. package/lib/components/comments-list.tsx +0 -106
  30. package/lib/components/meta.tsx +0 -129
  31. package/lib/components/svg.tsx +0 -29
  32. package/lib/constants/index.ts +0 -57
  33. package/lib/contexts/I18nContext.ts +0 -20
  34. package/lib/gitalk.tsx +0 -882
  35. package/lib/i18n/de.json +0 -20
  36. package/lib/i18n/en.json +0 -20
  37. package/lib/i18n/es-ES.json +0 -20
  38. package/lib/i18n/fa.json +0 -20
  39. package/lib/i18n/fr.json +0 -20
  40. package/lib/i18n/index.ts +0 -40
  41. package/lib/i18n/ja.json +0 -20
  42. package/lib/i18n/ko.json +0 -20
  43. package/lib/i18n/pl.json +0 -21
  44. package/lib/i18n/ru.json +0 -20
  45. package/lib/i18n/zh-CN.json +0 -20
  46. package/lib/i18n/zh-TW.json +0 -20
  47. package/lib/interfaces/index.ts +0 -196
  48. package/lib/services/graphql/comment.ts +0 -84
  49. package/lib/services/request.ts +0 -24
  50. package/lib/services/user.ts +0 -40
  51. package/lib/themes/base.scss +0 -628
  52. package/lib/themes/gitalk-dark.scss +0 -28
  53. package/lib/themes/gitalk-light.scss +0 -28
  54. package/lib/utils/compatibility.ts +0 -35
  55. package/lib/utils/dom.ts +0 -15
  56. package/lib/utils/logger.ts +0 -66
  57. package/lib/utils/query.ts +0 -19
  58. package/lib/vite-env.d.ts +0 -1
package/dist/gitalk.d.ts DELETED
@@ -1,455 +0,0 @@
1
- import { default as default_2 } from 'react';
2
- import { default as default_3 } from 'react-flip-move';
3
- import { Endpoints } from '@octokit/types';
4
-
5
- declare type Comment_2 = Pick<CommentDefine, "id" | "body" | "body_html" | "created_at" | "html_url"> & {
6
- user: Pick<NonNullable<CommentDefine["user"]>, "avatar_url" | "login" | "html_url">;
7
- reactions: Pick<NonNullable<CommentDefine["reactions"]>, "heart">;
8
- reactionsHeart: {
9
- totalCount: number;
10
- viewerHasReacted: boolean;
11
- nodes: {
12
- databaseId: number;
13
- user: {
14
- login: string;
15
- };
16
- }[];
17
- };
18
- };
19
-
20
- declare type CommentDefine = Endpoints["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"]["response"]["data"][number];
21
-
22
- declare const Gitalk: default_2.FC<GitalkProps>;
23
- export default Gitalk;
24
-
25
- export declare interface GitalkProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "id" | "title"> {
26
- /**
27
- * GitHub Application Client ID.
28
- */
29
- clientID: string;
30
- /**
31
- * GitHub Application Client Secret.
32
- */
33
- clientSecret: string;
34
- /**
35
- * GitHub repository owner.
36
- * Can be personal user or organization.
37
- */
38
- owner: string;
39
- /**
40
- * Name of Github repository.
41
- */
42
- repo: string;
43
- /**
44
- * GitHub repository owner and collaborators.
45
- * (Users who having write access to this repository)
46
- */
47
- admin: string[];
48
- /**
49
- * The unique id of the page.
50
- * Length must less than 50.
51
- *
52
- * @default location.host + location.pathname
53
- */
54
- id?: string;
55
- /**
56
- * The issue ID of the page.
57
- * If the number attribute is not defined, issue will be located using id.
58
- */
59
- number?: number;
60
- /**
61
- * GitHub issue labels.
62
- *
63
- * @default ['Gitalk']
64
- */
65
- labels?: string[];
66
- /**
67
- * GitHub issue title.
68
- *
69
- * @default document.title
70
- */
71
- title?: string;
72
- /**
73
- * GitHub issue body.
74
- *
75
- * @default location.href + header.meta[description]
76
- */
77
- body?: string;
78
- /**
79
- * Localization language key.
80
- *
81
- * @default navigator.language
82
- */
83
- language?: Lang;
84
- /**
85
- * Pagination size, with maximum 100.
86
- *
87
- * @default 10
88
- */
89
- perPage?: number;
90
- /**
91
- * Comment sorting direction.
92
- * Available values are `last` and `first`.
93
- *
94
- * @default "last"
95
- */
96
- pagerDirection?: "last" | "first";
97
- /**
98
- * 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.
99
- * You can create it manually by setting this option to true.
100
- *
101
- * @default false
102
- */
103
- createIssueManually?: boolean;
104
- /**
105
- * Enable hot key (cmd|ctrl + enter) submit comment.
106
- *
107
- * @default true
108
- */
109
- enableHotKey?: boolean;
110
- /**
111
- * Facebook-like distraction free mode.
112
- *
113
- * @default false
114
- */
115
- distractionFreeMode?: boolean;
116
- /**
117
- * Comment list animation.
118
- *
119
- * @default
120
- * ```ts
121
- * {
122
- * staggerDelayBy: 150,
123
- * appearAnimation: 'accordionVertical',
124
- * enterAnimation: 'accordionVertical',
125
- * leaveAnimation: 'accordionVertical',
126
- * }
127
- * ```
128
- * @link https://github.com/joshwcomeau/react-flip-move/blob/master/documentation/enter_leave_animations.md
129
- */
130
- flipMoveOptions?: default_3.FlipMoveProps;
131
- /**
132
- * GitHub oauth request reverse proxy for CORS.
133
- * [Why need this?](https://github.com/isaacs/github/issues/330)
134
- *
135
- * @default "https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token"
136
- */
137
- proxy?: string;
138
- /**
139
- * Default user field if comments' author is not provided
140
- *
141
- * @default
142
- * ```ts
143
- * {
144
- * avatar_url: "//avatars1.githubusercontent.com/u/29697133?s=50",
145
- * login: "null",
146
- * html_url: ""
147
- * }
148
- */
149
- defaultUser?: Comment_2["user"];
150
- /**
151
- * Default user field if comments' author is not provided
152
- *
153
- * @deprecated use `defaultUser`
154
- */
155
- defaultAuthor?: IssueCommentsQLResponse["repository"]["issue"]["comments"]["nodes"][number]["author"];
156
- /**
157
- * Default collapse the comment if meets the height (px)
158
- */
159
- collapsedHeight?: number;
160
- /**
161
- * Callback method invoked when updating the number of comments.
162
- *
163
- * @param count comments number
164
- */
165
- updateCountCallback?: (count: number) => void;
166
- /**
167
- * Callback method invoked when a new issue is successfully created.
168
- *
169
- * @param issue created issue
170
- */
171
- onCreateIssue?: (issue: Issue) => void;
172
- /**
173
- * Callback method invoked when a new comment is successfully created.
174
- *
175
- * @param comment created comment
176
- */
177
- onCreateComment?: (comment: Comment_2) => void;
178
- }
179
-
180
- declare const i18nMap: {
181
- zh: {
182
- init: string;
183
- "no-found-related": string;
184
- "please-contact": string;
185
- "init-issue": string;
186
- "leave-a-comment": string;
187
- preview: string;
188
- edit: string;
189
- comment: string;
190
- "support-markdown": string;
191
- "login-with-github": string;
192
- "first-comment-person": string;
193
- commented: string;
194
- "load-more": string;
195
- counts: string;
196
- "sort-asc": string;
197
- "sort-desc": string;
198
- logout: string;
199
- anonymous: string;
200
- };
201
- "zh-CN": {
202
- init: string;
203
- "no-found-related": string;
204
- "please-contact": string;
205
- "init-issue": string;
206
- "leave-a-comment": string;
207
- preview: string;
208
- edit: string;
209
- comment: string;
210
- "support-markdown": string;
211
- "login-with-github": string;
212
- "first-comment-person": string;
213
- commented: string;
214
- "load-more": string;
215
- counts: string;
216
- "sort-asc": string;
217
- "sort-desc": string;
218
- logout: string;
219
- anonymous: string;
220
- };
221
- "zh-TW": {
222
- init: string;
223
- "no-found-related": string;
224
- "please-contact": string;
225
- "init-issue": string;
226
- "leave-a-comment": string;
227
- preview: string;
228
- edit: string;
229
- comment: string;
230
- "support-markdown": string;
231
- "login-with-github": string;
232
- "first-comment-person": string;
233
- commented: string;
234
- "load-more": string;
235
- counts: string;
236
- "sort-asc": string;
237
- "sort-desc": string;
238
- logout: string;
239
- anonymous: string;
240
- };
241
- en: {
242
- init: string;
243
- "no-found-related": string;
244
- "please-contact": string;
245
- "init-issue": string;
246
- "leave-a-comment": string;
247
- preview: string;
248
- edit: string;
249
- comment: string;
250
- "support-markdown": string;
251
- "login-with-github": string;
252
- "first-comment-person": string;
253
- commented: string;
254
- "load-more": string;
255
- counts: string;
256
- "sort-asc": string;
257
- "sort-desc": string;
258
- logout: string;
259
- anonymous: string;
260
- };
261
- "es-ES": {
262
- init: string;
263
- "no-found-related": string;
264
- "please-contact": string;
265
- "init-issue": string;
266
- "leave-a-comment": string;
267
- preview: string;
268
- edit: string;
269
- comment: string;
270
- "support-markdown": string;
271
- "login-with-github": string;
272
- "first-comment-person": string;
273
- commented: string;
274
- "load-more": string;
275
- counts: string;
276
- "sort-asc": string;
277
- "sort-desc": string;
278
- logout: string;
279
- anonymous: string;
280
- };
281
- fr: {
282
- init: string;
283
- "no-found-related": string;
284
- "please-contact": string;
285
- "init-issue": string;
286
- "leave-a-comment": string;
287
- preview: string;
288
- edit: string;
289
- comment: string;
290
- "support-markdown": string;
291
- "login-with-github": string;
292
- "first-comment-person": string;
293
- commented: string;
294
- "load-more": string;
295
- counts: string;
296
- "sort-asc": string;
297
- "sort-desc": string;
298
- logout: string;
299
- anonymous: string;
300
- };
301
- ru: {
302
- init: string;
303
- "no-found-related": string;
304
- "please-contact": string;
305
- "init-issue": string;
306
- "leave-a-comment": string;
307
- preview: string;
308
- edit: string;
309
- comment: string;
310
- "support-markdown": string;
311
- "login-with-github": string;
312
- "first-comment-person": string;
313
- commented: string;
314
- "load-more": string;
315
- counts: string;
316
- "sort-asc": string;
317
- "sort-desc": string;
318
- logout: string;
319
- anonymous: string;
320
- };
321
- de: {
322
- init: string;
323
- "no-found-related": string;
324
- "please-contact": string;
325
- "init-issue": string;
326
- "leave-a-comment": string;
327
- preview: string;
328
- edit: string;
329
- comment: string;
330
- "support-markdown": string;
331
- "login-with-github": string;
332
- "first-comment-person": string;
333
- commented: string;
334
- "load-more": string;
335
- counts: string;
336
- "sort-asc": string;
337
- "sort-desc": string;
338
- logout: string;
339
- anonymous: string;
340
- };
341
- pl: {
342
- init: string;
343
- "no-found-related": string;
344
- "please-contact": string;
345
- "init-issue": string;
346
- "leave-a-comment": string;
347
- preview: string;
348
- edit: string;
349
- comment: string;
350
- "support-markdown": string;
351
- "login-with-github": string;
352
- "first-comment-person": string;
353
- commented: string;
354
- "load-more": string;
355
- counts: string;
356
- "sort-asc": string;
357
- "sort-desc": string;
358
- logout: string;
359
- anonymous: string;
360
- };
361
- ko: {
362
- init: string;
363
- "no-found-related": string;
364
- "please-contact": string;
365
- "init-issue": string;
366
- "leave-a-comment": string;
367
- preview: string;
368
- edit: string;
369
- comment: string;
370
- "support-markdown": string;
371
- "login-with-github": string;
372
- "first-comment-person": string;
373
- commented: string;
374
- "load-more": string;
375
- counts: string;
376
- "sort-asc": string;
377
- "sort-desc": string;
378
- logout: string;
379
- anonymous: string;
380
- };
381
- fa: {
382
- init: string;
383
- "no-found-related": string;
384
- "please-contact": string;
385
- "init-issue": string;
386
- "leave-a-comment": string;
387
- preview: string;
388
- edit: string;
389
- comment: string;
390
- "support-markdown": string;
391
- "login-with-github": string;
392
- "first-comment-person": string;
393
- commented: string;
394
- "load-more": string;
395
- counts: string;
396
- "sort-asc": string;
397
- "sort-desc": string;
398
- logout: string;
399
- anonymous: string;
400
- };
401
- ja: {
402
- init: string;
403
- "no-found-related": string;
404
- "please-contact": string;
405
- "init-issue": string;
406
- "leave-a-comment": string;
407
- preview: string;
408
- edit: string;
409
- comment: string;
410
- "support-markdown": string;
411
- "login-with-github": string;
412
- "first-comment-person": string;
413
- commented: string;
414
- "load-more": string;
415
- counts: string;
416
- "sort-asc": string;
417
- "sort-desc": string;
418
- logout: string;
419
- anonymous: string;
420
- };
421
- };
422
-
423
- declare type Issue = Endpoints["GET /repos/{owner}/{repo}/issues/{issue_number}"]["response"]["data"];
424
-
425
- declare interface IssueCommentsQLResponse {
426
- repository: {
427
- issue: {
428
- comments: {
429
- totalCount: number;
430
- pageInfo: {
431
- hasPreviousPage?: boolean;
432
- hasNextPage?: boolean;
433
- startCursor?: string;
434
- endCursor?: string;
435
- };
436
- nodes: (Pick<Comment_2, "body"> & {
437
- databaseId: Comment_2["id"];
438
- author: {
439
- avatarUrl: Comment_2["user"]["avatar_url"];
440
- login: Comment_2["user"]["login"];
441
- url: Comment_2["user"]["html_url"];
442
- };
443
- bodyHTML: Comment_2["body_html"];
444
- createdAt: Comment_2["created_at"];
445
- resourcePath: Comment_2["html_url"];
446
- reactions: Comment_2["reactionsHeart"];
447
- })[];
448
- };
449
- };
450
- };
451
- }
452
-
453
- declare type Lang = keyof typeof i18nMap;
454
-
455
- export { }