diff --git a/d2ast/keywords.go b/d2ast/keywords.go index 8995961281..91266ee3ec 100644 --- a/d2ast/keywords.go +++ b/d2ast/keywords.go @@ -30,7 +30,8 @@ var SimpleReservedKeywords = map[string]struct{}{ // ReservedKeywordHolders are reserved keywords that are meaningless on its own and must hold composites var ReservedKeywordHolders = map[string]struct{}{ - "style": {}, + "style": {}, + "layout": {}, } // CompositeReservedKeywords are reserved keywords that can hold composites diff --git a/d2compiler/compile.go b/d2compiler/compile.go index 66f6497a54..a1b6bfba16 100644 --- a/d2compiler/compile.go +++ b/d2compiler/compile.go @@ -1,6 +1,7 @@ package d2compiler import ( + "encoding/json" "encoding/xml" "fmt" "html" @@ -388,6 +389,13 @@ func (c *compiler) compileField(obj *d2graph.Object, f *d2ir.Field) { } c.compileStyle(&obj.Attributes.Style, f.Map()) return + } else if f.Name.ScalarString() == "layout" && f.Name.IsUnquoted() { + if f.Map() == nil || len(f.Map().Fields) == 0 { + c.errorf(f.LastRef().AST(), `"layout" expected to be set to a map of key-values, or contain an additional keyword like "layout.elk.algorithm: stress"`) + return + } + c.compileLayout(&obj.Attributes.Layout, f.Map()) + return } if obj.Parent != nil { @@ -853,6 +861,48 @@ func compileStyleFieldInit(styles *d2graph.Style, f *d2ir.Field) { } } +func (c *compiler) compileLayout(layout **json.RawMessage, m *d2ir.Map) { + // Convert the D2 map to a JSON object + layoutMap := make(map[string]interface{}) + c.convertMapToJSON(m, layoutMap) + + // Marshal to JSON + jsonBytes, err := json.Marshal(layoutMap) + if err != nil { + c.errorf(m.AST(), "failed to compile layout options: %s", err.Error()) + return + } + + rawMsg := json.RawMessage(jsonBytes) + *layout = &rawMsg +} + +func (c *compiler) convertMapToJSON(m *d2ir.Map, result map[string]interface{}) { + for _, f := range m.Fields { + key := f.Name.ScalarString() + + if f.Primary() != nil && f.Primary().Value != nil { + // Simple scalar value + val := f.Primary().Value.ScalarString() + // Try to convert to appropriate types + if intVal, err := strconv.ParseInt(val, 10, 64); err == nil { + result[key] = intVal + } else if floatVal, err := strconv.ParseFloat(val, 64); err == nil { + result[key] = floatVal + } else if boolVal, err := strconv.ParseBool(val); err == nil { + result[key] = boolVal + } else { + result[key] = val + } + } else if f.Map() != nil { + // Nested map + nested := make(map[string]interface{}) + c.convertMapToJSON(f.Map(), nested) + result[key] = nested + } + } +} + func (c *compiler) compileEdge(obj *d2graph.Object, e *d2ir.Edge) { edge, err := obj.Connect(e.ID.SrcPath, e.ID.DstPath, e.ID.SrcArrow, e.ID.DstArrow, "") if err != nil { @@ -938,6 +988,12 @@ func (c *compiler) compileEdgeField(edge *d2graph.Edge, f *d2ir.Field) { } c.compileStyle(&edge.Attributes.Style, f.Map()) return + } else if f.Name.ScalarString() == "layout" { + if f.Map() == nil { + return + } + c.compileLayout(&edge.Attributes.Layout, f.Map()) + return } if (f.Name.ScalarString() == "source-arrowhead" || f.Name.ScalarString() == "target-arrowhead") && f.Name.IsUnquoted() { diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index dbd935eb8e..458e0b866d 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -3,6 +3,7 @@ package d2graph import ( "bytes" "context" + "encoding/json" "errors" "fmt" "io/fs" @@ -232,6 +233,9 @@ type Attributes struct { // These names are attached to the rendered elements in SVG // so that users can target them however they like outside of D2 Classes []string `json:"classes,omitempty"` + + // Layout options passed as JSON to layout engines + Layout *json.RawMessage `json:"layout,omitempty"` } // ApplyTextTransform will alter the `Label.Value` of the current object based diff --git a/d2layouts/d2elklayout/layout.go b/d2layouts/d2elklayout/layout.go index 67e6b466ed..397610e347 100644 --- a/d2layouts/d2elklayout/layout.go +++ b/d2layouts/d2elklayout/layout.go @@ -123,6 +123,109 @@ var DefaultOpts = ConfigurableOpts{ var port_spacing = 40. var edge_node_spacing = 40 +// mergeLayoutOptions merges user-defined layout options with base ELK options using deep merge +func mergeLayoutOptions(baseOptions *elkOpts, layoutJSON *json.RawMessage) *elkOpts { + if layoutJSON == nil { + return baseOptions + } + + // Debug: print what we received + fmt.Printf("DEBUG ELK: Received layout JSON: %s\n", string(*layoutJSON)) + + // Parse the JSON layout options + var userOptions map[string]interface{} + if err := json.Unmarshal(*layoutJSON, &userOptions); err != nil { + // Log error but don't fail - use base options + fmt.Printf("DEBUG ELK: Failed to unmarshal layout options: %v\n", err) + return baseOptions + } + + // Flatten user options to match base options structure + flatUserOptions := make(map[string]interface{}) + flattenForELK(userOptions, "", flatUserOptions) + + fmt.Printf("DEBUG ELK: Flattened user options: %+v\n", flatUserOptions) + + // Marshal base options to map for merging + baseJSON, err := json.Marshal(baseOptions) + if err != nil { + return baseOptions + } + + var baseMap map[string]interface{} + if err := json.Unmarshal(baseJSON, &baseMap); err != nil { + return baseOptions + } + + // Merge flattened user options with base options (user options override) + mergedMap := deepMerge(baseMap, flatUserOptions) + + // Debug: show what we're about to send to ELK + fmt.Printf("DEBUG ELK: Final merged options: %+v\n", mergedMap) + + // Convert back to elkOpts + mergedJSON, err := json.Marshal(mergedMap) + if err != nil { + return baseOptions + } + + fmt.Printf("DEBUG ELK: Final JSON sent to ELK: %s\n", string(mergedJSON)) + + var merged elkOpts + if err := json.Unmarshal(mergedJSON, &merged); err != nil { + fmt.Printf("DEBUG ELK: Failed to unmarshal final options: %v\n", err) + return baseOptions + } + + return &merged +} + +// deepMerge recursively merges two maps, with values from 'override' taking precedence +func deepMerge(base, override map[string]interface{}) map[string]interface{} { + result := make(map[string]interface{}) + + // Copy base map + for k, v := range base { + result[k] = v + } + + // Merge override values + for k, v := range override { + if baseVal, exists := result[k]; exists { + // If both values are maps, merge recursively + if baseMap, baseIsMap := baseVal.(map[string]interface{}); baseIsMap { + if overrideMap, overrideIsMap := v.(map[string]interface{}); overrideIsMap { + result[k] = deepMerge(baseMap, overrideMap) + continue + } + } + } + // Otherwise, override takes precedence + result[k] = v + } + + return result +} + +// flattenForELK converts nested D2 layout structure to flat ELK key format +// e.g. {"elk": {"algorithm": "stress"}} becomes {"elk.algorithm": "stress"} +func flattenForELK(input map[string]interface{}, prefix string, result map[string]interface{}) { + for key, value := range input { + fullKey := key + if prefix != "" { + fullKey = prefix + "." + key + } + + if valueMap, ok := value.(map[string]interface{}); ok { + // Recursively flatten nested maps + flattenForELK(valueMap, fullKey, result) + } else { + // Store the flattened key-value pair + result[fullKey] = value + } + } +} + type elkOpts struct { EdgeNode int `json:"elk.spacing.edgeNode,omitempty"` FixedAlignment string `json:"elk.layered.nodePlacement.bk.fixedAlignment,omitempty"` @@ -174,41 +277,46 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err } } - elkGraph := &ELKGraph{ - ID: "", - LayoutOptions: &elkOpts{ - Thoroughness: 8, - EdgeEdgeBetweenLayersSpacing: 50, - EdgeNode: edge_node_spacing, - HierarchyHandling: "INCLUDE_CHILDREN", - FixedAlignment: "BALANCED", - ConsiderModelOrder: "NODES_AND_EDGES", - CycleBreakingStrategy: "GREEDY_MODEL_ORDER", - NodeSizeConstraints: "MINIMUM_SIZE", - ContentAlignment: "H_CENTER V_CENTER", - ConfigurableOpts: ConfigurableOpts{ - Algorithm: opts.Algorithm, - NodeSpacing: opts.NodeSpacing, - EdgeNodeSpacing: opts.EdgeNodeSpacing, - SelfLoopSpacing: opts.SelfLoopSpacing, - }, + baseRootOpts := &elkOpts{ + Thoroughness: 8, + EdgeEdgeBetweenLayersSpacing: 50, + EdgeNode: edge_node_spacing, + HierarchyHandling: "INCLUDE_CHILDREN", + FixedAlignment: "BALANCED", + ConsiderModelOrder: "NODES_AND_EDGES", + CycleBreakingStrategy: "GREEDY_MODEL_ORDER", + NodeSizeConstraints: "MINIMUM_SIZE", + ContentAlignment: "H_CENTER V_CENTER", + ConfigurableOpts: ConfigurableOpts{ + Algorithm: opts.Algorithm, + NodeSpacing: opts.NodeSpacing, + EdgeNodeSpacing: opts.EdgeNodeSpacing, + SelfLoopSpacing: opts.SelfLoopSpacing, }, } + + elkGraph := &ELKGraph{ + ID: "", + LayoutOptions: mergeLayoutOptions(baseRootOpts, g.Root.Attributes.Layout), + } if elkGraph.LayoutOptions.ConfigurableOpts.SelfLoopSpacing == DefaultOpts.SelfLoopSpacing { // +5 for a tiny bit of padding elkGraph.LayoutOptions.ConfigurableOpts.SelfLoopSpacing = go2.Max(elkGraph.LayoutOptions.ConfigurableOpts.SelfLoopSpacing, childrenMaxSelfLoop(g.Root, g.Root.Direction.Value == "down" || g.Root.Direction.Value == "" || g.Root.Direction.Value == "up")/2+5) } - switch g.Root.Direction.Value { - case "down": - elkGraph.LayoutOptions.Direction = Down - case "up": - elkGraph.LayoutOptions.Direction = Up - case "right": - elkGraph.LayoutOptions.Direction = Right - case "left": - elkGraph.LayoutOptions.Direction = Left - default: - elkGraph.LayoutOptions.Direction = Down + // Only set direction if not already set by layout options + if elkGraph.LayoutOptions.Direction == "" { + switch g.Root.Direction.Value { + case "down": + elkGraph.LayoutOptions.Direction = Down + case "up": + elkGraph.LayoutOptions.Direction = Up + case "right": + elkGraph.LayoutOptions.Direction = Right + case "left": + elkGraph.LayoutOptions.Direction = Left + default: + elkGraph.LayoutOptions.Direction = Down + } } // set label and icon positions for ELK @@ -272,7 +380,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err } if len(obj.ChildrenArray) > 0 { - n.LayoutOptions = &elkOpts{ + baseOpts := &elkOpts{ ForceNodeModelOrder: true, Thoroughness: 8, EdgeEdgeBetweenLayersSpacing: 50, @@ -290,6 +398,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err Padding: opts.Padding, }, } + n.LayoutOptions = mergeLayoutOptions(baseOpts, obj.Attributes.Layout) if n.LayoutOptions.ConfigurableOpts.SelfLoopSpacing == DefaultOpts.SelfLoopSpacing { n.LayoutOptions.ConfigurableOpts.SelfLoopSpacing = go2.Max(n.LayoutOptions.ConfigurableOpts.SelfLoopSpacing, childrenMaxSelfLoop(obj, g.Root.Direction.Value == "down" || g.Root.Direction.Value == "" || g.Root.Direction.Value == "up")/2+5) } @@ -301,9 +410,10 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err n.LayoutOptions.NodeSizeMinimum = fmt.Sprintf("(%d, %d)", int(math.Ceil(width)), int(math.Ceil(height))) } } else { - n.LayoutOptions = &elkOpts{ + baseOpts := &elkOpts{ SelfLoopDistribution: "EQUALLY", } + n.LayoutOptions = mergeLayoutOptions(baseOpts, obj.Attributes.Layout) } if obj.IsContainer() { diff --git a/e2etests/stable_test.go b/e2etests/stable_test.go index 33664eba0f..3b00b81ea0 100644 --- a/e2etests/stable_test.go +++ b/e2etests/stable_test.go @@ -1872,18 +1872,19 @@ c: "just an actor" shape: sequence_diagram CLI; d2ast; d2compiler; d2layout; d2exporter; d2themes; d2renderer; d2sequencelayout; d2dagrelayout + d2layout.layout_: layout CLI -> d2ast: "'How this is rendered: {...}'" d2ast -> CLI: tokenized AST CLI -> d2compiler: compile AST d2compiler."measurements also take place" d2compiler -> CLI: objects and edges - CLI -> d2layout.layout: run layout engines - d2layout.layout -> d2sequencelayout: run engine on shape: sequence_diagram, temporarily remove + 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.layout_ <- d2sequencelayout: add back in sequence diagrams d2layout -> CLI: diagram with correct positions and dimensions CLI -> d2exporter: export diagram with chosen theme and renderer d2exporter.export -> d2themes: get theme styles diff --git a/e2etests/testdata/files/nesting_power.d2 b/e2etests/testdata/files/nesting_power.d2 index 93aec9d7c0..14dc6b6ce3 100644 --- a/e2etests/testdata/files/nesting_power.d2 +++ b/e2etests/testdata/files/nesting_power.d2 @@ -1,13 +1,14 @@ l: Left Constant Near { + layout_: layout direction: right near: center-left - default -> layout -> here + default -> layout_ -> here default: { direction: right dagre -- elk -- tala: or } - default.* -> layout: runs this + default.* -> layout_: runs this here: { grid-columns: 3 @@ -54,7 +55,7 @@ l: Left Constant Near { here.this.row 1 <- default.tala: straight edge across nested types {class: green} } -center -> directions: default layout +center -> directions: default layout_ center: { rectangle: {shape: "rectangle"} diff --git a/e2etests/testdata/stable/nesting_power/dagre/board.exp.json b/e2etests/testdata/stable/nesting_power/dagre/board.exp.json index 91aefcd270..80a1ecd04c 100644 --- a/e2etests/testdata/stable/nesting_power/dagre/board.exp.json +++ b/e2etests/testdata/stable/nesting_power/dagre/board.exp.json @@ -55,14 +55,14 @@ "level": 1 }, { - "id": "l.default", + "id": "l.layout_", "type": "rectangle", "pos": { - "x": -2496, - "y": 1197 + "x": -1760, + "y": 1290 }, - "width": 559, - "height": 189, + "width": 90, + "height": 66, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -82,29 +82,29 @@ "fields": null, "methods": null, "columns": null, - "label": "default", - "fontSize": 24, + "label": "layout", + "fontSize": 16, "fontFamily": "DEFAULT", "language": "", "color": "N1", "italic": false, - "bold": false, + "bold": true, "underline": false, - "labelWidth": 71, - "labelHeight": 31, - "labelPosition": "OUTSIDE_TOP_CENTER", + "labelWidth": 45, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 2 }, { - "id": "l.layout", + "id": "l.default", "type": "rectangle", "pos": { - "x": -1760, - "y": 1290 + "x": -2496, + "y": 1197 }, - "width": 90, - "height": 66, + "width": 559, + "height": 189, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -124,17 +124,17 @@ "fields": null, "methods": null, "columns": null, - "label": "layout", - "fontSize": 16, + "label": "default", + "fontSize": 24, "fontFamily": "DEFAULT", "language": "", "color": "N1", "italic": false, - "bold": true, + "bold": false, "underline": false, - "labelWidth": 45, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelWidth": 71, + "labelHeight": 31, + "labelPosition": "OUTSIDE_TOP_CENTER", "zIndex": 0, "level": 2 }, @@ -6316,10 +6316,10 @@ ], "connections": [ { - "id": "l.(default -> layout)[0]", + "id": "l.(default -> layout_)[0]", "src": "l.default", "srcArrow": "none", - "dst": "l.layout", + "dst": "l.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -6364,8 +6364,8 @@ "zIndex": 0 }, { - "id": "l.(layout -> here)[0]", - "src": "l.layout", + "id": "l.(layout_ -> here)[0]", + "src": "l.layout_", "srcArrow": "none", "dst": "l.here", "dstArrow": "triangle", @@ -6508,10 +6508,10 @@ "zIndex": 0 }, { - "id": "l.(default.tala -> layout)[0]", + "id": "l.(default.tala -> layout_)[0]", "src": "l.default.tala", "srcArrow": "none", - "dst": "l.layout", + "dst": "l.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -6556,10 +6556,10 @@ "zIndex": 0 }, { - "id": "l.(default.dagre -> layout)[0]", + "id": "l.(default.dagre -> layout_)[0]", "src": "l.default.dagre", "srcArrow": "none", - "dst": "l.layout", + "dst": "l.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -6652,10 +6652,10 @@ "zIndex": 0 }, { - "id": "l.(default.elk -> layout)[0]", + "id": "l.(default.elk -> layout_)[0]", "src": "l.default.elk", "srcArrow": "none", - "dst": "l.layout", + "dst": "l.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -7370,7 +7370,7 @@ "strokeWidth": 2, "stroke": "B1", "borderRadius": 10, - "label": "default layout", + "label": "default layout_", "fontSize": 16, "fontFamily": "DEFAULT", "language": "", @@ -7378,7 +7378,7 @@ "italic": true, "bold": false, "underline": false, - "labelWidth": 93, + "labelWidth": 99, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "labelPercentage": 0, diff --git a/e2etests/testdata/stable/nesting_power/dagre/sketch.exp.svg b/e2etests/testdata/stable/nesting_power/dagre/sketch.exp.svg index dfd05f7a97..b54b73afea 100644 --- a/e2etests/testdata/stable/nesting_power/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/nesting_power/dagre/sketch.exp.svg @@ -1,23 +1,23 @@ - + .d2-3779496257 .fill-N1{fill:#0A0F25;} + .d2-3779496257 .fill-N2{fill:#676C7E;} + .d2-3779496257 .fill-N3{fill:#9499AB;} + .d2-3779496257 .fill-N4{fill:#CFD2DD;} + .d2-3779496257 .fill-N5{fill:#DEE1EB;} + .d2-3779496257 .fill-N6{fill:#EEF1F8;} + .d2-3779496257 .fill-N7{fill:#FFFFFF;} + .d2-3779496257 .fill-B1{fill:#0D32B2;} + .d2-3779496257 .fill-B2{fill:#0D32B2;} + .d2-3779496257 .fill-B3{fill:#E3E9FD;} + .d2-3779496257 .fill-B4{fill:#E3E9FD;} + .d2-3779496257 .fill-B5{fill:#EDF0FD;} + .d2-3779496257 .fill-B6{fill:#F7F8FE;} + .d2-3779496257 .fill-AA2{fill:#4A6FF3;} + .d2-3779496257 .fill-AA4{fill:#EDF0FD;} + .d2-3779496257 .fill-AA5{fill:#F7F8FE;} + .d2-3779496257 .fill-AB4{fill:#EDF0FD;} + .d2-3779496257 .fill-AB5{fill:#F7F8FE;} + .d2-3779496257 .stroke-N1{stroke:#0A0F25;} + .d2-3779496257 .stroke-N2{stroke:#676C7E;} + .d2-3779496257 .stroke-N3{stroke:#9499AB;} + .d2-3779496257 .stroke-N4{stroke:#CFD2DD;} + .d2-3779496257 .stroke-N5{stroke:#DEE1EB;} + .d2-3779496257 .stroke-N6{stroke:#EEF1F8;} + .d2-3779496257 .stroke-N7{stroke:#FFFFFF;} + .d2-3779496257 .stroke-B1{stroke:#0D32B2;} + .d2-3779496257 .stroke-B2{stroke:#0D32B2;} + .d2-3779496257 .stroke-B3{stroke:#E3E9FD;} + .d2-3779496257 .stroke-B4{stroke:#E3E9FD;} + .d2-3779496257 .stroke-B5{stroke:#EDF0FD;} + .d2-3779496257 .stroke-B6{stroke:#F7F8FE;} + .d2-3779496257 .stroke-AA2{stroke:#4A6FF3;} + .d2-3779496257 .stroke-AA4{stroke:#EDF0FD;} + .d2-3779496257 .stroke-AA5{stroke:#F7F8FE;} + .d2-3779496257 .stroke-AB4{stroke:#EDF0FD;} + .d2-3779496257 .stroke-AB5{stroke:#F7F8FE;} + .d2-3779496257 .background-color-N1{background-color:#0A0F25;} + .d2-3779496257 .background-color-N2{background-color:#676C7E;} + .d2-3779496257 .background-color-N3{background-color:#9499AB;} + .d2-3779496257 .background-color-N4{background-color:#CFD2DD;} + .d2-3779496257 .background-color-N5{background-color:#DEE1EB;} + .d2-3779496257 .background-color-N6{background-color:#EEF1F8;} + .d2-3779496257 .background-color-N7{background-color:#FFFFFF;} + .d2-3779496257 .background-color-B1{background-color:#0D32B2;} + .d2-3779496257 .background-color-B2{background-color:#0D32B2;} + .d2-3779496257 .background-color-B3{background-color:#E3E9FD;} + .d2-3779496257 .background-color-B4{background-color:#E3E9FD;} + .d2-3779496257 .background-color-B5{background-color:#EDF0FD;} + .d2-3779496257 .background-color-B6{background-color:#F7F8FE;} + .d2-3779496257 .background-color-AA2{background-color:#4A6FF3;} + .d2-3779496257 .background-color-AA4{background-color:#EDF0FD;} + .d2-3779496257 .background-color-AA5{background-color:#F7F8FE;} + .d2-3779496257 .background-color-AB4{background-color:#EDF0FD;} + .d2-3779496257 .background-color-AB5{background-color:#F7F8FE;} + .d2-3779496257 .color-N1{color:#0A0F25;} + .d2-3779496257 .color-N2{color:#676C7E;} + .d2-3779496257 .color-N3{color:#9499AB;} + .d2-3779496257 .color-N4{color:#CFD2DD;} + .d2-3779496257 .color-N5{color:#DEE1EB;} + .d2-3779496257 .color-N6{color:#EEF1F8;} + .d2-3779496257 .color-N7{color:#FFFFFF;} + .d2-3779496257 .color-B1{color:#0D32B2;} + .d2-3779496257 .color-B2{color:#0D32B2;} + .d2-3779496257 .color-B3{color:#E3E9FD;} + .d2-3779496257 .color-B4{color:#E3E9FD;} + .d2-3779496257 .color-B5{color:#EDF0FD;} + .d2-3779496257 .color-B6{color:#F7F8FE;} + .d2-3779496257 .color-AA2{color:#4A6FF3;} + .d2-3779496257 .color-AA4{color:#EDF0FD;} + .d2-3779496257 .color-AA5{color:#F7F8FE;} + .d2-3779496257 .color-AB4{color:#EDF0FD;} + .d2-3779496257 .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-d2-3779496257);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker-d2-3779496257);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-3779496257);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-3779496257);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-3779496257);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-3779496257);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-3779496257);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-3779496257);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]> @@ -111,9 +111,9 @@ -Left Constant NearcenterdirectionsRight Constant NearseqmoreBottom Left Constant Neardefaultlayouthererectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloudrightleftisconstantandalsogridscoreritemResponseitemessayRubricconceptitemOutcomestylishcontaineradagreelktalathisisgrid12341234updownnearax +Left Constant NearcenterdirectionsRight Constant NearseqmoreBottom Left Constant Nearlayoutdefaulthererectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloudrightleftisconstantandalsogridscoreritemResponseitemessayRubricconceptitemOutcomestylishcontaineradagreelktalathisisgrid12341234updownnearax -ya_sequencea_shapesequencefinallybrow 1row 2row 3row 4row 5withasequence diagramyou canchild of is12341234scoreritemResponseitemessayRubricconceptsequencefrom one constant nearhaveanothergridhere andgrandchildscorerconceptessayRubricitemitemOutcomeitemResponse123continuenesting ororruns thisruns thisruns thisA straight edge across straight edge across nested typesdefault layoutdefault layoutdefault layout in styleto inside sequence diagramto inside sequence diagramto inside sequence diagramto constant nearfrom within constant nearto another getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)score +ya_sequencea_shapesequencefinallybrow 1row 2row 3row 4row 5withasequence diagramyou canchild of is12341234scoreritemResponseitemessayRubricconceptsequencefrom one constant nearhaveanothergridhere andgrandchildscorerconceptessayRubricitemitemOutcomeitemResponse123continuenesting ororruns thisruns thisruns thisA straight edge across straight edge across nested typesdefault layout_default layoutdefault layout in styleto inside sequence diagramto inside sequence diagramto inside sequence diagramto constant nearfrom within constant nearto another getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)score @@ -123,7 +123,7 @@ - + diff --git a/e2etests/testdata/stable/nesting_power/elk/board.exp.json b/e2etests/testdata/stable/nesting_power/elk/board.exp.json index 1f0a26a069..d36424727d 100644 --- a/e2etests/testdata/stable/nesting_power/elk/board.exp.json +++ b/e2etests/testdata/stable/nesting_power/elk/board.exp.json @@ -55,14 +55,14 @@ "level": 1 }, { - "id": "l.default", + "id": "l.layout_", "type": "rectangle", "pos": { - "x": -2750, - "y": 1141 + "x": -1820, + "y": 1171 }, - "width": 658, - "height": 251, + "width": 90, + "height": 160, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -82,29 +82,29 @@ "fields": null, "methods": null, "columns": null, - "label": "default", - "fontSize": 24, + "label": "layout", + "fontSize": 16, "fontFamily": "DEFAULT", "language": "", "color": "N1", "italic": false, - "bold": false, + "bold": true, "underline": false, - "labelWidth": 71, - "labelHeight": 31, - "labelPosition": "INSIDE_TOP_CENTER", + "labelWidth": 45, + "labelHeight": 21, + "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 0, "level": 2 }, { - "id": "l.layout", + "id": "l.default", "type": "rectangle", "pos": { - "x": -1820, - "y": 1171 + "x": -2750, + "y": 1141 }, - "width": 90, - "height": 160, + "width": 658, + "height": 251, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, @@ -124,17 +124,17 @@ "fields": null, "methods": null, "columns": null, - "label": "layout", - "fontSize": 16, + "label": "default", + "fontSize": 24, "fontFamily": "DEFAULT", "language": "", "color": "N1", "italic": false, - "bold": true, + "bold": false, "underline": false, - "labelWidth": 45, - "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", + "labelWidth": 71, + "labelHeight": 31, + "labelPosition": "INSIDE_TOP_CENTER", "zIndex": 0, "level": 2 }, @@ -6316,10 +6316,10 @@ ], "connections": [ { - "id": "l.(default -> layout)[0]", + "id": "l.(default -> layout_)[0]", "src": "l.default", "srcArrow": "none", - "dst": "l.layout", + "dst": "l.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -6355,8 +6355,8 @@ "zIndex": 0 }, { - "id": "l.(layout -> here)[0]", - "src": "l.layout", + "id": "l.(layout_ -> here)[0]", + "src": "l.layout_", "srcArrow": "none", "dst": "l.here", "dstArrow": "triangle", @@ -6480,10 +6480,10 @@ "zIndex": 0 }, { - "id": "l.(default.tala -> layout)[0]", + "id": "l.(default.tala -> layout_)[0]", "src": "l.default.tala", "srcArrow": "none", - "dst": "l.layout", + "dst": "l.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -6527,10 +6527,10 @@ "zIndex": 0 }, { - "id": "l.(default.dagre -> layout)[0]", + "id": "l.(default.dagre -> layout_)[0]", "src": "l.default.dagre", "srcArrow": "none", - "dst": "l.layout", + "dst": "l.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -6574,10 +6574,10 @@ "zIndex": 0 }, { - "id": "l.(default.elk -> layout)[0]", + "id": "l.(default.elk -> layout_)[0]", "src": "l.default.elk", "srcArrow": "none", - "dst": "l.layout", + "dst": "l.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -7267,7 +7267,7 @@ "strokeWidth": 2, "stroke": "B1", "borderRadius": 10, - "label": "default layout", + "label": "default layout_", "fontSize": 16, "fontFamily": "DEFAULT", "language": "", @@ -7275,7 +7275,7 @@ "italic": true, "bold": false, "underline": false, - "labelWidth": 93, + "labelWidth": 99, "labelHeight": 21, "labelPosition": "INSIDE_MIDDLE_CENTER", "labelPercentage": 0, diff --git a/e2etests/testdata/stable/nesting_power/elk/sketch.exp.svg b/e2etests/testdata/stable/nesting_power/elk/sketch.exp.svg index d10feea9f1..4aadc642f6 100644 --- a/e2etests/testdata/stable/nesting_power/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/nesting_power/elk/sketch.exp.svg @@ -1,23 +1,23 @@ - + .d2-3897249982 .fill-N1{fill:#0A0F25;} + .d2-3897249982 .fill-N2{fill:#676C7E;} + .d2-3897249982 .fill-N3{fill:#9499AB;} + .d2-3897249982 .fill-N4{fill:#CFD2DD;} + .d2-3897249982 .fill-N5{fill:#DEE1EB;} + .d2-3897249982 .fill-N6{fill:#EEF1F8;} + .d2-3897249982 .fill-N7{fill:#FFFFFF;} + .d2-3897249982 .fill-B1{fill:#0D32B2;} + .d2-3897249982 .fill-B2{fill:#0D32B2;} + .d2-3897249982 .fill-B3{fill:#E3E9FD;} + .d2-3897249982 .fill-B4{fill:#E3E9FD;} + .d2-3897249982 .fill-B5{fill:#EDF0FD;} + .d2-3897249982 .fill-B6{fill:#F7F8FE;} + .d2-3897249982 .fill-AA2{fill:#4A6FF3;} + .d2-3897249982 .fill-AA4{fill:#EDF0FD;} + .d2-3897249982 .fill-AA5{fill:#F7F8FE;} + .d2-3897249982 .fill-AB4{fill:#EDF0FD;} + .d2-3897249982 .fill-AB5{fill:#F7F8FE;} + .d2-3897249982 .stroke-N1{stroke:#0A0F25;} + .d2-3897249982 .stroke-N2{stroke:#676C7E;} + .d2-3897249982 .stroke-N3{stroke:#9499AB;} + .d2-3897249982 .stroke-N4{stroke:#CFD2DD;} + .d2-3897249982 .stroke-N5{stroke:#DEE1EB;} + .d2-3897249982 .stroke-N6{stroke:#EEF1F8;} + .d2-3897249982 .stroke-N7{stroke:#FFFFFF;} + .d2-3897249982 .stroke-B1{stroke:#0D32B2;} + .d2-3897249982 .stroke-B2{stroke:#0D32B2;} + .d2-3897249982 .stroke-B3{stroke:#E3E9FD;} + .d2-3897249982 .stroke-B4{stroke:#E3E9FD;} + .d2-3897249982 .stroke-B5{stroke:#EDF0FD;} + .d2-3897249982 .stroke-B6{stroke:#F7F8FE;} + .d2-3897249982 .stroke-AA2{stroke:#4A6FF3;} + .d2-3897249982 .stroke-AA4{stroke:#EDF0FD;} + .d2-3897249982 .stroke-AA5{stroke:#F7F8FE;} + .d2-3897249982 .stroke-AB4{stroke:#EDF0FD;} + .d2-3897249982 .stroke-AB5{stroke:#F7F8FE;} + .d2-3897249982 .background-color-N1{background-color:#0A0F25;} + .d2-3897249982 .background-color-N2{background-color:#676C7E;} + .d2-3897249982 .background-color-N3{background-color:#9499AB;} + .d2-3897249982 .background-color-N4{background-color:#CFD2DD;} + .d2-3897249982 .background-color-N5{background-color:#DEE1EB;} + .d2-3897249982 .background-color-N6{background-color:#EEF1F8;} + .d2-3897249982 .background-color-N7{background-color:#FFFFFF;} + .d2-3897249982 .background-color-B1{background-color:#0D32B2;} + .d2-3897249982 .background-color-B2{background-color:#0D32B2;} + .d2-3897249982 .background-color-B3{background-color:#E3E9FD;} + .d2-3897249982 .background-color-B4{background-color:#E3E9FD;} + .d2-3897249982 .background-color-B5{background-color:#EDF0FD;} + .d2-3897249982 .background-color-B6{background-color:#F7F8FE;} + .d2-3897249982 .background-color-AA2{background-color:#4A6FF3;} + .d2-3897249982 .background-color-AA4{background-color:#EDF0FD;} + .d2-3897249982 .background-color-AA5{background-color:#F7F8FE;} + .d2-3897249982 .background-color-AB4{background-color:#EDF0FD;} + .d2-3897249982 .background-color-AB5{background-color:#F7F8FE;} + .d2-3897249982 .color-N1{color:#0A0F25;} + .d2-3897249982 .color-N2{color:#676C7E;} + .d2-3897249982 .color-N3{color:#9499AB;} + .d2-3897249982 .color-N4{color:#CFD2DD;} + .d2-3897249982 .color-N5{color:#DEE1EB;} + .d2-3897249982 .color-N6{color:#EEF1F8;} + .d2-3897249982 .color-N7{color:#FFFFFF;} + .d2-3897249982 .color-B1{color:#0D32B2;} + .d2-3897249982 .color-B2{color:#0D32B2;} + .d2-3897249982 .color-B3{color:#E3E9FD;} + .d2-3897249982 .color-B4{color:#E3E9FD;} + .d2-3897249982 .color-B5{color:#EDF0FD;} + .d2-3897249982 .color-B6{color:#F7F8FE;} + .d2-3897249982 .color-AA2{color:#4A6FF3;} + .d2-3897249982 .color-AA4{color:#EDF0FD;} + .d2-3897249982 .color-AA5{color:#F7F8FE;} + .d2-3897249982 .color-AB4{color:#EDF0FD;} + .d2-3897249982 .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-d2-3897249982);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker-d2-3897249982);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-3897249982);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-3897249982);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-3897249982);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-3897249982);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-3897249982);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-3897249982);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]> @@ -111,9 +111,9 @@ -Left Constant NearcenterdirectionsRight Constant NearseqmoreBottom Left Constant Neardefaultlayouthererectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloudrightleftisconstantandalsogridscoreritemResponseitemessayRubricconceptitemOutcomestylishcontaineradagreelktalathisisgrid12341234updownnearax +Left Constant NearcenterdirectionsRight Constant NearseqmoreBottom Left Constant Nearlayoutdefaulthererectanglesquarepageparallelogramdocumentcylinderqueuepackagestepcalloutstored_datapersondiamondovalcirclehexagoncloudrightleftisconstantandalsogridscoreritemResponseitemessayRubricconceptitemOutcomestylishcontaineradagreelktalathisisgrid12341234updownnearax -ya_sequencea_shapesequencefinallybrow 1row 2row 3row 4row 5withasequence diagramyou canchild of is12341234scoreritemResponseitemessayRubricconceptsequencefrom one constant nearhaveanothergridhere andgrandchildscorerconceptessayRubricitemitemOutcomeitemResponse123continuenesting ororruns thisruns thisruns thisA straight edge across straight edge across nested typesdefault layoutdefault layoutdefault layout in styleto inside sequence diagramto inside sequence diagramto inside sequence diagramto constant nearfrom within constant nearto another getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)score +ya_sequencea_shapesequencefinallybrow 1row 2row 3row 4row 5withasequence diagramyou canchild of is12341234scoreritemResponseitemessayRubricconceptsequencefrom one constant nearhaveanothergridhere andgrandchildscorerconceptessayRubricitemitemOutcomeitemResponse123continuenesting ororruns thisruns thisruns thisA straight edge across straight edge across nested typesdefault layout_default layoutdefault layout in styleto inside sequence diagramto inside sequence diagramto inside sequence diagramto constant nearfrom within constant nearto another getItem() itemgetRubric()rubricapplyTo(essayResp)match(essayResponse)score @@ -123,7 +123,7 @@ - + diff --git a/e2etests/testdata/stable/sequence_diagram_real/dagre/board.exp.json b/e2etests/testdata/stable/sequence_diagram_real/dagre/board.exp.json index 8c488deb50..4386f5f54e 100644 --- a/e2etests/testdata/stable/sequence_diagram_real/dagre/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_real/dagre/board.exp.json @@ -433,19 +433,19 @@ "level": 2 }, { - "id": "How this is rendered.d2compiler.measurements also take place", - "type": "page", + "id": "How this is rendered.d2layout.layout_", + "type": "rectangle", "pos": { - "x": 329, - "y": 497 + "x": 610, + "y": 720 }, - "width": 247, - "height": 66, + "width": 12, + "height": 321, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "borderRadius": 0, - "fill": "N7", + "fill": "B4", "stroke": "B1", "animated": false, "shadow": false, @@ -460,7 +460,7 @@ "fields": null, "methods": null, "columns": null, - "label": "measurements also take place", + "label": "", "fontSize": 16, "fontFamily": "DEFAULT", "language": "", @@ -468,26 +468,25 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 202, + "labelWidth": 42, "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 5, + "zIndex": 2, "level": 3 }, { - "id": "How this is rendered.d2layout.layout", - "type": "rectangle", + "id": "How this is rendered.d2compiler.measurements also take place", + "type": "page", "pos": { - "x": 610, - "y": 720 + "x": 329, + "y": 497 }, - "width": 12, - "height": 321, + "width": 247, + "height": 66, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "borderRadius": 0, - "fill": "B4", + "fill": "N7", "stroke": "B1", "animated": false, "shadow": false, @@ -502,7 +501,7 @@ "fields": null, "methods": null, "columns": null, - "label": "", + "label": "measurements also take place", "fontSize": 16, "fontFamily": "DEFAULT", "language": "", @@ -510,9 +509,10 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 42, + "labelWidth": 202, "labelHeight": 21, - "zIndex": 2, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 5, "level": 3 }, { @@ -758,10 +758,10 @@ "zIndex": 4 }, { - "id": "How this is rendered.(CLI -> d2layout.layout)[0]", + "id": "How this is rendered.(CLI -> d2layout.layout_)[0]", "src": "How this is rendered.CLI", "srcArrow": "none", - "dst": "How this is rendered.d2layout.layout", + "dst": "How this is rendered.d2layout.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -797,8 +797,8 @@ "zIndex": 4 }, { - "id": "How this is rendered.(d2layout.layout -> d2sequencelayout)[0]", - "src": "How this is rendered.d2layout.layout", + "id": "How this is rendered.(d2layout.layout_ -> d2sequencelayout)[0]", + "src": "How this is rendered.d2layout.layout_", "srcArrow": "none", "dst": "How this is rendered.d2sequencelayout", "dstArrow": "triangle", @@ -836,8 +836,8 @@ "zIndex": 4 }, { - "id": "How this is rendered.(d2layout.layout -> d2dagrelayout)[0]", - "src": "How this is rendered.d2layout.layout", + "id": "How this is rendered.(d2layout.layout_ -> d2dagrelayout)[0]", + "src": "How this is rendered.d2layout.layout_", "srcArrow": "none", "dst": "How this is rendered.d2dagrelayout", "dstArrow": "triangle", @@ -875,8 +875,8 @@ "zIndex": 4 }, { - "id": "How this is rendered.(d2layout.layout <- d2sequencelayout)[0]", - "src": "How this is rendered.d2layout.layout", + "id": "How this is rendered.(d2layout.layout_ <- d2sequencelayout)[0]", + "src": "How this is rendered.d2layout.layout_", "srcArrow": "triangle", "dst": "How this is rendered.d2sequencelayout", "dstArrow": "none", diff --git a/e2etests/testdata/stable/sequence_diagram_real/dagre/sketch.exp.svg b/e2etests/testdata/stable/sequence_diagram_real/dagre/sketch.exp.svg index 7814fe4f63..4c583543a2 100644 --- a/e2etests/testdata/stable/sequence_diagram_real/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/sequence_diagram_real/dagre/sketch.exp.svg @@ -1,16 +1,16 @@ -How this is renderedCLId2astd2compilerd2layoutd2exporterd2themesd2rendererd2sequencelayoutd2dagrelayoutonly if root is not sequence 'How this is rendered: {...}'tokenized ASTcompile ASTobjects and edgesrun layout enginesrun engine on shape: sequence_diagram, temporarily removerun core engine on rest add back in sequence diagramsdiagram with correct positions and dimensionsexport diagram with chosen theme and rendererget theme stylesrender to SVGresulting SVGmeasurements also take place + .d2-44883262 .fill-N1{fill:#0A0F25;} + .d2-44883262 .fill-N2{fill:#676C7E;} + .d2-44883262 .fill-N3{fill:#9499AB;} + .d2-44883262 .fill-N4{fill:#CFD2DD;} + .d2-44883262 .fill-N5{fill:#DEE1EB;} + .d2-44883262 .fill-N6{fill:#EEF1F8;} + .d2-44883262 .fill-N7{fill:#FFFFFF;} + .d2-44883262 .fill-B1{fill:#0D32B2;} + .d2-44883262 .fill-B2{fill:#0D32B2;} + .d2-44883262 .fill-B3{fill:#E3E9FD;} + .d2-44883262 .fill-B4{fill:#E3E9FD;} + .d2-44883262 .fill-B5{fill:#EDF0FD;} + .d2-44883262 .fill-B6{fill:#F7F8FE;} + .d2-44883262 .fill-AA2{fill:#4A6FF3;} + .d2-44883262 .fill-AA4{fill:#EDF0FD;} + .d2-44883262 .fill-AA5{fill:#F7F8FE;} + .d2-44883262 .fill-AB4{fill:#EDF0FD;} + .d2-44883262 .fill-AB5{fill:#F7F8FE;} + .d2-44883262 .stroke-N1{stroke:#0A0F25;} + .d2-44883262 .stroke-N2{stroke:#676C7E;} + .d2-44883262 .stroke-N3{stroke:#9499AB;} + .d2-44883262 .stroke-N4{stroke:#CFD2DD;} + .d2-44883262 .stroke-N5{stroke:#DEE1EB;} + .d2-44883262 .stroke-N6{stroke:#EEF1F8;} + .d2-44883262 .stroke-N7{stroke:#FFFFFF;} + .d2-44883262 .stroke-B1{stroke:#0D32B2;} + .d2-44883262 .stroke-B2{stroke:#0D32B2;} + .d2-44883262 .stroke-B3{stroke:#E3E9FD;} + .d2-44883262 .stroke-B4{stroke:#E3E9FD;} + .d2-44883262 .stroke-B5{stroke:#EDF0FD;} + .d2-44883262 .stroke-B6{stroke:#F7F8FE;} + .d2-44883262 .stroke-AA2{stroke:#4A6FF3;} + .d2-44883262 .stroke-AA4{stroke:#EDF0FD;} + .d2-44883262 .stroke-AA5{stroke:#F7F8FE;} + .d2-44883262 .stroke-AB4{stroke:#EDF0FD;} + .d2-44883262 .stroke-AB5{stroke:#F7F8FE;} + .d2-44883262 .background-color-N1{background-color:#0A0F25;} + .d2-44883262 .background-color-N2{background-color:#676C7E;} + .d2-44883262 .background-color-N3{background-color:#9499AB;} + .d2-44883262 .background-color-N4{background-color:#CFD2DD;} + .d2-44883262 .background-color-N5{background-color:#DEE1EB;} + .d2-44883262 .background-color-N6{background-color:#EEF1F8;} + .d2-44883262 .background-color-N7{background-color:#FFFFFF;} + .d2-44883262 .background-color-B1{background-color:#0D32B2;} + .d2-44883262 .background-color-B2{background-color:#0D32B2;} + .d2-44883262 .background-color-B3{background-color:#E3E9FD;} + .d2-44883262 .background-color-B4{background-color:#E3E9FD;} + .d2-44883262 .background-color-B5{background-color:#EDF0FD;} + .d2-44883262 .background-color-B6{background-color:#F7F8FE;} + .d2-44883262 .background-color-AA2{background-color:#4A6FF3;} + .d2-44883262 .background-color-AA4{background-color:#EDF0FD;} + .d2-44883262 .background-color-AA5{background-color:#F7F8FE;} + .d2-44883262 .background-color-AB4{background-color:#EDF0FD;} + .d2-44883262 .background-color-AB5{background-color:#F7F8FE;} + .d2-44883262 .color-N1{color:#0A0F25;} + .d2-44883262 .color-N2{color:#676C7E;} + .d2-44883262 .color-N3{color:#9499AB;} + .d2-44883262 .color-N4{color:#CFD2DD;} + .d2-44883262 .color-N5{color:#DEE1EB;} + .d2-44883262 .color-N6{color:#EEF1F8;} + .d2-44883262 .color-N7{color:#FFFFFF;} + .d2-44883262 .color-B1{color:#0D32B2;} + .d2-44883262 .color-B2{color:#0D32B2;} + .d2-44883262 .color-B3{color:#E3E9FD;} + .d2-44883262 .color-B4{color:#E3E9FD;} + .d2-44883262 .color-B5{color:#EDF0FD;} + .d2-44883262 .color-B6{color:#F7F8FE;} + .d2-44883262 .color-AA2{color:#4A6FF3;} + .d2-44883262 .color-AA4{color:#EDF0FD;} + .d2-44883262 .color-AA5{color:#F7F8FE;} + .d2-44883262 .color-AB4{color:#EDF0FD;} + .d2-44883262 .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-d2-44883262);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker-d2-44883262);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-44883262);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-44883262);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-44883262);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-44883262);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-44883262);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-44883262);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>How this is renderedCLId2astd2compilerd2layoutd2exporterd2themesd2rendererd2sequencelayoutd2dagrelayoutonly if root is not sequence 'How this is rendered: {...}'tokenized ASTcompile ASTobjects and edgesrun layout enginesrun engine on shape: sequence_diagram, temporarily removerun core engine on rest add back in sequence diagramsdiagram with correct positions and dimensionsexport diagram with chosen theme and rendererget theme stylesrender to SVGresulting SVGmeasurements also take place diff --git a/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json b/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json index d15e21a150..2643eead16 100644 --- a/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json +++ b/e2etests/testdata/stable/sequence_diagram_real/elk/board.exp.json @@ -433,19 +433,19 @@ "level": 2 }, { - "id": "How this is rendered.d2compiler.measurements also take place", - "type": "page", + "id": "How this is rendered.d2layout.layout_", + "type": "rectangle", "pos": { - "x": 341, - "y": 509 + "x": 622, + "y": 732 }, - "width": 247, - "height": 66, + "width": 12, + "height": 321, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "borderRadius": 0, - "fill": "N7", + "fill": "B4", "stroke": "B1", "animated": false, "shadow": false, @@ -460,7 +460,7 @@ "fields": null, "methods": null, "columns": null, - "label": "measurements also take place", + "label": "", "fontSize": 16, "fontFamily": "DEFAULT", "language": "", @@ -468,26 +468,25 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 202, + "labelWidth": 42, "labelHeight": 21, - "labelPosition": "INSIDE_MIDDLE_CENTER", - "zIndex": 5, + "zIndex": 2, "level": 3 }, { - "id": "How this is rendered.d2layout.layout", - "type": "rectangle", + "id": "How this is rendered.d2compiler.measurements also take place", + "type": "page", "pos": { - "x": 622, - "y": 732 + "x": 341, + "y": 509 }, - "width": 12, - "height": 321, + "width": 247, + "height": 66, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "borderRadius": 0, - "fill": "B4", + "fill": "N7", "stroke": "B1", "animated": false, "shadow": false, @@ -502,7 +501,7 @@ "fields": null, "methods": null, "columns": null, - "label": "", + "label": "measurements also take place", "fontSize": 16, "fontFamily": "DEFAULT", "language": "", @@ -510,9 +509,10 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 42, + "labelWidth": 202, "labelHeight": 21, - "zIndex": 2, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 5, "level": 3 }, { @@ -758,10 +758,10 @@ "zIndex": 4 }, { - "id": "How this is rendered.(CLI -> d2layout.layout)[0]", + "id": "How this is rendered.(CLI -> d2layout.layout_)[0]", "src": "How this is rendered.CLI", "srcArrow": "none", - "dst": "How this is rendered.d2layout.layout", + "dst": "How this is rendered.d2layout.layout_", "dstArrow": "triangle", "opacity": 1, "strokeDash": 0, @@ -797,8 +797,8 @@ "zIndex": 4 }, { - "id": "How this is rendered.(d2layout.layout -> d2sequencelayout)[0]", - "src": "How this is rendered.d2layout.layout", + "id": "How this is rendered.(d2layout.layout_ -> d2sequencelayout)[0]", + "src": "How this is rendered.d2layout.layout_", "srcArrow": "none", "dst": "How this is rendered.d2sequencelayout", "dstArrow": "triangle", @@ -836,8 +836,8 @@ "zIndex": 4 }, { - "id": "How this is rendered.(d2layout.layout -> d2dagrelayout)[0]", - "src": "How this is rendered.d2layout.layout", + "id": "How this is rendered.(d2layout.layout_ -> d2dagrelayout)[0]", + "src": "How this is rendered.d2layout.layout_", "srcArrow": "none", "dst": "How this is rendered.d2dagrelayout", "dstArrow": "triangle", @@ -875,8 +875,8 @@ "zIndex": 4 }, { - "id": "How this is rendered.(d2layout.layout <- d2sequencelayout)[0]", - "src": "How this is rendered.d2layout.layout", + "id": "How this is rendered.(d2layout.layout_ <- d2sequencelayout)[0]", + "src": "How this is rendered.d2layout.layout_", "srcArrow": "triangle", "dst": "How this is rendered.d2sequencelayout", "dstArrow": "none", diff --git a/e2etests/testdata/stable/sequence_diagram_real/elk/sketch.exp.svg b/e2etests/testdata/stable/sequence_diagram_real/elk/sketch.exp.svg index a2f77236ca..a0ac6258fd 100644 --- a/e2etests/testdata/stable/sequence_diagram_real/elk/sketch.exp.svg +++ b/e2etests/testdata/stable/sequence_diagram_real/elk/sketch.exp.svg @@ -1,16 +1,16 @@ -How this is renderedCLId2astd2compilerd2layoutd2exporterd2themesd2rendererd2sequencelayoutd2dagrelayoutonly if root is not sequence 'How this is rendered: {...}'tokenized ASTcompile ASTobjects and edgesrun layout enginesrun engine on shape: sequence_diagram, temporarily removerun core engine on rest add back in sequence diagramsdiagram with correct positions and dimensionsexport diagram with chosen theme and rendererget theme stylesrender to SVGresulting SVGmeasurements also take place + .d2-3792593189 .fill-N1{fill:#0A0F25;} + .d2-3792593189 .fill-N2{fill:#676C7E;} + .d2-3792593189 .fill-N3{fill:#9499AB;} + .d2-3792593189 .fill-N4{fill:#CFD2DD;} + .d2-3792593189 .fill-N5{fill:#DEE1EB;} + .d2-3792593189 .fill-N6{fill:#EEF1F8;} + .d2-3792593189 .fill-N7{fill:#FFFFFF;} + .d2-3792593189 .fill-B1{fill:#0D32B2;} + .d2-3792593189 .fill-B2{fill:#0D32B2;} + .d2-3792593189 .fill-B3{fill:#E3E9FD;} + .d2-3792593189 .fill-B4{fill:#E3E9FD;} + .d2-3792593189 .fill-B5{fill:#EDF0FD;} + .d2-3792593189 .fill-B6{fill:#F7F8FE;} + .d2-3792593189 .fill-AA2{fill:#4A6FF3;} + .d2-3792593189 .fill-AA4{fill:#EDF0FD;} + .d2-3792593189 .fill-AA5{fill:#F7F8FE;} + .d2-3792593189 .fill-AB4{fill:#EDF0FD;} + .d2-3792593189 .fill-AB5{fill:#F7F8FE;} + .d2-3792593189 .stroke-N1{stroke:#0A0F25;} + .d2-3792593189 .stroke-N2{stroke:#676C7E;} + .d2-3792593189 .stroke-N3{stroke:#9499AB;} + .d2-3792593189 .stroke-N4{stroke:#CFD2DD;} + .d2-3792593189 .stroke-N5{stroke:#DEE1EB;} + .d2-3792593189 .stroke-N6{stroke:#EEF1F8;} + .d2-3792593189 .stroke-N7{stroke:#FFFFFF;} + .d2-3792593189 .stroke-B1{stroke:#0D32B2;} + .d2-3792593189 .stroke-B2{stroke:#0D32B2;} + .d2-3792593189 .stroke-B3{stroke:#E3E9FD;} + .d2-3792593189 .stroke-B4{stroke:#E3E9FD;} + .d2-3792593189 .stroke-B5{stroke:#EDF0FD;} + .d2-3792593189 .stroke-B6{stroke:#F7F8FE;} + .d2-3792593189 .stroke-AA2{stroke:#4A6FF3;} + .d2-3792593189 .stroke-AA4{stroke:#EDF0FD;} + .d2-3792593189 .stroke-AA5{stroke:#F7F8FE;} + .d2-3792593189 .stroke-AB4{stroke:#EDF0FD;} + .d2-3792593189 .stroke-AB5{stroke:#F7F8FE;} + .d2-3792593189 .background-color-N1{background-color:#0A0F25;} + .d2-3792593189 .background-color-N2{background-color:#676C7E;} + .d2-3792593189 .background-color-N3{background-color:#9499AB;} + .d2-3792593189 .background-color-N4{background-color:#CFD2DD;} + .d2-3792593189 .background-color-N5{background-color:#DEE1EB;} + .d2-3792593189 .background-color-N6{background-color:#EEF1F8;} + .d2-3792593189 .background-color-N7{background-color:#FFFFFF;} + .d2-3792593189 .background-color-B1{background-color:#0D32B2;} + .d2-3792593189 .background-color-B2{background-color:#0D32B2;} + .d2-3792593189 .background-color-B3{background-color:#E3E9FD;} + .d2-3792593189 .background-color-B4{background-color:#E3E9FD;} + .d2-3792593189 .background-color-B5{background-color:#EDF0FD;} + .d2-3792593189 .background-color-B6{background-color:#F7F8FE;} + .d2-3792593189 .background-color-AA2{background-color:#4A6FF3;} + .d2-3792593189 .background-color-AA4{background-color:#EDF0FD;} + .d2-3792593189 .background-color-AA5{background-color:#F7F8FE;} + .d2-3792593189 .background-color-AB4{background-color:#EDF0FD;} + .d2-3792593189 .background-color-AB5{background-color:#F7F8FE;} + .d2-3792593189 .color-N1{color:#0A0F25;} + .d2-3792593189 .color-N2{color:#676C7E;} + .d2-3792593189 .color-N3{color:#9499AB;} + .d2-3792593189 .color-N4{color:#CFD2DD;} + .d2-3792593189 .color-N5{color:#DEE1EB;} + .d2-3792593189 .color-N6{color:#EEF1F8;} + .d2-3792593189 .color-N7{color:#FFFFFF;} + .d2-3792593189 .color-B1{color:#0D32B2;} + .d2-3792593189 .color-B2{color:#0D32B2;} + .d2-3792593189 .color-B3{color:#E3E9FD;} + .d2-3792593189 .color-B4{color:#E3E9FD;} + .d2-3792593189 .color-B5{color:#EDF0FD;} + .d2-3792593189 .color-B6{color:#F7F8FE;} + .d2-3792593189 .color-AA2{color:#4A6FF3;} + .d2-3792593189 .color-AA4{color:#EDF0FD;} + .d2-3792593189 .color-AA5{color:#F7F8FE;} + .d2-3792593189 .color-AB4{color:#EDF0FD;} + .d2-3792593189 .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-d2-3792593189);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker-d2-3792593189);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-3792593189);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-3792593189);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-3792593189);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-3792593189);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-3792593189);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-3792593189);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>How this is renderedCLId2astd2compilerd2layoutd2exporterd2themesd2rendererd2sequencelayoutd2dagrelayoutonly if root is not sequence 'How this is rendered: {...}'tokenized ASTcompile ASTobjects and edgesrun layout enginesrun engine on shape: sequence_diagram, temporarily removerun core engine on rest add back in sequence diagramsdiagram with correct positions and dimensionsexport diagram with chosen theme and rendererget theme stylesrender to SVGresulting SVGmeasurements also take place