Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add history nodes to state diagram #5700

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

nimec01
Copy link

@nimec01 nimec01 commented Aug 7, 2024

📑 Summary

This PR adds shallow and deep history nodes to state diagrams. I also updated the docs and added a test case.

Resolves #2901

📏 Design Decisions

Defining a history node works similar to creating a fork or a join. Use <<history>> or <<deephistory>> to mark a state as a history node. You can also use the shorthand variants <<H>> and <<H*>>.

Example:

   stateDiagram-v2
      state "A" as A {
        state "B" as B
        state "C" as C
        state A_History <<history>>

        B --> C
        C --> B
      }
      state "D" as D {
        state "E" as E {
          state "F" as F
          state "G" as G

          F --> G
          G --> F
        }
        state "I" as I
        state D_History <<deephistory>>

        E --> I
        I --> E
      }

      G --> A_History
      A --> D_History

image

📋 Tasks

Make sure you

@github-actions github-actions bot added the Type: Enhancement New feature or request label Aug 7, 2024
Copy link

netlify bot commented Aug 7, 2024

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit e453aea
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/67461b10a7a4910008515c0f
😎 Deploy Preview https://deploy-preview-5700--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 83 lines in your changes missing coverage. Please review.

Project coverage is 4.49%. Comparing base (8328f74) to head (832c538).

Files with missing lines Patch % Lines
...endering-util/rendering-elements/shapes/history.ts 0.00% 61 Missing ⚠️
...id/src/rendering-util/rendering-elements/shapes.ts 0.00% 17 Missing ⚠️
packages/mermaid/src/diagrams/state/styles.js 0.00% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #5700      +/-   ##
==========================================
- Coverage     4.49%   4.49%   -0.01%     
==========================================
  Files          382     383       +1     
  Lines        53914   53997      +83     
  Branches       621     622       +1     
==========================================
  Hits          2425    2425              
- Misses       51489   51572      +83     
Flag Coverage Δ
unit 4.49% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/diagrams/state/styles.js 0.00% <0.00%> (ø)
...id/src/rendering-util/rendering-elements/shapes.ts 0.00% <0.00%> (ø)
...endering-util/rendering-elements/shapes/history.ts 0.00% <0.00%> (ø)

Copy link

argos-ci bot commented Aug 7, 2024

The latest updates on your projects. Learn more about Argos notifications ↗︎

Waiting for the first build to start…

@nimec01 nimec01 force-pushed the feat/2901_state-diagram-history-nodes branch from cba730e to 9b161b6 Compare August 26, 2024 20:49
Copy link

changeset-bot bot commented Aug 26, 2024

🦋 Changeset detected

Latest commit: e453aea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nimec01 nimec01 force-pushed the feat/2901_state-diagram-history-nodes branch from 9b161b6 to 2dbeec2 Compare September 4, 2024 10:25
@nimec01 nimec01 force-pushed the feat/2901_state-diagram-history-nodes branch from 2dbeec2 to 228c987 Compare October 12, 2024 11:34
Copy link

pkg-pr-new bot commented Oct 12, 2024

Open in Stackblitz

npm i https://pkg.pr.new/mermaid-js/mermaid@5700
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-elk@5700
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/mermaid-zenuml@5700
npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/parser@5700

commit: e453aea

@nimec01 nimec01 force-pushed the feat/2901_state-diagram-history-nodes branch from 228c987 to 855de7b Compare October 21, 2024 19:33
@nimec01 nimec01 force-pushed the feat/2901_state-diagram-history-nodes branch from 855de7b to 9c8f5fb Compare November 2, 2024 15:03
@nimec01 nimec01 marked this pull request as draft November 2, 2024 15:18
@nimec01 nimec01 force-pushed the feat/2901_state-diagram-history-nodes branch 2 times, most recently from ba34ed9 to 2f300c5 Compare November 8, 2024 19:07
@nimec01 nimec01 marked this pull request as ready for review November 8, 2024 19:38
@nimec01 nimec01 force-pushed the feat/2901_state-diagram-history-nodes branch from 2f300c5 to 832c538 Compare November 14, 2024 21:30
@nimec01 nimec01 force-pushed the feat/2901_state-diagram-history-nodes branch from 832c538 to e453aea Compare November 26, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

History state in state diagram
1 participant