From af2b1945a30d50b27c076b9af61e47e58846e4b4 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Fri, 23 Sep 2022 16:55:30 +0200 Subject: [PATCH] Detector registering itself on load --- .vite/build.ts | 4 + cypress/platform/knsv.html | 68 +---------------- cypress/platform/knsv2.html | 24 ++---- package.json | 18 ++--- .../mermaid-mindmap-detector/package.json | 75 +++++++++++++++++++ .../src/mindmapDetector.ts | 8 ++ .../mermaid-mindmap-detector/src/registry.ts | 18 +++++ .../mermaid-mindmap-detector/tsconfig.json | 9 +++ packages/mermaid-mindmap/src/diagram.ts | 26 +++++++ packages/mermaid-mindmap/src/registry.ts | 25 +++++-- packages/mermaid-mindmap/src/types/index.d.ts | 7 ++ packages/mermaid-mindmap/tsconfig.json | 3 +- packages/mermaid/src/mermaid.ts | 5 +- 13 files changed, 194 insertions(+), 96 deletions(-) create mode 100644 packages/mermaid-mindmap-detector/package.json create mode 100644 packages/mermaid-mindmap-detector/src/mindmapDetector.ts create mode 100644 packages/mermaid-mindmap-detector/src/registry.ts create mode 100644 packages/mermaid-mindmap-detector/tsconfig.json create mode 100644 packages/mermaid-mindmap/src/diagram.ts create mode 100644 packages/mermaid-mindmap/src/types/index.d.ts diff --git a/.vite/build.ts b/.vite/build.ts index d2ce8423d..f842e669a 100644 --- a/.vite/build.ts +++ b/.vite/build.ts @@ -20,6 +20,10 @@ const packageOptions = { }, 'mermaid-mindmap': { name: 'mermaid-mindmap', + file: 'diagram.ts', + }, + 'mermaid-mindmap-detector': { + name: 'mermaid-mindmap-detector', file: 'registry.ts', }, }; diff --git a/cypress/platform/knsv.html b/cypress/platform/knsv.html index a06667c1f..a74dec22b 100644 --- a/cypress/platform/knsv.html +++ b/cypress/platform/knsv.html @@ -165,47 +165,7 @@ graph TD
         info
     
-
-requirementDiagram
-      accTitle: My req Diagram
-      accDescr: My req Diagram Description
 
-    requirement test_req {
-    id: 1
-    text: the test text.
-    risk: high
-    verifymethod: test
-    }
-
-    functionalRequirement test_req2 {
-    id: 1.1
-    text: the second test text.
-    risk: low
-    verifymethod: inspection
-    }
-
-    performanceRequirement test_req3 {
-    id: 1.2
-    text: the third test text.
-    risk: medium
-    verifymethod: demonstration
-    }
-
-    element test_entity {
-    type: simulation
-    }
-
-    element test_entity2 {
-    type: word doc
-    docRef: reqs/test_entity
-    }
-
-
-    test_entity - satisfies -> test_req2
-    test_req - traces -> test_req2
-    test_req - contains -> test_req3
-    test_req <- copies - test_entity2
-    
 gantt
     dateFormat  YYYY-MM-DD
@@ -320,29 +280,7 @@ flowchart TD
       C -->|Two| E[iPhone]
       C -->|Three| F[fa:fa-car Car]
     
-
-        classDiagram
-          Animal "1" <|-- Duck
-          Animal <|-- Fish
-          Animal <--o 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()
-          }
-    
+
         erDiagram
     CAR ||--o{ NAMED-DRIVER : allows
@@ -359,7 +297,9 @@ flowchart TD
     }
     
- + + + +
+        mindmap
+          root
+            ch1
+            ch2
+    
+ +