2022-11-23 11:16:23PM

This commit is contained in:
Alexander Wang 2022-11-23 23:16:23 -08:00
parent 73a65f2e5f
commit e78ce495a5
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
11 changed files with 17 additions and 25 deletions

View file

@ -242,6 +242,8 @@ Open sourced under the Mozilla Public License 2.0. See [./LICENSE.txt](./LICENSE
version updates from Github periodically. version updates from Github periodically.
- Does D2 need a browser to run? - Does D2 need a browser to run?
- No, D2 can run entirely server-side. - 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. - I have a question or need help.
- The best way to get help is to ask on [D2 Discord](https://discord.gg/NF6X8K4eDq) - 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. - I have a feature request, proposal, or bug report.

View file

@ -1,13 +1,7 @@
For v0.0.99 we focused on X, Y and Z. Enjoy!
#### Features 🚀 #### 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 🔧 #### Improvements 🔧
- Improves something or the other #9999
#### Bugfixes 🔴 #### Bugfixes 🔴
- The svg renderer now displays arrowhead labels fixing #169

View file

@ -1,13 +1,5 @@
For v0.0.99 we focused on X, Y and Z. Enjoy!
#### Features 🚀 #### Features 🚀
- Now you can easily do x, y and z #9999
#### Improvements 🔧 #### Improvements 🔧
- Improves something or the other #9999
#### Bugfixes 🔴 #### Bugfixes 🔴
- Fixes something or the other #9999

View file

@ -557,6 +557,9 @@ func drawShape(writer io.Writer, targetShape d2target.Shape) error {
if err != nil { if err != nil {
darkerColor = targetShape.Fill darkerColor = targetShape.Fill
} }
sideShape := targetShape
sideShape.Fill = darkerColor
sideStyle := shapeStyle(sideShape)
var topPolygonPoints []string var topPolygonPoints []string
for _, v := range []d2target.Point{ 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.Sprintf("%d,%d ", v.X+targetShape.Pos.X, v.Y+targetShape.Pos.Y),
) )
} }
fmt.Fprintf(writer, `<polygon points="%s" style="fill:%s;"/>`, fmt.Fprintf(writer, `<polygon points="%s" style="%s"/>`,
strings.Join(topPolygonPoints, ""), darkerColor) strings.Join(topPolygonPoints, ""), sideStyle)
var rightPolygonPoints []string var rightPolygonPoints []string
for _, v := range []d2target.Point{ 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.Sprintf("%d,%d ", v.X+targetShape.Pos.X, v.Y+targetShape.Pos.Y),
) )
} }
fmt.Fprintf(writer, `<polygon points="%s" style="fill:%s;"/>`, fmt.Fprintf(writer, `<polygon points="%s" style="%s"/>`,
strings.Join(rightPolygonPoints, ""), darkerColor) strings.Join(rightPolygonPoints, ""), sideStyle)
} }
if targetShape.Multiple { if targetShape.Multiple {
fmt.Fprintf(writer, `<rect x="%d" y="%d" width="%d" height="%d" style="%s" />`, fmt.Fprintf(writer, `<rect x="%d" y="%d" width="%d" height="%d" style="%s" />`,

View file

@ -912,6 +912,7 @@ y: {
opacity: 0.6 opacity: 0.6
fill: red fill: red
3d: true 3d: true
stroke: black
} }
} }

View file

@ -14,7 +14,7 @@ width="371" height="580" viewBox="-100 -100 371 580"><style type="text/css">
} }
]]> ]]>
</style><g class="shape" ><polygon points="0,0 15,-15 186,-15 171,0 0,0 " style="fill:#cad0f8;"/><polygon points="171,0 186,-15 186,111 171,126 " style="fill:#cad0f8;"/><rect x="0" y="0" width="171" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="85.500000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:black">rectangle</text><g class="shape" ><polygon points="9,226 24,211 178,211 163,226 9,226 " style="fill:#cad0f8;"/><polygon points="163,226 178,211 178,365 163,380 " style="fill:#cad0f8;"/><rect x="9" y="226" width="154" height="154" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="86.000000" y="306.000000" style="text-anchor:middle;font-size:16px;fill:black">square</text><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 85.500000 128.000000 C 85.500000 166.000000 85.500000 186.000000 85.500000 222.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" /><style type="text/css"><![CDATA[ </style><g class="shape" ><polygon points="0,0 15,-15 186,-15 171,0 0,0 " style="fill:#cad0f8;stroke:#0D32B2;opacity:1.000000;stroke-width:2;"/><polygon points="171,0 186,-15 186,111 171,126 " style="fill:#cad0f8;stroke:#0D32B2;opacity:1.000000;stroke-width:2;"/><rect x="0" y="0" width="171" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="85.500000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:black">rectangle</text><g class="shape" ><polygon points="9,226 24,211 178,211 163,226 9,226 " style="fill:#cad0f8;stroke:#0D32B2;opacity:1.000000;stroke-width:2;"/><polygon points="163,226 178,211 178,365 163,380 " style="fill:#cad0f8;stroke:#0D32B2;opacity:1.000000;stroke-width:2;"/><rect x="9" y="226" width="154" height="154" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="86.000000" y="306.000000" style="text-anchor:middle;font-size:16px;fill:black">square</text><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 85.500000 128.000000 C 85.500000 166.000000 85.500000 186.000000 85.500000 222.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" /><style type="text/css"><![CDATA[
.text-bold { .text-bold {
font-family: "font-bold"; font-family: "font-bold";
} }

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 325 KiB

