@georgepxto/github-activity 0.0.0-stage → 0.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.
@@ -0,0 +1,352 @@
1
+ import { getMonthLabels, getStats, normalize } from './data.js';
2
+ import { fill, labelsFor } from './i18n.js';
3
+ import { styles } from './styles.js';
4
+ const TAG = 'github-activity';
5
+ const WAVE = 1100;
6
+ const COUNT = 1300;
7
+ const EASE = 'cubic-bezier(.2, .7, .2, 1)';
8
+ const USERNAME = /^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i;
9
+ const Base = (typeof HTMLElement === 'undefined' ? class {
10
+ } : HTMLElement);
11
+ const escape = (value) => value.replace(/[&<>"']/g, (character) => `&#${character.charCodeAt(0)};`);
12
+ const toDate = (value) => new Date(`${value}T00:00:00Z`);
13
+ let sharedSheet;
14
+ const adoptStyles = (shadow) => {
15
+ try {
16
+ if (!sharedSheet) {
17
+ sharedSheet = new CSSStyleSheet();
18
+ sharedSheet.replaceSync(styles);
19
+ }
20
+ shadow.adoptedStyleSheets = [sharedSheet];
21
+ }
22
+ catch {
23
+ const style = document.createElement('style');
24
+ style.textContent = styles;
25
+ shadow.append(style);
26
+ }
27
+ };
28
+ const resolveLocale = (value) => {
29
+ if (!value)
30
+ return null;
31
+ try {
32
+ return Intl.getCanonicalLocales(value)[0] ?? null;
33
+ }
34
+ catch {
35
+ return null;
36
+ }
37
+ };
38
+ const halves = (weeks) => {
39
+ const split = Math.ceil(weeks.length / 2);
40
+ return { split, parts: [weeks.slice(0, split), weeks.slice(split)].filter((part) => part.length > 0) };
41
+ };
42
+ export class GitHubActivity extends Base {
43
+ static observedAttributes = ['src', 'locale', 'username', 'hide', 'animation'];
44
+ #data = null;
45
+ #labels;
46
+ #root;
47
+ #controller;
48
+ #observer;
49
+ #animated = false;
50
+ constructor() {
51
+ super();
52
+ const shadow = this.attachShadow({ mode: 'open' });
53
+ adoptStyles(shadow);
54
+ this.#root = document.createElement('div');
55
+ this.#root.className = 'root';
56
+ this.#root.setAttribute('part', 'root');
57
+ shadow.append(this.#root);
58
+ }
59
+ get data() {
60
+ return this.#data;
61
+ }
62
+ set data(value) {
63
+ this.#controller?.abort();
64
+ if (value === null || value === undefined) {
65
+ this.#data = null;
66
+ this.removeAttribute('state');
67
+ this.#render();
68
+ return;
69
+ }
70
+ try {
71
+ this.#accept(normalize(value));
72
+ }
73
+ catch (error) {
74
+ this.#fail(error);
75
+ }
76
+ }
77
+ get labels() {
78
+ return this.#labels;
79
+ }
80
+ set labels(value) {
81
+ this.#labels = value;
82
+ this.#render();
83
+ }
84
+ connectedCallback() {
85
+ this.#upgrade('data');
86
+ this.#upgrade('labels');
87
+ if (this.#data) {
88
+ this.#render();
89
+ return;
90
+ }
91
+ if (document.readyState === 'loading') {
92
+ document.addEventListener('DOMContentLoaded', () => this.#initialize(), { once: true });
93
+ return;
94
+ }
95
+ this.#initialize();
96
+ }
97
+ disconnectedCallback() {
98
+ this.#controller?.abort();
99
+ this.#observer?.disconnect();
100
+ this.#observer = undefined;
101
+ }
102
+ attributeChangedCallback(name, previous, value) {
103
+ if (previous === value)
104
+ return;
105
+ if (name === 'src') {
106
+ if (value && this.isConnected)
107
+ void this.#load(value);
108
+ return;
109
+ }
110
+ if (this.#data)
111
+ this.#render();
112
+ }
113
+ reload() {
114
+ const src = this.getAttribute('src');
115
+ return src ? this.#load(src) : Promise.resolve();
116
+ }
117
+ #upgrade(property) {
118
+ if (!Object.prototype.hasOwnProperty.call(this, property))
119
+ return;
120
+ const self = this;
121
+ const value = self[property];
122
+ delete self[property];
123
+ self[property] = value;
124
+ }
125
+ #initialize() {
126
+ if (this.#data || !this.isConnected)
127
+ return;
128
+ const inline = this.querySelector(':scope > script[type="application/json"]');
129
+ if (inline?.textContent?.trim()) {
130
+ try {
131
+ this.data = JSON.parse(inline.textContent);
132
+ }
133
+ catch (error) {
134
+ this.#fail(error);
135
+ }
136
+ return;
137
+ }
138
+ const src = this.getAttribute('src');
139
+ if (src)
140
+ void this.#load(src);
141
+ }
142
+ async #load(src) {
143
+ this.#controller?.abort();
144
+ const controller = new AbortController();
145
+ this.#controller = controller;
146
+ this.setAttribute('state', 'loading');
147
+ try {
148
+ const response = await fetch(new URL(src, document.baseURI), {
149
+ signal: controller.signal,
150
+ headers: { Accept: 'application/json' },
151
+ });
152
+ if (!response.ok)
153
+ throw new Error(`HTTP ${response.status}`);
154
+ const json = await response.json();
155
+ if (controller.signal.aborted)
156
+ return;
157
+ this.#accept(normalize(json));
158
+ this.dispatchEvent(new CustomEvent('load', { detail: this.#data }));
159
+ }
160
+ catch (error) {
161
+ if (controller.signal.aborted)
162
+ return;
163
+ this.#fail(error);
164
+ }
165
+ }
166
+ #accept(data) {
167
+ this.#data = data;
168
+ this.#animated = false;
169
+ this.setAttribute('state', 'ready');
170
+ this.#render();
171
+ }
172
+ #fail(error) {
173
+ this.#data = null;
174
+ this.setAttribute('state', 'error');
175
+ this.#render();
176
+ this.dispatchEvent(new CustomEvent('error', { detail: error }));
177
+ }
178
+ #locale() {
179
+ return (resolveLocale(this.getAttribute('locale')) ??
180
+ resolveLocale(this.closest('[lang]')?.getAttribute('lang')) ??
181
+ resolveLocale(navigator.language) ??
182
+ 'en');
183
+ }
184
+ #render() {
185
+ this.#observer?.disconnect();
186
+ this.#observer = undefined;
187
+ const data = this.#data;
188
+ if (!data) {
189
+ this.#root.innerHTML = '';
190
+ return;
191
+ }
192
+ const locale = this.#locale();
193
+ const labels = labelsFor(locale, this.#labels);
194
+ const hidden = new Set((this.getAttribute('hide') ?? '').toLowerCase().split(/\s+/));
195
+ const number = new Intl.NumberFormat(locale);
196
+ const plurals = new Intl.PluralRules(locale);
197
+ const longDate = new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeZone: 'UTC' });
198
+ const mediumDate = new Intl.DateTimeFormat(locale, { dateStyle: 'medium', timeZone: 'UTC' });
199
+ const monthFormat = new Intl.DateTimeFormat(locale, { month: 'short', timeZone: 'UTC' });
200
+ const weekdayFormat = new Intl.DateTimeFormat(locale, { weekday: 'long', timeZone: 'UTC' });
201
+ const monthNames = Array.from({ length: 12 }, (_, month) => monthFormat.format(Date.UTC(2000, month, 1)).replace(/\.$/, ''));
202
+ const counted = (value, forms) => `${number.format(value)} ${plurals.select(value) === 'one' ? forms.one : forms.other}`;
203
+ const { weeks } = data;
204
+ const stats = getStats(weeks);
205
+ const { split, parts } = halves(weeks);
206
+ const firstDay = weeks[0].days[0];
207
+ const lastWeek = weeks[weeks.length - 1];
208
+ const lastDay = lastWeek.days[lastWeek.days.length - 1];
209
+ const username = this.getAttribute('username');
210
+ const profile = username && USERNAME.test(username) ? `https://github.com/${username}` : 'https://github.com';
211
+ const summary = fill(labels.summary, {
212
+ count: counted(stats.total, labels.contributions),
213
+ from: longDate.format(toDate(firstDay.date)),
214
+ to: longDate.format(toDate(lastDay.date)),
215
+ });
216
+ const describe = (count, date) => {
217
+ const when = longDate.format(toDate(date));
218
+ return count === 0
219
+ ? fill(labels.noneOn, { date: when })
220
+ : fill(labels.countOn, { count: counted(count, labels.contributions), date: when });
221
+ };
222
+ const months = (range, className) => hidden.has('months')
223
+ ? ''
224
+ : `<div class="months ${className}" part="months" aria-hidden="true">${getMonthLabels(range)
225
+ .map((label) => `<span style="grid-column: ${label.column + 1}">${escape(monthNames[label.month])}</span>`)
226
+ .join('')}</div>`;
227
+ const cells = (range, first) => range
228
+ .flatMap((week, column) => week.days.map((day, index) => {
229
+ const offset = first && column === 0 && index === 0 && day.weekday > 0 ? ` style="grid-row-start: ${day.weekday + 1}"` : '';
230
+ return `<span class="cell" part="cell" data-level="${day.level}" title="${escape(describe(day.count, day.date))}"${offset}></span>`;
231
+ }))
232
+ .join('');
233
+ const statItems = [
234
+ { label: labels.total, value: number.format(stats.total), count: stats.total },
235
+ {
236
+ label: labels.streak,
237
+ value: counted(stats.longestStreak, labels.days),
238
+ count: stats.longestStreak,
239
+ forms: labels.days,
240
+ },
241
+ {
242
+ label: labels.busiest,
243
+ value: stats.busiestWeekday === null ? '—' : weekdayFormat.format(Date.UTC(2023, 0, 1 + stats.busiestWeekday)),
244
+ },
245
+ ];
246
+ const statsHtml = hidden.has('stats')
247
+ ? ''
248
+ : `<dl class="stats" part="stats">${statItems
249
+ .map((item) => {
250
+ const countAttrs = item.count === undefined
251
+ ? ''
252
+ : ` data-count="${item.count}"${item.forms ? ` data-one="${escape(item.forms.one)}" data-other="${escape(item.forms.other)}"` : ''}`;
253
+ return `<div class="stat" part="stat"><dt>${escape(item.label)}</dt><dd${countAttrs}>${escape(item.value)}</dd></div>`;
254
+ })
255
+ .join('')}</dl>`;
256
+ const range = fill(labels.range, {
257
+ from: mediumDate.format(toDate(firstDay.date)),
258
+ to: mediumDate.format(toDate(lastDay.date)),
259
+ });
260
+ const caption = hidden.has('caption')
261
+ ? ''
262
+ : `<p class="caption" part="caption">${escape(range)} · <span class="source">${escape(labels.source)}: <a href="${escape(profile)}" target="_blank" rel="noopener noreferrer">GitHub</a></span></p>`;
263
+ const legend = hidden.has('legend')
264
+ ? ''
265
+ : `<div class="legend" part="legend" aria-hidden="true"><span>${escape(labels.less)}</span><span class="swatches">${[0, 1, 2, 3, 4]
266
+ .map((level) => `<span class="cell" data-level="${level}"></span>`)
267
+ .join('')}</span><span>${escape(labels.more)}</span></div>`;
268
+ const meta = caption || legend ? `<div class="meta">${caption}${legend}</div>` : '';
269
+ this.#root.innerHTML = `${statsHtml}<div class="activity" style="--weeks: ${weeks.length}; --split: ${split}">
270
+ <div class="canvas" part="graph" role="img" aria-label="${escape(summary)}">
271
+ ${months(weeks, 'months-full')}
272
+ ${parts
273
+ .map((part, index) => `<div class="half" style="--span: ${part.length}">${months(part, 'months-half')}<div class="grid">${cells(part, index === 0)}</div></div>`)
274
+ .join('')}
275
+ </div>
276
+ ${meta}
277
+ </div>`;
278
+ this.#prepareAnimation(locale);
279
+ }
280
+ #prepareAnimation(locale) {
281
+ if (this.#animated ||
282
+ this.getAttribute('animation') === 'none' ||
283
+ matchMedia('(prefers-reduced-motion: reduce)').matches ||
284
+ typeof Element.prototype.animate !== 'function') {
285
+ this.#animated = true;
286
+ return;
287
+ }
288
+ const canvas = this.#root.querySelector('.canvas');
289
+ if (!canvas)
290
+ return;
291
+ canvas.classList.add('pending');
292
+ const run = () => {
293
+ this.#animated = true;
294
+ this.#wave(canvas);
295
+ this.#countUp(locale);
296
+ canvas.classList.remove('pending');
297
+ };
298
+ if (!('IntersectionObserver' in window)) {
299
+ run();
300
+ return;
301
+ }
302
+ this.#observer = new IntersectionObserver((entries) => {
303
+ if (!entries.some((entry) => entry.isIntersecting))
304
+ return;
305
+ this.#observer?.disconnect();
306
+ this.#observer = undefined;
307
+ run();
308
+ }, { rootMargin: '0px 0px -10% 0px' });
309
+ this.#observer.observe(this);
310
+ }
311
+ #wave(canvas) {
312
+ const box = canvas.getBoundingClientRect();
313
+ if (!box.width)
314
+ return;
315
+ canvas.querySelectorAll('.grid .cell').forEach((cell) => {
316
+ const rect = cell.getBoundingClientRect();
317
+ if (!rect.width)
318
+ return;
319
+ const animation = cell.animate([
320
+ { opacity: 0, transform: 'scale(.3)' },
321
+ { opacity: 1, transform: 'none' },
322
+ ], { duration: 420, delay: ((rect.left - box.left) / box.width) * WAVE, easing: EASE, fill: 'backwards' });
323
+ animation.finished.then(() => animation.cancel()).catch(() => { });
324
+ });
325
+ }
326
+ #countUp(locale) {
327
+ const number = new Intl.NumberFormat(locale);
328
+ const plurals = new Intl.PluralRules(locale);
329
+ this.#root.querySelectorAll('dd[data-count]').forEach((element) => {
330
+ const target = Number(element.dataset.count);
331
+ if (!Number.isFinite(target) || target <= 0)
332
+ return;
333
+ const { one, other } = element.dataset;
334
+ const render = (value) => {
335
+ const unit = one && other ? ` ${plurals.select(value) === 'one' ? one : other}` : '';
336
+ element.textContent = `${number.format(value)}${unit}`;
337
+ };
338
+ const start = performance.now();
339
+ const tick = () => {
340
+ const progress = Math.min(1, Math.max(0, (performance.now() - start) / COUNT));
341
+ render(Math.round(target * (1 - (1 - progress) ** 3)));
342
+ if (progress < 1 && element.isConnected)
343
+ requestAnimationFrame(tick);
344
+ };
345
+ render(0);
346
+ requestAnimationFrame(tick);
347
+ });
348
+ }
349
+ }
350
+ if (typeof customElements !== 'undefined' && !customElements.get(TAG)) {
351
+ customElements.define(TAG, GitHubActivity);
352
+ }
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ export interface Plural {
2
+ one: string;
3
+ other: string;
4
+ }
5
+ export interface Labels {
6
+ total: string;
7
+ streak: string;
8
+ busiest: string;
9
+ less: string;
10
+ more: string;
11
+ source: string;
12
+ contributions: Plural;
13
+ days: Plural;
14
+ noneOn: string;
15
+ countOn: string;
16
+ summary: string;
17
+ range: string;
18
+ }
19
+ export declare const dictionaries: Record<string, Labels>;
20
+ export declare const labelsFor: (locale: string, overrides?: Partial<Labels>) => Labels;
21
+ export declare const fill: (template: string, values: Record<string, string>) => string;
package/dist/i18n.js ADDED
@@ -0,0 +1,48 @@
1
+ const en = {
2
+ total: 'Contributions',
3
+ streak: 'Longest streak',
4
+ busiest: 'Most active day',
5
+ less: 'Less',
6
+ more: 'More',
7
+ source: 'Source',
8
+ contributions: { one: 'contribution', other: 'contributions' },
9
+ days: { one: 'day', other: 'days' },
10
+ noneOn: 'No contributions on {date}',
11
+ countOn: '{count} on {date}',
12
+ summary: '{count} on GitHub from {from} to {to}',
13
+ range: '{from} – {to}',
14
+ };
15
+ const pt = {
16
+ total: 'Contribuições',
17
+ streak: 'Maior sequência',
18
+ busiest: 'Dia mais ativo',
19
+ less: 'Menos',
20
+ more: 'Mais',
21
+ source: 'Fonte',
22
+ contributions: { one: 'contribuição', other: 'contribuições' },
23
+ days: { one: 'dia', other: 'dias' },
24
+ noneOn: 'Nenhuma contribuição em {date}',
25
+ countOn: '{count} em {date}',
26
+ summary: '{count} no GitHub de {from} a {to}',
27
+ range: '{from} a {to}',
28
+ };
29
+ const es = {
30
+ total: 'Contribuciones',
31
+ streak: 'Racha más larga',
32
+ busiest: 'Día más activo',
33
+ less: 'Menos',
34
+ more: 'Más',
35
+ source: 'Fuente',
36
+ contributions: { one: 'contribución', other: 'contribuciones' },
37
+ days: { one: 'día', other: 'días' },
38
+ noneOn: 'Ninguna contribución el {date}',
39
+ countOn: '{count} el {date}',
40
+ summary: '{count} en GitHub del {from} al {to}',
41
+ range: '{from} – {to}',
42
+ };
43
+ export const dictionaries = { en, pt, es };
44
+ export const labelsFor = (locale, overrides) => {
45
+ const language = locale.toLowerCase().split('-')[0];
46
+ return { ...(dictionaries[language] ?? en), ...overrides };
47
+ };
48
+ export const fill = (template, values) => template.replace(/\{(\w+)\}/g, (match, key) => values[key] ?? match);
@@ -0,0 +1,3 @@
1
+ export { GitHubActivity, type ActivityState } from './github-activity.js';
2
+ export { getMonthLabels, getStats, normalize, type ContributionDay, type ContributionLevel, type ContributionStats, type ContributionWeek, type Contributions, type MonthLabel, } from './data.js';
3
+ export { dictionaries, type Labels, type Plural } from './i18n.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { GitHubActivity } from './github-activity.js';
2
+ export { getMonthLabels, getStats, normalize, } from './data.js';
3
+ export { dictionaries } from './i18n.js';
@@ -0,0 +1,2 @@
1
+ export { fetchContributions, type FetchContributionsOptions } from './fetch.js';
2
+ export { getMonthLabels, getStats, normalize, type ContributionDay, type ContributionLevel, type ContributionStats, type ContributionWeek, type Contributions, type MonthLabel, } from './data.js';
package/dist/server.js ADDED
@@ -0,0 +1,2 @@
1
+ export { fetchContributions } from './fetch.js';
2
+ export { getMonthLabels, getStats, normalize, } from './data.js';
@@ -0,0 +1 @@
1
+ export declare const styles = "\n :host {\n \n --_level-0: var(--gha-level-0, #eff2f5);\n --_accent: var(--gha-accent, #1f883d);\n --_text: var(--gha-text, #1f2328);\n --_muted: var(--gha-muted, #59636e);\n --_border: var(--gha-border, #d1d9e0);\n\n --_level-1: var(--gha-level-1, color-mix(in oklab, var(--_accent) 30%, var(--_level-0)));\n --_level-2: var(--gha-level-2, color-mix(in oklab, var(--_accent) 55%, var(--_level-0)));\n --_level-3: var(--gha-level-3, color-mix(in oklab, var(--_accent) 80%, var(--_level-0)));\n --_level-4: var(--gha-level-4, var(--_accent));\n --_gap: var(--gha-cell-gap, 3px);\n --_radius: var(--gha-cell-radius, 2px);\n --_cell-max: var(--gha-cell-max, 24px);\n display: block;\n container-type: inline-size;\n color: var(--_text);\n font: inherit;\n line-height: 1.5;\n }\n\n :host([theme='dark']) {\n \n --_level-0: var(--gha-level-0, #151b23);\n --_accent: var(--gha-accent, #39d353);\n --_text: var(--gha-text, #f0f6fc);\n --_muted: var(--gha-muted, #9198a1);\n --_border: var(--gha-border, #3d444d);\n\n }\n\n @media (prefers-color-scheme: dark) {\n :host(:not([theme='light'])) {\n \n --_level-0: var(--gha-level-0, #151b23);\n --_accent: var(--gha-accent, #39d353);\n --_text: var(--gha-text, #f0f6fc);\n --_muted: var(--gha-muted, #9198a1);\n --_border: var(--gha-border, #3d444d);\n\n }\n }\n\n :host([hidden]) {\n display: none;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n .root {\n display: flex;\n flex-direction: column;\n gap: 20px;\n }\n\n .stats {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n margin: 0;\n }\n\n .stat {\n min-width: 0;\n padding: 0 16px;\n }\n\n .stat:first-child {\n padding-left: 0;\n }\n\n .stat + .stat {\n border-left: 1px solid var(--_border);\n }\n\n dt {\n font-size: 12px;\n color: var(--_muted);\n }\n\n dd {\n margin: 4px 0 0;\n font-size: 24px;\n font-weight: 600;\n line-height: 1.25;\n letter-spacing: -0.01em;\n font-variant-numeric: tabular-nums;\n overflow-wrap: anywhere;\n }\n\n .activity {\n --columns: repeat(var(--weeks), minmax(0, var(--_cell-max)));\n width: fit-content;\n max-width: 100%;\n display: flex;\n flex-direction: column;\n gap: 16px;\n }\n\n .canvas {\n display: grid;\n grid-template-columns: var(--columns);\n column-gap: var(--_gap);\n row-gap: 8px;\n }\n\n .months {\n grid-column: 1 / -1;\n display: grid;\n grid-template-columns: subgrid;\n font-size: 12px;\n line-height: 1;\n color: var(--_muted);\n }\n\n .months span {\n grid-row: 1;\n white-space: nowrap;\n }\n\n .months-half {\n display: none;\n }\n\n .half {\n grid-column: span var(--span);\n display: grid;\n grid-template-columns: subgrid;\n row-gap: 8px;\n }\n\n .grid {\n grid-column: 1 / -1;\n display: grid;\n grid-template-columns: subgrid;\n grid-template-rows: repeat(7, auto);\n grid-auto-flow: column;\n row-gap: var(--_gap);\n }\n\n .cell {\n display: block;\n aspect-ratio: 1;\n border-radius: var(--_radius);\n background: var(--_level-0);\n }\n\n .cell[data-level='1'] {\n background: var(--_level-1);\n }\n\n .cell[data-level='2'] {\n background: var(--_level-2);\n }\n\n .cell[data-level='3'] {\n background: var(--_level-3);\n }\n\n .cell[data-level='4'] {\n background: var(--_level-4);\n }\n\n .pending .grid .cell {\n opacity: 0;\n }\n\n .meta {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 12px 32px;\n }\n\n .caption {\n margin: 0;\n font-size: 13px;\n color: var(--_muted);\n }\n\n .source {\n white-space: nowrap;\n }\n\n .caption a {\n color: var(--_text);\n text-decoration: underline;\n text-decoration-color: var(--_border);\n text-underline-offset: 4px;\n }\n\n .caption a:hover {\n text-decoration-color: currentColor;\n }\n\n .caption a:focus-visible {\n outline: 2px solid var(--_accent);\n outline-offset: 2px;\n border-radius: 2px;\n }\n\n .legend {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-left: auto;\n font-size: 12px;\n color: var(--_muted);\n }\n\n .swatches {\n display: flex;\n gap: var(--_gap);\n }\n\n .swatches .cell {\n width: 11px;\n }\n\n @container (max-width: 639px) {\n .canvas {\n grid-template-columns: repeat(var(--split), minmax(0, var(--_cell-max)));\n row-gap: 16px;\n }\n\n .months-full {\n display: none;\n }\n\n .months-half {\n display: grid;\n }\n\n .half {\n grid-column: 1 / -1;\n }\n }\n\n @container (max-width: 479px) {\n .stats {\n grid-template-columns: minmax(0, 1fr);\n gap: 12px;\n }\n\n .stat,\n .stat:first-child {\n padding: 0;\n }\n\n .stat + .stat {\n border-left: 0;\n border-top: 1px solid var(--_border);\n padding-top: 12px;\n }\n }\n";