@likec4/diagram 1.39.5 → 1.41.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 (140) hide show
  1. package/bundle/{chunk-CW_KClZe.js → chunk-FGcODVxo.js} +1059 -1023
  2. package/bundle/custom.js +61 -60
  3. package/bundle/index.js +2932 -764
  4. package/dist/LikeC4Diagram.d.ts +1 -1
  5. package/dist/LikeC4Diagram.js +7 -4
  6. package/dist/LikeC4Diagram.props.d.ts +6 -1
  7. package/dist/base/const.d.ts +9 -0
  8. package/dist/base/const.js +10 -1
  9. package/dist/base/index.d.ts +1 -0
  10. package/dist/base/primitives/MarkdownBlock.js +2 -0
  11. package/dist/base/primitives/edge/EdgeLabel.js +2 -1
  12. package/dist/base/primitives/edge/EdgeLabelContainer.js +10 -4
  13. package/dist/base/primitives/edge/EdgePath.js +17 -8
  14. package/dist/base/primitives/edge/edge.css.d.ts +0 -1
  15. package/dist/base/primitives/edge/edge.css.js +6 -14
  16. package/dist/base/primitives/element/ElementActionButtons.js +1 -3
  17. package/dist/base/primitives/element/ElementNodeContainer.d.ts +0 -6
  18. package/dist/base/primitives/element/ElementNodeContainer.js +3 -26
  19. package/dist/base/primitives/element/ElementTitle.js +2 -2
  20. package/dist/base/types.d.ts +3 -3
  21. package/dist/bundle/LikeC4View.js +4 -12
  22. package/dist/bundle/LikeC4View.props.d.ts +12 -3
  23. package/dist/bundle/custom.js +1 -1
  24. package/dist/components/Link.js +28 -20
  25. package/dist/custom/customNodes.d.ts +6 -0
  26. package/dist/custom/customNodes.js +2 -1
  27. package/dist/custom/index.js +1 -1
  28. package/dist/hooks/useDiagram.d.ts +5 -1
  29. package/dist/hooks/useDiagram.js +3 -0
  30. package/dist/hooks/useXYFlow.d.ts +4 -439
  31. package/dist/likec4diagram/DiagramUI.js +1 -1
  32. package/dist/likec4diagram/DiagramXYFlow.js +8 -4
  33. package/dist/likec4diagram/convert-to-xyflow.d.ts +14 -0
  34. package/dist/likec4diagram/convert-to-xyflow.js +29 -0
  35. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +4 -4
  36. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +0 -1
  37. package/dist/likec4diagram/custom/edges/SequenceStepEdge.d.ts +3 -0
  38. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +71 -0
  39. package/dist/likec4diagram/custom/index.js +7 -2
  40. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
  41. package/dist/likec4diagram/custom/nodes/SequenceActorNode.d.ts +4 -0
  42. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +157 -0
  43. package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
  44. package/dist/likec4diagram/custom/nodes/nodes.d.ts +1 -2
  45. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +31 -27
  46. package/dist/likec4diagram/types.d.ts +41 -7
  47. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -0
  48. package/dist/likec4diagram/{useViewToNodesEdges.js → xyflow-diagram/diagram-view.js} +4 -13
  49. package/dist/likec4diagram/xyflow-sequence/_types.d.ts +41 -0
  50. package/dist/likec4diagram/xyflow-sequence/const.d.ts +17 -0
  51. package/dist/likec4diagram/xyflow-sequence/const.js +16 -0
  52. package/dist/likec4diagram/xyflow-sequence/layouter.d.ts +46 -0
  53. package/dist/likec4diagram/xyflow-sequence/layouter.js +408 -0
  54. package/dist/likec4diagram/xyflow-sequence/sequence-view.d.ts +7 -0
  55. package/dist/likec4diagram/xyflow-sequence/sequence-view.js +273 -0
  56. package/dist/likec4diagram/xyflow-sequence/utils.d.ts +14 -0
  57. package/dist/likec4diagram/xyflow-sequence/utils.js +92 -0
  58. package/dist/navigationpanel/NavigationPanelControls.js +2 -2
  59. package/dist/navigationpanel/controls/ViewDetailsCard.js +27 -12
  60. package/dist/navigationpanel/dropdown/ProjectsMenu.js +53 -44
  61. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.d.ts +1 -2
  62. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +10 -41
  63. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +292 -0
  64. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +119 -0
  65. package/dist/navigationpanel/walkthrough/index.d.ts +2 -1
  66. package/dist/overlays/element-details/ElementDetailsCard.css.js +7 -1
  67. package/dist/overlays/element-details/ElementDetailsCard.js +17 -19
  68. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -1
  69. package/dist/overlays/relationship-details/layout.d.ts +3 -2
  70. package/dist/overlays/relationship-details/layout.js +1 -2
  71. package/dist/overlays/relationships-browser/RelationshipsBrowser.js +2 -1
  72. package/dist/overlays/relationships-browser/layout.js +1 -1
  73. package/dist/search/components/ElementsColumn.js +1 -1
  74. package/dist/state/DiagramActorProvider.d.ts +3 -2
  75. package/dist/state/DiagramActorProvider.js +40 -41
  76. package/dist/state/assign.js +11 -4
  77. package/dist/state/diagram-machine.d.ts +224 -194
  78. package/dist/state/diagram-machine.js +170 -63
  79. package/dist/state/utils.d.ts +7 -1
  80. package/dist/state/utils.js +67 -7
  81. package/dist/styles-min.css +1 -1
  82. package/dist/styles.css +1 -1
  83. package/dist/styles.css2.js +1 -1
  84. package/package.json +8 -7
  85. package/panda.buildinfo.json +45 -24
  86. package/src/LikeC4Diagram.props.ts +14 -1
  87. package/src/LikeC4Diagram.tsx +7 -4
  88. package/src/base/const.ts +12 -0
  89. package/src/base/index.ts +2 -0
  90. package/src/base/primitives/MarkdownBlock.tsx +2 -0
  91. package/src/base/primitives/edge/EdgeLabel.tsx +23 -19
  92. package/src/base/primitives/edge/EdgeLabelContainer.tsx +12 -7
  93. package/src/base/primitives/edge/EdgePath.tsx +25 -14
  94. package/src/base/primitives/edge/edge.css.ts +5 -14
  95. package/src/base/primitives/element/ElementActionButtons.tsx +1 -3
  96. package/src/base/primitives/element/ElementNodeContainer.tsx +3 -30
  97. package/src/base/primitives/element/ElementTitle.tsx +2 -3
  98. package/src/base/types.ts +7 -5
  99. package/src/bundle/LikeC4View.props.ts +14 -3
  100. package/src/bundle/LikeC4View.tsx +4 -14
  101. package/src/bundle/ReactLikeC4.tsx +1 -2
  102. package/src/components/Link.tsx +21 -18
  103. package/src/custom/customNodes.ts +7 -0
  104. package/src/hooks/useDiagram.ts +10 -0
  105. package/src/likec4diagram/DiagramUI.tsx +1 -1
  106. package/src/likec4diagram/DiagramXYFlow.tsx +10 -5
  107. package/src/likec4diagram/convert-to-xyflow.ts +45 -0
  108. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +0 -1
  109. package/src/likec4diagram/custom/edges/SequenceStepEdge.tsx +65 -0
  110. package/src/likec4diagram/custom/index.ts +7 -1
  111. package/src/likec4diagram/custom/nodes/ElementActions.tsx +4 -2
  112. package/src/likec4diagram/custom/nodes/SequenceActorNode.tsx +175 -0
  113. package/src/likec4diagram/custom/nodes/index.ts +1 -0
  114. package/src/likec4diagram/custom/nodes/nodes.tsx +1 -1
  115. package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +36 -30
  116. package/src/likec4diagram/types.ts +96 -13
  117. package/src/likec4diagram/{useViewToNodesEdges.ts → xyflow-diagram/diagram-view.ts} +7 -28
  118. package/src/likec4diagram/xyflow-sequence/_types.ts +45 -0
  119. package/src/likec4diagram/xyflow-sequence/const.ts +37 -0
  120. package/src/likec4diagram/xyflow-sequence/layouter.ts +567 -0
  121. package/src/likec4diagram/xyflow-sequence/sequence-view.ts +337 -0
  122. package/src/likec4diagram/xyflow-sequence/utils.ts +112 -0
  123. package/src/navigationpanel/NavigationPanelControls.tsx +2 -2
  124. package/src/navigationpanel/controls/ViewDetailsCard.tsx +29 -12
  125. package/src/navigationpanel/dropdown/ProjectsMenu.tsx +5 -1
  126. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +5 -40
  127. package/src/navigationpanel/walkthrough/DynamicViewControls.tsx +125 -0
  128. package/src/navigationpanel/walkthrough/index.tsx +2 -1
  129. package/src/overlays/element-details/ElementDetailsCard.css.ts +7 -1
  130. package/src/overlays/element-details/ElementDetailsCard.tsx +24 -25
  131. package/src/overlays/relationship-details/RelationshipDetails.tsx +5 -2
  132. package/src/overlays/relationship-details/layout.ts +4 -3
  133. package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +2 -1
  134. package/src/overlays/relationships-browser/layout.ts +1 -1
  135. package/src/search/components/ElementsColumn.tsx +1 -1
  136. package/src/state/DiagramActorProvider.tsx +46 -51
  137. package/src/state/assign.ts +18 -5
  138. package/src/state/diagram-machine.ts +207 -75
  139. package/src/state/utils.ts +81 -7
  140. package/dist/likec4diagram/useViewToNodesEdges.d.ts +0 -12
