Skip to content

Export diagram from model to mermaid code#174

Open
cheryl7114 wants to merge 10 commits into
serverlessworkflow:mainfrom
cheryl7114:mermaid-export-150
Open

Export diagram from model to mermaid code#174
cheryl7114 wants to merge 10 commits into
serverlessworkflow:mainfrom
cheryl7114:mermaid-export-150

Conversation

@cheryl7114

@cheryl7114 cheryl7114 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Closes #150

Changes Made
Added two buttons to export diagram model (JSON/YAML) to Mermaid:

  • Copy Mermaid Code - copy mermaid string to clipboard
  • Download as Mermaid File - download workflow as a .mmd file

Cheryl Kong added 3 commits June 8, 2026 15:38
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
@cheryl7114 cheryl7114 requested review from Copilot, fantonangeli, handreyrc, kumaradityaraj and lornakelly and removed request for Copilot and lornakelly June 9, 2026 08:40
@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for swf-editor ready!

Name Link
🔨 Latest commit b2c417f
🔍 Latest deploy log https://app.netlify.com/projects/swf-editor/deploys/6a30042bd8fe420008661e14
😎 Deploy Preview https://deploy-preview-174--swf-editor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cheryl7114 cheryl7114 requested a review from Copilot June 9, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Mermaid export capabilities to the diagram editor, exposing “copy” and “download” actions from the SidePanel and providing a core utility to generate Mermaid code.

Changes:

  • Add exportToMermaid + clipboard/file download helpers in src/core
  • Expose “Copy Mermaid Code” and “Download as Mermaid File” buttons in SidePanel
  • Add i18n strings and tests for both core export and SidePanel rendering states

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/serverless-workflow-diagram-editor/tests/side-panel/SidePanel.test.tsx Adds UI-state tests for Mermaid export buttons visibility.
packages/serverless-workflow-diagram-editor/tests/core/mermaidExport.test.ts Adds a unit test for Mermaid conversion output shape.
packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Adds export buttons + handlers wired to new Mermaid export helpers.
packages/serverless-workflow-diagram-editor/src/i18n/locales/en.ts Adds English strings for Mermaid export UI.
packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts Introduces Mermaid export, clipboard copy, and download helpers.
packages/serverless-workflow-diagram-editor/src/core/index.ts Re-exports the new Mermaid export module.
.changeset/mermaid-export.md Declares a minor release for the new functionality.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
@cheryl7114 cheryl7114 requested a review from Copilot June 9, 2026 11:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Comment thread packages/serverless-workflow-diagram-editor/tests/side-panel/SidePanel.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread .changeset/mermaid-export.md Outdated
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
@cheryl7114 cheryl7114 requested a review from Copilot June 9, 2026 11:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Comment thread packages/serverless-workflow-diagram-editor/tests/side-panel/SidePanel.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts Outdated
Comment thread .changeset/mermaid-export.md Outdated
@cheryl7114 cheryl7114 requested a review from Copilot June 9, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/side-panel/SidePanel.test.tsx Outdated
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
@cheryl7114 cheryl7114 requested a review from Copilot June 9, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/side-panel/SidePanel.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/side-panel/SidePanel.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts Outdated
@cheryl7114 cheryl7114 requested a review from lornakelly June 9, 2026 11:59
@handreyrc

Copy link
Copy Markdown
Contributor

@cheryl7114,
I noticed that in the build process we have many warnings related to storybook such as the one below.
image

Could you take a look?

@kumaradityaraj kumaradityaraj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment thread packages/serverless-workflow-diagram-editor/src/i18n/locales/en.ts Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/core/mermaidExport.ts Outdated

@fantonangeli fantonangeli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@cheryl7114 I only added one comment in addition to other's comments.
Can you please also add the issue link in the description?

Comment thread packages/serverless-workflow-diagram-editor/src/side-panel/SidePanel.tsx Outdated
Cheryl Kong added 2 commits June 15, 2026 12:26
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Copilot AI review requested due to automatic review settings June 15, 2026 11:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.

Comment thread packages/serverless-workflow-diagram-editor/tests/lib/download.test.ts Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/side-panel/SidePanel.test.tsx Outdated
Comment on lines +28 to +29
const [isCopied, setIsCopied] = React.useState(false);
const copyTimeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
Comment on lines +50 to +53
copyTimeoutRef.current = setTimeout(() => {
setIsCopied(false);
copyTimeoutRef.current = null;
}, 2000);
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
@cheryl7114 cheryl7114 requested a review from Copilot June 15, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.

Comment thread packages/serverless-workflow-diagram-editor/src/i18n/locales/en.ts Outdated
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
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.

feat: Export diagram from model to mermaid code

6 participants