@likec4/diagram 1.39.5 → 1.40.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 (123) hide show
  1. package/bundle/{chunk-CW_KClZe.js → chunk-CDr-4Ymp.js} +936 -903
  2. package/bundle/custom.js +61 -60
  3. package/bundle/index.js +2667 -539
  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/edge/EdgeLabel.js +2 -1
  11. package/dist/base/primitives/edge/EdgeLabelContainer.js +10 -4
  12. package/dist/base/primitives/edge/EdgePath.js +17 -8
  13. package/dist/base/primitives/edge/edge.css.d.ts +0 -1
  14. package/dist/base/primitives/edge/edge.css.js +6 -14
  15. package/dist/base/primitives/element/ElementActionButtons.js +1 -3
  16. package/dist/base/primitives/element/ElementNodeContainer.d.ts +0 -6
  17. package/dist/base/primitives/element/ElementNodeContainer.js +3 -26
  18. package/dist/base/primitives/element/ElementTitle.js +2 -2
  19. package/dist/base/types.d.ts +3 -3
  20. package/dist/bundle/LikeC4View.js +4 -12
  21. package/dist/bundle/LikeC4View.props.d.ts +12 -3
  22. package/dist/bundle/custom.js +1 -1
  23. package/dist/custom/customNodes.d.ts +6 -0
  24. package/dist/custom/customNodes.js +2 -1
  25. package/dist/custom/index.js +1 -1
  26. package/dist/hooks/useDiagram.d.ts +5 -1
  27. package/dist/hooks/useDiagram.js +3 -0
  28. package/dist/hooks/useXYFlow.d.ts +4 -439
  29. package/dist/likec4diagram/DiagramUI.js +1 -1
  30. package/dist/likec4diagram/DiagramXYFlow.js +8 -4
  31. package/dist/likec4diagram/convert-to-xyflow.d.ts +14 -0
  32. package/dist/likec4diagram/convert-to-xyflow.js +29 -0
  33. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +3 -3
  34. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +0 -1
  35. package/dist/likec4diagram/custom/edges/SequenceStepEdge.d.ts +3 -0
  36. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +71 -0
  37. package/dist/likec4diagram/custom/index.js +7 -2
  38. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
  39. package/dist/likec4diagram/custom/nodes/SequenceActorNode.d.ts +4 -0
  40. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +157 -0
  41. package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
  42. package/dist/likec4diagram/custom/nodes/nodes.d.ts +1 -2
  43. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +31 -27
  44. package/dist/likec4diagram/types.d.ts +41 -7
  45. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -0
  46. package/dist/likec4diagram/{useViewToNodesEdges.js → xyflow-diagram/diagram-view.js} +4 -13
  47. package/dist/likec4diagram/xyflow-sequence/_types.d.ts +41 -0
  48. package/dist/likec4diagram/xyflow-sequence/const.d.ts +17 -0
  49. package/dist/likec4diagram/xyflow-sequence/const.js +16 -0
  50. package/dist/likec4diagram/xyflow-sequence/layouter.d.ts +46 -0
  51. package/dist/likec4diagram/xyflow-sequence/layouter.js +408 -0
  52. package/dist/likec4diagram/xyflow-sequence/sequence-view.d.ts +7 -0
  53. package/dist/likec4diagram/xyflow-sequence/sequence-view.js +273 -0
  54. package/dist/likec4diagram/xyflow-sequence/utils.d.ts +14 -0
  55. package/dist/likec4diagram/xyflow-sequence/utils.js +92 -0
  56. package/dist/navigationpanel/NavigationPanelControls.js +2 -2
  57. package/dist/navigationpanel/controls/ViewDetailsCard.js +5 -2
  58. package/dist/navigationpanel/dropdown/ProjectsMenu.js +53 -44
  59. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.d.ts +1 -2
  60. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +10 -41
  61. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +292 -0
  62. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +119 -0
  63. package/dist/navigationpanel/walkthrough/index.d.ts +2 -1
  64. package/dist/overlays/relationship-details/RelationshipDetails.js +4 -1
  65. package/dist/state/DiagramActorProvider.d.ts +3 -2
  66. package/dist/state/DiagramActorProvider.js +19 -11
  67. package/dist/state/assign.js +11 -4
  68. package/dist/state/diagram-machine.d.ts +224 -194
  69. package/dist/state/diagram-machine.js +170 -63
  70. package/dist/state/utils.d.ts +7 -1
  71. package/dist/state/utils.js +67 -7
  72. package/dist/styles-min.css +1 -1
  73. package/dist/styles.css +1 -1
  74. package/dist/styles.css2.js +1 -1
  75. package/package.json +8 -7
  76. package/panda.buildinfo.json +30 -9
  77. package/src/LikeC4Diagram.props.ts +14 -1
  78. package/src/LikeC4Diagram.tsx +7 -4
  79. package/src/base/const.ts +12 -0
  80. package/src/base/index.ts +2 -0
  81. package/src/base/primitives/edge/EdgeLabel.tsx +23 -19
  82. package/src/base/primitives/edge/EdgeLabelContainer.tsx +12 -7
  83. package/src/base/primitives/edge/EdgePath.tsx +25 -14
  84. package/src/base/primitives/edge/edge.css.ts +5 -14
  85. package/src/base/primitives/element/ElementActionButtons.tsx +1 -3
  86. package/src/base/primitives/element/ElementNodeContainer.tsx +3 -30
  87. package/src/base/primitives/element/ElementTitle.tsx +2 -3
  88. package/src/base/types.ts +7 -5
  89. package/src/bundle/LikeC4View.props.ts +14 -3
  90. package/src/bundle/LikeC4View.tsx +4 -14
  91. package/src/bundle/ReactLikeC4.tsx +1 -2
  92. package/src/custom/customNodes.ts +7 -0
  93. package/src/hooks/useDiagram.ts +10 -0
  94. package/src/likec4diagram/DiagramUI.tsx +1 -1
  95. package/src/likec4diagram/DiagramXYFlow.tsx +10 -5
  96. package/src/likec4diagram/convert-to-xyflow.ts +45 -0
  97. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +0 -1
  98. package/src/likec4diagram/custom/edges/SequenceStepEdge.tsx +65 -0
  99. package/src/likec4diagram/custom/index.ts +7 -1
  100. package/src/likec4diagram/custom/nodes/ElementActions.tsx +4 -2
  101. package/src/likec4diagram/custom/nodes/SequenceActorNode.tsx +175 -0
  102. package/src/likec4diagram/custom/nodes/index.ts +1 -0
  103. package/src/likec4diagram/custom/nodes/nodes.tsx +1 -1
  104. package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +36 -30
  105. package/src/likec4diagram/types.ts +96 -13
  106. package/src/likec4diagram/{useViewToNodesEdges.ts → xyflow-diagram/diagram-view.ts} +7 -28
  107. package/src/likec4diagram/xyflow-sequence/_types.ts +45 -0
  108. package/src/likec4diagram/xyflow-sequence/const.ts +37 -0
  109. package/src/likec4diagram/xyflow-sequence/layouter.ts +567 -0
  110. package/src/likec4diagram/xyflow-sequence/sequence-view.ts +337 -0
  111. package/src/likec4diagram/xyflow-sequence/utils.ts +112 -0
  112. package/src/navigationpanel/NavigationPanelControls.tsx +2 -2
  113. package/src/navigationpanel/controls/ViewDetailsCard.tsx +5 -2
  114. package/src/navigationpanel/dropdown/ProjectsMenu.tsx +5 -1
  115. package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +5 -40
  116. package/src/navigationpanel/walkthrough/DynamicViewControls.tsx +125 -0
  117. package/src/navigationpanel/walkthrough/index.tsx +2 -1
  118. package/src/overlays/relationship-details/RelationshipDetails.tsx +5 -2
  119. package/src/state/DiagramActorProvider.tsx +21 -10
  120. package/src/state/assign.ts +18 -5
  121. package/src/state/diagram-machine.ts +207 -75
  122. package/src/state/utils.ts +81 -7
  123. package/dist/likec4diagram/useViewToNodesEdges.d.ts +0 -12
