diff --git a/README.md b/README.md index 0a8c9c9cbb..693f3e40af 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,8 @@ Open sourced under the Mozilla Public License 2.0. See [./LICENSE.txt](./LICENSE version updates from Github periodically. - Does D2 need a browser to run? - No, D2 can run entirely server-side. +- What's coming in the next release? + - See [./ci/release/changelogs/next.md](./ci/release/changelogs/next.md). - I have a question or need help. - The best way to get help is to ask on [D2 Discord](https://discord.gg/NF6X8K4eDq) - I have a feature request, proposal, or bug report. diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 031a3414a6..ebf3b6455b 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -1,13 +1,10 @@ -For v0.0.99 we focused on X, Y and Z. Enjoy! - #### Features 🚀 -- Now you can easily do x, y and z #9999 +- Arrowhead labels are now supported. [#182](https://github.com/terrastruct/d2/pull/182) #### Improvements 🔧 -- Improves something or the other #9999 - #### Bugfixes 🔴 -- The svg renderer now displays arrowhead labels fixing #169 +- 3D style was missing border and other styles for its top and right faces. + [#187](https://github.com/terrastruct/d2/pull/187) diff --git a/ci/release/changelogs/template.md b/ci/release/changelogs/template.md index b3f8fa64df..dd3f64b05e 100644 --- a/ci/release/changelogs/template.md +++ b/ci/release/changelogs/template.md @@ -1,13 +1,5 @@ -For v0.0.99 we focused on X, Y and Z. Enjoy! - #### Features 🚀 -- Now you can easily do x, y and z #9999 - #### Improvements 🔧 -- Improves something or the other #9999 - #### Bugfixes 🔴 - -- Fixes something or the other #9999 diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index e234c9df4c..5cef9be2f6 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -557,6 +557,9 @@ func drawShape(writer io.Writer, targetShape d2target.Shape) error { if err != nil { darkerColor = targetShape.Fill } + sideShape := targetShape + sideShape.Fill = darkerColor + sideStyle := shapeStyle(sideShape) var topPolygonPoints []string for _, v := range []d2target.Point{ @@ -570,8 +573,8 @@ func drawShape(writer io.Writer, targetShape d2target.Shape) error { fmt.Sprintf("%d,%d ", v.X+targetShape.Pos.X, v.Y+targetShape.Pos.Y), ) } - fmt.Fprintf(writer, ``, - strings.Join(topPolygonPoints, ""), darkerColor) + fmt.Fprintf(writer, ``, + strings.Join(topPolygonPoints, ""), sideStyle) var rightPolygonPoints []string for _, v := range []d2target.Point{ @@ -584,8 +587,8 @@ func drawShape(writer io.Writer, targetShape d2target.Shape) error { fmt.Sprintf("%d,%d ", v.X+targetShape.Pos.X, v.Y+targetShape.Pos.Y), ) } - fmt.Fprintf(writer, ``, - strings.Join(rightPolygonPoints, ""), darkerColor) + fmt.Fprintf(writer, ``, + strings.Join(rightPolygonPoints, ""), sideStyle) } if targetShape.Multiple { fmt.Fprintf(writer, ``, diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 6f03c9570b..0edc06849c 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -892,6 +892,38 @@ a -> b: To err is human, to moo bovine { shape: diamond } } +`, + }, + { + name: "stylish", + script: ` +x: { + style: { + opacity: 0.6 + fill: orange + stroke: "#53C0D8" + stroke-width: 5 + shadow: true + } +} + +y: { + style: { + opacity: 0.6 + fill: red + 3d: true + stroke: black + } +} + +x -> y: { + style: { + stroke: green + opacity: 0.5 + stroke-width: 2 + stroke-dash: 5 + } +} `, }, } diff --git a/e2etests/testdata/stable/square_3d/dagre/sketch.exp.svg b/e2etests/testdata/stable/square_3d/dagre/sketch.exp.svg index 174379e1a6..1e9a1012ad 100644 --- a/e2etests/testdata/stable/square_3d/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/square_3d/dagre/sketch.exp.svg @@ -14,7 +14,7 @@ width="371" height="580" viewBox="-100 -100 371 580">rectanglesquare rectanglesquare rectanglesquare rectanglesquare + + + + + + + +xy \ No newline at end of file diff --git a/e2etests/testdata/stable/stylish/elk/board.exp.json b/e2etests/testdata/stable/stylish/elk/board.exp.json new file mode 100644 index 0000000000..b77c208317 --- /dev/null +++ b/e2etests/testdata/stable/stylish/elk/board.exp.json @@ -0,0 +1,121 @@ +{ + "name": "", + "shapes": [ + { + "id": "x", + "type": "", + "pos": { + "x": 12, + "y": 12 + }, + "width": 113, + "height": 126, + "level": 1, + "opacity": 0.6, + "strokeDash": 0, + "strokeWidth": 5, + "borderRadius": 0, + "fill": "orange", + "stroke": "#53C0D8", + "shadow": true, + "3d": false, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "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" + }, + { + "id": "y", + "type": "", + "pos": { + "x": 225, + "y": 12 + }, + "width": 114, + "height": 126, + "level": 1, + "opacity": 0.6, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "red", + "stroke": "black", + "shadow": false, + "3d": true, + "multiple": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "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" + } + ], + "connections": [ + { + "id": "(x -> y)[0]", + "src": "x", + "srcArrow": "none", + "srcLabel": "", + "dst": "y", + "dstArrow": "triangle", + "dstLabel": "", + "opacity": 0.5, + "strokeDash": 5, + "strokeWidth": 2, + "stroke": "green", + "label": "", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "", + "color": "#676C7E", + "italic": true, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "labelPosition": "", + "labelPercentage": 0, + "route": [ + { + "x": 125, + "y": 75 + }, + { + "x": 225, + "y": 75 + } + ], + "animated": false, + "tooltip": "", + "icon": null + } + ] +} diff --git a/e2etests/testdata/stable/stylish/elk/sketch.exp.svg b/e2etests/testdata/stable/stylish/elk/sketch.exp.svg new file mode 100644 index 0000000000..2d8f1e9ec9 --- /dev/null +++ b/e2etests/testdata/stable/stylish/elk/sketch.exp.svg @@ -0,0 +1,32 @@ + + + + + + + + + +xy \ No newline at end of file