gitannals 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,318 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ meta.lang }}">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>{{ persona.name }} · {{ t('ui.author.title_suffix') }}</title>
7
+ <style>
8
+ {% include "_style.css.j2" %}
9
+
10
+ /* hero 里的标签药丸 */
11
+ .tags{display:flex;gap:8px;flex-wrap:wrap;margin-top:18px}
12
+ .tag{
13
+ font-size:12px;padding:4px 12px;border-radius:999px;
14
+ background:rgba(93,202,165,.14);color:#5DCAA5;letter-spacing:.02em
15
+ }
16
+
17
+ /* 占比条 */
18
+ .sharebar{display:flex;height:14px;border-radius:7px;overflow:hidden;
19
+ background:rgba(22,21,26,.07);margin:20px 0 12px}
20
+ .sharebar .me{background:var(--ink);opacity:.8}
21
+ .sharebar .rest{background:rgba(22,21,26,.13)}
22
+ .sharekey{display:flex;justify-content:space-between;font-size:12px;color:var(--faint)}
23
+
24
+ /* 作息 */
25
+ .rhythm-stats{display:flex;gap:34px;flex-wrap:wrap;margin-top:22px}
26
+ .rhythm-stats div{font-size:12px;color:var(--faint)}
27
+ .rhythm-stats b{display:block;font-size:20px;font-family:var(--mono);color:var(--ink);font-weight:400}
28
+
29
+ /* 阶段参与 */
30
+ .phase{display:grid;grid-template-columns:1fr 96px;gap:14px;padding:12px 0;
31
+ border-bottom:1px solid rgba(230,226,217,.75);align-items:center}
32
+ .phase:last-child{border-bottom:0}
33
+ .phase-name{font-size:13.5px}
34
+ .phase-name em{font-style:normal;display:block;font-size:11.5px;color:var(--faint);font-family:var(--mono)}
35
+ .phase-num{font-family:var(--mono);font-size:12px;color:var(--muted);text-align:right}
36
+ .ptrack{height:4px;border-radius:2px;background:rgba(22,21,26,.06);margin-top:7px;overflow:hidden}
37
+ .ptrack span{display:block;height:100%;background:var(--ink);opacity:.55}
38
+ .phase-note{margin-top:8px;font-size:13px;line-height:1.7;color:var(--muted);font-family:var(--serif)}
39
+ .phase.absent .phase-name{color:var(--faint)}
40
+ .phase.absent .ptrack span{opacity:.12}
41
+
42
+ /* 主战场 */
43
+ .cols{display:grid;grid-template-columns:1fr 1fr;gap:26px}
44
+ .coltitle{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--faint);margin-bottom:10px}
45
+ .frow{display:flex;justify-content:space-between;gap:12px;font-size:12.5px;padding:6px 0;
46
+ border-bottom:1px solid rgba(230,226,217,.6)}
47
+ .frow:last-child{border-bottom:0}
48
+ .frow code{font-family:var(--mono);font-size:12px;color:var(--muted);overflow:hidden;
49
+ text-overflow:ellipsis;white-space:nowrap}
50
+ .frow b{font-family:var(--mono);font-weight:400;font-size:12px;color:var(--faint);flex:0 0 auto}
51
+
52
+ /* 提交构成 */
53
+ .kind{display:grid;grid-template-columns:74px 1fr 52px;gap:12px;align-items:center;padding:5px 0}
54
+ .kind span:first-child{font-size:12.5px;color:var(--muted)}
55
+ .ktrack{height:6px;border-radius:3px;background:rgba(22,21,26,.06);overflow:hidden}
56
+ .ktrack i{display:block;height:100%;background:var(--ink);opacity:.45;border-radius:3px}
57
+ .kind b{font-family:var(--mono);font-size:12px;color:var(--faint);font-weight:400;text-align:right}
58
+
59
+ /* 同路人 */
60
+ .prow{display:flex;align-items:center;gap:14px;padding:9px 0}
61
+ .pname{flex:0 0 170px;font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
62
+ .pshare{flex:0 0 58px;text-align:right;font-family:var(--mono);font-size:12px;color:var(--muted)}
63
+ .pbar{flex:1;height:4px;background:rgba(22,21,26,.06);border-radius:2px;overflow:hidden}
64
+ .pbar span{display:block;height:100%;background:var(--ink);opacity:.5}
65
+
66
+ /* 彩蛋 */
67
+ .facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}
68
+ .fact{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:20px;
69
+ display:flex;flex-direction:column}
70
+ .fact dt{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--warm)}
71
+ .fact dd{margin:10px 0 0;font-size:13.5px;line-height:1.7}
72
+ .fact .val{font-family:var(--mono);font-size:12px;color:var(--faint);display:block;
73
+ margin-top:auto;padding-top:10px}
74
+ .fact .comment{margin-top:10px;padding-top:10px;border-top:1px dashed var(--line);
75
+ font-size:12.5px;color:var(--muted);font-style:italic}
76
+
77
+ @media (max-width:720px){
78
+ .cols{grid-template-columns:1fr;gap:20px}
79
+ .phase{grid-template-columns:1fr}
80
+ .phase-num{text-align:left}
81
+ }
82
+ </style>
83
+ </head>
84
+ <body>
85
+
86
+ <header class="hero">
87
+ <div class="wrap">
88
+ <div class="eyebrow">{{ t('author.eyebrow') }}</div>
89
+ <h1>{{ persona.name }}</h1>
90
+ <p class="quote">{{ quote }}</p>
91
+ <div class="tags">
92
+ {% for tag in persona.tags %}<span class="tag">{{ tag.label }}</span>{% endfor %}
93
+ </div>
94
+ <dl class="stats">
95
+ <div class="stat"><dt>{{ t('ui.stat.commits') }}</dt><dd>{{ persona.commits | num }}</dd></div>
96
+ <div class="stat"><dt>{{ t('ui.stat.share_of_repo') }}</dt><dd>{{ persona.share }}<small>%</small></dd></div>
97
+ <div class="stat"><dt>{{ t('ui.stat.added') }}</dt><dd style="color:#5DCAA5">{{ persona.insertions | signnum('+') }}</dd></div>
98
+ <div class="stat"><dt>{{ t('ui.stat.removed') }}</dt><dd style="color:#F0997B">{{ persona.deletions | signnum('−') }}</dd></div>
99
+ <div class="stat"><dt>{{ t('ui.stat.active_days') }}</dt><dd>{{ persona.active_days }}<small>/{{ persona.span_days }}</small></dd></div>
100
+ </dl>
101
+ <div class="hero-actions">
102
+ <button class="btn" id="export-card" type="button">{{ t('ui.export.btn') }}</button>
103
+ <span class="btn-note" id="export-note">{{ meta.repo.name }} · 720 × 1080</span>
104
+ </div>
105
+ </div>
106
+ </header>
107
+
108
+ <main class="wrap">
109
+
110
+ <section class="section" id="position">
111
+ <div class="eyebrow">{{ t('ui.author.s1.eyebrow') }}</div>
112
+ <h2>{{ t('author.position') }}</h2>
113
+ <p class="lead">{{ persona.verdict }}</p>
114
+ <div class="block" style="margin-top:22px">
115
+ <div class="sharebar">
116
+ <span class="me" style="width:{{ persona.share }}%"></span>
117
+ <span class="rest" style="width:{{ 100 - persona.share }}%"></span>
118
+ </div>
119
+ <div class="sharekey">
120
+ <span>{{ t('ui.author.mine', name=persona.name, n=persona.commits) }}</span>
121
+ <span>{{ t('ui.author.others', n=persona.repo_commits - persona.commits) }}</span>
122
+ </div>
123
+ <div class="dirs" style="margin-top:24px">
124
+ <span class="dchip">{{ t('ui.author.first_commit', d=persona.first_commit_at[:10]) }}</span>
125
+ <span class="dchip">{{ t('ui.author.last_commit', d=persona.last_commit_at[:10]) }}</span>
126
+ <span class="dchip">{{ t('ui.author.per_active_day', v=persona.avg_commits_per_active_day) }}</span>
127
+ <span class="dchip">{{ t('ui.author.net', n=persona.net) }}</span>
128
+ </div>
129
+ </div>
130
+ </section>
131
+
132
+ <section class="section" id="rhythm">
133
+ <div class="eyebrow">{{ t('ui.author.s2.eyebrow') }}</div>
134
+ <h2>{{ t('author.rhythm') }}</h2>
135
+ <p class="lead">{{ t('ui.author.rhythm_lead') }}</p>
136
+ <div class="block" style="margin-top:22px">
137
+ {{ svg_heatmap }}
138
+ <div class="rhythm-stats">
139
+ <div>{{ t('ui.rhythm.night') }}<b>{{ persona.night_ratio }}%</b></div>
140
+ <div>{{ t('ui.rhythm.weekend') }}<b>{{ persona.weekend_ratio }}%</b></div>
141
+ <div>{{ t('ui.author.most_often') }}<b>{{ '%02d' % persona.peak_hour }}:00</b></div>
142
+ <div>{{ t('ui.author.streak') }}<b>{{ t('ui.days', n=persona.streak_days) }}</b></div>
143
+ </div>
144
+ </div>
145
+ </section>
146
+
147
+ <section class="section" id="cadence">
148
+ <div class="eyebrow">{{ t('ui.author.s3.eyebrow') }}</div>
149
+ <h2>{{ t('author.cadence') }}</h2>
150
+ <p class="lead">{{ t('ui.author.cadence_lead') }}</p>
151
+ <div class="block" style="margin-top:22px">
152
+ {{ svg_commit_bars }}
153
+ <div class="caption">
154
+ {{ t('ui.author.longest_gap', n=persona.longest_gap_days) }}
155
+ {{ t('ui.author.busiest', d=persona.busiest_day, n=persona.busiest_day_commits) }}
156
+ </div>
157
+ </div>
158
+ </section>
159
+
160
+ <section class="section" id="phases">
161
+ <div class="eyebrow">{{ t('ui.author.s4.eyebrow') }}</div>
162
+ <h2>{{ t('author.chapters') }}</h2>
163
+ <p class="lead">{{ t('ui.author.phases_lead') }}</p>
164
+ <div class="block" style="margin-top:22px">
165
+ {% for phase in chapters %}
166
+ <div class="phase {{ 'absent' if phase.absent }}">
167
+ <div>
168
+ <div class="phase-name">{{ phase.title }}<em>{{ phase.start }} → {{ phase.end }}</em></div>
169
+ <div class="ptrack"><span style="width:{{ phase.share }}%"></span></div>
170
+ {% if phase.note %}<p class="phase-note">{{ phase.note }}</p>{% endif %}
171
+ </div>
172
+ <div class="phase-num">
173
+ {% if phase.absent %}{{ t('author.absent') }}
174
+ {% else %}{{ phase.commits }}/{{ phase.chapter_commits }}<br><span style="color:var(--faint)">{{ phase.share }}%</span>{% endif %}
175
+ </div>
176
+ </div>
177
+ {% endfor %}
178
+ </div>
179
+ </section>
180
+
181
+ <section class="section" id="footprint">
182
+ <div class="eyebrow">{{ t('ui.author.s5.eyebrow') }}</div>
183
+ <h2>{{ t('author.footprint') }}</h2>
184
+ <div class="block" style="margin-top:22px">
185
+ <div class="cols">
186
+ <div>
187
+ <div class="coltitle">{{ t('ui.author.dirs') }}</div>
188
+ {% for item in persona.top_dirs %}
189
+ <div class="frow"><code>{{ item.name }}</code><b>{{ item.churn | num }}</b></div>
190
+ {% endfor %}
191
+ </div>
192
+ <div>
193
+ <div class="coltitle">{{ t('ui.author.files') }}</div>
194
+ {% for item in persona.top_files %}
195
+ <div class="frow"><code>{{ item.path }}</code><b>{{ item.churn | num }}</b></div>
196
+ {% endfor %}
197
+ </div>
198
+ </div>
199
+ </div>
200
+ </section>
201
+
202
+ <section class="section" id="kinds">
203
+ <div class="eyebrow">{{ t('ui.author.s6.eyebrow') }}</div>
204
+ <h2>{{ t('author.kinds') }}</h2>
205
+ <div class="block" style="margin-top:22px">
206
+ {% for item in persona.kind_mix %}
207
+ <div class="kind">
208
+ <span>{{ kind_label.get(item.kind, item.kind) }}</span>
209
+ <span class="ktrack"><i style="width:{{ item.share }}%"></i></span>
210
+ <b>{{ item.share }}%</b>
211
+ </div>
212
+ {% endfor %}
213
+ </div>
214
+ </section>
215
+
216
+ {% if peers %}
217
+ <section class="section" id="peers">
218
+ <div class="eyebrow">{{ t('ui.author.s7.eyebrow') }}</div>
219
+ <h2>{{ t('author.peers') }}</h2>
220
+ <p class="lead">{{ t('author.peers.note') }}</p>
221
+ <div class="block" style="margin-top:22px">
222
+ {% for peer in peers %}
223
+ <div class="prow">
224
+ <span class="pname" title="{{ peer.email }}">{{ peer.name }}</span>
225
+ <span class="pbar"><span style="width:{{ peer.overlap }}%"></span></span>
226
+ <span class="pshare">{{ t('ui.author.shared_files', n=peer.shared_files) }}</span>
227
+ </div>
228
+ {% endfor %}
229
+ </div>
230
+ </section>
231
+ {% endif %}
232
+
233
+ <section class="section" id="facts">
234
+ <div class="eyebrow">{{ t('ui.author.s8.eyebrow') }}</div>
235
+ <h2>{{ t('author.facts') }}</h2>
236
+ <div class="facts" style="margin-top:22px">
237
+ {% for fact in fun_facts %}
238
+ <dl class="fact">
239
+ <dt>{{ fact.title }}</dt>
240
+ <dd>{{ fact.detail }}<span class="val">{{ fact.value }}</span>
241
+ {% if fact.comment %}<div class="comment">{{ fact.comment }}</div>{% endif %}
242
+ </dd>
243
+ </dl>
244
+ {% endfor %}
245
+ </div>
246
+ </section>
247
+
248
+ {% if warnings %}
249
+ <div class="notice">
250
+ {% for w in warnings %}<div>· {{ w }}</div>{% endfor %}
251
+ </div>
252
+ {% endif %}
253
+
254
+ <footer>
255
+ <span>{{ t('ui.footer.generated', v=meta.version, d=meta.generated_at[:19].replace('T', ' ')) }}</span>
256
+ <span>{{ meta.repo.name }} · {{ meta.repo.branch or '' }}</span>
257
+ </footer>
258
+ </main>
259
+
260
+ <div hidden aria-hidden="true">{{ svg_share_card }}</div>
261
+
262
+ <script>
263
+ (function () {
264
+ var btn = document.getElementById('export-card');
265
+ var note = document.getElementById('export-note');
266
+ if (!btn) return;
267
+
268
+ btn.addEventListener('click', function () {
269
+ var svg = document.getElementById('share-card');
270
+ if (!svg) return;
271
+ note.textContent = '{{ t('ui.export.generating') }}';
272
+
273
+ var clone = svg.cloneNode(true);
274
+ clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
275
+ var source = new XMLSerializer().serializeToString(clone);
276
+
277
+ // 两条通道:blob 优先,data URL 兜底。某些浏览器在 file:// 下会污染 canvas
278
+ var candidates = [
279
+ URL.createObjectURL(new Blob([source], { type: 'image/svg+xml;charset=utf-8' })),
280
+ 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(source)
281
+ ];
282
+
283
+ function attempt(index) {
284
+ if (index >= candidates.length) {
285
+ note.textContent = '{{ t('ui.export.blocked') }}';
286
+ return;
287
+ }
288
+ var image = new Image();
289
+ image.onload = function () {
290
+ try {
291
+ var canvas = document.createElement('canvas');
292
+ canvas.width = 1440;
293
+ canvas.height = 2160;
294
+ var ctx = canvas.getContext('2d');
295
+ ctx.scale(2, 2);
296
+ ctx.drawImage(image, 0, 0, 720, 1080);
297
+ canvas.toBlob(function (blob) {
298
+ if (!blob) { attempt(index + 1); return; }
299
+ var link = document.createElement('a');
300
+ link.download = 'annals-author-card.png';
301
+ link.href = URL.createObjectURL(blob);
302
+ link.click();
303
+ setTimeout(function () { URL.revokeObjectURL(link.href); }, 4000);
304
+ note.textContent = '{{ t('ui.export.done', name='annals-author-card.png') }}';
305
+ }, 'image/png');
306
+ } catch (err) {
307
+ attempt(index + 1);
308
+ }
309
+ };
310
+ image.onerror = function () { attempt(index + 1); };
311
+ image.src = candidates[index];
312
+ }
313
+ attempt(0);
314
+ });
315
+ })();
316
+ </script>
317
+ </body>
318
+ </html>