terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
16.22k stars 401 forks source link

d2 api: handle globs #1533

Open alixander opened 11 months ago

alixander commented 11 months ago

what happens if * -> y, and you delete one the edges? It shouldn't change the glob, it should null the edge.

What about adding a new object? i suppose the glob rules can also by default apply to it on creation

bo-ku-ra commented 11 months ago

i am confused

a{ style.font-color: darkgreen; style.stroke: darkgreen; style.fill: honeydew; }
b{ style.font-color: red; style.stroke: red; style.fill: mistyrose; }
c

#a:null

*->y
(b->y)[*]:null

#a:null
a{ style.font-color: darkgreen; style.stroke: darkgreen; style.fill: honeydew; }
b{ style.font-color: red; style.stroke: red; style.fill: mistyrose; }
c

a:null

*->y
(b->y)[*]:null

#a:null
a{ style.font-color: darkgreen; style.stroke: darkgreen; style.fill: honeydew; }
b{ style.font-color: red; style.stroke: red; style.fill: mistyrose; }
c

#a:null

*->y
(b->y)[*]:null

a:null
alixander commented 11 months ago

this is an issue for d2oracle, the golang library for programmatically changing d2 diagrams with code: https://d2lang.com/tour/api/