@@ -1,448 +1,13 @@
1
1
  import { ReactFlowInstance, ReactFlowState, InternalNode } from '@xyflow/react';
2
2
  import { Types } from '../likec4diagram/types';
3
- import { EdgeMarkerType, HandleType, XYPosition } from '@xyflow/system';
4
- import { ReactNode, CSSProperties, AriaRole, SVGAttributes } from 'react';
5
- import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, RichTextOrEmpty } from '@likec4/core';
6
- export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
7
- id: string;
8
- source: string;
9
- target: string;
10
- sourceHandle?: string | null;
11
- targetHandle?: string | null;
12
- animated?: boolean;
13
- hidden?: boolean;
14
- deletable?: boolean;
15
- selectable?: boolean;
16
- selected?: boolean;
17
- markerStart?: EdgeMarkerType;
18
- markerEnd?: EdgeMarkerType;
19
- zIndex?: number;
20
- ariaLabel?: string;
21
- interactionWidth?: number;
22
- label?: ReactNode;
23
- labelStyle?: CSSProperties;
24
- labelShowBg?: boolean;
25
- labelBgStyle?: CSSProperties;
26
- labelBgPadding?: [number, number];
27
- labelBgBorderRadius?: number;
28
- style?: CSSProperties;
29
- className?: string;
30
- reconnectable?: boolean | HandleType;
31
- focusable?: boolean;
32
- ariaRole?: AriaRole;
33
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
34
- type: "relationship";
35
- data: {
36
- hovered?: boolean;
37
- active?: boolean;
38
- dimmed?: import("../base").Base.Dimmed;
39
- id: EdgeId;
40
- label: string | null;
41
- points: NonEmptyArray<Point>;
42
- color: Color | undefined;
43
- dir: "forward" | "back" | "both" | undefined;
44
- technology: string | undefined;
45
- line: RelationshipLineType | undefined;
46
- tail: RelationshipArrowType | undefined;
47
- head: RelationshipArrowType | undefined;
48
- labelBBox: BBox | null | undefined;
49
- navigateTo: ViewId<string> | null | undefined;
50
- notes: RichTextOrEmpty;
51
- labelXY: XYPosition | null;
52
- controlPoints: XYPosition[] | undefined | null;
53
- };
54
- }>;
3
+ export declare const useXYFlow: () => ReactFlowInstance<Types.Node, Types.Edge>;
55
4
  export type XYFlowInstance = ReactFlowInstance<Types.Node, Types.Edge>;
