@docusaurus/theme-mermaid 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client/index.js +4 -2
- package/package.json +8 -8
- package/src/client/index.ts +6 -2
package/lib/client/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { useState, useEffect, useMemo
|
|
7
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
8
8
|
import { useColorMode, useThemeConfig } from '@docusaurus/theme-common';
|
|
9
9
|
import mermaid from 'mermaid';
|
|
10
10
|
// Stable className to allow users to easily target with CSS
|
|
@@ -24,8 +24,10 @@ function useMermaidId() {
|
|
|
24
24
|
Random client-only id, we don't care much but mermaid want an id so...
|
|
25
25
|
Note: Mermaid doesn't like values provided by Rect.useId() and throws
|
|
26
26
|
*/
|
|
27
|
+
// TODO 2025-2026: check if useId() now works
|
|
28
|
+
// It could work thanks to https://github.com/facebook/react/pull/32001
|
|
27
29
|
// return useId(); // tried that, doesn't work ('#d:re:' is not a valid selector.)
|
|
28
|
-
return
|
|
30
|
+
return useState(`mermaid-svg-${Math.round(Math.random() * 10000000)}`)[0];
|
|
29
31
|
}
|
|
30
32
|
async function renderMermaid({ id, text, config, }) {
|
|
31
33
|
/*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-mermaid",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Mermaid components for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-mermaid.d.ts",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@docusaurus/core": "3.
|
|
37
|
-
"@docusaurus/module-type-aliases": "3.
|
|
38
|
-
"@docusaurus/theme-common": "3.
|
|
39
|
-
"@docusaurus/types": "3.
|
|
40
|
-
"@docusaurus/utils-validation": "3.
|
|
41
|
-
"mermaid": ">=
|
|
36
|
+
"@docusaurus/core": "3.8.0",
|
|
37
|
+
"@docusaurus/module-type-aliases": "3.8.0",
|
|
38
|
+
"@docusaurus/theme-common": "3.8.0",
|
|
39
|
+
"@docusaurus/types": "3.8.0",
|
|
40
|
+
"@docusaurus/utils-validation": "3.8.0",
|
|
41
|
+
"mermaid": ">=11.6.0",
|
|
42
42
|
"tslib": "^2.6.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=18.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "948d63c42fad0ba24b7b531a9deb6167e64dc845"
|
|
55
55
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {useState, useEffect, useMemo
|
|
8
|
+
import {useState, useEffect, useMemo} from 'react';
|
|
9
9
|
import {useColorMode, useThemeConfig} from '@docusaurus/theme-common';
|
|
10
10
|
import mermaid from 'mermaid';
|
|
11
11
|
import type {RenderResult, MermaidConfig} from 'mermaid';
|
|
@@ -36,8 +36,12 @@ function useMermaidId(): string {
|
|
|
36
36
|
Random client-only id, we don't care much but mermaid want an id so...
|
|
37
37
|
Note: Mermaid doesn't like values provided by Rect.useId() and throws
|
|
38
38
|
*/
|
|
39
|
+
|
|
40
|
+
// TODO 2025-2026: check if useId() now works
|
|
41
|
+
// It could work thanks to https://github.com/facebook/react/pull/32001
|
|
39
42
|
// return useId(); // tried that, doesn't work ('#d:re:' is not a valid selector.)
|
|
40
|
-
|
|
43
|
+
|
|
44
|
+
return useState(`mermaid-svg-${Math.round(Math.random() * 10000000)}`)[0];
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
async function renderMermaid({
|