diff --git a/.changeset/clean-wolves-turn.md b/.changeset/clean-wolves-turn.md deleted file mode 100644 index 7a44c1c16..000000000 --- a/.changeset/clean-wolves-turn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: Render newlines as spaces in class diagrams diff --git a/.changeset/crazy-loops-matter.md b/.changeset/crazy-loops-matter.md deleted file mode 100644 index e6377a9e5..000000000 --- a/.changeset/crazy-loops-matter.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': patch ---- - -fix: Handle arrows correctly when auto number is enabled diff --git a/.changeset/deep-pumas-run.md b/.changeset/deep-pumas-run.md new file mode 100644 index 000000000..eca83fd6e --- /dev/null +++ b/.changeset/deep-pumas-run.md @@ -0,0 +1,5 @@ +--- +'mermaid': patch +--- + +chore: Fix mindmap rendering in docs and apply tidytree layout diff --git a/.changeset/deep-times-make.md b/.changeset/deep-times-make.md deleted file mode 100644 index 3f126736f..000000000 --- a/.changeset/deep-times-make.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': minor ---- - -Add IDs in architecture diagrams diff --git a/.changeset/hungry-baths-glow.md b/.changeset/hungry-baths-glow.md deleted file mode 100644 index b3084bcab..000000000 --- a/.changeset/hungry-baths-glow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'mermaid': minor ---- - -feat: Added support for new participant types (`actor`, `boundary`, `control`, `entity`, `database`, `collections`, `queue`) in `sequenceDiagram`. diff --git a/.changeset/hungry-guests-drive.md b/.changeset/hungry-guests-drive.md deleted file mode 100644 index 1b0e0a07b..000000000 --- a/.changeset/hungry-guests-drive.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'mermaid': minor -'@mermaid-js/layout-tidy-tree': minor -'@mermaid-js/layout-elk': minor ---- - -feat: Update mindmap rendering to support multiple layouts, improved edge intersections, and new shapes diff --git a/.changeset/loud-results-melt.md b/.changeset/loud-results-melt.md new file mode 100644 index 000000000..7005750c6 --- /dev/null +++ b/.changeset/loud-results-melt.md @@ -0,0 +1,5 @@ +--- +'mermaid': minor +--- + +feat: Add half-arrowheads (solid & stick) and central connection support diff --git a/.changeset/slow-lemons-know.md b/.changeset/slow-lemons-know.md new file mode 100644 index 000000000..49eb48543 --- /dev/null +++ b/.changeset/slow-lemons-know.md @@ -0,0 +1,5 @@ +--- +'@mermaid': patch +--- + +fix: Mindmap breaking in ELK layout diff --git a/.changeset/sweet-games-build.md b/.changeset/sweet-games-build.md new file mode 100644 index 000000000..a71e3de25 --- /dev/null +++ b/.changeset/sweet-games-build.md @@ -0,0 +1,5 @@ +--- +'mermaid': patch +--- + +fix(er-diagram): prevent syntax error when using 'u', numbers, and decimals in node names diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a6400a86a..64de2eb66 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -26,8 +26,8 @@ jobs: strategy: fail-fast: false matrix: - language: ['javascript'] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + language: ['javascript', 'actions'] + # CodeQL supports [ 'actions', 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: @@ -36,7 +36,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/init@5378192d256ef1302a6980fffe5ca04426d43091 # v3.28.21 with: config-file: ./.github/codeql/codeql-config.yml languages: ${{ matrix.language }} @@ -48,7 +48,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/autobuild@5378192d256ef1302a6980fffe5ca04426d43091 # v3.28.21 # ℹ️ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -62,4 +62,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/analyze@5378192d256ef1302a6980fffe5ca04426d43091 # v3.28.21 diff --git a/.github/workflows/e2e-applitools.yml b/.github/workflows/e2e-applitools.yml index 6aaa91eb8..853818425 100644 --- a/.github/workflows/e2e-applitools.yml +++ b/.github/workflows/e2e-applitools.yml @@ -53,7 +53,7 @@ jobs: args: -X POST "$APPLITOOLS_SERVER_URL/api/externals/github/push?apiKey=$APPLITOOLS_API_KEY&CommitSha=$GITHUB_SHA&BranchName=${APPLITOOLS_BRANCH}$&ParentBranchName=$APPLITOOLS_PARENT_BRANCH" - name: Cypress run - uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 + uses: cypress-io/github-action@108b8684ae52e735ff7891524cbffbcd4be5b19f # v6.7.16 id: cypress with: start: pnpm run dev diff --git a/.github/workflows/e2e-timings.yml b/.github/workflows/e2e-timings.yml index 635253bc8..e59903df6 100644 --- a/.github/workflows/e2e-timings.yml +++ b/.github/workflows/e2e-timings.yml @@ -27,12 +27,12 @@ jobs: with: node-version-file: '.node-version' - name: Install dependencies - uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 + uses: cypress-io/github-action@108b8684ae52e735ff7891524cbffbcd4be5b19f # v6.7.16 with: runTests: false - name: Cypress run - uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 + uses: cypress-io/github-action@108b8684ae52e735ff7891524cbffbcd4be5b19f # v6.7.16 id: cypress with: install: false diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 56883b987..8fbf6d6f6 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -45,7 +45,7 @@ jobs: node-version-file: '.node-version' - name: Cache snapshots id: cache-snapshot - uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1 + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 with: path: ./cypress/snapshots key: ${{ runner.os }}-snapshots-${{ env.targetHash }} @@ -59,7 +59,7 @@ jobs: - name: Install dependencies if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }} - uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 + uses: cypress-io/github-action@108b8684ae52e735ff7891524cbffbcd4be5b19f # v6.7.16 with: # just perform install runTests: false @@ -95,13 +95,13 @@ jobs: # These cached snapshots are downloaded, providing the reference snapshots. - name: Cache snapshots id: cache-snapshot - uses: actions/cache/restore@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1 + uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 with: path: ./cypress/snapshots key: ${{ runner.os }}-snapshots-${{ env.targetHash }} - name: Install dependencies - uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 + uses: cypress-io/github-action@108b8684ae52e735ff7891524cbffbcd4be5b19f # v6.7.16 with: runTests: false @@ -117,7 +117,7 @@ jobs: # Install NPM dependencies, cache them correctly # and run all Cypress tests - name: Cypress run - uses: cypress-io/github-action@18a6541367f4580a515371905f499a27a44e8dbe # v6.7.12 + uses: cypress-io/github-action@108b8684ae52e735ff7891524cbffbcd4be5b19f # v6.7.16 id: cypress with: install: false diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml index f855ed23b..ce43c2ed7 100644 --- a/.github/workflows/link-checker.yml +++ b/.github/workflows/link-checker.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Restore lychee cache - uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1 + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 with: path: .lycheecache key: cache-lychee-${{ github.sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 649c40034..7dbf85d94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: - name: Create Release Pull Request or Publish to npm id: changesets - uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 + uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc # v1.4.10 with: version: pnpm changeset:version publish: pnpm changeset:publish diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 4901b3781..539f6ee2f 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -20,18 +20,18 @@ jobs: with: persist-credentials: false - name: Run analysis - uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 + uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 with: results_file: results.sarif results_format: sarif publish_results: true - name: Upload artifact - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: SARIF file path: results.sarif retention-days: 5 - name: Upload to code-scanning - uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/upload-sarif@5378192d256ef1302a6980fffe5ca04426d43091 # v3.28.21 with: sarif_file: results.sarif diff --git a/.github/workflows/update-browserlist.yml b/.github/workflows/update-browserlist.yml index 94de12ad3..54ef39b11 100644 --- a/.github/workflows/update-browserlist.yml +++ b/.github/workflows/update-browserlist.yml @@ -19,7 +19,7 @@ jobs: message: 'chore: update browsers list' push: false - name: Create Pull Request - uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6 + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 with: branch: update-browserslist title: Update Browserslist diff --git a/cypress/integration/rendering/erDiagram.spec.js b/cypress/integration/rendering/erDiagram.spec.js index 8f6193f96..b9c8bbbf4 100644 --- a/cypress/integration/rendering/erDiagram.spec.js +++ b/cypress/integration/rendering/erDiagram.spec.js @@ -369,4 +369,92 @@ ORDER ||--|{ LINE-ITEM : contains ); }); }); + + describe('Special characters and numbers syntax', () => { + it('should render ER diagram with numeric entity names', () => { + imgSnapshotTest( + ` + erDiagram + 1 ||--|| ORDER : places + ORDER ||--|{ 2 : contains + 2 ||--o{ 3.5 : references + `, + { logLevel: 1 } + ); + }); + + it('should render ER diagram with "u" character in entity names and cardinality', () => { + imgSnapshotTest( + ` + erDiagram + CUSTOMER ||--|| u : has + u ||--|| ORDER : places + PROJECT u--o{ TEAM_MEMBER : "parent" + `, + { logLevel: 1 } + ); + }); + + it('should render ER diagram with decimal numbers in relationships', () => { + imgSnapshotTest( + ` + erDiagram + 2.5 ||--|| 1.5 : has + CUSTOMER ||--o{ 3.14 : references + 1.0 ||--|{ ORDER : contains + `, + { logLevel: 1 } + ); + }); + + it('should render ER diagram with numeric entity names and attributes', () => { + imgSnapshotTest( + ` + erDiagram + 1 { + string name + int value + } + 1 ||--|| ORDER : places + ORDER { + float price + string description + } + `, + { logLevel: 1 } + ); + }); + + it('should render complex ER diagram with mixed special entity names', () => { + imgSnapshotTest( + ` + erDiagram + CUSTOMER ||--o{ 1 : places + 1 ||--|{ u : contains + 1.5 + u ||--|| 2.5 : processes + 2.5 { + string id + float value + } + u { + varchar(50) name + int count + } + `, + { logLevel: 1 } + ); + }); + it('should render ER diagram with numeric entity names and attributes', () => { + imgSnapshotTest( + `erDiagram + PRODUCT ||--o{ ORDER-ITEM : has + 1.5 + u + 1 + `, + { logLevel: 1 } + ); + }); + }); }); diff --git a/cypress/integration/rendering/sequencediagram-v2.spec.js b/cypress/integration/rendering/sequencediagram-v2.spec.js index f1c2aafbd..42db4001d 100644 --- a/cypress/integration/rendering/sequencediagram-v2.spec.js +++ b/cypress/integration/rendering/sequencediagram-v2.spec.js @@ -655,5 +655,126 @@ describe('Sequence Diagram Special Cases', () => { expect(svg).to.not.have.attr('style'); }); }); + + describe('Central Connection Rendering Tests', () => { + it('should render central connection circles on actor vertical lines', () => { + imgSnapshotTest( + `sequenceDiagram + participant Alice + participant Bob + participant Charlie + Alice ()->>() Bob: Central connection + Bob ()-->> Charlie: Reverse central connection + Charlie ()<<-->>() Alice: Dual central connection`, + { look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } } + ); + }); + + it('should render central connections with different arrow types', () => { + imgSnapshotTest( + `sequenceDiagram + participant Alice + participant Bob + Alice ()->>() Bob: Solid open arrow + Alice ()-->>() Bob: Dotted open arrow + Alice ()-x() Bob: Solid cross + Alice ()--x() Bob: Dotted cross + Alice ()->() Bob: Solid arrow`, + { look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } } + ); + }); + + it('should render central connections with bidirectional arrows', () => { + imgSnapshotTest( + `sequenceDiagram + participant Alice + participant Bob + Alice ()<<->>() Bob: Bidirectional solid + Alice ()<<-->>() Bob: Bidirectional dotted`, + { look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } } + ); + }); + + it('should render central connections with activations', () => { + imgSnapshotTest( + `sequenceDiagram + participant Alice + participant Bob + participant Charlie + Alice ()->>() Bob: Activate Bob + activate Bob + Bob ()-->> Charlie: Message to Charlie + Bob ()->>() Alice: Response to Alice + deactivate Bob`, + { look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } } + ); + }); + + it('should render central connections mixed with normal messages', () => { + imgSnapshotTest( + `sequenceDiagram + participant Alice + participant Bob + participant Charlie + Alice ->> Bob: Normal message + Bob ()->>() Charlie: Central connection + Charlie -->> Alice: Normal dotted message + Alice ()<<-->>() Bob: Dual central connection + Bob -x Charlie: Normal cross message`, + { look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } } + ); + }); + + it('should render central connections with notes', () => { + imgSnapshotTest( + `sequenceDiagram + participant Alice + participant Bob + participant Charlie + Alice ()->>() Bob: Central connection + Note over Alice,Bob: Central connection note + Bob ()-->> Charlie: Reverse central connection + Note right of Charlie: Response note + Charlie ()<<-->>() Alice: Dual central connection`, + { look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } } + ); + }); + + it('should render central connections with loops and alternatives', () => { + imgSnapshotTest( + `sequenceDiagram + participant Alice + participant Bob + participant Charlie + loop Every minute + Alice ()->>() Bob: Central heartbeat + Bob ()-->> Charlie: Forward heartbeat + end + alt Success + Charlie ()<<-->>() Alice: Success response + else Failure + Charlie ()-x() Alice: Failure response + end`, + { look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } } + ); + }); + + it('should render central connections with different participant types', () => { + imgSnapshotTest( + `sequenceDiagram + participant Alice + actor Bob + participant Charlie@{"type":"boundary"} + participant David@{"type":"control"} + participant Eve@{"type":"entity"} + Alice ()->>() Bob: To actor + Bob ()-->> Charlie: To boundary + Charlie ()->>() David: To control + David ()<<-->>() Eve: To entity + Eve ()-x() Alice: Back to participant`, + { look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } } + ); + }); + }); }); }); diff --git a/cypress/integration/rendering/sequencediagram.spec.js b/cypress/integration/rendering/sequencediagram.spec.js index 6709b557c..0ec913a8c 100644 --- a/cypress/integration/rendering/sequencediagram.spec.js +++ b/cypress/integration/rendering/sequencediagram.spec.js @@ -1053,4 +1053,167 @@ describe('Sequence diagram', () => { ]); }); }); + describe('render new arrow type', () => { + it('should render Solid half arrow top', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice -|\\ John: Hello John, how are you? + Alice-|\\ John: Hi Alice, I can hear you! + Alice -|\\ John: Test + ` + ); + }); + it('should render Solid half arrow bottom', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice-|/John: Hello John, how are you? + Alice-|/John: Hi Alice, I can hear you! + Alice-|/John: Test + ` + ); + }); + + it('should render Stick half arrow top ', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice-\\\\John: Hello John, how are you? + Alice-\\\\John: Hi Alice, I can hear you! + Alice-\\\\John: Test + ` + ); + }); + it('should render Stick half arrow bottom ', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice-//John: Hello John, how are you? + Alice-//John: Hi Alice, I can hear you! + Alice-//John: Test + ` + ); + }); + it('should render Solid half arrow top reverse ', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice/|-John: Hello Alice, how are you? + Alice/|-John: Hi Alice, I can hear you! + Alice/|-John: Test + + ` + ); + }); + + it('should render Solid half arrow bottom reverse ', () => { + imgSnapshotTest( + `sequenceDiagram + Alice \\|- John: Hello Alice, how are you? + Alice \\|- John: Hi Alice, I can hear you! + Alice \\|- John: Test` + ); + }); + + it('should render Stick half arrow top reverse ', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice //-John: Hello Alice, how are you? + Alice //-John: Hi Alice, I can hear you! + Alice //-John: Test` + ); + }); + + it('should render Stick half arrow bottom reverse ', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice \\\\-John: Hello Alice, how are you? + Alice \\\\-John: Hi Alice, I can hear you! + Alice \\\\-John: Test` + ); + }); + + it('should render Solid half arrow top dotted', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice --|\\John: Hello John, how are you? + Alice --|\\John: Hi Alice, I can hear you! + Alice --|\\John: Test` + ); + }); + + it('should render Solid half arrow bottom dotted', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice --|/John: Hello John, how are you? + Alice --|/John: Hi Alice, I can hear you! + Alice --|/John: Test` + ); + }); + + it('should render Stick half arrow top dotted', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice--\\\\John: Hello John, how are you? + Alice--\\\\John: Hi Alice, I can hear you! + Alice--\\\\John: Test` + ); + }); + + it('should render Stick half arrow bottom dotted', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice--//John: Hello John, how are you? + Alice--//John: Hi Alice, I can hear you! + Alice--//John: Test` + ); + }); + + it('should render Solid half arrow top reverse dotted', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice/|--John: Hello Alice, how are you? + Alice/|--John: Hi Alice, I can hear you! + Alice/|--John: Test` + ); + }); + + it('should render Solid half arrow bottom reverse dotted', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice\\|--John: Hello Alice, how are you? + Alice\\|--John: Hi Alice, I can hear you! + Alice\\|--John: Test` + ); + }); + + it('should render Stick half arrow top reverse dotted ', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice//--John: Hello Alice, how are you? + Alice//--John: Hi Alice, I can hear you! + Alice//--John: Test` + ); + }); + + it('should render Stick half arrow bottom reverse dotted ', () => { + imgSnapshotTest( + ` + sequenceDiagram + Alice\\\\--John: Hello Alice, how are you? + Alice\\\\--John: Hi Alice, I can hear you! + Alice\\\\--John: Test` + ); + }); + }); }); diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html index 7ac7aeac8..90f40003a 100644 --- a/cypress/platform/knsv2.html +++ b/cypress/platform/knsv2.html @@ -110,6 +110,48 @@ config: layout: elk --- + mindmap + root((mindmap)) + Origins + Long history + ::icon(fa fa-book) + Popularisation + British popular psychology author Tony Buzan + Research + On effectiveness<br/>and features + On Automatic creation + Uses + Creative techniques + Strategic planning + Argument mapping + Tools + id)I am a cloud( + id))I am a bang(( + Tools + +
+ --- + config: + layout: elk + --- + flowchart + aid0 ++
+ --- + config: + layout: elk + --- + mindmap + aid0 + ++
+ --- + config: + layout: ogdc + --- flowchart-elk TB c1-->a2 subgraph one diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index b01ce9bac..1c0202c62 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "es2020", "lib": ["es2020", "dom"], - "types": ["cypress", "node", "@argos-ci/cypress/dist/support.d.ts"], + "types": ["cypress", "node", "@argos-ci/cypress/support"], "allowImportingTsExtensions": true, "noEmit": true }, diff --git a/demos/er-multiline.html b/demos/er-multiline.html index 97cfcc934..7379f12f6 100644 --- a/demos/er-multiline.html +++ b/demos/er-multiline.html @@ -11,7 +11,7 @@ rel="stylesheet" /> +)** + +The following half-arrow types are supported for more expressive sequence diagrams. Both solid and dotted variants are available by increasing the number of dashes (`-` → `--`). + +--- + +| Type | Description | +| ------- | ---------------------------------------------------- | +| `-\|\` | Solid line with top half arrowhead | +| `--\|\` | Dotted line with top half arrowhead | +| `-\|/` | Solid line with bottom half arrowhead | +| `--\|/` | Dotted line with bottom half arrowhead | +| `/\|-` | Solid line with reverse top half arrowhead | +| `/\|--` | Dotted line with reverse top half arrowhead | +| `\\-` | Solid line with reverse bottom half arrowhead | +| `\\--` | Dotted line with reverse bottom half arrowhead | +| `-\\` | Solid line with top stick half arrowhead | +| `--\\` | Dotted line with top stick half arrowhead | +| `-//` | Solid line with bottom stick half arrowhead | +| `--//` | Dotted line with bottom stick half arrowhead | +| `//-` | Solid line with reverse top stick half arrowhead | +| `//--` | Dotted line with reverse top stick half arrowhead | +| `\\-` | Solid line with reverse bottom stick half arrowhead | +| `\\--` | Dotted line with reverse bottom stick half arrowhead | + +## Central Connections (v\+) + +Mermaid sequence diagrams support **central lifeline connections** using a `()`. +This is useful to represent messages or signals that connect to a central point, rather than from one actor directly to another. + +To indicate a central connection, append `()` to the arrow syntax. + +#### Basic Syntax + +```mermaid-example +sequenceDiagram + participant Alice + participant John + Alice->>()John: Hello John + Alice()->>John: How are you? + John()->>()Alice: Great! +``` + +```mermaid +sequenceDiagram + participant Alice + participant John + Alice->>()John: Hello John + Alice()->>John: How are you? + John()->>()Alice: Great! +``` + ## Activations It is possible to activate and deactivate an actor. (de)activation can be dedicated declarations: diff --git a/package.json b/package.json index ddd0446ed..e970240d1 100644 --- a/package.json +++ b/package.json @@ -63,36 +63,36 @@ ] }, "devDependencies": { - "@applitools/eyes-cypress": "^3.44.9", - "@argos-ci/cypress": "^5.0.2", + "@applitools/eyes-cypress": "^3.55.2", + "@argos-ci/cypress": "^6.1.3", "@changesets/changelog-github": "^0.5.1", - "@changesets/cli": "^2.27.12", + "@changesets/cli": "^2.29.7", "@cspell/eslint-plugin": "^8.19.4", - "@cypress/code-coverage": "^3.12.49", + "@cypress/code-coverage": "^3.14.6", "@eslint/js": "^9.26.0", - "@rollup/plugin-typescript": "^12.1.2", - "@types/cors": "^2.8.17", - "@types/express": "^5.0.0", + "@rollup/plugin-typescript": "^12.1.4", + "@types/cors": "^2.8.19", + "@types/express": "^5.0.3", "@types/js-yaml": "^4.0.9", "@types/jsdom": "^21.1.7", - "@types/lodash": "^4.17.15", + "@types/lodash": "^4.17.20", "@types/mdast": "^4.0.4", - "@types/node": "^22.13.5", + "@types/node": "^22.18.6", "@types/rollup-plugin-visualizer": "^5.0.3", - "@vitest/coverage-v8": "^3.0.6", - "@vitest/spy": "^3.0.6", - "@vitest/ui": "^3.0.6", + "@vitest/coverage-v8": "^3.2.4", + "@vitest/spy": "^3.2.4", + "@vitest/ui": "^3.2.4", "ajv": "^8.17.1", "chokidar": "3.6.0", - "concurrently": "^9.1.2", + "concurrently": "^9.2.1", "cors": "^2.8.5", "cpy-cli": "^5.0.0", "cross-env": "^7.0.3", - "cspell": "^9.1.3", - "cypress": "^14.5.1", + "cspell": "^9.2.1", + "cypress": "^14.5.4", "cypress-image-snapshot": "^4.0.1", - "cypress-split": "^1.24.14", - "esbuild": "^0.25.0", + "cypress-split": "^1.24.23", + "esbuild": "^0.25.10", "eslint": "^9.26.0", "eslint-config-prettier": "^10.1.8", "eslint-plugin-cypress": "^4.3.0", @@ -106,30 +106,30 @@ "eslint-plugin-tsdoc": "^0.4.0", "eslint-plugin-unicorn": "^59.0.1", "express": "^5.1.0", - "globals": "^16.0.0", - "globby": "^14.0.2", + "globals": "^16.4.0", + "globby": "^14.1.0", "husky": "^9.1.7", - "jest": "^30.0.4", + "jest": "^30.1.3", "jison": "^0.4.18", "js-yaml": "^4.1.0", "jsdom": "^26.1.0", "langium-cli": "3.3.0", - "lint-staged": "^16.1.2", + "lint-staged": "^16.1.6", "markdown-table": "^3.0.4", "nyc": "^17.1.0", "path-browserify": "^1.0.1", - "prettier": "^3.5.2", - "prettier-plugin-jsdoc": "^1.3.2", + "prettier": "^3.6.2", + "prettier-plugin-jsdoc": "^1.3.3", "rimraf": "^6.0.1", "rollup-plugin-visualizer": "^6.0.3", - "start-server-and-test": "^2.0.10", + "start-server-and-test": "^2.1.2", "tslib": "^2.8.1", - "tsx": "^4.7.3", + "tsx": "^4.20.5", "typescript": "~5.7.3", "typescript-eslint": "^8.38.0", - "vite": "^7.0.3", + "vite": "^7.0.7", "vite-plugin-istanbul": "^7.0.0", - "vitest": "^3.0.6" + "vitest": "^3.2.4" }, "nyc": { "report-dir": "coverage/cypress" diff --git a/packages/mermaid-example-diagram/package.json b/packages/mermaid-example-diagram/package.json index 75eaa498e..f4c0ef6fc 100644 --- a/packages/mermaid-example-diagram/package.json +++ b/packages/mermaid-example-diagram/package.json @@ -37,12 +37,12 @@ ] }, "dependencies": { - "@braintree/sanitize-url": "^7.0.4", + "@braintree/sanitize-url": "^7.1.1", "d3": "^7.9.0", "khroma": "^2.1.0" }, "devDependencies": { - "concurrently": "^9.1.2", + "concurrently": "^9.2.1", "mermaid": "workspace:*", "rimraf": "^6.0.1" }, diff --git a/packages/mermaid-layout-elk/CHANGELOG.md b/packages/mermaid-layout-elk/CHANGELOG.md index ef40f04a0..3b9bd1614 100644 --- a/packages/mermaid-layout-elk/CHANGELOG.md +++ b/packages/mermaid-layout-elk/CHANGELOG.md @@ -1,5 +1,16 @@ # @mermaid-js/layout-elk +## 0.2.0 + +### Minor Changes + +- [#6802](https://github.com/mermaid-js/mermaid/pull/6802) [`c8e5027`](https://github.com/mermaid-js/mermaid/commit/c8e50276e877c4de7593a09ec458c99353e65af8) Thanks [@darshanr0107](https://github.com/darshanr0107)! - feat: Update mindmap rendering to support multiple layouts, improved edge intersections, and new shapes + +### Patch Changes + +- Updated dependencies [[`33bc4a0`](https://github.com/mermaid-js/mermaid/commit/33bc4a0b4e2ca6d937bb0a8c4e2081b1362b2800), [`e0b45c2`](https://github.com/mermaid-js/mermaid/commit/e0b45c2d2b41c2a9038bf87646fa3ccd7560eb20), [`012530e`](https://github.com/mermaid-js/mermaid/commit/012530e98e9b8b80962ab270b6bb3b6d9f6ada05), [`c8e5027`](https://github.com/mermaid-js/mermaid/commit/c8e50276e877c4de7593a09ec458c99353e65af8)]: + - mermaid@11.11.0 + ## 0.1.9 ### Patch Changes diff --git a/packages/mermaid-layout-elk/package.json b/packages/mermaid-layout-elk/package.json index 176c14b25..91c1ae81f 100644 --- a/packages/mermaid-layout-elk/package.json +++ b/packages/mermaid-layout-elk/package.json @@ -1,6 +1,6 @@ { "name": "@mermaid-js/layout-elk", - "version": "0.1.9", + "version": "0.2.0", "description": "ELK layout engine for mermaid", "module": "dist/mermaid-layout-elk.core.mjs", "types": "dist/layouts.d.ts", diff --git a/packages/mermaid-layout-elk/src/render.ts b/packages/mermaid-layout-elk/src/render.ts index 4680b0c68..2cb12e035 100644 --- a/packages/mermaid-layout-elk/src/render.ts +++ b/packages/mermaid-layout-elk/src/render.ts @@ -67,7 +67,22 @@ export const render = async ( // Add the element to the DOM if (!node.isGroup) { - const child = node as NodeWithVertex; + // const child = node as NodeWithVertex; + const child: NodeWithVertex = { + id: node.id, + width: node.width, + height: node.height, + // Store the original node data for later use + label: node.label, + isGroup: node.isGroup, + shape: node.shape, + padding: node.padding, + cssClasses: node.cssClasses, + cssStyles: node.cssStyles, + look: node.look, + // Include parentId for subgraph processing + parentId: node.parentId, + }; graph.children.push(child); nodeDb[node.id] = node; @@ -150,7 +165,7 @@ export const render = async ( domId: { node: () => any; attr: (arg0: string, arg1: string) => void }; }) { if (node) { - nodeDb[node.id] = node; + nodeDb[node.id] ??= {}; nodeDb[node.id].offset = { posX: node.x + relX, posY: node.y + relY, @@ -860,11 +875,13 @@ export const render = async ( log.info('APA01 layout result:', JSON.stringify(g, null, 2)); } catch (error) { log.error('APA01 ELK layout error:', error); + log.error('APA01 elkGraph that caused error:', JSON.stringify(elkGraph, null, 2)); throw error; } // debugger; await drawNodes(0, 0, g.children, svg, subGraphsEl, 0); + g.edges?.map( (edge: { sources: (string | number)[]; diff --git a/packages/mermaid-layout-tidy-tree/CHANGELOG.md b/packages/mermaid-layout-tidy-tree/CHANGELOG.md new file mode 100644 index 000000000..63c8ab6e2 --- /dev/null +++ b/packages/mermaid-layout-tidy-tree/CHANGELOG.md @@ -0,0 +1,12 @@ +# @mermaid-js/layout-tidy-tree + +## 0.2.0 + +### Minor Changes + +- [#6802](https://github.com/mermaid-js/mermaid/pull/6802) [`c8e5027`](https://github.com/mermaid-js/mermaid/commit/c8e50276e877c4de7593a09ec458c99353e65af8) Thanks [@darshanr0107](https://github.com/darshanr0107)! - feat: Update mindmap rendering to support multiple layouts, improved edge intersections, and new shapes + +### Patch Changes + +- Updated dependencies [[`33bc4a0`](https://github.com/mermaid-js/mermaid/commit/33bc4a0b4e2ca6d937bb0a8c4e2081b1362b2800), [`e0b45c2`](https://github.com/mermaid-js/mermaid/commit/e0b45c2d2b41c2a9038bf87646fa3ccd7560eb20), [`012530e`](https://github.com/mermaid-js/mermaid/commit/012530e98e9b8b80962ab270b6bb3b6d9f6ada05), [`c8e5027`](https://github.com/mermaid-js/mermaid/commit/c8e50276e877c4de7593a09ec458c99353e65af8)]: + - mermaid@11.11.0 diff --git a/packages/mermaid-layout-tidy-tree/package.json b/packages/mermaid-layout-tidy-tree/package.json index d8c3ed965..bdc15869f 100644 --- a/packages/mermaid-layout-tidy-tree/package.json +++ b/packages/mermaid-layout-tidy-tree/package.json @@ -1,6 +1,6 @@ { "name": "@mermaid-js/layout-tidy-tree", - "version": "0.1.0", + "version": "0.2.0", "description": "Tidy-tree layout engine for mermaid", "module": "dist/mermaid-layout-tidy-tree.core.mjs", "types": "dist/layouts.d.ts", diff --git a/packages/mermaid-zenuml/package.json b/packages/mermaid-zenuml/package.json index cc9ce0d4a..0244fb77d 100644 --- a/packages/mermaid-zenuml/package.json +++ b/packages/mermaid-zenuml/package.json @@ -33,7 +33,7 @@ ], "license": "MIT", "dependencies": { - "@zenuml/core": "^3.35.2" + "@zenuml/core": "^3.41.4" }, "devDependencies": { "mermaid": "workspace:^" diff --git a/packages/mermaid/CHANGELOG.md b/packages/mermaid/CHANGELOG.md index fc2f97fdf..e21ad76e2 100644 --- a/packages/mermaid/CHANGELOG.md +++ b/packages/mermaid/CHANGELOG.md @@ -1,5 +1,19 @@ # mermaid +## 11.11.0 + +### Minor Changes + +- [#6704](https://github.com/mermaid-js/mermaid/pull/6704) [`012530e`](https://github.com/mermaid-js/mermaid/commit/012530e98e9b8b80962ab270b6bb3b6d9f6ada05) Thanks [@omkarht](https://github.com/omkarht)! - feat: Added support for new participant types (`actor`, `boundary`, `control`, `entity`, `database`, `collections`, `queue`) in `sequenceDiagram`. + +- [#6802](https://github.com/mermaid-js/mermaid/pull/6802) [`c8e5027`](https://github.com/mermaid-js/mermaid/commit/c8e50276e877c4de7593a09ec458c99353e65af8) Thanks [@darshanr0107](https://github.com/darshanr0107)! - feat: Update mindmap rendering to support multiple layouts, improved edge intersections, and new shapes + +### Patch Changes + +- [#6905](https://github.com/mermaid-js/mermaid/pull/6905) [`33bc4a0`](https://github.com/mermaid-js/mermaid/commit/33bc4a0b4e2ca6d937bb0a8c4e2081b1362b2800) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix: Render newlines as spaces in class diagrams + +- [#6886](https://github.com/mermaid-js/mermaid/pull/6886) [`e0b45c2`](https://github.com/mermaid-js/mermaid/commit/e0b45c2d2b41c2a9038bf87646fa3ccd7560eb20) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix: Handle arrows correctly when auto number is enabled + ## 11.10.0 ### Minor Changes diff --git a/packages/mermaid/package.json b/packages/mermaid/package.json index c1ce3f63f..7bacb71bb 100644 --- a/packages/mermaid/package.json +++ b/packages/mermaid/package.json @@ -1,6 +1,6 @@ { "name": "mermaid", - "version": "11.10.0", + "version": "11.11.0", "description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.", "type": "module", "module": "./dist/mermaid.core.mjs", @@ -67,29 +67,29 @@ ] }, "dependencies": { - "@braintree/sanitize-url": "^7.0.4", - "@iconify/utils": "^3.0.1", + "@braintree/sanitize-url": "^7.1.1", + "@iconify/utils": "^3.0.2", "@mermaid-js/parser": "workspace:^", "@types/d3": "^7.4.3", - "cytoscape": "^3.29.3", + "cytoscape": "^3.33.1", "cytoscape-cose-bilkent": "^4.1.0", "cytoscape-fcose": "^2.2.0", "d3": "^7.9.0", "d3-sankey": "^0.12.3", "dagre-d3-es": "7.0.11", - "dayjs": "^1.11.13", + "dayjs": "^1.11.18", "dompurify": "^3.2.5", "katex": "^0.16.22", "khroma": "^2.1.0", "lodash-es": "^4.17.21", - "marked": "^16.0.0", + "marked": "^16.3.0", "roughjs": "^4.6.6", "stylis": "^4.3.6", "ts-dedent": "^2.2.0", "uuid": "^11.1.0" }, "devDependencies": { - "@adobe/jsonschema2md": "^8.0.2", + "@adobe/jsonschema2md": "^8.0.5", "@iconify/types": "^2.0.0", "@types/cytoscape": "^3.21.9", "@types/cytoscape-fcose": "^2.2.4", @@ -105,30 +105,30 @@ "@types/stylis": "^4.2.7", "@types/uuid": "^10.0.0", "ajv": "^8.17.1", - "canvas": "^3.1.0", + "canvas": "^3.2.0", "chokidar": "3.6.0", - "concurrently": "^9.1.2", + "concurrently": "^9.2.1", "csstree-validator": "^4.0.1", - "globby": "^14.0.2", + "globby": "^14.1.0", "jison": "^0.4.18", - "js-base64": "^3.7.7", + "js-base64": "^3.7.8", "jsdom": "^26.1.0", "json-schema-to-typescript": "^15.0.4", "micromatch": "^4.0.8", "path-browserify": "^1.0.1", - "prettier": "^3.5.2", + "prettier": "^3.6.2", "remark": "^15.0.1", "remark-frontmatter": "^5.0.0", "remark-gfm": "^4.0.1", "rimraf": "^6.0.1", - "start-server-and-test": "^2.0.10", - "type-fest": "^4.35.0", - "typedoc": "^0.28.9", - "typedoc-plugin-markdown": "^4.8.0", + "start-server-and-test": "^2.1.2", + "type-fest": "^4.41.0", + "typedoc": "^0.28.13", + "typedoc-plugin-markdown": "^4.8.1", "typescript": "~5.7.3", "unist-util-flatmap": "^1.0.0", "unist-util-visit": "^5.0.0", - "vitepress": "^1.0.2", + "vitepress": "^1.6.4", "vitepress-plugin-search": "1.0.4-alpha.22" }, "files": [ diff --git a/packages/mermaid/src/diagrams/er/parser/erDiagram.jison b/packages/mermaid/src/diagrams/er/parser/erDiagram.jison index 2b59309fb..f581c6777 100644 --- a/packages/mermaid/src/diagrams/er/parser/erDiagram.jison +++ b/packages/mermaid/src/diagrams/er/parser/erDiagram.jison @@ -66,12 +66,15 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili \}\| return 'ONE_OR_MORE'; "one" return 'ONLY_ONE'; "only one" return 'ONLY_ONE'; -"1" return 'ONLY_ONE'; +[0-9]+\.[0-9]+ return 'DECIMAL_NUM'; +"1"(?=\s+[A-Za-z_"']) return 'ONLY_ONE'; +"1" return 'ENTITY_ONE'; +[0-9]+ return 'NUM'; \|\| return 'ONLY_ONE'; o\| return 'ZERO_OR_ONE'; o\{ return 'ZERO_OR_MORE'; \|\{ return 'ONE_OR_MORE'; -\s*u return 'MD_PARENT'; +u(?=[\.\-\|]) return 'MD_PARENT'; \.\. return 'NON_IDENTIFYING'; \-\- return 'IDENTIFYING'; "to" return 'IDENTIFYING'; @@ -80,13 +83,15 @@ o\{ return 'ZERO_OR_MORE'; \-\. return 'NON_IDENTIFYING';