From 46a4af6fdec2860395bb31d69f22fb4353b5f872 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Tue, 23 Apr 2024 14:14:08 +0530 Subject: [PATCH] move types to types file --- .../mermaid/src/diagrams/sequence/svgDraw.ts | 26 ++----------------- .../mermaid/src/diagrams/sequence/types.ts | 23 ++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/packages/mermaid/src/diagrams/sequence/svgDraw.ts b/packages/mermaid/src/diagrams/sequence/svgDraw.ts index 2d942a1491..6a970bf325 100644 --- a/packages/mermaid/src/diagrams/sequence/svgDraw.ts +++ b/packages/mermaid/src/diagrams/sequence/svgDraw.ts @@ -3,7 +3,7 @@ import * as svgDrawCommon from '../common/svgDrawCommon.js'; import { ZERO_WIDTH_SPACE, parseFontSize } from '../../utils.js'; import { sanitizeUrl } from '@braintree/sanitize-url'; import * as configApi from '../../config.js'; -import type { Actor } from './types.js'; +import type { Actor, LoopModel, TextAttrs } from './types.js'; import type { Bound, D3RectElement, @@ -26,15 +26,6 @@ export const drawRect = (elem: SVG, rectData: RectData): D3RectElement => { return svgDrawCommon.drawRect(elem, rectData); }; -interface TextAttrs { - class?: string; - fill?: string; - stroke?: string; - 'font-size'?: string; - 'font-family'?: string; - 'font-weight'?: string; -} - export const drawPopup = ( elem: SVG, actor: Actor, @@ -403,7 +394,7 @@ const drawActorTypeParticipant = async function ( } } - await _drawTextCandidateFunc(conf, hasKatex(actor.description))( + _drawTextCandidateFunc(conf, hasKatex(actor.description))( actor.description, g, rect.x, @@ -577,19 +568,6 @@ export const drawActivation = function ( drawRect(g, rect); }; -interface LoopModel { - startx: number; - starty: number; - stopx: number; - stopy: number; - title: string; - wrap: boolean; - width: number; - height: number; - fill: string; - sections: Array<{ x: number; y: number; height: number }>; - sectionTitles?: Array<{ message: string }>; -} /** * Draws a loop in the diagram * diff --git a/packages/mermaid/src/diagrams/sequence/types.ts b/packages/mermaid/src/diagrams/sequence/types.ts index 845f9aeb2b..499daf0f2e 100644 --- a/packages/mermaid/src/diagrams/sequence/types.ts +++ b/packages/mermaid/src/diagrams/sequence/types.ts @@ -100,3 +100,26 @@ export interface Note { message: string; wrap: boolean; } + +export interface TextAttrs { + class?: string; + fill?: string; + stroke?: string; + 'font-size'?: string; + 'font-family'?: string; + 'font-weight'?: string; +} + +export interface LoopModel { + startx: number; + starty: number; + stopx: number; + stopy: number; + title: string; + wrap: boolean; + width: number; + height: number; + fill: string; + sections: Array<{ x: number; y: number; height: number }>; + sectionTitles?: Array<{ message: string }>; +}