From 7ded689cad49331167e29fd88b38f38d3736d576 Mon Sep 17 00:00:00 2001 From: David Luzar <5153846+dwelle@users.noreply.github.com> Date: Wed, 4 Nov 2026 20:53:43 +0100 Subject: [PATCH] feat(editor): bump mermaid-to-excalidraw to 3.6.0 (elbow flowcharts, Gantt, quadrant charts, timelines) (#12535) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(editor): bump mermaid-to-excalidraw to 3.3.0 (Pele 1.13, stepped edges) - mermaid-to-excalidraw 3.1.0 -> 3.3.0 (Pele 1.8.0 -> 1.13.0): flowchart edges and state transitions are elbow arrows when the definition asks for a stepped curve (`curve: "step"`, `linkStyle … interpolate step`); class namespaces are drawn as boxes like subgraphs (3.2.0) - Pele 1.13 reports syntax errors on the source line (counting front matter, directives, comments and blank lines) and errors past the end on the last line, so the TTD dialog no longer converts them: the conversion would shift them twice Claude Opus 5.5 (low) * docs: link #12535 in the changelog Claude Opus 5.5 (low) * feat(editor): draw Mermaid flowchart and state edges as elbow arrows Convert Mermaid diagrams (TTD dialog and paste) with `flowchart.curve: "step"` (`MERMAID_TO_EXCALIDRAW_CONFIG`), which m2e 3.3 turns into elbow arrows for flowchart edges and state transitions. A curve the definition sets itself (front matter, `%%{init}%%`, `linkStyle … interpolate`) still wins; class and ER diagrams are unaffected. Claude Opus 5.5 (low) * feat(editor): elbow arrows for Mermaid flowcharts only (mermaid-to-excalidraw 3.4.0) mermaid-to-excalidraw 3.4.0 replaces `flowchart.curve` with `elbow`, per diagram type. Use `elbow: { flowchart: true }`: state diagrams' elbow transitions need more work in m2e, so they stay as before. Claude Opus 5.5 (low) * feat(editor): bump mermaid-to-excalidraw to 3.5.0 (Gantt, quadrant charts, timelines) mermaid-to-excalidraw 3.5.0 converts Gantt charts, quadrant charts and timelines to Excalidraw elements instead of an image. The Mermaid dialog's description lists them (and State diagrams, missing before), its syntax links built by one helper. Claude Opus 5.5 (low) * fix(editor): detect pasted Mermaid after comments and front matter Pasted text was only taken for Mermaid when its diagram type came first, or after a single one-line `%%{...}%%` directive. Skip everything Mermaid allows before it: blank lines, `%%` comments, directives (also over several lines) and front matter. A directive doesn't run past the next `%%{`, so text with many unclosed directives is checked in linear time (searching each to the end of the text would be quadratic: ReDoS). Claude Opus 5.5 (low) * feat(editor): bump mermaid-to-excalidraw to 3.6.0 (diagram types loaded on first use) mermaid-to-excalidraw 3.6.0 loads each diagram type's parser and converter on first use: its main chunk is 20.3 KiB (brotli) instead of 35.8, plus 1.5–5.1 KiB for the type converted (a first flowchart: 28.5 KiB). Claude Opus 5.5 (low) --- packages/excalidraw/CHANGELOG.md | 2 +- .../excalidraw/components/App.clipboard.ts | 10 +- .../TTDDialog/MermaidToExcalidraw.tsx | 56 ++++------- .../components/TTDDialog/TTDDialog.tsx | 6 +- .../components/TTDDialog/TTDDialogOutput.tsx | 2 +- .../components/TTDDialog/TextToDiagram.tsx | 6 +- .../TTDDialog/utils/mermaidError.test.ts | 44 +-------- .../TTDDialog/utils/mermaidError.ts | 97 ++----------------- packages/excalidraw/locales/en.json | 2 +- packages/excalidraw/mermaid.test.ts | 36 +++++++ packages/excalidraw/mermaid.ts | 82 +++++++++------- packages/excalidraw/package.json | 2 +- .../tests/MermaidToExcalidraw.test.tsx | 7 ++ .../MermaidToExcalidraw.test.tsx.snap | 2 +- packages/excalidraw/tests/clipboard.test.tsx | 5 + yarn.lock | 18 ++-- 16 files changed, 155 insertions(+), 222 deletions(-) diff --git a/packages/excalidraw/CHANGELOG.md b/packages/excalidraw/CHANGELOG.md index 05aa2f97d8..fb4068d92d 100644 --- a/packages/excalidraw/CHANGELOG.md +++ b/packages/excalidraw/CHANGELOG.md @@ -209,7 +209,7 @@ The toolbar UI was rewritten from hidden radio/checkbox inputs to real `
Ctrl
Enter
"`; +exports[`Test > should open mermaid popup when active tool is mermaid 1`] = `""`; exports[`Test > should show error in preview when mermaid library throws error 1`] = ` "flowchart TD diff --git a/packages/excalidraw/tests/clipboard.test.tsx b/packages/excalidraw/tests/clipboard.test.tsx index bd795e6cb5..9a5678388f 100644 --- a/packages/excalidraw/tests/clipboard.test.tsx +++ b/packages/excalidraw/tests/clipboard.test.tsx @@ -1,6 +1,8 @@ import React from "react"; import { vi } from "vitest"; +import * as MermaidToExcalidrawLib from "@excalidraw/mermaid-to-excalidraw"; + import { getLineHeightInPx } from "@excalidraw/element"; import { @@ -801,6 +803,9 @@ describe("clipboard - pasting mermaid definition", () => { ]), ); }); + expect( + MermaidToExcalidrawLib.parseMermaidToExcalidraw, + ).toHaveBeenCalledWith(text, { elbow: { flowchart: true } }); }); it("should support directives", async () => { diff --git a/yarn.lock b/yarn.lock index 3b37abbd90..4716426837 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1481,14 +1481,14 @@ resolved "https://registry.yarnpkg.com/@excalidraw/markdown-to-text/-/markdown-to-text-0.1.2.tgz#1703705e7da608cf478f17bfe96fb295f55a23eb" integrity sha512-1nDXBNAojfi3oSFwJswKREkFm5wrSjqay81QlyRv2pkITG/XYB5v+oChENVBQLcxQwX4IUATWvXM5BcaNhPiIg== -"@excalidraw/mermaid-to-excalidraw@3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@excalidraw/mermaid-to-excalidraw/-/mermaid-to-excalidraw-3.1.0.tgz#352c9eaf7a56fa0e55015df70cc96c97fe7e8d20" - integrity sha512-B3H6aXm4f4O4+f7k1z/Eu1xNj3ZurnCX9RQNzjx00RCfnanLY4z8Pj/1r76FP8yZ1Ue84z50gJoRFCUIZy5xDg== +"@excalidraw/mermaid-to-excalidraw@3.6.0": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@excalidraw/mermaid-to-excalidraw/-/mermaid-to-excalidraw-3.6.0.tgz#fbf422ef01932d953f82a443b06f72ea51646fa0" + integrity sha512-h21Mr9FxmfLDds78iw0iTRDzes+/CDRFJ5kndFAmH+EVQLG6PHoMyn4Lms1dHiYgDTal+MkBJnqKJC9Xj080uA== dependencies: "@excalidraw/markdown-to-text" "0.1.2" nanoid "4.0.2" - pele "1.8.0" + pele "1.13.0" "@excalidraw/prettier-config@1.0.2": version "1.0.2" @@ -7625,10 +7625,10 @@ pathval@^2.0.0: resolved "https://registry.yarnpkg.com/pathval/-/pathval-2.0.0.tgz#7e2550b422601d4f6b8e26f1301bc8f15a741a25" integrity sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA== -pele@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/pele/-/pele-1.8.0.tgz#85853ea6207dd619a2cc24592483a5360c1474b9" - integrity sha512-AYmHttE70cwNJVXdfPMCANGivFlmc3bGGpMG0GqH5S5vE3RgtEuLlkqbhRfe94Csv/ZEd1TUbv2dMUHpw4p1Bg== +pele@1.13.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/pele/-/pele-1.13.0.tgz#5a14f20b809a5ae61b04cd8825a4940550675d11" + integrity sha512-Ie8UKY9x00MsuR3jO6AzUwzK2Z6MIV3Tf4EDdITiuk8Uaz8K7g0R082WqsqNaSU8DdgkrRvZThzhit83mi/uiw== pend@~1.2.0: version "1.2.0"