#5237 Updated configuration schema for elk layout

This commit is contained in:
Knut Sveidqvist
2024-07-19 11:53:15 +02:00
parent 5b47950f9f
commit d96dcd2529
4 changed files with 36 additions and 27 deletions

View File

@@ -465,8 +465,8 @@ export const render = async (data4Layout: LayoutData, svg, element, algorithm) =
layoutOptions: {
'elk.hierarchyHandling': 'INCLUDE_CHILDREN',
'elk.algorithm': algorithm,
'nodePlacement.strategy': data4Layout.config['elk.nodePlacement.strategy'],
'elk.layered.mergeEdges': data4Layout.config['elk.mergeEdges'],
'nodePlacement.strategy': data4Layout.config.elk.nodePlacementStrategy,
'elk.layered.mergeEdges': data4Layout.config.elk.mergeEdges,
'elk.direction': 'DOWN',
'spacing.baseValue': 30,
// 'spacing.nodeNode': 40,

View File

@@ -88,16 +88,18 @@ export interface MermaidConfig {
*
*/
maxEdges?: number;
/**
* Elk specific option that allows edges to share path where it convenient. It can make for pretty diagrams but can also make it harder to read the diagram.
*
*/
'elk.mergeEdges'?: boolean;
/**
* Elk specific option affecting how nodes are placed.
*
*/
'elk.nodePlacement.strategy'?: 'SIMPLE' | 'NETWORK_SIMPLEX' | 'LINEAR_SEGMENTS' | 'BRANDES_KOEPF';
elk?: {
/**
* Elk specific option that allows edges to share path where it convenient. It can make for pretty diagrams but can also make it harder to read the diagram.
*
*/
mergeEdges?: boolean;
/**
* Elk specific option affecting how nodes are placed.
*
*/
nodePlacementStrategy?: 'SIMPLE' | 'NETWORK_SIMPLEX' | 'LINEAR_SEGMENTS' | 'BRANDES_KOEPF';
};
darkMode?: boolean;
htmlLabels?: boolean;
/**

View File

@@ -20,6 +20,10 @@ const config: RequiredDeep<MermaidConfig> = {
// Set, even though they're `undefined` so that `configKeys` finds these keys
// TODO: Should we replace these with `null` so that they can go in the JSON Schema?
deterministicIDSeed: undefined,
elk: {
mergeEdges: false,
nodePlacementStrategy: 'SIMPLE',
},
themeCSS: undefined,
// add non-JSON default config values

View File

@@ -100,21 +100,24 @@ properties:
type: integer
default: 500
minimum: 0
elk.mergeEdges:
description: |
Elk specific option that allows edges to share path where it convenient. It can make for pretty diagrams but can also make it harder to read the diagram.
type: boolean
default: false
elk.nodePlacement.strategy:
description: |
Elk specific option affecting how nodes are placed.
type: string
enum:
- SIMPLE
- NETWORK_SIMPLEX
- LINEAR_SEGMENTS
- BRANDES_KOEPF
default: SIMPLE
elk:
type: object
properties:
mergeEdges:
description: |
Elk specific option that allows edges to share path where it convenient. It can make for pretty diagrams but can also make it harder to read the diagram.
type: boolean
default: false
nodePlacementStrategy:
description: |
Elk specific option affecting how nodes are placed.
type: string
enum:
- SIMPLE
- NETWORK_SIMPLEX
- LINEAR_SEGMENTS
- BRANDES_KOEPF
default: SIMPLE
darkMode:
type: boolean
default: false