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 working-directory: ./packages/mermaid
run: pnpm run docs:build 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, pull_number: prNumber,
}); });
const isSponsored = commits.some( const isSponsored = commits.every(
(c) => c.commit.author.email?.endsWith('@mermaidchart.com') (c) => c.commit.author.email?.endsWith('@mermaidchart.com')
); );

View File

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

View File

@@ -1,7 +1,7 @@
import { imgSnapshotTest } from '../../helpers/util'; import { imgSnapshotTest } from '../../helpers/util';
describe('packet structure', () => { describe('packet structure', () => {
it('should render a simple packet diagram', () => { it('should render a simple packet-beta diagram', () => {
imgSnapshotTest( imgSnapshotTest(
`packet-beta `packet-beta
title Hello world 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', () => { it('should render a simple packet diagram without ranges', () => {
imgSnapshotTest( imgSnapshotTest(
`packet-beta `packet
0: "h" 0: "h"
1: "i" 1: "i"
` `
@@ -21,7 +30,7 @@ describe('packet structure', () => {
it('should render a complex packet diagram', () => { it('should render a complex packet diagram', () => {
imgSnapshotTest( imgSnapshotTest(
`packet-beta `packet
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"
@@ -52,7 +61,7 @@ describe('packet structure', () => {
packet: packet:
showBits: false showBits: false
--- ---
packet-beta packet
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 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 href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
<link <link
rel="stylesheet" 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 <link
href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css" href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css"

View File

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

View File

@@ -17,7 +17,7 @@ This diagram type is particularly useful for developers, network engineers, educ
## Syntax ## Syntax
``` ```
packet-beta packet
start: "Block name" %% Single-bit block start: "Block name" %% Single-bit block
start-end: "Block name" %% Multi-bit blocks start-end: "Block name" %% Multi-bit blocks
... More Fields ... ... 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: 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 +1: "Block name" %% Single-bit block
+8: "Block name" %% 8-bit block +8: "Block name" %% 8-bit block
9-15: "Manually set start and end, it's fine to mix and match" 9-15: "Manually set start and end, it's fine to mix and match"
@@ -41,7 +41,7 @@ packet-beta
--- ---
title: "TCP Packet" title: "TCP Packet"
--- ---
packet-beta packet
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"
@@ -65,7 +65,7 @@ packet-beta
--- ---
title: "TCP Packet" title: "TCP Packet"
--- ---
packet-beta packet
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"
@@ -86,7 +86,7 @@ packet-beta
``` ```
```mermaid-example ```mermaid-example
packet-beta packet
title UDP Packet title UDP Packet
+16: "Source Port" +16: "Source Port"
+16: "Destination Port" +16: "Destination Port"
@@ -96,7 +96,7 @@ title UDP Packet
``` ```
```mermaid ```mermaid
packet-beta packet
title UDP Packet title UDP Packet
+16: "Source Port" +16: "Source Port"
+16: "Destination Port" +16: "Destination Port"
@@ -144,7 +144,7 @@ config:
packet: packet:
startByteColor: red startByteColor: red
--- ---
packet-beta packet
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"

View File

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -27,7 +27,7 @@
"@iconify-json/carbon": "^1.1.37", "@iconify-json/carbon": "^1.1.37",
"@unocss/reset": "^66.0.0", "@unocss/reset": "^66.0.0",
"@vite-pwa/vitepress": "^1.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", "fast-glob": "^3.3.3",
"https-localhost": "^4.7.1", "https-localhost": "^4.7.1",
"pathe": "^2.0.3", "pathe": "^2.0.3",

View File

@@ -11,7 +11,7 @@ This diagram type is particularly useful for developers, network engineers, educ
## Syntax ## Syntax
``` ```
packet-beta packet
start: "Block name" %% Single-bit block start: "Block name" %% Single-bit block
start-end: "Block name" %% Multi-bit blocks start-end: "Block name" %% Multi-bit blocks
... More Fields ... ... 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: 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 +1: "Block name" %% Single-bit block
+8: "Block name" %% 8-bit block +8: "Block name" %% 8-bit block
9-15: "Manually set start and end, it's fine to mix and match" 9-15: "Manually set start and end, it's fine to mix and match"
@@ -35,7 +35,7 @@ packet-beta
--- ---
title: "TCP Packet" title: "TCP Packet"
--- ---
packet-beta packet
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"
@@ -56,7 +56,7 @@ packet-beta
``` ```
```mermaid-example ```mermaid-example
packet-beta packet
title UDP Packet title UDP Packet
+16: "Source Port" +16: "Source Port"
+16: "Destination Port" +16: "Destination Port"
@@ -104,7 +104,7 @@ config:
packet: packet:
startByteColor: red startByteColor: red
--- ---
packet-beta packet
0-15: "Source Port" 0-15: "Source Port"
16-31: "Destination Port" 16-31: "Destination Port"
32-63: "Sequence Number" 32-63: "Sequence Number"

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,15 +32,10 @@ const consoleMock = vi.spyOn(console, 'log').mockImplementation(() => undefined)
* @param result - the result `parse` function. * @param result - the result `parse` function.
*/ */
export function expectNoErrorsOrAlternatives(result: ParseResult) { export function expectNoErrorsOrAlternatives(result: ParseResult) {
if (result.lexerErrors.length > 0) { expect.soft(result.lexerErrors).toHaveLength(0);
// console.debug(result.lexerErrors); expect.soft(result.parserErrors).toHaveLength(0);
} // To see what the error is, in the logs.
if (result.parserErrors.length > 0) { expect(result.lexerErrors[0]).toBeUndefined();
// console.debug(result.parserErrors);
}
expect(result.lexerErrors).toHaveLength(0);
expect(result.parserErrors).toHaveLength(0);
expect(consoleMock).not.toHaveBeenCalled(); expect(consoleMock).not.toHaveBeenCalled();
consoleMock.mockReset(); 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", "groupName": "dompurify",
"matchPackagePatterns": ["dompurify"] "matchPackagePatterns": ["dompurify"]
},
{
"matchPackageNames": ["chokidar"],
"enabled": false
} }
], ],
"dependencyDashboard": false, "dependencyDashboard": false,