@@ -9,6 +9,7 @@ export {
9
9
  ElementNode,
10
10
  ViewGroupNode,
11
11
  } from './nodes'
12
+ export { SequenceActorNode, SequenceParallelArea } from './SequenceActorNode'
12
13
 
13
14
  export * from './CompoundActions'
14
15
  export * from './ElementActions'
@@ -20,7 +20,7 @@ import { DeploymentElementActions, ElementActions } from './ElementActions'
20
20
  import { CompoundDeploymentToolbar, CompoundElementToolbar } from './toolbar/CompoundToolbar'
21
21
  import { DeploymentElementToolbar, ElementToolbar } from './toolbar/ElementToolbar'
22
22
 
23
- type CustomNodes = Required<CustomNodesType>
23
+ export type CustomNodes = Required<CustomNodesType>
24
24
 
25
25
  export function ElementDetailsButtonWithHandler(
26
26
  props: NodeProps<Types.ElementNodeData | Types.DeploymentElementNodeData>,
@@ -29,7 +29,7 @@ import {
29
29
  useRef,
30
30
  useState,
31
31
  } from 'react'
32
- import { clamp, filter, isTruthy, map, partition, pipe } from 'remeda'
32
+ import { clamp, filter, isEmpty, isTruthy, map, partition, pipe } from 'remeda'
33
33
  import { Link } from '../../components/Link'
34
34
  import { useDiagramEventHandlers } from '../../context/DiagramEventHandlers'
35
35
  import { useEnabledFeatures } from '../../context/DiagramFeatures'
@@ -61,6 +61,7 @@ function selectDiagramContext(c: DiagramContext) {
61
61
  }
62
62
 
63
63
  export const RelationshipPopover = memo(() => {
64
+ const likec4model = useLikeC4Model()
64
65
  const actorRef = useActorRef(RelationshipPopoverActorLogic)
65
66
  const diagram = useDiagram()
66
67
  const { viewId, selected } = useDiagramContext(selectDiagramContext)
@@ -132,13 +133,42 @@ export const RelationshipPopover = memo(() => {
132
133
  [openedEdgeId],
133
134
  )
134
135
 
135
- if (!diagramEdge || !sourceNode || !targetNode) {
136
+ if (!diagramEdge || !sourceNode || !targetNode || isEmpty(diagramEdge.relations)) {
137
+ return null
138
+ }
139
+
140
+ const [direct, nested] = pipe(
141
+ diagramEdge.relations,
142
+ map(id => {
143
+ try {
144
+ return likec4model.relationship(id)
145
+ } catch (e) {
146
+ // View was cached, but likec4model based on new data
147
+ console.error(
148
+ `View is cached and likec4model missing relationship ${id} from ${sourceNode.id} -> ${targetNode.id}`,
149
+ e,
150
+ )
151
+ return null
152
+ }
153
+ }),
154
+ filter(isTruthy),
155
+ partition(r => r.source.id === sourceNode.id && r.target.id === targetNode.id),
156
+ )
157
+
158
+ if (direct.length === 0 && nested.length === 0) {
159
+ console.warn('No relationships found diagram edge', {
160
+ diagramEdge,
161
+ sourceNode,
162
+ targetNode,
163
+ })
136
164
  return null
137
165
  }
138
166
 
139
167
  return (
140
168
  <RelationshipPopoverInternal
141
169
  viewId={viewId}
170
+ direct={direct}
171
+ nested={nested}
142
172
  diagramEdge={diagramEdge}
143
173
  sourceNode={sourceNode}
144
174
  targetNode={targetNode}
@@ -153,6 +183,8 @@ const getEdgeLabelElement = (edgeId: string, container: HTMLDivElement | undefin
153
183
 
154
184
  type RelationshipPopoverInternalProps = {
155
185
  viewId: ViewId
186
+ direct: LikeC4Model.AnyRelation[]
187
+ nested: LikeC4Model.AnyRelation[]
156
188
  diagramEdge: DiagramEdge
157
189
  sourceNode: DiagramNode
158
190
  targetNode: DiagramNode
@@ -163,6 +195,8 @@ const POPOVER_PADDING = 8
163
195
  const RelationshipPopoverInternal = ({
164
196
  viewId,
165
197
  diagramEdge,
198
+ direct,
199
+ nested,
166
200
  sourceNode,
167
201
  targetNode,
168
202
  onMouseEnter,
@@ -240,36 +274,8 @@ const RelationshipPopoverInternal = ({
240
274
  }
241
275
  }, [referenceEl])
242
276
 
243
- const likec4model = useLikeC4Model()
244
277
  const diagram = useDiagram()
245
278
 
246
- const [direct, nested] = pipe(
247
- diagramEdge.relations,
248
- map(id => {
249
- try {
250
- return likec4model.relationship(id)
251
- } catch (e) {
252
- // View was cached, but likec4model based on new data
253
- console.error(
254
- `View is cached and likec4model missing relationship ${id} from ${sourceNode.id} -> ${targetNode.id}`,
255
- e,
256
- )
257
- return null
258
- }
259
- }),
260
- filter(isTruthy),
261
- partition(r => r.source.id === sourceNode.id && r.target.id === targetNode.id),
262
- )
263
-
264
- if (direct.length === 0 && nested.length === 0) {
265
- console.error('No relationships found diagram edge', {
266
- diagramEdge,
267
- sourceNode,
268
- targetNode,
269
- })
270
- return null
271
- }
272
-
273
279
  const navigateTo = enableNavigateTo
274
280
  ? (viewId: ViewId) => {
275
281
  diagram.navigateTo(viewId)
@@ -1,4 +1,14 @@
1
- import type { DeploymentFqn, DiagramEdge, DiagramNode, Fqn, IconUrl, RichTextOrEmpty, ViewId } from '@likec4/core/types'
1
+ import type {
2
+ BBox,
3
+ DeploymentFqn,
4
+ DiagramEdge,
5
+ DiagramNode,
6
+ ExclusiveUnion,
7
+ Fqn,
8
+ IconUrl,
9
+ RichTextOrEmpty,
10
+ ViewId,
11
+ } from '@likec4/core/types'
2
12
  import type { XYPosition } from '@xyflow/system'
3
13
  import type { OptionalKeysOf, Simplify } from 'type-fest'
4
14
  import type { Base, ReactFlowEdge, ReactFlowNode } from '../base/types'
@@ -44,14 +54,16 @@ export namespace Types {
44
54
  /**
45
55
  * Represents element from logical model
46
56
  */
47
- export type ElementNodeData = LeafNodeData & {
48
- modelFqn: Fqn
49
- deploymentFqn?: never
50
- /**
51
- * If set - this node has navigation to another view and diagram has handler for this
52
- */
53
- navigateTo: ViewId | null
54
- }
57
+ export type ElementNodeData = Simplify<
58
+ LeafNodeData & {
59
+ modelFqn: Fqn
60
+ deploymentFqn?: never
61
+ /**
62
+ * If set - this node has navigation to another view and diagram has handler for this
63
+ */
64
+ navigateTo: ViewId | null
65
+ }
66
+ >
55
67
 
56
68
  /**
57
69
  * Represents element from deployment model
@@ -65,6 +77,32 @@ export namespace Types {
65
77
  modelFqn: Fqn | null
66
78
  }
67
79
 
80
+ export type SequenceActorNodePort = {
81
+ id: string
82
+ cx: number
83
+ cy: number
84
+ height: number
85
+ type: 'target' | 'source'
86
+ position: 'left' | 'right' | 'top' | 'bottom'
87
+ }
88
+ export type SequenceActorNodeData = Simplify<
89
+ & LeafNodeData
90
+ & {
91
+ navigateTo: ViewId | null
92
+ // If set - this node refers to a model element
93
+ modelFqn: Fqn | null
94
+ ports: Array<SequenceActorNodePort>
95
+ viewHeight: number
96
+ }
97
+ >
98
+
99
+ export type SequenceParallelAreaData = Simplify<
100
+ & LeafNodeData
101
+ & {
102
+ parallelPrefix: string
103
+ }
104
+ >
105
+
68
106
  export type CompoundNodeData =
69
107
  & Base.NodeData
70
108
  & NonOptional<
@@ -117,13 +155,32 @@ export namespace Types {
117
155
 
118
156
  export type ElementNode = ReactFlowNode<ElementNodeData, 'element'>
119
157
  export type DeploymentElementNode = ReactFlowNode<DeploymentElementNodeData, 'deployment'>
158
+
159
+ export type SequenceActorNode = ReactFlowNode<SequenceActorNodeData, 'seq-actor'>
160
+ export type SequenceParallelArea = ReactFlowNode<SequenceParallelAreaData, 'seq-parallel'>
161
+
120
162
  export type CompoundElementNode = ReactFlowNode<CompoundElementNodeData, 'compound-element'>
121
163
  export type CompoundDeploymentNode = ReactFlowNode<CompoundDeploymentNodeData, 'compound-deployment'>
122
164
  export type ViewGroupNode = ReactFlowNode<ViewGroupNodeData, 'view-group'>
123
165
 
124
- export type Node = ElementNode | DeploymentElementNode | CompoundElementNode | CompoundDeploymentNode | ViewGroupNode
166
+ export type Node =
167
+ | ElementNode
168
+ | DeploymentElementNode
169
+ | CompoundElementNode
170
+ | CompoundDeploymentNode
171
+ | ViewGroupNode
172
+ | SequenceActorNode
173
+ | SequenceParallelArea
125
174
 
126
- export type NodeData = Node['data']
175
+ export type NodeData = ExclusiveUnion<{
176
+ ElementNodeData: ElementNodeData
177
+ DeploymentElementNodeData: DeploymentElementNodeData
178
+ CompoundElementNodeData: CompoundElementNodeData
179
+ CompoundDeploymentNodeData: CompoundDeploymentNodeData
180
+ ViewGroupNodeData: ViewGroupNodeData
181
+ SequenceActorNodeData: SequenceActorNodeData
182
+ SequenceParallelAreaData: SequenceParallelAreaData
183
+ }>
127
184
 
128
185
  export type RelationshipEdgeData = Simplify<
129
186
  & Base.EdgeData
@@ -150,8 +207,34 @@ export namespace Types {
150
207
  }
151
208
  >
152
209
 
210
+ export type SequenceStepEdgeData = Simplify<
211
+ & Base.EdgeData
212
+ & NonOptional<
213
+ Pick<
214
+ DiagramEdge,
215
+ | 'id'
216
+ | 'label'
217
+ | 'technology'
218
+ | 'points'
219
+ | 'dir'
220
+ | 'color'
221
+ | 'line'
222
+ | 'head'
223
+ | 'tail'
224
+ | 'navigateTo'
225
+ >
226
+ >
227
+ & {
228
+ notes: RichTextOrEmpty
229
+ labelXY: XYPosition | null
230
+ labelBBox: BBox
231
+ controlPoints: XYPosition[] | undefined | null
232
+ }
233
+ >
234
+
153
235
  export type RelationshipEdge = ReactFlowEdge<RelationshipEdgeData, 'relationship'>
236
+ export type SequenceStepEdge = ReactFlowEdge<SequenceStepEdgeData, 'seq-step'>
154
237
 
155
- export type Edge = RelationshipEdge
156
- export type EdgeData = RelationshipEdgeData
238
+ export type Edge = RelationshipEdge | SequenceStepEdge
239
+ export type EdgeData = RelationshipEdgeData | SequenceStepEdgeData
157
240
  }
@@ -1,4 +1,5 @@
1
1
  import {
2
+ type BBox,
2
3
  type DiagramEdge,
3
4
  type DiagramNode,
4
5
  type DiagramView,
@@ -13,18 +14,16 @@ import {
13
14
  RichText,
14
15
  whereOperatorAsPredicate,
15
16
  } from '@likec4/core'
16
- import { useCustomCompareMemo } from '@react-hookz/web'
17
- import { deepEqual, shallowEqual } from 'fast-equals'
18
17
  import { hasAtLeast, pick } from 'remeda'
19
- import { ZIndexes } from '../base/const'
20
- import type { Types } from './types'
18
+ import { ZIndexes } from '../../base/const'
19
+ import type { Types } from '../types'
21
20
 
22
- // const nodeZIndex = (node: DiagramNode) => node.level - (node.children.length > 0 ? 1 : 0)
23
- function viewToNodesEdge(opts: {
24
- view: Pick<DiagramView, 'id' | 'nodes' | 'edges' | '_type'>
21
+ export function diagramToXY(opts: {
22
+ view: Pick<DiagramView, 'id' | 'nodes' | 'edges' | 'bounds' | '_type'>
25
23
  where: WhereOperator | null
26
24
  nodesSelectable: boolean
27
25
  }): {
26
+ bounds: BBox
28
27
  xynodes: Types.Node[]
29
28
  xyedges: Types.Edge[]
30
29
  } {
@@ -269,28 +268,8 @@ function viewToNodesEdge(opts: {
269
268
  }
270
269
 
271
270
  return {
271
+ bounds: view.bounds,
272
272
  xynodes,
273
273
  xyedges,
274
274
  }
275
275
  }
276
- type ViewToNodesEdgeInput = {
277
- view: DiagramView
278
- where: WhereOperator | null
279
- nodesSelectable: boolean
280
- }
281
- const viewToNodesEdgeEqual = (a: ViewToNodesEdgeInput, b: ViewToNodesEdgeInput) => (
282
- a.view.id === b.view.id
283
- && a.view._type === b.view._type
284
- && a.nodesSelectable === b.nodesSelectable
285
- && shallowEqual(a.view.nodes, b.view.nodes)
286
- && shallowEqual(a.view.edges, b.view.edges)
287
- && deepEqual(a.where, b.where)
288
- )
289
-
290
- export function useViewToNodesEdges(params: ViewToNodesEdgeInput) {
291
- return useCustomCompareMemo(
292
- () => viewToNodesEdge(params),
293
- [params],
294
- ([a], [b]) => !!a && !!b && viewToNodesEdgeEqual(a, b),
295
- )
296
- }
@@ -0,0 +1,45 @@
1
+ import type { DiagramEdge, DiagramNode, EdgeId } from '@likec4/core/types'
2
+
3
+ export type Step = {
4
+ id: EdgeId
5
+ from: {
6
+ column: number
7
+ row: number
8
+ }
9
+ to: {
10
+ column: number
11
+ row: number
12
+ }
13
+ source: DiagramNode
14
+ target: DiagramNode
15
+ label: null | {
16
+ height: number
17
+ width: number
18
+ text: string | null
19
+ }
20
+ isSelfLoop: boolean
21
+ isBack: boolean
22
+ parallelPrefix: string | null
23
+ offset: number // offset for continuing edges
24
+ edge: DiagramEdge
25
+ }
26
+
27
+ export type Compound = {
28
+ node: DiagramNode
29
+ from: DiagramNode
30
+ to: DiagramNode
31
+
32
+ nested: Compound[]
33
+ }
34
+
35
+ export type ParallelRect = {
36
+ parallelPrefix: string
37
+ min: {
38
+ column: number
39
+ row: number
40
+ }
41
+ max: {
42
+ column: number
43
+ row: number
44
+ }
45
+ }
@@ -0,0 +1,37 @@
1
+ import type { ThemeColor } from '@likec4/core/types'
2
+
3
+ // minimum space between actors
4
+ export const ACTOR_GAP = 60
5
+
6
+ // minimum space between columns
7
+ export const COLUMN_GAP = 32
8
+
9
+ // minimum height of a step row
10
+ export const MIN_ROW_HEIGHT = 80
11
+
12
+ // height of ports, edges connected to center of ports
13
+ export const PORT_HEIGHT = 32
14
+
15
+ // margin from step label to step box
16
+ export const STEP_LABEL_MARGIN = 50
17
+
18
+ // offset from actor box
19
+ export const FIRST_STEP_OFFSET = 30
20
+
21
+ // offset for continuing steps
22
+ // A -> B,
23
+ // C -> D (sequential)
24
+ // A -> B -> C (continuous)
25
+ export const CONTINUOUS_OFFSET = 22
26
+
27
+ export const SeqZIndex = {
28
+ compound: 0,
29
+ parallel: 1,
30
+ actor: 10,
31
+ step: 20,
32
+ }
33
+
34
+ export const SeqParallelAreaColor = {
35
+ default: 'gray',
36
+ active: 'amber',
37
+ } satisfies Record<string, ThemeColor>