mirror of https://gitlab.com/octtspacc/OcttKB
10 lines
8.3 KiB
JSON
10 lines
8.3 KiB
JSON
|
[
|
||
|
{
|
||
|
"title": "$:/plugins/Gk0Wk/echarts/addons/TheBrain.js",
|
||
|
"text": "\"use strict\";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var i in t)__defProp(e,i,{get:t[i],enumerable:!0})},__copyProps=(t,i,o,r)=>{if(i&&\"object\"==typeof i||\"function\"==typeof i)for(let e of __getOwnPropNames(i))__hasOwnProp.call(t,e)||e===o||__defProp(t,e,{get:()=>i[e],enumerable:!(r=__getOwnPropDesc(i,e))||r.enumerable});return t},__toCommonJS=e=>__copyProps(__defProp({},\"__esModule\",{value:!0}),e),TheBrain_exports={},colors=(__export(TheBrain_exports,{\"default\":()=>TheBrain_default}),module.exports=__toCommonJS(TheBrain_exports),[\"#5470c6\",\"#91cc75\",\"#fac858\",\"#ee6666\",\"#73c0de\",\"#3ba272\",\"#fc8452\",\"#9a60b4\",\"#ea7ccc\"]),CategoriesEn=[\"Focusing\",\"History\",\"Link To\",\"Backlink From\",\"Tag To\",\"Tag By\",\"Transclude\"].map((e,t)=>({name:e,itemStyle:{color:colors[t%colors.length]}})),CategoriesZh=[\"聚焦\",\"历史\",\"链接\",\"反链\",\"标签\",\"作为标签\",\"嵌套\"].map((e,t)=>({name:e,itemStyle:{color:colors[t%colors.length]}})),attributes=new Set([\"focussedTiddler\",\"levels\",\"graphTitle\",\"aliasField\",\"excludeFilter\",\"previewDelay\"]),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>`,{}),findIcon=e=>{var t,i=null==(i=$tw.wiki.getTiddler(e))?void 0:i.fields;if(null!=i&&i.icon)return(t=null==(t=$tw.wiki.getTiddler(i.icon))?void 0:t.fields)?t._canonical_uri?\"image://\"+t._canonical_uri:t.title.startsWith(\"$:/core/images/\")?void 0:`image://data:${t.type};base64,`+t.text:/^https?:\\/\\//.test(i.icon)?\"image://\"+i.icon:void 0},getAliasOrTitle=(e,t)=>{var i;return void 0===t||\"title\"===t?[e,Boolean($tw.wiki.getTiddler(e))]:(i=$tw.wiki.getTiddler(e))?[\"string\"==typeof(i=i.fields[t])?$tw.wiki.renderText(\"text/plain\",\"text/vnd.tiddlywiki\",i,{variables:{currentTiddler:e}}):e,!0]:[e,!1]},TheBrainAddon={onMount:(e,t)=>(e.on(\"click\",{dataType:\"node\"},e=>{(new $tw.Story).navigateTiddler(e.data.name)}),{historyTiddlers:[],viewingTiddlers:new Set,focusing:t.focussedTiddler}),shouldUpdate:({viewingTiddlers:t,focusing:e,currentlyFocused:i},o,r)=>Object.keys(o).some(e=>t.has(e))||Object.keys(r).some(e=>attributes.has(e))||void 0===e&&$tw.wiki.getTiddlerText(\"$:/temp/focussedTiddler\")!==i,onUpdate:(r,l,d)=>{let s=d.focussedTiddler||$tw.wiki.getTiddlerText(\"$:/temp/focussedTiddler\");if(l.viewingTiddlers.clear(),l.focusing=d.focussedTiddler,l.currentlyFocused=s){l.viewingTiddlers.add(s),null!=(n=$tw.wiki.getTiddler(s))&&n.fields[\"draft.of\"]&&(s=$tw.wiki.getTiddler(s).fields[\"draft.of\"]);const T=[],b=[];var n=!0===(null==(n=$tw.wiki.getTiddlerText(\"$:/language\"))?void 0:n.includes(\"zh\"));let e=Number(d.levels);Number.isNaN(e)&&(e=1),e=Math.max(e,0);var g=d.graphTitle||(n?\"聚焦\":\"Focusing Map\");const v=\"\"===d.aliasField?void 0:d.aliasField,k=\"\"===d.excludeFilter?void 0:$tw.wiki.compileFilter(null!=(h=d.excludeFilter)?h:\"[prefix[$:/]]\"),$=new Map;T.push({name:s,category:0,label:{formatter:getAliasOrTitle(s,v)[0],fontWeight:\"bold\",fontSize:\"15px\"},symbol:findIcon(s),symbolSize:15,select:{disabled:!0},itemStyle:{opacity:1,borderColor:colors[0]+\"66\",borderWidth:15},isTag:!1,tooltip:{show:!1}});let a=[s];if(k){var u=new Set(a);for(const _ of k.call($tw.wiki,a))u[\"delete\"](_);a=Array.from(u)}$.set(s,!0),$.set(\"\",!1);for(var y=(e,t,i)=>{var o,r,l;return!(k&&0<k.call($tw.wiki,[e]).length)&&(([r,l]=void 0===(o=$.get(e))?getAliasOrTitle(e,v):[\"\",o]),void 0===o&&(T.push(t(r,l)),$.set(e,l),l)&&a.push(e),b.push(i(l)),l)};a.length&&0<e--;){var f=a;a=[];for(const S of f){for(const x of $tw.wiki.getTiddlerLinks(S))y(x,(e,t)=>({name:x,label:{formatter:e},itemStyle:{opacity:t?1:.65},symbol:findIcon(x),category:2,isTag:!1}),e=>({source:S,target:x,lineStyle
|
||
|
"Modern.TiddlyDev#IncludeSource": "true",
|
||
|
"Modern.TiddlyDev#Origin": "addons/Gk0Wk/TheBrain.ts",
|
||
|
"module-type": "echarts-component",
|
||
|
"type": "application/javascript"
|
||
|
}
|
||
|
]
|