@eventcatalog/visualiser 4.1.2 → 4.1.4

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.mjs CHANGED
@@ -2977,6 +2977,7 @@ function PostItChannel(props) {
2977
2977
  props?.selected ? "ring-2 ring-gray-400/60 ring-offset-1" : ""
2978
2978
  ),
2979
2979
  children: [
2980
+ props.data.isFocused && /* @__PURE__ */ jsx13(FocusedResourceIndicator, {}),
2980
2981
  /* @__PURE__ */ jsx13(
2981
2982
  Handle7,
2982
2983
  {
@@ -3140,6 +3141,7 @@ function DefaultChannel(props) {
3140
3141
  boxShadow: "0 2px 12px rgba(107, 114, 128, 0.15)"
3141
3142
  },
3142
3143
  children: [
3144
+ props.data.isFocused && /* @__PURE__ */ jsx13(FocusedResourceIndicator, {}),
3143
3145
  /* @__PURE__ */ jsx13(
3144
3146
  Handle7,
3145
3147
  {
@@ -9536,6 +9538,26 @@ var createDagreGraph = ({
9536
9538
  graph.setDefaultEdgeLabel(() => ({}));
9537
9539
  return graph;
9538
9540
  };
9541
+ var LARGE_GRAPH_NODE_THRESHOLD = 80;
9542
+ var LARGE_GRAPH_EDGE_THRESHOLD = 200;
9543
+ var LARGE_GRAPH_RANKER = "tight-tree";
9544
+ var selectDagreRanker = (nodeCount, edgeCount, explicitRanker) => {
9545
+ if (explicitRanker) return explicitRanker;
9546
+ if (nodeCount >= LARGE_GRAPH_NODE_THRESHOLD || edgeCount >= LARGE_GRAPH_EDGE_THRESHOLD) {
9547
+ return LARGE_GRAPH_RANKER;
9548
+ }
9549
+ return void 0;
9550
+ };
9551
+ var layoutDagreGraph = (flow) => {
9552
+ const label = flow.graph() || {};
9553
+ const nodeCount = flow.nodeCount();
9554
+ const edgeCount = flow.edgeCount();
9555
+ const ranker = selectDagreRanker(nodeCount, edgeCount, label.ranker);
9556
+ if (ranker && label.ranker !== ranker) {
9557
+ flow.setGraph({ ...label, ranker });
9558
+ }
9559
+ dagre.layout(flow);
9560
+ };
9539
9561
  var createEdge = (edgeOptions) => {
9540
9562
  return {
9541
9563
  label: "subscribed by",
@@ -9578,7 +9600,7 @@ var getNodesAndEdgesFromDagre = ({
9578
9600
  edges.forEach((edge) => {
9579
9601
  flow.setEdge(edge.source, edge.target);
9580
9602
  });
9581
- dagre.layout(flow);
9603
+ layoutDagreGraph(flow);
9582
9604
  return {
9583
9605
  nodes: calculatedNodes(flow, nodes),
9584
9606
  edges
@@ -11579,7 +11601,7 @@ function AllNotesModal({
11579
11601
  import dagre3 from "dagre";
11580
11602
  import { Fragment as Fragment15, jsx as jsx52, jsxs as jsxs49 } from "react/jsx-runtime";
11581
11603
  var POSITION_CHANGE_THRESHOLD = 1;
11582
- var LARGE_GRAPH_NODE_THRESHOLD = 30;
11604
+ var LARGE_GRAPH_NODE_THRESHOLD2 = 30;
11583
11605
  var NODE_ORIGIN = [0.1, 0.1];
11584
11606
  var INITIAL_FIT_VIEW_OPTIONS = { padding: 0.2, duration: 0 };
11585
11607
  var MINIMAP_STYLE = {
@@ -12018,7 +12040,7 @@ var NodeGraphBuilder = ({
12018
12040
  g.setEdge(sourceTop, targetTop);
12019
12041
  }
12020
12042
  });
12021
- dagre3.layout(g);
12043
+ layoutDagreGraph(g);
12022
12044
  const positioned = nextNodes.map((node) => {
12023
12045
  if (node.parentId) {
12024
12046
  const parent = nextNodes.find((n) => n.id === node.parentId);
@@ -12109,7 +12131,7 @@ var NodeGraphBuilder = ({
12109
12131
  g.setEdge(e.source, e.target);
12110
12132
  }
12111
12133
  });
12112
- dagre3.layout(g);
12134
+ layoutDagreGraph(g);
12113
12135
  let minX = Infinity;
12114
12136
  let minY = Infinity;
12115
12137
  let maxX = -Infinity;
@@ -12728,7 +12750,7 @@ var NodeGraphBuilder = ({
12728
12750
  if (storedAnimateMessages !== null) {
12729
12751
  setAnimateMessages(storedAnimateMessages === "true");
12730
12752
  } else {
12731
- setAnimateMessages(initialNodes.length <= LARGE_GRAPH_NODE_THRESHOLD);
12753
+ setAnimateMessages(initialNodes.length <= LARGE_GRAPH_NODE_THRESHOLD2);
12732
12754
  }
12733
12755
  }
12734
12756
  }, [animated, disableMessageAnimation, initialNodes.length]);
@@ -13725,6 +13747,9 @@ export {
13725
13747
  Flow_default as FlowNode,
13726
13748
  FocusModeModal_default as FocusModeModal,
13727
13749
  GroupNode_default as GroupNode,
13750
+ LARGE_GRAPH_EDGE_THRESHOLD,
13751
+ LARGE_GRAPH_NODE_THRESHOLD,
13752
+ LARGE_GRAPH_RANKER,
13728
13753
  LabelledDefaultEdge,
13729
13754
  LabelledSmoothStepEdge,
13730
13755
  LabelledStepEdge,
@@ -13772,9 +13797,11 @@ export {
13772
13797
  getNestedEntityProperties,
13773
13798
  getNodesAndEdgesFromDagre,
13774
13799
  getPropertyTypeLabel,
13800
+ layoutDagreGraph,
13775
13801
  layoutGraph,
13776
13802
  nodeComponents,
13777
13803
  nodeConfigs,
13778
- normalizeOwners
13804
+ normalizeOwners,
13805
+ selectDagreRanker
13779
13806
  };
13780
13807
  //# sourceMappingURL=index.mjs.map