@git-stats-components/vue 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -23
- package/dist/style.css +1 -1
- package/dist/vue.es.js +656 -0
- package/dist/vue.es.js.map +1 -0
- package/dist/vue.umd.js +2 -0
- package/dist/vue.umd.js.map +1 -0
- package/package.json +1 -1
- package/dist/vue-git-stats.es.js +0 -636
- package/dist/vue-git-stats.es.js.map +0 -1
- package/dist/vue-git-stats.umd.js +0 -2
- package/dist/vue-git-stats.umd.js.map +0 -1
package/dist/vue.es.js
ADDED
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
var ot = Object.defineProperty, nt = Object.defineProperties;
|
|
2
|
+
var rt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var V = Object.getOwnPropertySymbols;
|
|
4
|
+
var it = Object.prototype.hasOwnProperty, lt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var R = (e, t, s) => t in e ? ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, Y = (e, t) => {
|
|
6
|
+
for (var s in t || (t = {}))
|
|
7
|
+
it.call(t, s) && R(e, s, t[s]);
|
|
8
|
+
if (V)
|
|
9
|
+
for (var s of V(t))
|
|
10
|
+
lt.call(t, s) && R(e, s, t[s]);
|
|
11
|
+
return e;
|
|
12
|
+
}, W = (e, t) => nt(e, rt(t));
|
|
13
|
+
var O = (e, t, s) => new Promise((i, l) => {
|
|
14
|
+
var m = (d) => {
|
|
15
|
+
try {
|
|
16
|
+
n(s.next(d));
|
|
17
|
+
} catch (p) {
|
|
18
|
+
l(p);
|
|
19
|
+
}
|
|
20
|
+
}, u = (d) => {
|
|
21
|
+
try {
|
|
22
|
+
n(s.throw(d));
|
|
23
|
+
} catch (p) {
|
|
24
|
+
l(p);
|
|
25
|
+
}
|
|
26
|
+
}, n = (d) => d.done ? i(d.value) : Promise.resolve(d.value).then(m, u);
|
|
27
|
+
n((s = s.apply(e, t)).next());
|
|
28
|
+
});
|
|
29
|
+
import { ref as S, computed as E, defineComponent as J, watch as q, createElementBlock as y, openBlock as h, createElementVNode as a, createCommentVNode as U, toDisplayString as D, normalizeClass as T, unref as k, renderSlot as L, createTextVNode as C, Fragment as A, renderList as B, normalizeStyle as ct, createStaticVNode as ut } from "vue";
|
|
30
|
+
function me(e) {
|
|
31
|
+
return O(this, null, function* () {
|
|
32
|
+
const t = yield fetch(e);
|
|
33
|
+
if (!t.ok)
|
|
34
|
+
throw new Error(`Failed to fetch git stats: ${t.statusText}`);
|
|
35
|
+
return t.json();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function dt() {
|
|
39
|
+
const e = [], t = /* @__PURE__ */ new Date(), s = new Date(t);
|
|
40
|
+
s.setDate(s.getDate() - s.getDay());
|
|
41
|
+
const i = new Date(s);
|
|
42
|
+
i.setDate(i.getDate() - 52 * 7);
|
|
43
|
+
const l = new Date(i);
|
|
44
|
+
for (let m = 0; m < 53; m++) {
|
|
45
|
+
const u = {
|
|
46
|
+
weekStart: new Date(l).toISOString().split("T")[0],
|
|
47
|
+
contributionDays: []
|
|
48
|
+
};
|
|
49
|
+
for (let n = 0; n < 7; n++) {
|
|
50
|
+
const d = l > t, p = n === 0 || n === 6;
|
|
51
|
+
let f = 0;
|
|
52
|
+
d || (p ? f = Math.random() < 0.3 ? Math.floor(Math.random() * 5) : 0 : f = Math.floor(Math.random() * 15)), u.contributionDays.push({
|
|
53
|
+
date: new Date(l).toISOString().split("T")[0],
|
|
54
|
+
contributionCount: f,
|
|
55
|
+
weekday: n
|
|
56
|
+
}), l.setDate(l.getDate() + 1);
|
|
57
|
+
}
|
|
58
|
+
e.push(u);
|
|
59
|
+
}
|
|
60
|
+
return e;
|
|
61
|
+
}
|
|
62
|
+
function P(e = {}) {
|
|
63
|
+
const {
|
|
64
|
+
username: t = "demo-user",
|
|
65
|
+
platform: s = "github",
|
|
66
|
+
projectCount: i = 30,
|
|
67
|
+
commitCount: l = 2500
|
|
68
|
+
} = e, m = dt();
|
|
69
|
+
return m.reduce((u, n) => u + n.contributionDays.reduce(
|
|
70
|
+
(d, p) => d + p.contributionCount,
|
|
71
|
+
0
|
|
72
|
+
), 0), {
|
|
73
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
74
|
+
profiles: [
|
|
75
|
+
{
|
|
76
|
+
username: t,
|
|
77
|
+
platform: s,
|
|
78
|
+
stats: {
|
|
79
|
+
projectCount: i,
|
|
80
|
+
commitCount: l,
|
|
81
|
+
contributions: m.map((u) => ({
|
|
82
|
+
firstDay: u.weekStart,
|
|
83
|
+
contributionDays: u.contributionDays
|
|
84
|
+
}))
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
totals: {
|
|
89
|
+
projectCount: i,
|
|
90
|
+
commitCount: l
|
|
91
|
+
},
|
|
92
|
+
metadata: {
|
|
93
|
+
fetchedAt: Date.now(),
|
|
94
|
+
source: "dummy_data",
|
|
95
|
+
isDummy: !0
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function fe() {
|
|
100
|
+
const e = P({
|
|
101
|
+
username: "demo-github",
|
|
102
|
+
platform: "github",
|
|
103
|
+
projectCount: 45,
|
|
104
|
+
commitCount: 2847
|
|
105
|
+
}), t = P({
|
|
106
|
+
username: "demo-gitlab",
|
|
107
|
+
platform: "gitlab",
|
|
108
|
+
projectCount: 7,
|
|
109
|
+
commitCount: 523
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
113
|
+
profiles: [e.profiles[0], t.profiles[0]],
|
|
114
|
+
totals: {
|
|
115
|
+
projectCount: 52,
|
|
116
|
+
commitCount: 3370
|
|
117
|
+
},
|
|
118
|
+
metadata: {
|
|
119
|
+
fetchedAt: Date.now(),
|
|
120
|
+
source: "dummy_data",
|
|
121
|
+
isDummy: !0
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function ve(e = "dummy-git-stats.json") {
|
|
126
|
+
const t = P(), s = JSON.stringify(t, null, " ");
|
|
127
|
+
if (typeof window != "undefined") {
|
|
128
|
+
const i = new Blob([s], { type: "application/json" }), l = URL.createObjectURL(i), m = document.createElement("a");
|
|
129
|
+
m.href = l, m.download = e, m.click(), URL.revokeObjectURL(l);
|
|
130
|
+
} else
|
|
131
|
+
try {
|
|
132
|
+
require("fs").writeFileSync(e, s), console.log(`✓ Dummy data saved to ${e}`);
|
|
133
|
+
} catch (i) {
|
|
134
|
+
console.error("Failed to save dummy data:", i);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function mt(e) {
|
|
138
|
+
return O(this, null, function* () {
|
|
139
|
+
var m, u;
|
|
140
|
+
const { dataUrl: t, cacheKey: s = "git_stats_cache", useStaleCache: i = !0 } = e;
|
|
141
|
+
try {
|
|
142
|
+
const n = yield fetch(t);
|
|
143
|
+
if (n.ok) {
|
|
144
|
+
const d = yield n.json();
|
|
145
|
+
return typeof window != "undefined" && localStorage.setItem(
|
|
146
|
+
s,
|
|
147
|
+
JSON.stringify(W(Y({}, d), {
|
|
148
|
+
cachedAt: Date.now()
|
|
149
|
+
}))
|
|
150
|
+
), {
|
|
151
|
+
data: d,
|
|
152
|
+
error: null,
|
|
153
|
+
source: "static",
|
|
154
|
+
isDummy: ((m = d.metadata) == null ? void 0 : m.isDummy) === !0
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
} catch (n) {
|
|
158
|
+
console.warn("Failed to fetch from static file:", n);
|
|
159
|
+
}
|
|
160
|
+
if (i && typeof window != "undefined")
|
|
161
|
+
try {
|
|
162
|
+
const n = localStorage.getItem(s);
|
|
163
|
+
if (n) {
|
|
164
|
+
const d = JSON.parse(n);
|
|
165
|
+
return {
|
|
166
|
+
data: d,
|
|
167
|
+
error: null,
|
|
168
|
+
source: "cache",
|
|
169
|
+
isDummy: ((u = d.metadata) == null ? void 0 : u.isDummy) === !0
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
} catch (n) {
|
|
173
|
+
console.warn("Failed to load from cache:", n);
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
data: yt(),
|
|
177
|
+
error: null,
|
|
178
|
+
source: "mock",
|
|
179
|
+
isDummy: !1
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function ft(e) {
|
|
184
|
+
const t = new Date(e), s = /* @__PURE__ */ new Date(), i = Math.floor((s.getTime() - t.getTime()) / (1e3 * 60 * 60));
|
|
185
|
+
if (i < 1) return "just now";
|
|
186
|
+
if (i < 24) return `${i} hours ago`;
|
|
187
|
+
const l = Math.floor(i / 24);
|
|
188
|
+
return l === 1 ? "yesterday" : l < 7 ? `${l} days ago` : t.toLocaleDateString("en-US", {
|
|
189
|
+
month: "short",
|
|
190
|
+
day: "numeric",
|
|
191
|
+
year: t.getFullYear() !== s.getFullYear() ? "numeric" : void 0
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function ye(e) {
|
|
195
|
+
return e === 0 ? 0 : e <= 3 ? 1 : e <= 6 ? 2 : e <= 9 ? 3 : 4;
|
|
196
|
+
}
|
|
197
|
+
function vt(e) {
|
|
198
|
+
if (e.length === 0) return 0;
|
|
199
|
+
const t = {};
|
|
200
|
+
return e.forEach((s) => {
|
|
201
|
+
var u;
|
|
202
|
+
const i = s.endDate ? new Date(s.endDate) : /* @__PURE__ */ new Date(), l = new Date(s.startDate), m = (i.getTime() - l.getTime()) / (1e3 * 60 * 60 * 24 * 365.25);
|
|
203
|
+
(u = s.skills) == null || u.forEach((n) => {
|
|
204
|
+
t[n] || (t[n] = 0), t[n] += m;
|
|
205
|
+
});
|
|
206
|
+
}), Math.max(...Object.values(t), 0);
|
|
207
|
+
}
|
|
208
|
+
function yt() {
|
|
209
|
+
return {
|
|
210
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
211
|
+
profiles: [
|
|
212
|
+
{
|
|
213
|
+
username: "mockuser",
|
|
214
|
+
platform: "github",
|
|
215
|
+
stats: {
|
|
216
|
+
projectCount: 30,
|
|
217
|
+
commitCount: 2500,
|
|
218
|
+
contributions: []
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
totals: {
|
|
223
|
+
projectCount: 30,
|
|
224
|
+
commitCount: 2500
|
|
225
|
+
},
|
|
226
|
+
metadata: {
|
|
227
|
+
source: "mock",
|
|
228
|
+
fetchedAt: Date.now()
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function z(e = {}) {
|
|
233
|
+
const {
|
|
234
|
+
dataUrl: t = "/data/git-stats.json",
|
|
235
|
+
cacheTTL: s = 24 * 60 * 60 * 1e3,
|
|
236
|
+
useStaleCache: i = !0,
|
|
237
|
+
cacheKey: l = "git_stats_cache"
|
|
238
|
+
} = e, m = S(!1), u = S(null), n = S(null), d = S(null), p = S(!1);
|
|
239
|
+
function f() {
|
|
240
|
+
return O(this, null, function* () {
|
|
241
|
+
m.value = !0, u.value = null;
|
|
242
|
+
try {
|
|
243
|
+
const b = yield mt({
|
|
244
|
+
dataUrl: t,
|
|
245
|
+
cacheTTL: s,
|
|
246
|
+
cacheKey: l,
|
|
247
|
+
useStaleCache: i
|
|
248
|
+
});
|
|
249
|
+
return n.value = b.data, u.value = b.error, d.value = b.source, p.value = b.isDummy, b.data;
|
|
250
|
+
} catch (b) {
|
|
251
|
+
return u.value = b instanceof Error ? b : new Error("Failed to load data"), null;
|
|
252
|
+
} finally {
|
|
253
|
+
m.value = !1;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const c = E(() => {
|
|
258
|
+
var b;
|
|
259
|
+
return (b = n.value) != null && b.lastUpdated ? ft(n.value.lastUpdated) : "";
|
|
260
|
+
}), _ = E(() => {
|
|
261
|
+
if (p.value)
|
|
262
|
+
return "⚠️ Using dummy data for testing";
|
|
263
|
+
switch (d.value) {
|
|
264
|
+
case "static":
|
|
265
|
+
return "Real-time data";
|
|
266
|
+
case "cache":
|
|
267
|
+
return "Cached data";
|
|
268
|
+
case "mock":
|
|
269
|
+
return "Sample data";
|
|
270
|
+
default:
|
|
271
|
+
return "";
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return f(), {
|
|
275
|
+
data: n,
|
|
276
|
+
loading: m,
|
|
277
|
+
error: u,
|
|
278
|
+
dataSource: d,
|
|
279
|
+
dataSourceText: _,
|
|
280
|
+
lastUpdatedText: c,
|
|
281
|
+
isDummy: p,
|
|
282
|
+
loadData: f
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
const ht = { class: "git-contribution-graph" }, pt = { class: "graph-header" }, gt = { class: "header-info" }, bt = { class: "contribution-count" }, _t = {
|
|
286
|
+
key: 0,
|
|
287
|
+
class: "header-actions"
|
|
288
|
+
}, kt = {
|
|
289
|
+
key: 0,
|
|
290
|
+
class: "settings-dropdown"
|
|
291
|
+
}, Dt = ["onClick"], St = {
|
|
292
|
+
key: 0,
|
|
293
|
+
class: "loading-state"
|
|
294
|
+
}, wt = {
|
|
295
|
+
key: 1,
|
|
296
|
+
class: "graph-container"
|
|
297
|
+
}, Ct = { class: "graph-content-wrapper" }, $t = { class: "months-row" }, Tt = { class: "months-container" }, jt = { class: "grid-container" }, Lt = { class: "contribution-grid" }, Ut = ["title", "onClick"], xt = { class: "graph-footer" }, Ft = {
|
|
298
|
+
key: 0,
|
|
299
|
+
class: "last-updated"
|
|
300
|
+
}, It = { class: "legend" }, Et = { class: "legend-squares" }, Nt = /* @__PURE__ */ J({
|
|
301
|
+
__name: "ContributionGraph",
|
|
302
|
+
props: {
|
|
303
|
+
dataUrl: { default: "/data/git-stats.json" },
|
|
304
|
+
profileIndex: { default: 0 },
|
|
305
|
+
colorScheme: { default: "green" },
|
|
306
|
+
showSettings: { type: Boolean, default: !0 },
|
|
307
|
+
cacheTTL: { default: 24 * 60 * 60 * 1e3 }
|
|
308
|
+
},
|
|
309
|
+
emits: ["day-click", "color-scheme-change"],
|
|
310
|
+
setup(e, { emit: t }) {
|
|
311
|
+
const s = e, i = t, { data: l, loading: m, dataSourceText: u, lastUpdatedText: n, isDummy: d } = z(
|
|
312
|
+
{
|
|
313
|
+
dataUrl: s.dataUrl,
|
|
314
|
+
cacheTTL: s.cacheTTL
|
|
315
|
+
}
|
|
316
|
+
), p = S(s.colorScheme), f = S(!1), c = ["green", "blue", "purple", "orange"], _ = S([]), b = S([]);
|
|
317
|
+
q(
|
|
318
|
+
l,
|
|
319
|
+
(o) => {
|
|
320
|
+
var r, v, g;
|
|
321
|
+
if ((g = (v = (r = o == null ? void 0 : o.profiles) == null ? void 0 : r[s.profileIndex]) == null ? void 0 : v.stats) != null && g.contributions) {
|
|
322
|
+
const w = o.profiles[s.profileIndex].stats.contributions;
|
|
323
|
+
w && (_.value = G(w), H());
|
|
324
|
+
} else
|
|
325
|
+
_.value = [];
|
|
326
|
+
},
|
|
327
|
+
{ immediate: !0 }
|
|
328
|
+
);
|
|
329
|
+
const j = E(() => !_.value || _.value.length === 0 ? 0 : _.value.reduce((o, r) => !r.days || !Array.isArray(r.days) ? o : o + r.days.reduce((v, g) => v + (g.count || 0), 0), 0));
|
|
330
|
+
function G(o) {
|
|
331
|
+
if (!o || !Array.isArray(o))
|
|
332
|
+
return $();
|
|
333
|
+
const r = o.map((v) => ({
|
|
334
|
+
weekStart: v.firstDay || "",
|
|
335
|
+
days: v.contributionDays.map((g) => {
|
|
336
|
+
var w;
|
|
337
|
+
return {
|
|
338
|
+
date: g.date || "",
|
|
339
|
+
count: (w = g.contributionCount) != null ? w : 0,
|
|
340
|
+
weekday: g.weekday || 0
|
|
341
|
+
};
|
|
342
|
+
})
|
|
343
|
+
}));
|
|
344
|
+
for (; r.length < 53; )
|
|
345
|
+
r.push(x());
|
|
346
|
+
return r;
|
|
347
|
+
}
|
|
348
|
+
function $() {
|
|
349
|
+
const o = [];
|
|
350
|
+
for (let r = 0; r < 53; r++)
|
|
351
|
+
o.push(x());
|
|
352
|
+
return o;
|
|
353
|
+
}
|
|
354
|
+
function x() {
|
|
355
|
+
const o = [];
|
|
356
|
+
for (let r = 0; r < 7; r++)
|
|
357
|
+
o.push({ date: "", count: 0, weekday: r });
|
|
358
|
+
return { weekStart: "", days: o };
|
|
359
|
+
}
|
|
360
|
+
function H() {
|
|
361
|
+
if (!_.value || _.value.length === 0) {
|
|
362
|
+
b.value = [];
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const o = [];
|
|
366
|
+
let r = -1, v = -1;
|
|
367
|
+
_.value.forEach((g, w) => {
|
|
368
|
+
if (!g.days || g.days.length === 0) return;
|
|
369
|
+
const N = g.days[0].date;
|
|
370
|
+
if (!N) return;
|
|
371
|
+
const M = N.split("-");
|
|
372
|
+
if (M.length !== 3) return;
|
|
373
|
+
const [F, I] = M.map(Number);
|
|
374
|
+
if (!(isNaN(F) || isNaN(I)) && (I !== r || F !== v)) {
|
|
375
|
+
const at = new Date(F, I - 1, 1);
|
|
376
|
+
o.push({
|
|
377
|
+
week: w,
|
|
378
|
+
month: I - 1,
|
|
379
|
+
year: F,
|
|
380
|
+
label: at.toLocaleDateString("en-US", { month: "short" })
|
|
381
|
+
}), r = I, v = F;
|
|
382
|
+
}
|
|
383
|
+
}), b.value = o;
|
|
384
|
+
}
|
|
385
|
+
function Q(o) {
|
|
386
|
+
return `level-${X(o)} ${p.value}`;
|
|
387
|
+
}
|
|
388
|
+
function X(o) {
|
|
389
|
+
return o === 0 ? 0 : o <= 3 ? 1 : o <= 6 ? 2 : o <= 9 ? 3 : 4;
|
|
390
|
+
}
|
|
391
|
+
function Z(o) {
|
|
392
|
+
if (!o.date) return "";
|
|
393
|
+
const [r, v, g] = o.date.split("-").map(Number), N = new Date(r, v - 1, g).toLocaleDateString("en-US", {
|
|
394
|
+
weekday: "short",
|
|
395
|
+
year: "numeric",
|
|
396
|
+
month: "short",
|
|
397
|
+
day: "numeric"
|
|
398
|
+
}), M = o.count === 1 ? "contribution" : "contributions";
|
|
399
|
+
return `${o.count} ${M} on ${N}`;
|
|
400
|
+
}
|
|
401
|
+
function tt(o) {
|
|
402
|
+
i("day-click", { date: o.date, count: o.count });
|
|
403
|
+
}
|
|
404
|
+
function et() {
|
|
405
|
+
f.value = !f.value;
|
|
406
|
+
}
|
|
407
|
+
function st(o) {
|
|
408
|
+
p.value = o, f.value = !1, i("color-scheme-change", o);
|
|
409
|
+
}
|
|
410
|
+
return (o, r) => (h(), y("div", ht, [
|
|
411
|
+
a("div", pt, [
|
|
412
|
+
a("div", gt, [
|
|
413
|
+
a("h5", bt, D(j.value.toLocaleString()) + " contributions in the last year ", 1),
|
|
414
|
+
a("small", {
|
|
415
|
+
class: T(["data-source-text", { "is-dummy": k(d) }])
|
|
416
|
+
}, D(k(u)), 3)
|
|
417
|
+
]),
|
|
418
|
+
e.showSettings ? (h(), y("div", _t, [
|
|
419
|
+
a("button", {
|
|
420
|
+
class: "settings-btn",
|
|
421
|
+
type: "button",
|
|
422
|
+
onClick: et
|
|
423
|
+
}, [
|
|
424
|
+
L(o.$slots, "settings-icon", {}, () => [
|
|
425
|
+
r[0] || (r[0] = C("⚙️", -1))
|
|
426
|
+
], !0),
|
|
427
|
+
r[1] || (r[1] = C(" Settings ", -1))
|
|
428
|
+
]),
|
|
429
|
+
f.value ? (h(), y("div", kt, [
|
|
430
|
+
(h(), y(A, null, B(c, (v) => a("button", {
|
|
431
|
+
key: v,
|
|
432
|
+
onClick: (g) => st(v),
|
|
433
|
+
class: "settings-item"
|
|
434
|
+
}, D(v) + " theme ", 9, Dt)), 64))
|
|
435
|
+
])) : U("", !0)
|
|
436
|
+
])) : U("", !0)
|
|
437
|
+
]),
|
|
438
|
+
k(m) ? (h(), y("div", St, [...r[2] || (r[2] = [
|
|
439
|
+
a("div", { class: "spinner" }, null, -1),
|
|
440
|
+
a("span", null, "Loading contributions...", -1)
|
|
441
|
+
])])) : (h(), y("div", wt, [
|
|
442
|
+
a("div", Ct, [
|
|
443
|
+
a("div", $t, [
|
|
444
|
+
r[3] || (r[3] = a("div", { class: "month-spacer" }, null, -1)),
|
|
445
|
+
a("div", Tt, [
|
|
446
|
+
(h(!0), y(A, null, B(b.value, (v) => (h(), y("div", {
|
|
447
|
+
key: `${v.year}-${v.month}`,
|
|
448
|
+
class: "month-label",
|
|
449
|
+
style: ct({
|
|
450
|
+
gridColumn: `${v.week + 1} / span 1`
|
|
451
|
+
})
|
|
452
|
+
}, D(v.label), 5))), 128))
|
|
453
|
+
])
|
|
454
|
+
]),
|
|
455
|
+
a("div", jt, [
|
|
456
|
+
r[4] || (r[4] = ut('<div class="day-labels" data-v-3d412399><div class="day-label" data-v-3d412399>Mon</div><div class="day-label" data-v-3d412399></div><div class="day-label" data-v-3d412399>Wed</div><div class="day-label" data-v-3d412399></div><div class="day-label" data-v-3d412399>Fri</div><div class="day-label" data-v-3d412399></div><div class="day-label" data-v-3d412399></div></div>', 1)),
|
|
457
|
+
a("div", Lt, [
|
|
458
|
+
(h(!0), y(A, null, B(_.value, (v) => (h(), y("div", {
|
|
459
|
+
key: v.weekStart,
|
|
460
|
+
class: "contribution-week"
|
|
461
|
+
}, [
|
|
462
|
+
(h(!0), y(A, null, B(v.days, (g) => (h(), y("div", {
|
|
463
|
+
key: g.date,
|
|
464
|
+
class: T(["contribution-day", Q(g.count)]),
|
|
465
|
+
title: Z(g),
|
|
466
|
+
onClick: (w) => tt(g)
|
|
467
|
+
}, null, 10, Ut))), 128))
|
|
468
|
+
]))), 128))
|
|
469
|
+
])
|
|
470
|
+
])
|
|
471
|
+
]),
|
|
472
|
+
a("div", xt, [
|
|
473
|
+
k(n) ? (h(), y("small", Ft, " Last updated: " + D(k(n)), 1)) : U("", !0),
|
|
474
|
+
a("div", It, [
|
|
475
|
+
r[5] || (r[5] = a("small", { class: "legend-label" }, "Less", -1)),
|
|
476
|
+
a("div", Et, [
|
|
477
|
+
a("div", {
|
|
478
|
+
class: T(p.value + " contribution-day level-0")
|
|
479
|
+
}, null, 2),
|
|
480
|
+
a("div", {
|
|
481
|
+
class: T(p.value + " contribution-day level-1")
|
|
482
|
+
}, null, 2),
|
|
483
|
+
a("div", {
|
|
484
|
+
class: T(p.value + " contribution-day level-2")
|
|
485
|
+
}, null, 2),
|
|
486
|
+
a("div", {
|
|
487
|
+
class: T(p.value + " contribution-day level-3")
|
|
488
|
+
}, null, 2),
|
|
489
|
+
a("div", {
|
|
490
|
+
class: T(p.value + " contribution-day level-4")
|
|
491
|
+
}, null, 2)
|
|
492
|
+
]),
|
|
493
|
+
r[6] || (r[6] = a("small", { class: "legend-label" }, "More", -1))
|
|
494
|
+
])
|
|
495
|
+
])
|
|
496
|
+
]))
|
|
497
|
+
]));
|
|
498
|
+
}
|
|
499
|
+
}), K = (e, t) => {
|
|
500
|
+
const s = e.__vccOpts || e;
|
|
501
|
+
for (const [i, l] of t)
|
|
502
|
+
s[i] = l;
|
|
503
|
+
return s;
|
|
504
|
+
}, Mt = /* @__PURE__ */ K(Nt, [["__scopeId", "data-v-3d412399"]]), Ot = { class: "git-stats-breakdown" }, At = { class: "stats-grid" }, Bt = { class: "stat-card" }, Gt = { class: "stat-icon" }, Pt = { class: "stat-content" }, Vt = { class: "stat-value" }, Rt = { class: "stat-card" }, Yt = { class: "stat-icon" }, Wt = { class: "stat-content" }, Jt = {
|
|
505
|
+
key: 0,
|
|
506
|
+
class: "stat-loading"
|
|
507
|
+
}, qt = {
|
|
508
|
+
key: 1,
|
|
509
|
+
class: "stat-value"
|
|
510
|
+
}, zt = { class: "stat-card" }, Kt = { class: "stat-icon" }, Ht = { class: "stat-content" }, Qt = {
|
|
511
|
+
key: 0,
|
|
512
|
+
class: "stat-loading"
|
|
513
|
+
}, Xt = {
|
|
514
|
+
key: 1,
|
|
515
|
+
class: "stat-value"
|
|
516
|
+
}, Zt = {
|
|
517
|
+
key: 0,
|
|
518
|
+
class: "stat-card"
|
|
519
|
+
}, te = { class: "stat-icon" }, ee = { class: "stat-content" }, se = {
|
|
520
|
+
key: 0,
|
|
521
|
+
class: "stat-loading"
|
|
522
|
+
}, ae = {
|
|
523
|
+
key: 1,
|
|
524
|
+
class: "stat-value"
|
|
525
|
+
}, oe = { class: "stat-label" }, ne = { class: "stats-footer" }, re = {
|
|
526
|
+
key: 0,
|
|
527
|
+
class: "data-source"
|
|
528
|
+
}, ie = { key: 0 }, le = /* @__PURE__ */ J({
|
|
529
|
+
__name: "StatsBreakdown",
|
|
530
|
+
props: {
|
|
531
|
+
dataUrl: { default: "/data/git-stats.json" },
|
|
532
|
+
profileIndexes: { default: () => [] },
|
|
533
|
+
experienceData: { default: () => [] },
|
|
534
|
+
showCustomStat: { type: Boolean, default: !0 },
|
|
535
|
+
customStatCalculator: { type: [Function, null], default: null },
|
|
536
|
+
cacheTTL: { default: 24 * 60 * 60 * 1e3 }
|
|
537
|
+
},
|
|
538
|
+
setup(e) {
|
|
539
|
+
const t = e, { data: s, loading: i, dataSourceText: l, lastUpdatedText: m } = z({
|
|
540
|
+
dataUrl: t.dataUrl,
|
|
541
|
+
cacheTTL: t.cacheTTL
|
|
542
|
+
}), u = S(0), n = S(0);
|
|
543
|
+
q(
|
|
544
|
+
s,
|
|
545
|
+
(f) => {
|
|
546
|
+
var c, _;
|
|
547
|
+
if (f)
|
|
548
|
+
if (t.profileIndexes.length > 0) {
|
|
549
|
+
let b = 0, j = 0;
|
|
550
|
+
t.profileIndexes.forEach((G) => {
|
|
551
|
+
var x;
|
|
552
|
+
const $ = (x = f.profiles) == null ? void 0 : x[G];
|
|
553
|
+
$ != null && $.stats && (b += $.stats.projectCount || 0, j += $.stats.commitCount || 0);
|
|
554
|
+
}), u.value = b, n.value = j;
|
|
555
|
+
} else
|
|
556
|
+
u.value = ((c = f.totals) == null ? void 0 : c.projectCount) || 0, n.value = ((_ = f.totals) == null ? void 0 : _.commitCount) || 0;
|
|
557
|
+
},
|
|
558
|
+
{ immediate: !0 }
|
|
559
|
+
);
|
|
560
|
+
const d = E(() => vt(t.experienceData).toFixed(1)), p = E(() => {
|
|
561
|
+
if (t.customStatCalculator) {
|
|
562
|
+
const j = {
|
|
563
|
+
projects: u.value,
|
|
564
|
+
commits: n.value,
|
|
565
|
+
years: parseFloat(d.value)
|
|
566
|
+
};
|
|
567
|
+
return t.customStatCalculator(j);
|
|
568
|
+
}
|
|
569
|
+
return (u.value * 1.5 + n.value * 1.2 + parseFloat(d.value) * 1.5).toFixed(2);
|
|
570
|
+
});
|
|
571
|
+
return (f, c) => (h(), y("div", Ot, [
|
|
572
|
+
a("div", At, [
|
|
573
|
+
a("div", Bt, [
|
|
574
|
+
a("div", Gt, [
|
|
575
|
+
L(f.$slots, "icon-experience", {}, () => [
|
|
576
|
+
c[0] || (c[0] = C("⏱️", -1))
|
|
577
|
+
], !0)
|
|
578
|
+
]),
|
|
579
|
+
a("div", Pt, [
|
|
580
|
+
a("div", Vt, D(d.value), 1),
|
|
581
|
+
c[1] || (c[1] = a("div", { class: "stat-label" }, "Years Experience", -1))
|
|
582
|
+
])
|
|
583
|
+
]),
|
|
584
|
+
a("div", Rt, [
|
|
585
|
+
a("div", Yt, [
|
|
586
|
+
L(f.$slots, "icon-projects", {}, () => [
|
|
587
|
+
c[2] || (c[2] = C("📦", -1))
|
|
588
|
+
], !0)
|
|
589
|
+
]),
|
|
590
|
+
a("div", Wt, [
|
|
591
|
+
k(i) ? (h(), y("div", Jt, [...c[3] || (c[3] = [
|
|
592
|
+
a("div", { class: "spinner" }, null, -1)
|
|
593
|
+
])])) : (h(), y("div", qt, D(u.value), 1)),
|
|
594
|
+
c[4] || (c[4] = a("div", { class: "stat-label" }, "Projects", -1))
|
|
595
|
+
])
|
|
596
|
+
]),
|
|
597
|
+
a("div", zt, [
|
|
598
|
+
a("div", Kt, [
|
|
599
|
+
L(f.$slots, "icon-commits", {}, () => [
|
|
600
|
+
c[5] || (c[5] = C("💻", -1))
|
|
601
|
+
], !0)
|
|
602
|
+
]),
|
|
603
|
+
a("div", Ht, [
|
|
604
|
+
k(i) ? (h(), y("div", Qt, [...c[6] || (c[6] = [
|
|
605
|
+
a("div", { class: "spinner" }, null, -1)
|
|
606
|
+
])])) : (h(), y("div", Xt, D(n.value), 1)),
|
|
607
|
+
c[7] || (c[7] = a("div", { class: "stat-label" }, "Commits", -1))
|
|
608
|
+
])
|
|
609
|
+
]),
|
|
610
|
+
e.showCustomStat ? (h(), y("div", Zt, [
|
|
611
|
+
a("div", te, [
|
|
612
|
+
L(f.$slots, "icon-custom", {}, () => [
|
|
613
|
+
c[8] || (c[8] = C("☕", -1))
|
|
614
|
+
], !0)
|
|
615
|
+
]),
|
|
616
|
+
a("div", ee, [
|
|
617
|
+
k(i) ? (h(), y("div", se, [...c[9] || (c[9] = [
|
|
618
|
+
a("div", { class: "spinner" }, null, -1)
|
|
619
|
+
])])) : (h(), y("div", ae, D(p.value), 1)),
|
|
620
|
+
a("div", oe, [
|
|
621
|
+
L(f.$slots, "custom-stat-label", {}, () => [
|
|
622
|
+
c[10] || (c[10] = C("Coffee Consumed", -1))
|
|
623
|
+
], !0)
|
|
624
|
+
])
|
|
625
|
+
])
|
|
626
|
+
])) : U("", !0)
|
|
627
|
+
]),
|
|
628
|
+
a("div", ne, [
|
|
629
|
+
k(l) ? (h(), y("small", re, [
|
|
630
|
+
C(D(k(l)) + " ", 1),
|
|
631
|
+
k(m) ? (h(), y("span", ie, " · " + D(k(m)), 1)) : U("", !0)
|
|
632
|
+
])) : U("", !0)
|
|
633
|
+
])
|
|
634
|
+
]));
|
|
635
|
+
}
|
|
636
|
+
}), ce = /* @__PURE__ */ K(le, [["__scopeId", "data-v-31f1bb7a"]]), he = {
|
|
637
|
+
install(e) {
|
|
638
|
+
e.component("ContributionGraph", Mt), e.component("StatsBreakdown", ce);
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
export {
|
|
642
|
+
Mt as ContributionGraph,
|
|
643
|
+
ce as StatsBreakdown,
|
|
644
|
+
vt as calculateYearsExperience,
|
|
645
|
+
he as default,
|
|
646
|
+
mt as fetchGitStats,
|
|
647
|
+
me as fetchGitStatsAPI,
|
|
648
|
+
ft as formatLastUpdated,
|
|
649
|
+
dt as generateDummyContributions,
|
|
650
|
+
P as generateDummyStats,
|
|
651
|
+
fe as generateMultiProfileDummyStats,
|
|
652
|
+
ye as getContributionLevel,
|
|
653
|
+
ve as saveDummyDataToFile,
|
|
654
|
+
z as useGitStats
|
|
655
|
+
};
|
|
656
|
+
//# sourceMappingURL=vue.es.js.map
|