@eventcatalog/visualiser 5.0.0 → 5.1.0

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.
@@ -17,16 +17,29 @@ type EdgeRoute = {
17
17
  x: number;
18
18
  y: number;
19
19
  };
20
- /** Where the edge's source and target were laid out (top-left, in the flow) */
20
+ /**
21
+ * Where the edge's source and target were laid out (top-left, in the flow),
22
+ * and how tall: nodes often render shorter than the layout estimated
23
+ */
21
24
  source?: {
22
25
  x: number;
23
26
  y: number;
27
+ height?: number;
24
28
  };
25
29
  target?: {
26
30
  x: number;
27
31
  y: number;
32
+ height?: number;
28
33
  };
29
34
  };
35
+ /**
36
+ * A route copied to another canvas (e.g. a diagram opened in Studio), which
37
+ * places the nodes itself: where it goes, and how tall its nodes were laid out
38
+ */
39
+ type CopiedEdgeRoute = Pick<EdgeRoute, "points" | "label"> & {
40
+ sourceHeight?: number;
41
+ targetHeight?: number;
42
+ };
30
43
  /** The size a node is laid out at: as rendered, or an estimate for its type */
31
44
  declare const getNodeSize: (node: Node) => LayoutSize;
32
45
  /**
@@ -44,4 +57,4 @@ declare const layoutWithElk: ({ nodes, edges }: LayoutGraph, { sizeOf }?: {
44
57
  sizeOf?: (node: Node) => LayoutSize;
45
58
  }) => Promise<LayoutGraph>;
46
59
 
47
- export { type EdgeRoute as E, type LayoutGraph as L, type LayoutSize as a, getNodeSize as g, layoutWithElk as l };
60
+ export { type CopiedEdgeRoute as C, type EdgeRoute as E, type LayoutGraph as L, type LayoutSize as a, getNodeSize as g, layoutWithElk as l };
@@ -0,0 +1,23 @@
1
+ import { Node, Edge } from '@xyflow/react';
2
+
3
+ /**
4
+ * Mermaid Export Utility
5
+ * Converts React Flow nodes and edges to Mermaid flowchart syntax. Used by the
6
+ * visualiser's Mermaid view and by EventCatalog (the `.mermaid` routes, AI Chat
7
+ * and the MCP server), so every level of a diagram exports the same way.
8
+ */
9
+ interface MermaidExportOptions {
10
+ /** Include class definitions for styling */
11
+ includeStyles?: boolean;
12
+ /** Direction of the flowchart: LR (left-right), TB (top-bottom), etc. */
13
+ direction?: "LR" | "TB" | "RL" | "BT";
14
+ }
15
+ /**
16
+ * Convert React Flow nodes and edges to Mermaid flowchart syntax. Domains,
17
+ * systems and a flow's lanes are subgraphs around what's in them (nested, as
18
+ * on the diagram), so every level of a domain or system diagram keeps its
19
+ * boundaries. Edges between domains are highlighted.
20
+ */
21
+ declare function convertToMermaid(graphNodes: Node[], graphEdges: Edge[], options?: MermaidExportOptions): string;
22
+
23
+ export { type MermaidExportOptions as M, convertToMermaid as c };
@@ -0,0 +1,80 @@
1
+ import { Node, Edge } from '@xyflow/react';
2
+
3
+ type LayoutGraph = {
4
+ nodes: Node[];
5
+ edges: Edge[];
6
+ };
7
+ type LayoutSize = {
8
+ width: number;
9
+ height: number;
10
+ };
11
+ type EdgeRoute = {
12
+ points: {
13
+ x: number;
14
+ y: number;
15
+ }[];
16
+ label?: {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ /**
21
+ * Where the edge's source and target were laid out (top-left, in the flow),
22
+ * and how tall: nodes often render shorter than the layout estimated
23
+ */
24
+ source?: {
25
+ x: number;
26
+ y: number;
27
+ height?: number;
28
+ };
29
+ target?: {
30
+ x: number;
31
+ y: number;
32
+ height?: number;
33
+ };
34
+ };
35
+ /**
36
+ * A route copied to another canvas (e.g. a diagram opened in Studio), which
37
+ * places the nodes itself: where it goes, and how tall its nodes were laid out
38
+ */
39
+ type CopiedEdgeRoute = Pick<EdgeRoute, "points" | "label"> & {
40
+ sourceHeight?: number;
41
+ targetHeight?: number;
42
+ };
43
+ /** The size a node is laid out at: as rendered, or an estimate for its type */
44
+ declare const getNodeSize: (node: Node) => LayoutSize;
45
+ /**
46
+ * Lays a graph out with ELK (left to right). Nested groups (nodes other nodes
47
+ * have as their `parentId`) are laid out in one pass with their children.
48
+ * Edges are routed at right angles around nodes, each edge with its own
49
+ * connection point so edges don't run on top of each other, and labels are
50
+ * placed on their edge. Each edge keeps its type and gets its route (and label
51
+ * position) in `data.route`, which the visualiser's edges are drawn along.
52
+ *
53
+ * Node positions are top-left corners (nodes get `origin: [0, 0]`), children
54
+ * relative to their group. Groups are sized to fit their children.
55
+ */
56
+ declare const layoutWithElk: ({ nodes, edges }: LayoutGraph, { sizeOf }?: {
57
+ sizeOf?: (node: Node) => LayoutSize;
58
+ }) => Promise<LayoutGraph>;
59
+
60
+ /**
61
+ * Mermaid Export Utility
62
+ * Converts React Flow nodes and edges to Mermaid flowchart syntax. Used by the
63
+ * visualiser's Mermaid view and by EventCatalog (the `.mermaid` routes, AI Chat
64
+ * and the MCP server), so every level of a diagram exports the same way.
65
+ */
66
+ interface MermaidExportOptions {
67
+ /** Include class definitions for styling */
68
+ includeStyles?: boolean;
69
+ /** Direction of the flowchart: LR (left-right), TB (top-bottom), etc. */
70
+ direction?: "LR" | "TB" | "RL" | "BT";
71
+ }
72
+ /**
73
+ * Convert React Flow nodes and edges to Mermaid flowchart syntax. Domains,
74
+ * systems and a flow's lanes are subgraphs around what's in them (nested, as
75
+ * on the diagram), so every level of a domain or system diagram keeps its
76
+ * boundaries. Edges between domains are highlighted.
77
+ */
78
+ declare function convertToMermaid(graphNodes: Node[], graphEdges: Edge[], options?: MermaidExportOptions): string;
79
+
80
+ export { type CopiedEdgeRoute as C, type EdgeRoute as E, type LayoutGraph as L, type MermaidExportOptions as M, type LayoutSize as a, convertToMermaid as c, getNodeSize as g, layoutWithElk as l };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as _xyflow_react from '@xyflow/react';
2
2
  import { Node, Connection, MarkerType, Edge, NodeTypes, EdgeTypes, NodeProps, EdgeProps, ReactFlowJsonObject } from '@xyflow/react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { E as EdgeRoute } from './elk-layout-BVUJjv6i.mjs';
4
+ import { C as CopiedEdgeRoute } from './elk-layout-CpbZ6hB9.mjs';
5
5
  import * as react from 'react';
6
6
  import react__default, { ReactNode, ComponentType } from 'react';
7
+ export { M as MermaidExportOptions, c as convertToMermaid } from './export-mermaid-CbER9roE.mjs';
7
8
 
8
9
  /**
9
10
  * EventCatalog resource mode
@@ -363,8 +364,11 @@ type VisualiserSnapshot = {
363
364
  source: string;
364
365
  target: string;
365
366
  label?: string;
366
- /** How it's drawn: the points it goes through on the diagram, and where its label is (from the layout) */
367
- route?: Pick<EdgeRoute, "points" | "label">;
367
+ /**
368
+ * How it's drawn: the points it goes through on the diagram, where its label is, and how tall its nodes were
369
+ * (from the layout)
370
+ */
371
+ route?: CopiedEdgeRoute;
368
372
  }[];
