github-contributions-ui 1.0.13 → 1.0.14

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.
package/dist/index.cjs CHANGED
@@ -86,15 +86,7 @@ function buildGrid(dayMap, year) {
86
86
  for (let d = 0; d < 7; d++) {
87
87
  const iso = cur.toISOString().slice(0, 10);
88
88
  if (cur > end) week.push(null);
89
- else {
90
- week.push(
91
- (_a = dayMap.get(iso)) != null ? _a : {
92
- date: iso,
93
- count: 0,
94
- level: 0
95
- }
96
- );
97
- }
89
+ else week.push((_a = dayMap.get(iso)) != null ? _a : { date: iso, count: 0, level: 0 });
98
90
  cur.setDate(cur.getDate() + 1);
99
91
  }
100
92
  weeks.push(week);
@@ -125,7 +117,7 @@ function Tooltip({ day, x, y }) {
125
117
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
126
118
  "div",
127
119
  {
128
- className: "fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white",
120
+ className: "gcu fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white",
129
121
  style: { left: x, top: y - 8 },
130
122
  children: [
131
123
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("b", { children: [
@@ -150,12 +142,30 @@ function Skeleton() {
150
142
  )) }, w)) });
151
143
  }
152
144
  function YearPill({ label, active, onClick }) {
145
+ const [hovered, setHovered] = (0, import_react.useState)(false);
146
+ const baseStyle = {
147
+ padding: "2px 10px",
148
+ fontSize: 12,
149
+ fontWeight: 500,
150
+ borderRadius: 9999,
151
+ border: "none",
152
+ cursor: "pointer",
153
+ transition: "background-color 0.15s ease, color 0.15s ease",
154
+ userSelect: "none",
155
+ outline: "none",
156
+ // Active = white pill with dark text
157
+ // Inactive = dark pill with muted text, slightly lighter on hover
158
+ backgroundColor: active ? "#ffffff" : hovered ? "#3f3f46" : "#262626",
159
+ color: active ? "#000000" : "#ffffff"
160
+ };
153
161
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
154
162
  "button",
155
163
  {
156
164
  type: "button",
157
165
  onClick,
158
- className: "px-3 py-1 text-[12px] font-medium rounded-full transition-colors duration-150 select-none focus:outline-none " + (active ? "bg-white text-black" : "bg-neutral-800 text-white"),
166
+ style: baseStyle,
167
+ onMouseEnter: () => setHovered(true),
168
+ onMouseLeave: () => setHovered(false),
159
169
  children: label
160
170
  }
161
171
  );
