@likec4/diagram 1.27.0 → 1.27.2

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.
Files changed (151) hide show
  1. package/bundle/index.js +2343 -6880
  2. package/dist/LikeC4Diagram.js +3 -9
  3. package/dist/LikeC4Diagram.props.d.ts +5 -3
  4. package/dist/StaticLikeC4Diagram.js +1 -1
  5. package/dist/_virtual/set.js +5 -0
  6. package/dist/_virtual/set2.js +3 -0
  7. package/dist/base/BaseXYFlow.d.ts +2 -1
  8. package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
  9. package/dist/base/primitives/compound/CompoundNodeContainer.js +1 -2
  10. package/dist/base/primitives/edge/EdgeLabel.css.js +1 -4
  11. package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
  12. package/dist/base/primitives/edge/EdgePath.js +0 -3
  13. package/dist/base/primitives/edge/edge.css.js +2 -0
  14. package/dist/base/primitives/element/ElementActionButtons.js +5 -10
  15. package/dist/base/primitives/element/ElementNodeContainer.css.js +5 -4
  16. package/dist/base/primitives/element/ElementShape.css.js +1 -12
  17. package/dist/base/primitives/element/ElementTitle.css.js +3 -2
  18. package/dist/base/types.js +2 -2
  19. package/dist/base/updateEdges.js +1 -9
  20. package/dist/base/updateNodes.js +1 -12
  21. package/dist/bundle/LikeC4View.js +2 -2
  22. package/dist/bundle/LikeC4View.props.d.ts +7 -7
  23. package/dist/components/Link.js +1 -1
  24. package/dist/hooks/useCurrentViewId.js +8 -2
  25. package/dist/hooks/useDiagram.d.ts +2659 -1996
  26. package/dist/hooks/useDiagram.js +16 -8
  27. package/dist/likec4diagram/DiagramXYFlow.js +10 -9
  28. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +30 -41
  29. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +1 -1
  30. package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +6 -1
  31. package/dist/likec4diagram/ui/controls/LayoutDriftNotification.js +13 -5
  32. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +3 -3
  33. package/dist/likec4diagram/ui/notation/NotationPanel.js +10 -4
  34. package/dist/likec4diagram/useLayoutConstraints.d.ts +11 -10
  35. package/dist/likec4diagram/useLayoutConstraints.js +64 -61
  36. package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/set.js +369 -0
  37. package/dist/overlays/Overlays.js +5 -3
  38. package/dist/overlays/element-details/actor.d.ts +2769 -173
  39. package/dist/overlays/overlay/Overlay.css.d.ts +26 -2
  40. package/dist/overlays/overlay/Overlay.css.js +83 -16
  41. package/dist/overlays/overlay/Overlay.d.ts +7 -6
  42. package/dist/overlays/overlay/Overlay.js +39 -32
  43. package/dist/overlays/overlaysActor.js +2 -2
  44. package/dist/overlays/relationship-details/RelationshipDetails.js +113 -70
  45. package/dist/overlays/relationship-details/SelectEdge.d.ts +1 -1
  46. package/dist/overlays/relationship-details/SelectEdge.js +15 -9
  47. package/dist/overlays/relationship-details/_types.d.ts +4 -1
  48. package/dist/overlays/relationship-details/actor.d.ts +415 -128
  49. package/dist/overlays/relationship-details/actor.js +162 -53
  50. package/dist/overlays/relationship-details/compute.d.ts +12 -0
  51. package/dist/overlays/relationship-details/compute.js +139 -0
  52. package/dist/overlays/relationship-details/custom/ElementActions.js +27 -5
  53. package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
  54. package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +2 -1
  55. package/dist/overlays/relationship-details/hooks.d.ts +336 -6
  56. package/dist/overlays/relationship-details/hooks.js +9 -7
  57. package/dist/overlays/relationship-details/layout-to-xyflow.d.ts +12 -0
  58. package/dist/overlays/relationship-details/layout-to-xyflow.js +149 -0
  59. package/dist/overlays/relationship-details/layout.d.ts +22 -0
  60. package/dist/overlays/relationship-details/layout.js +314 -0
  61. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +3 -1
  62. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +2 -2
  63. package/dist/overlays/relationships-browser/SelectElement.js +4 -4
  64. package/dist/overlays/relationships-browser/_types.d.ts +2 -0
  65. package/dist/overlays/relationships-browser/actor.d.ts +130 -14
  66. package/dist/overlays/relationships-browser/actor.js +30 -16
  67. package/dist/overlays/relationships-browser/custom/ElementActions.js +5 -3
  68. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +3 -1
  69. package/dist/overlays/relationships-browser/custom/edgeTypes.js +1 -1
  70. package/dist/overlays/relationships-browser/hooks.d.ts +3 -1
  71. package/dist/overlays/relationships-browser/hooks.js +1 -1
  72. package/dist/overlays/relationships-browser/{-useRelationshipsView.d.ts → layout.d.ts} +2 -0
  73. package/dist/overlays/relationships-browser/{-useRelationshipsView.js → layout.js} +19 -2
  74. package/dist/overlays/relationships-browser/useViewToNodesEdges.d.ts +1 -1
  75. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +3 -1
  76. package/dist/packages/core/src/compute-view/relationships-view/compute.js +1 -1
  77. package/dist/packages/core/src/model/connection/model/ConnectionModel.js +121 -0
  78. package/dist/packages/core/src/model/connection/model/find.js +39 -0
  79. package/dist/packages/core/src/model/connection/ops.js +7 -0
  80. package/dist/packages/core/src/utils/const.js +3 -0
  81. package/dist/packages/core/src/utils/fqn.js +9 -1
  82. package/dist/packages/core/src/utils/iterable/find.js +21 -0
  83. package/dist/packages/core/src/utils/iterable/some.js +21 -0
  84. package/dist/packages/core/src/utils/set.js +48 -0
  85. package/dist/packages/core/src/utils/string-hash.js +13 -0
  86. package/dist/state/DiagramActorProvider.d.ts +4 -2
  87. package/dist/state/DiagramActorProvider.js +30 -37
  88. package/dist/state/assign.js +2 -2
  89. package/dist/state/diagram-machine.d.ts +1731 -1040
  90. package/dist/state/diagram-machine.js +126 -60
  91. package/dist/state/syncManualLayoutActor.d.ts +1 -1
  92. package/dist/styles.css.js +1 -1
  93. package/package.json +11 -11
  94. package/src/LikeC4Diagram.props.ts +7 -3
  95. package/src/LikeC4Diagram.tsx +2 -8
  96. package/src/StaticLikeC4Diagram.tsx +1 -1
  97. package/src/base/BaseXYFlow.tsx +2 -1
  98. package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -3
  99. package/src/base/primitives/edge/EdgeLabel.css.ts +1 -4
  100. package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -1
  101. package/src/base/primitives/edge/EdgePath.tsx +0 -3
  102. package/src/base/primitives/edge/edge.css.ts +2 -0
  103. package/src/base/primitives/element/ElementActionButtons.tsx +6 -7
  104. package/src/base/primitives/element/ElementNodeContainer.css.ts +5 -4
  105. package/src/base/primitives/element/ElementShape.css.ts +1 -12
  106. package/src/base/primitives/element/ElementTitle.css.ts +3 -2
  107. package/src/base/types.ts +2 -7
  108. package/src/base/updateEdges.ts +8 -8
  109. package/src/base/updateNodes.ts +11 -11
  110. package/src/bundle/LikeC4View.props.ts +7 -7
  111. package/src/bundle/LikeC4View.tsx +2 -2
  112. package/src/components/Link.tsx +3 -1
  113. package/src/hooks/useCurrentViewId.ts +4 -2
  114. package/src/hooks/useDiagram.ts +18 -9
  115. package/src/likec4diagram/DiagramXYFlow.tsx +11 -9
  116. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +39 -48
  117. package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +2 -2
  118. package/src/likec4diagram/custom/nodes/toolbar/styles.css.ts +5 -0
  119. package/src/likec4diagram/ui/controls/LayoutDriftNotification.tsx +8 -4
  120. package/src/likec4diagram/ui/notation/NotationPanel.css.ts +2 -2
  121. package/src/likec4diagram/ui/notation/NotationPanel.tsx +8 -6
  122. package/src/likec4diagram/useLayoutConstraints.ts +84 -89
  123. package/src/overlays/Overlays.tsx +5 -3
  124. package/src/overlays/overlay/Overlay.css.ts +83 -15
  125. package/src/overlays/overlay/Overlay.tsx +52 -41
  126. package/src/overlays/overlaysActor.ts +1 -1
  127. package/src/overlays/relationship-details/RelationshipDetails.tsx +131 -68
  128. package/src/overlays/relationship-details/SelectEdge.tsx +19 -12
  129. package/src/overlays/relationship-details/_types.ts +3 -1
  130. package/src/overlays/relationship-details/actor.ts +217 -68
  131. package/src/overlays/relationship-details/compute.ts +186 -0
  132. package/src/overlays/relationship-details/custom/ElementActions.tsx +27 -18
  133. package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
  134. package/src/overlays/relationship-details/hooks.ts +10 -8
  135. package/src/overlays/relationship-details/layout-to-xyflow.ts +195 -0
  136. package/src/overlays/relationship-details/layout.ts +470 -0
  137. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +2 -2
  138. package/src/overlays/relationships-browser/SelectElement.tsx +5 -5
  139. package/src/overlays/relationships-browser/_types.ts +2 -0
  140. package/src/overlays/relationships-browser/actor.ts +39 -14
  141. package/src/overlays/relationships-browser/custom/ElementActions.tsx +5 -3
  142. package/src/overlays/relationships-browser/custom/edgeTypes.tsx +1 -1
  143. package/src/overlays/relationships-browser/hooks.ts +2 -2
  144. package/src/overlays/relationships-browser/{-useRelationshipsView.ts → layout.ts} +23 -13
  145. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +3 -1
  146. package/src/state/DiagramActorProvider.tsx +40 -50
  147. package/src/state/assign.ts +2 -2
  148. package/src/state/diagram-machine.ts +151 -75
  149. package/dist/overlays/relationship-details/useLayoutedDetails.d.ts +0 -19
  150. package/dist/overlays/relationship-details/useLayoutedDetails.js +0 -267
  151. package/src/overlays/relationship-details/useLayoutedDetails.ts +0 -376
