From 11e9fdbf111a4420b7f23b6274748dad07e0ed38 Mon Sep 17 00:00:00 2001 From: Andrei Efanov <1134togo@gmail.com> Date: Wed, 31 May 2023 08:47:23 +0200 Subject: [PATCH] Fix style defaults according to Structurizr notation (#11) https://structurizr.com/help/notation https://github.com/structurizr/dsl/tree/master/docs/cookbook/groups#styling-all-groups --- .../structurizr/export/d2/D2Exporter.kt | 30 +++++++---- .../structurizr/export/d2/ElementExt.kt | 17 +++++-- .../structurizr/export/d2/RelationshipExt.kt | 2 +- .../structurizr/export/d2/model/D2Object.kt | 6 +-- .../structurizr/export/d2/D2ExporterTest.kt | 2 +- .../AmazonWebServicesDeployment.d2 | 3 ++ .../amazon/AmazonWebServicesDeployment.d2 | 3 ++ .../animated-relation/SystemContext.d2 | 1 + .../resources/bank-animated/Components.d2 | 13 +++++ .../resources/bank-animated/Containers.d2 | 10 ++++ .../bank-animated/DevelopmentDeployment.d2 | 4 ++ .../resources/bank-animated/LiveDeployment.d2 | 7 +++ .../resources/bank-animated/SystemContext.d2 | 6 ++- .../bank-animated/SystemLandscape.d2 | 9 ++++ lib/src/test/resources/bank/Components.d2 | 13 +++++ lib/src/test/resources/bank/Containers.d2 | 10 ++++ .../resources/bank/DevelopmentDeployment.d2 | 4 ++ lib/src/test/resources/bank/LiveDeployment.d2 | 7 +++ lib/src/test/resources/bank/SignIn.d2 | 6 +++ lib/src/test/resources/bank/SystemContext.d2 | 4 ++ .../test/resources/bank/SystemLandscape.d2 | 9 ++++ .../resources/fill-pattern/SystemContext.d2 | 1 + .../groups-nested/SystemLandscape.d2 | 51 +++++++++++++++---- .../{ => groups-nested}/groups-nested.dsl | 0 .../{ => groups-nested}/groups-nested.json | 0 lib/src/test/resources/groups/Components.d2 | 12 ++++- lib/src/test/resources/groups/Containers.d2 | 12 ++++- .../test/resources/groups/SystemLandscape.d2 | 23 +++++++-- 28 files changed, 225 insertions(+), 40 deletions(-) rename lib/src/test/resources/{ => groups-nested}/groups-nested.dsl (100%) rename lib/src/test/resources/{ => groups-nested}/groups-nested.json (100%) diff --git a/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/D2Exporter.kt b/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/D2Exporter.kt index c659ed9..3b368fe 100644 --- a/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/D2Exporter.kt +++ b/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/D2Exporter.kt @@ -5,6 +5,7 @@ import com.structurizr.export.Diagram import com.structurizr.export.IndentingWriter import com.structurizr.model.* import com.structurizr.view.* +import io.github.goto1134.structurizr.export.d2.model.D2Shape import io.github.goto1134.structurizr.export.d2.model.GlobalObject import io.github.goto1134.structurizr.export.d2.model.NamedObject import io.github.goto1134.structurizr.export.d2.model.TextObject @@ -224,9 +225,20 @@ open class D2Exporter : AbstractDiagramExporter() { } protected fun writeGroup(view: ModelView, groupWithPath: GroupWithPath, writer: IndentingWriter) { + val allGroupsStyle = view.viewSet.configuration.styles.findElementStyle("Group") + val currentGroupStyle = view.viewSet.configuration.styles.findElementStyle("Group:${groupWithPath.fullGroup}") NamedObject.build(groupWithPath.absolutePathInView(view)) { - label(groupWithPath.name) - withGroupStyle() + label(groupWithPath.group) + shape(currentGroupStyle?.d2Shape ?: allGroupsStyle?.d2Shape ?: D2Shape.RECTANGLE) + icon(currentGroupStyle?.icon ?: allGroupsStyle?.icon) + stroke(currentGroupStyle?.stroke ?: currentGroupStyle?.stroke ?: "#cccccc") + strokeWidth(currentGroupStyle?.strokeWidth ?: allGroupsStyle?.strokeWidth ?: 2) + fontColor(currentGroupStyle?.color ?: allGroupsStyle?.color ?: "#cccccc") + fontSize(currentGroupStyle?.fontSize ?: allGroupsStyle?.fontSize ?: 24) + opacity(currentGroupStyle?.d2Opacity ?: currentGroupStyle?.d2Opacity ?: 1.0) + dashed() + fill(currentGroupStyle?.background ?: allGroupsStyle?.background ?: "#ffffff") + fillPattern(currentGroupStyle?.d2FillPattern ?: allGroupsStyle?.d2FillPattern) }.writeObject(writer) } @@ -271,15 +283,15 @@ open class D2Exporter : AbstractDiagramExporter() { NamedObject.build(relationshipView.relationshipNameInView(view)) { animated(relationshipStyle.d2Animated) label(relationshipView.d2LabelInView(view)) - opacity(relationshipStyle.d2Opacity) - stroke(relationshipStyle.color) - fontSize(relationshipStyle.fontSize) + opacity(relationshipStyle.d2Opacity ?: 1.0) + stroke(relationshipStyle.color ?: "#707070") + strokeWidth(relationshipStyle.thickness ?: 2) + fontSize(relationshipStyle.fontSize ?: 24) when (relationshipStyle.style) { - LineStyle.Dashed -> dashed() LineStyle.Dotted -> dotted() - else -> Unit + LineStyle.Solid -> Unit + LineStyle.Dashed, null -> dashed() } - strokeWidth(relationshipStyle.thickness) }.writeObject(writer) } @@ -295,7 +307,7 @@ open class D2Exporter : AbstractDiagramExporter() { fillPattern(style.d2FillPattern) stroke(style.stroke) strokeWidth(style.strokeWidth) - opacity(style.d2Opacity) + opacity(style.d2Opacity ?: 1.0) when (style.border) { Border.Dashed -> dashed() Border.Dotted -> dotted() diff --git a/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/ElementExt.kt b/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/ElementExt.kt index e2ee8b8..bf38ece 100644 --- a/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/ElementExt.kt +++ b/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/ElementExt.kt @@ -8,7 +8,7 @@ import io.github.goto1134.structurizr.export.d2.D2Exporter.Companion.STRUCTURIZR import io.github.goto1134.structurizr.export.d2.model.D2FillPattern import io.github.goto1134.structurizr.export.d2.model.D2Shape -val ElementStyle.d2Opacity get() = opacity.toDouble() / 100 +val ElementStyle.d2Opacity get() = opacity?.toDouble()?.div( 100) val ElementStyle.d2FillPattern get() = D2FillPattern.get(properties[D2Exporter.D2_FILL_PATTERN]) @@ -22,6 +22,7 @@ val ElementStyle.d2Shape Shape.Hexagon -> D2Shape.HEXAGON Shape.Pipe -> D2Shape.QUEUE Shape.Diamond -> D2Shape.DIAMOND + null -> null else -> D2Shape.RECTANGLE } @@ -41,24 +42,30 @@ fun GroupableElement.parentGroupSequenceOrNull(): Sequence? { } } -data class GroupWithPath(val parent: Element?, val relativePath: String, val name: String) { +data class GroupWithPath(val parent: Element?, val relativePath: String, val fullGroup: String, val group: String) { fun absolutePathInView(view: ModelView) = buildString { parent?.absolutePathInView(view)?.let { append(it, ".") } append(relativePath) } } -fun GroupableElement.groupsWithPathsOrNull() = - parentGroupSequenceOrNull()?.scan(GroupWithPath(parent, "", "")) { wrapper, groupName -> +fun GroupableElement.groupsWithPathsOrNull(): Sequence? { + val groupSeparator = model.properties[STRUCTURIZR_GROUP_SEPARATOR_PROPERTY_NAME] + return parentGroupSequenceOrNull()?.scan(GroupWithPath(parent, "", "", "")) { wrapper, groupName -> GroupWithPath( parent = parent, relativePath = buildString { if (wrapper.relativePath.isNotEmpty()) append(wrapper.relativePath, ".") append("\"group_", groupName, "\"") }, - name = groupName + fullGroup = buildString { + if (wrapper.fullGroup.isNotEmpty()) append(wrapper.fullGroup, groupSeparator) + append(groupName) + }, + group = groupName ) }?.drop(1) +} val Element.hasMultipleInstances get() = this is DeploymentNode && "1" != instances diff --git a/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/RelationshipExt.kt b/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/RelationshipExt.kt index d548c3a..32c19f4 100644 --- a/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/RelationshipExt.kt +++ b/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/RelationshipExt.kt @@ -8,7 +8,7 @@ import io.github.goto1134.structurizr.export.d2.model.D2Connection val RelationshipStyle.d2Animated get() = properties[D2_CONNECTION_ANIMATED].toBoolean() -val RelationshipStyle.d2Opacity get() = opacity.toDouble() / 100 +val RelationshipStyle.d2Opacity get() = opacity?.toDouble()?.div(100) val RelationshipView.d2Connection: D2Connection get() = if (isResponse == true) D2Connection.REVERSE else D2Connection.DIRECT diff --git a/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/model/D2Object.kt b/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/model/D2Object.kt index 24ac965..740b0b2 100644 --- a/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/model/D2Object.kt +++ b/lib/src/main/kotlin/io/github/goto1134/structurizr/export/d2/model/D2Object.kt @@ -116,8 +116,8 @@ class PropertyBuilder { properties.add(D2WrappedStringProperty(D2Keyword.LABEL, label)) } - fun shape(shape: D2Shape) = apply { - properties.add(D2Property(D2Keyword.SHAPE, shape)) + fun shape(shape: D2Shape?) = apply { + if (shape != null) properties.add(D2Property(D2Keyword.SHAPE, shape)) } fun icon(icon: String?) = apply { @@ -174,8 +174,6 @@ class PropertyBuilder { style.add(D2Property(D2StyleKeyword.OPACITY, opacity)) } - fun withGroupStyle() = fill("white").stroke("black") - fun animated(animated: Boolean) = apply { if (animated) style.add(D2Property(D2StyleKeyword.CONNECTION_ANIMATED, true)) } diff --git a/lib/src/test/kotlin/io/github/goto1134/structurizr/export/d2/D2ExporterTest.kt b/lib/src/test/kotlin/io/github/goto1134/structurizr/export/d2/D2ExporterTest.kt index 487337e..c28b192 100644 --- a/lib/src/test/kotlin/io/github/goto1134/structurizr/export/d2/D2ExporterTest.kt +++ b/lib/src/test/kotlin/io/github/goto1134/structurizr/export/d2/D2ExporterTest.kt @@ -75,7 +75,7 @@ internal class D2ExporterTest { @Test fun test_NestedGroupsExample() { - val workspace = WorkspaceUtils.loadWorkspaceFromJson(testFile("groups-nested.json")) + val workspace = WorkspaceUtils.loadWorkspaceFromJson(testFile("groups-nested/groups-nested.json")) ThemeUtils.loadThemes(workspace) val diagrams = D2Exporter().export(workspace) assertEquals(1, diagrams.size) diff --git a/lib/src/test/resources/amazon-animated/AmazonWebServicesDeployment.d2 b/lib/src/test/resources/amazon-animated/AmazonWebServicesDeployment.d2 index 68ff922..3346d1e 100644 --- a/lib/src/test/resources/amazon-animated/AmazonWebServicesDeployment.d2 +++ b/lib/src/test/resources/amazon-animated/AmazonWebServicesDeployment.d2 @@ -70,6 +70,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -120,6 +121,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -170,6 +172,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/amazon/AmazonWebServicesDeployment.d2 b/lib/src/test/resources/amazon/AmazonWebServicesDeployment.d2 index e4de40d..a6baf46 100644 --- a/lib/src/test/resources/amazon/AmazonWebServicesDeployment.d2 +++ b/lib/src/test/resources/amazon/AmazonWebServicesDeployment.d2 @@ -140,6 +140,7 @@ container_5.container_6.container_9.container_10.container_11 -> container_5.con font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -149,6 +150,7 @@ container_5.container_6.container_7 -> container_5.container_6.container_8: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -158,6 +160,7 @@ container_5.container_6.container_8 -> container_5.container_6.container_9.conta font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/animated-relation/SystemContext.d2 b/lib/src/test/resources/animated-relation/SystemContext.d2 index d4eb2a7..3503291 100644 --- a/lib/src/test/resources/animated-relation/SystemContext.d2 +++ b/lib/src/test/resources/animated-relation/SystemContext.d2 @@ -38,6 +38,7 @@ container_1 -> container_2: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank-animated/Components.d2 b/lib/src/test/resources/bank-animated/Components.d2 index 7107e0e..fab1ece 100644 --- a/lib/src/test/resources/bank-animated/Components.d2 +++ b/lib/src/test/resources/bank-animated/Components.d2 @@ -119,6 +119,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -128,6 +129,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -137,6 +139,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -146,6 +149,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -184,6 +188,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -193,6 +198,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -202,6 +208,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -211,6 +218,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -249,6 +257,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -258,6 +267,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -267,6 +277,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -276,6 +287,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -285,6 +297,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank-animated/Containers.d2 b/lib/src/test/resources/bank-animated/Containers.d2 index fe909df..f496a98 100644 --- a/lib/src/test/resources/bank-animated/Containers.d2 +++ b/lib/src/test/resources/bank-animated/Containers.d2 @@ -51,6 +51,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -89,6 +90,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -114,6 +116,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -123,6 +126,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -148,6 +152,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -173,6 +178,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -182,6 +188,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -191,6 +198,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -200,6 +208,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -225,6 +234,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank-animated/DevelopmentDeployment.d2 b/lib/src/test/resources/bank-animated/DevelopmentDeployment.d2 index bb23cd3..b6ad2fd 100644 --- a/lib/src/test/resources/bank-animated/DevelopmentDeployment.d2 +++ b/lib/src/test/resources/bank-animated/DevelopmentDeployment.d2 @@ -102,6 +102,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -111,6 +112,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -161,6 +163,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -185,6 +188,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank-animated/LiveDeployment.d2 b/lib/src/test/resources/bank-animated/LiveDeployment.d2 index 0cf29fd..cbb470f 100644 --- a/lib/src/test/resources/bank-animated/LiveDeployment.d2 +++ b/lib/src/test/resources/bank-animated/LiveDeployment.d2 @@ -166,6 +166,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -175,6 +176,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -184,6 +186,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -234,6 +237,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -284,6 +288,7 @@ steps: { font-size: 24 opacity: 0.25 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -293,6 +298,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -317,6 +323,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank-animated/SystemContext.d2 b/lib/src/test/resources/bank-animated/SystemContext.d2 index 50fdfb3..5961230 100644 --- a/lib/src/test/resources/bank-animated/SystemContext.d2 +++ b/lib/src/test/resources/bank-animated/SystemContext.d2 @@ -41,6 +41,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -66,6 +67,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -91,6 +93,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -100,8 +103,9 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } } -} \ No newline at end of file +} diff --git a/lib/src/test/resources/bank-animated/SystemLandscape.d2 b/lib/src/test/resources/bank-animated/SystemLandscape.d2 index 7de8cdf..4141caa 100644 --- a/lib/src/test/resources/bank-animated/SystemLandscape.d2 +++ b/lib/src/test/resources/bank-animated/SystemLandscape.d2 @@ -64,6 +64,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -73,6 +74,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -82,6 +84,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -91,6 +94,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -116,6 +120,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -125,6 +130,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -163,6 +169,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -172,6 +179,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -181,6 +189,7 @@ steps: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank/Components.d2 b/lib/src/test/resources/bank/Components.d2 index 33f245c..6ffca4d 100644 --- a/lib/src/test/resources/bank/Components.d2 +++ b/lib/src/test/resources/bank/Components.d2 @@ -166,6 +166,7 @@ container_17 -> container_20.container_29: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -175,6 +176,7 @@ container_17 -> container_20.container_31: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -184,6 +186,7 @@ container_17 -> container_20.container_30: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -193,6 +196,7 @@ container_18 -> container_20.container_29: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -202,6 +206,7 @@ container_18 -> container_20.container_31: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -211,6 +216,7 @@ container_18 -> container_20.container_30: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -220,6 +226,7 @@ container_20.container_29 -> container_20.container_32: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -229,6 +236,7 @@ container_20.container_30 -> container_20.container_33: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -238,6 +246,7 @@ container_20.container_31 -> container_20.container_32: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -247,6 +256,7 @@ container_20.container_31 -> container_20.container_34: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -256,6 +266,7 @@ container_20.container_32 -> container_21: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -265,6 +276,7 @@ container_20.container_33 -> container_4: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -274,6 +286,7 @@ container_20.container_34 -> container_6: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank/Containers.d2 b/lib/src/test/resources/bank/Containers.d2 index 9981f67..c88f667 100644 --- a/lib/src/test/resources/bank/Containers.d2 +++ b/lib/src/test/resources/bank/Containers.d2 @@ -127,6 +127,7 @@ container_1 -> container_2.container_19: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -136,6 +137,7 @@ container_1 -> container_2.container_17: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -145,6 +147,7 @@ container_1 -> container_2.container_18: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -154,6 +157,7 @@ container_2.container_19 -> container_2.container_17: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -163,6 +167,7 @@ container_2.container_20 -> container_2.container_21: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -172,6 +177,7 @@ container_2.container_20 -> container_4: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -181,6 +187,7 @@ container_2.container_20 -> container_6: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -190,6 +197,7 @@ container_2.container_17 -> container_2.container_20: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -199,6 +207,7 @@ container_2.container_18 -> container_2.container_20: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -208,6 +217,7 @@ container_6 -> container_1: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank/DevelopmentDeployment.d2 b/lib/src/test/resources/bank/DevelopmentDeployment.d2 index ee58ae7..7ba45ad 100644 --- a/lib/src/test/resources/bank/DevelopmentDeployment.d2 +++ b/lib/src/test/resources/bank/DevelopmentDeployment.d2 @@ -170,6 +170,7 @@ container_50.container_51.container_52.container_54 -> container_55.container_56 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -179,6 +180,7 @@ container_50.container_51.container_52.container_54 -> container_50.container_59 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -188,6 +190,7 @@ container_50.container_63.container_64 -> container_50.container_51.container_52 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -197,6 +200,7 @@ container_50.container_51.container_52.container_53 -> container_50.container_63 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank/LiveDeployment.d2 b/lib/src/test/resources/bank/LiveDeployment.d2 index c25c3e7..b0a0021 100644 --- a/lib/src/test/resources/bank/LiveDeployment.d2 +++ b/lib/src/test/resources/bank/LiveDeployment.d2 @@ -257,6 +257,7 @@ container_72.container_75.container_76.container_77 -> container_69.container_70 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -266,6 +267,7 @@ container_67.container_68 -> container_72.container_79.container_80.container_81 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -275,6 +277,7 @@ container_69.container_70.container_71 -> container_72.container_79.container_80 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -284,6 +287,7 @@ container_72.container_79.container_80.container_81 -> container_72.container_73 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -293,6 +297,7 @@ container_72.container_79.container_80.container_81 -> container_72.container_85 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -302,6 +307,7 @@ container_72.container_79.container_80.container_81 -> container_72.container_89 font-size: 24 opacity: 0.25 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -311,6 +317,7 @@ container_72.container_85.container_86 -> container_72.container_89.container_90 font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank/SignIn.d2 b/lib/src/test/resources/bank/SignIn.d2 index 061e158..aaee0f3 100644 --- a/lib/src/test/resources/bank/SignIn.d2 +++ b/lib/src/test/resources/bank/SignIn.d2 @@ -75,6 +75,7 @@ container_17 -> container_20.container_29: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -84,6 +85,7 @@ container_20.container_29 -> container_20.container_32: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -93,6 +95,7 @@ container_20.container_32 -> container_21: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -102,6 +105,7 @@ container_20.container_32 <- container_21: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -111,6 +115,7 @@ container_20.container_29 <- container_20.container_32: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -120,6 +125,7 @@ container_17 <- container_20.container_29: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank/SystemContext.d2 b/lib/src/test/resources/bank/SystemContext.d2 index 16e4706..54bb69c 100644 --- a/lib/src/test/resources/bank/SystemContext.d2 +++ b/lib/src/test/resources/bank/SystemContext.d2 @@ -62,6 +62,7 @@ container_1 -> container_2: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -71,6 +72,7 @@ container_2 -> container_4: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -80,6 +82,7 @@ container_2 -> container_6: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -89,6 +92,7 @@ container_6 -> container_1: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/bank/SystemLandscape.d2 b/lib/src/test/resources/bank/SystemLandscape.d2 index 5e178cc..1335348 100644 --- a/lib/src/test/resources/bank/SystemLandscape.d2 +++ b/lib/src/test/resources/bank/SystemLandscape.d2 @@ -101,6 +101,7 @@ container_9 -> container_4: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -110,6 +111,7 @@ container_1 -> container_9: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -119,6 +121,7 @@ container_12 -> container_4: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -128,6 +131,7 @@ container_1 -> container_12: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -137,6 +141,7 @@ container_15 -> container_4: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -146,6 +151,7 @@ container_1 -> container_2: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -155,6 +161,7 @@ container_2 -> container_4: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -164,6 +171,7 @@ container_2 -> container_6: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -173,6 +181,7 @@ container_6 -> container_1: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/fill-pattern/SystemContext.d2 b/lib/src/test/resources/fill-pattern/SystemContext.d2 index 38aa126..597fdb6 100644 --- a/lib/src/test/resources/fill-pattern/SystemContext.d2 +++ b/lib/src/test/resources/fill-pattern/SystemContext.d2 @@ -41,6 +41,7 @@ container_1 -> container_2: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/groups-nested/SystemLandscape.d2 b/lib/src/test/resources/groups-nested/SystemLandscape.d2 index 1d30f38..cdf05e7 100644 --- a/lib/src/test/resources/groups-nested/SystemLandscape.d2 +++ b/lib/src/test/resources/groups-nested/SystemLandscape.d2 @@ -6,16 +6,28 @@ title: |`md direction: down "group_Department A": { label: "Department A" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } "group_Department A"."group_Team 1": { label: "Team 1" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } "group_Department A"."group_Team 1".container_8: { @@ -32,23 +44,41 @@ direction: down } "group_Organisation": { label: "Organisation" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } "group_Organisation"."group_Department A": { label: "Department A" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } "group_Organisation"."group_Department B": { label: "Department B" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } "group_Organisation"."group_Department A".container_1: { @@ -87,4 +117,3 @@ direction: down stroke: "#9a9a9a" } } - diff --git a/lib/src/test/resources/groups-nested.dsl b/lib/src/test/resources/groups-nested/groups-nested.dsl similarity index 100% rename from lib/src/test/resources/groups-nested.dsl rename to lib/src/test/resources/groups-nested/groups-nested.dsl diff --git a/lib/src/test/resources/groups-nested.json b/lib/src/test/resources/groups-nested/groups-nested.json similarity index 100% rename from lib/src/test/resources/groups-nested.json rename to lib/src/test/resources/groups-nested/groups-nested.json diff --git a/lib/src/test/resources/groups/Components.d2 b/lib/src/test/resources/groups/Components.d2 index efef1b9..b190884 100644 --- a/lib/src/test/resources/groups/Components.d2 +++ b/lib/src/test/resources/groups/Components.d2 @@ -31,9 +31,15 @@ container_6: { } container_6."group_Group 4": { label: "Group 4" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } container_6.container_7: { @@ -66,6 +72,7 @@ container_3 -> container_6.container_7: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -75,6 +82,7 @@ container_3 -> container_6."group_Group 4".container_8: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/groups/Containers.d2 b/lib/src/test/resources/groups/Containers.d2 index eca0a13..a7ff6a5 100644 --- a/lib/src/test/resources/groups/Containers.d2 +++ b/lib/src/test/resources/groups/Containers.d2 @@ -31,9 +31,15 @@ container_4: { } container_4."group_Group 3": { label: "Group 3" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } container_4.container_5: { @@ -66,6 +72,7 @@ container_3 -> container_4.container_5: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -75,6 +82,7 @@ container_3 -> container_4."group_Group 3".container_6: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } diff --git a/lib/src/test/resources/groups/SystemLandscape.d2 b/lib/src/test/resources/groups/SystemLandscape.d2 index d74df34..2691da4 100644 --- a/lib/src/test/resources/groups/SystemLandscape.d2 +++ b/lib/src/test/resources/groups/SystemLandscape.d2 @@ -6,9 +6,15 @@ title: |`md direction: down "group_Group 2": { label: "Group 2" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } container_3: { @@ -37,9 +43,15 @@ container_3: { } "group_Group 1": { label: "Group 1" + shape: rectangle style: { - fill: "white" - stroke: "black" + fill: "#ffffff" + font-color: "#cccccc" + font-size: 24 + opacity: 1.0 + stroke: "#cccccc" + stroke-dash: 5 + stroke-width: 2 } } container_1: { @@ -73,6 +85,7 @@ container_1: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -82,6 +95,7 @@ container_3 -> "group_Group 2".container_4: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } } @@ -91,6 +105,7 @@ container_1 -> "group_Group 1".container_2: { font-size: 24 opacity: 1.0 stroke: "#707070" + stroke-dash: 5 stroke-width: 2 } }