56
5
  export type XYStoreState = ReactFlowState<Types.Node, Types.Edge>;
57
6
  export declare function useXYStore<StateSlice = unknown>(selector: (state: XYStoreState) => StateSlice, equalityFn?: (a: NoInfer<StateSlice>, b: NoInfer<StateSlice>) => boolean): StateSlice;
58
7
  export declare const useXYStoreApi: () => {
59
- getState: () => ReactFlowState<Types.Node, {
60
- id: string;
61
- source: string;
62
- target: string;
63
- sourceHandle?: string | null;
64
- targetHandle?: string | null;
65
- animated?: boolean;
66
- hidden?: boolean;
67
- deletable?: boolean;
68
- selectable?: boolean;
69
- selected?: boolean;
70
- markerStart?: EdgeMarkerType;
71
- markerEnd?: EdgeMarkerType;
72
- zIndex?: number;
73
- ariaLabel?: string;
74
- interactionWidth?: number;
75
- label?: ReactNode;
76
- labelStyle?: CSSProperties;
77
- labelShowBg?: boolean;
78
- labelBgStyle?: CSSProperties;
79
- labelBgPadding?: [number, number];
80
- labelBgBorderRadius?: number;
81
- style?: CSSProperties;
82
- className?: string;
83
- reconnectable?: boolean | HandleType;
84
- focusable?: boolean;
85
- ariaRole?: AriaRole;
86
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
87
- type: "relationship";
88
- data: {
89
- hovered?: boolean;
90
- active?: boolean;
91
- dimmed?: import("../base").Base.Dimmed;
92
- id: EdgeId;
93
- label: string | null;
94
- points: NonEmptyArray<Point>;
95
- color: Color | undefined;
96
- dir: "forward" | "back" | "both" | undefined;
97
- technology: string | undefined;
98
- line: RelationshipLineType | undefined;
99
- tail: RelationshipArrowType | undefined;
100
- head: RelationshipArrowType | undefined;
101
- labelBBox: BBox | null | undefined;
102
- navigateTo: ViewId<string> | null | undefined;
103
- notes: RichTextOrEmpty;
104
- labelXY: XYPosition | null;
105
- controlPoints: XYPosition[] | undefined | null;
106
- };
107
- }>;
108
- setState: (partial: ReactFlowState<Types.Node, {
109
- id: string;
110
- source: string;
111
- target: string;
112
- sourceHandle?: string | null;
113
- targetHandle?: string | null;
114
- animated?: boolean;
115
- hidden?: boolean;
116
- deletable?: boolean;
117
- selectable?: boolean;
118
- selected?: boolean;
119
- markerStart?: EdgeMarkerType;
120
- markerEnd?: EdgeMarkerType;
121
- zIndex?: number;
122
- ariaLabel?: string;
123
- interactionWidth?: number;
124
- label?: ReactNode;
125
- labelStyle?: CSSProperties;
126
- labelShowBg?: boolean;
127
- labelBgStyle?: CSSProperties;
128
- labelBgPadding?: [number, number];
129
- labelBgBorderRadius?: number;
130
- style?: CSSProperties;
131
- className?: string;
132
- reconnectable?: boolean | HandleType;
133
- focusable?: boolean;
134
- ariaRole?: AriaRole;
135
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
136
- type: "relationship";
137
- data: {
138
- hovered?: boolean;
139
- active?: boolean;
140
- dimmed?: import("../base").Base.Dimmed;
141
- id: EdgeId;
142
- label: string | null;
143
- points: NonEmptyArray<Point>;
144
- color: Color | undefined;
145
- dir: "forward" | "back" | "both" | undefined;
146
- technology: string | undefined;
147
- line: RelationshipLineType | undefined;
148
- tail: RelationshipArrowType | undefined;
149
- head: RelationshipArrowType | undefined;
150
- labelBBox: BBox | null | undefined;
151
- navigateTo: ViewId<string> | null | undefined;
152
- notes: RichTextOrEmpty;
153
- labelXY: XYPosition | null;
154
- controlPoints: XYPosition[] | undefined | null;
155
- };
156
- }> | Partial<ReactFlowState<Types.Node, {
157
- id: string;
158
- source: string;
159
- target: string;
160
- sourceHandle?: string | null;
161
- targetHandle?: string | null;
162
- animated?: boolean;
163
- hidden?: boolean;
164
- deletable?: boolean;
165
- selectable?: boolean;
166
- selected?: boolean;
167
- markerStart?: EdgeMarkerType;
168
- markerEnd?: EdgeMarkerType;
169
- zIndex?: number;
170
- ariaLabel?: string;
171
- interactionWidth?: number;
172
- label?: ReactNode;
173
- labelStyle?: CSSProperties;
174
- labelShowBg?: boolean;
175
- labelBgStyle?: CSSProperties;
176
- labelBgPadding?: [number, number];
177
- labelBgBorderRadius?: number;
178
- style?: CSSProperties;
179
- className?: string;
180
- reconnectable?: boolean | HandleType;
181
- focusable?: boolean;
182
- ariaRole?: AriaRole;
183
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
184
- type: "relationship";
185
- data: {
186
- hovered?: boolean;
187
- active?: boolean;
188
- dimmed?: import("../base").Base.Dimmed;
189
- id: EdgeId;
190
- label: string | null;
191
- points: NonEmptyArray<Point>;
192
- color: Color | undefined;
193
- dir: "forward" | "back" | "both" | undefined;
194
- technology: string | undefined;
195
- line: RelationshipLineType | undefined;
196
- tail: RelationshipArrowType | undefined;
197
- head: RelationshipArrowType | undefined;
198
- labelBBox: BBox | null | undefined;
199
- navigateTo: ViewId<string> | null | undefined;
200
- notes: RichTextOrEmpty;
201
- labelXY: XYPosition | null;
202
- controlPoints: XYPosition[] | undefined | null;
203
- };
204
- }>> | ((state: ReactFlowState<Types.Node, {
205
- id: string;
206
- source: string;
207
- target: string;
208
- sourceHandle?: string | null;
209
- targetHandle?: string | null;
210
- animated?: boolean;
211
- hidden?: boolean;
212
- deletable?: boolean;
213
- selectable?: boolean;
214
- selected?: boolean;
215
- markerStart?: EdgeMarkerType;
216
- markerEnd?: EdgeMarkerType;
217
- zIndex?: number;
218
- ariaLabel?: string;
219
- interactionWidth?: number;
220
- label?: ReactNode;
221
- labelStyle?: CSSProperties;
222
- labelShowBg?: boolean;
223
- labelBgStyle?: CSSProperties;
224
- labelBgPadding?: [number, number];
225
- labelBgBorderRadius?: number;
226
- style?: CSSProperties;
227
- className?: string;
228
- reconnectable?: boolean | HandleType;
229
- focusable?: boolean;
230
- ariaRole?: AriaRole;
231
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
232
- type: "relationship";
233
- data: {
234
- hovered?: boolean;
235
- active?: boolean;
236
- dimmed?: import("../base").Base.Dimmed;
237
- id: EdgeId;
238
- label: string | null;
239
- points: NonEmptyArray<Point>;
240
- color: Color | undefined;
241
- dir: "forward" | "back" | "both" | undefined;
242
- technology: string | undefined;
243
- line: RelationshipLineType | undefined;
244
- tail: RelationshipArrowType | undefined;
245
- head: RelationshipArrowType | undefined;
246
- labelBBox: BBox | null | undefined;
247
- navigateTo: ViewId<string> | null | undefined;
248
- notes: RichTextOrEmpty;
249
- labelXY: XYPosition | null;
250
- controlPoints: XYPosition[] | undefined | null;
251
- };
252
- }>) => ReactFlowState<Types.Node, {
253
- id: string;
254
- source: string;
255
- target: string;
256
- sourceHandle?: string | null;
257
- targetHandle?: string | null;
258
- animated?: boolean;
259
- hidden?: boolean;
260
- deletable?: boolean;
261
- selectable?: boolean;
262
- selected?: boolean;
263
- markerStart?: EdgeMarkerType;
264
- markerEnd?: EdgeMarkerType;
265
- zIndex?: number;
266
- ariaLabel?: string;
267
- interactionWidth?: number;
268
- label?: ReactNode;
269
- labelStyle?: CSSProperties;
270
- labelShowBg?: boolean;
271
- labelBgStyle?: CSSProperties;
272
- labelBgPadding?: [number, number];
273
- labelBgBorderRadius?: number;
274
- style?: CSSProperties;
275
- className?: string;
276
- reconnectable?: boolean | HandleType;
277
- focusable?: boolean;
278
- ariaRole?: AriaRole;
279
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
280
- type: "relationship";
281
- data: {
282
- hovered?: boolean;
283
- active?: boolean;
284
- dimmed?: import("../base").Base.Dimmed;
285
- id: EdgeId;
286
- label: string | null;
287
- points: NonEmptyArray<Point>;
288
- color: Color | undefined;
289
- dir: "forward" | "back" | "both" | undefined;
290
- technology: string | undefined;
291
- line: RelationshipLineType | undefined;
292
- tail: RelationshipArrowType | undefined;
293
- head: RelationshipArrowType | undefined;
294
- labelBBox: BBox | null | undefined;
295
- navigateTo: ViewId<string> | null | undefined;
296
- notes: RichTextOrEmpty;
297
- labelXY: XYPosition | null;
298
- controlPoints: XYPosition[] | undefined | null;
299
- };
300
- }> | Partial<ReactFlowState<Types.Node, {
301
- id: string;
302
- source: string;
303
- target: string;
304
- sourceHandle?: string | null;
305
- targetHandle?: string | null;
306
- animated?: boolean;
307
- hidden?: boolean;
308
- deletable?: boolean;
309
- selectable?: boolean;
310
- selected?: boolean;
311
- markerStart?: EdgeMarkerType;
312
- markerEnd?: EdgeMarkerType;
313
- zIndex?: number;
314
- ariaLabel?: string;
315
- interactionWidth?: number;
316
- label?: ReactNode;
317
- labelStyle?: CSSProperties;
318
- labelShowBg?: boolean;
319
- labelBgStyle?: CSSProperties;
320
- labelBgPadding?: [number, number];
321
- labelBgBorderRadius?: number;
322
- style?: CSSProperties;
323
- className?: string;
324
- reconnectable?: boolean | HandleType;
325
- focusable?: boolean;
326
- ariaRole?: AriaRole;
327
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
328
- type: "relationship";
329
- data: {
330
- hovered?: boolean;
331
- active?: boolean;
332
- dimmed?: import("../base").Base.Dimmed;
333
- id: EdgeId;
334
- label: string | null;
335
- points: NonEmptyArray<Point>;
336
- color: Color | undefined;
337
- dir: "forward" | "back" | "both" | undefined;
338
- technology: string | undefined;
339
- line: RelationshipLineType | undefined;
340
- tail: RelationshipArrowType | undefined;
341
- head: RelationshipArrowType | undefined;
342
- labelBBox: BBox | null | undefined;
343
- navigateTo: ViewId<string> | null | undefined;
344
- notes: RichTextOrEmpty;
345
- labelXY: XYPosition | null;
346
- controlPoints: XYPosition[] | undefined | null;
347
- };
348
- }>>), replace?: boolean | undefined) => void;
349
- subscribe: (listener: (state: ReactFlowState<Types.Node, {
350
- id: string;
351
- source: string;
352
- target: string;
353
- sourceHandle?: string | null;
354
- targetHandle?: string | null;
355
- animated?: boolean;
356
- hidden?: boolean;
357
- deletable?: boolean;
358
- selectable?: boolean;
359
- selected?: boolean;
360
- markerStart?: EdgeMarkerType;
361
- markerEnd?: EdgeMarkerType;
362
- zIndex?: number;
363
- ariaLabel?: string;
364
- interactionWidth?: number;
365
- label?: ReactNode;
366
- labelStyle?: CSSProperties;
367
- labelShowBg?: boolean;
368
- labelBgStyle?: CSSProperties;
369
- labelBgPadding?: [number, number];
370
- labelBgBorderRadius?: number;
371
- style?: CSSProperties;
372
- className?: string;
373
- reconnectable?: boolean | HandleType;
374
- focusable?: boolean;
375
- ariaRole?: AriaRole;
376
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
377
- type: "relationship";
378
- data: {
379
- hovered?: boolean;
380
- active?: boolean;
381
- dimmed?: import("../base").Base.Dimmed;
382
- id: EdgeId;
383
- label: string | null;
384
- points: NonEmptyArray<Point>;
385
- color: Color | undefined;
386
- dir: "forward" | "back" | "both" | undefined;
387
- technology: string | undefined;
388
- line: RelationshipLineType | undefined;
389
- tail: RelationshipArrowType | undefined;
390
- head: RelationshipArrowType | undefined;
391
- labelBBox: BBox | null | undefined;
392
- navigateTo: ViewId<string> | null | undefined;
393
- notes: RichTextOrEmpty;
394
- labelXY: XYPosition | null;
395
- controlPoints: XYPosition[] | undefined | null;
396
- };
397
- }>, prevState: ReactFlowState<Types.Node, {
398
- id: string;
399
- source: string;
400
- target: string;
401
- sourceHandle?: string | null;
402
- targetHandle?: string | null;
403
- animated?: boolean;
404
- hidden?: boolean;
405
- deletable?: boolean;
406
- selectable?: boolean;
407
- selected?: boolean;
408
- markerStart?: EdgeMarkerType;
409
- markerEnd?: EdgeMarkerType;
410
- zIndex?: number;
411
- ariaLabel?: string;
412
- interactionWidth?: number;
413
- label?: ReactNode;
414
- labelStyle?: CSSProperties;
415
- labelShowBg?: boolean;
416
- labelBgStyle?: CSSProperties;
417
- labelBgPadding?: [number, number];
418
- labelBgBorderRadius?: number;
419
- style?: CSSProperties;
420
- className?: string;
421
- reconnectable?: boolean | HandleType;
422
- focusable?: boolean;
423
- ariaRole?: AriaRole;
424
- domAttributes?: Omit< SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label" | "dangerouslySetInnerHTML">;
425
- type: "relationship";
426
- data: {
427
- hovered?: boolean;
428
- active?: boolean;
429
- dimmed?: import("../base").Base.Dimmed;
430
- id: EdgeId;
431
- label: string | null;
432
- points: NonEmptyArray<Point>;
433
- color: Color | undefined;
434
- dir: "forward" | "back" | "both" | undefined;
435
- technology: string | undefined;
436
- line: RelationshipLineType | undefined;
437
- tail: RelationshipArrowType | undefined;
438
- head: RelationshipArrowType | undefined;
439
- labelBBox: BBox | null | undefined;
440
- navigateTo: ViewId<string> | null | undefined;
441
- notes: RichTextOrEmpty;
442
- labelXY: XYPosition | null;
443
- controlPoints: XYPosition[] | undefined | null;
444
- };
445
- }>) => void) => () => void;
8
+ getState: () => ReactFlowState<Types.Node, Types.Edge>;
9
+ setState: (partial: ReactFlowState<Types.Node, Types.Edge> | Partial<ReactFlowState<Types.Node, Types.Edge>> | ((state: ReactFlowState<Types.Node, Types.Edge>) => ReactFlowState<Types.Node, Types.Edge> | Partial<ReactFlowState<Types.Node, Types.Edge>>), replace?: boolean | undefined) => void;
10
+ subscribe: (listener: (state: ReactFlowState<Types.Node, Types.Edge>, prevState: ReactFlowState<Types.Node, Types.Edge>) => void) => () => void;
446
11
  };