369
373
  /**
370
374
  * Levels 1 and 2 as the diagram shows them (laid out, positions relative to their parents), for Studio to show
@@ -391,6 +395,17 @@ type OpenInStudioRequest = {
391
395
  };
392
396
  interface NodeGraphProps {
393
397
  id: string;
398
+ /**
399
+ * Keeps the Mermaid view in the page's URL (`?render=mermaid`), so links open
400
+ * in it. Only for the visualiser's own pages: not diagrams embedded in docs
401
+ * or other apps, which can share a page (or an iframe) with others.
402
+ */
403
+ syncRenderModeWithUrl?: boolean;
404
+ /**
405
+ * The level of detail to open at (1, 2 or 3), rather than the URL's or the
406
+ * saved one, e.g. the level an MCP client asked for
407
+ */
408
+ initialLevel?: 1 | 2 | 3;
394
409
  title?: string;
395
410
  href?: string;
396
411
  hrefLabel?: string;
@@ -470,14 +485,50 @@ interface NodeGraphProps {
470
485
  /** Starts a Studio canvas from what the diagram shows (the menu has "Open in Studio" when set) */
471
486
  onOpenInStudio?: (request: OpenInStudioRequest) => void;
472
487
  }
473
- declare const NodeGraph: ({ id, nodes: nodesProp, edges: edgesProp, graph, title: titleProp, href, linkTo, hrefLabel, includeKey: includeKeyProp, footerLabel, linksToVisualiser, links, mode, portalId, showFlowWalkthrough, showSearch: showSearchProp, showMenu, compactSearch, hideAttribution, zoomOnScroll, designId, isChatEnabled, maxTextSize, isDevMode, resourceKey, animated: animatedProp, disableMessageAnimation, overviewGraph, hiddenMessagesGraph, preferenceScope, swimlanes, focusNodeId, focusRequestId, fitRequestId, onNodeClick, onBuildUrl, onNavigate, onSaveLayout, onResetLayout, onOpenInStudio, }: NodeGraphProps) => react_jsx_runtime.JSX.Element | null;
488
+ declare const NodeGraph: ({ id, nodes: nodesProp, edges: edgesProp, graph, title: titleProp, href, linkTo, hrefLabel, includeKey: includeKeyProp, footerLabel, linksToVisualiser, links, syncRenderModeWithUrl, initialLevel, mode, portalId, showFlowWalkthrough, showSearch: showSearchProp, showMenu, compactSearch, hideAttribution, zoomOnScroll, designId, isChatEnabled, maxTextSize, isDevMode, resourceKey, animated: animatedProp, disableMessageAnimation, overviewGraph, hiddenMessagesGraph, preferenceScope, swimlanes, focusNodeId, focusRequestId, fitRequestId, onNodeClick, onBuildUrl, onNavigate, onSaveLayout, onResetLayout, onOpenInStudio, }: NodeGraphProps) => react_jsx_runtime.JSX.Element | null;
489
+
490
+ type CanvasLevel = {
491
+ description: string;
492
+ active: boolean;
493
+ /** Why the level is greyed out (e.g. the diagram doesn't have it), shown on hover */
494
+ disabledReason?: string;
495
+ onSelect: () => void;
496
+ };
497
+ /** A button in a toolbar, with its tooltip (what it does, and why it can't be used when it can't) */
498
+ declare const ToolbarButton: ({ label, hint, active, disabled, onClick, children, }: {
499
+ label: string;
500
+ /** Shown under the label on hover */
501
+ hint?: string;
502
+ active?: boolean;
503
+ disabled?: boolean;
504
+ onClick: () => void;
505
+ children: ReactNode;
506
+ }) => react_jsx_runtime.JSX.Element;
507
+ /**
508
+ * How far the canvas is zoomed in, as a percentage. Isolated, so what it's in only re-renders when the zoom changes
509
+ * (not on every pan). Studio's bar shows it too.
510
+ */
511
+ declare const ZoomLevel: react.NamedExoticComponent<{
512
+ className?: string;
513
+ }>;
514
+ declare const ToolbarDivider: () => react_jsx_runtime.JSX.Element;
515
+ /** The frame of a toolbar (e.g. the bar at the bottom of a diagram, or of a Studio canvas), with tooltips */
516
+ declare const Toolbar: ({ children }: {
517
+ children: ReactNode;
518
+ }) => react_jsx_runtime.JSX.Element;
474
519
 
