grammar: add support of font attribute

This commit is contained in:
Dmitriy Pleshevskiy 2023-06-16 05:20:03 +03:00
parent eec6b0d050
commit 37230c006f
Signed by: pleshevskiy
GPG key ID: 79C4487B44403985
8 changed files with 107 additions and 34 deletions

View file

@ -1,34 +0,0 @@
direction: right
classes: {
load balancer {
label: load\nbalancer
width: 100
height: 200
style: {
stroke-width: 0
fill: "#44C7B1"
shadow: true
border-radius: 5
}
}
unhealthy: {
style: {
fill: "#FE7070"
stroke: "#F69E03"
}
}
}
web traffic -> web lb
web lb.class: load balancer
web lb -> api1
web lb -> api2
web lb -> api3
api2.class: unhealthy
api1 -> cache lb
api3 -> cache lb
cache lb.class: load balancer

94
examples/flipt.d2 Normal file
View file

@ -0,0 +1,94 @@
classes: {
block: {
style: {
font: mono
stroke-dash: 2
stroke: black
border-radius: 5
}
}
grid-block: {
label: ""
style: {
fill: "#6EF759"
border-radius: 5
}
width: 40
height: 40
}
}
direction: right
Build: {
class: block
style: {
fill: "#FFEBCD"
}
source -> linked
source -> assets
linked -> artifacts
assets -> artifacts
artifacts: "" {
shape: image
icon: https://icons.terrastruct.com/essentials/220-layers.svg
width: 100
height: 100
}
}
Test: {
class: block
style: {
fill: "#ffc9d6"
}
grid: "" {
grid-columns: 4
grid-rows: 4
1.class: grid-block
2.class: grid-block
3.class: grid-block
4.class: grid-block
5.class: grid-block
6.class: grid-block
7.class: grid-block
8.class: grid-block
9.class: grid-block
10.class: grid-block
11.class: grid-block
12.class: grid-block
13.class: grid-block
14.class: grid-block
15.class: grid-block
16.class: grid-block
6.style.fill: red
12.style.fill: red
}
}
Release: {
class: block
style: {
fill: "#d5ffcd"
}
incoming.class: grid-block
incoming -> db1
incoming -> db2
db1: "" {
shape: image
icon: https://icons.terrastruct.com/essentials/117-database.svg
width: 70
height: 70
}
db2: "" {
shape: image
icon: https://icons.terrastruct.com/essentials/117-database.svg
width: 70
height: 70
}
}
Build.artifacts -> Test.grid -> Release.incoming

View file

@ -298,6 +298,7 @@ module.exports = grammar({
"stroke-dash", "stroke-dash",
"border-radius", "border-radius",
"double-border", "double-border",
"font",
"font-size", "font-size",
"font-color", "font-color",
"shadow", "shadow",

View file

@ -1461,6 +1461,10 @@
"type": "STRING", "type": "STRING",
"value": "double-border" "value": "double-border"
}, },
{
"type": "STRING",
"value": "font"
},
{ {
"type": "STRING", "type": "STRING",
"value": "font-size" "value": "font-size"

View file

@ -552,6 +552,10 @@
"type": "float", "type": "float",
"named": true "named": true
}, },
{
"type": "font",
"named": false
},
{ {
"type": "font-color", "type": "font-color",
"named": false "named": false

Binary file not shown.

View file

@ -13,6 +13,8 @@ stroke: red
stroke-width: 5 stroke-width: 5
stroke-dash: 4 stroke-dash: 4
border-radius: 1 border-radius: 1
font: mono
font-size: 20
font-color: red font-color: red
shadow: false shadow: false
multiple: true multiple: true
@ -36,6 +38,8 @@ near: abc
(attribute (attr_key (reserved)) (attr_value (integer))) (attribute (attr_key (reserved)) (attr_value (integer)))
(attribute (attr_key (reserved)) (attr_value (integer))) (attribute (attr_key (reserved)) (attr_value (integer)))
(attribute (attr_key (reserved)) (attr_value)) (attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value (integer)))
(attribute (attr_key (reserved)) (attr_value))
(attribute (attr_key (reserved)) (attr_value (boolean))) (attribute (attr_key (reserved)) (attr_value (boolean)))
(attribute (attr_key (reserved)) (attr_value (boolean))) (attribute (attr_key (reserved)) (attr_value (boolean)))
(attribute (attr_key (reserved)) (attr_value (boolean))) (attribute (attr_key (reserved)) (attr_value (boolean)))

Binary file not shown.