Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 5747 rendering util types #5798

Merged
merged 10 commits into from
Sep 8, 2024
8 changes: 4 additions & 4 deletions docs/config/setup/interfaces/mermaid.LayoutData.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

### config

• **config**: `MermaidConfig`
• **config**: [`MermaidConfig`](mermaid.MermaidConfig.md)

#### 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)

---

Expand All @@ -30,7 +30,7 @@

#### 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)

---

Expand All @@ -40,4 +40,4 @@

#### 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)
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default tseslint.config(
'**/generated/',
'**/coverage/',
'packages/mermaid/src/config.type.ts',
'packages/mermaid/src/docs/.vitepress/components.d.ts',
],
},
{
Expand Down
12 changes: 6 additions & 6 deletions packages/mermaid-layout-elk/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
}: InternalHelpers,
{ algorithm }: RenderOptions
) => {
const nodeDb: Record<string, any> = {};

Check warning on line 24 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type
const clusterDb: Record<string, any> = {};

Check warning on line 25 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type

const addVertex = async (nodeEl: any, graph: { children: any[] }, nodeArr: any, node: any) => {

Check warning on line 27 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type

Check warning on line 27 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type

Check warning on line 27 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type

Check warning on line 27 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type
const labelData: any = { width: 0, height: 0 };

Check warning on line 28 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type

let boundingBox;
const child = {
Expand Down Expand Up @@ -67,8 +67,8 @@
};

const addVertices = async function (
nodeEl: any,

Check warning on line 70 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type
nodeArr: any[],

Check warning on line 71 in packages/mermaid-layout-elk/src/render.ts

View workflow job for this annotation

GitHub Actions / autofix

Unexpected any. Specify a different type
graph: {
id: string;
layoutOptions: {
Expand Down Expand Up @@ -224,7 +224,7 @@
* Add edges to graph based on parsed graph definition
*/
const addEdges = async function (
dataForLayout: { edges: any; direction: string },
dataForLayout: { edges: any; direction?: string },
graph: {
id?: string;
layoutOptions?: {
Expand Down Expand Up @@ -749,12 +749,12 @@
layoutOptions: {
'elk.hierarchyHandling': 'INCLUDE_CHILDREN',
'elk.algorithm': algorithm,
'nodePlacement.strategy': data4Layout.config.elk.nodePlacementStrategy,
'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': 35,
'elk.layered.unnecessaryBendpoints': true,
'elk.layered.cycleBreaking.strategy': data4Layout.config.elk.cycleBreakingStrategy,
'elk.layered.cycleBreaking.strategy': data4Layout.config.elk?.cycleBreakingStrategy,
// 'spacing.nodeNode': 20,
// 'spacing.nodeNodeBetweenLayers': 25,
// 'spacing.edgeNode': 20,
Expand Down Expand Up @@ -837,8 +837,8 @@
...node.layoutOptions,
'elk.algorithm': algorithm,
'elk.direction': dir2ElkDirection(node.dir),
'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.hierarchyHandling': 'SEPARATE_CHILDREN',
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export type MarkdownWordType = 'normal' | 'strong' | 'em';
import type { MermaidConfig } from '../../dist/config.type';
import type { MermaidConfig } from '../config.type.js';
export interface MarkdownWord {
content: string;
type: MarkdownWordType;
Expand All @@ -9,7 +9,7 @@ export type MarkdownLine = MarkdownWord[];
export type CheckFitFunction = (text: MarkdownLine) => boolean;

// Common properties for any node in the system
interface Node {
export interface Node {
id: string;
label?: string;
description?: string[];
Expand Down Expand Up @@ -38,7 +38,6 @@ interface Node {
tooltip?: string;
padding?: number; //REMOVE?, use from LayoutData.config - Keep, this could be shape specific
shape?: string;
tooltip?: string;
isGroup: boolean;
width?: number;
height?: number;
Expand Down Expand Up @@ -68,7 +67,7 @@ interface Node {
}

// Common properties for any edge in the system
interface Edge {
export interface Edge {
id: string;
label?: string;
classes?: string;
Expand Down Expand Up @@ -98,7 +97,7 @@ interface Edge {
look?: string;
}

interface RectOptions {
export interface RectOptions {
rx: number;
ry: number;
labelPaddingX: number;
Expand All @@ -107,7 +106,7 @@ interface RectOptions {
}

// 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
}

Expand Down
Loading