-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Feature/1893 data flow diagrams #2389
Feature/1893 data flow diagrams #2389
Conversation
Hello and thanks for looking at this issue. Have the possibilities to make data flow diagrams would be great and you have made a good start. One thing to keep in mind is backwards compatibility as we can not risk existing authored diagrams to break. This basically means that the syntax once added can never change so no pressure 😄 I like your idea with the brackets which would allow many shapes, do you mean to combine them as well? I don't think [| and |] to represent datastore nodes of data flow diagrams is the best way to go and once in they are there to stay. I think we should go with your syntax as long as it does not break existing diagrams. The parsing tests are your friendly helper to make sure of that, please add your own as well. It will help you both when working with the grammar and make sure no one else does not break the data flow parsing down the line. Another think to keep in mind is that I will not merge this right now due to the syntax of Note that you can call these lexical elements the same thing DF_RECT_START and DF_RECT_STOP and infer the detail semantics of which of the shapes the start and stop symbols form in the flowDB. This will keep the grammar from exploding. |
Thanks for the feedback 👍
Yes, but I just realized that my current brackets do not allow to stroke just right and bottom sides like this You can use
Another issue may be that
Till now, it renders as but due to my suggestion, it would render as Another idea/solution are bracket-parameters, e.g. with a syntax like this
For example, the letters
Named parameters should be easier to extend, e.g. the same example could be written with named parameters
An extension could be
What do you think? |
Sorry for the slow delay. Thursdays is Mermaid night here :) This looks great! 🚀 I like your last suggestion, go for it! |
@maiermic This looks great, is the PR still active? |
@knsv Yes, I just hadn't the time yet to implement my last suggestion. I'm looking forward to do so. |
This reverts commit cd427ab.
rbSides[|borders:rb| stroke right and bottom sides ]; | ||
ltSides[|borders:lt| stroke left and top sides ]; | ||
lrSides[|borders:lr| stroke left and right sides ]; | ||
noSide[|borders:no| stroke no side ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
works, since the word does not contain any of the border letters ltrb
. It's not a bug, it's a feature 😉
if (node.props?.borders) { | ||
applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight); | ||
propKeys.delete('borders'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More properties may be added here in the future 🙂
src/dagre-wrapper/nodes.js
Outdated
|
||
const propKeys = new Set(Object.keys(node.props)); | ||
if (node.props?.borders) { | ||
applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If properties are handled here in this function, only the required data has to be passed to each property handler (here applyNodePropertyBorders
). I decided to not extract the whole block (handling all properties) as applyNodeProperties
to have access to variables of the current function context (e.g. totalWidth
). I could have passed them (e.g. bbox
), but it is hard to predict, which variables may be of interest to future property handlers (e.g. that do something else than adding borders). I guess, all variables would be passed to applyNodeProperties
in the end.
@knsv I'm confused that the test
fails, since Edit: I should have looked at the console output first. It does not break the sanitization. It's just an error that is thrown, because |
@@ -380,6 +381,8 @@ vertex: idString SQS text SQE | |||
{$$ = $1;yy.addVertex($1,$3,'stadium');} | |||
| idString SUBROUTINESTART text SUBROUTINEEND | |||
{$$ = $1;yy.addVertex($1,$3,'subroutine');} | |||
| idString VERTEX_WITH_PROPS_START ALPHA COLON ALPHA PIPE text SQE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if there is a better token (or rule) than ALPHA
for the identifier and/or value. It does not allow to add a property thick-borders
, but thickBorders
would work. That's fine to me. Further, the rule could be changed in the future if required.
Great to see this PR progressing. Is it ready for another review? |
Yes, it is ready to review |
1 similar comment
Yes, it is ready to review |
Thanks for the PR! |
Thank you for the this! Unfortunately, the implementation is incomplete. flowchart LR Renders as: flowchart LR
p((process))
ds[|borders:tb|ds] --> p
ds2[|borders:tb|ds2] --> p
p --> ds2
Borders has no effect when ds2 is referenced. A problem similar to this is: #3263 I added this to that issue. |
📑 Summary
Support data flow diagrams by adding brackets
[|
and|]
for datastore nodes tograph
, e.g.Resolves #1893
📏 Design Decisions
I extend
graph
as data flow diagrams are graphs in general. However, the same grammar is used forflowchart
, which does not contain such nodes. I use the brackets[|
and|]
as suggested by the author of the issue. However, if other nodes may be added in the future that are rectangles with borders/strokes on specific sides, the|
indicates rather vertical lines than horizontal. We might consider[-
and-]
instead. Actually, we could support all sides using brackets:[|
left, but no top stroke[|-
left and top stroke[-
no left, but top stroke|]
right, but no bottom stroke-|]
right and bottom stroke-]
no right, but bottom strokeHowever, this would be a larger change/extension of the grammar. Hence, I only added one bracket pair, which is sufficient to cover data flow diagrams. What do you think?
📋 Tasks
Make sure you
develop
branchTODO: Add tests when design decisions are final