implement arrays for classes

update

changelog
This commit is contained in:
Alexander Wang 2023-04-27 15:09:43 -07:00
parent 5714e34470
commit 7c401a4806
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
9 changed files with 1368 additions and 10 deletions

View file

@ -1,5 +1,6 @@
#### Features 🚀
- `class` field now accepts arrays. See [docs](TODO). [#1256](https://github.com/terrastruct/d2/pull/1256)
- Pill shape is implemented with rectangles of large border radius. Thanks @Poivey ! [#1006](https://github.com/terrastruct/d2/pull/1006)
#### Improvements 🧹

View file

@ -126,11 +126,25 @@ func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) {
func (c *compiler) compileMap(obj *d2graph.Object, m *d2ir.Map) {
class := m.GetField("class")
if class != nil {
className := class.Primary()
if className == nil {
c.errorf(class.LastRef().AST(), "class missing value")
var classNames []string
if class.Primary() != nil {
classNames = append(classNames, class.Primary().String())
} else if class.Composite != nil {
if arr, ok := class.Composite.(*d2ir.Array); ok {
for _, class := range arr.Values {
if scalar, ok := class.(*d2ir.Scalar); ok {
classNames = append(classNames, scalar.Value.ScalarString())
} else {
c.errorf(class.LastPrimaryKey(), "invalid value in array")
}
}
}
} else {
classMap := m.GetClassMap(className.String())
c.errorf(class.LastRef().AST(), "class missing value")
}
for _, className := range classNames {
classMap := m.GetClassMap(className)
if classMap != nil {
c.compileMap(obj, classMap)
}
@ -292,7 +306,7 @@ func (c *compiler) compileLabel(attrs *d2graph.Attributes, f d2ir.Node) {
func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) {
if f.Primary() == nil {
if f.Composite != nil {
if f.Composite != nil && !strings.EqualFold(f.Name, "class") {
c.errorf(f.LastPrimaryKey(), "reserved field %v does not accept composite", f.Name)
}
return
@ -462,7 +476,17 @@ func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) {
attrs.HorizontalGap.Value = scalar.ScalarString()
attrs.HorizontalGap.MapKey = f.LastPrimaryKey()
case "class":
attrs.Classes = append(attrs.Classes, scalar.ScalarString())
if f.Primary() != nil {
attrs.Classes = append(attrs.Classes, scalar.ScalarString())
} else if f.Composite != nil {
if arr, ok := f.Composite.(*d2ir.Array); ok {
for _, class := range arr.Values {
if scalar, ok := class.(*d2ir.Scalar); ok {
attrs.Classes = append(attrs.Classes, scalar.Value.ScalarString())
}
}
}
}
case "classes":
}
@ -577,11 +601,25 @@ func (c *compiler) compileEdge(obj *d2graph.Object, e *d2ir.Edge) {
func (c *compiler) compileEdgeMap(edge *d2graph.Edge, m *d2ir.Map) {
class := m.GetField("class")
if class != nil {
className := class.Primary()
if className == nil {
c.errorf(class.LastRef().AST(), "class missing value")
var classNames []string
if class.Primary() != nil {
classNames = append(classNames, class.Primary().String())
} else if class.Composite != nil {
if arr, ok := class.Composite.(*d2ir.Array); ok {
for _, class := range arr.Values {
if scalar, ok := class.(*d2ir.Scalar); ok {
classNames = append(classNames, scalar.Value.ScalarString())
} else {
c.errorf(class.LastPrimaryKey(), "invalid value in array")
}
}
}
} else {
classMap := m.GetClassMap(className.String())
c.errorf(class.LastRef().AST(), "class missing value")
}
for _, className := range classNames {
classMap := m.GetClassMap(className)
if classMap != nil {
c.compileEdgeMap(edge, classMap)
}

View file

@ -2382,6 +2382,35 @@ nostar -> 1star: { class: path }
tassert.Equal(t, "then", g.Edges[0].Label.Value)
},
},
{
name: "array-classes",
text: `classes: {
dragon_ball: {
label: ""
shape: circle
style.fill: orange
}
path: {
label: "then"
style.stroke-width: 4
}
path2: {
style.stroke-width: 2
}
}
nostar: { class: [dragon_ball; path] }
1star: { class: [path; dragon_ball] }
nostar -> 1star: { class: [path; path2] }
`,
assertions: func(t *testing.T, g *d2graph.Graph) {
tassert.Equal(t, "then", g.Objects[0].Label.Value)
tassert.Equal(t, "", g.Objects[1].Label.Value)
tassert.Equal(t, "circle", g.Objects[0].Shape.Value)
tassert.Equal(t, "circle", g.Objects[1].Shape.Value)
tassert.Equal(t, "2", g.Edges[0].Style.StrokeWidth.Value)
},
},
{
name: "reordered-classes",
text: `classes: {

View file

@ -2422,6 +2422,24 @@ nostar: { class: dragon_ball }
nostar -> 1star: { class: path }
1star -> 2star: { class: path }
`,
},
{
name: "array-classes",
script: `classes: {
button: {
style.border-radius: 999
style.stroke: black
}
success: {
style.fill: "#90EE90"
}
error: {
style.fill: "#EA9999"
}
}
yay: Successful { class: [button; success] }
nay: Failure { class: [button; error] }
`,
},
{

View file

@ -0,0 +1,130 @@
{
"name": "",
"isFolderOnly": false,
"fontFamily": "SourceSansPro",
"shapes": [
{
"id": "yay",
"type": "rectangle",
"pos": {
"x": 0,
"y": 0
},
"width": 120,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 999,
"fill": "#90EE90",
"stroke": "black",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "Successful",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "N1",
"italic": false,
"bold": true,
"underline": false,
"labelWidth": 75,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "nay",
"type": "rectangle",
"pos": {
"x": 180,
"y": 0
},
"width": 94,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 999,
"fill": "#EA9999",
"stroke": "black",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "Failure",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "N1",
"italic": false,
"bold": true,
"underline": false,
"labelWidth": 49,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
}
],
"connections": [],
"root": {
"id": "",
"type": "",
"pos": {
"x": 0,
"y": 0
},
"width": 0,
"height": 0,
"opacity": 0,
"strokeDash": 0,
"strokeWidth": 0,
"borderRadius": 0,
"fill": "N7",
"stroke": "",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "",
"fontSize": 0,
"fontFamily": "",
"language": "",
"color": "",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"zIndex": 0,
"level": 0
}
}

View file

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" d2Version="v0.4.1-HEAD" preserveAspectRatio="xMinYMin meet" viewBox="0 0 276 68"><svg id="d2-svg" class="d2-640799908" width="276" height="68" viewBox="-1 -1 276 68"><rect x="-1.000000" y="-1.000000" width="276.000000" height="68.000000" rx="0.000000" class=" fill-N7" stroke-width="0" /><style type="text/css"><![CDATA[
.d2-640799908 .text-bold {
font-family: "d2-640799908-font-bold";
}
@font-face {
font-family: d2-640799908-font-bold;
src: url("data:application/font-woff;base64,d09GRgABAAAAAAk8AAoAAAAADrwAAguFAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAAA9AAAAGAAAABgXxHXrmNtYXAAAAFUAAAAaQAAAIQB8QK2Z2x5ZgAAAcAAAANgAAAEDD3r17hoZWFkAAAFIAAAADYAAAA2G38e1GhoZWEAAAVYAAAAJAAAACQKfwXNaG10eAAABXwAAAA4AAAAOBbvAkJsb2NhAAAFtAAAAB4AAAAeCMoH5m1heHAAAAXUAAAAIAAAACAAJgD3bmFtZQAABfQAAAMoAAAIKgjwVkFwb3N0AAAJHAAAAB0AAAAg/9EAMgADAioCvAAFAAACigJYAAAASwKKAlgAAAFeADIBKQAAAgsHAwMEAwICBGAAAvcAAAADAAAAAAAAAABBREJPACAAIP//Au7/BgAAA9gBESAAAZ8AAAAAAfAClAAAACAAA3icZMxPCkFRAEfh73rPfwMDa7IBK5AopRTZCh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GzqyKWNH1p/FxCJ+JjN15+I4Ux1TMvW8ZO6p1kgV3n3C5Q6lG+rI5TPQHpWWTvNLtGcBI1NFJoZT9XKpjdz6F5oipqqlnO3tfbkNc9u95RbfkGqHS7UuOJWTWzB631S9dzRzrR+PgJCUC1kMSJnSoOBGvM8JuCLGcazunWhLClornzLPjVQSMRWDDonizMj0NzDd+MZ9sKF7Z29JKP+S6eWqqvtkcerV7YzeqHvLO9+6HK1NoGFTTdfUNBDXxLQfaafW+fvyzfW6pTzliJSY8F8vwDM8muxzwCFjZRjoZm6vQ1MvRJOXHKr6SyJZDaXnyCIc4PGcAw54yfN3+rhk4oyLW3FZz93imCO6HH5QFQv7Lke8Xn37/6y/i2lTtTierk4v7j3FJ3dQ6xfas9v3sqeJlZOYW7TbrTgjYFpycbvrNbnHeP8AAAD//wEAAP//9LdPUXicYmBmAIP/5xiMGLAAAAAAAP//AQAA//8vAQIDAAAA");
}]]></style><style type="text/css"><![CDATA[.shape {
shape-rendering: geometricPrecision;
stroke-linejoin: round;
}
.connection {
stroke-linecap: round;
stroke-linejoin: round;
}
.blend {
mix-blend-mode: multiply;
opacity: 0.5;
}
.d2-640799908 .fill-N1{fill:#0A0F25;}
.d2-640799908 .fill-N2{fill:#676C7E;}
.d2-640799908 .fill-N3{fill:#9499AB;}
.d2-640799908 .fill-N4{fill:#CFD2DD;}
.d2-640799908 .fill-N5{fill:#DEE1EB;}
.d2-640799908 .fill-N6{fill:#EEF1F8;}
.d2-640799908 .fill-N7{fill:#FFFFFF;}
.d2-640799908 .fill-B1{fill:#0D32B2;}
.d2-640799908 .fill-B2{fill:#0D32B2;}
.d2-640799908 .fill-B3{fill:#E3E9FD;}
.d2-640799908 .fill-B4{fill:#E3E9FD;}
.d2-640799908 .fill-B5{fill:#EDF0FD;}
.d2-640799908 .fill-B6{fill:#F7F8FE;}
.d2-640799908 .fill-AA2{fill:#4A6FF3;}
.d2-640799908 .fill-AA4{fill:#EDF0FD;}
.d2-640799908 .fill-AA5{fill:#F7F8FE;}
.d2-640799908 .fill-AB4{fill:#EDF0FD;}
.d2-640799908 .fill-AB5{fill:#F7F8FE;}
.d2-640799908 .stroke-N1{stroke:#0A0F25;}
.d2-640799908 .stroke-N2{stroke:#676C7E;}
.d2-640799908 .stroke-N3{stroke:#9499AB;}
.d2-640799908 .stroke-N4{stroke:#CFD2DD;}
.d2-640799908 .stroke-N5{stroke:#DEE1EB;}
.d2-640799908 .stroke-N6{stroke:#EEF1F8;}
.d2-640799908 .stroke-N7{stroke:#FFFFFF;}
.d2-640799908 .stroke-B1{stroke:#0D32B2;}
.d2-640799908 .stroke-B2{stroke:#0D32B2;}
.d2-640799908 .stroke-B3{stroke:#E3E9FD;}
.d2-640799908 .stroke-B4{stroke:#E3E9FD;}
.d2-640799908 .stroke-B5{stroke:#EDF0FD;}
.d2-640799908 .stroke-B6{stroke:#F7F8FE;}
.d2-640799908 .stroke-AA2{stroke:#4A6FF3;}
.d2-640799908 .stroke-AA4{stroke:#EDF0FD;}
.d2-640799908 .stroke-AA5{stroke:#F7F8FE;}
.d2-640799908 .stroke-AB4{stroke:#EDF0FD;}
.d2-640799908 .stroke-AB5{stroke:#F7F8FE;}
.d2-640799908 .background-color-N1{background-color:#0A0F25;}
.d2-640799908 .background-color-N2{background-color:#676C7E;}
.d2-640799908 .background-color-N3{background-color:#9499AB;}
.d2-640799908 .background-color-N4{background-color:#CFD2DD;}
.d2-640799908 .background-color-N5{background-color:#DEE1EB;}
.d2-640799908 .background-color-N6{background-color:#EEF1F8;}
.d2-640799908 .background-color-N7{background-color:#FFFFFF;}
.d2-640799908 .background-color-B1{background-color:#0D32B2;}
.d2-640799908 .background-color-B2{background-color:#0D32B2;}
.d2-640799908 .background-color-B3{background-color:#E3E9FD;}
.d2-640799908 .background-color-B4{background-color:#E3E9FD;}
.d2-640799908 .background-color-B5{background-color:#EDF0FD;}
.d2-640799908 .background-color-B6{background-color:#F7F8FE;}
.d2-640799908 .background-color-AA2{background-color:#4A6FF3;}
.d2-640799908 .background-color-AA4{background-color:#EDF0FD;}
.d2-640799908 .background-color-AA5{background-color:#F7F8FE;}
.d2-640799908 .background-color-AB4{background-color:#EDF0FD;}
.d2-640799908 .background-color-AB5{background-color:#F7F8FE;}
.d2-640799908 .color-N1{color:#0A0F25;}
.d2-640799908 .color-N2{color:#676C7E;}
.d2-640799908 .color-N3{color:#9499AB;}
.d2-640799908 .color-N4{color:#CFD2DD;}
.d2-640799908 .color-N5{color:#DEE1EB;}
.d2-640799908 .color-N6{color:#EEF1F8;}
.d2-640799908 .color-N7{color:#FFFFFF;}
.d2-640799908 .color-B1{color:#0D32B2;}
.d2-640799908 .color-B2{color:#0D32B2;}
.d2-640799908 .color-B3{color:#E3E9FD;}
.d2-640799908 .color-B4{color:#E3E9FD;}
.d2-640799908 .color-B5{color:#EDF0FD;}
.d2-640799908 .color-B6{color:#F7F8FE;}
.d2-640799908 .color-AA2{color:#4A6FF3;}
.d2-640799908 .color-AA4{color:#EDF0FD;}
.d2-640799908 .color-AA5{color:#F7F8FE;}
.d2-640799908 .color-AB4{color:#EDF0FD;}
.d2-640799908 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]></style><g id="yay"><g class="shape" ><rect x="0.000000" y="0.000000" width="120.000000" height="66.000000" rx="33.000000" stroke="black" fill="#90EE90" style="stroke-width:2;" /></g><text x="60.000000" y="38.500000" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">Successful</text></g><g id="nay"><g class="shape" ><rect x="180.000000" y="0.000000" width="94.000000" height="66.000000" rx="33.000000" stroke="black" fill="#EA9999" style="stroke-width:2;" /></g><text x="227.000000" y="38.500000" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">Failure</text></g><mask id="d2-640799908" maskUnits="userSpaceOnUse" x="-1" y="-1" width="276" height="68">
<rect x="-1" y="-1" width="276" height="68" fill="white"></rect>
</mask></svg></svg>

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

@ -0,0 +1,130 @@
{
"name": "",
"isFolderOnly": false,
"fontFamily": "SourceSansPro",
"shapes": [
{
"id": "yay",
"type": "rectangle",
"pos": {
"x": 12,
"y": 12
},
"width": 120,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 999,
"fill": "#90EE90",
"stroke": "black",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "Successful",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "N1",
"italic": false,
"bold": true,
"underline": false,
"labelWidth": 75,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "nay",
"type": "rectangle",
"pos": {
"x": 152,
"y": 12
},
"width": 94,
"height": 66,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 999,
"fill": "#EA9999",
"stroke": "black",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "Failure",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "N1",
"italic": false,
"bold": true,
"underline": false,
"labelWidth": 49,
"labelHeight": 21,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
}
],
"connections": [],
"root": {
"id": "",
"type": "",
"pos": {
"x": 0,
"y": 0
},
"width": 0,
"height": 0,
"opacity": 0,
"strokeDash": 0,
"strokeWidth": 0,
"borderRadius": 0,
"fill": "N7",
"stroke": "",
"shadow": false,
"3d": false,
"multiple": false,
"double-border": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "",
"fontSize": 0,
"fontFamily": "",
"language": "",
"color": "",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"zIndex": 0,
"level": 0
}
}

View file

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" d2Version="v0.4.1-HEAD" preserveAspectRatio="xMinYMin meet" viewBox="0 0 236 68"><svg id="d2-svg" class="d2-1992029540" width="236" height="68" viewBox="11 11 236 68"><rect x="11.000000" y="11.000000" width="236.000000" height="68.000000" rx="0.000000" class=" fill-N7" stroke-width="0" /><style type="text/css"><![CDATA[
.d2-1992029540 .text-bold {
font-family: "d2-1992029540-font-bold";
}
@font-face {
font-family: d2-1992029540-font-bold;
src: url("data:application/font-woff;base64,d09GRgABAAAAAAk8AAoAAAAADrwAAguFAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAAA9AAAAGAAAABgXxHXrmNtYXAAAAFUAAAAaQAAAIQB8QK2Z2x5ZgAAAcAAAANgAAAEDD3r17hoZWFkAAAFIAAAADYAAAA2G38e1GhoZWEAAAVYAAAAJAAAACQKfwXNaG10eAAABXwAAAA4AAAAOBbvAkJsb2NhAAAFtAAAAB4AAAAeCMoH5m1heHAAAAXUAAAAIAAAACAAJgD3bmFtZQAABfQAAAMoAAAIKgjwVkFwb3N0AAAJHAAAAB0AAAAg/9EAMgADAioCvAAFAAACigJYAAAASwKKAlgAAAFeADIBKQAAAgsHAwMEAwICBGAAAvcAAAADAAAAAAAAAABBREJPACAAIP//Au7/BgAAA9gBESAAAZ8AAAAAAfAClAAAACAAA3icZMxPCkFRAEfh73rPfwMDa7IBK5AopRTZChMJG7AAi/vJHZg4w29wUDQKJlp7zEw1WnMLSysbWztHp4Sfrqsevpp3XnnmkXtuueaSc/39V3Tquaunb2BoZMwHAAD//wEAAP//CfUamAAAAHicXJJNbNtkHMb/75vEoZm71kn8kS87iePXc9Y5a/y1NC1p0qYdrJm6resHWxeoxMfUbqCuoAoN7QAnNMQhk5hAggscOXFi0jjDuRM7IWDiwLGHCO2Q2siOtMEOli/28/x/z/NABJYB8Ba+ByEYgTGIAwtgMAVGMVRVjjqG48h8yFERE13Gcfe7b1UtrGnhcv6+9GG3izrX8L2jnSudra1/uvW6+/WPD9zP0K0HAAg6AOhvfBdGAj22wBqszHbQV+7TJ0/w3dtf3D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Lke8Xn37/6y/i2lTtTierk4v7j3FJ3dQ6xfas9v3sqeJlZOYW7TbrTgjYFpycbvrNbnHeP8AAAD//wEAAP//9LdPUXicYmBmAIP/5xiMGLAAAAAAAP//AQAA//8vAQIDAAAA");
}]]></style><style type="text/css"><![CDATA[.shape {
shape-rendering: geometricPrecision;
stroke-linejoin: round;
}
.connection {
stroke-linecap: round;
stroke-linejoin: round;
}
.blend {
mix-blend-mode: multiply;
opacity: 0.5;
}
.d2-1992029540 .fill-N1{fill:#0A0F25;}
.d2-1992029540 .fill-N2{fill:#676C7E;}
.d2-1992029540 .fill-N3{fill:#9499AB;}
.d2-1992029540 .fill-N4{fill:#CFD2DD;}
.d2-1992029540 .fill-N5{fill:#DEE1EB;}
.d2-1992029540 .fill-N6{fill:#EEF1F8;}
.d2-1992029540 .fill-N7{fill:#FFFFFF;}
.d2-1992029540 .fill-B1{fill:#0D32B2;}
.d2-1992029540 .fill-B2{fill:#0D32B2;}
.d2-1992029540 .fill-B3{fill:#E3E9FD;}
.d2-1992029540 .fill-B4{fill:#E3E9FD;}
.d2-1992029540 .fill-B5{fill:#EDF0FD;}
.d2-1992029540 .fill-B6{fill:#F7F8FE;}
.d2-1992029540 .fill-AA2{fill:#4A6FF3;}
.d2-1992029540 .fill-AA4{fill:#EDF0FD;}
.d2-1992029540 .fill-AA5{fill:#F7F8FE;}
.d2-1992029540 .fill-AB4{fill:#EDF0FD;}
.d2-1992029540 .fill-AB5{fill:#F7F8FE;}
.d2-1992029540 .stroke-N1{stroke:#0A0F25;}
.d2-1992029540 .stroke-N2{stroke:#676C7E;}
.d2-1992029540 .stroke-N3{stroke:#9499AB;}
.d2-1992029540 .stroke-N4{stroke:#CFD2DD;}
.d2-1992029540 .stroke-N5{stroke:#DEE1EB;}
.d2-1992029540 .stroke-N6{stroke:#EEF1F8;}
.d2-1992029540 .stroke-N7{stroke:#FFFFFF;}
.d2-1992029540 .stroke-B1{stroke:#0D32B2;}
.d2-1992029540 .stroke-B2{stroke:#0D32B2;}
.d2-1992029540 .stroke-B3{stroke:#E3E9FD;}
.d2-1992029540 .stroke-B4{stroke:#E3E9FD;}
.d2-1992029540 .stroke-B5{stroke:#EDF0FD;}
.d2-1992029540 .stroke-B6{stroke:#F7F8FE;}
.d2-1992029540 .stroke-AA2{stroke:#4A6FF3;}
.d2-1992029540 .stroke-AA4{stroke:#EDF0FD;}
.d2-1992029540 .stroke-AA5{stroke:#F7F8FE;}
.d2-1992029540 .stroke-AB4{stroke:#EDF0FD;}
.d2-1992029540 .stroke-AB5{stroke:#F7F8FE;}
.d2-1992029540 .background-color-N1{background-color:#0A0F25;}
.d2-1992029540 .background-color-N2{background-color:#676C7E;}
.d2-1992029540 .background-color-N3{background-color:#9499AB;}
.d2-1992029540 .background-color-N4{background-color:#CFD2DD;}
.d2-1992029540 .background-color-N5{background-color:#DEE1EB;}
.d2-1992029540 .background-color-N6{background-color:#EEF1F8;}
.d2-1992029540 .background-color-N7{background-color:#FFFFFF;}
.d2-1992029540 .background-color-B1{background-color:#0D32B2;}
.d2-1992029540 .background-color-B2{background-color:#0D32B2;}
.d2-1992029540 .background-color-B3{background-color:#E3E9FD;}
.d2-1992029540 .background-color-B4{background-color:#E3E9FD;}
.d2-1992029540 .background-color-B5{background-color:#EDF0FD;}
.d2-1992029540 .background-color-B6{background-color:#F7F8FE;}
.d2-1992029540 .background-color-AA2{background-color:#4A6FF3;}
.d2-1992029540 .background-color-AA4{background-color:#EDF0FD;}
.d2-1992029540 .background-color-AA5{background-color:#F7F8FE;}
.d2-1992029540 .background-color-AB4{background-color:#EDF0FD;}
.d2-1992029540 .background-color-AB5{background-color:#F7F8FE;}
.d2-1992029540 .color-N1{color:#0A0F25;}
.d2-1992029540 .color-N2{color:#676C7E;}
.d2-1992029540 .color-N3{color:#9499AB;}
.d2-1992029540 .color-N4{color:#CFD2DD;}
.d2-1992029540 .color-N5{color:#DEE1EB;}
.d2-1992029540 .color-N6{color:#EEF1F8;}
.d2-1992029540 .color-N7{color:#FFFFFF;}
.d2-1992029540 .color-B1{color:#0D32B2;}
.d2-1992029540 .color-B2{color:#0D32B2;}
.d2-1992029540 .color-B3{color:#E3E9FD;}
.d2-1992029540 .color-B4{color:#E3E9FD;}
.d2-1992029540 .color-B5{color:#EDF0FD;}
.d2-1992029540 .color-B6{color:#F7F8FE;}
.d2-1992029540 .color-AA2{color:#4A6FF3;}
.d2-1992029540 .color-AA4{color:#EDF0FD;}
.d2-1992029540 .color-AA5{color:#F7F8FE;}
.d2-1992029540 .color-AB4{color:#EDF0FD;}
.d2-1992029540 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]></style><g id="yay"><g class="shape" ><rect x="12.000000" y="12.000000" width="120.000000" height="66.000000" rx="33.000000" stroke="black" fill="#90EE90" style="stroke-width:2;" /></g><text x="72.000000" y="50.500000" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">Successful</text></g><g id="nay"><g class="shape" ><rect x="152.000000" y="12.000000" width="94.000000" height="66.000000" rx="33.000000" stroke="black" fill="#EA9999" style="stroke-width:2;" /></g><text x="199.000000" y="50.500000" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">Failure</text></g><mask id="d2-1992029540" maskUnits="userSpaceOnUse" x="11" y="11" width="236" height="68">
<rect x="11" y="11" width="236" height="68" fill="white"></rect>
</mask></svg></svg>

After

Width:  |  Height:  |  Size: 9.7 KiB

822
testdata/d2compiler/TestCompile/array-classes.exp.json generated vendored Normal file
View file

@ -0,0 +1,822 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,0:0:0-18:0:306",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,0:0:0-13:1:185",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,0:0:0-0:7:7",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,0:0:0-0:7:7",
"value": [
{
"string": "classes",
"raw_string": "classes"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,0:9:9-13:0:184",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,1:2:13-5:3:86",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,1:2:13-1:13:24",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,1:2:13-1:13:24",
"value": [
{
"string": "dragon_ball",
"raw_string": "dragon_ball"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,1:15:26-5:2:85",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,2:4:32-2:13:41",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,2:4:32-2:9:37",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,2:4:32-2:9:37",
"value": [
{
"string": "label",
"raw_string": "label"
}
]
}
}
]
},
"primary": {},
"value": {
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,2:11:39-2:13:41",
"value": null
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,3:4:46-3:17:59",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,3:4:46-3:9:51",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,3:4:46-3:9:51",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,3:11:53-3:17:59",
"value": [
{
"string": "circle",
"raw_string": "circle"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,4:4:64-4:22:82",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,4:4:64-4:14:74",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,4:4:64-4:9:69",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,4:10:70-4:14:74",
"value": [
{
"string": "fill",
"raw_string": "fill"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,4:16:76-4:22:82",
"value": [
{
"string": "orange",
"raw_string": "orange"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,6:2:89-9:3:144",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,6:2:89-6:6:93",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,6:2:89-6:6:93",
"value": [
{
"string": "path",
"raw_string": "path"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,6:8:95-9:2:143",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,7:4:101-7:17:114",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,7:4:101-7:9:106",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,7:4:101-7:9:106",
"value": [
{
"string": "label",
"raw_string": "label"
}
]
}
}
]
},
"primary": {},
"value": {
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,7:11:108-7:17:114",
"value": [
{
"string": "then",
"raw_string": "then"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,8:4:119-8:25:140",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,8:4:119-8:22:137",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,8:4:119-8:9:124",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,8:10:125-8:22:137",
"value": [
{
"string": "stroke-width",
"raw_string": "stroke-width"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,8:24:139-8:25:140",
"raw": "4",
"value": "4"
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,10:1:146-12:2:183",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,10:1:146-10:6:151",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,10:1:146-10:6:151",
"value": [
{
"string": "path2",
"raw_string": "path2"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,10:8:153-12:1:182",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,11:4:159-11:25:180",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,11:4:159-11:22:177",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,11:4:159-11:9:164",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,11:10:165-11:22:177",
"value": [
{
"string": "stroke-width",
"raw_string": "stroke-width"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,11:24:179-11:25:180",
"raw": "2",
"value": "2"
}
}
}
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:0:186-14:38:224",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:0:186-14:6:192",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:0:186-14:6:192",
"value": [
{
"string": "nostar",
"raw_string": "nostar"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:8:194-14:37:223",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:10:196-14:36:222",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:10:196-14:15:201",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:10:196-14:15:201",
"value": [
{
"string": "class",
"raw_string": "class"
}
]
}
}
]
},
"primary": {},
"value": {
"array": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:17:203-14:35:221",
"nodes": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:18:204-14:29:215",
"value": [
{
"string": "dragon_ball",
"raw_string": "dragon_ball"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:31:217-14:35:221",
"value": [
{
"string": "path",
"raw_string": "path"
}
]
}
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:0:225-15:37:262",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:0:225-15:5:230",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:0:225-15:5:230",
"value": [
{
"string": "1star",
"raw_string": "1star"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:7:232-15:36:261",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:9:234-15:35:260",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:9:234-15:14:239",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:9:234-15:14:239",
"value": [
{
"string": "class",
"raw_string": "class"
}
]
}
}
]
},
"primary": {},
"value": {
"array": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:16:241-15:34:259",
"nodes": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:17:242-15:21:246",
"value": [
{
"string": "path",
"raw_string": "path"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:23:248-15:34:259",
"value": [
{
"string": "dragon_ball",
"raw_string": "dragon_ball"
}
]
}
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:0:264-17:41:305",
"edges": [
{
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:0:264-17:15:279",
"src": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:0:264-17:7:271",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:0:264-17:6:270",
"value": [
{
"string": "nostar",
"raw_string": "nostar"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:9:273-17:15:279",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:10:274-17:15:279",
"value": [
{
"string": "1star",
"raw_string": "1star"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:17:281-17:40:304",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:19:283-17:39:303",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:19:283-17:24:288",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:19:283-17:24:288",
"value": [
{
"string": "class",
"raw_string": "class"
}
]
}
}
]
},
"primary": {},
"value": {
"array": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:26:290-17:38:302",
"nodes": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:27:291-17:31:295",
"value": [
{
"string": "path",
"raw_string": "path"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:33:297-17:38:302",
"value": [
{
"string": "path2",
"raw_string": "path2"
}
]
}
}
]
}
}
}
}
]
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
"edges": [
{
"index": 0,
"isCurve": false,
"src_arrow": false,
"dst_arrow": true,
"references": [
{
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "then"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"strokeWidth": {
"value": "2"
}
},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
}
],
"objects": [
{
"id": "nostar",
"id_val": "nostar",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:0:186-14:6:192",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,14:0:186-14:6:192",
"value": [
{
"string": "nostar",
"raw_string": "nostar"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
},
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:0:264-17:7:271",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:0:264-17:6:270",
"value": [
{
"string": "nostar",
"raw_string": "nostar"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "then"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"fill": {
"value": "orange"
},
"strokeWidth": {
"value": "4"
}
},
"near_key": null,
"shape": {
"value": "circle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "1star",
"id_val": "1star",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:0:225-15:5:230",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,15:0:225-15:5:230",
"value": [
{
"string": "1star",
"raw_string": "1star"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
},
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:9:273-17:15:279",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/array-classes.d2,17:10:274-17:15:279",
"value": [
{
"string": "1star",
"raw_string": "1star"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"fill": {
"value": "orange"
},
"strokeWidth": {
"value": "4"
}
},
"near_key": null,
"shape": {
"value": "circle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
}
]
},
"err": null
}