Skip to content

Conversation

@milesspencer35
Copy link

@milesspencer35 milesspencer35 commented Nov 5, 2025

📑 Summary

Added support for sequence numbers in sequence diagrams to use decimal values up to the hundredths place, and enabled incrementing using decimal values to the same precision.

Resolves #7078

📏 Design Decisions

Describe the way your implementation works or what design decisions you made if applicable.

  • Updated the Jison parser for sequence diagrams to accept decimal values to the hundredths place.
  • Updated how the sequenceIndex and sequenceIndexStep are added to remove floating-point errors.
  • Decrease the font size once a sequence number gets sufficiently long and spills out of the circle. I decided this was the best course of action because it was a simple fix for a rare use case.

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot
Copy link

changeset-bot bot commented Nov 5, 2025

🦋 Changeset detected

Latest commit: 1290065

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Nov 5, 2025

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 1290065
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/691ca491048072000823b666
😎 Deploy Preview https://deploy-preview-7132--mermaid-js.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.

@github-actions github-actions bot added the Type: Enhancement New feature or request label Nov 5, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 5, 2025

Open in StackBlitz

@mermaid-js/examples

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/examples@7132

mermaid

npm i https://pkg.pr.new/mermaid-js/mermaid@7132

@mermaid-js/layout-elk

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-elk@7132

@mermaid-js/layout-tidy-tree

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-tidy-tree@7132

@mermaid-js/mermaid-zenuml

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/mermaid-zenuml@7132

@mermaid-js/parser

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/parser@7132

@mermaid-js/tiny

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/tiny@7132

commit: 1290065

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.55%. Comparing base (717d3b3) to head (1290065).
⚠️ Report is 136 commits behind head on develop.

Files with missing lines Patch % Lines
.../mermaid/src/diagrams/sequence/sequenceRenderer.ts 0.00% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #7132      +/-   ##
==========================================
- Coverage     3.55%   3.55%   -0.01%     
==========================================
  Files          474     473       -1     
  Lines        47453   47504      +51     
  Branches       730     731       +1     
==========================================
  Hits          1687    1687              
- Misses       45766   45817      +51     
Flag Coverage Δ
unit 3.55% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../mermaid/src/diagrams/sequence/sequenceRenderer.ts 0.06% <0.00%> (-0.01%) ⬇️

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci
Copy link

argos-ci bot commented Nov 5, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 1 added Nov 18, 2025, 5:05 PM

@milesspencer35 milesspencer35 marked this pull request as ready for review November 5, 2025 05:07
Copy link
Member

@shubhamparikh2704 shubhamparikh2704 left a comment

Choose a reason for hiding this comment

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

Please add changeset and some rendering tests

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for decimal sequence numbers in sequence diagrams, allowing values up to the hundredths place (e.g., 10.25). The implementation includes parser updates to accept decimal values, renderer modifications to handle floating-point arithmetic correctly, and dynamic font sizing for longer sequence numbers.

Key Changes:

  • Updated Jison parser to accept decimal numbers up to two decimal places
  • Implemented proper rounding to avoid floating-point precision errors
  • Added dynamic font sizing based on sequence number length

Reviewed Changes

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

Show a summary per file
File Description
packages/mermaid/src/diagrams/sequence/parser/sequenceDiagram.jison Updated NUM token regex to accept decimal values up to hundredths place
packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts Added floating-point rounding fix and dynamic font sizing for sequence numbers
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js Added unit tests for decimal number support and precision validation
cypress/integration/rendering/sequencediagram.spec.js Added integration test for decimal sequence number rendering
packages/mermaid/src/docs/syntax/sequenceDiagram.md Documented new decimal sequence number feature with examples
docs/syntax/sequenceDiagram.md Documented new decimal sequence number feature with examples
.changeset/slick-maps-hear.md Added changeset entry for the feature

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

@milesspencer35 milesspencer35 force-pushed the feature/7078_allow_decimal_sequence_numbers branch from 9aaa70b to f602021 Compare November 12, 2025 16:26
Alice->Bob: Hello Bob, how are you?
Bob-->Alice: I am good thanks!
```

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure why this is duplicating. I've tried a couple of things to fix it, like manually removing it and reverting to an older version when a manual change hadn't been made, but neither worked. Any ideas?

Copy link
Author

Choose a reason for hiding this comment

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

@shubhamparikh2704 @sidharthv96 I wasn't able to figure out why this was duplicating so I made a new branch, updated my docs change, and created a new PR. Here is the PR: #7174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for decimal numbers with sequence diagram

2 participants