@@ -0,0 +1,314 @@
1
+ import dagre from '@dagrejs/dagre';
2
+ import { invariant } from '@likec4/core';
3
+ import { pipe, filter, mapToObj, find, map, tap, reduce, sortBy, prop } from 'remeda';
4
+ import { ifind } from '../../packages/core/src/utils/iterable/find.js';
5
+ import DefaultMap from '../../_virtual/default-map.js';
6
+ import { treeFromElements } from '../../packages/core/src/compute-view/relationships-view/utils.js';
7
+
8
+ const Sizes = {
9
+ dagre: {
10
+ ranksep: 60,
11
+ nodesep: 35,
12
+ edgesep: 25
13
+ },
14
+ edgeLabel: {
15
+ width: 220,
16
+ height: 14
17
+ // minlen: 1,
18
+ },
19
+ nodeWidth: 330,
20
+ nodeHeight: 180,
21
+ compound: {
22
+ labelHeight: 2,
23
+ paddingTop: 50,
24
+ paddingBottom: 32
25
+ }
26
+ };
27
+ function createGraph() {
28
+ const g = new dagre.graphlib.Graph({
29
+ directed: true,
30
+ compound: true,
31
+ multigraph: true
32
+ });
33
+ g.setGraph({
34
+ ...Sizes.dagre,
35
+ rankdir: "LR"
36
+ });
37
+ g.setDefaultEdgeLabel(() => ({ ...Sizes.edgeLabel }));
38
+ g.setDefaultNodeLabel(() => ({}));
39
+ return g;
40
+ }
41
+ const PortSuffix = "-port";
42
+ function createNodes(column, elements, g) {
43
+ const graphNodes = new DefaultMap((key) => ({
44
+ id: `${column}-${key}`,
45
+ portId: `${column}-${key}`
46
+ }));
47
+ const tree = treeFromElements(elements);
48
+ for (const element of tree.sorted) {
49
+ const isCompound = tree.children(element).length > 0;
50
+ const fqn = element.id;
51
+ const id = `${column}-${fqn}`;
52
+ const portId = isCompound ? `${id}${PortSuffix}` : id;
53
+ graphNodes.set(fqn, {
54
+ id,
55
+ portId
56
+ });
57
+ g.setNode(id, {
58
+ column,
59
+ element,
60
+ isCompound,
61
+ portId,
62
+ inPorts: [],
63
+ outPorts: [],
64
+ width: Sizes.nodeWidth,
65
+ height: Sizes.nodeHeight
66
+ });
67
+ if (isCompound) {
68
+ g.setNode(portId, {
69
+ element,
70
+ portId,
71
+ isCompound,
72
+ inPorts: [],
73
+ outPorts: [],
74
+ width: Sizes.nodeWidth - Sizes.dagre.ranksep,
75
+ height: Sizes.compound.labelHeight
76
+ });
77
+ g.setParent(portId, id);
78
+ }
79
+ const parent = tree.parent(element);
80
+ if (parent) {
81
+ g.setParent(id, `${column}-${parent.id}`);
82
+ }
83
+ }
84
+ return {
85
+ ...tree,
86
+ byId: (id) => {
87
+ const element = tree.byId(id);
88
+ const graph = graphNodes.get(element.id);
89
+ return {
90
+ element,
91
+ graph
92
+ };
93
+ },
94
+ graphNodes
95
+ };
96
+ }
97
+ function applyDagreLayout(g) {
98
+ dagre.layout(g, {
99
+ // disableOptimalOrderHeuristic: true,
100
+ });
101
+ return (nodeId) => {
102
+ const node = g.node(nodeId);
103
+ const { x, y, width, height } = node;
104
+ return {
105
+ position: {
106
+ x: x - Math.round(width / 2),
107
+ y: y - Math.round(height / 2)
108
+ },
109
+ width,
110
+ height
111
+ };
112
+ };
113
+ }
114
+ function layoutRelationshipDetails(data, scope) {
115
+ const g = createGraph();
116
+ const sources = createNodes("sources", data.sources, g), targets = createNodes("targets", data.targets, g);
117
+ const edges = Array.from(data.relationships).map((r) => {
118
+ const source = sources.byId(r.source.id).graph;
119
+ const target = targets.byId(r.target.id).graph;
120
+ const name = r.id;
121
+ g.node(source.id).outPorts.push(target.id);
122
+ g.node(target.id).inPorts.push(source.id);
123
+ g.setEdge(source.portId, target.portId, {
124
+ ...Sizes.edgeLabel
125
+ }, name);
126
+ return {
127
+ name,
128
+ source: source.id,
129
+ sourceHandle: source.id + "_out" + (g.node(source.id).outPorts.length - 1),
130
+ target: target.id,
131
+ targetHandle: target.id + "_in" + (g.node(target.id).inPorts.length - 1),
132
+ relationship: r
133
+ };
134
+ });
135
+ const nodeIds = [
136
+ ...sources.graphNodes.values(),
137
+ ...targets.graphNodes.values()
138
+ ];
139
+ for (const { id: nodeId } of nodeIds) {
140
+ const node = g.node(nodeId);
141
+ if (node.isCompound) {
142
+ continue;
143
+ }
144
+ const edgeCount2 = Math.max(g.inEdges(nodeId)?.length ?? 0, g.outEdges(nodeId)?.length ?? 0);
145
+ if (edgeCount2 > 3) {
146
+ node.height = node.height + (edgeCount2 - 4) * 14;
147
+ }
148
+ }
149
+ const edgeCount = g.edgeCount();
150
+ if (edgeCount > 5) {
151
+ for (const edge of g.edges()) {
152
+ g.setEdge(edge, {
153
+ ...Sizes.edgeLabel,
154
+ width: edgeCount > 10 ? 800 : 400
155
+ });
156
+ }
157
+ }
158
+ const dagreBounds = applyDagreLayout(g);
159
+ const _calculatedNodeBounds = pipe(
160
+ nodeIds,
161
+ // Compound nodes have different portId
162
+ filter((n) => n.id === n.portId),
163
+ mapToObj((n) => [n.id, dagreBounds(n.id)])
164
+ );
165
+ function nodeBounds(nodeId) {
166
+ return _calculatedNodeBounds[nodeId] ??= pipe(
167
+ g.children(nodeId) ?? [],
168
+ filter((id) => !id.endsWith(PortSuffix)),
169
+ map((id) => nodeBounds(id)),
170
+ tap((bounds) => {
171
+ invariant(bounds.length > 0, `Node ${nodeId} has no nested nodes`);
172
+ }),
173
+ reduce((acc, bounds) => {
174
+ return {
175
+ minY: Math.min(acc.minY, bounds.position.y),
176
+ maxY: Math.max(acc.maxY, bounds.position.y + bounds.height)
177
+ };
178
+ }, { minY: Infinity, maxY: -Infinity }),
179
+ ({ minY: minY2, maxY }) => {
180
+ const {
181
+ position: { x },
182
+ width
183
+ } = dagreBounds(nodeId);
184
+ minY2 = minY2 - Sizes.compound.paddingTop;
185
+ maxY = maxY + Sizes.compound.paddingBottom;
186
+ return {
187
+ position: {
188
+ x,
189
+ y: minY2
190
+ },
191
+ width,
192
+ height: maxY - minY2
193
+ };
194
+ }
195
+ );
196
+ }
197
+ function nodeLevel(nodeId) {
198
+ const parent = g.parent(nodeId);
199
+ if (parent) {
200
+ return nodeLevel(parent) + 1;
201
+ }
202
+ return 0;
203
+ }
204
+ function nodeDepth(nodeId) {
205
+ const children = g.children(nodeId) ?? [];
206
+ if (children.length === 0) {
207
+ return 0;
208
+ }
209
+ return 1 + Math.max(...children.map(nodeDepth));
210
+ }
211
+ const sortedPorts = (nodeId, type, ports) => {
212
+ return pipe(
213
+ ports,
214
+ map((port, index) => {
215
+ return {
216
+ port: nodeId + "_" + type + index,
217
+ topY: nodeBounds(port).position.y
218
+ };
219
+ }),
220
+ sortBy(prop("topY")),
221
+ map(prop("port"))
222
+ );
223
+ };
224
+ let minX = 0;
225
+ let minY = 0;
226
+ const nodes = nodeIds.map(({ id }) => {
227
+ const { element, inPorts, outPorts, column } = g.node(id);
228
+ let { position, width, height } = nodeBounds(id);
229
+ const parentId = g.parent(id);
230
+ const children = (g.children(id) ?? []).filter((c) => !c.endsWith(PortSuffix));
231
+ minX = Math.min(minX, position.x);
232
+ minY = Math.min(minY, position.y);
233
+ const navigateTo = scope ? ifind(element.scopedViews(), (v) => v.id !== scope.id)?.id ?? null : null;
234
+ const inheritFromNode = scope?.findNodeWithElement(element.id);
235
+ const scopedAncestor = scope && !inheritFromNode ? ifind(element.ancestors(), (a) => !!scope.findNodeWithElement(a.id))?.id : null;
236
+ const inheritFromNodeOrAncestor = inheritFromNode ?? (scopedAncestor && scope?.findNodeWithElement(scopedAncestor));
237
+ return {
238
+ id,
239
+ parent: parentId ?? null,
240
+ position: [position.x, position.y],
241
+ title: element.title,
242
+ description: element.description,
243
+ technology: element.technology,
244
+ tags: null,
245
+ links: null,
246
+ color: inheritFromNodeOrAncestor?.color ?? element.color,
247
+ shape: inheritFromNode?.shape ?? element.shape,
248
+ icon: inheritFromNode?.icon ?? element.icon ?? "none",
249
+ modelRef: element.id,
250
+ kind: element.kind,
251
+ level: nodeLevel(id),
252
+ labelBBox: {
253
+ x: position.x,
254
+ y: position.y,
255
+ width,
256
+ height
257
+ },
258
+ style: {
259
+ ...(inheritFromNode ?? inheritFromNodeOrAncestor)?.style,
260
+ ...element.$element.style
261
+ },
262
+ navigateTo,
263
+ ...children.length > 0 && { depth: nodeDepth(id) },
264
+ children,
265
+ width,
266
+ height,
267
+ column,
268
+ ports: {
269
+ in: sortedPorts(id, "in", inPorts),
270
+ out: sortedPorts(id, "out", outPorts)
271
+ }
272
+ };
273
+ });
274
+ return {
275
+ bounds: {
276
+ x: Math.min(minX, 0),
277
+ y: Math.min(minY, 0),
278
+ width: g.graph().width ?? 100,
279
+ height: g.graph().height ?? 100
280
+ },
281
+ nodes,
282
+ edges: g.edges().reduce((acc, e) => {
283
+ const edge = g.edge(e);
284
+ const ename = e.name;
285
+ if (!ename) {
286
+ return acc;
287
+ }
288
+ const { name, source, target, relationship, sourceHandle, targetHandle } = find(edges, (e2) => e2.name === ename);
289
+ const label = relationship.title ?? "untitled";
290
+ const navigateTo = relationship.navigateTo?.id ?? null;
291
+ const description = relationship.description ?? null;
292
+ const technology = relationship.technology ?? null;
293
+ acc.push({
294
+ id: name,
295
+ source,
296
+ sourceHandle,
297
+ target,
298
+ targetHandle,
299
+ label,
300
+ color: relationship.color,
301
+ ...navigateTo && { navigateTo },
302
+ ...description && { description },
303
+ ...technology && { technology },
304
+ points: edge.points.map((p) => [p.x, p.y]),
305
+ line: relationship.line,
306
+ relationId: relationship.id,
307
+ parent: null
308
+ });
309
+ return acc;
310
+ }, [])
311
+ };
312
+ }
313
+
314
+ export { layoutRelationshipDetails };
@@ -1,7 +1,7 @@
1
1
  import { RelationshipsBrowserActorRef } from './actor';
