From ea61235e8734eec3058c980e867d785a00678b5c Mon Sep 17 00:00:00 2001 From: Avelino Date: Mon, 2 Jan 2023 15:11:53 -0300 Subject: [PATCH 01/65] docker: add ca-certificates package fixed: #594 ``` err: failed to install Playwright: could not install driver: could not install driver: could not download driver: Get "https://playwright.azureedge.net/builds/driver/next/playwright-1.20.0-beta-1647057403000-linux.zip": x509: certificate signed by unknown authority ``` --- ci/release/linux/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release/linux/Dockerfile b/ci/release/linux/Dockerfile index 5bc66a568..826876d63 100644 --- a/ci/release/linux/Dockerfile +++ b/ci/release/linux/Dockerfile @@ -1,7 +1,7 @@ FROM debian:10 RUN apt-get update -RUN apt-get install -y curl +RUN apt-get install -y curl ca-certificates ARG GOVERSION= RUN curl -fsSL "https://go.dev/dl/go$GOVERSION.tar.gz" >/tmp/go.tar.gz From 8e929ec17e00b3af7ea7b68f2f3e01b439851413 Mon Sep 17 00:00:00 2001 From: Avelino Date: Mon, 2 Jan 2023 15:13:44 -0300 Subject: [PATCH 02/65] docker: add ca-certificates package --- ci/release/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/release/Dockerfile b/ci/release/Dockerfile index d195fa05b..3d44ac80c 100644 --- a/ci/release/Dockerfile +++ b/ci/release/Dockerfile @@ -3,6 +3,9 @@ FROM debian:latest ARG TARGETARCH +RUN apt-get update && \ + apt-get install -y ca-certificates + COPY ./d2-*-linux-$TARGETARCH.tar.gz /tmp RUN mkdir -p /usr/local/lib/d2 \ && tar -C /usr/local/lib/d2 -xzf /tmp/d2-*-linux-"$TARGETARCH".tar.gz \ From b0d3b9d3fdb302647a6b550095a4faa75e67559b Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Mon, 9 Jan 2023 22:44:45 -0500 Subject: [PATCH 03/65] Init --- ci/release/changelogs/next.md | 2 +- d2renderers/d2svg/d2svg.go | 47 +++++++++++++++++++++++++++++++++++ d2target/d2target.go | 9 +++++++ e2etests/stable_test.go | 23 +++++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index f3c0d2a77..955808118 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,5 +1,5 @@ #### Features ๐Ÿš€ - +- Circle notation is now supported. [] #### Improvements ๐Ÿงน #### Bugfixes โ›‘๏ธ diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 678f0c2ae..91b18c54a 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -114,6 +114,12 @@ func arrowheadDimensions(arrowhead d2target.Arrowhead, strokeWidth float64) (wid case d2target.DiamondArrowhead: widthMultiplier = 11 heightMultiplier = 9 + case d2target.FilledCircleArrowhead: + widthMultiplier = 14 + heightMultiplier = 15 + case d2target.CircleArrowhead: + widthMultiplier = 14 + heightMultiplier = 15 case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired: widthMultiplier = 14 heightMultiplier = 15 @@ -224,6 +230,39 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s width*0.6, height*7/8, ) } + case d2target.FilledCircleArrowhead: + attrs := fmt.Sprintf(`class="connection" fill="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth) + offset := 4.0 + float64(connection.StrokeWidth*2) + if isTarget { + path = fmt.Sprintf(``, + attrs, + offset+9, height/2, + offset*1.2, + ) + } else { + path = fmt.Sprintf(``, + attrs, + offset+3, height/2, + offset*1.2, + ) + } + case d2target.CircleArrowhead: + attrs := fmt.Sprintf(`class="connection" fill="white" stroke="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth) + offset := 4.0 + float64(connection.StrokeWidth*2) + if isTarget { + path = fmt.Sprintf(``, + attrs, + offset+10, height/2, + offset*1.2, + ) + } else { + path = fmt.Sprintf(``, + attrs, + offset+6, height/2, + offset*1.2, + ) + } + case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired: attrs := fmt.Sprintf(`class="connection" stroke="%s" stroke-width="%d" fill="white"`, connection.Stroke, connection.StrokeWidth) offset := 4.0 + float64(connection.StrokeWidth*2) @@ -277,6 +316,14 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s refX = width/8 + 0.6*strokeWidth } width *= 1.1 + + case d2target.CircleArrowhead: + if isTarget { + refX = width - 0.6*strokeWidth + } else { + refX = width/8 + 0.6*strokeWidth + } + width *= 1.1 default: if isTarget { refX = width - 1.5*strokeWidth diff --git a/d2target/d2target.go b/d2target/d2target.go index b426adfd9..b324e4ff6 100644 --- a/d2target/d2target.go +++ b/d2target/d2target.go @@ -277,6 +277,8 @@ const ( TriangleArrowhead Arrowhead = "triangle" DiamondArrowhead Arrowhead = "diamond" FilledDiamondArrowhead Arrowhead = "filled-diamond" + CircleArrowhead Arrowhead = "circle" + FilledCircleArrowhead Arrowhead = "circle-filled" // For fat arrows LineArrowhead Arrowhead = "line" @@ -294,6 +296,8 @@ var Arrowheads = map[string]struct{}{ string(TriangleArrowhead): {}, string(DiamondArrowhead): {}, string(FilledDiamondArrowhead): {}, + string(CircleArrowhead): {}, + string(FilledCircleArrowhead): {}, string(CfOne): {}, string(CfMany): {}, string(CfOneRequired): {}, @@ -307,6 +311,11 @@ func ToArrowhead(arrowheadType string, filled bool) Arrowhead { return FilledDiamondArrowhead } return DiamondArrowhead + case string(CircleArrowhead): + if filled { + return FilledCircleArrowhead + } + return CircleArrowhead case string(ArrowArrowhead): return ArrowArrowhead case string(CfOne): diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index a8acc138a..680a18045 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1762,6 +1762,29 @@ e <--> f: { target-arrowhead: { shape: cf-one-required } +}`, + }, + { + name: "circle_arrowhead", + script: ` +a <-> b: circle { + source-arrowhead: { + shape: circle + } + target-arrowhead: { + shape: circle + } +} + +c <--> d: circle-filled { + source-arrowhead: { + shape: circle + style.filled: true + } + target-arrowhead: { + shape: circle + style.filled: true + } }`, }, } From acf04be5e548c653e1464271f8fca4bdf18a4e10 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Mon, 9 Jan 2023 22:53:19 -0500 Subject: [PATCH 04/65] Update next.md --- ci/release/changelogs/next.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 955808118..fda4c774c 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,5 +1,5 @@ #### Features ๐Ÿš€ -- Circle notation is now supported. [] +- Circle notation is now supported. [#634](https://github.com/terrastruct/d2/pull/634) #### Improvements ๐Ÿงน #### Bugfixes โ›‘๏ธ From 2154c3b02ad689734d10e1ec255662f75cc535ef Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Mon, 9 Jan 2023 23:04:41 -0500 Subject: [PATCH 05/65] Update stable_test.go --- e2etests/stable_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 680a18045..98e366c39 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1776,7 +1776,7 @@ a <-> b: circle { } } -c <--> d: circle-filled { +c <-> d: circle-filled { source-arrowhead: { shape: circle style.filled: true From 649dbb13c281a4b4e968d19291894a59c34fb888 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Mon, 9 Jan 2023 23:40:03 -0500 Subject: [PATCH 06/65] Tests --- .../circle_arrowhead/dagre/board.exp.json | 264 ++++++++++++++++++ .../circle_arrowhead/dagre/sketch.exp.svg | 60 ++++ .../circle_arrowhead/elk/board.exp.json | 246 ++++++++++++++++ .../circle_arrowhead/elk/sketch.exp.svg | 60 ++++ 4 files changed, 630 insertions(+) create mode 100644 e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json create mode 100644 e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg create mode 100644 e2etests/testdata/stable/circle_arrowhead/elk/board.exp.json create mode 100644 e2etests/testdata/stable/circle_arrowhead/elk/sketch.exp.svg diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json b/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json new file mode 100644 index 000000000..acf9c5535 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json @@ -0,0 +1,264 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "", + "pos": { + "x": 0, + "y": 247 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "", + "pos": { + "x": 174, + "y": 0 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "c", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "d", + "type": "", + "pos": { + "x": 173, + "y": 247 + }, + "width": 114, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "d", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 14, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "circle", + "srcLabel": "", + "dst": "b", + "dstArrow": "circle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 36, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 56.5, + "y": 126 + }, + { + "x": 56.5, + "y": 174.4 + }, + { + "x": 56.5, + "y": 198.7 + }, + { + "x": 56.5, + "y": 247.5 + } + ], + "isCurve": true, + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(c <-> d)[0]", + "src": "c", + "srcArrow": "circle-filled", + "srcLabel": "", + "dst": "d", + "dstArrow": "circle-filled", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle-filled", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 73, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 230, + "y": 126 + }, + { + "x": 230, + "y": 174.4 + }, + { + "x": 230, + "y": 198.7 + }, + { + "x": 230, + "y": 247.5 + } + ], + "isCurve": true, + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ] +} diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg new file mode 100644 index 000000000..a5a5eefa6 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg @@ -0,0 +1,60 @@ + +abcd circle circle-filled + + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/circle_arrowhead/elk/board.exp.json b/e2etests/testdata/stable/circle_arrowhead/elk/board.exp.json new file mode 100644 index 000000000..f75bfeb10 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead/elk/board.exp.json @@ -0,0 +1,246 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 12, + "y": 12 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "", + "pos": { + "x": 12, + "y": 359 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "", + "pos": { + "x": 145, + "y": 12 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "c", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "d", + "type": "", + "pos": { + "x": 145, + "y": 359 + }, + "width": 114, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "d", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 14, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "circle", + "srcLabel": "", + "dst": "b", + "dstArrow": "circle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 36, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 68.5, + "y": 138 + }, + { + "x": 68.5, + "y": 359 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(c <-> d)[0]", + "src": "c", + "srcArrow": "circle-filled", + "srcLabel": "", + "dst": "d", + "dstArrow": "circle-filled", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle-filled", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 73, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 202, + "y": 138 + }, + { + "x": 202, + "y": 359 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ] +} diff --git a/e2etests/testdata/stable/circle_arrowhead/elk/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/elk/sketch.exp.svg new file mode 100644 index 000000000..7161bc2b1 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead/elk/sketch.exp.svg @@ -0,0 +1,60 @@ + +abcd circle circle-filled + + + + \ No newline at end of file From 2c59b1c16352c5fb976d704a924faa0afa69bd22 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Mon, 9 Jan 2023 23:48:26 -0500 Subject: [PATCH 07/65] Formatting --- d2renderers/d2svg/d2svg.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 91b18c54a..fa2ffafa9 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -114,10 +114,7 @@ func arrowheadDimensions(arrowhead d2target.Arrowhead, strokeWidth float64) (wid case d2target.DiamondArrowhead: widthMultiplier = 11 heightMultiplier = 9 - case d2target.FilledCircleArrowhead: - widthMultiplier = 14 - heightMultiplier = 15 - case d2target.CircleArrowhead: + case d2target.FilledCircleArrowhead, d2target.CircleArrowhead: widthMultiplier = 14 heightMultiplier = 15 case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired: From d46ce55c2f7d1dd63b1d47dc7911db234577bd51 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:08:26 -0500 Subject: [PATCH 08/65] Update d2svg.go --- d2renderers/d2svg/d2svg.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index fa2ffafa9..37dedce2b 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -114,10 +114,7 @@ func arrowheadDimensions(arrowhead d2target.Arrowhead, strokeWidth float64) (wid case d2target.DiamondArrowhead: widthMultiplier = 11 heightMultiplier = 9 - case d2target.FilledCircleArrowhead, d2target.CircleArrowhead: - widthMultiplier = 14 - heightMultiplier = 15 - case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired: + case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired, d2target.FilledCircleArrowhead, d2target.CircleArrowhead: widthMultiplier = 14 heightMultiplier = 15 } From 73aeae484503dfea3d3b430b6c5509feac180cc1 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:09:20 -0500 Subject: [PATCH 09/65] Update next.md --- ci/release/changelogs/next.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index fda4c774c..cfdebd299 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,5 +1,5 @@ #### Features ๐Ÿš€ -- Circle notation is now supported. [#634](https://github.com/terrastruct/d2/pull/634) +- Circle arrowheads are now supported. [#634](https://github.com/terrastruct/d2/pull/634) #### Improvements ๐Ÿงน #### Bugfixes โ›‘๏ธ From 7cdec21ec8d28dd82947b8a276ea2686f21b52bb Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:11:06 -0500 Subject: [PATCH 10/65] Update d2target.go --- d2target/d2target.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d2target/d2target.go b/d2target/d2target.go index b324e4ff6..8a2ae89fb 100644 --- a/d2target/d2target.go +++ b/d2target/d2target.go @@ -278,7 +278,7 @@ const ( DiamondArrowhead Arrowhead = "diamond" FilledDiamondArrowhead Arrowhead = "filled-diamond" CircleArrowhead Arrowhead = "circle" - FilledCircleArrowhead Arrowhead = "circle-filled" + FilledCircleArrowhead Arrowhead = "filled-circle" // For fat arrows LineArrowhead Arrowhead = "line" From bc1b7b8ef9d9f6356abc881080bad05950c1b52f Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose <103412754+Paracelsus-Rose@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:12:24 -0500 Subject: [PATCH 11/65] Update stable_test.go --- e2etests/stable_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 98e366c39..4257c4d1a 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1776,7 +1776,7 @@ a <-> b: circle { } } -c <-> d: circle-filled { +c <-> d: filled-circle { source-arrowhead: { shape: circle style.filled: true From fc15982b93036f3a8706a42ef37231617347020b Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Tue, 10 Jan 2023 12:48:54 -0500 Subject: [PATCH 12/65] Requested Changes --- d2renderers/d2svg/d2svg.go | 8 ++++---- .../testdata/stable/circle_arrowhead/dagre/board.exp.json | 6 +++--- .../testdata/stable/circle_arrowhead/dagre/sketch.exp.svg | 2 +- .../testdata/stable/circle_arrowhead/elk/board.exp.json | 6 +++--- .../testdata/stable/circle_arrowhead/elk/sketch.exp.svg | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 37dedce2b..22f984345 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -230,13 +230,13 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s if isTarget { path = fmt.Sprintf(``, attrs, - offset+9, height/2, + offset+11, height/2, offset*1.2, ) } else { path = fmt.Sprintf(``, attrs, - offset+3, height/2, + offset+1, height/2, offset*1.2, ) } @@ -246,13 +246,13 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s if isTarget { path = fmt.Sprintf(``, attrs, - offset+10, height/2, + offset+12, height/2, offset*1.2, ) } else { path = fmt.Sprintf(``, attrs, - offset+6, height/2, + offset+4, height/2, offset*1.2, ) } diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json b/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json index acf9c5535..82f04068a 100644 --- a/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/board.exp.json @@ -215,16 +215,16 @@ { "id": "(c <-> d)[0]", "src": "c", - "srcArrow": "circle-filled", + "srcArrow": "filled-circle", "srcLabel": "", "dst": "d", - "dstArrow": "circle-filled", + "dstArrow": "filled-circle", "dstLabel": "", "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "stroke": "#0D32B2", - "label": "circle-filled", + "label": "filled-circle", "fontSize": 16, "fontFamily": "DEFAULT", "language": "", diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg index a5a5eefa6..8ca984fdc 100644 --- a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="491" height="577" viewBox="-102 -102 491 577">

hey

+
    +
  • they +
      +
    1. they
    2. +
    +
  • +
