@likec4/diagram 1.30.0 → 1.31.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 (266) hide show
  1. package/README.md +324 -5
  2. package/bundle/chunk-BBzMXzCg.js +21383 -0
  3. package/bundle/custom.js +62 -0
  4. package/bundle/index.js +17459 -38163
  5. package/dist/LikeC4CustomColors.js +2 -2
  6. package/dist/LikeC4Diagram.d.ts +1 -1
  7. package/dist/LikeC4Diagram.js +4 -2
  8. package/dist/LikeC4Diagram.props.d.ts +6 -1
  9. package/dist/LikeC4ModelProvider.d.ts +3 -3
  10. package/dist/LikeC4ModelProvider.js +0 -1
  11. package/dist/StaticLikeC4Diagram.d.ts +1 -1
  12. package/dist/base/BaseXYFlow.js +3 -3
  13. package/dist/base/primitives/compound/CompoundActionButton.d.ts +3 -2
  14. package/dist/base/primitives/compound/CompoundDetailsButton.d.ts +3 -2
  15. package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +7 -3
  16. package/dist/base/primitives/compound/CompoundNodeContainer.js +3 -2
  17. package/dist/base/primitives/customEdge.d.ts +2 -35
  18. package/dist/base/primitives/customEdge.js +2 -2
  19. package/dist/base/primitives/customNode.d.ts +2 -2
  20. package/dist/base/primitives/customNode.js +9 -2
  21. package/dist/base/primitives/edge/EdgeContainer.js +0 -1
  22. package/dist/base/primitives/edge/EdgeLabel.js +0 -1
  23. package/dist/base/primitives/edge/EdgeLabelContainer.js +0 -2
  24. package/dist/base/primitives/edge/EdgePath.js +2 -2
  25. package/dist/base/primitives/element/ElementNodeContainer.d.ts +24 -22
  26. package/dist/base/primitives/element/ElementNodeContainer.js +66 -68
  27. package/dist/base/primitives/element/ElementShape.d.ts +8 -4
  28. package/dist/base/primitives/element/ElementShape.js +4 -3
  29. package/dist/base/primitives/element/ElementTitle.css.d.ts +1 -1
  30. package/dist/base/primitives/element/ElementTitle.js +0 -1
  31. package/dist/base/types.d.ts +5 -5
  32. package/dist/bundle/LikeC4View.js +6 -3
  33. package/dist/bundle/LikeC4View.props.d.ts +5 -1
  34. package/dist/bundle/ReactLikeC4.js +1 -2
  35. package/dist/bundle/ShadowRoot.js +3 -3
  36. package/dist/bundle/custom.d.ts +1 -0
  37. package/dist/bundle/index.d.ts +3 -1
  38. package/dist/bundle/index.js +9 -0
  39. package/dist/bundle/styles.css.js +5 -5
  40. package/dist/components/SearchControl.js +2 -2
  41. package/dist/context/ControlsCustomLayout.js +0 -1
  42. package/dist/context/DiagramEventHandlers.js +5 -5
  43. package/dist/context/DiagramFeatures.d.ts +2 -4
  44. package/dist/context/DiagramFeatures.js +15 -16
  45. package/dist/context/EnsureMantine.js +9 -4
  46. package/dist/context/FramerMotionConfig.js +0 -1
  47. package/dist/context/IconRenderer.js +7 -7
  48. package/dist/context/ReduceGraphics.js +6 -6
  49. package/dist/context/RootContainer.js +5 -5
  50. package/dist/context/index.d.ts +1 -1
  51. package/dist/custom/components.d.ts +5 -0
  52. package/dist/custom/customNodes.d.ts +218 -0
  53. package/dist/custom/hooks.d.ts +10 -0
  54. package/dist/custom/index.d.ts +4 -0
  55. package/dist/hooks/safeContext.js +3 -3
  56. package/dist/hooks/useCurrentViewId.d.ts +5 -1
  57. package/dist/hooks/useCurrentViewId.js +1 -2
  58. package/dist/hooks/useDiagram.d.ts +14 -12544
  59. package/dist/hooks/useDiagram.js +3 -5
  60. package/dist/hooks/useMantinePortalProps.js +2 -2
  61. package/dist/hooks/useSetState.js +3 -3
  62. package/dist/hooks/useUpdateEffect.js +0 -1
  63. package/dist/hooks/useXYFlow.d.ts +64 -64
  64. package/dist/hooks/useXYFlow.js +2 -2
  65. package/dist/index.d.ts +2 -4
  66. package/dist/index.js +8 -3
  67. package/dist/likec4diagram/DiagramUI.js +2 -2
  68. package/dist/likec4diagram/DiagramXYFlow.d.ts +1 -1
  69. package/dist/likec4diagram/DiagramXYFlow.js +25 -7
  70. package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
  71. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +9 -13
  72. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +8 -8
  73. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +14 -12
  74. package/dist/likec4diagram/custom/index.d.ts +15 -19
  75. package/dist/likec4diagram/custom/index.js +3 -3
  76. package/dist/likec4diagram/custom/nodes/CompoundActions.js +2 -2
  77. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +27 -4
  78. package/dist/likec4diagram/custom/nodes/ElementActions.js +67 -53
  79. package/dist/likec4diagram/custom/nodes/index.d.ts +8 -0
  80. package/dist/likec4diagram/custom/nodes/nodes.d.ts +10 -0
  81. package/dist/likec4diagram/custom/nodes/{nodeTypes.js → nodes.js} +39 -39
  82. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
  83. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +6 -7
  84. package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.js +3 -3
  85. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.d.ts +3 -2
  86. package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +2 -2
  87. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +2 -2
  88. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
  89. package/dist/likec4diagram/types.d.ts +15 -7
  90. package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
  91. package/dist/likec4diagram/ui/controls/Controls.js +2 -2
  92. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +2 -2
  93. package/dist/likec4diagram/ui/notation/NotationPanel.js +6 -8
  94. package/dist/likec4diagram/ui/search/ElementsColumn.js +6 -7
  95. package/dist/likec4diagram/ui/search/LikeC4Search.js +3 -3
  96. package/dist/likec4diagram/ui/search/SearchInput.js +0 -1
  97. package/dist/likec4diagram/ui/search/_shared.css.d.ts +1 -1
  98. package/dist/likec4diagram/ui/search/state.js +3 -4
  99. package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +4 -4
  100. package/dist/likec4diagram/useLayoutConstraints.js +3 -4
  101. package/dist/likec4diagram/useViewToNodesEdges.js +2 -0
  102. package/dist/likec4model/LikeC4ModelContext.d.ts +2 -2
  103. package/dist/likec4model/LikeC4ModelContext.js +2 -2
  104. package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -1
  105. package/dist/likec4model/useLikeC4ElementsTree.js +3 -3
  106. package/dist/likec4model/useLikeC4Model.d.ts +1 -1
  107. package/dist/likec4model/useLikeC4Model.js +2 -2
  108. package/dist/overlays/Overlays.d.ts +2 -3
  109. package/dist/overlays/Overlays.js +5 -6
  110. package/dist/overlays/element-details/ElementDetailsCard.css.js +13 -9
  111. package/dist/overlays/element-details/ElementDetailsCard.js +98 -105
  112. package/dist/overlays/element-details/TabPanelDeployments.js +4 -4
  113. package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
  114. package/dist/overlays/element-details/TabPanelStructure.js +3 -3
  115. package/dist/overlays/element-details/actor.d.ts +6905 -19690
  116. package/dist/overlays/element-details/actor.js +0 -2
  117. package/dist/overlays/element-details/actorContext.js +3 -3
  118. package/dist/overlays/overlay/Overlay.d.ts +11 -1
  119. package/dist/overlays/overlay/Overlay.js +8 -8
  120. package/dist/overlays/overlaysActor.d.ts +4 -2
  121. package/dist/overlays/overlaysActor.js +2 -1
  122. package/dist/overlays/relationship-details/RelationshipDetails.d.ts +4 -8
  123. package/dist/overlays/relationship-details/RelationshipDetails.js +12 -12
  124. package/dist/overlays/relationship-details/SelectEdge.js +2 -3
  125. package/dist/overlays/relationship-details/_types.d.ts +6 -5
  126. package/dist/overlays/relationship-details/actor.d.ts +3 -3
  127. package/dist/overlays/relationship-details/compute.js +3 -3
  128. package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +4 -8
  129. package/dist/overlays/relationship-details/custom/edgeTypes.js +2 -2
  130. package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +3 -31
  131. package/dist/overlays/relationship-details/hooks.d.ts +27 -27
  132. package/dist/overlays/relationship-details/hooks.js +4 -4
  133. package/dist/overlays/relationship-details/layout.js +2 -3
  134. package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +4 -8
  135. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +8 -8
  136. package/dist/overlays/relationships-browser/SelectElement.js +5 -5
  137. package/dist/overlays/relationships-browser/_types.d.ts +6 -5
  138. package/dist/overlays/relationships-browser/actor.d.ts +63 -428
  139. package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +4 -8
  140. package/dist/overlays/relationships-browser/custom/edgeTypes.js +2 -2
  141. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +10 -14
  142. package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -2
  143. package/dist/overlays/relationships-browser/hooks.d.ts +4 -61
  144. package/dist/overlays/relationships-browser/hooks.js +4 -4
  145. package/dist/overlays/relationships-browser/layout.js +3 -4
  146. package/dist/state/DiagramActorProvider.js +3 -3
  147. package/dist/state/diagram-machine.d.ts +186 -10369
  148. package/dist/state/diagram-machine.js +2 -1
  149. package/dist/state/hotkeyActor.d.ts +4 -2
  150. package/dist/state/syncManualLayoutActor.d.ts +14 -3
  151. package/dist/state/syncManualLayoutActor.js +2 -1
  152. package/dist/state/types.d.ts +5 -4
  153. package/dist/state/utils.d.ts +1 -1
  154. package/dist/styles-font.css +1 -0
  155. package/dist/styles-min.css +1 -0
  156. package/dist/styles-xyflow.css +1 -0
  157. package/dist/styles.css +1 -0
  158. package/dist/styles.css2.js +3 -0
  159. package/package.json +46 -21
  160. package/panda.buildinfo.json +979 -0
  161. package/src/LikeC4Diagram.props.ts +7 -1
  162. package/src/LikeC4Diagram.tsx +2 -0
  163. package/src/LikeC4ModelProvider.tsx +3 -3
  164. package/src/StaticLikeC4Diagram.tsx +1 -0
  165. package/src/base/Background.tsx +0 -4
  166. package/src/base/primitives/compound/CompoundActionButton.tsx +7 -4
  167. package/src/base/primitives/compound/CompoundDetailsButton.tsx +7 -4
  168. package/src/base/primitives/compound/CompoundNodeContainer.tsx +8 -7
  169. package/src/base/primitives/customEdge.ts +1 -1
  170. package/src/base/primitives/{customNode.ts → customNode.tsx} +11 -3
  171. package/src/base/primitives/element/ElementNodeContainer.tsx +87 -80
  172. package/src/base/primitives/element/ElementShape.tsx +11 -10
  173. package/src/base/types.ts +28 -33
  174. package/src/bundle/LikeC4View.props.ts +6 -1
  175. package/src/bundle/LikeC4View.tsx +3 -0
  176. package/src/bundle/ReactLikeC4.tsx +1 -1
  177. package/src/bundle/custom.ts +1 -0
  178. package/src/bundle/index.ts +20 -1
  179. package/src/bundle/styles.css.ts +1 -1
  180. package/src/components/SearchControl.tsx +1 -1
  181. package/src/context/DiagramFeatures.tsx +12 -8
  182. package/src/context/EnsureMantine.tsx +13 -3
  183. package/src/context/IconRenderer.tsx +1 -1
  184. package/src/context/ReduceGraphics.tsx +6 -6
  185. package/src/context/index.ts +0 -1
  186. package/src/custom/components.ts +47 -0
  187. package/src/custom/customNodes.tsx +244 -0
  188. package/src/custom/hooks.ts +35 -0
  189. package/src/custom/index.ts +5 -0
  190. package/src/hooks/useCurrentViewId.ts +9 -1
  191. package/src/hooks/useDiagram.ts +30 -9
  192. package/src/index.ts +4 -8
  193. package/src/likec4diagram/DiagramXYFlow.tsx +28 -5
  194. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +1 -1
  195. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +9 -7
  196. package/src/likec4diagram/custom/{index.tsx → index.ts} +2 -2
  197. package/src/likec4diagram/custom/nodes/CompoundActions.tsx +2 -2
  198. package/src/likec4diagram/custom/nodes/ElementActions.tsx +100 -57
  199. package/src/likec4diagram/custom/nodes/index.ts +17 -0
  200. package/src/likec4diagram/custom/nodes/{nodeTypes.tsx → nodes.tsx} +52 -36
  201. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -4
  202. package/src/likec4diagram/custom/nodes/toolbar/ElementToolbar.tsx +3 -3
  203. package/src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx +5 -4
  204. package/src/likec4diagram/types.ts +19 -9
  205. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
  206. package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -2
  207. package/src/likec4diagram/ui/search/ElementsColumn.tsx +2 -4
  208. package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
  209. package/src/likec4diagram/useViewToNodesEdges.ts +2 -0
  210. package/src/likec4model/LikeC4ModelContext.ts +2 -2
  211. package/src/likec4model/useLikeC4ElementsTree.ts +3 -1
  212. package/src/likec4model/useLikeC4Model.ts +1 -1
  213. package/src/overlays/Overlays.tsx +2 -3
  214. package/src/overlays/element-details/ElementDetailsCard.css.ts +14 -22
  215. package/src/overlays/element-details/ElementDetailsCard.tsx +18 -16
  216. package/src/overlays/overlay/Overlay.tsx +3 -4
  217. package/src/overlays/overlaysActor.ts +4 -3
  218. package/src/overlays/relationship-details/RelationshipDetails.tsx +1 -1
  219. package/src/overlays/relationship-details/SelectEdge.tsx +0 -2
  220. package/src/overlays/relationship-details/_types.ts +16 -13
  221. package/src/overlays/relationship-details/custom/edgeTypes.tsx +2 -2
  222. package/src/overlays/relationships-browser/_types.ts +18 -15
  223. package/src/overlays/relationships-browser/actor.ts +2 -2
  224. package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -2
  225. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -2
  226. package/src/state/DiagramActorProvider.tsx +2 -2
  227. package/src/state/diagram-machine.ts +13 -8
  228. package/src/state/hotkeyActor.ts +4 -2
  229. package/src/state/syncManualLayoutActor.ts +9 -3
  230. package/src/state/types.ts +9 -3
  231. package/src/state/utils.ts +3 -3
  232. package/src/styles-min.css +2 -0
  233. package/src/styles-xyflow.css +1 -0
  234. package/dist/_virtual/_commonjsHelpers.js +0 -5
  235. package/dist/_virtual/default-map.js +0 -7
  236. package/dist/_virtual/index.js +0 -5
  237. package/dist/_virtual/index2.js +0 -3
  238. package/dist/_virtual/react.production.js +0 -3
  239. package/dist/_virtual/set.js +0 -5
  240. package/dist/_virtual/set2.js +0 -3
  241. package/dist/base/xyflowMachine.d.ts +0 -212
  242. package/dist/likec4diagram/custom/nodes/nodeTypes.d.ts +0 -8
  243. package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/default-map.js +0 -172
  244. package/dist/node_modules/.pnpm/mnemonist@0.40.3_patch_hash_5c12abb43fcff6fd81e53021b89075d53249640d165a2556cc1e58d71201a13a/node_modules/mnemonist/set.js +0 -369
  245. package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js +0 -556
  246. package/dist/node_modules/.pnpm/react@19.1.0/node_modules/react/index.js +0 -15
  247. package/dist/packages/core/src/compute-view/relationships-view/compute.js +0 -123
  248. package/dist/packages/core/src/compute-view/relationships-view/utils.js +0 -68
  249. package/dist/packages/core/src/errors/index.js +0 -15
  250. package/dist/packages/core/src/model/connection/model/ConnectionModel.js +0 -121
  251. package/dist/packages/core/src/model/connection/model/find.js +0 -39
  252. package/dist/packages/core/src/model/connection/ops.js +0 -7
  253. package/dist/packages/core/src/utils/const.js +0 -3
  254. package/dist/packages/core/src/utils/fqn.js +0 -51
  255. package/dist/packages/core/src/utils/guards.js +0 -7
  256. package/dist/packages/core/src/utils/iterable/filter.js +0 -21
  257. package/dist/packages/core/src/utils/iterable/find.js +0 -21
  258. package/dist/packages/core/src/utils/iterable/map.js +0 -18
  259. package/dist/packages/core/src/utils/iterable/some.js +0 -21
  260. package/dist/packages/core/src/utils/iterable/to.js +0 -14
  261. package/dist/packages/core/src/utils/set.js +0 -48
  262. package/dist/packages/core/src/utils/string-hash.js +0 -13
  263. package/dist/styles.css.js +0 -3
  264. package/src/base/xyflowMachine.ts +0 -75
  265. /package/dist/{bundle/font.css.js → styles-font.css2.js} +0 -0
  266. /package/src/{bundle/font.css → styles-font.css} +0 -0
