@rsalianto/git-heatmap-vue 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GitHeatmap.vue.d.ts.map +1 -1
- package/dist/index.cjs +19 -2
- package/dist/index.mjs +197 -183
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHeatmap.vue.d.ts","sourceRoot":"","sources":["../src/GitHeatmap.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GitHeatmap.vue.d.ts","sourceRoot":"","sources":["../src/GitHeatmap.vue"],"names":[],"mappings":"AA2QA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAMtG,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;;;;;;YAVS,WAAW,EAAE;cACX,MAAM;aACP,MAAM;gBACH,MAAM;eACP,OAAO;gBACN,OAAO;qBACF,OAAO;mBACT,OAAO;WAEf,MAAM;;;;;AAyWhB,wBAUG"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),m=require("@rsalianto/git-heatmap-core");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),m=require("@rsalianto/git-heatmap-core");function V(t){const g=e.ref(t.data??null),a=e.ref(t.data?"success":"idle"),v=e.ref(null);async function c(){if(t.data){g.value=t.data,a.value="success";return}const p=t.fetchData??(t.apiUrl?()=>fetch(t.apiUrl).then(u=>u.json()):null);if(p){a.value="loading";try{g.value=await p(),a.value="success"}catch(u){v.value=u instanceof Error?u:new Error(String(u)),a.value="error"}}}return e.onMounted(c),e.watch(()=>t.apiUrl,c),{data:g,status:a,error:v}}const G=["aria-label"],U={key:0,style:{opacity:"0.6",padding:"1rem 0"}},Y={key:0,style:{height:"14px",width:"160px",background:"var(--ghm-text)","border-radius":"4px","margin-bottom":"12px",opacity:"0.2"}},O=["width","height"],P=["x","y","width","height","rx"],j={key:0,style:{"margin-bottom":"12px",color:"var(--ghm-text)"}},W=["width","height","aria-label"],q=["x","y"],I=["x","y"],X=["x","y","width","height","rx","fill","aria-label","onMouseenter","onClick"],_={key:1,style:{"margin-top":"8px","font-size":"0.9em",background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.1)","border-radius":"4px",padding:"6px 12px"}},J={key:2,style:{display:"flex","align-items":"center","justify-content":"flex-end","margin-top":"8px"}},K={style:{display:"flex","align-items":"center",gap:"6px","font-size":"0.9em"}},Q=["width","height"],Z=["width","height","rx","fill"],D=32,N=16,F=e.defineComponent({__name:"GitHeatmap",props:{data:{},apiUrl:{},fetchData:{},levels:{default:()=>m.DEFAULT_LEVELS},cellSize:{default:m.CELL},cellGap:{default:m.GAP},cellRadius:{default:2},showTotal:{type:Boolean,default:!0},showLegend:{type:Boolean,default:!0},showMonthLabels:{type:Boolean,default:!0},showDayLabels:{type:Boolean,default:!0},theme:{},label:{default:"Contribution heatmap"}},emits:["day-click"],setup(t,{emit:g}){const a=t,v=g,{data:c,status:p,error:u}=V({data:a.data,apiUrl:a.apiUrl,fetchData:a.fetchData}),k=e.ref(null),E=e.ref(null),f=e.ref(null),h=e.ref(null),d=e.computed(()=>a.cellSize+a.cellGap),y=e.computed(()=>a.showDayLabels?D:0),b=e.computed(()=>a.showMonthLabels?N+a.cellGap:0),L=e.computed(()=>c.value?c.value.weeks.length*d.value+y.value:53*d.value+y.value),w=e.computed(()=>7*d.value-a.cellGap+b.value),i=e.computed(()=>({...m.DEFAULT_THEME,...a.theme})),M=e.computed(()=>({"--ghm-color-l0":i.value.colorL0,"--ghm-color-l1":i.value.colorL1,"--ghm-color-l2":i.value.colorL2,"--ghm-color-l3":i.value.colorL3,"--ghm-color-l4":i.value.colorL4,"--ghm-text":i.value.textColor,"--ghm-tooltip-bg":i.value.tooltipBg,"--ghm-tooltip-border":i.value.tooltipBorderColor,"--ghm-tooltip-text":i.value.tooltipTextColor,"--ghm-font":i.value.fontFamily,"--ghm-fs":i.value.fontSize})),A=e.computed(()=>a.showMonthLabels&&c.value?m.buildMonthLabels(c.value.weeks):[]),H=e.computed(()=>Array.from({length:53},(l,n)=>n)),R=e.computed(()=>Array.from({length:7},(l,n)=>n));function B(l){return l.count===0?`No contributions on ${l.date}`:`${l.count} contribution${l.count>1?"s":""} on ${l.date}`}function S(l){return y.value+l*d.value}function C(l){return b.value+l*d.value}function T(l,n){var s;const o=l.currentTarget.getBoundingClientRect(),r=(s=E.value)==null?void 0:s.getBoundingClientRect();r&&(h.value={day:n,x:o.left-r.left+a.cellSize/2,y:o.top-r.top})}function $(l){var n;f.value=((n=f.value)==null?void 0:n.date)===l.date?null:l,v("day-click",l)}return e.watch(c,l=>{l&&k.value&&(k.value.scrollLeft=k.value.scrollWidth)}),e.onMounted(()=>{if(typeof document>"u"||document.getElementById("ghm-style"))return;const l=document.createElement("style");l.id="ghm-style",l.textContent=`
|
|
2
2
|
[data-git-heatmap] {
|
|
3
3
|
display: block; position: relative; width: 100%;
|
|
4
4
|
font-size: var(--ghm-fs); font-family: var(--ghm-font);
|
|
@@ -7,4 +7,21 @@
|
|
|
7
7
|
[data-git-heatmap] * { box-sizing: border-box; }
|
|
8
8
|
[data-git-heatmap] rect { transition: opacity 0.15s; cursor: pointer; }
|
|
9
9
|
[data-git-heatmap] rect:hover { opacity: 0.7; }
|
|
10
|
-
|
|
10
|
+
.ghm-scroll {
|
|
11
|
+
overflow-x: auto;
|
|
12
|
+
overflow-y: visible;
|
|
13
|
+
padding-bottom: 4px;
|
|
14
|
+
scrollbar-width: thin;
|
|
15
|
+
scrollbar-color: transparent transparent;
|
|
16
|
+
-webkit-overflow-scrolling: touch;
|
|
17
|
+
}
|
|
18
|
+
.ghm-scroll:hover { scrollbar-color: rgba(255,255,255,0.25) transparent; }
|
|
19
|
+
.ghm-scroll::-webkit-scrollbar { height: 4px; }
|
|
20
|
+
.ghm-scroll::-webkit-scrollbar-track { background: transparent; }
|
|
21
|
+
.ghm-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
|
|
22
|
+
.ghm-scroll:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); }
|
|
23
|
+
@media (hover: none) {
|
|
24
|
+
.ghm-scroll { scrollbar-width: none; }
|
|
25
|
+
.ghm-scroll::-webkit-scrollbar { display: none; }
|
|
26
|
+
}
|
|
27
|
+
`,document.head.appendChild(l)}),(l,n)=>(e.openBlock(),e.createElementBlock("div",{"data-git-heatmap":"",style:e.normalizeStyle(M.value),"aria-label":t.label,ref_key:"wrapperRef",ref:E},[e.unref(u)?(e.openBlock(),e.createElementBlock("p",U,"Could not load contribution data.")):e.unref(p)==="loading"||e.unref(p)==="idle"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showTotal?(e.openBlock(),e.createElementBlock("div",Y)):e.createCommentVNode("",!0),(e.openBlock(),e.createElementBlock("svg",{width:L.value,height:w.value,style:{display:"block",opacity:"0.4"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(H.value,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,r=>(e.openBlock(),e.createElementBlock("rect",{key:`s-${o}-${r}`,x:y.value+o*d.value,y:b.value+r*d.value,width:t.cellSize,height:t.cellSize,rx:t.cellRadius,fill:"var(--ghm-color-l0)"},null,8,P))),128))],64))),128))],8,O))],64)):e.unref(c)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[t.showTotal?(e.openBlock(),e.createElementBlock("p",j,e.toDisplayString(e.unref(c).totalContributions.toLocaleString())+" contributions in the last year ",1)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"scrollRef",ref:k,class:"ghm-scroll"},[(e.openBlock(),e.createElementBlock("svg",{width:L.value,height:w.value,style:{display:"block",overflow:"visible"},role:"img","aria-label":t.label},[t.showMonthLabels?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(A.value,(o,r)=>(e.openBlock(),e.createElementBlock("text",{key:o.label+o.col,x:S(o.col),y:N-4,fill:"var(--ghm-text)","font-size":"10"},e.toDisplayString(o.label),9,q))),128)):e.createCommentVNode("",!0),t.showDayLabels?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},e.renderList(7,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[e.unref(m.DAY_LABELS)[o-1]?(e.openBlock(),e.createElementBlock("text",{key:0,x:D-6,y:C(o-1)+t.cellSize,fill:"var(--ghm-text)","font-size":"10","text-anchor":"end"},e.toDisplayString(e.unref(m.DAY_LABELS)[o-1]),9,I)):e.createCommentVNode("",!0)],64))),64)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c).weeks,(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,s=>{var z;return e.openBlock(),e.createElementBlock(e.Fragment,{key:s},[(z=o.days[s-1])!=null&&z.date?(e.openBlock(),e.createElementBlock("rect",{key:0,x:S(r),y:C(s-1),width:t.cellSize,height:t.cellSize,rx:t.cellRadius,fill:`var(--ghm-color-l${o.days[s-1].level})`,"aria-label":B(o.days[s-1]),role:"button",onMouseenter:x=>T(x,o.days[s-1]),onMouseleave:n[0]||(n[0]=x=>h.value=null),onClick:x=>$(o.days[s-1])},null,40,X)):e.createCommentVNode("",!0)],64)}),64))],64))),128))],8,W))],512),f.value?(e.openBlock(),e.createElementBlock("div",_,e.toDisplayString(B(f.value)),1)):e.createCommentVNode("",!0),t.showLegend?(e.openBlock(),e.createElementBlock("div",J,[e.createElementVNode("div",K,[n[1]||(n[1]=e.createElementVNode("span",null,"Less",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.levels,(o,r)=>(e.openBlock(),e.createElementBlock("svg",{key:r,width:t.cellSize,height:t.cellSize,style:{display:"block"}},[e.createElementVNode("rect",{width:t.cellSize,height:t.cellSize,rx:t.cellRadius,fill:`var(--ghm-color-l${r})`},[e.createElementVNode("title",null,e.toDisplayString(o.label),1)],8,Z)],8,Q))),128)),n[2]||(n[2]=e.createElementVNode("span",null,"More",-1))])])):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createElementBlock("div",{key:3,style:e.normalizeStyle({pointerEvents:"none",position:"absolute",zIndex:50,left:`${h.value.x}px`,top:`${h.value.y-6}px`,transform:"translate(-50%, -100%)",background:"var(--ghm-tooltip-bg)",border:"1px solid var(--ghm-tooltip-border)",color:"var(--ghm-tooltip-text)",fontSize:"0.9em",borderRadius:"4px",padding:"3px 8px",whiteSpace:"nowrap"})},e.toDisplayString(B(h.value.day)),5)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],12,G))}}),ee={install(t){t.component("GitHeatmap",F)}};exports.GitHeatmap=F;exports.GitHeatmapPlugin=ee;exports.useHeatmapData=V;
|
package/dist/index.mjs
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { GAP as
|
|
3
|
-
function
|
|
4
|
-
const w =
|
|
5
|
-
async function
|
|
1
|
+
import { ref as y, onMounted as Y, watch as O, defineComponent as q, computed as d, openBlock as t, createElementBlock as l, normalizeStyle as U, unref as v, Fragment as s, createCommentVNode as g, renderList as b, toDisplayString as x, createElementVNode as k } from "vue";
|
|
2
|
+
import { GAP as J, CELL as K, DEFAULT_LEVELS as Q, DEFAULT_THEME as Z, buildMonthLabels as ee, DAY_LABELS as F } from "@rsalianto/git-heatmap-core";
|
|
3
|
+
function te(e) {
|
|
4
|
+
const w = y(e.data ?? null), r = y(e.data ? "success" : "idle"), z = y(null);
|
|
5
|
+
async function u() {
|
|
6
6
|
if (e.data) {
|
|
7
|
-
w.value = e.data,
|
|
7
|
+
w.value = e.data, r.value = "success";
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
const L = e.fetchData ?? (e.apiUrl ? () => fetch(e.apiUrl).then((
|
|
10
|
+
const L = e.fetchData ?? (e.apiUrl ? () => fetch(e.apiUrl).then((m) => m.json()) : null);
|
|
11
11
|
if (L) {
|
|
12
|
-
|
|
12
|
+
r.value = "loading";
|
|
13
13
|
try {
|
|
14
|
-
w.value = await L(),
|
|
15
|
-
} catch (
|
|
16
|
-
z.value =
|
|
14
|
+
w.value = await L(), r.value = "success";
|
|
15
|
+
} catch (m) {
|
|
16
|
+
z.value = m instanceof Error ? m : new Error(String(m)), r.value = "error";
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return Y(u), O(() => e.apiUrl, u), { data: w, status: r, error: z };
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const le = ["aria-label"], ae = {
|
|
23
23
|
key: 0,
|
|
24
24
|
style: { opacity: "0.6", padding: "1rem 0" }
|
|
25
|
-
},
|
|
25
|
+
}, oe = {
|
|
26
26
|
key: 0,
|
|
27
27
|
style: { height: "14px", width: "160px", background: "var(--ghm-text)", "border-radius": "4px", "margin-bottom": "12px", opacity: "0.2" }
|
|
28
|
-
},
|
|
28
|
+
}, re = ["width", "height"], ne = ["x", "y", "width", "height", "rx"], ie = {
|
|
29
29
|
key: 0,
|
|
30
30
|
style: { "margin-bottom": "12px", color: "var(--ghm-text)" }
|
|
31
|
-
},
|
|
31
|
+
}, se = ["width", "height", "aria-label"], ue = ["x", "y"], ce = ["x", "y"], he = ["x", "y", "width", "height", "rx", "fill", "aria-label", "onMouseenter", "onClick"], de = {
|
|
32
32
|
key: 1,
|
|
33
33
|
style: { "margin-top": "8px", "font-size": "0.9em", background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", "border-radius": "4px", padding: "6px 12px" }
|
|
34
|
-
},
|
|
34
|
+
}, ge = {
|
|
35
35
|
key: 2,
|
|
36
36
|
style: { display: "flex", "align-items": "center", "justify-content": "flex-end", "margin-top": "8px" }
|
|
37
|
-
},
|
|
37
|
+
}, ve = { style: { display: "flex", "align-items": "center", gap: "6px", "font-size": "0.9em" } }, me = ["width", "height"], fe = ["width", "height", "rx", "fill"], N = 32, V = 16, be = /* @__PURE__ */ q({
|
|
38
38
|
__name: "GitHeatmap",
|
|
39
39
|
props: {
|
|
40
40
|
data: {},
|
|
41
41
|
apiUrl: {},
|
|
42
42
|
fetchData: {},
|
|
43
|
-
levels: { default: () =>
|
|
44
|
-
cellSize: { default:
|
|
45
|
-
cellGap: { default:
|
|
43
|
+
levels: { default: () => Q },
|
|
44
|
+
cellSize: { default: K },
|
|
45
|
+
cellGap: { default: J },
|
|
46
46
|
cellRadius: { default: 2 },
|
|
47
47
|
showTotal: { type: Boolean, default: !0 },
|
|
48
48
|
showLegend: { type: Boolean, default: !0 },
|
|
@@ -53,53 +53,53 @@ const ne = ["aria-label"], ie = {
|
|
|
53
53
|
},
|
|
54
54
|
emits: ["day-click"],
|
|
55
55
|
setup(e, { emit: w }) {
|
|
56
|
-
const
|
|
57
|
-
data:
|
|
58
|
-
apiUrl:
|
|
59
|
-
fetchData:
|
|
60
|
-
}), S =
|
|
61
|
-
() =>
|
|
62
|
-
),
|
|
63
|
-
() => 7 * f.value -
|
|
64
|
-
),
|
|
65
|
-
"--ghm-color-l0":
|
|
66
|
-
"--ghm-color-l1":
|
|
67
|
-
"--ghm-color-l2":
|
|
68
|
-
"--ghm-color-l3":
|
|
69
|
-
"--ghm-color-l4":
|
|
70
|
-
"--ghm-text":
|
|
71
|
-
"--ghm-tooltip-bg":
|
|
72
|
-
"--ghm-tooltip-border":
|
|
73
|
-
"--ghm-tooltip-text":
|
|
74
|
-
"--ghm-font":
|
|
75
|
-
"--ghm-fs":
|
|
76
|
-
})),
|
|
77
|
-
() =>
|
|
78
|
-
),
|
|
79
|
-
function
|
|
80
|
-
return
|
|
56
|
+
const r = e, z = w, { data: u, status: L, error: m } = te({
|
|
57
|
+
data: r.data,
|
|
58
|
+
apiUrl: r.apiUrl,
|
|
59
|
+
fetchData: r.fetchData
|
|
60
|
+
}), S = y(null), R = y(null), C = y(null), p = y(null), f = d(() => r.cellSize + r.cellGap), E = d(() => r.showDayLabels ? N : 0), B = d(() => r.showMonthLabels ? V + r.cellGap : 0), $ = d(
|
|
61
|
+
() => u.value ? u.value.weeks.length * f.value + E.value : 53 * f.value + E.value
|
|
62
|
+
), T = d(
|
|
63
|
+
() => 7 * f.value - r.cellGap + B.value
|
|
64
|
+
), c = d(() => ({ ...Z, ...r.theme })), W = d(() => ({
|
|
65
|
+
"--ghm-color-l0": c.value.colorL0,
|
|
66
|
+
"--ghm-color-l1": c.value.colorL1,
|
|
67
|
+
"--ghm-color-l2": c.value.colorL2,
|
|
68
|
+
"--ghm-color-l3": c.value.colorL3,
|
|
69
|
+
"--ghm-color-l4": c.value.colorL4,
|
|
70
|
+
"--ghm-text": c.value.textColor,
|
|
71
|
+
"--ghm-tooltip-bg": c.value.tooltipBg,
|
|
72
|
+
"--ghm-tooltip-border": c.value.tooltipBorderColor,
|
|
73
|
+
"--ghm-tooltip-text": c.value.tooltipTextColor,
|
|
74
|
+
"--ghm-font": c.value.fontFamily,
|
|
75
|
+
"--ghm-fs": c.value.fontSize
|
|
76
|
+
})), j = d(
|
|
77
|
+
() => r.showMonthLabels && u.value ? ee(u.value.weeks) : []
|
|
78
|
+
), I = d(() => Array.from({ length: 53 }, (a, n) => n)), P = d(() => Array.from({ length: 7 }, (a, n) => n));
|
|
79
|
+
function D(a) {
|
|
80
|
+
return a.count === 0 ? `No contributions on ${a.date}` : `${a.count} contribution${a.count > 1 ? "s" : ""} on ${a.date}`;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
return E.value +
|
|
82
|
+
function A(a) {
|
|
83
|
+
return E.value + a * f.value;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return B.value +
|
|
85
|
+
function G(a) {
|
|
86
|
+
return B.value + a * f.value;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function X(a, n) {
|
|
89
89
|
var h;
|
|
90
|
-
const
|
|
91
|
-
|
|
90
|
+
const o = a.currentTarget.getBoundingClientRect(), i = (h = R.value) == null ? void 0 : h.getBoundingClientRect();
|
|
91
|
+
i && (p.value = { day: n, x: o.left - i.left + r.cellSize / 2, y: o.top - i.top });
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
var
|
|
95
|
-
C.value = ((
|
|
93
|
+
function _(a) {
|
|
94
|
+
var n;
|
|
95
|
+
C.value = ((n = C.value) == null ? void 0 : n.date) === a.date ? null : a, z("day-click", a);
|
|
96
96
|
}
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
}),
|
|
97
|
+
return O(u, (a) => {
|
|
98
|
+
a && S.value && (S.value.scrollLeft = S.value.scrollWidth);
|
|
99
|
+
}), Y(() => {
|
|
100
100
|
if (typeof document > "u" || document.getElementById("ghm-style")) return;
|
|
101
|
-
const
|
|
102
|
-
|
|
101
|
+
const a = document.createElement("style");
|
|
102
|
+
a.id = "ghm-style", a.textContent = `
|
|
103
103
|
[data-git-heatmap] {
|
|
104
104
|
display: block; position: relative; width: 100%;
|
|
105
105
|
font-size: var(--ghm-fs); font-family: var(--ghm-font);
|
|
@@ -108,140 +108,154 @@ const ne = ["aria-label"], ie = {
|
|
|
108
108
|
[data-git-heatmap] * { box-sizing: border-box; }
|
|
109
109
|
[data-git-heatmap] rect { transition: opacity 0.15s; cursor: pointer; }
|
|
110
110
|
[data-git-heatmap] rect:hover { opacity: 0.7; }
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
111
|
+
.ghm-scroll {
|
|
112
|
+
overflow-x: auto;
|
|
113
|
+
overflow-y: visible;
|
|
114
|
+
padding-bottom: 4px;
|
|
115
|
+
scrollbar-width: thin;
|
|
116
|
+
scrollbar-color: transparent transparent;
|
|
117
|
+
-webkit-overflow-scrolling: touch;
|
|
118
|
+
}
|
|
119
|
+
.ghm-scroll:hover { scrollbar-color: rgba(255,255,255,0.25) transparent; }
|
|
120
|
+
.ghm-scroll::-webkit-scrollbar { height: 4px; }
|
|
121
|
+
.ghm-scroll::-webkit-scrollbar-track { background: transparent; }
|
|
122
|
+
.ghm-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
|
|
123
|
+
.ghm-scroll:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); }
|
|
124
|
+
@media (hover: none) {
|
|
125
|
+
.ghm-scroll { scrollbar-width: none; }
|
|
126
|
+
.ghm-scroll::-webkit-scrollbar { display: none; }
|
|
127
|
+
}
|
|
128
|
+
`, document.head.appendChild(a);
|
|
129
|
+
}), (a, n) => (t(), l("div", {
|
|
130
|
+
"data-git-heatmap": "",
|
|
131
|
+
style: U(W.value),
|
|
132
|
+
"aria-label": e.label,
|
|
133
|
+
ref_key: "wrapperRef",
|
|
134
|
+
ref: R
|
|
135
|
+
}, [
|
|
136
|
+
v(m) ? (t(), l("p", ae, "Could not load contribution data.")) : v(L) === "loading" || v(L) === "idle" ? (t(), l(s, { key: 1 }, [
|
|
137
|
+
e.showTotal ? (t(), l("div", oe)) : g("", !0),
|
|
138
|
+
(t(), l("svg", {
|
|
139
|
+
width: $.value,
|
|
140
|
+
height: T.value,
|
|
141
|
+
style: { display: "block", opacity: "0.4" }
|
|
142
|
+
}, [
|
|
143
|
+
(t(!0), l(s, null, b(I.value, (o) => (t(), l(s, { key: o }, [
|
|
144
|
+
(t(!0), l(s, null, b(P.value, (i) => (t(), l("rect", {
|
|
145
|
+
key: `s-${o}-${i}`,
|
|
146
|
+
x: E.value + o * f.value,
|
|
147
|
+
y: B.value + i * f.value,
|
|
132
148
|
width: e.cellSize,
|
|
133
149
|
height: e.cellSize,
|
|
134
150
|
rx: e.cellRadius,
|
|
135
151
|
fill: "var(--ghm-color-l0)"
|
|
136
|
-
}, null, 8,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
152
|
+
}, null, 8, ne))), 128))
|
|
153
|
+
], 64))), 128))
|
|
154
|
+
], 8, re))
|
|
155
|
+
], 64)) : v(u) ? (t(), l(s, { key: 2 }, [
|
|
156
|
+
e.showTotal ? (t(), l("p", ie, x(v(u).totalContributions.toLocaleString()) + " contributions in the last year ", 1)) : g("", !0),
|
|
157
|
+
k("div", {
|
|
158
|
+
ref_key: "scrollRef",
|
|
159
|
+
ref: S,
|
|
160
|
+
class: "ghm-scroll"
|
|
161
|
+
}, [
|
|
162
|
+
(t(), l("svg", {
|
|
163
|
+
width: $.value,
|
|
164
|
+
height: T.value,
|
|
165
|
+
style: { display: "block", overflow: "visible" },
|
|
166
|
+
role: "img",
|
|
167
|
+
"aria-label": e.label
|
|
146
168
|
}, [
|
|
147
|
-
(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
e.showMonthLabels ? (t(!0), l(s, { key: 0 }, b(j.value, (o, i) => (t(), l("text", {
|
|
170
|
+
key: o.label + o.col,
|
|
171
|
+
x: A(o.col),
|
|
172
|
+
y: V - 4,
|
|
173
|
+
fill: "var(--ghm-text)",
|
|
174
|
+
"font-size": "10"
|
|
175
|
+
}, x(o.label), 9, ue))), 128)) : g("", !0),
|
|
176
|
+
e.showDayLabels ? (t(), l(s, { key: 1 }, b(7, (o) => (t(), l(s, { key: o }, [
|
|
177
|
+
v(F)[o - 1] ? (t(), l("text", {
|
|
178
|
+
key: 0,
|
|
179
|
+
x: N - 6,
|
|
180
|
+
y: G(o - 1) + e.cellSize,
|
|
158
181
|
fill: "var(--ghm-text)",
|
|
159
|
-
"font-size": "10"
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
i[1] || (i[1] = y("span", null, "Less", -1)),
|
|
198
|
-
(l(!0), o(u, null, x(e.levels, (a, h) => (l(), o("svg", {
|
|
199
|
-
key: h,
|
|
182
|
+
"font-size": "10",
|
|
183
|
+
"text-anchor": "end"
|
|
184
|
+
}, x(v(F)[o - 1]), 9, ce)) : g("", !0)
|
|
185
|
+
], 64))), 64)) : g("", !0),
|
|
186
|
+
(t(!0), l(s, null, b(v(u).weeks, (o, i) => (t(), l(s, { key: i }, [
|
|
187
|
+
(t(), l(s, null, b(7, (h) => {
|
|
188
|
+
var H;
|
|
189
|
+
return t(), l(s, { key: h }, [
|
|
190
|
+
(H = o.days[h - 1]) != null && H.date ? (t(), l("rect", {
|
|
191
|
+
key: 0,
|
|
192
|
+
x: A(i),
|
|
193
|
+
y: G(h - 1),
|
|
194
|
+
width: e.cellSize,
|
|
195
|
+
height: e.cellSize,
|
|
196
|
+
rx: e.cellRadius,
|
|
197
|
+
fill: `var(--ghm-color-l${o.days[h - 1].level})`,
|
|
198
|
+
"aria-label": D(o.days[h - 1]),
|
|
199
|
+
role: "button",
|
|
200
|
+
onMouseenter: (M) => X(M, o.days[h - 1]),
|
|
201
|
+
onMouseleave: n[0] || (n[0] = (M) => p.value = null),
|
|
202
|
+
onClick: (M) => _(o.days[h - 1])
|
|
203
|
+
}, null, 40, he)) : g("", !0)
|
|
204
|
+
], 64);
|
|
205
|
+
}), 64))
|
|
206
|
+
], 64))), 128))
|
|
207
|
+
], 8, se))
|
|
208
|
+
], 512),
|
|
209
|
+
C.value ? (t(), l("div", de, x(D(C.value)), 1)) : g("", !0),
|
|
210
|
+
e.showLegend ? (t(), l("div", ge, [
|
|
211
|
+
k("div", ve, [
|
|
212
|
+
n[1] || (n[1] = k("span", null, "Less", -1)),
|
|
213
|
+
(t(!0), l(s, null, b(e.levels, (o, i) => (t(), l("svg", {
|
|
214
|
+
key: i,
|
|
215
|
+
width: e.cellSize,
|
|
216
|
+
height: e.cellSize,
|
|
217
|
+
style: { display: "block" }
|
|
218
|
+
}, [
|
|
219
|
+
k("rect", {
|
|
200
220
|
width: e.cellSize,
|
|
201
221
|
height: e.cellSize,
|
|
202
|
-
|
|
222
|
+
rx: e.cellRadius,
|
|
223
|
+
fill: `var(--ghm-color-l${i})`
|
|
203
224
|
}, [
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
padding: "3px 8px",
|
|
231
|
-
whiteSpace: "nowrap"
|
|
232
|
-
})
|
|
233
|
-
}, k(M(b.value.day)), 5)) : d("", !0)
|
|
234
|
-
], 64)) : d("", !0)
|
|
235
|
-
], 12, ne);
|
|
236
|
-
};
|
|
225
|
+
k("title", null, x(o.label), 1)
|
|
226
|
+
], 8, fe)
|
|
227
|
+
], 8, me))), 128)),
|
|
228
|
+
n[2] || (n[2] = k("span", null, "More", -1))
|
|
229
|
+
])
|
|
230
|
+
])) : g("", !0),
|
|
231
|
+
p.value ? (t(), l("div", {
|
|
232
|
+
key: 3,
|
|
233
|
+
style: U({
|
|
234
|
+
pointerEvents: "none",
|
|
235
|
+
position: "absolute",
|
|
236
|
+
zIndex: 50,
|
|
237
|
+
left: `${p.value.x}px`,
|
|
238
|
+
top: `${p.value.y - 6}px`,
|
|
239
|
+
transform: "translate(-50%, -100%)",
|
|
240
|
+
background: "var(--ghm-tooltip-bg)",
|
|
241
|
+
border: "1px solid var(--ghm-tooltip-border)",
|
|
242
|
+
color: "var(--ghm-tooltip-text)",
|
|
243
|
+
fontSize: "0.9em",
|
|
244
|
+
borderRadius: "4px",
|
|
245
|
+
padding: "3px 8px",
|
|
246
|
+
whiteSpace: "nowrap"
|
|
247
|
+
})
|
|
248
|
+
}, x(D(p.value.day)), 5)) : g("", !0)
|
|
249
|
+
], 64)) : g("", !0)
|
|
250
|
+
], 12, le));
|
|
237
251
|
}
|
|
238
|
-
}),
|
|
252
|
+
}), xe = {
|
|
239
253
|
install(e) {
|
|
240
|
-
e.component("GitHeatmap",
|
|
254
|
+
e.component("GitHeatmap", be);
|
|
241
255
|
}
|
|
242
256
|
};
|
|
243
257
|
export {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
258
|
+
be as GitHeatmap,
|
|
259
|
+
xe as GitHeatmapPlugin,
|
|
260
|
+
te as useHeatmapData
|
|
247
261
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsalianto/git-heatmap-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Vue 3 component for git contribution heatmap",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"clean": "rm -rf dist"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@rsalianto/git-heatmap-core": "
|
|
27
|
+
"@rsalianto/git-heatmap-core": "0.1.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"vue": ">=3.3.0"
|