mirror of https://gitlab.com/octtspacc/OcttKB
10 lines
4.6 KiB
JSON
10 lines
4.6 KiB
JSON
|
[
|
||
|
{
|
||
|
"title": "$:/plugins/Gk0Wk/echarts/addons/GitHubHeatMap.js",
|
||
|
"text": "\"use strict\";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(t,r,a,o)=>{if(r&&\"object\"==typeof r||\"function\"==typeof r)for(let e of __getOwnPropNames(r))__hasOwnProp.call(t,e)||e===a||__defProp(t,e,{get:()=>r[e],enumerable:!(o=__getOwnPropDesc(r,e))||o.enumerable});return t},__toESM=(e,t,r)=>(r=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?r:__defProp(r,\"default\",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},\"__esModule\",{value:!0}),e),GitHubHeatMap_exports={},ECharts=(__export(GitHubHeatMap_exports,{\"default\":()=>GitHubHeatMap_default}),module.exports=__toCommonJS(GitHubHeatMap_exports),__toESM(require(\"$:/plugins/Gk0Wk/echarts/echarts.min.js\"))),getFilterByDate=(e,t)=>`[all[tiddlers]sameday:created[${e}]][all[tiddlers]sameday:modified[${e}]] +${t} +[sort[]]`,yearDates=new Map,dayTime=864e5,getData=(t,a)=>{if(!yearDates.has(t)){var r=ECharts.number.parseDate(t+\"-01-01\").getTime(),o=ECharts.number.parseDate(t+1+\"-01-01\").getTime(),l=[];for(let e=r;e<o;e+=dayTime){var i=ECharts.format.formatTime(\"yyyy-MM-dd\",e),d=i.replace(/-/g,\"\");l.push([i,d])}yearDates.set(t,l)}let n=0;return[yearDates.get(t).map(([e,t])=>{var r=$tw.wiki.filterTiddlers(getFilterByDate(t,a)).length;return n+=r,[e,r]}),n]},getPlatteColor=e=>$tw.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",`<$transclude tiddler={{$:/palette}} index=\"${e}\"><$transclude tiddler=\"$:/palettes/Vanilla\" index=\"${e}\"><$transclude tiddler=\"$:/config/DefaultColourMappings/${e}\"/></$transclude></$transclude>`,{}),checkIfChinese=()=>{var e;return!0===(null==(e=$tw.wiki.getTiddlerText(\"$:/language\"))?void 0:e.includes(\"zh\"))},checkIfDarkMode=()=>{var e;return\"dark\"===(null==(e=null==(e=$tw.wiki.getTiddler($tw.wiki.getTiddlerText(\"$:/palette\")))?void 0:e.fields)?void 0:e[\"color-scheme\"])},GitHubHeatMapAddon={shouldUpdate:(e,t)=>0<$tw.utils.count(t),onUpdate:(e,t,r)=>{var a=parseInt(r.year,10)||(new Date).getFullYear();const p=r.subfilter||\"[!is[shadow]!prefix[$:/]]\";var[o,l]=getData(a,p);let i=\"\",d=0,n;e.setOption({title:{top:0,left:\"center\",text:checkIfChinese()?`今年产出 ${l} 篇文章`:`Produced ${l} tiddlers this year`},tooltip:{position:\"top\",formatter:({value:[e,t]})=>(e===i&&t===d&&n||(n=((e,t)=>{if(0===t)return checkIfChinese()?ECharts.format.formatTime(\"yyyy年M月d日\",e)+\" 无条目。\":$tw.utils.formatDateString($tw.utils.parseDate(e.replace(/-/g,\"\")),\"MMM DDD, YYYY\")+\" no tiddler.\";var r=$tw.utils.domMaker(\"p\",{text:checkIfChinese()?ECharts.format.formatTime(\"yyyy年M月d日\",e)+` 共有 ${t} 篇:`:$tw.utils.formatDateString($tw.utils.parseDate(e.replace(/-/g,\"\")),\"MMM DDD, YYYY\")+` ${t} tiddler${1<t?\"s\":\"\"}.`}),a=$tw.utils.domMaker(\"ul\",{}),o=$tw.wiki.filterTiddlers(getFilterByDate(e.replace(/-/g,\"\"),p)),l=o.length;for(let n=0;n<l;n++){const s=o[n];var i=$tw.utils.domMaker(\"li\",{}),d=$tw.utils.domMaker(\"a\",{text:s,\"class\":\"tc-tiddlylink tc-tiddlylink-resolves tc-popup-handle tc-popup-absolute\",style:{cursor:\"pointer\"}});d.addEventListener(\"click\",()=>(new $tw.Story).navigateTiddler(s)),i.appendChild(d),a.appendChild(i)}return[r,a]})(e,t),i=e,d=t),n),triggerOn:\"mousemove|click\",enterable:!0,hideDelay:800,backgroundColor:getPlatteColor(\"page-background\"),borderColor:getPlatteColor(\"very-muted-foreground\")},visualMap:{type:\"piecewise\",orient:\"horizontal\",calculable:!0,showLabel:!1,right:0,top:175,pieces:[{lte:0,color:checkIfDarkMode()?\"#161B22\":\"#EBEDF0\"},{gt:0,lte:3,color:\"#0E4429\"},{gt:3,lte:7,color:\"#006D32\"},{gt:7,lte:15,color:\"#26A641\"},{gt:15,color:\"#39D353\"}]},calendar:{top:60,left:0,right:0,cellSize:15,orient:\"horizontal\",range:a,itemStyle:{borderWidth:3,borderCap:\"round\",borderJoin:\"round\",borderColor:getPlatt
|
||
|
"Modern.TiddlyDev#IncludeSource": "true",
|
||
|
"Modern.TiddlyDev#Origin": "addons/Gk0Wk/GitHubHeatMap.ts",
|
||
|
"module-type": "echarts-component",
|
||
|
"type": "application/javascript"
|
||
|
}
|
||
|
]
|