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

Standardize sequence definitions #4795

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

ibrahimWassouf
Copy link
Contributor

@ibrahimWassouf ibrahimWassouf commented Sep 1, 2023

📑 Summary

Migrates the Sequence Diagram to Typescript

Resolves #

📏 Design Decisions

Will follow the the guidelines and design choices made in #4501, #4486, and #4499 to maintain cohesiveness across the codebase as much as possible. I will attempt to refactor the code without changing functionality as much as possible. In a scenario where that may not be possible, I will maintain the old code and leave refactoring/optimizing to another issue/ticket.

📋 Tasks

Make sure you

@netlify
Copy link

netlify bot commented Sep 1, 2023

Deploy Preview for mermaid-js failed.

Name Link
🔨 Latest commit d588c23
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/652ae91656d1b400084b27e9

@ibrahimWassouf ibrahimWassouf marked this pull request as draft September 1, 2023 00:08
@@ -1087,7 +1087,7 @@ export interface SequenceDiagramConfig extends BaseDiagramConfig {
*/
diagramMarginX?: number;
/**
* Margin to the over and under the sequence diagram
* Margin to the top and bottom of the sequence diagram
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a generated file, please modify the original one: packages/mermaid/src/schemas/config.schema.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oop rookie mistake

This allows for a conceptual and type splitting between texts which
appear in many places in the diagram (messages, notes,
actor descriptions, etc) and messages between participants.

I believe it makes more sense to call parseText rather than
parseMessage when used in context of working with other components
in the diagram which will help with developer experience.

A notable change when implementing this is changing all wrap
fields in relevant interfaces to optional. This is done so that
if left undefined, we will resolt to an autoWrap function which
references the diagram config. This will allow for an implementation
of a diagram wide default of either wrap or nowrap that's left to the
user to decide, instead of a hard-coded default.
// JSON.parse the text
try {
let sanitizedText = sanitizeText(text.text, commonGetConfig());
sanitizedText = sanitizedText.replace(/&/g, '&');

Check failure

Code scanning / CodeQL

Double escaping or unescaping High

This replacement may produce '&' characters that are double-unescaped
here
.
const links: Record<string, string> = {};
let sanitizedText = sanitizeText(text.text, commonGetConfig());
const sep = sanitizedText.indexOf('@');
sanitizedText = sanitizedText.replace(/&amp;/g, '&');

Check failure

Code scanning / CodeQL

Double escaping or unescaping High

This replacement may produce '&' characters that are double-unescaped
here
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants