From dd89a286ba2c0175dc5cae5ebed7f6dca6503a0f Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sat, 14 Sep 2024 17:33:46 -0600 Subject: [PATCH 1/3] d2render: pill-shaped connection label fills --- d2renderers/d2sketch/sketch_test.go | 21 + .../connection-style-fill/sketch.exp.svg | 119 ++++ d2renderers/d2svg/d2svg.go | 5 +- .../dagre/board.exp.json | 638 ++++++++++++++++++ .../dagre/sketch.exp.svg | 111 +++ .../connection-style-fill/elk/board.exp.json | 638 ++++++++++++++++++ .../connection-style-fill/elk/sketch.exp.svg | 111 +++ e2etests/txtar.txt | 18 + 8 files changed, 1659 insertions(+), 2 deletions(-) create mode 100644 d2renderers/d2sketch/testdata/connection-style-fill/sketch.exp.svg create mode 100644 e2etests/testdata/txtar/connection-style-fill/dagre/board.exp.json create mode 100644 e2etests/testdata/txtar/connection-style-fill/dagre/sketch.exp.svg create mode 100644 e2etests/testdata/txtar/connection-style-fill/elk/board.exp.json create mode 100644 e2etests/testdata/txtar/connection-style-fill/elk/sketch.exp.svg diff --git a/d2renderers/d2sketch/sketch_test.go b/d2renderers/d2sketch/sketch_test.go index d0067b8d5..4f68d3843 100644 --- a/d2renderers/d2sketch/sketch_test.go +++ b/d2renderers/d2sketch/sketch_test.go @@ -1323,6 +1323,27 @@ C <-> D: triangle { } }`, }, + { + name: "connection-style-fill", + script: ` +shape: sequence_diagram +customer +employee +rental +item + +(* -> *)[*].style.fill: black +(* -> *)[*].style.font-color: white + +customer -> employee: "rent(this, i, p)" +employee -> rental: "new(this, i, p)" +rental -> employee +employee -> rental: isValid() +rental -> item: isRentable(c) +item -> customer: is(Adult) +customer -> item: true +`, + }, } runa(t, tcs) } diff --git a/d2renderers/d2sketch/testdata/connection-style-fill/sketch.exp.svg b/d2renderers/d2sketch/testdata/connection-style-fill/sketch.exp.svg new file mode 100644 index 000000000..934a42400 --- /dev/null +++ b/d2renderers/d2sketch/testdata/connection-style-fill/sketch.exp.svg @@ -0,0 +1,119 @@ + + + + + + + + +customeremployeerentalitem rent(this, i, p) new(this, i, p) isValid() isRentable(c) is(Adult) true + + + + + + + + + + + + \ No newline at end of file diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 9360c3eed..5f1c6c49f 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -623,8 +623,9 @@ func drawConnection(writer io.Writer, labelMaskID string, connection d2target.Co } if connection.Fill != color.Empty { rectEl := d2themes.NewThemableElement("rect") - rectEl.X, rectEl.Y = labelTL.X, labelTL.Y - rectEl.Width, rectEl.Height = float64(connection.LabelWidth), float64(connection.LabelHeight) + rectEl.Rx = 999 + rectEl.X, rectEl.Y = labelTL.X-4, labelTL.Y-2 + rectEl.Width, rectEl.Height = float64(connection.LabelWidth)+8, float64(connection.LabelHeight)+4 rectEl.Fill = connection.Fill fmt.Fprint(writer, rectEl.Render()) } diff --git a/e2etests/testdata/txtar/connection-style-fill/dagre/board.exp.json b/e2etests/testdata/txtar/connection-style-fill/dagre/board.exp.json new file mode 100644 index 000000000..6709ac240 --- /dev/null +++ b/e2etests/testdata/txtar/connection-style-fill/dagre/board.exp.json @@ -0,0 +1,638 @@ +{ + "name": "", + "isFolderOnly": false, + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "customer", + "type": "rectangle", + "pos": { + "x": 12, + "y": 52 + }, + "width": 109, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "customer", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 64, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "employee", + "type": "rectangle", + "pos": { + "x": 171, + "y": 52 + }, + "width": 112, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "employee", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 67, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "rental", + "type": "rectangle", + "pos": { + "x": 327, + "y": 52 + }, + "width": 100, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "rental", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 39, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "item", + "type": "rectangle", + "pos": { + "x": 477, + "y": 52 + }, + "width": 100, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "item", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 30, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(customer -> employee)[0]", + "src": "customer", + "srcArrow": "none", + "dst": "employee", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "rent(this, i, p)", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 86, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 66.5, + "y": 198 + }, + { + "x": 227, + "y": 198 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(employee -> rental)[0]", + "src": "employee", + "srcArrow": "none", + "dst": "rental", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "new(this, i, p)", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 87, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 227, + "y": 288 + }, + { + "x": 377, + "y": 288 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(rental -> employee)[0]", + "src": "rental", + "srcArrow": "none", + "dst": "employee", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 377, + "y": 368 + }, + { + "x": 227, + "y": 368 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(employee -> rental)[1]", + "src": "employee", + "srcArrow": "none", + "dst": "rental", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "isValid()", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 52, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 227, + "y": 448 + }, + { + "x": 377, + "y": 448 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(rental -> item)[0]", + "src": "rental", + "srcArrow": "none", + "dst": "item", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "isRentable(c)", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 85, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 377, + "y": 538 + }, + { + "x": 527, + "y": 538 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(item -> customer)[0]", + "src": "item", + "srcArrow": "none", + "dst": "customer", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "is(Adult)", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 54, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 527, + "y": 628 + }, + { + "x": 66.5, + "y": 628 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(customer -> item)[0]", + "src": "customer", + "srcArrow": "none", + "dst": "item", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "true", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 28, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 66.5, + "y": 718 + }, + { + "x": 527, + "y": 718 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(customer -- )[0]", + "src": "customer", + "srcArrow": "none", + "dst": "customer-lifeline-end-1038758816", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 66.5, + "y": 118 + }, + { + "x": 66.5, + "y": 788 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(employee -- )[0]", + "src": "employee", + "srcArrow": "none", + "dst": "employee-lifeline-end-1493022808", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 227, + "y": 118 + }, + { + "x": 227, + "y": 788 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(rental -- )[0]", + "src": "rental", + "srcArrow": "none", + "dst": "rental-lifeline-end-580282478", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 377, + "y": 118 + }, + { + "x": 377, + "y": 788 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(item -- )[0]", + "src": "item", + "srcArrow": "none", + "dst": "item-lifeline-end-4102336625", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 527, + "y": 118 + }, + { + "x": 527, + "y": 788 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + } + ], + "root": { + "id": "", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 0, + "height": 0, + "opacity": 0, + "strokeDash": 0, + "strokeWidth": 0, + "borderRadius": 0, + "fill": "N7", + "stroke": "", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 0 + } +} diff --git a/e2etests/testdata/txtar/connection-style-fill/dagre/sketch.exp.svg b/e2etests/testdata/txtar/connection-style-fill/dagre/sketch.exp.svg new file mode 100644 index 000000000..8038c7984 --- /dev/null +++ b/e2etests/testdata/txtar/connection-style-fill/dagre/sketch.exp.svg @@ -0,0 +1,111 @@ +customeremployeerentalitem rent(this, i, p)new(this, i, p)isValid()isRentable(c)is(Adult)true + + + + + + + + + + + + \ No newline at end of file diff --git a/e2etests/testdata/txtar/connection-style-fill/elk/board.exp.json b/e2etests/testdata/txtar/connection-style-fill/elk/board.exp.json new file mode 100644 index 000000000..6709ac240 --- /dev/null +++ b/e2etests/testdata/txtar/connection-style-fill/elk/board.exp.json @@ -0,0 +1,638 @@ +{ + "name": "", + "isFolderOnly": false, + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "customer", + "type": "rectangle", + "pos": { + "x": 12, + "y": 52 + }, + "width": 109, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "customer", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 64, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "employee", + "type": "rectangle", + "pos": { + "x": 171, + "y": 52 + }, + "width": 112, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "employee", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 67, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "rental", + "type": "rectangle", + "pos": { + "x": 327, + "y": 52 + }, + "width": 100, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "rental", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 39, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "item", + "type": "rectangle", + "pos": { + "x": 477, + "y": 52 + }, + "width": 100, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "item", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 30, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(customer -> employee)[0]", + "src": "customer", + "srcArrow": "none", + "dst": "employee", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "rent(this, i, p)", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 86, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 66.5, + "y": 198 + }, + { + "x": 227, + "y": 198 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(employee -> rental)[0]", + "src": "employee", + "srcArrow": "none", + "dst": "rental", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "new(this, i, p)", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 87, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 227, + "y": 288 + }, + { + "x": 377, + "y": 288 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(rental -> employee)[0]", + "src": "rental", + "srcArrow": "none", + "dst": "employee", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 377, + "y": 368 + }, + { + "x": 227, + "y": 368 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(employee -> rental)[1]", + "src": "employee", + "srcArrow": "none", + "dst": "rental", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "isValid()", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 52, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 227, + "y": 448 + }, + { + "x": 377, + "y": 448 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(rental -> item)[0]", + "src": "rental", + "srcArrow": "none", + "dst": "item", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "isRentable(c)", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 85, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 377, + "y": 538 + }, + { + "x": 527, + "y": 538 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(item -> customer)[0]", + "src": "item", + "srcArrow": "none", + "dst": "customer", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "is(Adult)", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 54, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 527, + "y": 628 + }, + { + "x": 66.5, + "y": 628 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(customer -> item)[0]", + "src": "customer", + "srcArrow": "none", + "dst": "item", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "true", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 28, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 66.5, + "y": 718 + }, + { + "x": 527, + "y": 718 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(customer -- )[0]", + "src": "customer", + "srcArrow": "none", + "dst": "customer-lifeline-end-1038758816", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 66.5, + "y": 118 + }, + { + "x": 66.5, + "y": 788 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(employee -- )[0]", + "src": "employee", + "srcArrow": "none", + "dst": "employee-lifeline-end-1493022808", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 227, + "y": 118 + }, + { + "x": 227, + "y": 788 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(rental -- )[0]", + "src": "rental", + "srcArrow": "none", + "dst": "rental-lifeline-end-580282478", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 377, + "y": 118 + }, + { + "x": 377, + "y": 788 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(item -- )[0]", + "src": "item", + "srcArrow": "none", + "dst": "item-lifeline-end-4102336625", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 527, + "y": 118 + }, + { + "x": 527, + "y": 788 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + } + ], + "root": { + "id": "", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 0, + "height": 0, + "opacity": 0, + "strokeDash": 0, + "strokeWidth": 0, + "borderRadius": 0, + "fill": "N7", + "stroke": "", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 0 + } +} diff --git a/e2etests/testdata/txtar/connection-style-fill/elk/sketch.exp.svg b/e2etests/testdata/txtar/connection-style-fill/elk/sketch.exp.svg new file mode 100644 index 000000000..8038c7984 --- /dev/null +++ b/e2etests/testdata/txtar/connection-style-fill/elk/sketch.exp.svg @@ -0,0 +1,111 @@ +customeremployeerentalitem rent(this, i, p)new(this, i, p)isValid()isRentable(c)is(Adult)true + + + + + + + + + + + + \ No newline at end of file diff --git a/e2etests/txtar.txt b/e2etests/txtar.txt index 41a1a2fbe..0481256df 100644 --- a/e2etests/txtar.txt +++ b/e2etests/txtar.txt @@ -378,3 +378,21 @@ D: "Alignment\nOf\nAlignment\nOf"{ RightAligned Justified } + +-- connection-style-fill -- +shape: sequence_diagram +customer +employee +rental +item + +(* -> *)[*].style.fill: black +(* -> *)[*].style.font-color: white + +customer -> employee: "rent(this, i, p)" +employee -> rental: "new(this, i, p)" +rental -> employee +employee -> rental: isValid() +rental -> item: isRentable(c) +item -> customer: is(Adult) +customer -> item: true From b925148a73758940884fccd45e7d3e5f388211ec Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sat, 14 Sep 2024 17:38:47 -0600 Subject: [PATCH 2/3] ta --- .../connection-style-fill/sketch.exp.svg | 180 +++++------ d2renderers/d2svg/d2svg.go | 6 +- .../stable/font_sizes/dagre/sketch.exp.svg | 2 +- .../stable/font_sizes/elk/sketch.exp.svg | 2 +- .../stable/nesting_power/dagre/sketch.exp.svg | 2 +- .../stable/nesting_power/elk/sketch.exp.svg | 2 +- .../stable/stylish/dagre/sketch.exp.svg | 2 +- .../stable/stylish/elk/sketch.exp.svg | 2 +- .../dagre/board.exp.json | 284 ++++++++++++++++-- .../dagre/sketch.exp.svg | 186 ++++++------ .../connection-style-fill/elk/board.exp.json | 284 ++++++++++++++++-- .../connection-style-fill/elk/sketch.exp.svg | 186 ++++++------ e2etests/txtar.txt | 6 + 13 files changed, 815 insertions(+), 329 deletions(-) diff --git a/d2renderers/d2sketch/testdata/connection-style-fill/sketch.exp.svg b/d2renderers/d2sketch/testdata/connection-style-fill/sketch.exp.svg index 934a42400..0f3a0ed88 100644 --- a/d2renderers/d2sketch/testdata/connection-style-fill/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/connection-style-fill/sketch.exp.svg @@ -1,16 +1,16 @@ - + .d2-2681167429 .fill-N1{fill:#0A0F25;} + .d2-2681167429 .fill-N2{fill:#676C7E;} + .d2-2681167429 .fill-N3{fill:#9499AB;} + .d2-2681167429 .fill-N4{fill:#CFD2DD;} + .d2-2681167429 .fill-N5{fill:#DEE1EB;} + .d2-2681167429 .fill-N6{fill:#EEF1F8;} + .d2-2681167429 .fill-N7{fill:#FFFFFF;} + .d2-2681167429 .fill-B1{fill:#0D32B2;} + .d2-2681167429 .fill-B2{fill:#0D32B2;} + .d2-2681167429 .fill-B3{fill:#E3E9FD;} + .d2-2681167429 .fill-B4{fill:#E3E9FD;} + .d2-2681167429 .fill-B5{fill:#EDF0FD;} + .d2-2681167429 .fill-B6{fill:#F7F8FE;} + .d2-2681167429 .fill-AA2{fill:#4A6FF3;} + .d2-2681167429 .fill-AA4{fill:#EDF0FD;} + .d2-2681167429 .fill-AA5{fill:#F7F8FE;} + .d2-2681167429 .fill-AB4{fill:#EDF0FD;} + .d2-2681167429 .fill-AB5{fill:#F7F8FE;} + .d2-2681167429 .stroke-N1{stroke:#0A0F25;} + .d2-2681167429 .stroke-N2{stroke:#676C7E;} + .d2-2681167429 .stroke-N3{stroke:#9499AB;} + .d2-2681167429 .stroke-N4{stroke:#CFD2DD;} + .d2-2681167429 .stroke-N5{stroke:#DEE1EB;} + .d2-2681167429 .stroke-N6{stroke:#EEF1F8;} + .d2-2681167429 .stroke-N7{stroke:#FFFFFF;} + .d2-2681167429 .stroke-B1{stroke:#0D32B2;} + .d2-2681167429 .stroke-B2{stroke:#0D32B2;} + .d2-2681167429 .stroke-B3{stroke:#E3E9FD;} + .d2-2681167429 .stroke-B4{stroke:#E3E9FD;} + .d2-2681167429 .stroke-B5{stroke:#EDF0FD;} + .d2-2681167429 .stroke-B6{stroke:#F7F8FE;} + .d2-2681167429 .stroke-AA2{stroke:#4A6FF3;} + .d2-2681167429 .stroke-AA4{stroke:#EDF0FD;} + .d2-2681167429 .stroke-AA5{stroke:#F7F8FE;} + .d2-2681167429 .stroke-AB4{stroke:#EDF0FD;} + .d2-2681167429 .stroke-AB5{stroke:#F7F8FE;} + .d2-2681167429 .background-color-N1{background-color:#0A0F25;} + .d2-2681167429 .background-color-N2{background-color:#676C7E;} + .d2-2681167429 .background-color-N3{background-color:#9499AB;} + .d2-2681167429 .background-color-N4{background-color:#CFD2DD;} + .d2-2681167429 .background-color-N5{background-color:#DEE1EB;} + .d2-2681167429 .background-color-N6{background-color:#EEF1F8;} + .d2-2681167429 .background-color-N7{background-color:#FFFFFF;} + .d2-2681167429 .background-color-B1{background-color:#0D32B2;} + .d2-2681167429 .background-color-B2{background-color:#0D32B2;} + .d2-2681167429 .background-color-B3{background-color:#E3E9FD;} + .d2-2681167429 .background-color-B4{background-color:#E3E9FD;} + .d2-2681167429 .background-color-B5{background-color:#EDF0FD;} + .d2-2681167429 .background-color-B6{background-color:#F7F8FE;} + .d2-2681167429 .background-color-AA2{background-color:#4A6FF3;} + .d2-2681167429 .background-color-AA4{background-color:#EDF0FD;} + .d2-2681167429 .background-color-AA5{background-color:#F7F8FE;} + .d2-2681167429 .background-color-AB4{background-color:#EDF0FD;} + .d2-2681167429 .background-color-AB5{background-color:#F7F8FE;} + .d2-2681167429 .color-N1{color:#0A0F25;} + .d2-2681167429 .color-N2{color:#676C7E;} + .d2-2681167429 .color-N3{color:#9499AB;} + .d2-2681167429 .color-N4{color:#CFD2DD;} + .d2-2681167429 .color-N5{color:#DEE1EB;} + .d2-2681167429 .color-N6{color:#EEF1F8;} + .d2-2681167429 .color-N7{color:#FFFFFF;} + .d2-2681167429 .color-B1{color:#0D32B2;} + .d2-2681167429 .color-B2{color:#0D32B2;} + .d2-2681167429 .color-B3{color:#E3E9FD;} + .d2-2681167429 .color-B4{color:#E3E9FD;} + .d2-2681167429 .color-B5{color:#EDF0FD;} + .d2-2681167429 .color-B6{color:#F7F8FE;} + .d2-2681167429 .color-AA2{color:#4A6FF3;} + .d2-2681167429 .color-AA4{color:#EDF0FD;} + .d2-2681167429 .color-AA5{color:#F7F8FE;} + .d2-2681167429 .color-AB4{color:#EDF0FD;} + .d2-2681167429 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]> @@ -104,16 +104,16 @@ -customeremployeerentalitem rent(this, i, p) new(this, i, p) isValid() isRentable(c) is(Adult) true - +customeremployeerentalitem rent(this, i, p) new(this, i, p) isValid() isRentable(c) is(Adult) true + - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 5f1c6c49f..039d330d5 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -623,9 +623,9 @@ func drawConnection(writer io.Writer, labelMaskID string, connection d2target.Co } if connection.Fill != color.Empty { rectEl := d2themes.NewThemableElement("rect") - rectEl.Rx = 999 - rectEl.X, rectEl.Y = labelTL.X-4, labelTL.Y-2 - rectEl.Width, rectEl.Height = float64(connection.LabelWidth)+8, float64(connection.LabelHeight)+4 + rectEl.Rx = 10 + rectEl.X, rectEl.Y = labelTL.X-4, labelTL.Y-3 + rectEl.Width, rectEl.Height = float64(connection.LabelWidth)+8, float64(connection.LabelHeight)+6 rectEl.Fill = connection.Fill fmt.Fprint(writer, rectEl.Render()) } diff --git a/e2etests/testdata/stable/font_sizes/dagre/sketch.exp.svg b/e2etests/testdata/stable/font_sizes/dagre/sketch.exp.svg index b6f3f0416..69a03e133 100644 --- a/e2etests/testdata/stable/font_sizes/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/font_sizes/dagre/sketch.exp.svg @@ -96,7 +96,7 @@ .d2-3174230406 .color-AA4{color:#EDF0FD;} .d2-3174230406 .color-AA5{color:#F7F8FE;} .d2-3174230406 .color-AB4{color:#EDF0FD;} - .d2-3174230406 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>size XSsize Ssize Msize Lsize XLsize XXLsize XXXLcustom 8custom 12custom 18custom 21custom 64 custom 10custom 15custom 48 + .d2-3174230406 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>size XSsize Ssize Msize Lsize XLsize XXLsize XXXLcustom 8custom 12custom 18custom 21custom 64 custom 10custom 15custom 48 diff --git a/e2etests/testdata/stable/font_sizes/elk/sketch.exp.svg b/e2etests/testdata/stable/font_sizes/elk/sketch.exp.svg index 276f85d8d..df12030cb 100644 --- a/e2etests/testdata/stable/font_sizes/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/font_sizes/elk/sketch.exp.svg @@ -96,7 +96,7 @@ .d2-1981788603 .color-AA4{color:#EDF0FD;} .d2-1981788603 .color-AA5{color:#F7F8FE;} .d2-1981788603 .color-AB4{color:#EDF0FD;} - .d2-1981788603 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>size XSsize Ssize Msize Lsize XLsize XXLsize XXXLcustom 8custom 12custom 18custom 21custom 64 custom 10custom 15custom 48 + .d2-1981788603 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>size XSsize Ssize Msize Lsize XLsize XXLsize XXXLcustom 8custom 12custom 18custom 21custom 64 custom 10custom 15custom 48 diff --git a/e2etests/testdata/stable/nesting_power/dagre/sketch.exp.svg b/e2etests/testdata/stable/nesting_power/dagre/sketch.exp.svg index aa2e38c0d..ec0c335c4 100644 --- a/e2etests/testdata/stable/nesting_power/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/nesting_power/dagre/sketch.exp.svg @@ -113,7 +113,7 @@ Left Constant NearcenterdirectionsRight Constant NearseqmoreBottom Left Constant Neardefaultlayouthererectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloudrightleftisconstantandalsogridscoreritemResponseitemessayRubricconceptitemOutcomestylishcontaineradagreelktalathisisgrid12341234updownnearax -ya_sequencea_shapesequencefinallybrow 1row 2row 3row 4row 5withasequence diagramyou canchild of is12341234scoreritemResponseitemessayRubricconceptsequencefrom one constant nearhaveanothergridhere andgrandchildscorerconceptessayRubricitemitemOutcomeitemResponse123continuenesting ororruns thisruns thisruns thisA straight edge across straight edge across nested typesdefault layoutdefault layoutdefault layout in styleto inside sequence diagramto inside sequence diagramto inside sequence diagramto constant nearfrom within constant nearto another getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)score +ya_sequencea_shapesequencefinallybrow 1row 2row 3row 4row 5withasequence diagramyou canchild of is12341234scoreritemResponseitemessayRubricconceptsequencefrom one constant nearhaveanothergridhere andgrandchildscorerconceptessayRubricitemitemOutcomeitemResponse123continuenesting ororruns thisruns thisruns thisA straight edge across straight edge across nested typesdefault layoutdefault layoutdefault layout in styleto inside sequence diagramto inside sequence diagramto inside sequence diagramto constant nearfrom within constant nearto another getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)score diff --git a/e2etests/testdata/stable/nesting_power/elk/sketch.exp.svg b/e2etests/testdata/stable/nesting_power/elk/sketch.exp.svg index 96fb0e567..9286f9415 100644 --- a/e2etests/testdata/stable/nesting_power/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/nesting_power/elk/sketch.exp.svg @@ -113,7 +113,7 @@ Left Constant NearcenterdirectionsRight Constant NearseqmoreBottom Left Constant Neardefaultlayouthererectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloudrightleftisconstantandalsogridscoreritemResponseitemessayRubricconceptitemOutcomestylishcontaineradagreelktalathisisgrid12341234updownnearax -ya_sequencea_shapesequencefinallybrow 1row 2row 3row 4row 5withasequence diagramyou canchild of is12341234scoreritemResponseitemessayRubricconceptsequencefrom one constant nearhaveanothergridhere andgrandchildscorerconceptessayRubricitemitemOutcomeitemResponse123continuenesting ororruns thisruns thisruns thisA straight edge across straight edge across nested typesdefault layoutdefault layoutdefault layout in styleto inside sequence diagramto inside sequence diagramto inside sequence diagramto constant nearfrom within constant nearto another getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)score +ya_sequencea_shapesequencefinallybrow 1row 2row 3row 4row 5withasequence diagramyou canchild of is12341234scoreritemResponseitemessayRubricconceptsequencefrom one constant nearhaveanothergridhere andgrandchildscorerconceptessayRubricitemitemOutcomeitemResponse123continuenesting ororruns thisruns thisruns thisA straight edge across straight edge across nested typesdefault layoutdefault layoutdefault layout in styleto inside sequence diagramto inside sequence diagramto inside sequence diagramto constant nearfrom within constant nearto another getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)score diff --git a/e2etests/testdata/stable/stylish/dagre/sketch.exp.svg b/e2etests/testdata/stable/stylish/dagre/sketch.exp.svg index 25f9b7b51..5f808ea6b 100644 --- a/e2etests/testdata/stable/stylish/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/stylish/dagre/sketch.exp.svg @@ -106,7 +106,7 @@ x -y in style +y in style diff --git a/e2etests/testdata/stable/stylish/elk/sketch.exp.svg b/e2etests/testdata/stable/stylish/elk/sketch.exp.svg index 90f0cb5bc..ade9abddf 100644 --- a/e2etests/testdata/stable/stylish/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/stylish/elk/sketch.exp.svg @@ -106,7 +106,7 @@ x -y in style +y in style diff --git a/e2etests/testdata/txtar/connection-style-fill/dagre/board.exp.json b/e2etests/testdata/txtar/connection-style-fill/dagre/board.exp.json index 6709ac240..013b1c18c 100644 --- a/e2etests/testdata/txtar/connection-style-fill/dagre/board.exp.json +++ b/e2etests/testdata/txtar/connection-style-fill/dagre/board.exp.json @@ -48,7 +48,7 @@ "id": "employee", "type": "rectangle", "pos": { - "x": 171, + "x": 161, "y": 52 }, "width": 112, @@ -89,7 +89,7 @@ "id": "rental", "type": "rectangle", "pos": { - "x": 327, + "x": 317, "y": 52 }, "width": 100, @@ -130,7 +130,7 @@ "id": "item", "type": "rectangle", "pos": { - "x": 477, + "x": 467, "y": 52 }, "width": 100, @@ -166,6 +166,88 @@ "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 1 + }, + { + "id": "alice", + "type": "rectangle", + "pos": { + "x": 617, + "y": 52 + }, + "width": 100, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "alice", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 32, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "bob", + "type": "rectangle", + "pos": { + "x": 838, + "y": 52 + }, + "width": 100, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "bob", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 26, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 } ], "connections": [ @@ -199,7 +281,7 @@ "y": 198 }, { - "x": 227, + "x": 217, "y": 198 } ], @@ -234,11 +316,11 @@ "labelPercentage": 0, "route": [ { - "x": 227, + "x": 217, "y": 288 }, { - "x": 377, + "x": 367, "y": 288 } ], @@ -273,11 +355,11 @@ "labelPercentage": 0, "route": [ { - "x": 377, + "x": 367, "y": 368 }, { - "x": 227, + "x": 217, "y": 368 } ], @@ -312,11 +394,11 @@ "labelPercentage": 0, "route": [ { - "x": 227, + "x": 217, "y": 448 }, { - "x": 377, + "x": 367, "y": 448 } ], @@ -351,11 +433,11 @@ "labelPercentage": 0, "route": [ { - "x": 377, + "x": 367, "y": 538 }, { - "x": 527, + "x": 517, "y": 538 } ], @@ -390,7 +472,7 @@ "labelPercentage": 0, "route": [ { - "x": 527, + "x": 517, "y": 628 }, { @@ -433,7 +515,7 @@ "y": 718 }, { - "x": 527, + "x": 517, "y": 718 } ], @@ -442,6 +524,84 @@ "icon": null, "zIndex": 4 }, + { + "id": "(alice -> bob)[0]", + "src": "alice", + "srcArrow": "none", + "dst": "bob", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "What does it mean\nto be well-adjusted?", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 133, + "labelHeight": 37, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 667, + "y": 816 + }, + { + "x": 888, + "y": 816 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(bob -> alice)[0]", + "src": "bob", + "srcArrow": "none", + "dst": "alice", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "The ability to play bridge or\ngolf as if they were games.", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 181, + "labelHeight": 37, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 888, + "y": 922 + }, + { + "x": 667, + "y": 922 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, { "id": "(customer -- )[0]", "src": "customer", @@ -472,7 +632,7 @@ }, { "x": 66.5, - "y": 788 + "y": 992 } ], "animated": false, @@ -505,12 +665,12 @@ "labelPercentage": 0, "route": [ { - "x": 227, + "x": 217, "y": 118 }, { - "x": 227, - "y": 788 + "x": 217, + "y": 992 } ], "animated": false, @@ -543,12 +703,12 @@ "labelPercentage": 0, "route": [ { - "x": 377, + "x": 367, "y": 118 }, { - "x": 377, - "y": 788 + "x": 367, + "y": 992 } ], "animated": false, @@ -581,12 +741,88 @@ "labelPercentage": 0, "route": [ { - "x": 527, + "x": 517, "y": 118 }, { - "x": 527, - "y": 788 + "x": 517, + "y": 992 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(alice -- )[0]", + "src": "alice", + "srcArrow": "none", + "dst": "alice-lifeline-end-3851299086", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 667, + "y": 118 + }, + { + "x": 667, + "y": 992 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(bob -- )[0]", + "src": "bob", + "srcArrow": "none", + "dst": "bob-lifeline-end-3036726343", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 888, + "y": 118 + }, + { + "x": 888, + "y": 992 } ], "animated": false, diff --git a/e2etests/testdata/txtar/connection-style-fill/dagre/sketch.exp.svg b/e2etests/testdata/txtar/connection-style-fill/dagre/sketch.exp.svg index 8038c7984..3debec50e 100644 --- a/e2etests/testdata/txtar/connection-style-fill/dagre/sketch.exp.svg +++ b/e2etests/testdata/txtar/connection-style-fill/dagre/sketch.exp.svg @@ -1,17 +1,17 @@ -customeremployeerentalitem rent(this, i, p)new(this, i, p)isValid()isRentable(c)is(Adult)true - + .d2-896225932 .fill-N1{fill:#0A0F25;} + .d2-896225932 .fill-N2{fill:#676C7E;} + .d2-896225932 .fill-N3{fill:#9499AB;} + .d2-896225932 .fill-N4{fill:#CFD2DD;} + .d2-896225932 .fill-N5{fill:#DEE1EB;} + .d2-896225932 .fill-N6{fill:#EEF1F8;} + .d2-896225932 .fill-N7{fill:#FFFFFF;} + .d2-896225932 .fill-B1{fill:#0D32B2;} + .d2-896225932 .fill-B2{fill:#0D32B2;} + .d2-896225932 .fill-B3{fill:#E3E9FD;} + .d2-896225932 .fill-B4{fill:#E3E9FD;} + .d2-896225932 .fill-B5{fill:#EDF0FD;} + .d2-896225932 .fill-B6{fill:#F7F8FE;} + .d2-896225932 .fill-AA2{fill:#4A6FF3;} + .d2-896225932 .fill-AA4{fill:#EDF0FD;} + .d2-896225932 .fill-AA5{fill:#F7F8FE;} + .d2-896225932 .fill-AB4{fill:#EDF0FD;} + .d2-896225932 .fill-AB5{fill:#F7F8FE;} + .d2-896225932 .stroke-N1{stroke:#0A0F25;} + .d2-896225932 .stroke-N2{stroke:#676C7E;} + .d2-896225932 .stroke-N3{stroke:#9499AB;} + .d2-896225932 .stroke-N4{stroke:#CFD2DD;} + .d2-896225932 .stroke-N5{stroke:#DEE1EB;} + .d2-896225932 .stroke-N6{stroke:#EEF1F8;} + .d2-896225932 .stroke-N7{stroke:#FFFFFF;} + .d2-896225932 .stroke-B1{stroke:#0D32B2;} + .d2-896225932 .stroke-B2{stroke:#0D32B2;} + .d2-896225932 .stroke-B3{stroke:#E3E9FD;} + .d2-896225932 .stroke-B4{stroke:#E3E9FD;} + .d2-896225932 .stroke-B5{stroke:#EDF0FD;} + .d2-896225932 .stroke-B6{stroke:#F7F8FE;} + .d2-896225932 .stroke-AA2{stroke:#4A6FF3;} + .d2-896225932 .stroke-AA4{stroke:#EDF0FD;} + .d2-896225932 .stroke-AA5{stroke:#F7F8FE;} + .d2-896225932 .stroke-AB4{stroke:#EDF0FD;} + .d2-896225932 .stroke-AB5{stroke:#F7F8FE;} + .d2-896225932 .background-color-N1{background-color:#0A0F25;} + .d2-896225932 .background-color-N2{background-color:#676C7E;} + .d2-896225932 .background-color-N3{background-color:#9499AB;} + .d2-896225932 .background-color-N4{background-color:#CFD2DD;} + .d2-896225932 .background-color-N5{background-color:#DEE1EB;} + .d2-896225932 .background-color-N6{background-color:#EEF1F8;} + .d2-896225932 .background-color-N7{background-color:#FFFFFF;} + .d2-896225932 .background-color-B1{background-color:#0D32B2;} + .d2-896225932 .background-color-B2{background-color:#0D32B2;} + .d2-896225932 .background-color-B3{background-color:#E3E9FD;} + .d2-896225932 .background-color-B4{background-color:#E3E9FD;} + .d2-896225932 .background-color-B5{background-color:#EDF0FD;} + .d2-896225932 .background-color-B6{background-color:#F7F8FE;} + .d2-896225932 .background-color-AA2{background-color:#4A6FF3;} + .d2-896225932 .background-color-AA4{background-color:#EDF0FD;} + .d2-896225932 .background-color-AA5{background-color:#F7F8FE;} + .d2-896225932 .background-color-AB4{background-color:#EDF0FD;} + .d2-896225932 .background-color-AB5{background-color:#F7F8FE;} + .d2-896225932 .color-N1{color:#0A0F25;} + .d2-896225932 .color-N2{color:#676C7E;} + .d2-896225932 .color-N3{color:#9499AB;} + .d2-896225932 .color-N4{color:#CFD2DD;} + .d2-896225932 .color-N5{color:#DEE1EB;} + .d2-896225932 .color-N6{color:#EEF1F8;} + .d2-896225932 .color-N7{color:#FFFFFF;} + .d2-896225932 .color-B1{color:#0D32B2;} + .d2-896225932 .color-B2{color:#0D32B2;} + .d2-896225932 .color-B3{color:#E3E9FD;} + .d2-896225932 .color-B4{color:#E3E9FD;} + .d2-896225932 .color-B5{color:#EDF0FD;} + .d2-896225932 .color-B6{color:#F7F8FE;} + .d2-896225932 .color-AA2{color:#4A6FF3;} + .d2-896225932 .color-AA4{color:#EDF0FD;} + .d2-896225932 .color-AA5{color:#F7F8FE;} + .d2-896225932 .color-AB4{color:#EDF0FD;} + .d2-896225932 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>customeremployeerentalitemalicebob rent(this, i, p)new(this, i, p)isValid()isRentable(c)is(Adult)trueWhat does it meanto be well-adjusted?The ability to play bridge orgolf as if they were games. + - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/e2etests/testdata/txtar/connection-style-fill/elk/board.exp.json b/e2etests/testdata/txtar/connection-style-fill/elk/board.exp.json index 6709ac240..013b1c18c 100644 --- a/e2etests/testdata/txtar/connection-style-fill/elk/board.exp.json +++ b/e2etests/testdata/txtar/connection-style-fill/elk/board.exp.json @@ -48,7 +48,7 @@ "id": "employee", "type": "rectangle", "pos": { - "x": 171, + "x": 161, "y": 52 }, "width": 112, @@ -89,7 +89,7 @@ "id": "rental", "type": "rectangle", "pos": { - "x": 327, + "x": 317, "y": 52 }, "width": 100, @@ -130,7 +130,7 @@ "id": "item", "type": "rectangle", "pos": { - "x": 477, + "x": 467, "y": 52 }, "width": 100, @@ -166,6 +166,88 @@ "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 1 + }, + { + "id": "alice", + "type": "rectangle", + "pos": { + "x": 617, + "y": 52 + }, + "width": 100, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "alice", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 32, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "bob", + "type": "rectangle", + "pos": { + "x": 838, + "y": 52 + }, + "width": 100, + "height": 66, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "bob", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N1", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 26, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 } ], "connections": [ @@ -199,7 +281,7 @@ "y": 198 }, { - "x": 227, + "x": 217, "y": 198 } ], @@ -234,11 +316,11 @@ "labelPercentage": 0, "route": [ { - "x": 227, + "x": 217, "y": 288 }, { - "x": 377, + "x": 367, "y": 288 } ], @@ -273,11 +355,11 @@ "labelPercentage": 0, "route": [ { - "x": 377, + "x": 367, "y": 368 }, { - "x": 227, + "x": 217, "y": 368 } ], @@ -312,11 +394,11 @@ "labelPercentage": 0, "route": [ { - "x": 227, + "x": 217, "y": 448 }, { - "x": 377, + "x": 367, "y": 448 } ], @@ -351,11 +433,11 @@ "labelPercentage": 0, "route": [ { - "x": 377, + "x": 367, "y": 538 }, { - "x": 527, + "x": 517, "y": 538 } ], @@ -390,7 +472,7 @@ "labelPercentage": 0, "route": [ { - "x": 527, + "x": 517, "y": 628 }, { @@ -433,7 +515,7 @@ "y": 718 }, { - "x": 527, + "x": 517, "y": 718 } ], @@ -442,6 +524,84 @@ "icon": null, "zIndex": 4 }, + { + "id": "(alice -> bob)[0]", + "src": "alice", + "srcArrow": "none", + "dst": "bob", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "What does it mean\nto be well-adjusted?", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 133, + "labelHeight": 37, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 667, + "y": 816 + }, + { + "x": 888, + "y": 816 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(bob -> alice)[0]", + "src": "bob", + "srcArrow": "none", + "dst": "alice", + "dstArrow": "triangle", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "B1", + "fill": "black", + "borderRadius": 10, + "label": "The ability to play bridge or\ngolf as if they were games.", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "white", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 181, + "labelHeight": 37, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 888, + "y": 922 + }, + { + "x": 667, + "y": 922 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, { "id": "(customer -- )[0]", "src": "customer", @@ -472,7 +632,7 @@ }, { "x": 66.5, - "y": 788 + "y": 992 } ], "animated": false, @@ -505,12 +665,12 @@ "labelPercentage": 0, "route": [ { - "x": 227, + "x": 217, "y": 118 }, { - "x": 227, - "y": 788 + "x": 217, + "y": 992 } ], "animated": false, @@ -543,12 +703,12 @@ "labelPercentage": 0, "route": [ { - "x": 377, + "x": 367, "y": 118 }, { - "x": 377, - "y": 788 + "x": 367, + "y": 992 } ], "animated": false, @@ -581,12 +741,88 @@ "labelPercentage": 0, "route": [ { - "x": 527, + "x": 517, "y": 118 }, { - "x": 527, - "y": 788 + "x": 517, + "y": 992 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(alice -- )[0]", + "src": "alice", + "srcArrow": "none", + "dst": "alice-lifeline-end-3851299086", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 667, + "y": 118 + }, + { + "x": 667, + "y": 992 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(bob -- )[0]", + "src": "bob", + "srcArrow": "none", + "dst": "bob-lifeline-end-3036726343", + "dstArrow": "none", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "B2", + "borderRadius": 10, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "N2", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 888, + "y": 118 + }, + { + "x": 888, + "y": 992 } ], "animated": false, diff --git a/e2etests/testdata/txtar/connection-style-fill/elk/sketch.exp.svg b/e2etests/testdata/txtar/connection-style-fill/elk/sketch.exp.svg index 8038c7984..3debec50e 100644 --- a/e2etests/testdata/txtar/connection-style-fill/elk/sketch.exp.svg +++ b/e2etests/testdata/txtar/connection-style-fill/elk/sketch.exp.svg @@ -1,17 +1,17 @@ -customeremployeerentalitem rent(this, i, p)new(this, i, p)isValid()isRentable(c)is(Adult)true - + .d2-896225932 .fill-N1{fill:#0A0F25;} + .d2-896225932 .fill-N2{fill:#676C7E;} + .d2-896225932 .fill-N3{fill:#9499AB;} + .d2-896225932 .fill-N4{fill:#CFD2DD;} + .d2-896225932 .fill-N5{fill:#DEE1EB;} + .d2-896225932 .fill-N6{fill:#EEF1F8;} + .d2-896225932 .fill-N7{fill:#FFFFFF;} + .d2-896225932 .fill-B1{fill:#0D32B2;} + .d2-896225932 .fill-B2{fill:#0D32B2;} + .d2-896225932 .fill-B3{fill:#E3E9FD;} + .d2-896225932 .fill-B4{fill:#E3E9FD;} + .d2-896225932 .fill-B5{fill:#EDF0FD;} + .d2-896225932 .fill-B6{fill:#F7F8FE;} + .d2-896225932 .fill-AA2{fill:#4A6FF3;} + .d2-896225932 .fill-AA4{fill:#EDF0FD;} + .d2-896225932 .fill-AA5{fill:#F7F8FE;} + .d2-896225932 .fill-AB4{fill:#EDF0FD;} + .d2-896225932 .fill-AB5{fill:#F7F8FE;} + .d2-896225932 .stroke-N1{stroke:#0A0F25;} + .d2-896225932 .stroke-N2{stroke:#676C7E;} + .d2-896225932 .stroke-N3{stroke:#9499AB;} + .d2-896225932 .stroke-N4{stroke:#CFD2DD;} + .d2-896225932 .stroke-N5{stroke:#DEE1EB;} + .d2-896225932 .stroke-N6{stroke:#EEF1F8;} + .d2-896225932 .stroke-N7{stroke:#FFFFFF;} + .d2-896225932 .stroke-B1{stroke:#0D32B2;} + .d2-896225932 .stroke-B2{stroke:#0D32B2;} + .d2-896225932 .stroke-B3{stroke:#E3E9FD;} + .d2-896225932 .stroke-B4{stroke:#E3E9FD;} + .d2-896225932 .stroke-B5{stroke:#EDF0FD;} + .d2-896225932 .stroke-B6{stroke:#F7F8FE;} + .d2-896225932 .stroke-AA2{stroke:#4A6FF3;} + .d2-896225932 .stroke-AA4{stroke:#EDF0FD;} + .d2-896225932 .stroke-AA5{stroke:#F7F8FE;} + .d2-896225932 .stroke-AB4{stroke:#EDF0FD;} + .d2-896225932 .stroke-AB5{stroke:#F7F8FE;} + .d2-896225932 .background-color-N1{background-color:#0A0F25;} + .d2-896225932 .background-color-N2{background-color:#676C7E;} + .d2-896225932 .background-color-N3{background-color:#9499AB;} + .d2-896225932 .background-color-N4{background-color:#CFD2DD;} + .d2-896225932 .background-color-N5{background-color:#DEE1EB;} + .d2-896225932 .background-color-N6{background-color:#EEF1F8;} + .d2-896225932 .background-color-N7{background-color:#FFFFFF;} + .d2-896225932 .background-color-B1{background-color:#0D32B2;} + .d2-896225932 .background-color-B2{background-color:#0D32B2;} + .d2-896225932 .background-color-B3{background-color:#E3E9FD;} + .d2-896225932 .background-color-B4{background-color:#E3E9FD;} + .d2-896225932 .background-color-B5{background-color:#EDF0FD;} + .d2-896225932 .background-color-B6{background-color:#F7F8FE;} + .d2-896225932 .background-color-AA2{background-color:#4A6FF3;} + .d2-896225932 .background-color-AA4{background-color:#EDF0FD;} + .d2-896225932 .background-color-AA5{background-color:#F7F8FE;} + .d2-896225932 .background-color-AB4{background-color:#EDF0FD;} + .d2-896225932 .background-color-AB5{background-color:#F7F8FE;} + .d2-896225932 .color-N1{color:#0A0F25;} + .d2-896225932 .color-N2{color:#676C7E;} + .d2-896225932 .color-N3{color:#9499AB;} + .d2-896225932 .color-N4{color:#CFD2DD;} + .d2-896225932 .color-N5{color:#DEE1EB;} + .d2-896225932 .color-N6{color:#EEF1F8;} + .d2-896225932 .color-N7{color:#FFFFFF;} + .d2-896225932 .color-B1{color:#0D32B2;} + .d2-896225932 .color-B2{color:#0D32B2;} + .d2-896225932 .color-B3{color:#E3E9FD;} + .d2-896225932 .color-B4{color:#E3E9FD;} + .d2-896225932 .color-B5{color:#EDF0FD;} + .d2-896225932 .color-B6{color:#F7F8FE;} + .d2-896225932 .color-AA2{color:#4A6FF3;} + .d2-896225932 .color-AA4{color:#EDF0FD;} + .d2-896225932 .color-AA5{color:#F7F8FE;} + .d2-896225932 .color-AB4{color:#EDF0FD;} + .d2-896225932 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>customeremployeerentalitemalicebob rent(this, i, p)new(this, i, p)isValid()isRentable(c)is(Adult)trueWhat does it meanto be well-adjusted?The ability to play bridge orgolf as if they were games. + - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/e2etests/txtar.txt b/e2etests/txtar.txt index 0481256df..3c2f7f028 100644 --- a/e2etests/txtar.txt +++ b/e2etests/txtar.txt @@ -386,6 +386,9 @@ employee rental item +alice +bob + (* -> *)[*].style.fill: black (* -> *)[*].style.font-color: white @@ -396,3 +399,6 @@ employee -> rental: isValid() rental -> item: isRentable(c) item -> customer: is(Adult) customer -> item: true + +alice -> bob: What does it mean\nto be well-adjusted? +bob -> alice: The ability to play bridge or\ngolf as if they were games. From 890e87f8bca7e8c2b6ea1477887f0dd3c4cf52dd Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sat, 14 Sep 2024 17:41:57 -0600 Subject: [PATCH 3/3] next --- ci/release/changelogs/next.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index c8c1b0434..392cf8339 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -12,6 +12,7 @@ - Compiler: Error on multi-line labels in `sql_table` shapes [#2057](https://github.com/terrastruct/d2/pull/2057) - Sequence diagram: Image shape actors can use spans and notes [#2056](https://github.com/terrastruct/d2/issues/2056) - Globs: Filters work with default values (e.g. `&opacity: 1` will capture everything without opacity explicitly set) [#2090](https://github.com/terrastruct/d2/pull/2090) +- Render: connection label fills have a bit of padding and border-radius for better aesthetics [#2094](https://github.com/terrastruct/d2/pull/2094) #### Bugfixes ⛑️