@likec4/diagram 1.18.0 → 1.19.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.
Files changed (277) hide show
  1. package/LICENSE +1 -1
  2. package/dist/LikeC4CustomColors.d.ts +7 -0
  3. package/dist/LikeC4CustomColors.js +30 -0
  4. package/dist/LikeC4Diagram.css.d.ts +5 -0
  5. package/dist/LikeC4Diagram.css.js +13 -0
  6. package/dist/LikeC4Diagram.d.ts +6 -0
  7. package/dist/LikeC4Diagram.js +194 -0
  8. package/dist/LikeC4Diagram.props.d.ts +166 -0
  9. package/dist/LikeC4ModelProvider.d.ts +9 -0
  10. package/dist/LikeC4ModelProvider.js +12 -0
  11. package/dist/LikeC4Search.css.d.ts +1 -0
  12. package/dist/LikeC4Search.css.js +5 -0
  13. package/dist/LikeC4Search.d.ts +2 -0
  14. package/dist/LikeC4Search.js +96 -0
  15. package/dist/StaticLikeC4Diagram.d.ts +3 -0
  16. package/dist/StaticLikeC4Diagram.js +41 -0
  17. package/dist/_virtual/_commonjsHelpers.js +6 -0
  18. package/dist/controls/Text.d.ts +2 -0
  19. package/dist/controls/Text.js +7 -0
  20. package/dist/controls/action-button-bar/ActionButtonBar.css.d.ts +1 -0
  21. package/dist/controls/action-button-bar/ActionButtonBar.css.js +5 -0
  22. package/dist/controls/action-button-bar/ActionButtonBar.d.ts +9 -0
  23. package/dist/controls/action-button-bar/ActionButtonBar.js +100 -0
  24. package/dist/controls/action-button-bar/useActionButtonBarCtx.d.ts +10 -0
  25. package/dist/controls/action-button-bar/useActionButtonBarCtx.js +9 -0
  26. package/dist/controls/action-buttons/ActionButton.css.d.ts +1 -0
  27. package/dist/controls/action-buttons/ActionButton.css.js +5 -0
  28. package/dist/controls/action-buttons/ActionButton.d.ts +9 -0
  29. package/dist/controls/action-buttons/ActionButton.js +66 -0
  30. package/dist/controls/action-buttons/ActionButtons.d.ts +12 -0
  31. package/dist/controls/action-buttons/ActionButtons.js +99 -0
  32. package/dist/globals.css.d.ts +1 -0
  33. package/dist/globals.css.js +92 -0
  34. package/dist/hooks/index.d.ts +5 -0
  35. package/dist/hooks/useDiagramState.d.ts +6 -0
  36. package/dist/hooks/useDiagramState.js +27 -0
  37. package/dist/hooks/useMantinePortalProps.d.ts +9 -0
  38. package/dist/hooks/useMantinePortalProps.js +9 -0
  39. package/dist/hooks/useSetState.d.ts +2 -0
  40. package/dist/hooks/useSetState.js +19 -0
  41. package/dist/hooks/useUpdateEffect.d.ts +4 -0
  42. package/dist/hooks/useUpdateEffect.js +32 -0
  43. package/dist/hooks/useXYFlow.d.ts +270 -0
  44. package/dist/hooks/useXYFlow.js +20 -0
  45. package/dist/index.d.ts +11 -0
  46. package/dist/index.js +25 -0
  47. package/dist/likec4model/LikeC4ModelContext.d.ts +3 -0
  48. package/dist/likec4model/LikeC4ModelContext.js +5 -0
  49. package/dist/likec4model/index.d.ts +2 -0
  50. package/dist/likec4model/useLikeC4ElementsTree.d.ts +12 -0
  51. package/dist/likec4model/useLikeC4ElementsTree.js +25 -0
  52. package/dist/likec4model/useLikeC4Model.d.ts +20 -0
  53. package/dist/likec4model/useLikeC4Model.js +55 -0
  54. package/dist/overlays/OverlayContext.d.ts +10 -0
  55. package/dist/overlays/OverlayContext.js +9 -0
  56. package/dist/overlays/Overlays.css.d.ts +3 -0
  57. package/dist/overlays/Overlays.css.js +7 -0
  58. package/dist/overlays/Overlays.d.ts +2 -0
  59. package/dist/overlays/Overlays.js +137 -0
  60. package/dist/overlays/edge-details/EdgeDetailsXYFlow.d.ts +5 -0
  61. package/dist/overlays/edge-details/EdgeDetailsXYFlow.js +185 -0
  62. package/dist/overlays/edge-details/SelectEdge.css.d.ts +7 -0
  63. package/dist/overlays/edge-details/SelectEdge.css.js +17 -0
  64. package/dist/overlays/edge-details/SelectEdge.d.ts +5 -0
  65. package/dist/overlays/edge-details/SelectEdge.js +129 -0
  66. package/dist/overlays/edge-details/_types.d.ts +14 -0
  67. package/dist/overlays/edge-details/use-layouted-edge-details.d.ts +21 -0
  68. package/dist/overlays/edge-details/use-layouted-edge-details.js +270 -0
  69. package/dist/overlays/edge-details/xyflow/CompoundNode.d.ts +5 -0
  70. package/dist/overlays/edge-details/xyflow/CompoundNode.js +76 -0
  71. package/dist/overlays/edge-details/xyflow/ElementNode.d.ts +5 -0
  72. package/dist/overlays/edge-details/xyflow/ElementNode.js +159 -0
  73. package/dist/overlays/edge-details/xyflow/RelationshipEdge.d.ts +3 -0
  74. package/dist/overlays/edge-details/xyflow/RelationshipEdge.js +84 -0
  75. package/dist/overlays/edge-details/xyflow/styles.css.d.ts +9 -0
  76. package/dist/overlays/edge-details/xyflow/styles.css.js +21 -0
  77. package/dist/overlays/element-details/ElementDetailsCard.css.d.ts +16 -0
  78. package/dist/overlays/element-details/ElementDetailsCard.css.js +33 -0
  79. package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -0
  80. package/dist/overlays/element-details/ElementDetailsCard.js +484 -0
  81. package/dist/overlays/element-details/TabPanelDeployments.css.d.ts +4 -0
  82. package/dist/overlays/element-details/TabPanelDeployments.css.js +11 -0
  83. package/dist/overlays/element-details/TabPanelDeployments.d.ts +7 -0
  84. package/dist/overlays/element-details/TabPanelDeployments.js +173 -0
  85. package/dist/overlays/element-details/TabPanelRelationships.css.d.ts +5 -0
  86. package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -0
  87. package/dist/overlays/element-details/TabPanelRelationships.d.ts +8 -0
  88. package/dist/overlays/element-details/TabPanelRelationships.js +157 -0
  89. package/dist/overlays/element-details/TabPanelStructure.css.d.ts +2 -0
  90. package/dist/overlays/element-details/TabPanelStructure.css.js +7 -0
  91. package/dist/overlays/element-details/TabPanelStructure.d.ts +25 -0
  92. package/dist/overlays/element-details/TabPanelStructure.js +91 -0
  93. package/dist/overlays/index.d.ts +1 -0
  94. package/dist/overlays/relationships-of/RelationshipsOverlay.d.ts +5 -0
  95. package/dist/overlays/relationships-of/RelationshipsOverlay.js +193 -0
  96. package/dist/overlays/relationships-of/RelationshipsXYFlow.d.ts +19 -0
  97. package/dist/overlays/relationships-of/RelationshipsXYFlow.js +290 -0
  98. package/dist/overlays/relationships-of/SelectElement.css.d.ts +2 -0
  99. package/dist/overlays/relationships-of/SelectElement.css.js +7 -0
  100. package/dist/overlays/relationships-of/SelectElement.d.ts +7 -0
  101. package/dist/overlays/relationships-of/SelectElement.js +126 -0
  102. package/dist/overlays/relationships-of/_types.d.ts +28 -0
  103. package/dist/overlays/relationships-of/use-layouted-relationships.d.ts +22 -0
  104. package/dist/overlays/relationships-of/use-layouted-relationships.js +496 -0
  105. package/dist/overlays/relationships-of/xyflow/CompoundNode.d.ts +6 -0
  106. package/dist/overlays/relationships-of/xyflow/CompoundNode.js +120 -0
  107. package/dist/overlays/relationships-of/xyflow/ElementNode.d.ts +6 -0
  108. package/dist/overlays/relationships-of/xyflow/ElementNode.js +194 -0
  109. package/dist/overlays/relationships-of/xyflow/EmptyNode.d.ts +5 -0
  110. package/dist/overlays/relationships-of/xyflow/EmptyNode.js +18 -0
  111. package/dist/overlays/relationships-of/xyflow/RelationshipEdge.d.ts +3 -0
  112. package/dist/overlays/relationships-of/xyflow/RelationshipEdge.js +123 -0
  113. package/dist/overlays/relationships-of/xyflow/styles.css.d.ts +14 -0
  114. package/dist/overlays/relationships-of/xyflow/styles.css.js +24 -0
  115. package/dist/overlays/shared/xyflow/RelationshipEdge.css.d.ts +4 -0
  116. package/dist/overlays/shared/xyflow/RelationshipEdge.css.js +12 -0
  117. package/dist/overlays/shared/xyflow/_types.d.ts +77 -0
  118. package/dist/state/DiagramContext.d.ts +1609 -0
  119. package/dist/state/DiagramContext.js +101 -0
  120. package/dist/state/aligners.d.ts +42 -0
  121. package/dist/state/aligners.js +349 -0
  122. package/dist/state/diagram-to-xyflow.d.ts +11 -0
  123. package/dist/state/diagram-to-xyflow.js +113 -0
  124. package/dist/state/diagramStore.d.ts +1705 -0
  125. package/dist/state/diagramStore.js +808 -0
  126. package/dist/state/diagramStore.layout.d.ts +4 -0
  127. package/dist/state/diagramStore.layout.js +56 -0
  128. package/dist/style.css +1 -0
  129. package/dist/theme-vars.css.d.ts +72 -0
  130. package/dist/theme-vars.css.js +6 -0
  131. package/dist/theme-vars.css.ts.vanilla.css.js +1 -0
  132. package/dist/theme-vars.d.ts +3 -0
  133. package/dist/theme-vars.js +5 -0
  134. package/dist/ui/DiagramTitlePanel.css.d.ts +4 -0
  135. package/dist/ui/DiagramTitlePanel.css.js +11 -0
  136. package/dist/ui/DiagramTitlePanel.d.ts +1 -0
  137. package/dist/ui/DiagramTitlePanel.js +159 -0
  138. package/dist/ui/DynamicViewWalkthrough.css.d.ts +4 -0
  139. package/dist/ui/DynamicViewWalkthrough.css.js +11 -0
  140. package/dist/ui/DynamicViewWalkthrough.d.ts +1 -0
  141. package/dist/ui/DynamicViewWalkthrough.js +156 -0
  142. package/dist/ui/EnsureMantine.d.ts +7 -0
  143. package/dist/ui/EnsureMantine.js +14 -0
  144. package/dist/ui/FramerMotionConfig.d.ts +2 -0
  145. package/dist/ui/FramerMotionConfig.js +14 -0
  146. package/dist/ui/Link.d.ts +4 -0
  147. package/dist/ui/Link.js +36 -0
  148. package/dist/ui/notation/NotationPanel.css.d.ts +6 -0
  149. package/dist/ui/notation/NotationPanel.css.js +16 -0
  150. package/dist/ui/notation/NotationPanel.d.ts +1 -0
  151. package/dist/ui/notation/NotationPanel.js +250 -0
  152. package/dist/ui/notation/index.d.ts +1 -0
  153. package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +2 -0
  154. package/dist/ui/top-left/ChangeAutoLayoutButton.js +159 -0
  155. package/dist/ui/top-left/ManualLayoutToolsButton.d.ts +2 -0
  156. package/dist/ui/top-left/ManualLayoutToolsButton.js +137 -0
  157. package/dist/ui/top-left/TopLeftPanel.d.ts +4 -0
  158. package/dist/ui/top-left/TopLeftPanel.js +211 -0
  159. package/dist/ui/top-left/_shared.d.ts +7 -0
  160. package/dist/ui/top-left/_shared.js +22 -0
  161. package/dist/ui/top-left/styles.css.d.ts +8 -0
  162. package/dist/ui/top-left/styles.css.js +17 -0
  163. package/dist/utils/types.d.ts +8 -0
  164. package/dist/utils/vector.d.ts +24 -0
  165. package/dist/utils/vector.js +55 -0
  166. package/dist/xyflow/EdgeMarkers.d.ts +12 -0
  167. package/dist/xyflow/EdgeMarkers.js +192 -0
  168. package/dist/xyflow/FitviewOnDiagramChange.d.ts +4 -0
  169. package/dist/xyflow/FitviewOnDiagramChange.js +72 -0
  170. package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +1 -0
  171. package/dist/xyflow/SelectEdgesOnNodeFocus.js +96 -0
  172. package/dist/xyflow/XYFlow.d.ts +8 -0
  173. package/dist/xyflow/XYFlow.js +145 -0
  174. package/dist/xyflow/XYFlowBackground.d.ts +10 -0
  175. package/dist/xyflow/XYFlowBackground.js +25 -0
  176. package/dist/xyflow/XYFlowInner.d.ts +8 -0
  177. package/dist/xyflow/XYFlowInner.js +41 -0
  178. package/dist/xyflow/const.d.ts +7 -0
  179. package/dist/xyflow/const.js +12 -0
  180. package/dist/xyflow/edges/EdgeLabel.d.ts +7 -0
  181. package/dist/xyflow/edges/EdgeLabel.js +160 -0
  182. package/dist/xyflow/edges/RelationshipEdge.d.ts +6 -0
  183. package/dist/xyflow/edges/RelationshipEdge.js +443 -0
  184. package/dist/xyflow/edges/RelationshipsDropdownMenu.css.d.ts +4 -0
  185. package/dist/xyflow/edges/RelationshipsDropdownMenu.css.js +11 -0
  186. package/dist/xyflow/edges/RelationshipsDropdownMenu.d.ts +13 -0
  187. package/dist/xyflow/edges/RelationshipsDropdownMenu.js +211 -0
  188. package/dist/xyflow/edges/edges.css.d.ts +17 -0
  189. package/dist/xyflow/edges/edges.css.js +37 -0
  190. package/dist/xyflow/edges/utils.d.ts +16 -0
  191. package/dist/xyflow/edges/utils.js +24 -0
  192. package/dist/xyflow/nodes/AnimateVariants.d.ts +1313 -0
  193. package/dist/xyflow/nodes/AnimateVariants.js +123 -0
  194. package/dist/xyflow/nodes/Node.css.d.ts +3 -0
  195. package/dist/xyflow/nodes/Node.css.js +9 -0
  196. package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +14 -0
  197. package/dist/xyflow/nodes/compound/CompoundNode.css.js +27 -0
  198. package/dist/xyflow/nodes/compound/CompoundNode.d.ts +6 -0
  199. package/dist/xyflow/nodes/compound/CompoundNode.js +216 -0
  200. package/dist/xyflow/nodes/compound/index.d.ts +1 -0
  201. package/dist/xyflow/nodes/element/ElementLink.css.d.ts +3 -0
  202. package/dist/xyflow/nodes/element/ElementLink.d.ts +6 -0
  203. package/dist/xyflow/nodes/element/ElementNode.d.ts +6 -0
  204. package/dist/xyflow/nodes/element/ElementNode.js +190 -0
  205. package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +17 -0
  206. package/dist/xyflow/nodes/element/ElementShapeSvg.js +175 -0
  207. package/dist/xyflow/nodes/element/element.css.d.ts +18 -0
  208. package/dist/xyflow/nodes/element/element.css.js +31 -0
  209. package/dist/xyflow/nodes/element/index.d.ts +1 -0
  210. package/dist/xyflow/nodes/shared/ElementIcon.d.ts +8 -0
  211. package/dist/xyflow/nodes/shared/ElementIcon.js +38 -0
  212. package/dist/xyflow/nodes/shared/Toolbar.d.ts +9 -0
  213. package/dist/xyflow/nodes/shared/Toolbar.js +436 -0
  214. package/dist/xyflow/types.d.ts +36 -0
  215. package/dist/xyflow/useLayoutConstraints.d.ts +42 -0
  216. package/dist/xyflow/useLayoutConstraints.js +226 -0
  217. package/dist/xyflow/useXYFlowEvents.d.ts +160 -0
  218. package/dist/xyflow/useXYFlowEvents.js +275 -0
  219. package/dist/xyflow/utils.d.ts +22 -0
  220. package/dist/xyflow/utils.js +72 -0
  221. package/package.json +34 -27
  222. package/src/LikeC4Diagram.tsx +4 -4
  223. package/src/LikeC4Search.css.ts +12 -0
  224. package/src/LikeC4Search.tsx +39 -90
  225. package/src/controls/Text.ts +5 -0
  226. package/src/controls/action-button-bar/ActionButtonBar.css.ts +13 -0
  227. package/src/controls/action-button-bar/ActionButtonBar.tsx +138 -0
  228. package/src/controls/action-button-bar/useActionButtonBarCtx.ts +13 -0
  229. package/src/controls/action-buttons/ActionButton.css.ts +29 -0
  230. package/src/controls/action-buttons/ActionButton.tsx +66 -0
  231. package/src/controls/action-buttons/ActionButtons.tsx +138 -0
  232. package/src/hooks/useXYFlow.ts +8 -8
  233. package/src/index.ts +12 -6
  234. package/src/likec4model/index.ts +12 -2
  235. package/src/overlays/edge-details/EdgeDetailsXYFlow.tsx +18 -12
  236. package/src/overlays/edge-details/_types.ts +13 -37
  237. package/src/overlays/edge-details/use-layouted-edge-details.ts +16 -14
  238. package/src/overlays/edge-details/xyflow/CompoundNode.tsx +3 -11
  239. package/src/overlays/edge-details/xyflow/ElementNode.tsx +4 -11
  240. package/src/overlays/edge-details/xyflow/RelationshipEdge.tsx +3 -3
  241. package/src/overlays/edge-details/xyflow/styles.css.ts +1 -59
  242. package/src/overlays/relationships-of/RelationshipsXYFlow.tsx +23 -23
  243. package/src/overlays/relationships-of/_types.ts +20 -58
  244. package/src/overlays/relationships-of/use-layouted-relationships.ts +36 -40
  245. package/src/overlays/relationships-of/xyflow/CompoundNode.tsx +9 -13
  246. package/src/overlays/relationships-of/xyflow/ElementNode.tsx +12 -15
  247. package/src/overlays/relationships-of/xyflow/EmptyNode.tsx +4 -7
  248. package/src/overlays/relationships-of/xyflow/RelationshipEdge.tsx +16 -14
  249. package/src/overlays/shared/xyflow/RelationshipEdge.css.ts +60 -0
  250. package/src/overlays/shared/xyflow/_types.ts +87 -0
  251. package/src/state/diagram-to-xyflow.ts +6 -7
  252. package/src/state/diagramStore.layout.ts +3 -4
  253. package/src/state/diagramStore.ts +35 -37
  254. package/src/theme-vars.css.ts +81 -0
  255. package/src/theme-vars.ts +8 -81
  256. package/src/ui/DiagramTitlePanel.tsx +6 -6
  257. package/src/utils/types.ts +6 -0
  258. package/src/xyflow/SelectEdgesOnNodeFocus.tsx +3 -3
  259. package/src/xyflow/XYFlow.tsx +2 -2
  260. package/src/xyflow/edges/EdgeLabel.tsx +25 -18
  261. package/src/xyflow/edges/RelationshipEdge.tsx +5 -3
  262. package/src/xyflow/edges/RelationshipsDropdownMenu.tsx +3 -3
  263. package/src/xyflow/edges/edges.css.ts +68 -74
  264. package/src/xyflow/edges/utils.ts +6 -6
  265. package/src/xyflow/nodes/AnimateVariants.ts +143 -0
  266. package/src/xyflow/nodes/Node.css.ts +44 -0
  267. package/src/xyflow/nodes/compound/CompoundNode.css.ts +1 -64
  268. package/src/xyflow/nodes/compound/CompoundNode.tsx +69 -182
  269. package/src/xyflow/nodes/element/ElementLink.tsx +2 -3
  270. package/src/xyflow/nodes/element/ElementNode.tsx +64 -266
  271. package/src/xyflow/nodes/element/element.css.ts +0 -57
  272. package/src/xyflow/nodes/shared/Toolbar.tsx +30 -30
  273. package/src/xyflow/types.ts +48 -51
  274. package/src/xyflow/useLayoutConstraints.ts +9 -9
  275. package/src/xyflow/useXYFlowEvents.ts +13 -30
  276. package/src/xyflow/utils.ts +2 -2
  277. package/src/xyflow/nodes/use-animate-variants.tsx +0 -64