447
12
  export type XYStoreApi = ReturnType<typeof useXYStoreApi>;
448
13
  export declare const useXYInternalNode: (id: string) => InternalNode<Types.Node> | undefined;
@@ -28,7 +28,7 @@ const DiagramUI = memo(() => {
28
28
  enableControls === "next" ? /* @__PURE__ */ jsx(EnsureCurrentViewModel, { children: /* @__PURE__ */ jsx(NavigationPanel, {}) }) : /* @__PURE__ */ jsx(Controls, {}),
29
29
  overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
30
30
  enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
31
- enableControls !== "next" && /* @__PURE__ */ jsxs(Fragment, { children: [
31
+ enableControls === true && /* @__PURE__ */ jsxs(Fragment, { children: [
32
32
  enableViewTitle && /* @__PURE__ */ jsx(DiagramTitlePanel, {}),
33
33
  enableDynamicViewWalkthrough && /* @__PURE__ */ jsx(DynamicViewWalkthrough, {})
34
34
  ] }),
@@ -3,7 +3,7 @@ import { nonNullable } from '@likec4/core';
3
3
  import { cx } from '@likec4/styles/css';
4
4
  import { useTimeout, useDebouncedCallback, useCallbackRef } from '@mantine/hooks';
5
5
  import { useCustomCompareMemo } from '@react-hookz/web';
6
- import { shallowEqual } from 'fast-equals';
6
+ import { deepEqual, shallowEqual } from 'fast-equals';
7
7
  import { BaseXYFlow } from '../base/BaseXYFlow.js';
8
8
  import { useIsReducedGraphics, usePanningAtom } from '../context/ReduceGraphics.js';
9
9
  import { useDiagram, useDiagramContext } from '../hooks/useDiagram.js';
@@ -11,6 +11,7 @@ import { BuiltinNodes, edgeTypes } from './custom/index.js';
11
11
  import { DiagramUI } from './DiagramUI.js';
12
12
  import { useLayoutConstraints } from './useLayoutConstraints.js';
13
13
  import { useDiagramEventHandlers } from '../context/DiagramEventHandlers.js';
14
+ import { SequenceParallelArea } from './custom/nodes/SequenceActorNode.js';
14
15
  import { useUpdateEffect } from '../hooks/useUpdateEffect.js';
15
16
 
16
17
  const selectXYProps = (ctx) => ({
@@ -21,7 +22,7 @@ const selectXYProps = (ctx) => ({
21
22
  zoomable: ctx.zoomable,
22
23
  fitViewPadding: ctx.fitViewPadding,
23
24
  enableFitView: ctx.features.enableFitView,
24
- enableReadOnly: ctx.features.enableReadOnly || ctx.toggledFeatures.enableReadOnly,
25
+ enableReadOnly: ctx.features.enableReadOnly || ctx.toggledFeatures.enableReadOnly || ctx.dynamicViewVariant === "sequence" && ctx.view._type === "dynamic",
25
26
  ...!ctx.features.enableFitView && {
26
27
  viewport: {
27
28
  x: -Math.min(ctx.view.bounds.x, 0),
@@ -30,7 +31,7 @@ const selectXYProps = (ctx) => ({
30
31
  }
31
32
  }
32
33
  });
33
- const equalsXYProps = (a, b) => a.initialized === b.initialized && a.pannable === b.pannable && a.zoomable === b.zoomable && a.enableFitView === b.enableFitView && a.enableReadOnly === b.enableReadOnly && shallowEqual(a.fitViewPadding, b.fitViewPadding) && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges) && shallowEqual(a.viewport ?? null, b.viewport ?? null);
34
+ const equalsXYProps = (a, b) => a.initialized === b.initialized && a.pannable === b.pannable && a.zoomable === b.zoomable && a.enableFitView === b.enableFitView && a.enableReadOnly === b.enableReadOnly && deepEqual(a.fitViewPadding, b.fitViewPadding) && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges) && shallowEqual(a.viewport ?? null, b.viewport ?? null);
34
35
  function LikeC4DiagramXYFlow({
35
36
  background = "dots",
36
37
  nodesDraggable = false,
@@ -84,7 +85,9 @@ function LikeC4DiagramXYFlow({
84
85
  deployment: renderNodes?.deployment ?? BuiltinNodes.deployment,
85
86
  "compound-element": renderNodes?.compoundElement ?? BuiltinNodes.compoundElement,
86
87
  "compound-deployment": renderNodes?.compoundDeployment ?? BuiltinNodes.compoundDeployment,
87
- "view-group": renderNodes?.viewGroup ?? BuiltinNodes.viewGroup
88
+ "view-group": renderNodes?.viewGroup ?? BuiltinNodes.viewGroup,
89
+ "seq-actor": renderNodes?.sequenceActor ?? BuiltinNodes.sequenceActor,
90
+ "seq-parallel": SequenceParallelArea
88
91
  };
89
92
  },
90
93
  [renderNodes],
@@ -184,6 +187,7 @@ function LikeC4DiagramXYFlow({
184
187
  },
185
188
  nodesDraggable: notReadOnly && nodesDraggable,
186
189
  nodesSelectable,
190
+ edgesFocusable: false,
187
191
  ...notReadOnly && nodesDraggable && layoutConstraints,
188
192
  ...props,
189
193
  ...reactFlowProps,
@@ -0,0 +1,14 @@
1
+ import { DynamicViewDisplayVariant, LayoutedView, WhereOperator } from '@likec4/core/types';
2
+ import { Types } from './types';
3
+ type ConvertToXYFlowInput = {
4
+ view: LayoutedView;
5
+ where: WhereOperator | null;
6
+ nodesSelectable: boolean;
7
+ dynamicViewVariant: DynamicViewDisplayVariant;
8
+ };
9
+ export declare function convertToXYFlow({ dynamicViewVariant, ...params }: ConvertToXYFlowInput): {
10
+ view: LayoutedView;
11
+ xynodes: Types.Node[];
12
+ xyedges: Types.Edge[];
13
+ };
14
+ export {};
@@ -0,0 +1,29 @@
1
+ import { diagramToXY } from './xyflow-diagram/diagram-view.js';
2
+ import { sequenceViewToXY } from './xyflow-sequence/sequence-view.js';
3
+
4
+ function convertToXYFlow({ dynamicViewVariant, ...params }) {
5
+ const view = params.view;
6
+ const isDynamic = view._type === "dynamic";
7
+ const { bounds, xynodes, xyedges } = isDynamic && dynamicViewVariant === "sequence" ? sequenceViewToXY(view) : diagramToXY(params);
8
+ if (isDynamic && view.variant !== dynamicViewVariant) {
9
+ return {
10
+ view: {
11
+ ...view,
12
+ bounds,
13
+ variant: dynamicViewVariant
14
+ },
15
+ xynodes,
16
+ xyedges
17
+ };
18
+ }
19
+ return {
20
+ view: bounds === view.bounds ? view : {
21
+ ...view,
22
+ bounds
23
+ },
24
+ xynodes,
25
+ xyedges
26
+ };
27
+ }
28
+
29
+ export { convertToXYFlow };
@@ -1,4 +1,4 @@
1
- import { EdgeId, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType, BBox, ViewId, RichTextOrEmpty } from '@likec4/core';
1
+ import { EdgeId, NonEmptyArray, Point, Color, BBox, RelationshipLineType, RelationshipArrowType, ViewId, RichTextOrEmpty } from '@likec4/core';
2
2
  import { XYPosition } from '@xyflow/react';
3
3
  import { FunctionComponent, CSSProperties, ReactNode } from 'react';
4
4
  import { Position } from '@xyflow/system';
@@ -39,10 +39,10 @@ export declare const RelationshipEdge: FunctionComponent<{
39
39
  color: Color | undefined;
40
40
  dir: "forward" | "back" | "both" | undefined;
41
41
  technology: string | undefined;
42
+ labelBBox: BBox | null | undefined;
42
43
  line: RelationshipLineType | undefined;
43
- tail: RelationshipArrowType | undefined;
44
44
  head: RelationshipArrowType | undefined;
45
- labelBBox: BBox | null | undefined;
45
+ tail: RelationshipArrowType | undefined;
46
46
  navigateTo: ViewId<string> | null | undefined;
47
47
  notes: RichTextOrEmpty;
48
48
  labelXY: XYPosition | null;
@@ -270,7 +270,6 @@ const RelationshipEdge = customEdge((props) => {
270
270
  children: /* @__PURE__ */ jsx(EdgeLabel, { edgeProps: props, children: navigateTo && /* @__PURE__ */ jsx(
271
271
  EdgeActionButton,
272
272
  {
273
- ...props,
274
273
  onClick: (e) => {
275
274
  e.stopPropagation();
276
275
  diagram.navigateTo(navigateTo);
@@ -0,0 +1,3 @@
1
+ import { EdgeProps } from '../../../base';
2
+ import { Types } from '../../types';
3
+ export declare function SequenceStepEdge(props: EdgeProps<Types.SequenceStepEdgeData>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,71 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { getSmoothStepPath } from '@xyflow/system';
3
+ import { useDiagram } from '../../../hooks/useDiagram.js';
4
+ import { EdgeContainer } from '../../../base/primitives/edge/EdgeContainer.js';
5
+ import { EdgePath } from '../../../base/primitives/edge/EdgePath.js';
6
+ import { EdgeLabelContainer } from '../../../base/primitives/edge/EdgeLabelContainer.js';
7
+ import { EdgeLabel } from '../../../base/primitives/edge/EdgeLabel.js';
8
+ import { EdgeActionButton } from '../../../base/primitives/edge/EdgeActionButton.js';
9
+
10
+ const LABEL_OFFSET = 16;
11
+ function SequenceStepEdge(props) {
12
+ const diagram = useDiagram();
13
+ const { navigateTo } = props.data;
14
+ const isSelfLoop = props.source === props.target;
15
+ const isBack = props.sourceX > props.targetX;
16
+ const [path] = getSmoothStepPath({
17
+ sourceX: props.sourceX,
18
+ sourceY: props.sourceY,
19
+ sourcePosition: props.sourcePosition,
20
+ targetX: props.targetX,
21
+ targetY: props.targetY,
22
+ targetPosition: props.targetPosition,
23
+ ...isSelfLoop && {
24
+ offset: 30,
25
+ borderRadius: 16
26
+ }
27
+ });
28
+ let labelX = props.sourceX;
29
+ switch (true) {
30
+ case isSelfLoop:
31
+ labelX = props.sourceX + 24 + LABEL_OFFSET;
32
+ break;
33
+ case isBack:
34
+ labelX = props.sourceX - LABEL_OFFSET;
35
+ break;
36
+ default:
37
+ labelX = props.sourceX + LABEL_OFFSET;
38
+ break;
39
+ }
40
+ return /* @__PURE__ */ jsxs(EdgeContainer, { ...props, children: [
41
+ /* @__PURE__ */ jsx(
42
+ EdgePath,
43
+ {
44
+ edgeProps: props,
45
+ svgPath: path
46
+ }
47
+ ),
48
+ /* @__PURE__ */ jsx(
49
+ EdgeLabelContainer,
50
+ {
51
+ edgeProps: props,
52
+ labelPosition: {
53
+ x: labelX,
54
+ y: props.sourceY + (!isSelfLoop ? LABEL_OFFSET : 0),
55
+ translate: isBack ? "translate(-100%, 0)" : void 0
56
+ },
57
+ children: /* @__PURE__ */ jsx(EdgeLabel, { edgeProps: props, children: navigateTo && /* @__PURE__ */ jsx(
58
+ EdgeActionButton,
59
+ {
60
+ onClick: (e) => {
61
+ e.stopPropagation();
62
+ diagram.navigateTo(navigateTo);
63
+ }
64
+ }
65
+ ) })
66
+ }
67
+ )
68
+ ] });
69
+ }
70
+
71
+ export { SequenceStepEdge };