@eventcatalog/visualiser 3.17.1 → 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.d.mts CHANGED
@@ -58,6 +58,7 @@ type Service = {
58
58
  draft?: boolean;
59
59
  notes?: Note[];
60
60
  specifications?: unknown;
61
+ externalSystem?: boolean;
61
62
  };
62
63
  /**
63
64
  * Channel type
package/dist/index.d.ts CHANGED
@@ -58,6 +58,7 @@ type Service = {
58
58
  draft?: boolean;
59
59
  notes?: Note[];
60
60
  specifications?: unknown;
61
+ externalSystem?: boolean;
61
62
  };
62
63
  /**
63
64
  * Channel type
package/dist/index.js CHANGED
@@ -1121,7 +1121,8 @@ var ServiceMessageFlow = (0, import_react5.memo)(function ServiceMessageFlow2({
1121
1121
  );
1122
1122
  });
1123
1123
  var GlowHandle = (0, import_react5.memo)(function GlowHandle2({
1124
- side
1124
+ side,
1125
+ external
1125
1126
  }) {
1126
1127
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1127
1128
  "div",
@@ -1134,10 +1135,10 @@ var GlowHandle = (0, import_react5.memo)(function GlowHandle2({
1134
1135
  width: 12,
1135
1136
  height: 12,
1136
1137
  borderRadius: "50%",
1137
- background: "linear-gradient(135deg, #ec4899, #be185d)",
1138
+ background: external ? "linear-gradient(135deg, #a855f7, #7e22ce)" : "linear-gradient(135deg, #ec4899, #be185d)",
1138
1139
  border: "2px solid rgb(var(--ec-page-bg))",
1139
1140
  zIndex: 20,
1140
- animation: "ec-service-handle-pulse 2s ease-in-out infinite",
1141
+ animation: external ? "ec-external-handle-pulse 2s ease-in-out infinite" : "ec-service-handle-pulse 2s ease-in-out infinite",
1141
1142
  pointerEvents: "none"
1142
1143
  }
1143
1144
  }
@@ -1146,16 +1147,86 @@ var GlowHandle = (0, import_react5.memo)(function GlowHandle2({
1146
1147
  function classNames(...classes) {
1147
1148
  return classes.filter(Boolean).join(" ");
1148
1149
  }
1150
+ var POST_IT_SERVICE = {
1151
+ Icon: import_lucide_react3.ServerIcon,
1152
+ label: "Service",
1153
+ gradient: "linear-gradient(135deg, #fbcfe8 0%, #f9a8d4 40%, #ec4899 100%)",
1154
+ draftBorder: "rgba(236, 72, 153, 0.5)",
1155
+ corner: "#db2777",
1156
+ ring: "ring-2 ring-pink-400/60 ring-offset-1",
1157
+ iconClass: "w-3 h-3 text-pink-900/50",
1158
+ labelClass: "text-[8px] font-bold text-pink-900/50 uppercase tracking-widest",
1159
+ nameText: "text-pink-950",
1160
+ nameTextDeprecated: "text-pink-950/40 line-through",
1161
+ versionClass: "text-[9px] text-pink-900/40 font-semibold mt-0.5",
1162
+ summaryClass: "mt-2 pt-1.5 border-t border-pink-900/10 text-[9px] text-pink-950/60 leading-relaxed overflow-hidden"
1163
+ };
1164
+ var POST_IT_EXTERNAL = {
1165
+ Icon: import_lucide_react3.Globe,
1166
+ label: "External System",
1167
+ gradient: "linear-gradient(135deg, #e9d5ff 0%, #c084fc 40%, #a855f7 100%)",
1168
+ draftBorder: "rgba(168, 85, 247, 0.5)",
1169
+ corner: "#7e22ce",
1170
+ ring: "ring-2 ring-purple-400/60 ring-offset-1",
1171
+ iconClass: "w-3 h-3 text-purple-900/50",
1172
+ labelClass: "text-[8px] font-bold text-purple-900/50 uppercase tracking-widest",
1173
+ nameText: "text-purple-950",
1174
+ nameTextDeprecated: "text-purple-950/40 line-through",
1175
+ versionClass: "text-[9px] text-purple-900/40 font-semibold mt-0.5",
1176
+ summaryClass: "mt-2 pt-1.5 border-t border-purple-900/10 text-[9px] text-purple-950/60 leading-relaxed overflow-hidden"
1177
+ };
1178
+ var DEFAULT_SERVICE = {
1179
+ Icon: import_lucide_react3.ServerIcon,
1180
+ label: "Service",
1181
+ ring: "ring-2 ring-pink-400/60 ring-offset-2",
1182
+ borderSolid: "border-pink-500",
1183
+ borderDraftDark: "border-dashed border-pink-400",
1184
+ borderDraftLight: "border-dashed border-pink-400/60",
1185
+ draftStripeDark: "rgba(236,72,153,0.25)",
1186
+ draftStripeLight: "rgba(236,72,153,0.15)",
1187
+ nodeBgVar: "var(--ec-service-node-bg, rgb(var(--ec-card-bg)))",
1188
+ shadowColor: "rgba(236, 72, 153, 0.15)",
1189
+ badgeBg: "bg-pink-500",
1190
+ ownerAccent: "bg-pink-400",
1191
+ ownerBorder: "rgba(236,72,153,0.08)",
1192
+ ownerIcon: "text-pink-300"
1193
+ };
1194
+ var DEFAULT_EXTERNAL = {
1195
+ Icon: import_lucide_react3.Globe,
1196
+ label: "External System",
1197
+ ring: "ring-2 ring-purple-400/60 ring-offset-2",
1198
+ borderSolid: "border-purple-500",
1199
+ borderDraftDark: "border-dashed border-purple-400",
1200
+ borderDraftLight: "border-dashed border-purple-400/60",
1201
+ draftStripeDark: "rgba(168,85,247,0.25)",
1202
+ draftStripeLight: "rgba(168,85,247,0.15)",
1203
+ nodeBgVar: "var(--ec-external-node-bg, rgb(var(--ec-card-bg)))",
1204
+ shadowColor: "rgba(168, 85, 247, 0.15)",
1205
+ badgeBg: "bg-purple-500",
1206
+ ownerAccent: "bg-purple-400",
1207
+ ownerBorder: "rgba(168,85,247,0.08)",
1208
+ ownerIcon: "text-purple-300"
1209
+ };
1149
1210
  function PostItService(props) {
1150
- const { version, name, summary, deprecated, draft, notes, specifications } = props.data.service;
1211
+ const {
1212
+ version,
1213
+ name,
1214
+ summary,
1215
+ deprecated,
1216
+ draft,
1217
+ notes,
1218
+ specifications,
1219
+ externalSystem
1220
+ } = props.data.service;
1151
1221
  const mode = props.data.mode || "simple";
1152
1222
  const isDark = useDarkMode();
1223
+ const p = externalSystem ? POST_IT_EXTERNAL : POST_IT_SERVICE;
1153
1224
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1154
1225
  "div",
1155
1226
  {
1156
1227
  className: classNames(
1157
1228
  "relative min-w-44 max-w-56 min-h-[120px]",
1158
- props?.selected ? "ring-2 ring-pink-400/60 ring-offset-1" : ""
1229
+ props?.selected ? p.ring : ""
1159
1230
  ),
1160
1231
  children: [
1161
1232
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -1180,10 +1251,10 @@ function PostItService(props) {
1180
1251
  {
1181
1252
  className: "absolute inset-0",
1182
1253
  style: {
1183
- background: draft ? "repeating-linear-gradient(135deg, #fbcfe8 0%, #f9a8d4 40%, #ec4899 100%)" : "linear-gradient(135deg, #fbcfe8 0%, #f9a8d4 40%, #ec4899 100%)",
1254
+ background: p.gradient,
1184
1255
  boxShadow: "1px 1px 3px rgba(0,0,0,0.15), 3px 4px 8px rgba(0,0,0,0.08)",
1185
1256
  transform: "rotate(1deg)",
1186
- border: deprecated ? "2px dashed rgba(239, 68, 68, 0.5)" : draft ? "2px dashed rgba(236, 72, 153, 0.5)" : "none"
1257
+ border: deprecated ? "2px dashed rgba(239, 68, 68, 0.5)" : draft ? `2px dashed ${p.draftBorder}` : "none"
1187
1258
  },
1188
1259
  children: [
1189
1260
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: FOLDED_CORNER_SHADOW_STYLE }),
@@ -1198,7 +1269,7 @@ function PostItService(props) {
1198
1269
  height: 0,
1199
1270
  borderStyle: "solid",
1200
1271
  borderWidth: "18px 0 0 18px",
1201
- borderColor: "#db2777 transparent transparent transparent",
1272
+ borderColor: `${p.corner} transparent transparent transparent`,
1202
1273
  opacity: 0.3
1203
1274
  }
1204
1275
  }
@@ -1209,14 +1280,8 @@ function PostItService(props) {
1209
1280
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative px-3.5 py-3", children: [
1210
1281
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [
1211
1282
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1", children: [
1212
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1213
- import_lucide_react3.ServerIcon,
1214
- {
1215
- className: "w-3 h-3 text-pink-900/50",
1216
- strokeWidth: 2.5
1217
- }
1218
- ),
1219
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-[8px] font-bold text-pink-900/50 uppercase tracking-widest", children: "Service" })
1283
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(p.Icon, { className: p.iconClass, strokeWidth: 2.5 }),
1284
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: p.labelClass, children: p.label })
1220
1285
  ] }),
1221
1286
  draft && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-[8px] font-extrabold text-amber-900 bg-amber-100 border border-dashed border-amber-400 px-1.5 py-0.5 rounded uppercase", children: "Draft" }),
1222
1287
  deprecated && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-[7px] font-bold text-white bg-red-500 border border-red-600 px-1.5 py-0.5 rounded uppercase", children: "Deprecated" })
@@ -1226,19 +1291,19 @@ function PostItService(props) {
1226
1291
  {
1227
1292
  className: classNames(
1228
1293
  "text-[13px] font-bold leading-snug",
1229
- deprecated ? "text-pink-950/40 line-through" : "text-pink-950"
1294
+ deprecated ? p.nameTextDeprecated : p.nameText
1230
1295
  ),
1231
1296
  children: name
1232
1297
  }
1233
1298
  ),
1234
- version && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "text-[9px] text-pink-900/40 font-semibold mt-0.5", children: [
1299
+ version && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: p.versionClass, children: [
1235
1300
  "v",
1236
1301
  version
1237
1302
  ] }),
1238
1303
  mode === "full" && summary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1239
1304
  "div",
1240
1305
  {
1241
- className: "mt-2 pt-1.5 border-t border-pink-900/10 text-[9px] text-pink-950/60 leading-relaxed overflow-hidden",
1306
+ className: p.summaryClass,
1242
1307
  style: LINE_CLAMP_STYLE,
1243
1308
  title: summary,
1244
1309
  children: summary
@@ -1251,7 +1316,16 @@ function PostItService(props) {
1251
1316
  );
1252
1317
  }
1253
1318
  function DefaultService(props) {
1254
- const { version, name, summary, deprecated, draft, notes, specifications } = props.data.service;
1319
+ const {
1320
+ version,
1321
+ name,
1322
+ summary,
1323
+ deprecated,
1324
+ draft,
1325
+ notes,
1326
+ specifications,
1327
+ externalSystem
1328
+ } = props.data.service;
1255
1329
  const mode = props.data.mode || "simple";
1256
1330
  const owners = (0, import_react5.useMemo)(
1257
1331
  () => normalizeOwners(props.data.service.owners),
@@ -1261,17 +1335,20 @@ function DefaultService(props) {
1261
1335
  const sourceConnections = (0, import_react6.useNodeConnections)({ handleType: "source" });
1262
1336
  const isDark = useDarkMode();
1263
1337
  const deprecatedStripe = isDark ? "rgba(239,68,68,0.25)" : "rgba(239,68,68,0.1)";
1338
+ const p = externalSystem ? DEFAULT_EXTERNAL : DEFAULT_SERVICE;
1339
+ const draftStripe = isDark ? p.draftStripeDark : p.draftStripeLight;
1340
+ const borderDraft = isDark ? p.borderDraftDark : p.borderDraftLight;
1264
1341
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1265
1342
  "div",
1266
1343
  {
1267
1344
  className: classNames(
1268
1345
  "relative min-w-48 max-w-60 rounded-xl border-2 overflow-visible",
1269
- props?.selected ? "ring-2 ring-pink-400/60 ring-offset-2" : "",
1270
- deprecated ? "border-dashed border-red-500" : draft ? `border-dashed ${isDark ? "border-pink-400" : "border-pink-400/60"}` : "border-pink-500"
1346
+ props?.selected ? p.ring : "",
1347
+ deprecated ? "border-dashed border-red-500" : draft ? borderDraft : p.borderSolid
1271
1348
  ),
1272
1349
  style: {
1273
- background: deprecated ? `repeating-linear-gradient(135deg, transparent, transparent 6px, ${deprecatedStripe} 6px, ${deprecatedStripe} 7px), var(--ec-service-node-bg, rgb(var(--ec-card-bg)))` : draft ? `repeating-linear-gradient(135deg, transparent, transparent 4px, ${isDark ? "rgba(236,72,153,0.25)" : "rgba(236,72,153,0.15)"} 4px, ${isDark ? "rgba(236,72,153,0.25)" : "rgba(236,72,153,0.15)"} 4.5px), repeating-linear-gradient(45deg, transparent, transparent 4px, ${isDark ? "rgba(236,72,153,0.25)" : "rgba(236,72,153,0.15)"} 4px, ${isDark ? "rgba(236,72,153,0.25)" : "rgba(236,72,153,0.15)"} 4.5px), var(--ec-service-node-bg, rgb(var(--ec-card-bg)))` : "var(--ec-service-node-bg, rgb(var(--ec-card-bg)))",
1274
- boxShadow: "0 2px 12px rgba(236, 72, 153, 0.15)"
1350
+ background: deprecated ? `repeating-linear-gradient(135deg, transparent, transparent 6px, ${deprecatedStripe} 6px, ${deprecatedStripe} 7px), ${p.nodeBgVar}` : draft ? `repeating-linear-gradient(135deg, transparent, transparent 4px, ${draftStripe} 4px, ${draftStripe} 4.5px), repeating-linear-gradient(45deg, transparent, transparent 4px, ${draftStripe} 4px, ${draftStripe} 4.5px), ${p.nodeBgVar}` : p.nodeBgVar,
1351
+ boxShadow: `0 2px 12px ${p.shadowColor}`
1275
1352
  },
1276
1353
  children: [
1277
1354
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -1291,18 +1368,18 @@ function DefaultService(props) {
1291
1368
  }
1292
1369
  ),
1293
1370
  notes && notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(NotesIndicator, { notes, resourceName: name }),
1294
- targetConnections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GlowHandle, { side: "left" }),
1295
- sourceConnections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GlowHandle, { side: "right" }),
1371
+ targetConnections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GlowHandle, { side: "left", external: externalSystem }),
1372
+ sourceConnections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GlowHandle, { side: "right", external: externalSystem }),
1296
1373
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "absolute -top-2.5 left-2.5 flex items-center gap-1.5 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1297
1374
  "span",
1298
1375
  {
1299
1376
  className: classNames(
1300
1377
  "inline-flex items-center gap-1 text-[7px] font-bold uppercase tracking-widest text-white px-1.5 py-0.5 rounded shadow-sm",
1301
- deprecated ? "bg-red-500" : "bg-pink-500"
1378
+ deprecated ? "bg-red-500" : p.badgeBg
1302
1379
  ),
1303
1380
  children: [
1304
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react3.ServerIcon, { className: "w-2.5 h-2.5", strokeWidth: 2.5 }),
1305
- "Service",
1381
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(p.Icon, { className: "w-2.5 h-2.5", strokeWidth: 2.5 }),
1382
+ p.label,
1306
1383
  draft && " (Draft)",
1307
1384
  deprecated && " (Deprecated)"
1308
1385
  ]
@@ -1331,9 +1408,9 @@ function DefaultService(props) {
1331
1408
  OwnerIndicator,
1332
1409
  {
1333
1410
  owners,
1334
- accentColor: "bg-pink-400",
1335
- borderColor: "rgba(236,72,153,0.08)",
1336
- iconClass: "text-pink-300"
1411
+ accentColor: p.ownerAccent,
1412
+ borderColor: p.ownerBorder,
1413
+ iconClass: p.ownerIcon
1337
1414
  }
1338
1415
  ),
1339
1416
  !!specifications && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SpecBadges, { specifications, isDark })
@@ -5421,6 +5498,7 @@ var AnimatedMessageEdge = (0, import_react53.memo)(
5421
5498
  [lines]
5422
5499
  );
5423
5500
  const labelWidth = Math.max(longestLine.length * 6.5 + 16, 50);
5501
+ const firstLineDy = `${-((lines.length - 1) * 1.2) / 2}em`;
5424
5502
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5425
5503
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5426
5504
  import_react54.BaseEdge,
@@ -5464,7 +5542,7 @@ var AnimatedMessageEdge = (0, import_react53.memo)(
5464
5542
  "tspan",
5465
5543
  {
5466
5544
  x: labelX,
5467
- dy: i === 0 ? 0 : "1.2em",
5545
+ dy: i === 0 ? firstLineDy : "1.2em",
5468
5546
  style: i === 0 ? TSPAN_NORMAL_STYLE : TSPAN_ITALIC_STYLE,
5469
5547
  children: line
5470
5548
  },
@@ -5509,6 +5587,16 @@ var MultilineEdgeLabel_default = (0, import_react55.memo)(function MultilineEdge
5509
5587
  targetPosition
5510
5588
  });
5511
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;
5512
5600
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5513
5601
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5514
5602
  "path",
@@ -5521,6 +5609,22 @@ var MultilineEdgeLabel_default = (0, import_react55.memo)(function MultilineEdge
5521
5609
  style
5522
5610
  }
5523
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
+ ),
5524
5628
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5525
5629
  "text",
5526
5630
  {
@@ -5535,7 +5639,7 @@ var MultilineEdgeLabel_default = (0, import_react55.memo)(function MultilineEdge
5535
5639
  "tspan",
5536
5640
  {
5537
5641
  x: labelX,
5538
- dy: i === 0 ? 0 : "1.2em",
5642
+ dy: i === 0 ? firstLineDy : "1.2em",
5539
5643
  style: i === 0 ? TSPAN_NORMAL_STYLE2 : TSPAN_ITALIC_STYLE2,
5540
5644
  children: line
5541
5645
  },
@@ -10614,7 +10718,7 @@ var NodeGraphBuilder = ({
10614
10718
  {
10615
10719
  onClick: handleQuickSaveLayout,
10616
10720
  disabled: isSavingLayout,
10617
- 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",
10618
10722
  children: isSavingLayout ? "Saving..." : "Save"
10619
10723
  }
10620
10724
  )