@@ -1,4 +1,4 @@
1
- import { delay, type DiagramView, type Fqn, isAncestor, type Relation } from '@likec4/core'
1
+ import { type AbstractRelation, delay, type DiagramView, type Fqn, isAncestor } from '@likec4/core'
2
2
  import { useId } from '@mantine/hooks'
3
3
  import { useDebouncedCallback, useDeepCompareEffect, useSyncedRef } from '@react-hookz/web'
4
4
  import {
@@ -19,7 +19,7 @@ import { isNullish, map, omit, only, prop, setPath, unique } from 'remeda'
19
19
  import { useUpdateEffect } from '../../hooks'
20
20
  import { centerXYInternalNode } from '../../xyflow/utils'
21
21
  import { cssReactflowMarker } from '../Overlays.css'
22
- import type { XYFlowTypes } from './_types'
22
+ import type { RelationshipsOfFlowTypes } from './_types'
23
23
  import { ZIndexes } from './use-layouted-relationships'
24
24
  import { CompoundNode } from './xyflow/CompoundNode'
25
25
  import { ElementNode } from './xyflow/ElementNode'
@@ -38,10 +38,10 @@ const edgeTypes = {
38
38
  /**
39
39
  * Root node in 'subjects' column
40
40
  */
41
- const findRootSubject = (nodes: XYFlowTypes.Node[]) =>
42
- nodes.find((n): n is XYFlowTypes.ElementNode => n.data.column === 'subjects' && isNullish(n.parentId))
41
+ const findRootSubject = (nodes: RelationshipsOfFlowTypes.Node[]) =>
42
+ nodes.find((n): n is RelationshipsOfFlowTypes.ElementNode => n.data.column === 'subjects' && isNullish(n.parentId))
43
43
 
44
- const resetDimmedAndHovered = (xyflow: ReactFlowInstance<XYFlowTypes.Node, XYFlowTypes.Edge>) => {
44
+ const resetDimmedAndHovered = (xyflow: ReactFlowInstance<RelationshipsOfFlowTypes.Node, RelationshipsOfFlowTypes.Edge>) => {
45
45
  xyflow.setEdges(edges =>
46
46
  edges.map(edge => ({
47
47
  ...edge,
@@ -62,12 +62,12 @@ const resetDimmedAndHovered = (xyflow: ReactFlowInstance<XYFlowTypes.Node, XYFlo
62
62
  dimmed: false,
63
63
  hovered: false
64
64
  }
65
- }) as XYFlowTypes.Node
65
+ }) as RelationshipsOfFlowTypes.Node
66
66
  )
67
67
  )
68
68
  }
69
69
 
70
- const animateEdge = (node: XYFlowTypes.Node, animated = true) => (edges: XYFlowTypes.Edge[]) => {
70
+ const animateEdge = (node: RelationshipsOfFlowTypes.Node, animated = true) => (edges: RelationshipsOfFlowTypes.Edge[]) => {
71
71
  return edges.map(edge => {
72
72
  const isConnected = edge.source === node.id || edge.target === node.id || isAncestor(node.id, edge.source)
73
73
  || isAncestor(node.id, edge.target)
@@ -78,10 +78,10 @@ const animateEdge = (node: XYFlowTypes.Node, animated = true) => (edges: XYFlowT
78
78
  })
79
79
  }
80
80
 
81
- const onlyOneUnique = <T extends keyof Relation>(
82
- data: XYFlowTypes.Edge['data'],
81
+ const onlyOneUnique = <T extends keyof AbstractRelation>(
82
+ data: RelationshipsOfFlowTypes.Edge['data'],
83
83
  property: T
84
- ): Relation[T] | undefined => {
84
+ ): AbstractRelation[T] | undefined => {
85
85
  return only(unique(map(data.relations, prop(property))))
86
86
  }
87
87
 
@@ -89,8 +89,8 @@ type RelationshipsXYFlowProps =
89
89
  & PropsWithChildren<{
90
90
  subjectId: Fqn
91
91
  view: DiagramView
92
- nodes: XYFlowTypes.Node[]
93
- edges: XYFlowTypes.Edge[]
92
+ nodes: RelationshipsOfFlowTypes.Node[]
93
+ edges: RelationshipsOfFlowTypes.Edge[]
94
94
  bounds: {
95
95
  x: number
96
96
  y: number
@@ -100,7 +100,7 @@ type RelationshipsXYFlowProps =
100
100
  viewportPadding?: number | undefined
101
101
  }>
102
102
  & Pick<
103
- ReactFlowProps<XYFlowTypes.Node, XYFlowTypes.Edge>,
103
+ ReactFlowProps<RelationshipsOfFlowTypes.Node, RelationshipsOfFlowTypes.Edge>,
104
104
  | 'onNodeClick'
105
105
  | 'elementsSelectable'
106
106
  | 'maxZoom'
@@ -122,10 +122,10 @@ function RelationshipsXYFlowWrapped({
122
122
  }: RelationshipsXYFlowProps) {
123
123
  const id = useId()
124
124
 
125
- const lastClickedNodeRef = useRef<XYFlowTypes.NonEmptyNode | null>(null)
125
+ const lastClickedNodeRef = useRef<RelationshipsOfFlowTypes.NonEmptyNode | null>(null)
126
126
 
127
- const xyflow = useReactFlow<XYFlowTypes.Node, XYFlowTypes.Edge>()
128
- const xystore = useStoreApi<XYFlowTypes.Node, XYFlowTypes.Edge>()
127
+ const xyflow = useReactFlow<RelationshipsOfFlowTypes.Node, RelationshipsOfFlowTypes.Edge>()
128
+ const xystore = useStoreApi<RelationshipsOfFlowTypes.Node, RelationshipsOfFlowTypes.Edge>()
129
129
 
130
130
  const [zoomOnDoubleClick, setZoomOnDoubleClick] = useState(true)
131
131
 
@@ -183,7 +183,7 @@ function RelationshipsXYFlowWrapped({
183
183
 
184
184
  // If subject node is the same, don't animate
185
185
  if (currentSubjectNode && nextSubjectNode?.data.fqn === currentSubjectNode.data.fqn) {
186
- setNodes(map(nodes, setPath(['data', 'initialAnimation'], false)))
186
+ setNodes(map(nodes, setPath(['data', 'entering'], false)))
187
187
  setEdges(edges)
188
188
  fitview()
189
189
  return
@@ -227,7 +227,7 @@ function RelationshipsXYFlowWrapped({
227
227
  dimmed: n.data.column === 'subjects' ? 'immediate' : false
228
228
  }
229
229
  // hidden: n.data.column === 'subjects'
230
- } as XYFlowTypes.Node
230
+ } as RelationshipsOfFlowTypes.Node
231
231
  }
232
232
  // Move existing node
233
233
  return {
@@ -242,7 +242,7 @@ function RelationshipsXYFlowWrapped({
242
242
  leaving: false,
243
243
  dimmed: false
244
244
  }
245
- } as XYFlowTypes.Node
245
+ } as RelationshipsOfFlowTypes.Node
246
246
  }))
247
247
  setEdges(_edges.map(e => ({
248
248
  ...e,
@@ -282,7 +282,7 @@ function RelationshipsXYFlowWrapped({
282
282
  isCancelled = true
283
283
  }
284
284
  }
285
- setNodes(map(nodes, setPath(['data', 'initialAnimation'], false)))
285
+ setNodes(map(nodes, setPath(['data', 'entering'], false)))
286
286
  setEdges(edges)
287
287
  fitview()
288
288
  return undefined
@@ -291,8 +291,8 @@ function RelationshipsXYFlowWrapped({
291
291
  return (
292
292
  <ReactFlow
293
293
  id={id}
294
- defaultEdges={[] as XYFlowTypes.Edge[]}
295
- defaultNodes={[] as XYFlowTypes.Node[]}
294
+ defaultEdges={[] as RelationshipsOfFlowTypes.Edge[]}
295
+ defaultNodes={[] as RelationshipsOfFlowTypes.Node[]}
296
296
  nodeTypes={nodeTypes}
297
297
  edgeTypes={edgeTypes}
298
298
  defaultMarkerColor="var(--likec4-relation-lineColor)"
@@ -344,7 +344,7 @@ function RelationshipsXYFlowWrapped({
344
344
  ...n.data,
345
345
  dimmed: n.id !== edge.source && n.id !== edge.target
346
346
  }
347
- } as XYFlowTypes.Node))
347
+ } as RelationshipsOfFlowTypes.Node))
348
348
  )
349
349
  }}
350
350
  onEdgeMouseLeave={() => {
@@ -1,78 +1,40 @@
1
- import type { ComputedNode, Fqn, Relation, ViewId } from '@likec4/core'
2
- import type {
3
- Edge as ReactFlowEdge,
4
- InternalNode as ReactFlowInternalNode,
5
- Node as ReactFlowNode,
6
- ReactFlowInstance
7
- } from '@xyflow/react'
8
- import type { SetRequired } from 'type-fest'
1
+ import type { AddEdgeData, AddNodeData } from '../../utils/types'
2
+ import type { SharedFlowTypes } from '../shared/xyflow/_types'
3
+
4
+ export namespace RelationshipsOfFlowTypes {
9
5
 
10
- export namespace XYFlowTypes {
11
6
  /**
12
- * Handle in ReactFlow terms
7
+ * Data that is exclusive to the relationships-of overlay. It will be merged into the node types
8
+ * provided by SharedFlowTypes.
13
9
  */
14
- export type Port = {
15
- id: string
16
- type: 'in' | 'out'
17
- }
18
-
19
- type NodeProps = {
10
+ type RelationshipsOfNodeData = {
20
11
  depth?: number
21
12
  column: 'incomers' | 'subjects' | 'outgoers'
22
- fqn: Fqn
23
13
  existsInCurrentView: boolean
24
- element: Pick<ComputedNode, 'color' | 'title' | 'description' | 'shape' | 'kind'>
25
- ports: {
26
- left: Port[]
27
- right: Port[]
28
- }
29
- navigateTo: ViewId | null
30
- hovered?: boolean
31
14
  layoutId?: string
32
- leaving?: boolean
33
- /**
34
- * @default true
35
- */
36
- initialAnimation?: boolean
37
- /**
38
- * Whether the node is dimmed
39
- * 'immediate' means that the node is dimmed without delay
40
- */
41
- dimmed?: 'immediate' | boolean
42
15
  }
43
16
 
44
- export type ElementNode = SetRequired<ReactFlowNode<NodeProps, 'element'>, 'type'>
17
+ // Extend the node types provided by SharedFlowTypes with RelationshipsOfNodeData
18
+
19
+ export type ElementNode = AddNodeData<SharedFlowTypes.ElementNode, RelationshipsOfNodeData>
45
20
 
46
- export type CompoundNode = SetRequired<ReactFlowNode<NodeProps, 'compound'>, 'type'>
21
+ export type CompoundNode = AddNodeData<SharedFlowTypes.CompoundNode, RelationshipsOfNodeData>
47
22
 
48
23
  export type NonEmptyNode = ElementNode | CompoundNode
49
24
 
50
- export type EmptyNode = SetRequired<
51
- ReactFlowNode<{
52
- column: 'incomers' | 'subjects' | 'outgoers'
53
- hovered?: boolean
54
- dimmed?: boolean
55
- /**
56
- * @default true
57
- */
58
- initialAnimation?: boolean
59
- }, 'empty'>,
60
- 'type'
61
- >
25
+ export type EmptyNode = AddNodeData<SharedFlowTypes.EmptyNode, RelationshipsOfNodeData>
62
26
 
63
27
  export type Node = NonEmptyNode | EmptyNode
64
28
 
65
- export type Edge = Omit<ReactFlowEdge, 'data' | 'type'> & {
66
- data: {
67
- relations: [Relation, ...Relation[]]
68
- includedInCurrentView: boolean
69
- hovered?: boolean
70
- dimmed?: 'immediate' | boolean
71
- }
72
- type: 'relation'
29
+ /**
30
+ * Data that is exclusive to the relationships-of overlay. It will be merged into the edge types
31
+ * provided by SharedFlowTypes.
32
+ */
33
+ type RelationshipsOfEdgeData = {
34
+ existsInCurrentView: boolean
73
35
  }
74
36
 
75
- export type Instance = ReactFlowInstance<Node, Edge>
37
+ // Extend the edge types provided by SharedFlowTypes with RelationshipsOfEdgeData
76
38
 
77
- export type InternalNode = ReactFlowInternalNode<Node>
39
+ export type Edge = AddEdgeData<SharedFlowTypes.Edge, RelationshipsOfEdgeData>
78
40
  }
@@ -38,7 +38,7 @@ import {
38
38
  tap
39
39
  } from 'remeda'
40
40
  import { useLikeC4Model } from '../../likec4model'
41
- import type { XYFlowTypes } from './_types'
41
+ import type { RelationshipsOfFlowTypes } from './_types'
42
42
 
43
43
  const columns = ['incomers', 'subjects', 'outgoers'] as const
44
44
  type ColumnKey = typeof columns[number]
@@ -134,11 +134,11 @@ type Context = {
134
134
  outgoers: Set<Fqn>
135
135
  }
136
136
  columns: {
137
- incomers: Map<Fqn, XYFlowTypes.Node>
138
- subjects: Map<Fqn, XYFlowTypes.Node>
139
- outgoers: Map<Fqn, XYFlowTypes.Node>
137
+ incomers: Map<Fqn, RelationshipsOfFlowTypes.Node>
138
+ subjects: Map<Fqn, RelationshipsOfFlowTypes.Node>
139
+ outgoers: Map<Fqn, RelationshipsOfFlowTypes.Node>
140
140
  }
141
- edges: XYFlowTypes.Edge[]
141
+ edges: RelationshipsOfFlowTypes.Edge[]
142
142
  }
143
143
 
144
144
  const sized = (height: number = Sizes.hodeHeight) => ({
@@ -146,7 +146,7 @@ const sized = (height: number = Sizes.hodeHeight) => ({
146
146
  height
147
147
  })
148
148
 
149
- const graphId = (node: XYFlowTypes.Node) => ({
149
+ const graphId = (node: RelationshipsOfFlowTypes.Node) => ({
150
150
  id: node.id,
151
151
  port: node.type === 'compound' ? `${node.id}::port` : node.id,
152
152
  body: `${node.id}`,
@@ -156,7 +156,7 @@ const graphId = (node: XYFlowTypes.Node) => ({
156
156
  function nodeData(
157
157
  element: LikeC4Model.Element,
158
158
  ctx: Context
159
- ): Omit<XYFlowTypes.NonEmptyNode['data'], 'column'> {
159
+ ): Omit<RelationshipsOfFlowTypes.NonEmptyNode['data'], 'column'> {
160
160
  // We try to inherit style from existing diagram node
161
161
  let diagramNode = ctx.diagramNodes.get(element.id)
162
162
 
@@ -183,8 +183,8 @@ function nodeData(
183
183
  },
184
184
  navigateTo: diagramNode?.navigateTo ?? element.defaultView?.id ?? null,
185
185
  ports: {
186
- left: [],
187
- right: []
186
+ in: [],
187
+ out: []
188
188
  }
189
189
  }
190
190
  }
@@ -192,7 +192,7 @@ function nodeData(
192
192
  function createEmptyNode(
193
193
  column: ColumnKey,
194
194
  ctx: Context
195
- ): XYFlowTypes.EmptyNode {
195
+ ): RelationshipsOfFlowTypes.EmptyNode {
196
196
  const id = `${column}__empty` as Fqn
197
197
  const xynodes = ctx.columns[column]
198
198
  let node = xynodes.get(id)
@@ -200,12 +200,13 @@ function createEmptyNode(
200
200
  invariant(node.type === 'empty', 'Node is not empty')
201
201
  return node
202
202
  }
203
- const xynode: XYFlowTypes.EmptyNode = {
203
+ const xynode: RelationshipsOfFlowTypes.EmptyNode = {
204
204
  type: 'empty',
205
205
  id,
206
206
  position: { x: 0, y: 0 },
207
207
  data: {
208
- column
208
+ column,
209
+ existsInCurrentView: true
209
210
  },
210
211
  zIndex: ZIndexes.empty
211
212
  }
@@ -224,11 +225,11 @@ function createEmptyNode(
224
225
 
225
226
  function createNode(
226
227
  column: ColumnKey,
227
- nodeType: Exclude<XYFlowTypes.Node['type'], 'empty'>,
228
+ nodeType: Exclude<RelationshipsOfFlowTypes.Node['type'], 'empty'>,
228
229
  element: LikeC4Model.Element,
229
230
  ctx: Context,
230
231
  depth: number = 0
231
- ): XYFlowTypes.ElementNode | XYFlowTypes.CompoundNode {
232
+ ): RelationshipsOfFlowTypes.ElementNode | RelationshipsOfFlowTypes.CompoundNode {
232
233
  const xynodes = ctx.columns[column]
233
234
  let node = xynodes.get(element.id)
234
235
  if (node) {
@@ -251,7 +252,7 @@ function createNode(
251
252
  found => found ? createNode(column, 'compound', found, ctx, depth + 2) : null
252
253
  )
253
254
 
254
- const xynode: XYFlowTypes.NonEmptyNode = {
255
+ const xynode: RelationshipsOfFlowTypes.NonEmptyNode = {
255
256
  type: nodeType,
256
257
  id: `${column}::${element.id}`,
257
258
  position: { x: 0, y: 0 },
@@ -289,7 +290,7 @@ function createNode(
289
290
  * And return a function to get node bounds for xyflow
290
291
  */
291
292
  function applyDagreLayout(g: dagre.graphlib.Graph) {
292
- type NodeBounds = Required<Pick<XYFlowTypes.Node, 'position' | 'width' | 'height'>>
293
+ type NodeBounds = Required<Pick<RelationshipsOfFlowTypes.Node, 'position' | 'width' | 'height'>>
293
294
  dagre.layout(g)
294
295
  return function nodeBounds(nodeId: string): NodeBounds {
295
296
  const { x, y, width, height } = g.node(nodeId)
@@ -307,18 +308,18 @@ function applyDagreLayout(g: dagre.graphlib.Graph) {
307
308
  function addEdge(
308
309
  ctx: Context,
309
310
  props: {
310
- includedInCurrentView: boolean
311
+ existsInCurrentView: boolean
311
312
  source: string
312
313
  target: string
313
- relations: XYFlowTypes.Edge['data']['relations']
314
+ relations: RelationshipsOfFlowTypes.Edge['data']['relations']
314
315
  }
315
316
  ) {
316
- const { source, target, relations, includedInCurrentView } = props
317
+ const { source, target, relations, existsInCurrentView } = props
317
318
  const ids = relations.map(r => r.id).join('_')
318
319
  const label = only(relations)?.title ?? 'untitled'
319
320
 
320
321
  const isMultiple = relations.length > 1
321
- const edge: XYFlowTypes.Edge = {
322
+ const edge: RelationshipsOfFlowTypes.Edge = {
322
323
  id: `rel${ctx.edges.length + 1}_${ids}`,
323
324
  type: 'relation',
324
325
  source,
@@ -326,7 +327,7 @@ function addEdge(
326
327
  sourceHandle: target,
327
328
  targetHandle: source,
328
329
  data: {
329
- includedInCurrentView,
330
+ existsInCurrentView: existsInCurrentView,
330
331
  relations
331
332
  },
332
333
  label: isMultiple ? `${relations.length} relationships` : label,
@@ -361,8 +362,8 @@ function layout(
361
362
  viewIncludesSubject: boolean
362
363
  notIncludedRelations: number
363
364
  subject: LikeC4Model.Element
364
- nodes: XYFlowTypes.Node[]
365
- edges: XYFlowTypes.Edge[]
365
+ nodes: RelationshipsOfFlowTypes.Node[]
366
+ edges: RelationshipsOfFlowTypes.Edge[]
366
367
  bounds: {
367
368
  x: number
368
369
  y: number
@@ -372,6 +373,7 @@ function layout(
372
373
  } {
373
374
  const diagramNodes = new Map(view.nodes.map(n => [n.id, n]))
374
375
  const subjectElement = likec4model.element(subjectId)
376
+
375
377
  const viewIncludesSubject = diagramNodes.has(subjectId)
376
378
 
377
379
  const viewRelationships = new Set(
@@ -500,7 +502,7 @@ function layout(
500
502
  relation,
501
503
  source,
502
504
  target,
503
- includedInCurrentView: viewRelationships.has(relation.id),
505
+ existsInCurrentView: viewRelationships.has(relation.id),
504
506
  id: `${source.id}:${target.id}`
505
507
  })
506
508
  })
@@ -512,14 +514,8 @@ function layout(
512
514
  const { source, target } = grouped[0]
513
515
  const relations = map(grouped, g => g.relation)
514
516
 
515
- source.data.ports.right.push({
516
- id: target.id,
517
- type: 'out'
518
- })
519
- target.data.ports.left.push({
520
- id: source.id,
521
- type: 'in'
522
- })
517
+ source.data.ports.out.push(target.id)
518
+ target.data.ports.in.push(source.id)
523
519
 
524
520
  const isAnyCompound = source.type === 'compound' || target.type === 'compound'
525
521
 
@@ -530,7 +526,7 @@ function layout(
530
526
 
531
527
  addEdge(ctx, {
532
528
  // if view does not include subject - do not highlight
533
- includedInCurrentView: !viewIncludesSubject || grouped.every(g => g.includedInCurrentView),
529
+ existsInCurrentView: !viewIncludesSubject || grouped.every(g => g.existsInCurrentView),
534
530
  source: source.id,
535
531
  target: target.id,
536
532
  relations
@@ -555,7 +551,7 @@ function layout(
555
551
  if (subject.type !== 'element') {
556
552
  continue
557
553
  }
558
- const subjectPortsCount = Math.max(subject.data.ports.left.length, subject.data.ports.right.length)
554
+ const subjectPortsCount = Math.max(subject.data.ports.in.length, subject.data.ports.out.length)
559
555
  if (subjectPortsCount > 2) {
560
556
  g.node(subject.id).height = Sizes.hodeHeight + (subjectPortsCount - 3) * 14
561
557
  }
@@ -628,13 +624,13 @@ function layout(
628
624
  }
629
625
 
630
626
  // Sort ports in subject vertically
631
- const sortedPorts = (ports: XYFlowTypes.Port[]) => {
627
+ const sortedPorts = (ports: string[]) => {
632
628
  return pipe(
633
629
  ports,
634
630
  map(port => {
635
631
  return {
636
632
  port,
637
- topY: nodeBounds(port.id).position.y
633
+ topY: nodeBounds(port).position.y
638
634
  }
639
635
  }),
640
636
  sortBy(prop('topY')),
@@ -658,11 +654,11 @@ function layout(
658
654
  continue
659
655
  }
660
656
  // Sort ports by their position
661
- if (node.data.ports.left.length > 1) {
662
- node.data.ports.left = sortedPorts(node.data.ports.left)
657
+ if (node.data.ports.in.length > 1) {
658
+ node.data.ports.in = sortedPorts(node.data.ports.in)
663
659
  }
664
- if (node.data.ports.right.length > 1) {
665
- node.data.ports.right = sortedPorts(node.data.ports.right)
660
+ if (node.data.ports.out.length > 1) {
661
+ node.data.ports.out = sortedPorts(node.data.ports.out)
666
662
  }
667
663
  }
668
664
 
@@ -1,17 +1,13 @@
1
- import { Text as MantineText } from '@mantine/core'
2
1
  import { Handle, type NodeProps, Position, useStore } from '@xyflow/react'
3
2
  import clsx from 'clsx'
4
3
  import { deepEqual, shallowEqual } from 'fast-equals'
5
4
  import { m } from 'framer-motion'
6
5
  import { memo, useCallback } from 'react'
7
- import type { XYFlowTypes } from '../_types'
6
+ import type { RelationshipsOfFlowTypes } from '../_types'
8
7
  import * as css from './styles.css'
8
+ import { Text } from '../../../controls/Text'
9
9
 
10
- const Text = MantineText.withProps({
11
- component: 'div'
12
- })
13
-
14
- type CompoundNodeProps = NodeProps<XYFlowTypes.CompoundNode>
10
+ type CompoundNodeProps = NodeProps<RelationshipsOfFlowTypes.CompoundNode>
15
11
 
16
12
  export const CompoundNode = memo<CompoundNodeProps>(({
17
13
  id,
@@ -20,7 +16,7 @@ export const CompoundNode = memo<CompoundNodeProps>(({
20
16
  ports,
21
17
  layoutId = id,
22
18
  leaving = false,
23
- initialAnimation = true,
19
+ entering = true,
24
20
  ...data
25
21
  },
26
22
  width = 200,
@@ -61,7 +57,7 @@ export const CompoundNode = memo<CompoundNodeProps>(({
61
57
  layoutId={layoutId}
62
58
  data-compound-depth={data.depth ?? 1}
63
59
  data-likec4-color={element.color}
64
- initial={(layoutId === id && initialAnimation)
60
+ initial={(layoutId === id && entering)
65
61
  ? {
66
62
  ...scale(-20),
67
63
  opacity: 0,
@@ -99,22 +95,22 @@ export const CompoundNode = memo<CompoundNodeProps>(({
99
95
  {element.title}
100
96
  </Text>
101
97
  </m.div>
102
- {ports.left.map(({ id, type }, i) => (
98
+ {ports.in.map((id, i) => (
103
99
  <Handle
104
100
  key={id}
105
101
  id={id}
106
- type={type === 'in' ? 'target' : 'source'}
102
+ type="target"
107
103
  position={Position.Left}
108
104
  style={{
109
105
  visibility: 'hidden',
110
106
  top: `${20 * (i + 1)}px`
111
107
  }} />
112
108
  ))}
113
- {ports.right.map(({ id, type }, i) => (
109
+ {ports.out.map((id, i) => (
114
110
  <Handle
115
111
  key={id}
116
112
  id={id}
117
- type={type === 'in' ? 'target' : 'source'}
113
+ type="source"
118
114
  position={Position.Right}
119
115
  style={{
120
116
  visibility: 'hidden',
@@ -1,4 +1,4 @@
1
- import { ActionIcon, Box, Group, Text as MantineText } from '@mantine/core'
1
+ import { ActionIcon, Box, Group } from '@mantine/core'
2
2
  import { IconFileSymlink, IconTransform, IconZoomScan } from '@tabler/icons-react'
3
3
  import { Handle, type NodeProps, Position } from '@xyflow/react'
4
4
  import clsx from 'clsx'
@@ -9,8 +9,9 @@ import { type DiagramState, useDiagramState } from '../../../hooks'
9
9
  import { ElementShapeSvg } from '../../../xyflow/nodes/element/ElementShapeSvg'
10
10
  import { stopPropagation } from '../../../xyflow/utils'
11
11
  import { useOverlayDialog } from '../../OverlayContext'
12
- import type { XYFlowTypes } from '../_types'
12
+ import type { RelationshipsOfFlowTypes } from '../_types'
13
13
  import * as css from './styles.css'
14
+ import { Text } from '../../../controls/Text'
14
15
 
15
16
  const Action = ActionIcon.withProps({
16
17
  className: 'nodrag nopan ' + css.navigateBtn,
@@ -20,11 +21,7 @@ const Action = ActionIcon.withProps({
20
21
  onPointerDownCapture: stopPropagation
21
22
  })
22
23
 
23
- const Text = MantineText.withProps({
24
- component: 'div'
25
- })
26
-
27
- type ElementNodeProps = NodeProps<XYFlowTypes.ElementNode>
24
+ type ElementNodeProps = NodeProps<RelationshipsOfFlowTypes.ElementNode>
28
25
 
29
26
  function selector(s: DiagramState) {
30
27
  return {
@@ -42,7 +39,7 @@ export const ElementNode = memo<ElementNodeProps>(({
42
39
  navigateTo,
43
40
  layoutId = id,
44
41
  leaving = false,
45
- initialAnimation = true,
42
+ entering = true,
46
43
  ...data
47
44
  },
48
45
  selectable = true,
@@ -82,7 +79,7 @@ export const ElementNode = memo<ElementNodeProps>(({
82
79
  ])}
83
80
  layoutId={layoutId}
84
81
  data-likec4-color={element.color}
85
- initial={(layoutId === id && initialAnimation)
82
+ initial={(layoutId === id && entering)
86
83
  ? {
87
84
  ...scale(-20),
88
85
  opacity: 0,
@@ -168,26 +165,26 @@ export const ElementNode = memo<ElementNodeProps>(({
168
165
  )}
169
166
  </Group>
170
167
  </m.div>
171
- {ports.left.map(({ id, type }, i) => (
168
+ {ports.in.map((id, i) => (
172
169
  <Handle
173
170
  key={id}
174
171
  id={id}
175
- type={type === 'in' ? 'target' : 'source'}
172
+ type="target"
176
173
  position={Position.Left}
177
174
  style={{
178
175
  visibility: 'hidden',
179
- top: `${15 + (i + 1) * ((h - 30) / (ports.left.length + 1))}px`
176
+ top: `${15 + (i + 1) * ((h - 30) / (ports.in.length + 1))}px`
180
177
  }} />
181
178
  ))}
182
- {ports.right.map(({ id, type }, i) => (
179
+ {ports.out.map((id, i) => (
183
180
  <Handle
184
181
  key={id}
185
182
  id={id}
186
- type={type === 'in' ? 'target' : 'source'}
183
+ type="source"
187
184
  position={Position.Right}
188
185
  style={{
189
186
  visibility: 'hidden',
190
- top: `${15 + (i + 1) * ((h - 30) / (ports.right.length + 1))}px`
187
+ top: `${15 + (i + 1) * ((h - 30) / (ports.out.length + 1))}px`
191
188
  }} />
192
189
  ))}
193
190
  </>
@@ -1,13 +1,10 @@
1
- import { Box, Text as MantineText } from '@mantine/core'
1
+ import { Box } from '@mantine/core'
2
2
  import { type NodeProps } from '@xyflow/react'
3
- import type { XYFlowTypes } from '../_types'
3
+ import type { RelationshipsOfFlowTypes } from '../_types'
4
4
  import * as css from './styles.css'
5
+ import { Text } from '../../../controls/Text'
5
6
 
6
- const Text = MantineText.withProps({
7
- component: 'div'
8
- })
9
-
10
- type EmptyNodeProps = NodeProps<XYFlowTypes.EmptyNode>
7
+ type EmptyNodeProps = NodeProps<RelationshipsOfFlowTypes.EmptyNode>
11
8
 
12
9
  export function EmptyNode({
13
10
  data: {