diff --git a/.obsidian/app.json b/.obsidian/app.json index 9e26dfe..76fcd24 100644 --- a/.obsidian/app.json +++ b/.obsidian/app.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "showLineNumber": false +} \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json index 574a981..e4494a1 100644 --- a/.obsidian/community-plugins.json +++ b/.obsidian/community-plugins.json @@ -1,11 +1,10 @@ [ + "export-graph-view", + "mermaid-tools", "obsidian-git", - "obsidian-tasks-plugin", - "pdf-plus", -<<<<<<< HEAD - "advanced-canvas", "obsidian-plantuml", -======= ->>>>>>> origin/main - "tasks-calendar-wrapper" + "pdf-plus", + "obsidian-tasks-plugin", + "tasks-calendar-wrapper", + "advanced-canvas" ] \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json new file mode 100644 index 0000000..e21a18d --- /dev/null +++ b/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 1, + "close": false +} \ No newline at end of file diff --git a/.obsidian/plugins/export-graph-view/main.js b/.obsidian/plugins/export-graph-view/main.js new file mode 100644 index 0000000..3e63080 --- /dev/null +++ b/.obsidian/plugins/export-graph-view/main.js @@ -0,0 +1,22 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var v=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var F=(c,t)=>{for(var i in t)v(c,i,{get:t[i],enumerable:!0})},O=(c,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of k(t))!C.call(c,s)&&s!==i&&v(c,s,{get:()=>t[s],enumerable:!(e=E(t,s))||e.enumerable});return c};var A=c=>O(v({},"__esModule",{value:!0}),c);var L={};F(L,{default:()=>b});module.exports=A(L);var M={exportFormat:"mmd",includeOrphans:!1,includeAttachments:!1,lastExported:"",includeWeights:!1,relationshipStrategy:"tags",weightThreshold:1,subgraphs:!1,direction:"TD",maxEPerV:10,enableAutoBridge:!0,manualBackoff:!1,maxNodes:40,maxRelationships:60,maxTags:10};var h=require("obsidian"),N=class extends h.PluginSettingTab{constructor(t,i){super(t,i),this.plugin=i}display(){let{containerEl:t}=this;t.empty(),this.plugin.settings.viewMode?this.plugin.settings.viewMode==="singleGraph"?this.singleGraph(t):this.plugin.settings.viewMode==="fullGraph"&&this.fullGraph(t):this.singleOrFull(t)}singleOrFull(t){let i=t.createDiv({cls:"egv-choice-container"});i.createEl("h2",{text:"Change default settings",cls:"egv-choice-header"}),i.createEl("p",{text:"Select the focus you want to tweak settings on",cls:"egv-choice-description"});let e=i.createDiv({cls:"egv-cards-container"}),s=e.createDiv({cls:"egv-choice-card"});s.createDiv({cls:"egv-card-icon single-parent-icon"}),s.createEl("h3",{text:"Single-parent focus"}),s.createEl("p",{text:"Snapshot relationships from a single tag or note"});let n=new h.ButtonComponent(s.createDiv({cls:"egv-card-button-container"})).setButtonText("Change settings").setCta().onClick(async()=>{this.plugin.settings.viewMode="singleGraph",await this.plugin.saveSettings(),this.display()}),a=e.createDiv({cls:"egv-choice-card"});a.createDiv({cls:"egv-card-icon full-graph-icon"}),a.createEl("h3",{text:"Full vault focus"}),a.createEl("p",{text:"Snapshot your vault from a wider angle"});let o=new h.ButtonComponent(a.createDiv({cls:"egv-card-button-container"})).setButtonText("Change settings").setCta().onClick(async()=>{this.plugin.settings.viewMode="fullGraph",await this.plugin.saveSettings(),this.display()})}singleGraph(t){let i=t.createDiv({cls:"single-div"});new h.ButtonComponent(i).setIcon("arrow-left").setTooltip("Back to main choices").onClick(async()=>{this.plugin.settings.viewMode=void 0,await this.plugin.saveSettings(),this.display()}),i.createEl("h2",{text:"Single parent graph settings"});let e=t.createDiv({cls:"sg-div"});new h.Setting(e).setName("Parent node type").setDesc("Set your graph to draw from either your chosen tag or chosen note").addDropdown(s=>s.addOption("singleTag","Tag").addOption("singleNote","Note").setValue(this.plugin.settings.relationshipStrategy||"singleTag").onChange(async n=>{this.plugin.settings.relationshipStrategy=n,await this.plugin.saveSettings(),this.display()})),this.plugin.settings.relationshipStrategy==="singleTag"?new h.Setting(e).setName("Parent tag").setDesc("Enter the tag to use as your graph parent (without #)").addText(s=>s.setPlaceholder("Enter tag").setValue(this.plugin.settings.rootTag||"").onChange(async n=>{this.plugin.settings.rootTag=n,await this.plugin.saveSettings()})):this.plugin.settings.relationshipStrategy==="singleNote"&&new h.Setting(e).setName("Parent note").setDesc("Enter the title of the note to use as your graph parent").addText(s=>s.setPlaceholder("Enter note title").setValue(this.plugin.settings.rootNote||"").onChange(async n=>{this.plugin.settings.rootNote=n,await this.plugin.saveSettings()})),this.displayFormatSettings(t)}fullGraph(t){let i=t.createDiv({cls:"fgh"});new h.ButtonComponent(i).setIcon("arrow-left").setTooltip("Back to main choices").onClick(async()=>{this.plugin.settings.viewMode=void 0,await this.plugin.saveSettings(),this.display()}),i.createEl("h2",{text:"Full graph settings"});let e=t.createDiv({cls:"full-div"});new h.Setting(e).setName("Relationship between notes").setDesc("Choose how your notes are organised").addDropdown(s=>s.addOption("tags","by tags").addOption("internalLinks","by internal links").addOption("folders","by folders").setValue(this.plugin.settings.relationshipStrategy||"tags").onChange(async n=>{this.plugin.settings.relationshipStrategy=n,await this.plugin.saveSettings(),this.display()})),new h.Setting(e).setName("Include orphan notes").setDesc("Whether to include notes with no relationship to other notes by default").addToggle(s=>s.setValue(this.plugin.settings.includeOrphans).onChange(async n=>{this.plugin.settings.includeOrphans=n,await this.plugin.saveSettings()})),this.displayFormatSettings(t)}displayFormatSettings(t){let i=t.createDiv({cls:"formset-div"});i.createEl("h3",{text:"Export format settings"}),new h.Setting(i).setName("Export format").setDesc("Choose either a .mmd (Mermaid) or .dot (Graphviz) file").addDropdown(e=>e.addOption("mmd",".mmd").addOption("dot",".dot").setValue(this.plugin.settings.exportFormat).onChange(async s=>{this.plugin.settings.exportFormat=s,await this.plugin.saveSettings(),this.display()})),new h.Setting(i).setName("Include attachments").setDesc("Whether to include any non-markdown files by default").addToggle(e=>e.setValue(this.plugin.settings.includeAttachments).onChange(async s=>{this.plugin.settings.includeAttachments=s,await this.plugin.saveSettings()})),new h.Setting(i).setName("Include relationship weights").setDesc("Store relationship importance metadata in the exported file").addToggle(e=>e.setValue(this.plugin.settings.includeWeights).onChange(async s=>{this.plugin.settings.includeWeights=s,await this.plugin.saveSettings()})),this.plugin.settings.exportFormat==="dot"?this.displayDotSettings(i):this.plugin.settings.exportFormat==="mmd"&&this.displayMermaidSettings(i)}displayDotSettings(t){let i=t.createDiv({cls:"dotsetdiv"});i.createEl("h4",{text:"DOT format settings"}),new h.Setting(i).setName("Weight threshold").setDesc("Only include important relationships above a minimum score").addSlider(e=>e.setLimits(0,10,1).setValue(this.plugin.settings.weightThreshold||0).setDynamicTooltip().onChange(async s=>{this.plugin.settings.weightThreshold=s,await this.plugin.saveSettings()})),new h.Setting(i).setName("Subgraph clustering").setDesc("Whether to cluster notes by their common tag or folder").addToggle(e=>e.setValue(this.plugin.settings.subgraphs||!1).onChange(async s=>{this.plugin.settings.subgraphs=s,await this.plugin.saveSettings()}))}displayMermaidSettings(t){let i=t.createDiv({cls:"mmdsetdiv"});i.createEl("h4",{text:"Mermaid settings"}),new h.Setting(i).setName("Direction").setDesc("Mermaid layout").addDropdown(e=>e.addOption("TD","Top down").addOption("LR","Left right").addOption("RL","Right left").addOption("BT","Bottom top").setValue(this.plugin.settings.direction||"TD").onChange(async s=>{this.plugin.settings.direction=s,await this.plugin.saveSettings()})),new h.Setting(i).setName("Max relationships per node").setDesc("Optionally limit the number of relationships to render on elements").addSlider(e=>e.setLimits(0,20,1).setValue(this.plugin.settings.maxEPerV||0).setDynamicTooltip().onChange(async s=>{this.plugin.settings.maxEPerV=s,await this.plugin.saveSettings()})),this.plugin.settings.viewMode!=="singleGraph"&&this.backoffStrategy(i)}backoffStrategy(t){let i=t.createDiv({cls:"backoff-div"});new h.Setting(i).setName("Enable auto graph reduction").setDesc("NOTE: Turning this off may produce unreadable Mermaid graphs").addToggle(e=>e.setValue(this.plugin.settings.enableAutoBridge).onChange(async s=>{this.plugin.settings.enableAutoBridge=s,await this.plugin.saveSettings(),this.display()})),this.plugin.settings.enableAutoBridge===!0&&(new h.Setting(i).setName("Manual limit configuration").setDesc("Enable manual configuration of graph limits (advanced)").addToggle(e=>e.setValue(this.plugin.settings.manualBackoff||!1).onChange(async s=>{this.plugin.settings.manualBackoff=s,await this.plugin.saveSettings(),this.display()})),this.plugin.settings.manualBackoff===!0&&(new h.Setting(i).setName("Max elements").setDesc("Limit the number of elements included").addSlider(e=>e.setLimits(10,100,5).setValue(Math.min(this.plugin.settings.maxNodes||40,100)).setDynamicTooltip().onChange(async s=>{this.plugin.settings.maxNodes=s,await this.plugin.saveSettings()})),new h.Setting(i).setName("Max relationships").setDesc("Limit the relationships included").addSlider(e=>e.setLimits(10,75,5).setValue(Math.min(this.plugin.settings.maxRelationships||60,75)).setDynamicTooltip().onChange(async s=>{this.plugin.settings.maxRelationships=s,await this.plugin.saveSettings()})),new h.Setting(i).setName("Max tags").setDesc("Limit the number of tags included").addSlider(e=>e.setLimits(5,50,1).setValue(Math.min(this.plugin.settings.maxTags||10,50)).setDynamicTooltip().onChange(async s=>{this.plugin.settings.maxTags=s,await this.plugin.saveSettings()}))))}};var p=require("obsidian"),T=class extends p.Modal{constructor(t,i){super(t),this.plugin=i}onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("egv-export-modal");let i=t.createDiv({cls:"egv-file-row"}),e=new p.Setting(i).setName("File name").setClass("egv-filename-setting"),s=new p.TextComponent(e.controlEl).setValue(this.filename).onChange(d=>this.filename=d),n=new p.ButtonComponent(i).setButtonText("Export").setCta().onClick(()=>this.export()),a=t.createDiv({cls:"egv-section"});a.createEl("h3",{text:"Graph type"});let o=new p.Setting(a).setName("Graph scope").addDropdown(d=>d.addOption("fullGraph","Full graph").addOption("singleGraph","Single parent graph").setValue(this.plugin.settings.viewMode||"notSet").onChange(async y=>{this.plugin.settings.viewMode=y,await this.plugin.saveSettings(),this.strategy(a)}));this.strategy(a);let g=t.createDiv({cls:"egv-section"});g.createEl("h3",{text:"Format settings"}),new p.Setting(g).setName("Export format").addDropdown(d=>d.addOption("mmd",".mmd").addOption("dot",".dot").setValue(this.plugin.settings.exportFormat).onChange(async y=>{this.plugin.settings.exportFormat=y,await this.plugin.saveSettings(),this.mmdOrDot(g)})),this.mmdOrDot(g)}strategy(t){let i=t.querySelector(".options-div");i&&i.remove();let e=t.createDiv({cls:"options-div"});this.plugin.settings.viewMode==="singleGraph"?(new p.Setting(e).setName("Parent type").addDropdown(s=>s.addOption("singleTag","Tag").addOption("singleNote","Note").setValue(this.plugin.settings.relationshipStrategy).onChange(async n=>{this.plugin.settings.relationshipStrategy=n,await this.plugin.saveSettings(),this.singleOrFull(e)})),this.singleOrFull(e)):(new p.Setting(e).setName("Relationship type").addDropdown(s=>s.addOption("tags","By tags").addOption("internalLinks","By links").addOption("folders","By folders").setValue(this.plugin.settings.relationshipStrategy).onChange(async n=>{this.plugin.settings.relationshipStrategy=n,await this.plugin.saveSettings()})),new p.Setting(e).setName("Include orphans").setDesc("Include notes with no relationships to other notes").addToggle(s=>s.setValue(this.plugin.settings.includeOrphans).onChange(async n=>{this.plugin.settings.includeOrphans=n,await this.plugin.saveSettings()})))}singleOrFull(t){let i=t.querySelector(".single-diplay-div");i&&i.remove();let e=t.createDiv({cls:"single-display-div"});this.plugin.settings.relationshipStrategy==="singleTag"?new p.Setting(e).setName("Parent tag").setDesc("Enter tag without #").addText(s=>s.setValue(this.plugin.settings.rootTag||"").onChange(async n=>{this.plugin.settings.rootTag=n,await this.plugin.saveSettings()})):new p.Setting(e).setName("Parent note").setDesc("Enter note title").addText(s=>s.setValue(this.plugin.settings.rootNote||"").onChange(async n=>{this.plugin.settings.rootNote=n,await this.plugin.saveSettings()}))}mmdOrDot(t){let i=t.querySelector(".format-div");i&&i.remove();let e=t.createDiv({cls:"format-div"});this.plugin.settings.exportFormat==="mmd"?new p.Setting(e).setName("Mermaid layout").addDropdown(s=>s.addOption("TD","Top down").addOption("BT","Bottom to top").addOption("LR","Left to right").addOption("RL","Right to left").setValue(this.plugin.settings.direction||"TD").onChange(async n=>{this.plugin.settings.direction=n,await this.plugin.saveSettings()})):this.plugin.settings.exportFormat==="dot"&&(new p.Setting(e).setName("Weight threshold").setDesc("Only include important relationships with a minimum score").addSlider(s=>s.setLimits(1,10,1).setValue(this.plugin.settings.weightThreshold||10).setDynamicTooltip().onChange(async n=>{this.plugin.settings.weightThreshold=n,await this.plugin.saveSettings()})),new p.Setting(e).setName("Use subgraphs").addToggle(s=>s.setValue(this.plugin.settings.subgraphs||!1).onChange(async n=>{this.plugin.settings.subgraphs=n,await this.plugin.saveSettings()})))}export(){if(!this.filename){new p.Notice("Please enter a filename");return}this.plugin.exportGraph(this.filename),this.close()}onClose(){let{contentEl:t}=this;t.empty()}};var m=require("obsidian");function w(c){return c.replace(/[^a-zA-Z0-9]/g,"_")}function D(c){return c.replace(/"/g,'\\"')}var x=class{constructor(t,i){this.app=t,this.settings=i}buildGraph(){let t={nodes:[],relationships:[]};return this.harvestVault(t),this.settings.exportFormat==="dot"?this.runDotSettings(t):this.runMMDSettings(t),t}harvestVault(t){let i={cache:this.app.metadataCache,vault:this.app.vault,nodes:new Map,relationships:[],settings:this.settings,getN(){return Array.from(this.nodes.keys()).filter(e=>e.endsWith(".md")).length},getT(){return Array.from(this.nodes.values()).filter(e=>e.type==="tag").length},getK(){let e=new Map;return this.relationships.forEach(n=>{let a=this.nodes.get(n.target),o=this.nodes.get(n.source);(a==null?void 0:a.type)==="tag"&&(o==null?void 0:o.type)==="note"&&(e.has(n.source)||e.set(n.source,0),e.set(n.source,e.get(n.source)+1))}),Array.from(e.values()).reduce((n,a)=>n+a,0)/Math.max(1,e.size)},getOptimalN(e=150){let s=this.getT(),n=this.getK();return Math.floor(Math.sqrt(2*e*s/Math.max(1,n)))},isTearing(e=150){if(this.settings.viewMode==="singleGraph"||this.settings.enableAutoBridge===!1)return!1;let s=this.getN(),n=this.getT(),a=this.getK(),o=0,g=new Map;this.relationships.forEach(r=>{let l=this.nodes.get(r.target),f=this.nodes.get(r.source);(l==null?void 0:l.type)==="tag"&&(f==null?void 0:f.type)==="note"&&(g.has(r.target)||g.set(r.target,[]),g.get(r.target).push(r.source))}),g.forEach(r=>{r.length>1&&(o+=r.length*(r.length-1)/2)});let d=100,y=Math.min(e,75);return s>d||o>y||s+o>150||n>50}};switch(this.reapNotes(i),this.reapTags(i),this.reapLinks(i),this.reapFolders(i),this.settings.includeAttachments&&this.clusterAttachments(i),this.settings.relationshipStrategy){case"tags":this.tagNetwork(i);break;case"internalLinks":this.linkNetwork(i);break;case"folders":this.plantFolders(i);break;case"singleTag":this.singleTagNetwork(i);break;case"singleNote":this.singleNoteNetwork(i);break}t.nodes=Array.from(i.nodes.values()),t.relationships=i.relationships}reapNotes(t){let i=t.vault.getMarkdownFiles();for(let e of i)t.nodes.set(e.path,{id:(0,m.normalizePath)(e.path),name:e.basename,type:"note"})}reapTags(t){var s;let i=t.vault.getMarkdownFiles(),e=new Set;for(let n of i){let a=t.cache.getFileCache(n),o=[];if((s=a==null?void 0:a.frontmatter)!=null&&s.tags){let g=a.frontmatter.tags;Array.isArray(g)?o.push(...g):typeof g=="string"&&o.push(g)}o.forEach(g=>{e.add(g),t.nodes.has(g)||t.nodes.set(g,{id:g,name:g,type:"tag"}),t.relationships.push({source:n.path,target:g,weight:1})})}}reapLinks(t){let i=t.vault.getMarkdownFiles();for(let e of i){let s=t.cache.getFileCache(e);s!=null&&s.links&&s.links.forEach(n=>{let a=t.vault.getAbstractFileByPath(n.link+".md");a&&a instanceof m.TFile&&t.relationships.push({source:e.path,target:a.path,weight:1})})}}reapFolders(t){let i=t.vault.getAllLoadedFiles().filter(e=>e instanceof m.TFolder);for(let e of i)t.nodes.set(e.name,{id:e.name,name:e.name,type:"folder"}),e.children.forEach(s=>{s instanceof m.TFile&&s.extension==="md"&&t.relationships.push({source:s.path,target:e.name,weight:1})})}clusterAttachments(t){let i=t.vault.getFiles();for(let e of i)if(e.extension!==".md"){t.nodes.set(e.path,{id:(0,m.normalizePath)(e.path),name:e.basename,type:"attachment"});let s=t.vault.getMarkdownFiles();for(let n of s){let a=t.cache.getFileCache(n);a!=null&&a.embeds&&a.embeds.forEach(o=>{(o.link===e.path||o.link===e.basename)&&t.relationships.push({source:n.path,target:e.path,weight:1})})}}}tagNetwork(t){console.log("Before tagNetwork:",t.nodes.size,"nodes,",t.relationships.length,"relationships");let i=new Map,e=[];t.nodes.forEach((n,a)=>{(n.type==="note"||n.type==="tag")&&i.set(a,n)}),t.relationships.forEach(n=>{let a=t.nodes.get(n.target),o=t.nodes.get(n.source);(a==null?void 0:a.type)==="tag"&&(o==null?void 0:o.type)==="note"&&e.push(n)}),t.settings.exportFormat==="mmd"&&({...t,nodes:new Map(i),relationships:[...e]}.isTearing()?(console.log("Singularity detected - applying backoff strategy"),this.backoffSingularity(i,e,t)):console.log("Graph size within acceptable limits")),t.settings.includeOrphans||this.prune(i,e);let s=i.size+e.length;console.log("After tagNetwork:",i.size,"nodes,",e.length,"relationships",`(${s} total elements)`),s>200&&console.warn("Graph may still be too large for optimal Mermaid rendering"),t.nodes=i,t.relationships=e}linkNetwork(t){let i=new Map,e=[];t.nodes.forEach((s,n)=>{s.type==="note"&&i.set(n,s)}),t.relationships.forEach(s=>{let n=t.nodes.get(s.target),a=t.nodes.get(s.source);(n==null?void 0:n.type)==="note"&&(a==null?void 0:a.type)==="note"&&e.push(s)}),t.settings.includeOrphans||this.prune(i,e),t.nodes=i,t.relationships=e}plantFolders(t){let i=new Map,e=[];t.nodes.forEach((s,n)=>{(s.type==="note"||s.type==="folder")&&i.set(n,s)}),t.relationships.forEach(s=>{let n=t.nodes.get(s.target),a=t.nodes.get(s.source);(n==null?void 0:n.type)==="folder"&&(a==null?void 0:a.type)==="note"&&e.push(s)}),t.settings.includeOrphans||this.prune(i,e),t.nodes=i,t.relationships=e}singleTagNetwork(t){let i=this.settings.rootTag||"",e=new Map,s=[];if(i&&t.nodes.has(i))e.set(i,t.nodes.get(i));else{new m.Notice(`Tag "${i}" not found in your vault`);return}t.relationships.forEach(n=>{let a=t.nodes.get(n.target),o=t.nodes.get(n.source);(n.target===i&&(o==null?void 0:o.type)==="note"||n.source===i&&(a==null?void 0:a.type)==="note")&&(n.target===i&&o?e.set(n.source,o):n.source===i&&a&&e.set(n.target,a),s.push(n))}),t.nodes=e,t.relationships=s}singleNoteNetwork(t){var a;let i=this.settings.rootNote||"",e=new Map,s=[],n=(a=Array.from(t.nodes.entries()).find(([o,g])=>g.type==="note"&&g.name===i))==null?void 0:a[0];if(!n){new m.Notice(`Note "${i}" not found in your vault`);return}e.set(n,t.nodes.get(n)),t.relationships.forEach(o=>{if(o.source===n){let g=t.nodes.get(o.target);g&&(e.set(o.target,g),s.push(o))}else if(o.target===n){let g=t.nodes.get(o.source);g&&(e.set(o.source,g),s.push(o))}}),t.nodes=e,t.relationships=s}backoffSingularity(t,i,e){let s=e.settings.maxNodes||40,n=e.settings.maxRelationships||60,a=e.settings.maxTags||10;console.log("Starting backoff task");let o=new Map;i.forEach(r=>{let l=e.nodes.get(r.target);(l==null?void 0:l.type)==="tag"&&(o.has(r.target)||o.set(r.target,[]),o.get(r.target).push(r.source))});let g=Array.from(o.entries()).sort((r,l)=>l[1].length-r[1].length).slice(0,a).map(([r])=>r),d=new Map;g.forEach(r=>{var l;(l=o.get(r))==null||l.forEach(f=>{d.set(f,(d.get(f)||0)+1)})});let y=new Set(Array.from(d.entries()).sort((r,l)=>l[1]-r[1]).slice(0,s-g.length).map(([r])=>r));t.clear(),i.length=0,g.forEach(r=>{let l=e.nodes.get(r);l&&t.set(r,l)}),y.forEach(r=>{let l=e.nodes.get(r);l&&t.set(r,l)});let S=new Set;e.relationships.forEach(r=>{var l,f;if(t.has(r.source)&&t.has(r.target)&&S.size{let l=`${r.source}-${r.target}`;t.has(r.source)&&t.has(r.target)&&!S.has(l)&&S.size{e.add(n.source),e.add(n.target)});let s=new Map;t.forEach((n,a)=>{e.has(a)&&s.set(a,n)}),t.clear(),s.forEach((n,a)=>t.set(a,n))}runDotSettings(t){this.settings.includeWeights&&this.settings.weightThreshold&&(t.relationships=t.relationships.filter(i=>i.weight>=this.settings.weightThreshold)),this.settings.subgraphs&&this.clusterSubgraphs(t)}clusterSubgraphs(t){t.nodes.forEach(i=>{i.subgraph=i.type})}runMMDSettings(t){if(this.settings.maxEPerV){let i=[],e=new Map,s=[...t.relationships].sort((n,a)=>a.weight-n.weight);for(let n of s){let a=e.get(n.source)||0;a{let s=w(e.id);i+=` ${s}["${D(e.name)}"] +`}),t.relationships.forEach(e=>{let s=w(e.source),n=w(e.target);i+=` ${s} --> ${n} +`}),i}runDotPrinter(t){let e=`digraph ${this.app.vault.getName()} { +`;if(e+=` rankdir=LR; +`,e+=` node [shape=box, style=rounded]; +`,this.settings.subgraphs){let s=new Map;t.nodes.forEach(n=>{let a=n.subgraph||n.type;s.has(a)||s.set(a,[]),s.get(a).push(n)}),s.forEach((n,a)=>{e+=` subgraph cluster_${w(a)} { +`,e+=` label="${a}"; +`,e+=` style=rounded; +`,e+=` color="#cccccc"; +`,n.forEach(o=>{let g=w(o.id),d=o.type==="attachment"?'fillcolor="#ffcc80", style="filled,rounded"':'fillcolor="#e3f2fd", style="filled,rounded"';e+=` "${g}" [label="${D(o.name)}", ${d}]; +`}),e+=` } +`})}else t.nodes.forEach(s=>{let n=w(s.id),a=s.type==="attachment"?'fillcolor="#ffcc80", style="filled,rounded"':'fillcolor="#e3f2fd", style="filled,rounded"';e+=` "${n}" [label="${D(s.name)}", ${a}]; +`});return t.relationships.forEach(s=>{let n=w(s.source),a=w(s.target),o=this.settings.includeWeights&&s.weight>1?` [weight=${s.weight}]`:"";e+=` "${n}" -> "${a}"${o}; +`}),e+="}",e}};var u=require("obsidian"),b=class extends u.Plugin{async onload(){await this.loadSettings(),this.whisperer=new x(this.app,this.settings),this.addRibbonIcon("inspection-panel","Export graph view",()=>{new T(this.app,this).open()}),this.addCommand({id:"export-graph",name:"Export graph to file",callback:()=>{new T(this.app,this).open()}}),this.addSettingTab(new N(this.app,this))}async loadSettings(){this.settings=Object.assign({},M,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async exportGraph(t=""){try{let i=this.whisperer.buildGraph(),e;if(t)e=(0,u.normalizePath)(t);else{let n=this.app.vault.getName();e=(0,u.normalizePath)(`${n}-graph-data`)}this.settings.lastExported=e,await this.saveSettings();let s;return this.settings.exportFormat==="mmd"?s=await this.exportMermaid(i,e):s=await this.exportDot(i,e),new u.Notice(`Success! Exported to ${(0,u.normalizePath)(this.showWhereExported(s))}`,5e3),s}catch(i){return new u.Notice(`There's a problem: ${i.message}`),null}}async exportMermaid(t,i){let e=this.whisperer.runMMDPrinter(t),s=(0,u.normalizePath)(`${i}.mmd`);return await this.app.vault.create(s,e),s}async exportDot(t,i){let e=this.whisperer.runDotPrinter(t),s=(0,u.normalizePath)(`${i}.dot`);return await this.app.vault.create(s,e),s}showWhereExported(t=""){let i;if(t)i=(0,u.normalizePath)(t);else{let s=this.app.vault.getName();i=(0,u.normalizePath)(`${s}-graph-data`)}return`${this.app.vault.getName()}/${i}`}}; + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/export-graph-view/manifest.json b/.obsidian/plugins/export-graph-view/manifest.json new file mode 100644 index 0000000..296532f --- /dev/null +++ b/.obsidian/plugins/export-graph-view/manifest.json @@ -0,0 +1,11 @@ +{ + "id": "export-graph-view", + "name": "Export Graph View", + "version": "1.2.2", + "minAppVersion": "0.15.0", + "description": "Export your vault's graph view to mermaid and dot format.", + "author": "Sean McGhee", + "authorUrl": "https://www.seantiz.com", + "fundingUrl": "https://github.com/sponsors/seantiz", + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/export-graph-view/styles.css b/.obsidian/plugins/export-graph-view/styles.css new file mode 100644 index 0000000..9124f4a --- /dev/null +++ b/.obsidian/plugins/export-graph-view/styles.css @@ -0,0 +1,119 @@ +.quick-export-button, +.export-button { + font-size: 16px; + padding: 20px; +} + +.metadata-section { + text-align: center; + margin-top: 20px; + padding: 15px; + border: 1px solid #ccc; + border-radius: 5px; +} + +.metadata-section p { + margin: 5px 0; + font-size: 0.9em; +} + +.help-text { + font-size: 12px; + border-bottom: none; + margin-top: 20px; +} + +.root-notice { + font-size: 12px; +} + +.section-button-section { + text-align: right; + margin-top: 50px; +} + +.view-button-section { + display: flex; + justify-content: space-around; + margin-top: 20px; +} + +.egv-choice-container { + max-width: 800px; + margin: 0 auto; + padding: 20px; + } + + .egv-choice-header { + text-align: center; + margin-bottom: 10px; + } + + .egv-choice-description { + text-align: center; + margin-bottom: 30px; + color: var(--text-muted); + } + + .egv-cards-container { + display: flex; + gap: 30px; + justify-content: center; + flex-wrap: wrap; + } + + .egv-choice-card { + background-color: var(--background-secondary); + border-radius: 10px; + padding: 25px; + min-width: 250px; + flex: 1; + display: flex; + flex-direction: column; + transition: transform 0.2s, box-shadow 0.2s; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + cursor: pointer; + max-width: 350px; + } + + .egv-choice-card:hover { + transform: translateY(-5px); + box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15); + } + + .egv-choice-card h3 { + margin-top: 15px; + margin-bottom: 10px; + text-align: center; + } + + .egv-choice-card p { + flex-grow: 1; + color: var(--text-muted); + margin-bottom: 20px; + text-align: center; + } + + .egv-card-icon { + height: 60px; + margin: 0 auto 15px; + background-size: contain; + background-position: center; + background-repeat: no-repeat; + width: 60px; + } + + .single-parent-icon { + background-image: url('data:image/svg+xml;utf8,'); + } + + .full-graph-icon { + background-image: url('data:image/svg+xml;utf8,'); + } + + .egv-card-button-container { + text-align: center; + } + + .egv-card-button-container button { + width: 100%; diff --git a/.obsidian/plugins/mermaid-tools/data.json b/.obsidian/plugins/mermaid-tools/data.json new file mode 100644 index 0000000..54ec0e0 --- /dev/null +++ b/.obsidian/plugins/mermaid-tools/data.json @@ -0,0 +1,792 @@ +{ + "elements": [ + { + "id": "ce8a0064-979c-4d60-a26c-89a3b1802216", + "categoryId": "flowchart", + "description": "a simple flowchart with top to down direction", + "content": "flowchart TD\nStart --> Stop", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "81190b75-35a7-45af-a8d4-94e69ee69980", + "categoryId": "flowchart", + "description": "a simple flowchart with left to right direction", + "content": "flowchart LR\nStart --> Stop", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "e13cedc2-1b11-48d7-bba6-78e307e1cb57", + "categoryId": "flowchart", + "description": "A node with round edges", + "content": "id1(Some text)", + "sortingOrder": 3, + "isPinned": false + }, + { + "id": "8e7188cf-932f-452d-89e2-0c5adc0b1dcb", + "categoryId": "flowchart", + "description": "A stadium-shaped node", + "content": "id1([Some text])", + "sortingOrder": 4, + "isPinned": false + }, + { + "id": "74abe0f5-d7cd-4830-a37b-0489d7449328", + "categoryId": "flowchart", + "description": "A node in a cylindrical shape", + "content": "id1[(Database)]", + "sortingOrder": 5, + "isPinned": false + }, + { + "id": "5fd59c6c-0c37-46c4-a959-bff6446af538", + "categoryId": "flowchart", + "description": "Circle", + "content": "id1((Some text))", + "sortingOrder": 6, + "isPinned": false + }, + { + "id": "e58fe5be-675f-44b0-a337-830d36d2684c", + "categoryId": "flowchart", + "description": "Rhombus", + "content": "id1{Some text}", + "sortingOrder": 7, + "isPinned": false + }, + { + "id": "417a32f2-b1af-4b94-a370-0d69e96f35b4", + "categoryId": "flowchart", + "description": "Hexagon", + "content": "id1{{Some text}}", + "sortingOrder": 8, + "isPinned": false + }, + { + "id": "17487f2b-d361-49ff-bb9f-b51b32ce9d92", + "categoryId": "flowchart", + "description": "Parallelogram skewed right", + "content": "id1[/Some text/]", + "sortingOrder": 9, + "isPinned": false + }, + { + "id": "0c09e005-999c-4f69-8c22-33c22e82d9d8", + "categoryId": "flowchart", + "description": "Parallelogram skewed left", + "content": "id1[\\Some text\\]", + "sortingOrder": 10, + "isPinned": false + }, + { + "id": "6122256d-84a4-495c-8f9f-1d6836068691", + "categoryId": "flowchart", + "description": "Trapezoid", + "content": "A[/Some text\\]", + "sortingOrder": 11, + "isPinned": false + }, + { + "id": "6d31176d-fac1-49c5-8058-4e4dc2c6e5dd", + "categoryId": "flowchart", + "description": "Trapezoid upside down", + "content": "A[\\Some text/]", + "sortingOrder": 12, + "isPinned": false + }, + { + "id": "410f9e4d-4629-45f7-949f-f798a9a0b6b9", + "categoryId": "flowchart", + "description": "Double circle node", + "content": "id1(((Some text)))", + "sortingOrder": 13, + "isPinned": false + }, + { + "id": "e144a699-ba5e-43ea-8729-0d7f1b9e34d2", + "categoryId": "flowchart", + "description": "A link with arrow head", + "content": "A-->B", + "sortingOrder": 14, + "isPinned": false + }, + { + "id": "6340f678-124b-4a42-9f47-6015412d1b98", + "categoryId": "flowchart", + "description": "An open link", + "content": "A --- B", + "sortingOrder": 15, + "isPinned": false + }, + { + "id": "0586c4d4-4dc1-4ce1-867d-57e43a932f0b", + "categoryId": "flowchart", + "description": "Text on links", + "content": "A-- This is the text! ---B", + "sortingOrder": 16, + "isPinned": false + }, + { + "id": "eb1e584b-5aaf-46f5-bfc9-44b3c406dc2d", + "categoryId": "flowchart", + "description": "A link with arrow head and text", + "content": "A-->|text|B", + "sortingOrder": 17, + "isPinned": false + }, + { + "id": "ca8afaf7-7505-4f22-b95b-9a5cff53cad6", + "categoryId": "flowchart", + "description": "Dotted link", + "content": "A-.->B", + "sortingOrder": 18, + "isPinned": false + }, + { + "id": "4dffe292-4204-4da3-911d-1025a05ad46c", + "categoryId": "flowchart", + "description": "Thick link", + "content": "A ==> B", + "sortingOrder": 19, + "isPinned": false + }, + { + "id": "5ad57178-87bb-488b-b138-b3084d5364c5", + "categoryId": "flowchart", + "description": "Invisible link", + "content": "A ~~~ B", + "sortingOrder": 20, + "isPinned": false + }, + { + "id": "b9e7daaa-5915-4a1c-a481-96ac137d16f9", + "categoryId": "flowchart", + "description": "Link with circle edge", + "content": "A --o B", + "sortingOrder": 21, + "isPinned": false + }, + { + "id": "a053922d-c961-4e28-b1d2-6321b249c0ae", + "categoryId": "flowchart", + "description": "Link with cross edge", + "content": "A --x B", + "sortingOrder": 22, + "isPinned": false + }, + { + "id": "187bf51e-e384-4a39-803c-78bb18b78c8b", + "categoryId": "flowchart", + "description": "Subgraph", + "content": "subgraph one\na1-->a2\nend", + "sortingOrder": 14, + "isPinned": false + }, + { + "id": "9857856d-2fd4-4e0d-b058-76855215da37", + "categoryId": "sequenceDiagram", + "description": "a simple sequence diagram", + "content": "sequenceDiagram\nAlice->>John: Hello John, how are you?\nJohn-->>Alice: Great!\nAlice-)John: See you later!", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "47c587ff-c1e1-41f3-9e29-3bc54cce4cb1", + "categoryId": "sequenceDiagram", + "description": "a simple sequence diagram with actors", + "content": "sequenceDiagram\nactor Alice\nactor John\nAlice->>John: Hello John, how are you?\nJohn-->>Alice: Great!\nAlice-)John: See you later!", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "2ae592c0-806e-4640-945f-2dbc576ccdf1", + "categoryId": "classDiagram", + "description": "sample class", + "content": "class Duck{\n +String beakColor\n +swim()\n +quack()\n }", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "467423fe-2d69-49f4-83ca-9314227a2cc6", + "categoryId": "classDiagram", + "description": "sample class", + "content": "class BankAccount\n BankAccount : +String owner\n BankAccount : +Bigdecimal balance\n BankAccount : +deposit(amount)\n BankAccount : +withdrawal(amount)", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "c8275c79-b289-4d75-9ae5-65c3267e94d5", + "categoryId": "classDiagram", + "description": "generic class", + "content": "class Square~Shape~{\n int id\n List~int~ position\n setPoints(List~int~ points)\n getPoints() List~int~\n }\n \n Square : -List~string~ messages\n Square : +setMessages(List~string~ messages)\n Square : +getMessages() List~string~", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "8b09aee4-6260-4ec6-970c-c67168d4ac76", + "categoryId": "classDiagram", + "description": "inheritance", + "content": "classA <|-- classB", + "sortingOrder": 3, + "isPinned": false + }, + { + "id": "4ec30fef-b3cc-4bcc-8f4a-fda668776a36", + "categoryId": "classDiagram", + "description": "composition", + "content": "classC *-- classD", + "sortingOrder": 4, + "isPinned": false + }, + { + "id": "ea60828f-8ab8-4c4e-88a3-bbaf77a10472", + "categoryId": "classDiagram", + "description": "aggregation", + "content": "classE o-- classF", + "sortingOrder": 5, + "isPinned": false + }, + { + "id": "99c0ed8a-8d15-4c1e-b315-4bbb3cabfd64", + "categoryId": "classDiagram", + "description": "association", + "content": "classG <-- classH", + "sortingOrder": 6, + "isPinned": false + }, + { + "id": "9bc99a1a-c6f0-4a43-98aa-d18be64bdde7", + "categoryId": "classDiagram", + "description": "solid link", + "content": "classI -- classJ", + "sortingOrder": 7, + "isPinned": false + }, + { + "id": "71380dcd-4c29-4907-86d9-36bb822df062", + "categoryId": "classDiagram", + "description": "dependency", + "content": "classK <.. classL", + "sortingOrder": 8, + "isPinned": false + }, + { + "id": "6855b6ca-61ee-46d1-b937-085c56f96c2d", + "categoryId": "classDiagram", + "description": "realization", + "content": "classM <|.. classN", + "sortingOrder": 9, + "isPinned": false + }, + { + "id": "702caa95-72a3-449f-9da2-a406f9996be0", + "categoryId": "classDiagram", + "description": "dashed link", + "content": "classO .. classP", + "sortingOrder": 10, + "isPinned": false + }, + { + "id": "fa3c801c-d9ec-4506-a501-28472e7b8c78", + "categoryId": "classDiagram", + "description": "two-way relation", + "content": "Animal <|--|> Zebra", + "sortingOrder": 11, + "isPinned": false + }, + { + "id": "f590de96-2011-4df5-bef1-a068832bff8a", + "categoryId": "classDiagram", + "description": "sample class diagram", + "content": "classDiagram\n Animal <|-- Duck\n Animal <|-- Fish\n Animal <|-- Zebra\n Animal : +int age\n Animal : +String gender\n Animal: +isMammal()\n Animal: +mate()\n class Duck{\n +String beakColor\n +swim()\n +quack()\n }\n class Fish{\n -int sizeInFeet\n -canEat()\n }\n class Zebra{\n +bool is_wild\n +run()\n }", + "sortingOrder": 12, + "isPinned": false + }, + { + "id": "b16b29d7-3ecb-45fa-9327-eac5239bd953", + "categoryId": "stateDiagram", + "description": "a sample state diagram", + "content": "stateDiagram-v2\n [*] --> Still\n Still --> [*]\n \n Still --> Moving\n Moving --> Still\n Moving --> Crash\n Crash --> [*]", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "ef56afbc-aa32-4708-a191-3481d673e08a", + "categoryId": "stateDiagram", + "description": "a sample state diagram with left-to-right direction", + "content": "stateDiagram-v2\n direction LR\n [*] --> Still\n Still --> [*]\n \n Still --> Moving\n Moving --> Still\n Moving --> Crash\n Crash --> [*]", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "b04c48f5-2bb4-4fc2-be33-03f6597e2499", + "categoryId": "stateDiagram", + "description": "node with description", + "content": "s2 : This is a state description", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "3dedb769-542f-40dd-99c3-98dd0ed974e6", + "categoryId": "stateDiagram", + "description": "a transition", + "content": "s1 --> s2", + "sortingOrder": 3, + "isPinned": false + }, + { + "id": "530b0984-485f-4bad-9d6e-80f5398fc01b", + "categoryId": "stateDiagram", + "description": "a transition with label", + "content": "s1 --> s2: A transition", + "sortingOrder": 4, + "isPinned": false + }, + { + "id": "bcec3d91-0232-4e6a-82ed-6581356d6183", + "categoryId": "stateDiagram", + "description": "composite state", + "content": "\n [*] --> First\n state First {\n [*] --> second\n second --> [*]\n }", + "sortingOrder": 5, + "isPinned": false + }, + { + "id": "1dcba01a-ac61-4171-8fc9-a616eaed11f2", + "categoryId": "stateDiagram", + "description": "diagram with choice", + "content": "stateDiagram-v2\n state if_state <>\n [*] --> IsPositive\n IsPositive --> if_state\n if_state --> False: if n < 0\n if_state --> True : if n >= 0", + "sortingOrder": 6, + "isPinned": false + }, + { + "id": "57ad4f8a-33cd-43b5-8910-910edf8e7dec", + "categoryId": "stateDiagram", + "description": "diagram with fork", + "content": "stateDiagram-v2\n state fork_state <>\n [*] --> fork_state\n fork_state --> State2\n fork_state --> State3\n \n state join_state <>\n State2 --> join_state\n State3 --> join_state\n join_state --> State4\n State4 --> [*]", + "sortingOrder": 7, + "isPinned": false + }, + { + "id": "4e9935b8-d200-4b71-a054-e959765e7825", + "categoryId": "stateDiagram", + "description": "a diagram with concurrency", + "content": "stateDiagram-v2\n [*] --> Active\n \n state Active {\n [*] --> NumLockOff\n NumLockOff --> NumLockOn : EvNumLockPressed\n NumLockOn --> NumLockOff : EvNumLockPressed\n --\n [*] --> CapsLockOff\n CapsLockOff --> CapsLockOn : EvCapsLockPressed\n CapsLockOn --> CapsLockOff : EvCapsLockPressed\n --\n [*] --> ScrollLockOff\n ScrollLockOff --> ScrollLockOn : EvScrollLockPressed\n ScrollLockOn --> ScrollLockOff : EvScrollLockPressed\n }", + "sortingOrder": 8, + "isPinned": false + }, + { + "id": "26791328-43e6-430f-ad2e-76821214a95d", + "categoryId": "entityRelationshipDiagram", + "description": "a sample entity relationship diagram", + "content": "erDiagram\n CUSTOMER ||--o{ ORDER : places\n ORDER ||--|{ LINE-ITEM : contains\n CUSTOMER }|..|{ DELIVERY-ADDRESS : uses", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "cb07fc4d-ae9b-4da3-a938-3a1b0ab0c2ac", + "categoryId": "entityRelationshipDiagram", + "description": "an entity", + "content": " CUSTOMER {\n string name\n string custNumber\n string sector\n }", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "dcae6673-6476-4466-a97a-8a0732574801", + "categoryId": "entityRelationshipDiagram", + "description": "one-to-many relationship", + "content": "A ||--|{ B : label", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "c2ad1cfb-ea4e-4d69-8bf4-b85ecc5b9134", + "categoryId": "entityRelationshipDiagram", + "description": "many-to-many relationship", + "content": "A }|--|{ B : label", + "sortingOrder": 3, + "isPinned": false + }, + { + "id": "118f56be-db56-49a7-80ab-3326f7336f3d", + "categoryId": "entityRelationshipDiagram", + "description": "one-to-one relationship", + "content": "A ||--|| B : label", + "sortingOrder": 4, + "isPinned": false + }, + { + "id": "bec578a5-0e42-4d24-a0dd-12b4fc25daa5", + "categoryId": "entityRelationshipDiagram", + "description": "many-to-one relationship", + "content": "A }|--|| B : label", + "sortingOrder": 5, + "isPinned": false + }, + { + "id": "32d99372-8321-44dd-80c3-1a080644fa5c", + "categoryId": "entityRelationshipDiagram", + "description": "zero/one-to-one relationship", + "content": "A |o--|| B : label", + "sortingOrder": 6, + "isPinned": false + }, + { + "id": "2113de04-a4ee-4436-a3ab-435650b23414", + "categoryId": "entityRelationshipDiagram", + "description": "one-to-one/zero relationship", + "content": "A ||--o| B : label", + "sortingOrder": 7, + "isPinned": false + }, + { + "id": "30293f49-1289-4976-88d9-34d75c0a6852", + "categoryId": "entityRelationshipDiagram", + "description": "zero-or-more-to-one relationship", + "content": "A }o--|| B : label", + "sortingOrder": 8, + "isPinned": false + }, + { + "id": "dc49bc4c-2ea6-495d-9d38-28c33e078f77", + "categoryId": "entityRelationshipDiagram", + "description": "one-to-zero-or-more relationship", + "content": "A ||--o{ B : label", + "sortingOrder": 9, + "isPinned": false + }, + { + "id": "5c53fcab-e772-4dcd-ab06-fc941fa168fa", + "categoryId": "entityRelationshipDiagram", + "description": "zero-or-more-to-many relationship", + "content": "A }o--|{ B : label", + "sortingOrder": 10, + "isPinned": false + }, + { + "id": "89b04b4e-1e06-4b5c-ae55-fa28f6e08b0b", + "categoryId": "entityRelationshipDiagram", + "description": "many-to-zero-or-more relationship", + "content": "A }|--o{ B : label", + "sortingOrder": 11, + "isPinned": false + }, + { + "id": "98ae0edc-7b11-4fcb-b049-94684070b79e", + "categoryId": "userJourneyDiagram", + "description": "a sample user journey diagram", + "content": "journey\n title My working day\n section Go to work\n Make tea: 5: Me\n Go upstairs: 3: Me\n Do work: 1: Me, Cat\n section Go home\n Go downstairs: 5: Me\n Sit down: 5: Me", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "452612b5-f9c4-4406-b150-6d1ffdf52bb4", + "categoryId": "userJourneyDiagram", + "description": "a step in user journey", + "content": " Step Title: 5: ActorName", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "d1b92887-20a1-4430-b26d-4d41aad84da6", + "categoryId": "ganttChart", + "description": "simple gantt chart", + "content": "gantt\n title A Gantt Diagram\n dateFormat YYYY-MM-DD\n section Section\n A task :a1, 2014-01-01, 30d\n Another task :after a1 , 20d\n section Another\n Task in sec :2014-01-12 , 12d\n another task : 24d", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "00ddbe10-684f-4d8c-9e4c-7e933c6f3392", + "categoryId": "ganttChart", + "description": "rich gantt chart", + "content": "gantt\n dateFormat YYYY-MM-DD\n title Adding GANTT diagram functionality to mermaid\n excludes weekends\n \n section A section\n Completed task :done, des1, 2014-01-06,2014-01-08\n Active task :active, des2, 2014-01-09, 3d\n Future task : des3, after des2, 5d\n Future task2 : des4, after des3, 5d\n \n section Critical tasks\n Completed task in the critical line :crit, done, 2014-01-06,24h\n Implement parser and jison :crit, done, after des1, 2d\n Create tests for parser :crit, active, 3d\n Future task in critical line :crit, 5d\n Create tests for renderer :2d\n Add to mermaid :1d\n Functionality added :milestone, 2014-01-25, 0d\n \n section Documentation\n Describe gantt syntax :active, a1, after des1, 3d\n Add gantt diagram to demo page :after a1 , 20h\n Add another diagram to demo page :doc1, after a1 , 48h\n \n section Last section\n Describe gantt syntax :after doc1, 3d\n Add gantt diagram to demo page :20h\n Add another diagram to demo page :48h", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "ede911d1-d519-494a-845a-33a2347a4b41", + "categoryId": "ganttChart", + "description": "milestones example", + "content": "gantt\n dateFormat HH:mm\n axisFormat %H:%M\n Initial milestone : milestone, m1, 17:49,2min\n taska2 : 10min\n taska3 : 5min\n Final milestone : milestone, m2, 18:14, 2min", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "9c641239-521b-4e7d-8680-41400e20eb49", + "categoryId": "pieChart", + "description": "sample pie chart", + "content": "pie title /r/obsidianmd posts by type\n \"Graphs\" : 85\n \"Dashboards\" : 14\n \"Tips\" : 1", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "90fbf382-435d-495b-8c14-a1b758602fec", + "categoryId": "pieChart", + "description": "sample pie chart with values shown in legend", + "content": "pie showData title /r/obsidianmd posts by type\n \"Graphs\" : 85\n \"Dashboards\" : 14\n \"Tips\" : 1", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "4b42a05a-b81e-47ab-a23b-3d6beee6a68f", + "categoryId": "requirementDiagram", + "description": "sample requirements diagram", + "content": " requirementDiagram\n\n requirement test_req {\n id: 1\n text: the test text.\n risk: high\n verifymethod: test\n }\n \n element test_entity {\n type: simulation\n }\n \n test_entity - satisfies -> test_req", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "e0407d51-0c91-45bb-b7d1-6eb669382bd8", + "categoryId": "requirementDiagram", + "description": "sample requirements diagram", + "content": "element customElement {\n type: customType\n docref: customDocRef\n }", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "6f808e9d-4bcc-423e-8372-2283940e285d", + "categoryId": "requirementDiagram", + "description": "a requirement with high risk", + "content": "functionalRequirement myReq {\n id: reqId\n text: someText\n risk: High\n verifymethod: analysis\n }", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "09458e5f-b3af-4f5e-a43f-c96d585bcaee", + "categoryId": "requirementDiagram", + "description": "sample requirements diagram", + "content": "interfaceRequirement myReq2 {\n id: reqId\n text: someText\n risk: Medium\n verifymethod: demonstration\n }", + "sortingOrder": 3, + "isPinned": false + }, + { + "id": "5581967d-eb25-4cd5-b161-eb9345585012", + "categoryId": "requirementDiagram", + "description": "sample requirements diagram", + "content": "designConstraint myReq3 {\n id: reqId\n text: someText\n risk: Low\n verifymethod: test\n }", + "sortingOrder": 4, + "isPinned": false + }, + { + "id": "4df85f3a-0a21-46ef-94b2-1f7ac20659ba", + "categoryId": "gitGraph", + "description": "simple git graph", + "content": "gitGraph\n commit\n commit\n branch develop\n checkout develop\n commit\n commit\n checkout main\n merge develop\n commit\n commit", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "241c6930-88da-438a-85c9-dc1ca8f4b3e1", + "categoryId": "gitGraph", + "description": "tagged commit", + "content": "commit id: \"Normal\" tag: \"v1.0.0\"", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "6d1bb248-32bd-4c7f-af21-a276e52d5bf6", + "categoryId": "gitGraph", + "description": "reverse commit", + "content": "commit id: \"Reverse\" type: REVERSE", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "65a0b460-cf18-4c7b-a39a-cc8c4ad11578", + "categoryId": "gitGraph", + "description": "highlighted commit", + "content": "commit id: \"Highlight\" type: HIGHLIGHT", + "sortingOrder": 3, + "isPinned": false + }, + { + "id": "7cd136f5-4519-49d3-90d8-f845c59f606f", + "categoryId": "gitGraph", + "description": "reverse commit", + "content": "commit id: \"Reverse\" type: REVERSE", + "sortingOrder": 4, + "isPinned": false + }, + { + "id": "69d9ed7f-aebd-4dda-a920-05f486dfddba", + "categoryId": "gitGraph", + "description": "git graph with cherry-pick", + "content": "gitGraph\n commit id: \"ZERO\"\n branch develop\n commit id:\"A\"\n checkout main\n commit id:\"ONE\"\n checkout develop\n commit id:\"B\"\n checkout main\n commit id:\"TWO\"\n cherry-pick id:\"A\"\n commit id:\"THREE\"\n checkout develop\n commit id:\"C\"", + "sortingOrder": 5, + "isPinned": false + }, + { + "id": "ddc3aff8-b403-4ef7-a8ca-b3dbe8a75272", + "categoryId": "mindmap", + "description": "a simple mindmap", + "content": "mindmap\n Root\n A\n B\n C", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "fc3097e2-fc2c-463e-ac54-e6a91c8573e9", + "categoryId": "mindmap", + "description": "square", + "content": "id[I am a square]", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "76e932cc-e140-41f5-96e4-eef5225569ad", + "categoryId": "mindmap", + "description": "rounded square", + "content": "id(I am a rounded square)", + "sortingOrder": 3, + "isPinned": false + }, + { + "id": "2943cf70-a543-4847-99da-5428de6cb5df", + "categoryId": "mindmap", + "description": "circle", + "content": "id((I am a circle))", + "sortingOrder": 4, + "isPinned": false + }, + { + "id": "b8cc4c57-a8b1-462e-8558-ddd780339d98", + "categoryId": "mindmap", + "description": "bang", + "content": "id))I am a bang((", + "sortingOrder": 5, + "isPinned": false + }, + { + "id": "9ab2c4b7-e2c3-42cd-a846-3fcc36cb0868", + "categoryId": "mindmap", + "description": "cloud", + "content": "id)I am a cloud(", + "sortingOrder": 6, + "isPinned": false + }, + { + "id": "be1122b5-fdd0-4958-b305-7f08b2fd3e76", + "categoryId": "mindmap", + "description": "hexagon", + "content": "id{{I am a hexagon}}", + "sortingOrder": 7, + "isPinned": false + }, + { + "id": "2cf43034-8777-405c-935d-81a27aba2f64", + "categoryId": "mindmap", + "description": "default", + "content": "I am the default shape", + "sortingOrder": 8, + "isPinned": false + }, + { + "id": "b3e18945-295e-4a29-a954-fd3e1c80caff", + "categoryId": "mindmap", + "description": "sample mindmap", + "content": "mindmap\n root((mindmap))\n Origins\n Long history\n Popularisation\n British popular psychology author Tony Buzan\n Research\n On effectiveness
and features\n On Automatic creation\n Uses\n Creative techniques\n Strategic planning\n Argument mapping\n Tools\n Pen and paper\n Mermaid", + "sortingOrder": 9, + "isPinned": false + }, + { + "id": "6af01e26-c328-448f-9c0e-7293ccf65ad0", + "categoryId": "timeline", + "description": "sample timeline", + "content": "timeline\n\t\ttitle History of Social Media Platform\n\t\t2002 : LinkedIn\n\t\t2004 : Facebook\n\t\t\t : Google\n\t\t2005 : Youtube\n\t\t2006 : Twitter", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "58536caa-6860-457b-8fd8-96f132530355", + "categoryId": "timeline", + "description": "timeline with grouping", + "content": "timeline\n\t\ttitle Timeline of Industrial Revolution\n\t\tsection 17th-20th century\n\t\t\tIndustry 1.0 : Machinery, Water power, Steam
power\n\t\t\tIndustry 2.0 : Electricity, Internal combustion engine, Mass production\n\t\t\tIndustry 3.0 : Electronics, Computers, Automation\n\t\tsection 21st century\n\t\t\tIndustry 4.0 : Internet, Robotics, Internet of Things\n\t\t\tIndustry 5.0 : Artificial intelligence, Big data,3D printing", + "sortingOrder": 2, + "isPinned": false + }, + { + "id": "6c7b156f-319b-46c1-a0f7-e62be3571fc9", + "categoryId": "timeline", + "description": "timeline with Forest theme. see the docs for additional themes", + "content": "%%{init: { 'logLevel': 'debug', 'theme': 'forest' } }%%\n\t\ttimeline\n\t\t\ttitle History of Social Media Platform\n\t\t\t 2002 : LinkedIn\n\t\t\t 2004 : Facebook : Google\n\t\t\t 2005 : Youtube\n\t\t\t 2006 : Twitter\n\t\t\t 2007 : Tumblr\n\t\t\t 2008 : Instagram\n\t\t\t 2010 : Pinterest", + "sortingOrder": 3, + "isPinned": false + }, + { + "id": "db1924f2-1c69-4e15-a665-74a062d12cd4", + "categoryId": "quadrantChart", + "description": "sample quadrant chart", + "content": "quadrantChart\n\t\ttitle Reach and engagement of campaigns\n\t\tx-axis Low Reach --> High Reach\n\t\ty-axis Low Engagement --> High Engagement\n\t\tquadrant-1 We should expand\n\t\tquadrant-2 Need to promote\n\t\tquadrant-3 Re-evaluate\n\t\tquadrant-4 May be improved\n\t\tCampaign A: [0.3, 0.6]\n\t\tCampaign B: [0.45, 0.23]\n\t\tCampaign C: [0.57, 0.69]\n\t\tCampaign D: [0.78, 0.34]\n\t\tCampaign E: [0.40, 0.34]\n\t\tCampaign F: [0.35, 0.78]", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "f8259530-5179-4548-a42c-e672a7c28ac0", + "categoryId": "quadrantChart", + "description": "themed quadrant chart", + "content": "%%{init: {\"quadrantChart\": {\"chartWidth\": 400, \"chartHeight\": 400}, \"themeVariables\": {\"quadrant1TextFill\": \"#ff0000\"} }}%%\n\t\tquadrantChart\n\t\t x-axis Urgent --> Not Urgent\n\t\t y-axis Not Important --> \"Important ❤\"\n\t\t quadrant-1 Plan\n\t\t quadrant-2 Do\n\t\t quadrant-3 Delegate\n\t\t quadrant-4 Delete", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "8a28b8a2-f058-414b-b82a-900153d11a2f", + "categoryId": "c4Diagram", + "description": "sample C4 diagram (compatible with PlantUML)", + "content": "C4Context\n\t\ttitle System Context diagram for Internet Banking System\n\t\tEnterprise_Boundary(b0, \"BankBoundary0\") {\n\t\t Person(customerA, \"Banking Customer A\", \"A customer of the bank, with personal bank accounts.\")\n\t\t Person(customerB, \"Banking Customer B\")\n\t\t Person_Ext(customerC, \"Banking Customer C\", \"desc\")\n \n\t\t Person(customerD, \"Banking Customer D\", \"A customer of the bank,
with personal bank accounts.\")\n \n\t\t System(SystemAA, \"Internet Banking System\", \"Allows customers to view information about their bank accounts, and make payments.\")\n \n\t\t Enterprise_Boundary(b1, \"BankBoundary\") {\n \n\t\t\tSystemDb_Ext(SystemE, \"Mainframe Banking System\", \"Stores all of the core banking information about customers, accounts, transactions, etc.\")\n \n\t\t\tSystem_Boundary(b2, \"BankBoundary2\") {\n\t\t\t System(SystemA, \"Banking System A\")\n\t\t\t System(SystemB, \"Banking System B\", \"A system of the bank, with personal bank accounts. next line.\")\n\t\t\t}\n \n\t\t\tSystem_Ext(SystemC, \"E-mail system\", \"The internal Microsoft Exchange e-mail system.\")\n\t\t\tSystemDb(SystemD, \"Banking System D Database\", \"A system of the bank, with personal bank accounts.\")\n \n\t\t\tBoundary(b3, \"BankBoundary3\", \"boundary\") {\n\t\t\t SystemQueue(SystemF, \"Banking System F Queue\", \"A system of the bank.\")\n\t\t\t SystemQueue_Ext(SystemG, \"Banking System G Queue\", \"A system of the bank, with personal bank accounts.\")\n\t\t\t}\n\t\t }\n\t\t}\n \n\t\tBiRel(customerA, SystemAA, \"Uses\")\n\t\tBiRel(SystemAA, SystemE, \"Uses\")\n\t\tRel(SystemAA, SystemC, \"Sends e-mails\", \"SMTP\")\n\t\tRel(SystemC, customerA, \"Sends e-mails to\")\n \n\t\tUpdateElementStyle(customerA, $fontColor=\"red\", $bgColor=\"grey\", $borderColor=\"red\")\n\t\tUpdateRelStyle(customerA, SystemAA, $textColor=\"blue\", $lineColor=\"blue\", $offsetX=\"5\")\n\t\tUpdateRelStyle(SystemAA, SystemE, $textColor=\"blue\", $lineColor=\"blue\", $offsetY=\"-10\")\n\t\tUpdateRelStyle(SystemAA, SystemC, $textColor=\"blue\", $lineColor=\"blue\", $offsetY=\"-40\", $offsetX=\"-50\")\n\t\tUpdateRelStyle(SystemC, customerA, $textColor=\"red\", $lineColor=\"red\", $offsetX=\"-50\", $offsetY=\"20\")\n \n\t\tUpdateLayoutConfig($c4ShapeInRow=\"3\", $c4BoundaryInRow=\"1\")", + "sortingOrder": 1, + "isPinned": false + }, + { + "id": "d476fcb2-171b-407b-a14c-fc229928f3c5", + "categoryId": "sankeyDiagram", + "description": "", + "content": "sankey-beta\n %% source,target,value\n Electricity grid,Over generation / exports,104.453\n Electricity grid,Heating and cooling - homes,113.726\n Electricity grid,H2 conversion,27.14", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "fd51101c-845f-41cc-98ea-cf3d9064f4fe", + "categoryId": "xyChart", + "description": "a sample XYChart diagram", + "content": "xychart-beta\n title \"Sales Revenue\"\n x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]\n y-axis \"Revenue (in $)\" 4000 --> 11000\n bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]\n line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "4d105a15-f99c-47da-909b-9cf95a3b0d0f", + "categoryId": "packet", + "description": "a sample packet diagram", + "content": "packet-beta\ntitle UDP Packet\n0-15: \"Source Port\"\n16-31: \"Destination Port\"\n32-47: \"Length\"\n48-63: \"Checksum\"\n64-95: \"Data (variable length)\"\n", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "016f803e-9b70-40a9-9ba5-aed11358011f", + "categoryId": "kanban", + "description": "a sample kanban diagram", + "content": "kanban\n Todo\n [Create Documentation]\n docs[Create Blog about the new diagram]\n [In progress]\n id6[Create renderer so that it works in all cases. We also add som extra text here for testing purposes. And some more just for the extra flare.]\n id9[Ready for deploy]\n id8[Design grammar]@{ assigned: 'knsv' }\n id10[Ready for test]\n id4[Create parsing tests]@{ ticket: MC-2038, assigned: 'K.Sveidqvist', priority: 'High' }\n id66[last item]@{ priority: 'Very Low', assigned: 'knsv' }\n id11[Done]\n id5[define getData]\n id2[Title of diagram is more than 100 chars when user duplicates diagram with 100 char]@{ ticket: MC-2036, priority: 'Very High'}\n id3[Update DB function]@{ ticket: MC-2037, assigned: knsv, priority: 'High' }\n\n id12[Can't reproduce]\n id3[Weird flickering in Firefox]", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "64c83d61-8d0f-49a1-a719-a333e59d3063", + "categoryId": "block", + "description": "a sample block diagram", + "content": "block-beta\ncolumns 1\n db((\"DB\"))\n blockArrowId6<[\"   \"]>(down)\n block:ID\n A\n B[\"A wide one in the middle\"]\n C\n end\n space\n D\n ID --> D\n C --> D\n style B fill:#969,stroke:#333,stroke-width:4px\n", + "sortingOrder": 0, + "isPinned": false + }, + { + "id": "9ae060df-8b48-4c98-a735-3dbe736b2fcc", + "categoryId": "architecture", + "description": "a sample architecture diagram", + "content": "architecture-beta\n group api(cloud)[API]\n\n service db(database)[Database] in api\n service disk1(disk)[Storage] in api\n service disk2(disk)[Storage] in api\n service server(server)[Server] in api\n\n db:L -- R:server\n disk1:T -- B:server\n disk2:T -- B:db\n", + "sortingOrder": 0, + "isPinned": false + } + ], + "customCategories": [], + "selectedCategoryId": "block", + "defaultCategorySortOrders": {}, + "categoryModifications": {} +} \ No newline at end of file diff --git a/.obsidian/plugins/mermaid-tools/main.js b/.obsidian/plugins/mermaid-tools/main.js new file mode 100644 index 0000000..829d903 --- /dev/null +++ b/.obsidian/plugins/mermaid-tools/main.js @@ -0,0 +1,2633 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// main.ts +var main_exports = {}; +__export(main_exports, { + TRIDENT_ICON_NAME: () => TRIDENT_ICON_NAME, + default: () => MermaidPlugin +}); +module.exports = __toCommonJS(main_exports); +var import_obsidian7 = require("obsidian"); + +// src/elements/sampleDiagrams.ts +var sampleDiagrams = { + EntityRelationshipDiagram: `erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + CUSTOMER }|..|{ DELIVERY-ADDRESS : uses`, + ClassDiagram: `class BankAccount + BankAccount : +String owner + BankAccount : +Bigdecimal balance + BankAccount : +deposit(amount) + BankAccount : +withdrawal(amount)`, + Flowchart: "flowchart LR\nStart --> Stop", + GanttChart: `gantt + title A Gantt Diagram + dateFormat YYYY-MM-DD + section Section + A task :a1, 2014-01-01, 30d + Another task :after a1 , 20d + section Another + Task in sec :2014-01-12 , 12d + another task : 24d`, + GitGraph: `gitGraph + commit + commit + branch develop + checkout develop + commit + commit + checkout main + merge develop + commit + commit`, + PieChart: `pie title /r/obsidianmd posts by type + "Look at my awesome graph" : 85 + "Look at my cool dashboard" : 14 + "Moved from Notion, liking it" : 1`, + RequirementDiagram: ` requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req`, + SequenceDiagram: `sequenceDiagram +Alice->>John: Hello John, how are you? +John-->>Alice: Great! +Alice-)John: See you later!`, + StateDiagram: `stateDiagram-v2 + [*] --> Still + Still --> [*] + + Still --> Moving + Moving --> Still + Moving --> Crash + Crash --> [*]`, + UserJourneyDiagram: `journey + title My working day + section Go to work + Make tea: 5: Me + Go upstairs: 3: Me + Do work: 1: Me, Cat + section Go home + Go downstairs: 5: Me + Sit down: 5: Me`, + Mindmap: `mindmap + Root + A + B + C`, + Timeline: `timeline + title History of Social Media Platform + 2002 : LinkedIn + 2004 : Facebook + : Google + 2005 : Youtube + 2006 : Twitter`, + QuadrantChart: `quadrantChart + title Reach and engagement of campaigns + x-axis Low Reach --> High Reach + y-axis Low Engagement --> High Engagement + quadrant-1 We should expand + quadrant-2 Need to promote + quadrant-3 Re-evaluate + quadrant-4 May be improved + Campaign A: [0.3, 0.6] + Campaign B: [0.45, 0.23] + Campaign C: [0.57, 0.69] + Campaign D: [0.78, 0.34] + Campaign E: [0.40, 0.34] + Campaign F: [0.35, 0.78]`, + C4Diagram: `C4Context + title System Context diagram for Internet Banking System + Enterprise_Boundary(b0, "BankBoundary0") { + Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.") + Person(customerB, "Banking Customer B") + Person_Ext(customerC, "Banking Customer C", "desc") + + Person(customerD, "Banking Customer D", "A customer of the bank,
with personal bank accounts.") + + System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.") + + Enterprise_Boundary(b1, "BankBoundary") { + + SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.") + + System_Boundary(b2, "BankBoundary2") { + System(SystemA, "Banking System A") + System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts. next line.") + } + + System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.") + SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.") + + Boundary(b3, "BankBoundary3", "boundary") { + SystemQueue(SystemF, "Banking System F Queue", "A system of the bank.") + SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.") + } + } + } + + BiRel(customerA, SystemAA, "Uses") + BiRel(SystemAA, SystemE, "Uses") + Rel(SystemAA, SystemC, "Sends e-mails", "SMTP") + Rel(SystemC, customerA, "Sends e-mails to") + + UpdateElementStyle(customerA, $fontColor="red", $bgColor="grey", $borderColor="red") + UpdateRelStyle(customerA, SystemAA, $textColor="blue", $lineColor="blue", $offsetX="5") + UpdateRelStyle(SystemAA, SystemE, $textColor="blue", $lineColor="blue", $offsetY="-10") + UpdateRelStyle(SystemAA, SystemC, $textColor="blue", $lineColor="blue", $offsetY="-40", $offsetX="-50") + UpdateRelStyle(SystemC, customerA, $textColor="red", $lineColor="red", $offsetX="-50", $offsetY="20") + + UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")`, + SankeyDiagram: `sankey-beta + + %% source,target,value + Electricity grid,Over generation / exports,104.453 + Electricity grid,Heating and cooling - homes,113.726 + Electricity grid,H2 conversion,27.14`, + XyChart: `xychart-beta + title "Sales Revenue" + x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec] + y-axis "Revenue (in $)" 4000 --> 11000 + bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000] + line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]`, + Packet: `packet-beta +title UDP Packet +0-15: "Source Port" +16-31: "Destination Port" +32-47: "Length" +48-63: "Checksum" +64-95: "Data (variable length)" +`, + Kanban: `kanban + Todo + [Create Documentation] + docs[Create Blog about the new diagram] + [In progress] + id6[Create renderer so that it works in all cases. We also add som extra text here for testing purposes. And some more just for the extra flare.] + id9[Ready for deploy] + id8[Design grammar]@{ assigned: 'knsv' } + id10[Ready for test] + id4[Create parsing tests]@{ ticket: MC-2038, assigned: 'K.Sveidqvist', priority: 'High' } + id66[last item]@{ priority: 'Very Low', assigned: 'knsv' } + id11[Done] + id5[define getData] + id2[Title of diagram is more than 100 chars when user duplicates diagram with 100 char]@{ ticket: MC-2036, priority: 'Very High'} + id3[Update DB function]@{ ticket: MC-2037, assigned: knsv, priority: 'High' } + + id12[Can't reproduce] + id3[Weird flickering in Firefox]`, + Block: `block-beta +columns 1 + db(("DB")) + blockArrowId6<["   "]>(down) + block:ID + A + B["A wide one in the middle"] + C + end + space + D + ID --> D + C --> D + style B fill:#969,stroke:#333,stroke-width:4px +`, + Architecture: `architecture-beta + group api(cloud)[API] + + service db(database)[Database] in api + service disk1(disk)[Storage] in api + service disk2(disk)[Storage] in api + service server(server)[Server] in api + + db:L -- R:server + disk1:T -- B:server + disk2:T -- B:db +` +}; + +// src/elements/architecture.ts +var architectureElements = [ + { + id: crypto.randomUUID(), + categoryId: "architecture", + description: "a sample architecture diagram", + content: `architecture-beta + group api(cloud)[API] + + service db(database)[Database] in api + service disk1(disk)[Storage] in api + service disk2(disk)[Storage] in api + service server(server)[Server] in api + + db:L -- R:server + disk1:T -- B:server + disk2:T -- B:db +`, + sortingOrder: 0, + isPinned: false + } +]; + +// src/elements/blockDiagram.ts +var blockDiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "block", + description: "a sample block diagram", + content: `block-beta +columns 1 + db(("DB")) + blockArrowId6<["   "]>(down) + block:ID + A + B["A wide one in the middle"] + C + end + space + D + ID --> D + C --> D + style B fill:#969,stroke:#333,stroke-width:4px +`, + sortingOrder: 0, + isPinned: false + } +]; + +// src/elements/c4Diagram.ts +var c4DiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "c4Diagram", + description: "sample C4 diagram (compatible with PlantUML)", + content: `C4Context + title System Context diagram for Internet Banking System + Enterprise_Boundary(b0, "BankBoundary0") { + Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.") + Person(customerB, "Banking Customer B") + Person_Ext(customerC, "Banking Customer C", "desc") + + Person(customerD, "Banking Customer D", "A customer of the bank,
with personal bank accounts.") + + System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.") + + Enterprise_Boundary(b1, "BankBoundary") { + + SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.") + + System_Boundary(b2, "BankBoundary2") { + System(SystemA, "Banking System A") + System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts. next line.") + } + + System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.") + SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.") + + Boundary(b3, "BankBoundary3", "boundary") { + SystemQueue(SystemF, "Banking System F Queue", "A system of the bank.") + SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.") + } + } + } + + BiRel(customerA, SystemAA, "Uses") + BiRel(SystemAA, SystemE, "Uses") + Rel(SystemAA, SystemC, "Sends e-mails", "SMTP") + Rel(SystemC, customerA, "Sends e-mails to") + + UpdateElementStyle(customerA, $fontColor="red", $bgColor="grey", $borderColor="red") + UpdateRelStyle(customerA, SystemAA, $textColor="blue", $lineColor="blue", $offsetX="5") + UpdateRelStyle(SystemAA, SystemE, $textColor="blue", $lineColor="blue", $offsetY="-10") + UpdateRelStyle(SystemAA, SystemC, $textColor="blue", $lineColor="blue", $offsetY="-40", $offsetX="-50") + UpdateRelStyle(SystemC, customerA, $textColor="red", $lineColor="red", $offsetX="-50", $offsetY="20") + + UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")`, + sortingOrder: 1, + isPinned: false + } +]; + +// src/elements/classDiagram.ts +var classDiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "sample class", + content: `class Duck{ + +String beakColor + +swim() + +quack() + }`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "sample class", + content: `class BankAccount + BankAccount : +String owner + BankAccount : +Bigdecimal balance + BankAccount : +deposit(amount) + BankAccount : +withdrawal(amount)`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "generic class", + content: `class Square~Shape~{ + int id + List~int~ position + setPoints(List~int~ points) + getPoints() List~int~ + } + + Square : -List~string~ messages + Square : +setMessages(List~string~ messages) + Square : +getMessages() List~string~`, + sortingOrder: 2, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "inheritance", + content: "classA <|-- classB", + sortingOrder: 3, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "composition", + content: "classC *-- classD", + sortingOrder: 4, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "aggregation", + content: "classE o-- classF", + sortingOrder: 5, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "association", + content: "classG <-- classH", + sortingOrder: 6, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "solid link", + content: "classI -- classJ", + sortingOrder: 7, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "dependency", + content: "classK <.. classL", + sortingOrder: 8, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "realization", + content: "classM <|.. classN", + sortingOrder: 9, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "dashed link", + content: "classO .. classP", + sortingOrder: 10, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "two-way relation", + content: "Animal <|--|> Zebra", + sortingOrder: 11, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "classDiagram", + description: "sample class diagram", + content: `classDiagram + Animal <|-- Duck + Animal <|-- Fish + Animal <|-- Zebra + Animal : +int age + Animal : +String gender + Animal: +isMammal() + Animal: +mate() + class Duck{ + +String beakColor + +swim() + +quack() + } + class Fish{ + -int sizeInFeet + -canEat() + } + class Zebra{ + +bool is_wild + +run() + }`, + sortingOrder: 12, + isPinned: false + } +]; + +// src/elements/entityRelationshipDiagram.ts +var entityRelationshipDiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "a sample entity relationship diagram", + content: `erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + CUSTOMER }|..|{ DELIVERY-ADDRESS : uses`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "an entity", + content: ` CUSTOMER { + string name + string custNumber + string sector + }`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "one-to-many relationship", + content: `A ||--|{ B : label`, + sortingOrder: 2, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "many-to-many relationship", + content: `A }|--|{ B : label`, + sortingOrder: 3, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "one-to-one relationship", + content: `A ||--|| B : label`, + sortingOrder: 4, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "many-to-one relationship", + content: `A }|--|| B : label`, + sortingOrder: 5, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "zero/one-to-one relationship", + content: `A |o--|| B : label`, + sortingOrder: 6, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "one-to-one/zero relationship", + content: `A ||--o| B : label`, + sortingOrder: 7, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "zero-or-more-to-one relationship", + content: `A }o--|| B : label`, + sortingOrder: 8, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "one-to-zero-or-more relationship", + content: `A ||--o{ B : label`, + sortingOrder: 9, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "zero-or-more-to-many relationship", + content: `A }o--|{ B : label`, + sortingOrder: 10, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "entityRelationshipDiagram", + description: "many-to-zero-or-more relationship", + content: `A }|--o{ B : label`, + sortingOrder: 11, + isPinned: false + } +]; + +// src/elements/flowchart.ts +var flowchartElements = [ + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "a simple flowchart with top to down direction", + content: `flowchart TD +Start --> Stop`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "a simple flowchart with left to right direction", + content: "flowchart LR\nStart --> Stop", + sortingOrder: 2, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "A node with round edges", + content: "id1(Some text)", + sortingOrder: 3, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "A stadium-shaped node", + content: "id1([Some text])", + sortingOrder: 4, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "A node in a cylindrical shape", + content: "id1[(Database)]", + sortingOrder: 5, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Circle", + content: "id1((Some text))", + sortingOrder: 6, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Rhombus", + content: "id1{Some text}", + sortingOrder: 7, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Hexagon", + content: "id1{{Some text}}", + sortingOrder: 8, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Parallelogram skewed right", + content: "id1[/Some text/]", + sortingOrder: 9, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Parallelogram skewed left", + content: "id1[\\Some text\\]", + sortingOrder: 10, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Trapezoid", + content: "A[/Some text\\]", + sortingOrder: 11, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Trapezoid upside down", + content: "A[\\Some text/]", + sortingOrder: 12, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Double circle node", + content: "id1(((Some text)))", + sortingOrder: 13, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "A link with arrow head", + content: "A-->B", + sortingOrder: 14, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "An open link", + content: "A --- B", + sortingOrder: 15, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Text on links", + content: "A-- This is the text! ---B", + sortingOrder: 16, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "A link with arrow head and text", + content: "A-->|text|B", + sortingOrder: 17, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Dotted link", + content: "A-.->B", + sortingOrder: 18, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Thick link", + content: "A ==> B", + sortingOrder: 19, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Invisible link", + content: "A ~~~ B", + sortingOrder: 20, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Link with circle edge", + content: "A --o B", + sortingOrder: 21, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Link with cross edge", + content: "A --x B", + sortingOrder: 22, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "flowchart", + description: "Subgraph", + content: "subgraph one\na1-->a2\nend", + sortingOrder: 14, + isPinned: false + } +]; + +// src/elements/ganntChart.ts +var ganttChartElements = [ + { + id: crypto.randomUUID(), + categoryId: "ganttChart", + description: "simple gantt chart", + content: `gantt + title A Gantt Diagram + dateFormat YYYY-MM-DD + section Section + A task :a1, 2014-01-01, 30d + Another task :after a1 , 20d + section Another + Task in sec :2014-01-12 , 12d + another task : 24d`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "ganttChart", + description: "rich gantt chart", + content: `gantt + dateFormat YYYY-MM-DD + title Adding GANTT diagram functionality to mermaid + excludes weekends + + section A section + Completed task :done, des1, 2014-01-06,2014-01-08 + Active task :active, des2, 2014-01-09, 3d + Future task : des3, after des2, 5d + Future task2 : des4, after des3, 5d + + section Critical tasks + Completed task in the critical line :crit, done, 2014-01-06,24h + Implement parser and jison :crit, done, after des1, 2d + Create tests for parser :crit, active, 3d + Future task in critical line :crit, 5d + Create tests for renderer :2d + Add to mermaid :1d + Functionality added :milestone, 2014-01-25, 0d + + section Documentation + Describe gantt syntax :active, a1, after des1, 3d + Add gantt diagram to demo page :after a1 , 20h + Add another diagram to demo page :doc1, after a1 , 48h + + section Last section + Describe gantt syntax :after doc1, 3d + Add gantt diagram to demo page :20h + Add another diagram to demo page :48h`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "ganttChart", + description: "milestones example", + content: `gantt + dateFormat HH:mm + axisFormat %H:%M + Initial milestone : milestone, m1, 17:49,2min + taska2 : 10min + taska3 : 5min + Final milestone : milestone, m2, 18:14, 2min`, + sortingOrder: 2, + isPinned: false + } +]; + +// src/elements/gitGraph.ts +var gitGraphElements = [ + { + id: crypto.randomUUID(), + categoryId: "gitGraph", + description: "simple git graph", + content: `gitGraph + commit + commit + branch develop + checkout develop + commit + commit + checkout main + merge develop + commit + commit`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "gitGraph", + description: "tagged commit", + content: `commit id: "Normal" tag: "v1.0.0"`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "gitGraph", + description: "reverse commit", + content: `commit id: "Reverse" type: REVERSE`, + sortingOrder: 2, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "gitGraph", + description: "highlighted commit", + content: `commit id: "Highlight" type: HIGHLIGHT`, + sortingOrder: 3, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "gitGraph", + description: "reverse commit", + content: `commit id: "Reverse" type: REVERSE`, + sortingOrder: 4, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "gitGraph", + description: "git graph with cherry-pick", + content: `gitGraph + commit id: "ZERO" + branch develop + commit id:"A" + checkout main + commit id:"ONE" + checkout develop + commit id:"B" + checkout main + commit id:"TWO" + cherry-pick id:"A" + commit id:"THREE" + checkout develop + commit id:"C"`, + sortingOrder: 5, + isPinned: false + } +]; + +// src/elements/kanban.ts +var kanbanElements = [ + { + id: crypto.randomUUID(), + categoryId: "kanban", + description: "a sample kanban diagram", + content: `kanban + Todo + [Create Documentation] + docs[Create Blog about the new diagram] + [In progress] + id6[Create renderer so that it works in all cases. We also add som extra text here for testing purposes. And some more just for the extra flare.] + id9[Ready for deploy] + id8[Design grammar]@{ assigned: 'knsv' } + id10[Ready for test] + id4[Create parsing tests]@{ ticket: MC-2038, assigned: 'K.Sveidqvist', priority: 'High' } + id66[last item]@{ priority: 'Very Low', assigned: 'knsv' } + id11[Done] + id5[define getData] + id2[Title of diagram is more than 100 chars when user duplicates diagram with 100 char]@{ ticket: MC-2036, priority: 'Very High'} + id3[Update DB function]@{ ticket: MC-2037, assigned: knsv, priority: 'High' } + + id12[Can't reproduce] + id3[Weird flickering in Firefox]`, + sortingOrder: 0, + isPinned: false + } +]; + +// src/elements/mindMap.ts +var mindMapElements = [ + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "a simple mindmap", + content: `mindmap + Root + A + B + C`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "square", + content: `id[I am a square]`, + sortingOrder: 2, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "rounded square", + content: `id(I am a rounded square)`, + sortingOrder: 3, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "circle", + content: `id((I am a circle))`, + sortingOrder: 4, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "bang", + content: `id))I am a bang((`, + sortingOrder: 5, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "cloud", + content: `id)I am a cloud(`, + sortingOrder: 6, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "hexagon", + content: `id{{I am a hexagon}}`, + sortingOrder: 7, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "default", + content: `I am the default shape`, + sortingOrder: 8, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "mindmap", + description: "sample mindmap", + content: `mindmap + root((mindmap)) + Origins + Long history + Popularisation + British popular psychology author Tony Buzan + Research + On effectiveness
and features + On Automatic creation + Uses + Creative techniques + Strategic planning + Argument mapping + Tools + Pen and paper + Mermaid`, + sortingOrder: 9, + isPinned: false + } +]; + +// src/elements/packet.ts +var packetElements = [ + { + id: crypto.randomUUID(), + categoryId: "packet", + description: "a sample packet diagram", + content: `packet-beta +title UDP Packet +0-15: "Source Port" +16-31: "Destination Port" +32-47: "Length" +48-63: "Checksum" +64-95: "Data (variable length)" +`, + sortingOrder: 0, + isPinned: false + } +]; + +// src/elements/pieChart.ts +var pieChartElements = [ + { + id: crypto.randomUUID(), + categoryId: "pieChart", + description: "sample pie chart", + content: `pie title /r/obsidianmd posts by type + "Graphs" : 85 + "Dashboards" : 14 + "Tips" : 1`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "pieChart", + description: "sample pie chart with values shown in legend", + content: `pie showData title /r/obsidianmd posts by type + "Graphs" : 85 + "Dashboards" : 14 + "Tips" : 1`, + sortingOrder: 1, + isPinned: false + } +]; + +// src/elements/quadrant.ts +var quadrantElements = [ + { + id: crypto.randomUUID(), + categoryId: "quadrantChart", + description: "sample quadrant chart", + content: `quadrantChart + title Reach and engagement of campaigns + x-axis Low Reach --> High Reach + y-axis Low Engagement --> High Engagement + quadrant-1 We should expand + quadrant-2 Need to promote + quadrant-3 Re-evaluate + quadrant-4 May be improved + Campaign A: [0.3, 0.6] + Campaign B: [0.45, 0.23] + Campaign C: [0.57, 0.69] + Campaign D: [0.78, 0.34] + Campaign E: [0.40, 0.34] + Campaign F: [0.35, 0.78]`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "quadrantChart", + description: "themed quadrant chart", + content: `%%{init: {"quadrantChart": {"chartWidth": 400, "chartHeight": 400}, "themeVariables": {"quadrant1TextFill": "#ff0000"} }}%% + quadrantChart + x-axis Urgent --> Not Urgent + y-axis Not Important --> "Important \u2764" + quadrant-1 Plan + quadrant-2 Do + quadrant-3 Delegate + quadrant-4 Delete`, + sortingOrder: 1, + isPinned: false + } +]; + +// src/elements/requirementDiagram.ts +var requirementDiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "requirementDiagram", + description: "sample requirements diagram", + content: ` requirementDiagram + + requirement test_req { + id: 1 + text: the test text. + risk: high + verifymethod: test + } + + element test_entity { + type: simulation + } + + test_entity - satisfies -> test_req`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "requirementDiagram", + description: "sample requirements diagram", + content: `element customElement { + type: customType + docref: customDocRef + }`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "requirementDiagram", + description: "a requirement with high risk", + content: `functionalRequirement myReq { + id: reqId + text: someText + risk: High + verifymethod: analysis + }`, + sortingOrder: 2, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "requirementDiagram", + description: "sample requirements diagram", + content: `interfaceRequirement myReq2 { + id: reqId + text: someText + risk: Medium + verifymethod: demonstration + }`, + sortingOrder: 3, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "requirementDiagram", + description: "sample requirements diagram", + content: `designConstraint myReq3 { + id: reqId + text: someText + risk: Low + verifymethod: test + }`, + sortingOrder: 4, + isPinned: false + } +]; + +// src/elements/sankeyDiagram.ts +var sankeyDiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "sankeyDiagram", + description: "", + content: `sankey-beta + %% source,target,value + Electricity grid,Over generation / exports,104.453 + Electricity grid,Heating and cooling - homes,113.726 + Electricity grid,H2 conversion,27.14`, + sortingOrder: 0, + isPinned: false + } +]; + +// src/elements/sequenceDiagram.ts +var sequenceDiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "sequenceDiagram", + description: "a simple sequence diagram", + content: `sequenceDiagram +Alice->>John: Hello John, how are you? +John-->>Alice: Great! +Alice-)John: See you later!`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "sequenceDiagram", + description: "a simple sequence diagram with actors", + content: `sequenceDiagram +actor Alice +actor John +Alice->>John: Hello John, how are you? +John-->>Alice: Great! +Alice-)John: See you later!`, + sortingOrder: 1, + isPinned: false + } +]; + +// src/elements/stateDiagram.ts +var stateDiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "a sample state diagram", + content: `stateDiagram-v2 + [*] --> Still + Still --> [*] + + Still --> Moving + Moving --> Still + Moving --> Crash + Crash --> [*]`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "a sample state diagram with left-to-right direction", + content: `stateDiagram-v2 + direction LR + [*] --> Still + Still --> [*] + + Still --> Moving + Moving --> Still + Moving --> Crash + Crash --> [*]`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "node with description", + content: `s2 : This is a state description`, + sortingOrder: 2, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "a transition", + content: `s1 --> s2`, + sortingOrder: 3, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "a transition with label", + content: `s1 --> s2: A transition`, + sortingOrder: 4, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "composite state", + content: ` + [*] --> First + state First { + [*] --> second + second --> [*] + }`, + sortingOrder: 5, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "diagram with choice", + content: `stateDiagram-v2 + state if_state <> + [*] --> IsPositive + IsPositive --> if_state + if_state --> False: if n < 0 + if_state --> True : if n >= 0`, + sortingOrder: 6, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "diagram with fork", + content: `stateDiagram-v2 + state fork_state <> + [*] --> fork_state + fork_state --> State2 + fork_state --> State3 + + state join_state <> + State2 --> join_state + State3 --> join_state + join_state --> State4 + State4 --> [*]`, + sortingOrder: 7, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "stateDiagram", + description: "a diagram with concurrency", + content: `stateDiagram-v2 + [*] --> Active + + state Active { + [*] --> NumLockOff + NumLockOff --> NumLockOn : EvNumLockPressed + NumLockOn --> NumLockOff : EvNumLockPressed + -- + [*] --> CapsLockOff + CapsLockOff --> CapsLockOn : EvCapsLockPressed + CapsLockOn --> CapsLockOff : EvCapsLockPressed + -- + [*] --> ScrollLockOff + ScrollLockOff --> ScrollLockOn : EvScrollLockPressed + ScrollLockOn --> ScrollLockOff : EvScrollLockPressed + }`, + sortingOrder: 8, + isPinned: false + } +]; + +// src/elements/timeline.ts +var timelineElements = [ + { + id: crypto.randomUUID(), + categoryId: "timeline", + description: "sample timeline", + content: `timeline + title History of Social Media Platform + 2002 : LinkedIn + 2004 : Facebook + : Google + 2005 : Youtube + 2006 : Twitter`, + sortingOrder: 1, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "timeline", + description: "timeline with grouping", + content: `timeline + title Timeline of Industrial Revolution + section 17th-20th century + Industry 1.0 : Machinery, Water power, Steam
power + Industry 2.0 : Electricity, Internal combustion engine, Mass production + Industry 3.0 : Electronics, Computers, Automation + section 21st century + Industry 4.0 : Internet, Robotics, Internet of Things + Industry 5.0 : Artificial intelligence, Big data,3D printing`, + sortingOrder: 2, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "timeline", + description: "timeline with Forest theme. see the docs for additional themes", + content: `%%{init: { 'logLevel': 'debug', 'theme': 'forest' } }%% + timeline + title History of Social Media Platform + 2002 : LinkedIn + 2004 : Facebook : Google + 2005 : Youtube + 2006 : Twitter + 2007 : Tumblr + 2008 : Instagram + 2010 : Pinterest`, + sortingOrder: 3, + isPinned: false + } +]; + +// src/elements/userJourneyDiagram.ts +var userJourneyDiagramElements = [ + { + id: crypto.randomUUID(), + categoryId: "userJourneyDiagram", + description: "a sample user journey diagram", + content: `journey + title My working day + section Go to work + Make tea: 5: Me + Go upstairs: 3: Me + Do work: 1: Me, Cat + section Go home + Go downstairs: 5: Me + Sit down: 5: Me`, + sortingOrder: 0, + isPinned: false + }, + { + id: crypto.randomUUID(), + categoryId: "userJourneyDiagram", + description: "a step in user journey", + content: ` Step Title: 5: ActorName`, + sortingOrder: 1, + isPinned: false + } +]; + +// src/elements/xyChart.ts +var xyChartElements = [ + { + id: crypto.randomUUID(), + categoryId: "xyChart", + description: "a sample XYChart diagram", + content: `xychart-beta + title "Sales Revenue" + x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec] + y-axis "Revenue (in $)" 4000 --> 11000 + bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000] + line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]`, + sortingOrder: 0, + isPinned: false + } +]; + +// src/elements/defaultElements.ts +var defaultElements = [ + ...flowchartElements, + ...sequenceDiagramElements, + ...classDiagramElements, + ...stateDiagramElements, + ...entityRelationshipDiagramElements, + ...userJourneyDiagramElements, + ...ganttChartElements, + ...pieChartElements, + ...requirementDiagramElements, + ...gitGraphElements, + ...mindMapElements, + ...timelineElements, + ...quadrantElements, + ...c4DiagramElements, + ...sankeyDiagramElements, + ...xyChartElements, + ...packetElements, + ...kanbanElements, + ...blockDiagramElements, + ...architectureElements +]; + +// src/core/defaultCategories.ts +var DEFAULT_CATEGORIES = [ + { + id: "flowchart", + name: "Flowchart", + defaultWrapping: "flowchart LR", + wrappings: ["flowchart LR", "flowchart TD"], + isCustom: false, + sortOrder: 0 + }, + { + id: "sequenceDiagram", + name: "SequenceDiagram", + defaultWrapping: "sequenceDiagram", + wrappings: null, + isCustom: false, + sortOrder: 1 + }, + { + id: "classDiagram", + name: "ClassDiagram", + defaultWrapping: "classDiagram", + wrappings: null, + isCustom: false, + sortOrder: 2 + }, + { + id: "stateDiagram", + name: "StateDiagram", + defaultWrapping: "stateDiagram-v2", + wrappings: null, + isCustom: false, + sortOrder: 3 + }, + { + id: "entityRelationshipDiagram", + name: "EntityRelationshipDiagram", + defaultWrapping: "erDiagram", + wrappings: null, + isCustom: false, + sortOrder: 4 + }, + { + id: "userJourneyDiagram", + name: "UserJourneyDiagram", + defaultWrapping: "journey", + wrappings: null, + isCustom: false, + sortOrder: 5 + }, + { + id: "ganttChart", + name: "GanttChart", + defaultWrapping: "gantt", + wrappings: null, + isCustom: false, + sortOrder: 6 + }, + { + id: "pieChart", + name: "PieChart", + defaultWrapping: "pie", + wrappings: null, + isCustom: false, + sortOrder: 7 + }, + { + id: "requirementDiagram", + name: "RequirementDiagram", + defaultWrapping: "requirementDiagram", + wrappings: null, + isCustom: false, + sortOrder: 8 + }, + { + id: "gitGraph", + name: "GitGraph", + defaultWrapping: "gitGraph", + wrappings: null, + isCustom: false, + sortOrder: 9 + }, + { + id: "mindmap", + name: "Mindmap", + defaultWrapping: "mindmap", + wrappings: ["mindmap"], + isCustom: false, + sortOrder: 10 + }, + { + id: "timeline", + name: "Timeline", + defaultWrapping: "timeline", + wrappings: null, + isCustom: false, + sortOrder: 11 + }, + { + id: "c4Diagram", + name: "C4Diagram", + defaultWrapping: "C4Context", + wrappings: null, + isCustom: false, + sortOrder: 12 + }, + { + id: "quadrantChart", + name: "QuadrantChart", + defaultWrapping: "quadrantChart", + wrappings: null, + isCustom: false, + sortOrder: 13 + }, + { + id: "sankeyDiagram", + name: "SankeyDiagram", + defaultWrapping: "sankey-beta", + wrappings: null, + isCustom: false, + sortOrder: 14 + }, + { + id: "xyChart", + name: "XyChart", + defaultWrapping: "xychart-beta", + wrappings: null, + isCustom: false, + sortOrder: 15 + }, + { + id: "kanban", + name: "Kanban", + defaultWrapping: "kanban", + wrappings: null, + isCustom: false, + sortOrder: 16 + }, + { + id: "architecture", + name: "Architecture", + defaultWrapping: "architecture-beta", + wrappings: null, + isCustom: false, + sortOrder: 17 + }, + { + id: "block", + name: "Block", + defaultWrapping: "block-beta", + wrappings: null, + isCustom: false, + sortOrder: 18 + }, + { + id: "packet", + name: "Packet", + defaultWrapping: "packet-beta", + wrappings: null, + isCustom: false, + sortOrder: 19 + } +]; + +// src/core/categoryService.ts +var CategoryService = class { + constructor() { + this.categories = []; + this.categories = [...DEFAULT_CATEGORIES]; + } + static getInstance() { + if (!CategoryService.instance) { + CategoryService.instance = new CategoryService(); + } + return CategoryService.instance; + } + getCategories() { + return [...this.categories].sort((a, b) => a.sortOrder - b.sortOrder); + } + getCategoryById(id) { + return this.categories.find((cat) => cat.id === id); + } + getCategoryByName(name) { + return this.categories.find((cat) => cat.name === name); + } + addCategory(category) { + if (this.categories.some((cat) => cat.id === category.id)) { + throw new Error(`Category with ID '${category.id}' already exists`); + } + this.categories.push(category); + } + updateCategory(category) { + const index = this.categories.findIndex((cat) => cat.id === category.id); + if (index === -1) { + throw new Error(`Category with ID '${category.id}' not found`); + } + this.categories[index] = category; + } + deleteCategory(id) { + var _a; + if (!((_a = this.getCategoryById(id)) == null ? void 0 : _a.isCustom)) { + throw new Error("Cannot delete default categories"); + } + this.categories = this.categories.filter((cat) => cat.id !== id); + } + loadCategories(customCategories, defaultCategorySortOrders = {}) { + const defaultCategories = DEFAULT_CATEGORIES.map((cat) => ({ + ...cat, + sortOrder: defaultCategorySortOrders[cat.id] !== void 0 ? defaultCategorySortOrders[cat.id] : cat.sortOrder + })); + const customCats = customCategories.filter((cat) => cat.isCustom); + this.categories = [...defaultCategories, ...customCats]; + } + getCustomCategories() { + return this.categories.filter((cat) => cat.isCustom); + } + getWrappingData(categoryId) { + var _a; + const category = this.getCategoryById(categoryId); + if (!category) + return null; + return { + defaultWrapping: category.defaultWrapping, + wrappings: (_a = category.wrappings) != null ? _a : null + }; + } + getNextSortOrder() { + return Math.max(...this.categories.map((cat) => cat.sortOrder), -1) + 1; + } +}; + +// src/core/elementService.ts +var MermaidElementService = class { + constructor() { + this.categoryService = CategoryService.getInstance(); + } + static DefaultElements() { + return defaultElements; + } + saveElement(element, plugin) { + const elementExists = plugin.settings.elements.some((el) => el.id === element.id); + if (elementExists) { + const index = plugin.settings.elements.findIndex((el) => el.id === element.id); + if (index !== -1) { + plugin.settings.elements[index] = element; + } + } else { + this.fixSortOrder(element, plugin); + plugin.settings.elements.push(element); + } + plugin.saveSettings(); + } + fixSortOrder(element, plugin) { + const elementsFromSameCategory = plugin.settings.elements.filter((el) => el.categoryId === element.categoryId); + if (elementsFromSameCategory.some((el) => el.sortingOrder === element.sortingOrder)) { + element.sortingOrder = elementsFromSameCategory.length; + } + } + getSampleDiagram(categoryId) { + const category = this.categoryService.getCategoryById(categoryId); + if (!category) { + console.warn(`[Mermaid Tools] No category found for ID: ${categoryId}, using default sample`); + return this.wrapForPastingIntoEditor(this.wrapWithMermaidBlock("flowchart TD\nStart --> End")); + } + const sampleKey = category.name; + const sample = sampleDiagrams[sampleKey]; + if (sample) { + return this.wrapForPastingIntoEditor(this.wrapWithMermaidBlock(sample)); + } + console.warn(`[Mermaid Tools] No sample diagram found for category: ${category.name}, using default sample`); + return this.wrapForPastingIntoEditor(this.wrapWithMermaidBlock("flowchart TD\nStart --> End")); + } + wrapForPastingIntoEditor(text) { + return `${text} +`; + } + wrapWithMermaidBlock(text) { + return `\`\`\`mermaid +${text} +\`\`\``; + } + wrapAsCompleteDiagram(element) { + const wrapping = this.categoryService.getWrappingData(element.categoryId); + if (!wrapping) { + console.warn(`[Mermaid Tools] No wrapping data found for category: ${element.categoryId}`); + return element.content; + } + const contentAlreadyWrapped = wrapping.wrappings ? wrapping.wrappings.some((w) => element.content.contains(w)) : element.content.contains(wrapping.defaultWrapping); + if (contentAlreadyWrapped) { + return element.content; + } + const wrappedContent = wrapping.defaultWrapping + "\n" + element.content; + const firstWord = wrapping.defaultWrapping.trim().split(/\s+/)[0]; + const validDiagramTypes = [ + "flowchart", + "graph", + "sequenceDiagram", + "classDiagram", + "stateDiagram-v2", + "erDiagram", + "journey", + "gantt", + "pie", + "requirementDiagram", + "gitGraph", + "mindmap", + "timeline", + "quadrantChart", + "C4Context", + "sankey-beta", + "xychart-beta", + "packet-beta", + "kanban", + "block-beta", + "architecture-beta" + ]; + if (!validDiagramTypes.includes(firstWord)) { + console.warn(`[Mermaid Tools] Potentially invalid diagram type "${firstWord}" in category ${element.categoryId}. This may cause rendering errors.`); + } + return wrappedContent; + } +}; + +// src/core/textEditorService.ts +var NoActiveCursorError = class extends Error { + constructor() { + super(); + this.message = "Mermaid Tools: Error getting cursor position. Make sure you are in editing mode and have an active cursor in file content."; + } +}; +var TextEditorService = class { + constructor() { + this._elementService = new MermaidElementService(); + } + insertTextAtCursor(editor, content) { + if (!editor) + throw new NoActiveCursorError(); + content = this._elementService.wrapForPastingIntoEditor(content); + const cursor = editor.getCursor(); + editor.replaceRange(content, cursor); + const lines = content.split("\n"); + const newCursor = { + line: cursor.line + lines.length - 1, + ch: lines.length === 1 ? cursor.ch + lines[0].length : lines[lines.length - 1].length + }; + editor.setCursor(newCursor); + editor.focus(); + } +}; + +// src/settings/settings.ts +var MermaidPluginSettings = class { + static DefaultSettings() { + const settings = new MermaidPluginSettings(); + settings.elements = defaultElements; + settings.customCategories = []; + settings.selectedCategoryId = "flowchart"; + settings.defaultCategorySortOrders = {}; + settings.categoryModifications = {}; + return settings; + } +}; + +// src/trident-icon.ts +var import_obsidian = require("obsidian"); +function addTridentIcon() { + (0, import_obsidian.addIcon)(TRIDENT_ICON_NAME, getSanitizedSvg()); +} +function getSanitizedSvg() { + var sanitized = (0, import_obsidian.sanitizeHTMLToDom)(tridentIcon); + var tempContainer = createDiv(); + tempContainer.appendChild(sanitized); + return tempContainer.innerHTML; +} +var tridentIcon = ` + +`; + +// src/ui/settingsTab.ts +var import_obsidian4 = require("obsidian"); + +// src/ui/editMermaidElementModal.ts +var import_obsidian2 = require("obsidian"); +var EditMermaidElementModal = class extends import_obsidian2.Modal { + constructor(app, _plugin, _mermaid, _element, _categoryService) { + super(app); + this._plugin = _plugin; + this._mermaid = _mermaid; + this._element = _element; + this._categoryService = _categoryService; + } + async onOpen() { + const { contentEl } = this; + contentEl.addClass("mermaid-tools-edit-element-modal"); + contentEl.createEl("h2", { text: "Edit element" }); + const renderContainerEl = contentEl.createDiv(); + const renderEl = renderContainerEl.createEl("pre", { text: "rendered diagram" }); + if (!this._mermaid) + this._mermaid = await (0, import_obsidian2.loadMermaid)(); + renderEl.id = "mermaid-edit-element-modal"; + const elementCategoryContainerEl = contentEl.createDiv(); + elementCategoryContainerEl.createEl("label", { text: "Category" }); + const elementCategoryEl = elementCategoryContainerEl.createEl("select"); + const categories = this._categoryService.getCategories(); + for (const category of categories) { + const option = elementCategoryEl.createEl("option", { text: category.name }); + option.value = category.id; + } + elementCategoryEl.value = this._element.categoryId; + elementCategoryEl.onchange = (e) => { + this._element.categoryId = elementCategoryEl.value; + }; + const elementDescriptionContainerEl = contentEl.createDiv(); + elementDescriptionContainerEl.createEl("label", { text: "Description" }); + const elementDescriptionEl = elementDescriptionContainerEl.createEl("input", { value: this._element.description, type: "text" }); + elementDescriptionEl.style.minWidth = "50%"; + elementDescriptionEl.onchange = (e) => { + this._element.description = elementDescriptionEl.value; + }; + const elementContentContainerEl = contentEl.createDiv(); + elementContentContainerEl.createEl("label", { text: "Content" }); + const elementContentEl = elementContentContainerEl.createEl("textarea", { text: this._element.content }); + elementContentEl.style.height = "200px"; + elementContentEl.style.width = "100%"; + elementContentEl.onchange = async (e) => { + this._element.content = elementContentEl.value; + const { svg: svg2 } = await this._mermaid.render(renderEl.id, this._plugin._mermaidElementService.wrapAsCompleteDiagram(this._element)); + renderEl.innerHTML = svg2; + renderContainerEl.appendChild(renderEl); + }; + const saveButtonEl = contentEl.createEl("button", { text: "Save" }); + saveButtonEl.onclick = (e) => { + this.save(); + }; + const { svg } = await this._mermaid.render(renderEl.id, this._plugin._mermaidElementService.wrapAsCompleteDiagram(this._element)); + renderEl.innerHTML = svg; + renderContainerEl.appendChild(renderEl); + } + save() { + this._plugin._mermaidElementService.saveElement(this._element, this._plugin); + this.close(); + } +}; + +// src/ui/editCategoryModal.ts +var import_obsidian3 = require("obsidian"); +var EditCategoryModal = class extends import_obsidian3.Modal { + constructor(app, plugin, existingCategory, onSave) { + super(app); + this.plugin = plugin; + this.categoryService = CategoryService.getInstance(); + this.onSave = onSave; + this.isNewCategory = !existingCategory; + if (existingCategory) { + this.category = { ...existingCategory }; + } else { + this.category = { + id: "", + name: "", + defaultWrapping: "", + wrappings: null, + isCustom: true, + sortOrder: this.categoryService.getNextSortOrder() + }; + } + } + onOpen() { + const { contentEl } = this; + contentEl.addClass("mermaid-tools-edit-category-modal"); + contentEl.createEl("h2", { + text: this.isNewCategory ? "Create Custom Category" : "Edit Category" + }); + new import_obsidian3.Setting(contentEl).setName("Category ID").setDesc("Unique identifier for this category (lowercase, no spaces)").addText((text) => text.setPlaceholder("my-custom-category").setValue(this.category.id).onChange((value) => { + this.category.id = value.toLowerCase().replace(/\s+/g, "-"); + })); + new import_obsidian3.Setting(contentEl).setName("Category Name").setDesc("Display name for this category").addText((text) => text.setPlaceholder("My Custom Category").setValue(this.category.name).onChange((value) => { + this.category.name = value; + })); + new import_obsidian3.Setting(contentEl).setName("Default Wrapping").setDesc('Default mermaid syntax to wrap elements (e.g., "flowchart TD", "sequenceDiagram")').addText((text) => text.setPlaceholder("flowchart TD").setValue(this.category.defaultWrapping).onChange((value) => { + this.category.defaultWrapping = value; + })); + new import_obsidian3.Setting(contentEl).setName("Additional Wrappings (Optional)").setDesc('Comma-separated list of alternative wrappings (e.g., "flowchart LR, flowchart TB")').addText((text) => text.setPlaceholder("flowchart LR, flowchart TB").setValue(this.category.wrappings ? this.category.wrappings.join(", ") : "").onChange((value) => { + if (value.trim()) { + this.category.wrappings = value.split(",").map((w) => w.trim()).filter((w) => w); + } else { + this.category.wrappings = null; + } + })); + new import_obsidian3.Setting(contentEl).setName("Sort Order").setDesc("Determines the order in which categories appear").addText((text) => text.setPlaceholder("0").setValue(this.category.sortOrder.toString()).onChange((value) => { + const num = parseInt(value); + if (!isNaN(num)) { + this.category.sortOrder = num; + } + })); + const buttonContainer = contentEl.createDiv("modal-button-container"); + buttonContainer.style.display = "flex"; + buttonContainer.style.justifyContent = "flex-end"; + buttonContainer.style.gap = "10px"; + buttonContainer.style.marginTop = "20px"; + const cancelButton = buttonContainer.createEl("button", { text: "Cancel" }); + cancelButton.onclick = () => this.close(); + const saveButton = buttonContainer.createEl("button", { + text: this.isNewCategory ? "Create" : "Save", + cls: "mod-cta" + }); + saveButton.onclick = () => this.save(); + } + save() { + if (!this.category.id.trim()) { + alert("Category ID is required"); + return; + } + if (!this.category.name.trim()) { + alert("Category name is required"); + return; + } + if (!this.category.defaultWrapping.trim()) { + alert("Default wrapping is required"); + return; + } + const commonDiagramTypes = [ + "flowchart", + "graph", + "sequenceDiagram", + "classDiagram", + "stateDiagram-v2", + "erDiagram", + "journey", + "gantt", + "pie", + "requirementDiagram", + "gitGraph", + "mindmap", + "timeline", + "quadrantChart", + "C4Context", + "sankey-beta", + "xychart-beta", + "packet-beta", + "kanban", + "block-beta", + "architecture-beta" + ]; + const wrapping = this.category.defaultWrapping.trim().split(/\s+/)[0]; + if (!commonDiagramTypes.includes(wrapping)) { + const shouldContinue = confirm(`Warning: "${wrapping}" is not a recognized Mermaid diagram type. This may cause rendering errors. Are you sure you want to continue?`); + if (!shouldContinue) { + return; + } + } + if (this.isNewCategory && this.categoryService.getCategoryById(this.category.id)) { + alert(`A category with ID '${this.category.id}' already exists`); + return; + } + try { + this.onSave(this.category); + this.close(); + } catch (error) { + alert(`Error saving category: ${error.message}`); + } + } +}; + +// src/ui/settingsTab.ts +var MermaidToolsSettingsTab = class extends import_obsidian4.PluginSettingTab { + constructor(_app, _plugin) { + super(_app, _plugin); + this._app = _app; + this._plugin = _plugin; + } + async display() { + await renderSettings(this.containerEl, this._plugin); + } +}; +async function renderSettings(containerEl, plugin) { + const mermaid = await (0, import_obsidian4.loadMermaid)(); + const categoryService = CategoryService.getInstance(); + categoryService.loadCategories(plugin.settings.customCategories, plugin.settings.defaultCategorySortOrders); + containerEl.empty(); + containerEl.createEl("h1", { text: "Mermaid Tools Settings" }); + containerEl.createEl("h2", { text: "Manage Elements & Categories" }); + const buttonsContainer = containerEl.createDiv(); + buttonsContainer.style.marginBottom = "20px"; + buttonsContainer.style.display = "flex"; + buttonsContainer.style.gap = "10px"; + const addElementButton = buttonsContainer.createEl("button", { text: "Add Element" }); + addElementButton.addClass("mod-cta"); + addElementButton.onclick = () => { + const newElement = { + id: crypto.randomUUID(), + description: "New element", + content: `flowchart TD +Start --> Stop`, + categoryId: "flowchart", + sortingOrder: 0, + isPinned: false + }; + const modal = new EditMermaidElementModal(plugin.app, plugin, mermaid, newElement, categoryService); + modal.open(); + modal.onClose = () => { + renderSettings(containerEl, plugin); + }; + }; + const addCategoryButton = buttonsContainer.createEl("button", { text: "Add Category" }); + addCategoryButton.addClass("mod-cta"); + addCategoryButton.onclick = () => { + const modal = new EditCategoryModal(plugin.app, plugin, null, (category) => { + try { + if (category.sortOrder === void 0 || category.sortOrder === null) { + category.sortOrder = categoryService.getNextSortOrder(); + } + categoryService.addCategory(category); + saveAllCategoryChanges(plugin, categoryService); + renderSettings(containerEl, plugin); + } catch (error) { + console.error("Error adding category:", error); + } + }); + modal.open(); + }; + createIntegratedCategorySection(containerEl, plugin, categoryService, mermaid); +} +function saveAllCategoryChanges(plugin, categoryService) { + plugin.settings.customCategories = categoryService.getCustomCategories(); + const defaultCategories = categoryService.getCategories().filter((cat) => !cat.isCustom); + defaultCategories.forEach((cat) => { + plugin.settings.defaultCategorySortOrders[cat.id] = cat.sortOrder; + }); + plugin.saveSettings(); +} +function createIntegratedCategorySection(containerEl, plugin, categoryService, mermaid) { + const allCategories = categoryService.getCategories().sort((a, b) => a.sortOrder - b.sortOrder); + allCategories.forEach((category) => { + const categoryContainer = containerEl.createDiv(); + categoryContainer.addClass("mermaid-tools-category-section"); + categoryContainer.style.marginBottom = "20px"; + categoryContainer.style.border = "1px solid var(--background-modifier-border)"; + categoryContainer.style.borderRadius = "8px"; + categoryContainer.style.padding = "15px"; + const categoryHeader = categoryContainer.createDiv(); + categoryHeader.style.display = "flex"; + categoryHeader.style.alignItems = "center"; + categoryHeader.style.justifyContent = "space-between"; + categoryHeader.style.marginBottom = "10px"; + categoryHeader.style.cursor = "pointer"; + const categoryTitle = categoryHeader.createDiv(); + categoryTitle.style.display = "flex"; + categoryTitle.style.alignItems = "center"; + categoryTitle.style.gap = "10px"; + const expandIcon = categoryTitle.createSpan(); + expandIcon.innerHTML = "\u25BC"; + expandIcon.style.fontSize = "12px"; + expandIcon.style.transition = "transform 0.2s"; + const categoryName = categoryTitle.createEl("h3", { text: category.name }); + categoryName.style.margin = "0"; + categoryName.style.fontSize = "16px"; + const categoryInfo = categoryTitle.createSpan(); + const elementCount = plugin.settings.elements.filter((el) => el.categoryId === category.id).length; + categoryInfo.textContent = `(${elementCount} elements)`; + categoryInfo.style.color = "var(--text-muted)"; + categoryInfo.style.fontSize = "12px"; + const categoryControls = categoryHeader.createDiv(); + categoryControls.style.display = "flex"; + categoryControls.style.gap = "2px"; + const addElementButton = categoryControls.createEl("button"); + addElementButton.title = "Add element to this category"; + addElementButton.style.background = "none"; + addElementButton.style.border = "none"; + addElementButton.style.cursor = "pointer"; + addElementButton.style.padding = "4px"; + addElementButton.style.display = "flex"; + addElementButton.style.alignItems = "center"; + addElementButton.style.borderRadius = "3px"; + addElementButton.innerHTML = ``; + addElementButton.onmouseenter = () => addElementButton.style.backgroundColor = "var(--background-modifier-hover)"; + addElementButton.onmouseleave = () => addElementButton.style.backgroundColor = "transparent"; + addElementButton.onclick = (e) => { + e.stopPropagation(); + const newElement = { + id: crypto.randomUUID(), + description: "New element", + content: `flowchart TD +Start --> Stop`, + categoryId: category.id, + sortingOrder: plugin.settings.elements.filter((el) => el.categoryId === category.id).length, + isPinned: false + }; + const modal = new EditMermaidElementModal(plugin.app, plugin, mermaid, newElement, categoryService); + modal.open(); + modal.onClose = () => { + renderSettings(containerEl, plugin); + }; + }; + const moveUpButton = categoryControls.createEl("button"); + moveUpButton.title = "Move category up"; + moveUpButton.style.background = "none"; + moveUpButton.style.border = "none"; + moveUpButton.style.cursor = "pointer"; + moveUpButton.style.padding = "4px"; + moveUpButton.style.display = "flex"; + moveUpButton.style.alignItems = "center"; + moveUpButton.style.borderRadius = "3px"; + moveUpButton.innerHTML = ``; + moveUpButton.onmouseenter = () => moveUpButton.style.backgroundColor = "var(--background-modifier-hover)"; + moveUpButton.onmouseleave = () => moveUpButton.style.backgroundColor = "transparent"; + moveUpButton.onclick = (e) => { + e.stopPropagation(); + const categories = categoryService.getCategories().sort((a, b) => a.sortOrder - b.sortOrder); + const currentIndex = categories.findIndex((cat) => cat.id === category.id); + if (currentIndex > 0) { + const temp = categories[currentIndex - 1].sortOrder; + categories[currentIndex - 1].sortOrder = category.sortOrder; + category.sortOrder = temp; + categoryService.updateCategory(categories[currentIndex - 1]); + categoryService.updateCategory(category); + saveAllCategoryChanges(plugin, categoryService); + renderSettings(containerEl, plugin); + } + }; + const moveDownButton = categoryControls.createEl("button"); + moveDownButton.title = "Move category down"; + moveDownButton.style.background = "none"; + moveDownButton.style.border = "none"; + moveDownButton.style.cursor = "pointer"; + moveDownButton.style.padding = "4px"; + moveDownButton.style.display = "flex"; + moveDownButton.style.alignItems = "center"; + moveDownButton.style.borderRadius = "3px"; + moveDownButton.innerHTML = ``; + moveDownButton.onmouseenter = () => moveDownButton.style.backgroundColor = "var(--background-modifier-hover)"; + moveDownButton.onmouseleave = () => moveDownButton.style.backgroundColor = "transparent"; + moveDownButton.onclick = (e) => { + e.stopPropagation(); + const categories = categoryService.getCategories().sort((a, b) => a.sortOrder - b.sortOrder); + const currentIndex = categories.findIndex((cat) => cat.id === category.id); + if (currentIndex < categories.length - 1) { + const temp = categories[currentIndex + 1].sortOrder; + categories[currentIndex + 1].sortOrder = category.sortOrder; + category.sortOrder = temp; + categoryService.updateCategory(categories[currentIndex + 1]); + categoryService.updateCategory(category); + saveAllCategoryChanges(plugin, categoryService); + renderSettings(containerEl, plugin); + } + }; + const editButton = categoryControls.createEl("button"); + editButton.title = "Edit category"; + editButton.style.background = "none"; + editButton.style.border = "none"; + editButton.style.cursor = "pointer"; + editButton.style.padding = "4px"; + editButton.style.display = "flex"; + editButton.style.alignItems = "center"; + editButton.style.borderRadius = "3px"; + editButton.innerHTML = ``; + editButton.onmouseenter = () => editButton.style.backgroundColor = "var(--background-modifier-hover)"; + editButton.onmouseleave = () => editButton.style.backgroundColor = "transparent"; + editButton.onclick = (e) => { + e.stopPropagation(); + const modal = new EditCategoryModal(plugin.app, plugin, category, (updatedCategory) => { + try { + categoryService.updateCategory(updatedCategory); + saveAllCategoryChanges(plugin, categoryService); + renderSettings(containerEl, plugin); + } catch (error) { + console.error("Error updating category:", error); + } + }); + modal.open(); + }; + const deleteButton = categoryControls.createEl("button"); + deleteButton.title = "Delete category"; + deleteButton.style.background = "none"; + deleteButton.style.border = "none"; + deleteButton.style.cursor = "pointer"; + deleteButton.style.padding = "4px"; + deleteButton.style.display = "flex"; + deleteButton.style.alignItems = "center"; + deleteButton.style.borderRadius = "3px"; + deleteButton.innerHTML = ``; + deleteButton.onmouseenter = () => deleteButton.style.backgroundColor = "var(--background-modifier-hover)"; + deleteButton.onmouseleave = () => deleteButton.style.backgroundColor = "transparent"; + deleteButton.onclick = (e) => { + e.stopPropagation(); + const elementsInCategory = plugin.settings.elements.filter((el) => el.categoryId === category.id); + if (elementsInCategory.length > 0) { + alert(`Cannot delete category '${category.name}' because it contains ${elementsInCategory.length} element(s). Please move or delete these elements first.`); + return; + } + const confirmMessage = category.isCustom ? `Are you sure you want to delete the category '${category.name}'?` : `Are you sure you want to delete the default category '${category.name}'? This action cannot be undone.`; + if (confirm(confirmMessage)) { + try { + categoryService.deleteCategory(category.id); + if (category.isCustom) { + plugin.settings.customCategories = categoryService.getCustomCategories(); + } + plugin.saveSettings(); + renderSettings(containerEl, plugin); + } catch (error) { + console.error("Error deleting category:", error); + if (!category.isCustom) { + alert(`Cannot delete default category: ${error.message}`); + } + } + } + }; + const elementsContainer = categoryContainer.createDiv(); + elementsContainer.addClass("mermaid-tools-elements-container"); + elementsContainer.style.display = "none"; + let isCollapsed = true; + categoryHeader.onclick = () => { + isCollapsed = !isCollapsed; + elementsContainer.style.display = isCollapsed ? "none" : "block"; + expandIcon.style.transform = isCollapsed ? "rotate(-90deg)" : "rotate(0deg)"; + }; + expandIcon.style.transform = "rotate(-90deg)"; + renderCategoryElements(category, plugin, elementsContainer, mermaid, categoryService); + }); +} +function renderCategoryElements(category, plugin, parentEl, mermaid, categoryService) { + const elements = plugin.settings.elements.filter((e) => e.categoryId === category.id).sort((a, b) => a.sortingOrder - b.sortingOrder); + if (elements.length === 0) { + const emptyMessage = parentEl.createDiv(); + emptyMessage.textContent = "No elements in this category"; + emptyMessage.style.color = "var(--text-muted)"; + emptyMessage.style.fontStyle = "italic"; + emptyMessage.style.padding = "10px"; + return; + } + elements.forEach((element, index) => { + const settingContainer = parentEl.createDiv("mermaid-tools-element-container"); + settingContainer.style.marginBottom = "10px"; + settingContainer.style.padding = "10px"; + settingContainer.style.backgroundColor = "var(--background-secondary)"; + settingContainer.style.borderRadius = "5px"; + const setting = new import_obsidian4.Setting(settingContainer); + setting.setName(element.description); + setting.addExtraButton((cb) => { + cb.setIcon("edit").setTooltip("edit element").onClick(() => { + const modal = new EditMermaidElementModal(plugin.app, plugin, mermaid, element, categoryService); + modal.open(); + modal.onClose = () => { + const settingsContainer = parentEl.closest(".vertical-tab-content"); + if (settingsContainer) + renderSettings(settingsContainer, plugin); + }; + }); + }); + setting.addExtraButton((cb) => { + cb.setIcon("copy").setTooltip("create a duplicate of this element").onClick(() => { + const duplicate = { + id: crypto.randomUUID(), + categoryId: element.categoryId, + description: element.description + " (copy)", + content: element.content, + sortingOrder: plugin.settings.elements.filter((el) => el.categoryId === element.categoryId).length, + isPinned: element.isPinned + }; + plugin._mermaidElementService.saveElement(duplicate, plugin); + plugin.saveSettings(); + const settingsContainer = parentEl.closest(".vertical-tab-content"); + if (settingsContainer) + renderSettings(settingsContainer, plugin); + }); + }); + setting.addExtraButton((cb) => { + cb.setIcon("arrow-up").setTooltip("move element up in the sidebar").onClick(() => { + if (index > 0) { + const temp = elements[index - 1].sortingOrder; + elements[index - 1].sortingOrder = element.sortingOrder; + element.sortingOrder = temp; + plugin.settings.elements = plugin.settings.elements.filter((el) => el.categoryId !== category.id).concat(elements); + plugin.saveSettings(); + const settingsContainer = parentEl.closest(".vertical-tab-content"); + if (settingsContainer) + renderSettings(settingsContainer, plugin); + } + }); + }); + setting.addExtraButton((cb) => { + cb.setIcon("arrow-down").setTooltip("move element down in the sidebar").onClick(() => { + if (index < elements.length - 1) { + const temp = elements[index + 1].sortingOrder; + elements[index + 1].sortingOrder = element.sortingOrder; + element.sortingOrder = temp; + plugin.settings.elements = plugin.settings.elements.filter((el) => el.categoryId !== category.id).concat(elements); + plugin.saveSettings(); + const settingsContainer = parentEl.closest(".vertical-tab-content"); + if (settingsContainer) + renderSettings(settingsContainer, plugin); + } + }); + }); + setting.addExtraButton((cb) => { + cb.setIcon("trash-2").setTooltip("delete element").onClick(() => { + plugin.settings.elements = plugin.settings.elements.filter((e) => e.id !== element.id); + plugin.saveSettings(); + const settingsContainer = parentEl.closest(".vertical-tab-content"); + if (settingsContainer) + renderSettings(settingsContainer, plugin); + }); + }); + }); +} + +// src/ui/toolbarView/mermaidToolbarView.ts +var import_obsidian6 = require("obsidian"); + +// src/ui/toolbarView/viewHelpers.ts +var import_obsidian5 = require("obsidian"); +var TOOLBAR_ELEMENT_CLASS_NAME = "mermaid-toolbar-element"; +var TOOLBAR_ELEMENTS_CONTAINER_CLASS_NAME = "mermaid-toolbar-elements-container"; +var TOOLBAR_ELEMENTS_CONTAINER_ID = "mermaid-toolbar-elements-container-id"; +async function createMermaidToolbar(topRowButtons, items, selectedCategoryId, onCategoryChanged, onElementClick, categoryService) { + const container = document.createElement("div"); + const topRow = container.createDiv(); + topRow.addClass("mermaid-toolbar-top-row"); + const elementsContainer = container.createDiv(); + elementsContainer.addClass(TOOLBAR_ELEMENTS_CONTAINER_CLASS_NAME); + elementsContainer.setAttr("id", TOOLBAR_ELEMENTS_CONTAINER_ID); + createDropdown(topRow, elementsContainer, items, selectedCategoryId, onCategoryChanged, onElementClick, categoryService); + createTopRowBtns(topRow, topRowButtons); + await recreateElementsSection(elementsContainer, selectedCategoryId, items, onElementClick, categoryService); + return container; +} +function createTopRowBtns(parentEl, buttons) { + buttons.forEach((btn) => { + const b = new import_obsidian5.ButtonComponent(parentEl).setClass("clickable-icon").setIcon(btn.iconName).setTooltip(btn.tooltip).onClick(btn.callback); + }); +} +function createDropdown(parentEl, elementsContainer, items, selectedCategoryId, onSelectionChanged, onElClick, categoryService) { + const categories = categoryService.getCategories(); + const dropdown = new import_obsidian5.DropdownComponent(parentEl); + categories.forEach((category) => { + dropdown.addOption(category.id, category.name); + }); + dropdown.setValue(selectedCategoryId); + dropdown.onChange((val) => { + onSelectionChanged(val); + recreateElementsSection(elementsContainer, val, items, onElClick, categoryService); + }); +} +async function recreateElementsSection(sectionContainer, categoryId, items, onElClick, categoryService) { + sectionContainer.innerHTML = ""; + const elemService = new MermaidElementService(); + const mermaid = await (0, import_obsidian5.loadMermaid)(); + const filteredSortedItems = items.filter((i) => i.categoryId === categoryId).sort((a, b) => a.sortingOrder - b.sortingOrder); + filteredSortedItems.forEach(async (elem, index) => { + const el = createToolbarElement(sectionContainer); + el.id = `mermaid-toolbar-element-${elem.categoryId}-${index}`; + const diagram = elemService.wrapAsCompleteDiagram(elem); + console.log(mermaid.detectType(diagram)); + const { svg } = await mermaid.render(el.id, diagram); + el.title = elem.description; + el.innerHTML = svg; + el.onclick = (e) => onElClick(elem.content); + sectionContainer.appendChild(el); + }); +} +function createToolbarElement(parentEl) { + const itemEl = parentEl.createEl("pre"); + itemEl.addClass(TOOLBAR_ELEMENT_CLASS_NAME); + return itemEl; +} + +// src/ui/toolbarView/mermaidToolbarButtons.ts +var MermaidToolbarButton = class { + constructor(tooltip, iconName, callback) { + this.tooltip = tooltip; + this.iconName = iconName; + this.callback = callback; + } +}; + +// src/ui/toolbarView/mermaidToolbarView.ts +var _MermaidToolbarView = class extends import_obsidian6.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.topRowButtons = [ + new MermaidToolbarButton("insert Mermaid code block with sample diagram", "code-2", () => this.insertTextAtCursor(this._plugin._mermaidElementService.getSampleDiagram(this._plugin.settings.selectedCategoryId))), + new MermaidToolbarButton("open Mermaid.js documentation web page", "external-link", () => window.open("https://mermaid.js.org/intro/")), + new MermaidToolbarButton("open settings", "settings", () => { + this.app.setting.open(); + this.app.setting.openTabById("mermaid-tools"); + }) + ]; + this._plugin = plugin; + this.items = plugin.settings.elements; + this.categoryService = CategoryService.getInstance(); + this.categoryService.loadCategories(plugin.settings.customCategories, plugin.settings.defaultCategorySortOrders); + this.containerEl.children[1].addClass("mermaid-toolbar-container"); + } + async onOpen() { + await this.recreateToolbar(this._plugin.settings.selectedCategoryId); + } + async onClose() { + } + async recreateToolbar(selectedCategoryId) { + const container = this.containerEl.children[1]; + container.empty(); + const toolbarElement = await createMermaidToolbar(this.topRowButtons, this.items, selectedCategoryId, async (newCategoryId) => { + this._plugin.settings.selectedCategoryId = newCategoryId; + this._plugin.saveSettings(); + await this.recreateToolbar(this._plugin.settings.selectedCategoryId); + }, (text) => this.insertTextAtCursor(text), this.categoryService); + container.appendChild(toolbarElement); + } + insertTextAtCursor(text) { + this._plugin.insertTextAtCursor(text); + } + getViewType() { + return _MermaidToolbarView.VIEW_TYPE; + } + getDisplayText() { + return _MermaidToolbarView.VIEW_DESCRIPTION; + } + getIcon() { + return TRIDENT_ICON_NAME; + } +}; +var MermaidToolbarView = _MermaidToolbarView; +MermaidToolbarView.VIEW_TYPE = "mermaid-toolbar-view"; +MermaidToolbarView.VIEW_DESCRIPTION = "Mermaid Toolbar"; + +// main.ts +var TRIDENT_ICON_NAME = "trident-custom"; +var MermaidPlugin = class extends import_obsidian7.Plugin { + constructor() { + super(...arguments); + this._mermaidElementService = new MermaidElementService(); + this._textEditorService = new TextEditorService(); + } + async onload() { + await this.loadSettings(); + addTridentIcon(); + this.registerView(MermaidToolbarView.VIEW_TYPE, (leaf) => new MermaidToolbarView(leaf, this)); + this.app.workspace.on("active-leaf-change", (leaf) => { + var _a, _b; + this.activeEditor = (_b = (_a = this.app.workspace.activeEditor) == null ? void 0 : _a.editor) != null ? _b : this.activeEditor; + }); + this.addRibbonIcon(TRIDENT_ICON_NAME, "Open Mermaid Toolbar", () => { + this.activateView(); + }); + this.addCommand({ + id: "open-toolbar", + name: "Open Toolbar View", + callback: () => { + this.activateView(); + } + }); + this.addSettingTab(new MermaidToolsSettingsTab(this.app, this)); + } + async onunload() { + this.app.workspace.detachLeavesOfType(MermaidToolbarView.VIEW_TYPE); + } + async loadSettings() { + this.settings = Object.assign({}, MermaidPluginSettings.DefaultSettings(), await this.loadData()); + this.addNewCategories(); + } + addNewCategories() { + if (!this.settings.elements.some((x) => x.categoryId === "mindmap")) { + this.settings.elements.push(...mindMapElements); + console.log("[Mermaid Tools] added Mindmap elements"); + } + if (!this.settings.elements.some((x) => x.categoryId === "timeline")) { + this.settings.elements.push(...timelineElements); + console.log("[Mermaid Tools] added Timeline elements"); + } + if (!this.settings.elements.some((x) => x.categoryId === "quadrantChart")) { + this.settings.elements.push(...quadrantElements); + console.log("[Mermaid Tools] added QuadrantChart elements"); + } + if (!this.settings.elements.some((x) => x.categoryId === "c4Diagram")) { + this.settings.elements.push(...c4DiagramElements); + console.log("[Mermaid Tools] added C4 diagram elements"); + } + if (!this.settings.elements.some((x) => x.categoryId === "packet")) { + this.settings.elements.push(...packetElements); + console.log("[Mermaid Tools] added Packet elements"); + } + if (!this.settings.elements.some((x) => x.categoryId === "kanban")) { + this.settings.elements.push(...kanbanElements); + console.log("[Mermaid Tools] added Kanban elements"); + } + if (!this.settings.elements.some((x) => x.categoryId === "block")) { + this.settings.elements.push(...blockDiagramElements); + console.log("[Mermaid Tools] added Block elements"); + } + if (!this.settings.elements.some((x) => x.categoryId === "architecture")) { + this.settings.elements.push(...architectureElements); + console.log("[Mermaid Tools] added Architecture diagram elements"); + } + } + async saveSettings() { + await this.saveData(this.settings); + await this.activateView(); + } + async activateView() { + var _a; + this.app.workspace.detachLeavesOfType(MermaidToolbarView.VIEW_TYPE); + if (this.app.workspace === null) + return; + await ((_a = this.app.workspace.getRightLeaf(false)) == null ? void 0 : _a.setViewState({ + type: MermaidToolbarView.VIEW_TYPE, + active: true + })); + this.app.workspace.revealLeaf(this.app.workspace.getLeavesOfType(MermaidToolbarView.VIEW_TYPE)[0]); + } + insertTextAtCursor(text) { + this._textEditorService.insertTextAtCursor(this.activeEditor, text); + } +}; + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/mermaid-tools/manifest.json b/.obsidian/plugins/mermaid-tools/manifest.json new file mode 100644 index 0000000..15fc37e --- /dev/null +++ b/.obsidian/plugins/mermaid-tools/manifest.json @@ -0,0 +1,11 @@ +{ + "id": "mermaid-tools", + "name": "Mermaid Tools", + "version": "1.3.0", + "minAppVersion": "1.4.0", + "description": "Improved Mermaid.js experience for Obsidian: visual toolbar with common elements & more", + "author": "dartungar", + "authorUrl": "https://dartungar.com", + "fundingUrl": "https://www.paypal.com/paypalme/dartungar", + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/mermaid-tools/styles.css b/.obsidian/plugins/mermaid-tools/styles.css new file mode 100644 index 0000000..73ce877 --- /dev/null +++ b/.obsidian/plugins/mermaid-tools/styles.css @@ -0,0 +1,149 @@ +.mermaid-toolbar-container, .mermaid-toolbar-container * { + max-width: 100%; + max-height: 100%; +} + +.mermaid-toolbar-top-row { + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 8px; +} + +.mermaid-toolbar-elements-container { + padding-top: 1rem; + display: flex; + flex-direction: row; + flex-wrap: wrap; +} + +.mermaid-toolbar-element { + font-size: var(--font-ui-small); + cursor: pointer; + padding: 2px 2px 2px 5px; + border-radius: 3px; + flex: 1 0 auto; +} + +.mermaid-toolbar-element:hover { + background-color: var(--interactive-hover); +} + +.mermaid-tools-element-category-header::before { + content: "▼ "; + font-size: 70%; + padding-bottom: 2px; +} + +.mermaid-tools-element-category-header.collapsed::before { + content: "▶ "; + font-size: 70%; + padding-bottom: 2px; +} + +.mermaid-tools-element-container { + padding-top: 6px; + border-bottom: var(--border-width) solid var(--color-base-35); +} + +.mermaid-tools-edit-element-modal > div { + margin-bottom: 0.5rem; +} + +.mermaid-tools-edit-element-modal label { + margin-right: 1rem; +} + +/* Custom Category Management Styles */ +.mermaid-tools-category-management { + margin-bottom: 2rem; + padding: 1rem; + border: 1px solid var(--color-base-25); + border-radius: 8px; + background-color: var(--color-base-00); +} + +.mermaid-tools-category-management h3 { + margin-top: 1rem; + margin-bottom: 0.5rem; + color: var(--text-accent); +} + +.mermaid-tools-category-management button.mod-cta { + margin-bottom: 1rem; +} + +/* Edit Category Modal Styles */ +.mermaid-tools-edit-category-modal { + min-width: 500px; +} + +.mermaid-tools-edit-category-modal .setting-item { + padding: 8px 0; + border: none; +} + +.mermaid-tools-edit-category-modal .setting-item-info { + flex-grow: 1; + margin-right: 12px; +} + +.mermaid-tools-edit-category-modal .setting-item-name { + font-weight: 600; + color: var(--text-normal); +} + +.mermaid-tools-edit-category-modal .setting-item-description { + color: var(--text-muted); + font-size: var(--font-ui-smaller); +} + +.mermaid-tools-edit-category-modal input, +.mermaid-tools-edit-category-modal textarea { + width: 100%; + padding: 4px 8px; + border: 1px solid var(--color-base-30); + border-radius: 4px; + background-color: var(--color-base-00); + color: var(--text-normal); +} + +.mermaid-tools-edit-category-modal input:focus, +.mermaid-tools-edit-category-modal textarea:focus { + border-color: var(--color-accent); + outline: none; + box-shadow: 0 0 0 2px var(--color-accent-2); +} + +.modal-button-container { + display: flex; + justify-content: flex-end; + gap: 10px; + margin-top: 20px; + padding-top: 16px; + border-top: 1px solid var(--color-base-25); +} + +.modal-button-container button { + padding: 6px 16px; + border: 1px solid var(--color-base-30); + border-radius: 4px; + background-color: var(--color-base-10); + color: var(--text-normal); + cursor: pointer; + font-size: var(--font-ui-small); +} + +.modal-button-container button:hover { + background-color: var(--color-base-20); +} + +.modal-button-container button.mod-cta { + background-color: var(--color-accent); + color: var(--text-on-accent); + border-color: var(--color-accent); +} + +.modal-button-container button.mod-cta:hover { + background-color: var(--color-accent-hover); +} \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 633bd48..a339da7 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,12 +13,12 @@ "state": { "type": "markdown", "state": { - "file": "部门五月份任务规划.md", - "mode": "preview", + "file": "README.md", + "mode": "source", "source": false }, "icon": "lucide-file", - "title": "部门五月份任务规划" + "title": "README" } } ] @@ -94,6 +94,7 @@ "state": { "type": "backlink", "state": { + "file": "README.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -103,7 +104,7 @@ "unlinkedCollapsed": true }, "icon": "links-coming-in", - "title": "反向链接" + "title": "README 的反向链接列表" } }, { @@ -112,11 +113,12 @@ "state": { "type": "outgoing-link", "state": { + "file": "README.md", "linksCollapsed": false, "unlinkedCollapsed": true }, "icon": "links-going-out", - "title": "出链" + "title": "README 的出链列表" } }, { @@ -154,13 +156,13 @@ "state": { "type": "outline", "state": { - "file": "conflict-files-obsidian-git.md", + "file": "README.md", "followCursor": false, "showSearch": false, "searchQuery": "" }, "icon": "lucide-list", - "title": "conflict-files-obsidian-git 的大纲" + "title": "README 的大纲" } }, { @@ -172,6 +174,16 @@ "icon": "git-pull-request", "title": "Source Control" } + }, + { + "id": "7a3485b22ac1573e", + "type": "leaf", + "state": { + "type": "mermaid-toolbar-view", + "state": {}, + "icon": "trident-custom", + "title": "Mermaid Toolbar" + } } ], "currentTab": 5 @@ -189,14 +201,20 @@ "templates:插入模板": false, "command-palette:打开命令面板": false, "bases:新建数据库": false, + "export-graph-view:Export graph view": false, + "mermaid-tools:Open Mermaid Toolbar": false, "obsidian-git:Open Git source control": false, "pdf-plus:PDF++: Toggle auto-copy": false, "pdf-plus:PDF++: Toggle auto-focus": false, "pdf-plus:PDF++: Toggle auto-paste": false } }, - "active": "2076822cdefbb8a3", + "active": "b0ba3684f585064f", "lastOpenFiles": [ + "未命名.canvas", + "诀别书钢琴谱.pdf", + "动画.gif", + "README.md", "部门五月份任务规划.md", "conflict-files-obsidian-git.md" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..f9c4205 --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +## 项目名称 + +### 姿态传感器 + +## 运行条件 + +> 列出运行该项目所必须的条件和相关依赖 + +* Python==3.14 +* OpenOCD +* CLion +* Arm-none-eabi-gcc + +## 运行说明 + +> 说明如何运行和使用你的项目,建议给出具体的步骤说明 + +1. 下载所有运行条件中提到的文件 +2. + +![[动画.gif]] + +## 测试说明 + +> 如果有测试相关内容需要说明,请填写在这里 + +## 技术架构 + +```mermaid +flowchart TB + +A["Eclipse ThreadX API"] + +subgraph M["ThreadX Services"] +direction LR + +subgraph L[" "] +direction TB +T1["Thread Services"] +T2["Counting Semaphores"] +T3["Event Flags"] +T4["Byte Memory Pools"] +end + +subgraph R[" "] +direction TB +T5["Messaging Queues"] +T6["Mutexes"] +T7["Block Memory Pools"] +T8["Application Timers"] +end + +end + +B["Eclipse ThreadX Core Scheduler"] + +A --> M +M --> B +``` + + + + + +## 协作者 + +> 高效的协作会激发无尽的创造力,将他们的名字记录在这里吧 diff --git a/动画.gif b/动画.gif new file mode 100644 index 0000000..be9d281 Binary files /dev/null and b/动画.gif differ diff --git a/未命名.canvas b/未命名.canvas new file mode 100644 index 0000000..b07e788 --- /dev/null +++ b/未命名.canvas @@ -0,0 +1,8 @@ +{ + "nodes":[], + "edges":[], + "metadata":{ + "version":"1.0-1.0", + "frontmatter":{} + } +} \ No newline at end of file