@eventcatalog/core 3.10.2 → 3.12.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/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-K7EPHS7S.js → chunk-G7GG3HEB.js} +1 -1
- package/dist/{chunk-DGE5ITBR.js → chunk-K44BXVHU.js} +1 -1
- package/dist/{chunk-IJKRHWWO.js → chunk-LXOS3MXQ.js} +1 -1
- package/dist/{chunk-QWSUFHCT.js → chunk-VUBZ6A7B.js} +1 -1
- package/dist/{chunk-AL67CV2N.js → chunk-WVKLG26T.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +2 -1
- package/dist/eventcatalog.js +6 -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/integrations/eventcatalog-features.ts +13 -0
- package/eventcatalog/src/components/MDX/Design/Design.astro +10 -2
- package/eventcatalog/src/components/MDX/EntityMap/EntityMap.astro +10 -2
- package/eventcatalog/src/components/MDX/Flow/Flow.astro +10 -2
- package/eventcatalog/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +13 -0
- package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeContent.tsx +294 -0
- package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeNodeActions.tsx +92 -0
- package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModePlaceholder.tsx +26 -0
- package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/utils.ts +163 -0
- package/eventcatalog/src/components/MDX/NodeGraph/FocusModeModal.tsx +99 -0
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +10 -2
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +166 -43
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Entity.tsx +4 -1
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +4 -1
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +4 -1
- package/eventcatalog/src/components/MDX/NodeGraph/VisualizerDropdownContent.tsx +91 -2
- package/eventcatalog/src/enterprise/visualizer-layout/reset.ts +45 -0
- package/eventcatalog/src/enterprise/visualizer-layout/save.ts +57 -0
- package/eventcatalog/src/layouts/Footer.astro +4 -1
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +3 -1
- package/eventcatalog/src/utils/feature.ts +2 -0
- package/eventcatalog/src/utils/node-graphs/layout-persistence.ts +81 -0
- package/eventcatalog/tailwind.config.mjs +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
export interface SavedPosition {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SavedLayout {
|
|
10
|
+
version: number;
|
|
11
|
+
savedAt: string;
|
|
12
|
+
resourceKey: string;
|
|
13
|
+
positions: Record<string, SavedPosition>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Builds a resource key for layout persistence from collection, id, and version.
|
|
18
|
+
* e.g., buildResourceKey('services', 'OrderService', '1.0.0') -> 'services/OrderService/1.0.0'
|
|
19
|
+
*/
|
|
20
|
+
export function buildResourceKey(collection: string, id: string, version?: string): string {
|
|
21
|
+
if (version) {
|
|
22
|
+
return `${collection}/${id}/${version}`;
|
|
23
|
+
}
|
|
24
|
+
return `${collection}/${id}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Converts a resource key to a file path for the saved layout
|
|
29
|
+
* e.g., services/OrderService/1.0.0 -> _data/visualizer-layouts/services/OrderService/1.0.0.json
|
|
30
|
+
* Uses path.join with spread segments for cross-platform compatibility (Windows/Mac/Linux)
|
|
31
|
+
*/
|
|
32
|
+
export function getLayoutFilePath(resourceKey: string): string {
|
|
33
|
+
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
34
|
+
const cleanKey = resourceKey.replace(/^\//, '').replace(/\/$/, '');
|
|
35
|
+
// Split path segments and rejoin with platform-specific separator
|
|
36
|
+
const segments = cleanKey.split('/').filter(Boolean);
|
|
37
|
+
const fileName = `${segments.pop()}.json`;
|
|
38
|
+
return path.join(PROJECT_DIR, '_data', 'visualizer-layouts', ...segments, fileName);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Loads saved layout from disk if it exists
|
|
43
|
+
*/
|
|
44
|
+
export async function loadSavedLayout(resourceKey: string): Promise<SavedLayout | null> {
|
|
45
|
+
const filePath = getLayoutFilePath(resourceKey);
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const content = await fs.promises.readFile(filePath, 'utf-8');
|
|
49
|
+
return JSON.parse(content) as SavedLayout;
|
|
50
|
+
} catch {
|
|
51
|
+
// File doesn't exist or parse error - return null
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Applies saved positions to nodes. Nodes with saved positions get them applied,
|
|
58
|
+
* nodes without saved positions keep their Dagre-calculated positions.
|
|
59
|
+
*/
|
|
60
|
+
export function applyLayoutToNodes<T extends { id: string; position: { x: number; y: number } }>(
|
|
61
|
+
nodes: T[],
|
|
62
|
+
savedLayout: SavedLayout | null
|
|
63
|
+
): T[];
|
|
64
|
+
export function applyLayoutToNodes(nodes: any[], savedLayout: SavedLayout | null): any[] {
|
|
65
|
+
if (!savedLayout) {
|
|
66
|
+
return nodes; // No saved layout, use original Dagre positions
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return nodes.map((node) => {
|
|
70
|
+
const savedPosition = savedLayout.positions[node.id];
|
|
71
|
+
if (savedPosition) {
|
|
72
|
+
// Use saved position
|
|
73
|
+
return {
|
|
74
|
+
...node,
|
|
75
|
+
position: { x: savedPosition.x, y: savedPosition.y },
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Keep Dagre-calculated position for new/unmatched nodes
|
|
79
|
+
return node;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -44,10 +44,20 @@ export default {
|
|
|
44
44
|
'0%': { transform: 'translateX(100%)' },
|
|
45
45
|
'100%': { transform: 'translateX(-100%)' },
|
|
46
46
|
},
|
|
47
|
+
overlayShow: {
|
|
48
|
+
from: { opacity: '0' },
|
|
49
|
+
to: { opacity: '1' },
|
|
50
|
+
},
|
|
51
|
+
contentShow: {
|
|
52
|
+
from: { opacity: '0', transform: 'scale(0.96)' },
|
|
53
|
+
to: { opacity: '1', transform: 'scale(1)' },
|
|
54
|
+
},
|
|
47
55
|
},
|
|
48
56
|
animation: {
|
|
49
57
|
'progress-bar': 'progress-bar 2s linear infinite',
|
|
50
58
|
'progress-bar-reverse': 'progress-bar-reverse 2s linear infinite',
|
|
59
|
+
overlayShow: 'overlayShow 200ms ease-out',
|
|
60
|
+
contentShow: 'contentShow 200ms ease-out',
|
|
51
61
|
},
|
|
52
62
|
},
|
|
53
63
|
},
|