Compare commits

..

28 Commits

Author SHA1 Message Date
shubham-mermaid
526374e04a on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com> 2025-07-15 00:40:44 +05:30
shubham-mermaid
5493d4344c Merge branch 'develop' into test-validate-lockfile-workflow 2025-07-15 00:40:30 +05:30
Sidharth Vinod
d7f1f12549 Merge pull request #6748 from mermaid-js/sidv/updateArgosCy
chore: Update @argos-ci/cypress to v5
2025-07-14 23:35:38 +05:30
Sidharth Vinod
6e56869566 Update @argos-ci/cypress to v5.0.2 2025-07-14 23:22:40 +05:30
Sidharth Vinod
852cb35f0a Update @argos-ci/cypress to v5.0.1 2025-07-14 20:05:57 +05:30
omkarht
63d84f125b added changeset 2025-07-14 19:40:53 +05:30
omkarht
a28965064d chore: downgrade chokidar to 3.6.0 2025-07-14 19:34:02 +05:30
Sidharth Vinod
355eeeb9cc chore: Upgrade cypress 2025-07-14 18:33:09 +05:30
Sidharth Vinod
5449d6a447 chore: Update @argos-ci/cypress to v5
This fixes the random test renaming issue
2025-07-14 18:15:18 +05:30
shubham-mermaid
f76e27db70 Merge pull request #6747 from mermaid-js/6619-sequence-title-box-safari
6619: Prevent title from overlapping with box top border in Safari
2025-07-14 09:13:53 +00:00
darshanr0107
3e3ae08930 add changeset 2025-07-14 14:17:00 +05:30
darshanr0107
966c112eb1 prevent title from overlapping with box top border in Safari 2025-07-14 14:11:06 +05:30
shubham-mermaid
55527e70c2 Merge pull request #6745 from mermaid-js/renovate/autofix-ci-action-digest
chore(deps): update autofix-ci/action digest to 635ffb0
2025-07-14 06:47:45 +00:00
renovate[bot]
447d1cf988 chore(deps): update autofix-ci/action digest to 635ffb0 2025-07-14 00:55:26 +00:00
Alois Klink
fad6676d18 Merge pull request #6715 from Syn3ugar/feature/timelineRenderer-conf
fix: update leftMargin value
2025-07-10 10:37:48 +00:00
Syn3ugar
637680d4d9 fix(timeline): load leftMargin from config
The `timeline.leftMargin` value in the docs/schema was not being
correctly loaded for timeline diagrams.
2025-07-10 18:28:15 +08:00
shubham-mermaid
5f6f5110fd Merge pull request #6718 from MoonBall/feat/modify-blockDiagram-log
Modify block diagram's logger to global log
2025-07-10 08:00:39 +00:00
Sidharth Vinod
af47269342 Merge pull request #6615 from mermaid-js/renovate/major-all-major
fix(deps): update all major dependencies (major)
2025-07-09 20:05:52 +00:00
renovate[bot]
d3c0893937 fix(deps): update all major dependencies 2025-07-09 19:53:14 +00:00
Sidharth Vinod
75ef9bc681 fix: Make PR labeler stricter 2025-07-10 01:21:42 +05:30
Sidharth Vinod
45edc91591 Merge pull request #6510 from mermaid-js/sidv/packet-release
Move `packet` diagram out of beta
2025-07-09 19:35:19 +00:00
Sidharth Vinod
b611a13e04 chore: Add test for packet-beta 2025-07-10 00:44:07 +05:30
Sidharth Vinod
7a38eb715d chore: Changeset 2025-07-10 00:43:02 +05:30
Sidharth Vinod
2715ddb338 chore: Update packet-beta to packet 2025-07-10 00:41:02 +05:30
Sidharth Vinod
ca2eca58c9 Merge branch 'develop' into sidv/packet-release
* develop: (266 commits)
  chore: update E2E timings
  docs: Update changeset
  fix: Add useful error message to test
  chore: Add treemap example
  chore: Add treemap example
  chore: Add peerDependency to @mermaid-js/examples
  Version Packages
  docs: Update changeset
  update in changeset
  updated validaor and tests to use treemap
  Updated parser to use treemap
  chore: Fail build in CI on type errors
  fix text going outside node
  Version Packages
  Updated phpbb url  to support 403 in lychee
  Updated lychee for working url phpbb.com
  resolve PR comment
  resolve PR comments
  chore: update E2E timings
  add changeset
  ...