475
520
  interface MermaidViewProps {
476
521
  nodes: Node[];
477
522
  edges: Edge[];
478
523
  maxTextSize?: number;
524
+ /** The diagram's levels of detail, shown in the toolbar as on the diagram */
525
+ levels?: CanvasLevel[];
526
+ /** Zoom with the wheel; otherwise only with Ctrl or Cmd held (or a pinch), as on the diagram */
527
+ zoomOnScroll?: boolean;
528
+ /** Goes back to the diagram (the toolbar's Mermaid toggle, which is on here) */
529
+ onShowDiagram?: () => void;
479
530
  }
480
- declare const MermaidView: ({ nodes, edges, maxTextSize, }: MermaidViewProps) => react_jsx_runtime.JSX.Element;
531
+ declare const MermaidView: ({ nodes, edges, maxTextSize, levels, zoomOnScroll, onShowDiagram, }: MermaidViewProps) => react_jsx_runtime.JSX.Element;
481
532
 
482
533
  /**
483
534
  * A diagram's background: dots on the canvas colour (`.react-flow` in styles-core.css), the same wherever a
@@ -485,6 +536,12 @@ declare const MermaidView: ({ nodes, edges, maxTextSize, }: MermaidViewProps) =>
485
536
  */
486
537
  declare const DiagramBackground: react.NamedExoticComponent<object>;
487
538
 
539
+ /**
540
+ * A diagram's minimap: each node in its resource's colour, and domains and systems as outlined containers with
541
+ * what's in them inside, as the diagram draws them. The same wherever a diagram is drawn (the visualiser and Studio).
542
+ */
543
+ declare const DiagramMiniMap: react.NamedExoticComponent<object>;
544
+
488
545
  /**
489
546
  * A diagram's legend: how many of each kind of node it shows (and of each domain's, when steps are grouped by
490
547
  * domain), with the kind's icon. Clicking an entry hides or shows those nodes. Studio's canvases have the same one.
@@ -505,29 +562,6 @@ declare const LegendPanel: react.NamedExoticComponent<{
505
562
  onLegendClick: (key: string) => void;
506
563
  }>;
507
564
 
508
- /** A button in a toolbar, with its tooltip (what it does, and why it can't be used when it can't) */
509
- declare const ToolbarButton: ({ label, hint, active, disabled, onClick, children, }: {
510
- label: string;
511
- /** Shown under the label on hover */
512
- hint?: string;
513
- active?: boolean;
514
- disabled?: boolean;
515
- onClick: () => void;
516
- children: ReactNode;
517
- }) => react_jsx_runtime.JSX.Element;
518
- /**
519
- * How far the canvas is zoomed in, as a percentage. Isolated, so what it's in only re-renders when the zoom changes
520
- * (not on every pan). Studio's bar shows it too.
521
- */
522
- declare const ZoomLevel: react.NamedExoticComponent<{
523
- className?: string;
524
- }>;
525
- declare const ToolbarDivider: () => react_jsx_runtime.JSX.Element;
526
- /** The frame of a toolbar (e.g. the bar at the bottom of a diagram, or of a Studio canvas), with tooltips */
527
- declare const Toolbar: ({ children }: {
528
- children: ReactNode;
529
- }) => react_jsx_runtime.JSX.Element;
530
-
531
565
  /** Tooltips for a group of controls (e.g. a toolbar): shown after a moment, then straight away while moving along */
