d2: add self-referencing connections
This commit is contained in:
parent
ce00da10a5
commit
f62b1f6e8a
3 changed files with 30 additions and 12 deletions
4
Makefile
4
Makefile
|
@ -3,7 +3,7 @@ COV := $(DENO) coverage cov_profile
|
|||
FMT := $(DENO) fmt *.ts examples/*.ts
|
||||
NPM_PUB := npm publish
|
||||
|
||||
D2 := nix run git+https://git.pleshevski.ru/mynix/tools\\\#d2_unstable --
|
||||
D2 := nix run git+https://git.pleshevski.ru/mynix/tools\\\#d2 --
|
||||
DIAGRAMS := \
|
||||
turnstile
|
||||
|
||||
|
@ -40,7 +40,7 @@ clean:
|
|||
rm -rf assets/*.svg
|
||||
|
||||
define d2rule
|
||||
d2_$(1)_args := $(D2) $$($(1)_theme_args) assets/$(1).d2 assets/$(1).svg
|
||||
$(1)_args := $(D2) $$($(1)_theme_args) assets/$(1).d2 assets/$(1).svg
|
||||
|
||||
$(1): ; $$($(1)_args)
|
||||
$(1)-w: ; $$($(1)_args) -w
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
direction: right
|
||||
|
||||
Turnstile: {
|
||||
Locked -> Unlocked: coin
|
||||
Unlocked -> Locked: push
|
||||
l: Locked {
|
||||
shape: circle
|
||||
style.fill: "#fd7373"
|
||||
}
|
||||
u: Unlocked {
|
||||
shape: circle
|
||||
style.fill: "#59c061"
|
||||
}
|
||||
|
||||
l -> l: push
|
||||
u -> l: push
|
||||
|
||||
l -> u: coin
|
||||
u -> u: coin
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<svg
|
||||
style="background: white;"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="749" height="476" viewBox="-88 -88 749 476"><style type="text/css">
|
||||
width="749" height="554" viewBox="-88 -88 749 554"><style type="text/css">
|
||||
<![CDATA[
|
||||
.shape {
|
||||
shape-rendering: geometricPrecision;
|
||||
|
@ -14,13 +14,19 @@ width="749" height="476" viewBox="-88 -88 749 476"><style type="text/css">
|
|||
}
|
||||
|
||||
]]>
|
||||
</style><g id="Turnstile"><g class="shape" ><rect x="12" y="12" width="549" height="276" style="fill:#FABA8A;stroke:#311602;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="286.500000" y="45.000000" style="text-anchor:middle;font-size:28px;fill:#170206">Turnstile</text></g><g id="Turnstile.Locked"><g class="shape" ><rect x="331" y="87" width="155" height="126" style="fill:#FFE0C7;stroke:#311602;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="408.500000" y="153.000000" style="text-anchor:middle;font-size:16px;fill:#170206">Locked</text></g><g id="Turnstile.Unlocked"><g class="shape" ><rect x="87" y="87" width="171" height="126" style="fill:#FFE0C7;stroke:#311602;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="172.500000" y="153.000000" style="text-anchor:middle;font-size:16px;fill:#170206">Unlocked</text></g><g id="Turnstile.(Locked -> Unlocked)[0]"><marker id="mk-701194979" 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="#311602" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><mask id="mask-491102916" maskUnits="userSpaceOnUse" x="246.000000" y="157.000000" width="97.000000" height="28.000000">
|
||||
<rect x="246.000000" y="157.000000" width="97.000000" height="28.000000" fill="white"></rect>
|
||||
<rect x="281.000000" y="161.000000" width="27" height="21" fill="black"></rect>
|
||||
</mask><path d="M 329.000000 171.000000 L 262.000000 171.000000" class="connection" style="fill:none;stroke:#311602;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-701194979)" mask="url(#mask-491102916)" /><text class="text-italic" x="294.500000" y="177.000000" style="text-anchor:middle;font-size:16px;fill:#535152">coin</text></g><g id="Turnstile.(Unlocked -> Locked)[0]"><mask id="mask-1785474232" maskUnits="userSpaceOnUse" x="246.000000" y="115.000000" width="97.000000" height="28.000000">
|
||||
<rect x="246.000000" y="115.000000" width="97.000000" height="28.000000" fill="white"></rect>
|
||||
<rect x="278.000000" y="119.000000" width="33" height="21" fill="black"></rect>
|
||||
</mask><path d="M 260.000000 129.000000 L 327.000000 129.000000" class="connection" style="fill:none;stroke:#311602;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-701194979)" mask="url(#mask-1785474232)" /><text class="text-italic" x="294.500000" y="135.000000" style="text-anchor:middle;font-size:16px;fill:#535152">push</text></g><style type="text/css"><![CDATA[
|
||||
</style><g id="Turnstile"><g class="shape" ><rect x="12" y="12" width="549" height="354" style="fill:#FABA8A;stroke:#311602;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="286.500000" y="45.000000" style="text-anchor:middle;font-size:28px;fill:#170206">Turnstile</text></g><g id="Turnstile.l"><g class="shape" ><ellipse class="shape" cx="408.500000" cy="202.500000" rx="77.500000" ry="77.500000" style="fill:#fd7373;stroke:#311602;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="408.500000" y="205.500000" style="text-anchor:middle;font-size:16px;fill:#170206">Locked</text></g><g id="Turnstile.u"><g class="shape" ><ellipse class="shape" cx="172.500000" cy="205.500000" rx="85.500000" ry="85.500000" style="fill:#59c061;stroke:#311602;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="172.500000" y="208.500000" style="text-anchor:middle;font-size:16px;fill:#170206">Unlocked</text></g><g id="Turnstile.(l -> l)[0]"><marker id="mk-701194979" 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="#311602" stroke-width="2" points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" /> </marker><mask id="mask-1494680491" maskUnits="userSpaceOnUse" x="370.666667" y="101.333333" width="75.666667" height="38.000000">
|
||||
<rect x="370.666667" y="101.333333" width="75.666667" height="38.000000" fill="white"></rect>
|
||||
<rect x="392.000000" y="105.000000" width="33" height="21" fill="black"></rect>
|
||||
</mask><path d="M 382.666667 123.333333 L 382.666667 125.333333 S 382.666667 115.333333 392.666667 115.333333 L 429.333333 115.333333 S 434.333333 115.333333 434.333333 120.333333 L 434.333333 121.333333" class="connection" style="fill:none;stroke:#311602;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-701194979)" mask="url(#mask-1494680491)" /><text class="text-italic" x="408.500000" y="121.000000" style="text-anchor:middle;font-size:16px;fill:#535152">push</text></g><g id="Turnstile.(u -> l)[0]"><mask id="mask-594435644" maskUnits="userSpaceOnUse" x="246.000000" y="214.666667" width="97.000000" height="33.333333">
|
||||
<rect x="246.000000" y="214.666667" width="97.000000" height="33.333333" fill="white"></rect>
|
||||
<rect x="281.000000" y="224.000000" width="33" height="21" fill="black"></rect>
|
||||
</mask><path d="M 260.000000 234.000000 L 318.333333 234.000000 C 323.666667 234.000000 318.333333 228.666667 323.666667 228.666667 L 327.000000 228.666667" class="connection" style="fill:none;stroke:#311602;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-701194979)" mask="url(#mask-594435644)" /><text class="text-italic" x="297.500000" y="240.000000" style="text-anchor:middle;font-size:16px;fill:#535152">push</text></g><g id="Turnstile.(l -> u)[0]"><mask id="mask-1424756798" maskUnits="userSpaceOnUse" x="246.000000" y="163.000000" width="97.000000" height="28.000000">
|
||||
<rect x="246.000000" y="163.000000" width="97.000000" height="28.000000" fill="white"></rect>
|
||||
<rect x="281.000000" y="167.000000" width="27" height="21" fill="black"></rect>
|
||||
</mask><path d="M 329.000000 177.000000 L 262.000000 177.000000" class="connection" style="fill:none;stroke:#311602;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-701194979)" mask="url(#mask-1424756798)" /><text class="text-italic" x="294.500000" y="183.000000" style="text-anchor:middle;font-size:16px;fill:#535152">coin</text></g><g id="Turnstile.(u -> u)[0]"><mask id="mask-2366040521" maskUnits="userSpaceOnUse" x="132.000000" y="96.000000" width="81.000000" height="38.000000">
|
||||
<rect x="132.000000" y="96.000000" width="81.000000" height="38.000000" fill="white"></rect>
|
||||
<rect x="159.000000" y="100.000000" width="27" height="21" fill="black"></rect>
|
||||
</mask><path d="M 144.000000 118.000000 L 144.000000 120.000000 S 144.000000 110.000000 154.000000 110.000000 L 196.000000 110.000000 S 201.000000 110.000000 201.000000 115.000000 L 201.000000 116.000000" class="connection" style="fill:none;stroke:#311602;opacity:1.000000;stroke-width:2;" marker-end="url(#mk-701194979)" mask="url(#mask-2366040521)" /><text class="text-italic" x="172.500000" y="116.000000" style="text-anchor:middle;font-size:16px;fill:#535152">coin</text></g><style type="text/css"><![CDATA[
|
||||
.text-bold {
|
||||
font-family: "font-bold";
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 468 KiB After Width: | Height: | Size: 470 KiB |
Loading…
Reference in a new issue