@@ -197,16 +207,11 @@ function GithubActivity({ username, theme = "dark", className }) {
197
207
  .gcu .pt-px{padding-top:1px}
198
208
  .gcu .pb-1{padding-bottom:0.25rem}
199
209
  .gcu .pr-1\\.5{padding-right:0.375rem}
200
- .gcu .px-2{padding-left:0.5rem;padding-right:0.5rem}
201
210
  .gcu .px-2\\.5{padding-left:0.625rem;padding-right:0.625rem}
202
- .gcu .py-1{padding-top:0.25rem;padding-bottom:0.25rem}
203
211
  .gcu .py-1\\.5{padding-top:0.375rem;padding-bottom:0.375rem}
204
- .gcu .py-0\\.5{padding-top:0.125rem;padding-bottom:0.125rem}
205
212
  .gcu .rounded-\\[2px\\]{border-radius:2px}
206
213
  .gcu .rounded-\\[3px\\]{border-radius:3px}
207
- .gcu .rounded{border-radius:0.25rem}
208
214
  .gcu .rounded-md{border-radius:0.375rem}
209
- .gcu .rounded-full{border-radius:9999px}
210
215
  .gcu .rounded-xl{border-radius:0.75rem}
211
216
  .gcu .text-right{text-align:right}
212
217
  .gcu .text-\\[10px\\]{font-size:10px}
@@ -223,26 +228,16 @@ function GithubActivity({ username, theme = "dark", className }) {
223
228
  .gcu .border-neutral-800{border-color:#262626}
224
229
  .gcu .border-t{border-top-width:1px;border-top-style:solid;border-top-color:#262626}
225
230
  .gcu .transition-transform{transition-property:transform;transition-duration:0.1s;transition-timing-function:ease}
226
- .gcu .transition-colors{transition-property:color,background-color,border-color;transition-duration:0.15s;transition-timing-function:ease}
227
- .gcu .duration-150{transition-duration:0.15s}
228
231
  @keyframes gcu-pulse{50%{opacity:.5}}
229
232
  .gcu .animate-pulse{animation:gcu-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite}
230
233
  .gcu .hover\\:scale-125:hover{transform:scale(1.25)}
231
234
  .gcu .text-neutral-400{color:#9ca3af}
232
- .gcu .text-neutral-500{color:#6b7280}
233
235
  .gcu .text-neutral-200{color:#e5e7eb}
234
- .gcu .text-neutral-900{color:#171717}
235
- .gcu .text-neutral-700{color:#374151}
236
+ .gcu .bg-neutral-700{background-color:#3f3f46}
236
237
  .gcu .bg-neutral-900{background-color:#171717}
237
238
  .gcu .bg-neutral-950{background-color:#0a0a0a}
238
- .gcu .bg-neutral-700{background-color:#3f3f46}
239
- .gcu .bg-neutral-800{background-color:#262626}
240
239
  .gcu .text-white{color:#fff}
241
240
  .gcu .shadow-xl{box-shadow:0 20px 25px -5px rgba(0,0,0,0.1),0 10px 10px -5px rgba(0,0,0,0.04)}
242
- .gcu .bg-white{background-color:#ffffff}
243
- .gcu .text-black{color:#000000}
244
- .gcu .focus\\:outline-none:focus{outline:none}
245
- .gcu .bg-neutral-800{background-color:#262626}
246
241
  `;
247
242
  (0, import_react.useEffect)(() => {
248
243
  if (typeof document === "undefined") return;
@@ -322,130 +317,130 @@ function GithubActivity({ username, theme = "dark", className }) {
322
317
  );
323
318
  const labels = (0, import_react.useMemo)(() => monthLabels(grid), [grid]);
324
319
  const outlineColor = theme === "light" ? "#333" : "#f0f0f0";
325
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: ["gcu w-full font-mono", className].join(" ").trim(), children: [
326
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-400", children: [
327
- loading ? "Loading\u2026" : error ? "Unavailable" : `${total == null ? void 0 : total.toLocaleString()} contributions ${selectedYear === "last" ? "in the last year" : `in ${selectedYear}`}`,
328
- bestDay && !loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex items-center gap-1.5", children: [
329
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
330
- "span",
331
- {
332
- className: "inline-block w-[10px] h-[10px] rounded-[2px]",
333
- style: { backgroundColor: colors[4] }
334
- }
335
- ),
336
- "Best day:",
337
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "text-neutral-200 font-semibold", children: [
338
- bestDay.count,
339
- " contributions on ",
340
- bestDay.date
341
- ] })
342
- ] })
343
- ] }),
344
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border border-neutral-800 rounded-xl p-4 bg-neutral-950", children: error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm italic text-neutral-400", children: "GitHub activity unavailable." }) : loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
345
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "overflow-x-auto pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
346
- "div",
347
- {
348
- className: "relative",
349
- style: {
350
- minWidth: grid.length * STEP + DAY_COL_W + 8
351
- },
352
- children: [
320
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
321
+ "section",
322
+ {
323
+ className: ["gcu w-full font-mono", className].filter(Boolean).join(" "),
324
+ children: [
325
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-400", children: [
326
+ loading ? "Loading\u2026" : error ? "Unavailable" : `${total == null ? void 0 : total.toLocaleString()} contributions ${selectedYear === "last" ? "in the last year" : `in ${selectedYear}`}`,
327
+ bestDay && !loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex items-center gap-1.5", children: [
353
328
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
354
- "div",
329
+ "span",
355
330
  {
356
- className: "relative h-[18px] mb-1",
357
- style: { marginLeft: DAY_COL_W },
358
- children: labels.map(({ label, col }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
359
- "span",
360
- {
361
- className: "absolute text-[11px] text-neutral-400",
362
- style: { left: col * STEP },
363
- children: label
364
- },
365
- label + col
366
- ))
331
+ className: "inline-block w-[10px] h-[10px] rounded-[2px]",
332
+ style: { backgroundColor: colors[4] }
367
333
  }
368
334
  ),
369
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-[3px]", children: [
370
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
371
- "div",
372
- {
373
- className: "flex flex-col gap-[3px]",
374
- style: { width: DAY_COL_W - GAP },
375
- children: Array.from({ length: 7 }).map((_, i) => {
376
- var _a2;
377
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
378
- "div",
335
+ "Best day:",
336
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "text-neutral-200 font-semibold", children: [
337
+ bestDay.count,
338
+ " contributions on ",
339
+ bestDay.date
340
+ ] })
341
+ ] })
342
+ ] }),
343
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border border-neutral-800 rounded-xl p-4 bg-neutral-950", children: error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-neutral-400 italic", children: "GitHub activity unavailable." }) : loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
344
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "overflow-x-auto pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
345
+ "div",
346
+ {
347
+ className: "relative",
348
+ style: { minWidth: grid.length * STEP + DAY_COL_W + 8 },
349
+ children: [
350
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
351
+ "div",
352
+ {
353
+ className: "relative h-[18px] mb-1",
354
+ style: { marginLeft: DAY_COL_W },
355
+ children: labels.map(({ label, col }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
356
+ "span",
379
357
  {
380
- className: "h-[13px] text-[10px] text-right pr-1.5 text-neutral-400",
381
- children: (_a2 = DAY_LABELS[i]) != null ? _a2 : ""
358
+ className: "absolute text-[11px] text-neutral-400",
359
+ style: { left: col * STEP },
360
+ children: label
382
361
  },
383
- i
384
- );
385
- })
386
- }
387
- ),
388
- grid.map((week, wi) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-[3px]", children: week.map((day, di) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
389
- "div",
390
- {
391
- className: "w-[13px] h-[13px] rounded-[3px] transition-transform hover:scale-125",
392
- style: {
393
- backgroundColor: day ? colors[day.level] : "transparent",
394
- outline: bestDay && (day == null ? void 0 : day.date) === bestDay.date ? `2px solid ${outlineColor}` : "none",
395
- outlineOffset: "1px"
396
- },
397
- onMouseEnter: (e) => {
398
- if (!day) return;
399
- const r = e.currentTarget.getBoundingClientRect();
400
- setTip({
401
- day,
402
- x: r.left + r.width / 2,
403
- y: r.top
404
- });
405
- },
406
- onMouseLeave: () => setTip(null)
407
- },
408
- di
409
- )) }, wi))
410
- ] })
411
- ]
412
- }
413
- ) }),
414
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1 mt-3 text-[11px] text-neutral-400", children: [
415
- "Less",
416
- colors.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
417
- "div",
418
- {
419
- className: "w-[13px] h-[13px] rounded-[3px]",
420
- style: { backgroundColor: c }
421
- },
422
- i
423
- )),
424
- "More"
425
- ] }),
426
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-800", children: [
427
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-[11px] text-neutral-400 mr-1", children: "Year:" }),
428
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
429
- YearPill,
430
- {
431
- label: "Last year",
432
- active: selectedYear === "last",
433
- onClick: () => setSelectedYear("last")
434
- }
435
- ),
436
- years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
437
- YearPill,
438
- {
439
- label: String(y),
440
- active: selectedYear === y,
441
- onClick: () => setSelectedYear(y)
442
- },
443
- y
444
- ))
445
- ] })
446
- ] }) }),
447
- tip && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, { day: tip.day, x: tip.x, y: tip.y })
448
- ] });
362
+ label + col
363
+ ))
364
+ }
365
+ ),
366
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-[3px]", children: [
367
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
368
+ "div",
369
+ {
370
+ className: "flex flex-col gap-[3px]",
371
+ style: { width: DAY_COL_W - GAP },
372
+ children: Array.from({ length: 7 }).map((_, i) => {
373
+ var _a2;
374
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
375
+ "div",
376
+ {
377
+ className: "h-[13px] text-[10px] text-right pr-1.5 text-neutral-400",
378
+ children: (_a2 = DAY_LABELS[i]) != null ? _a2 : ""
379
+ },
380
+ i
381
+ );
382
+ })
383
+ }
384
+ ),
385
+ grid.map((week, wi) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-[3px]", children: week.map((day, di) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
386
+ "div",
387
+ {
388
+ className: "w-[13px] h-[13px] rounded-[3px] transition-transform hover:scale-125",
389
+ style: {
390
+ backgroundColor: day ? colors[day.level] : "transparent",
391
+ outline: bestDay && (day == null ? void 0 : day.date) === bestDay.date ? `2px solid ${outlineColor}` : "none",
392
+ outlineOffset: "1px"
393
+ },
394
+ onMouseEnter: (e) => {
395
+ if (!day) return;
396
+ const r = e.currentTarget.getBoundingClientRect();
397
+ setTip({ day, x: r.left + r.width / 2, y: r.top });
398
+ },
399
+ onMouseLeave: () => setTip(null)
400
+ },
401
+ di
402
+ )) }, wi))
403
+ ] })
404
+ ]
405
+ }
406
+ ) }),
407
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-1 mt-3 text-[11px] text-neutral-400", children: [
408
+ "Less",
409
+ colors.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
410
+ "div",
411
+ {
412
+ className: "w-[13px] h-[13px] rounded-[3px]",
413
+ style: { backgroundColor: c }
414
+ },
415
+ i
416
+ )),
417
+ "More"
418
+ ] }),
419
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-800", children: [
420
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-[11px] text-neutral-400 mr-1", children: "Year:" }),
421
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
422
+ YearPill,
423
+ {
424
+ label: "Last year",
425
+ active: selectedYear === "last",
426
+ onClick: () => setSelectedYear("last")
427
+ }
428
+ ),
429
+ years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
430
+ YearPill,
431
+ {
432
+ label: String(y),
433
+ active: selectedYear === y,
434
+ onClick: () => setSelectedYear(y)
435
+ },
436
+ y
437
+ ))
438
+ ] })
439
+ ] }) }),
440
+ tip && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, { day: tip.day, x: tip.x, y: tip.y })
441
+ ]
442
+ }
443
+ );
449
444
  }
450
445
  var GithubActivity_default = (0, import_react.memo)(GithubActivity);
451
446
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/GithubActivity.tsx"],"sourcesContent":[" \"use client\";\n export { default as GithubActivity } from \"./GithubActivity\";\n","\"use client\";\r\n\r\nimport { memo, useEffect, useState, useMemo } from \"react\";\r\n\r\ntype Theme = \"light\" | \"dark\" | \"blue\" | \"purple\";\r\n\r\ninterface Day {\r\n date: string;\r\n count: number;\r\n level: 0 | 1 | 2 | 3 | 4;\r\n}\r\n\r\ninterface Props {\r\n username: string;\r\n theme?: Theme;\r\n className?: string;\r\n}\r\n\r\nconst MONTHS = [\r\n \"Jan\",\r\n \"Feb\",\r\n \"Mar\",\r\n \"Apr\",\r\n \"May\",\r\n \"Jun\",\r\n \"Jul\",\r\n \"Aug\",\r\n \"Sep\",\r\n \"Oct\",\r\n \"Nov\",\r\n \"Dec\",\r\n];\r\n\r\nconst DAY_LABELS: Record<number, string> = { 1: \"Mon\", 3: \"Wed\", 5: \"Fri\" };\r\n\r\nconst CELL = 13;\r\nconst GAP = 3;\r\nconst STEP = CELL + GAP;\r\nconst DAY_COL_W = 30;\r\n\r\nconst LIGHT = [\"#ebedf0\", \"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"];\r\nconst DARK = [\"#21262d\", \"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"];\r\nconst BLUE = [\"#21262d\", \"#a3c9ff\", \"#5fa3ff\", \"#2f7bff\", \"#0b5cff\"];\r\nconst PURPLE = [\"#21262d\", \"#d8b4ff\", \"#c084fc\", \"#a855f7\", \"#7e22ce\"];\r\n\r\nconst COLOR_MAP: Record<Theme, string[]> = {\r\n light: LIGHT,\r\n dark: DARK,\r\n blue: BLUE,\r\n purple: PURPLE,\r\n};\r\n\r\nfunction toLevel(count: number): 0 | 1 | 2 | 3 | 4 {\r\n if (count === 0) return 0;\r\n if (count <= 3) return 1;\r\n if (count <= 6) return 2;\r\n if (count <= 9) return 3;\r\n return 4;\r\n}\r\n\r\nfunction buildGrid(\r\n dayMap: Map<string, Day>,\r\n year: number | \"last\",\r\n): (Day | null)[][] {\r\n let start: Date;\r\n let end: Date;\r\n\r\n if (year === \"last\") {\r\n end = new Date();\r\n start = new Date(end);\r\n start.setFullYear(start.getFullYear() - 1);\r\n start.setDate(start.getDate() + 1);\r\n } else {\r\n start = new Date(year, 0, 1);\r\n end =\r\n year === new Date().getFullYear() ? new Date() : new Date(year, 11, 31);\r\n }\r\n\r\n start.setDate(start.getDate() - start.getDay());\r\n\r\n const weeks: (Day | null)[][] = [];\r\n const cur = new Date(start);\r\n\r\n while (cur <= end) {\r\n const week: (Day | null)[] = [];\r\n\r\n for (let d = 0; d < 7; d++) {\r\n const iso = cur.toISOString().slice(0, 10);\r\n\r\n if (cur > end) week.push(null);\r\n else {\r\n week.push(\r\n dayMap.get(iso) ?? {\r\n date: iso,\r\n count: 0,\r\n level: 0,\r\n },\r\n );\r\n }\r\n\r\n cur.setDate(cur.getDate() + 1);\r\n }\r\n\r\n weeks.push(week);\r\n }\r\n\r\n return weeks;\r\n}\r\n\r\nfunction monthLabels(grid: (Day | null)[][]) {\r\n const out: { label: string; col: number }[] = [];\r\n let last = -1;\r\n\r\n grid.forEach((week, i) => {\r\n const first = week.find(Boolean);\r\n if (!first) return;\r\n\r\n const m = new Date(first.date).getMonth();\r\n\r\n if (m !== last) {\r\n out.push({ label: MONTHS[m], col: i });\r\n last = m;\r\n }\r\n });\r\n\r\n return out;\r\n}\r\n\r\nfunction Tooltip({ day, x, y }: { day: Day; x: number; y: number }) {\r\n const label = new Date(day.date).toLocaleDateString(\"en-US\", {\r\n weekday: \"long\",\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n });\r\n\r\n return (\r\n <div\r\n className=\"fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white\"\r\n style={{ left: x, top: y - 8 }}\r\n >\r\n <b>\r\n {day.count} contribution{day.count !== 1 ? \"s\" : \"\"}\r\n </b>{\" \"}\r\n · {label}\r\n </div>\r\n );\r\n}\r\n\r\nfunction Skeleton() {\r\n return (\r\n <div className=\"flex gap-[3px] animate-pulse opacity-40\">\r\n {Array.from({ length: 45 }).map((_, w) => (\r\n <div key={w} className=\"flex flex-col gap-[3px]\">\r\n {Array.from({ length: 7 }).map((_, d) => (\r\n <div\r\n key={d}\r\n className=\"w-[13px] h-[13px] rounded-[3px] bg-neutral-700\"\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\ntype YearPillProps = {\r\n label: string;\r\n active: boolean;\r\n onClick: () => void;\r\n};\r\n\r\n\r\nexport function YearPill({ label, active, onClick }: YearPillProps) {\r\n return (\r\n <button\r\n type=\"button\"\r\n onClick={onClick}\r\n className={\r\n \"px-3 py-1 text-[12px] font-medium rounded-full \" +\r\n \"transition-colors duration-150 select-none focus:outline-none \" +\r\n (active ? \"bg-white text-black\" : \"bg-neutral-800 text-white\")\r\n }\r\n >\r\n {label}\r\n </button>\r\n );\r\n}\r\n\r\nfunction GithubActivity({ username, theme = \"dark\", className }: Props) {\r\n const STYLES = `\r\n .gcu .relative{position:relative}\r\n .gcu .absolute{position:absolute}\r\n .gcu .fixed{position:fixed}\r\n .gcu .z-50{z-index:50}\r\n .gcu .pointer-events-none{pointer-events:none}\r\n .gcu .flex{display:flex}\r\n .gcu .flex-col{flex-direction:column}\r\n .gcu .flex-wrap{flex-wrap:wrap}\r\n .gcu .items-center{align-items:center}\r\n .gcu .justify-start{justify-content:flex-start}\r\n .gcu .inline-block{display:inline-block}\r\n .gcu .w-full{width:100%}\r\n .gcu .w-\\\\[10px\\\\]{width:10px}\r\n .gcu .w-\\\\[13px\\\\]{width:13px}\r\n .gcu .h-\\\\[10px\\\\]{height:10px}\r\n .gcu .h-\\\\[13px\\\\]{height:13px}\r\n .gcu .h-\\\\[18px\\\\]{height:18px}\r\n .gcu .-translate-x-1\\\\/2{transform:translateX(-50%)}\r\n .gcu .-translate-y-full{transform:translateY(-100%)}\r\n .gcu .gap-\\\\[3px\\\\]{gap:3px}\r\n .gcu .gap-1{gap:0.25rem}\r\n .gcu .gap-1\\\\.5{gap:0.375rem}\r\n .gcu .gap-x-6{column-gap:1.5rem}\r\n .gcu .gap-y-1{row-gap:0.25rem}\r\n .gcu .mb-4{margin-bottom:1rem}\r\n .gcu .mt-3{margin-top:0.75rem}\r\n .gcu .mt-4{margin-top:1rem}\r\n .gcu .mr-1{margin-right:0.25rem}\r\n .gcu .ml-1{margin-left:0.25rem}\r\n .gcu .p-4{padding:1rem}\r\n .gcu .pt-3{padding-top:0.75rem}\r\n .gcu .pt-px{padding-top:1px}\r\n .gcu .pb-1{padding-bottom:0.25rem}\r\n .gcu .pr-1\\\\.5{padding-right:0.375rem}\r\n .gcu .px-2{padding-left:0.5rem;padding-right:0.5rem}\r\n .gcu .px-2\\\\.5{padding-left:0.625rem;padding-right:0.625rem}\r\n .gcu .py-1{padding-top:0.25rem;padding-bottom:0.25rem}\r\n .gcu .py-1\\\\.5{padding-top:0.375rem;padding-bottom:0.375rem}\r\n .gcu .py-0\\\\.5{padding-top:0.125rem;padding-bottom:0.125rem}\r\n .gcu .rounded-\\\\[2px\\\\]{border-radius:2px}\r\n .gcu .rounded-\\\\[3px\\\\]{border-radius:3px}\r\n .gcu .rounded{border-radius:0.25rem}\r\n .gcu .rounded-md{border-radius:0.375rem}\r\n .gcu .rounded-full{border-radius:9999px}\r\n .gcu .rounded-xl{border-radius:0.75rem}\r\n .gcu .text-right{text-align:right}\r\n .gcu .text-\\\\[10px\\\\]{font-size:10px}\r\n .gcu .text-\\\\[11px\\\\]{font-size:11px}\r\n .gcu .text-xs{font-size:0.75rem}\r\n .gcu .text-sm{font-size:0.875rem}\r\n .gcu .font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace}\r\n .gcu .font-medium{font-weight:500}\r\n .gcu .font-semibold{font-weight:600}\r\n .gcu .select-none{-webkit-user-select:none;-ms-user-select:none;user-select:none}\r\n .gcu .whitespace-nowrap{white-space:nowrap}\r\n .gcu .overflow-x-auto{overflow-x:auto}\r\n .gcu .border{border-width:1px;border-style:solid;border-color:#262626}\r\n .gcu .border-neutral-800{border-color:#262626}\r\n .gcu .border-t{border-top-width:1px;border-top-style:solid;border-top-color:#262626}\r\n .gcu .transition-transform{transition-property:transform;transition-duration:0.1s;transition-timing-function:ease}\r\n .gcu .transition-colors{transition-property:color,background-color,border-color;transition-duration:0.15s;transition-timing-function:ease}\r\n .gcu .duration-150{transition-duration:0.15s}\r\n @keyframes gcu-pulse{50%{opacity:.5}}\r\n .gcu .animate-pulse{animation:gcu-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite}\r\n .gcu .hover\\\\:scale-125:hover{transform:scale(1.25)}\r\n .gcu .text-neutral-400{color:#9ca3af}\r\n .gcu .text-neutral-500{color:#6b7280}\r\n .gcu .text-neutral-200{color:#e5e7eb}\r\n .gcu .text-neutral-900{color:#171717}\r\n .gcu .text-neutral-700{color:#374151}\r\n .gcu .bg-neutral-900{background-color:#171717}\r\n .gcu .bg-neutral-950{background-color:#0a0a0a}\r\n .gcu .bg-neutral-700{background-color:#3f3f46}\r\n .gcu .bg-neutral-800{background-color:#262626}\r\n .gcu .text-white{color:#fff}\r\n .gcu .shadow-xl{box-shadow:0 20px 25px -5px rgba(0,0,0,0.1),0 10px 10px -5px rgba(0,0,0,0.04)}\r\n .gcu .bg-white{background-color:#ffffff}\r\n .gcu .text-black{color:#000000}\r\n .gcu .focus\\\\:outline-none:focus{outline:none}\r\n .gcu .bg-neutral-800{background-color:#262626}\r\n `;\r\n\r\n useEffect(() => {\r\n if (typeof document === \"undefined\") return;\r\n const id = \"github-contributions-ui-inline\";\r\n if (document.getElementById(id)) return;\r\n const style = document.createElement(\"style\");\r\n style.id = id;\r\n style.textContent = STYLES;\r\n document.head.appendChild(style);\r\n }, []);\r\n const [allDays, setAllDays] = useState<Map<string, Day>>(new Map());\r\n const [years, setYears] = useState<number[]>([]);\r\n const [selectedYear, setSelectedYear] = useState<number | \"last\">(\"last\");\r\n\r\n const [total, setTotal] = useState<number | null>(null);\r\n const [bestDay, setBestDay] = useState<Day | null>(null);\r\n\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(false);\r\n\r\n const [tip, setTip] = useState<{ day: Day; x: number; y: number } | null>(\r\n null,\r\n );\r\n\r\n const colors = COLOR_MAP[theme] ?? COLOR_MAP.dark;\r\n\r\n useEffect(() => {\r\n if (!username) return;\r\n\r\n let mounted = true;\r\n\r\n (async () => {\r\n try {\r\n setLoading(true);\r\n const res = await fetch(\r\n `https://github-contributions-api.jogruber.de/v4/${username}?y=all`,\r\n );\r\n\r\n if (!res.ok) throw new Error();\r\n\r\n const json = await res.json();\r\n\r\n const map = new Map<string, Day>();\r\n const yearSet = new Set<number>();\r\n\r\n json.contributions.forEach((c: any) => {\r\n map.set(c.date, {\r\n date: c.date,\r\n count: c.count,\r\n level: toLevel(c.count),\r\n });\r\n\r\n yearSet.add(new Date(c.date).getFullYear());\r\n });\r\n\r\n if (!mounted) return;\r\n\r\n setAllDays(map);\r\n setYears(Array.from(yearSet).sort((a, b) => b - a));\r\n setError(false);\r\n } catch {\r\n if (mounted) setError(true);\r\n } finally {\r\n if (mounted) setLoading(false);\r\n }\r\n })();\r\n\r\n return () => {\r\n mounted = false;\r\n };\r\n }, [username]);\r\n\r\n useEffect(() => {\r\n if (!allDays.size) return;\r\n\r\n const entries = Array.from(allDays.values()).filter((d) => {\r\n if (selectedYear === \"last\") {\r\n const oneYearAgo = new Date();\r\n oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);\r\n return new Date(d.date) >= oneYearAgo;\r\n }\r\n return new Date(d.date).getFullYear() === selectedYear;\r\n });\r\n\r\n setTotal(entries.reduce((s, d) => s + d.count, 0));\r\n\r\n const best = entries.reduce<Day | null>(\r\n (b, d) => (!b || d.count > b.count ? d : b),\r\n null,\r\n );\r\n\r\n setBestDay(best && best.count > 0 ? best : null);\r\n }, [allDays, selectedYear]);\r\n\r\n const grid = useMemo(\r\n () => (allDays.size ? buildGrid(allDays, selectedYear) : []),\r\n [allDays, selectedYear],\r\n );\r\n\r\n const labels = useMemo(() => monthLabels(grid), [grid]);\r\n\r\n const outlineColor = theme === \"light\" ? \"#333\" : \"#f0f0f0\";\r\n\r\n return (\r\n <section className={[\"gcu w-full font-mono\", className].join(\" \").trim()}>\r\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-400\">\r\n {loading\r\n ? \"Loading…\"\r\n : error\r\n ? \"Unavailable\"\r\n : `${total?.toLocaleString()} contributions ${\r\n selectedYear === \"last\"\r\n ? \"in the last year\"\r\n : `in ${selectedYear}`\r\n }`}\r\n\r\n {bestDay && !loading && (\r\n <span className=\"flex items-center gap-1.5\">\r\n <span\r\n className=\"inline-block w-[10px] h-[10px] rounded-[2px]\"\r\n style={{ backgroundColor: colors[4] }}\r\n />\r\n Best day:\r\n <span className=\"text-neutral-200 font-semibold\">\r\n {bestDay.count} contributions on {bestDay.date}\r\n </span>\r\n </span>\r\n )}\r\n </div>\r\n\r\n <div className=\"border border-neutral-800 rounded-xl p-4 bg-neutral-950\">\r\n {error ? (\r\n <p className=\"text-sm italic text-neutral-400\">\r\n GitHub activity unavailable.\r\n </p>\r\n ) : loading ? (\r\n <Skeleton />\r\n ) : (\r\n <>\r\n <div className=\"overflow-x-auto pb-1\">\r\n <div\r\n className=\"relative\"\r\n style={{\r\n minWidth: grid.length * STEP + DAY_COL_W + 8,\r\n }}\r\n >\r\n <div\r\n className=\"relative h-[18px] mb-1\"\r\n style={{ marginLeft: DAY_COL_W }}\r\n >\r\n {labels.map(({ label, col }) => (\r\n <span\r\n key={label + col}\r\n className=\"absolute text-[11px] text-neutral-400\"\r\n style={{ left: col * STEP }}\r\n >\r\n {label}\r\n </span>\r\n ))}\r\n </div>\r\n\r\n <div className=\"flex gap-[3px]\">\r\n <div\r\n className=\"flex flex-col gap-[3px]\"\r\n style={{ width: DAY_COL_W - GAP }}\r\n >\r\n {Array.from({ length: 7 }).map((_, i) => (\r\n <div\r\n key={i}\r\n className=\"h-[13px] text-[10px] text-right pr-1.5 text-neutral-400\"\r\n >\r\n {DAY_LABELS[i] ?? \"\"}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n {grid.map((week, wi) => (\r\n <div key={wi} className=\"flex flex-col gap-[3px]\">\r\n {week.map((day, di) => (\r\n <div\r\n key={di}\r\n className=\"w-[13px] h-[13px] rounded-[3px] transition-transform hover:scale-125\"\r\n style={{\r\n backgroundColor: day\r\n ? colors[day.level]\r\n : \"transparent\",\r\n outline:\r\n bestDay && day?.date === bestDay.date\r\n ? `2px solid ${outlineColor}`\r\n : \"none\",\r\n outlineOffset: \"1px\",\r\n }}\r\n onMouseEnter={(e) => {\r\n if (!day) return;\r\n const r = e.currentTarget.getBoundingClientRect();\r\n setTip({\r\n day,\r\n x: r.left + r.width / 2,\r\n y: r.top,\r\n });\r\n }}\r\n onMouseLeave={() => setTip(null)}\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex items-center gap-1 mt-3 text-[11px] text-neutral-400\">\r\n Less\r\n {colors.map((c, i) => (\r\n <div\r\n key={i}\r\n className=\"w-[13px] h-[13px] rounded-[3px]\"\r\n style={{ backgroundColor: c }}\r\n />\r\n ))}\r\n More\r\n </div>\r\n\r\n <div className=\"flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-800\">\r\n <span className=\"text-[11px] text-neutral-400 mr-1\">Year:</span>\r\n\r\n <YearPill\r\n label=\"Last year\"\r\n active={selectedYear === \"last\"}\r\n onClick={() => setSelectedYear(\"last\")}\r\n />\r\n\r\n {years.map((y) => (\r\n <YearPill\r\n key={y}\r\n label={String(y)}\r\n active={selectedYear === y}\r\n onClick={() => setSelectedYear(y)}\r\n />\r\n ))}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n\r\n {tip && <Tooltip day={tip.day} x={tip.x} y={tip.y} />}\r\n </section>\r\n );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EA,6CAAC,SAAI,WAAU,6EACb;AAAA,oDAAC,UAAK,WAAU,qCAAoC,mBAAK;AAAA,QAEzD;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,MAAM;AAAA;AAAA,QACvC;AAAA,QAEC,MAAM,IAAI,CAAC,MACV;AAAA,UAAC;AAAA;AAAA,YAEC,OAAO,OAAO,CAAC;AAAA,YACf,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,CAAC;AAAA;AAAA,UAH3B;AAAA,QAIP,CACD;AAAA,SACH;AAAA,OACF,GAEJ;AAAA,IAEC,OAAO,4CAAC,WAAQ,KAAK,IAAI,KAAK,GAAG,IAAI,GAAG,GAAG,IAAI,GAAG;AAAA,KACrD;AAEJ;AAEA,IAAO,6BAAQ,mBAAK,cAAc;","names":["_","_a"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/GithubActivity.tsx"],"sourcesContent":[" \"use client\";\n export { default as GithubActivity } from \"./GithubActivity\";\n","\"use client\";\r\n\r\nimport { memo, useEffect, useState, useMemo } from \"react\";\r\n\r\ntype Theme = \"light\" | \"dark\" | \"blue\" | \"purple\";\r\n\r\ninterface Day {\r\n date: string;\r\n count: number;\r\n level: 0 | 1 | 2 | 3 | 4;\r\n}\r\n\r\ninterface Props {\r\n username: string;\r\n theme?: Theme;\r\n className?: string;\r\n}\r\n\r\nconst MONTHS = [\r\n \"Jan\",\r\n \"Feb\",\r\n \"Mar\",\r\n \"Apr\",\r\n \"May\",\r\n \"Jun\",\r\n \"Jul\",\r\n \"Aug\",\r\n \"Sep\",\r\n \"Oct\",\r\n \"Nov\",\r\n \"Dec\",\r\n];\r\nconst DAY_LABELS: Record<number, string> = { 1: \"Mon\", 3: \"Wed\", 5: \"Fri\" };\r\n\r\nconst CELL = 13;\r\nconst GAP = 3;\r\nconst STEP = CELL + GAP;\r\nconst DAY_COL_W = 30;\r\n\r\nconst LIGHT = [\"#ebedf0\", \"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"];\r\nconst DARK = [\"#21262d\", \"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"];\r\nconst BLUE = [\"#21262d\", \"#a3c9ff\", \"#5fa3ff\", \"#2f7bff\", \"#0b5cff\"];\r\nconst PURPLE = [\"#21262d\", \"#d8b4ff\", \"#c084fc\", \"#a855f7\", \"#7e22ce\"];\r\n\r\nconst COLOR_MAP: Record<Theme, string[]> = {\r\n light: LIGHT,\r\n dark: DARK,\r\n blue: BLUE,\r\n purple: PURPLE,\r\n};\r\n\r\nfunction toLevel(count: number): 0 | 1 | 2 | 3 | 4 {\r\n if (count === 0) return 0;\r\n if (count <= 3) return 1;\r\n if (count <= 6) return 2;\r\n if (count <= 9) return 3;\r\n return 4;\r\n}\r\n\r\nfunction buildGrid(\r\n dayMap: Map<string, Day>,\r\n year: number | \"last\",\r\n): (Day | null)[][] {\r\n let start: Date;\r\n let end: Date;\r\n\r\n if (year === \"last\") {\r\n end = new Date();\r\n start = new Date(end);\r\n start.setFullYear(start.getFullYear() - 1);\r\n start.setDate(start.getDate() + 1);\r\n } else {\r\n start = new Date(year, 0, 1);\r\n end =\r\n year === new Date().getFullYear() ? new Date() : new Date(year, 11, 31);\r\n }\r\n\r\n start.setDate(start.getDate() - start.getDay());\r\n\r\n const weeks: (Day | null)[][] = [];\r\n const cur = new Date(start);\r\n\r\n while (cur <= end) {\r\n const week: (Day | null)[] = [];\r\n for (let d = 0; d < 7; d++) {\r\n const iso = cur.toISOString().slice(0, 10);\r\n if (cur > end) week.push(null);\r\n else week.push(dayMap.get(iso) ?? { date: iso, count: 0, level: 0 });\r\n cur.setDate(cur.getDate() + 1);\r\n }\r\n weeks.push(week);\r\n }\r\n return weeks;\r\n}\r\n\r\nfunction monthLabels(grid: (Day | null)[][]) {\r\n const out: { label: string; col: number }[] = [];\r\n let last = -1;\r\n grid.forEach((week, i) => {\r\n const first = week.find(Boolean);\r\n if (!first) return;\r\n const m = new Date(first.date).getMonth();\r\n if (m !== last) {\r\n out.push({ label: MONTHS[m], col: i });\r\n last = m;\r\n }\r\n });\r\n return out;\r\n}\r\n\r\nfunction Tooltip({ day, x, y }: { day: Day; x: number; y: number }) {\r\n const label = new Date(day.date).toLocaleDateString(\"en-US\", {\r\n weekday: \"long\",\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n });\r\n return (\r\n <div\r\n className=\"gcu fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white\"\r\n style={{ left: x, top: y - 8 }}\r\n >\r\n <b>\r\n {day.count} contribution{day.count !== 1 ? \"s\" : \"\"}\r\n </b>{\" \"}\r\n · {label}\r\n </div>\r\n );\r\n}\r\n\r\nfunction Skeleton() {\r\n return (\r\n <div className=\"flex gap-[3px] animate-pulse opacity-40\">\r\n {Array.from({ length: 45 }).map((_, w) => (\r\n <div key={w} className=\"flex flex-col gap-[3px]\">\r\n {Array.from({ length: 7 }).map((_, d) => (\r\n <div\r\n key={d}\r\n className=\"w-[13px] h-[13px] rounded-[3px] bg-neutral-700\"\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\n// ─── YearPill — fully inline styles, zero Tailwind dependency ─────────────────\r\ntype YearPillProps = { label: string; active: boolean; onClick: () => void };\r\n\r\nexport function YearPill({ label, active, onClick }: YearPillProps) {\r\n const [hovered, setHovered] = useState(false);\r\n\r\n const baseStyle: React.CSSProperties = {\r\n padding: \"2px 10px\",\r\n fontSize: 12,\r\n fontWeight: 500,\r\n borderRadius: 9999,\r\n border: \"none\",\r\n cursor: \"pointer\",\r\n transition: \"background-color 0.15s ease, color 0.15s ease\",\r\n userSelect: \"none\",\r\n outline: \"none\",\r\n // Active = white pill with dark text\r\n // Inactive = dark pill with muted text, slightly lighter on hover\r\n backgroundColor: active ? \"#ffffff\" : hovered ? \"#3f3f46\" : \"#262626\",\r\n color: active ? \"#000000\" : \"#ffffff\",\r\n };\r\n\r\n return (\r\n <button\r\n type=\"button\"\r\n onClick={onClick}\r\n style={baseStyle}\r\n onMouseEnter={() => setHovered(true)}\r\n onMouseLeave={() => setHovered(false)}\r\n >\r\n {label}\r\n </button>\r\n );\r\n}\r\n\r\n// ─── Main ─────────────────────────────────────────────────────────────────────\r\nfunction GithubActivity({ username, theme = \"dark\", className }: Props) {\r\n const STYLES = `\r\n .gcu .relative{position:relative}\r\n .gcu .absolute{position:absolute}\r\n .gcu .fixed{position:fixed}\r\n .gcu .z-50{z-index:50}\r\n .gcu .pointer-events-none{pointer-events:none}\r\n .gcu .flex{display:flex}\r\n .gcu .flex-col{flex-direction:column}\r\n .gcu .flex-wrap{flex-wrap:wrap}\r\n .gcu .items-center{align-items:center}\r\n .gcu .justify-start{justify-content:flex-start}\r\n .gcu .inline-block{display:inline-block}\r\n .gcu .w-full{width:100%}\r\n .gcu .w-\\\\[10px\\\\]{width:10px}\r\n .gcu .w-\\\\[13px\\\\]{width:13px}\r\n .gcu .h-\\\\[10px\\\\]{height:10px}\r\n .gcu .h-\\\\[13px\\\\]{height:13px}\r\n .gcu .h-\\\\[18px\\\\]{height:18px}\r\n .gcu .-translate-x-1\\\\/2{transform:translateX(-50%)}\r\n .gcu .-translate-y-full{transform:translateY(-100%)}\r\n .gcu .gap-\\\\[3px\\\\]{gap:3px}\r\n .gcu .gap-1{gap:0.25rem}\r\n .gcu .gap-1\\\\.5{gap:0.375rem}\r\n .gcu .gap-x-6{column-gap:1.5rem}\r\n .gcu .gap-y-1{row-gap:0.25rem}\r\n .gcu .mb-4{margin-bottom:1rem}\r\n .gcu .mt-3{margin-top:0.75rem}\r\n .gcu .mt-4{margin-top:1rem}\r\n .gcu .mr-1{margin-right:0.25rem}\r\n .gcu .ml-1{margin-left:0.25rem}\r\n .gcu .p-4{padding:1rem}\r\n .gcu .pt-3{padding-top:0.75rem}\r\n .gcu .pt-px{padding-top:1px}\r\n .gcu .pb-1{padding-bottom:0.25rem}\r\n .gcu .pr-1\\\\.5{padding-right:0.375rem}\r\n .gcu .px-2\\\\.5{padding-left:0.625rem;padding-right:0.625rem}\r\n .gcu .py-1\\\\.5{padding-top:0.375rem;padding-bottom:0.375rem}\r\n .gcu .rounded-\\\\[2px\\\\]{border-radius:2px}\r\n .gcu .rounded-\\\\[3px\\\\]{border-radius:3px}\r\n .gcu .rounded-md{border-radius:0.375rem}\r\n .gcu .rounded-xl{border-radius:0.75rem}\r\n .gcu .text-right{text-align:right}\r\n .gcu .text-\\\\[10px\\\\]{font-size:10px}\r\n .gcu .text-\\\\[11px\\\\]{font-size:11px}\r\n .gcu .text-xs{font-size:0.75rem}\r\n .gcu .text-sm{font-size:0.875rem}\r\n .gcu .font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace}\r\n .gcu .font-medium{font-weight:500}\r\n .gcu .font-semibold{font-weight:600}\r\n .gcu .select-none{-webkit-user-select:none;-ms-user-select:none;user-select:none}\r\n .gcu .whitespace-nowrap{white-space:nowrap}\r\n .gcu .overflow-x-auto{overflow-x:auto}\r\n .gcu .border{border-width:1px;border-style:solid;border-color:#262626}\r\n .gcu .border-neutral-800{border-color:#262626}\r\n .gcu .border-t{border-top-width:1px;border-top-style:solid;border-top-color:#262626}\r\n .gcu .transition-transform{transition-property:transform;transition-duration:0.1s;transition-timing-function:ease}\r\n @keyframes gcu-pulse{50%{opacity:.5}}\r\n .gcu .animate-pulse{animation:gcu-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite}\r\n .gcu .hover\\\\:scale-125:hover{transform:scale(1.25)}\r\n .gcu .text-neutral-400{color:#9ca3af}\r\n .gcu .text-neutral-200{color:#e5e7eb}\r\n .gcu .bg-neutral-700{background-color:#3f3f46}\r\n .gcu .bg-neutral-900{background-color:#171717}\r\n .gcu .bg-neutral-950{background-color:#0a0a0a}\r\n .gcu .text-white{color:#fff}\r\n .gcu .shadow-xl{box-shadow:0 20px 25px -5px rgba(0,0,0,0.1),0 10px 10px -5px rgba(0,0,0,0.04)}\r\n `;\r\n\r\n useEffect(() => {\r\n if (typeof document === \"undefined\") return;\r\n const id = \"github-contributions-ui-inline\";\r\n if (document.getElementById(id)) return;\r\n const style = document.createElement(\"style\");\r\n style.id = id;\r\n style.textContent = STYLES;\r\n document.head.appendChild(style);\r\n }, []);\r\n\r\n const [allDays, setAllDays] = useState<Map<string, Day>>(new Map());\r\n const [years, setYears] = useState<number[]>([]);\r\n const [selectedYear, setSelectedYear] = useState<number | \"last\">(\"last\");\r\n const [total, setTotal] = useState<number | null>(null);\r\n const [bestDay, setBestDay] = useState<Day | null>(null);\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(false);\r\n const [tip, setTip] = useState<{ day: Day; x: number; y: number } | null>(\r\n null,\r\n );\r\n\r\n const colors = COLOR_MAP[theme] ?? COLOR_MAP.dark;\r\n\r\n useEffect(() => {\r\n if (!username) return;\r\n let mounted = true;\r\n\r\n (async () => {\r\n try {\r\n setLoading(true);\r\n const res = await fetch(\r\n `https://github-contributions-api.jogruber.de/v4/${username}?y=all`,\r\n );\r\n if (!res.ok) throw new Error();\r\n const json = await res.json();\r\n\r\n const map = new Map<string, Day>();\r\n const yearSet = new Set<number>();\r\n\r\n json.contributions.forEach((c: { date: string; count: number }) => {\r\n map.set(c.date, {\r\n date: c.date,\r\n count: c.count,\r\n level: toLevel(c.count),\r\n });\r\n yearSet.add(new Date(c.date).getFullYear());\r\n });\r\n\r\n if (!mounted) return;\r\n setAllDays(map);\r\n setYears(Array.from(yearSet).sort((a, b) => b - a));\r\n setError(false);\r\n } catch {\r\n if (mounted) setError(true);\r\n } finally {\r\n if (mounted) setLoading(false);\r\n }\r\n })();\r\n\r\n return () => {\r\n mounted = false;\r\n };\r\n }, [username]);\r\n\r\n useEffect(() => {\r\n if (!allDays.size) return;\r\n\r\n const entries = Array.from(allDays.values()).filter((d) => {\r\n if (selectedYear === \"last\") {\r\n const oneYearAgo = new Date();\r\n oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);\r\n return new Date(d.date) >= oneYearAgo;\r\n }\r\n return new Date(d.date).getFullYear() === selectedYear;\r\n });\r\n\r\n setTotal(entries.reduce((s, d) => s + d.count, 0));\r\n const best = entries.reduce<Day | null>(\r\n (b, d) => (!b || d.count > b.count ? d : b),\r\n null,\r\n );\r\n setBestDay(best && best.count > 0 ? best : null);\r\n }, [allDays, selectedYear]);\r\n\r\n const grid = useMemo(\r\n () => (allDays.size ? buildGrid(allDays, selectedYear) : []),\r\n [allDays, selectedYear],\r\n );\r\n const labels = useMemo(() => monthLabels(grid), [grid]);\r\n const outlineColor = theme === \"light\" ? \"#333\" : \"#f0f0f0\";\r\n\r\n return (\r\n <section\r\n className={[\"gcu w-full font-mono\", className].filter(Boolean).join(\" \")}\r\n >\r\n {/* Stats */}\r\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-400\">\r\n {loading\r\n ? \"Loading…\"\r\n : error\r\n ? \"Unavailable\"\r\n : `${total?.toLocaleString()} contributions ${selectedYear === \"last\" ? \"in the last year\" : `in ${selectedYear}`}`}\r\n\r\n {bestDay && !loading && (\r\n <span className=\"flex items-center gap-1.5\">\r\n <span\r\n className=\"inline-block w-[10px] h-[10px] rounded-[2px]\"\r\n style={{ backgroundColor: colors[4] }}\r\n />\r\n Best day:\r\n <span className=\"text-neutral-200 font-semibold\">\r\n {bestDay.count} contributions on {bestDay.date}\r\n </span>\r\n </span>\r\n )}\r\n </div>\r\n\r\n {/* Card */}\r\n <div className=\"border border-neutral-800 rounded-xl p-4 bg-neutral-950\">\r\n {error ? (\r\n <p className=\"text-sm text-neutral-400 italic\">\r\n GitHub activity unavailable.\r\n </p>\r\n ) : loading ? (\r\n <Skeleton />\r\n ) : (\r\n <>\r\n <div className=\"overflow-x-auto pb-1\">\r\n <div\r\n className=\"relative\"\r\n style={{ minWidth: grid.length * STEP + DAY_COL_W + 8 }}\r\n >\r\n {/* Month labels */}\r\n <div\r\n className=\"relative h-[18px] mb-1\"\r\n style={{ marginLeft: DAY_COL_W }}\r\n >\r\n {labels.map(({ label, col }) => (\r\n <span\r\n key={label + col}\r\n className=\"absolute text-[11px] text-neutral-400\"\r\n style={{ left: col * STEP }}\r\n >\r\n {label}\r\n </span>\r\n ))}\r\n </div>\r\n\r\n {/* Grid */}\r\n <div className=\"flex gap-[3px]\">\r\n <div\r\n className=\"flex flex-col gap-[3px]\"\r\n style={{ width: DAY_COL_W - GAP }}\r\n >\r\n {Array.from({ length: 7 }).map((_, i) => (\r\n <div\r\n key={i}\r\n className=\"h-[13px] text-[10px] text-right pr-1.5 text-neutral-400\"\r\n >\r\n {DAY_LABELS[i] ?? \"\"}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n {grid.map((week, wi) => (\r\n <div key={wi} className=\"flex flex-col gap-[3px]\">\r\n {week.map((day, di) => (\r\n <div\r\n key={di}\r\n className=\"w-[13px] h-[13px] rounded-[3px] transition-transform hover:scale-125\"\r\n style={{\r\n backgroundColor: day\r\n ? colors[day.level]\r\n : \"transparent\",\r\n outline:\r\n bestDay && day?.date === bestDay.date\r\n ? `2px solid ${outlineColor}`\r\n : \"none\",\r\n outlineOffset: \"1px\",\r\n }}\r\n onMouseEnter={(e) => {\r\n if (!day) return;\r\n const r = e.currentTarget.getBoundingClientRect();\r\n setTip({ day, x: r.left + r.width / 2, y: r.top });\r\n }}\r\n onMouseLeave={() => setTip(null)}\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n {/* Legend */}\r\n <div className=\"flex items-center gap-1 mt-3 text-[11px] text-neutral-400\">\r\n Less\r\n {colors.map((c, i) => (\r\n <div\r\n key={i}\r\n className=\"w-[13px] h-[13px] rounded-[3px]\"\r\n style={{ backgroundColor: c }}\r\n />\r\n ))}\r\n More\r\n </div>\r\n\r\n {/* Year selector */}\r\n <div className=\"flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-800\">\r\n <span className=\"text-[11px] text-neutral-400 mr-1\">Year:</span>\r\n <YearPill\r\n label=\"Last year\"\r\n active={selectedYear === \"last\"}\r\n onClick={() => setSelectedYear(\"last\")}\r\n />\r\n {years.map((y) => (\r\n <YearPill\r\n key={y}\r\n label={String(y)}\r\n active={selectedYear === y}\r\n onClick={() => setSelectedYear(y)}\r\n />\r\n ))}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n\r\n {tip && <Tooltip day={tip.day} x={tip.x} y={tip.y} />}\r\n </section>\r\n );\r\n}\r\n\r\nexport default memo(GithubActivity);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAmD;AAwH7C;AAxGN,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,aAAqC,EAAE,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM;AAE1E,IAAM,OAAO;AACb,IAAM,MAAM;AACZ,IAAM,OAAO,OAAO;AACpB,IAAM,YAAY;AAElB,IAAM,QAAQ,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACpE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,SAAS,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AAErE,IAAM,YAAqC;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AACV;AAEA,SAAS,QAAQ,OAAkC;AACjD,MAAI,UAAU,EAAG,QAAO;AACxB,MAAI,SAAS,EAAG,QAAO;AACvB,MAAI,SAAS,EAAG,QAA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GED
@@ -61,15 +61,7 @@ function buildGrid(dayMap, year) {
61
61
  for (let d = 0; d < 7; d++) {
62
62
  const iso = cur.toISOString().slice(0, 10);
63
63
  if (cur > end) week.push(null);
64
- else {
65
- week.push(
66
- (_a = dayMap.get(iso)) != null ? _a : {
67
- date: iso,
68
- count: 0,
69
- level: 0
70
- }
71
- );
72
- }
64
+ else week.push((_a = dayMap.get(iso)) != null ? _a : { date: iso, count: 0, level: 0 });
73
65
  cur.setDate(cur.getDate() + 1);
74
66
  }
75
67
  weeks.push(week);
@@ -100,7 +92,7 @@ function Tooltip({ day, x, y }) {
100
92
  return /* @__PURE__ */ jsxs(
101
93
  "div",
102
94
  {
103
- className: "fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white",
95
+ className: "gcu fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white",
104
96
  style: { left: x, top: y - 8 },
105
97
  children: [
106
98
  /* @__PURE__ */ jsxs("b", { children: [
@@ -125,12 +117,30 @@ function Skeleton() {
125
117
  )) }, w)) });
126
118
  }
127
119
  function YearPill({ label, active, onClick }) {
120
+ const [hovered, setHovered] = useState(false);
121
+ const baseStyle = {
122
+ padding: "2px 10px",
123
+ fontSize: 12,
124
+ fontWeight: 500,
125
+ borderRadius: 9999,
126
+ border: "none",
127
+ cursor: "pointer",
128
+ transition: "background-color 0.15s ease, color 0.15s ease",
129
+ userSelect: "none",
130
+ outline: "none",
131
+ // Active = white pill with dark text
132
+ // Inactive = dark pill with muted text, slightly lighter on hover
133
+ backgroundColor: active ? "#ffffff" : hovered ? "#3f3f46" : "#262626",
134
+ color: active ? "#000000" : "#ffffff"
135
+ };
128
136
  return /* @__PURE__ */ jsx(
129
137
  "button",
130
138
  {
131
139
  type: "button",
132
140
  onClick,
133
- className: "px-3 py-1 text-[12px] font-medium rounded-full transition-colors duration-150 select-none focus:outline-none " + (active ? "bg-white text-black" : "bg-neutral-800 text-white"),
141
+ style: baseStyle,
142
+ onMouseEnter: () => setHovered(true),
143
+ onMouseLeave: () => setHovered(false),
134
144
  children: label
135
145
  }
136
146
  );
@@ -172,16 +182,11 @@ function GithubActivity({ username, theme = "dark", className }) {
172
182
  .gcu .pt-px{padding-top:1px}
173
183
  .gcu .pb-1{padding-bottom:0.25rem}
174
184
  .gcu .pr-1\\.5{padding-right:0.375rem}
175
- .gcu .px-2{padding-left:0.5rem;padding-right:0.5rem}
176
185
  .gcu .px-2\\.5{padding-left:0.625rem;padding-right:0.625rem}
177
- .gcu .py-1{padding-top:0.25rem;padding-bottom:0.25rem}
178
186
  .gcu .py-1\\.5{padding-top:0.375rem;padding-bottom:0.375rem}
179
- .gcu .py-0\\.5{padding-top:0.125rem;padding-bottom:0.125rem}
180
187
  .gcu .rounded-\\[2px\\]{border-radius:2px}
181
188
  .gcu .rounded-\\[3px\\]{border-radius:3px}
182
- .gcu .rounded{border-radius:0.25rem}
183
189
  .gcu .rounded-md{border-radius:0.375rem}
184
- .gcu .rounded-full{border-radius:9999px}
185
190
  .gcu .rounded-xl{border-radius:0.75rem}
186
191
  .gcu .text-right{text-align:right}
187
192
  .gcu .text-\\[10px\\]{font-size:10px}
@@ -198,26 +203,16 @@ function GithubActivity({ username, theme = "dark", className }) {
198
203
  .gcu .border-neutral-800{border-color:#262626}
199
204
  .gcu .border-t{border-top-width:1px;border-top-style:solid;border-top-color:#262626}
200
205
  .gcu .transition-transform{transition-property:transform;transition-duration:0.1s;transition-timing-function:ease}
201
- .gcu .transition-colors{transition-property:color,background-color,border-color;transition-duration:0.15s;transition-timing-function:ease}
202
- .gcu .duration-150{transition-duration:0.15s}
203
206
  @keyframes gcu-pulse{50%{opacity:.5}}
204
207
  .gcu .animate-pulse{animation:gcu-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite}
205
208
  .gcu .hover\\:scale-125:hover{transform:scale(1.25)}
206
209
  .gcu .text-neutral-400{color:#9ca3af}
207
- .gcu .text-neutral-500{color:#6b7280}
208
210
  .gcu .text-neutral-200{color:#e5e7eb}
209
- .gcu .text-neutral-900{color:#171717}
210
- .gcu .text-neutral-700{color:#374151}
211
+ .gcu .bg-neutral-700{background-color:#3f3f46}
211
212
  .gcu .bg-neutral-900{background-color:#171717}
212
213
  .gcu .bg-neutral-950{background-color:#0a0a0a}
213
- .gcu .bg-neutral-700{background-color:#3f3f46}
214
- .gcu .bg-neutral-800{background-color:#262626}
215
214
  .gcu .text-white{color:#fff}
216
215
  .gcu .shadow-xl{box-shadow:0 20px 25px -5px rgba(0,0,0,0.1),0 10px 10px -5px rgba(0,0,0,0.04)}
217
- .gcu .bg-white{background-color:#ffffff}
218
- .gcu .text-black{color:#000000}
219
- .gcu .focus\\:outline-none:focus{outline:none}
220
- .gcu .bg-neutral-800{background-color:#262626}
221
216
  `;
222
217
  useEffect(() => {
223
218
  if (typeof document === "undefined") return;
@@ -297,130 +292,130 @@ function GithubActivity({ username, theme = "dark", className }) {
297
292
  );
298
293
  const labels = useMemo(() => monthLabels(grid), [grid]);
299
294
  const outlineColor = theme === "light" ? "#333" : "#f0f0f0";
300
- return /* @__PURE__ */ jsxs("section", { className: ["gcu w-full font-mono", className].join(" ").trim(), children: [
301
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-400", children: [
302
- loading ? "Loading\u2026" : error ? "Unavailable" : `${total == null ? void 0 : total.toLocaleString()} contributions ${selectedYear === "last" ? "in the last year" : `in ${selectedYear}`}`,
303
- bestDay && !loading && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
304
- /* @__PURE__ */ jsx(
305
- "span",
306
- {
307
- className: "inline-block w-[10px] h-[10px] rounded-[2px]",
308
- style: { backgroundColor: colors[4] }
309
- }
310
- ),
311
- "Best day:",
312
- /* @__PURE__ */ jsxs("span", { className: "text-neutral-200 font-semibold", children: [
313
- bestDay.count,
314
- " contributions on ",
315
- bestDay.date
316
- ] })
317
- ] })
318
- ] }),
319
- /* @__PURE__ */ jsx("div", { className: "border border-neutral-800 rounded-xl p-4 bg-neutral-950", children: error ? /* @__PURE__ */ jsx("p", { className: "text-sm italic text-neutral-400", children: "GitHub activity unavailable." }) : loading ? /* @__PURE__ */ jsx(Skeleton, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
320
- /* @__PURE__ */ jsx("div", { className: "overflow-x-auto pb-1", children: /* @__PURE__ */ jsxs(
321
- "div",
322
- {
323
- className: "relative",
324
- style: {
325
- minWidth: grid.length * STEP + DAY_COL_W + 8
326
- },
327
- children: [
295
+ return /* @__PURE__ */ jsxs(
296
+ "section",
297
+ {
298
+ className: ["gcu w-full font-mono", className].filter(Boolean).join(" "),
299
+ children: [
300
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-400", children: [
301
+ loading ? "Loading\u2026" : error ? "Unavailable" : `${total == null ? void 0 : total.toLocaleString()} contributions ${selectedYear === "last" ? "in the last year" : `in ${selectedYear}`}`,
302
+ bestDay && !loading && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
328
303
  /* @__PURE__ */ jsx(
329
- "div",
304
+ "span",
330
305
  {
331
- className: "relative h-[18px] mb-1",
332
- style: { marginLeft: DAY_COL_W },
333
- children: labels.map(({ label, col }) => /* @__PURE__ */ jsx(
334
- "span",
335
- {
336
- className: "absolute text-[11px] text-neutral-400",
337
- style: { left: col * STEP },
338
- children: label
339
- },
340
- label + col
341
- ))
306
+ className: "inline-block w-[10px] h-[10px] rounded-[2px]",
307
+ style: { backgroundColor: colors[4] }
342
308
  }
343
309
  ),
344
- /* @__PURE__ */ jsxs("div", { className: "flex gap-[3px]", children: [
345
- /* @__PURE__ */ jsx(
346
- "div",
347
- {
348
- className: "flex flex-col gap-[3px]",
349
- style: { width: DAY_COL_W - GAP },
350
- children: Array.from({ length: 7 }).map((_, i) => {
351
- var _a2;
352
- return /* @__PURE__ */ jsx(
353
- "div",
310
+ "Best day:",
311
+ /* @__PURE__ */ jsxs("span", { className: "text-neutral-200 font-semibold", children: [
312
+ bestDay.count,
313
+ " contributions on ",
314
+ bestDay.date
315
+ ] })
316
+ ] })
317
+ ] }),
318
+ /* @__PURE__ */ jsx("div", { className: "border border-neutral-800 rounded-xl p-4 bg-neutral-950", children: error ? /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-400 italic", children: "GitHub activity unavailable." }) : loading ? /* @__PURE__ */ jsx(Skeleton, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
319
+ /* @__PURE__ */ jsx("div", { className: "overflow-x-auto pb-1", children: /* @__PURE__ */ jsxs(
320
+ "div",
321
+ {
322
+ className: "relative",
323
+ style: { minWidth: grid.length * STEP + DAY_COL_W + 8 },
324
+ children: [
325
+ /* @__PURE__ */ jsx(
326
+ "div",
327
+ {
328
+ className: "relative h-[18px] mb-1",
329
+ style: { marginLeft: DAY_COL_W },
330
+ children: labels.map(({ label, col }) => /* @__PURE__ */ jsx(
331
+ "span",
354
332
  {
355
- className: "h-[13px] text-[10px] text-right pr-1.5 text-neutral-400",
356
- children: (_a2 = DAY_LABELS[i]) != null ? _a2 : ""
333
+ className: "absolute text-[11px] text-neutral-400",
334
+ style: { left: col * STEP },
335
+ children: label
357
336
  },
358
- i
359
- );
360
- })
361
- }
362
- ),
363
- grid.map((week, wi) => /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-[3px]", children: week.map((day, di) => /* @__PURE__ */ jsx(
364
- "div",
365
- {
366
- className: "w-[13px] h-[13px] rounded-[3px] transition-transform hover:scale-125",
367
- style: {
368
- backgroundColor: day ? colors[day.level] : "transparent",
369
- outline: bestDay && (day == null ? void 0 : day.date) === bestDay.date ? `2px solid ${outlineColor}` : "none",
370
- outlineOffset: "1px"
371
- },
372
- onMouseEnter: (e) => {
373
- if (!day) return;
374
- const r = e.currentTarget.getBoundingClientRect();
375
- setTip({
376
- day,
377
- x: r.left + r.width / 2,
378
- y: r.top
379
- });
380
- },
381
- onMouseLeave: () => setTip(null)
382
- },
383
- di
384
- )) }, wi))
385
- ] })
386
- ]
387
- }
388
- ) }),
389
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-3 text-[11px] text-neutral-400", children: [
390
- "Less",
391
- colors.map((c, i) => /* @__PURE__ */ jsx(
392
- "div",
393
- {
394
- className: "w-[13px] h-[13px] rounded-[3px]",
395
- style: { backgroundColor: c }
396
- },
397
- i
398
- )),
399
- "More"
400
- ] }),
401
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-800", children: [
402
- /* @__PURE__ */ jsx("span", { className: "text-[11px] text-neutral-400 mr-1", children: "Year:" }),
403
- /* @__PURE__ */ jsx(
404
- YearPill,
405
- {
406
- label: "Last year",
407
- active: selectedYear === "last",
408
- onClick: () => setSelectedYear("last")
409
- }
410
- ),
411
- years.map((y) => /* @__PURE__ */ jsx(
412
- YearPill,
413
- {
414
- label: String(y),
415
- active: selectedYear === y,
416
- onClick: () => setSelectedYear(y)
417
- },
418
- y
419
- ))
420
- ] })
421
- ] }) }),
422
- tip && /* @__PURE__ */ jsx(Tooltip, { day: tip.day, x: tip.x, y: tip.y })
423
- ] });
337
+ label + col
338
+ ))
339
+ }
340
+ ),
341
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-[3px]", children: [
342
+ /* @__PURE__ */ jsx(
343
+ "div",
344
+ {
345
+ className: "flex flex-col gap-[3px]",
346
+ style: { width: DAY_COL_W - GAP },
347
+ children: Array.from({ length: 7 }).map((_, i) => {
348
+ var _a2;
349
+ return /* @__PURE__ */ jsx(
350
+ "div",
351
+ {
352
+ className: "h-[13px] text-[10px] text-right pr-1.5 text-neutral-400",
353
+ children: (_a2 = DAY_LABELS[i]) != null ? _a2 : ""
354
+ },
355
+ i
356
+ );
357
+ })
358
+ }
359
+ ),
360
+ grid.map((week, wi) => /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-[3px]", children: week.map((day, di) => /* @__PURE__ */ jsx(
361
+ "div",
362
+ {
363
+ className: "w-[13px] h-[13px] rounded-[3px] transition-transform hover:scale-125",
364
+ style: {
365
+ backgroundColor: day ? colors[day.level] : "transparent",
366
+ outline: bestDay && (day == null ? void 0 : day.date) === bestDay.date ? `2px solid ${outlineColor}` : "none",
367
+ outlineOffset: "1px"
368
+ },
369
+ onMouseEnter: (e) => {
370
+ if (!day) return;
371
+ const r = e.currentTarget.getBoundingClientRect();
372
+ setTip({ day, x: r.left + r.width / 2, y: r.top });
373
+ },
374
+ onMouseLeave: () => setTip(null)
375
+ },
376
+ di
377
+ )) }, wi))
378
+ ] })
379
+ ]
380
+ }
381
+ ) }),
382
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-3 text-[11px] text-neutral-400", children: [
383
+ "Less",
384
+ colors.map((c, i) => /* @__PURE__ */ jsx(
385
+ "div",
386
+ {
387
+ className: "w-[13px] h-[13px] rounded-[3px]",
388
+ style: { backgroundColor: c }
389
+ },
390
+ i
391
+ )),
392
+ "More"
393
+ ] }),
394
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-800", children: [
395
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-neutral-400 mr-1", children: "Year:" }),
396
+ /* @__PURE__ */ jsx(
397
+ YearPill,
398
+ {
399
+ label: "Last year",
400
+ active: selectedYear === "last",
401
+ onClick: () => setSelectedYear("last")
402
+ }
403
+ ),
404
+ years.map((y) => /* @__PURE__ */ jsx(
405
+ YearPill,
406
+ {
407
+ label: String(y),
408
+ active: selectedYear === y,
409
+ onClick: () => setSelectedYear(y)
410
+ },
411
+ y
412
+ ))
413
+ ] })
414
+ ] }) }),
415
+ tip && /* @__PURE__ */ jsx(Tooltip, { day: tip.day, x: tip.x, y: tip.y })
416
+ ]
417
+ }
418
+ );
424
419
  }
425
420
  var GithubActivity_default = memo(GithubActivity);
426
421
  export {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/GithubActivity.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { memo, useEffect, useState, useMemo } from \"react\";\r\n\r\ntype Theme = \"light\" | \"dark\" | \"blue\" | \"purple\";\r\n\r\ninterface Day {\r\n date: string;\r\n count: number;\r\n level: 0 | 1 | 2 | 3 | 4;\r\n}\r\n\r\ninterface Props {\r\n username: string;\r\n theme?: Theme;\r\n className?: string;\r\n}\r\n\r\nconst MONTHS = [\r\n \"Jan\",\r\n \"Feb\",\r\n \"Mar\",\r\n \"Apr\",\r\n \"May\",\r\n \"Jun\",\r\n \"Jul\",\r\n \"Aug\",\r\n \"Sep\",\r\n \"Oct\",\r\n \"Nov\",\r\n \"Dec\",\r\n];\r\n\r\nconst DAY_LABELS: Record<number, string> = { 1: \"Mon\", 3: \"Wed\", 5: \"Fri\" };\r\n\r\nconst CELL = 13;\r\nconst GAP = 3;\r\nconst STEP = CELL + GAP;\r\nconst DAY_COL_W = 30;\r\n\r\nconst LIGHT = [\"#ebedf0\", \"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"];\r\nconst DARK = [\"#21262d\", \"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"];\r\nconst BLUE = [\"#21262d\", \"#a3c9ff\", \"#5fa3ff\", \"#2f7bff\", \"#0b5cff\"];\r\nconst PURPLE = [\"#21262d\", \"#d8b4ff\", \"#c084fc\", \"#a855f7\", \"#7e22ce\"];\r\n\r\nconst COLOR_MAP: Record<Theme, string[]> = {\r\n light: LIGHT,\r\n dark: DARK,\r\n blue: BLUE,\r\n purple: PURPLE,\r\n};\r\n\r\nfunction toLevel(count: number): 0 | 1 | 2 | 3 | 4 {\r\n if (count === 0) return 0;\r\n if (count <= 3) return 1;\r\n if (count <= 6) return 2;\r\n if (count <= 9) return 3;\r\n return 4;\r\n}\r\n\r\nfunction buildGrid(\r\n dayMap: Map<string, Day>,\r\n year: number | \"last\",\r\n): (Day | null)[][] {\r\n let start: Date;\r\n let end: Date;\r\n\r\n if (year === \"last\") {\r\n end = new Date();\r\n start = new Date(end);\r\n start.setFullYear(start.getFullYear() - 1);\r\n start.setDate(start.getDate() + 1);\r\n } else {\r\n start = new Date(year, 0, 1);\r\n end =\r\n year === new Date().getFullYear() ? new Date() : new Date(year, 11, 31);\r\n }\r\n\r\n start.setDate(start.getDate() - start.getDay());\r\n\r\n const weeks: (Day | null)[][] = [];\r\n const cur = new Date(start);\r\n\r\n while (cur <= end) {\r\n const week: (Day | null)[] = [];\r\n\r\n for (let d = 0; d < 7; d++) {\r\n const iso = cur.toISOString().slice(0, 10);\r\n\r\n if (cur > end) week.push(null);\r\n else {\r\n week.push(\r\n dayMap.get(iso) ?? {\r\n date: iso,\r\n count: 0,\r\n level: 0,\r\n },\r\n );\r\n }\r\n\r\n cur.setDate(cur.getDate() + 1);\r\n }\r\n\r\n weeks.push(week);\r\n }\r\n\r\n return weeks;\r\n}\r\n\r\nfunction monthLabels(grid: (Day | null)[][]) {\r\n const out: { label: string; col: number }[] = [];\r\n let last = -1;\r\n\r\n grid.forEach((week, i) => {\r\n const first = week.find(Boolean);\r\n if (!first) return;\r\n\r\n const m = new Date(first.date).getMonth();\r\n\r\n if (m !== last) {\r\n out.push({ label: MONTHS[m], col: i });\r\n last = m;\r\n }\r\n });\r\n\r\n return out;\r\n}\r\n\r\nfunction Tooltip({ day, x, y }: { day: Day; x: number; y: number }) {\r\n const label = new Date(day.date).toLocaleDateString(\"en-US\", {\r\n weekday: \"long\",\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n });\r\n\r\n return (\r\n <div\r\n className=\"fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white\"\r\n style={{ left: x, top: y - 8 }}\r\n >\r\n <b>\r\n {day.count} contribution{day.count !== 1 ? \"s\" : \"\"}\r\n </b>{\" \"}\r\n · {label}\r\n </div>\r\n );\r\n}\r\n\r\nfunction Skeleton() {\r\n return (\r\n <div className=\"flex gap-[3px] animate-pulse opacity-40\">\r\n {Array.from({ length: 45 }).map((_, w) => (\r\n <div key={w} className=\"flex flex-col gap-[3px]\">\r\n {Array.from({ length: 7 }).map((_, d) => (\r\n <div\r\n key={d}\r\n className=\"w-[13px] h-[13px] rounded-[3px] bg-neutral-700\"\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\ntype YearPillProps = {\r\n label: string;\r\n active: boolean;\r\n onClick: () => void;\r\n};\r\n\r\n\r\nexport function YearPill({ label, active, onClick }: YearPillProps) {\r\n return (\r\n <button\r\n type=\"button\"\r\n onClick={onClick}\r\n className={\r\n \"px-3 py-1 text-[12px] font-medium rounded-full \" +\r\n \"transition-colors duration-150 select-none focus:outline-none \" +\r\n (active ? \"bg-white text-black\" : \"bg-neutral-800 text-white\")\r\n }\r\n >\r\n {label}\r\n </button>\r\n );\r\n}\r\n\r\nfunction GithubActivity({ username, theme = \"dark\", className }: Props) {\r\n const STYLES = `\r\n .gcu .relative{position:relative}\r\n .gcu .absolute{position:absolute}\r\n .gcu .fixed{position:fixed}\r\n .gcu .z-50{z-index:50}\r\n .gcu .pointer-events-none{pointer-events:none}\r\n .gcu .flex{display:flex}\r\n .gcu .flex-col{flex-direction:column}\r\n .gcu .flex-wrap{flex-wrap:wrap}\r\n .gcu .items-center{align-items:center}\r\n .gcu .justify-start{justify-content:flex-start}\r\n .gcu .inline-block{display:inline-block}\r\n .gcu .w-full{width:100%}\r\n .gcu .w-\\\\[10px\\\\]{width:10px}\r\n .gcu .w-\\\\[13px\\\\]{width:13px}\r\n .gcu .h-\\\\[10px\\\\]{height:10px}\r\n .gcu .h-\\\\[13px\\\\]{height:13px}\r\n .gcu .h-\\\\[18px\\\\]{height:18px}\r\n .gcu .-translate-x-1\\\\/2{transform:translateX(-50%)}\r\n .gcu .-translate-y-full{transform:translateY(-100%)}\r\n .gcu .gap-\\\\[3px\\\\]{gap:3px}\r\n .gcu .gap-1{gap:0.25rem}\r\n .gcu .gap-1\\\\.5{gap:0.375rem}\r\n .gcu .gap-x-6{column-gap:1.5rem}\r\n .gcu .gap-y-1{row-gap:0.25rem}\r\n .gcu .mb-4{margin-bottom:1rem}\r\n .gcu .mt-3{margin-top:0.75rem}\r\n .gcu .mt-4{margin-top:1rem}\r\n .gcu .mr-1{margin-right:0.25rem}\r\n .gcu .ml-1{margin-left:0.25rem}\r\n .gcu .p-4{padding:1rem}\r\n .gcu .pt-3{padding-top:0.75rem}\r\n .gcu .pt-px{padding-top:1px}\r\n .gcu .pb-1{padding-bottom:0.25rem}\r\n .gcu .pr-1\\\\.5{padding-right:0.375rem}\r\n .gcu .px-2{padding-left:0.5rem;padding-right:0.5rem}\r\n .gcu .px-2\\\\.5{padding-left:0.625rem;padding-right:0.625rem}\r\n .gcu .py-1{padding-top:0.25rem;padding-bottom:0.25rem}\r\n .gcu .py-1\\\\.5{padding-top:0.375rem;padding-bottom:0.375rem}\r\n .gcu .py-0\\\\.5{padding-top:0.125rem;padding-bottom:0.125rem}\r\n .gcu .rounded-\\\\[2px\\\\]{border-radius:2px}\r\n .gcu .rounded-\\\\[3px\\\\]{border-radius:3px}\r\n .gcu .rounded{border-radius:0.25rem}\r\n .gcu .rounded-md{border-radius:0.375rem}\r\n .gcu .rounded-full{border-radius:9999px}\r\n .gcu .rounded-xl{border-radius:0.75rem}\r\n .gcu .text-right{text-align:right}\r\n .gcu .text-\\\\[10px\\\\]{font-size:10px}\r\n .gcu .text-\\\\[11px\\\\]{font-size:11px}\r\n .gcu .text-xs{font-size:0.75rem}\r\n .gcu .text-sm{font-size:0.875rem}\r\n .gcu .font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace}\r\n .gcu .font-medium{font-weight:500}\r\n .gcu .font-semibold{font-weight:600}\r\n .gcu .select-none{-webkit-user-select:none;-ms-user-select:none;user-select:none}\r\n .gcu .whitespace-nowrap{white-space:nowrap}\r\n .gcu .overflow-x-auto{overflow-x:auto}\r\n .gcu .border{border-width:1px;border-style:solid;border-color:#262626}\r\n .gcu .border-neutral-800{border-color:#262626}\r\n .gcu .border-t{border-top-width:1px;border-top-style:solid;border-top-color:#262626}\r\n .gcu .transition-transform{transition-property:transform;transition-duration:0.1s;transition-timing-function:ease}\r\n .gcu .transition-colors{transition-property:color,background-color,border-color;transition-duration:0.15s;transition-timing-function:ease}\r\n .gcu .duration-150{transition-duration:0.15s}\r\n @keyframes gcu-pulse{50%{opacity:.5}}\r\n .gcu .animate-pulse{animation:gcu-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite}\r\n .gcu .hover\\\\:scale-125:hover{transform:scale(1.25)}\r\n .gcu .text-neutral-400{color:#9ca3af}\r\n .gcu .text-neutral-500{color:#6b7280}\r\n .gcu .text-neutral-200{color:#e5e7eb}\r\n .gcu .text-neutral-900{color:#171717}\r\n .gcu .text-neutral-700{color:#374151}\r\n .gcu .bg-neutral-900{background-color:#171717}\r\n .gcu .bg-neutral-950{background-color:#0a0a0a}\r\n .gcu .bg-neutral-700{background-color:#3f3f46}\r\n .gcu .bg-neutral-800{background-color:#262626}\r\n .gcu .text-white{color:#fff}\r\n .gcu .shadow-xl{box-shadow:0 20px 25px -5px rgba(0,0,0,0.1),0 10px 10px -5px rgba(0,0,0,0.04)}\r\n .gcu .bg-white{background-color:#ffffff}\r\n .gcu .text-black{color:#000000}\r\n .gcu .focus\\\\:outline-none:focus{outline:none}\r\n .gcu .bg-neutral-800{background-color:#262626}\r\n `;\r\n\r\n useEffect(() => {\r\n if (typeof document === \"undefined\") return;\r\n const id = \"github-contributions-ui-inline\";\r\n if (document.getElementById(id)) return;\r\n const style = document.createElement(\"style\");\r\n style.id = id;\r\n style.textContent = STYLES;\r\n document.head.appendChild(style);\r\n }, []);\r\n const [allDays, setAllDays] = useState<Map<string, Day>>(new Map());\r\n const [years, setYears] = useState<number[]>([]);\r\n const [selectedYear, setSelectedYear] = useState<number | \"last\">(\"last\");\r\n\r\n const [total, setTotal] = useState<number | null>(null);\r\n const [bestDay, setBestDay] = useState<Day | null>(null);\r\n\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(false);\r\n\r\n const [tip, setTip] = useState<{ day: Day; x: number; y: number } | null>(\r\n null,\r\n );\r\n\r\n const colors = COLOR_MAP[theme] ?? COLOR_MAP.dark;\r\n\r\n useEffect(() => {\r\n if (!username) return;\r\n\r\n let mounted = true;\r\n\r\n (async () => {\r\n try {\r\n setLoading(true);\r\n const res = await fetch(\r\n `https://github-contributions-api.jogruber.de/v4/${username}?y=all`,\r\n );\r\n\r\n if (!res.ok) throw new Error();\r\n\r\n const json = await res.json();\r\n\r\n const map = new Map<string, Day>();\r\n const yearSet = new Set<number>();\r\n\r\n json.contributions.forEach((c: any) => {\r\n map.set(c.date, {\r\n date: c.date,\r\n count: c.count,\r\n level: toLevel(c.count),\r\n });\r\n\r\n yearSet.add(new Date(c.date).getFullYear());\r\n });\r\n\r\n if (!mounted) return;\r\n\r\n setAllDays(map);\r\n setYears(Array.from(yearSet).sort((a, b) => b - a));\r\n setError(false);\r\n } catch {\r\n if (mounted) setError(true);\r\n } finally {\r\n if (mounted) setLoading(false);\r\n }\r\n })();\r\n\r\n return () => {\r\n mounted = false;\r\n };\r\n }, [username]);\r\n\r\n useEffect(() => {\r\n if (!allDays.size) return;\r\n\r\n const entries = Array.from(allDays.values()).filter((d) => {\r\n if (selectedYear === \"last\") {\r\n const oneYearAgo = new Date();\r\n oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);\r\n return new Date(d.date) >= oneYearAgo;\r\n }\r\n return new Date(d.date).getFullYear() === selectedYear;\r\n });\r\n\r\n setTotal(entries.reduce((s, d) => s + d.count, 0));\r\n\r\n const best = entries.reduce<Day | null>(\r\n (b, d) => (!b || d.count > b.count ? d : b),\r\n null,\r\n );\r\n\r\n setBestDay(best && best.count > 0 ? best : null);\r\n }, [allDays, selectedYear]);\r\n\r\n const grid = useMemo(\r\n () => (allDays.size ? buildGrid(allDays, selectedYear) : []),\r\n [allDays, selectedYear],\r\n );\r\n\r\n const labels = useMemo(() => monthLabels(grid), [grid]);\r\n\r\n const outlineColor = theme === \"light\" ? \"#333\" : \"#f0f0f0\";\r\n\r\n return (\r\n <section className={[\"gcu w-full font-mono\", className].join(\" \").trim()}>\r\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-400\">\r\n {loading\r\n ? \"Loading…\"\r\n : error\r\n ? \"Unavailable\"\r\n : `${total?.toLocaleString()} contributions ${\r\n selectedYear === \"last\"\r\n ? \"in the last year\"\r\n : `in ${selectedYear}`\r\n }`}\r\n\r\n {bestDay && !loading && (\r\n <span className=\"flex items-center gap-1.5\">\r\n <span\r\n className=\"inline-block w-[10px] h-[10px] rounded-[2px]\"\r\n style={{ backgroundColor: colors[4] }}\r\n />\r\n Best day:\r\n <span className=\"text-neutral-200 font-semibold\">\r\n {bestDay.count} contributions on {bestDay.date}\r\n </span>\r\n </span>\r\n )}\r\n </div>\r\n\r\n <div className=\"border border-neutral-800 rounded-xl p-4 bg-neutral-950\">\r\n {error ? (\r\n <p className=\"text-sm italic text-neutral-400\">\r\n GitHub activity unavailable.\r\n </p>\r\n ) : loading ? (\r\n <Skeleton />\r\n ) : (\r\n <>\r\n <div className=\"overflow-x-auto pb-1\">\r\n <div\r\n className=\"relative\"\r\n style={{\r\n minWidth: grid.length * STEP + DAY_COL_W + 8,\r\n }}\r\n >\r\n <div\r\n className=\"relative h-[18px] mb-1\"\r\n style={{ marginLeft: DAY_COL_W }}\r\n >\r\n {labels.map(({ label, col }) => (\r\n <span\r\n key={label + col}\r\n className=\"absolute text-[11px] text-neutral-400\"\r\n style={{ left: col * STEP }}\r\n >\r\n {label}\r\n </span>\r\n ))}\r\n </div>\r\n\r\n <div className=\"flex gap-[3px]\">\r\n <div\r\n className=\"flex flex-col gap-[3px]\"\r\n style={{ width: DAY_COL_W - GAP }}\r\n >\r\n {Array.from({ length: 7 }).map((_, i) => (\r\n <div\r\n key={i}\r\n className=\"h-[13px] text-[10px] text-right pr-1.5 text-neutral-400\"\r\n >\r\n {DAY_LABELS[i] ?? \"\"}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n {grid.map((week, wi) => (\r\n <div key={wi} className=\"flex flex-col gap-[3px]\">\r\n {week.map((day, di) => (\r\n <div\r\n key={di}\r\n className=\"w-[13px] h-[13px] rounded-[3px] transition-transform hover:scale-125\"\r\n style={{\r\n backgroundColor: day\r\n ? colors[day.level]\r\n : \"transparent\",\r\n outline:\r\n bestDay && day?.date === bestDay.date\r\n ? `2px solid ${outlineColor}`\r\n : \"none\",\r\n outlineOffset: \"1px\",\r\n }}\r\n onMouseEnter={(e) => {\r\n if (!day) return;\r\n const r = e.currentTarget.getBoundingClientRect();\r\n setTip({\r\n day,\r\n x: r.left + r.width / 2,\r\n y: r.top,\r\n });\r\n }}\r\n onMouseLeave={() => setTip(null)}\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex items-center gap-1 mt-3 text-[11px] text-neutral-400\">\r\n Less\r\n {colors.map((c, i) => (\r\n <div\r\n key={i}\r\n className=\"w-[13px] h-[13px] rounded-[3px]\"\r\n style={{ backgroundColor: c }}\r\n />\r\n ))}\r\n More\r\n </div>\r\n\r\n <div className=\"flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-800\">\r\n <span className=\"text-[11px] text-neutral-400 mr-1\">Year:</span>\r\n\r\n <YearPill\r\n label=\"Last year\"\r\n active={selectedYear === \"last\"}\r\n onClick={() => setSelectedYear(\"last\")}\r\n />\r\n\r\n {years.map((y) => (\r\n <YearPill\r\n key={y}\r\n label={String(y)}\r\n active={selectedYear === y}\r\n onClick={() => setSelectedYear(y)}\r\n />\r\n ))}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n\r\n {tip && <Tooltip day={tip.day} x={tip.x} y={tip.y} />}\r\n </section>\r\n );\r\n}\r\n\r\nexport default memo(GithubActivity);\r\n"],"mappings":";;;;AAEA,SAAS,MAAM,WAAW,UAAU,eAAe;AA2I7C,SA6QI,UA/PE,KAdN;AA3HN,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,aAAqC,EAAE,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM;AAE1E,IAAM,OAAO;AACb,IAAM,MAAM;AACZ,IAAM,OAAO,OAAO;AACpB,IAAM,YAAY;AAElB,IAAM,QAAQ,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACpE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,SAAS,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AAErE,IAAM,YAAqC;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AACV;AAEA,SAAS,QAAQ,OAAkC;AACjD,MAAI,UAAU,EAAG,QAAO;AACxB,MAAI,SAAS,EAAG,QAAO;AACvB,MAAI,SAAS,EAAG,QAAO;AACvB,MAAI,SAAS,EAAG,QAAO;AACvB,SAAO;AACT;AAEA,SAAS,UACP,QACA,MACkB;AA/DpB;AAgEE,MAAI;AACJ,MAAI;AAEJ,MAAI,SAAS,QAAQ;AACnB,UAAM,oBAAI,KAAK;AACf,YAAQ,IAAI,KAAK,GAAG;AACpB,UAAM,YAAY,MAAM,YAAY,IAAI,CAAC;AACzC,UAAM,QAAQ,MAAM,QAAQ,IAAI,CAAC;AAAA,E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AE,iBAAiB,EAAE;AAAA;AAAA,UAFvB;AAAA,QAGP,CACD;AAAA,QAAE;AAAA,SAEL;AAAA,MAEA,qBAAC,SAAI,WAAU,6EACb;AAAA,4BAAC,UAAK,WAAU,qCAAoC,mBAAK;AAAA,QAEzD;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,MAAM;AAAA;AAAA,QACvC;AAAA,QAEC,MAAM,IAAI,CAAC,MACV;AAAA,UAAC;AAAA;AAAA,YAEC,OAAO,OAAO,CAAC;AAAA,YACf,QAAQ,iBAAiB;AAAA,YACzB,SAAS,MAAM,gBAAgB,CAAC;AAAA;AAAA,UAH3B;AAAA,QAIP,CACD;AAAA,SACH;AAAA,OACF,GAEJ;AAAA,IAEC,OAAO,oBAAC,WAAQ,KAAK,IAAI,KAAK,GAAG,IAAI,GAAG,GAAG,IAAI,GAAG;AAAA,KACrD;AAEJ;AAEA,IAAO,yBAAQ,KAAK,cAAc;","names":["_","_a"]}
1
+ {"version":3,"sources":["../src/GithubActivity.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { memo, useEffect, useState, useMemo } from \"react\";\r\n\r\ntype Theme = \"light\" | \"dark\" | \"blue\" | \"purple\";\r\n\r\ninterface Day {\r\n date: string;\r\n count: number;\r\n level: 0 | 1 | 2 | 3 | 4;\r\n}\r\n\r\ninterface Props {\r\n username: string;\r\n theme?: Theme;\r\n className?: string;\r\n}\r\n\r\nconst MONTHS = [\r\n \"Jan\",\r\n \"Feb\",\r\n \"Mar\",\r\n \"Apr\",\r\n \"May\",\r\n \"Jun\",\r\n \"Jul\",\r\n \"Aug\",\r\n \"Sep\",\r\n \"Oct\",\r\n \"Nov\",\r\n \"Dec\",\r\n];\r\nconst DAY_LABELS: Record<number, string> = { 1: \"Mon\", 3: \"Wed\", 5: \"Fri\" };\r\n\r\nconst CELL = 13;\r\nconst GAP = 3;\r\nconst STEP = CELL + GAP;\r\nconst DAY_COL_W = 30;\r\n\r\nconst LIGHT = [\"#ebedf0\", \"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"];\r\nconst DARK = [\"#21262d\", \"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"];\r\nconst BLUE = [\"#21262d\", \"#a3c9ff\", \"#5fa3ff\", \"#2f7bff\", \"#0b5cff\"];\r\nconst PURPLE = [\"#21262d\", \"#d8b4ff\", \"#c084fc\", \"#a855f7\", \"#7e22ce\"];\r\n\r\nconst COLOR_MAP: Record<Theme, string[]> = {\r\n light: LIGHT,\r\n dark: DARK,\r\n blue: BLUE,\r\n purple: PURPLE,\r\n};\r\n\r\nfunction toLevel(count: number): 0 | 1 | 2 | 3 | 4 {\r\n if (count === 0) return 0;\r\n if (count <= 3) return 1;\r\n if (count <= 6) return 2;\r\n if (count <= 9) return 3;\r\n return 4;\r\n}\r\n\r\nfunction buildGrid(\r\n dayMap: Map<string, Day>,\r\n year: number | \"last\",\r\n): (Day | null)[][] {\r\n let start: Date;\r\n let end: Date;\r\n\r\n if (year === \"last\") {\r\n end = new Date();\r\n start = new Date(end);\r\n start.setFullYear(start.getFullYear() - 1);\r\n start.setDate(start.getDate() + 1);\r\n } else {\r\n start = new Date(year, 0, 1);\r\n end =\r\n year === new Date().getFullYear() ? new Date() : new Date(year, 11, 31);\r\n }\r\n\r\n start.setDate(start.getDate() - start.getDay());\r\n\r\n const weeks: (Day | null)[][] = [];\r\n const cur = new Date(start);\r\n\r\n while (cur <= end) {\r\n const week: (Day | null)[] = [];\r\n for (let d = 0; d < 7; d++) {\r\n const iso = cur.toISOString().slice(0, 10);\r\n if (cur > end) week.push(null);\r\n else week.push(dayMap.get(iso) ?? { date: iso, count: 0, level: 0 });\r\n cur.setDate(cur.getDate() + 1);\r\n }\r\n weeks.push(week);\r\n }\r\n return weeks;\r\n}\r\n\r\nfunction monthLabels(grid: (Day | null)[][]) {\r\n const out: { label: string; col: number }[] = [];\r\n let last = -1;\r\n grid.forEach((week, i) => {\r\n const first = week.find(Boolean);\r\n if (!first) return;\r\n const m = new Date(first.date).getMonth();\r\n if (m !== last) {\r\n out.push({ label: MONTHS[m], col: i });\r\n last = m;\r\n }\r\n });\r\n return out;\r\n}\r\n\r\nfunction Tooltip({ day, x, y }: { day: Day; x: number; y: number }) {\r\n const label = new Date(day.date).toLocaleDateString(\"en-US\", {\r\n weekday: \"long\",\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n });\r\n return (\r\n <div\r\n className=\"gcu fixed z-50 pointer-events-none -translate-x-1/2 -translate-y-full px-2.5 py-1.5 rounded-md text-xs font-mono whitespace-nowrap shadow-xl bg-neutral-900 text-white\"\r\n style={{ left: x, top: y - 8 }}\r\n >\r\n <b>\r\n {day.count} contribution{day.count !== 1 ? \"s\" : \"\"}\r\n </b>{\" \"}\r\n · {label}\r\n </div>\r\n );\r\n}\r\n\r\nfunction Skeleton() {\r\n return (\r\n <div className=\"flex gap-[3px] animate-pulse opacity-40\">\r\n {Array.from({ length: 45 }).map((_, w) => (\r\n <div key={w} className=\"flex flex-col gap-[3px]\">\r\n {Array.from({ length: 7 }).map((_, d) => (\r\n <div\r\n key={d}\r\n className=\"w-[13px] h-[13px] rounded-[3px] bg-neutral-700\"\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n );\r\n}\r\n\r\n// ─── YearPill — fully inline styles, zero Tailwind dependency ─────────────────\r\ntype YearPillProps = { label: string; active: boolean; onClick: () => void };\r\n\r\nexport function YearPill({ label, active, onClick }: YearPillProps) {\r\n const [hovered, setHovered] = useState(false);\r\n\r\n const baseStyle: React.CSSProperties = {\r\n padding: \"2px 10px\",\r\n fontSize: 12,\r\n fontWeight: 500,\r\n borderRadius: 9999,\r\n border: \"none\",\r\n cursor: \"pointer\",\r\n transition: \"background-color 0.15s ease, color 0.15s ease\",\r\n userSelect: \"none\",\r\n outline: \"none\",\r\n // Active = white pill with dark text\r\n // Inactive = dark pill with muted text, slightly lighter on hover\r\n backgroundColor: active ? \"#ffffff\" : hovered ? \"#3f3f46\" : \"#262626\",\r\n color: active ? \"#000000\" : \"#ffffff\",\r\n };\r\n\r\n return (\r\n <button\r\n type=\"button\"\r\n onClick={onClick}\r\n style={baseStyle}\r\n onMouseEnter={() => setHovered(true)}\r\n onMouseLeave={() => setHovered(false)}\r\n >\r\n {label}\r\n </button>\r\n );\r\n}\r\n\r\n// ─── Main ─────────────────────────────────────────────────────────────────────\r\nfunction GithubActivity({ username, theme = \"dark\", className }: Props) {\r\n const STYLES = `\r\n .gcu .relative{position:relative}\r\n .gcu .absolute{position:absolute}\r\n .gcu .fixed{position:fixed}\r\n .gcu .z-50{z-index:50}\r\n .gcu .pointer-events-none{pointer-events:none}\r\n .gcu .flex{display:flex}\r\n .gcu .flex-col{flex-direction:column}\r\n .gcu .flex-wrap{flex-wrap:wrap}\r\n .gcu .items-center{align-items:center}\r\n .gcu .justify-start{justify-content:flex-start}\r\n .gcu .inline-block{display:inline-block}\r\n .gcu .w-full{width:100%}\r\n .gcu .w-\\\\[10px\\\\]{width:10px}\r\n .gcu .w-\\\\[13px\\\\]{width:13px}\r\n .gcu .h-\\\\[10px\\\\]{height:10px}\r\n .gcu .h-\\\\[13px\\\\]{height:13px}\r\n .gcu .h-\\\\[18px\\\\]{height:18px}\r\n .gcu .-translate-x-1\\\\/2{transform:translateX(-50%)}\r\n .gcu .-translate-y-full{transform:translateY(-100%)}\r\n .gcu .gap-\\\\[3px\\\\]{gap:3px}\r\n .gcu .gap-1{gap:0.25rem}\r\n .gcu .gap-1\\\\.5{gap:0.375rem}\r\n .gcu .gap-x-6{column-gap:1.5rem}\r\n .gcu .gap-y-1{row-gap:0.25rem}\r\n .gcu .mb-4{margin-bottom:1rem}\r\n .gcu .mt-3{margin-top:0.75rem}\r\n .gcu .mt-4{margin-top:1rem}\r\n .gcu .mr-1{margin-right:0.25rem}\r\n .gcu .ml-1{margin-left:0.25rem}\r\n .gcu .p-4{padding:1rem}\r\n .gcu .pt-3{padding-top:0.75rem}\r\n .gcu .pt-px{padding-top:1px}\r\n .gcu .pb-1{padding-bottom:0.25rem}\r\n .gcu .pr-1\\\\.5{padding-right:0.375rem}\r\n .gcu .px-2\\\\.5{padding-left:0.625rem;padding-right:0.625rem}\r\n .gcu .py-1\\\\.5{padding-top:0.375rem;padding-bottom:0.375rem}\r\n .gcu .rounded-\\\\[2px\\\\]{border-radius:2px}\r\n .gcu .rounded-\\\\[3px\\\\]{border-radius:3px}\r\n .gcu .rounded-md{border-radius:0.375rem}\r\n .gcu .rounded-xl{border-radius:0.75rem}\r\n .gcu .text-right{text-align:right}\r\n .gcu .text-\\\\[10px\\\\]{font-size:10px}\r\n .gcu .text-\\\\[11px\\\\]{font-size:11px}\r\n .gcu .text-xs{font-size:0.75rem}\r\n .gcu .text-sm{font-size:0.875rem}\r\n .gcu .font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace}\r\n .gcu .font-medium{font-weight:500}\r\n .gcu .font-semibold{font-weight:600}\r\n .gcu .select-none{-webkit-user-select:none;-ms-user-select:none;user-select:none}\r\n .gcu .whitespace-nowrap{white-space:nowrap}\r\n .gcu .overflow-x-auto{overflow-x:auto}\r\n .gcu .border{border-width:1px;border-style:solid;border-color:#262626}\r\n .gcu .border-neutral-800{border-color:#262626}\r\n .gcu .border-t{border-top-width:1px;border-top-style:solid;border-top-color:#262626}\r\n .gcu .transition-transform{transition-property:transform;transition-duration:0.1s;transition-timing-function:ease}\r\n @keyframes gcu-pulse{50%{opacity:.5}}\r\n .gcu .animate-pulse{animation:gcu-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite}\r\n .gcu .hover\\\\:scale-125:hover{transform:scale(1.25)}\r\n .gcu .text-neutral-400{color:#9ca3af}\r\n .gcu .text-neutral-200{color:#e5e7eb}\r\n .gcu .bg-neutral-700{background-color:#3f3f46}\r\n .gcu .bg-neutral-900{background-color:#171717}\r\n .gcu .bg-neutral-950{background-color:#0a0a0a}\r\n .gcu .text-white{color:#fff}\r\n .gcu .shadow-xl{box-shadow:0 20px 25px -5px rgba(0,0,0,0.1),0 10px 10px -5px rgba(0,0,0,0.04)}\r\n `;\r\n\r\n useEffect(() => {\r\n if (typeof document === \"undefined\") return;\r\n const id = \"github-contributions-ui-inline\";\r\n if (document.getElementById(id)) return;\r\n const style = document.createElement(\"style\");\r\n style.id = id;\r\n style.textContent = STYLES;\r\n document.head.appendChild(style);\r\n }, []);\r\n\r\n const [allDays, setAllDays] = useState<Map<string, Day>>(new Map());\r\n const [years, setYears] = useState<number[]>([]);\r\n const [selectedYear, setSelectedYear] = useState<number | \"last\">(\"last\");\r\n const [total, setTotal] = useState<number | null>(null);\r\n const [bestDay, setBestDay] = useState<Day | null>(null);\r\n const [loading, setLoading] = useState(true);\r\n const [error, setError] = useState(false);\r\n const [tip, setTip] = useState<{ day: Day; x: number; y: number } | null>(\r\n null,\r\n );\r\n\r\n const colors = COLOR_MAP[theme] ?? COLOR_MAP.dark;\r\n\r\n useEffect(() => {\r\n if (!username) return;\r\n let mounted = true;\r\n\r\n (async () => {\r\n try {\r\n setLoading(true);\r\n const res = await fetch(\r\n `https://github-contributions-api.jogruber.de/v4/${username}?y=all`,\r\n );\r\n if (!res.ok) throw new Error();\r\n const json = await res.json();\r\n\r\n const map = new Map<string, Day>();\r\n const yearSet = new Set<number>();\r\n\r\n json.contributions.forEach((c: { date: string; count: number }) => {\r\n map.set(c.date, {\r\n date: c.date,\r\n count: c.count,\r\n level: toLevel(c.count),\r\n });\r\n yearSet.add(new Date(c.date).getFullYear());\r\n });\r\n\r\n if (!mounted) return;\r\n setAllDays(map);\r\n setYears(Array.from(yearSet).sort((a, b) => b - a));\r\n setError(false);\r\n } catch {\r\n if (mounted) setError(true);\r\n } finally {\r\n if (mounted) setLoading(false);\r\n }\r\n })();\r\n\r\n return () => {\r\n mounted = false;\r\n };\r\n }, [username]);\r\n\r\n useEffect(() => {\r\n if (!allDays.size) return;\r\n\r\n const entries = Array.from(allDays.values()).filter((d) => {\r\n if (selectedYear === \"last\") {\r\n const oneYearAgo = new Date();\r\n oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);\r\n return new Date(d.date) >= oneYearAgo;\r\n }\r\n return new Date(d.date).getFullYear() === selectedYear;\r\n });\r\n\r\n setTotal(entries.reduce((s, d) => s + d.count, 0));\r\n const best = entries.reduce<Day | null>(\r\n (b, d) => (!b || d.count > b.count ? d : b),\r\n null,\r\n );\r\n setBestDay(best && best.count > 0 ? best : null);\r\n }, [allDays, selectedYear]);\r\n\r\n const grid = useMemo(\r\n () => (allDays.size ? buildGrid(allDays, selectedYear) : []),\r\n [allDays, selectedYear],\r\n );\r\n const labels = useMemo(() => monthLabels(grid), [grid]);\r\n const outlineColor = theme === \"light\" ? \"#333\" : \"#f0f0f0\";\r\n\r\n return (\r\n <section\r\n className={[\"gcu w-full font-mono\", className].filter(Boolean).join(\" \")}\r\n >\r\n {/* Stats */}\r\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 mb-4 text-xs text-neutral-400\">\r\n {loading\r\n ? \"Loading…\"\r\n : error\r\n ? \"Unavailable\"\r\n : `${total?.toLocaleString()} contributions ${selectedYear === \"last\" ? \"in the last year\" : `in ${selectedYear}`}`}\r\n\r\n {bestDay && !loading && (\r\n <span className=\"flex items-center gap-1.5\">\r\n <span\r\n className=\"inline-block w-[10px] h-[10px] rounded-[2px]\"\r\n style={{ backgroundColor: colors[4] }}\r\n />\r\n Best day:\r\n <span className=\"text-neutral-200 font-semibold\">\r\n {bestDay.count} contributions on {bestDay.date}\r\n </span>\r\n </span>\r\n )}\r\n </div>\r\n\r\n {/* Card */}\r\n <div className=\"border border-neutral-800 rounded-xl p-4 bg-neutral-950\">\r\n {error ? (\r\n <p className=\"text-sm text-neutral-400 italic\">\r\n GitHub activity unavailable.\r\n </p>\r\n ) : loading ? (\r\n <Skeleton />\r\n ) : (\r\n <>\r\n <div className=\"overflow-x-auto pb-1\">\r\n <div\r\n className=\"relative\"\r\n style={{ minWidth: grid.length * STEP + DAY_COL_W + 8 }}\r\n >\r\n {/* Month labels */}\r\n <div\r\n className=\"relative h-[18px] mb-1\"\r\n style={{ marginLeft: DAY_COL_W }}\r\n >\r\n {labels.map(({ label, col }) => (\r\n <span\r\n key={label + col}\r\n className=\"absolute text-[11px] text-neutral-400\"\r\n style={{ left: col * STEP }}\r\n >\r\n {label}\r\n </span>\r\n ))}\r\n </div>\r\n\r\n {/* Grid */}\r\n <div className=\"flex gap-[3px]\">\r\n <div\r\n className=\"flex flex-col gap-[3px]\"\r\n style={{ width: DAY_COL_W - GAP }}\r\n >\r\n {Array.from({ length: 7 }).map((_, i) => (\r\n <div\r\n key={i}\r\n className=\"h-[13px] text-[10px] text-right pr-1.5 text-neutral-400\"\r\n >\r\n {DAY_LABELS[i] ?? \"\"}\r\n </div>\r\n ))}\r\n </div>\r\n\r\n {grid.map((week, wi) => (\r\n <div key={wi} className=\"flex flex-col gap-[3px]\">\r\n {week.map((day, di) => (\r\n <div\r\n key={di}\r\n className=\"w-[13px] h-[13px] rounded-[3px] transition-transform hover:scale-125\"\r\n style={{\r\n backgroundColor: day\r\n ? colors[day.level]\r\n : \"transparent\",\r\n outline:\r\n bestDay && day?.date === bestDay.date\r\n ? `2px solid ${outlineColor}`\r\n : \"none\",\r\n outlineOffset: \"1px\",\r\n }}\r\n onMouseEnter={(e) => {\r\n if (!day) return;\r\n const r = e.currentTarget.getBoundingClientRect();\r\n setTip({ day, x: r.left + r.width / 2, y: r.top });\r\n }}\r\n onMouseLeave={() => setTip(null)}\r\n />\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n\r\n {/* Legend */}\r\n <div className=\"flex items-center gap-1 mt-3 text-[11px] text-neutral-400\">\r\n Less\r\n {colors.map((c, i) => (\r\n <div\r\n key={i}\r\n className=\"w-[13px] h-[13px] rounded-[3px]\"\r\n style={{ backgroundColor: c }}\r\n />\r\n ))}\r\n More\r\n </div>\r\n\r\n {/* Year selector */}\r\n <div className=\"flex flex-wrap items-center gap-1.5 mt-4 pt-3 border-t border-neutral-800\">\r\n <span className=\"text-[11px] text-neutral-400 mr-1\">Year:</span>\r\n <YearPill\r\n label=\"Last year\"\r\n active={selectedYear === \"last\"}\r\n onClick={() => setSelectedYear(\"last\")}\r\n />\r\n {years.map((y) => (\r\n <YearPill\r\n key={y}\r\n label={String(y)}\r\n active={selectedYear === y}\r\n onClick={() => setSelectedYear(y)}\r\n />\r\n ))}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n\r\n {tip && <Tooltip day={tip.day} x={tip.x} y={tip.y} />}\r\n </section>\r\n );\r\n}\r\n\r\nexport default memo(GithubActivity);\r\n"],"mappings":";;;;AAEA,SAAS,MAAM,WAAW,UAAU,eAAe;AAwH7C,SAgQI,UAlPE,KAdN;AAxGN,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,IAAM,aAAqC,EAAE,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM;AAE1E,IAAM,OAAO;AACb,IAAM,MAAM;AACZ,IAAM,OAAO,OAAO;AACpB,IAAM,YAAY;AAElB,IAAM,QAAQ,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACpE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,OAAO,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AACnE,IAAM,SAAS,CAAC,WAAW,WAAW,WAAW,WAAW,SAAS;AAErE,IAAM,YAAqC;AAAA,EACzC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AACV;AAEA,SAAS,QAAQ,OAAkC;AACjD,MAAI,UAAU,EAAG,QAAO;AACxB,MAAI,SAAS,EAAG,QAAO;AACvB,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les.css CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-outline-style:solid;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z-50{z-index:50}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.h-\[10px\]{height:10px}.h-\[13px\]{height:13px}.h-\[18px\]{height:18px}.w-\[10px\]{width:10px}.w-\[13px\]{width:13px}.w-full{width:100%}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-full{--tw-translate-y:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-start{justify-content:flex-start}.gap-\[3px\]{gap:3px}.overflow-x-auto{overflow-x:auto}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.pt-px{padding-top:1px}.text-right{text-align:right}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.whitespace-nowrap{white-space:nowrap}.italic{font-style:italic}.opacity-40{opacity:.4}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.duration-150{--tw-duration:.15s;transition-duration:.15s}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.hover\:scale-125:hover{--tw-scale-x:125%;--tw-scale-y:125%;--tw-scale-z:125%;scale:var(--tw-scale-x) var(--tw-scale-y)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-outline-style:solid;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z-50{z-index:50}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-block{display:inline-block}.h-\[10px\]{height:10px}.h-\[13px\]{height:13px}.h-\[18px\]{height:18px}.w-\[10px\]{width:10px}.w-\[13px\]{width:13px}.w-full{width:100%}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-full{--tw-translate-y:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-start{justify-content:flex-start}.gap-\[3px\]{gap:3px}.overflow-x-auto{overflow-x:auto}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.pt-px{padding-top:1px}.text-right{text-align:right}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.whitespace-nowrap{white-space:nowrap}.italic{font-style:italic}.opacity-40{opacity:.4}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.hover\:scale-125:hover{--tw-scale-x:125%;--tw-scale-y:125%;--tw-scale-z:125%;scale:var(--tw-scale-x) var(--tw-scale-y)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-contributions-ui",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "GitHub contributions graph React component",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",