Added attribute data-look to composite and nested states

This commit is contained in:
Per Brolin
2024-06-14 14:45:24 +02:00
parent ccdaa6333e
commit 2f6d728123
6 changed files with 43 additions and 26 deletions

View File

@@ -90,24 +90,23 @@ stateDiagram-v2
> >
<pre id="diagram" class="mermaid"> <pre id="diagram" class="mermaid">
stateDiagram stateDiagram-v2
StateA [*] --> First
state First {
[*] --> second
second --> [*]
}
</pre> </pre>
<pre id="diagram" class="mermaid2"> <pre id="diagram" class="mermaid2">
stateDiagram flowchart LR
direction LR A[Start] --Some text--> B(Continue)
[*] --> A B --> C{Evaluate}
A --> B C -- One --> D[Option 1]
B --> C C -- Two --> E[Option 2]
state B { C -- Three --> F[fa:fa-car Option 3]
direction LR
a --> b
}
B --> D
</pre> </pre>
<script type="module"> <script type="module">
@@ -118,7 +117,7 @@ stateDiagram-v2
console.error('Mermaid error: ', err); console.error('Mermaid error: ', err);
}; };
mermaid.initialize({ mermaid.initialize({
theme: 'neo', theme: 'forest',
handdrawnSeed: 12, handdrawnSeed: 12,
look: 'neo', look: 'neo',
//layout: 'elk', //layout: 'elk',

View File

@@ -91,8 +91,9 @@
<table> <table>
<tr> <tr>
<th></th> <!-- Placeholder for the top left corner --> <th></th> <!-- Placeholder for the top left corner -->
<th>neo-default-light</th> <th>default-light</th>
<th>neo-default-dark</th> <th>neo-neo-light</th>
<th>neo-neo-dark</th>
<th>neo-forest-light</th> <th>neo-forest-light</th>
<th>neo-base-light</th> <th>neo-base-light</th>
</tr> </tr>
@@ -108,6 +109,13 @@
</th> </th>
<td> <td>
<pre id="diagram1" class="mermaid"> <pre id="diagram1" class="mermaid">
%%{init: {"look": "classic", "theme": "default"} }%%
stateDiagram-v2
stateId
</pre>
</td>
<td>
<pre id="diagram1" class="mermaid">
%%{init: {"look": "neo", "theme": "neo"} }%% %%{init: {"look": "neo", "theme": "neo"} }%%
stateDiagram-v2 stateDiagram-v2
stateId stateId
@@ -431,7 +439,6 @@ stateDiagram-v2
<div class="content"> <div class="content">
<div class="pre-scrollable"> <div class="pre-scrollable">
<pre> <pre>
%%{init: {"look": "neo", "theme": "neo"} }%%
[*] --> First [*] --> First
state First { state First {
[*] --> second [*] --> second
@@ -444,7 +451,7 @@ stateDiagram-v2
</th> </th>
<td> <td>
<pre id="diagram1" class="mermaid"> <pre id="diagram1" class="mermaid">
%%{init: {"look": "neo", "theme": "neo"} }%%
stateDiagram-v2 stateDiagram-v2
[*] --> First [*] --> First
state First { state First {

View File

@@ -1,5 +1,8 @@
1. Paddings of node labels for neo and classic does not differ, which it should. Status: Fixed 1. Paddings of node labels for neo and classic does not differ, which it should. Status: Fixed
2. When layout is set to "elk" and look is "neo", the drop shadow is not present 2. When layout is set to "elk" and look is "neo", the drop shadow is not present. Status: Fixed
3. Drop-shadows are not present for flow-charts, even if look is "neo" 3. Drop-shadows are not present for flow-charts, even if look is "neo". Status: Fixed
4. When look is "neo" and theme is "forest", the border of nodes is visible, which should not be the case 4. When look is "neo" and theme is "forest", the border of nodes is visible, which should not be the case: Status: Fixed
5. When look is "neo" and "theme" is "neo", the background color shall be white 5. When look is "neo" and "theme" is "neo", the background color shall be white. Status: Fixed
6. Composite states contains borders in neo. Status: Fixed
7. Nested states contains borders in neo. Status: Fixed
8. The font-size of node labels seems a bit off:

View File

@@ -182,7 +182,8 @@ const roundedWithTitle = (parent, node) => {
.attr('class', node.cssClasses) .attr('class', node.cssClasses)
.attr('id', node.id) .attr('id', node.id)
.attr('data-et', 'node') .attr('data-et', 'node')
.attr('data-id', node.id); .attr('data-id', node.id)
.attr('data-look', node.look);
// add the rect // add the rect
const outerRectG = shapeSvg.insert('g', ':first-child'); const outerRectG = shapeSvg.insert('g', ':first-child');
@@ -269,7 +270,8 @@ const roundedWithTitle = (parent, node) => {
.attr('x', x) .attr('x', x)
.attr('y', y) .attr('y', y)
.attr('width', width) .attr('width', width)
.attr('height', node.height + padding); .attr('height', node.height + padding)
.attr('data-look', node.look);
innerRect innerRect
.attr('class', 'inner') .attr('class', 'inner')
.attr('x', x) .attr('x', x)

View File

@@ -77,6 +77,13 @@ const getStyles = (
stroke: none; stroke: none;
filter: drop-shadow( 1px 2px 2px rgba(185,185,185,1.0) ); filter: drop-shadow( 1px 2px 2px rgba(185,185,185,1.0) );
} }
[data-look="neo"].statediagram-cluster rect {
fill: ${options.compositeTitleBackground};
stroke: none;
stroke-width: 1px;
}
${userStyles} ${userStyles}
`; `;
}; };

View File

@@ -15,8 +15,7 @@ class Theme {
this.background = '#ffffff'; this.background = '#ffffff';
this.primaryColor = '#cccccc'; this.primaryColor = '#cccccc';
//this.mainBkg = '#ffffff'; this.mainBkg = '#ffffff';
this.mainBkg = '#ecedfe';
this.noteBkgColor = '#fff5ad'; this.noteBkgColor = '#fff5ad';
this.noteTextColor = '#333'; this.noteTextColor = '#333';