Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/cold-pillows-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'mermaid': patch
---

fix: handle CSS sibling combinators in compileCSS

author: aloisklink
commit: 12d472c9ed43f94814b110da8d7a9ae6dd5266ed
12 changes: 12 additions & 0 deletions .changeset/curly-lands-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'mermaid': patch
---

fix: increase protections against prototype pollution

User-controlled input already has protections against prototype pollution.

Fixes: GHSA-c4c3-pg64-4m4v

commit: 2cd6dcf735533b323507e3e889ffdea870540b43
author: @aloisklink
11 changes: 11 additions & 0 deletions .changeset/dry-ducks-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'mermaid': patch
---

fix(architecture): use `Map`s and `Set`s to store groups/services

Services are now rendered in the order they are defined and more service IDs
are now supported.

author: aloisklink
commit: 99af3fc35ef0a9a9c8c6314521344d67523ddccf
8 changes: 8 additions & 0 deletions .changeset/proud-breads-stick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'mermaid': minor
---

deprecate: Deprecate the `mermaidAPI.setConfig()` function

commit: 2cd6dcf735533b323507e3e889ffdea870540b43
author: @aloisklink
8 changes: 8 additions & 0 deletions .changeset/solid-clubs-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'mermaid': patch
---

fix(xychart): support zero-width x-axis ranges

author: aloisklink
commit: 630aa7e5dd417e1f56bff2a1ce8df2c5ad08d289
9 changes: 9 additions & 0 deletions .changeset/wet-emus-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'mermaid': patch
---

fix(radar): limit number of ticks to 32

Setting a ticks value higher than this would only show 32 ticks.