2025-07-10 00:38:41 +05:30
shubham-mermaid
3151241559 Merge branch 'develop' into feat/modify-blockDiagram-log 2025-07-09 13:47:24 +05:30
Gang Chen
79ba50216a Modify block diagram's logger to global log 2025-07-06 01:09:36 +08:00
Sidharth Vinod
19884294bc chore: Move packet diagram out of beta 2025-04-20 14:09:27 +05:30
30 changed files with 2331 additions and 1272 deletions

View File

@@ -0,0 +1,7 @@
---
'@mermaid-js/examples': patch
'mermaid': patch
'@mermaid-js/parser': patch
---
chore: Move packet diagram out of beta

View File

@@ -0,0 +1,5 @@
---
'mermaid': patch
---
fix: adjust sequence diagram title positioning to prevent overlap with top border in Safari

View File

@@ -0,0 +1,5 @@
---
'mermaid': patch
---
chore: downgrade chokidar to 3.6.0 and ignore updates for hot reload stability

View File

@@ -0,0 +1,7 @@
---
'mermaid': patch
---
fix(timeline): fix loading `leftMargin` from config
The `timeline.leftMargin` config value should now correctly control the size of the left margin, instead of being ignored.

View File

@@ -42,4 +42,4 @@ jobs:
working-directory: ./packages/mermaid
run: pnpm run docs:build
- uses: autofix-ci/action@551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef # main
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 # main

View File