532
566
  declare const TipProvider: ({ children }: {
533
567
  children: ReactNode;
@@ -1051,21 +1085,6 @@ declare const edgeTypes: {
1051
1085
  step: react.NamedExoticComponent<_xyflow_react.EdgeProps>;
1052
1086
  };
1053
1087
 
1054
- /**
1055
- * Mermaid Export Utility
1056
- * Converts React Flow nodes and edges to Mermaid flowchart syntax
1057
- */
1058
- interface MermaidExportOptions {
1059
- /** Include class definitions for styling */
1060
- includeStyles?: boolean;
1061
- /** Direction of the flowchart: LR (left-right), TB (top-bottom), etc. */
1062
- direction?: "LR" | "TB" | "RL" | "BT";
1063
- }
1064
- /**
1065
- * Convert React Flow nodes and edges to Mermaid flowchart syntax
1066
- */
1067
- declare function convertToMermaid(graphNodes: Node[], edges: Edge[], options?: MermaidExportOptions): string;
1068
-
1069
1088
  declare const exportNodeGraphForStudio: (data: ReactFlowJsonObject) => ReactFlowJsonObject;
1070
1089
 
1071
1090
  interface BaseCollectionData {
@@ -1132,4 +1151,4 @@ declare const memoNode: <P extends object>(Component: ComponentType<P>) => react
1132
1151
  */
1133
1152
  declare const pauseEdgeAnimations: (canvas: Element | null, paused: boolean) => void | undefined;
1134
1153
 
1135
- export { ACTOR, AGENT, AGENT_TOOL, _default$p as Actor, type ActorNode, type Agent$1 as Agent, _default$j as AgentNode, type AgentTool$1 as AgentTool, _default$k as AgentToolNode, type AgentToolNode as AgentToolNodeType, AnimatedMessageEdge, type BaseNodeData, CHANNEL, COMMAND, type Channel, type ChannelNode, _default$g as Command, type CommandNode, _default$8 as ContextActorNode, type ContextMenuItem, _default$c as CustomNode, DATA, DIAGRAM_FIT_VIEW_OPTIONS, DIAGRAM_MENU, DIAGRAM_MENU_BUTTON, DIAGRAM_MENU_BUTTON_COMPACT, DIAGRAM_MENU_BUTTON_ICON, DIAGRAM_MENU_BUTTON_ICON_COMPACT, DIAGRAM_MENU_ITEM, DIAGRAM_MENU_ITEM_ICON, DIAGRAM_MENU_SEPARATOR, DIAGRAM_MENU_TITLE, type Data, type DataNode, _default$t as DataProductNode, DiagramBackground, _default$a as DomainCardNode, _default$b as DomainNode, type DslGraph, ENTITY_TARGET_HANDLE_ID, EVENT, type EdgeType, _default$d as EntityNode, type EntityProperty, _default$f as Event, type EventCatalogResource, type EventNode, type ExternalSystem, _default$2 as ExternalSystem2Node, type ExternalSystemNode, _default$r as Field, type FieldNode as FieldNodeType, _default$1 as FlowEdge, _default$s as FlowExpandedNode, type FlowGroupBy, type FlowGroupStyle, _default$6 as FlowNode, FocusModeModal, type GraphEdge, type GraphEdgeType, type GraphNode, _default$5 as GroupNode, LabelledDefaultEdge, LabelledSmoothStepEdge, LabelledStepEdge, type LegendEntry, LegendPanel, MESSAGE, type MermaidExportOptions, MermaidView, type Message, _default$u as MessageGroupExpandedNode, type MessageGroupExpandedNodeData, _default$v as MessageGroupNode, type MessageGroupNodeData, type MessageGroupNode as MessageGroupNodeType, _default as MultilineEdgeLabel, type NodeCategory, type NodeConfiguration, _default$w as NodeContextMenu, NodeGraph, type NodeGraphProps, type NodeType, _default$l as Note, type NoteNode, NotesIndicator, type OpenInStudioRequest, OwnerIndicator, QUERY, _default$h as Query, type QueryNode, type RegisteredNode, SERVICE, _default$i as Service, type ServiceNode, type Service as ServiceType, _default$4 as StepNode, _default$x as StepWalkthrough, _default$7 as SystemGroupNode, _default$9 as SystemNode, Tip, TipProvider, Toolbar, ToolbarButton, ToolbarDivider, _default$3 as UserNode, VIEW, type View, type ViewNode, VisualiserSearch, type VisualiserSnapshot, type VisualizerCallbacks, type VisualizerLink, type VisualizerMode, ZoomLevel, _default$o as actorConfig, buildNodeData, convertToMermaid, createEdge, createNode, _default$n as dataNodeConfig, diagramNodeComponents, edgeTypes, _default$e as eventConfig, exportNodeGraphForStudio, _default$m as externalSystemConfig, _default$q as fieldConfig, generateIdForNode, generateIdForNodes, generatedIdForEdge, getColorFromString, getEdgeLabelForMessageAsSource, getEdgeLabelForServiceAsTarget, getEdgeLabelSize, getLegend, getNestedEntityProperties, getPropertyTypeLabel, isFlowGroupBy, layoutGraph, memoNode, nodeComponents, nodeConfigs, normalizeOwners, pauseEdgeAnimations };
1154
+ export { ACTOR, AGENT, AGENT_TOOL, _default$p as Actor, type ActorNode, type Agent$1 as Agent, _default$j as AgentNode, type AgentTool$1 as AgentTool, _default$k as AgentToolNode, type AgentToolNode as AgentToolNodeType, AnimatedMessageEdge, type BaseNodeData, CHANNEL, COMMAND, type Channel, type ChannelNode, _default$g as Command, type CommandNode, _default$8 as ContextActorNode, type ContextMenuItem, _default$c as CustomNode, DATA, DIAGRAM_FIT_VIEW_OPTIONS, DIAGRAM_MENU, DIAGRAM_MENU_BUTTON, DIAGRAM_MENU_BUTTON_COMPACT, DIAGRAM_MENU_BUTTON_ICON, DIAGRAM_MENU_BUTTON_ICON_COMPACT, DIAGRAM_MENU_ITEM, DIAGRAM_MENU_ITEM_ICON, DIAGRAM_MENU_SEPARATOR, DIAGRAM_MENU_TITLE, type Data, type DataNode, _default$t as DataProductNode, DiagramBackground, DiagramMiniMap, _default$a as DomainCardNode, _default$b as DomainNode, type DslGraph, ENTITY_TARGET_HANDLE_ID, EVENT, type EdgeType, _default$d as EntityNode, type EntityProperty, _default$f as Event, type EventCatalogResource, type EventNode, type ExternalSystem, _default$2 as ExternalSystem2Node, type ExternalSystemNode, _default$r as Field, type FieldNode as FieldNodeType, _default$1 as FlowEdge, _default$s as FlowExpandedNode, type FlowGroupBy, type FlowGroupStyle, _default$6 as FlowNode, FocusModeModal, type GraphEdge, type GraphEdgeType, type GraphNode, _default$5 as GroupNode, LabelledDefaultEdge, LabelledSmoothStepEdge, LabelledStepEdge, type LegendEntry, LegendPanel, MESSAGE, MermaidView, type Message, _default$u as MessageGroupExpandedNode, type MessageGroupExpandedNodeData, _default$v as MessageGroupNode, type MessageGroupNodeData, type MessageGroupNode as MessageGroupNodeType, _default as MultilineEdgeLabel, type NodeCategory, type NodeConfiguration, _default$w as NodeContextMenu, NodeGraph, type NodeGraphProps, type NodeType, _default$l as Note, type NoteNode, NotesIndicator, type OpenInStudioRequest, OwnerIndicator, QUERY, _default$h as Query, type QueryNode, type RegisteredNode, SERVICE, _default$i as Service, type ServiceNode, type Service as ServiceType, _default$4 as StepNode, _default$x as StepWalkthrough, _default$7 as SystemGroupNode, _default$9 as SystemNode, Tip, TipProvider, Toolbar, ToolbarButton, ToolbarDivider, _default$3 as UserNode, VIEW, type View, type ViewNode, VisualiserSearch, type VisualiserSnapshot, type VisualizerCallbacks, type VisualizerLink, type VisualizerMode, ZoomLevel, _default$o as actorConfig, buildNodeData, createEdge, createNode, _default$n as dataNodeConfig, diagramNodeComponents, edgeTypes, _default$e as eventConfig, exportNodeGraphForStudio, _default$m as externalSystemConfig, _default$q as fieldConfig, generateIdForNode, generateIdForNodes, generatedIdForEdge, getColorFromString, getEdgeLabelForMessageAsSource, getEdgeLabelForServiceAsTarget, getEdgeLabelSize, getLegend, getNestedEntityProperties, getPropertyTypeLabel, isFlowGroupBy, layoutGraph, memoNode, nodeComponents, nodeConfigs, normalizeOwners, pauseEdgeAnimations };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as _xyflow_react from '@xyflow/react';
2
2
  import { Node, Connection, MarkerType, Edge, NodeTypes, EdgeTypes, NodeProps, EdgeProps, ReactFlowJsonObject } from '@xyflow/react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { E as EdgeRoute } from './elk-layout-BVUJjv6i.js';
4
+ import { C as CopiedEdgeRoute } from './export-mermaid-xL98eL1l.js';
5
+ export { M as MermaidExportOptions, c as convertToMermaid } from './export-mermaid-xL98eL1l.js';
5
6
  import * as react from 'react';
6
7
  import react__default, { ReactNode, ComponentType } from 'react';
7
8
 
@@ -363,8 +364,11 @@ type VisualiserSnapshot = {
363
364
  source: string;
364
365
  target: string;
365
366
  label?: string;
366
- /** How it's drawn: the points it goes through on the diagram, and where its label is (from the layout) */
367
- route?: Pick<EdgeRoute, "points" | "label">;
367
+ /**
368
+ * How it's drawn: the points it goes through on the diagram, where its label is, and how tall its nodes were
369
+ * (from the layout)
370
+ */
371
+ route?: CopiedEdgeRoute;
368
372
  }[];
369
373
  /**
370
374
  * Levels 1 and 2 as the diagram shows them (laid out, positions relative to their parents), for Studio to show
@@ -391,6 +395,17 @@ type OpenInStudioRequest = {
391
395
  };
392
396
  interface NodeGraphProps {
393
397
  id: string;
398
+ /**
399
+ * Keeps the Mermaid view in the page's URL (`?render=mermaid`), so links open
400
+ * in it. Only for the visualiser's own pages: not diagrams embedded in docs
401
+ * or other apps, which can share a page (or an iframe) with others.
402
+ */
403
+ syncRenderModeWithUrl?: boolean;
404
+ /**
405
+ * The level of detail to open at (1, 2 or 3), rather than the URL's or the
406
+ * saved one, e.g. the level an MCP client asked for
407
+ */
408
+ initialLevel?: 1 | 2 | 3;
394
409
  title?: string;
395
410
  href?: string;
396
411
  hrefLabel?: string;
@@ -470,14 +485,50 @@ interface NodeGraphProps {
470
485
  /** Starts a Studio canvas from what the diagram shows (the menu has "Open in Studio" when set) */
471
486
  onOpenInStudio?: (request: OpenInStudioRequest) => void;
472
487
  }
473
- declare const NodeGraph: ({ id, nodes: nodesProp, edges: edgesProp, graph, title: titleProp, href, linkTo, hrefLabel, includeKey: includeKeyProp, footerLabel, linksToVisualiser, links, mode, portalId, showFlowWalkthrough, showSearch: showSearchProp, showMenu, compactSearch, hideAttribution, zoomOnScroll, designId, isChatEnabled, maxTextSize, isDevMode, resourceKey, animated: animatedProp, disableMessageAnimation, overviewGraph, hiddenMessagesGraph, preferenceScope, swimlanes, focusNodeId, focusRequestId, fitRequestId, onNodeClick, onBuildUrl, onNavigate, onSaveLayout, onResetLayout, onOpenInStudio, }: NodeGraphProps) => react_jsx_runtime.JSX.Element | null;
488
+ declare const NodeGraph: ({ id, nodes: nodesProp, edges: edgesProp, graph, title: titleProp, href, linkTo, hrefLabel, includeKey: includeKeyProp, footerLabel, linksToVisualiser, links, syncRenderModeWithUrl, initialLevel, mode, portalId, showFlowWalkthrough, showSearch: showSearchProp, showMenu, compactSearch, hideAttribution, zoomOnScroll, designId, isChatEnabled, maxTextSize, isDevMode, resourceKey, animated: animatedProp, disableMessageAnimation, overviewGraph, hiddenMessagesGraph, preferenceScope, swimlanes, focusNodeId, focusRequestId, fitRequestId, onNodeClick, onBuildUrl, onNavigate, onSaveLayout, onResetLayout, onOpenInStudio, }: NodeGraphProps) => react_jsx_runtime.JSX.Element | null;
489
+
490
+ type CanvasLevel = {
491
+ description: string;
492
+ active: boolean;
493
+ /** Why the level is greyed out (e.g. the diagram doesn't have it), shown on hover */
494
+ disabledReason?: string;
495
+ onSelect: () => void;
496
+ };
497
+ /** A button in a toolbar, with its tooltip (what it does, and why it can't be used when it can't) */
498
+ declare const ToolbarButton: ({ label, hint, active, disabled, onClick, children, }: {
499
+ label: string;
500
+ /** Shown under the label on hover */
501
+ hint?: string;
502
+ active?: boolean;
503
+ disabled?: boolean;
504
+ onClick: () => void;
505
+ children: ReactNode;
506
+ }) => react_jsx_runtime.JSX.Element;
507
+ /**
508
+ * How far the canvas is zoomed in, as a percentage. Isolated, so what it's in only re-renders when the zoom changes
509
+ * (not on every pan). Studio's bar shows it too.
510
+ */
511
+ declare const ZoomLevel: react.NamedExoticComponent<{
512
+ className?: string;
513
+ }>;
514
+ declare const ToolbarDivider: () => react_jsx_runtime.JSX.Element;
515
+ /** The frame of a toolbar (e.g. the bar at the bottom of a diagram, or of a Studio canvas), with tooltips */
516
+ declare const Toolbar: ({ children }: {
517
+ children: ReactNode;
518
+ }) => react_jsx_runtime.JSX.Element;
474
519
 
475
520
  interface MermaidViewProps {
476
521
  nodes: Node[];
477
522
  edges: Edge[];
478
523
  maxTextSize?: number;
524
+ /** The diagram's levels of detail, shown in the toolbar as on the diagram */
525
+ levels?: CanvasLevel[];
526
+ /** Zoom with the wheel; otherwise only with Ctrl or Cmd held (or a pinch), as on the diagram */
527
+ zoomOnScroll?: boolean;
528
+ /** Goes back to the diagram (the toolbar's Mermaid toggle, which is on here) */
529
+ onShowDiagram?: () => void;
479
530
  }
480
- declare const MermaidView: ({ nodes, edges, maxTextSize, }: MermaidViewProps) => react_jsx_runtime.JSX.Element;
531
+ declare const MermaidView: ({ nodes, edges, maxTextSize, levels, zoomOnScroll, onShowDiagram, }: MermaidViewProps) => react_jsx_runtime.JSX.Element;
481
532
 
482
533
  /**
483
534
  * A diagram's background: dots on the canvas colour (`.react-flow` in styles-core.css), the same wherever a
@@ -485,6 +536,12 @@ declare const MermaidView: ({ nodes, edges, maxTextSize, }: MermaidViewProps) =>
485
536
  */
486
537
  declare const DiagramBackground: react.NamedExoticComponent<object>;
487
538
 
539
+ /**
540
+ * A diagram's minimap: each node in its resource's colour, and domains and systems as outlined containers with
541
+ * what's in them inside, as the diagram draws them. The same wherever a diagram is drawn (the visualiser and Studio).
542
+ */
543
+ declare const DiagramMiniMap: react.NamedExoticComponent<object>;
544
+
488
545
  /**
489
546
  * A diagram's legend: how many of each kind of node it shows (and of each domain's, when steps are grouped by
490
547
  * domain), with the kind's icon. Clicking an entry hides or shows those nodes. Studio's canvases have the same one.
@@ -505,29 +562,6 @@ declare const LegendPanel: react.NamedExoticComponent<{
505
562
  onLegendClick: (key: string) => void;
506
563
  }>;
507
564
 
508
- /** A button in a toolbar, with its tooltip (what it does, and why it can't be used when it can't) */
509
- declare const ToolbarButton: ({ label, hint, active, disabled, onClick, children, }: {
510
- label: string;
511
- /** Shown under the label on hover */
512
- hint?: string;
513
- active?: boolean;
514
- disabled?: boolean;
515
- onClick: () => void;
516
- children: ReactNode;
517
- }) => react_jsx_runtime.JSX.Element;
518
- /**
519
- * How far the canvas is zoomed in, as a percentage. Isolated, so what it's in only re-renders when the zoom changes
520
- * (not on every pan). Studio's bar shows it too.
521
- */
522
- declare const ZoomLevel: react.NamedExoticComponent<{
523
- className?: string;
524
- }>;
525
- declare const ToolbarDivider: () => react_jsx_runtime.JSX.Element;
526
- /** The frame of a toolbar (e.g. the bar at the bottom of a diagram, or of a Studio canvas), with tooltips */
527
- declare const Toolbar: ({ children }: {
528
- children: ReactNode;
529
- }) => react_jsx_runtime.JSX.Element;
530
-
531
565
  /** Tooltips for a group of controls (e.g. a toolbar): shown after a moment, then straight away while moving along */
532
566
  declare const TipProvider: ({ children }: {
533
567
  children: ReactNode;
@@ -1051,21 +1085,6 @@ declare const edgeTypes: {
1051
1085
  step: react.NamedExoticComponent<_xyflow_react.EdgeProps>;
1052
1086
  };
1053
1087
 
1054
- /**
1055
- * Mermaid Export Utility
1056
- * Converts React Flow nodes and edges to Mermaid flowchart syntax
1057
- */
1058
- interface MermaidExportOptions {
1059
- /** Include class definitions for styling */
1060
- includeStyles?: boolean;
1061
- /** Direction of the flowchart: LR (left-right), TB (top-bottom), etc. */
1062
- direction?: "LR" | "TB" | "RL" | "BT";
1063
- }
1064
- /**
1065
- * Convert React Flow nodes and edges to Mermaid flowchart syntax
1066
- */
1067
- declare function convertToMermaid(graphNodes: Node[], edges: Edge[], options?: MermaidExportOptions): string;
1068
-
1069
1088
  declare const exportNodeGraphForStudio: (data: ReactFlowJsonObject) => ReactFlowJsonObject;
1070
1089
 
1071
1090
  interface BaseCollectionData {
@@ -1132,4 +1151,4 @@ declare const memoNode: <P extends object>(Component: ComponentType<P>) => react
1132
1151
  */
1133
1152
  declare const pauseEdgeAnimations: (canvas: Element | null, paused: boolean) => void | undefined;
1134
1153
 
1135
- export { ACTOR, AGENT, AGENT_TOOL, _default$p as Actor, type ActorNode, type Agent$1 as Agent, _default$j as AgentNode, type AgentTool$1 as AgentTool, _default$k as AgentToolNode, type AgentToolNode as AgentToolNodeType, AnimatedMessageEdge, type BaseNodeData, CHANNEL, COMMAND, type Channel, type ChannelNode, _default$g as Command, type CommandNode, _default$8 as ContextActorNode, type ContextMenuItem, _default$c as CustomNode, DATA, DIAGRAM_FIT_VIEW_OPTIONS, DIAGRAM_MENU, DIAGRAM_MENU_BUTTON, DIAGRAM_MENU_BUTTON_COMPACT, DIAGRAM_MENU_BUTTON_ICON, DIAGRAM_MENU_BUTTON_ICON_COMPACT, DIAGRAM_MENU_ITEM, DIAGRAM_MENU_ITEM_ICON, DIAGRAM_MENU_SEPARATOR, DIAGRAM_MENU_TITLE, type Data, type DataNode, _default$t as DataProductNode, DiagramBackground, _default$a as DomainCardNode, _default$b as DomainNode, type DslGraph, ENTITY_TARGET_HANDLE_ID, EVENT, type EdgeType, _default$d as EntityNode, type EntityProperty, _default$f as Event, type EventCatalogResource, type EventNode, type ExternalSystem, _default$2 as ExternalSystem2Node, type ExternalSystemNode, _default$r as Field, type FieldNode as FieldNodeType, _default$1 as FlowEdge, _default$s as FlowExpandedNode, type FlowGroupBy, type FlowGroupStyle, _default$6 as FlowNode, FocusModeModal, type GraphEdge, type GraphEdgeType, type GraphNode, _default$5 as GroupNode, LabelledDefaultEdge, LabelledSmoothStepEdge, LabelledStepEdge, type LegendEntry, LegendPanel, MESSAGE, type MermaidExportOptions, MermaidView, type Message, _default$u as MessageGroupExpandedNode, type MessageGroupExpandedNodeData, _default$v as MessageGroupNode, type MessageGroupNodeData, type MessageGroupNode as MessageGroupNodeType, _default as MultilineEdgeLabel, type NodeCategory, type NodeConfiguration, _default$w as NodeContextMenu, NodeGraph, type NodeGraphProps, type NodeType, _default$l as Note, type NoteNode, NotesIndicator, type OpenInStudioRequest, OwnerIndicator, QUERY, _default$h as Query, type QueryNode, type RegisteredNode, SERVICE, _default$i as Service, type ServiceNode, type Service as ServiceType, _default$4 as StepNode, _default$x as StepWalkthrough, _default$7 as SystemGroupNode, _default$9 as SystemNode, Tip, TipProvider, Toolbar, ToolbarButton, ToolbarDivider, _default$3 as UserNode, VIEW, type View, type ViewNode, VisualiserSearch, type VisualiserSnapshot, type VisualizerCallbacks, type VisualizerLink, type VisualizerMode, ZoomLevel, _default$o as actorConfig, buildNodeData, convertToMermaid, createEdge, createNode, _default$n as dataNodeConfig, diagramNodeComponents, edgeTypes, _default$e as eventConfig, exportNodeGraphForStudio, _default$m as externalSystemConfig, _default$q as fieldConfig, generateIdForNode, generateIdForNodes, generatedIdForEdge, getColorFromString, getEdgeLabelForMessageAsSource, getEdgeLabelForServiceAsTarget, getEdgeLabelSize, getLegend, getNestedEntityProperties, getPropertyTypeLabel, isFlowGroupBy, layoutGraph, memoNode, nodeComponents, nodeConfigs, normalizeOwners, pauseEdgeAnimations };
1154
+ export { ACTOR, AGENT, AGENT_TOOL, _default$p as Actor, type ActorNode, type Agent$1 as Agent, _default$j as AgentNode, type AgentTool$1 as AgentTool, _default$k as AgentToolNode, type AgentToolNode as AgentToolNodeType, AnimatedMessageEdge, type BaseNodeData, CHANNEL, COMMAND, type Channel, type ChannelNode, _default$g as Command, type CommandNode, _default$8 as ContextActorNode, type ContextMenuItem, _default$c as CustomNode, DATA, DIAGRAM_FIT_VIEW_OPTIONS, DIAGRAM_MENU, DIAGRAM_MENU_BUTTON, DIAGRAM_MENU_BUTTON_COMPACT, DIAGRAM_MENU_BUTTON_ICON, DIAGRAM_MENU_BUTTON_ICON_COMPACT, DIAGRAM_MENU_ITEM, DIAGRAM_MENU_ITEM_ICON, DIAGRAM_MENU_SEPARATOR, DIAGRAM_MENU_TITLE, type Data, type DataNode, _default$t as DataProductNode, DiagramBackground, DiagramMiniMap, _default$a as DomainCardNode, _default$b as DomainNode, type DslGraph, ENTITY_TARGET_HANDLE_ID, EVENT, type EdgeType, _default$d as EntityNode, type EntityProperty, _default$f as Event, type EventCatalogResource, type EventNode, type ExternalSystem, _default$2 as ExternalSystem2Node, type ExternalSystemNode, _default$r as Field, type FieldNode as FieldNodeType, _default$1 as FlowEdge, _default$s as FlowExpandedNode, type FlowGroupBy, type FlowGroupStyle, _default$6 as FlowNode, FocusModeModal, type GraphEdge, type GraphEdgeType, type GraphNode, _default$5 as GroupNode, LabelledDefaultEdge, LabelledSmoothStepEdge, LabelledStepEdge, type LegendEntry, LegendPanel, MESSAGE, MermaidView, type Message, _default$u as MessageGroupExpandedNode, type MessageGroupExpandedNodeData, _default$v as MessageGroupNode, type MessageGroupNodeData, type MessageGroupNode as MessageGroupNodeType, _default as MultilineEdgeLabel, type NodeCategory, type NodeConfiguration, _default$w as NodeContextMenu, NodeGraph, type NodeGraphProps, type NodeType, _default$l as Note, type NoteNode, NotesIndicator, type OpenInStudioRequest, OwnerIndicator, QUERY, _default$h as Query, type QueryNode, type RegisteredNode, SERVICE, _default$i as Service, type ServiceNode, type Service as ServiceType, _default$4 as StepNode, _default$x as StepWalkthrough, _default$7 as SystemGroupNode, _default$9 as SystemNode, Tip, TipProvider, Toolbar, ToolbarButton, ToolbarDivider, _default$3 as UserNode, VIEW, type View, type ViewNode, VisualiserSearch, type VisualiserSnapshot, type VisualizerCallbacks, type VisualizerLink, type VisualizerMode, ZoomLevel, _default$o as actorConfig, buildNodeData, createEdge, createNode, _default$n as dataNodeConfig, diagramNodeComponents, edgeTypes, _default$e as eventConfig, exportNodeGraphForStudio, _default$m as externalSystemConfig, _default$q as fieldConfig, generateIdForNode, generateIdForNodes, generatedIdForEdge, getColorFromString, getEdgeLabelForMessageAsSource, getEdgeLabelForServiceAsTarget, getEdgeLabelSize, getLegend, getNestedEntityProperties, getPropertyTypeLabel, isFlowGroupBy, layoutGraph, memoNode, nodeComponents, nodeConfigs, normalizeOwners, pauseEdgeAnimations };