@@ -111,6 +111,7 @@ function viewToNodesEdge(opts: {
111
111
  } satisfies Omit<Types.Node, 'data' | 'type'>
112
112
 
113
113
  const compoundData = {
114
+ viewId: view.id,
114
115
  id: node.id,
115
116
  title: node.title,
116
117
  color: node.color,
@@ -122,6 +123,7 @@ function viewToNodesEdge(opts: {
122
123
  } satisfies Types.CompoundNodeData
123
124
 
124
125
  const leafNodeData = {
126
+ viewId: view.id,
125
127
  id: node.id,
126
128
  title: node.title,
127
129
  technology: node.technology,
@@ -1,4 +1,4 @@
1
- import type { LikeC4Model } from '@likec4/core'
1
+ import type { AnyAux, LikeC4Model } from '@likec4/core/model'
2
2
  import { createContext } from 'react'
3
3
 
4
- export const LikeC4ModelContext = createContext<LikeC4Model | null>(null)
4
+ export const LikeC4ModelContext = createContext<LikeC4Model<AnyAux> | null>(null)
@@ -1,4 +1,6 @@
1
- import { type Fqn, type LikeC4Model, type ViewId, compareNatural } from '@likec4/core'
1
+ import { type LikeC4Model } from '@likec4/core/model'
2
+ import { type Fqn, type ViewId } from '@likec4/core/types'
3
+ import { compareNatural } from '@likec4/core/utils'
2
4
  import { useMemo } from 'react'
3
5
  import { useLikeC4Model } from './useLikeC4Model'
4
6
 
@@ -1,4 +1,4 @@
1
- import type { LikeC4Model } from '@likec4/core'
1
+ import type { LikeC4Model } from '@likec4/core/model'
2
2
  import { useContext } from 'react'
3
3
  import { isDefined, isNonNullish, isString } from 'remeda'
4
4
  import { LikeC4ModelContext } from './LikeC4ModelContext'
@@ -77,7 +77,7 @@ const compareSelectOverlays = <T extends ReturnType<typeof selectOverlays>>(a: T
77
77
  })
78
78
  }
79
79
 
80
- export const Overlays = memo(({ overlaysActorRef }: { overlaysActorRef: OverlaysActorRef }) => {
80
+ export function Overlays({ overlaysActorRef }: { overlaysActorRef: OverlaysActorRef }) {
81
81
  const xyflowDomNode = useXYStore(s => s.domNode)
82
82
  const xyflowRendererDom = useMemo(() => xyflowDomNode?.querySelector('.react-flow__renderer') ?? null, [
83
83
  xyflowDomNode,
@@ -145,5 +145,4 @@ export const Overlays = memo(({ overlaysActorRef }: { overlaysActorRef: Overlays
145
145
  </ErrorBoundary>
146
146
  </DiagramFeatures.Overlays>
147
147
  )
148
- })
149
- Overlays.displayName = 'Overlays'
148
+ }
@@ -27,17 +27,20 @@ export const card = css({
27
27
  pointerEvents: 'all',
28
28
  gap: 'lg',
29
29
  justifyContent: 'stretch',
30
- backgroundColor: 'mantine.colors.body',
31
- backgroundImage:
32
- `linear-gradient(180deg, {colors.likec4.palette.fill}, {colors.likec4.palette.fill} 4px, transparent 4px)`,
33
- borderTopColor: 'likec4.palette.fill',
34
- _dark: {
35
- backgroundColor: `mantine.colors.dark[6]`,
36
- backgroundImage: `
37
- linear-gradient(180deg, color-mix(in srgb, {colors.likec4.palette.fill} 15%, transparent), transparent 80px),
38
- linear-gradient(180deg, {colors.likec4.palette.fill}, {colors.likec4.palette.fill} 4px, transparent 4px)
39
- `,
40
- },
30
+ backgroundColor: {
31
+ base: 'mantine.colors.body',
32
+ _dark: 'mantine.colors.dark[6]',
33
+ },
34
+ border: `none`,
35
+ backgroundImage: `
36
+ linear-gradient(180deg,
37
+ color-mix(in srgb, {colors.likec4.palette.fill} 60%, transparent),
38
+ color-mix(in srgb, {colors.likec4.palette.fill} 20%, transparent) 8px,
39
+ color-mix(in srgb, {colors.likec4.palette.fill} 14%, transparent) 20px,
40
+ transparent 80px
41
+ ),
42
+ linear-gradient(180deg, {colors.likec4.palette.fill}, {colors.likec4.palette.fill} 4px, transparent 4px)
43
+ `,
41
44
  '& .react-flow__attribution': {
42
45
  display: 'none',
43
46
  },
@@ -145,17 +148,6 @@ export const viewButtonTitle = css({
145
148
  fontWeight: 500,
146
149
  lineHeight: '1.4',
147
150
  })
148
- // globalStyle(`${viewButton} .tabler-icon`, {
149
- // width: '85%',
150
- // })
151
- // globalStyle(`${viewButton} .tabler-icon`, {
152
- // width: '85%',
153
- // opacity: 0.75
154
- // })
155
-
156
- // globalStyle(`${whereLight} ${viewButton} .mantine-Button-label`, {
157
- // color: mantine.colors.dark[3]
158
- // })
159
151
 
160
152
  export const tabsRoot = css({
161
153
  flex: 1,
@@ -215,16 +215,19 @@ export function ElementDetailsCard({
215
215
  }
216
216
  }, 20)
217
217
 
218
+ /**
219
+ * This delay improves "enter" animations,
220
+ * if current tab is "Relationships"
221
+ */
218
222
  useTimeoutEffect(() => {
219
223
  setOpened(true)
220
- }, 150)
224
+ }, 200)
221
225
 
222
226
  return (
223
227
  <m.dialog
224
228
  ref={ref}
225
229
  className={cx(styles.dialog, RemoveScroll.classNames.fullWidth)}
226
230
  layout
227
- layoutRoot
228
231
  initial={{
229
232
  [styles.backdropBlur]: '0px',
230
233
  [styles.backdropOpacity]: '5%',
@@ -255,14 +258,15 @@ export function ElementDetailsCard({
255
258
  >
256
259
  <RemoveScroll forwardProps removeScrollBar={false}>
257
260
  <Card
261
+ shadow="md"
262
+ component={m.div}
263
+ layout
264
+ layoutRoot
258
265
  drag
266
+ dragControls={controls}
259
267
  dragElastic={0}
260
268
  dragMomentum={false}
261
269
  dragListener={false}
262
- dragControls={controls}
263
- withBorder
264
- shadow="md"
265
- component={m.div}
266
270
  className={cx(
267
271
  css({
268
272
  likec4Palette: nodeModel?.color ?? elementModel.color,
@@ -296,13 +300,11 @@ export function ElementDetailsCard({
296
300
  width: width as any,
297
301
  height: height as any,
298
302
  }}>
299
- <Box
300
- className={styles.cardHeader}
301
- onPointerDown={e => controls.start(e)}>
303
+ <div className={styles.cardHeader} onPointerDown={e => controls.start(e)}>
302
304
  <Group align="start" justify="space-between" gap={'sm'} mb={'sm'} wrap="nowrap">
303
305
  <Group align="start" gap={'sm'} style={{ cursor: 'default' }} wrap="nowrap">
304
306
  {elementIcon}
305
- <Box>
307
+ <div>
306
308
  <Text
307
309
  component={'div'}
308
310
  className={styles.title}>
@@ -313,7 +315,7 @@ export function ElementDetailsCard({
313
315
  {notation}
314
316
  </Text>
315
317
  )}
316
- </Box>
318
+ </div>
317
319
  </Group>
318
320
  <CloseButton
319
321
  size={'lg'}
@@ -323,11 +325,11 @@ export function ElementDetailsCard({
323
325
  }} />
324
326
  </Group>
325
327
  <Group align="baseline" gap={'sm'} wrap="nowrap">
326
- <Box>
328
+ <div>
327
329
  <SmallLabel>kind</SmallLabel>
328
330
  <Badge radius={'sm'} size="sm" fw={600} color="gray">{elementModel.kind}</Badge>
329
- </Box>
330
- <Box flex={1}>
331
+ </div>
332
+ <div style={{ flex: 1 }}>
331
333
  <SmallLabel>tags</SmallLabel>
332
334
  <Flex gap={4} flex={1} mt={6}>
333
335
  {elementModel.tags.map((tag) => (
@@ -335,7 +337,7 @@ export function ElementDetailsCard({
335
337
  ))}
336
338
  {elementModel.tags.length === 0 && <Badge radius={'sm'} size="sm" fw={600} color="gray">—</Badge>}
337
339
  </Flex>
338
- </Box>
340
+ </div>
339
341
  <ActionIconGroup
340
342
  style={{
341
343
  alignSelf: 'flex-end',
@@ -384,7 +386,7 @@ export function ElementDetailsCard({
384
386
  )}
385
387
  </ActionIconGroup>
386
388
  </Group>
387
- </Box>
389
+ </div>
388
390
  <Tabs
389
391
  value={activeTab}
390
392
  onChange={v => setActiveTab(v as any)}
@@ -1,6 +1,5 @@
1
1
  import { cx } from '@likec4/styles/css'
2
2
  import {
3
- Box,
4
3
  RemoveScroll,
5
4
  } from '@mantine/core'
6
5
  import { useMergedRef } from '@mantine/hooks'
@@ -10,7 +9,7 @@ import { type PropsWithChildren, forwardRef, useEffect, useRef, useState } from
10
9
  import { stopPropagation } from '../../utils'
11
10
  import { backdropBlur, backdropOpacity, level as cssVarLevel, overlay as overlayCVA } from './Overlay.css'
12
11
 
13
- type OverlayProps = PropsWithChildren<{
12
+ export type OverlayProps = PropsWithChildren<{
14
13
  overlayLevel?: number
15
14
  className?: string
16
15
  classes?: {
@@ -128,9 +127,9 @@ export const Overlay = forwardRef<HTMLDialogElement, OverlayProps>(({
128
127
  {...rest}
129
128
  >
130
129
  <RemoveScroll forwardProps removeScrollBar={false}>
131
- <Box className={cx(styles.body, 'overlay-body', classes?.body)}>
130
+ <div className={cx(styles.body, 'overlay-body', classes?.body)}>
132
131
  {opened && <>{children}</>}
133
- </Box>
132
+ </div>
134
133
  </RemoveScroll>
135
134
  </m.dialog>
136
135
  )
@@ -7,7 +7,6 @@ import {
7
7
  type ActorRefFrom,
8
8
  type SnapshotFrom,
9
9
  assertEvent,
10
- assign,
11
10
  enqueueActions,
12
11
  fromCallback,
13
12
  setup,
@@ -59,7 +58,7 @@ const hotkeyLogic = fromCallback(({ sendBack }: {
59
58
  }
60
59
  })
61
60
 
62
- export const overlaysActorLogic = setup({
61
+ const _overlaysActorLogic = setup({
63
62
  types: {
64
63
  context: {} as OverlaysContext,
65
64
  events: {} as OverlayActorEvent,
@@ -278,6 +277,8 @@ export const overlaysActorLogic = setup({
278
277
  ],
279
278
  })
280
279
 
281
- export interface OverlaysActorLogic extends ActorLogicFrom<typeof overlaysActorLogic> {}
280
+ export interface OverlaysActorLogic extends ActorLogicFrom<typeof _overlaysActorLogic> {}
281
+ export const overlaysActorLogic: OverlaysActorLogic = _overlaysActorLogic
282
+
282
283
  export type OverlaysActorSnapshot = SnapshotFrom<OverlaysActorLogic>
283
284
  export interface OverlaysActorRef extends ActorRefFrom<OverlaysActorLogic> {}
@@ -1,10 +1,10 @@
1
1
  import { type DiagramEdge, type DiagramView, invariant, isAncestor, nonNullable } from '@likec4/core'
2
+ import { cx as clsx } from '@likec4/styles/css'
2
3
  import { ActionIcon, Group } from '@mantine/core'
3
4
  import { useCallbackRef, useStateHistory } from '@mantine/hooks'
4
5
  import { IconChevronLeft, IconChevronRight, IconX } from '@tabler/icons-react'
5
6
  import { useSelector } from '@xstate/react'
6
7
  import { Panel, ReactFlowProvider, useReactFlow, useStoreApi } from '@xyflow/react'
7
- import clsx from 'clsx'
8
8
  import { deepEqual } from 'fast-equals'
9
9
  import { AnimatePresence, LayoutGroup, m } from 'motion/react'
10
10
  import { memo, useEffect, useMemo, useRef } from 'react'
@@ -8,11 +8,9 @@ import {
8
8
  ScrollAreaAutosize,
9
9
  Text,
10
10
  ThemeIcon,
11
- useComputedColorScheme,
12
11
  } from '@mantine/core'
13
12
  import { IconArrowRight, IconSelector } from '@tabler/icons-react'
14
13
  import { useRef } from 'react'
15
- import { useMantinePortalProps } from '../../hooks'
16
14
  import { useRelationshipDetails } from './hooks'
17
15
  import * as css from './SelectEdge.css'
18
16
 
@@ -1,4 +1,5 @@
1
1
  import type { Color, DiagramNode, Fqn, IconUrl, RelationId, RelationshipLineType, ViewId } from '@likec4/core'
2
+ import type { Simplify } from 'type-fest'
2
3
  import type { Base, NonOptional, ReactFlowEdge, ReactFlowNode } from '../../base/types'
3
4
 
4
5
  export namespace RelationshipDetailsTypes {
@@ -11,7 +12,8 @@ export namespace RelationshipDetailsTypes {
11
12
  out: string[]
12
13
  }
13
14
 
14
- export type ElementNodeData = Base.NodeData<
15
+ export type ElementNodeData =
16
+ & Base.NodeData
15
17
  & NonOptional<
16
18
  Pick<
17
19
  DiagramNode,
@@ -32,9 +34,9 @@ export namespace RelationshipDetailsTypes {
32
34
  icon: IconUrl
33
35
  ports: Ports
34
36
  }
35
- >
36
37
 
37
- export type CompoundNodeData = Base.NodeData<
38
+ export type CompoundNodeData =
39
+ & Base.NodeData
38
40
  & NonOptional<
39
41
  Pick<
40
42
  DiagramNode,
@@ -50,7 +52,6 @@ export namespace RelationshipDetailsTypes {
50
52
  icon?: IconUrl
51
53
  ports: Ports
52
54
  }
53
- >
54
55
 
55
56
  export type ElementNode = ReactFlowNode<ElementNodeData, 'element'>
56
57
 
@@ -61,15 +62,17 @@ export namespace RelationshipDetailsTypes {
61
62
 
62
63
  // Extend the edge types provided by SharedFlowTypes with RelationshipsOfEdgeData
63
64
 
64
- export type EdgeData = Base.EdgeData<{
65
- relationId: RelationId
66
- color: Color | undefined
67
- label: string | null
68
- technology?: string | undefined
69
- description?: string | undefined
70
- navigateTo: ViewId | null
71
- line: RelationshipLineType
72
- }>
65
+ export type EdgeData = Simplify<
66
+ Base.EdgeData & {
67
+ relationId: RelationId
68
+ color: Color | undefined
69
+ label: string | null
70
+ technology?: string | undefined
71
+ description?: string | undefined
72
+ navigateTo: ViewId | null
73
+ line: RelationshipLineType
74
+ }
75
+ >
73
76
 
74
77
  export type Edge = ReactFlowEdge<EdgeData, 'relationship'>
75
78
  }
@@ -7,12 +7,12 @@ import {
7
7
  EdgeLabelContainer,
8
8
  EdgePath,
9
9
  } from '../../../base/primitives'
10
- import { useEnabledFeature } from '../../../context'
10
+ import { useEnabledFeatures } from '../../../context'
11
11
  import { useDiagram } from '../../../hooks/useDiagram'
12
12
  import type { RelationshipDetailsTypes } from '../_types'
13
13
 
14
14
  export const RelationshipEdge = customEdge<RelationshipDetailsTypes.EdgeData>((props) => {
15
- const { enableNavigateTo } = useEnabledFeature('NavigateTo')
15
+ const { enableNavigateTo } = useEnabledFeatures()
16
16
  const {
17
17
  sourceX,
18
18
  targetY,
@@ -8,6 +8,7 @@ import type {
8
8
  RelationshipLineType,
9
9
  ViewId,
10
10
  } from '@likec4/core'
11
+ import type { Simplify } from 'type-fest'
11
12
  import type { Base, NonOptional, ReactFlowEdge, ReactFlowNode } from '../../base/types'
12
13
 
13
14
  export namespace RelationshipsBrowserTypes {
@@ -21,7 +22,8 @@ export namespace RelationshipsBrowserTypes {
21
22
  out: string[]
22
23
  }
23
24
 
24
- export type ElementNodeData = Base.NodeData<
25
+ export type ElementNodeData = Simplify<
26
+ & Base.NodeData
25
27
  & NonOptional<
26
28
  Pick<
27
29
  DiagramNode,
@@ -45,7 +47,8 @@ export namespace RelationshipsBrowserTypes {
45
47
  }
46
48
  >
47
49
 
48
- export type CompoundNodeData = Base.NodeData<
50
+ export type CompoundNodeData = Simplify<
51
+ & Base.NodeData
49
52
  & NonOptional<
50
53
  Pick<
51
54
  DiagramNode,
@@ -71,9 +74,7 @@ export namespace RelationshipsBrowserTypes {
71
74
 
72
75
  // export type NonEmptyNode = ElementNode | CompoundNode
73
76
 
74
- export type EmptyNodeData = Base.NodeData<{
75
- column: Column
76
- }>
77
+ export type EmptyNodeData = Base.NodeData & { column: Column }
77
78
 
78
79
  export type EmptyNode = ReactFlowNode<EmptyNodeData, 'empty'>
79
80
 
@@ -82,16 +83,18 @@ export namespace RelationshipsBrowserTypes {
82
83
 
83
84
  // Extend the edge types provided by SharedFlowTypes with RelationshipsOfEdgeData
84
85
 
85
- export type EdgeData = Base.EdgeData<{
86
- sourceFqn: Fqn
87
- targetFqn: Fqn
88
- relations: NonEmptyArray<RelationId>
89
- color: Color | undefined
90
- label: string | null
91
- navigateTo: ViewId | null
92
- line: RelationshipLineType
93
- existsInCurrentView: boolean
94
- }>
86
+ export type EdgeData = Simplify<
87
+ Base.EdgeData & {
88
+ sourceFqn: Fqn
89
+ targetFqn: Fqn
90
+ relations: NonEmptyArray<RelationId>
91
+ color: Color | undefined
92
+ label: string | null
93
+ navigateTo: ViewId | null
94
+ line: RelationshipLineType
95
+ existsInCurrentView: boolean
96
+ }
97
+ >
95
98
 
96
99
  export type Edge = ReactFlowEdge<EdgeData, 'relationship'>
97
100
  }
@@ -186,7 +186,7 @@ export type Input = {
186
186
  // parentRef?: AnyActorRef| null
187
187
  }
188
188
 
189
- export type Context = Readonly<{
189
+ export interface Context {
190
190
  subject: Fqn
191
191
  viewId: ViewId | null
192
192
  scope: 'global' | 'view'
@@ -200,7 +200,7 @@ export type Context = Readonly<{
200
200
  navigateFromNode: string | null
201
201
  xynodes: RelationshipsBrowserTypes.Node[]
202
202
  xyedges: RelationshipsBrowserTypes.Edge[]
203
- }>
203
+ }
204
204
 
205
205
  export type Events =
206
206
  | { type: 'xyflow.init'; instance: XYFLowInstance; store: XYStoreApi }
@@ -9,14 +9,14 @@ import {
9
9
  EdgeLabelContainer,
10
10
  EdgePath,
11
11
  } from '../../../base/primitives'
12
- import { useEnabledFeature } from '../../../context'
12
+ import { useEnabledFeatures } from '../../../context'
13
13
  import { useDiagram } from '../../../hooks/useDiagram'
14
14
  import type { RelationshipsBrowserTypes } from '../_types'
15
15
  import { useRelationshipsBrowser } from '../hooks'
16
16
 
17
17
  export const RelationshipEdge = customEdge<RelationshipsBrowserTypes.EdgeData>((props) => {
18
18
  const browser = useRelationshipsBrowser()
19
- const { enableNavigateTo } = useEnabledFeature('NavigateTo')
19
+ const { enableNavigateTo } = useEnabledFeatures()
20
20
  const {
21
21
  id,
22
22
  data: {
@@ -1,6 +1,5 @@
1
1
  import { Handle } from '@xyflow/react'
2
2
  import { Position } from '@xyflow/system'
3
- import * as m from 'motion/react-m'
4
3
  import type { NodeProps } from '../../../base'
5
4
  import {
6
5
  CompoundNodeContainer,
@@ -34,7 +33,7 @@ const ElementDetailsButtonWithHandler = (
34
33
 
35
34
  export const ElementNode = customNode<RelationshipsBrowserTypes.ElementNodeData>((props) => {
36
35
  return (
37
- <ElementNodeContainer key={props.id} component={m.div} layoutId={props.id} nodeProps={props}>
36
+ <ElementNodeContainer key={props.id} layoutId={props.id} nodeProps={props}>
38
37
  <ElementShape {...props} />
39
38
  <ElementTitle {...props} />
40
39
  <ElementDetailsButtonWithHandler {...props} />
@@ -34,10 +34,10 @@ export function DiagramActorProvider({
34
34
  diagramMachine.provide({
35
35
  actions: {
36
36
  'trigger:NavigateTo': ((_, { viewId }) => {
37
- // this delay allows tap animations to finish
37
+ // Slightly defer callback for better responsiveness
38
38
  setTimeout(() => {
39
39
  handlersRef.current.onNavigateTo?.(viewId as ViewId)
40
- }, 30)
40
+ }, 50)
41
41
  }),
42
42
 
43
43
  'trigger:OnChange': ((_, params) => {
@@ -26,6 +26,7 @@ import {
26
26
  } from '@xyflow/react'
27
27
  import { type EdgeChange, type NodeChange, type Rect, type Viewport, nodeToRect } from '@xyflow/system'
28
28
  import { clamp, first, hasAtLeast, prop } from 'remeda'
29
+ import type { PartialDeep } from 'type-fest'
29
30
  import {
30
31
  type ActorLogicFrom,
31
32
  type ActorRef,
@@ -69,7 +70,7 @@ import { DiagramToggledFeaturesPersistence } from './persistence'
69
70
  import { type Events as SyncLayoutEvents, syncManualLayoutActorLogic } from './syncManualLayoutActor'
70
71
  import { findDiagramNode, focusedBounds, typedSystem } from './utils'
71
72
 
72
- type XYStoreApi = ReturnType<typeof useStoreApi<Types.Node, Types.Edge>>
73
+ export type XYStoreApi = ReturnType<typeof useStoreApi<Types.Node, Types.Edge>>
73
74
 
74
75
  export interface NavigationHistory {
75
76
  history: ReadonlyArray<{
@@ -89,7 +90,7 @@ export interface Input {
89
90
  nodesSelectable: boolean
90
91
  }
91
92
 
92
- type ToggledFeatures = Partial<EnabledFeatures>
93
+ export type ToggledFeatures = Partial<EnabledFeatures>
93
94
 
94
95
  export interface Context extends Input {
95
96
  xynodes: Types.Node[]
@@ -150,8 +151,8 @@ export type Events =
150
151
  | { type: 'xyflow.nodeMouseLeave'; node: Types.Node }
151
152
  | { type: 'xyflow.edgeMouseEnter'; edge: Types.Edge }
152
153
  | { type: 'xyflow.edgeMouseLeave'; edge: Types.Edge }
153
- | { type: 'update.nodeData'; nodeId: NodeId; data: Partial<Types.NodeData> }
154
- | { type: 'update.edgeData'; edgeId: EdgeId; data: Partial<Types.Edge['data']> }
154
+ | { type: 'update.nodeData'; nodeId: NodeId; data: PartialDeep<Types.NodeData> }
155
+ | { type: 'update.edgeData'; edgeId: EdgeId; data: PartialDeep<Types.EdgeData> }
155
156
  | { type: 'update.view'; view: DiagramView; xynodes: Types.Node[]; xyedges: Types.Edge[] }
156
157
  | { type: 'update.inputs'; inputs: Partial<Omit<Input, 'view' | 'xystore'>> }
157
158
  | { type: 'update.features'; features: EnabledFeatures }
@@ -179,7 +180,7 @@ export type Events =
179
180
  export type ActionArg = { context: Context; event: Events }
180
181
 
181
182
  // TODO: naming convention for actors
182
- export const diagramMachine = setup({
183
+ const _diagramMachine = setup({
183
184
  types: {
184
185
  context: {} as Context,
185
186
  input: {} as Input,
@@ -1120,6 +1121,10 @@ function findCorrespondingNode(context: Context, event: { view: DiagramView }) {
1120
1121
  return { fromNode, toNode }
1121
1122
  }
1122
1123
 
1123
- export type DiagramMachineLogic = ActorLogicFrom<typeof diagramMachine>
1124
- // export type MachineSnapshot = SnapshotFrom<Machine>
1125
- // export type LikeC4ViewActorRef = ActorRefFromLogic<Machine>
1124
+ /**
1125
+ * Here is a trick to reduce inference types
1126
+ */
1127
+ type InferredDiagramMachine = typeof _diagramMachine
1128
+ export interface DiagramMachine extends InferredDiagramMachine {}
1129
+ export const diagramMachine: DiagramMachine = _diagramMachine
1130
+ export interface DiagramMachineLogic extends ActorLogicFrom<DiagramMachine> {}
@@ -1,10 +1,12 @@
1
1
  import { getHotkeyHandler } from '@mantine/hooks'
2
2
  import type { KeyboardEvent } from 'react'
3
- import { type AnyEventObject, type NonReducibleUnknown, fromCallback } from 'xstate'
3
+ import { type AnyEventObject, type CallbackActorLogic, type NonReducibleUnknown, fromCallback } from 'xstate'
4
4
 
5
5
  export type HotKeyEvent = { type: 'key.esc' | `key.arrow.${'left' | 'right'}` }
6
6
 
7
- export const hotkeyActorLogic = fromCallback<AnyEventObject, NonReducibleUnknown, HotKeyEvent>(({ sendBack }: {
7
+ export interface HotkeyActorLogic extends CallbackActorLogic<AnyEventObject, NonReducibleUnknown, HotKeyEvent> {}
8
+
9
+ export const hotkeyActorLogic: HotkeyActorLogic = fromCallback(({ sendBack }: {
8
10
  sendBack: (event: HotKeyEvent) => void
9
11
  }) => {
10
12
  const escHandler = getHotkeyHandler([
@@ -12,6 +12,10 @@ import { bezierControlPoints, isSamePoint } from '../utils'
12
12
  import type { Context as DiagramContext, Events as DiagramEvents } from './diagram-machine'
13
13
 
14
14
  export type Input = {
15
+ /**
16
+ * Actually this is DiagramActorRef
17
+ * But we can't use it here due to circular type inference
18
+ */
15
19
  parent: ActorRef<
16
20
  MachineSnapshot<DiagramContext, DiagramEvents, any, any, any, any, any, any>,
17
21
  DiagramEvents,
@@ -29,8 +33,8 @@ export type Events =
29
33
  | { type: 'synced' }
30
34
  | { type: 'cancel' }
31
35
  | { type: 'stop' }
32
- // TODO: naming convention for actors
33
- export const syncManualLayoutActorLogic = setup({
36
+
37
+ const _syncManualLayoutActorLogic = setup({
34
38
  types: {
35
39
  context: {} as Context,
36
40
  input: {} as Input,
@@ -121,7 +125,9 @@ export const syncManualLayoutActorLogic = setup({
121
125
  },
122
126
  })
123
127
 
124
- export type SyncLayoutActorLogic = ActorLogicFrom<typeof syncManualLayoutActorLogic>
128
+ export interface SyncLayoutActorLogic extends ActorLogicFrom<typeof _syncManualLayoutActorLogic> {}
129
+
130
+ export const syncManualLayoutActorLogic: SyncLayoutActorLogic = _syncManualLayoutActorLogic
125
131
 
126
132
  function createViewChange(parentContext: DiagramContext): ViewChange.SaveManualLayout {
127
133
  const { view, xystore, xyflow } = parentContext
@@ -1,20 +1,26 @@
1
- import type { ActorRefFromLogic, ActorSystem, SnapshotFrom } from 'xstate'
1
+ import type { ActorRefFromLogic, ActorSystem, EventFromLogic, SnapshotFrom } from 'xstate'
2
2
  import type { OverlaysActorRef } from '../overlays/overlaysActor'
3
3
  import type { DiagramMachineLogic } from './diagram-machine'
4
4
  import type { SyncLayoutActorLogic } from './syncManualLayoutActor'
5
5
 
6
6
  export type System = ActorSystem<{
7
7
  actors: {
8
- diagram: DiagramActorRef
8
+ diagram: ActorRefFromLogic<DiagramMachineLogic>
9
9
  overlays: OverlaysActorRef
10
10
  }
11
11
  }>
12
12
 
13
- export type DiagramActorRef = Omit<ActorRefFromLogic<DiagramMachineLogic>, 'system'> & {
13
+ export interface DiagramActorRef extends ActorRefFromLogic<DiagramMachineLogic> {
14
14
  system: System
15
15
  }
16
+
17
+ // export type DiagramActorRef = Omit<ActorRefFromLogic<DiagramMachineLogic>, 'system'> & {
18
+ // system: System
19
+ // }
16
20
  export type DiagramActorSnapshot = SnapshotFrom<DiagramMachineLogic>
17
21
 
22
+ export type DiagramActorEvent = EventFromLogic<DiagramMachineLogic>
23
+
18
24
  export type { Context as DiagramContext } from './diagram-machine'
19
25
 
20
26
  export type SyncLayoutActorRef = Omit<ActorRefFromLogic<SyncLayoutActorLogic>, 'system'> & {
@@ -1,4 +1,4 @@
1
- import type { BBox, XYPoint } from '@likec4/core'
1
+ import type { BBox, DiagramEdge, DiagramNode, XYPoint } from '@likec4/core/types'
2
2
  import type { ActorSystem } from 'xstate'
3
3
  import type { OverlaysActorRef } from '../overlays/overlaysActor'
4
4
  import type { Context } from './diagram-machine'
@@ -15,11 +15,11 @@ export function typedSystem(system: ActorSystem<any>) {
15
15
  }
16
16
  }
17
17
 
18
- export function findDiagramNode(ctx: Context, xynodeId: string) {
18
+ export function findDiagramNode(ctx: Context, xynodeId: string): DiagramNode | null {
19
19
  return ctx.view.nodes.find(n => n.id === xynodeId) ?? null
20
20
  }
21
21
 
22
- export function findDiagramEdge(ctx: Context, xyedgeId: string) {
22
+ export function findDiagramEdge(ctx: Context, xyedgeId: string): DiagramEdge | null {
23
23
  return ctx.view.edges.find(e => e.id === xyedgeId) ?? null
24
24
  }
25
25