@rsalianto/git-heatmap-vue 0.1.2 → 0.1.4

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