This commit is contained in:
Alexander Wang 2022-12-05 19:50:08 -08:00
parent 035dc0d7a4
commit 546ea0266c
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
16 changed files with 2056 additions and 474 deletions

View file

@ -1553,13 +1553,45 @@ dst.id <-> src.dst_id
text: `x: {
shape: sequence_diagram
a
a
}
b -> x.a
`,
expErr: `d2/testdata/d2compiler/TestCompile/leaky_sequence.d2:5:1: connections within sequence diagrams can connect only to other objects within the same sequence diagram
`,
},
{
name: "sequence_scoping",
text: `x: {
shape: sequence_diagram
a;b
group: {
a -> b
a.t1 -> b.t1
b.t1.t2 -> b.t1
}
}
`,
assertions: func(t *testing.T, g *d2graph.Graph) {
tassert.Equal(t, 7, len(g.Objects))
tassert.Equal(t, 3, len(g.Objects[0].ChildrenArray))
},
},
{
name: "sequence_grouped_note",
text: `shape: sequence_diagram
a;d
choo: {
d."this note"
}
`,
assertions: func(t *testing.T, g *d2graph.Graph) {
tassert.Equal(t, 4, len(g.Objects))
tassert.Equal(t, 3, len(g.Root.ChildrenArray))
},
},
{
name: "root_direction",

View file

@ -525,6 +525,22 @@ func (obj *Object) HasEdge(mk *d2ast.Key) (*Edge, bool) {
}
func ResolveUnderscoreKey(ida []string, obj *Object) (resolvedObj *Object, resolvedIDA []string, _ error) {
if len(ida) > 0 {
objSD := obj.OuterSequenceDiagram()
if objSD != nil {
referencesActor := false
for _, c := range objSD.ChildrenArray {
if c.ID == ida[0] {
referencesActor = true
break
}
}
if referencesActor {
obj = objSD
}
}
}
resolvedObj = obj
resolvedIDA = ida

View file

@ -24,6 +24,10 @@ func (obj *Object) IsSequenceDiagramGroup() bool {
}
for _, e := range obj.Graph.Edges {
if e.Src == obj || e.Dst == obj {
if obj.AbsID() == "choo" {
println("\033[1;31m--- DEBUG:", "=======================", "\033[m")
println("\033[1;31m--- DEBUG:", e.AbsID(), "\033[m")
}
return false
}
}

View file

@ -1363,25 +1363,25 @@ d."The earth is like a tiny grain of sand, only much, much heavier"
a;b;c;d
a -> b
ggg: {
_.a -> _.b: lala
a -> b: lala
}
group 1: {
_.b -> _.c
_.c -> _.b: ey
b -> c
c -> b: ey
nested guy: {
_._.c -> _._.b: okay
c -> b: okay
}
_.b.t1 -> _.c.t1
_.b.t1.t2 -> _.c.t1
_.c.t1 -> _.b.t1
b.t1 -> c.t1
b.t1.t2 -> c.t1
c.t1 -> b.t1
}
group b: {
_.b -> _.c
_.c."what would arnold say"
_.c -> _.b: okay
b -> c
c."what would arnold say"
c -> b: okay
}
choo: {
_.d."this note"
d."this note"
}
`,
},
@ -1390,16 +1390,16 @@ choo: {
script: `shape: sequence_diagram
this is a message group: {
_.a -> _.b
a -> b
and this is a nested message group: {
_._.a -> _._.b
a -> b
what about more nesting: {
_._._.a -> _._._.b
a -> b
crazy town: {
_._._._.a."a note"
_._._._.a -> _._._._.b
a."a note"
a -> b
whoa: {
_._._._._.a -> _._._._._.b
a -> b
}
}
}
@ -1408,16 +1408,16 @@ this is a message group: {
alt: {
case 1: {
_._.b -> _._.c
b -> c
}
case 2: {
_._.b -> _._.c
b -> c
}
case 3: {
_._.b -> _._.c
b -> c
}
case 4: {
_._.b -> _._.c
b -> c
}
}
@ -1431,7 +1431,7 @@ c: "just an actor"
script: `How this is rendered: {
shape: sequence_diagram
CLI; d2ast; d2compiler; d2layout; d2exporter; d2themes; d2renderer
CLI; d2ast; d2compiler; d2layout; d2exporter; d2themes; d2renderer; d2dagrelayout
CLI -> d2ast: "'How this is rendered: {...}'"
d2ast -> CLI: tokenized AST
@ -1441,7 +1441,7 @@ c: "just an actor"
CLI -> d2layout.layout: run layout engines
d2layout.layout -> d2sequencelayout: run engine on shape: sequence_diagram, temporarily remove
only if root is not sequence: {
_.d2layout.layout -> _.d2dagrelayout: run core engine on rest
d2layout.layout -> d2dagrelayout: run core engine on rest
}
d2layout.layout <- d2sequencelayout: add back in sequence diagrams
d2layout -> CLI: diagram with correct positions and dimensions

View file

@ -5,11 +5,11 @@
"id": "this is a message group",
"type": "",
"pos": {
"x": -97,
"x": -47,
"y": 290
},
"width": 655,
"height": 952,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
@ -44,11 +44,11 @@
"id": "this is a message group.and this is a nested message group",
"type": "",
"pos": {
"x": -73,
"x": -23,
"y": 420
},
"width": 607,
"height": 798,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
@ -83,11 +83,11 @@
"id": "this is a message group.and this is a nested message group.what about more nesting",
"type": "",
"pos": {
"x": -49,
"x": 1,
"y": 550
},
"width": 559,
"height": 644,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
@ -122,16 +122,16 @@
"id": "this is a message group.and this is a nested message group.what about more nesting.crazy town",
"type": "",
"pos": {
"x": -25,
"x": 25,
"y": 680
},
"width": 511,
"height": 490,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#DEE1EB",
"fill": "#EEF1F8",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
@ -140,7 +140,7 @@
"link": "",
"icon": null,
"iconPosition": "",
"blend": true,
"blend": false,
"fields": null,
"methods": null,
"columns": null,
@ -158,19 +158,19 @@
"level": 4
},
{
"id": "a",
"id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.a",
"type": "",
"pos": {
"x": 24,
"y": 74
"x": 9223372036854775807,
"y": 9223372036854775807
},
"width": 150,
"height": 126,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"fill": "#FFFFFF",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
@ -193,19 +193,18 @@
"underline": false,
"labelWidth": 12,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
"zIndex": 3,
"level": 5
},
{
"id": "a.a note",
"type": "rectangle",
"id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.a.a note",
"type": "",
"pos": {
"x": 25,
"y": 720
"x": 9223372036854775807,
"y": 9223372036854775807
},
"width": 148,
"height": 126,
"width": -9223372036854775808,
"height": -9223372036854775808,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
@ -233,16 +232,15 @@
"underline": false,
"labelWidth": 48,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 5,
"level": 2
"zIndex": 3,
"level": 6
},
{
"id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.whoa",
"type": "",
"pos": {
"x": 49,
"y": 1066
"y": 810
},
"width": 413,
"height": 80,
@ -280,10 +278,10 @@
"id": "alt",
"type": "",
"pos": {
"x": 338,
"y": 1172
"x": 25,
"y": 916
},
"width": 460,
"width": 711,
"height": 518,
"opacity": 1,
"strokeDash": 0,
@ -319,10 +317,10 @@
"id": "alt.case 1",
"type": "",
"pos": {
"x": 362,
"y": 1196
"x": 49,
"y": 940
},
"width": 412,
"width": 663,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -358,10 +356,10 @@
"id": "alt.case 2",
"type": "",
"pos": {
"x": 362,
"y": 1326
"x": 49,
"y": 1070
},
"width": 412,
"width": 663,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -397,10 +395,10 @@
"id": "alt.case 3",
"type": "",
"pos": {
"x": 362,
"y": 1456
"x": 49,
"y": 1200
},
"width": 412,
"width": 663,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -436,10 +434,10 @@
"id": "alt.case 4",
"type": "",
"pos": {
"x": 362,
"y": 1586
"x": 49,
"y": 1330
},
"width": 412,
"width": 663,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -475,7 +473,7 @@
"id": "b",
"type": "",
"pos": {
"x": 337,
"x": 24,
"y": 74
},
"width": 150,
@ -515,8 +513,8 @@
"id": "b.note",
"type": "rectangle",
"pos": {
"x": 149,
"y": 2076
"x": -163,
"y": 1500
},
"width": 525,
"height": 126,
@ -551,11 +549,51 @@
"zIndex": 5,
"level": 2
},
{
"id": "a",
"type": "",
"pos": {
"x": 337,
"y": 74
},
"width": 150,
"height": 126,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "a",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 12,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "a.note",
"type": "rectangle",
"pos": {
"x": 30,
"x": 343,
"y": 1756
},
"width": 137,
@ -595,7 +633,7 @@
"id": "c",
"type": "",
"pos": {
"x": 629,
"x": 567,
"y": 74
},
"width": 190,
@ -659,11 +697,11 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"x": 412,
"y": 330
},
{
"x": 412,
"x": 99,
"y": 330
}
],
@ -698,11 +736,11 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"x": 412,
"y": 460
},
{
"x": 412,
"x": 99,
"y": 460
}
],
@ -737,11 +775,11 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"x": 412,
"y": 590
},
{
"x": 412,
"x": 99,
"y": 590
}
],
@ -776,12 +814,12 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"y": 976
"x": 412,
"y": 720
},
{
"x": 412,
"y": 976
"x": 99,
"y": 720
}
],
"animated": false,
@ -815,12 +853,12 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"y": 1106
"x": 412,
"y": 850
},
{
"x": 412,
"y": 1106
"x": 99,
"y": 850
}
],
"animated": false,
@ -854,12 +892,12 @@
"labelPercentage": 0,
"route": [
{
"x": 412,
"y": 1236
"x": 99,
"y": 980
},
{
"x": 724,
"y": 1236
"x": 662,
"y": 980
}
],
"animated": false,
@ -893,12 +931,12 @@
"labelPercentage": 0,
"route": [
{
"x": 412,
"y": 1366
"x": 99,
"y": 1110
},
{
"x": 724,
"y": 1366
"x": 662,
"y": 1110
}
],
"animated": false,
@ -932,12 +970,12 @@
"labelPercentage": 0,
"route": [
{
"x": 412,
"y": 1496
"x": 99,
"y": 1240
},
{
"x": 724,
"y": 1496
"x": 662,
"y": 1240
}
],
"animated": false,
@ -971,12 +1009,12 @@
"labelPercentage": 0,
"route": [
{
"x": 412,
"y": 1626
"x": 99,
"y": 1370
},
{
"x": 724,
"y": 1626
"x": 662,
"y": 1370
}
],
"animated": false,
@ -984,45 +1022,6 @@
"icon": null,
"zIndex": 4
},
{
"id": "(a -- )[0]",
"src": "a",
"srcArrow": "none",
"srcLabel": "",
"dst": "a-lifeline-end-2251863791",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 99,
"y": 200
},
{
"x": 99,
"y": 2332
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(b -- )[0]",
"src": "b",
@ -1047,6 +1046,45 @@
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 99,
"y": 200
},
{
"x": 99,
"y": 2076
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(a -- )[0]",
"src": "a",
"srcArrow": "none",
"srcLabel": "",
"dst": "a-lifeline-end-2251863791",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 412,
@ -1054,7 +1092,7 @@
},
{
"x": 412,
"y": 2332
"y": 2076
}
],
"animated": false,
@ -1088,12 +1126,12 @@
"labelPercentage": 0,
"route": [
{
"x": 724,
"x": 662,
"y": 200
},
{
"x": 724,
"y": 2332
"x": 662,
"y": 2076
}
],
"animated": false,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 332 KiB

After

Width:  |  Height:  |  Size: 333 KiB

View file

@ -5,11 +5,11 @@
"id": "this is a message group",
"type": "",
"pos": {
"x": -97,
"x": -47,
"y": 290
},
"width": 655,
"height": 952,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
@ -44,11 +44,11 @@
"id": "this is a message group.and this is a nested message group",
"type": "",
"pos": {
"x": -73,
"x": -23,
"y": 420
},
"width": 607,
"height": 798,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
@ -83,11 +83,11 @@
"id": "this is a message group.and this is a nested message group.what about more nesting",
"type": "",
"pos": {
"x": -49,
"x": 1,
"y": 550
},
"width": 559,
"height": 644,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
@ -122,16 +122,16 @@
"id": "this is a message group.and this is a nested message group.what about more nesting.crazy town",
"type": "",
"pos": {
"x": -25,
"x": 25,
"y": 680
},
"width": 511,
"height": 490,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#DEE1EB",
"fill": "#EEF1F8",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
@ -140,7 +140,7 @@
"link": "",
"icon": null,
"iconPosition": "",
"blend": true,
"blend": false,
"fields": null,
"methods": null,
"columns": null,
@ -158,19 +158,19 @@
"level": 4
},
{
"id": "a",
"id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.a",
"type": "",
"pos": {
"x": 24,
"y": 74
"x": 9223372036854775807,
"y": 9223372036854775807
},
"width": 150,
"height": 126,
"width": 0,
"height": 0,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"fill": "#FFFFFF",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
@ -193,19 +193,18 @@
"underline": false,
"labelWidth": 12,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
"zIndex": 3,
"level": 5
},
{
"id": "a.a note",
"type": "rectangle",
"id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.a.a note",
"type": "",
"pos": {
"x": 25,
"y": 720
"x": 9223372036854775807,
"y": 9223372036854775807
},
"width": 148,
"height": 126,
"width": -9223372036854775808,
"height": -9223372036854775808,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
@ -233,16 +232,15 @@
"underline": false,
"labelWidth": 48,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 5,
"level": 2
"zIndex": 3,
"level": 6
},
{
"id": "this is a message group.and this is a nested message group.what about more nesting.crazy town.whoa",
"type": "",
"pos": {
"x": 49,
"y": 1066
"y": 810
},
"width": 413,
"height": 80,
@ -280,10 +278,10 @@
"id": "alt",
"type": "",
"pos": {
"x": 338,
"y": 1172
"x": 25,
"y": 916
},
"width": 460,
"width": 711,
"height": 518,
"opacity": 1,
"strokeDash": 0,
@ -319,10 +317,10 @@
"id": "alt.case 1",
"type": "",
"pos": {
"x": 362,
"y": 1196
"x": 49,
"y": 940
},
"width": 412,
"width": 663,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -358,10 +356,10 @@
"id": "alt.case 2",
"type": "",
"pos": {
"x": 362,
"y": 1326
"x": 49,
"y": 1070
},
"width": 412,
"width": 663,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -397,10 +395,10 @@
"id": "alt.case 3",
"type": "",
"pos": {
"x": 362,
"y": 1456
"x": 49,
"y": 1200
},
"width": 412,
"width": 663,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -436,10 +434,10 @@
"id": "alt.case 4",
"type": "",
"pos": {
"x": 362,
"y": 1586
"x": 49,
"y": 1330
},
"width": 412,
"width": 663,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -475,7 +473,7 @@
"id": "b",
"type": "",
"pos": {
"x": 337,
"x": 24,
"y": 74
},
"width": 150,
@ -515,8 +513,8 @@
"id": "b.note",
"type": "rectangle",
"pos": {
"x": 149,
"y": 2076
"x": -163,
"y": 1500
},
"width": 525,
"height": 126,
@ -551,11 +549,51 @@
"zIndex": 5,
"level": 2
},
{
"id": "a",
"type": "",
"pos": {
"x": 337,
"y": 74
},
"width": 150,
"height": 126,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "a",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 12,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 1
},
{
"id": "a.note",
"type": "rectangle",
"pos": {
"x": 30,
"x": 343,
"y": 1756
},
"width": 137,
@ -595,7 +633,7 @@
"id": "c",
"type": "",
"pos": {
"x": 629,
"x": 567,
"y": 74
},
"width": 190,
@ -659,11 +697,11 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"x": 412,
"y": 330
},
{
"x": 412,
"x": 99,
"y": 330
}
],
@ -698,11 +736,11 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"x": 412,
"y": 460
},
{
"x": 412,
"x": 99,
"y": 460
}
],
@ -737,11 +775,11 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"x": 412,
"y": 590
},
{
"x": 412,
"x": 99,
"y": 590
}
],
@ -776,12 +814,12 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"y": 976
"x": 412,
"y": 720
},
{
"x": 412,
"y": 976
"x": 99,
"y": 720
}
],
"animated": false,
@ -815,12 +853,12 @@
"labelPercentage": 0,
"route": [
{
"x": 99,
"y": 1106
"x": 412,
"y": 850
},
{
"x": 412,
"y": 1106
"x": 99,
"y": 850
}
],
"animated": false,
@ -854,12 +892,12 @@
"labelPercentage": 0,
"route": [
{
"x": 412,
"y": 1236
"x": 99,
"y": 980
},
{
"x": 724,
"y": 1236
"x": 662,
"y": 980
}
],
"animated": false,
@ -893,12 +931,12 @@
"labelPercentage": 0,
"route": [
{
"x": 412,
"y": 1366
"x": 99,
"y": 1110
},
{
"x": 724,
"y": 1366
"x": 662,
"y": 1110
}
],
"animated": false,
@ -932,12 +970,12 @@
"labelPercentage": 0,
"route": [
{
"x": 412,
"y": 1496
"x": 99,
"y": 1240
},
{
"x": 724,
"y": 1496
"x": 662,
"y": 1240
}
],
"animated": false,
@ -971,12 +1009,12 @@
"labelPercentage": 0,
"route": [
{
"x": 412,
"y": 1626
"x": 99,
"y": 1370
},
{
"x": 724,
"y": 1626
"x": 662,
"y": 1370
}
],
"animated": false,
@ -984,45 +1022,6 @@
"icon": null,
"zIndex": 4
},
{
"id": "(a -- )[0]",
"src": "a",
"srcArrow": "none",
"srcLabel": "",
"dst": "a-lifeline-end-2251863791",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 99,
"y": 200
},
{
"x": 99,
"y": 2332
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(b -- )[0]",
"src": "b",
@ -1047,6 +1046,45 @@
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 99,
"y": 200
},
{
"x": 99,
"y": 2076
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(a -- )[0]",
"src": "a",
"srcArrow": "none",
"srcLabel": "",
"dst": "a-lifeline-end-2251863791",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 412,
@ -1054,7 +1092,7 @@
},
{
"x": 412,
"y": 2332
"y": 2076
}
],
"animated": false,
@ -1088,12 +1126,12 @@
"labelPercentage": 0,
"route": [
{
"x": 724,
"x": 662,
"y": 200
},
{
"x": 724,
"y": 2332
"x": 662,
"y": 2076
}
],
"animated": false,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 332 KiB

After

Width:  |  Height:  |  Size: 333 KiB

View file

@ -8,7 +8,7 @@
"x": 0,
"y": 0
},
"width": 2247,
"width": 2254,
"height": 2336,
"opacity": 1,
"strokeDash": 0,
@ -321,6 +321,46 @@
"zIndex": 0,
"level": 2
},
{
"id": "How this is rendered.d2dagrelayout",
"type": "",
"pos": {
"x": 1747,
"y": 110
},
"width": 204,
"height": 126,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "d2dagrelayout",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 104,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 2
},
{
"id": "How this is rendered.d2compiler.measurements also take place",
"type": "rectangle",
@ -368,7 +408,7 @@
"x": 805,
"y": 1362
},
"width": 1365,
"width": 1093,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -443,7 +483,7 @@
"id": "How this is rendered.d2sequencelayout",
"type": "",
"pos": {
"x": 1740,
"x": 2001,
"y": 110
},
"width": 229,
@ -479,46 +519,6 @@
"zIndex": 0,
"level": 2
},
{
"id": "How this is rendered.d2dagrelayout",
"type": "",
"pos": {
"x": 2019,
"y": 110
},
"width": 204,
"height": 126,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "d2dagrelayout",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 104,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 2
},
{
"id": "How this is rendered.d2exporter.export",
"type": "rectangle",
@ -785,7 +785,7 @@
"y": 1272
},
{
"x": 1854.5,
"x": 2115.5,
"y": 1272
}
],
@ -824,7 +824,7 @@
"y": 1402
},
{
"x": 2121,
"x": 1849,
"y": 1402
}
],
@ -863,7 +863,7 @@
"y": 1532
},
{
"x": 1854.5,
"x": 2115.5,
"y": 1532
}
],
@ -1340,45 +1340,6 @@
"icon": null,
"zIndex": 1
},
{
"id": "(How this is rendered.d2sequencelayout -- )[0]",
"src": "How this is rendered.d2sequencelayout",
"srcArrow": "none",
"srcLabel": "",
"dst": "d2sequencelayout-lifeline-end-3085844671",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 1854.5,
"y": 236
},
{
"x": 1854.5,
"y": 2312
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(How this is rendered.d2dagrelayout -- )[0]",
"src": "How this is rendered.d2dagrelayout",
@ -1405,11 +1366,50 @@
"labelPercentage": 0,
"route": [
{
"x": 2121,
"x": 1849,
"y": 236
},
{
"x": 2121,
"x": 1849,
"y": 2312
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(How this is rendered.d2sequencelayout -- )[0]",
"src": "How this is rendered.d2sequencelayout",
"srcArrow": "none",
"srcLabel": "",
"dst": "d2sequencelayout-lifeline-end-3085844671",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 2115.5,
"y": 236
},
{
"x": 2115.5,
"y": 2312
}
],

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 480 KiB

After

Width:  |  Height:  |  Size: 480 KiB

View file

@ -8,7 +8,7 @@
"x": 12,
"y": 12
},
"width": 2247,
"width": 2254,
"height": 2336,
"opacity": 1,
"strokeDash": 0,
@ -321,6 +321,46 @@
"zIndex": 0,
"level": 2
},
{
"id": "How this is rendered.d2dagrelayout",
"type": "",
"pos": {
"x": 1759,
"y": 122
},
"width": 204,
"height": 126,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "d2dagrelayout",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 104,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 2
},
{
"id": "How this is rendered.d2compiler.measurements also take place",
"type": "rectangle",
@ -368,7 +408,7 @@
"x": 817,
"y": 1374
},
"width": 1365,
"width": 1093,
"height": 80,
"opacity": 1,
"strokeDash": 0,
@ -443,7 +483,7 @@
"id": "How this is rendered.d2sequencelayout",
"type": "",
"pos": {
"x": 1752,
"x": 2013,
"y": 122
},
"width": 229,
@ -479,46 +519,6 @@
"zIndex": 0,
"level": 2
},
{
"id": "How this is rendered.d2dagrelayout",
"type": "",
"pos": {
"x": 2031,
"y": 122
},
"width": 204,
"height": 126,
"opacity": 1,
"strokeDash": 0,
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#EDF0FD",
"stroke": "#0D32B2",
"shadow": false,
"3d": false,
"multiple": false,
"tooltip": "",
"link": "",
"icon": null,
"iconPosition": "",
"blend": false,
"fields": null,
"methods": null,
"columns": null,
"label": "d2dagrelayout",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#0A0F25",
"italic": false,
"bold": false,
"underline": false,
"labelWidth": 104,
"labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 0,
"level": 2
},
{
"id": "How this is rendered.d2exporter.export",
"type": "rectangle",
@ -785,7 +785,7 @@
"y": 1284
},
{
"x": 1866.5,
"x": 2127.5,
"y": 1284
}
],
@ -824,7 +824,7 @@
"y": 1414
},
{
"x": 2133,
"x": 1861,
"y": 1414
}
],
@ -863,7 +863,7 @@
"y": 1544
},
{
"x": 1866.5,
"x": 2127.5,
"y": 1544
}
],
@ -1340,45 +1340,6 @@
"icon": null,
"zIndex": 1
},
{
"id": "(How this is rendered.d2sequencelayout -- )[0]",
"src": "How this is rendered.d2sequencelayout",
"srcArrow": "none",
"srcLabel": "",
"dst": "d2sequencelayout-lifeline-end-3085844671",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 1866.5,
"y": 248
},
{
"x": 1866.5,
"y": 2324
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(How this is rendered.d2dagrelayout -- )[0]",
"src": "How this is rendered.d2dagrelayout",
@ -1405,11 +1366,50 @@
"labelPercentage": 0,
"route": [
{
"x": 2133,
"x": 1861,
"y": 248
},
{
"x": 2133,
"x": 1861,
"y": 2324
}
],
"animated": false,
"tooltip": "",
"icon": null,
"zIndex": 1
},
{
"id": "(How this is rendered.d2sequencelayout -- )[0]",
"src": "How this is rendered.d2sequencelayout",
"srcArrow": "none",
"srcLabel": "",
"dst": "d2sequencelayout-lifeline-end-3085844671",
"dstArrow": "none",
"dstLabel": "",
"opacity": 1,
"strokeDash": 6,
"strokeWidth": 2,
"stroke": "#0D32B2",
"label": "",
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "",
"color": "#676C7E",
"italic": true,
"bold": false,
"underline": false,
"labelWidth": 0,
"labelHeight": 0,
"labelPosition": "",
"labelPercentage": 0,
"route": [
{
"x": 2127.5,
"y": 248
},
{
"x": 2127.5,
"y": 2324
}
],

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 480 KiB

After

Width:  |  Height:  |  Size: 480 KiB

View file

@ -75,15 +75,15 @@ ninety nine: {
b;a;c
b -> c
this is a message group: {
_.a -> _.b
a -> b
and this is a nested message group: {
_._.a -> _._.b
a -> b
what about more nesting: {
_._._.a -> _._._.b
a -> b
yo: {
_._._._.a -> _._._._.b
a -> b
yo: {
_._._._._.a -> _._._._._.b
a -> b
}
}
}

View file

@ -4,7 +4,7 @@
"ioerr": null,
"errs": [
{
"range": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2,4:0:36-4:8:44",
"range": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2,4:0:37-4:8:45",
"errmsg": "d2/testdata/d2compiler/TestCompile/leaky_sequence.d2:5:1: connections within sequence diagrams can connect only to other objects within the same sequence diagram"
}
]

View file

@ -0,0 +1,395 @@
{
"graph": {
"ast": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:0:0-5:0:54",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:0:0-0:23:23",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:0:0-0:5:5",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:0:0-0:5:5",
"value": [
{
"string": "shape",
"raw_string": "shape"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,0:7:7-0:23:23",
"value": [
{
"string": "sequence_diagram",
"raw_string": "sequence_diagram"
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-4:1:53",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-2:4:32",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-2:4:32",
"value": [
{
"string": "choo",
"raw_string": "choo"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:6:34-4:0:52",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:15:51",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:15:51",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:3:39",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
},
{
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:4:40-3:15:51",
"value": [
{
"string": "this note",
"raw_string": "this note"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"label_dimensions": {
"width": 0,
"height": 0
},
"attributes": {
"label": {
"value": ""
},
"style": {},
"near_key": null,
"shape": {
"value": "sequence_diagram"
},
"direction": {
"value": ""
}
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"id": "a",
"id_val": "a",
"label_dimensions": {
"width": 0,
"height": 0
},
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:0:24-1:1:25",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "a"
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "d",
"id_val": "d",
"label_dimensions": {
"width": 0,
"height": 0
},
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,1:2:26-1:3:27",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
},
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:15:51",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:3:39",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
},
{
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:4:40-3:15:51",
"value": [
{
"string": "this note",
"raw_string": "this note"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "d"
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "choo",
"id_val": "choo",
"label_dimensions": {
"width": 0,
"height": 0
},
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-2:4:32",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,2:0:28-2:4:32",
"value": [
{
"string": "choo",
"raw_string": "choo"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "choo"
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "this note",
"id_val": "this note",
"label_dimensions": {
"width": 0,
"height": 0
},
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:15:51",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:2:38-3:3:39",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
},
{
"double_quoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/sequence_grouped_note.d2,3:4:40-3:15:51",
"value": [
{
"string": "this note",
"raw_string": "this note"
}
]
}
}
]
},
"key_path_index": 1,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "this note"
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
}
},
"zIndex": 0
}
]
},
"err": null
}

1059
testdata/d2compiler/TestCompile/sequence_scoping.exp.json generated vendored Normal file

File diff suppressed because it is too large Load diff