@eventcatalog/visualiser 4.0.0 → 4.0.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/index.js +230 -132
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -108,9 +108,9 @@ __export(index_exports, {
|
|
|
108
108
|
module.exports = __toCommonJS(index_exports);
|
|
109
109
|
|
|
110
110
|
// src/components/NodeGraph.tsx
|
|
111
|
-
var
|
|
111
|
+
var import_react90 = require("react");
|
|
112
112
|
var import_react_dom = require("react-dom");
|
|
113
|
-
var
|
|
113
|
+
var import_react91 = require("@xyflow/react");
|
|
114
114
|
var import_lucide_react37 = require("lucide-react");
|
|
115
115
|
var DropdownMenu2 = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
116
116
|
var import_html_to_image = require("html-to-image");
|
|
@@ -9959,9 +9959,109 @@ var NodeContextMenu_default = (0, import_react85.memo)(function NodeContextMenu(
|
|
|
9959
9959
|
] });
|
|
9960
9960
|
});
|
|
9961
9961
|
|
|
9962
|
+
// src/utils/export-image.ts
|
|
9963
|
+
var import_react86 = require("@xyflow/react");
|
|
9964
|
+
var MIN_IMAGE_WIDTH = 1024;
|
|
9965
|
+
var MIN_IMAGE_HEIGHT = 768;
|
|
9966
|
+
var EXPORT_PADDING = 40;
|
|
9967
|
+
function getExportImageDimensions(nodesBounds) {
|
|
9968
|
+
const paddedBounds = {
|
|
9969
|
+
x: nodesBounds.x - EXPORT_PADDING,
|
|
9970
|
+
y: nodesBounds.y - EXPORT_PADDING,
|
|
9971
|
+
width: nodesBounds.width + EXPORT_PADDING * 2,
|
|
9972
|
+
height: nodesBounds.height + EXPORT_PADDING * 2
|
|
9973
|
+
};
|
|
9974
|
+
const width = Math.max(MIN_IMAGE_WIDTH, Math.ceil(paddedBounds.width));
|
|
9975
|
+
const height = Math.max(MIN_IMAGE_HEIGHT, Math.ceil(paddedBounds.height));
|
|
9976
|
+
const viewport = (0, import_react86.getViewportForBounds)(paddedBounds, width, height, 0.5, 2, 0);
|
|
9977
|
+
return { width, height, viewport };
|
|
9978
|
+
}
|
|
9979
|
+
function extractEcVarNames(cssText) {
|
|
9980
|
+
return Array.from(new Set(cssText.match(/--ec-[a-z0-9-]+/g) ?? []));
|
|
9981
|
+
}
|
|
9982
|
+
function buildExportCss(themeVars) {
|
|
9983
|
+
const varDeclarations = Object.entries(themeVars).map(([name, value]) => `${name}: ${value};`).join(" ");
|
|
9984
|
+
return [
|
|
9985
|
+
// Applied to every element so the variables reach the cloned SVG subtree
|
|
9986
|
+
`* { ${varDeclarations} }`,
|
|
9987
|
+
// Mirrors .react-flow__edge-path in styles.css, which is lost in the clone
|
|
9988
|
+
`.react-flow__edge-path { stroke: var(--ec-edge-stroke, #6b7280); stroke-width: 1.5; fill: none; }`
|
|
9989
|
+
].join("\n");
|
|
9990
|
+
}
|
|
9991
|
+
function collectThemeCssVars(scope) {
|
|
9992
|
+
const names = /* @__PURE__ */ new Set();
|
|
9993
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
9994
|
+
let rules;
|
|
9995
|
+
try {
|
|
9996
|
+
rules = sheet.cssRules;
|
|
9997
|
+
} catch {
|
|
9998
|
+
continue;
|
|
9999
|
+
}
|
|
10000
|
+
for (const rule of Array.from(rules)) {
|
|
10001
|
+
for (const name of extractEcVarNames(rule.cssText)) {
|
|
10002
|
+
names.add(name);
|
|
10003
|
+
}
|
|
10004
|
+
}
|
|
10005
|
+
}
|
|
10006
|
+
const computed = window.getComputedStyle(scope);
|
|
10007
|
+
const vars = {};
|
|
10008
|
+
for (const name of names) {
|
|
10009
|
+
const value = computed.getPropertyValue(name).trim();
|
|
10010
|
+
if (value) vars[name] = value;
|
|
10011
|
+
}
|
|
10012
|
+
return vars;
|
|
10013
|
+
}
|
|
10014
|
+
var SVG_EXPORT_STYLE_PROPERTIES = [
|
|
10015
|
+
"fill",
|
|
10016
|
+
"fill-opacity",
|
|
10017
|
+
"stroke",
|
|
10018
|
+
"stroke-width",
|
|
10019
|
+
"stroke-dasharray",
|
|
10020
|
+
"stroke-linecap",
|
|
10021
|
+
"stroke-linejoin",
|
|
10022
|
+
"opacity",
|
|
10023
|
+
"font-family",
|
|
10024
|
+
"font-size",
|
|
10025
|
+
"font-weight",
|
|
10026
|
+
"letter-spacing",
|
|
10027
|
+
"text-anchor",
|
|
10028
|
+
"dominant-baseline"
|
|
10029
|
+
];
|
|
10030
|
+
function inlineSvgComputedStyles(viewport) {
|
|
10031
|
+
const restores = [];
|
|
10032
|
+
const svgElements = viewport.querySelectorAll("svg, svg *");
|
|
10033
|
+
svgElements.forEach((element) => {
|
|
10034
|
+
if (!(element instanceof SVGElement)) return;
|
|
10035
|
+
const computed = window.getComputedStyle(element);
|
|
10036
|
+
const originalStyle = element.getAttribute("style");
|
|
10037
|
+
for (const property of SVG_EXPORT_STYLE_PROPERTIES) {
|
|
10038
|
+
const value = computed.getPropertyValue(property);
|
|
10039
|
+
if (value) element.style.setProperty(property, value);
|
|
10040
|
+
}
|
|
10041
|
+
restores.push(() => {
|
|
10042
|
+
if (originalStyle === null) {
|
|
10043
|
+
element.removeAttribute("style");
|
|
10044
|
+
} else {
|
|
10045
|
+
element.setAttribute("style", originalStyle);
|
|
10046
|
+
}
|
|
10047
|
+
});
|
|
10048
|
+
});
|
|
10049
|
+
return () => restores.forEach((restore) => restore());
|
|
10050
|
+
}
|
|
10051
|
+
function injectExportStyles(viewport) {
|
|
10052
|
+
const styleElement = document.createElement("style");
|
|
10053
|
+
styleElement.textContent = buildExportCss(collectThemeCssVars(viewport));
|
|
10054
|
+
viewport.appendChild(styleElement);
|
|
10055
|
+
const restoreSvgStyles = inlineSvgComputedStyles(viewport);
|
|
10056
|
+
return () => {
|
|
10057
|
+
restoreSvgStyles();
|
|
10058
|
+
styleElement.remove();
|
|
10059
|
+
};
|
|
10060
|
+
}
|
|
10061
|
+
|
|
9962
10062
|
// src/utils/layout.ts
|
|
9963
10063
|
var import_dagre2 = __toESM(require("dagre"));
|
|
9964
|
-
var
|
|
10064
|
+
var import_react87 = require("@xyflow/react");
|
|
9965
10065
|
var GROUP_HEADER_HEIGHT = 44;
|
|
9966
10066
|
var GROUP_CONTENT_PADDING_TOP = 50;
|
|
9967
10067
|
var GROUP_CONTENT_PADDING_BOTTOM = 30;
|
|
@@ -10402,7 +10502,7 @@ function layoutGraph(nodes, edges, options = {}, style) {
|
|
|
10402
10502
|
const isCalls = edge.type === "calls";
|
|
10403
10503
|
const isBidirectional = edge.type === "reads-writes";
|
|
10404
10504
|
const arrowMarker = {
|
|
10405
|
-
type:
|
|
10505
|
+
type: import_react87.MarkerType.ArrowClosed,
|
|
10406
10506
|
width: 20,
|
|
10407
10507
|
height: 20,
|
|
10408
10508
|
color: "rgb(var(--ec-page-text-muted))"
|
|
@@ -10460,7 +10560,7 @@ function flatLayout(nodes, edges, graphOpts, nodeSize, style) {
|
|
|
10460
10560
|
const isCalls = edge.type === "calls";
|
|
10461
10561
|
const isBidirectional = edge.type === "reads-writes";
|
|
10462
10562
|
const arrowMarker = {
|
|
10463
|
-
type:
|
|
10563
|
+
type: import_react87.MarkerType.ArrowClosed,
|
|
10464
10564
|
width: 20,
|
|
10465
10565
|
height: 20,
|
|
10466
10566
|
color: "rgb(var(--ec-page-text-muted))"
|
|
@@ -10594,9 +10694,9 @@ var buildMessageGroupExpansionNodes = ({
|
|
|
10594
10694
|
};
|
|
10595
10695
|
|
|
10596
10696
|
// src/components/NotesToolbarButton.tsx
|
|
10597
|
-
var
|
|
10697
|
+
var import_react88 = require("react");
|
|
10598
10698
|
var import_lucide_react36 = require("lucide-react");
|
|
10599
|
-
var
|
|
10699
|
+
var import_react89 = require("@xyflow/react");
|
|
10600
10700
|
var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
|
|
10601
10701
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
10602
10702
|
var NODE_TYPE_META = {
|
|
@@ -10859,12 +10959,12 @@ function AllNotesModal({
|
|
|
10859
10959
|
onClose,
|
|
10860
10960
|
nodes
|
|
10861
10961
|
}) {
|
|
10862
|
-
const { setCenter, getZoom } = (0,
|
|
10863
|
-
const [selectedIdx, setSelectedIdx] = (0,
|
|
10962
|
+
const { setCenter, getZoom } = (0, import_react89.useReactFlow)();
|
|
10963
|
+
const [selectedIdx, setSelectedIdx] = (0, import_react88.useState)(0);
|
|
10864
10964
|
const portalContainer = usePortalContainer();
|
|
10865
10965
|
const totalNotes = noteGroups.reduce((sum, g) => sum + g.notes.length, 0);
|
|
10866
10966
|
const selected = noteGroups[selectedIdx] || noteGroups[0];
|
|
10867
|
-
const handleNavigate = (0,
|
|
10967
|
+
const handleNavigate = (0, import_react88.useCallback)(
|
|
10868
10968
|
(nodeId) => {
|
|
10869
10969
|
const node = nodes.find((n) => n.id === nodeId);
|
|
10870
10970
|
if (!node) return;
|
|
@@ -11348,13 +11448,13 @@ var LEGEND_ICONS = {
|
|
|
11348
11448
|
field: { Icon: import_lucide_react37.Box, colorClass: "text-cyan-600" }
|
|
11349
11449
|
};
|
|
11350
11450
|
var getLegendIcon = (key) => LEGEND_ICONS[key];
|
|
11351
|
-
var LegendPanel = (0,
|
|
11451
|
+
var LegendPanel = (0, import_react90.memo)(function LegendPanel2({
|
|
11352
11452
|
legend,
|
|
11353
11453
|
showMinimap,
|
|
11354
11454
|
onLegendClick
|
|
11355
11455
|
}) {
|
|
11356
11456
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
11357
|
-
|
|
11457
|
+
import_react91.Panel,
|
|
11358
11458
|
{
|
|
11359
11459
|
position: "bottom-right",
|
|
11360
11460
|
style: showMinimap ? LEGEND_PANEL_STYLE_WITH_MINIMAP : void 0,
|
|
@@ -11395,7 +11495,7 @@ var GROUP_EDGE_STYLE = {
|
|
|
11395
11495
|
stroke: "var(--ec-edge-stroke, #6b7280)"
|
|
11396
11496
|
};
|
|
11397
11497
|
var GROUP_EDGE_MARKER = {
|
|
11398
|
-
type:
|
|
11498
|
+
type: import_react91.MarkerType.ArrowClosed,
|
|
11399
11499
|
width: 20,
|
|
11400
11500
|
height: 20
|
|
11401
11501
|
};
|
|
@@ -11492,14 +11592,14 @@ var NodeGraphBuilder = ({
|
|
|
11492
11592
|
onSaveLayout,
|
|
11493
11593
|
onResetLayout
|
|
11494
11594
|
}) => {
|
|
11495
|
-
(0,
|
|
11595
|
+
(0, import_react90.useEffect)(() => {
|
|
11496
11596
|
if (onBuildUrl) {
|
|
11497
11597
|
setBuildUrlFn(onBuildUrl);
|
|
11498
11598
|
}
|
|
11499
11599
|
}, []);
|
|
11500
|
-
const nodeTypes = (0,
|
|
11600
|
+
const nodeTypes = (0, import_react90.useMemo)(() => {
|
|
11501
11601
|
const wrapWithContextMenu = (Component) => {
|
|
11502
|
-
const Wrapped = (0,
|
|
11602
|
+
const Wrapped = (0, import_react90.memo)((props) => {
|
|
11503
11603
|
const items = props.data?.contextMenu;
|
|
11504
11604
|
if (!items?.length) return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Component, { ...props });
|
|
11505
11605
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(NodeContextMenu_default, { items, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Component, { ...props }) });
|
|
@@ -11544,14 +11644,14 @@ var NodeGraphBuilder = ({
|
|
|
11544
11644
|
"data-products": wrapWithContextMenu(DataProduct_default),
|
|
11545
11645
|
group: GroupNode_default,
|
|
11546
11646
|
"system-group": SystemGroupNode_default,
|
|
11547
|
-
note: (0,
|
|
11647
|
+
note: (0, import_react90.memo)((props) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(NoteNode_default, { ...props, readOnly: true })),
|
|
11548
11648
|
field: wrapWithContextMenu(FieldNode_default),
|
|
11549
11649
|
messageGroup: MessageGroupNode_default,
|
|
11550
11650
|
messageGroupExpanded: MessageGroupExpandedNode_default,
|
|
11551
11651
|
flowExpanded: FlowExpandedNode_default
|
|
11552
11652
|
};
|
|
11553
11653
|
}, []);
|
|
11554
|
-
const edgeTypes2 = (0,
|
|
11654
|
+
const edgeTypes2 = (0, import_react90.useMemo)(
|
|
11555
11655
|
() => ({
|
|
11556
11656
|
animated: AnimatedMessageEdge_default,
|
|
11557
11657
|
multiline: MultilineEdgeLabel_default,
|
|
@@ -11559,47 +11659,48 @@ var NodeGraphBuilder = ({
|
|
|
11559
11659
|
}),
|
|
11560
11660
|
[]
|
|
11561
11661
|
);
|
|
11562
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
11563
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
11564
|
-
const { fitView, getNodes, getIntersectingNodes, getZoom, setCenter } = (0,
|
|
11565
|
-
(0,
|
|
11662
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react91.useNodesState)(initialNodes);
|
|
11663
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react91.useEdgesState)(initialEdges);
|
|
11664
|
+
const { fitView, getNodes, getIntersectingNodes, getZoom, setCenter } = (0, import_react91.useReactFlow)();
|
|
11665
|
+
const storeApi = (0, import_react91.useStoreApi)();
|
|
11666
|
+
(0, import_react90.useEffect)(() => {
|
|
11566
11667
|
setNodes(initialNodes);
|
|
11567
11668
|
setEdges(initialEdges);
|
|
11568
11669
|
requestAnimationFrame(() => {
|
|
11569
11670
|
fitView({ duration: 300, padding: 0.2 });
|
|
11570
11671
|
});
|
|
11571
11672
|
}, [initialNodes, initialEdges, setNodes, setEdges, fitView]);
|
|
11572
|
-
const [animateMessages, setAnimateMessages] = (0,
|
|
11573
|
-
const [_activeStepIndex, _setActiveStepIndex] = (0,
|
|
11574
|
-
const [_isFullscreen, _setIsFullscreen] = (0,
|
|
11575
|
-
const [isShareModalOpen, setIsShareModalOpen] = (0,
|
|
11576
|
-
const [shareUrlCopySuccess, setShareUrlCopySuccess] = (0,
|
|
11577
|
-
const [isMermaidView, setIsMermaidView] = (0,
|
|
11578
|
-
const [showMinimap, setShowMinimap] = (0,
|
|
11579
|
-
const [hasLayoutChanges, setHasLayoutChanges] = (0,
|
|
11580
|
-
const [isSavingLayout, setIsSavingLayout] = (0,
|
|
11581
|
-
const initialPositionsRef = (0,
|
|
11673
|
+
const [animateMessages, setAnimateMessages] = (0, import_react90.useState)(true);
|
|
11674
|
+
const [_activeStepIndex, _setActiveStepIndex] = (0, import_react90.useState)(null);
|
|
11675
|
+
const [_isFullscreen, _setIsFullscreen] = (0, import_react90.useState)(false);
|
|
11676
|
+
const [isShareModalOpen, setIsShareModalOpen] = (0, import_react90.useState)(false);
|
|
11677
|
+
const [shareUrlCopySuccess, setShareUrlCopySuccess] = (0, import_react90.useState)(false);
|
|
11678
|
+
const [isMermaidView, setIsMermaidView] = (0, import_react90.useState)(false);
|
|
11679
|
+
const [showMinimap, setShowMinimap] = (0, import_react90.useState)(false);
|
|
11680
|
+
const [hasLayoutChanges, setHasLayoutChanges] = (0, import_react90.useState)(false);
|
|
11681
|
+
const [isSavingLayout, setIsSavingLayout] = (0, import_react90.useState)(false);
|
|
11682
|
+
const initialPositionsRef = (0, import_react90.useRef)(
|
|
11582
11683
|
{}
|
|
11583
11684
|
);
|
|
11584
|
-
const [focusModeOpen, setFocusModeOpen] = (0,
|
|
11585
|
-
const [focusedNodeId, setFocusedNodeId] = (0,
|
|
11586
|
-
const [isNotesModalOpen, setIsNotesModalOpen] = (0,
|
|
11587
|
-
const openNotesModal = (0,
|
|
11588
|
-
const interactionCountRef = (0,
|
|
11589
|
-
const startInteraction = (0,
|
|
11685
|
+
const [focusModeOpen, setFocusModeOpen] = (0, import_react90.useState)(false);
|
|
11686
|
+
const [focusedNodeId, setFocusedNodeId] = (0, import_react90.useState)(null);
|
|
11687
|
+
const [isNotesModalOpen, setIsNotesModalOpen] = (0, import_react90.useState)(false);
|
|
11688
|
+
const openNotesModal = (0, import_react90.useCallback)(() => setIsNotesModalOpen(true), []);
|
|
11689
|
+
const interactionCountRef = (0, import_react90.useRef)(0);
|
|
11690
|
+
const startInteraction = (0, import_react90.useCallback)(() => {
|
|
11590
11691
|
interactionCountRef.current += 1;
|
|
11591
11692
|
if (interactionCountRef.current === 1) {
|
|
11592
11693
|
reactFlowWrapperRef.current?.classList.add("ec-interaction-active");
|
|
11593
11694
|
}
|
|
11594
11695
|
}, []);
|
|
11595
|
-
const endInteraction = (0,
|
|
11696
|
+
const endInteraction = (0, import_react90.useCallback)(() => {
|
|
11596
11697
|
interactionCountRef.current = Math.max(0, interactionCountRef.current - 1);
|
|
11597
11698
|
if (interactionCountRef.current === 0) {
|
|
11598
11699
|
reactFlowWrapperRef.current?.classList.remove("ec-interaction-active");
|
|
11599
11700
|
}
|
|
11600
11701
|
}, []);
|
|
11601
|
-
const hoveredEdgeNodesRef = (0,
|
|
11602
|
-
const handleEdgeMouseEnter = (0,
|
|
11702
|
+
const hoveredEdgeNodesRef = (0, import_react90.useRef)([]);
|
|
11703
|
+
const handleEdgeMouseEnter = (0, import_react90.useCallback)(
|
|
11603
11704
|
(_, edge) => {
|
|
11604
11705
|
const wrapper = reactFlowWrapperRef.current;
|
|
11605
11706
|
if (!wrapper) return;
|
|
@@ -11611,15 +11712,15 @@ var NodeGraphBuilder = ({
|
|
|
11611
11712
|
},
|
|
11612
11713
|
[]
|
|
11613
11714
|
);
|
|
11614
|
-
const handleEdgeMouseLeave = (0,
|
|
11715
|
+
const handleEdgeMouseLeave = (0, import_react90.useCallback)(() => {
|
|
11615
11716
|
hoveredEdgeNodesRef.current.forEach(
|
|
11616
11717
|
(el) => el.classList.remove("ec-edge-hover-node")
|
|
11617
11718
|
);
|
|
11618
11719
|
hoveredEdgeNodesRef.current = [];
|
|
11619
11720
|
}, []);
|
|
11620
|
-
const hoveredNodeEdgesRef = (0,
|
|
11621
|
-
const hoveredNodePeersRef = (0,
|
|
11622
|
-
const handleNodeMouseEnter = (0,
|
|
11721
|
+
const hoveredNodeEdgesRef = (0, import_react90.useRef)([]);
|
|
11722
|
+
const hoveredNodePeersRef = (0, import_react90.useRef)([]);
|
|
11723
|
+
const handleNodeMouseEnter = (0, import_react90.useCallback)(
|
|
11623
11724
|
(_, node) => {
|
|
11624
11725
|
const wrapper = reactFlowWrapperRef.current;
|
|
11625
11726
|
if (!wrapper) return;
|
|
@@ -11648,7 +11749,7 @@ var NodeGraphBuilder = ({
|
|
|
11648
11749
|
},
|
|
11649
11750
|
[]
|
|
11650
11751
|
);
|
|
11651
|
-
const handleNodeMouseLeave = (0,
|
|
11752
|
+
const handleNodeMouseLeave = (0, import_react90.useCallback)(() => {
|
|
11652
11753
|
hoveredNodeEdgesRef.current.forEach(
|
|
11653
11754
|
(el) => el.classList.remove("ec-node-hover-edge")
|
|
11654
11755
|
);
|
|
@@ -11658,7 +11759,7 @@ var NodeGraphBuilder = ({
|
|
|
11658
11759
|
);
|
|
11659
11760
|
hoveredNodePeersRef.current = [];
|
|
11660
11761
|
}, []);
|
|
11661
|
-
const hasChannels = (0,
|
|
11762
|
+
const hasChannels = (0, import_react90.useMemo)(
|
|
11662
11763
|
() => initialNodes.some((node) => node.type === "channels"),
|
|
11663
11764
|
[initialNodes]
|
|
11664
11765
|
);
|
|
@@ -11669,39 +11770,39 @@ var NodeGraphBuilder = ({
|
|
|
11669
11770
|
setEdges,
|
|
11670
11771
|
skipProcessing: !hasChannels
|
|
11671
11772
|
});
|
|
11672
|
-
const searchRef = (0,
|
|
11673
|
-
const reactFlowWrapperRef = (0,
|
|
11674
|
-
const scrollableContainerRef = (0,
|
|
11675
|
-
const nodesRef = (0,
|
|
11773
|
+
const searchRef = (0, import_react90.useRef)(null);
|
|
11774
|
+
const reactFlowWrapperRef = (0, import_react90.useRef)(null);
|
|
11775
|
+
const scrollableContainerRef = (0, import_react90.useRef)(null);
|
|
11776
|
+
const nodesRef = (0, import_react90.useRef)(nodes);
|
|
11676
11777
|
nodesRef.current = nodes;
|
|
11677
|
-
const edgesRef = (0,
|
|
11778
|
+
const edgesRef = (0, import_react90.useRef)(edges);
|
|
11678
11779
|
edgesRef.current = edges;
|
|
11679
|
-
const hideChannelsRef = (0,
|
|
11780
|
+
const hideChannelsRef = (0, import_react90.useRef)(hideChannels);
|
|
11680
11781
|
hideChannelsRef.current = hideChannels;
|
|
11681
|
-
const wrapperNodeIds = (0,
|
|
11782
|
+
const wrapperNodeIds = (0, import_react90.useMemo)(() => {
|
|
11682
11783
|
const ids = /* @__PURE__ */ new Set();
|
|
11683
11784
|
nodes.forEach((n) => {
|
|
11684
11785
|
if (isExpandedWrapper(n.type)) ids.add(n.id);
|
|
11685
11786
|
});
|
|
11686
11787
|
return ids;
|
|
11687
11788
|
}, [nodes]);
|
|
11688
|
-
const walkthroughNodes = (0,
|
|
11789
|
+
const walkthroughNodes = (0, import_react90.useMemo)(
|
|
11689
11790
|
() => wrapperNodeIds.size === 0 ? nodes : nodes.filter((n) => !wrapperNodeIds.has(n.id)),
|
|
11690
11791
|
[nodes, wrapperNodeIds]
|
|
11691
11792
|
);
|
|
11692
|
-
const walkthroughEdges = (0,
|
|
11793
|
+
const walkthroughEdges = (0, import_react90.useMemo)(
|
|
11693
11794
|
() => wrapperNodeIds.size === 0 ? edges : edges.filter(
|
|
11694
11795
|
(e) => !wrapperNodeIds.has(e.source) && !wrapperNodeIds.has(e.target)
|
|
11695
11796
|
),
|
|
11696
11797
|
[edges, wrapperNodeIds]
|
|
11697
11798
|
);
|
|
11698
|
-
const animateLayout = (0,
|
|
11799
|
+
const animateLayout = (0, import_react90.useCallback)(() => {
|
|
11699
11800
|
const wrapper = reactFlowWrapperRef.current;
|
|
11700
11801
|
if (!wrapper) return;
|
|
11701
11802
|
wrapper.classList.add("ec-animating-layout");
|
|
11702
11803
|
setTimeout(() => wrapper.classList.remove("ec-animating-layout"), 400);
|
|
11703
11804
|
}, []);
|
|
11704
|
-
const relayoutGraph = (0,
|
|
11805
|
+
const relayoutGraph = (0, import_react90.useCallback)(
|
|
11705
11806
|
(nextNodes, nextEdges, anchor) => {
|
|
11706
11807
|
const g = new import_dagre3.default.graphlib.Graph({ compound: true });
|
|
11707
11808
|
g.setGraph({ rankdir: "LR", ranksep: 300, nodesep: 50 });
|
|
@@ -11773,7 +11874,7 @@ var NodeGraphBuilder = ({
|
|
|
11773
11874
|
},
|
|
11774
11875
|
[]
|
|
11775
11876
|
);
|
|
11776
|
-
const makeRoomForRenderedExpandedGroup = (0,
|
|
11877
|
+
const makeRoomForRenderedExpandedGroup = (0, import_react90.useCallback)(
|
|
11777
11878
|
(groupNodeId, groupBounds) => {
|
|
11778
11879
|
const padding = 80;
|
|
11779
11880
|
const protectedBounds = {
|
|
@@ -11802,7 +11903,7 @@ var NodeGraphBuilder = ({
|
|
|
11802
11903
|
},
|
|
11803
11904
|
[getIntersectingNodes, setNodes]
|
|
11804
11905
|
);
|
|
11805
|
-
const layoutSubFlowChildren = (0,
|
|
11906
|
+
const layoutSubFlowChildren = (0, import_react90.useCallback)(
|
|
11806
11907
|
(children, edges2, sizeOf, opts) => {
|
|
11807
11908
|
const { padding, headerH, fallbackW = 240, fallbackH = 120 } = opts;
|
|
11808
11909
|
const g = new import_dagre3.default.graphlib.Graph();
|
|
@@ -11852,7 +11953,7 @@ var NodeGraphBuilder = ({
|
|
|
11852
11953
|
},
|
|
11853
11954
|
[]
|
|
11854
11955
|
);
|
|
11855
|
-
const handleCollapseGroup = (0,
|
|
11956
|
+
const handleCollapseGroup = (0, import_react90.useCallback)(
|
|
11856
11957
|
(e) => {
|
|
11857
11958
|
const target = e.target;
|
|
11858
11959
|
const collapseBtn = target.closest(
|
|
@@ -11929,7 +12030,7 @@ var NodeGraphBuilder = ({
|
|
|
11929
12030
|
animateLayout
|
|
11930
12031
|
]
|
|
11931
12032
|
);
|
|
11932
|
-
(0,
|
|
12033
|
+
(0, import_react90.useEffect)(() => {
|
|
11933
12034
|
if (isDevMode && initialNodes.length > 0) {
|
|
11934
12035
|
const positions = {};
|
|
11935
12036
|
initialNodes.forEach((node) => {
|
|
@@ -11938,7 +12039,7 @@ var NodeGraphBuilder = ({
|
|
|
11938
12039
|
initialPositionsRef.current = positions;
|
|
11939
12040
|
}
|
|
11940
12041
|
}, [isDevMode, initialNodes]);
|
|
11941
|
-
const checkForLayoutChanges = (0,
|
|
12042
|
+
const checkForLayoutChanges = (0, import_react90.useCallback)(() => {
|
|
11942
12043
|
if (!isDevMode) return;
|
|
11943
12044
|
const initial = initialPositionsRef.current;
|
|
11944
12045
|
if (Object.keys(initial).length === 0) return;
|
|
@@ -11948,7 +12049,7 @@ var NodeGraphBuilder = ({
|
|
|
11948
12049
|
});
|
|
11949
12050
|
setHasLayoutChanges(hasChanges);
|
|
11950
12051
|
}, [isDevMode]);
|
|
11951
|
-
const handleNodesChange = (0,
|
|
12052
|
+
const handleNodesChange = (0, import_react90.useCallback)(
|
|
11952
12053
|
(changes) => {
|
|
11953
12054
|
onNodesChange(changes);
|
|
11954
12055
|
const hasDragEnd = changes.some(
|
|
@@ -11960,7 +12061,7 @@ var NodeGraphBuilder = ({
|
|
|
11960
12061
|
},
|
|
11961
12062
|
[onNodesChange, checkForLayoutChanges]
|
|
11962
12063
|
);
|
|
11963
|
-
const resetNodesAndEdges = (0,
|
|
12064
|
+
const resetNodesAndEdges = (0, import_react90.useCallback)(() => {
|
|
11964
12065
|
setNodes(
|
|
11965
12066
|
(nds) => nds.map((node) => {
|
|
11966
12067
|
node.style = { ...node.style, opacity: 1 };
|
|
@@ -11979,7 +12080,7 @@ var NodeGraphBuilder = ({
|
|
|
11979
12080
|
})
|
|
11980
12081
|
);
|
|
11981
12082
|
}, [setNodes, setEdges, animateMessages]);
|
|
11982
|
-
(0,
|
|
12083
|
+
(0, import_react90.useEffect)(() => {
|
|
11983
12084
|
if (!focusNodeId) return;
|
|
11984
12085
|
const targetNode = nodesRef.current.find((node) => node.id === focusNodeId);
|
|
11985
12086
|
if (!targetNode) return;
|
|
@@ -11997,13 +12098,13 @@ var NodeGraphBuilder = ({
|
|
|
11997
12098
|
});
|
|
11998
12099
|
});
|
|
11999
12100
|
}, [focusNodeId, focusRequestId, fitView, setNodes]);
|
|
12000
|
-
(0,
|
|
12101
|
+
(0, import_react90.useEffect)(() => {
|
|
12001
12102
|
if (fitRequestId == null) return;
|
|
12002
12103
|
requestAnimationFrame(() => {
|
|
12003
12104
|
fitView({ duration: 400, padding: 0.2 });
|
|
12004
12105
|
});
|
|
12005
12106
|
}, [fitRequestId, fitView]);
|
|
12006
|
-
const handleNodeClick = (0,
|
|
12107
|
+
const handleNodeClick = (0, import_react90.useCallback)(
|
|
12007
12108
|
(_, node) => {
|
|
12008
12109
|
if (onNodeClick) {
|
|
12009
12110
|
onNodeClick(node);
|
|
@@ -12402,7 +12503,7 @@ var NodeGraphBuilder = ({
|
|
|
12402
12503
|
setCenter
|
|
12403
12504
|
]
|
|
12404
12505
|
);
|
|
12405
|
-
const toggleAnimateMessages = (0,
|
|
12506
|
+
const toggleAnimateMessages = (0, import_react90.useCallback)(() => {
|
|
12406
12507
|
setAnimateMessages((prev) => {
|
|
12407
12508
|
const next = !prev;
|
|
12408
12509
|
localStorage.setItem(
|
|
@@ -12412,10 +12513,10 @@ var NodeGraphBuilder = ({
|
|
|
12412
12513
|
return next;
|
|
12413
12514
|
});
|
|
12414
12515
|
}, []);
|
|
12415
|
-
const handleFitView = (0,
|
|
12516
|
+
const handleFitView = (0, import_react90.useCallback)(() => {
|
|
12416
12517
|
fitView({ duration: 400, padding: 0.2 });
|
|
12417
12518
|
}, [fitView]);
|
|
12418
|
-
(0,
|
|
12519
|
+
(0, import_react90.useEffect)(() => {
|
|
12419
12520
|
if (disableMessageAnimation) {
|
|
12420
12521
|
setAnimateMessages(false);
|
|
12421
12522
|
return;
|
|
@@ -12441,7 +12542,7 @@ var NodeGraphBuilder = ({
|
|
|
12441
12542
|
}
|
|
12442
12543
|
}
|
|
12443
12544
|
}, [animated, disableMessageAnimation, initialNodes.length]);
|
|
12444
|
-
(0,
|
|
12545
|
+
(0, import_react90.useEffect)(() => {
|
|
12445
12546
|
setEdges(
|
|
12446
12547
|
(eds) => eds.map((edge) => {
|
|
12447
12548
|
const preservesOwnRenderer = edge.type === "flow-edge" || edge.type === "multiline" || edge.type === "default" || edge.type === "step" || edge.type === "smoothstep" || edge.data?.animated === false;
|
|
@@ -12458,12 +12559,12 @@ var NodeGraphBuilder = ({
|
|
|
12458
12559
|
})
|
|
12459
12560
|
);
|
|
12460
12561
|
}, [animateMessages]);
|
|
12461
|
-
(0,
|
|
12562
|
+
(0, import_react90.useEffect)(() => {
|
|
12462
12563
|
setTimeout(() => {
|
|
12463
12564
|
fitView({ duration: 800 });
|
|
12464
12565
|
}, 150);
|
|
12465
12566
|
}, []);
|
|
12466
|
-
const generateMermaidCode = (0,
|
|
12567
|
+
const generateMermaidCode = (0, import_react90.useCallback)(() => {
|
|
12467
12568
|
try {
|
|
12468
12569
|
return convertToMermaid(nodesRef.current, edgesRef.current, {
|
|
12469
12570
|
includeStyles: true,
|
|
@@ -12474,7 +12575,7 @@ var NodeGraphBuilder = ({
|
|
|
12474
12575
|
return "";
|
|
12475
12576
|
}
|
|
12476
12577
|
}, []);
|
|
12477
|
-
(0,
|
|
12578
|
+
(0, import_react90.useEffect)(() => {
|
|
12478
12579
|
if (zoomOnScroll) return;
|
|
12479
12580
|
const findScrollableContainer = () => {
|
|
12480
12581
|
const selectors = [
|
|
@@ -12519,34 +12620,34 @@ var NodeGraphBuilder = ({
|
|
|
12519
12620
|
};
|
|
12520
12621
|
}
|
|
12521
12622
|
}, [zoomOnScroll]);
|
|
12522
|
-
const handlePaneClick = (0,
|
|
12623
|
+
const handlePaneClick = (0, import_react90.useCallback)(() => {
|
|
12523
12624
|
searchRef.current?.hideSuggestions();
|
|
12524
12625
|
resetNodesAndEdges();
|
|
12525
12626
|
fitView({ duration: 800 });
|
|
12526
12627
|
}, [resetNodesAndEdges, fitView]);
|
|
12527
|
-
const handleNodeSelect = (0,
|
|
12628
|
+
const handleNodeSelect = (0, import_react90.useCallback)(
|
|
12528
12629
|
(node) => {
|
|
12529
12630
|
handleNodeClick(null, node);
|
|
12530
12631
|
},
|
|
12531
12632
|
[handleNodeClick]
|
|
12532
12633
|
);
|
|
12533
|
-
const handleSearchClear = (0,
|
|
12634
|
+
const handleSearchClear = (0, import_react90.useCallback)(() => {
|
|
12534
12635
|
resetNodesAndEdges();
|
|
12535
12636
|
fitView({ duration: 800 });
|
|
12536
12637
|
}, [resetNodesAndEdges, fitView]);
|
|
12537
|
-
const downloadImage = (0,
|
|
12638
|
+
const downloadImage = (0, import_react90.useCallback)((dataUrl, filename) => {
|
|
12538
12639
|
const a = document.createElement("a");
|
|
12539
12640
|
a.setAttribute("download", `${filename || "eventcatalog"}.png`);
|
|
12540
12641
|
a.setAttribute("href", dataUrl);
|
|
12541
12642
|
a.click();
|
|
12542
12643
|
}, []);
|
|
12543
|
-
const openStudioModal = (0,
|
|
12644
|
+
const openStudioModal = (0, import_react90.useCallback)(() => {
|
|
12544
12645
|
setIsStudioModalOpen(true);
|
|
12545
12646
|
}, [setIsStudioModalOpen]);
|
|
12546
|
-
const openChat = (0,
|
|
12647
|
+
const openChat = (0, import_react90.useCallback)(() => {
|
|
12547
12648
|
window.dispatchEvent(new CustomEvent("eventcatalog:open-chat"));
|
|
12548
12649
|
}, []);
|
|
12549
|
-
const handleSaveLayout = (0,
|
|
12650
|
+
const handleSaveLayout = (0, import_react90.useCallback)(async () => {
|
|
12550
12651
|
if (!resourceKey || !onSaveLayout) return false;
|
|
12551
12652
|
const positions = {};
|
|
12552
12653
|
nodesRef.current.forEach((node) => {
|
|
@@ -12557,11 +12658,11 @@ var NodeGraphBuilder = ({
|
|
|
12557
12658
|
});
|
|
12558
12659
|
return await onSaveLayout(resourceKey, positions);
|
|
12559
12660
|
}, [resourceKey, onSaveLayout]);
|
|
12560
|
-
const handleResetLayout = (0,
|
|
12661
|
+
const handleResetLayout = (0, import_react90.useCallback)(async () => {
|
|
12561
12662
|
if (!resourceKey || !onResetLayout) return false;
|
|
12562
12663
|
return await onResetLayout(resourceKey);
|
|
12563
12664
|
}, [resourceKey, onResetLayout]);
|
|
12564
|
-
const handleQuickSaveLayout = (0,
|
|
12665
|
+
const handleQuickSaveLayout = (0, import_react90.useCallback)(async () => {
|
|
12565
12666
|
setIsSavingLayout(true);
|
|
12566
12667
|
const success = await handleSaveLayout();
|
|
12567
12668
|
setIsSavingLayout(false);
|
|
@@ -12574,17 +12675,17 @@ var NodeGraphBuilder = ({
|
|
|
12574
12675
|
setHasLayoutChanges(false);
|
|
12575
12676
|
}
|
|
12576
12677
|
}, [handleSaveLayout]);
|
|
12577
|
-
const handleCopyArchitectureCode = (0,
|
|
12678
|
+
const handleCopyArchitectureCode = (0, import_react90.useCallback)(async () => {
|
|
12578
12679
|
const code = generateMermaidCode();
|
|
12579
12680
|
await copyToClipboard(code);
|
|
12580
12681
|
}, [generateMermaidCode]);
|
|
12581
|
-
const handleCopyShareUrl = (0,
|
|
12682
|
+
const handleCopyShareUrl = (0, import_react90.useCallback)(async () => {
|
|
12582
12683
|
const url = typeof window !== "undefined" ? window.location.href : "";
|
|
12583
12684
|
await copyToClipboard(url);
|
|
12584
12685
|
setShareUrlCopySuccess(true);
|
|
12585
12686
|
setTimeout(() => setShareUrlCopySuccess(false), 2e3);
|
|
12586
12687
|
}, []);
|
|
12587
|
-
const toggleFullScreen = (0,
|
|
12688
|
+
const toggleFullScreen = (0, import_react90.useCallback)(() => {
|
|
12588
12689
|
if (!document.fullscreenElement) {
|
|
12589
12690
|
reactFlowWrapperRef.current?.requestFullscreen().catch((err) => {
|
|
12590
12691
|
console.error(
|
|
@@ -12595,7 +12696,7 @@ var NodeGraphBuilder = ({
|
|
|
12595
12696
|
document.exitFullscreen();
|
|
12596
12697
|
}
|
|
12597
12698
|
}, []);
|
|
12598
|
-
(0,
|
|
12699
|
+
(0, import_react90.useEffect)(() => {
|
|
12599
12700
|
const handleFullscreenChange = () => {
|
|
12600
12701
|
_setIsFullscreen(!!document.fullscreenElement);
|
|
12601
12702
|
setTimeout(() => {
|
|
@@ -12607,39 +12708,36 @@ var NodeGraphBuilder = ({
|
|
|
12607
12708
|
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
12608
12709
|
};
|
|
12609
12710
|
}, [fitView]);
|
|
12610
|
-
const handleExportVisual = (0,
|
|
12611
|
-
const
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
const width
|
|
12615
|
-
const height = imageHeight > nodesBounds.height ? imageHeight : nodesBounds.height;
|
|
12616
|
-
const viewport = (0, import_react90.getViewportForBounds)(
|
|
12617
|
-
nodesBounds,
|
|
12618
|
-
width,
|
|
12619
|
-
height,
|
|
12620
|
-
0.5,
|
|
12621
|
-
2,
|
|
12622
|
-
0
|
|
12623
|
-
);
|
|
12711
|
+
const handleExportVisual = (0, import_react90.useCallback)(() => {
|
|
12712
|
+
const nodesBounds = (0, import_react91.getNodesBounds)(getNodes(), {
|
|
12713
|
+
nodeLookup: storeApi.getState().nodeLookup
|
|
12714
|
+
});
|
|
12715
|
+
const { width, height, viewport } = getExportImageDimensions(nodesBounds);
|
|
12624
12716
|
const controls = document.querySelector(
|
|
12625
12717
|
".react-flow__controls"
|
|
12626
12718
|
);
|
|
12627
12719
|
if (controls) controls.style.display = "none";
|
|
12628
|
-
|
|
12720
|
+
const viewportElement = document.querySelector(
|
|
12721
|
+
".react-flow__viewport"
|
|
12722
|
+
);
|
|
12723
|
+
const removeExportStyles = injectExportStyles(viewportElement);
|
|
12724
|
+
(0, import_html_to_image.toPng)(viewportElement, {
|
|
12629
12725
|
backgroundColor: "#f1f1f1",
|
|
12630
12726
|
width,
|
|
12631
12727
|
height,
|
|
12632
12728
|
style: {
|
|
12633
|
-
width: width
|
|
12634
|
-
height: height
|
|
12729
|
+
width: `${width}px`,
|
|
12730
|
+
height: `${height}px`,
|
|
12635
12731
|
transform: `translate(${viewport.x}px, ${viewport.y}px) scale(${viewport.zoom})`
|
|
12636
12732
|
}
|
|
12637
12733
|
}).then((dataUrl) => {
|
|
12638
12734
|
downloadImage(dataUrl, title);
|
|
12735
|
+
}).finally(() => {
|
|
12736
|
+
removeExportStyles();
|
|
12639
12737
|
if (controls) controls.style.display = "block";
|
|
12640
12738
|
});
|
|
12641
|
-
}, [getNodes, downloadImage, title]);
|
|
12642
|
-
const handleLegendClick = (0,
|
|
12739
|
+
}, [getNodes, storeApi, downloadImage, title]);
|
|
12740
|
+
const handleLegendClick = (0, import_react90.useCallback)(
|
|
12643
12741
|
(collectionType, groupId) => {
|
|
12644
12742
|
const isLegendTarget = (node) => {
|
|
12645
12743
|
if (groupId) {
|
|
@@ -12674,7 +12772,7 @@ var NodeGraphBuilder = ({
|
|
|
12674
12772
|
},
|
|
12675
12773
|
[nodes, edges, setNodes, setEdges, fitView]
|
|
12676
12774
|
);
|
|
12677
|
-
const getNodesByCollectionWithColors = (0,
|
|
12775
|
+
const getNodesByCollectionWithColors = (0, import_react90.useCallback)((nodes2) => {
|
|
12678
12776
|
const colorClasses = {
|
|
12679
12777
|
events: "bg-orange-600",
|
|
12680
12778
|
agent: "bg-sky-600",
|
|
@@ -12735,24 +12833,24 @@ var NodeGraphBuilder = ({
|
|
|
12735
12833
|
);
|
|
12736
12834
|
return { ...legendForDomains, ...legendForNodes };
|
|
12737
12835
|
}, []);
|
|
12738
|
-
const legendKeyRef = (0,
|
|
12836
|
+
const legendKeyRef = (0, import_react90.useRef)("");
|
|
12739
12837
|
const computedLegendKey = nodes.map((n) => `${n.id}:${n.type}:${n.data.group?.id || ""}`).join(",");
|
|
12740
12838
|
if (computedLegendKey !== legendKeyRef.current) {
|
|
12741
12839
|
legendKeyRef.current = computedLegendKey;
|
|
12742
12840
|
}
|
|
12743
12841
|
const legendKey = legendKeyRef.current;
|
|
12744
|
-
const legend = (0,
|
|
12842
|
+
const legend = (0, import_react90.useMemo)(
|
|
12745
12843
|
() => getNodesByCollectionWithColors(nodes),
|
|
12746
12844
|
[getNodesByCollectionWithColors, legendKey]
|
|
12747
12845
|
);
|
|
12748
|
-
const nodeIdsKeyRef = (0,
|
|
12846
|
+
const nodeIdsKeyRef = (0, import_react90.useRef)("");
|
|
12749
12847
|
const computedNodeIdsKey = nodes.map((n) => n.id).join(",");
|
|
12750
12848
|
if (computedNodeIdsKey !== nodeIdsKeyRef.current) {
|
|
12751
12849
|
nodeIdsKeyRef.current = computedNodeIdsKey;
|
|
12752
12850
|
}
|
|
12753
12851
|
const nodeIdsKey = nodeIdsKeyRef.current;
|
|
12754
|
-
const searchNodes = (0,
|
|
12755
|
-
const allNoteGroups = (0,
|
|
12852
|
+
const searchNodes = (0, import_react90.useMemo)(() => nodes, [nodeIdsKey]);
|
|
12853
|
+
const allNoteGroups = (0, import_react90.useMemo)(() => {
|
|
12756
12854
|
const groups = [];
|
|
12757
12855
|
for (const node of nodes) {
|
|
12758
12856
|
const result = getNotesFromNode(node);
|
|
@@ -12767,11 +12865,11 @@ var NodeGraphBuilder = ({
|
|
|
12767
12865
|
}
|
|
12768
12866
|
return groups;
|
|
12769
12867
|
}, [nodeIdsKey]);
|
|
12770
|
-
const totalNotesCount = (0,
|
|
12868
|
+
const totalNotesCount = (0, import_react90.useMemo)(
|
|
12771
12869
|
() => allNoteGroups.reduce((sum, g) => sum + g.notes.length, 0),
|
|
12772
12870
|
[allNoteGroups]
|
|
12773
12871
|
);
|
|
12774
|
-
const handleStepChange = (0,
|
|
12872
|
+
const handleStepChange = (0, import_react90.useCallback)(
|
|
12775
12873
|
(nodeId, highlightPaths, shouldZoomOut) => {
|
|
12776
12874
|
if (nodeId === null) {
|
|
12777
12875
|
resetNodesAndEdges();
|
|
@@ -12846,7 +12944,7 @@ var NodeGraphBuilder = ({
|
|
|
12846
12944
|
},
|
|
12847
12945
|
[nodes, edges, setNodes, setEdges, resetNodesAndEdges, fitView]
|
|
12848
12946
|
);
|
|
12849
|
-
const isFlowVisualization = (0,
|
|
12947
|
+
const isFlowVisualization = (0, import_react90.useMemo)(
|
|
12850
12948
|
() => edges.some((edge) => edge.type === "flow-edge"),
|
|
12851
12949
|
[edges]
|
|
12852
12950
|
);
|
|
@@ -12939,7 +13037,7 @@ var NodeGraphBuilder = ({
|
|
|
12939
13037
|
}
|
|
12940
13038
|
) })
|
|
12941
13039
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12942
|
-
|
|
13040
|
+
import_react91.ReactFlow,
|
|
12943
13041
|
{
|
|
12944
13042
|
nodeTypes,
|
|
12945
13043
|
edgeTypes: edgeTypes2,
|
|
@@ -12951,7 +13049,7 @@ var NodeGraphBuilder = ({
|
|
|
12951
13049
|
onEdgesChange,
|
|
12952
13050
|
onEdgeMouseEnter: handleEdgeMouseEnter,
|
|
12953
13051
|
onEdgeMouseLeave: handleEdgeMouseLeave,
|
|
12954
|
-
connectionLineType:
|
|
13052
|
+
connectionLineType: import_react91.ConnectionLineType.SmoothStep,
|
|
12955
13053
|
nodeOrigin: NODE_ORIGIN,
|
|
12956
13054
|
onNodeClick: handleNodeClick,
|
|
12957
13055
|
onNodeMouseEnter: handleNodeMouseEnter,
|
|
@@ -12965,7 +13063,7 @@ var NodeGraphBuilder = ({
|
|
|
12965
13063
|
className: "relative",
|
|
12966
13064
|
children: [
|
|
12967
13065
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12968
|
-
|
|
13066
|
+
import_react91.Panel,
|
|
12969
13067
|
{
|
|
12970
13068
|
position: "top-center",
|
|
12971
13069
|
className: "w-full pr-6 pointer-events-none",
|
|
@@ -13083,10 +13181,10 @@ var NodeGraphBuilder = ({
|
|
|
13083
13181
|
]
|
|
13084
13182
|
}
|
|
13085
13183
|
),
|
|
13086
|
-
includeBackground && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13087
|
-
includeBackground && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13184
|
+
includeBackground && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react91.Background, { color: "var(--ec-bg-dots)", gap: 16 }),
|
|
13185
|
+
includeBackground && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react91.Controls, {}),
|
|
13088
13186
|
showMinimap && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13089
|
-
|
|
13187
|
+
import_react91.MiniMap,
|
|
13090
13188
|
{
|
|
13091
13189
|
nodeStrokeWidth: 3,
|
|
13092
13190
|
zoomable: true,
|
|
@@ -13094,7 +13192,7 @@ var NodeGraphBuilder = ({
|
|
|
13094
13192
|
style: MINIMAP_STYLE
|
|
13095
13193
|
}
|
|
13096
13194
|
),
|
|
13097
|
-
isFlowVisualization && showFlowWalkthrough && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13195
|
+
isFlowVisualization && showFlowWalkthrough && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react91.Panel, { position: "bottom-left", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13098
13196
|
StepWalkthrough_default,
|
|
13099
13197
|
{
|
|
13100
13198
|
nodes: walkthroughNodes,
|
|
@@ -13105,7 +13203,7 @@ var NodeGraphBuilder = ({
|
|
|
13105
13203
|
}
|
|
13106
13204
|
) }),
|
|
13107
13205
|
isDevMode && hasLayoutChanges && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13108
|
-
|
|
13206
|
+
import_react91.Panel,
|
|
13109
13207
|
{
|
|
13110
13208
|
position: "bottom-left",
|
|
13111
13209
|
style: isFlowVisualization && showFlowWalkthrough ? LAYOUT_CHANGE_PANEL_STYLE_WITH_WALKTHROUGH : LAYOUT_CHANGE_PANEL_STYLE_DEFAULT,
|
|
@@ -13266,7 +13364,7 @@ var NodeGraph = ({
|
|
|
13266
13364
|
onSaveLayout,
|
|
13267
13365
|
onResetLayout
|
|
13268
13366
|
}) => {
|
|
13269
|
-
const graphLayout = (0,
|
|
13367
|
+
const graphLayout = (0, import_react90.useMemo)(() => {
|
|
13270
13368
|
if (!graph) return null;
|
|
13271
13369
|
return layoutGraph(
|
|
13272
13370
|
graph.nodes,
|
|
@@ -13281,17 +13379,17 @@ var NodeGraph = ({
|
|
|
13281
13379
|
const includeKey = includeKeyProp !== void 0 ? includeKeyProp : graph?.options?.legend !== false;
|
|
13282
13380
|
const showSearch = showSearchProp !== void 0 ? showSearchProp : graph?.options?.search !== false;
|
|
13283
13381
|
const animated = animatedProp ?? graph?.options?.animated;
|
|
13284
|
-
const [elem, setElem] = (0,
|
|
13285
|
-
const [showFooter, setShowFooter] = (0,
|
|
13286
|
-
const [isStudioModalOpen, setIsStudioModalOpen] = (0,
|
|
13287
|
-
const openStudioModal = (0,
|
|
13382
|
+
const [elem, setElem] = (0, import_react90.useState)(null);
|
|
13383
|
+
const [showFooter, setShowFooter] = (0, import_react90.useState)(true);
|
|
13384
|
+
const [isStudioModalOpen, setIsStudioModalOpen] = (0, import_react90.useState)(false);
|
|
13385
|
+
const openStudioModal = (0, import_react90.useCallback)(() => {
|
|
13288
13386
|
setIsStudioModalOpen(true);
|
|
13289
13387
|
}, []);
|
|
13290
13388
|
const containerToRenderInto = portalId || `${id}-portal`;
|
|
13291
|
-
(0,
|
|
13389
|
+
(0, import_react90.useEffect)(() => {
|
|
13292
13390
|
setElem(document.getElementById(containerToRenderInto));
|
|
13293
13391
|
}, []);
|
|
13294
|
-
(0,
|
|
13392
|
+
(0, import_react90.useEffect)(() => {
|
|
13295
13393
|
const urlParams = new URLSearchParams(window.location.search);
|
|
13296
13394
|
const embed = urlParams.get("embed");
|
|
13297
13395
|
if (embed === "true") {
|
|
@@ -13300,7 +13398,7 @@ var NodeGraph = ({
|
|
|
13300
13398
|
}, []);
|
|
13301
13399
|
if (!elem) return null;
|
|
13302
13400
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { children: (0, import_react_dom.createPortal)(
|
|
13303
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13401
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react91.ReactFlowProvider, { children: [
|
|
13304
13402
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13305
13403
|
NodeGraphBuilder,
|
|
13306
13404
|
{
|