mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-09 02:27:05 +02:00
chore: Cleanup flowDB
This commit is contained in:
@@ -729,14 +729,12 @@ export const destructLink = (_str: string, _startStr: string) => {
|
||||
|
||||
// Todo optimizer this by caching existing nodes
|
||||
const exists = (allSgs: FlowSubGraph[], _id: string) => {
|
||||
let res = false;
|
||||
allSgs.forEach((sg) => {
|
||||
const pos = sg.nodes.indexOf(_id);
|
||||
if (pos >= 0) {
|
||||
res = true;
|
||||
for (const sg of allSgs) {
|
||||
if (sg.nodes.indexOf(_id) >= 0) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Deletes an id from all subgraphs
|
||||
@@ -830,14 +828,11 @@ function getCompiledStyles(classDefs: string[]) {
|
||||
let compiledStyles: string[] = [];
|
||||
for (const customClass of classDefs) {
|
||||
const cssClass = classes.get(customClass);
|
||||
// log.debug('IPI cssClass in flowDb', cssClass);
|
||||
if (cssClass) {
|
||||
if (cssClass.styles) {
|
||||
compiledStyles = [...compiledStyles, ...(cssClass.styles ?? [])].map((s) => s.trim());
|
||||
}
|
||||
if (cssClass.textStyles) {
|
||||
compiledStyles = [...compiledStyles, ...(cssClass.textStyles ?? [])].map((s) => s.trim());
|
||||
}
|
||||
if (cssClass?.styles) {
|
||||
compiledStyles = [...compiledStyles, ...(cssClass.styles ?? [])].map((s) => s.trim());
|
||||
}
|
||||
if (cssClass?.textStyles) {
|
||||
compiledStyles = [...compiledStyles, ...(cssClass.textStyles ?? [])].map((s) => s.trim());
|
||||
}
|
||||
}
|
||||
return compiledStyles;
|
||||
@@ -858,9 +853,9 @@ export const getData = () => {
|
||||
if (subGraph.nodes.length > 0) {
|
||||
subGraphDB.set(subGraph.id, true);
|
||||
}
|
||||
subGraph.nodes.forEach((id) => {
|
||||
for (const id of subGraph.nodes) {
|
||||
parentDB.set(id, subGraph.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Data is setup, add the nodes
|
||||
@@ -917,8 +912,6 @@ export const getData = () => {
|
||||
edges.push(edge);
|
||||
});
|
||||
|
||||
// log.debug('IPI nodes', JSON.stringify(nodes, null, 2));
|
||||
|
||||
return { nodes, edges, other: {}, config };
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user