@eventcatalog/core 3.12.8 → 3.13.0-beta.1
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/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-DINAMVEI.js → chunk-7RCUF3VG.js} +1 -1
- package/dist/{chunk-GOLMKUV3.js → chunk-AY2OEUWV.js} +1 -1
- package/dist/{chunk-6MBAYHHT.js → chunk-NXATPLVB.js} +1 -1
- package/dist/{chunk-JUWMXGCI.js → chunk-V3GX7FC3.js} +1 -1
- package/dist/{chunk-ROHEB5DM.js → chunk-VXTATPGX.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/components/MDX/Design/Design.astro +2 -2
- package/eventcatalog/src/components/MDX/EntityMap/EntityMap.astro +2 -2
- package/eventcatalog/src/components/MDX/File.tsx +7 -7
- package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -2
- package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +104 -0
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +2 -2
- package/eventcatalog/src/components/MDX/NodeGraph/README.md +85 -0
- package/eventcatalog/src/components/MDX/Schema.astro +3 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +2 -2
- package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -2
- package/eventcatalog/src/utils/collections/channels.ts +1 -26
- package/eventcatalog/src/utils/collections/commands.ts +1 -26
- package/eventcatalog/src/utils/collections/containers.ts +1 -32
- package/eventcatalog/src/utils/collections/data-products.ts +1 -19
- package/eventcatalog/src/utils/collections/diagrams.ts +0 -7
- package/eventcatalog/src/utils/collections/domains.ts +0 -18
- package/eventcatalog/src/utils/collections/entities.ts +1 -27
- package/eventcatalog/src/utils/collections/events.ts +1 -22
- package/eventcatalog/src/utils/collections/flows.ts +0 -8
- package/eventcatalog/src/utils/collections/queries.ts +1 -22
- package/eventcatalog/src/utils/collections/schemas.ts +9 -4
- package/eventcatalog/src/utils/collections/services.ts +0 -20
- package/eventcatalog/src/utils/collections/teams.ts +0 -6
- package/eventcatalog/src/utils/collections/users.ts +0 -6
- package/eventcatalog/src/utils/collections/util.ts +10 -1
- package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +66 -17
- package/eventcatalog/src/utils/node-graphs/data-products-node-graph.ts +14 -5
- package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +1 -1
- package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +133 -18
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +36 -14
- package/eventcatalog/src/utils/node-graphs/utils/utils.ts +115 -4
- package/package.json +4 -4
- package/eventcatalog/src/components/MDX/NodeGraph/DownloadButton.tsx +0 -62
- package/eventcatalog/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +0 -110
- package/eventcatalog/src/components/MDX/NodeGraph/Edges/FlowEdge.tsx +0 -96
- package/eventcatalog/src/components/MDX/NodeGraph/Edges/MultilineEdgeLabel.tsx +0 -52
- package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeContent.tsx +0 -294
- package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeNodeActions.tsx +0 -92
- package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModePlaceholder.tsx +0 -26
- package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/utils.ts +0 -163
- package/eventcatalog/src/components/MDX/NodeGraph/FocusModeModal.tsx +0 -99
- package/eventcatalog/src/components/MDX/NodeGraph/MermaidView.tsx +0 -242
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +0 -1181
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Actor.tsx +0 -46
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +0 -55
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +0 -27
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Custom.tsx +0 -159
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Data.tsx +0 -63
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/DataProduct.tsx +0 -132
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Domain.tsx +0 -155
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Entity.tsx +0 -154
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +0 -29
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +0 -79
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem2.tsx +0 -24
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Flow.tsx +0 -107
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +0 -63
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +0 -28
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +0 -127
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Step.tsx +0 -64
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/User.tsx +0 -76
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/View.tsx +0 -24
- package/eventcatalog/src/components/MDX/NodeGraph/StepWalkthrough.tsx +0 -296
- package/eventcatalog/src/components/MDX/NodeGraph/StudioModal.tsx +0 -129
- package/eventcatalog/src/components/MDX/NodeGraph/VisualiserSearch.tsx +0 -258
- package/eventcatalog/src/components/MDX/NodeGraph/VisualizerDropdownContent.tsx +0 -313
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
|
-
import { CheckIcon, ClipboardIcon } from 'lucide-react';
|
|
3
|
-
import type { Node, Edge } from '@xyflow/react';
|
|
4
|
-
import { convertToMermaid } from '@utils/node-graphs/export-mermaid';
|
|
5
|
-
import { copyToClipboard } from '@utils/clipboard';
|
|
6
|
-
|
|
7
|
-
interface MermaidViewProps {
|
|
8
|
-
nodes: Node[];
|
|
9
|
-
edges: Edge[];
|
|
10
|
-
maxTextSize?: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const MermaidView = ({ nodes, edges, maxTextSize = 100000 }: MermaidViewProps) => {
|
|
14
|
-
const [copySuccess, setCopySuccess] = useState(false);
|
|
15
|
-
const [mermaidCode, setMermaidCode] = useState('');
|
|
16
|
-
const [previewSvg, setPreviewSvg] = useState<string | null>(null);
|
|
17
|
-
const [previewError, setPreviewError] = useState<string | null>(null);
|
|
18
|
-
const [isRendering, setIsRendering] = useState(true);
|
|
19
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
20
|
-
const svgContainerRef = useRef<HTMLDivElement>(null);
|
|
21
|
-
const panZoomInstanceRef = useRef<any>(null);
|
|
22
|
-
|
|
23
|
-
// Generate mermaid code
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const code = convertToMermaid(nodes, edges, { includeStyles: true, direction: 'LR' });
|
|
26
|
-
setMermaidCode(code);
|
|
27
|
-
}, [nodes, edges]);
|
|
28
|
-
|
|
29
|
-
// Render mermaid preview
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (!mermaidCode) return;
|
|
32
|
-
|
|
33
|
-
let cancelled = false;
|
|
34
|
-
setIsRendering(true);
|
|
35
|
-
setPreviewError(null);
|
|
36
|
-
|
|
37
|
-
const renderMermaid = async () => {
|
|
38
|
-
try {
|
|
39
|
-
const { default: mermaid } = await import('mermaid');
|
|
40
|
-
|
|
41
|
-
// Detect current theme
|
|
42
|
-
const isDarkMode = document.documentElement.getAttribute('data-theme') === 'dark';
|
|
43
|
-
const currentTheme = isDarkMode ? 'dark' : 'default';
|
|
44
|
-
|
|
45
|
-
mermaid.initialize({
|
|
46
|
-
maxTextSize: maxTextSize,
|
|
47
|
-
startOnLoad: false,
|
|
48
|
-
theme: currentTheme,
|
|
49
|
-
flowchart: {
|
|
50
|
-
curve: 'basis',
|
|
51
|
-
padding: 20,
|
|
52
|
-
},
|
|
53
|
-
securityLevel: 'loose',
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const id = 'mermaid-view-' + Math.random().toString(36).substring(2, 9);
|
|
57
|
-
const { svg } = await mermaid.render(id, mermaidCode);
|
|
58
|
-
|
|
59
|
-
if (!cancelled) {
|
|
60
|
-
setPreviewSvg(svg);
|
|
61
|
-
setPreviewError(null);
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
if (!cancelled) {
|
|
65
|
-
console.error('Mermaid render error:', error);
|
|
66
|
-
setPreviewError(error instanceof Error ? error.message : 'Failed to render diagram');
|
|
67
|
-
setPreviewSvg(null);
|
|
68
|
-
}
|
|
69
|
-
} finally {
|
|
70
|
-
if (!cancelled) {
|
|
71
|
-
setIsRendering(false);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
renderMermaid();
|
|
77
|
-
|
|
78
|
-
return () => {
|
|
79
|
-
cancelled = true;
|
|
80
|
-
};
|
|
81
|
-
}, [mermaidCode]);
|
|
82
|
-
|
|
83
|
-
// Initialize pan/zoom after SVG is rendered
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
if (!previewSvg || !svgContainerRef.current) return;
|
|
86
|
-
|
|
87
|
-
const initZoom = async () => {
|
|
88
|
-
const svgElement = svgContainerRef.current?.querySelector('svg');
|
|
89
|
-
if (!svgElement) return;
|
|
90
|
-
|
|
91
|
-
try {
|
|
92
|
-
const { default: svgPanZoom } = await import('svg-pan-zoom');
|
|
93
|
-
|
|
94
|
-
// Set SVG to fill container
|
|
95
|
-
svgElement.style.width = '100%';
|
|
96
|
-
svgElement.style.height = '100%';
|
|
97
|
-
svgElement.removeAttribute('height');
|
|
98
|
-
svgElement.removeAttribute('width');
|
|
99
|
-
|
|
100
|
-
const instance = svgPanZoom(svgElement, {
|
|
101
|
-
zoomEnabled: true,
|
|
102
|
-
controlIconsEnabled: false,
|
|
103
|
-
fit: true,
|
|
104
|
-
center: true,
|
|
105
|
-
minZoom: 0.1,
|
|
106
|
-
maxZoom: 10,
|
|
107
|
-
zoomScaleSensitivity: 0.15,
|
|
108
|
-
dblClickZoomEnabled: true,
|
|
109
|
-
mouseWheelZoomEnabled: true,
|
|
110
|
-
panEnabled: true,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
panZoomInstanceRef.current = instance;
|
|
114
|
-
} catch (e) {
|
|
115
|
-
console.warn('Failed to initialize zoom:', e);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
initZoom();
|
|
120
|
-
|
|
121
|
-
return () => {
|
|
122
|
-
if (panZoomInstanceRef.current) {
|
|
123
|
-
try {
|
|
124
|
-
panZoomInstanceRef.current.destroy();
|
|
125
|
-
} catch (e) {
|
|
126
|
-
// Ignore
|
|
127
|
-
}
|
|
128
|
-
panZoomInstanceRef.current = null;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}, [previewSvg]);
|
|
132
|
-
|
|
133
|
-
const handleCopyToClipboard = useCallback(async () => {
|
|
134
|
-
await copyToClipboard(mermaidCode);
|
|
135
|
-
setCopySuccess(true);
|
|
136
|
-
setTimeout(() => setCopySuccess(false), 2000);
|
|
137
|
-
}, [mermaidCode]);
|
|
138
|
-
|
|
139
|
-
return (
|
|
140
|
-
<div
|
|
141
|
-
ref={containerRef}
|
|
142
|
-
className="w-full h-full bg-[rgb(var(--ec-page-bg))] relative flex flex-col"
|
|
143
|
-
style={{ animation: 'fadeIn 200ms ease-out' }}
|
|
144
|
-
>
|
|
145
|
-
<style>{`
|
|
146
|
-
@keyframes fadeIn {
|
|
147
|
-
from { opacity: 0; }
|
|
148
|
-
to { opacity: 1; }
|
|
149
|
-
}
|
|
150
|
-
`}</style>
|
|
151
|
-
|
|
152
|
-
{/* Copy button - top right */}
|
|
153
|
-
<div className="absolute top-[10px] right-4 z-20">
|
|
154
|
-
<div className="relative group">
|
|
155
|
-
<button
|
|
156
|
-
onClick={handleCopyToClipboard}
|
|
157
|
-
className={`p-2.5 rounded-md shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[rgb(var(--ec-accent))] transition-all duration-150 ${
|
|
158
|
-
copySuccess
|
|
159
|
-
? 'bg-green-500 text-white scale-110'
|
|
160
|
-
: 'bg-[rgb(var(--ec-card-bg))] hover:bg-[rgb(var(--ec-page-border))/0.5] text-[rgb(var(--ec-icon-color))] hover:scale-105'
|
|
161
|
-
}`}
|
|
162
|
-
aria-label={copySuccess ? 'Copied!' : 'Copy Mermaid code'}
|
|
163
|
-
>
|
|
164
|
-
{copySuccess ? <CheckIcon className="h-5 w-5" /> : <ClipboardIcon className="h-5 w-5" />}
|
|
165
|
-
</button>
|
|
166
|
-
<div className="absolute top-full right-0 mt-2 px-2 py-1 bg-[rgb(var(--ec-page-text))] text-[rgb(var(--ec-page-bg))] text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-50">
|
|
167
|
-
{copySuccess ? 'Copied!' : 'Copy Mermaid code'}
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
|
|
172
|
-
{/* Mermaid diagram container */}
|
|
173
|
-
<div className="flex-1 overflow-hidden">
|
|
174
|
-
{isRendering && (
|
|
175
|
-
<div className="w-full h-full flex items-center justify-center">
|
|
176
|
-
<div className="relative">
|
|
177
|
-
<div className="flex items-center gap-4 opacity-40">
|
|
178
|
-
<div className="w-24 h-10 bg-[rgb(var(--ec-page-border))] rounded animate-pulse" />
|
|
179
|
-
<div className="w-12 h-0.5 bg-[rgb(var(--ec-page-border))] animate-pulse" />
|
|
180
|
-
<div
|
|
181
|
-
className="w-20 h-10 bg-[rgb(var(--ec-page-border))] rounded-full animate-pulse"
|
|
182
|
-
style={{ animationDelay: '75ms' }}
|
|
183
|
-
/>
|
|
184
|
-
<div className="w-12 h-0.5 bg-[rgb(var(--ec-page-border))] animate-pulse" style={{ animationDelay: '150ms' }} />
|
|
185
|
-
<div
|
|
186
|
-
className="w-24 h-10 bg-[rgb(var(--ec-page-border))] rounded animate-pulse"
|
|
187
|
-
style={{ animationDelay: '225ms' }}
|
|
188
|
-
/>
|
|
189
|
-
</div>
|
|
190
|
-
<p className="text-center text-sm text-[rgb(var(--ec-page-text-muted))] mt-4">Rendering diagram...</p>
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
)}
|
|
194
|
-
|
|
195
|
-
{previewError && !isRendering && (
|
|
196
|
-
<div className="w-full h-full flex flex-col items-center justify-center p-4">
|
|
197
|
-
<div className="text-red-500 text-sm mb-2">Failed to render diagram</div>
|
|
198
|
-
<div className="text-[rgb(var(--ec-page-text-muted))] text-xs font-mono bg-[rgb(var(--ec-code-bg))] p-2 rounded max-w-lg overflow-auto">
|
|
199
|
-
{previewError}
|
|
200
|
-
</div>
|
|
201
|
-
<div className="mt-4 text-sm text-[rgb(var(--ec-page-text-muted))]">
|
|
202
|
-
<p>You can still copy the Mermaid code and paste it into</p>
|
|
203
|
-
<a
|
|
204
|
-
href="https://mermaid.live"
|
|
205
|
-
target="_blank"
|
|
206
|
-
rel="noopener noreferrer"
|
|
207
|
-
className="text-[rgb(var(--ec-accent))] hover:underline"
|
|
208
|
-
>
|
|
209
|
-
mermaid.live
|
|
210
|
-
</a>
|
|
211
|
-
</div>
|
|
212
|
-
</div>
|
|
213
|
-
)}
|
|
214
|
-
|
|
215
|
-
{previewSvg && !isRendering && !previewError && (
|
|
216
|
-
<div
|
|
217
|
-
ref={svgContainerRef}
|
|
218
|
-
className="w-full h-full cursor-grab active:cursor-grabbing [&_svg]:w-full [&_svg]:h-full"
|
|
219
|
-
dangerouslySetInnerHTML={{ __html: previewSvg }}
|
|
220
|
-
/>
|
|
221
|
-
)}
|
|
222
|
-
</div>
|
|
223
|
-
|
|
224
|
-
{/* Footer hint */}
|
|
225
|
-
<div className="absolute bottom-4 left-4 z-20">
|
|
226
|
-
<div className="flex items-center gap-2 bg-[rgb(var(--ec-card-bg))]/90 backdrop-blur-sm px-3 py-1.5 rounded-md shadow-sm border border-[rgb(var(--ec-page-border))]">
|
|
227
|
-
<svg className="w-3.5 h-3.5 text-[rgb(var(--ec-icon-color))]" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
228
|
-
<path
|
|
229
|
-
strokeLinecap="round"
|
|
230
|
-
strokeLinejoin="round"
|
|
231
|
-
strokeWidth={2}
|
|
232
|
-
d="M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"
|
|
233
|
-
/>
|
|
234
|
-
</svg>
|
|
235
|
-
<span className="text-xs text-[rgb(var(--ec-page-text-muted))]">Scroll to zoom · Drag to pan</span>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
</div>
|
|
239
|
-
);
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
export default MermaidView;
|