From 11abfc9ae59bb3ed786b376cbac15388ce7e6a7f Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Tue, 12 Aug 2025 16:08:19 +0200 Subject: [PATCH] Refactor code structure for improved readability and maintainability --- .cspell/mermaid-terms.txt | 1 + cypress/platform/knsv2.html | 86 +++- packages/mermaid-layout-elk/src/render.ts | 95 +++-- packages/mermaid/src/rendering-util/render.ts | 3 + .../rendering-elements/edges.js | 21 - pnpm-lock.yaml | 376 ++++++++++++++++-- 6 files changed, 456 insertions(+), 126 deletions(-) diff --git a/.cspell/mermaid-terms.txt b/.cspell/mermaid-terms.txt index b0cfa0a1d..c61eb4a8d 100644 --- a/.cspell/mermaid-terms.txt +++ b/.cspell/mermaid-terms.txt @@ -7,6 +7,7 @@ catmull compositTitleSize curv doublecircle +elem elems gantt gitgraph diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html index 27b925fa7..d7c705b5b 100644 --- a/cypress/platform/knsv2.html +++ b/cypress/platform/knsv2.html @@ -130,7 +130,35 @@ -
+    
+      ---
+      config:
+        layout: elk
+        flowchart:
+          curve: linear
+      ---
+      flowchart LR
+          D["Use
the
editor"] -- Mermaid js --> I["fa:fa-code Text"] + I --> D & D + D@{ shape: question} + I@{ shape: question} + +
+
+      ---
+      config:
+        layout: elk
+        flowchart:
+          curve: rounded
+      ---
+      flowchart LR
+          I["fa:fa-code Text"] -- Mermaid js --> D["Use
the
editor!"] + I --> D & D + D@{ shape: question} + I@{ shape: question} + +
+
       ---
       config:
         layout: tidy-tree
@@ -153,6 +181,20 @@
           Pen and paper
           Mermaid
 
+    
+
+      ---
+      config:
+        layout: elk
+        flowchart:
+          curve: linear
+      ---
+      flowchart LR
+          A[A] --> B[B]
+          A[A] --- B([C])
+          A@{ shape: diamond}
+          %%B@{ shape: diamond}
+
     
       ---
@@ -268,7 +310,7 @@ config:
       end
       end
     
-
+    
 ---
 config:
   layout: elk
@@ -320,7 +362,7 @@ flowchart LR
     n8@{ shape: rect}
 
     
-
+    
 ---
 config:
   layout: elk
@@ -336,7 +378,7 @@ flowchart LR
 
 
     
-
+    
 ---
 config:
   layout: elk
@@ -345,7 +387,7 @@ flowchart LR
     A{A} --> B & C
 
-
+    
 ---
 config:
   layout: elk
@@ -375,7 +417,7 @@ flowchart LR
 
 
     
-
+    
 ---
 config:
   kanban:
@@ -394,81 +436,81 @@ kanban
     task3[💻 Develop login feature]@{ ticket: 103 }
 
     
-
+    
 flowchart LR
 nA[Default] --> A@{ icon: 'fa:bell', form: 'rounded' }
 
     
-
+    
 flowchart LR
 nA[Style] --> A@{ icon: 'fa:bell', form: 'rounded' }
 style A fill:#f9f,stroke:#333,stroke-width:4px
     
-
+    
 flowchart LR
 nA[Class] --> A@{ icon: 'fa:bell', form: 'rounded' }
 A:::AClass
 classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
     
-
+    
 flowchart LR
   nA[Class] --> A@{ icon: 'logos:aws', form: 'rounded' }
 
     
-
+    
 flowchart LR
 nA[Default] --> A@{ icon: 'fa:bell', form: 'square' }
 
     
-
+    
 flowchart LR
 nA[Style] --> A@{ icon: 'fa:bell', form: 'square' }
 style A fill:#f9f,stroke:#333,stroke-width:4px
     
-
+    
 flowchart LR
 nA[Class] --> A@{ icon: 'fa:bell', form: 'square' }
 A:::AClass
 classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
     
-
+    
 flowchart LR
   nA[Class] --> A@{ icon: 'logos:aws', form: 'square' }
 
     
-
+    
 flowchart LR
 nA[Default] --> A@{ icon: 'fa:bell', form: 'circle' }
 
     
-
+    
 flowchart LR
 nA[Style] --> A@{ icon: 'fa:bell', form: 'circle' }
 style A fill:#f9f,stroke:#333,stroke-width:4px
     
-
+    
 flowchart LR
 nA[Class] --> A@{ icon: 'fa:bell', form: 'circle' }
 A:::AClass
 classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
     
-
+    
 flowchart LR
   nA[Class] --> A@{ icon: 'logos:aws', form: 'circle' }
   A:::AClass
   classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
     
-
+    
 flowchart LR
   nA[Style] --> A@{ icon: 'logos:aws', form: 'circle' }
   style A fill:#f9f,stroke:#333,stroke-width:4px
     
-
+    
 kanban
   id2[In progress]
     docs[Create Blog about the new diagram]@{ priority: 'Very Low', ticket: MC-2037, assigned: 'knsv' }
     
-
+    
 ---
 config:
   kanban:
@@ -497,6 +539,7 @@ kanban