Skip to content

Commit

Permalink
Fix 0xa0 bug for nodes, and update demo 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 committed Aug 4, 2024
1 parent 81ce8a8 commit 781f67a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 40 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ For server side rendering, the `"server_side_graphviz"` feature needs to be pass
- [ ] Link to gist

[demo_1]: https://azriel.im/dot_ix/
[demo_2]: https://azriel.im/dot_ix/#src=LQhQBMEsCcFMGMAukD2A7AXAAgG62svAIYA2oAFpPkdPOQJ4ahZZEDuAzkyy+xwPoBzEigBGpbj16chI8SX6QiAW37QUJWP1GwiaDolIBrbAG8AvsymsZwsaUUq1GrZH2G08WGctS+a2EFUTCs-GTgg9H4cAAd4SWsbAQjg6Lj+IgTEpIDItDT4DP4OchpYcGKAV1E0WEQfUOz-FKjYwqJ+cFgcKpq6huyeZsDUtqKY9QqOatr6rAtGsOSR1vTRLMThvILtTu7e2YHBnJb8sdF+CZQpmf753ybwlbP0+MXrLdHXvZ7pvrmFscTs8doUrjd-g1QGhrlo0CpYFwrHxsAAiACCyiIAC90FgAOqwURYADK+BwkC8HFRyNscgkWFRAB5RAA+ADi9JIWAASoiUJVaIimQB6NmM2kCOzyRyqdSabS6dzGNEASXRAFleS4adIpVzZc4FW4DHovGrNdrNLrgXk0SzWXy8qRefzBVTReKbZ9VvFGQA1AAKAGFvU9tmNMoyncEsOiw8sI+kOiUyhDDoyABQk0pwcAASlJt0QCdyX3aPwOd1RmYAIgBRf2FknF0unHYdcFVuY1wM8gDytebrclZd92jRMbxACE2yDzpW-hmaw2m0X-nOk4ULl2l9XM33B8ON6P22M-aip2gsKHT-Pvl1fsW0XXG8fZpvy-wwZNuy-D0O64fqA0KwnsHDwEiLAGLAMT8AAjGiABibjgFgoiVIIpbSg4Shyi4ip6KaJAmIyfDALAJBEAYlI6ERhgkcAHDkpSsDAPKsDYQ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RNyaXEaTbdYSJnaG0ZCQJACtqaB06I7QExA-DBLgBQGM8o7xJmwrcIIPt6aUTvCZEyDp-rECWNKHo78hiU30EoiINg7wBSIFMbUM9IgL1XpQDeqQjQ4AhPdFoPpAoYjSK-QKIUQgnkxF3fu2ph7j0DP0ee7ABh0AWMSHeh9cHn0IcQEh+VkjalAZ-aB-98rTgdPwyBv9lRwMmrVgcvdB7IDeqPe2-xp950IdCeAT9zxAPPAg-RxjMHT0GIw1gDgVFf63sqPetw6GjEIfE8h21+dIykd49Ryh6w8NqaU1qoppxi48BBlI4KfGoMMYDREk9smU2iBIJURTUhUMyafXJ9CdmHOGZnaxoJomOPEZVRytVJn1O0yjh04LOmiVMMZRFnFrCwu1Ni6QxWhc7iFKSxahL6Xiz+coVwmLOWgA
13 changes: 10 additions & 3 deletions crate/rt/src/into_graphviz_dot_src/info_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ fn node_cluster_internal(
})
.unwrap_or_default();