View file

@ -14,7 +14,7 @@ width="625" height="354" viewBox="-88 -88 625 354"><style type="text/css">
} }
]]> ]]>
</style><g class="shape" ><polygon points="12,26 27,11 198,11 183,26 12,26 " style="fill:#cad0f8;"/><polygon points="183,26 198,11 198,137 183,152 " style="fill:#cad0f8;"/><rect x="12" y="26" width="171" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="97.500000" y="92.000000" style="text-anchor:middle;font-size:16px;fill:black">rectangle</text><g class="shape" ><polygon points="283,12 298,-3 452,-3 437,12 283,12 " style="fill:#cad0f8;"/><polygon points="437,12 452,-3 452,151 437,166 " style="fill:#cad0f8;"/><rect x="283" y="12" width="154" height="154" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="360.000000" y="92.000000" style="text-anchor:middle;font-size:16px;fill:black">square</text><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 185.000000 89.000000 L 279.000000 89.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" /><style type="text/css"><![CDATA[ </style><g class="shape" ><polygon points="12,26 27,11 198,11 183,26 12,26 " style="fill:#cad0f8;stroke:#0D32B2;opacity:1.000000;stroke-width:2;"/><polygon points="183,26 198,11 198,137 183,152 " style="fill:#cad0f8;stroke:#0D32B2;opacity:1.000000;stroke-width:2;"/><rect x="12" y="26" width="171" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="97.500000" y="92.000000" style="text-anchor:middle;font-size:16px;fill:black">rectangle</text><g class="shape" ><polygon points="283,12 298,-3 452,-3 437,12 283,12 " style="fill:#cad0f8;stroke:#0D32B2;opacity:1.000000;stroke-width:2;"/><polygon points="437,12 452,-3 452,151 437,166 " style="fill:#cad0f8;stroke:#0D32B2;opacity:1.000000;stroke-width:2;"/><rect x="283" y="12" width="154" height="154" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="360.000000" y="92.000000" style="text-anchor:middle;font-size:16px;fill:black">square</text><marker id="mk-3990223579" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="#0D32B2" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 185.000000 89.000000 L 279.000000 89.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-3990223579)" /><style type="text/css"><![CDATA[
.text-bold { .text-bold {
font-family: "font-bold"; font-family: "font-bold";
} }

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 325 KiB

View file

@ -54,7 +54,7 @@
"strokeWidth": 2, "strokeWidth": 2,
"borderRadius": 0, "borderRadius": 0,
"fill": "red", "fill": "red",
"stroke": "#0D32B2", "stroke": "black",
"shadow": false, "shadow": false,
"3d": true, "3d": true,
"multiple": false, "multiple": false,

View file

