@eventcatalog/visualiser 3.18.0 → 3.18.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 CHANGED
@@ -5498,6 +5498,7 @@ var AnimatedMessageEdge = (0, import_react53.memo)(
5498
5498
  [lines]
5499
5499
  );
5500
5500
  const labelWidth = Math.max(longestLine.length * 6.5 + 16, 50);
5501
+ const firstLineDy = `${-((lines.length - 1) * 1.2) / 2}em`;
5501
5502
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5502
5503
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5503
5504
  import_react54.BaseEdge,
@@ -5541,7 +5542,7 @@ var AnimatedMessageEdge = (0, import_react53.memo)(
5541
5542
  "tspan",
5542
5543
  {
5543
5544
  x: labelX,
5544
- dy: i === 0 ? 0 : "1.2em",
5545
+ dy: i === 0 ? firstLineDy : "1.2em",
5545
5546
  style: i === 0 ? TSPAN_NORMAL_STYLE : TSPAN_ITALIC_STYLE,
5546
5547
  children: line
5547
5548
  },
@@ -5586,6 +5587,16 @@ var MultilineEdgeLabel_default = (0, import_react55.memo)(function MultilineEdge
5586
5587
  targetPosition
5587
5588
  });
5588
5589
  const lines = (0, import_react55.useMemo)(() => String(label ?? "").split("\n"), [label]);
5590
+ const firstLineDy = (0, import_react55.useMemo)(
5591
+ () => `${-((lines.length - 1) * 1.2) / 2}em`,
5592
+ [lines.length]
5593
+ );
5594
+ const longestLine = (0, import_react55.useMemo)(
5595
+ () => lines.reduce((a, b) => a.length > b.length ? a : b, ""),
5596
+ [lines]
5597
+ );
5598
+ const labelWidth = Math.max(longestLine.length * 5.5 + 14, 44);
5599
+ const labelHeight = lines.length * 12 + 4;
5589
5600
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5590
5601
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5591
5602
  "path",
@@ -5598,6 +5609,22 @@ var MultilineEdgeLabel_default = (0, import_react55.memo)(function MultilineEdge
5598
5609
  style
5599
5610
  }
5600
5611
  ),
5612
+ label && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5613
+ "rect",
5614
+ {
5615
+ x: labelX - labelWidth / 2,
5616
+ y: labelY - labelHeight / 2,
5617
+ width: labelWidth,
5618
+ height: labelHeight,
5619
+ fill: "rgb(var(--ec-card-bg))",
5620
+ fillOpacity: 0.95,
5621
+ stroke: "rgb(var(--ec-page-border))",
5622
+ strokeWidth: 0.75,
5623
+ rx: 5,
5624
+ ry: 5,
5625
+ pointerEvents: "none"
5626
+ }
5627
+ ),
5601
5628
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5602
5629
  "text",
5603
5630
  {
@@ -5612,7 +5639,7 @@ var MultilineEdgeLabel_default = (0, import_react55.memo)(function MultilineEdge
5612
5639
  "tspan",
5613
5640
  {
5614
5641
  x: labelX,
5615
- dy: i === 0 ? 0 : "1.2em",
5642
+ dy: i === 0 ? firstLineDy : "1.2em",
5616
5643
  style: i === 0 ? TSPAN_NORMAL_STYLE2 : TSPAN_ITALIC_STYLE2,
5617
5644
  children: line
5618
5645
  },
@@ -10691,7 +10718,7 @@ var NodeGraphBuilder = ({
10691
10718
  {
10692
10719
  onClick: handleQuickSaveLayout,
10693
10720
  disabled: isSavingLayout,
10694
- className: "text-xs font-medium text-[rgb(var(--ec-accent-text))] bg-[rgb(var(--ec-accent-subtle))] hover:bg-[rgb(var(--ec-accent-subtle)/0.7)] px-2 py-1 rounded transition-colors disabled:opacity-50",
10721
+ className: "text-xs font-medium text-white bg-[rgb(var(--ec-accent))] hover:bg-[rgb(var(--ec-accent-hover))] px-2 py-1 rounded transition-colors disabled:opacity-50",
10695
10722
  children: isSavingLayout ? "Saving..." : "Save"
10696
10723
  }
10697
10724
  )