// Note: There's no space between `{node_tailwind_classes}{node_tag_classes}`
// because for some reason spaces before `{node_tag_classes}` are translated
// into the `0xa0` byte.
//
// Same thing happens for `{edge_tag_classes}`
if node_hierarchy.is_empty() {
match graph_style {
GraphStyle::Box => writedoc!(
Expand All @@ -472,7 +477,7 @@ fn node_cluster_internal(
</tr>
{node_desc}
</table>>
class = "{node_tailwind_classes} {node_tag_classes}"
class = "{node_tailwind_classes}{node_tag_classes}"
]
"#
)?,
Expand All @@ -498,7 +503,7 @@ fn node_cluster_internal(
{node_id} [
label = ""
class = "{node_tailwind_classes} {node_tag_classes}"
class = "{node_tailwind_classes}{node_tag_classes}"
{margin}
]
{node_id}_text [
Expand Down Expand Up @@ -540,7 +545,7 @@ fn node_cluster_internal(
{node_desc}
</table>>
style = "filled,rounded"
class = "{node_tailwind_classes} {node_tag_classes}"
class = "{node_tailwind_classes}{node_tag_classes}"
"#
)?;

Expand Down Expand Up @@ -705,6 +710,8 @@ fn edge(edge_args: EdgeArgs<'_>) -> String {
// Note: There's no space between `{edge_tailwind_classes}{edge_tag_classes}`
// because for some reason spaces before `{edge_tag_classes}` are translated
// into the `0xa0` byte.
//
// Same thing happens for `{node_tag_classes}`
formatdoc!(
r#"
{edge_src_node_id} -> {edge_target_node_id} [
Expand Down
73 changes: 37 additions & 36 deletions playground/src/app/info_graph_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,43 @@ tag_items:
tag_step_4: [iam_policy, iam_role, instance_profile, github_app_zip, app_download, app_download__s3_object, s3_object, app_extract, app_download__app_extract]
tag_step_5: [iam_policy, iam_role, instance_profile, github_app_zip, app_download, app_download__s3_object, s3_object, app_extract]

common_styles: # not part of `info_graph`, but it ignores unknown keys
selected_outline: &selected_outline
outline_color: red
outline_style: dashed
outline_width: '1'
outline_shade: '600'

node_blue_progress: &node_blue_progress
<<: *selected_outline
shape_color: blue
stroke_shade: '600'
stroke_style: "dasharray:0.5,3,0.5,3,0.5,3,0.5,3,6,3,12,30"
stroke_width: '[2px]'
fill_shade: '200'
extra: |-
[&>ellipse]:[stroke-linecap:round]
[&>ellipse]:animate-[ellipse-spin_1.5s_linear_infinite]
node_completed: &node_completed
shape_color: green
stroke_shade: '600'
stroke_style: 'solid'
stroke_width: '[2px]'
fill_shade: '200'

edge_blue_animated: &edge_blue_animated
shape_color: blue
stroke_style: dashed # shorthand for [&>path]:[stroke-dasharray:3]
stroke_width: '[2px]'
stroke_shade_normal: '600'
fill_shade_normal: '500'
extra: >-
[&>path]:animate-[stroke-dashoffset-move_2s_linear_infinite]
[&>path]:visible
[&>polygon]:visible
# We always use the `focus` pseudo class.
#
# There are other pseudo classes, but it doesn't appear useful enough for most of those to be
Expand Down Expand Up @@ -225,39 +262,3 @@ css: >-
0% { stroke-dashoffset: 0; }
100% { stroke-dashoffset: -248; }
}
common_styles: # not part of `info_graph`, but it ignores unknown keys
selected_outline: &selected_outline
outline_color: red
outline_style: dashed
outline_width: '1'
outline_shade: '600'

node_blue_progress: &node_blue_progress
<<: *selected_outline
shape_color: blue
stroke_shade: '600'
stroke_style: "dasharray:0.5,3,0.5,3,0.5,3,0.5,3,6,3,12,30"
stroke_width: '[2px]'
fill_shade: '200'
extra: |-
[&>ellipse]:[stroke-linecap:round]
[&>ellipse]:animate-[ellipse-spin_1.5s_linear_infinite]
node_completed: &node_completed
shape_color: green
stroke_shade: '600'
stroke_style: 'solid'
stroke_width: '[2px]'
fill_shade: '200'

edge_blue_animated: &edge_blue_animated
shape_color: blue
stroke_style: dashed # shorthand for [&>path]:[stroke-dasharray:3]
stroke_width: '[2px]'
stroke_shade_normal: '600'
fill_shade_normal: '500'
extra: >-
[&>path]:animate-[stroke-dashoffset-move_2s_linear_infinite]
[&>path]:visible
[&>polygon]:visible

0 comments on commit 781f67a

Please sign in to comment.