Merge pull request #5798 from bollwyvl/gh-5747-rendering-util-types

fix 5747 rendering util types
This commit is contained in:
Sidharth Vinod
2024-09-08 14:36:38 +00:00
committed by GitHub
4 changed files with 16 additions and 16 deletions

View File

@@ -16,11 +16,11 @@
### config ### config
**config**: `MermaidConfig` **config**: [`MermaidConfig`](mermaid.MermaidConfig.md)
#### Defined in #### Defined in
[packages/mermaid/src/rendering-util/types.d.ts:118](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.d.ts#L118) [packages/mermaid/src/rendering-util/types.ts:117](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L117)
--- ---
@@ -30,7 +30,7 @@
#### Defined in #### Defined in
[packages/mermaid/src/rendering-util/types.d.ts:117](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.d.ts#L117) [packages/mermaid/src/rendering-util/types.ts:116](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L116)
--- ---
@@ -40,4 +40,4 @@
#### Defined in #### Defined in
[packages/mermaid/src/rendering-util/types.d.ts:116](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.d.ts#L116) [packages/mermaid/src/rendering-util/types.ts:115](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L115)

View File

@@ -23,6 +23,7 @@ export default tseslint.config(
'**/generated/', '**/generated/',
'**/coverage/', '**/coverage/',
'packages/mermaid/src/config.type.ts', 'packages/mermaid/src/config.type.ts',
'packages/mermaid/src/docs/.vitepress/components.d.ts',
], ],
}, },
{ {

View File

@@ -224,7 +224,7 @@ export const render = async (
* Add edges to graph based on parsed graph definition * Add edges to graph based on parsed graph definition
*/ */
const addEdges = async function ( const addEdges = async function (
dataForLayout: { edges: any; direction: string }, dataForLayout: { edges: any; direction?: string },
graph: { graph: {
id?: string; id?: string;
layoutOptions?: { layoutOptions?: {
@@ -749,12 +749,12 @@ export const render = async (
layoutOptions: { layoutOptions: {
'elk.hierarchyHandling': 'INCLUDE_CHILDREN', 'elk.hierarchyHandling': 'INCLUDE_CHILDREN',
'elk.algorithm': algorithm, 'elk.algorithm': algorithm,
'nodePlacement.strategy': data4Layout.config.elk.nodePlacementStrategy, 'nodePlacement.strategy': data4Layout.config.elk?.nodePlacementStrategy,
'elk.layered.mergeEdges': data4Layout.config.elk.mergeEdges, 'elk.layered.mergeEdges': data4Layout.config.elk?.mergeEdges,
'elk.direction': 'DOWN', 'elk.direction': 'DOWN',
'spacing.baseValue': 35, 'spacing.baseValue': 35,
'elk.layered.unnecessaryBendpoints': true, 'elk.layered.unnecessaryBendpoints': true,
'elk.layered.cycleBreaking.strategy': data4Layout.config.elk.cycleBreakingStrategy, 'elk.layered.cycleBreaking.strategy': data4Layout.config.elk?.cycleBreakingStrategy,
// 'spacing.nodeNode': 20, // 'spacing.nodeNode': 20,
// 'spacing.nodeNodeBetweenLayers': 25, // 'spacing.nodeNodeBetweenLayers': 25,
// 'spacing.edgeNode': 20, // 'spacing.edgeNode': 20,
@@ -837,8 +837,8 @@ export const render = async (
...node.layoutOptions, ...node.layoutOptions,
'elk.algorithm': algorithm, 'elk.algorithm': algorithm,
'elk.direction': dir2ElkDirection(node.dir), 'elk.direction': dir2ElkDirection(node.dir),
'nodePlacement.strategy': data4Layout.config['elk.nodePlacement.strategy'], 'nodePlacement.strategy': data4Layout.config.elk?.nodePlacementStrategy,
'elk.layered.mergeEdges': data4Layout.config['elk.mergeEdges'], 'elk.layered.mergeEdges': data4Layout.config.elk?.mergeEdges,
'elk.hierarchyHandling': 'SEPARATE_CHILDREN', 'elk.hierarchyHandling': 'SEPARATE_CHILDREN',
}; };
} }

View File

@@ -1,5 +1,5 @@
export type MarkdownWordType = 'normal' | 'strong' | 'em'; export type MarkdownWordType = 'normal' | 'strong' | 'em';
import type { MermaidConfig } from '../../dist/config.type'; import type { MermaidConfig } from '../config.type.js';
export interface MarkdownWord { export interface MarkdownWord {
content: string; content: string;
type: MarkdownWordType; type: MarkdownWordType;
@@ -9,7 +9,7 @@ export type MarkdownLine = MarkdownWord[];
export type CheckFitFunction = (text: MarkdownLine) => boolean; export type CheckFitFunction = (text: MarkdownLine) => boolean;
// Common properties for any node in the system // Common properties for any node in the system
interface Node { export interface Node {
id: string; id: string;
label?: string; label?: string;
description?: string[]; description?: string[];
@@ -38,7 +38,6 @@ interface Node {
tooltip?: string; tooltip?: string;
padding?: number; //REMOVE?, use from LayoutData.config - Keep, this could be shape specific padding?: number; //REMOVE?, use from LayoutData.config - Keep, this could be shape specific
shape?: string; shape?: string;
tooltip?: string;
isGroup: boolean; isGroup: boolean;
width?: number; width?: number;
height?: number; height?: number;
@@ -68,7 +67,7 @@ interface Node {
} }
// Common properties for any edge in the system // Common properties for any edge in the system
interface Edge { export interface Edge {
id: string; id: string;
label?: string; label?: string;
classes?: string; classes?: string;
@@ -98,7 +97,7 @@ interface Edge {
look?: string; look?: string;
} }
interface RectOptions { export interface RectOptions {
rx: number; rx: number;
ry: number; ry: number;
labelPaddingX: number; labelPaddingX: number;
@@ -107,7 +106,7 @@ interface RectOptions {
} }
// Extending the Node interface for specific types if needed // Extending the Node interface for specific types if needed
interface ClassDiagramNode extends Node { export interface ClassDiagramNode extends Node {
memberData: any; // Specific property for class diagram nodes memberData: any; // Specific property for class diagram nodes
} }