opensource-showcase 0.1.0 → 0.1.3

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 (82) hide show
  1. package/README.md +61 -37
  2. package/dist/auth/github-auth.d.ts +6 -2
  3. package/dist/auth/github-auth.d.ts.map +1 -1
  4. package/dist/auth/github-auth.js +16 -8
  5. package/dist/auth/github-auth.js.map +1 -1
  6. package/dist/cli.d.ts +1 -1
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +28 -3
  9. package/dist/cli.js.map +1 -1
  10. package/dist/commands/login.d.ts +5 -0
  11. package/dist/commands/login.d.ts.map +1 -0
  12. package/dist/commands/login.js +15 -0
  13. package/dist/commands/login.js.map +1 -0
  14. package/dist/commands/main.d.ts.map +1 -1
  15. package/dist/commands/main.js +113 -45
  16. package/dist/commands/main.js.map +1 -1
  17. package/dist/commands/whoami.d.ts +5 -0
  18. package/dist/commands/whoami.d.ts.map +1 -0
  19. package/dist/commands/whoami.js +21 -0
  20. package/dist/commands/whoami.js.map +1 -0
  21. package/dist/constants.d.ts +1 -0
  22. package/dist/constants.d.ts.map +1 -1
  23. package/dist/constants.js +6 -6
  24. package/dist/constants.js.map +1 -1
  25. package/dist/github/fetch-prs.d.ts +9 -2
  26. package/dist/github/fetch-prs.d.ts.map +1 -1
  27. package/dist/github/fetch-prs.js +54 -7
  28. package/dist/github/fetch-prs.js.map +1 -1
  29. package/dist/github/fetch-repos.d.ts +18 -0
  30. package/dist/github/fetch-repos.d.ts.map +1 -0
  31. package/dist/github/fetch-repos.js +87 -0
  32. package/dist/github/fetch-repos.js.map +1 -0
  33. package/dist/repo/generate-readme.d.ts +4 -4
  34. package/dist/repo/generate-readme.d.ts.map +1 -1
  35. package/dist/repo/generate-readme.js +67 -163
  36. package/dist/repo/generate-readme.js.map +1 -1
  37. package/dist/repo/generate-site.d.ts +6 -0
  38. package/dist/repo/generate-site.d.ts.map +1 -0
  39. package/dist/repo/generate-site.js +31 -0
  40. package/dist/repo/generate-site.js.map +1 -0
  41. package/dist/repo/manage-repo.d.ts +7 -1
  42. package/dist/repo/manage-repo.d.ts.map +1 -1
  43. package/dist/repo/manage-repo.js +84 -35
  44. package/dist/repo/manage-repo.js.map +1 -1
  45. package/dist/repo/site/assets.d.ts +3 -0
  46. package/dist/repo/site/assets.d.ts.map +1 -0
  47. package/dist/repo/site/assets.js +534 -0
  48. package/dist/repo/site/assets.js.map +1 -0
  49. package/dist/repo/site/components.d.ts +9 -0
  50. package/dist/repo/site/components.d.ts.map +1 -0
  51. package/dist/repo/site/components.js +121 -0
  52. package/dist/repo/site/components.js.map +1 -0
  53. package/dist/repo/site/utils.d.ts +17 -0
  54. package/dist/repo/site/utils.d.ts.map +1 -0
  55. package/dist/repo/site/utils.js +162 -0
  56. package/dist/repo/site/utils.js.map +1 -0
  57. package/dist/templates/index.d.ts +7 -0
  58. package/dist/templates/index.d.ts.map +1 -0
  59. package/dist/templates/index.js +7 -0
  60. package/dist/templates/index.js.map +1 -0
  61. package/dist/templates/project-section.d.ts +6 -0
  62. package/dist/templates/project-section.d.ts.map +1 -0
  63. package/dist/templates/project-section.js +112 -0
  64. package/dist/templates/project-section.js.map +1 -0
  65. package/dist/templates/readme-footer.d.ts +5 -0
  66. package/dist/templates/readme-footer.d.ts.map +1 -0
  67. package/dist/templates/readme-footer.js +35 -0
  68. package/dist/templates/readme-footer.js.map +1 -0
  69. package/dist/templates/readme-header.d.ts +10 -0
  70. package/dist/templates/readme-header.d.ts.map +1 -0
  71. package/dist/templates/readme-header.js +118 -0
  72. package/dist/templates/readme-header.js.map +1 -0
  73. package/dist/types/index.d.ts +6 -1
  74. package/dist/types/index.d.ts.map +1 -1
  75. package/dist/ui/interactive.d.ts +7 -1
  76. package/dist/ui/interactive.d.ts.map +1 -1
  77. package/dist/ui/interactive.js +86 -4
  78. package/dist/ui/interactive.js.map +1 -1
  79. package/dist/utils/config.d.ts.map +1 -1
  80. package/dist/utils/config.js +0 -1
  81. package/dist/utils/config.js.map +1 -1
  82. package/package.json +5 -6
