@eventcatalog/visualiser 5.0.0-beta.1 → 5.0.0-beta.2
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/index.js +201 -160
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -113,9 +113,9 @@ __export(index_exports, {
|
|
|
113
113
|
module.exports = __toCommonJS(index_exports);
|
|
114
114
|
|
|
115
115
|
// src/components/NodeGraph.tsx
|
|
116
|
-
var
|
|
116
|
+
var import_react104 = require("react");
|
|
117
117
|
var import_react_dom = require("react-dom");
|
|
118
|
-
var
|
|
118
|
+
var import_react105 = require("@xyflow/react");
|
|
119
119
|
var import_lucide_react42 = require("lucide-react");
|
|
120
120
|
var DropdownMenu3 = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
121
121
|
var import_html_to_image = require("html-to-image");
|
|
@@ -1085,10 +1085,13 @@ function TruncatedResourceName({
|
|
|
1085
1085
|
const updateTruncation = () => {
|
|
1086
1086
|
setIsTruncated(element.scrollWidth > element.clientWidth);
|
|
1087
1087
|
};
|
|
1088
|
-
updateTruncation();
|
|
1089
1088
|
if (typeof ResizeObserver === "undefined") {
|
|
1089
|
+
const frame = requestAnimationFrame(updateTruncation);
|
|
1090
1090
|
window.addEventListener("resize", updateTruncation);
|
|
1091
|
-
return () =>
|
|
1091
|
+
return () => {
|
|
1092
|
+
cancelAnimationFrame(frame);
|
|
1093
|
+
window.removeEventListener("resize", updateTruncation);
|
|
1094
|
+
};
|
|
1092
1095
|
}
|
|
1093
1096
|
const observer = new ResizeObserver(updateTruncation);
|
|
1094
1097
|
observer.observe(element);
|
|
@@ -11240,6 +11243,7 @@ var animateLayout = ({
|
|
|
11240
11243
|
toEdges,
|
|
11241
11244
|
setNodes,
|
|
11242
11245
|
setEdges,
|
|
11246
|
+
getCurrentNodes,
|
|
11243
11247
|
morphs = [],
|
|
11244
11248
|
nodeOrigin = [0, 0],
|
|
11245
11249
|
onDone
|
|
@@ -11309,7 +11313,18 @@ var animateLayout = ({
|
|
|
11309
11313
|
);
|
|
11310
11314
|
return [...nodes, ...exitingNodes];
|
|
11311
11315
|
};
|
|
11312
|
-
|
|
11316
|
+
const setNodesKeepingSize = (nodes) => {
|
|
11317
|
+
const measured = new Map(
|
|
11318
|
+
getCurrentNodes().map((node) => [node.id, node.measured])
|
|
11319
|
+
);
|
|
11320
|
+
setNodes(
|
|
11321
|
+
nodes.map((node) => {
|
|
11322
|
+
const measuredSize = measured.get(node.id);
|
|
11323
|
+
return measuredSize ? { ...node, measured: measuredSize } : node;
|
|
11324
|
+
})
|
|
11325
|
+
);
|
|
11326
|
+
};
|
|
11327
|
+
setNodesKeepingSize(frame(0));
|
|
11313
11328
|
setEdges([
|
|
11314
11329
|
...toEdges.map(
|
|
11315
11330
|
(edge) => fromEdgeIds.has(edge.id) ? edge : { ...edge, className: "ec-enter" }
|
|
@@ -11320,11 +11335,11 @@ var animateLayout = ({
|
|
|
11320
11335
|
let animationFrame = requestAnimationFrame(function tick(now) {
|
|
11321
11336
|
const t = Math.min(1, (now - start) / LAYOUT_ANIMATION_DURATION);
|
|
11322
11337
|
if (t < 1) {
|
|
11323
|
-
|
|
11338
|
+
setNodesKeepingSize(frame(easeInOut(t)));
|
|
11324
11339
|
animationFrame = requestAnimationFrame(tick);
|
|
11325
11340
|
return;
|
|
11326
11341
|
}
|
|
11327
|
-
|
|
11342
|
+
setNodesKeepingSize(toNodes);
|
|
11328
11343
|
setEdges(
|
|
11329
11344
|
(edges) => edges.filter((edge) => toEdgeIds.has(edge.id)).map(
|
|
11330
11345
|
(edge) => edge.className === "ec-enter" ? { ...edge, className: void 0 } : edge
|
|
@@ -11555,6 +11570,7 @@ var useNodeVisibility = ({
|
|
|
11555
11570
|
toEdges: target.edges,
|
|
11556
11571
|
setNodes,
|
|
11557
11572
|
setEdges,
|
|
11573
|
+
getCurrentNodes: () => nodesRef.current,
|
|
11558
11574
|
// When switching graphs, systems expand into their group (or back), e.g.
|
|
11559
11575
|
// a system in its context diagram
|
|
11560
11576
|
morphs: from ? getSystemMorphs(from.nodes, target.nodes) : [],
|
|
@@ -12043,8 +12059,25 @@ var NodeContextMenu_default = (0, import_react98.memo)(function NodeContextMenu(
|
|
|
12043
12059
|
] });
|
|
12044
12060
|
});
|
|
12045
12061
|
|
|
12062
|
+
// src/utils/node-memo.ts
|
|
12063
|
+
var import_react99 = require("react");
|
|
12064
|
+
var POSITION_PROPS = /* @__PURE__ */ new Set(["positionAbsoluteX", "positionAbsoluteY"]);
|
|
12065
|
+
var equalExceptPosition = (previous, next) => {
|
|
12066
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(previous), ...Object.keys(next)]);
|
|
12067
|
+
for (const key of keys) {
|
|
12068
|
+
if (POSITION_PROPS.has(key)) continue;
|
|
12069
|
+
if (!Object.is(
|
|
12070
|
+
previous[key],
|
|
12071
|
+
next[key]
|
|
12072
|
+
))
|
|
12073
|
+
return false;
|
|
12074
|
+
}
|
|
12075
|
+
return true;
|
|
12076
|
+
};
|
|
12077
|
+
var memoNode = (Component) => (0, import_react99.memo)(Component, equalExceptPosition);
|
|
12078
|
+
|
|
12046
12079
|
// src/utils/export-image.ts
|
|
12047
|
-
var
|
|
12080
|
+
var import_react100 = require("@xyflow/react");
|
|
12048
12081
|
var MIN_IMAGE_WIDTH = 1024;
|
|
12049
12082
|
var MIN_IMAGE_HEIGHT = 768;
|
|
12050
12083
|
var EXPORT_PADDING = 40;
|
|
@@ -12057,7 +12090,7 @@ function getExportImageDimensions(nodesBounds) {
|
|
|
12057
12090
|
};
|
|
12058
12091
|
const width = Math.max(MIN_IMAGE_WIDTH, Math.ceil(paddedBounds.width));
|
|
12059
12092
|
const height = Math.max(MIN_IMAGE_HEIGHT, Math.ceil(paddedBounds.height));
|
|
12060
|
-
const viewport = (0,
|
|
12093
|
+
const viewport = (0, import_react100.getViewportForBounds)(paddedBounds, width, height, 0.5, 2, 0);
|
|
12061
12094
|
return { width, height, viewport };
|
|
12062
12095
|
}
|
|
12063
12096
|
function extractEcVarNames(cssText) {
|
|
@@ -12144,7 +12177,7 @@ function injectExportStyles(viewport) {
|
|
|
12144
12177
|
}
|
|
12145
12178
|
|
|
12146
12179
|
// src/utils/layout.ts
|
|
12147
|
-
var
|
|
12180
|
+
var import_react101 = require("@xyflow/react");
|
|
12148
12181
|
var EMPTY_GROUP_WIDTH = 200;
|
|
12149
12182
|
var EMPTY_GROUP_HEIGHT = 80;
|
|
12150
12183
|
var defaultSizes = {
|
|
@@ -12334,7 +12367,7 @@ async function layoutGraph(nodes, edges, { style } = {}) {
|
|
|
12334
12367
|
const isCalls = edge.type === "calls";
|
|
12335
12368
|
const isBidirectional = edge.type === "reads-writes";
|
|
12336
12369
|
const arrowMarker = {
|
|
12337
|
-
type:
|
|
12370
|
+
type: import_react101.MarkerType.ArrowClosed,
|
|
12338
12371
|
width: 20,
|
|
12339
12372
|
height: 20,
|
|
12340
12373
|
color: "rgb(var(--ec-page-text-muted))"
|
|
@@ -12483,9 +12516,9 @@ var buildMessageGroupExpansionNodes = ({
|
|
|
12483
12516
|
};
|
|
12484
12517
|
|
|
12485
12518
|
// src/components/NotesToolbarButton.tsx
|
|
12486
|
-
var
|
|
12519
|
+
var import_react102 = require("react");
|
|
12487
12520
|
var import_lucide_react41 = require("lucide-react");
|
|
12488
|
-
var
|
|
12521
|
+
var import_react103 = require("@xyflow/react");
|
|
12489
12522
|
var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
|
|
12490
12523
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
12491
12524
|
var NODE_TYPE_META = {
|
|
@@ -12748,12 +12781,12 @@ function AllNotesModal({
|
|
|
12748
12781
|
onClose,
|
|
12749
12782
|
nodes
|
|
12750
12783
|
}) {
|
|
12751
|
-
const { setCenter, getZoom } = (0,
|
|
12752
|
-
const [selectedIdx, setSelectedIdx] = (0,
|
|
12784
|
+
const { setCenter, getZoom } = (0, import_react103.useReactFlow)();
|
|
12785
|
+
const [selectedIdx, setSelectedIdx] = (0, import_react102.useState)(0);
|
|
12753
12786
|
const portalContainer = usePortalContainer();
|
|
12754
12787
|
const totalNotes = noteGroups.reduce((sum, g) => sum + g.notes.length, 0);
|
|
12755
12788
|
const selected = noteGroups[selectedIdx] || noteGroups[0];
|
|
12756
|
-
const handleNavigate = (0,
|
|
12789
|
+
const handleNavigate = (0, import_react102.useCallback)(
|
|
12757
12790
|
(nodeId) => {
|
|
12758
12791
|
const node = nodes.find((n) => n.id === nodeId);
|
|
12759
12792
|
if (!node) return;
|
|
@@ -13314,7 +13347,7 @@ var LEGEND_ICONS = {
|
|
|
13314
13347
|
field: { Icon: import_lucide_react42.Box, colorClass: "text-cyan-600" }
|
|
13315
13348
|
};
|
|
13316
13349
|
var getLegendIcon = (key) => LEGEND_ICONS[key];
|
|
13317
|
-
var LegendPanel = (0,
|
|
13350
|
+
var LegendPanel = (0, import_react104.memo)(function LegendPanel2({
|
|
13318
13351
|
legend,
|
|
13319
13352
|
hiddenKeys,
|
|
13320
13353
|
showMinimap,
|
|
@@ -13322,7 +13355,7 @@ var LegendPanel = (0, import_react103.memo)(function LegendPanel2({
|
|
|
13322
13355
|
}) {
|
|
13323
13356
|
if (Object.keys(legend).length === 0) return null;
|
|
13324
13357
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
13325
|
-
|
|
13358
|
+
import_react105.Panel,
|
|
13326
13359
|
{
|
|
13327
13360
|
position: "bottom-right",
|
|
13328
13361
|
style: showMinimap ? LEGEND_PANEL_STYLE_WITH_MINIMAP : void 0,
|
|
@@ -13363,7 +13396,7 @@ var GROUP_EDGE_STYLE = {
|
|
|
13363
13396
|
stroke: "var(--ec-edge-stroke, #6b7280)"
|
|
13364
13397
|
};
|
|
13365
13398
|
var GROUP_EDGE_MARKER = {
|
|
13366
|
-
type:
|
|
13399
|
+
type: import_react105.MarkerType.ArrowClosed,
|
|
13367
13400
|
width: 20,
|
|
13368
13401
|
height: 20
|
|
13369
13402
|
};
|
|
@@ -13469,22 +13502,24 @@ var NodeGraphBuilder = ({
|
|
|
13469
13502
|
onSaveLayout,
|
|
13470
13503
|
onResetLayout
|
|
13471
13504
|
}) => {
|
|
13472
|
-
(0,
|
|
13505
|
+
(0, import_react104.useEffect)(() => {
|
|
13473
13506
|
if (onBuildUrl) {
|
|
13474
13507
|
setBuildUrlFn(onBuildUrl);
|
|
13475
13508
|
}
|
|
13476
13509
|
}, []);
|
|
13477
|
-
const nodeTypes = (0,
|
|
13510
|
+
const nodeTypes = (0, import_react104.useMemo)(() => {
|
|
13478
13511
|
const wrapWithContextMenu = (Component) => {
|
|
13479
|
-
const Wrapped = (
|
|
13512
|
+
const Wrapped = (props) => {
|
|
13480
13513
|
const items = props.data?.contextMenu;
|
|
13481
13514
|
if (!items?.length) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Component, { ...props });
|
|
13482
13515
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(NodeContextMenu_default, { items, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Component, { ...props }) });
|
|
13483
|
-
}
|
|
13516
|
+
};
|
|
13484
13517
|
Wrapped.displayName = `WithContextMenu(${Component.displayName || Component.name || "Component"})`;
|
|
13485
13518
|
return Wrapped;
|
|
13486
13519
|
};
|
|
13487
|
-
|
|
13520
|
+
const ReadOnlyNoteNode = (props) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(NoteNode_default, { ...props, readOnly: true });
|
|
13521
|
+
ReadOnlyNoteNode.displayName = "ReadOnlyNoteNode";
|
|
13522
|
+
const types = {
|
|
13488
13523
|
service: wrapWithContextMenu(ServiceNode_default),
|
|
13489
13524
|
services: wrapWithContextMenu(ServiceNode_default),
|
|
13490
13525
|
agent: wrapWithContextMenu(Agent_default),
|
|
@@ -13523,15 +13558,21 @@ var NodeGraphBuilder = ({
|
|
|
13523
13558
|
"system-group": SystemGroupNode_default,
|
|
13524
13559
|
"domain-group": SystemGroupNode_default,
|
|
13525
13560
|
"context-domain": DomainCard_default,
|
|
13526
|
-
note:
|
|
13561
|
+
note: ReadOnlyNoteNode,
|
|
13527
13562
|
field: wrapWithContextMenu(FieldNode_default),
|
|
13528
13563
|
messageGroup: MessageGroupNode_default,
|
|
13529
13564
|
messageGroupExpanded: MessageGroupExpandedNode_default,
|
|
13530
13565
|
flowExpanded: FlowExpandedNode_default,
|
|
13531
13566
|
swimlane: SwimlaneNode_default
|
|
13532
13567
|
};
|
|
13568
|
+
return Object.fromEntries(
|
|
13569
|
+
Object.entries(types).map(([type, Component]) => [
|
|
13570
|
+
type,
|
|
13571
|
+
memoNode(Component)
|
|
13572
|
+
])
|
|
13573
|
+
);
|
|
13533
13574
|
}, []);
|
|
13534
|
-
const edgeTypes2 = (0,
|
|
13575
|
+
const edgeTypes2 = (0, import_react104.useMemo)(
|
|
13535
13576
|
() => ({
|
|
13536
13577
|
animated: AnimatedMessageEdge_default,
|
|
13537
13578
|
multiline: MultilineEdgeLabel_default,
|
|
@@ -13542,8 +13583,8 @@ var NodeGraphBuilder = ({
|
|
|
13542
13583
|
}),
|
|
13543
13584
|
[]
|
|
13544
13585
|
);
|
|
13545
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
13546
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
13586
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react105.useNodesState)(initialNodes);
|
|
13587
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react105.useEdgesState)(initialEdges);
|
|
13547
13588
|
const {
|
|
13548
13589
|
fitView,
|
|
13549
13590
|
getNodes,
|
|
@@ -13553,13 +13594,13 @@ var NodeGraphBuilder = ({
|
|
|
13553
13594
|
getEdges,
|
|
13554
13595
|
getViewport,
|
|
13555
13596
|
setViewport
|
|
13556
|
-
} = (0,
|
|
13557
|
-
const storeApi = (0,
|
|
13558
|
-
const previousGraphInputRef = (0,
|
|
13597
|
+
} = (0, import_react105.useReactFlow)();
|
|
13598
|
+
const storeApi = (0, import_react105.useStoreApi)();
|
|
13599
|
+
const previousGraphInputRef = (0, import_react104.useRef)({
|
|
13559
13600
|
nodes: initialNodes,
|
|
13560
13601
|
edges: initialEdges
|
|
13561
13602
|
});
|
|
13562
|
-
(0,
|
|
13603
|
+
(0, import_react104.useEffect)(() => {
|
|
13563
13604
|
const previousGraphInput = previousGraphInputRef.current;
|
|
13564
13605
|
previousGraphInputRef.current = {
|
|
13565
13606
|
nodes: initialNodes,
|
|
@@ -13574,46 +13615,46 @@ var NodeGraphBuilder = ({
|
|
|
13574
13615
|
fitView({ duration: 300, padding: 0.2 });
|
|
13575
13616
|
});
|
|
13576
13617
|
}, [initialNodes, initialEdges, setNodes, setEdges, fitView]);
|
|
13577
|
-
const [animateMessages, setAnimateMessages] = (0,
|
|
13578
|
-
const prepareEdges = (0,
|
|
13618
|
+
const [animateMessages, setAnimateMessages] = (0, import_react104.useState)(true);
|
|
13619
|
+
const prepareEdges = (0, import_react104.useCallback)(
|
|
13579
13620
|
(eds) => applyMessageAnimation(eds, animateMessages),
|
|
13580
13621
|
[animateMessages]
|
|
13581
13622
|
);
|
|
13582
|
-
const [_activeStepIndex, _setActiveStepIndex] = (0,
|
|
13583
|
-
const [_isFullscreen, _setIsFullscreen] = (0,
|
|
13584
|
-
const [isShareModalOpen, setIsShareModalOpen] = (0,
|
|
13585
|
-
const [shareUrlCopySuccess, setShareUrlCopySuccess] = (0,
|
|
13586
|
-
const [isMermaidView, setIsMermaidView] = (0,
|
|
13587
|
-
const [showMinimap, setShowMinimap] = (0,
|
|
13588
|
-
const [hasLayoutChanges, setHasLayoutChanges] = (0,
|
|
13589
|
-
const [isSavingLayout, setIsSavingLayout] = (0,
|
|
13590
|
-
const initialPositionsRef = (0,
|
|
13623
|
+
const [_activeStepIndex, _setActiveStepIndex] = (0, import_react104.useState)(null);
|
|
13624
|
+
const [_isFullscreen, _setIsFullscreen] = (0, import_react104.useState)(false);
|
|
13625
|
+
const [isShareModalOpen, setIsShareModalOpen] = (0, import_react104.useState)(false);
|
|
13626
|
+
const [shareUrlCopySuccess, setShareUrlCopySuccess] = (0, import_react104.useState)(false);
|
|
13627
|
+
const [isMermaidView, setIsMermaidView] = (0, import_react104.useState)(false);
|
|
13628
|
+
const [showMinimap, setShowMinimap] = (0, import_react104.useState)(false);
|
|
13629
|
+
const [hasLayoutChanges, setHasLayoutChanges] = (0, import_react104.useState)(false);
|
|
13630
|
+
const [isSavingLayout, setIsSavingLayout] = (0, import_react104.useState)(false);
|
|
13631
|
+
const initialPositionsRef = (0, import_react104.useRef)(
|
|
13591
13632
|
{}
|
|
13592
13633
|
);
|
|
13593
|
-
const [focusModeOpen, setFocusModeOpen] = (0,
|
|
13594
|
-
const [focusedNodeId, setFocusedNodeId] = (0,
|
|
13595
|
-
const [swimlanes, setSwimlanes] = (0,
|
|
13596
|
-
const swimlanesRef = (0,
|
|
13597
|
-
const [swimlaneStyle, setSwimlaneStyle] = (0,
|
|
13598
|
-
const swimlaneStyleRef = (0,
|
|
13599
|
-
const unlanedGraphRef = (0,
|
|
13600
|
-
const [isNotesModalOpen, setIsNotesModalOpen] = (0,
|
|
13601
|
-
const openNotesModal = (0,
|
|
13602
|
-
const interactionCountRef = (0,
|
|
13603
|
-
const startInteraction = (0,
|
|
13634
|
+
const [focusModeOpen, setFocusModeOpen] = (0, import_react104.useState)(false);
|
|
13635
|
+
const [focusedNodeId, setFocusedNodeId] = (0, import_react104.useState)(null);
|
|
13636
|
+
const [swimlanes, setSwimlanes] = (0, import_react104.useState)(null);
|
|
13637
|
+
const swimlanesRef = (0, import_react104.useRef)(null);
|
|
13638
|
+
const [swimlaneStyle, setSwimlaneStyle] = (0, import_react104.useState)("boxes");
|
|
13639
|
+
const swimlaneStyleRef = (0, import_react104.useRef)("boxes");
|
|
13640
|
+
const unlanedGraphRef = (0, import_react104.useRef)(null);
|
|
13641
|
+
const [isNotesModalOpen, setIsNotesModalOpen] = (0, import_react104.useState)(false);
|
|
13642
|
+
const openNotesModal = (0, import_react104.useCallback)(() => setIsNotesModalOpen(true), []);
|
|
13643
|
+
const interactionCountRef = (0, import_react104.useRef)(0);
|
|
13644
|
+
const startInteraction = (0, import_react104.useCallback)(() => {
|
|
13604
13645
|
interactionCountRef.current += 1;
|
|
13605
13646
|
if (interactionCountRef.current === 1) {
|
|
13606
13647
|
reactFlowWrapperRef.current?.classList.add("ec-interaction-active");
|
|
13607
13648
|
}
|
|
13608
13649
|
}, []);
|
|
13609
|
-
const endInteraction = (0,
|
|
13650
|
+
const endInteraction = (0, import_react104.useCallback)(() => {
|
|
13610
13651
|
interactionCountRef.current = Math.max(0, interactionCountRef.current - 1);
|
|
13611
13652
|
if (interactionCountRef.current === 0) {
|
|
13612
13653
|
reactFlowWrapperRef.current?.classList.remove("ec-interaction-active");
|
|
13613
13654
|
}
|
|
13614
13655
|
}, []);
|
|
13615
|
-
const hoveredEdgeNodesRef = (0,
|
|
13616
|
-
const handleEdgeMouseEnter = (0,
|
|
13656
|
+
const hoveredEdgeNodesRef = (0, import_react104.useRef)([]);
|
|
13657
|
+
const handleEdgeMouseEnter = (0, import_react104.useCallback)(
|
|
13617
13658
|
(_, edge) => {
|
|
13618
13659
|
const wrapper = reactFlowWrapperRef.current;
|
|
13619
13660
|
if (!wrapper) return;
|
|
@@ -13625,15 +13666,15 @@ var NodeGraphBuilder = ({
|
|
|
13625
13666
|
},
|
|
13626
13667
|
[]
|
|
13627
13668
|
);
|
|
13628
|
-
const handleEdgeMouseLeave = (0,
|
|
13669
|
+
const handleEdgeMouseLeave = (0, import_react104.useCallback)(() => {
|
|
13629
13670
|
hoveredEdgeNodesRef.current.forEach(
|
|
13630
13671
|
(el) => el.classList.remove("ec-edge-hover-node")
|
|
13631
13672
|
);
|
|
13632
13673
|
hoveredEdgeNodesRef.current = [];
|
|
13633
13674
|
}, []);
|
|
13634
|
-
const hoveredNodeEdgesRef = (0,
|
|
13635
|
-
const hoveredNodePeersRef = (0,
|
|
13636
|
-
const handleNodeMouseEnter = (0,
|
|
13675
|
+
const hoveredNodeEdgesRef = (0, import_react104.useRef)([]);
|
|
13676
|
+
const hoveredNodePeersRef = (0, import_react104.useRef)([]);
|
|
13677
|
+
const handleNodeMouseEnter = (0, import_react104.useCallback)(
|
|
13637
13678
|
(_, node) => {
|
|
13638
13679
|
const wrapper = reactFlowWrapperRef.current;
|
|
13639
13680
|
if (!wrapper) return;
|
|
@@ -13662,7 +13703,7 @@ var NodeGraphBuilder = ({
|
|
|
13662
13703
|
},
|
|
13663
13704
|
[]
|
|
13664
13705
|
);
|
|
13665
|
-
const handleNodeMouseLeave = (0,
|
|
13706
|
+
const handleNodeMouseLeave = (0, import_react104.useCallback)(() => {
|
|
13666
13707
|
hoveredNodeEdgesRef.current.forEach(
|
|
13667
13708
|
(el) => el.classList.remove("ec-node-hover-edge")
|
|
13668
13709
|
);
|
|
@@ -13672,30 +13713,30 @@ var NodeGraphBuilder = ({
|
|
|
13672
13713
|
);
|
|
13673
13714
|
hoveredNodePeersRef.current = [];
|
|
13674
13715
|
}, []);
|
|
13675
|
-
const hasChannels = (0,
|
|
13716
|
+
const hasChannels = (0, import_react104.useMemo)(
|
|
13676
13717
|
() => initialNodes.some((node) => node.type === "channels"),
|
|
13677
13718
|
[initialNodes]
|
|
13678
13719
|
);
|
|
13679
|
-
const hasMessages = (0,
|
|
13720
|
+
const hasMessages = (0, import_react104.useMemo)(
|
|
13680
13721
|
() => initialNodes.some(isMessageNode),
|
|
13681
13722
|
[initialNodes]
|
|
13682
13723
|
);
|
|
13683
|
-
const isFlowGraph = (0,
|
|
13724
|
+
const isFlowGraph = (0, import_react104.useMemo)(
|
|
13684
13725
|
() => initialEdges.some((edge) => edge.type === "flow-edge"),
|
|
13685
13726
|
[initialEdges]
|
|
13686
13727
|
);
|
|
13687
|
-
const renderedSizeOf = (0,
|
|
13728
|
+
const renderedSizeOf = (0, import_react104.useCallback)(
|
|
13688
13729
|
(node) => {
|
|
13689
13730
|
const measured = storeApi.getState().nodeLookup.get(node.id)?.measured;
|
|
13690
13731
|
return measured?.width && measured?.height ? { width: measured.width, height: measured.height } : getNodeSize(node);
|
|
13691
13732
|
},
|
|
13692
13733
|
[storeApi]
|
|
13693
13734
|
);
|
|
13694
|
-
const beforeLayout = (0,
|
|
13735
|
+
const beforeLayout = (0, import_react104.useCallback)(
|
|
13695
13736
|
(graph) => swimlaneStyleRef.current === "lanes" ? removeSwimlanes(graph) : graph,
|
|
13696
13737
|
[]
|
|
13697
13738
|
);
|
|
13698
|
-
const afterLayout = (0,
|
|
13739
|
+
const afterLayout = (0, import_react104.useCallback)((graph) => {
|
|
13699
13740
|
const groupBy = swimlanesRef.current;
|
|
13700
13741
|
const style = swimlaneStyleRef.current;
|
|
13701
13742
|
const current = getGrouping(graph.nodes);
|
|
@@ -13707,24 +13748,24 @@ var NodeGraphBuilder = ({
|
|
|
13707
13748
|
unlanedGraphRef.current = unlaned;
|
|
13708
13749
|
return layoutSwimlanes(unlaned, groupBy, { sizeOf: renderedSizeOf });
|
|
13709
13750
|
}, []);
|
|
13710
|
-
const hasLevels = (0,
|
|
13751
|
+
const hasLevels = (0, import_react104.useMemo)(
|
|
13711
13752
|
() => initialNodes.some(
|
|
13712
13753
|
(node) => LEVEL_NODE_TYPES.includes(node.type || "")
|
|
13713
13754
|
),
|
|
13714
13755
|
[initialNodes]
|
|
13715
13756
|
);
|
|
13716
|
-
const isContextGraph = (0,
|
|
13757
|
+
const isContextGraph = (0, import_react104.useMemo)(
|
|
13717
13758
|
() => initialNodes.every(
|
|
13718
13759
|
(node) => CONTEXT_NODE_TYPES.includes(node.type || "")
|
|
13719
13760
|
),
|
|
13720
13761
|
[initialNodes]
|
|
13721
13762
|
);
|
|
13722
|
-
const hasOtherDomains = (0,
|
|
13763
|
+
const hasOtherDomains = (0, import_react104.useMemo)(
|
|
13723
13764
|
() => mode === "full" && initialNodes.some((node) => !!node.data?.otherDomain),
|
|
13724
13765
|
[initialNodes, mode]
|
|
13725
13766
|
);
|
|
13726
|
-
const legendRef = (0,
|
|
13727
|
-
const matchesLegendKey = (0,
|
|
13767
|
+
const legendRef = (0, import_react104.useRef)({});
|
|
13768
|
+
const matchesLegendKey = (0, import_react104.useCallback)((node, key) => {
|
|
13728
13769
|
const groupId = legendRef.current[key]?.groupId;
|
|
13729
13770
|
return groupId ? node.data?.group?.id === groupId : node.type === key;
|
|
13730
13771
|
}, []);
|
|
@@ -13760,7 +13801,7 @@ var NodeGraphBuilder = ({
|
|
|
13760
13801
|
beforeLayout,
|
|
13761
13802
|
afterLayout
|
|
13762
13803
|
});
|
|
13763
|
-
const switchGraph = (0,
|
|
13804
|
+
const switchGraph = (0, import_react104.useCallback)(
|
|
13764
13805
|
(showOverview) => onShowOverview?.(showOverview, {
|
|
13765
13806
|
nodes: getNodes(),
|
|
13766
13807
|
edges: getEdges(),
|
|
@@ -13768,7 +13809,7 @@ var NodeGraphBuilder = ({
|
|
|
13768
13809
|
}),
|
|
13769
13810
|
[onShowOverview, getNodes, getEdges, getViewport]
|
|
13770
13811
|
);
|
|
13771
|
-
const levels = (0,
|
|
13812
|
+
const levels = (0, import_react104.useMemo)(() => {
|
|
13772
13813
|
if (isFlowGraph) return [];
|
|
13773
13814
|
if (!overviewLabel && !isContextGraph && !hasLevels) return [];
|
|
13774
13815
|
const selectDetailLevel = (level) => {
|
|
@@ -13810,7 +13851,7 @@ var NodeGraphBuilder = ({
|
|
|
13810
13851
|
setDetailLevel,
|
|
13811
13852
|
switchGraph
|
|
13812
13853
|
]);
|
|
13813
|
-
const canvasTools = (0,
|
|
13854
|
+
const canvasTools = (0, import_react104.useMemo)(
|
|
13814
13855
|
() => hasOtherDomains ? [
|
|
13815
13856
|
{
|
|
13816
13857
|
label: highlightCrossDomain ? "Stop highlighting cross-domain communication" : "Highlight cross-domain communication",
|
|
@@ -13821,23 +13862,23 @@ var NodeGraphBuilder = ({
|
|
|
13821
13862
|
] : [],
|
|
13822
13863
|
[hasOtherDomains, highlightCrossDomain, toggleHighlightCrossDomain]
|
|
13823
13864
|
);
|
|
13824
|
-
const searchRef = (0,
|
|
13825
|
-
const reactFlowWrapperRef = (0,
|
|
13826
|
-
const scrollableContainerRef = (0,
|
|
13827
|
-
const nodesRef = (0,
|
|
13865
|
+
const searchRef = (0, import_react104.useRef)(null);
|
|
13866
|
+
const reactFlowWrapperRef = (0, import_react104.useRef)(null);
|
|
13867
|
+
const scrollableContainerRef = (0, import_react104.useRef)(null);
|
|
13868
|
+
const nodesRef = (0, import_react104.useRef)(nodes);
|
|
13828
13869
|
nodesRef.current = nodes;
|
|
13829
|
-
const edgesRef = (0,
|
|
13870
|
+
const edgesRef = (0, import_react104.useRef)(edges);
|
|
13830
13871
|
edgesRef.current = edges;
|
|
13831
|
-
const subFlowLayoutRun = (0,
|
|
13832
|
-
const hideChannelsRef = (0,
|
|
13872
|
+
const subFlowLayoutRun = (0, import_react104.useRef)(0);
|
|
13873
|
+
const hideChannelsRef = (0, import_react104.useRef)(hideChannels);
|
|
13833
13874
|
hideChannelsRef.current = hideChannels;
|
|
13834
|
-
const walkthroughKeyRef = (0,
|
|
13875
|
+
const walkthroughKeyRef = (0, import_react104.useRef)("");
|
|
13835
13876
|
const computedWalkthroughKey = `${nodes.map((n) => `${n.id}:${n.type}`).join(",")}|${edges.map((e) => `${e.source}>${e.target}`).join(",")}`;
|
|
13836
13877
|
if (computedWalkthroughKey !== walkthroughKeyRef.current) {
|
|
13837
13878
|
walkthroughKeyRef.current = computedWalkthroughKey;
|
|
13838
13879
|
}
|
|
13839
13880
|
const walkthroughKey = walkthroughKeyRef.current;
|
|
13840
|
-
const { walkthroughNodes, walkthroughEdges } = (0,
|
|
13881
|
+
const { walkthroughNodes, walkthroughEdges } = (0, import_react104.useMemo)(() => {
|
|
13841
13882
|
const wrapperNodeIds = new Set(
|
|
13842
13883
|
nodes.filter((n) => isExpandedWrapper(n.type) || isSwimlaneNode(n)).map((n) => n.id)
|
|
13843
13884
|
);
|
|
@@ -13848,13 +13889,13 @@ var NodeGraphBuilder = ({
|
|
|
13848
13889
|
)
|
|
13849
13890
|
};
|
|
13850
13891
|
}, [walkthroughKey]);
|
|
13851
|
-
const animateLayout2 = (0,
|
|
13892
|
+
const animateLayout2 = (0, import_react104.useCallback)(() => {
|
|
13852
13893
|
const wrapper = reactFlowWrapperRef.current;
|
|
13853
13894
|
if (!wrapper) return;
|
|
13854
13895
|
wrapper.classList.add("ec-animating-layout");
|
|
13855
13896
|
setTimeout(() => wrapper.classList.remove("ec-animating-layout"), 400);
|
|
13856
13897
|
}, []);
|
|
13857
|
-
const makeRoomForRenderedExpandedGroup = (0,
|
|
13898
|
+
const makeRoomForRenderedExpandedGroup = (0, import_react104.useCallback)(
|
|
13858
13899
|
(groupNodeId, groupBounds) => {
|
|
13859
13900
|
const padding = 80;
|
|
13860
13901
|
const protectedBounds = {
|
|
@@ -13883,7 +13924,7 @@ var NodeGraphBuilder = ({
|
|
|
13883
13924
|
},
|
|
13884
13925
|
[getIntersectingNodes, setNodes]
|
|
13885
13926
|
);
|
|
13886
|
-
const handleCollapseGroup = (0,
|
|
13927
|
+
const handleCollapseGroup = (0, import_react104.useCallback)(
|
|
13887
13928
|
(e) => {
|
|
13888
13929
|
const target = e.target;
|
|
13889
13930
|
const collapseBtn = target.closest(
|
|
@@ -13957,7 +13998,7 @@ var NodeGraphBuilder = ({
|
|
|
13957
13998
|
},
|
|
13958
13999
|
[initialNodes, initialEdges, setNodes, setEdges, animateLayout2]
|
|
13959
14000
|
);
|
|
13960
|
-
(0,
|
|
14001
|
+
(0, import_react104.useEffect)(() => {
|
|
13961
14002
|
if (isDevMode && initialNodes.length > 0) {
|
|
13962
14003
|
const positions = {};
|
|
13963
14004
|
initialNodes.forEach((node) => {
|
|
@@ -13966,7 +14007,7 @@ var NodeGraphBuilder = ({
|
|
|
13966
14007
|
initialPositionsRef.current = positions;
|
|
13967
14008
|
}
|
|
13968
14009
|
}, [isDevMode, initialNodes]);
|
|
13969
|
-
const checkForLayoutChanges = (0,
|
|
14010
|
+
const checkForLayoutChanges = (0, import_react104.useCallback)(() => {
|
|
13970
14011
|
if (!isDevMode) return;
|
|
13971
14012
|
const initial = initialPositionsRef.current;
|
|
13972
14013
|
if (Object.keys(initial).length === 0) return;
|
|
@@ -13976,7 +14017,7 @@ var NodeGraphBuilder = ({
|
|
|
13976
14017
|
});
|
|
13977
14018
|
setHasLayoutChanges(hasChanges);
|
|
13978
14019
|
}, [isDevMode]);
|
|
13979
|
-
const handleNodesChange = (0,
|
|
14020
|
+
const handleNodesChange = (0, import_react104.useCallback)(
|
|
13980
14021
|
(changes) => {
|
|
13981
14022
|
onNodesChange(changes);
|
|
13982
14023
|
const hasDragEnd = changes.some(
|
|
@@ -13988,7 +14029,7 @@ var NodeGraphBuilder = ({
|
|
|
13988
14029
|
},
|
|
13989
14030
|
[onNodesChange, checkForLayoutChanges]
|
|
13990
14031
|
);
|
|
13991
|
-
const resetNodesAndEdges = (0,
|
|
14032
|
+
const resetNodesAndEdges = (0, import_react104.useCallback)(() => {
|
|
13992
14033
|
setNodes(
|
|
13993
14034
|
(nds) => nds.map((node) => {
|
|
13994
14035
|
node.style = { ...node.style, opacity: 1 };
|
|
@@ -14012,7 +14053,7 @@ var NodeGraphBuilder = ({
|
|
|
14012
14053
|
})
|
|
14013
14054
|
);
|
|
14014
14055
|
}, [setNodes, setEdges, animateMessages]);
|
|
14015
|
-
(0,
|
|
14056
|
+
(0, import_react104.useEffect)(() => {
|
|
14016
14057
|
if (!focusNodeId) return;
|
|
14017
14058
|
const targetNode = nodesRef.current.find((node) => node.id === focusNodeId);
|
|
14018
14059
|
if (!targetNode) return;
|
|
@@ -14030,13 +14071,13 @@ var NodeGraphBuilder = ({
|
|
|
14030
14071
|
});
|
|
14031
14072
|
});
|
|
14032
14073
|
}, [focusNodeId, focusRequestId, fitView, setNodes]);
|
|
14033
|
-
(0,
|
|
14074
|
+
(0, import_react104.useEffect)(() => {
|
|
14034
14075
|
if (fitRequestId == null) return;
|
|
14035
14076
|
requestAnimationFrame(() => {
|
|
14036
14077
|
fitView({ duration: 400, padding: 0.2 });
|
|
14037
14078
|
});
|
|
14038
14079
|
}, [fitRequestId, fitView]);
|
|
14039
|
-
const handleNodeClick = (0,
|
|
14080
|
+
const handleNodeClick = (0, import_react104.useCallback)(
|
|
14040
14081
|
(_, node) => {
|
|
14041
14082
|
if (onNodeClick) {
|
|
14042
14083
|
onNodeClick(node);
|
|
@@ -14381,7 +14422,7 @@ var NodeGraphBuilder = ({
|
|
|
14381
14422
|
setCenter
|
|
14382
14423
|
]
|
|
14383
14424
|
);
|
|
14384
|
-
const toggleAnimateMessages = (0,
|
|
14425
|
+
const toggleAnimateMessages = (0, import_react104.useCallback)(() => {
|
|
14385
14426
|
setAnimateMessages((prev) => {
|
|
14386
14427
|
const next = !prev;
|
|
14387
14428
|
localStorage.setItem(
|
|
@@ -14391,10 +14432,10 @@ var NodeGraphBuilder = ({
|
|
|
14391
14432
|
return next;
|
|
14392
14433
|
});
|
|
14393
14434
|
}, []);
|
|
14394
|
-
const handleFitView = (0,
|
|
14435
|
+
const handleFitView = (0, import_react104.useCallback)(() => {
|
|
14395
14436
|
fitView({ maxZoom: 1, duration: 400, padding: 0.2 });
|
|
14396
14437
|
}, [fitView]);
|
|
14397
|
-
(0,
|
|
14438
|
+
(0, import_react104.useEffect)(() => {
|
|
14398
14439
|
if (disableMessageAnimation) {
|
|
14399
14440
|
setAnimateMessages(false);
|
|
14400
14441
|
return;
|
|
@@ -14420,16 +14461,16 @@ var NodeGraphBuilder = ({
|
|
|
14420
14461
|
}
|
|
14421
14462
|
}
|
|
14422
14463
|
}, [animated, disableMessageAnimation, initialNodes.length]);
|
|
14423
|
-
(0,
|
|
14464
|
+
(0, import_react104.useEffect)(() => {
|
|
14424
14465
|
setEdges((eds) => applyMessageAnimation(eds, animateMessages));
|
|
14425
14466
|
}, [animateMessages]);
|
|
14426
|
-
(0,
|
|
14467
|
+
(0, import_react104.useEffect)(() => {
|
|
14427
14468
|
if (transitionFrom) return;
|
|
14428
14469
|
setTimeout(() => {
|
|
14429
14470
|
fitView({ maxZoom: 1, duration: 800 });
|
|
14430
14471
|
}, 150);
|
|
14431
14472
|
}, []);
|
|
14432
|
-
const generateMermaidCode = (0,
|
|
14473
|
+
const generateMermaidCode = (0, import_react104.useCallback)(() => {
|
|
14433
14474
|
try {
|
|
14434
14475
|
return convertToMermaid(nodesRef.current, edgesRef.current, {
|
|
14435
14476
|
includeStyles: true,
|
|
@@ -14440,7 +14481,7 @@ var NodeGraphBuilder = ({
|
|
|
14440
14481
|
return "";
|
|
14441
14482
|
}
|
|
14442
14483
|
}, []);
|
|
14443
|
-
(0,
|
|
14484
|
+
(0, import_react104.useEffect)(() => {
|
|
14444
14485
|
if (zoomOnScroll) return;
|
|
14445
14486
|
const findScrollableContainer = () => {
|
|
14446
14487
|
const selectors = [
|
|
@@ -14485,31 +14526,31 @@ var NodeGraphBuilder = ({
|
|
|
14485
14526
|
};
|
|
14486
14527
|
}
|
|
14487
14528
|
}, [zoomOnScroll]);
|
|
14488
|
-
const handlePaneClick = (0,
|
|
14529
|
+
const handlePaneClick = (0, import_react104.useCallback)(() => {
|
|
14489
14530
|
searchRef.current?.hideSuggestions();
|
|
14490
14531
|
resetNodesAndEdges();
|
|
14491
14532
|
fitView({ maxZoom: 1, duration: 800 });
|
|
14492
14533
|
}, [resetNodesAndEdges, fitView]);
|
|
14493
|
-
const handleNodeSelect = (0,
|
|
14534
|
+
const handleNodeSelect = (0, import_react104.useCallback)(
|
|
14494
14535
|
(node) => {
|
|
14495
14536
|
handleNodeClick(null, node);
|
|
14496
14537
|
},
|
|
14497
14538
|
[handleNodeClick]
|
|
14498
14539
|
);
|
|
14499
|
-
const handleSearchClear = (0,
|
|
14540
|
+
const handleSearchClear = (0, import_react104.useCallback)(() => {
|
|
14500
14541
|
resetNodesAndEdges();
|
|
14501
14542
|
fitView({ maxZoom: 1, duration: 800 });
|
|
14502
14543
|
}, [resetNodesAndEdges, fitView]);
|
|
14503
|
-
const downloadImage = (0,
|
|
14544
|
+
const downloadImage = (0, import_react104.useCallback)((dataUrl, filename) => {
|
|
14504
14545
|
const a = document.createElement("a");
|
|
14505
14546
|
a.setAttribute("download", `${filename || "eventcatalog"}.png`);
|
|
14506
14547
|
a.setAttribute("href", dataUrl);
|
|
14507
14548
|
a.click();
|
|
14508
14549
|
}, []);
|
|
14509
|
-
const openChat = (0,
|
|
14550
|
+
const openChat = (0, import_react104.useCallback)(() => {
|
|
14510
14551
|
window.dispatchEvent(new CustomEvent("eventcatalog:open-chat"));
|
|
14511
14552
|
}, []);
|
|
14512
|
-
const handleSaveLayout = (0,
|
|
14553
|
+
const handleSaveLayout = (0, import_react104.useCallback)(async () => {
|
|
14513
14554
|
if (!resourceKey || !onSaveLayout) return false;
|
|
14514
14555
|
if (swimlanesRef.current) return false;
|
|
14515
14556
|
const positions = {};
|
|
@@ -14522,11 +14563,11 @@ var NodeGraphBuilder = ({
|
|
|
14522
14563
|
});
|
|
14523
14564
|
return await onSaveLayout(resourceKey, positions);
|
|
14524
14565
|
}, [resourceKey, onSaveLayout]);
|
|
14525
|
-
const handleResetLayout = (0,
|
|
14566
|
+
const handleResetLayout = (0, import_react104.useCallback)(async () => {
|
|
14526
14567
|
if (!resourceKey || !onResetLayout) return false;
|
|
14527
14568
|
return await onResetLayout(resourceKey);
|
|
14528
14569
|
}, [resourceKey, onResetLayout]);
|
|
14529
|
-
const handleQuickSaveLayout = (0,
|
|
14570
|
+
const handleQuickSaveLayout = (0, import_react104.useCallback)(async () => {
|
|
14530
14571
|
setIsSavingLayout(true);
|
|
14531
14572
|
const success = await handleSaveLayout();
|
|
14532
14573
|
setIsSavingLayout(false);
|
|
@@ -14539,17 +14580,17 @@ var NodeGraphBuilder = ({
|
|
|
14539
14580
|
setHasLayoutChanges(false);
|
|
14540
14581
|
}
|
|
14541
14582
|
}, [handleSaveLayout]);
|
|
14542
|
-
const handleCopyArchitectureCode = (0,
|
|
14583
|
+
const handleCopyArchitectureCode = (0, import_react104.useCallback)(async () => {
|
|
14543
14584
|
const code = generateMermaidCode();
|
|
14544
14585
|
await copyToClipboard(code);
|
|
14545
14586
|
}, [generateMermaidCode]);
|
|
14546
|
-
const handleCopyShareUrl = (0,
|
|
14587
|
+
const handleCopyShareUrl = (0, import_react104.useCallback)(async () => {
|
|
14547
14588
|
const url = typeof window !== "undefined" ? window.location.href : "";
|
|
14548
14589
|
await copyToClipboard(url);
|
|
14549
14590
|
setShareUrlCopySuccess(true);
|
|
14550
14591
|
setTimeout(() => setShareUrlCopySuccess(false), 2e3);
|
|
14551
14592
|
}, []);
|
|
14552
|
-
const toggleFullScreen = (0,
|
|
14593
|
+
const toggleFullScreen = (0, import_react104.useCallback)(() => {
|
|
14553
14594
|
if (!document.fullscreenElement) {
|
|
14554
14595
|
reactFlowWrapperRef.current?.requestFullscreen().catch((err) => {
|
|
14555
14596
|
console.error(
|
|
@@ -14560,7 +14601,7 @@ var NodeGraphBuilder = ({
|
|
|
14560
14601
|
document.exitFullscreen();
|
|
14561
14602
|
}
|
|
14562
14603
|
}, []);
|
|
14563
|
-
(0,
|
|
14604
|
+
(0, import_react104.useEffect)(() => {
|
|
14564
14605
|
const handleFullscreenChange = () => {
|
|
14565
14606
|
_setIsFullscreen(!!document.fullscreenElement);
|
|
14566
14607
|
setTimeout(() => {
|
|
@@ -14572,8 +14613,8 @@ var NodeGraphBuilder = ({
|
|
|
14572
14613
|
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
14573
14614
|
};
|
|
14574
14615
|
}, [fitView]);
|
|
14575
|
-
const handleExportVisual = (0,
|
|
14576
|
-
const nodesBounds = (0,
|
|
14616
|
+
const handleExportVisual = (0, import_react104.useCallback)(() => {
|
|
14617
|
+
const nodesBounds = (0, import_react105.getNodesBounds)(getNodes(), {
|
|
14577
14618
|
nodeLookup: storeApi.getState().nodeLookup
|
|
14578
14619
|
});
|
|
14579
14620
|
const { width, height, viewport } = getExportImageDimensions(nodesBounds);
|
|
@@ -14601,7 +14642,7 @@ var NodeGraphBuilder = ({
|
|
|
14601
14642
|
if (controls) controls.style.display = "block";
|
|
14602
14643
|
});
|
|
14603
14644
|
}, [getNodes, storeApi, downloadImage, title]);
|
|
14604
|
-
const getNodesByCollectionWithColors = (0,
|
|
14645
|
+
const getNodesByCollectionWithColors = (0, import_react104.useCallback)((nodes2) => {
|
|
14605
14646
|
const colorClasses = {
|
|
14606
14647
|
events: "bg-orange-600",
|
|
14607
14648
|
agent: "bg-sky-600",
|
|
@@ -14662,18 +14703,18 @@ var NodeGraphBuilder = ({
|
|
|
14662
14703
|
);
|
|
14663
14704
|
return { ...legendForDomains, ...legendForNodes };
|
|
14664
14705
|
}, []);
|
|
14665
|
-
const legendKeyRef = (0,
|
|
14706
|
+
const legendKeyRef = (0, import_react104.useRef)("");
|
|
14666
14707
|
const computedLegendKey = nodes.map((n) => `${n.id}:${n.type}:${n.data.group?.id || ""}`).join(",");
|
|
14667
14708
|
if (computedLegendKey !== legendKeyRef.current) {
|
|
14668
14709
|
legendKeyRef.current = computedLegendKey;
|
|
14669
14710
|
}
|
|
14670
14711
|
const legendKey = legendKeyRef.current;
|
|
14671
|
-
const graphLegend = (0,
|
|
14712
|
+
const graphLegend = (0, import_react104.useMemo)(
|
|
14672
14713
|
() => getNodesByCollectionWithColors(nodes),
|
|
14673
14714
|
[getNodesByCollectionWithColors, legendKey]
|
|
14674
14715
|
);
|
|
14675
|
-
const legendEntries = (0,
|
|
14676
|
-
const legend = (0,
|
|
14716
|
+
const legendEntries = (0, import_react104.useRef)(null);
|
|
14717
|
+
const legend = (0, import_react104.useMemo)(() => {
|
|
14677
14718
|
legendEntries.current ?? (legendEntries.current = getNodesByCollectionWithColors(initialNodes));
|
|
14678
14719
|
Object.assign(legendEntries.current, graphLegend);
|
|
14679
14720
|
return Object.fromEntries(
|
|
@@ -14683,17 +14724,17 @@ var NodeGraphBuilder = ({
|
|
|
14683
14724
|
);
|
|
14684
14725
|
}, [graphLegend, hiddenLegendKeys]);
|
|
14685
14726
|
legendRef.current = legend;
|
|
14686
|
-
const nodeIdsKeyRef = (0,
|
|
14727
|
+
const nodeIdsKeyRef = (0, import_react104.useRef)("");
|
|
14687
14728
|
const computedNodeIdsKey = nodes.map((n) => n.id).join(",");
|
|
14688
14729
|
if (computedNodeIdsKey !== nodeIdsKeyRef.current) {
|
|
14689
14730
|
nodeIdsKeyRef.current = computedNodeIdsKey;
|
|
14690
14731
|
}
|
|
14691
14732
|
const nodeIdsKey = nodeIdsKeyRef.current;
|
|
14692
|
-
const searchNodes = (0,
|
|
14733
|
+
const searchNodes = (0, import_react104.useMemo)(
|
|
14693
14734
|
() => nodes.filter((node) => !isSwimlaneNode(node)),
|
|
14694
14735
|
[nodeIdsKey]
|
|
14695
14736
|
);
|
|
14696
|
-
const allNoteGroups = (0,
|
|
14737
|
+
const allNoteGroups = (0, import_react104.useMemo)(() => {
|
|
14697
14738
|
const groups = [];
|
|
14698
14739
|
for (const node of nodes) {
|
|
14699
14740
|
const result = getNotesFromNode(node);
|
|
@@ -14708,13 +14749,13 @@ var NodeGraphBuilder = ({
|
|
|
14708
14749
|
}
|
|
14709
14750
|
return groups;
|
|
14710
14751
|
}, [nodeIdsKey]);
|
|
14711
|
-
const totalNotesCount = (0,
|
|
14752
|
+
const totalNotesCount = (0, import_react104.useMemo)(
|
|
14712
14753
|
() => allNoteGroups.reduce((sum, g) => sum + g.notes.length, 0),
|
|
14713
14754
|
[allNoteGroups]
|
|
14714
14755
|
);
|
|
14715
|
-
const [walkthroughTrail, setWalkthroughTrail] = (0,
|
|
14716
|
-
const walkthroughTrailRef = (0,
|
|
14717
|
-
const handleStepChange = (0,
|
|
14756
|
+
const [walkthroughTrail, setWalkthroughTrail] = (0, import_react104.useState)([]);
|
|
14757
|
+
const walkthroughTrailRef = (0, import_react104.useRef)([]);
|
|
14758
|
+
const handleStepChange = (0, import_react104.useCallback)(
|
|
14718
14759
|
(nodeId, shouldZoomOut, trail = nodeId ? [nodeId] : []) => {
|
|
14719
14760
|
if (nodeId === null) {
|
|
14720
14761
|
resetNodesAndEdges();
|
|
@@ -14772,12 +14813,12 @@ var NodeGraphBuilder = ({
|
|
|
14772
14813
|
walkthroughTrailRef.current = trail;
|
|
14773
14814
|
const canvas = reactFlowWrapperRef.current?.getBoundingClientRect();
|
|
14774
14815
|
if (!canvas) return;
|
|
14775
|
-
const bounds = (0,
|
|
14816
|
+
const bounds = (0, import_react105.getNodesBounds)([nodeId, ...nextNodeIds], {
|
|
14776
14817
|
nodeLookup: storeApi.getState().nodeLookup
|
|
14777
14818
|
});
|
|
14778
14819
|
const cardSpace = Math.min(WALKTHROUGH_CARD_SPACE, canvas.height * 0.35);
|
|
14779
14820
|
setViewport(
|
|
14780
|
-
(0,
|
|
14821
|
+
(0, import_react105.getViewportForBounds)(
|
|
14781
14822
|
bounds,
|
|
14782
14823
|
canvas.width,
|
|
14783
14824
|
canvas.height - cardSpace,
|
|
@@ -14790,13 +14831,13 @@ var NodeGraphBuilder = ({
|
|
|
14790
14831
|
},
|
|
14791
14832
|
[setNodes, setEdges, resetNodesAndEdges, setViewport, storeApi]
|
|
14792
14833
|
);
|
|
14793
|
-
const swimlaneOptions = (0,
|
|
14834
|
+
const swimlaneOptions = (0, import_react104.useMemo)(
|
|
14794
14835
|
() => isFlowGraph ? FLOW_GROUP_BYS.filter(
|
|
14795
14836
|
(groupBy) => hasSwimlanes(initialNodes, groupBy)
|
|
14796
14837
|
) : [],
|
|
14797
14838
|
[isFlowGraph, initialNodes]
|
|
14798
14839
|
);
|
|
14799
|
-
const swimlaneCounts = (0,
|
|
14840
|
+
const swimlaneCounts = (0, import_react104.useMemo)(
|
|
14800
14841
|
() => Object.fromEntries(
|
|
14801
14842
|
swimlaneOptions.map((groupBy) => [
|
|
14802
14843
|
groupBy,
|
|
@@ -14805,9 +14846,9 @@ var NodeGraphBuilder = ({
|
|
|
14805
14846
|
),
|
|
14806
14847
|
[swimlaneOptions, initialNodes]
|
|
14807
14848
|
);
|
|
14808
|
-
const [groupingShown, setGroupingShown] = (0,
|
|
14809
|
-
const groupingRun = (0,
|
|
14810
|
-
const handleSwimlanesChange = (0,
|
|
14849
|
+
const [groupingShown, setGroupingShown] = (0, import_react104.useState)(0);
|
|
14850
|
+
const groupingRun = (0, import_react104.useRef)(0);
|
|
14851
|
+
const handleSwimlanesChange = (0, import_react104.useCallback)(
|
|
14811
14852
|
(requested, style = swimlaneStyleRef.current) => {
|
|
14812
14853
|
const groupBy = style === "lanes" && requested === "domain-system" ? "domain" : requested;
|
|
14813
14854
|
if (groupBy === swimlanesRef.current && style === swimlaneStyleRef.current)
|
|
@@ -14838,7 +14879,7 @@ var NodeGraphBuilder = ({
|
|
|
14838
14879
|
},
|
|
14839
14880
|
[animateLayout2, setNodes, setEdges, renderedSizeOf]
|
|
14840
14881
|
);
|
|
14841
|
-
(0,
|
|
14882
|
+
(0, import_react104.useEffect)(() => {
|
|
14842
14883
|
if (groupingShown === 0) return;
|
|
14843
14884
|
const trail = walkthroughTrailRef.current;
|
|
14844
14885
|
if (trail.length > 0) {
|
|
@@ -14848,9 +14889,9 @@ var NodeGraphBuilder = ({
|
|
|
14848
14889
|
fitView({ duration: 400, padding: 0.1 });
|
|
14849
14890
|
}
|
|
14850
14891
|
}, [groupingShown]);
|
|
14851
|
-
const nodesInitialized = (0,
|
|
14852
|
-
const groupedOnLoad = (0,
|
|
14853
|
-
(0,
|
|
14892
|
+
const nodesInitialized = (0, import_react105.useNodesInitialized)();
|
|
14893
|
+
const groupedOnLoad = (0, import_react104.useRef)(false);
|
|
14894
|
+
(0, import_react104.useEffect)(() => {
|
|
14854
14895
|
if (!nodesInitialized || groupedOnLoad.current) return;
|
|
14855
14896
|
groupedOnLoad.current = true;
|
|
14856
14897
|
const fromUrl = readGroupFromUrl();
|
|
@@ -14951,7 +14992,7 @@ var NodeGraphBuilder = ({
|
|
|
14951
14992
|
}
|
|
14952
14993
|
) })
|
|
14953
14994
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
14954
|
-
|
|
14995
|
+
import_react105.ReactFlow,
|
|
14955
14996
|
{
|
|
14956
14997
|
nodeTypes,
|
|
14957
14998
|
proOptions: hideAttribution ? HIDE_ATTRIBUTION : void 0,
|
|
@@ -14966,7 +15007,7 @@ var NodeGraphBuilder = ({
|
|
|
14966
15007
|
onEdgesChange,
|
|
14967
15008
|
onEdgeMouseEnter: handleEdgeMouseEnter,
|
|
14968
15009
|
onEdgeMouseLeave: handleEdgeMouseLeave,
|
|
14969
|
-
connectionLineType:
|
|
15010
|
+
connectionLineType: import_react105.ConnectionLineType.SmoothStep,
|
|
14970
15011
|
nodeOrigin: NODE_ORIGIN,
|
|
14971
15012
|
elevateNodesOnSelect: false,
|
|
14972
15013
|
onNodeClick: handleNodeClick,
|
|
@@ -14981,7 +15022,7 @@ var NodeGraphBuilder = ({
|
|
|
14981
15022
|
className: `relative${isLayingOut ? " ec-laying-out" : ""}${hasOtherDomains && highlightCrossDomain ? " ec-highlight-cross-domain" : ""}`,
|
|
14982
15023
|
children: [
|
|
14983
15024
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
14984
|
-
|
|
15025
|
+
import_react105.Panel,
|
|
14985
15026
|
{
|
|
14986
15027
|
position: "top-center",
|
|
14987
15028
|
className: "w-full pr-6 pointer-events-none",
|
|
@@ -15101,8 +15142,8 @@ var NodeGraphBuilder = ({
|
|
|
15101
15142
|
]
|
|
15102
15143
|
}
|
|
15103
15144
|
),
|
|
15104
|
-
includeBackground && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15105
|
-
includeBackground && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15145
|
+
includeBackground && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react105.Background, { color: "var(--ec-bg-dots)", gap: 16 }),
|
|
15146
|
+
includeBackground && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react105.Controls, {}),
|
|
15106
15147
|
mode === "full" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15107
15148
|
CanvasToolbar_default,
|
|
15108
15149
|
{
|
|
@@ -15117,7 +15158,7 @@ var NodeGraphBuilder = ({
|
|
|
15117
15158
|
}
|
|
15118
15159
|
),
|
|
15119
15160
|
showMinimap && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15120
|
-
|
|
15161
|
+
import_react105.MiniMap,
|
|
15121
15162
|
{
|
|
15122
15163
|
nodeStrokeWidth: 3,
|
|
15123
15164
|
zoomable: true,
|
|
@@ -15126,7 +15167,7 @@ var NodeGraphBuilder = ({
|
|
|
15126
15167
|
}
|
|
15127
15168
|
),
|
|
15128
15169
|
swimlaneOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15129
|
-
|
|
15170
|
+
import_react105.Panel,
|
|
15130
15171
|
{
|
|
15131
15172
|
position: "top-right",
|
|
15132
15173
|
style: mode === "full" && showSearch ? SWIMLANE_PICKER_PANEL_STYLE_UNDER_SEARCH : void 0,
|
|
@@ -15143,7 +15184,7 @@ var NodeGraphBuilder = ({
|
|
|
15143
15184
|
}
|
|
15144
15185
|
),
|
|
15145
15186
|
isFlowGraph && showFlowWalkthrough && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WalkthroughBadges_default, { trail: walkthroughTrail }),
|
|
15146
|
-
isFlowGraph && showFlowWalkthrough && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15187
|
+
isFlowGraph && showFlowWalkthrough && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react105.Panel, { position: "bottom-left", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15147
15188
|
StepWalkthrough_default,
|
|
15148
15189
|
{
|
|
15149
15190
|
nodes: walkthroughNodes,
|
|
@@ -15154,7 +15195,7 @@ var NodeGraphBuilder = ({
|
|
|
15154
15195
|
}
|
|
15155
15196
|
) }),
|
|
15156
15197
|
isDevMode && hasLayoutChanges && !swimlanes && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15157
|
-
|
|
15198
|
+
import_react105.Panel,
|
|
15158
15199
|
{
|
|
15159
15200
|
position: "bottom-left",
|
|
15160
15201
|
style: isFlowGraph && showFlowWalkthrough ? LAYOUT_CHANGE_PANEL_STYLE_WITH_WALKTHROUGH : LAYOUT_CHANGE_PANEL_STYLE_DEFAULT,
|
|
@@ -15317,8 +15358,8 @@ var NodeGraph = ({
|
|
|
15317
15358
|
onSaveLayout,
|
|
15318
15359
|
onResetLayout
|
|
15319
15360
|
}) => {
|
|
15320
|
-
const [graphLayout, setGraphLayout] = (0,
|
|
15321
|
-
(0,
|
|
15361
|
+
const [graphLayout, setGraphLayout] = (0, import_react104.useState)(null);
|
|
15362
|
+
(0, import_react104.useEffect)(() => {
|
|
15322
15363
|
if (!graph) return setGraphLayout(null);
|
|
15323
15364
|
let current = true;
|
|
15324
15365
|
layoutGraph(graph.nodes, graph.edges, {
|
|
@@ -15336,16 +15377,16 @@ var NodeGraph = ({
|
|
|
15336
15377
|
const includeKey = includeKeyProp !== void 0 ? includeKeyProp : graph?.options?.legend !== false;
|
|
15337
15378
|
const showSearch = showSearchProp !== void 0 ? showSearchProp : graph?.options?.search !== false;
|
|
15338
15379
|
const animated = animatedProp ?? graph?.options?.animated;
|
|
15339
|
-
const [elem, setElem] = (0,
|
|
15340
|
-
const [showFooter, setShowFooter] = (0,
|
|
15380
|
+
const [elem, setElem] = (0, import_react104.useState)(null);
|
|
15381
|
+
const [showFooter, setShowFooter] = (0, import_react104.useState)(true);
|
|
15341
15382
|
const containerToRenderInto = portalId || `${id}-portal`;
|
|
15342
|
-
const [showOverview, setShowOverview] = (0,
|
|
15383
|
+
const [showOverview, setShowOverview] = (0, import_react104.useState)(() => {
|
|
15343
15384
|
if (!overviewGraph) return false;
|
|
15344
15385
|
const level = new URLSearchParams(window.location.search).get("level");
|
|
15345
15386
|
return level === null || level === "1";
|
|
15346
15387
|
});
|
|
15347
|
-
const [transitionFrom, setTransitionFrom] = (0,
|
|
15348
|
-
const handleShowOverview = (0,
|
|
15388
|
+
const [transitionFrom, setTransitionFrom] = (0, import_react104.useState)();
|
|
15389
|
+
const handleShowOverview = (0, import_react104.useCallback)(
|
|
15349
15390
|
(show, from) => {
|
|
15350
15391
|
setTransitionFrom(from);
|
|
15351
15392
|
setShowOverview(show);
|
|
@@ -15354,14 +15395,14 @@ var NodeGraph = ({
|
|
|
15354
15395
|
[]
|
|
15355
15396
|
);
|
|
15356
15397
|
const overview = showOverview ? overviewGraph : void 0;
|
|
15357
|
-
const hiddenLegendKeys = (0,
|
|
15358
|
-
const handleHiddenLegendKeysChange = (0,
|
|
15398
|
+
const hiddenLegendKeys = (0, import_react104.useRef)([]);
|
|
15399
|
+
const handleHiddenLegendKeysChange = (0, import_react104.useCallback)((keys) => {
|
|
15359
15400
|
hiddenLegendKeys.current = keys;
|
|
15360
15401
|
}, []);
|
|
15361
|
-
(0,
|
|
15402
|
+
(0, import_react104.useEffect)(() => {
|
|
15362
15403
|
setElem(document.getElementById(containerToRenderInto));
|
|
15363
15404
|
}, []);
|
|
15364
|
-
(0,
|
|
15405
|
+
(0, import_react104.useEffect)(() => {
|
|
15365
15406
|
const urlParams = new URLSearchParams(window.location.search);
|
|
15366
15407
|
const embed = urlParams.get("embed");
|
|
15367
15408
|
if (embed === "true") {
|
|
@@ -15371,7 +15412,7 @@ var NodeGraph = ({
|
|
|
15371
15412
|
if (!elem || graph && !graphLayout) return null;
|
|
15372
15413
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { children: (0, import_react_dom.createPortal)(
|
|
15373
15414
|
// Remount when switching graphs so each starts from a clean state
|
|
15374
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
15415
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react105.ReactFlowProvider, { children: [
|
|
15375
15416
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15376
15417
|
NodeGraphBuilder,
|
|
15377
15418
|
{
|