Socket
Socket
Sign inDemoInstall

svelte-heatmap

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-beta.0 to 1.0.0-beta.1

src/SvelteHeatmap.svelte

6

dist/index.cjs.js

@@ -1121,3 +1121,3 @@ 'use strict';

/* src/Heatmap.svelte generated by Svelte v3.20.1 */
/* src/SvelteHeatmap.svelte generated by Svelte v3.20.1 */

@@ -1855,3 +1855,3 @@ function get_each_context_1(ctx, list, i) {

class Heatmap extends SvelteComponent {
class SvelteHeatmap extends SvelteComponent {
constructor(options) {

@@ -1891,2 +1891,2 @@ super();

module.exports = Heatmap;
module.exports = SvelteHeatmap;

@@ -1119,3 +1119,3 @@ function noop() { }

/* src/Heatmap.svelte generated by Svelte v3.20.1 */
/* src/SvelteHeatmap.svelte generated by Svelte v3.20.1 */

@@ -1853,3 +1853,3 @@ function get_each_context_1(ctx, list, i) {

class Heatmap extends SvelteComponent {
class SvelteHeatmap extends SvelteComponent {
constructor(options) {

@@ -1889,2 +1889,2 @@ super();

export default Heatmap;
export default SvelteHeatmap;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Heatmap = factory());
(global = global || self, global.SvelteHeatmap = factory());
}(this, (function () { 'use strict';

@@ -1125,3 +1125,3 @@

/* src/Heatmap.svelte generated by Svelte v3.20.1 */
/* src/SvelteHeatmap.svelte generated by Svelte v3.20.1 */

@@ -1859,3 +1859,3 @@ function get_each_context_1(ctx, list, i) {

class Heatmap extends SvelteComponent {
class SvelteHeatmap extends SvelteComponent {
constructor(options) {

@@ -1895,4 +1895,4 @@ super();

return Heatmap;
return SvelteHeatmap;
})));

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Heatmap=e()}(this,(function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function l(t){t.forEach(e)}function o(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function r(t,e){t.appendChild(e)}function i(t,e,n){t.insertBefore(e,n||null)}function c(t){t.parentNode.removeChild(t)}function f(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function u(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function s(t){return document.createTextNode(t)}function d(){return s("")}function h(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function g(t,e){e=""+e,t.data!==e&&(t.data=e)}let m;function p(t){m=t}const y=[],$=[],b=[],w=[],D=Promise.resolve();let v=!1;function x(t){b.push(t)}let z=!1;const L=new Set;function S(){if(!z){z=!0;do{for(let t=0;t<y.length;t+=1){const e=y[t];p(e),R(e.$$)}for(y.length=0;$.length;)$.pop()();for(let t=0;t<b.length;t+=1){const e=b[t];L.has(e)||(L.add(e),e())}b.length=0}while(y.length);for(;w.length;)w.pop()();v=!1,z=!1,L.clear()}}function R(t){if(null!==t.fragment){t.update(),l(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(x)}}const M=new Set;let G;function C(){G={r:0,c:[],p:G}}function F(){G.r||l(G.c),G=G.p}function H(t,e){t&&t.i&&(M.delete(t),t.i(e))}function O(t,e,n,l){if(t&&t.o){if(M.has(t))return;M.add(t),G.c.push(()=>{M.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}}function _(t){t&&t.c()}function N(t,n,a){const{fragment:r,on_mount:i,on_destroy:c,after_update:f}=t.$$;r&&r.m(n,a),x(()=>{const n=i.map(e).filter(o);c?c.push(...n):l(n),t.$$.on_mount=[]}),f.forEach(x)}function A(t,e){const n=t.$$;null!==n.fragment&&(l(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function B(t,e){-1===t.$$.dirty[0]&&(y.push(t),v||(v=!0,D.then(S)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function E(e,o,a,r,i,f,u=[-1]){const s=m;p(e);const d=o.props||{},h=e.$$={fragment:null,ctx:null,props:f,update:t,not_equal:i,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(s?s.$$.context:[]),callbacks:n(),dirty:u};let g=!1;if(h.ctx=a?a(e,d,(t,n,...l)=>{const o=l.length?l[0]:n;return h.ctx&&i(h.ctx[t],h.ctx[t]=o)&&(h.bound[t]&&h.bound[t](o),g&&B(e,t)),n}):[],h.update(),g=!0,l(h.before_update),h.fragment=!!r&&r(h.ctx),o.target){if(o.hydrate){const t=(y=o.target,Array.from(y.childNodes));h.fragment&&h.fragment.l(t),t.forEach(c)}else h.fragment&&h.fragment.c();o.intro&&H(e.$$.fragment),N(e,o.target,o.anchor),S()}var y;p(s)}class Y{$destroy(){A(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}}function W(t){const e=new Date(t.getFullYear(),t.getMonth(),1).getDay(),n=t.getDate()+e-1;return Math.floor(n/7)}function k(t){if(t instanceof Date)return t;if(["number","string"].includes(typeof t))return new Date(t);throw new Error("Invalid date value")}function j(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function J({colors:t,data:e,emptyColor:n,endDate:l,startDate:o,view:a}){var r;o=o?k(o):new Date,l=l?k(l):new Date,"monthly"===a?(r=o,o=new Date(r.getFullYear(),r.getMonth(),1),l=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0)}(l)):(o=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()-t.getDay())}(o),l=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+(6-t.getDay()))}(l));let i=0;const c=o.getDate(),f=Math.floor((l-o)/864e5)+1;return new Array(f).fill().map((t,n)=>{const l=function({data:t,offset:e,startDate:n,startDayOfMonth:l}){const o=new Date(n);o.setDate(l+e);const a=new Date(o);a.setDate(o.getDate()+1);const r=t.reduce((t,e)=>{const n=k(e.date);return n>=o&&n<a?t+e.value:t},0);return{date:o,value:r}}({data:e,offset:n,startDate:o,startDayOfMonth:c});return l.value>i&&(i=l.value),l}).map(({date:e,value:l})=>({color:function({colors:t,max:e,value:n}){if(t.length&&n){let l=t[0];const o=n/e;for(let e=1;e<t.length;e++){if(o<e/t.length)return l;l=t[e]}return t[t.length-1]}return null}({colors:t,max:i,value:l})||n,date:e,value:l}))}function q(e){let n,l;return{c(){n=u("rect"),h(n,"data-date",l=j(e[1])),h(n,"data-value",e[4]),h(n,"fill",e[0]),h(n,"height",e[3]),h(n,"rx",e[2]),h(n,"width",e[3]),h(n,"x",e[5]),h(n,"y",e[6])},m(t,e){i(t,n,e)},p(t,[e]){2&e&&l!==(l=j(t[1]))&&h(n,"data-date",l),16&e&&h(n,"data-value",t[4]),1&e&&h(n,"fill",t[0]),8&e&&h(n,"height",t[3]),4&e&&h(n,"rx",t[2]),8&e&&h(n,"width",t[3]),32&e&&h(n,"x",t[5]),64&e&&h(n,"y",t[6])},i:t,o:t,d(t){t&&c(n)}}}function I(t,e,n){let{color:l}=e,{date:o}=e,{radius:a}=e,{size:r}=e,{value:i}=e,{x:c}=e,{y:f}=e;return t.$set=t=>{"color"in t&&n(0,l=t.color),"date"in t&&n(1,o=t.date),"radius"in t&&n(2,a=t.radius),"size"in t&&n(3,r=t.size),"value"in t&&n(4,i=t.value),"x"in t&&n(5,c=t.x),"y"in t&&n(6,f=t.y)},[l,o,a,r,i,c,f]}class P extends Y{constructor(t){super(),E(this,t,I,q,a,{color:0,date:1,radius:2,size:3,value:4,x:5,y:6})}}function T(t,e,n){const l=t.slice();return l[13]=e[n],l}function K(t){let e;const n=new P({props:{color:t[13].color,date:t[13].date,radius:t[0],size:t[2],value:t[13].value,x:t[13].date.getDay()*t[1],y:W(t[13].date)*t[1]+t[7]}});return{c(){_(n.$$.fragment)},m(t,l){N(n,t,l),e=!0},p(t,e){const l={};8&e&&(l.color=t[13].color),8&e&&(l.date=t[13].date),1&e&&(l.radius=t[0]),4&e&&(l.size=t[2]),8&e&&(l.value=t[13].value),10&e&&(l.x=t[13].date.getDay()*t[1]),138&e&&(l.y=W(t[13].date)*t[1]+t[7]),n.$set(l)},i(t){e||(H(n.$$.fragment,t),e=!0)},o(t){O(n.$$.fragment,t),e=!1},d(t){A(n,t)}}}function Q(t){let e,n,l=t[8][t[3][0].date.getMonth()]+"";return{c(){e=u("text"),n=s(l),h(e,"alignment-baseline","hanging"),h(e,"fill",t[4]),h(e,"font-family",t[5]),h(e,"font-size",t[6]),h(e,"x","0"),h(e,"y","0")},m(t,l){i(t,e,l),r(e,n)},p(t,o){264&o&&l!==(l=t[8][t[3][0].date.getMonth()]+"")&&g(n,l),16&o&&h(e,"fill",t[4]),32&o&&h(e,"font-family",t[5]),64&o&&h(e,"font-size",t[6])},d(t){t&&c(e)}}}function U(t){let e,n,l,o,a=t[3],s=[];for(let e=0;e<a.length;e+=1)s[e]=K(T(t,a,e));const g=t=>O(s[t],1,1,()=>{s[t]=null});let m=t[7]>0&&Q(t);return{c(){e=u("g");for(let t=0;t<s.length;t+=1)s[t].c();n=d(),m&&m.c(),h(e,"transform",l=`translate(${t[9]}, 0)`)},m(t,l){i(t,e,l);for(let t=0;t<s.length;t+=1)s[t].m(e,null);r(e,n),m&&m.m(e,null),o=!0},p(t,[r]){if(143&r){let l;for(a=t[3],l=0;l<a.length;l+=1){const o=T(t,a,l);s[l]?(s[l].p(o,r),H(s[l],1)):(s[l]=K(o),s[l].c(),H(s[l],1),s[l].m(e,n))}for(C(),l=a.length;l<s.length;l+=1)g(l);F()}t[7]>0?m?m.p(t,r):(m=Q(t),m.c(),m.m(e,null)):m&&(m.d(1),m=null),(!o||512&r&&l!==(l=`translate(${t[9]}, 0)`))&&h(e,"transform",l)},i(t){if(!o){for(let t=0;t<a.length;t+=1)H(s[t]);o=!0}},o(t){s=s.filter(Boolean);for(let t=0;t<s.length;t+=1)O(s[t]);o=!1},d(t){t&&c(e),f(s,t),m&&m.d()}}}function V(t,e,n){let l,{cellGap:o}=e,{cellRadius:a}=e,{cellRect:r}=e,{cellSize:i}=e,{days:c}=e,{fontColor:f}=e,{fontFamily:u}=e,{fontSize:s}=e,{index:d}=e,{monthGap:h}=e,{monthLabelHeight:g}=e,{monthLabels:m}=e;return t.$set=t=>{"cellGap"in t&&n(10,o=t.cellGap),"cellRadius"in t&&n(0,a=t.cellRadius),"cellRect"in t&&n(1,r=t.cellRect),"cellSize"in t&&n(2,i=t.cellSize),"days"in t&&n(3,c=t.days),"fontColor"in t&&n(4,f=t.fontColor),"fontFamily"in t&&n(5,u=t.fontFamily),"fontSize"in t&&n(6,s=t.fontSize),"index"in t&&n(11,d=t.index),"monthGap"in t&&n(12,h=t.monthGap),"monthLabelHeight"in t&&n(7,g=t.monthLabelHeight),"monthLabels"in t&&n(8,m=t.monthLabels)},t.$$.update=()=>{7170&t.$$.dirty&&n(9,l=(7*r-o+h)*d)},[a,r,i,c,f,u,s,g,m,l,o,d,h]}class X extends Y{constructor(t){super(),E(this,t,V,U,a,{cellGap:10,cellRadius:0,cellRect:1,cellSize:2,days:3,fontColor:4,fontFamily:5,fontSize:6,index:11,monthGap:12,monthLabelHeight:7,monthLabels:8})}}function Z(t,e,n){const l=t.slice();return l[7]=e[n],l[6]=n,l}function tt(t){let e;const n=new P({props:{color:t[7].color,date:t[7].date,radius:t[0],size:t[2],value:t[7].value,y:t[7].date.getDay()*t[1]}});return{c(){_(n.$$.fragment)},m(t,l){N(n,t,l),e=!0},p(t,e){const l={};8&e&&(l.color=t[7].color),8&e&&(l.date=t[7].date),1&e&&(l.radius=t[0]),4&e&&(l.size=t[2]),8&e&&(l.value=t[7].value),10&e&&(l.y=t[7].date.getDay()*t[1]),n.$set(l)},i(t){e||(H(n.$$.fragment,t),e=!0)},o(t){O(n.$$.fragment,t),e=!1},d(t){A(n,t)}}}function et(t){let e,n,l,o=t[3],a=[];for(let e=0;e<o.length;e+=1)a[e]=tt(Z(t,o,e));const r=t=>O(a[t],1,1,()=>{a[t]=null});return{c(){e=u("g");for(let t=0;t<a.length;t+=1)a[t].c();h(e,"transform",n=`translate(${t[5]}, ${t[4]})`)},m(t,n){i(t,e,n);for(let t=0;t<a.length;t+=1)a[t].m(e,null);l=!0},p(t,[i]){if(15&i){let n;for(o=t[3],n=0;n<o.length;n+=1){const l=Z(t,o,n);a[n]?(a[n].p(l,i),H(a[n],1)):(a[n]=tt(l),a[n].c(),H(a[n],1),a[n].m(e,null))}for(C(),n=o.length;n<a.length;n+=1)r(n);F()}(!l||48&i&&n!==(n=`translate(${t[5]}, ${t[4]})`))&&h(e,"transform",n)},i(t){if(!l){for(let t=0;t<o.length;t+=1)H(a[t]);l=!0}},o(t){a=a.filter(Boolean);for(let t=0;t<a.length;t+=1)O(a[t]);l=!1},d(t){t&&c(e),f(a,t)}}}function nt(t,e,n){let l,{cellRadius:o}=e,{cellRect:a}=e,{cellSize:r}=e,{days:i}=e,{index:c}=e,{monthLabelHeight:f}=e;return t.$set=t=>{"cellRadius"in t&&n(0,o=t.cellRadius),"cellRect"in t&&n(1,a=t.cellRect),"cellSize"in t&&n(2,r=t.cellSize),"days"in t&&n(3,i=t.days),"index"in t&&n(6,c=t.index),"monthLabelHeight"in t&&n(4,f=t.monthLabelHeight)},t.$$.update=()=>{66&t.$$.dirty&&n(5,l=a*c)},[o,a,r,i,f,l,c]}class lt extends Y{constructor(t){super(),E(this,t,nt,et,a,{cellRadius:0,cellRect:1,cellSize:2,days:3,index:6,monthLabelHeight:4})}}function ot(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function at(t,e,n){const l=t.slice();return l[30]=e[n],l[28]=n,l}function rt(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function it(t){let e,n,l,o=t[3]>0&&ft(t),a=t[13],r=[];for(let e=0;e<a.length;e+=1)r[e]=dt(ot(t,a,e));const s=t=>O(r[t],1,1,()=>{r[t]=null});return{c(){o&&o.c(),e=u("g");for(let t=0;t<r.length;t+=1)r[t].c();h(e,"transform",n=`translate(${t[3]})`)},m(t,n){o&&o.m(t,n),i(t,e,n);for(let t=0;t<r.length;t+=1)r[t].m(e,null);l=!0},p(t,i){if(t[3]>0?o?o.p(t,i):(o=ft(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null),145126&i[0]){let n;for(a=t[13],n=0;n<a.length;n+=1){const l=ot(t,a,n);r[n]?(r[n].p(l,i),H(r[n],1)):(r[n]=dt(l),r[n].c(),H(r[n],1),r[n].m(e,null))}for(C(),n=a.length;n<r.length;n+=1)s(n);F()}(!l||8&i[0]&&n!==(n=`translate(${t[3]})`))&&h(e,"transform",n)},i(t){if(!l){for(let t=0;t<a.length;t+=1)H(r[t]);l=!0}},o(t){r=r.filter(Boolean);for(let t=0;t<r.length;t+=1)O(r[t]);l=!1},d(t){o&&o.d(t),t&&c(e),f(r,t)}}}function ct(t){let e,n,l=t[13],o=[];for(let e=0;e<l.length;e+=1)o[e]=ht(rt(t,l,e));const a=t=>O(o[t],1,1,()=>{o[t]=null});return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=d()},m(t,l){for(let e=0;e<o.length;e+=1)o[e].m(t,l);i(t,e,l),n=!0},p(t,n){if(14311&n[0]){let r;for(l=t[13],r=0;r<l.length;r+=1){const a=rt(t,l,r);o[r]?(o[r].p(a,n),H(o[r],1)):(o[r]=ht(a),o[r].c(),H(o[r],1),o[r].m(e.parentNode,e))}for(C(),r=l.length;r<o.length;r+=1)a(r);F()}},i(t){if(!n){for(let t=0;t<l.length;t+=1)H(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)O(o[t]);n=!1},d(t){f(o,t),t&&c(e)}}}function ft(t){let e,n=t[4],l=[];for(let e=0;e<n.length;e+=1)l[e]=ut(at(t,n,e));return{c(){for(let t=0;t<l.length;t+=1)l[t].c();e=d()},m(t,n){for(let e=0;e<l.length;e+=1)l[e].m(t,n);i(t,e,n)},p(t,o){if(65776&o[0]){let a;for(n=t[4],a=0;a<n.length;a+=1){const r=at(t,n,a);l[a]?l[a].p(r,o):(l[a]=ut(r),l[a].c(),l[a].m(e.parentNode,e))}for(;a<l.length;a+=1)l[a].d(1);l.length=n.length}},d(t){f(l,t),t&&c(e)}}}function ut(t){let e,n,l,o=t[30]+"";return{c(){e=u("text"),n=s(o),h(e,"alignment-baseline","middle"),h(e,"fill",t[5]),h(e,"font-family",t[6]),h(e,"font-size",t[7]),h(e,"x","0"),h(e,"y",l=t[16](t[28]))},m(t,l){i(t,e,l),r(e,n)},p(t,a){16&a[0]&&o!==(o=t[30]+"")&&g(n,o),32&a[0]&&h(e,"fill",t[5]),64&a[0]&&h(e,"font-family",t[6]),128&a[0]&&h(e,"font-size",t[7]),65536&a[0]&&l!==(l=t[16](t[28]))&&h(e,"y",l)},d(t){t&&c(e)}}}function st(t){let e,n,l,o=t[10][t[26][0].date.getMonth()]+"";return{c(){e=u("text"),n=s(o),h(e,"alignment-baseline","hanging"),h(e,"fill",t[5]),h(e,"font-family",t[6]),h(e,"font-size",t[7]),h(e,"x",l=t[12]*t[28])},m(t,l){i(t,e,l),r(e,n)},p(t,a){9216&a[0]&&o!==(o=t[10][t[26][0].date.getMonth()]+"")&&g(n,o),32&a[0]&&h(e,"fill",t[5]),64&a[0]&&h(e,"font-family",t[6]),128&a[0]&&h(e,"font-size",t[7]),4096&a[0]&&l!==(l=t[12]*t[28])&&h(e,"x",l)},d(t){t&&c(e)}}}function dt(t){let e,n,l=t[9]>0&&t[17](t[13],t[28]);const o=new lt({props:{cellRadius:t[1],cellRect:t[12],cellSize:t[2],days:t[26],index:t[28],monthLabelHeight:t[9]}});let a=l&&st(t);return{c(){_(o.$$.fragment),a&&a.c(),e=d()},m(t,l){N(o,t,l),a&&a.m(t,l),i(t,e,l),n=!0},p(t,n){const r={};2&n[0]&&(r.cellRadius=t[1]),4096&n[0]&&(r.cellRect=t[12]),4&n[0]&&(r.cellSize=t[2]),8192&n[0]&&(r.days=t[26]),512&n[0]&&(r.monthLabelHeight=t[9]),o.$set(r),8704&n[0]&&(l=t[9]>0&&t[17](t[13],t[28])),l?a?a.p(t,n):(a=st(t),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null)},i(t){n||(H(o.$$.fragment,t),n=!0)},o(t){O(o.$$.fragment,t),n=!1},d(t){A(o,t),a&&a.d(t),t&&c(e)}}}function ht(t){let e;const n=new X({props:{cellGap:t[0],cellRadius:t[1],cellRect:t[12],cellSize:t[2],days:t[26],fontColor:t[5],fontFamily:t[6],fontSize:t[7],index:t[28],monthGap:t[8],monthLabelHeight:t[9],monthLabels:t[10]}});return{c(){_(n.$$.fragment)},m(t,l){N(n,t,l),e=!0},p(t,e){const l={};1&e[0]&&(l.cellGap=t[0]),2&e[0]&&(l.cellRadius=t[1]),4096&e[0]&&(l.cellRect=t[12]),4&e[0]&&(l.cellSize=t[2]),8192&e[0]&&(l.days=t[26]),32&e[0]&&(l.fontColor=t[5]),64&e[0]&&(l.fontFamily=t[6]),128&e[0]&&(l.fontSize=t[7]),256&e[0]&&(l.monthGap=t[8]),512&e[0]&&(l.monthLabelHeight=t[9]),1024&e[0]&&(l.monthLabels=t[10]),n.$set(l)},i(t){e||(H(n.$$.fragment,t),e=!0)},o(t){O(n.$$.fragment,t),e=!1},d(t){A(n,t)}}}function gt(t){let e,n,l,o,a;const r=[ct,it],f=[];function s(t,e){return"monthly"===t[11]?0:1}return n=s(t),l=f[n]=r[n](t),{c(){e=u("svg"),l.c(),h(e,"viewBox",o=`0 0 ${t[15]} ${t[14]}`)},m(t,l){i(t,e,l),f[n].m(e,null),a=!0},p(t,i){let c=n;n=s(t),n===c?f[n].p(t,i):(C(),O(f[c],1,1,()=>{f[c]=null}),F(),l=f[n],l||(l=f[n]=r[n](t),l.c()),H(l,1),l.m(e,null)),(!a||49152&i[0]&&o!==(o=`0 0 ${t[15]} ${t[14]}`))&&h(e,"viewBox",o)},i(t){a||(H(l),a=!0)},o(t){O(l),a=!1},d(t){t&&c(e),f[n].d()}}}function mt(t,e,n){let{allowOverflow:l=!1}=e,{cellGap:o=2}=e,{cellRadius:a=0}=e,{cellSize:r=10}=e,{colors:i=["#c6e48b","#7bc96f","#239a3b","#196127"]}=e,{data:c=[]}=e,{dayLabelWidth:f=20}=e,{dayLabels:u=["","Mon","","Wed","","Fri",""]}=e,{emptyColor:s="#ebedf0"}=e,{endDate:d=null}=e,{fontColor:h="#333"}=e,{fontFamily:g="sans-serif"}=e,{fontSize:m=8}=e,{monthGap:p=2}=e,{monthLabelHeight:y=12}=e,{monthLabels:$=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}=e,{startDate:b=null}=e,{view:w="weekly"}=e;let D,v,x,z,L,S,R;return t.$set=t=>{"allowOverflow"in t&&n(18,l=t.allowOverflow),"cellGap"in t&&n(0,o=t.cellGap),"cellRadius"in t&&n(1,a=t.cellRadius),"cellSize"in t&&n(2,r=t.cellSize),"colors"in t&&n(19,i=t.colors),"data"in t&&n(20,c=t.data),"dayLabelWidth"in t&&n(3,f=t.dayLabelWidth),"dayLabels"in t&&n(4,u=t.dayLabels),"emptyColor"in t&&n(21,s=t.emptyColor),"endDate"in t&&n(22,d=t.endDate),"fontColor"in t&&n(5,h=t.fontColor),"fontFamily"in t&&n(6,g=t.fontFamily),"fontSize"in t&&n(7,m=t.fontSize),"monthGap"in t&&n(8,p=t.monthGap),"monthLabelHeight"in t&&n(9,y=t.monthLabelHeight),"monthLabels"in t&&n(10,$=t.monthLabels),"startDate"in t&&n(23,b=t.startDate),"view"in t&&n(11,w=t.view)},t.$$.update=()=>{5&t.$$.dirty[0]&&n(12,D=r+o),16517120&t.$$.dirty[0]&&n(24,v=J({allowOverflow:l,colors:i,data:c,emptyColor:s,endDate:d,startDate:b,view:w})),29624320&t.$$.dirty[0]&&n(13,x="monthly"===w?function({allowOverflow:t,calendar:e,endDate:n,startDate:l}){let o=-1;return l=k(l),n=k(n),e.reduce((e,a)=>{const r=a.date.getMonth();return o!==r&&(e.push([]),o=r),(t||(!l||a.date>=l)&&(!n||a.date<=n))&&e[e.length-1].push(a),e},[])}({allowOverflow:l,calendar:v,endDate:d,startDate:b}):function({allowOverflow:t,calendar:e,endDate:n,startDate:l}){return l=k(l),n=k(n),e.reduce((e,o,a)=>(a%7==0&&e.push([]),(t||(!l||o.date>=l)&&(!n||o.date<=n))&&e[e.length-1].push(o),e),[])}({allowOverflow:l,calendar:v,endDate:d,startDate:b})),4097&t.$$.dirty[0]&&n(25,z=7*D-o),33561089&t.$$.dirty[0]&&n(14,L="monthly"===w?6*D-o+y:z+y),33569033&t.$$.dirty[0]&&n(15,S="monthly"===w?(z+p)*x.length-p:D*x.length-o+f),4608&t.$$.dirty[0]&&n(16,R=t=>D*t+D/2+y)},[o,a,r,f,u,h,g,m,p,y,$,w,D,x,L,S,R,(t,e)=>{const n=t[e],l=t[e-1];if(!l)return!0;if(!l.length||!n.length)return!1;const o=n[0].date.getMonth(),a=l[0].date.getMonth();return e<t.length&&e<t.length-1&&(o>a||0===o&&11===a)},l,i,c,s,d,b]}return class extends Y{constructor(t){super(),E(this,t,mt,gt,a,{allowOverflow:18,cellGap:0,cellRadius:1,cellSize:2,colors:19,data:20,dayLabelWidth:3,dayLabels:4,emptyColor:21,endDate:22,fontColor:5,fontFamily:6,fontSize:7,monthGap:8,monthLabelHeight:9,monthLabels:10,startDate:23,view:11},[-1,-1])}}}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).SvelteHeatmap=e()}(this,(function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function l(t){t.forEach(e)}function o(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function r(t,e){t.appendChild(e)}function i(t,e,n){t.insertBefore(e,n||null)}function c(t){t.parentNode.removeChild(t)}function f(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function u(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function s(t){return document.createTextNode(t)}function d(){return s("")}function h(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function g(t,e){e=""+e,t.data!==e&&(t.data=e)}let m;function p(t){m=t}const y=[],$=[],b=[],w=[],D=Promise.resolve();let v=!1;function x(t){b.push(t)}let z=!1;const S=new Set;function L(){if(!z){z=!0;do{for(let t=0;t<y.length;t+=1){const e=y[t];p(e),R(e.$$)}for(y.length=0;$.length;)$.pop()();for(let t=0;t<b.length;t+=1){const e=b[t];S.has(e)||(S.add(e),e())}b.length=0}while(y.length);for(;w.length;)w.pop()();v=!1,z=!1,S.clear()}}function R(t){if(null!==t.fragment){t.update(),l(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(x)}}const M=new Set;let G;function C(){G={r:0,c:[],p:G}}function F(){G.r||l(G.c),G=G.p}function H(t,e){t&&t.i&&(M.delete(t),t.i(e))}function O(t,e,n,l){if(t&&t.o){if(M.has(t))return;M.add(t),G.c.push(()=>{M.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}}function _(t){t&&t.c()}function N(t,n,a){const{fragment:r,on_mount:i,on_destroy:c,after_update:f}=t.$$;r&&r.m(n,a),x(()=>{const n=i.map(e).filter(o);c?c.push(...n):l(n),t.$$.on_mount=[]}),f.forEach(x)}function A(t,e){const n=t.$$;null!==n.fragment&&(l(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function B(t,e){-1===t.$$.dirty[0]&&(y.push(t),v||(v=!0,D.then(L)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function E(e,o,a,r,i,f,u=[-1]){const s=m;p(e);const d=o.props||{},h=e.$$={fragment:null,ctx:null,props:f,update:t,not_equal:i,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(s?s.$$.context:[]),callbacks:n(),dirty:u};let g=!1;if(h.ctx=a?a(e,d,(t,n,...l)=>{const o=l.length?l[0]:n;return h.ctx&&i(h.ctx[t],h.ctx[t]=o)&&(h.bound[t]&&h.bound[t](o),g&&B(e,t)),n}):[],h.update(),g=!0,l(h.before_update),h.fragment=!!r&&r(h.ctx),o.target){if(o.hydrate){const t=(y=o.target,Array.from(y.childNodes));h.fragment&&h.fragment.l(t),t.forEach(c)}else h.fragment&&h.fragment.c();o.intro&&H(e.$$.fragment),N(e,o.target,o.anchor),L()}var y;p(s)}class Y{$destroy(){A(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}}function W(t){const e=new Date(t.getFullYear(),t.getMonth(),1).getDay(),n=t.getDate()+e-1;return Math.floor(n/7)}function k(t){if(t instanceof Date)return t;if(["number","string"].includes(typeof t))return new Date(t);throw new Error("Invalid date value")}function j(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function J({colors:t,data:e,emptyColor:n,endDate:l,startDate:o,view:a}){var r;o=o?k(o):new Date,l=l?k(l):new Date,"monthly"===a?(r=o,o=new Date(r.getFullYear(),r.getMonth(),1),l=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0)}(l)):(o=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()-t.getDay())}(o),l=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+(6-t.getDay()))}(l));let i=0;const c=o.getDate(),f=Math.floor((l-o)/864e5)+1;return new Array(f).fill().map((t,n)=>{const l=function({data:t,offset:e,startDate:n,startDayOfMonth:l}){const o=new Date(n);o.setDate(l+e);const a=new Date(o);a.setDate(o.getDate()+1);const r=t.reduce((t,e)=>{const n=k(e.date);return n>=o&&n<a?t+e.value:t},0);return{date:o,value:r}}({data:e,offset:n,startDate:o,startDayOfMonth:c});return l.value>i&&(i=l.value),l}).map(({date:e,value:l})=>({color:function({colors:t,max:e,value:n}){if(t.length&&n){let l=t[0];const o=n/e;for(let e=1;e<t.length;e++){if(o<e/t.length)return l;l=t[e]}return t[t.length-1]}return null}({colors:t,max:i,value:l})||n,date:e,value:l}))}function q(e){let n,l;return{c(){n=u("rect"),h(n,"data-date",l=j(e[1])),h(n,"data-value",e[4]),h(n,"fill",e[0]),h(n,"height",e[3]),h(n,"rx",e[2]),h(n,"width",e[3]),h(n,"x",e[5]),h(n,"y",e[6])},m(t,e){i(t,n,e)},p(t,[e]){2&e&&l!==(l=j(t[1]))&&h(n,"data-date",l),16&e&&h(n,"data-value",t[4]),1&e&&h(n,"fill",t[0]),8&e&&h(n,"height",t[3]),4&e&&h(n,"rx",t[2]),8&e&&h(n,"width",t[3]),32&e&&h(n,"x",t[5]),64&e&&h(n,"y",t[6])},i:t,o:t,d(t){t&&c(n)}}}function I(t,e,n){let{color:l}=e,{date:o}=e,{radius:a}=e,{size:r}=e,{value:i}=e,{x:c}=e,{y:f}=e;return t.$set=t=>{"color"in t&&n(0,l=t.color),"date"in t&&n(1,o=t.date),"radius"in t&&n(2,a=t.radius),"size"in t&&n(3,r=t.size),"value"in t&&n(4,i=t.value),"x"in t&&n(5,c=t.x),"y"in t&&n(6,f=t.y)},[l,o,a,r,i,c,f]}class P extends Y{constructor(t){super(),E(this,t,I,q,a,{color:0,date:1,radius:2,size:3,value:4,x:5,y:6})}}function T(t,e,n){const l=t.slice();return l[13]=e[n],l}function K(t){let e;const n=new P({props:{color:t[13].color,date:t[13].date,radius:t[0],size:t[2],value:t[13].value,x:t[13].date.getDay()*t[1],y:W(t[13].date)*t[1]+t[7]}});return{c(){_(n.$$.fragment)},m(t,l){N(n,t,l),e=!0},p(t,e){const l={};8&e&&(l.color=t[13].color),8&e&&(l.date=t[13].date),1&e&&(l.radius=t[0]),4&e&&(l.size=t[2]),8&e&&(l.value=t[13].value),10&e&&(l.x=t[13].date.getDay()*t[1]),138&e&&(l.y=W(t[13].date)*t[1]+t[7]),n.$set(l)},i(t){e||(H(n.$$.fragment,t),e=!0)},o(t){O(n.$$.fragment,t),e=!1},d(t){A(n,t)}}}function Q(t){let e,n,l=t[8][t[3][0].date.getMonth()]+"";return{c(){e=u("text"),n=s(l),h(e,"alignment-baseline","hanging"),h(e,"fill",t[4]),h(e,"font-family",t[5]),h(e,"font-size",t[6]),h(e,"x","0"),h(e,"y","0")},m(t,l){i(t,e,l),r(e,n)},p(t,o){264&o&&l!==(l=t[8][t[3][0].date.getMonth()]+"")&&g(n,l),16&o&&h(e,"fill",t[4]),32&o&&h(e,"font-family",t[5]),64&o&&h(e,"font-size",t[6])},d(t){t&&c(e)}}}function U(t){let e,n,l,o,a=t[3],s=[];for(let e=0;e<a.length;e+=1)s[e]=K(T(t,a,e));const g=t=>O(s[t],1,1,()=>{s[t]=null});let m=t[7]>0&&Q(t);return{c(){e=u("g");for(let t=0;t<s.length;t+=1)s[t].c();n=d(),m&&m.c(),h(e,"transform",l=`translate(${t[9]}, 0)`)},m(t,l){i(t,e,l);for(let t=0;t<s.length;t+=1)s[t].m(e,null);r(e,n),m&&m.m(e,null),o=!0},p(t,[r]){if(143&r){let l;for(a=t[3],l=0;l<a.length;l+=1){const o=T(t,a,l);s[l]?(s[l].p(o,r),H(s[l],1)):(s[l]=K(o),s[l].c(),H(s[l],1),s[l].m(e,n))}for(C(),l=a.length;l<s.length;l+=1)g(l);F()}t[7]>0?m?m.p(t,r):(m=Q(t),m.c(),m.m(e,null)):m&&(m.d(1),m=null),(!o||512&r&&l!==(l=`translate(${t[9]}, 0)`))&&h(e,"transform",l)},i(t){if(!o){for(let t=0;t<a.length;t+=1)H(s[t]);o=!0}},o(t){s=s.filter(Boolean);for(let t=0;t<s.length;t+=1)O(s[t]);o=!1},d(t){t&&c(e),f(s,t),m&&m.d()}}}function V(t,e,n){let l,{cellGap:o}=e,{cellRadius:a}=e,{cellRect:r}=e,{cellSize:i}=e,{days:c}=e,{fontColor:f}=e,{fontFamily:u}=e,{fontSize:s}=e,{index:d}=e,{monthGap:h}=e,{monthLabelHeight:g}=e,{monthLabels:m}=e;return t.$set=t=>{"cellGap"in t&&n(10,o=t.cellGap),"cellRadius"in t&&n(0,a=t.cellRadius),"cellRect"in t&&n(1,r=t.cellRect),"cellSize"in t&&n(2,i=t.cellSize),"days"in t&&n(3,c=t.days),"fontColor"in t&&n(4,f=t.fontColor),"fontFamily"in t&&n(5,u=t.fontFamily),"fontSize"in t&&n(6,s=t.fontSize),"index"in t&&n(11,d=t.index),"monthGap"in t&&n(12,h=t.monthGap),"monthLabelHeight"in t&&n(7,g=t.monthLabelHeight),"monthLabels"in t&&n(8,m=t.monthLabels)},t.$$.update=()=>{7170&t.$$.dirty&&n(9,l=(7*r-o+h)*d)},[a,r,i,c,f,u,s,g,m,l,o,d,h]}class X extends Y{constructor(t){super(),E(this,t,V,U,a,{cellGap:10,cellRadius:0,cellRect:1,cellSize:2,days:3,fontColor:4,fontFamily:5,fontSize:6,index:11,monthGap:12,monthLabelHeight:7,monthLabels:8})}}function Z(t,e,n){const l=t.slice();return l[7]=e[n],l[6]=n,l}function tt(t){let e;const n=new P({props:{color:t[7].color,date:t[7].date,radius:t[0],size:t[2],value:t[7].value,y:t[7].date.getDay()*t[1]}});return{c(){_(n.$$.fragment)},m(t,l){N(n,t,l),e=!0},p(t,e){const l={};8&e&&(l.color=t[7].color),8&e&&(l.date=t[7].date),1&e&&(l.radius=t[0]),4&e&&(l.size=t[2]),8&e&&(l.value=t[7].value),10&e&&(l.y=t[7].date.getDay()*t[1]),n.$set(l)},i(t){e||(H(n.$$.fragment,t),e=!0)},o(t){O(n.$$.fragment,t),e=!1},d(t){A(n,t)}}}function et(t){let e,n,l,o=t[3],a=[];for(let e=0;e<o.length;e+=1)a[e]=tt(Z(t,o,e));const r=t=>O(a[t],1,1,()=>{a[t]=null});return{c(){e=u("g");for(let t=0;t<a.length;t+=1)a[t].c();h(e,"transform",n=`translate(${t[5]}, ${t[4]})`)},m(t,n){i(t,e,n);for(let t=0;t<a.length;t+=1)a[t].m(e,null);l=!0},p(t,[i]){if(15&i){let n;for(o=t[3],n=0;n<o.length;n+=1){const l=Z(t,o,n);a[n]?(a[n].p(l,i),H(a[n],1)):(a[n]=tt(l),a[n].c(),H(a[n],1),a[n].m(e,null))}for(C(),n=o.length;n<a.length;n+=1)r(n);F()}(!l||48&i&&n!==(n=`translate(${t[5]}, ${t[4]})`))&&h(e,"transform",n)},i(t){if(!l){for(let t=0;t<o.length;t+=1)H(a[t]);l=!0}},o(t){a=a.filter(Boolean);for(let t=0;t<a.length;t+=1)O(a[t]);l=!1},d(t){t&&c(e),f(a,t)}}}function nt(t,e,n){let l,{cellRadius:o}=e,{cellRect:a}=e,{cellSize:r}=e,{days:i}=e,{index:c}=e,{monthLabelHeight:f}=e;return t.$set=t=>{"cellRadius"in t&&n(0,o=t.cellRadius),"cellRect"in t&&n(1,a=t.cellRect),"cellSize"in t&&n(2,r=t.cellSize),"days"in t&&n(3,i=t.days),"index"in t&&n(6,c=t.index),"monthLabelHeight"in t&&n(4,f=t.monthLabelHeight)},t.$$.update=()=>{66&t.$$.dirty&&n(5,l=a*c)},[o,a,r,i,f,l,c]}class lt extends Y{constructor(t){super(),E(this,t,nt,et,a,{cellRadius:0,cellRect:1,cellSize:2,days:3,index:6,monthLabelHeight:4})}}function ot(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function at(t,e,n){const l=t.slice();return l[30]=e[n],l[28]=n,l}function rt(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function it(t){let e,n,l,o=t[3]>0&&ft(t),a=t[13],r=[];for(let e=0;e<a.length;e+=1)r[e]=dt(ot(t,a,e));const s=t=>O(r[t],1,1,()=>{r[t]=null});return{c(){o&&o.c(),e=u("g");for(let t=0;t<r.length;t+=1)r[t].c();h(e,"transform",n=`translate(${t[3]})`)},m(t,n){o&&o.m(t,n),i(t,e,n);for(let t=0;t<r.length;t+=1)r[t].m(e,null);l=!0},p(t,i){if(t[3]>0?o?o.p(t,i):(o=ft(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null),145126&i[0]){let n;for(a=t[13],n=0;n<a.length;n+=1){const l=ot(t,a,n);r[n]?(r[n].p(l,i),H(r[n],1)):(r[n]=dt(l),r[n].c(),H(r[n],1),r[n].m(e,null))}for(C(),n=a.length;n<r.length;n+=1)s(n);F()}(!l||8&i[0]&&n!==(n=`translate(${t[3]})`))&&h(e,"transform",n)},i(t){if(!l){for(let t=0;t<a.length;t+=1)H(r[t]);l=!0}},o(t){r=r.filter(Boolean);for(let t=0;t<r.length;t+=1)O(r[t]);l=!1},d(t){o&&o.d(t),t&&c(e),f(r,t)}}}function ct(t){let e,n,l=t[13],o=[];for(let e=0;e<l.length;e+=1)o[e]=ht(rt(t,l,e));const a=t=>O(o[t],1,1,()=>{o[t]=null});return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=d()},m(t,l){for(let e=0;e<o.length;e+=1)o[e].m(t,l);i(t,e,l),n=!0},p(t,n){if(14311&n[0]){let r;for(l=t[13],r=0;r<l.length;r+=1){const a=rt(t,l,r);o[r]?(o[r].p(a,n),H(o[r],1)):(o[r]=ht(a),o[r].c(),H(o[r],1),o[r].m(e.parentNode,e))}for(C(),r=l.length;r<o.length;r+=1)a(r);F()}},i(t){if(!n){for(let t=0;t<l.length;t+=1)H(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)O(o[t]);n=!1},d(t){f(o,t),t&&c(e)}}}function ft(t){let e,n=t[4],l=[];for(let e=0;e<n.length;e+=1)l[e]=ut(at(t,n,e));return{c(){for(let t=0;t<l.length;t+=1)l[t].c();e=d()},m(t,n){for(let e=0;e<l.length;e+=1)l[e].m(t,n);i(t,e,n)},p(t,o){if(65776&o[0]){let a;for(n=t[4],a=0;a<n.length;a+=1){const r=at(t,n,a);l[a]?l[a].p(r,o):(l[a]=ut(r),l[a].c(),l[a].m(e.parentNode,e))}for(;a<l.length;a+=1)l[a].d(1);l.length=n.length}},d(t){f(l,t),t&&c(e)}}}function ut(t){let e,n,l,o=t[30]+"";return{c(){e=u("text"),n=s(o),h(e,"alignment-baseline","middle"),h(e,"fill",t[5]),h(e,"font-family",t[6]),h(e,"font-size",t[7]),h(e,"x","0"),h(e,"y",l=t[16](t[28]))},m(t,l){i(t,e,l),r(e,n)},p(t,a){16&a[0]&&o!==(o=t[30]+"")&&g(n,o),32&a[0]&&h(e,"fill",t[5]),64&a[0]&&h(e,"font-family",t[6]),128&a[0]&&h(e,"font-size",t[7]),65536&a[0]&&l!==(l=t[16](t[28]))&&h(e,"y",l)},d(t){t&&c(e)}}}function st(t){let e,n,l,o=t[10][t[26][0].date.getMonth()]+"";return{c(){e=u("text"),n=s(o),h(e,"alignment-baseline","hanging"),h(e,"fill",t[5]),h(e,"font-family",t[6]),h(e,"font-size",t[7]),h(e,"x",l=t[12]*t[28])},m(t,l){i(t,e,l),r(e,n)},p(t,a){9216&a[0]&&o!==(o=t[10][t[26][0].date.getMonth()]+"")&&g(n,o),32&a[0]&&h(e,"fill",t[5]),64&a[0]&&h(e,"font-family",t[6]),128&a[0]&&h(e,"font-size",t[7]),4096&a[0]&&l!==(l=t[12]*t[28])&&h(e,"x",l)},d(t){t&&c(e)}}}function dt(t){let e,n,l=t[9]>0&&t[17](t[13],t[28]);const o=new lt({props:{cellRadius:t[1],cellRect:t[12],cellSize:t[2],days:t[26],index:t[28],monthLabelHeight:t[9]}});let a=l&&st(t);return{c(){_(o.$$.fragment),a&&a.c(),e=d()},m(t,l){N(o,t,l),a&&a.m(t,l),i(t,e,l),n=!0},p(t,n){const r={};2&n[0]&&(r.cellRadius=t[1]),4096&n[0]&&(r.cellRect=t[12]),4&n[0]&&(r.cellSize=t[2]),8192&n[0]&&(r.days=t[26]),512&n[0]&&(r.monthLabelHeight=t[9]),o.$set(r),8704&n[0]&&(l=t[9]>0&&t[17](t[13],t[28])),l?a?a.p(t,n):(a=st(t),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null)},i(t){n||(H(o.$$.fragment,t),n=!0)},o(t){O(o.$$.fragment,t),n=!1},d(t){A(o,t),a&&a.d(t),t&&c(e)}}}function ht(t){let e;const n=new X({props:{cellGap:t[0],cellRadius:t[1],cellRect:t[12],cellSize:t[2],days:t[26],fontColor:t[5],fontFamily:t[6],fontSize:t[7],index:t[28],monthGap:t[8],monthLabelHeight:t[9],monthLabels:t[10]}});return{c(){_(n.$$.fragment)},m(t,l){N(n,t,l),e=!0},p(t,e){const l={};1&e[0]&&(l.cellGap=t[0]),2&e[0]&&(l.cellRadius=t[1]),4096&e[0]&&(l.cellRect=t[12]),4&e[0]&&(l.cellSize=t[2]),8192&e[0]&&(l.days=t[26]),32&e[0]&&(l.fontColor=t[5]),64&e[0]&&(l.fontFamily=t[6]),128&e[0]&&(l.fontSize=t[7]),256&e[0]&&(l.monthGap=t[8]),512&e[0]&&(l.monthLabelHeight=t[9]),1024&e[0]&&(l.monthLabels=t[10]),n.$set(l)},i(t){e||(H(n.$$.fragment,t),e=!0)},o(t){O(n.$$.fragment,t),e=!1},d(t){A(n,t)}}}function gt(t){let e,n,l,o,a;const r=[ct,it],f=[];function s(t,e){return"monthly"===t[11]?0:1}return n=s(t),l=f[n]=r[n](t),{c(){e=u("svg"),l.c(),h(e,"viewBox",o=`0 0 ${t[15]} ${t[14]}`)},m(t,l){i(t,e,l),f[n].m(e,null),a=!0},p(t,i){let c=n;n=s(t),n===c?f[n].p(t,i):(C(),O(f[c],1,1,()=>{f[c]=null}),F(),l=f[n],l||(l=f[n]=r[n](t),l.c()),H(l,1),l.m(e,null)),(!a||49152&i[0]&&o!==(o=`0 0 ${t[15]} ${t[14]}`))&&h(e,"viewBox",o)},i(t){a||(H(l),a=!0)},o(t){O(l),a=!1},d(t){t&&c(e),f[n].d()}}}function mt(t,e,n){let{allowOverflow:l=!1}=e,{cellGap:o=2}=e,{cellRadius:a=0}=e,{cellSize:r=10}=e,{colors:i=["#c6e48b","#7bc96f","#239a3b","#196127"]}=e,{data:c=[]}=e,{dayLabelWidth:f=20}=e,{dayLabels:u=["","Mon","","Wed","","Fri",""]}=e,{emptyColor:s="#ebedf0"}=e,{endDate:d=null}=e,{fontColor:h="#333"}=e,{fontFamily:g="sans-serif"}=e,{fontSize:m=8}=e,{monthGap:p=2}=e,{monthLabelHeight:y=12}=e,{monthLabels:$=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}=e,{startDate:b=null}=e,{view:w="weekly"}=e;let D,v,x,z,S,L,R;return t.$set=t=>{"allowOverflow"in t&&n(18,l=t.allowOverflow),"cellGap"in t&&n(0,o=t.cellGap),"cellRadius"in t&&n(1,a=t.cellRadius),"cellSize"in t&&n(2,r=t.cellSize),"colors"in t&&n(19,i=t.colors),"data"in t&&n(20,c=t.data),"dayLabelWidth"in t&&n(3,f=t.dayLabelWidth),"dayLabels"in t&&n(4,u=t.dayLabels),"emptyColor"in t&&n(21,s=t.emptyColor),"endDate"in t&&n(22,d=t.endDate),"fontColor"in t&&n(5,h=t.fontColor),"fontFamily"in t&&n(6,g=t.fontFamily),"fontSize"in t&&n(7,m=t.fontSize),"monthGap"in t&&n(8,p=t.monthGap),"monthLabelHeight"in t&&n(9,y=t.monthLabelHeight),"monthLabels"in t&&n(10,$=t.monthLabels),"startDate"in t&&n(23,b=t.startDate),"view"in t&&n(11,w=t.view)},t.$$.update=()=>{5&t.$$.dirty[0]&&n(12,D=r+o),16517120&t.$$.dirty[0]&&n(24,v=J({allowOverflow:l,colors:i,data:c,emptyColor:s,endDate:d,startDate:b,view:w})),29624320&t.$$.dirty[0]&&n(13,x="monthly"===w?function({allowOverflow:t,calendar:e,endDate:n,startDate:l}){let o=-1;return l=k(l),n=k(n),e.reduce((e,a)=>{const r=a.date.getMonth();return o!==r&&(e.push([]),o=r),(t||(!l||a.date>=l)&&(!n||a.date<=n))&&e[e.length-1].push(a),e},[])}({allowOverflow:l,calendar:v,endDate:d,startDate:b}):function({allowOverflow:t,calendar:e,endDate:n,startDate:l}){return l=k(l),n=k(n),e.reduce((e,o,a)=>(a%7==0&&e.push([]),(t||(!l||o.date>=l)&&(!n||o.date<=n))&&e[e.length-1].push(o),e),[])}({allowOverflow:l,calendar:v,endDate:d,startDate:b})),4097&t.$$.dirty[0]&&n(25,z=7*D-o),33561089&t.$$.dirty[0]&&n(14,S="monthly"===w?6*D-o+y:z+y),33569033&t.$$.dirty[0]&&n(15,L="monthly"===w?(z+p)*x.length-p:D*x.length-o+f),4608&t.$$.dirty[0]&&n(16,R=t=>D*t+D/2+y)},[o,a,r,f,u,h,g,m,p,y,$,w,D,x,S,L,R,(t,e)=>{const n=t[e],l=t[e-1];if(!l)return!0;if(!l.length||!n.length)return!1;const o=n[0].date.getMonth(),a=l[0].date.getMonth();return e<t.length&&e<t.length-1&&(o>a||0===o&&11===a)},l,i,c,s,d,b]}return class extends Y{constructor(t){super(),E(this,t,mt,gt,a,{allowOverflow:18,cellGap:0,cellRadius:1,cellSize:2,colors:19,data:20,dayLabelWidth:3,dayLabels:4,emptyColor:21,endDate:22,fontColor:5,fontFamily:6,fontSize:7,monthGap:8,monthLabelHeight:9,monthLabels:10,startDate:23,view:11},[-1,-1])}}}));

@@ -13,2 +13,3 @@ {

"consola": "^2.11.3",
"fs-extra": "^9.0.0",
"jest": "^25.3.0",

@@ -40,2 +41,3 @@ "rollup": "^1.32.1",

"build": "rollup -c",
"publish:ci": "node ./scripts/publish.js",
"test": "jest",

@@ -45,3 +47,3 @@ "watch": "rollup -c -w"

"unpkg": "dist/index.umd.min.js",
"version": "1.0.0-beta.0"
"version": "1.0.0-beta.1"
}

@@ -11,12 +11,26 @@ # svelte-heatmap

Soon...
The recommended way to install this package is through NPM.
```bash
npm install svelte-heatmap
```
Alternatively, you use this script tag to install via the CDN. When choosing the CDN, the package will be exposed globally as `SvelteHeatmap`.
```html
<script src="https://unpkg.com/svelte-heatmap"></script>
```
## Basic usage
To create a heatmap, pass `props` and a `target` to the `Heatmap` constructor.
To create a heatmap, pass `props` and a `target` to the `SvelteHeatmap` constructor.
```js
const heatmap = new Heatmap({
import SvelteHeatmap from 'svelte-heatmap';
const heatmap = new SvelteHeatmap({
props: {
// ...
data: [
// ...
],
},

@@ -27,3 +41,3 @@ target: '#some-container',

To remove the component, call `$destroy`. This will remove all elements from the DOM and unbind any event listeners.
To remove the component, call `$destroy`.

@@ -30,0 +44,0 @@ ```js

@@ -1,1 +0,1 @@

export { default as default } from './Heatmap.svelte';
export { default as default } from './SvelteHeatmap.svelte';
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc