mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
68.69k stars 6.07k forks source link

feat(state): add from, to ids for edge #5503

Closed igorwessel closed 1 month ago

igorwessel commented 1 month ago

:bookmark_tabs: Summary

The ID of the from-to relationship was added to the diagram's edges. Another denominator "_" was used to make the extraction of these respective IDs easier.

Captura de Tela 2024-05-04 às 06 26 26

:straight_ruler: Design Decisions

I am currently working on converting state diagram to Excalidraw, and I felt the need to have an easier way to find the edges.

I tried some alternative paths but without success, for example:

  1. Manually tracking each edge, and using it as an index to search in .edgePaths, however, the index does not always reflect how we iterate through the parser.doc.
  2. Using the respective graphCount id to get the edge, but in cases where we have multiple relationships for the same state, it may not find the correct edge because we do not have access to the graphCount in the parser.doc, only to the node id.

:clipboard: Tasks

Make sure you

netlify[bot] commented 1 month ago

Deploy Preview for mermaid-js ready!

Name Link
Latest commit da150e8767eab63ef9e95be73a6696f34ffca161
Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/6638ba5d184fe10008ebd40c
Deploy Preview https://deploy-preview-5503--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.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 4.54545% with 42 lines in your changes are missing coverage. Please review.

Project coverage is 5.73%. Comparing base (e68125e) to head (da150e8).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503/graphs/tree.svg?width=650&height=150&src=pr&token=BaET4V1BdM&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js)](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) ```diff @@ Coverage Diff @@ ## develop #5503 +/- ## ======================================= Coverage 5.73% 5.73% ======================================= Files 277 277 Lines 41999 42033 +34 Branches 515 515 ======================================= + Hits 2407 2409 +2 - Misses 39592 39624 +32 ``` | [Flag](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) | Coverage Δ | | |---|---|---| | [unit](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) | `5.73% <4.54%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) | Coverage Δ | | |---|---|---| | [...ges/mermaid/src/diagrams/class/classRenderer-v2.ts](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503?src=pr&el=tree&filepath=packages%2Fmermaid%2Fsrc%2Fdiagrams%2Fclass%2FclassRenderer-v2.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js#diff-cGFja2FnZXMvbWVybWFpZC9zcmMvZGlhZ3JhbXMvY2xhc3MvY2xhc3NSZW5kZXJlci12Mi50cw==) | `0.00% <0.00%> (ø)` | | | [...ges/mermaid/src/diagrams/flowchart/flowRenderer.js](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503?src=pr&el=tree&filepath=packages%2Fmermaid%2Fsrc%2Fdiagrams%2Fflowchart%2FflowRenderer.js&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js#diff-cGFja2FnZXMvbWVybWFpZC9zcmMvZGlhZ3JhbXMvZmxvd2NoYXJ0L2Zsb3dSZW5kZXJlci5qcw==) | `0.00% <0.00%> (ø)` | | | [.../mermaid/src/diagrams/flowchart/flowRenderer-v2.js](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503?src=pr&el=tree&filepath=packages%2Fmermaid%2Fsrc%2Fdiagrams%2Fflowchart%2FflowRenderer-v2.js&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js#diff-cGFja2FnZXMvbWVybWFpZC9zcmMvZGlhZ3JhbXMvZmxvd2NoYXJ0L2Zsb3dSZW5kZXJlci12Mi5qcw==) | `0.00% <0.00%> (ø)` | | | [...ges/mermaid/src/diagrams/state/stateRenderer-v2.js](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503?src=pr&el=tree&filepath=packages%2Fmermaid%2Fsrc%2Fdiagrams%2Fstate%2FstateRenderer-v2.js&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js#diff-cGFja2FnZXMvbWVybWFpZC9zcmMvZGlhZ3JhbXMvc3RhdGUvc3RhdGVSZW5kZXJlci12Mi5qcw==) | `0.00% <0.00%> (ø)` | | | [packages/mermaid/src/utils.ts](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5503?src=pr&el=tree&filepath=packages%2Fmermaid%2Fsrc%2Futils.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js#diff-cGFja2FnZXMvbWVybWFpZC9zcmMvdXRpbHMudHM=) | `41.60% <12.50%> (-0.51%)` | :arrow_down: |
mermaid-bot[bot] commented 1 month ago

@igorwessel, Thank you for the contribution! You are now eligible for a year of Premium account on MermaidChart. Sign up with your GitHub account to activate.

igorwessel commented 1 month ago

@sidharthv96 could we include it in a minor release? I can do a double-check and look to see if any breaking changes were introduced.

sidharthv96 commented 1 month ago

Current develop has breaking changes, slotted for v11. So we'll have to extract your changes and rebase onto master to make a new release. We are only doing v10 security releases now.