@djangocfg/ui-nextjs 2.1.48 → 2.1.50
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-nextjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.50",
|
|
4
4
|
"description": "Next.js UI component library with Radix UI primitives, Tailwind CSS styling, charts, and form components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"check": "tsc --noEmit"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@djangocfg/api": "^2.1.
|
|
62
|
-
"@djangocfg/ui-core": "^2.1.
|
|
61
|
+
"@djangocfg/api": "^2.1.50",
|
|
62
|
+
"@djangocfg/ui-core": "^2.1.50",
|
|
63
63
|
"@types/react": "^19.1.0",
|
|
64
64
|
"@types/react-dom": "^19.1.0",
|
|
65
65
|
"consola": "^3.4.2",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"vidstack": "next"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
109
|
+
"@djangocfg/typescript-config": "^2.1.50",
|
|
110
110
|
"@types/node": "^24.7.2",
|
|
111
111
|
"eslint": "^9.37.0",
|
|
112
112
|
"tailwindcss-animate": "1.0.7",
|
|
@@ -68,8 +68,8 @@ export const MermaidFullscreenModal: React.FC<MermaidFullscreenModalProps> = ({
|
|
|
68
68
|
>
|
|
69
69
|
<div className={`relative bg-card rounded-sm shadow-xl max-h-[95vh] flex flex-col border border-border ${
|
|
70
70
|
isVertical
|
|
71
|
-
? 'w-auto max-w-[600px]'
|
|
72
|
-
: 'max-w-[90vw] w-auto'
|
|
71
|
+
? 'w-auto min-w-[400px] max-w-[600px]'
|
|
72
|
+
: 'min-w-[600px] max-w-[90vw] w-auto'
|
|
73
73
|
}`}>
|
|
74
74
|
{/* Header */}
|
|
75
75
|
<div className="flex items-center justify-between py-4 px-6 border-b border-border">
|
|
@@ -2,26 +2,72 @@
|
|
|
2
2
|
* Hook for cleaning up orphaned Mermaid DOM nodes
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { useEffect } from 'react';
|
|
5
|
+
import { useCallback, useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
export function useMermaidCleanup() {
|
|
8
|
-
const cleanupMermaidErrors = () => {
|
|
8
|
+
const cleanupMermaidErrors = useCallback(() => {
|
|
9
9
|
if (typeof document === 'undefined') return;
|
|
10
10
|
|
|
11
|
-
// Remove
|
|
11
|
+
// Remove all orphaned mermaid elements from body
|
|
12
|
+
// Mermaid can append: SVGs, divs with errors, text nodes
|
|
13
|
+
|
|
14
|
+
// 1. Remove elements with mermaid-* IDs directly in body
|
|
12
15
|
document.querySelectorAll('[id^="mermaid-"]').forEach((node) => {
|
|
13
16
|
if (node.parentNode === document.body) {
|
|
14
17
|
node.remove();
|
|
15
18
|
}
|
|
16
19
|
});
|
|
17
|
-
|
|
20
|
+
|
|
21
|
+
// 2. Remove elements with d prefix (mermaid diagram IDs) directly in body
|
|
22
|
+
document.querySelectorAll('[id^="d"]').forEach((node) => {
|
|
23
|
+
if (node.parentNode === document.body && node.id.match(/^d\d+$/)) {
|
|
24
|
+
node.remove();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// 3. Remove orphaned SVG elements that mermaid creates in body
|
|
29
|
+
document.querySelectorAll('body > svg').forEach((node) => {
|
|
30
|
+
// Check if it's a mermaid SVG (has mermaid classes or aria-roledescription)
|
|
31
|
+
if (node.getAttribute('aria-roledescription') ||
|
|
32
|
+
node.classList.contains('mermaid') ||
|
|
33
|
+
node.querySelector('.mermaid') ||
|
|
34
|
+
node.id?.includes('mermaid')) {
|
|
35
|
+
node.remove();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// 4. Remove any orphaned error divs with "Syntax error" text
|
|
40
|
+
document.querySelectorAll('body > div').forEach((node) => {
|
|
41
|
+
const text = node.textContent || '';
|
|
42
|
+
if (text.includes('Syntax error in text') ||
|
|
43
|
+
text.includes('mermaid version') ||
|
|
44
|
+
node.id?.startsWith('mermaid-') ||
|
|
45
|
+
node.id?.startsWith('d') && node.id.match(/^d\d+$/)) {
|
|
46
|
+
node.remove();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// 5. Remove orphaned pre elements with error info
|
|
51
|
+
document.querySelectorAll('body > pre').forEach((node) => {
|
|
52
|
+
const text = node.textContent || '';
|
|
53
|
+
if (text.includes('Syntax error') || text.includes('mermaid')) {
|
|
54
|
+
node.remove();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}, []);
|
|
18
58
|
|
|
19
59
|
// Cleanup on unmount
|
|
20
60
|
useEffect(() => {
|
|
21
61
|
return () => {
|
|
22
62
|
cleanupMermaidErrors();
|
|
23
63
|
};
|
|
24
|
-
}, []);
|
|
64
|
+
}, [cleanupMermaidErrors]);
|
|
65
|
+
|
|
66
|
+
// Also run cleanup periodically to catch any stray elements
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const interval = setInterval(cleanupMermaidErrors, 1000);
|
|
69
|
+
return () => clearInterval(interval);
|
|
70
|
+
}, [cleanupMermaidErrors]);
|
|
25
71
|
|
|
26
72
|
return { cleanupMermaidErrors };
|
|
27
73
|
}
|
|
@@ -129,6 +129,7 @@ export function useMermaidRenderer({ chart, theme, isCompact = false }: UseMerma
|
|
|
129
129
|
startOnLoad: false,
|
|
130
130
|
theme: 'base',
|
|
131
131
|
securityLevel: 'loose',
|
|
132
|
+
suppressErrorRendering: true, // Prevent mermaid from appending errors to body
|
|
132
133
|
fontFamily: 'Inter, system-ui, sans-serif',
|
|
133
134
|
flowchart: {
|
|
134
135
|
useMaxWidth: true,
|