@ -22,7 +22,7 @@ width="314" height="552" viewBox="-100 -100 314 552"><style type="text/css">
<feOffset dx="3" dy="5" result="ShadowFeOffset" in="ShadowFeComposite"></feOffset> <feOffset dx="3" dy="5" result="ShadowFeOffset" in="ShadowFeComposite"></feOffset>
<feBlend in="SourceGraphic" in2="ShadowFeOffset" mode="normal" result="ShadowFeBlend"></feBlend> <feBlend in="SourceGraphic" in2="ShadowFeOffset" mode="normal" result="ShadowFeBlend"></feBlend>
</filter> </filter>
</defs><g class="shape" filter="url(#shadow-filter)" ><rect x="1" y="0" width="113" height="126" style="fill:orange;stroke:#53C0D8;opacity:0.600000;stroke-width:5;" /></g><text class="text-bold" x="57.500000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:black">x</text><g class="shape" ><polygon points="0,226 15,211 129,211 114,226 0,226 " style="fill:#cc0000;"/><polygon points="114,226 129,211 129,337 114,352 " style="fill:#cc0000;"/><rect x="0" y="226" width="114" height="126" style="fill:red;stroke:#0D32B2;opacity:0.600000;stroke-width:2;" /></g><text class="text-bold" x="57.000000" y="292.000000" style="text-anchor:middle;font-size:16px;fill:black">y</text><marker id="mk-1457214650" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="green" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 57.000000 129.500000 C 57.000000 166.000000 57.000000 186.000000 57.000000 222.000000" class="connection" style="fill:none;stroke:green;opacity:0.500000;stroke-width:2;stroke-dasharray:10.000000,9.865639;" marker-end="url(#mk-1457214650)" /><style type="text/css"><![CDATA[ </defs><g class="shape" filter="url(#shadow-filter)" ><rect x="1" y="0" width="113" height="126" style="fill:orange;stroke:#53C0D8;opacity:0.600000;stroke-width:5;" /></g><text class="text-bold" x="57.500000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:black">x</text><g class="shape" ><polygon points="0,226 15,211 129,211 114,226 0,226 " style="fill:#cc0000;stroke:black;opacity:0.600000;stroke-width:2;"/><polygon points="114,226 129,211 129,337 114,352 " style="fill:#cc0000;stroke:black;opacity:0.600000;stroke-width:2;"/><rect x="0" y="226" width="114" height="126" style="fill:red;stroke:black;opacity:0.600000;stroke-width:2;" /></g><text class="text-bold" x="57.000000" y="292.000000" style="text-anchor:middle;font-size:16px;fill:black">y</text><marker id="mk-1457214650" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="green" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 57.000000 129.500000 C 57.000000 166.000000 57.000000 186.000000 57.000000 222.000000" class="connection" style="fill:none;stroke:green;opacity:0.500000;stroke-width:2;stroke-dasharray:10.000000,9.865639;" marker-end="url(#mk-1457214650)" /><style type="text/css"><![CDATA[
.text-bold { .text-bold {
font-family: "font-bold"; font-family: "font-bold";
} }

Before

Width:  |  Height:  |  Size: 325 KiB

After

Width:  |  Height:  |  Size: 325 KiB

View file

@ -54,7 +54,7 @@
"strokeWidth": 2, "strokeWidth": 2,
"borderRadius": 0, "borderRadius": 0,
"fill": "red", "fill": "red",
"stroke": "#0D32B2", "stroke": "black",
"shadow": false, "shadow": false,
"3d": true, "3d": true,
"multiple": false, "multiple": false,

View file

@ -22,7 +22,7 @@ width="527" height="326" viewBox="-88 -88 527 326"><style type="text/css">
<feOffset dx="3" dy="5" result="ShadowFeOffset" in="ShadowFeComposite"></feOffset> <feOffset dx="3" dy="5" result="ShadowFeOffset" in="ShadowFeComposite"></feOffset>
<feBlend in="SourceGraphic" in2="ShadowFeOffset" mode="normal" result="ShadowFeBlend"></feBlend> <feBlend in="SourceGraphic" in2="ShadowFeOffset" mode="normal" result="ShadowFeBlend"></feBlend>
</filter> </filter>
</defs><g class="shape" filter="url(#shadow-filter)" ><rect x="12" y="12" width="113" height="126" style="fill:orange;stroke:#53C0D8;opacity:0.600000;stroke-width:5;" /></g><text class="text-bold" x="68.500000" y="78.000000" style="text-anchor:middle;font-size:16px;fill:black">x</text><g class="shape" ><polygon points="225,12 240,-3 354,-3 339,12 225,12 " style="fill:#cc0000;"/><polygon points="339,12 354,-3 354,123 339,138 " style="fill:#cc0000;"/><rect x="225" y="12" width="114" height="126" style="fill:red;stroke:#0D32B2;opacity:0.600000;stroke-width:2;" /></g><text class="text-bold" x="282.000000" y="78.000000" style="text-anchor:middle;font-size:16px;fill:black">y</text><marker id="mk-1457214650" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="green" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 128.500000 75.000000 L 221.000000 75.000000" class="connection" style="fill:none;stroke:green;opacity:0.500000;stroke-width:2;stroke-dasharray:10.000000,9.865639;" marker-end="url(#mk-1457214650)" /><style type="text/css"><![CDATA[ </defs><g class="shape" filter="url(#shadow-filter)" ><rect x="12" y="12" width="113" height="126" style="fill:orange;stroke:#53C0D8;opacity:0.600000;stroke-width:5;" /></g><text class="text-bold" x="68.500000" y="78.000000" style="text-anchor:middle;font-size:16px;fill:black">x</text><g class="shape" ><polygon points="225,12 240,-3 354,-3 339,12 225,12 " style="fill:#cc0000;stroke:black;opacity:0.600000;stroke-width:2;"/><polygon points="339,12 354,-3 354,123 339,138 " style="fill:#cc0000;stroke:black;opacity:0.600000;stroke-width:2;"/><rect x="225" y="12" width="114" height="126" style="fill:red;stroke:black;opacity:0.600000;stroke-width:2;" /></g><text class="text-bold" x="282.000000" y="78.000000" style="text-anchor:middle;font-size:16px;fill:black">y</text><marker id="mk-1457214650" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon class="connection" fill="green" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><path d="M 128.500000 75.000000 L 221.000000 75.000000" class="connection" style="fill:none;stroke:green;opacity:0.500000;stroke-width:2;stroke-dasharray:10.000000,9.865639;" marker-end="url(#mk-1457214650)" /><style type="text/css"><![CDATA[
.text-bold { .text-bold {
font-family: "font-bold"; font-family: "font-bold";
} }

Before

Width:  |  Height:  |  Size: 325 KiB

After

Width:  |  Height:  |  Size: 325 KiB