-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shapes: Add C4 Model shapes / Presets #1277
Comments
I think most of the shapes are already there. Check out the following code in my exporter to D2 from the structurizr language: Here is the list of shapes: https://structurizr.com/help/shapes. And also represented as code here: https://github.com/structurizr/java/blob/master/structurizr-core/src/com/structurizr/view/Shape.java. While I believe adding the absent shapes should not be hard, could you elaborate on why these windows, mobile phones, and robots matter? Do you use them? How widely are they adopted from your point of view? |
can this whole d2 source be defined as a new person shape? # ----------------------------------------------------------------------
# D2 - Declarative Diagramming https://d2lang.com/tour/intro/
# ----------------------------------------------------------------------
vars:"d2 v0.6.0" {
name: {
label:"foobar"
style.border-radius: 60
width: 300
height: 150
}
}
# ----------------------------------------------------------------------
grid-columns: 1
grid-rows: 2
grid-gap: 0
head: "" {
style.opacity: 0
grid-columns: 3
grid-gap: 0
leftside: "" {
style.opacity: 0
}
center: "" {
shape: circle
width: 130
}
rightside: "" {
style.opacity: 0
}
}
body : ${name} |
I tried to make a reusable version of the person shape by @bo-ku-ra: vars: {
person-shape: {
label: ""
grid-columns: 1
grid-rows: 2
grid-gap: 0
style.opacity: 0.0
head: {
label: ""
style.opacity: 0
grid-columns: 3
grid-gap: 0
leftside: {
style.opacity: 0
}
center: {
label: ""
shape: circle
width: 130
}
rightside: {
style.opacity: 0
}
}
body: {
label: ""
style.border-radius: 60
}
}
}
dora {
...${person-shape}
body.description: |md
## Dora
[Person]
Some person.
Their name starts with "D"
|
}
emily {
...${person-shape}
body.description: |md
## Emily
[Person]
Some person.
Their name starts with "E"
|
}
dora->emily: "Friends" This almost works, except that the heads are below the body: This is a bit puzzling, as it works in the original version, and Maybe the So close... |
they appear to be replaced in the order of appearance. vars: {
person-shape: {
label: ""
grid-columns: 1
grid-rows: 2
grid-gap: 0
style.opacity: 0.0
head: {
label: ""
style.opacity: 0
grid-columns: 3
grid-gap: 0
leftside: {
style.opacity: 0
}
center: {
label: ""
shape: circle
width: 130
}
rightside: {
style.opacity: 0
}
}
body: {
label: ""
style.border-radius: 60
}
}
}
dora: {
...${person-shape}
head.label: null
body.description: |md
## Dora
[Person]
Some person.
Their name starts with "D"
|
}
emily: {
...${person-shape}
head.label: null
body.description: |md
## Emily
[Person]
Some person.
Their name starts with "E"
|
}
dora -> emily: "Friends" |
Well, I guess that's a useable workaround until we have a better solution |
Hm that looks like a bug, will investigate. Thank you edit: dev notes: looks like this is related to #1721 , the way D2 compiles vars needs to be rewritten edit 2: nvm it's fixed, will be good in next release |
It would be great to have default shapes for full C4 Model. It's required sometimes by company's processes and standards.
Example shapes implementation can be found in draw.io's code
The text was updated successfully, but these errors were encountered: