src/Mocha/src/mocha-visualizer/README.md
Reusable topology visualization component for messaging systems.
npm install @chillicream/mocha-visualizer
This library requires the following peer dependencies:
npm install react react-dom @xyflow/react elkjs @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome
import { TopologyFlow, type DiagramData } from "@chillicream/mocha-visualizer";
function App() {
const data: DiagramData = {
services: [
/* ... */
],
transports: [
/* ... */
],
};
return (
<div style={{ width: "100vw", height: "100vh" }}>
<TopologyFlow data={data} />
</div>
);
}
import { TopologyFlow } from "@chillicream/mocha-visualizer";
import topologyData from "./topology.json";
<div style={{ height: "800px" }}>
<TopologyFlow data={topologyData} />
</div>
TopologyFlow - Main visualization componentDetailPanel - Node detail popupSagaStateMachine - State machine visualizationCompactNode, SimpleRouteNode, SimpleGroupLabel, SimpleSectionLabel - Node typesSmartSmoothStepEdge - Custom edge with pathfindingDiagramData - Root data structureService, Transport, Consumer, Saga, MessageType, etc.diagramToFlow - Transform DiagramData to React Flow nodes/edgeslayoutTopologyWithElk - ELK-based automatic layoutassignEdgeBundles - Metro-style edge bundlingfindSmartPath, generateSmoothStepPath - Pathfinding utilitiesStyles are automatically included when you import the library. The library uses CSS custom properties for theming with a GitHub Dark theme by default.