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