@@ -42,7 +42,7 @@ jobs:
pull_number: prNumber,
});
const isSponsored = commits.some(
const isSponsored = commits.every(
(c) => c.commit.author.email?.endsWith('@mermaidchart.com')
);

View File

@@ -35,7 +35,7 @@ jobs:
# 2) No unwanted vitepress paths
if grep -qF 'packages/mermaid/src/vitepress' pnpm-lock.yaml; then
issues+=("• Disallowed path 'packages/mermaid/src/vitepress' present. Run `rm -rf packages/mermaid/src/vitepress && pnpm install` to regenerate.")
issues+=("• Disallowed path 'packages/mermaid/src/vitepress' present. Run \`rm -rf packages/mermaid/src/vitepress && pnpm install\` to regenerate.")
fi
# 3) Lockfile only changes when package.json changes
@@ -46,12 +46,11 @@ jobs:
# If any issues, output them and fail
if [ ${#issues[@]} -gt 0 ]; then
# Use the new GITHUB_OUTPUT approach to set a multiline output
{
echo "errors<<EOF"
printf '%s\n' "${issues[@]}"
echo "EOF"
} >> $GITHUB_OUTPUT
} >> "$GITHUB_OUTPUT"
exit 1
fi
@@ -63,6 +62,7 @@ jobs:
issue-number: ${{ github.event.pull_request.number }}
body: |
The following issue(s) were detected:
${{ steps.validate.outputs.errors }}
Please address these and push an update.

View File

@@ -26,7 +26,10 @@ export default eyesPlugin(
config.env.useArgos = process.env.RUN_VISUAL_TEST === 'true';
if (config.env.useArgos) {
registerArgosTask(on, config);
registerArgosTask(on, config, {
// Enable upload to Argos only when it runs on CI.
uploadToArgos: !!process.env.CI,
});
} else {
addMatchImageSnapshotPlugin(on, config);
}

View File

@@ -1,7 +1,7 @@
import { imgSnapshotTest } from '../../helpers/util';
describe('packet structure', () => {
it('should render a simple packet diagram', () => {
it('should render a simple packet-beta diagram', () => {
imgSnapshotTest(
`packet-beta
title Hello world
@@ -10,9 +10,18 @@ describe('packet structure', () => {
);
});
it('should render a simple packet diagram', () => {
imgSnapshotTest(
`packet
title Hello world
0-10: "hello"
`
);
});
it('should render a simple packet diagram without ranges', () => {
imgSnapshotTest(
`packet-beta
`packet
0: "h"
1: "i"
`
@@ -21,7 +30,7 @@ describe('packet structure', () => {
it('should render a complex packet diagram', () => {
imgSnapshotTest(
`packet-beta
`packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"
@@ -52,7 +61,7 @@ describe('packet structure', () => {
packet:
showBits: false
---
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"

View File

@@ -4,7 +4,7 @@
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/font-awesome.min.css"
/>
<link
href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css"

View File

@@ -17,7 +17,7 @@
<div class="diagrams">
<pre class="mermaid">
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"
@@ -44,7 +44,7 @@
packet:
showBits: false
---
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"
@@ -70,7 +70,7 @@
config:
theme: forest
---
packet-beta
packet
title Forest theme
0-15: "Source Port"
16-31: "Destination Port"
@@ -97,7 +97,7 @@
config:
theme: dark
---
packet-beta
packet
title Dark theme
0-15: "Source Port"
16-31: "Destination Port"

View File

@@ -17,7 +17,7 @@ This diagram type is particularly useful for developers, network engineers, educ
## Syntax
```
packet-beta
packet
start: "Block name" %% Single-bit block
start-end: "Block name" %% Multi-bit blocks
... More Fields ...
@@ -28,7 +28,7 @@ start-end: "Block name" %% Multi-bit blocks
Using start and end bit counts can be difficult, especially when modifying a design. For this we add a bit count field, which starts from the end of the previous field automagically. Use `+<count>` to set the number of bits, thus:
```
packet-beta
packet
+1: "Block name" %% Single-bit block
+8: "Block name" %% 8-bit block
9-15: "Manually set start and end, it's fine to mix and match"
@@ -41,7 +41,7 @@ packet-beta
---
title: "TCP Packet"
---
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"
@@ -65,7 +65,7 @@ packet-beta
---
title: "TCP Packet"
---
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"
@@ -86,7 +86,7 @@ packet-beta
```
```mermaid-example
packet-beta
packet
title UDP Packet
+16: "Source Port"
+16: "Destination Port"
@@ -96,7 +96,7 @@ title UDP Packet
```
```mermaid
packet-beta
packet
title UDP Packet
+16: "Source Port"
+16: "Destination Port"
@@ -144,7 +144,7 @@ config:
packet:
startByteColor: red
---
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"

View File

View File

@@ -64,7 +64,7 @@
},
"devDependencies": {
"@applitools/eyes-cypress": "^3.44.9",
"@argos-ci/cypress": "^4.0.3",
"@argos-ci/cypress": "^5.0.2",
"@changesets/changelog-github": "^0.5.1",
"@changesets/cli": "^2.27.12",
"@cspell/eslint-plugin": "^8.19.3",
@@ -88,8 +88,8 @@
"cors": "^2.8.5",
"cpy-cli": "^5.0.0",
"cross-env": "^7.0.3",
"cspell": "^8.6.1",
"cypress": "^14.0.3",
"cspell": "^9.1.3",
"cypress": "^14.5.1",
"cypress-image-snapshot": "^4.0.1",
"cypress-split": "^1.24.14",
"esbuild": "^0.25.0",
@@ -109,25 +109,25 @@
"globals": "^16.0.0",
"globby": "^14.0.2",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest": "^30.0.4",
"jison": "^0.4.18",
"js-yaml": "^4.1.0",
"jsdom": "^26.0.0",
"langium-cli": "3.3.0",
"lint-staged": "^15.2.11",
"lint-staged": "^16.1.2",
"markdown-table": "^3.0.4",
"nyc": "^17.1.0",
"path-browserify": "^1.0.1",
"prettier": "^3.5.2",
"prettier-plugin-jsdoc": "^1.3.2",
"rimraf": "^6.0.1",
"rollup-plugin-visualizer": "^5.14.0",
"rollup-plugin-visualizer": "^6.0.3",
"start-server-and-test": "^2.0.10",
"tslib": "^2.8.1",
"tsx": "^4.7.3",
"typescript": "~5.7.3",
"typescript-eslint": "^8.32.0",
"vite": "^6.1.1",
"vite": "^7.0.3",
"vite-plugin-istanbul": "^7.0.0",
"vitest": "^3.0.6"
},

View File

@@ -11,7 +11,7 @@ export default {
code: `---
title: "TCP Packet"
---
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"

View File

@@ -82,7 +82,7 @@
"katex": "^0.16.9",
"khroma": "^2.1.0",
"lodash-es": "^4.17.21",
"marked": "^15.0.7",
"marked": "^16.0.0",
"roughjs": "^4.6.6",
"stylis": "^4.3.6",
"ts-dedent": "^2.2.0",
@@ -105,7 +105,7 @@
"@types/stylis": "^4.2.7",
"@types/uuid": "^10.0.0",
"ajv": "^8.17.1",
"chokidar": "3.6.0",
"chokidar": "^3.6.0",
"concurrently": "^9.1.2",
"csstree-validator": "^4.0.1",
"globby": "^14.0.2",

View File

@@ -287,7 +287,7 @@ const setBlock = (block: Block) => {
blockDatabase.set(block.id, block);
};
const getLogger = () => console;
const getLogger = () => log;
/**
* Return all of the style classes

View File

@@ -7,7 +7,7 @@ import type {
const id = 'packet';
const detector: DiagramDetector = (txt) => {
return /^\s*packet-beta/.test(txt);
return /^\s*packet(-beta)?/.test(txt);
};
const loader: DiagramLoader = async () => {

View File

@@ -15,8 +15,14 @@ describe('packet diagrams', () => {
expect(getPacket()).toMatchInlineSnapshot('[]');
});
it('should handle a packet definition', async () => {
const str = `packet`;
await expect(parser.parse(str)).resolves.not.toThrow();
expect(getPacket()).toMatchInlineSnapshot('[]');
});
it('should handle diagram with data and title', async () => {
const str = `packet-beta
const str = `packet
title Packet diagram
accTitle: Packet accTitle
accDescr: Packet accDescription
@@ -41,7 +47,7 @@ describe('packet diagrams', () => {
});
it('should handle single bits', async () => {
const str = `packet-beta
const str = `packet
0-10: "test"
11: "single"
`;
@@ -67,7 +73,7 @@ describe('packet diagrams', () => {
});
it('should handle bit counts', async () => {
const str = `packet-beta
const str = `packet
+8: "byte"
+16: "word"
`;
@@ -93,7 +99,7 @@ describe('packet diagrams', () => {
});
it('should handle bit counts with bit or bits', async () => {
const str = `packet-beta
const str = `packet
+8: "byte"
+16: "word"
`;
@@ -119,7 +125,7 @@ describe('packet diagrams', () => {
});
it('should split into multiple rows', async () => {
const str = `packet-beta
const str = `packet
0-10: "test"
11-90: "multiple"
`;
@@ -161,7 +167,7 @@ describe('packet diagrams', () => {
});
it('should split into multiple rows when cut at exact length', async () => {
const str = `packet-beta
const str = `packet
0-16: "test"
17-63: "multiple"
`;
@@ -195,7 +201,7 @@ describe('packet diagrams', () => {
});
it('should throw error if numbers are not continuous', async () => {
const str = `packet-beta
const str = `packet
0-16: "test"
18-20: "error"
`;
@@ -205,7 +211,7 @@ describe('packet diagrams', () => {
});
it('should throw error if numbers are not continuous with bit counts', async () => {
const str = `packet-beta
const str = `packet
+16: "test"
18-20: "error"
`;
@@ -215,7 +221,7 @@ describe('packet diagrams', () => {
});
it('should throw error if numbers are not continuous for single packets', async () => {
const str = `packet-beta
const str = `packet
0-16: "test"
18: "error"
`;
@@ -225,7 +231,7 @@ describe('packet diagrams', () => {
});
it('should throw error if numbers are not continuous for single packets with bit counts', async () => {
const str = `packet-beta
const str = `packet
+16: "test"
18: "error"
`;
@@ -235,7 +241,7 @@ describe('packet diagrams', () => {
});
it('should throw error if numbers are not continuous for single packets - 2', async () => {
const str = `packet-beta
const str = `packet
0-16: "test"
17: "good"
19: "error"
@@ -246,7 +252,7 @@ describe('packet diagrams', () => {
});
it('should throw error if end is less than start', async () => {
const str = `packet-beta
const str = `packet
0-16: "test"
25-20: "error"
`;
@@ -256,7 +262,7 @@ describe('packet diagrams', () => {
});
it('should throw error if bit count is 0', async () => {
const str = `packet-beta
const str = `packet
+0: "test"
`;
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(

View File

@@ -524,7 +524,7 @@ export const drawBox = function (elem, box, conf) {
box.name,
g,
box.x,
box.y + (box.textMaxHeight || 0) / 2,
box.y + conf.boxTextMargin + (box.textMaxHeight || 0) / 2,
box.width,
0,
{ class: 'text' },

View File

@@ -28,8 +28,7 @@ interface TimelineTask {
export const draw = function (text: string, id: string, version: string, diagObj: Diagram) {
//1. Fetch the configuration
const conf = getConfig();
// @ts-expect-error - wrong config?
const LEFT_MARGIN = conf.leftMargin ?? 50;
const LEFT_MARGIN = conf.timeline?.leftMargin ?? 50;
log.debug('timeline', diagObj.db);

View File

@@ -27,7 +27,7 @@
"@iconify-json/carbon": "^1.1.37",
"@unocss/reset": "^66.0.0",
"@vite-pwa/vitepress": "^1.0.0",
"@vitejs/plugin-vue": "^5.0.5",
"@vitejs/plugin-vue": "^6.0.0",
"fast-glob": "^3.3.3",
"https-localhost": "^4.7.1",
"pathe": "^2.0.3",

View File

@@ -11,7 +11,7 @@ This diagram type is particularly useful for developers, network engineers, educ
## Syntax
```
packet-beta
packet
start: "Block name" %% Single-bit block
start-end: "Block name" %% Multi-bit blocks
... More Fields ...
@@ -22,7 +22,7 @@ start-end: "Block name" %% Multi-bit blocks
Using start and end bit counts can be difficult, especially when modifying a design. For this we add a bit count field, which starts from the end of the previous field automagically. Use `+<count>` to set the number of bits, thus:
```
packet-beta
packet
+1: "Block name" %% Single-bit block
+8: "Block name" %% 8-bit block
9-15: "Manually set start and end, it's fine to mix and match"
@@ -35,7 +35,7 @@ packet-beta
---
title: "TCP Packet"
---
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"
@@ -56,7 +56,7 @@ packet-beta
```
```mermaid-example
packet-beta
packet
title UDP Packet
+16: "Source Port"
+16: "Destination Port"
@@ -104,7 +104,7 @@ config:
packet:
startByteColor: red
---
packet-beta
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"

View File

@@ -794,6 +794,7 @@ graph TD;A--x|text including URL space|B;`)
{ textDiagramType: 'gantt', expectedType: 'gantt' },
{ textDiagramType: 'journey', expectedType: 'journey' },
{ textDiagramType: 'pie', expectedType: 'pie' },
{ textDiagramType: 'packet', expectedType: 'packet' },
{ textDiagramType: 'packet-beta', expectedType: 'packet' },
{ textDiagramType: 'xychart-beta', expectedType: 'xychart' },
{ textDiagramType: 'requirementDiagram', expectedType: 'requirement' },

View File

@@ -3,7 +3,7 @@ import "../common/common";
entry Packet:
NEWLINE*
"packet-beta"
("packet"| "packet-beta")
(
TitleAndAccessibilities
| blocks+=PacketBlock

View File

@@ -2,6 +2,6 @@ import { AbstractMermaidTokenBuilder } from '../common/index.js';
export class PacketTokenBuilder extends AbstractMermaidTokenBuilder {
public constructor() {
super(['packet-beta']);
super(['packet']);
}
}

View File

@@ -11,6 +11,12 @@ describe('packet', () => {
`
\tpacket-beta
`,
`packet`,
` packet `,
`\tpacket\t`,
`
\tpacket
`,
])('should handle regular packet', (context: string) => {
const result = parse(context);
expectNoErrorsOrAlternatives(result);

View File

@@ -32,15 +32,10 @@ const consoleMock = vi.spyOn(console, 'log').mockImplementation(() => undefined)
* @param result - the result `parse` function.
*/
export function expectNoErrorsOrAlternatives(result: ParseResult) {
if (result.lexerErrors.length > 0) {
// console.debug(result.lexerErrors);
}
if (result.parserErrors.length > 0) {
// console.debug(result.parserErrors);
}
expect(result.lexerErrors).toHaveLength(0);
expect(result.parserErrors).toHaveLength(0);
expect.soft(result.lexerErrors).toHaveLength(0);
expect.soft(result.parserErrors).toHaveLength(0);
// To see what the error is, in the logs.
expect(result.lexerErrors[0]).toBeUndefined();
expect(consoleMock).not.toHaveBeenCalled();
consoleMock.mockReset();
}

3422
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -40,6 +40,10 @@
{
"groupName": "dompurify",
"matchPackagePatterns": ["dompurify"]
},
{
"matchPackageNames": ["chokidar"],
"enabled": false
}
],
"dependencyDashboard": false,