+
ab + + + \ No newline at end of file diff --git a/e2etests/testdata/regression/md_h1_li_li/elk/board.exp.json b/e2etests/testdata/regression/md_h1_li_li/elk/board.exp.json new file mode 100644 index 000000000..3f26d8123 --- /dev/null +++ b/e2etests/testdata/regression/md_h1_li_li/elk/board.exp.json @@ -0,0 +1,205 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "md", + "type": "text", + "pos": { + "x": 21, + "y": 238 + }, + "width": 95, + "height": 110, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "transparent", + "stroke": "#0A0F25", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "\n# hey\n- they\n\t1. they\n", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 95, + "labelHeight": 110, + "zIndex": 0, + "level": 1 + }, + { + "id": "a", + "type": "", + "pos": { + "x": 12, + "y": 12 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "", + "pos": { + "x": 12, + "y": 448 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(a -> md)[0]", + "src": "a", + "srcArrow": "none", + "srcLabel": "", + "dst": "md", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 68.5, + "y": 138 + }, + { + "x": 68.5, + "y": 238 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(md -> b)[0]", + "src": "md", + "srcArrow": "none", + "srcLabel": "", + "dst": "b", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 68.5, + "y": 348 + }, + { + "x": 68.5, + "y": 448 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ] +} diff --git a/e2etests/testdata/regression/md_h1_li_li/elk/sketch.exp.svg b/e2etests/testdata/regression/md_h1_li_li/elk/sketch.exp.svg new file mode 100644 index 000000000..8624d8414 --- /dev/null +++ b/e2etests/testdata/regression/md_h1_li_li/elk/sketch.exp.svg @@ -0,0 +1,824 @@ + +

hey

+
    +
  • they +
      +
    1. they
    2. +
    +
  • +
+
ab + + +
\ No newline at end of file From 1a07492517c7673ad8033ad3bad0dee7d7fb95ae Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Fri, 13 Jan 2023 20:55:10 -0800 Subject: [PATCH 18/65] update li measurement + h1 border-bottom --- lib/textmeasure/markdown.go | 84 +++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/lib/textmeasure/markdown.go b/lib/textmeasure/markdown.go index bf12dc7ab..4a30afbbb 100644 --- a/lib/textmeasure/markdown.go +++ b/lib/textmeasure/markdown.go @@ -2,6 +2,7 @@ package textmeasure import ( "bytes" + "fmt" "math" "strings" @@ -33,6 +34,7 @@ const ( MarginTop_h = 24 MarginBottom_h = 16 PaddingBottom_h1_h2_em = 0.3 + BorderBottom_h1_h2 = 1 Height_hr = 4 MarginTopBottom_hr = 24 @@ -203,6 +205,18 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, fontFamily *d2fonts.Fon parentElementType = n.Parent.Data } + debugMeasure := false + var depthStr string + if debugMeasure { + if depth == 0 { + fmt.Println() + } + depthStr = "โ”Œ" + for i := 0; i < depth; i++ { + depthStr += "-" + } + } + switch n.Type { case html.TextNode: if strings.TrimSpace(n.Data) == "" { @@ -244,6 +258,9 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, fontFamily *d2fonts.Fon w *= FontSize_pre_code_em h *= FontSize_pre_code_em } + if debugMeasure { + fmt.Printf("%stext(%v,%v)\n", depthStr, w, h) + } return blockAttrs{w + spaceWidths, h, 0, 0} case html.ElementNode: isCode := false @@ -273,58 +290,58 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, fontFamily *d2fonts.Fon last := getPrev(n.LastChild) var blocks []blockAttrs - var current *blockAttrs + var inlineBlock *blockAttrs // first create blocks from combined inline elements, then combine all blocks - // current will be non-nil while inline elements are being combined into a block + // inlineBlock will be non-nil while inline elements are being combined into a block + endInlineBlock := func() { + if !isCode && inlineBlock.height > 0 && inlineBlock.height < MarkdownLineHeightPx { + inlineBlock.height = MarkdownLineHeightPx + } + blocks = append(blocks, *inlineBlock) + inlineBlock = nil + } for child := n.FirstChild; child != nil; child = child.NextSibling { childBlock := ruler.measureNode(depth+1, child, fontFamily, fontSize, fontStyle) if child.Type == html.ElementNode && isBlockElement(child.Data) { - if current != nil { - blocks = append(blocks, *current) + if inlineBlock != nil { + endInlineBlock() } - current = &blockAttrs{} + newBlock := &blockAttrs{} + newBlock.width = childBlock.width + newBlock.height = childBlock.height if child == first && n.Data == "blockquote" { - current.marginTop = 0. + newBlock.marginTop = 0. } else { - current.marginTop = childBlock.marginTop + newBlock.marginTop = childBlock.marginTop } if child == last && n.Data == "blockquote" { - current.marginBottom = 0. + newBlock.marginBottom = 0. } else { - current.marginBottom = childBlock.marginBottom + newBlock.marginBottom = childBlock.marginBottom } - current.width = childBlock.width - current.height = childBlock.height - blocks = append(blocks, *current) - current = nil + blocks = append(blocks, *newBlock) } else if child.Type == html.ElementNode && child.Data == "br" { - if current != nil { - if !isCode && current.height > 0 && current.height < MarkdownLineHeightPx { - current.height = MarkdownLineHeightPx - } - blocks = append(blocks, *current) - current = nil + if inlineBlock != nil { + endInlineBlock() } } else if childBlock.isNotEmpty() { - if current == nil { - current = &childBlock + if inlineBlock == nil { + // start inline block with child + inlineBlock = &childBlock } else { - current.marginTop = go2.Max(current.marginTop, childBlock.marginTop) - current.marginBottom = go2.Max(current.marginBottom, childBlock.marginBottom) + // stack inline element dimensions horizontally + inlineBlock.width += childBlock.width + inlineBlock.height = go2.Max(inlineBlock.height, childBlock.height) - current.width += childBlock.width - current.height = go2.Max(current.height, childBlock.height) + inlineBlock.marginTop = go2.Max(inlineBlock.marginTop, childBlock.marginTop) + inlineBlock.marginBottom = go2.Max(inlineBlock.marginBottom, childBlock.marginBottom) } } } - if current != nil { - if !isCode && current.height > 0 && current.height < MarkdownLineHeightPx { - current.height = MarkdownLineHeightPx - } - blocks = append(blocks, *current) - current = nil + if inlineBlock != nil { + endInlineBlock() } var prevMarginBottom float64 @@ -363,7 +380,7 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, fontFamily *d2fonts.Fon block.marginBottom = go2.Max(block.marginBottom, MarginBottom_h) switch n.Data { case "h1", "h2": - block.height += PaddingBottom_h1_h2_em * float64(fontSize) + block.height += PaddingBottom_h1_h2_em*float64(fontSize) + BorderBottom_h1_h2 } case "li": block.width += PaddingLeft_ul_ol @@ -394,6 +411,9 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, fontFamily *d2fonts.Fon if block.height > 0 && block.height < MarkdownLineHeightPx { block.height = MarkdownLineHeightPx } + if debugMeasure { + fmt.Printf("%s%s(%v,%v) mt:%v mb:%v\n", depthStr, n.Data, block.width, block.height, block.marginTop, block.marginBottom) + } return block } return blockAttrs{} From 41741e0d673a3d33c3b05c3e7ac0a614810c8bf4 Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Fri, 13 Jan 2023 20:59:50 -0800 Subject: [PATCH 19/65] update test --- .../regression/md_h1_li_li/dagre/board.exp.json | 14 +++++++------- .../regression/md_h1_li_li/dagre/sketch.exp.svg | 8 ++++---- .../regression/md_h1_li_li/elk/board.exp.json | 10 +++++----- .../regression/md_h1_li_li/elk/sketch.exp.svg | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/e2etests/testdata/regression/md_h1_li_li/dagre/board.exp.json b/e2etests/testdata/regression/md_h1_li_li/dagre/board.exp.json index 190f5ee5e..636f04603 100644 --- a/e2etests/testdata/regression/md_h1_li_li/dagre/board.exp.json +++ b/e2etests/testdata/regression/md_h1_li_li/dagre/board.exp.json @@ -10,7 +10,7 @@ "y": 226 }, "width": 95, - "height": 110, + "height": 115, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -37,7 +37,7 @@ "bold": false, "underline": false, "labelWidth": 95, - "labelHeight": 110, + "labelHeight": 115, "zIndex": 0, "level": 1 }, @@ -86,7 +86,7 @@ "type": "", "pos": { "x": 0, - "y": 436 + "y": 441 }, "width": 113, "height": 126, @@ -198,19 +198,19 @@ "route": [ { "x": 56.5, - "y": 336 + "y": 341 }, { "x": 56.5, - "y": 376 + "y": 381 }, { "x": 56.5, - "y": 396 + "y": 401 }, { "x": 56.5, - "y": 436 + "y": 441 } ], "isCurve": true, diff --git a/e2etests/testdata/regression/md_h1_li_li/dagre/sketch.exp.svg b/e2etests/testdata/regression/md_h1_li_li/dagre/sketch.exp.svg index ee8454068..8f944eaa4 100644 --- a/e2etests/testdata/regression/md_h1_li_li/dagre/sketch.exp.svg +++ b/e2etests/testdata/regression/md_h1_li_li/dagre/sketch.exp.svg @@ -3,7 +3,7 @@ id="d2-svg" style="background: white;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" -width="317" height="766" viewBox="-102 -102 317 766">

hey

+

hey

  • they
      @@ -804,8 +804,8 @@ width="317" height="766" viewBox="-102 -102 317 766">

      hey

      +

      hey

      • they
          @@ -804,8 +804,8 @@ width="317" height="766" viewBox="-90 -90 317 766">xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          +xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          If we can't fix it, it ain't broke.

          Dieters live life in the fasting lane.

          -
          i am top lefti am top righti am bottom lefti am bottom right - +
          i am top lefti am top righti am bottom lefti am bottom right + xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          +xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          If we can't fix it, it ain't broke.

          Dieters live life in the fasting lane.

          -
          i am top lefti am top righti am bottom lefti am bottom right - +
          i am top lefti am top righti am bottom lefti am bottom right + poll the peopleresultsunfavorablefavorablewill of the people

          A winning strategy

          -
          - +poll the peopleresultsunfavorablefavorablewill of the people

          A winning strategy

          +
          + poll the peopleresultsunfavorablefavorablewill of the people

          A winning strategy

          -
          - +poll the peopleresultsunfavorablefavorablewill of the people

          A winning strategy

          +
          +

          Markdown: Syntax

          +

          Markdown: Syntax

          • Overview
              @@ -1053,8 +1053,8 @@ title for the link, surrounded in quotes. For example:

              Code

              Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

              -
          ab - +
          ab +

          Markdown: Syntax

          +

          Markdown: Syntax

          • Overview
              @@ -1053,8 +1053,8 @@ title for the link, surrounded in quotes. For example:

              Code

              Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

              -
          ab - +
          ab +

          Note: This document is itself written using Markdown; you +

          Note: This document is itself written using Markdown; you can see the source for it by adding '.text' to the URL.


          Overview

          -
          ab - +
          ab +

          Note: This document is itself written using Markdown; you +

          Note: This document is itself written using Markdown; you can see the source for it by adding '.text' to the URL.


          Overview

          -
          ab - +
          ab +

          Markdown: Syntax

          -
          ab - +

          Markdown: Syntax

          +
          ab +

          Markdown: Syntax

          -
          ab - +

          Markdown: Syntax

          +
          ab +

          Every frustum longs to be a cone

          +

          Every frustum longs to be a cone

          • A continuing flow of paper is sufficient to continue the flow of paper
          • Please remain calm, it's no use both of us being hysterical at the same time
          • Visits always give pleasure: if not on arrival, then on the departure

          Festivity Level 1: Your guests are chatting amiably with each other.

          -
          xy - +
          xy +

          Every frustum longs to be a cone

          +

          Every frustum longs to be a cone

          • A continuing flow of paper is sufficient to continue the flow of paper
          • Please remain calm, it's no use both of us being hysterical at the same time
          • Visits always give pleasure: if not on arrival, then on the departure

          Festivity Level 1: Your guests are chatting amiably with each other.

          -
          xy - +
          xy + container

          they did it in style

          -

          a header

          +container

          they did it in style

          +

          a header

          a line of text and an

          {
           	indented: "block",
          @@ -805,8 +805,8 @@ width="516" height="685" viewBox="-102 -102 516 685">container

          they did it in style

          -

          a header

          +container

          they did it in style

          +

          a header

          a line of text and an

          {
           	indented: "block",
          @@ -805,8 +805,8 @@ width="566" height="735" viewBox="-90 -90 566 735">xab  
          +
          +
          +
          \ No newline at end of file
          diff --git a/e2etests/testdata/regression/elk_loop_panic/elk/board.exp.json b/e2etests/testdata/regression/elk_loop_panic/elk/board.exp.json
          new file mode 100644
          index 000000000..58c402aea
          --- /dev/null
          +++ b/e2etests/testdata/regression/elk_loop_panic/elk/board.exp.json
          @@ -0,0 +1,175 @@
          +{
          +  "name": "",
          +  "fontFamily": "SourceSansPro",
          +  "shapes": [
          +    {
          +      "id": "x",
          +      "type": "",
          +      "pos": {
          +        "x": 12,
          +        "y": 12
          +      },
          +      "width": 446,
          +      "height": 276,
          +      "opacity": 1,
          +      "strokeDash": 0,
          +      "strokeWidth": 2,
          +      "borderRadius": 0,
          +      "fill": "#E3E9FD",
          +      "stroke": "#0D32B2",
          +      "shadow": false,
          +      "3d": false,
          +      "multiple": false,
          +      "tooltip": "",
          +      "link": "",
          +      "icon": null,
          +      "iconPosition": "",
          +      "blend": false,
          +      "fields": null,
          +      "methods": null,
          +      "columns": null,
          +      "label": "x",
          +      "fontSize": 28,
          +      "fontFamily": "DEFAULT",
          +      "language": "",
          +      "color": "#0A0F25",
          +      "italic": false,
          +      "bold": false,
          +      "underline": false,
          +      "labelWidth": 18,
          +      "labelHeight": 41,
          +      "labelPosition": "INSIDE_TOP_CENTER",
          +      "zIndex": 0,
          +      "level": 1
          +    },
          +    {
          +      "id": "x.a",
          +      "type": "",
          +      "pos": {
          +        "x": 137,
          +        "y": 87
          +      },
          +      "width": 113,
          +      "height": 126,
          +      "opacity": 1,
          +      "strokeDash": 0,
          +      "strokeWidth": 2,
          +      "borderRadius": 0,
          +      "fill": "#EDF0FD",
          +      "stroke": "#0D32B2",
          +      "shadow": false,
          +      "3d": false,
          +      "multiple": false,
          +      "tooltip": "",
          +      "link": "",
          +      "icon": null,
          +      "iconPosition": "",
          +      "blend": false,
          +      "fields": null,
          +      "methods": null,
          +      "columns": null,
          +      "label": "a",
          +      "fontSize": 16,
          +      "fontFamily": "DEFAULT",
          +      "language": "",
          +      "color": "#0A0F25",
          +      "italic": false,
          +      "bold": true,
          +      "underline": false,
          +      "labelWidth": 13,
          +      "labelHeight": 26,
          +      "labelPosition": "INSIDE_MIDDLE_CENTER",
          +      "zIndex": 0,
          +      "level": 2
          +    },
          +    {
          +      "id": "x.b",
          +      "type": "",
          +      "pos": {
          +        "x": 270,
          +        "y": 87
          +      },
          +      "width": 113,
          +      "height": 126,
          +      "opacity": 1,
          +      "strokeDash": 0,
          +      "strokeWidth": 2,
          +      "borderRadius": 0,
          +      "fill": "#EDF0FD",
          +      "stroke": "#0D32B2",
          +      "shadow": false,
          +      "3d": false,
          +      "multiple": false,
          +      "tooltip": "",
          +      "link": "",
          +      "icon": null,
          +      "iconPosition": "",
          +      "blend": false,
          +      "fields": null,
          +      "methods": null,
          +      "columns": null,
          +      "label": "b",
          +      "fontSize": 16,
          +      "fontFamily": "DEFAULT",
          +      "language": "",
          +      "color": "#0A0F25",
          +      "italic": false,
          +      "bold": true,
          +      "underline": false,
          +      "labelWidth": 13,
          +      "labelHeight": 26,
          +      "labelPosition": "INSIDE_MIDDLE_CENTER",
          +      "zIndex": 0,
          +      "level": 2
          +    }
          +  ],
          +  "connections": [
          +    {
          +      "id": "x.(a -> a)[0]",
          +      "src": "x.a",
          +      "srcArrow": "none",
          +      "srcLabel": "",
          +      "dst": "x.a",
          +      "dstArrow": "triangle",
          +      "dstLabel": "",
          +      "opacity": 1,
          +      "strokeDash": 0,
          +      "strokeWidth": 2,
          +      "stroke": "#0D32B2",
          +      "label": "",
          +      "fontSize": 16,
          +      "fontFamily": "DEFAULT",
          +      "language": "",
          +      "color": "#676C7E",
          +      "italic": true,
          +      "bold": false,
          +      "underline": false,
          +      "labelWidth": 0,
          +      "labelHeight": 0,
          +      "labelPosition": "",
          +      "labelPercentage": 0,
          +      "route": [
          +        {
          +          "x": 137,
          +          "y": 129
          +        },
          +        {
          +          "x": 87,
          +          "y": 129
          +        },
          +        {
          +          "x": 87,
          +          "y": 171
          +        },
          +        {
          +          "x": 137,
          +          "y": 171
          +        }
          +      ],
          +      "animated": false,
          +      "tooltip": "",
          +      "icon": null,
          +      "zIndex": 0
          +    }
          +  ]
          +}
          diff --git a/e2etests/testdata/regression/elk_loop_panic/elk/sketch.exp.svg b/e2etests/testdata/regression/elk_loop_panic/elk/sketch.exp.svg
          new file mode 100644
          index 000000000..c63d14456
          --- /dev/null
          +++ b/e2etests/testdata/regression/elk_loop_panic/elk/sketch.exp.svg
          @@ -0,0 +1,59 @@
          +
          +xab  
          +
          +
          +
          \ No newline at end of file
          
          From 53c6b5bb62eda1c5840143443e981595b9c97f1b Mon Sep 17 00:00:00 2001
          From: Alexander Wang 
          Date: Wed, 18 Jan 2023 14:37:46 -0800
          Subject: [PATCH 26/65] changelog
          
          ---
           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 7226a211e..0a3afb0f8 100644
          --- a/ci/release/changelogs/next.md
          +++ b/ci/release/changelogs/next.md
          @@ -20,3 +20,4 @@
           - Fixes code snippets not being tall enough with leading newlines. [#664](https://github.com/terrastruct/d2/pull/664)
           - Icon URLs that needed escaping (e.g. with ampersands) are handled correctly by CLI. [#666](https://github.com/terrastruct/d2/pull/666)
           - Fixes markdown shapes being slightly too short for their text in some cases. [#665](https://github.com/terrastruct/d2/pull/665)
          +- Fixes self-connections inside layouts when using ELK. [#676](https://github.com/terrastruct/d2/pull/676)
          
          From 7651aedb8cd18625d00cfa82686998f79da3c2f8 Mon Sep 17 00:00:00 2001
          From: Alexander Wang 
          Date: Thu, 19 Jan 2023 00:26:00 -0800
          Subject: [PATCH 27/65] fix opacity for labels
          
          ---
           d2renderers/d2svg/d2svg.go                    |   6 +
           e2etests/regression_test.go                   |  10 +
           .../opacity-on-label/dagre/board.exp.json     |  86 ++
           .../opacity-on-label/dagre/sketch.exp.svg     | 817 ++++++++++++++++++
           .../opacity-on-label/elk/board.exp.json       |  86 ++
           .../opacity-on-label/elk/sketch.exp.svg       | 817 ++++++++++++++++++
           .../stable/stylish/dagre/sketch.exp.svg       |   4 +-
           .../stable/stylish/elk/sketch.exp.svg         |   4 +-
           .../transparent_3d/dagre/sketch.exp.svg       |   2 +-
           .../stable/transparent_3d/elk/sketch.exp.svg  |   2 +-
           10 files changed, 1828 insertions(+), 6 deletions(-)
           create mode 100644 e2etests/testdata/regression/opacity-on-label/dagre/board.exp.json
           create mode 100644 e2etests/testdata/regression/opacity-on-label/dagre/sketch.exp.svg
           create mode 100644 e2etests/testdata/regression/opacity-on-label/elk/board.exp.json
           create mode 100644 e2etests/testdata/regression/opacity-on-label/elk/sketch.exp.svg
          
          diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go
          index 8082c033c..f21b1bce1 100644
          --- a/d2renderers/d2svg/d2svg.go
          +++ b/d2renderers/d2svg/d2svg.go
          @@ -885,6 +885,9 @@ func drawShape(writer io.Writer, targetShape d2target.Shape, sketchRunner *d2ske
           			if targetShape.Stroke != "" {
           				mdStyle += fmt.Sprintf("color:%s;", targetShape.Stroke)
           			}
          +			if targetShape.Opacity != 1.0 {
          +				mdStyle += fmt.Sprintf("opacity:%f;", targetShape.Opacity)
          +			}
           
           			fmt.Fprintf(writer, `
          %v
          `, mdStyle, render) fmt.Fprint(writer, ``) @@ -894,6 +897,9 @@ func drawShape(writer io.Writer, targetShape d2target.Shape, sketchRunner *d2ske fontColor = targetShape.Color } textStyle := fmt.Sprintf("text-anchor:%s;font-size:%vpx;fill:%s", "middle", targetShape.FontSize, fontColor) + if targetShape.Opacity != 1.0 { + textStyle += fmt.Sprintf(";opacity:%f;", targetShape.Opacity) + } x := labelTL.X + float64(targetShape.LabelWidth)/2. // text is vertically positioned at its baseline which is at labelTL+FontSize y := labelTL.Y + float64(targetShape.FontSize) diff --git a/e2etests/regression_test.go b/e2etests/regression_test.go index 13646d942..6752d7f73 100644 --- a/e2etests/regression_test.go +++ b/e2etests/regression_test.go @@ -380,6 +380,16 @@ no leading: |python } x.a -> x.a +`, + }, + { + name: "opacity-on-label", + script: `x.style.opacity: 0.4 +y: |md + linux: because a PC is a terrible thing to waste +| { + style.opacity: 0.4 +} `, }, } diff --git a/e2etests/testdata/regression/opacity-on-label/dagre/board.exp.json b/e2etests/testdata/regression/opacity-on-label/dagre/board.exp.json new file mode 100644 index 000000000..db2020838 --- /dev/null +++ b/e2etests/testdata/regression/opacity-on-label/dagre/board.exp.json @@ -0,0 +1,86 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "x", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 113, + "height": 126, + "opacity": 0.4, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "x", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "y", + "type": "text", + "pos": { + "x": 173, + "y": 51 + }, + "width": 304, + "height": 24, + "opacity": 0.4, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "transparent", + "stroke": "#0A0F25", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "linux: because a PC is a terrible thing to waste", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 304, + "labelHeight": 24, + "zIndex": 0, + "level": 1 + } + ], + "connections": [] +} diff --git a/e2etests/testdata/regression/opacity-on-label/dagre/sketch.exp.svg b/e2etests/testdata/regression/opacity-on-label/dagre/sketch.exp.svg new file mode 100644 index 000000000..8ed199b2a --- /dev/null +++ b/e2etests/testdata/regression/opacity-on-label/dagre/sketch.exp.svg @@ -0,0 +1,817 @@ + +x

          linux: because a PC is a terrible thing to waste

          +
          + + +
          \ No newline at end of file diff --git a/e2etests/testdata/regression/opacity-on-label/elk/board.exp.json b/e2etests/testdata/regression/opacity-on-label/elk/board.exp.json new file mode 100644 index 000000000..bc30bf771 --- /dev/null +++ b/e2etests/testdata/regression/opacity-on-label/elk/board.exp.json @@ -0,0 +1,86 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "x", + "type": "", + "pos": { + "x": 12, + "y": 12 + }, + "width": 113, + "height": 126, + "opacity": 0.4, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "x", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "y", + "type": "text", + "pos": { + "x": 145, + "y": 63 + }, + "width": 304, + "height": 24, + "opacity": 0.4, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "transparent", + "stroke": "#0A0F25", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "linux: because a PC is a terrible thing to waste", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 304, + "labelHeight": 24, + "zIndex": 0, + "level": 1 + } + ], + "connections": [] +} diff --git a/e2etests/testdata/regression/opacity-on-label/elk/sketch.exp.svg b/e2etests/testdata/regression/opacity-on-label/elk/sketch.exp.svg new file mode 100644 index 000000000..fa2b77780 --- /dev/null +++ b/e2etests/testdata/regression/opacity-on-label/elk/sketch.exp.svg @@ -0,0 +1,817 @@ + +x

          linux: because a PC is a terrible thing to waste

          +
          + + +
          \ No newline at end of file diff --git a/e2etests/testdata/stable/stylish/dagre/sketch.exp.svg b/e2etests/testdata/stable/stylish/dagre/sketch.exp.svg index b1f14ed51..12c7c3837 100644 --- a/e2etests/testdata/stable/stylish/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/stylish/dagre/sketch.exp.svg @@ -47,9 +47,9 @@ width="323" height="580" viewBox="-104 -105 323 580"> + + + + +x

          linux: because a PC is a terrible thing to waste

          +
          a You don't have to know how the computer works,just how to work the computer. + + + \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg b/d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg index ca6bb4d1f..a73606a4b 100644 --- a/d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg @@ -51,7 +51,7 @@ width="1029" height="664" viewBox="-102 -102 1029 664">x

          linux: because a PC is a terrible thing to waste

          -
          - - +x

          linux: because a PC is a terrible thing to waste

          +
          a You don't have to know how the computer works,just how to work the computer. + + \ No newline at end of file diff --git a/e2etests/testdata/regression/opacity-on-label/elk/board.exp.json b/e2etests/testdata/regression/opacity-on-label/elk/board.exp.json index bc30bf771..3ae7ceeba 100644 --- a/e2etests/testdata/regression/opacity-on-label/elk/board.exp.json +++ b/e2etests/testdata/regression/opacity-on-label/elk/board.exp.json @@ -6,7 +6,7 @@ "id": "x", "type": "", "pos": { - "x": 12, + "x": 116, "y": 12 }, "width": 113, @@ -46,7 +46,7 @@ "id": "y", "type": "text", "pos": { - "x": 145, + "x": 249, "y": 63 }, "width": 304, @@ -80,7 +80,87 @@ "labelHeight": 24, "zIndex": 0, "level": 1 + }, + { + "id": "a", + "type": "", + "pos": { + "x": 116, + "y": 375 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 } ], - "connections": [] + "connections": [ + { + "id": "(x -> a)[0]", + "src": "x", + "srcArrow": "none", + "srcLabel": "", + "dst": "a", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 0.4, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "You don't have to know how the computer works,\njust how to work the computer.", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 322, + "labelHeight": 37, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 173, + "y": 138 + }, + { + "x": 173, + "y": 375 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ] } diff --git a/e2etests/testdata/regression/opacity-on-label/elk/sketch.exp.svg b/e2etests/testdata/regression/opacity-on-label/elk/sketch.exp.svg index fa2b77780..28aa950fe 100644 --- a/e2etests/testdata/regression/opacity-on-label/elk/sketch.exp.svg +++ b/e2etests/testdata/regression/opacity-on-label/elk/sketch.exp.svg @@ -3,7 +3,7 @@ id="d2-svg" style="background: white;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" -width="641" height="330" viewBox="-90 -90 641 330">x

          linux: because a PC is a terrible thing to waste

          -
          - - +x

          linux: because a PC is a terrible thing to waste

          +
          a You don't have to know how the computer works,just how to work the computer. + + \ No newline at end of file From 68e75bc8d4663b1182862ee5898230730ee642bb Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 00:46:57 -0800 Subject: [PATCH 30/65] fix --- ci/release/changelogs/next.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index bbe2de2cb..9dda6efa4 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -18,7 +18,7 @@ - Fixes tooltip/link attributes being ignored for `sql_table` and `class`. [#658](https://github.com/terrastruct/d2/pull/658) - Fixes arrowheads sometimes appearing broken with sketch on. [#656](https://github.com/terrastruct/d2/pull/656) - Fixes code snippets not being tall enough with leading newlines. [#664](https://github.com/terrastruct/d2/pull/664) -- Opacity was not being applied to labels of shapes. [#677](https://github.com/terrastruct/d2/pull/677) +- Opacity was not being applied to labels of shapes (and other edge cases). [#677](https://github.com/terrastruct/d2/pull/677) - Icon URLs that needed escaping (e.g. with ampersands) are handled correctly by CLI. [#666](https://github.com/terrastruct/d2/pull/666) - Fixes markdown shapes being slightly too short for their text in some cases. [#665](https://github.com/terrastruct/d2/pull/665) - Fixes self-connections inside layouts when using ELK. [#676](https://github.com/terrastruct/d2/pull/676) From 74b54f3f8a74f77cacfd9d60a78bc5795bfbf595 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 00:52:10 -0800 Subject: [PATCH 31/65] update --- d2renderers/d2sketch/sketch_test.go | 5 +++++ d2renderers/d2sketch/testdata/opacity/sketch.exp.svg | 8 +++++--- d2renderers/d2svg/d2svg.go | 2 +- .../dagre/sketch.exp.svg | 6 +++--- .../code_leading_trailing_newlines/elk/sketch.exp.svg | 6 +++--- .../dagre_broken_arrowhead/dagre/sketch.exp.svg | 2 +- .../dagre_broken_arrowhead/elk/sketch.exp.svg | 2 +- .../dagre_edge_label_spacing/dagre/sketch.exp.svg | 2 +- .../dagre_edge_label_spacing/elk/sketch.exp.svg | 2 +- .../regression/dagre_special_ids/dagre/sketch.exp.svg | 2 +- .../regression/dagre_special_ids/elk/sketch.exp.svg | 2 +- .../regression/elk_alignment/dagre/sketch.exp.svg | 2 +- .../regression/elk_alignment/elk/sketch.exp.svg | 2 +- .../elk_img_empty_label_panic/dagre/sketch.exp.svg | 2 +- .../elk_img_empty_label_panic/elk/sketch.exp.svg | 2 +- .../regression/elk_loop_panic/dagre/sketch.exp.svg | 2 +- .../regression/elk_loop_panic/elk/sketch.exp.svg | 2 +- .../testdata/regression/elk_order/dagre/sketch.exp.svg | 4 ++-- .../testdata/regression/elk_order/elk/sketch.exp.svg | 4 ++-- .../regression/empty_sequence/dagre/sketch.exp.svg | 2 +- .../regression/empty_sequence/elk/sketch.exp.svg | 2 +- .../regression/md_h1_li_li/dagre/sketch.exp.svg | 2 +- .../testdata/regression/md_h1_li_li/elk/sketch.exp.svg | 2 +- .../testdata/regression/no-lexer/dagre/sketch.exp.svg | 2 +- .../testdata/regression/no-lexer/elk/sketch.exp.svg | 2 +- .../only_header_class_table/dagre/sketch.exp.svg | 4 ++-- .../only_header_class_table/elk/sketch.exp.svg | 4 ++-- .../overlapping-edge-label/dagre/sketch.exp.svg | 2 +- .../overlapping-edge-label/elk/sketch.exp.svg | 2 +- .../regression/query_param_escape/dagre/sketch.exp.svg | 2 +- .../regression/query_param_escape/elk/sketch.exp.svg | 2 +- .../sequence_diagram_name_crash/dagre/sketch.exp.svg | 2 +- .../sequence_diagram_name_crash/elk/sketch.exp.svg | 2 +- .../sequence_diagram_no_message/dagre/sketch.exp.svg | 2 +- .../sequence_diagram_no_message/elk/sketch.exp.svg | 2 +- .../sequence_diagram_span_cover/dagre/sketch.exp.svg | 2 +- .../sequence_diagram_span_cover/elk/sketch.exp.svg | 2 +- .../regression/sql_table_overflow/dagre/sketch.exp.svg | 4 ++-- .../regression/sql_table_overflow/elk/sketch.exp.svg | 4 ++-- .../unnamed_class_table_code/dagre/sketch.exp.svg | 8 ++++---- .../unnamed_class_table_code/elk/sketch.exp.svg | 8 ++++---- e2etests/testdata/sanity/1_to_2/dagre/sketch.exp.svg | 2 +- e2etests/testdata/sanity/1_to_2/elk/sketch.exp.svg | 2 +- e2etests/testdata/sanity/basic/dagre/sketch.exp.svg | 2 +- e2etests/testdata/sanity/basic/elk/sketch.exp.svg | 2 +- .../sanity/child_to_child/dagre/sketch.exp.svg | 2 +- .../testdata/sanity/child_to_child/elk/sketch.exp.svg | 2 +- .../sanity/connection_label/dagre/sketch.exp.svg | 2 +- .../sanity/connection_label/elk/sketch.exp.svg | 2 +- .../testdata/stable/all_shapes/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/all_shapes/elk/sketch.exp.svg | 2 +- .../stable/all_shapes_multiple/dagre/sketch.exp.svg | 2 +- .../stable/all_shapes_multiple/elk/sketch.exp.svg | 2 +- .../stable/all_shapes_shadow/dagre/sketch.exp.svg | 2 +- .../stable/all_shapes_shadow/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/animated/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/animated/elk/sketch.exp.svg | 2 +- .../stable/arrowhead_adjustment/dagre/sketch.exp.svg | 2 +- .../stable/arrowhead_adjustment/elk/sketch.exp.svg | 2 +- .../stable/arrowhead_labels/dagre/sketch.exp.svg | 2 +- .../stable/arrowhead_labels/elk/sketch.exp.svg | 2 +- .../testdata/stable/binary_tree/dagre/sketch.exp.svg | 2 +- .../testdata/stable/binary_tree/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/chaos1/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/chaos1/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/chaos2/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/chaos2/elk/sketch.exp.svg | 2 +- .../stable/child_parent_edges/dagre/sketch.exp.svg | 2 +- .../stable/child_parent_edges/elk/sketch.exp.svg | 2 +- .../stable/circular_dependency/dagre/sketch.exp.svg | 2 +- .../stable/circular_dependency/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/class/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/class/elk/sketch.exp.svg | 2 +- .../testdata/stable/code_snippet/dagre/sketch.exp.svg | 4 ++-- .../testdata/stable/code_snippet/elk/sketch.exp.svg | 4 ++-- .../stable/connected_container/dagre/sketch.exp.svg | 2 +- .../stable/connected_container/elk/sketch.exp.svg | 2 +- .../stable/constant_near_stress/dagre/sketch.exp.svg | 4 ++-- .../stable/constant_near_stress/elk/sketch.exp.svg | 4 ++-- .../stable/constant_near_title/dagre/sketch.exp.svg | 4 ++-- .../stable/constant_near_title/elk/sketch.exp.svg | 4 ++-- .../stable/container_edges/dagre/sketch.exp.svg | 2 +- .../testdata/stable/container_edges/elk/sketch.exp.svg | 2 +- .../stable/crow_foot_arrowhead/dagre/sketch.exp.svg | 2 +- .../stable/crow_foot_arrowhead/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/dense/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/dense/elk/sketch.exp.svg | 2 +- .../stable/different_subgraphs/dagre/sketch.exp.svg | 2 +- .../stable/different_subgraphs/elk/sketch.exp.svg | 2 +- .../testdata/stable/direction/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/direction/elk/sketch.exp.svg | 2 +- .../testdata/stable/font_colors/dagre/sketch.exp.svg | 2 +- .../testdata/stable/font_colors/elk/sketch.exp.svg | 2 +- .../testdata/stable/font_sizes/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/font_sizes/elk/sketch.exp.svg | 2 +- .../stable/giant_markdown_test/dagre/sketch.exp.svg | 2 +- .../stable/giant_markdown_test/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/hr/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/hr/elk/sketch.exp.svg | 2 +- .../testdata/stable/icon-label/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/icon-label/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/images/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/images/elk/sketch.exp.svg | 2 +- .../testdata/stable/investigate/dagre/sketch.exp.svg | 2 +- .../testdata/stable/investigate/elk/sketch.exp.svg | 2 +- .../testdata/stable/large_arch/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/large_arch/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/latex/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/latex/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/li1/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/li1/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/li2/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/li2/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/li3/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/li3/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/li4/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/li4/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/links/dagre/sketch.exp.svg | 6 +++--- e2etests/testdata/stable/links/elk/sketch.exp.svg | 6 +++--- e2etests/testdata/stable/lone_h1/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/lone_h1/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/markdown/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/markdown/elk/sketch.exp.svg | 2 +- .../stable/markdown_stroke_fill/dagre/sketch.exp.svg | 4 ++-- .../stable/markdown_stroke_fill/elk/sketch.exp.svg | 4 ++-- .../stable/md_2space_newline/dagre/sketch.exp.svg | 2 +- .../stable/md_2space_newline/elk/sketch.exp.svg | 2 +- .../stable/md_backslash_newline/dagre/sketch.exp.svg | 2 +- .../stable/md_backslash_newline/elk/sketch.exp.svg | 2 +- .../stable/md_code_block_fenced/dagre/sketch.exp.svg | 2 +- .../stable/md_code_block_fenced/elk/sketch.exp.svg | 2 +- .../stable/md_code_block_indented/dagre/sketch.exp.svg | 2 +- .../stable/md_code_block_indented/elk/sketch.exp.svg | 2 +- .../stable/md_code_inline/dagre/sketch.exp.svg | 2 +- .../testdata/stable/md_code_inline/elk/sketch.exp.svg | 2 +- .../stable/multiline_text/dagre/sketch.exp.svg | 2 +- .../testdata/stable/multiline_text/elk/sketch.exp.svg | 2 +- .../stable/multiple_trees/dagre/sketch.exp.svg | 2 +- .../testdata/stable/multiple_trees/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/n22_e32/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/n22_e32/elk/sketch.exp.svg | 2 +- .../stable/number_connections/dagre/sketch.exp.svg | 2 +- .../stable/number_connections/elk/sketch.exp.svg | 2 +- .../stable/one_container_loop/dagre/sketch.exp.svg | 2 +- .../stable/one_container_loop/elk/sketch.exp.svg | 2 +- .../one_three_one_container/dagre/sketch.exp.svg | 2 +- .../stable/one_three_one_container/elk/sketch.exp.svg | 2 +- .../dagre/sketch.exp.svg | 2 +- .../elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/p/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/p/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/pre/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/pre/elk/sketch.exp.svg | 2 +- .../stable/self-referencing/dagre/sketch.exp.svg | 2 +- .../stable/self-referencing/elk/sketch.exp.svg | 2 +- .../dagre/sketch.exp.svg | 2 +- .../sequence_diagram_actor_distance/elk/sketch.exp.svg | 2 +- .../sequence_diagram_all_shapes/dagre/sketch.exp.svg | 8 ++++---- .../sequence_diagram_all_shapes/elk/sketch.exp.svg | 8 ++++---- .../sequence_diagram_distance/dagre/sketch.exp.svg | 2 +- .../sequence_diagram_distance/elk/sketch.exp.svg | 2 +- .../sequence_diagram_groups/dagre/sketch.exp.svg | 2 +- .../stable/sequence_diagram_groups/elk/sketch.exp.svg | 2 +- .../sequence_diagram_long_note/dagre/sketch.exp.svg | 2 +- .../sequence_diagram_long_note/elk/sketch.exp.svg | 2 +- .../dagre/sketch.exp.svg | 2 +- .../sequence_diagram_nested_groups/elk/sketch.exp.svg | 2 +- .../sequence_diagram_nested_span/dagre/sketch.exp.svg | 2 +- .../sequence_diagram_nested_span/elk/sketch.exp.svg | 2 +- .../stable/sequence_diagram_note/dagre/sketch.exp.svg | 2 +- .../stable/sequence_diagram_note/elk/sketch.exp.svg | 2 +- .../stable/sequence_diagram_real/dagre/sketch.exp.svg | 2 +- .../stable/sequence_diagram_real/elk/sketch.exp.svg | 2 +- .../sequence_diagram_self_edges/dagre/sketch.exp.svg | 2 +- .../sequence_diagram_self_edges/elk/sketch.exp.svg | 2 +- .../sequence_diagram_simple/dagre/sketch.exp.svg | 2 +- .../stable/sequence_diagram_simple/elk/sketch.exp.svg | 2 +- .../stable/sequence_diagram_span/dagre/sketch.exp.svg | 2 +- .../stable/sequence_diagram_span/elk/sketch.exp.svg | 2 +- .../stable/sequence_diagrams/dagre/sketch.exp.svg | 2 +- .../stable/sequence_diagrams/elk/sketch.exp.svg | 2 +- .../sql_table_tooltip_animated/dagre/sketch.exp.svg | 6 +++--- .../sql_table_tooltip_animated/elk/sketch.exp.svg | 6 +++--- .../testdata/stable/sql_tables/dagre/sketch.exp.svg | 10 +++++----- e2etests/testdata/stable/sql_tables/elk/sketch.exp.svg | 10 +++++----- .../testdata/stable/square_3d/dagre/sketch.exp.svg | 4 ++-- e2etests/testdata/stable/square_3d/elk/sketch.exp.svg | 4 ++-- .../straight_hierarchy_container/dagre/sketch.exp.svg | 2 +- .../straight_hierarchy_container/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/stylish/dagre/sketch.exp.svg | 4 ++-- e2etests/testdata/stable/stylish/elk/sketch.exp.svg | 4 ++-- .../stable/text_font_sizes/dagre/sketch.exp.svg | 2 +- .../testdata/stable/text_font_sizes/elk/sketch.exp.svg | 2 +- e2etests/testdata/stable/tooltips/dagre/sketch.exp.svg | 6 +++--- e2etests/testdata/stable/tooltips/elk/sketch.exp.svg | 6 +++--- .../stable/transparent_3d/dagre/sketch.exp.svg | 4 ++-- .../testdata/stable/transparent_3d/elk/sketch.exp.svg | 4 ++-- .../stable/unnamed_only_height/dagre/sketch.exp.svg | 8 ++++---- .../stable/unnamed_only_height/elk/sketch.exp.svg | 8 ++++---- .../stable/unnamed_only_width/dagre/sketch.exp.svg | 8 ++++---- .../stable/unnamed_only_width/elk/sketch.exp.svg | 8 ++++---- e2etests/testdata/stable/us_map/dagre/sketch.exp.svg | 2 +- e2etests/testdata/stable/us_map/elk/sketch.exp.svg | 2 +- .../todo/container_child_edge/dagre/sketch.exp.svg | 2 +- .../todo/container_child_edge/elk/sketch.exp.svg | 2 +- .../font_sizes_containers_large/dagre/sketch.exp.svg | 2 +- .../font_sizes_containers_large/elk/sketch.exp.svg | 2 +- .../todo/font_sizes_large/dagre/sketch.exp.svg | 2 +- .../testdata/todo/font_sizes_large/elk/sketch.exp.svg | 2 +- .../dagre/sketch.exp.svg | 2 +- .../elk/sketch.exp.svg | 2 +- .../todo/shape_set_width_height/dagre/sketch.exp.svg | 10 +++++----- .../todo/shape_set_width_height/elk/sketch.exp.svg | 10 +++++----- .../testdata/todo/tall_edge_label/dagre/sketch.exp.svg | 2 +- .../testdata/todo/tall_edge_label/elk/sketch.exp.svg | 2 +- 215 files changed, 299 insertions(+), 292 deletions(-) diff --git a/d2renderers/d2sketch/sketch_test.go b/d2renderers/d2sketch/sketch_test.go index 54d3b8b5b..f431a62a2 100644 --- a/d2renderers/d2sketch/sketch_test.go +++ b/d2renderers/d2sketch/sketch_test.go @@ -340,6 +340,11 @@ x -> a: { label: You don't have to know how the computer works,\njust how to work the computer. style.opacity: 0.4 } +users: { + shape: sql_table + last_login: datetime + style.opacity: 0.4 +} `, }, } diff --git a/d2renderers/d2sketch/testdata/opacity/sketch.exp.svg b/d2renderers/d2sketch/testdata/opacity/sketch.exp.svg index b70d25d7f..fbb3d712e 100644 --- a/d2renderers/d2sketch/testdata/opacity/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/opacity/sketch.exp.svg @@ -3,7 +3,7 @@ id="d2-svg" style="background: white;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" -width="855" height="595" viewBox="-100 -102 855 595"> \ No newline at end of file diff --git a/e2etests/testdata/regression/elk_img_empty_label_panic/elk/sketch.exp.svg b/e2etests/testdata/regression/elk_img_empty_label_panic/elk/sketch.exp.svg index 2ca3fb21b..6f53328fa 100644 --- a/e2etests/testdata/regression/elk_img_empty_label_panic/elk/sketch.exp.svg +++ b/e2etests/testdata/regression/elk_img_empty_label_panic/elk/sketch.exp.svg @@ -39,7 +39,7 @@ width="452" height="332" viewBox="-90 -90 452 332"> \ No newline at end of file diff --git a/e2etests/testdata/regression/elk_loop_panic/dagre/sketch.exp.svg b/e2etests/testdata/regression/elk_loop_panic/dagre/sketch.exp.svg index 5a3042961..48ca96d52 100644 --- a/e2etests/testdata/regression/elk_loop_panic/dagre/sketch.exp.svg +++ b/e2etests/testdata/regression/elk_loop_panic/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="630" height="430" viewBox="-102 -102 630 430">

          Oldest message

          +

          Oldest message

          Offset

          Last message

          Next message will be
          inserted here

          -
          M0M1M2M3M4M5M6 +
          M0M1M2M3M4M5M6

          Oldest message

          +

          Oldest message

          Offset

          Last message

          Next message will be
          inserted here

          -
          M0M1M2M3M4M5M6 +
          M0M1M2M3M4M5M6 aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 +aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 diff --git a/e2etests/testdata/stable/chaos2/elk/sketch.exp.svg b/e2etests/testdata/stable/chaos2/elk/sketch.exp.svg index 08bad938b..e1498a328 100644 --- a/e2etests/testdata/stable/chaos2/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/chaos2/elk/sketch.exp.svg @@ -796,7 +796,7 @@ width="1275" height="2738" viewBox="-90 -90 1275 2738">aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 +aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 diff --git a/e2etests/testdata/stable/child_parent_edges/dagre/sketch.exp.svg b/e2etests/testdata/stable/child_parent_edges/dagre/sketch.exp.svg index f8a893097..7bc1e8325 100644 --- a/e2etests/testdata/stable/child_parent_edges/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/child_parent_edges/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="698" height="630" viewBox="-102 -102 698 630">xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          +xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          If we can't fix it, it ain't broke.

          Dieters live life in the fasting lane.

          -
          i am top lefti am top righti am bottom lefti am bottom right +
          i am top lefti am top righti am bottom lefti am bottom right xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          +xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          If we can't fix it, it ain't broke.

          Dieters live life in the fasting lane.

          -
          i am top lefti am top righti am bottom lefti am bottom right +
          i am top lefti am top righti am bottom lefti am bottom right poll the peopleresultsunfavorablefavorablewill of the people

          A winning strategy

          -
          +poll the peopleresultsunfavorablefavorablewill of the people

          A winning strategy

          +
          poll the peopleresultsunfavorablefavorablewill of the people

          A winning strategy

          -
          +poll the peopleresultsunfavorablefavorablewill of the people

          A winning strategy

          +
          mixed togethersugarsolution we get +mixed togethersugarsolution we get mixed togethersugarsolution we get +mixed togethersugarsolution we get

          Markdown: Syntax

          -
          ab +
          ab

          Markdown: Syntax

          -
          ab +
          ab container

          they did it in style

          +container

          they did it in style

          a header

          a line of text and an

          {
          @@ -805,7 +805,7 @@ width="516" height="686" viewBox="-102 -102 516 686">container

          they did it in style

          +container

          they did it in style

          a header

          a line of text and an

          {
          @@ -805,7 +805,7 @@ width="566" height="736" viewBox="-90 -90 566 736">markdown

          Lorem ipsum dolor sit amet, consectetur adipiscing elit,
          +markdown

          Lorem ipsum dolor sit amet, consectetur adipiscing elit,
          sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

          diff --git a/e2etests/testdata/stable/md_2space_newline/elk/sketch.exp.svg b/e2etests/testdata/stable/md_2space_newline/elk/sketch.exp.svg index 556034da3..20588b494 100644 --- a/e2etests/testdata/stable/md_2space_newline/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/md_2space_newline/elk/sketch.exp.svg @@ -796,7 +796,7 @@ width="813" height="402" viewBox="-90 -90 813 402">markdown

          Lorem ipsum dolor sit amet, consectetur adipiscing elit,
          +markdown

          Lorem ipsum dolor sit amet, consectetur adipiscing elit,
          sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

          diff --git a/e2etests/testdata/stable/md_backslash_newline/dagre/sketch.exp.svg b/e2etests/testdata/stable/md_backslash_newline/dagre/sketch.exp.svg index 02882dac2..c8ae1c67d 100644 --- a/e2etests/testdata/stable/md_backslash_newline/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/md_backslash_newline/dagre/sketch.exp.svg @@ -796,7 +796,7 @@ width="763" height="352" viewBox="-102 -102 763 352">markdown

          Lorem ipsum dolor sit amet, consectetur adipiscing elit,
          +markdown

          Lorem ipsum dolor sit amet, consectetur adipiscing elit,
          sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

          diff --git a/e2etests/testdata/stable/md_backslash_newline/elk/sketch.exp.svg b/e2etests/testdata/stable/md_backslash_newline/elk/sketch.exp.svg index 36b39bde1..675ff5992 100644 --- a/e2etests/testdata/stable/md_backslash_newline/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/md_backslash_newline/elk/sketch.exp.svg @@ -796,7 +796,7 @@ width="813" height="402" viewBox="-90 -90 813 402">markdown

          Lorem ipsum dolor sit amet, consectetur adipiscing elit,
          +markdown

          Lorem ipsum dolor sit amet, consectetur adipiscing elit,
          sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

          diff --git a/e2etests/testdata/stable/md_code_block_fenced/dagre/sketch.exp.svg b/e2etests/testdata/stable/md_code_block_fenced/dagre/sketch.exp.svg index e6e3efc9b..f56147b8e 100644 --- a/e2etests/testdata/stable/md_code_block_fenced/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/md_code_block_fenced/dagre/sketch.exp.svg @@ -801,7 +801,7 @@ width="400" height="767" viewBox="-102 -102 400 767">

          code

          -
          ab +
          ab

          code

          -
          ab +
          ab bearmama bearpapa bear +bearmama bearpapa bear bearmama bearpapa bear +bearmama bearpapa bear abcd circle filled-circle + + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json b/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json new file mode 100644 index 000000000..bb09866a6 --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json @@ -0,0 +1,246 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 12, + "y": 12 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "a", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "", + "pos": { + "x": 12, + "y": 359 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "b", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "c", + "type": "", + "pos": { + "x": 145, + "y": 12 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "c", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "d", + "type": "", + "pos": { + "x": 145, + "y": 359 + }, + "width": 114, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "d", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 14, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [ + { + "id": "(a <-> b)[0]", + "src": "a", + "srcArrow": "circle", + "srcLabel": "", + "dst": "b", + "dstArrow": "circle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "circle", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 36, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 68.5, + "y": 138 + }, + { + "x": 68.5, + "y": 359 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + }, + { + "id": "(c <-> d)[0]", + "src": "c", + "srcArrow": "filled-circle", + "srcLabel": "", + "dst": "d", + "dstArrow": "filled-circle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "filled-circle", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 73, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 202, + "y": 138 + }, + { + "x": 202, + "y": 359 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 0 + } + ] +} diff --git a/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg new file mode 100644 index 000000000..0d9c1f70f --- /dev/null +++ b/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg @@ -0,0 +1,60 @@ + +abcd circle filled-circle + + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg index 60d459d6a..e8e6605e7 100644 --- a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="491" height="577" viewBox="-102 -102 491 577">xyz + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/near-alone/elk/board.exp.json b/e2etests/testdata/stable/near-alone/elk/board.exp.json new file mode 100644 index 000000000..dba43ee30 --- /dev/null +++ b/e2etests/testdata/stable/near-alone/elk/board.exp.json @@ -0,0 +1,127 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "x", + "type": "", + "pos": { + "x": -56, + "y": -146 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "x", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "y", + "type": "", + "pos": { + "x": -57, + "y": 20 + }, + "width": 114, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "y", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 14, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "z", + "type": "", + "pos": { + "x": -189, + "y": 0 + }, + "width": 112, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "z", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 12, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [] +} diff --git a/e2etests/testdata/stable/near-alone/elk/sketch.exp.svg b/e2etests/testdata/stable/near-alone/elk/sketch.exp.svg new file mode 100644 index 000000000..3944c699c --- /dev/null +++ b/e2etests/testdata/stable/near-alone/elk/sketch.exp.svg @@ -0,0 +1,52 @@ + +xyz + + + \ No newline at end of file From 568742e50aeff5f02ed838593f6493d621193899 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 15:04:41 -0800 Subject: [PATCH 43/65] test --- .../constant_near_stress/dagre/board.exp.json | 84 +++++++++---------- .../constant_near_stress/dagre/sketch.exp.svg | 8 +- .../constant_near_stress/elk/board.exp.json | 84 +++++++++---------- .../constant_near_stress/elk/sketch.exp.svg | 8 +- 4 files changed, 92 insertions(+), 92 deletions(-) diff --git a/e2etests/testdata/stable/constant_near_stress/dagre/board.exp.json b/e2etests/testdata/stable/constant_near_stress/dagre/board.exp.json index e081c8884..8afeff0d2 100644 --- a/e2etests/testdata/stable/constant_near_stress/dagre/board.exp.json +++ b/e2etests/testdata/stable/constant_near_stress/dagre/board.exp.json @@ -122,11 +122,51 @@ "zIndex": 0, "level": 1 }, + { + "id": "bottom", + "type": "text", + "pos": { + "x": -414, + "y": 372 + }, + "width": 943, + "height": 131, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "transparent", + "stroke": "#0A0F25", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# Cats, no less liquid than their shadows, offer no angles to the wind.\n\nIf we can't fix it, it ain't broke.\n\nDieters live life in the fasting lane.", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 943, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, { "id": "Joe", "type": "person", "pos": { - "x": -151, + "x": -565, "y": 113 }, "width": 131, @@ -166,7 +206,7 @@ "id": "Donald", "type": "person", "pos": { - "x": 134, + "x": 548, "y": 113 }, "width": 155, @@ -202,46 +242,6 @@ "zIndex": 0, "level": 1 }, - { - "id": "bottom", - "type": "text", - "pos": { - "x": -414, - "y": 372 - }, - "width": 943, - "height": 131, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "transparent", - "stroke": "#0A0F25", - "shadow": false, - "3d": false, - "multiple": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "# Cats, no less liquid than their shadows, offer no angles to the wind.\n\nIf we can't fix it, it ain't broke.\n\nDieters live life in the fasting lane.", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "markdown", - "color": "#0A0F25", - "italic": false, - "bold": false, - "underline": false, - "labelWidth": 943, - "labelHeight": 131, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, { "id": "i am top left", "type": "text", diff --git a/e2etests/testdata/stable/constant_near_stress/dagre/sketch.exp.svg b/e2etests/testdata/stable/constant_near_stress/dagre/sketch.exp.svg index 7c4a6bc7c..59a33a536 100644 --- a/e2etests/testdata/stable/constant_near_stress/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/constant_near_stress/dagre/sketch.exp.svg @@ -3,7 +3,7 @@ id="d2-svg" style="background: white;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" -width="1410" height="748" viewBox="-643 -143 1410 748">xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          +xyThe top of the mountain

          Cats, no less liquid than their shadows, offer no angles to the wind.

          If we can't fix it, it ain't broke.

          Dieters live life in the fasting lane.

          -
          i am top lefti am top righti am bottom lefti am bottom right - +
          JoeDonaldi am top lefti am top righti am bottom lefti am bottom right + xyThe top of the mountainJoeDonald

          Cats, no less liquid than their shadows, offer no angles to the wind.

          +xyThe top of the mountain

          Cats, no less liquid than their shadows, offer no angles to the wind.

          If we can't fix it, it ain't broke.

          Dieters live life in the fasting lane.

          -
          i am top lefti am top righti am bottom lefti am bottom right - +
          JoeDonaldi am top lefti am top righti am bottom lefti am bottom right + xy + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/border-radius/elk/board.exp.json b/e2etests/testdata/stable/border-radius/elk/board.exp.json new file mode 100644 index 000000000..7b8a7b2e6 --- /dev/null +++ b/e2etests/testdata/stable/border-radius/elk/board.exp.json @@ -0,0 +1,87 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "x", + "type": "", + "pos": { + "x": 12, + "y": 12 + }, + "width": 113, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 4, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "x", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "y", + "type": "", + "pos": { + "x": 145, + "y": 12 + }, + "width": 114, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 10, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "y", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 14, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [] +} diff --git a/e2etests/testdata/stable/border-radius/elk/sketch.exp.svg b/e2etests/testdata/stable/border-radius/elk/sketch.exp.svg new file mode 100644 index 000000000..d64f2999d --- /dev/null +++ b/e2etests/testdata/stable/border-radius/elk/sketch.exp.svg @@ -0,0 +1,52 @@ + +xy + + + \ No newline at end of file From d4c4bc0c08a382be0c62055ce4b264623e4f2f9f Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 15:29:44 -0800 Subject: [PATCH 47/65] changelog --- 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 e4ceb4151..9126e3255 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -4,6 +4,7 @@ #### Features ๐Ÿš€ - `animated` keyword implemented for connections. [#652](https://github.com/terrastruct/d2/pull/652) +- `border-radius` keyword implemented for squares/rectangles. [#688](https://github.com/terrastruct/d2/pull/688) #### Improvements ๐Ÿงน From de1eed2072630cd743815c7e67025acdb2e48599 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 15:34:54 -0800 Subject: [PATCH 48/65] test --- .../testdata/stable/arrowhead_adjustment/dagre/sketch.exp.svg | 2 +- .../testdata/stable/arrowhead_adjustment/elk/sketch.exp.svg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2etests/testdata/stable/arrowhead_adjustment/dagre/sketch.exp.svg b/e2etests/testdata/stable/arrowhead_adjustment/dagre/sketch.exp.svg index 3eb3587e4..99f2f12e9 100644 --- a/e2etests/testdata/stable/arrowhead_adjustment/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/arrowhead_adjustment/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="494" height="793" viewBox="-108 -107 494 793">abcd circle filled-circle - - - - \ No newline at end of file diff --git a/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json b/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json deleted file mode 100644 index bb09866a6..000000000 --- a/e2etests/testdata/stable/circle_arrowhead#01/elk/board.exp.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "name": "", - "fontFamily": "SourceSansPro", - "shapes": [ - { - "id": "a", - "type": "", - "pos": { - "x": 12, - "y": 12 - }, - "width": 113, - "height": 126, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "#F7F8FE", - "stroke": "#0D32B2", - "shadow": false, - "3d": false, - "multiple": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "a", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 13, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "b", - "type": "", - "pos": { - "x": 12, - "y": 359 - }, - "width": 113, - "height": 126, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "#F7F8FE", - "stroke": "#0D32B2", - "shadow": false, - "3d": false, - "multiple": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "b", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 13, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "c", - "type": "", - "pos": { - "x": 145, - "y": 12 - }, - "width": 113, - "height": 126, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "#F7F8FE", - "stroke": "#0D32B2", - "shadow": false, - "3d": false, - "multiple": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "c", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 13, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - }, - { - "id": "d", - "type": "", - "pos": { - "x": 145, - "y": 359 - }, - "width": 114, - "height": 126, - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "borderRadius": 0, - "fill": "#F7F8FE", - "stroke": "#0D32B2", - "shadow": false, - "3d": false, - "multiple": false, - "tooltip": "", - "link": "", - "icon": null, - "iconPosition": "", - "blend": false, - "fields": null, - "methods": null, - "columns": null, - "label": "d", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#0A0F25", - "italic": false, - "bold": true, - "underline": false, - "labelWidth": 14, - "labelHeight": 26, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 0, - "level": 1 - } - ], - "connections": [ - { - "id": "(a <-> b)[0]", - "src": "a", - "srcArrow": "circle", - "srcLabel": "", - "dst": "b", - "dstArrow": "circle", - "dstLabel": "", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "#0D32B2", - "label": "circle", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#676C7E", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 36, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "labelPercentage": 0, - "route": [ - { - "x": 68.5, - "y": 138 - }, - { - "x": 68.5, - "y": 359 - } - ], - "animated": false, - "tooltip": "", - "icon": null, - "zIndex": 0 - }, - { - "id": "(c <-> d)[0]", - "src": "c", - "srcArrow": "filled-circle", - "srcLabel": "", - "dst": "d", - "dstArrow": "filled-circle", - "dstLabel": "", - "opacity": 1, - "strokeDash": 0, - "strokeWidth": 2, - "stroke": "#0D32B2", - "label": "filled-circle", - "fontSize": 16, - "fontFamily": "DEFAULT", - "language": "", - "color": "#676C7E", - "italic": true, - "bold": false, - "underline": false, - "labelWidth": 73, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "labelPercentage": 0, - "route": [ - { - "x": 202, - "y": 138 - }, - { - "x": 202, - "y": 359 - } - ], - "animated": false, - "tooltip": "", - "icon": null, - "zIndex": 0 - } - ] -} diff --git a/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg deleted file mode 100644 index 0d9c1f70f..000000000 --- a/e2etests/testdata/stable/circle_arrowhead#01/elk/sketch.exp.svg +++ /dev/null @@ -1,60 +0,0 @@ - -abcd circle filled-circle - - - - \ No newline at end of file From 182e3b0254442d788d27d36110446d5923221110 Mon Sep 17 00:00:00 2001 From: Paracelsus-Rose Date: Thu, 19 Jan 2023 20:50:27 -0500 Subject: [PATCH 50/65] submodule --- ci/sub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/sub b/ci/sub index 9a29d9ea6..23984e4d7 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 9a29d9ea640834905c4010c0b3d14b7301ebb6d8 +Subproject commit 23984e4d743dd9977b513c0fd850a4996c9198a5 From f595aafcc4c6af98fca41644099a8a1d790cc8df Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 18:09:32 -0800 Subject: [PATCH 51/65] fix self-span in sequence diagrams --- d2layouts/d2sequence/sequence_diagram.go | 12 +- e2etests/stable_test.go | 12 + .../dagre/board.exp.json | 369 ++++++++++++++++++ .../dagre/sketch.exp.svg | 61 +++ .../elk/board.exp.json | 369 ++++++++++++++++++ .../elk/sketch.exp.svg | 61 +++ 6 files changed, 883 insertions(+), 1 deletion(-) create mode 100644 e2etests/testdata/stable/sequence-inter-span-self/dagre/board.exp.json create mode 100644 e2etests/testdata/stable/sequence-inter-span-self/dagre/sketch.exp.svg create mode 100644 e2etests/testdata/stable/sequence-inter-span-self/elk/board.exp.json create mode 100644 e2etests/testdata/stable/sequence-inter-span-self/elk/sketch.exp.svg diff --git a/d2layouts/d2sequence/sequence_diagram.go b/d2layouts/d2sequence/sequence_diagram.go index 1058d6037..053694d1a 100644 --- a/d2layouts/d2sequence/sequence_diagram.go +++ b/d2layouts/d2sequence/sequence_diagram.go @@ -471,7 +471,17 @@ func (sd *sequenceDiagram) routeMessages() error { isFromDescendant := strings.HasPrefix(message.Src.AbsID(), message.Dst.AbsID()+".") isSelfMessage := message.Src == message.Dst - if isSelfMessage || isToDescendant || isFromDescendant { + currSrc := message.Src + for !currSrc.Parent.IsSequenceDiagram() { + currSrc = currSrc.Parent + } + currDst := message.Dst + for !currDst.Parent.IsSequenceDiagram() { + currDst = currDst.Parent + } + isToSibling := currSrc == currDst + + if isSelfMessage || isToDescendant || isFromDescendant || isToSibling { midX := startX + SELF_MESSAGE_HORIZONTAL_TRAVEL endY := startY + MIN_MESSAGE_DISTANCE message.Route = []*geo.Point{ diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 90ce50f94..b7f34a5cd 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1840,6 +1840,18 @@ x: { y: { style.border-radius: 10 } +`, + }, + { + name: "sequence-inter-span-self", + script: ` +shape: sequence_diagram +a: A +b: B + +a.sp1 -> b: foo +a.sp1 -> a.sp2: redirect +a.sp2 -> b: bar `, }, } diff --git a/e2etests/testdata/stable/sequence-inter-span-self/dagre/board.exp.json b/e2etests/testdata/stable/sequence-inter-span-self/dagre/board.exp.json new file mode 100644 index 000000000..69b32bf01 --- /dev/null +++ b/e2etests/testdata/stable/sequence-inter-span-self/dagre/board.exp.json @@ -0,0 +1,369 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 24, + "y": 74 + }, + "width": 150, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#EDF0FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "A", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 14, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "", + "pos": { + "x": 274, + "y": 74 + }, + "width": 150, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#EDF0FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "B", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "a.sp1", + "type": "rectangle", + "pos": { + "x": 93, + "y": 314 + }, + "width": 12, + "height": 162, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#E3E9FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 29, + "labelHeight": 26, + "zIndex": 2, + "level": 2 + }, + { + "id": "a.sp2", + "type": "rectangle", + "pos": { + "x": 93, + "y": 524 + }, + "width": 12, + "height": 82, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#E3E9FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 29, + "labelHeight": 26, + "zIndex": 2, + "level": 2 + } + ], + "connections": [ + { + "id": "(a.sp1 -> b)[0]", + "src": "a.sp1", + "srcArrow": "none", + "srcLabel": "", + "dst": "b", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "foo", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 21, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 105, + "y": 330 + }, + { + "x": 349, + "y": 330 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "a.(sp1 -> sp2)[0]", + "src": "a.sp1", + "srcArrow": "none", + "srcLabel": "", + "dst": "a.sp2", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "redirect", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 52, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 105, + "y": 460 + }, + { + "x": 199, + "y": 460 + }, + { + "x": 199, + "y": 540 + }, + { + "x": 105, + "y": 540 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(a.sp2 -> b)[0]", + "src": "a.sp2", + "srcArrow": "none", + "srcLabel": "", + "dst": "b", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "bar", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 25, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 105, + "y": 590 + }, + { + "x": 349, + "y": 590 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(a -- )[0]", + "src": "a", + "srcArrow": "none", + "srcLabel": "", + "dst": "a-lifeline-end-2251863791", + "dstArrow": "none", + "dstLabel": "", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 99, + "y": 200 + }, + { + "x": 99, + "y": 720 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(b -- )[0]", + "src": "b", + "srcArrow": "none", + "srcLabel": "", + "dst": "b-lifeline-end-668380428", + "dstArrow": "none", + "dstLabel": "", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 349, + "y": 200 + }, + { + "x": 349, + "y": 720 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + } + ] +} diff --git a/e2etests/testdata/stable/sequence-inter-span-self/dagre/sketch.exp.svg b/e2etests/testdata/stable/sequence-inter-span-self/dagre/sketch.exp.svg new file mode 100644 index 000000000..db270ba18 --- /dev/null +++ b/e2etests/testdata/stable/sequence-inter-span-self/dagre/sketch.exp.svg @@ -0,0 +1,61 @@ + +AB fooredirectbar + + + + + \ No newline at end of file diff --git a/e2etests/testdata/stable/sequence-inter-span-self/elk/board.exp.json b/e2etests/testdata/stable/sequence-inter-span-self/elk/board.exp.json new file mode 100644 index 000000000..69b32bf01 --- /dev/null +++ b/e2etests/testdata/stable/sequence-inter-span-self/elk/board.exp.json @@ -0,0 +1,369 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 24, + "y": 74 + }, + "width": 150, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#EDF0FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "A", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 14, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "b", + "type": "", + "pos": { + "x": 274, + "y": 74 + }, + "width": 150, + "height": 126, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#EDF0FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "B", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 13, + "labelHeight": 26, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "a.sp1", + "type": "rectangle", + "pos": { + "x": 93, + "y": 314 + }, + "width": 12, + "height": 162, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#E3E9FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 29, + "labelHeight": 26, + "zIndex": 2, + "level": 2 + }, + { + "id": "a.sp2", + "type": "rectangle", + "pos": { + "x": 93, + "y": 524 + }, + "width": 12, + "height": 82, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#E3E9FD", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 29, + "labelHeight": 26, + "zIndex": 2, + "level": 2 + } + ], + "connections": [ + { + "id": "(a.sp1 -> b)[0]", + "src": "a.sp1", + "srcArrow": "none", + "srcLabel": "", + "dst": "b", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "foo", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 21, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 105, + "y": 330 + }, + { + "x": 349, + "y": 330 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "a.(sp1 -> sp2)[0]", + "src": "a.sp1", + "srcArrow": "none", + "srcLabel": "", + "dst": "a.sp2", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "redirect", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 52, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 105, + "y": 460 + }, + { + "x": 199, + "y": 460 + }, + { + "x": 199, + "y": 540 + }, + { + "x": 105, + "y": 540 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(a.sp2 -> b)[0]", + "src": "a.sp2", + "srcArrow": "none", + "srcLabel": "", + "dst": "b", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "bar", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 25, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelPercentage": 0, + "route": [ + { + "x": 105, + "y": 590 + }, + { + "x": 349, + "y": 590 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 4 + }, + { + "id": "(a -- )[0]", + "src": "a", + "srcArrow": "none", + "srcLabel": "", + "dst": "a-lifeline-end-2251863791", + "dstArrow": "none", + "dstLabel": "", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 99, + "y": 200 + }, + { + "x": 99, + "y": 720 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + }, + { + "id": "(b -- )[0]", + "src": "b", + "srcArrow": "none", + "srcLabel": "", + "dst": "b-lifeline-end-668380428", + "dstArrow": "none", + "dstLabel": "", + "opacity": 1, + "strokeDash": 6, + "strokeWidth": 2, + "stroke": "#0D32B2", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 349, + "y": 200 + }, + { + "x": 349, + "y": 720 + } + ], + "animated": false, + "tooltip": "", + "icon": null, + "zIndex": 1 + } + ] +} diff --git a/e2etests/testdata/stable/sequence-inter-span-self/elk/sketch.exp.svg b/e2etests/testdata/stable/sequence-inter-span-self/elk/sketch.exp.svg new file mode 100644 index 000000000..db270ba18 --- /dev/null +++ b/e2etests/testdata/stable/sequence-inter-span-self/elk/sketch.exp.svg @@ -0,0 +1,61 @@ + +AB fooredirectbar + + + + + \ No newline at end of file From 0b389635fd44d2ec90c3926991b1d13cb03bac7e Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 20:56:57 -0800 Subject: [PATCH 52/65] prep changelog --- README.md | 4 +++- ci/release/changelogs/next.md | 23 ++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5f615e6ce..e9b7fbf2a 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,9 @@ improved security but the install script is by no means insecure. In addition to being a runnable CLI tool, D2 can also be used to produce diagrams from Go programs. -For examples, see [./docs/examples/lib](./docs/examples/lib). +For examples, see [./docs/examples/lib](./docs/examples/lib). This [blog +post](https://terrastruct.com/blog/post/generate-diagrams-programmatically/) also demos +an complete, runnable example of using D2 as a library for a real-world use case. ## Themes diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 0f7d02121..a976f61c5 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,12 +1,16 @@ -![animated connection example](https://user-images.githubusercontent.com/3120367/213055161-e6f1918b-150c-4beb-b61c-3ea05cc29f00.svg) +Many meaningful quality of life improvements and bug fixes, along with a few small features. Overall, a stabilizing set of changes, while some huge features are brewing in the background for the next release! +Thank you to the new contributors that have been joining us. If you want to get involved, there's lots of issues tagged with "good first issue" that are relatively easy to pick up. We're always around to lend a hand, and feel free to drop by our Discord if you're not sure where to start. + +Have you enjoyed using D2? We're redesigning some of the site and will have a section for testimonials. If you'd like to be included with a few words alongside your name or public profile, please email us at hi@d2lang.com (or just post it somewhere and let us know)! + +![animated connection example](https://user-images.githubusercontent.com/3120367/213055161-e6f1918b-150c-4beb-b61c-3ea05cc29f00.svg) #### Features ๐Ÿš€ -- Circle arrowheads are now supported. [#634](https://github.com/terrastruct/d2/pull/634) - - `animated` keyword implemented for connections. [#652](https://github.com/terrastruct/d2/pull/652) - `border-radius` keyword implemented for squares/rectangles. [#688](https://github.com/terrastruct/d2/pull/688) +- `circle` arrowheads. [#634](https://github.com/terrastruct/d2/pull/634) #### Improvements ๐Ÿงน @@ -16,14 +20,15 @@ #### Bugfixes โ›‘๏ธ -- Fixes arrowheads sometimes appearing broken in dagre layouts. [#649](https://github.com/terrastruct/d2/pull/649) -- Fixes attributes being ignored for `sql_table` to `sql_table` connections. [#658](https://github.com/terrastruct/d2/pull/658) -- Fixes tooltip/link attributes being ignored for `sql_table` and `class`. [#658](https://github.com/terrastruct/d2/pull/658) -- Fixes arrowheads sometimes appearing broken with sketch on. [#656](https://github.com/terrastruct/d2/pull/656) -- Bounding box was not accounting for dimensions added by `multiple` and `3d` keywords, which made them look cut off with 0 padding. [#684](https://github.com/terrastruct/d2/pull/684), [#685](https://github.com/terrastruct/d2/pull/685) - Fixes code snippets not being tall enough with leading newlines. [#664](https://github.com/terrastruct/d2/pull/664) - Opacity was not being applied to labels of shapes (and other edge cases). [#677](https://github.com/terrastruct/d2/pull/677) +- Fixes arrowheads sometimes appearing broken with sketch on. [#656](https://github.com/terrastruct/d2/pull/656) +- Fixes attributes being ignored for `sql_table` to `sql_table` connections. [#658](https://github.com/terrastruct/d2/pull/658) - Icon URLs that needed escaping (e.g. with ampersands) are handled correctly by CLI. [#666](https://github.com/terrastruct/d2/pull/666) -- Fixes markdown shapes being slightly too short for their text in some cases. [#665](https://github.com/terrastruct/d2/pull/665) - Fixes self-connections inside layouts when using ELK. [#676](https://github.com/terrastruct/d2/pull/676) +- Fixes inter-span messages between spans of the same actor in sequence diagrams. [#694](https://github.com/terrastruct/d2/pull/694) +- Fixes arrowheads sometimes appearing broken in Dagre layouts. [#649](https://github.com/terrastruct/d2/pull/649) +- Fixes tooltip/link attributes being ignored for `sql_table` and `class`. [#658](https://github.com/terrastruct/d2/pull/658) +- Bounding box was not accounting for dimensions added by `multiple` and `3d` keywords, which made them look cut off with 0 padding. [#684](https://github.com/terrastruct/d2/pull/684), [#685](https://github.com/terrastruct/d2/pull/685) +- Fixes markdown shapes being slightly too short for their text in some cases. [#665](https://github.com/terrastruct/d2/pull/665) - Fixes panic when the only diagram object has `near` set to a constant. [#687](https://github.com/terrastruct/d2/pull/687) From 6e540cf42b6b9c0e8fcfa2eef246b5b6e80f702f Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 21:01:28 -0800 Subject: [PATCH 53/65] typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e9b7fbf2a..7f459d247 100644 --- a/README.md +++ b/README.md @@ -132,8 +132,8 @@ In addition to being a runnable CLI tool, D2 can also be used to produce diagram Go programs. For examples, see [./docs/examples/lib](./docs/examples/lib). This [blog -post](https://terrastruct.com/blog/post/generate-diagrams-programmatically/) also demos -an complete, runnable example of using D2 as a library for a real-world use case. +post](https://terrastruct.com/blog/post/generate-diagrams-programmatically/) also demos a +complete, runnable example of using D2 as a library for a real-world use case. ## Themes From c8ce9f6d14e691bb7031778dcdf11d6052b42e31 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 21:15:10 -0800 Subject: [PATCH 54/65] move gif --- ci/release/changelogs/next.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index a976f61c5..b4e98445e 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -4,11 +4,10 @@ Thank you to the new contributors that have been joining us. If you want to get Have you enjoyed using D2? We're redesigning some of the site and will have a section for testimonials. If you'd like to be included with a few words alongside your name or public profile, please email us at hi@d2lang.com (or just post it somewhere and let us know)! -![animated connection example](https://user-images.githubusercontent.com/3120367/213055161-e6f1918b-150c-4beb-b61c-3ea05cc29f00.svg) - #### Features ๐Ÿš€ - `animated` keyword implemented for connections. [#652](https://github.com/terrastruct/d2/pull/652) +![animated connection example](https://user-images.githubusercontent.com/3120367/213055161-e6f1918b-150c-4beb-b61c-3ea05cc29f00.svg) - `border-radius` keyword implemented for squares/rectangles. [#688](https://github.com/terrastruct/d2/pull/688) - `circle` arrowheads. [#634](https://github.com/terrastruct/d2/pull/634) From 688f156b8e70391361d497ab5f98145bec76aba7 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Thu, 19 Jan 2023 21:22:53 -0800 Subject: [PATCH 55/65] v0.1.6 --- ci/release/changelogs/next.md | 28 ---------------------------- ci/release/changelogs/v0.1.6.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 ci/release/changelogs/v0.1.6.md diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index b4e98445e..f3c0d2a77 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,33 +1,5 @@ -Many meaningful quality of life improvements and bug fixes, along with a few small features. Overall, a stabilizing set of changes, while some huge features are brewing in the background for the next release! - -Thank you to the new contributors that have been joining us. If you want to get involved, there's lots of issues tagged with "good first issue" that are relatively easy to pick up. We're always around to lend a hand, and feel free to drop by our Discord if you're not sure where to start. - -Have you enjoyed using D2? We're redesigning some of the site and will have a section for testimonials. If you'd like to be included with a few words alongside your name or public profile, please email us at hi@d2lang.com (or just post it somewhere and let us know)! - #### Features ๐Ÿš€ -- `animated` keyword implemented for connections. [#652](https://github.com/terrastruct/d2/pull/652) -![animated connection example](https://user-images.githubusercontent.com/3120367/213055161-e6f1918b-150c-4beb-b61c-3ea05cc29f00.svg) -- `border-radius` keyword implemented for squares/rectangles. [#688](https://github.com/terrastruct/d2/pull/688) -- `circle` arrowheads. [#634](https://github.com/terrastruct/d2/pull/634) - #### Improvements ๐Ÿงน -- ELK layouts tuned to have better defaults. [#627](https://github.com/terrastruct/d2/pull/627) -- Code snippets of unrecognized languages will render (just without syntax highlighting). [#650](https://github.com/terrastruct/d2/pull/650) -- Adds sketched versions of arrowheads. [#656](https://github.com/terrastruct/d2/pull/656) - #### Bugfixes โ›‘๏ธ - -- Fixes code snippets not being tall enough with leading newlines. [#664](https://github.com/terrastruct/d2/pull/664) -- Opacity was not being applied to labels of shapes (and other edge cases). [#677](https://github.com/terrastruct/d2/pull/677) -- Fixes arrowheads sometimes appearing broken with sketch on. [#656](https://github.com/terrastruct/d2/pull/656) -- Fixes attributes being ignored for `sql_table` to `sql_table` connections. [#658](https://github.com/terrastruct/d2/pull/658) -- Icon URLs that needed escaping (e.g. with ampersands) are handled correctly by CLI. [#666](https://github.com/terrastruct/d2/pull/666) -- Fixes self-connections inside layouts when using ELK. [#676](https://github.com/terrastruct/d2/pull/676) -- Fixes inter-span messages between spans of the same actor in sequence diagrams. [#694](https://github.com/terrastruct/d2/pull/694) -- Fixes arrowheads sometimes appearing broken in Dagre layouts. [#649](https://github.com/terrastruct/d2/pull/649) -- Fixes tooltip/link attributes being ignored for `sql_table` and `class`. [#658](https://github.com/terrastruct/d2/pull/658) -- Bounding box was not accounting for dimensions added by `multiple` and `3d` keywords, which made them look cut off with 0 padding. [#684](https://github.com/terrastruct/d2/pull/684), [#685](https://github.com/terrastruct/d2/pull/685) -- Fixes markdown shapes being slightly too short for their text in some cases. [#665](https://github.com/terrastruct/d2/pull/665) -- Fixes panic when the only diagram object has `near` set to a constant. [#687](https://github.com/terrastruct/d2/pull/687) diff --git a/ci/release/changelogs/v0.1.6.md b/ci/release/changelogs/v0.1.6.md new file mode 100644 index 000000000..b4e98445e --- /dev/null +++ b/ci/release/changelogs/v0.1.6.md @@ -0,0 +1,33 @@ +Many meaningful quality of life improvements and bug fixes, along with a few small features. Overall, a stabilizing set of changes, while some huge features are brewing in the background for the next release! + +Thank you to the new contributors that have been joining us. If you want to get involved, there's lots of issues tagged with "good first issue" that are relatively easy to pick up. We're always around to lend a hand, and feel free to drop by our Discord if you're not sure where to start. + +Have you enjoyed using D2? We're redesigning some of the site and will have a section for testimonials. If you'd like to be included with a few words alongside your name or public profile, please email us at hi@d2lang.com (or just post it somewhere and let us know)! + +#### Features ๐Ÿš€ + +- `animated` keyword implemented for connections. [#652](https://github.com/terrastruct/d2/pull/652) +![animated connection example](https://user-images.githubusercontent.com/3120367/213055161-e6f1918b-150c-4beb-b61c-3ea05cc29f00.svg) +- `border-radius` keyword implemented for squares/rectangles. [#688](https://github.com/terrastruct/d2/pull/688) +- `circle` arrowheads. [#634](https://github.com/terrastruct/d2/pull/634) + +#### Improvements ๐Ÿงน + +- ELK layouts tuned to have better defaults. [#627](https://github.com/terrastruct/d2/pull/627) +- Code snippets of unrecognized languages will render (just without syntax highlighting). [#650](https://github.com/terrastruct/d2/pull/650) +- Adds sketched versions of arrowheads. [#656](https://github.com/terrastruct/d2/pull/656) + +#### Bugfixes โ›‘๏ธ + +- Fixes code snippets not being tall enough with leading newlines. [#664](https://github.com/terrastruct/d2/pull/664) +- Opacity was not being applied to labels of shapes (and other edge cases). [#677](https://github.com/terrastruct/d2/pull/677) +- Fixes arrowheads sometimes appearing broken with sketch on. [#656](https://github.com/terrastruct/d2/pull/656) +- Fixes attributes being ignored for `sql_table` to `sql_table` connections. [#658](https://github.com/terrastruct/d2/pull/658) +- Icon URLs that needed escaping (e.g. with ampersands) are handled correctly by CLI. [#666](https://github.com/terrastruct/d2/pull/666) +- Fixes self-connections inside layouts when using ELK. [#676](https://github.com/terrastruct/d2/pull/676) +- Fixes inter-span messages between spans of the same actor in sequence diagrams. [#694](https://github.com/terrastruct/d2/pull/694) +- Fixes arrowheads sometimes appearing broken in Dagre layouts. [#649](https://github.com/terrastruct/d2/pull/649) +- Fixes tooltip/link attributes being ignored for `sql_table` and `class`. [#658](https://github.com/terrastruct/d2/pull/658) +- Bounding box was not accounting for dimensions added by `multiple` and `3d` keywords, which made them look cut off with 0 padding. [#684](https://github.com/terrastruct/d2/pull/684), [#685](https://github.com/terrastruct/d2/pull/685) +- Fixes markdown shapes being slightly too short for their text in some cases. [#665](https://github.com/terrastruct/d2/pull/665) +- Fixes panic when the only diagram object has `near` set to a constant. [#687](https://github.com/terrastruct/d2/pull/687) From fe16543a6da653ec800d86aaacdfe37d8043740b Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 01:14:30 -0800 Subject: [PATCH 56/65] Dockerfile: Add playwright support for rendering PNGs Closes #594 --- ci/release/Dockerfile | 24 ++++++++++++++++++++---- ci/release/Dockerfile_entrypoint.sh | 6 ++++++ ci/release/build.sh | 1 + docs/INSTALL.md | 2 +- main.go | 10 ++++++++++ 5 files changed, 38 insertions(+), 5 deletions(-) create mode 100755 ci/release/Dockerfile_entrypoint.sh diff --git a/ci/release/Dockerfile b/ci/release/Dockerfile index 3d44ac80c..623a0f490 100644 --- a/ci/release/Dockerfile +++ b/ci/release/Dockerfile @@ -3,19 +3,35 @@ FROM debian:latest ARG TARGETARCH -RUN apt-get update && \ - apt-get install -y ca-certificates +RUN apt-get update && apt-get install -y ca-certificates curl dumb-init sudo + +RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash -s - && \ + apt-get install -y nodejs +RUN npx playwright install-deps + +RUN adduser --gecos '' --disabled-password debian \ + && echo "debian ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd + +RUN curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-0.5-linux-$TARGETARCH.tar.gz" | tar -C /usr/local/bin -xzf - \ + && chown root:root /usr/local/bin/fixuid \ + && chmod 4755 /usr/local/bin/fixuid \ + && mkdir -p /etc/fixuid \ + && printf "user: debian\ngroup: debian\npaths: [/home/debian]\n" > /etc/fixuid/config.yml COPY ./d2-*-linux-$TARGETARCH.tar.gz /tmp +ADD ./Dockerfile_entrypoint.sh /usr/local/bin/entrypoint.sh RUN mkdir -p /usr/local/lib/d2 \ && tar -C /usr/local/lib/d2 -xzf /tmp/d2-*-linux-"$TARGETARCH".tar.gz \ && /usr/local/lib/d2/d2-*/scripts/install.sh \ && rm -Rf /tmp/d2-*-linux-"$TARGETARCH".tar.gz -WORKDIR /root/src +USER debian:debian +RUN d2 init-playwright + +WORKDIR /home/debian/src EXPOSE 8080 ENV PORT 8080 ENV HOST 0.0.0.0 ENV BROWSER false -ENTRYPOINT ["/usr/local/bin/d2"] +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/ci/release/Dockerfile_entrypoint.sh b/ci/release/Dockerfile_entrypoint.sh new file mode 100755 index 000000000..63ffeeb48 --- /dev/null +++ b/ci/release/Dockerfile_entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -eu + +eval "$(fixuid -q)" + +exec dumb-init /usr/local/bin/d2 "$@" diff --git a/ci/release/build.sh b/ci/release/build.sh index 19b607336..e8148a83e 100755 --- a/ci/release/build.sh +++ b/ci/release/build.sh @@ -253,6 +253,7 @@ build_docker_image() { if [ -n "${PUSH_DOCKER-}" -o -n "${RELEASE-}" ]; then flags='--push --platform linux/amd64,linux/arm64' fi + sh_c rsync --archive --human-readable ./ci/release/Dockerfile_entrypoint.sh "./ci/release/build/$VERSION" sh_c docker buildx build $flags -t "$D2_DOCKER_IMAGE:$VERSION" -t "$D2_DOCKER_IMAGE:latest" --build-arg "VERSION=$VERSION" -f ./ci/release/Dockerfile "./ci/release/build/$VERSION" } diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 5c20aa1bd..8a4f7a090 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -219,7 +219,7 @@ Example usage: ```sh echo 'x -> y' >helloworld.d2 -docker run --rm -it -u "$(id -u):$(id -g)" -v "$PWD:/root/src" \ +docker run --rm -it -u "$(id -u):$(id -g)" -v "$PWD:/home/debian/src" \ -p 127.0.0.1:8080:8080 terrastruct/d2:v0.1.2 --watch helloworld.d2 # Visit http://127.0.0.1:8080 ``` diff --git a/main.go b/main.go index 646b8c994..c7a0429d9 100644 --- a/main.go +++ b/main.go @@ -96,6 +96,8 @@ func run(ctx context.Context, ms *xmain.State) (err error) { if len(ms.Opts.Flags.Args()) > 0 { switch ms.Opts.Flags.Arg(0) { + case "init-playwright": + return initPlaywright() case "layout": return layoutCmd(ctx, ms, ps) case "fmt": @@ -322,3 +324,11 @@ func populateLayoutOpts(ctx context.Context, ms *xmain.State, ps []d2plugin.Plug return nil } + +func initPlaywright() error { + pw, err := png.InitPlaywright() + if err != nil { + return err + } + return pw.Cleanup() +} From ccabee9e7dfa22b1113119a4ae9735576cb8cfb0 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 01:19:09 -0800 Subject: [PATCH 57/65] next.md: Add Dockerfile release note --- ci/release/changelogs/next.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index f3c0d2a77..6dbdee6f0 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,5 +1,8 @@ #### Features ๐Ÿš€ +- The [Dockerfile](./docs/INSTALL.md#docker) now supports rendering PNGs [#594](https://github.com/terrastruct/d2/issues/594) + - There was a minor breaking change as part of this where the default working directory of the Dockerfile is now `/home/debian/src` instead of `/root/src` to allow UID remapping with [`fixuid`](https://github.com/boxboat/fixuid). + #### Improvements ๐Ÿงน #### Bugfixes โ›‘๏ธ From 4c0ee82ca722916b9fc31259c2e622073ce898e9 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 14:33:37 -0800 Subject: [PATCH 58/65] deps: update [ci-force] --- ci/sub | 2 +- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/sub b/ci/sub index 23984e4d7..1c94f3d01 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 23984e4d743dd9977b513c0fd850a4996c9198a5 +Subproject commit 1c94f3d0120199b85eb5e45841a9bb4515ddf965 diff --git a/go.mod b/go.mod index be4afe5ac..38e75f856 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 gonum.org/v1/plot v0.12.0 nhooyr.io/websocket v1.8.7 - oss.terrastruct.com/util-go v0.0.0-20230118143836-0960f48cae9f + oss.terrastruct.com/util-go v0.0.0-20230124223326-041fa96d3331 ) require ( diff --git a/go.sum b/go.sum index 4648445e7..10cedfc91 100644 --- a/go.sum +++ b/go.sum @@ -805,8 +805,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -oss.terrastruct.com/util-go v0.0.0-20230118143836-0960f48cae9f h1:+VLjmVHPpFbsovhDyXOX7xRa8bM6tQ2821jsviq57PY= -oss.terrastruct.com/util-go v0.0.0-20230118143836-0960f48cae9f/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU= +oss.terrastruct.com/util-go v0.0.0-20230124223326-041fa96d3331 h1:5B6+mum6eq9bOtAkHK15T6rvPgtijxu/v165uEAqd7I= +oss.terrastruct.com/util-go v0.0.0-20230124223326-041fa96d3331/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= From 5059085f3c1179876e34d11f304ed801ed9c5210 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Tue, 24 Jan 2023 12:09:59 -0800 Subject: [PATCH 59/65] fix empty labels with class & sql_tables w/ premeasured texts --- d2graph/d2graph.go | 11 +++-- e2etests/e2e_test.go | 27 +++++++--- e2etests/measured_test.go | 34 +++++++++++++ .../measured/empty-class/dagre/board.exp.json | 49 +++++++++++++++++++ .../measured/empty-class/dagre/sketch.exp.svg | 45 +++++++++++++++++ .../measured/empty-shape/dagre/board.exp.json | 46 +++++++++++++++++ .../measured/empty-shape/dagre/sketch.exp.svg | 45 +++++++++++++++++ .../empty-sql_table/dagre/board.exp.json | 49 +++++++++++++++++++ .../empty-sql_table/dagre/sketch.exp.svg | 45 +++++++++++++++++ 9 files changed, 339 insertions(+), 12 deletions(-) create mode 100644 e2etests/measured_test.go create mode 100644 e2etests/testdata/measured/empty-class/dagre/board.exp.json create mode 100644 e2etests/testdata/measured/empty-class/dagre/sketch.exp.svg create mode 100644 e2etests/testdata/measured/empty-shape/dagre/board.exp.json create mode 100644 e2etests/testdata/measured/empty-shape/dagre/sketch.exp.svg create mode 100644 e2etests/testdata/measured/empty-sql_table/dagre/board.exp.json create mode 100644 e2etests/testdata/measured/empty-sql_table/dagre/sketch.exp.svg diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 28ea03ef9..f4b99a03e 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -707,6 +707,9 @@ func (obj *Object) GetLabelSize(mtexts []*d2target.MText, ruler *textmeasure.Rul } if dims == nil { + if obj.Text().Text == "" { + return d2target.NewTextDimensions(0, 0), nil + } if shapeType == d2target.ShapeImage { dims = d2target.NewTextDimensions(0, 0) } else { @@ -728,7 +731,7 @@ func (obj *Object) GetDefaultSize(mtexts []*d2target.MText, ruler *textmeasure.R return d2target.NewTextDimensions(128, 128), nil case d2target.ShapeClass: - maxWidth := labelDims.Width + maxWidth := go2.Max(12, labelDims.Width) for _, f := range obj.Class.Fields { fdims := GetTextDimensions(mtexts, ruler, f.Text(), go2.Pointer(d2fonts.SourceCodePro)) @@ -764,7 +767,7 @@ func (obj *Object) GetDefaultSize(mtexts []*d2target.MText, ruler *textmeasure.R rowHeight := GetTextDimensions(mtexts, ruler, anyRowText, go2.Pointer(d2fonts.SourceCodePro)).Height + 20 dims.Height = rowHeight * (len(obj.Class.Fields) + len(obj.Class.Methods) + 2) } else { - dims.Height = labelDims.Height + dims.Height = go2.Max(12, labelDims.Height) } case d2target.ShapeSQLTable: @@ -804,10 +807,10 @@ func (obj *Object) GetDefaultSize(mtexts []*d2target.MText, ruler *textmeasure.R } // The rows get padded a little due to header font being larger than row font - dims.Height = labelDims.Height * (len(obj.SQLTable.Columns) + 1) + dims.Height = go2.Max(12, labelDims.Height*(len(obj.SQLTable.Columns)+1)) headerWidth := d2target.HeaderPadding + labelDims.Width + d2target.HeaderPadding rowsWidth := d2target.NamePadding + maxNameWidth + d2target.TypePadding + maxTypeWidth + d2target.TypePadding + constraintWidth - dims.Width = go2.Max(headerWidth, rowsWidth) + dims.Width = go2.Max(12, go2.Max(headerWidth, rowsWidth)) } return &dims, nil diff --git a/e2etests/e2e_test.go b/e2etests/e2e_test.go index dcca4bba2..35a7c6c6d 100644 --- a/e2etests/e2e_test.go +++ b/e2etests/e2e_test.go @@ -37,6 +37,7 @@ func TestE2E(t *testing.T) { t.Run("stable", testStable) t.Run("regression", testRegression) t.Run("todo", testTodo) + t.Run("measured", testMeasured) } func testSanity(t *testing.T) { @@ -73,6 +74,7 @@ a -> c type testCase struct { name string script string + mtexts []*d2target.MText assertions func(t *testing.T, diagram *d2target.Diagram) skip bool } @@ -118,12 +120,16 @@ func run(t *testing.T, tc testCase) { ctx = log.WithTB(ctx, t, nil) ctx = log.Leveled(ctx, slog.LevelDebug) - ruler, err := textmeasure.NewRuler() - if !tassert.Nil(t, err) { - return - } + var ruler *textmeasure.Ruler + var err error + if tc.mtexts == nil { + ruler, err = textmeasure.NewRuler() + if !tassert.Nil(t, err) { + return + } - serde(t, tc, ruler) + serde(t, tc, ruler) + } layoutsTested := []string{"dagre", "elk"} @@ -132,12 +138,17 @@ func run(t *testing.T, tc testCase) { if layoutName == "dagre" { layout = d2dagrelayout.DefaultLayout } else if layoutName == "elk" { + // If measured texts exists, we are specifically exercising text measurements, no need to run on both layouts + if tc.mtexts != nil { + continue + } layout = d2elklayout.DefaultLayout } diagram, _, err := d2lib.Compile(ctx, tc.script, &d2lib.CompileOptions{ - Ruler: ruler, - ThemeID: 0, - Layout: layout, + Ruler: ruler, + MeasuredTexts: tc.mtexts, + ThemeID: 0, + Layout: layout, }) if !tassert.Nil(t, err) { return diff --git a/e2etests/measured_test.go b/e2etests/measured_test.go new file mode 100644 index 000000000..777fda482 --- /dev/null +++ b/e2etests/measured_test.go @@ -0,0 +1,34 @@ +package e2etests + +import ( + _ "embed" + "testing" + + "oss.terrastruct.com/d2/d2target" +) + +// testMeasured exercises the code paths that provide pre-measured texts +func testMeasured(t *testing.T) { + tcs := []testCase{ + { + name: "empty-shape", + mtexts: []*d2target.MText{}, + script: `a: "" +`, + }, + { + name: "empty-class", + mtexts: []*d2target.MText{}, + script: `a: "" { shape: class } +`, + }, + { + name: "empty-sql_table", + mtexts: []*d2target.MText{}, + script: `a: "" { shape: sql_table } +`, + }, + } + + runa(t, tcs) +} diff --git a/e2etests/testdata/measured/empty-class/dagre/board.exp.json b/e2etests/testdata/measured/empty-class/dagre/board.exp.json new file mode 100644 index 000000000..1f92e5b45 --- /dev/null +++ b/e2etests/testdata/measured/empty-class/dagre/board.exp.json @@ -0,0 +1,49 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "class", + "pos": { + "x": 0, + "y": 0 + }, + "width": 112, + "height": 12, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#0A0F25", + "stroke": "#FFFFFF", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 20, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 1, + "primaryAccentColor": "#0D32B2", + "secondaryAccentColor": "#4A6FF3", + "neutralAccentColor": "#676C7E" + } + ], + "connections": [] +} diff --git a/e2etests/testdata/measured/empty-class/dagre/sketch.exp.svg b/e2etests/testdata/measured/empty-class/dagre/sketch.exp.svg new file mode 100644 index 000000000..830b5caa3 --- /dev/null +++ b/e2etests/testdata/measured/empty-class/dagre/sketch.exp.svg @@ -0,0 +1,45 @@ + + + + + \ No newline at end of file diff --git a/e2etests/testdata/measured/empty-shape/dagre/board.exp.json b/e2etests/testdata/measured/empty-shape/dagre/board.exp.json new file mode 100644 index 000000000..bf4da9d37 --- /dev/null +++ b/e2etests/testdata/measured/empty-shape/dagre/board.exp.json @@ -0,0 +1,46 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 100, + "height": 100, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#F7F8FE", + "stroke": "#0D32B2", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 1 + } + ], + "connections": [] +} diff --git a/e2etests/testdata/measured/empty-shape/dagre/sketch.exp.svg b/e2etests/testdata/measured/empty-shape/dagre/sketch.exp.svg new file mode 100644 index 000000000..1acdbb250 --- /dev/null +++ b/e2etests/testdata/measured/empty-shape/dagre/sketch.exp.svg @@ -0,0 +1,45 @@ + + + + + \ No newline at end of file diff --git a/e2etests/testdata/measured/empty-sql_table/dagre/board.exp.json b/e2etests/testdata/measured/empty-sql_table/dagre/board.exp.json new file mode 100644 index 000000000..dcd887dd3 --- /dev/null +++ b/e2etests/testdata/measured/empty-sql_table/dagre/board.exp.json @@ -0,0 +1,49 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "a", + "type": "sql_table", + "pos": { + "x": 0, + "y": 0 + }, + "width": 50, + "height": 12, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "#0A0F25", + "stroke": "#FFFFFF", + "shadow": false, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 20, + "fontFamily": "DEFAULT", + "language": "", + "color": "#0A0F25", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 1, + "primaryAccentColor": "#0D32B2", + "secondaryAccentColor": "#4A6FF3", + "neutralAccentColor": "#676C7E" + } + ], + "connections": [] +} diff --git a/e2etests/testdata/measured/empty-sql_table/dagre/sketch.exp.svg b/e2etests/testdata/measured/empty-sql_table/dagre/sketch.exp.svg new file mode 100644 index 000000000..69d917f3c --- /dev/null +++ b/e2etests/testdata/measured/empty-sql_table/dagre/sketch.exp.svg @@ -0,0 +1,45 @@ + + + + + \ No newline at end of file From ca84d9e152db4faa0f318a3700c12cee6a059b63 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 14:57:35 -0800 Subject: [PATCH 60/65] install.sh: Regen [ci-force] --- ci/release/template/scripts/lib.sh | 8 ++++---- ci/sub | 2 +- install.sh | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ci/release/template/scripts/lib.sh b/ci/release/template/scripts/lib.sh index 699795908..2ee814abf 100644 --- a/ci/release/template/scripts/lib.sh +++ b/ci/release/template/scripts/lib.sh @@ -437,10 +437,10 @@ ensure_prefix() { if [ -n "${PREFIX-}" ]; then return fi - # The reason for checking whether bin is writable is that on macOS you have /usr/local + # The reason for checking whether lib is writable is that on macOS you have /usr/local # owned by root but you don't need root to write to its subdirectories which is all we # need to do. - if ! is_writable_dir "/usr/local/bin"; then + if ! is_writable_dir "/usr/local/lib"; then # This also handles M1 Mac's which do not allow modifications to /usr/local even # with sudo. PREFIX=$HOME/.local @@ -453,10 +453,10 @@ ensure_prefix_sh_c() { ensure_prefix sh_c="sh_c" - # The reason for checking whether bin is writable is that on macOS you have /usr/local + # The reason for checking whether lib is writable is that on macOS you have /usr/local # owned by root but you don't need root to write to its subdirectories which is all we # need to do. - if ! is_writable_dir "$PREFIX/bin"; then + if ! is_writable_dir "$PREFIX/lib"; then sh_c="sudo_sh_c" fi } diff --git a/ci/sub b/ci/sub index 1c94f3d01..64036dae6 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 1c94f3d0120199b85eb5e45841a9bb4515ddf965 +Subproject commit 64036dae6aa4da7c5928e0b00e4d360f4cafa238 diff --git a/install.sh b/install.sh index 026f423c9..04721fd93 100755 --- a/install.sh +++ b/install.sh @@ -573,10 +573,10 @@ ensure_prefix() { if [ -n "${PREFIX-}" ]; then return fi - # The reason for checking whether bin is writable is that on macOS you have /usr/local + # The reason for checking whether lib is writable is that on macOS you have /usr/local # owned by root but you don't need root to write to its subdirectories which is all we # need to do. - if ! is_writable_dir "/usr/local/bin"; then + if ! is_writable_dir "/usr/local/lib"; then # This also handles M1 Mac's which do not allow modifications to /usr/local even # with sudo. PREFIX=$HOME/.local @@ -589,10 +589,10 @@ ensure_prefix_sh_c() { ensure_prefix sh_c="sh_c" - # The reason for checking whether bin is writable is that on macOS you have /usr/local + # The reason for checking whether lib is writable is that on macOS you have /usr/local # owned by root but you don't need root to write to its subdirectories which is all we # need to do. - if ! is_writable_dir "$PREFIX/bin"; then + if ! is_writable_dir "$PREFIX/lib"; then sh_c="sudo_sh_c" fi } From 73c6e57998ff1021b761bd42568d8de387397c91 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 15:00:25 -0800 Subject: [PATCH 61/65] deps: update [ci-force] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 38e75f856..cc87cce80 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 gonum.org/v1/plot v0.12.0 nhooyr.io/websocket v1.8.7 - oss.terrastruct.com/util-go v0.0.0-20230124223326-041fa96d3331 + oss.terrastruct.com/util-go v0.0.0-20230124230012-e0ec54ab6cae ) require ( diff --git a/go.sum b/go.sum index 10cedfc91..0af5027de 100644 --- a/go.sum +++ b/go.sum @@ -805,8 +805,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -oss.terrastruct.com/util-go v0.0.0-20230124223326-041fa96d3331 h1:5B6+mum6eq9bOtAkHK15T6rvPgtijxu/v165uEAqd7I= -oss.terrastruct.com/util-go v0.0.0-20230124223326-041fa96d3331/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU= +oss.terrastruct.com/util-go v0.0.0-20230124230012-e0ec54ab6cae h1:ZK9+V4B8sLAj1thl4OE9GG/2DNLzaAEonH/YtcLQ140= +oss.terrastruct.com/util-go v0.0.0-20230124230012-e0ec54ab6cae/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= From 46ccb5de87732f6467080a3e3b4c4a93d6ec37c4 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 15:07:42 -0800 Subject: [PATCH 62/65] ci: Update [ci-force] --- .github/workflows/ci.yml | 2 +- ci/sub | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9feefc85..e4beb9701 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: ci on: [push, pull_request] concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true jobs: diff --git a/ci/sub b/ci/sub index 64036dae6..c209cbcd9 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 64036dae6aa4da7c5928e0b00e4d360f4cafa238 +Subproject commit c209cbcd9fafc5664d16531aa48eb050b5ff4b19 From afd2768880f327c18b50839b9c0a9268d6a1cc96 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 15:14:34 -0800 Subject: [PATCH 63/65] docs/flow.d2: Update [ci-base] --- docs/flow.d2 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/flow.d2 b/docs/flow.d2 index 41c60d079..24cd5f31f 100644 --- a/docs/flow.d2 +++ b/docs/flow.d2 @@ -1,8 +1,10 @@ -inputFile \ - -> d2parser\ - -> d2ast\ - -> d2compiler\ - -> d2graph\ - -> d2layouts/d2dagrelayout\ - -> d2exporter\ - -> d2target +# How we actually want it formatted (d2 fmt removes line continuations currently): +# inputFile \ +# -> d2parser\ +# -> d2ast\ +# -> d2compiler\ +# -> d2graph\ +# -> d2layouts/d2dagrelayout\ +# -> d2exporter\ +# -> d2target +inputFile -> d2parser -> d2ast -> d2compiler -> d2graph -> d2layouts/d2dagrelayout -> d2exporter -> d2target From c77b4acc4edd10990d34bb2a31504d9fc9b8da6b Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 15:25:18 -0800 Subject: [PATCH 64/65] deps: update [ci-force] --- ci/sub | 2 +- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/sub b/ci/sub index c209cbcd9..8b2a3a3be 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit c209cbcd9fafc5664d16531aa48eb050b5ff4b19 +Subproject commit 8b2a3a3be636842eaa74027c9e0d577ec8638272 diff --git a/go.mod b/go.mod index cc87cce80..2720cabf6 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 gonum.org/v1/plot v0.12.0 nhooyr.io/websocket v1.8.7 - oss.terrastruct.com/util-go v0.0.0-20230124230012-e0ec54ab6cae + oss.terrastruct.com/util-go v0.0.0-20230124232507-30a218ab7f4c ) require ( diff --git a/go.sum b/go.sum index 0af5027de..53ecb7b43 100644 --- a/go.sum +++ b/go.sum @@ -805,8 +805,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -oss.terrastruct.com/util-go v0.0.0-20230124230012-e0ec54ab6cae h1:ZK9+V4B8sLAj1thl4OE9GG/2DNLzaAEonH/YtcLQ140= -oss.terrastruct.com/util-go v0.0.0-20230124230012-e0ec54ab6cae/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU= +oss.terrastruct.com/util-go v0.0.0-20230124232507-30a218ab7f4c h1:gNKN5zMFFiKFaTtjpK5cCDfSh4ivWyz/tmzjrERPMz4= +oss.terrastruct.com/util-go v0.0.0-20230124232507-30a218ab7f4c/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= From 335d925b7c937d4e7cac7e26de993f60840eb116 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 24 Jan 2023 15:27:12 -0800 Subject: [PATCH 65/65] deps: update [ci-force] --- ci/sub | 2 +- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/sub b/ci/sub index 8b2a3a3be..8ac704818 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 8b2a3a3be636842eaa74027c9e0d577ec8638272 +Subproject commit 8ac704818b5d7ab519e4b87caf5eb79716493709 diff --git a/go.mod b/go.mod index 2720cabf6..573935bea 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 gonum.org/v1/plot v0.12.0 nhooyr.io/websocket v1.8.7 - oss.terrastruct.com/util-go v0.0.0-20230124232507-30a218ab7f4c + oss.terrastruct.com/util-go v0.0.0-20230124232704-39c2226d2b5e ) require ( diff --git a/go.sum b/go.sum index 53ecb7b43..f6080f513 100644 --- a/go.sum +++ b/go.sum @@ -805,8 +805,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -oss.terrastruct.com/util-go v0.0.0-20230124232507-30a218ab7f4c h1:gNKN5zMFFiKFaTtjpK5cCDfSh4ivWyz/tmzjrERPMz4= -oss.terrastruct.com/util-go v0.0.0-20230124232507-30a218ab7f4c/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU= +oss.terrastruct.com/util-go v0.0.0-20230124232704-39c2226d2b5e h1:pCKxiUFOLQamCtmyMZsM3Hc8MuKVpDg/4VunhVOVW/4= +oss.terrastruct.com/util-go v0.0.0-20230124232704-39c2226d2b5e/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=