diff --git a/docs/14.59682fdb.iframe.bundle.js b/docs/14.227636a6.iframe.bundle.js similarity index 64% rename from docs/14.59682fdb.iframe.bundle.js rename to docs/14.227636a6.iframe.bundle.js index 42a6a7e..92b0be0 100644 --- a/docs/14.59682fdb.iframe.bundle.js +++ b/docs/14.227636a6.iframe.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_melfore_konva_timeline=self.webpackChunk_melfore_konva_timeline||[]).push([[14],{"./src/tasks/components/Layer/index.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_konva__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react-konva/es/ReactKonva.js"),luxon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/luxon/src/luxon.js"),_timeline_TimelineContext__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/timeline/TimelineContext.tsx"),_utils_tasks__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/tasks/utils/tasks.ts"),_Task__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/tasks/components/Task/index.tsx"),_Tooltip__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/tasks/components/Tooltip/index.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");function cov_1nacfvm119(){var path="/home/runner/work/konva-timeline/konva-timeline/src/tasks/components/Layer/index.tsx",global=new Function("return this")(),gcv="__coverage__",coverageData={path:"/home/runner/work/konva-timeline/konva-timeline/src/tasks/components/Layer/index.tsx",statementMap:{0:{start:{line:25,column:40},end:{line:124,column:1}},1:{start:{line:34,column:6},end:{line:34,column:26}},2:{start:{line:36,column:26},end:{line:39,column:3}},3:{start:{line:37,column:28},end:{line:37,column:78}},4:{start:{line:37,column:60},end:{line:37,column:77}},5:{start:{line:41,column:22},end:{line:41,column:101}},6:{start:{line:41,column:54},end:{line:41,column:91}},7:{start:{line:41,column:77},end:{line:41,column:90}},8:{start:{line:43,column:22},end:{line:43,column:79}},9:{start:{line:43,column:40},end:{line:43,column:60}},10:{start:{line:45,column:21},end:{line:56,column:3}},11:{start:{line:47,column:19},end:{line:47,column:38}},12:{start:{line:48,column:6},end:{line:50,column:7}},13:{start:{line:49,column:8},end:{line:49,column:36}},14:{start:{line:52,column:23},end:{line:52,column:28}},15:{start:{line:53,column:6},end:{line:53,column:37}},16:{start:{line:58,column:25},end:{line:61,column:3}},17:{start:{line:59,column:24},end:{line:59,column:71}},18:{start:{line:63,column:29},end:{line:70,column:3}},19:{start:{line:65,column:24},end:{line:65,column:54}},20:{start:{line:66,column:32},end:{line:66,column:82}},21:{start:{line:67,column:6},end:{line:67,column:47}},22:{start:{line:72,column:23},end:{line:80,column:3}},23:{start:{line:74,column:24},end:{line:74,column:50}},24:{start:{line:75,column:22},end:{line:75,column:46}},25:{start:{line:76,column:32},end:{line:76,column:75}},26:{start:{line:77,column:6},end:{line:77,column:47}},27:{start:{line:82,column:2},end:{line:84,column:3}},28:{start:{line:83,column:4},end:{line:83,column:16}},29:{start:{line:86,column:2},end:{line:88,column:3}},30:{start:{line:87,column:4},end:{line:87,column:16}},31:{start:{line:90,column:2},end:{line:123,column:4}},32:{start:{line:93,column:37},end:{line:93,column:45}},33:{start:{line:94,column:30},end:{line:94,column:57}},34:{start:{line:95,column:8},end:{line:97,column:9}},35:{start:{line:96,column:10},end:{line:96,column:22}},36:{start:{line:99,column:58},end:{line:99,column:82}},37:{start:{line:100,column:28},end:{line:100,column:58}},38:{start:{line:101,column:28},end:{line:101,column:72}},39:{start:{line:102,column:22},end:{line:102,column:40}},40:{start:{line:103,column:8},end:{line:105,column:9}},41:{start:{line:104,column:10},end:{line:104,column:22}},42:{start:{line:107,column:8},end:{line:119,column:10}}},fnMap:{0:{name:"(anonymous_0)",decl:{start:{line:25,column:40},end:{line:25,column:41}},loc:{start:{line:25,column:77},end:{line:124,column:1}},line:25},1:{name:"(anonymous_1)",decl:{start:{line:37,column:4},end:{line:37,column:5}},loc:{start:{line:37,column:28},end:{line:37,column:78}},line:37},2:{name:"(anonymous_2)",decl:{start:{line:37,column:48},end:{line:37,column:49}},loc:{start:{line:37,column:60},end:{line:37,column:77}},line:37},3:{name:"(anonymous_3)",decl:{start:{line:41,column:34},end:{line:41,column:35}},loc:{start:{line:41,column:54},end:{line:41,column:91}},line:41},4:{name:"(anonymous_4)",decl:{start:{line:41,column:65},end:{line:41,column:66}},loc:{start:{line:41,column:77},end:{line:41,column:90}},line:41},5:{name:"(anonymous_5)",decl:{start:{line:43,column:34},end:{line:43,column:35}},loc:{start:{line:43,column:40},end:{line:43,column:60}},line:43},6:{name:"(anonymous_6)",decl:{start:{line:46,column:4},end:{line:46,column:5}},loc:{start:{line:46,column:43},end:{line:54,column:5}},line:46},7:{name:"(anonymous_7)",decl:{start:{line:59,column:4},end:{line:59,column:5}},loc:{start:{line:59,column:24},end:{line:59,column:71}},line:59},8:{name:"(anonymous_8)",decl:{start:{line:64,column:4},end:{line:64,column:5}},loc:{start:{line:64,column:27},end:{line:68,column:5}},line:64},9:{name:"(anonymous_9)",decl:{start:{line:73,column:4},end:{line:73,column:5}},loc:{start:{line:73,column:43},end:{line:78,column:5}},line:73},10:{name:"(anonymous_10)",decl:{start:{line:92,column:17},end:{line:92,column:18}},loc:{start:{line:92,column:31},end:{line:120,column:7}},line:92}},branchMap:{0:{loc:{start:{line:48,column:6},end:{line:50,column:7}},type:"if",locations:[{start:{line:48,column:6},end:{line:50,column:7}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:48},1:{loc:{start:{line:82,column:2},end:{line:84,column:3}},type:"if",locations:[{start:{line:82,column:2},end:{line:84,column:3}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:82},2:{loc:{start:{line:82,column:6},end:{line:82,column:36}},type:"binary-expr",locations:[{start:{line:82,column:6},end:{line:82,column:20}},{start:{line:82,column:24},end:{line:82,column:36}}],line:82},3:{loc:{start:{line:86,column:2},end:{line:88,column:3}},type:"if",locations:[{start:{line:86,column:2},end:{line:88,column:3}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:86},4:{loc:{start:{line:95,column:8},end:{line:97,column:9}},type:"if",locations:[{start:{line:95,column:8},end:{line:97,column:9}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:95},5:{loc:{start:{line:103,column:8},end:{line:105,column:9}},type:"if",locations:[{start:{line:103,column:8},end:{line:105,column:9}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:103},6:{loc:{start:{line:103,column:12},end:{line:103,column:80}},type:"binary-expr",locations:[{start:{line:103,column:12},end:{line:103,column:39}},{start:{line:103,column:43},end:{line:103,column:80}}],line:103},7:{loc:{start:{line:121,column:7},end:{line:121,column:54}},type:"binary-expr",locations:[{start:{line:121,column:7},end:{line:121,column:18}},{start:{line:121,column:22},end:{line:121,column:54}}],line:121}},s:{0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0,21:0,22:0,23:0,24:0,25:0,26:0,27:0,28:0,29:0,30:0,31:0,32:0,33:0,34:0,35:0,36:0,37:0,38:0,39:0,40:0,41:0,42:0},f:{0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0},b:{0:[0,0],1:[0,0],2:[0,0],3:[0,0],4:[0,0],5:[0,0],6:[0,0],7:[0,0]},_coverageSchema:"1a1c01bbd47fc00a2c39e90264f33305004495a9",hash:"d947d7e5dd9246435e4289b39716d8964171d9dc"},coverage=global[gcv]||(global[gcv]={});coverage[path]&&"d947d7e5dd9246435e4289b39716d8964171d9dc"===coverage[path].hash||(coverage[path]=coverageData);var actualCoverage=coverage[path];return cov_1nacfvm119=function(){return actualCoverage},actualCoverage}cov_1nacfvm119(),cov_1nacfvm119().s[0]++;const TasksLayer=({setTaskTooltip,taskTooltip})=>{cov_1nacfvm119().f[0]++;const{columnWidth,drawRange,interval:{start:intervalStart,end:intervalEnd},resolution,resources,rowHeight,tasks}=(cov_1nacfvm119().s[1]++,(0,_timeline_TimelineContext__WEBPACK_IMPORTED_MODULE_3__.i)()),getResourceById=(cov_1nacfvm119().s[2]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((resourceId=>(cov_1nacfvm119().f[1]++,cov_1nacfvm119().s[3]++,resources.findIndex((({id})=>(cov_1nacfvm119().f[2]++,cov_1nacfvm119().s[4]++,resourceId===id))))),[resources])),getTaskById=(cov_1nacfvm119().s[5]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((taskId=>(cov_1nacfvm119().f[3]++,cov_1nacfvm119().s[6]++,tasks.find((({id})=>(cov_1nacfvm119().f[4]++,cov_1nacfvm119().s[7]++,taskId===id))))),[tasks])),onTaskLeave=(cov_1nacfvm119().s[8]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((()=>(cov_1nacfvm119().f[5]++,cov_1nacfvm119().s[9]++,setTaskTooltip(null))),[setTaskTooltip])),onTaskOver=(cov_1nacfvm119().s[10]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(((taskId,point)=>{cov_1nacfvm119().f[6]++;const task=(cov_1nacfvm119().s[11]++,getTaskById(taskId));if(cov_1nacfvm119().s[12]++,!task)return cov_1nacfvm119().b[0][0]++,cov_1nacfvm119().s[13]++,setTaskTooltip(null);cov_1nacfvm119().b[0][1]++;const{x,y}=(cov_1nacfvm119().s[14]++,point);cov_1nacfvm119().s[15]++,setTaskTooltip({task,x,y})}),[getTaskById,setTaskTooltip])),getXCoordinate=(cov_1nacfvm119().s[16]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((offset=>(cov_1nacfvm119().f[7]++,cov_1nacfvm119().s[17]++,offset*columnWidth/resolution.sizeInUnits)),[columnWidth,resolution.sizeInUnits])),getTaskXCoordinate=(cov_1nacfvm119().s[18]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((startTime=>{cov_1nacfvm119().f[8]++;const timeStart=(cov_1nacfvm119().s[19]++,luxon__WEBPACK_IMPORTED_MODULE_2__.ou.fromMillis(startTime)),startOffsetInUnit=(cov_1nacfvm119().s[20]++,timeStart.diff(intervalStart).as(resolution.unit));return cov_1nacfvm119().s[21]++,getXCoordinate(startOffsetInUnit)}),[getXCoordinate,intervalStart,resolution.unit])),getTaskWidth=(cov_1nacfvm119().s[22]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((({start,end})=>{cov_1nacfvm119().f[9]++;const timeStart=(cov_1nacfvm119().s[23]++,luxon__WEBPACK_IMPORTED_MODULE_2__.ou.fromMillis(start)),timeEnd=(cov_1nacfvm119().s[24]++,luxon__WEBPACK_IMPORTED_MODULE_2__.ou.fromMillis(end)),widthOffsetInUnit=(cov_1nacfvm119().s[25]++,timeEnd.diff(timeStart).as(resolution.unit));return cov_1nacfvm119().s[26]++,getXCoordinate(widthOffsetInUnit)}),[getXCoordinate,resolution.unit]));return cov_1nacfvm119().s[27]++,cov_1nacfvm119().b[2][0]++,intervalStart&&(cov_1nacfvm119().b[2][1]++,intervalEnd)?(cov_1nacfvm119().b[1][1]++,cov_1nacfvm119().s[29]++,drawRange.end-drawRange.start<=0?(cov_1nacfvm119().b[3][0]++,cov_1nacfvm119().s[30]++,null):(cov_1nacfvm119().b[3][1]++,cov_1nacfvm119().s[31]++,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_konva__WEBPACK_IMPORTED_MODULE_1__.mh,{children:[tasks.map((taskData=>{cov_1nacfvm119().f[10]++;const{resourceId,time}=(cov_1nacfvm119().s[32]++,taskData),resourceIndex=(cov_1nacfvm119().s[33]++,getResourceById(resourceId));if(cov_1nacfvm119().s[34]++,resourceIndex<0)return cov_1nacfvm119().b[4][0]++,cov_1nacfvm119().s[35]++,null;cov_1nacfvm119().b[4][1]++;const{color:resourceColor,toCompleteColor}=(cov_1nacfvm119().s[36]++,resources[resourceIndex]),xCoordinate=(cov_1nacfvm119().s[37]++,getTaskXCoordinate(time.start)),yCoordinate=(cov_1nacfvm119().s[38]++,(0,_utils_tasks__WEBPACK_IMPORTED_MODULE_4__.rc)(resourceIndex,rowHeight)),width=(cov_1nacfvm119().s[39]++,getTaskWidth(time));return cov_1nacfvm119().s[40]++,cov_1nacfvm119().b[6][0]++,xCoordinate>drawRange.end||(cov_1nacfvm119().b[6][1]++,xCoordinate+width void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/tasks/components/Layer/index.tsx#Layer"]={docgenInfo:Layer.__docgenInfo,name:"Layer",path:"src/tasks/components/Layer/index.tsx#Layer"})}catch(__react_docgen_typescript_loader_error){}},"./src/tasks/components/Tooltip/index.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_konva__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react-konva/es/ReactKonva.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");function cov_2fcno329eq(){var path="/home/runner/work/konva-timeline/konva-timeline/src/tasks/components/Tooltip/index.tsx",global=new Function("return this")(),gcv="__coverage__",coverage=global[gcv]||(global[gcv]={});coverage[path]&&"2ece78ae83ecb53b7702449096facbc47fa2c586"===coverage[path].hash||(coverage[path]={path:"/home/runner/work/konva-timeline/konva-timeline/src/tasks/components/Tooltip/index.tsx",statementMap:{0:{start:{line:11,column:32},end:{line:11,column:39}},1:{start:{line:12,column:27},end:{line:12,column:34}},2:{start:{line:13,column:34},end:{line:13,column:36}},3:{start:{line:14,column:33},end:{line:14,column:35}},4:{start:{line:19,column:42},end:{line:37,column:1}},5:{start:{line:20,column:2},end:{line:36,column:4}}},fnMap:{0:{name:"(anonymous_0)",decl:{start:{line:19,column:42},end:{line:19,column:43}},loc:{start:{line:19,column:84},end:{line:37,column:1}},line:19}},branchMap:{},s:{0:0,1:0,2:0,3:0,4:0,5:0},f:{0:0},b:{},_coverageSchema:"1a1c01bbd47fc00a2c39e90264f33305004495a9",hash:"2ece78ae83ecb53b7702449096facbc47fa2c586"});var actualCoverage=coverage[path];return cov_2fcno329eq=function(){return actualCoverage},actualCoverage}cov_2fcno329eq();const TASK_TOOLTIP_BACKGROUND=(cov_2fcno329eq().s[0]++,"black"),TASK_TOOLTIP_COLOR=(cov_2fcno329eq().s[1]++,"white"),TASK_TOOLTIP_POINTER_SIZE=(cov_2fcno329eq().s[2]++,10),TASK_TOOLTIP_SHADOW_SIZE=(cov_2fcno329eq().s[3]++,10);cov_2fcno329eq().s[4]++;const TaskTooltip=({task:{label:taskLabel},x,y})=>(cov_2fcno329eq().f[0]++,cov_2fcno329eq().s[5]++,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(react_konva__WEBPACK_IMPORTED_MODULE_1__.__,{x,y,opacity:.75,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_konva__WEBPACK_IMPORTED_MODULE_1__.Vp,{fill:TASK_TOOLTIP_BACKGROUND,lineJoin:"round",pointerDirection:"down",pointerHeight:TASK_TOOLTIP_POINTER_SIZE,pointerWidth:TASK_TOOLTIP_POINTER_SIZE,shadowBlur:TASK_TOOLTIP_SHADOW_SIZE,shadowColor:TASK_TOOLTIP_BACKGROUND,shadowOffsetX:TASK_TOOLTIP_SHADOW_SIZE,shadowOffsetY:TASK_TOOLTIP_SHADOW_SIZE,shadowOpacity:.2}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_konva__WEBPACK_IMPORTED_MODULE_1__.xv,{text:taskLabel,fill:TASK_TOOLTIP_COLOR,fontSize:18,padding:5})]}));TaskTooltip.displayName="TaskTooltip";const __WEBPACK_DEFAULT_EXPORT__=TaskTooltip;try{Tooltip.displayName="Tooltip",Tooltip.__docgenInfo={description:"This component renders a task tooltip inside a canvas.",displayName:"Tooltip",props:{task:{defaultValue:null,description:"",name:"task",required:!0,type:{name:"TaskData"}},x:{defaultValue:null,description:"The x coordinate of a point on canvas",name:"x",required:!0,type:{name:"number"}},y:{defaultValue:null,description:"The y coordinate of a point on canvas",name:"y",required:!0,type:{name:"number"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/tasks/components/Tooltip/index.tsx#Tooltip"]={docgenInfo:Tooltip.__docgenInfo,name:"Tooltip",path:"src/tasks/components/Tooltip/index.tsx#Tooltip"})}catch(__react_docgen_typescript_loader_error){}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_melfore_konva_timeline=self.webpackChunk_melfore_konva_timeline||[]).push([[14],{"./src/tasks/components/Layer/index.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_konva__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react-konva/es/ReactKonva.js"),luxon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/luxon/src/luxon.js"),_timeline_TimelineContext__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/timeline/TimelineContext.tsx"),_utils_tasks__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/tasks/utils/tasks.ts"),_Task__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/tasks/components/Task/index.tsx"),_Tooltip__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/tasks/components/Tooltip/index.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");function cov_1nacfvm119(){var path="/home/runner/work/konva-timeline/konva-timeline/src/tasks/components/Layer/index.tsx",global=new Function("return this")(),gcv="__coverage__",coverageData={path:"/home/runner/work/konva-timeline/konva-timeline/src/tasks/components/Layer/index.tsx",statementMap:{0:{start:{line:25,column:40},end:{line:124,column:1}},1:{start:{line:34,column:6},end:{line:34,column:26}},2:{start:{line:36,column:26},end:{line:39,column:3}},3:{start:{line:37,column:28},end:{line:37,column:78}},4:{start:{line:37,column:60},end:{line:37,column:77}},5:{start:{line:41,column:22},end:{line:41,column:101}},6:{start:{line:41,column:54},end:{line:41,column:91}},7:{start:{line:41,column:77},end:{line:41,column:90}},8:{start:{line:43,column:22},end:{line:43,column:79}},9:{start:{line:43,column:40},end:{line:43,column:60}},10:{start:{line:45,column:21},end:{line:56,column:3}},11:{start:{line:47,column:19},end:{line:47,column:38}},12:{start:{line:48,column:6},end:{line:50,column:7}},13:{start:{line:49,column:8},end:{line:49,column:36}},14:{start:{line:52,column:23},end:{line:52,column:28}},15:{start:{line:53,column:6},end:{line:53,column:37}},16:{start:{line:58,column:25},end:{line:61,column:3}},17:{start:{line:59,column:24},end:{line:59,column:71}},18:{start:{line:63,column:29},end:{line:70,column:3}},19:{start:{line:65,column:24},end:{line:65,column:54}},20:{start:{line:66,column:32},end:{line:66,column:82}},21:{start:{line:67,column:6},end:{line:67,column:47}},22:{start:{line:72,column:23},end:{line:80,column:3}},23:{start:{line:74,column:24},end:{line:74,column:50}},24:{start:{line:75,column:22},end:{line:75,column:46}},25:{start:{line:76,column:32},end:{line:76,column:75}},26:{start:{line:77,column:6},end:{line:77,column:47}},27:{start:{line:82,column:2},end:{line:84,column:3}},28:{start:{line:83,column:4},end:{line:83,column:16}},29:{start:{line:86,column:2},end:{line:88,column:3}},30:{start:{line:87,column:4},end:{line:87,column:16}},31:{start:{line:90,column:2},end:{line:123,column:4}},32:{start:{line:93,column:37},end:{line:93,column:45}},33:{start:{line:94,column:30},end:{line:94,column:57}},34:{start:{line:95,column:8},end:{line:97,column:9}},35:{start:{line:96,column:10},end:{line:96,column:22}},36:{start:{line:99,column:58},end:{line:99,column:82}},37:{start:{line:100,column:28},end:{line:100,column:58}},38:{start:{line:101,column:28},end:{line:101,column:72}},39:{start:{line:102,column:22},end:{line:102,column:40}},40:{start:{line:103,column:8},end:{line:105,column:9}},41:{start:{line:104,column:10},end:{line:104,column:22}},42:{start:{line:107,column:8},end:{line:119,column:10}}},fnMap:{0:{name:"(anonymous_0)",decl:{start:{line:25,column:40},end:{line:25,column:41}},loc:{start:{line:25,column:77},end:{line:124,column:1}},line:25},1:{name:"(anonymous_1)",decl:{start:{line:37,column:4},end:{line:37,column:5}},loc:{start:{line:37,column:28},end:{line:37,column:78}},line:37},2:{name:"(anonymous_2)",decl:{start:{line:37,column:48},end:{line:37,column:49}},loc:{start:{line:37,column:60},end:{line:37,column:77}},line:37},3:{name:"(anonymous_3)",decl:{start:{line:41,column:34},end:{line:41,column:35}},loc:{start:{line:41,column:54},end:{line:41,column:91}},line:41},4:{name:"(anonymous_4)",decl:{start:{line:41,column:65},end:{line:41,column:66}},loc:{start:{line:41,column:77},end:{line:41,column:90}},line:41},5:{name:"(anonymous_5)",decl:{start:{line:43,column:34},end:{line:43,column:35}},loc:{start:{line:43,column:40},end:{line:43,column:60}},line:43},6:{name:"(anonymous_6)",decl:{start:{line:46,column:4},end:{line:46,column:5}},loc:{start:{line:46,column:43},end:{line:54,column:5}},line:46},7:{name:"(anonymous_7)",decl:{start:{line:59,column:4},end:{line:59,column:5}},loc:{start:{line:59,column:24},end:{line:59,column:71}},line:59},8:{name:"(anonymous_8)",decl:{start:{line:64,column:4},end:{line:64,column:5}},loc:{start:{line:64,column:27},end:{line:68,column:5}},line:64},9:{name:"(anonymous_9)",decl:{start:{line:73,column:4},end:{line:73,column:5}},loc:{start:{line:73,column:43},end:{line:78,column:5}},line:73},10:{name:"(anonymous_10)",decl:{start:{line:92,column:17},end:{line:92,column:18}},loc:{start:{line:92,column:31},end:{line:120,column:7}},line:92}},branchMap:{0:{loc:{start:{line:48,column:6},end:{line:50,column:7}},type:"if",locations:[{start:{line:48,column:6},end:{line:50,column:7}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:48},1:{loc:{start:{line:82,column:2},end:{line:84,column:3}},type:"if",locations:[{start:{line:82,column:2},end:{line:84,column:3}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:82},2:{loc:{start:{line:82,column:6},end:{line:82,column:36}},type:"binary-expr",locations:[{start:{line:82,column:6},end:{line:82,column:20}},{start:{line:82,column:24},end:{line:82,column:36}}],line:82},3:{loc:{start:{line:86,column:2},end:{line:88,column:3}},type:"if",locations:[{start:{line:86,column:2},end:{line:88,column:3}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:86},4:{loc:{start:{line:95,column:8},end:{line:97,column:9}},type:"if",locations:[{start:{line:95,column:8},end:{line:97,column:9}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:95},5:{loc:{start:{line:103,column:8},end:{line:105,column:9}},type:"if",locations:[{start:{line:103,column:8},end:{line:105,column:9}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:103},6:{loc:{start:{line:103,column:12},end:{line:103,column:80}},type:"binary-expr",locations:[{start:{line:103,column:12},end:{line:103,column:39}},{start:{line:103,column:43},end:{line:103,column:80}}],line:103},7:{loc:{start:{line:121,column:7},end:{line:121,column:54}},type:"binary-expr",locations:[{start:{line:121,column:7},end:{line:121,column:18}},{start:{line:121,column:22},end:{line:121,column:54}}],line:121}},s:{0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0,21:0,22:0,23:0,24:0,25:0,26:0,27:0,28:0,29:0,30:0,31:0,32:0,33:0,34:0,35:0,36:0,37:0,38:0,39:0,40:0,41:0,42:0},f:{0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0},b:{0:[0,0],1:[0,0],2:[0,0],3:[0,0],4:[0,0],5:[0,0],6:[0,0],7:[0,0]},_coverageSchema:"1a1c01bbd47fc00a2c39e90264f33305004495a9",hash:"d947d7e5dd9246435e4289b39716d8964171d9dc"},coverage=global[gcv]||(global[gcv]={});coverage[path]&&"d947d7e5dd9246435e4289b39716d8964171d9dc"===coverage[path].hash||(coverage[path]=coverageData);var actualCoverage=coverage[path];return cov_1nacfvm119=function(){return actualCoverage},actualCoverage}cov_1nacfvm119(),cov_1nacfvm119().s[0]++;const TasksLayer=({setTaskTooltip,taskTooltip})=>{cov_1nacfvm119().f[0]++;const{columnWidth,drawRange,interval:{start:intervalStart,end:intervalEnd},resolution,resources,rowHeight,tasks}=(cov_1nacfvm119().s[1]++,(0,_timeline_TimelineContext__WEBPACK_IMPORTED_MODULE_3__.i)()),getResourceById=(cov_1nacfvm119().s[2]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((resourceId=>(cov_1nacfvm119().f[1]++,cov_1nacfvm119().s[3]++,resources.findIndex((({id})=>(cov_1nacfvm119().f[2]++,cov_1nacfvm119().s[4]++,resourceId===id))))),[resources])),getTaskById=(cov_1nacfvm119().s[5]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((taskId=>(cov_1nacfvm119().f[3]++,cov_1nacfvm119().s[6]++,tasks.find((({id})=>(cov_1nacfvm119().f[4]++,cov_1nacfvm119().s[7]++,taskId===id))))),[tasks])),onTaskLeave=(cov_1nacfvm119().s[8]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((()=>(cov_1nacfvm119().f[5]++,cov_1nacfvm119().s[9]++,setTaskTooltip(null))),[setTaskTooltip])),onTaskOver=(cov_1nacfvm119().s[10]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(((taskId,point)=>{cov_1nacfvm119().f[6]++;const task=(cov_1nacfvm119().s[11]++,getTaskById(taskId));if(cov_1nacfvm119().s[12]++,!task)return cov_1nacfvm119().b[0][0]++,cov_1nacfvm119().s[13]++,setTaskTooltip(null);cov_1nacfvm119().b[0][1]++;const{x,y}=(cov_1nacfvm119().s[14]++,point);cov_1nacfvm119().s[15]++,setTaskTooltip({task,x,y})}),[getTaskById,setTaskTooltip])),getXCoordinate=(cov_1nacfvm119().s[16]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((offset=>(cov_1nacfvm119().f[7]++,cov_1nacfvm119().s[17]++,offset*columnWidth/resolution.sizeInUnits)),[columnWidth,resolution.sizeInUnits])),getTaskXCoordinate=(cov_1nacfvm119().s[18]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((startTime=>{cov_1nacfvm119().f[8]++;const timeStart=(cov_1nacfvm119().s[19]++,luxon__WEBPACK_IMPORTED_MODULE_2__.ou.fromMillis(startTime)),startOffsetInUnit=(cov_1nacfvm119().s[20]++,timeStart.diff(intervalStart).as(resolution.unit));return cov_1nacfvm119().s[21]++,getXCoordinate(startOffsetInUnit)}),[getXCoordinate,intervalStart,resolution.unit])),getTaskWidth=(cov_1nacfvm119().s[22]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((({start,end})=>{cov_1nacfvm119().f[9]++;const timeStart=(cov_1nacfvm119().s[23]++,luxon__WEBPACK_IMPORTED_MODULE_2__.ou.fromMillis(start)),timeEnd=(cov_1nacfvm119().s[24]++,luxon__WEBPACK_IMPORTED_MODULE_2__.ou.fromMillis(end)),widthOffsetInUnit=(cov_1nacfvm119().s[25]++,timeEnd.diff(timeStart).as(resolution.unit));return cov_1nacfvm119().s[26]++,getXCoordinate(widthOffsetInUnit)}),[getXCoordinate,resolution.unit]));return cov_1nacfvm119().s[27]++,cov_1nacfvm119().b[2][0]++,intervalStart&&(cov_1nacfvm119().b[2][1]++,intervalEnd)?(cov_1nacfvm119().b[1][1]++,cov_1nacfvm119().s[29]++,drawRange.end-drawRange.start<=0?(cov_1nacfvm119().b[3][0]++,cov_1nacfvm119().s[30]++,null):(cov_1nacfvm119().b[3][1]++,cov_1nacfvm119().s[31]++,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_konva__WEBPACK_IMPORTED_MODULE_1__.mh,{children:[tasks.map((taskData=>{cov_1nacfvm119().f[10]++;const{resourceId,time}=(cov_1nacfvm119().s[32]++,taskData),resourceIndex=(cov_1nacfvm119().s[33]++,getResourceById(resourceId));if(cov_1nacfvm119().s[34]++,resourceIndex<0)return cov_1nacfvm119().b[4][0]++,cov_1nacfvm119().s[35]++,null;cov_1nacfvm119().b[4][1]++;const{color:resourceColor,toCompleteColor}=(cov_1nacfvm119().s[36]++,resources[resourceIndex]),xCoordinate=(cov_1nacfvm119().s[37]++,getTaskXCoordinate(time.start)),yCoordinate=(cov_1nacfvm119().s[38]++,(0,_utils_tasks__WEBPACK_IMPORTED_MODULE_4__.rc)(resourceIndex,rowHeight)),width=(cov_1nacfvm119().s[39]++,getTaskWidth(time));return cov_1nacfvm119().s[40]++,cov_1nacfvm119().b[6][0]++,xCoordinate>drawRange.end||(cov_1nacfvm119().b[6][1]++,xCoordinate+width void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/tasks/components/Layer/index.tsx#Layer"]={docgenInfo:Layer.__docgenInfo,name:"Layer",path:"src/tasks/components/Layer/index.tsx#Layer"})}catch(__react_docgen_typescript_loader_error){}},"./src/tasks/components/Tooltip/index.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_konva__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react-konva/es/ReactKonva.js"),luxon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/luxon/src/luxon.js"),_timeline_TimelineContext__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/timeline/TimelineContext.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");function cov_2fcno329eq(){var path="/home/runner/work/konva-timeline/konva-timeline/src/tasks/components/Tooltip/index.tsx",global=new Function("return this")(),gcv="__coverage__",coverageData={path:"/home/runner/work/konva-timeline/konva-timeline/src/tasks/components/Tooltip/index.tsx",statementMap:{0:{start:{line:13,column:32},end:{line:13,column:39}},1:{start:{line:14,column:27},end:{line:14,column:34}},2:{start:{line:15,column:34},end:{line:15,column:36}},3:{start:{line:16,column:33},end:{line:16,column:35}},4:{start:{line:21,column:42},end:{line:75,column:1}},5:{start:{line:33,column:6},end:{line:33,column:26}},6:{start:{line:34,column:14},end:{line:41,column:62}},7:{start:{line:35,column:18},end:{line:35,column:46}},8:{start:{line:36,column:22},end:{line:36,column:51}},9:{start:{line:37,column:26},end:{line:37,column:87}},10:{start:{line:38,column:24},end:{line:38,column:77}},11:{start:{line:39,column:21},end:{line:39,column:96}},12:{start:{line:40,column:4},end:{line:40,column:70}},13:{start:{line:43,column:21},end:{line:55,column:41}},14:{start:{line:44,column:17},end:{line:44,column:42}},15:{start:{line:45,column:4},end:{line:47,column:5}},16:{start:{line:46,column:6},end:{line:46,column:20}},17:{start:{line:48,column:4},end:{line:50,column:5}},18:{start:{line:49,column:6},end:{line:49,column:21}},19:{start:{line:51,column:4},end:{line:53,column:5}},20:{start:{line:52,column:6},end:{line:52,column:18}},21:{start:{line:54,column:4},end:{line:54,column:18}},22:{start:{line:56,column:2},end:{line:74,column:4}}},fnMap:{0:{name:"(anonymous_0)",decl:{start:{line:21,column:42},end:{line:21,column:43}},loc:{start:{line:30,column:6},end:{line:75,column:1}},line:30},1:{name:"(anonymous_1)",decl:{start:{line:34,column:22},end:{line:34,column:23}},loc:{start:{line:34,column:28},end:{line:41,column:3}},line:34},2:{name:"(anonymous_2)",decl:{start:{line:43,column:29},end:{line:43,column:30}},loc:{start:{line:43,column:35},end:{line:55,column:3}},line:43}},branchMap:{0:{loc:{start:{line:39,column:21},end:{line:39,column:96}},type:"cond-expr",locations:[{start:{line:39,column:43},end:{line:39,column:91}},{start:{line:39,column:94},end:{line:39,column:96}}],line:39},1:{loc:{start:{line:45,column:4},end:{line:47,column:5}},type:"if",locations:[{start:{line:45,column:4},end:{line:47,column:5}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:45},2:{loc:{start:{line:48,column:4},end:{line:50,column:5}},type:"if",locations:[{start:{line:48,column:4},end:{line:50,column:5}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:48},3:{loc:{start:{line:51,column:4},end:{line:53,column:5}},type:"if",locations:[{start:{line:51,column:4},end:{line:53,column:5}},{start:{line:void 0,column:void 0},end:{line:void 0,column:void 0}}],line:51}},s:{0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0,19:0,20:0,21:0,22:0},f:{0:0,1:0,2:0},b:{0:[0,0],1:[0,0],2:[0,0],3:[0,0]},_coverageSchema:"1a1c01bbd47fc00a2c39e90264f33305004495a9",hash:"e13a43029c9370f3737fb32ed0384f3455e64ac1"},coverage=global[gcv]||(global[gcv]={});coverage[path]&&"e13a43029c9370f3737fb32ed0384f3455e64ac1"===coverage[path].hash||(coverage[path]=coverageData);var actualCoverage=coverage[path];return cov_2fcno329eq=function(){return actualCoverage},actualCoverage}cov_2fcno329eq();const TASK_TOOLTIP_BACKGROUND=(cov_2fcno329eq().s[0]++,"black"),TASK_TOOLTIP_COLOR=(cov_2fcno329eq().s[1]++,"black"),TASK_TOOLTIP_POINTER_SIZE=(cov_2fcno329eq().s[2]++,15),TASK_TOOLTIP_SHADOW_SIZE=(cov_2fcno329eq().s[3]++,10);cov_2fcno329eq().s[4]++;const TaskTooltip=({task:{label:taskLabel,resourceId,completedPercentage,time:{start,end}},x,y})=>{cov_2fcno329eq().f[0]++;const{drawRange:{start:drawStart,end:drawEnd}}=(cov_2fcno329eq().s[5]++,(0,_timeline_TimelineContext__WEBPACK_IMPORTED_MODULE_3__.i)()),txt=(cov_2fcno329eq().s[6]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>{cov_2fcno329eq().f[1]++;const label=(cov_2fcno329eq().s[7]++,"LABEL: "+taskLabel+"\n"),resources=(cov_2fcno329eq().s[8]++,"RESID: "+resourceId+"\n"),startDuration=(cov_2fcno329eq().s[9]++,"START: "+luxon__WEBPACK_IMPORTED_MODULE_2__.ou.fromMillis(Number(start)).toISO()+"\n"),endDuration=(cov_2fcno329eq().s[10]++,"END: "+luxon__WEBPACK_IMPORTED_MODULE_2__.ou.fromMillis(Number(end)).toISO()),complete=(cov_2fcno329eq().s[11]++,completedPercentage?(cov_2fcno329eq().b[0][0]++,"\nCOMPLETED: "+completedPercentage+"%"):(cov_2fcno329eq().b[0][1]++,""));return cov_2fcno329eq().s[12]++,label+resources+startDuration+endDuration+complete}),[taskLabel,resourceId,completedPercentage,start,end])),pointerDir=(cov_2fcno329eq().s[13]++,(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>{cov_2fcno329eq().f[2]++;const part=(cov_2fcno329eq().s[14]++,(drawEnd-drawStart)/5);return cov_2fcno329eq().s[15]++,xdrawEnd-part?(cov_2fcno329eq().b[2][0]++,cov_2fcno329eq().s[18]++,"right"):(cov_2fcno329eq().b[2][1]++,cov_2fcno329eq().s[19]++,"1"===resourceId?(cov_2fcno329eq().b[3][0]++,cov_2fcno329eq().s[20]++,"up"):(cov_2fcno329eq().b[3][1]++,cov_2fcno329eq().s[21]++,"down")))}),[resourceId,drawEnd,drawStart,x]));return cov_2fcno329eq().s[22]++,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_konva__WEBPACK_IMPORTED_MODULE_1__.__,{x,y,opacity:1,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(react_konva__WEBPACK_IMPORTED_MODULE_1__.Vp,{fill:"white",lineJoin:"round",stroke:"black",strokeWidth:1,pointerDirection:pointerDir,pointerHeight:TASK_TOOLTIP_POINTER_SIZE,pointerWidth:TASK_TOOLTIP_POINTER_SIZE,shadowBlur:TASK_TOOLTIP_SHADOW_SIZE,shadowColor:TASK_TOOLTIP_BACKGROUND,shadowOffsetX:TASK_TOOLTIP_SHADOW_SIZE,shadowOffsetY:TASK_TOOLTIP_SHADOW_SIZE,shadowOpacity:.2}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(react_konva__WEBPACK_IMPORTED_MODULE_1__.xv,{text:txt,fill:TASK_TOOLTIP_COLOR,fontSize:15,padding:6})]})};TaskTooltip.displayName="TaskTooltip";const __WEBPACK_DEFAULT_EXPORT__=TaskTooltip;try{Tooltip.displayName="Tooltip",Tooltip.__docgenInfo={description:"This component renders a task tooltip inside a canvas.",displayName:"Tooltip",props:{task:{defaultValue:null,description:"",name:"task",required:!0,type:{name:"TaskData"}},x:{defaultValue:null,description:"The x coordinate of a point on canvas",name:"x",required:!0,type:{name:"number"}},y:{defaultValue:null,description:"The y coordinate of a point on canvas",name:"y",required:!0,type:{name:"number"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/tasks/components/Tooltip/index.tsx#Tooltip"]={docgenInfo:Tooltip.__docgenInfo,name:"Tooltip",path:"src/tasks/components/Tooltip/index.tsx#Tooltip"})}catch(__react_docgen_typescript_loader_error){}}}]); \ No newline at end of file diff --git a/docs/iframe.html b/docs/iframe.html index 8cd29a2..859bedb 100644 --- a/docs/iframe.html +++ b/docs/iframe.html @@ -348,7 +348,7 @@ window['DOCS_OPTIONS'] = {"docsMode":true,"defaultName":"Docs","autodocs":"tag"};