commit: 59b22fad2b3bb04f87a476c84a8a2b24679e607e
1 change: 1 addition & 0 deletions .cspell/misc-terms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ BRANDES
browserlist
Buzan
circo
GHSA
handDrawn
KOEPF
MMLU
Expand Down
14 changes: 14 additions & 0 deletions cypress/integration/rendering/xychart/xyChart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,20 @@ describe('XY Chart', () => {
{}
);
});
it('x-axis range with same values is supported', () => {
imgSnapshotTest(
`---
title: Dirac delta function
---
xychart-beta
x-axis "Only 0 matters" 0 --> 0
line "dirac" [0, 0.5, 1]
`,
{}
);

cy.get('g.plot g.line-plot-0 path').should('exist');
});
it('Render spark line with "plotReservedSpacePercent"', () => {
imgSnapshotTest(
`
Expand Down
62 changes: 51 additions & 11 deletions demos/dev/example.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!--Do not edit this file-->
<!--Duplicate this file to any name you like, run `pnpm dev`, open http://localhost:9000/dev/name.html to view-->
<!doctype html>
<html>
<head>
<title>Mermaid development page</title>
Expand All @@ -21,36 +20,73 @@
</style>
</head>
<body>
<pre id="diagram" class="mermaid">
<div class="container">
<pre id="diagram" class="mermaid">
graph TB
a --> b
a --> c
b --> d
c --> d
</pre>
</pre>
<pre class="mermaid">info</pre>
</div>

<hr />
Type code to view diagram:
<div class="container">
<textarea name="code" id="code" cols="30" rows="10"></textarea>
<div id="dynamicDiagram"></div>
</div>
<pre class="mermaid">info</pre>

<table>
<tbody>
<tr>
<th scope="row">Error</th>
<td>
<pre><code id="errors"></code></pre>
</td>
</tr>
<tr>
<th scope="row">Render time</th>
<td>
<time id="renderTime">N/A</time>
</td>
</tr>
</tbody>
</table>

<script type="module">
import mermaid from '/mermaid.esm.mjs';
import layouts from '/mermaid-layout-elk.esm.mjs';
mermaid.registerLayoutLoaders(layouts);

function setRenderTime(start, end) {
const durationMs = end - start;
document
.getElementById('renderTime')
.setAttribute('datetime', `PT${(durationMs / 1000).toFixed(3)}s`);
document.getElementById('renderTime').innerText = new Intl.NumberFormat('en', {
style: 'unit',
unit: 'millisecond',
}).format(durationMs);
}

async function render(str) {
const { svg } = await mermaid.render('dynamic', str);
document.getElementById('dynamicDiagram').innerHTML = svg;
const start = performance.now();
try {
const { svg } = await mermaid.render('dynamic', str);
const end = performance.now();
document.getElementById('dynamicDiagram').innerHTML = svg;
document.getElementById('errors').innerText = 'No errors';
setRenderTime(start, end);
} catch (err) {
const end = performance.now();
document.getElementById('errors').innerText = err;
setRenderTime(start, end);
}
}
const storeKey = window.location.pathname;
const code = localStorage.getItem(storeKey);
if (code) {
document.getElementById('code').value = code;
await render(code);
}
mermaid.initialize({
startOnLoad: true,
logLevel: 0,
Expand All @@ -60,6 +96,10 @@
localStorage.setItem(storeKey, value);
await render(value);
});
if (code) {
document.getElementById('code').value = code;
await render(code);
}
</script>

<script src="/dev/reload.js"></script>
Expand Down
3 changes: 1 addition & 2 deletions docs/config/setup/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
- [reset](functions/reset.md)
- [sanitize](functions/sanitize.md)
- [saveConfigFromInitialize](functions/saveConfigFromInitialize.md)
- [setConfig](functions/setConfig.md)
- [~~setConfig~~](functions/setConfig.md)
- [setSiteConfig](functions/setSiteConfig.md)
- [updateCurrentConfig](functions/updateCurrentConfig.md)
- [updateSiteConfig](functions/updateSiteConfig.md)
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/addDirective.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **addDirective**(`directive`): `void`
Defined in: [packages/mermaid/src/config.ts:197](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L197)
Defined in: [packages/mermaid/src/config.ts:173](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L173)

Pushes in a directive to the configuration

Expand Down
15 changes: 7 additions & 8 deletions docs/config/setup/config/functions/getConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@

> **getConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
Defined in: [packages/mermaid/src/config.ts:140](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L140)
Defined in: [packages/mermaid/src/config.ts:120](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L120)

## getConfig

| Function | Description | Type | Return Values |
| --------- | ------------------------- | ----------- | ------------------------------ |
| getConfig | Obtains the currentConfig | Get Request | Any Values from current Config |

**Notes**: Avoid calling this function repeatedly. Instead, store the result in a variable and use it, and pass it down to function calls.
Returns a copy of the `currentConfig`.

## Returns

[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

The currentConfig

## Remarks

Avoid calling this function repeatedly.
Instead, store the result in a variable and use it, and pass it down to function calls.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **getEffectiveHtmlLabels**(`config`): `boolean`
Defined in: [packages/mermaid/src/config.ts:282](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L282)
Defined in: [packages/mermaid/src/config.ts:246](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L246)

Helper function to handle deprecated flowchart.htmlLabels

Expand Down
10 changes: 2 additions & 8 deletions docs/config/setup/config/functions/getSiteConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@

> **getSiteConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
Defined in: [packages/mermaid/src/config.ts:105](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L105)
Defined in: [packages/mermaid/src/config.ts:94](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L94)

## getSiteConfig

| Function | Description | Type | Values |
| ------------- | ------------------------------------------------- | ----------- | -------------------------------- |
| setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig |

**Notes**: Returns **any** values in siteConfig.
Returns a copy of the current `siteConfig` base configuration.

## Returns

Expand Down
2 changes: 1 addition & 1 deletion docs/config/setup/config/functions/getUserDefinedConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **getUserDefinedConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
Defined in: [packages/mermaid/src/config.ts:263](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L263)
Defined in: [packages/mermaid/src/config.ts:227](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L227)

## Returns

Expand Down
20 changes: 4 additions & 16 deletions docs/config/setup/config/functions/reset.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,18 @@

> **reset**(`config`): `void`
Defined in: [packages/mermaid/src/config.ts:230](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L230)
Defined in: [packages/mermaid/src/config.ts:194](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L194)

## reset

| Function | Description | Type | Required | Values |
| -------- | ---------------------------- | ----------- | -------- | ------ |
| reset | Resets currentConfig to conf | Put Request | Required | None |

## conf

| Parameter | Description | Type | Required | Values |
| --------- | -------------------------------------------------------------- | ---------- | -------- | -------------------------------------------- |
| conf | base set of values, which currentConfig could be **reset** to. | Dictionary | Required | Any Values, with respect to the secure Array |

**Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`)
Resets the current config and applied directives to the provided config.

## Parameters

### config

[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md) = `siteConfig`

base set of values, which currentConfig could be **reset** to.
Defaults to the current siteConfig (e.g returned by [getSiteConfig](getSiteConfig.md)).
the value to reset the `currentConfig` to.
Defaults to the current `siteConfig` (e.g the value returned by [getSiteConfig](getSiteConfig.md)).

## Returns

Expand Down
17 changes: 7 additions & 10 deletions docs/config/setup/config/functions/sanitize.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,22 @@

> **sanitize**(`options`): `void`
Defined in: [packages/mermaid/src/config.ts:155](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L155)
Defined in: [packages/mermaid/src/config.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L131)

## sanitize

| Function | Description | Type | Values |
| -------- | -------------------------------------- | ----------- | ------ |
| sanitize | Sets the siteConfig to desired values. | Put Request | None |

Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies
options in-place
Ensures options parameter does not attempt to override `siteConfig` secure keys.

## Parameters

### options

`any`

The potential setConfig parameter
The potential `setConfig` parameter

## Returns

`void`

## Remarks

Modifies options in-place.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

> **saveConfigFromInitialize**(`conf`): `void`
Defined in: [packages/mermaid/src/config.ts:84](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L84)
Defined in: [packages/mermaid/src/config.ts:78](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L78)

## Parameters

Expand Down
19 changes: 8 additions & 11 deletions docs/config/setup/config/functions/setConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,13 @@

---

# Function: setConfig()
# ~~Function: setConfig()~~

> **setConfig**(`conf`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
Defined in: [packages/mermaid/src/config.ts:122](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L122)
Defined in: [packages/mermaid/src/config.ts:106](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L106)

## setConfig

| Function | Description | Type | Values |
| ------------- | ------------------------------------- | ----------- | --------------------------------------- |
| setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |

**Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure
keys. Any values found in conf with key found in siteConfig.secure will be replaced with the
corresponding siteConfig value.
Updates the `currentConfig` with the provided `conf` after sanitization.

## Parameters

Expand All @@ -37,3 +29,8 @@ The potential currentConfig
[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)

The currentConfig merged with the sanitized conf

## Deprecated

Any changes to the `currentConfig` would be overwritten by the
next call to [addDirective](addDirective.md) or [reset](reset.md).
Loading
Loading