2
2
  import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
3
3
  import { Position } from '@xyflow/system';
4
- import { NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
4
+ import { Fqn, NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
5
5
  export declare const edgeTypes: {
6
6
  relationship: NamedExoticComponent<{
7
7
  id: string;
@@ -35,6 +35,8 @@ export declare const edgeTypes: {
35
35
  active?: boolean;
36
36
  dimmed?: import("../../base").Base.Dimmed;
37
37
  } & {
38
+ sourceFqn: Fqn;
39
+ targetFqn: Fqn;
38
40
  relations: NonEmptyArray<RelationId>;
39
41
  color: Color | undefined;
40
42
  label: string | null;
@@ -8,9 +8,9 @@ import { shallowEqual } from 'fast-equals';
8
8
  import { LayoutGroup, AnimatePresence, m } from 'framer-motion';
9
9
  import { useRef, memo, useEffect } from 'react';
10
10
  import { BaseXYFlow } from '../../base/BaseXYFlow.js';
11
- import { useRelationshipsView } from './-useRelationshipsView.js';
12
11
  import { ViewPadding } from './const.js';
13
12
  import { RelationshipsBrowserActorContext, useRelationshipsBrowser, useRelationshipsBrowserState } from './hooks.js';
13
+ import { useRelationshipsView } from './layout.js';
14
14
  import { SelectElement } from './SelectElement.js';
15
15
  import { RelationshipEdge } from './custom/edgeTypes.js';
16
16
  import { EmptyNode, CompoundNode, ElementNode } from './custom/nodeTypes.js';
@@ -124,7 +124,7 @@ const RelationshipsBrowserInner = memo(() => {
124
124
  if (instance.viewportInitialized) {
125
125
  browser.send({ type: "xyflow.init", instance, store });
126
126
  }
127
- }, [store, instance, browser]);
127
+ }, [store, instance.viewportInitialized, browser]);
128
128
  const layouted = useRelationshipsView(subjectId, viewId, scope);
129
129
  const [historySubjectId, historyOps, { history, current }] = useStateHistory(subjectId);
130
130
  useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { ancestorsFqn } from '@likec4/core';
3
3
  import { useTree, Group, Box, Popover, PopoverTarget, Button, Text, PopoverDropdown, ScrollAreaAutosize, Tree, ActionIcon, Tooltip, SegmentedControl } from '@mantine/core';
4
4
  import { IconSelector, IconChevronRight } from '@tabler/icons-react';
@@ -44,8 +44,8 @@ const SelectElement = memo(() => {
44
44
  });
45
45
  tree.select(subjectId);
46
46
  }, [subjectId]);
47
- return /* @__PURE__ */ jsxs(Group, { ref: root, gap: "xs", wrap: "nowrap", pos: "relative", children: [
48
- enableSelectSubject && /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ return /* @__PURE__ */ jsxs(Group, { ref: root, gap: "xs", pos: "relative", children: [
48
+ enableSelectSubject && /* @__PURE__ */ jsxs(Group, { gap: 4, wrap: "nowrap", children: [
49
49
  /* @__PURE__ */ jsx(
50
50
  Box,
51
51
  {
@@ -153,7 +153,7 @@ const SelectElement = memo(() => {
153
153
  }
154
154
  ) })
155
155
  ] }),
156
- enableChangeScope && /* @__PURE__ */ jsxs(Fragment, { children: [
156
+ enableChangeScope && /* @__PURE__ */ jsxs(Group, { gap: 4, wrap: "nowrap", children: [
157
157
  enableSelectSubject && /* @__PURE__ */ jsx(
158
158
  Box,
159
159
  {
@@ -33,6 +33,8 @@ export declare namespace RelationshipsBrowserTypes {
33
33
  type Node = ElementNode | CompoundNode | EmptyNode;
34
34
  type NodeData = Node['data'];
35
35
  type EdgeData = Base.EdgeData<{
36
+ sourceFqn: Fqn;
37
+ targetFqn: Fqn;
36
38
  relations: NonEmptyArray<RelationId>;
37
39
  color: Color | undefined;
38
40
  label: string | null;