@@ -0,0 +1,534 @@
1
+ export function renderStyles() {
2
+ return `<style>
3
+ :root {
4
+ color-scheme: light;
5
+ --bg: #fafafa;
6
+ --panel: #ffffff;
7
+ --panel-soft: #f6f6f6;
8
+ --text: #111111;
9
+ --muted: #666666;
10
+ --line: #e2e2e2;
11
+ --accent: #111111;
12
+ --accent-strong: #000000;
13
+ --chip: #eeeeee;
14
+ --shadow: 0 18px 45px rgba(0, 0, 0, 0.06);
15
+ }
16
+
17
+ * {
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ body {
22
+ margin: 0;
23
+ background: var(--bg);
24
+ color: var(--text);
25
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
26
+ line-height: 1.5;
27
+ }
28
+
29
+ a {
30
+ color: inherit;
31
+ text-decoration: none;
32
+ }
33
+
34
+ .shell {
35
+ width: min(1680px, calc(100% - 32px));
36
+ margin: 0 auto;
37
+ }
38
+
39
+ .hero {
40
+ padding: 18px 0;
41
+ border-bottom: 1px solid var(--line);
42
+ }
43
+
44
+ .profile {
45
+ display: grid;
46
+ grid-template-columns: minmax(0, 1fr) auto;
47
+ gap: 18px;
48
+ align-items: center;
49
+ }
50
+
51
+ .identity {
52
+ display: grid;
53
+ grid-template-columns: auto minmax(0, 1fr);
54
+ gap: 12px;
55
+ align-items: center;
56
+ min-width: 0;
57
+ }
58
+
59
+ .avatar {
60
+ width: 48px;
61
+ height: 48px;
62
+ border: 1px solid var(--line);
63
+ border-radius: 50%;
64
+ }
65
+
66
+ h1 {
67
+ margin: 0;
68
+ font-size: 1.05rem;
69
+ line-height: 1.2;
70
+ font-weight: 800;
71
+ letter-spacing: 0;
72
+ }
73
+
74
+ .handle {
75
+ margin: 2px 0 0;
76
+ color: var(--accent);
77
+ font-weight: 700;
78
+ font-size: 0.9rem;
79
+ }
80
+
81
+ .bio {
82
+ max-width: 620px;
83
+ margin: 4px 0 0;
84
+ color: var(--muted);
85
+ font-size: 0.88rem;
86
+ white-space: nowrap;
87
+ overflow: hidden;
88
+ text-overflow: ellipsis;
89
+ }
90
+
91
+ .stats {
92
+ display: grid;
93
+ grid-template-columns: repeat(3, minmax(0, 1fr));
94
+ gap: 8px;
95
+ min-width: 360px;
96
+ }
97
+
98
+ .stat {
99
+ min-height: 54px;
100
+ padding: 9px 12px;
101
+ background: var(--panel);
102
+ border: 1px solid var(--line);
103
+ border-radius: 4px;
104
+ }
105
+
106
+ .stat strong {
107
+ display: block;
108
+ font-size: 1.05rem;
109
+ line-height: 1.1;
110
+ }
111
+
112
+ .stat span {
113
+ display: block;
114
+ margin-top: 4px;
115
+ color: var(--muted);
116
+ font-size: 0.74rem;
117
+ font-weight: 700;
118
+ text-transform: uppercase;
119
+ }
120
+
121
+ .toolbar {
122
+ position: sticky;
123
+ top: 0;
124
+ z-index: 2;
125
+ padding: 14px 0;
126
+ background: rgba(250, 250, 250, 0.94);
127
+ border-bottom: 1px solid var(--line);
128
+ backdrop-filter: blur(16px);
129
+ }
130
+
131
+ .toolbar-inner {
132
+ display: grid;
133
+ grid-template-columns: minmax(220px, 360px) 1fr;
134
+ gap: 16px;
135
+ align-items: center;
136
+ }
137
+
138
+ .search {
139
+ width: 100%;
140
+ min-height: 42px;
141
+ padding: 0 14px;
142
+ border: 1px solid var(--line);
143
+ border-radius: 4px;
144
+ background: var(--panel);
145
+ color: var(--text);
146
+ font: inherit;
147
+ }
148
+
149
+ .filters {
150
+ display: flex;
151
+ gap: 8px;
152
+ overflow-x: auto;
153
+ padding-bottom: 2px;
154
+ }
155
+
156
+ .filter {
157
+ flex: 0 0 auto;
158
+ min-height: 38px;
159
+ padding: 0 12px;
160
+ border: 1px solid var(--line);
161
+ border-radius: 999px;
162
+ background: var(--panel);
163
+ color: var(--muted);
164
+ font: inherit;
165
+ cursor: pointer;
166
+ }
167
+
168
+ .filter span {
169
+ margin-left: 6px;
170
+ color: var(--accent);
171
+ font-weight: 700;
172
+ }
173
+
174
+ .filter.is-active {
175
+ background: var(--accent);
176
+ border-color: var(--accent);
177
+ color: #fff;
178
+ }
179
+
180
+ .filter.is-active span {
181
+ color: #dcebe5;
182
+ }
183
+
184
+ main {
185
+ padding: 28px 0 56px;
186
+ }
187
+
188
+ .repo-section {
189
+ margin-top: 18px;
190
+ padding: 22px;
191
+ background: var(--panel);
192
+ border: 1px solid var(--line);
193
+ border-radius: 4px;
194
+ box-shadow: var(--shadow);
195
+ }
196
+
197
+ .repo-header {
198
+ display: grid;
199
+ grid-template-columns: 1fr auto;
200
+ gap: 16px;
201
+ align-items: start;
202
+ padding-bottom: 18px;
203
+ border-bottom: 1px solid var(--line);
204
+ }
205
+
206
+ .repo-name {
207
+ display: inline-flex;
208
+ gap: 10px;
209
+ align-items: center;
210
+ font-weight: 800;
211
+ font-size: 1.1rem;
212
+ }
213
+
214
+ .repo-name img {
215
+ border: 1px solid var(--line);
216
+ border-radius: 50%;
217
+ }
218
+
219
+ .repo-header p {
220
+ max-width: 1080px;
221
+ margin: 10px 0 0;
222
+ color: var(--muted);
223
+ }
224
+
225
+ .repo-stats {
226
+ display: flex;
227
+ gap: 8px;
228
+ flex-wrap: wrap;
229
+ justify-content: flex-end;
230
+ }
231
+
232
+ .repo-stats span,
233
+ .labels span {
234
+ display: inline-flex;
235
+ align-items: center;
236
+ min-height: 28px;
237
+ padding: 0 9px;
238
+ background: var(--chip);
239
+ border-radius: 999px;
240
+ color: var(--accent-strong);
241
+ font-size: 0.82rem;
242
+ font-weight: 700;
243
+ }
244
+
245
+ .contribution-list {
246
+ display: grid;
247
+ gap: 12px;
248
+ margin-top: 18px;
249
+ }
250
+
251
+ @media (min-width: 1280px) {
252
+ .contribution-list {
253
+ gap: 14px;
254
+ }
255
+ }
256
+
257
+ .contribution {
258
+ padding: 18px;
259
+ border: 1px solid var(--line);
260
+ border-radius: 4px;
261
+ background: var(--panel-soft);
262
+ }
263
+
264
+ .pr-title {
265
+ font-weight: 800;
266
+ color: var(--accent-strong);
267
+ }
268
+
269
+ .contribution p {
270
+ margin: 8px 0 0;
271
+ color: var(--muted);
272
+ }
273
+
274
+ .description {
275
+ display: grid;
276
+ gap: 10px;
277
+ margin-top: 10px;
278
+ color: var(--muted);
279
+ }
280
+
281
+ .description :is(p, ul, figure, h4) {
282
+ margin: 0;
283
+ }
284
+
285
+ .description h4 {
286
+ color: var(--text);
287
+ font-size: 0.95rem;
288
+ }
289
+
290
+ .description ul {
291
+ padding-left: 20px;
292
+ }
293
+
294
+ .description a {
295
+ color: var(--text);
296
+ text-decoration: underline;
297
+ text-decoration-color: #b8b8b8;
298
+ text-underline-offset: 3px;
299
+ }
300
+
301
+ .description code {
302
+ padding: 2px 5px;
303
+ background: #ffffff;
304
+ border: 1px solid var(--line);
305
+ border-radius: 4px;
306
+ color: var(--text);
307
+ font-size: 0.9em;
308
+ }
309
+
310
+ .description img {
311
+ display: block;
312
+ max-width: 100%;
313
+ height: auto;
314
+ max-height: 620px;
315
+ object-fit: contain;
316
+ border: 1px solid var(--line);
317
+ border-radius: 4px;
318
+ background: #ffffff;
319
+ }
320
+
321
+ .markdown-table-wrap {
322
+ max-width: 100%;
323
+ overflow-x: auto;
324
+ border: 1px solid var(--line);
325
+ border-radius: 4px;
326
+ background: #ffffff;
327
+ }
328
+
329
+ .markdown-table {
330
+ width: 100%;
331
+ min-width: 860px;
332
+ border-collapse: collapse;
333
+ color: var(--text);
334
+ font-size: 0.88rem;
335
+ }
336
+
337
+ .markdown-table th,
338
+ .markdown-table td {
339
+ padding: 12px;
340
+ border-right: 1px solid var(--line);
341
+ border-bottom: 1px solid var(--line);
342
+ vertical-align: top;
343
+ text-align: left;
344
+ }
345
+
346
+ .markdown-table th:last-child,
347
+ .markdown-table td:last-child {
348
+ border-right: 0;
349
+ }
350
+
351
+ .markdown-table tr:last-child td {
352
+ border-bottom: 0;
353
+ }
354
+
355
+ .markdown-table th {
356
+ background: #f3f3f3;
357
+ color: var(--text);
358
+ font-size: 0.78rem;
359
+ font-weight: 800;
360
+ text-transform: uppercase;
361
+ }
362
+
363
+ .markdown-table img {
364
+ width: 100%;
365
+ max-height: 440px;
366
+ }
367
+
368
+ .description-fallback {
369
+ color: var(--muted);
370
+ }
371
+
372
+ .reviewed-by {
373
+ display: flex;
374
+ flex-wrap: wrap;
375
+ gap: 10px;
376
+ align-items: center;
377
+ margin-top: 14px;
378
+ padding-top: 12px;
379
+ border-top: 1px solid var(--line);
380
+ color: var(--muted);
381
+ font-size: 0.88rem;
382
+ font-weight: 700;
383
+ }
384
+
385
+ .reviewers {
386
+ display: flex;
387
+ gap: 4px;
388
+ align-items: center;
389
+ }
390
+
391
+ .reviewers a {
392
+ display: inline-flex;
393
+ }
394
+
395
+ .reviewers img {
396
+ width: 24px;
397
+ height: 24px;
398
+ border: 1px solid #ffffff;
399
+ border-radius: 50%;
400
+ background: #ffffff;
401
+ box-shadow: 0 0 0 1px var(--line);
402
+ }
403
+
404
+ .merged-by {
405
+ color: var(--text);
406
+ text-decoration: underline;
407
+ text-decoration-color: #b8b8b8;
408
+ text-underline-offset: 3px;
409
+ }
410
+
411
+ .meta-row,
412
+ .labels {
413
+ display: flex;
414
+ flex-wrap: wrap;
415
+ gap: 8px;
416
+ margin-top: 12px;
417
+ }
418
+
419
+ .meta-row span {
420
+ display: inline-flex;
421
+ gap: 6px;
422
+ align-items: center;
423
+ min-height: 30px;
424
+ padding: 0 10px;
425
+ border: 1px solid #d4d4d4;
426
+ border-radius: 999px;
427
+ background: #ffffff;
428
+ color: var(--text);
429
+ font-size: 0.88rem;
430
+ font-weight: 700;
431
+ }
432
+
433
+ .meta-row strong {
434
+ color: var(--muted);
435
+ font-size: 0.76rem;
436
+ font-weight: 700;
437
+ text-transform: uppercase;
438
+ }
439
+
440
+ .empty {
441
+ margin-top: 28px;
442
+ padding: 24px;
443
+ border: 1px dashed var(--line);
444
+ border-radius: 4px;
445
+ color: var(--muted);
446
+ text-align: center;
447
+ }
448
+
449
+ footer {
450
+ padding: 28px 0;
451
+ border-top: 1px solid var(--line);
452
+ color: var(--muted);
453
+ font-size: 0.92rem;
454
+ }
455
+
456
+ @media (max-width: 760px) {
457
+ .hero {
458
+ padding: 14px 0;
459
+ }
460
+
461
+ .profile,
462
+ .toolbar-inner,
463
+ .repo-header {
464
+ grid-template-columns: 1fr;
465
+ }
466
+
467
+ .stats {
468
+ grid-template-columns: repeat(2, minmax(0, 1fr));
469
+ min-width: 0;
470
+ }
471
+
472
+ .bio {
473
+ white-space: normal;
474
+ }
475
+
476
+ .repo-stats {
477
+ justify-content: flex-start;
478
+ }
479
+ }
480
+
481
+ @media (max-width: 460px) {
482
+ .stats {
483
+ grid-template-columns: 1fr;
484
+ }
485
+
486
+ .identity {
487
+ grid-template-columns: 1fr;
488
+ }
489
+
490
+ .repo-section {
491
+ padding: 16px;
492
+ }
493
+ }
494
+ </style>`;
495
+ }
496
+ export function renderScript() {
497
+ return `<script>
498
+ const search = document.querySelector('#search');
499
+ const filters = [...document.querySelectorAll('.filter')];
500
+ const sections = [...document.querySelectorAll('.repo-section')];
501
+ const empty = document.querySelector('#empty');
502
+ let activeLanguage = 'all';
503
+
504
+ function normalize(value) {
505
+ return value.toLowerCase().trim();
506
+ }
507
+
508
+ function applyFilters() {
509
+ const query = normalize(search.value);
510
+ let visibleCount = 0;
511
+
512
+ sections.forEach((section) => {
513
+ const languages = section.dataset.languages.split('|');
514
+ const languageMatch = activeLanguage === 'all' || languages.includes(activeLanguage);
515
+ const queryMatch = !query || normalize(section.textContent).includes(query);
516
+
517
+ section.hidden = !(languageMatch && queryMatch);
518
+ if (!section.hidden) visibleCount += 1;
519
+ });
520
+
521
+ empty.hidden = visibleCount !== 0;
522
+ }
523
+
524
+ search.addEventListener('input', applyFilters);
525
+ filters.forEach((filter) => {
526
+ filter.addEventListener('click', () => {
527
+ activeLanguage = filter.dataset.language;
528
+ filters.forEach((item) => item.classList.toggle('is-active', item === filter));
529
+ applyFilters();
530
+ });
531
+ });
532
+ </script>`;
533
+ }
534
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../../src/repo/site/assets.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY;IAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA4eI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmCK,CAAC;AACf,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Contributor, EnrichedContribution } from '../../types/index.js';
2
+ import type { SiteStats } from './utils.js';
3
+ export declare function renderHero(contributor: Contributor, stats: SiteStats): string;
4
+ export declare function renderToolbar(languages: SiteStats['languages']): string;
5
+ export declare function renderRepositorySection(repo: string, contributions: EnrichedContribution[]): string;
6
+ export declare function renderContributionCard(contribution: EnrichedContribution): string;
7
+ export declare function renderMainContent(grouped: Array<[string, EnrichedContribution[]]>): string;
8
+ export declare function renderFooter(updatedAt: string): string;
9
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/repo/site/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAQ5C,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAsB7E;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,MAAM,CAqBvE;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,oBAAoB,EAAE,GACpC,MAAM,CA8BR;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,oBAAoB,GAAG,MAAM,CA4CjF;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC,GAC/C,MAAM,CAOR;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMtD"}
@@ -0,0 +1,121 @@
1
+ import { cleanDescription, escapeHtml, formatDate, renderRichDescription, } from './utils.js';
2
+ export function renderHero(contributor, stats) {
3
+ const displayName = contributor.name || contributor.username;
4
+ return `<header class="hero">
5
+ <div class="shell">
6
+ <div class="profile">
7
+ <div class="identity">
8
+ <img class="avatar" src="https://github.com/${escapeHtml(contributor.username)}.png" alt="${escapeHtml(displayName)}" />
9
+ <div class="identity-copy">
10
+ <h1>${escapeHtml(displayName)}</h1>
11
+ <p class="handle"><a href="${escapeHtml(contributor.profile_url)}">@${escapeHtml(contributor.username)}</a></p>
12
+ ${contributor.bio ? `<p class="bio">${escapeHtml(contributor.bio)}</p>` : ''}
13
+ </div>
14
+ </div>
15
+ <div class="stats" aria-label="Contribution summary">
16
+ <div class="stat"><strong>${stats.totalContributions.toLocaleString()}</strong><span>contributions</span></div>
17
+ <div class="stat"><strong>${stats.totalProjects.toLocaleString()}</strong><span>projects</span></div>
18
+ <div class="stat"><strong>${stats.totalLanguages.toLocaleString()}</strong><span>languages</span></div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </header>`;
23
+ }
24
+ export function renderToolbar(languages) {
25
+ const filters = languages.length === 0
26
+ ? ''
27
+ : `<div class="filters" aria-label="Language filters">
28
+ <button class="filter is-active" type="button" data-language="all">All</button>
29
+ ${languages
30
+ .map((language) => `<button class="filter" type="button" data-language="${escapeHtml(language.name)}">
31
+ ${escapeHtml(language.name)} <span>${language.count}</span>
32
+ </button>`)
33
+ .join('')}
34
+ </div>`;
35
+ return `<div class="toolbar">
36
+ <div class="shell toolbar-inner">
37
+ <input class="search" id="search" type="search" placeholder="Search repositories and pull requests" autocomplete="off" />
38
+ ${filters}
39
+ </div>
40
+ </div>`;
41
+ }
42
+ export function renderRepositorySection(repo, contributions) {
43
+ const first = contributions[0];
44
+ if (!first)
45
+ return '';
46
+ const sorted = [...contributions].sort((a, b) => new Date(b.merged_at).getTime() - new Date(a.merged_at).getTime());
47
+ const [owner] = repo.split('/');
48
+ const languages = new Set(sorted.map((contribution) => contribution.language ?? 'Unknown'));
49
+ return `<section class="repo-section" data-repo="${escapeHtml(repo)}" data-languages="${escapeHtml([...languages].join('|'))}">
50
+ <header class="repo-header">
51
+ <div>
52
+ <a class="repo-name" href="https://github.com/${escapeHtml(repo)}">
53
+ <img src="https://github.com/${escapeHtml(owner)}.png" alt="" width="28" height="28" />
54
+ ${escapeHtml(repo)}
55
+ </a>
56
+ ${first.repo_description ? `<p>${escapeHtml(first.repo_description)}</p>` : ''}
57
+ </div>
58
+ <div class="repo-stats">
59
+ <span>${first.repo_stars.toLocaleString()} stars</span>
60
+ <span>${sorted.length} PR${sorted.length === 1 ? '' : 's'}</span>
61
+ </div>
62
+ </header>
63
+ <div class="contribution-list">
64
+ ${sorted.map(renderContributionCard).join('')}
65
+ </div>
66
+ </section>`;
67
+ }
68
+ export function renderContributionCard(contribution) {
69
+ const description = renderRichDescription(contribution.pr_body);
70
+ const repoDescription = cleanDescription(contribution.repo_description, 160);
71
+ const labels = contribution.labels.slice(0, 4);
72
+ const language = contribution.language ?? 'Unknown';
73
+ const reviewers = contribution.reviewers?.slice(0, 5) ?? [];
74
+ const reviewHtml = reviewers.length > 0
75
+ ? `<div class="reviewed-by">
76
+ <span>Approved by</span>
77
+ <div class="reviewers">${reviewers
78
+ .map((reviewer) => `<a href="https://github.com/${escapeHtml(reviewer.login)}" title="${escapeHtml(reviewer.login)}"><img src="${escapeHtml(reviewer.avatar_url)}" alt="${escapeHtml(reviewer.login)}" width="24" height="24" /></a>`)
79
+ .join('')}</div>
80
+ </div>`
81
+ : contribution.merged_by
82
+ ? `<div class="reviewed-by">
83
+ <span>Merged by</span>
84
+ <a class="merged-by" href="https://github.com/${escapeHtml(contribution.merged_by)}">@${escapeHtml(contribution.merged_by)}</a>
85
+ </div>`
86
+ : '';
87
+ return `<article class="contribution" data-title="${escapeHtml(contribution.pr_title)}" data-language="${escapeHtml(language)}">
88
+ <div class="contribution-main">
89
+ <a class="pr-title" href="${escapeHtml(contribution.pr_url)}">${escapeHtml(contribution.pr_title)}</a>
90
+ ${description ? `<div class="description">${description}</div>` : repoDescription ? `<p class="description-fallback">${escapeHtml(repoDescription)}</p>` : ''}
91
+ </div>
92
+ ${reviewHtml}
93
+ <div class="meta-row">
94
+ <span><strong>Merged</strong>${escapeHtml(formatDate(contribution.merged_at))}</span>
95
+ <span><strong>Language</strong>${escapeHtml(language)}</span>
96
+ <span><strong>Changes</strong>+${contribution.additions.toLocaleString()} / -${contribution.deletions.toLocaleString()}</span>
97
+ <span><strong>Files</strong>${contribution.files_changed.toLocaleString()}</span>
98
+ </div>
99
+ ${labels.length > 0
100
+ ? `<div class="labels">${labels
101
+ .map((label) => `<span>${escapeHtml(label)}</span>`)
102
+ .join('')}</div>`
103
+ : ''}
104
+ </article>`;
105
+ }
106
+ export function renderMainContent(grouped) {
107
+ return `<main class="shell">
108
+ <div id="results">
109
+ ${grouped.map(([repo, contributions]) => renderRepositorySection(repo, contributions)).join('')}
110
+ </div>
111
+ <div class="empty" id="empty" hidden>No matching contributions.</div>
112
+ </main>`;
113
+ }
114
+ export function renderFooter(updatedAt) {
115
+ return `<footer>
116
+ <div class="shell">
117
+ Updated ${escapeHtml(formatDate(updatedAt))}. Data available in <a href="contributions.json">contributions.json</a>.
118
+ </div>
119
+ </footer>`;
120
+ }
121
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../../src/repo/site/components.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,UAAU,CAAC,WAAwB,EAAE,KAAgB;IACnE,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,CAAC;IAE7D,OAAO;;;;0DAIiD,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,UAAU,CAAC,WAAW,CAAC;;oBAE3G,UAAU,CAAC,WAAW,CAAC;2CACA,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACpG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,kBAAkB,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;;;;wCAIlD,KAAK,CAAC,kBAAkB,CAAC,cAAc,EAAE;wCACzC,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE;wCACpC,KAAK,CAAC,cAAc,CAAC,cAAc,EAAE;;;;cAI/D,CAAC;AACf,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,SAAiC;IAC7D,MAAM,OAAO,GACX,SAAS,CAAC,MAAM,KAAK,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U,CAAC,SAAS,CAAC,CAAC;;cAErC,CAAC;AACf,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { EnrichedContribution } from '../../types/index.js';
2
+ export interface SiteStats {
3
+ totalContributions: number;
4
+ totalProjects: number;
5
+ totalLanguages: number;
6
+ languages: Array<{
7
+ name: string;
8
+ count: number;
9
+ }>;
10
+ }
11
+ export declare function escapeHtml(value: string | number | null | undefined): string;
12
+ export declare function cleanDescription(value: string | null | undefined, maxLength?: number): string;
13
+ export declare function renderRichDescription(value: string | null | undefined, maxLength?: number): string;
14
+ export declare function formatDate(value: string): string;
15
+ export declare function calculateStats(contributions: EnrichedContribution[]): SiteStats;
16
+ export declare function groupByRepository(contributions: EnrichedContribution[]): Array<[string, EnrichedContribution[]]>;
17
+ //# sourceMappingURL=utils.d.ts.map