@likec4/diagram 1.58.0 → 1.59.1

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 (229) hide show
  1. package/dist/LikeC4Diagram.js +1 -1
  2. package/dist/LikeC4Diagram.props.d.ts +1 -1
  3. package/dist/LikeC4Styles.js +1 -1
  4. package/dist/LikeC4View.js +2 -2
  5. package/dist/ReactLikeC4.d.ts +1 -1
  6. package/dist/base/Base.d.ts +3 -2
  7. package/dist/base/Base.js +14 -26
  8. package/dist/base/BaseXYFlow.d.ts +2 -1
  9. package/dist/base/BaseXYFlow.js +63 -4
  10. package/dist/base/keyboardZoom.d.ts +3 -0
  11. package/dist/base/keyboardZoom.js +20 -0
  12. package/dist/base/updateEdges.js +7 -16
  13. package/dist/base/updateNodes.js +3 -9
  14. package/dist/base-primitives/compound/CompoundActionButton.d.ts +2 -1
  15. package/dist/base-primitives/compound/CompoundActionButton.js +5 -2
  16. package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +2 -1
  17. package/dist/base-primitives/compound/CompoundDetailsButton.js +5 -2
  18. package/dist/base-primitives/compound/CompoundTitle.d.ts +7 -1
  19. package/dist/base-primitives/compound/CompoundTitle.js +2 -1
  20. package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
  21. package/dist/base-primitives/edge/EdgeActionButton.d.ts +2 -1
  22. package/dist/base-primitives/edge/EdgeActionButton.js +2 -1
  23. package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
  24. package/dist/base-primitives/edge/EdgeContainer.js +4 -2
  25. package/dist/base-primitives/edge/EdgeLabel.d.ts +2 -0
  26. package/dist/base-primitives/edge/EdgeLabel.js +2 -5
  27. package/dist/base-primitives/element/ElementActionButtons.d.ts +1 -0
  28. package/dist/base-primitives/element/ElementActionButtons.js +4 -1
  29. package/dist/base-primitives/element/ElementData.d.ts +3 -1
  30. package/dist/base-primitives/element/ElementData.js +2 -1
  31. package/dist/base-primitives/element/ElementDetailsButton.d.ts +2 -1
  32. package/dist/base-primitives/element/ElementDetailsButton.js +5 -2
  33. package/dist/base-primitives/element/ElementNodeContainer.js +1 -1
  34. package/dist/base-primitives/element/ElementShape.js +3 -0
  35. package/dist/components/ErrorFallback.js +3 -5
  36. package/dist/components/Link.js +6 -6
  37. package/dist/components/NavigationPanel.js +1 -1
  38. package/dist/components/SearchControl.css.js +11 -11
  39. package/dist/context/TagStylesContext.d.ts +3 -3
  40. package/dist/context/TagStylesContext.js +16 -16
  41. package/dist/custom/index.d.ts +1 -0
  42. package/dist/custom/index.js +3 -2
  43. package/dist/editor/actor/actions.js +1 -1
  44. package/dist/editor/actor/machine.d.ts +4 -6
  45. package/dist/editor/actor/setup.d.ts +16 -2
  46. package/dist/editor/actor/setup.js +5 -4
  47. package/dist/hooks/index.d.ts +1 -1
  48. package/dist/hooks/safeContext.d.ts +156 -3
  49. package/dist/hooks/safeContext.js +60 -12
  50. package/dist/hooks/useCurrentViewModel.js +1 -1
  51. package/dist/hooks/useDiagram.d.ts +8 -0
  52. package/dist/hooks/useDiagram.js +9 -2
  53. package/dist/hooks/useEditorActor.js +1 -1
  54. package/dist/hooks/useLikeC4ElementsTree.js +1 -1
  55. package/dist/hooks/useLikeC4Model.js +1 -1
  56. package/dist/hooks/useXYFlow.d.ts +1 -0
  57. package/dist/hooks/useXYFlow.js +5 -3
  58. package/dist/index.d.ts +1 -1
  59. package/dist/index.js +2 -2
  60. package/dist/likec4diagram/DiagramUI.js +19 -6
  61. package/dist/likec4diagram/DiagramXYFlow.js +39 -14
  62. package/dist/likec4diagram/convert-to-xyflow.d.ts +3 -5
  63. package/dist/likec4diagram/convert-to-xyflow.js +29 -10
  64. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +13 -4
  65. package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +11 -4
  66. package/dist/likec4diagram/custom/edges/edges.css.js +1 -1
  67. package/dist/likec4diagram/custom/index.d.ts +2 -1
  68. package/dist/likec4diagram/custom/index.js +5 -3
  69. package/dist/likec4diagram/custom/nodes/CompoundActions.js +1 -0
  70. package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -2
  71. package/dist/likec4diagram/custom/nodes/ElementActions.js +13 -3
  72. package/dist/likec4diagram/custom/nodes/NodeNotes.js +0 -4
  73. package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +32 -19
  74. package/dist/likec4diagram/custom/nodes/SequenceSubFlow.d.ts +2 -0
  75. package/dist/likec4diagram/custom/nodes/SequenceSubFlow.js +234 -0
  76. package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
  77. package/dist/likec4diagram/custom/nodes/nodes.js +20 -5
  78. package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
  79. package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +1 -1
  80. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -14
  81. package/dist/likec4diagram/relationship-popover/components.d.ts +1 -1
  82. package/dist/likec4diagram/state/DiagramActorProvider.js +11 -20
  83. package/dist/likec4diagram/state/aligners.js +1 -1
  84. package/dist/likec4diagram/state/assign.d.ts +1 -1
  85. package/dist/likec4diagram/state/assign.js +1 -1
  86. package/dist/likec4diagram/state/createViewChange.js +1 -1
  87. package/dist/likec4diagram/state/diagram-api.d.ts +18 -10
  88. package/dist/likec4diagram/state/diagram-api.js +333 -229
  89. package/dist/likec4diagram/state/machine.actions.d.ts +1026 -332
  90. package/dist/likec4diagram/state/machine.actions.js +115 -44
  91. package/dist/likec4diagram/state/machine.actions.layout.d.ts +123 -51
  92. package/dist/likec4diagram/state/machine.actions.layout.js +40 -33
  93. package/dist/likec4diagram/state/machine.d.ts +154 -16
  94. package/dist/likec4diagram/state/machine.js +5 -41
  95. package/dist/likec4diagram/state/machine.setup.d.ts +84 -19
  96. package/dist/likec4diagram/state/machine.setup.js +65 -12
  97. package/dist/likec4diagram/state/machine.state.initializing.d.ts +59 -33
  98. package/dist/likec4diagram/state/machine.state.navigating.js +7 -3
  99. package/dist/likec4diagram/state/machine.state.ready.d.ts +1540 -476
  100. package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +294 -53
  101. package/dist/likec4diagram/state/machine.state.ready.focused.js +3 -3
  102. package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +264 -73
  103. package/dist/likec4diagram/state/machine.state.ready.idle.js +31 -6
  104. package/dist/likec4diagram/state/machine.state.ready.js +22 -16
  105. package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +23 -9
  106. package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +288 -84
  107. package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +135 -66
  108. package/dist/likec4diagram/state/types.d.ts +4 -2
  109. package/dist/likec4diagram/state/utils.d.ts +7 -0
  110. package/dist/likec4diagram/state/utils.js +36 -34
  111. package/dist/likec4diagram/types.d.ts +47 -3
  112. package/dist/likec4diagram/ui/FloatingSequenceActors.d.ts +6 -0
  113. package/dist/likec4diagram/ui/FloatingSequenceActors.js +155 -0
  114. package/dist/likec4diagram/ui/LayoutDriftFrame.js +2 -2
  115. package/dist/likec4diagram/ui/index.d.ts +2 -0
  116. package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -5
  117. package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.d.ts +2 -0
  118. package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.js +540 -0
  119. package/dist/likec4diagram/ui/sequence-outline/state.d.ts +36 -0
  120. package/dist/likec4diagram/ui/sequence-outline/state.js +55 -0
  121. package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +1 -1
  122. package/dist/likec4diagram/xyflow-diagram/diagram-view.js +112 -60
  123. package/dist/likec4diagram/xyflow-sequence/_types.d.ts +55 -5
  124. package/dist/likec4diagram/xyflow-sequence/const.d.ts +5 -5
  125. package/dist/likec4diagram/xyflow-sequence/const.js +4 -4
  126. package/dist/likec4diagram/xyflow-sequence/layouter.d.ts +30 -6
  127. package/dist/likec4diagram/xyflow-sequence/layouter.js +566 -0
  128. package/dist/likec4diagram/xyflow-sequence/{sequence-layout.d.ts → sequence-view-to-xy.d.ts} +8 -2
  129. package/dist/likec4diagram/xyflow-sequence/{sequence-layout.js → sequence-view-to-xy.js} +111 -14
  130. package/dist/likec4diagram/xyflow-sequence/sequence-view.d.ts +2 -7
  131. package/dist/likec4diagram/xyflow-sequence/sequence-view.js +144 -0
  132. package/dist/likec4diagram/xyflow-sequence/utils.d.ts +9 -1
  133. package/dist/likec4diagram/xyflow-sequence/utils.js +96 -0
  134. package/dist/navigationpanel/NavigationPanel.d.ts +5 -2
  135. package/dist/navigationpanel/NavigationPanel.js +58 -59
  136. package/dist/navigationpanel/NavigationPanelDropdown.js +45 -38
  137. package/dist/navigationpanel/_common.js +2 -2
  138. package/dist/navigationpanel/actor.actions.d.ts +19 -0
  139. package/dist/navigationpanel/actor.actions.js +45 -0
  140. package/dist/navigationpanel/actor.d.ts +34 -96
  141. package/dist/navigationpanel/actor.js +21 -84
  142. package/dist/navigationpanel/actor.setup.d.ts +98 -0
  143. package/dist/navigationpanel/actor.setup.js +31 -0
  144. package/dist/navigationpanel/comparepanel/DriftsSummary.js +4 -5
  145. package/dist/navigationpanel/controls/DetailsControls.js +7 -8
  146. package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
  147. package/dist/navigationpanel/editorpanel/styles.js +8 -8
  148. package/dist/navigationpanel/hooks.d.ts +20 -5
  149. package/dist/navigationpanel/hooks.js +4 -18
  150. package/dist/navigationpanel/styles.css.d.ts +1 -1
  151. package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +2 -2
  152. package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +4 -4
  153. package/dist/navigationpanel/walkthrough/DynamicViewControls.js +23 -25
  154. package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +5 -5
  155. package/dist/overlays/Overlays.d.ts +4 -2
  156. package/dist/overlays/Overlays.js +10 -10
  157. package/dist/overlays/element-details/ElementDetailsCard.css.js +17 -17
  158. package/dist/overlays/element-details/MetadataValue.js +15 -15
  159. package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -5
  160. package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -11
  161. package/dist/overlays/element-details/TabPanelRelationships.js +1 -1
  162. package/dist/overlays/element-details/TabPanelStructure.css.js +2 -2
  163. package/dist/overlays/element-details/TabPanelStructure.js +1 -1
  164. package/dist/overlays/element-details/actor.d.ts +2 -3
  165. package/dist/overlays/hooks.d.ts +28 -0
  166. package/dist/overlays/hooks.js +5 -0
  167. package/dist/overlays/overlay/Overlay.js +34 -25
  168. package/dist/overlays/overlaysActor.js +0 -1
  169. package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
  170. package/dist/overlays/relationship-details/layout.js +1 -1
  171. package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
  172. package/dist/overlays/relationships-browser/actor.js +79 -78
  173. package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
  174. package/dist/overlays/relationships-browser/hooks.js +1 -1
  175. package/dist/overlays/relationships-browser/layout.js +2 -2
  176. package/dist/projects-overview/actor.js +4 -4
  177. package/dist/search/Search.js +1 -1
  178. package/dist/search/components/ElementsColumn.css.js +2 -2
  179. package/dist/search/components/ViewsColum.js +1 -1
  180. package/dist/search/components/_shared.css.d.ts +1 -1
  181. package/dist/search/components/_shared.css.js +23 -23
  182. package/dist/search/components/styles.css.js +4 -4
  183. package/dist/shadowroot/ShadowRoot.d.ts +1 -1
  184. package/dist/shadowroot/ShadowRoot.js +76 -28
  185. package/dist/styles2.js +1 -1
  186. package/dist/utils/defineActors.d.ts +21 -0
  187. package/dist/utils/defineActors.js +13 -0
  188. package/dist/utils/index.d.ts +1 -0
  189. package/dist/utils/index.js +5 -4
  190. package/dist/utils/readableText.d.ts +11 -0
  191. package/dist/utils/readableText.js +18 -0
  192. package/package.json +18 -30
  193. package/panda.buildinfo.json +270 -288
  194. package/styles-min.css +1 -1
  195. package/styles.css +1 -1
  196. package/adhoc-editor/package.json +0 -4
  197. package/dist/adhoc-editor/EditorPanel.d.ts +0 -1
  198. package/dist/adhoc-editor/EditorPanel.js +0 -106
  199. package/dist/adhoc-editor/ElementsTree.d.ts +0 -2
  200. package/dist/adhoc-editor/ElementsTree.js +0 -112
  201. package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +0 -4
  202. package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +0 -83
  203. package/dist/adhoc-editor/components/Tree.d.ts +0 -48
  204. package/dist/adhoc-editor/components/Tree.js +0 -213
  205. package/dist/adhoc-editor/hooks.d.ts +0 -14
  206. package/dist/adhoc-editor/hooks.js +0 -34
  207. package/dist/adhoc-editor/index.d.ts +0 -2
  208. package/dist/adhoc-editor/index.js +0 -2
  209. package/dist/adhoc-editor/state/ActorProvider.d.ts +0 -5
  210. package/dist/adhoc-editor/state/ActorProvider.js +0 -37
  211. package/dist/adhoc-editor/state/actor.d.ts +0 -13
  212. package/dist/adhoc-editor/state/actor.editor.d.ts +0 -56
  213. package/dist/adhoc-editor/state/actor.editor.js +0 -167
  214. package/dist/adhoc-editor/state/actor.js +0 -14
  215. package/dist/adhoc-editor/state/actor.layouter.d.ts +0 -51
  216. package/dist/adhoc-editor/state/actor.layouter.js +0 -54
  217. package/dist/adhoc-editor/state/actor.types.d.ts +0 -63
  218. package/dist/adhoc-editor/state/actor.types.js +0 -25
  219. package/dist/adhoc-editor/state/panel.d.ts +0 -95
  220. package/dist/adhoc-editor/state/panel.js +0 -124
  221. package/dist/adhoc-editor/state/utils.d.ts +0 -17
  222. package/dist/adhoc-editor/state/utils.js +0 -25
  223. package/dist/adhoc-editor/useElementsTree.d.ts +0 -18
  224. package/dist/adhoc-editor/useElementsTree.js +0 -98
  225. package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +0 -6
  226. package/dist/context/ShadowRootContext.d.ts +0 -3
  227. package/dist/context/ShadowRootContext.js +0 -5
  228. package/dist/shadowroot/styles.d.ts +0 -13
  229. package/dist/shadowroot/styles.js +0 -60
@@ -1,8 +1,49 @@
1
1
  import "../../_virtual/_rolldown/runtime.js";
2
2
  import { ZIndexes } from "../../base/const.js";
3
+ import { readableText } from "../../utils/readableText.js";
3
4
  import { hasAtLeast, pick } from "remeda";
4
- import { GroupElementKind, Queue, invariant, nonNullable, whereOperatorAsPredicate } from "@likec4/core";
5
+ import { GroupElementKind, Queue, invariant, isStepPath, nonNullable, whereOperatorAsPredicate } from "@likec4/core";
5
6
  //#region src/likec4diagram/xyflow-diagram/diagram-view.ts
7
+ function sentence(parts) {
8
+ return parts.filter((part) => !!part).map((part) => part.endsWith(".") ? part : `${part}.`).join(" ");
9
+ }
10
+ function nodeAriaLabel(node) {
11
+ const title = readableText(node.title) ?? node.id;
12
+ const description = readableText(node.description);
13
+ const notes = readableText(node.notes);
14
+ if (node.kind === GroupElementKind) {
15
+ const childCount = node.children.length;
16
+ return sentence([
17
+ title,
18
+ "Group",
19
+ `Contains ${childCount} ${childCount === 1 ? "node" : "nodes"}`,
20
+ notes && `Notes: ${notes}`
21
+ ]);
22
+ }
23
+ return sentence([
24
+ title,
25
+ `Node kind: ${node.kind}`,
26
+ node.technology && `Technology: ${node.technology}`,
27
+ description && `Description: ${description}`,
28
+ notes && `Notes: ${notes}`,
29
+ node.navigateTo && `Opens view ${node.navigateTo}`
30
+ ]);
31
+ }
32
+ function edgeAriaLabel(edge, source, target) {
33
+ const sourceTitle = readableText(source.title) ?? source.id;
34
+ const targetTitle = readableText(target.title) ?? target.id;
35
+ const label = readableText(edge.label);
36
+ const description = readableText(edge.description);
37
+ const notes = readableText(edge.notes);
38
+ return sentence([
39
+ `Relationship from ${sourceTitle} to ${targetTitle}`,
40
+ label && `Label: ${label}`,
41
+ edge.technology && `Technology: ${edge.technology}`,
42
+ description && `Description: ${description}`,
43
+ notes && `Notes: ${notes}`,
44
+ edge.navigateTo && `Opens view ${edge.navigateTo}`
45
+ ]);
46
+ }
6
47
  /**
7
48
  * Convert a diagram view to XY flow nodes and edges.
8
49
  * @param opts
@@ -17,6 +58,7 @@ function diagramToXY(opts) {
17
58
  const xyedges = [];
18
59
  const nodeLookup = /* @__PURE__ */ new Map();
19
60
  const viewLayoutDir = view.autoLayout?.direction ?? "TB";
61
+ const isDynamic = view._type === "dynamic";
20
62
  const deletable = view._type !== "dynamic";
21
63
  const queue = Queue.from(view.nodes.reduce((acc, node) => {
22
64
  nodeLookup.set(node.id, node);
@@ -64,27 +106,76 @@ function diagramToXY(opts) {
64
106
  width: node.width,
65
107
  height: node.height
66
108
  },
109
+ ariaLabel: nodeAriaLabel(node),
67
110
  initialWidth: node.width,
68
111
  initialHeight: node.height,
69
112
  hidden: node.kind !== GroupElementKind && !visiblePredicate(node),
70
113
  ...parent && { parentId: ns + parent.id }
71
114
  };
72
- const compoundData = {
73
- viewId: view.id,
74
- id: node.id,
75
- title: node.title,
76
- color: node.color,
77
- shape: node.shape,
78
- style: node.style,
79
- depth: node.depth ?? 0,
80
- icon: node.icon ?? "none",
81
- tags: node.tags ?? null,
82
- x: node.x,
83
- y: node.y,
84
- drifts: node.drifts ?? null,
85
- notes: node.notes,
86
- viewLayoutDir
87
- };
115
+ const modelFqn = node.modelRef ?? null;
116
+ const deploymentFqn = node.deploymentRef ?? null;
117
+ const navigateTo = { navigateTo: node.navigateTo ?? null };
118
+ /**
119
+ * Compound nodes
120
+ */
121
+ if (isCompound) {
122
+ const compoundData = {
123
+ viewId: view.id,
124
+ id: node.id,
125
+ title: node.title,
126
+ color: node.color,
127
+ shape: node.shape,
128
+ style: node.style,
129
+ depth: node.depth ?? 0,
130
+ icon: node.icon ?? "none",
131
+ tags: node.tags ?? null,
132
+ x: node.x,
133
+ y: node.y,
134
+ drifts: node.drifts ?? null,
135
+ notes: node.notes,
136
+ viewLayoutDir
137
+ };
138
+ switch (true) {
139
+ case node.kind === GroupElementKind:
140
+ xynodes.push({
141
+ ...base,
142
+ type: "view-group",
143
+ data: {
144
+ isViewGroup: true,
145
+ ...compoundData
146
+ }
147
+ });
148
+ break;
149
+ case !!deploymentFqn:
150
+ xynodes.push({
151
+ ...base,
152
+ type: "compound-deployment",
153
+ data: {
154
+ ...compoundData,
155
+ ...navigateTo,
156
+ deploymentFqn,
157
+ modelFqn
158
+ }
159
+ });
160
+ break;
161
+ default:
162
+ invariant(!!modelFqn, "ModelRef expected");
163
+ xynodes.push({
164
+ ...base,
165
+ type: "compound-element",
166
+ data: {
167
+ ...compoundData,
168
+ ...navigateTo,
169
+ modelFqn
170
+ }
171
+ });
172
+ }
173
+ continue;
174
+ }
175
+ if (!modelFqn && !deploymentFqn) {
176
+ console.error("Invalid node", node);
177
+ throw new Error("Element should have either modelRef or deploymentRef");
178
+ }
88
179
  const leafNodeData = {
89
180
  viewId: view.id,
90
181
  id: node.id,
@@ -106,49 +197,7 @@ function diagramToXY(opts) {
106
197
  drifts: node.drifts ?? null,
107
198
  viewLayoutDir
108
199
  };
109
- if (node.kind === GroupElementKind) {
110
- xynodes.push({
111
- ...base,
112
- type: "view-group",
113
- data: {
114
- isViewGroup: true,
115
- ...compoundData
116
- }
117
- });
118
- continue;
119
- }
120
- const modelFqn = node.modelRef ?? null;
121
- const deploymentFqn = node.deploymentRef ?? null;
122
- if (!modelFqn && !deploymentFqn) {
123
- console.error("Invalid node", node);
124
- throw new Error("Element should have either modelRef or deploymentRef");
125
- }
126
- const navigateTo = { navigateTo: node.navigateTo ?? null };
127
200
  switch (true) {
128
- case isCompound && !!deploymentFqn:
129
- xynodes.push({
130
- ...base,
131
- type: "compound-deployment",
132
- data: {
133
- ...compoundData,
134
- ...navigateTo,
135
- deploymentFqn,
136
- modelFqn
137
- }
138
- });
139
- break;
140
- case isCompound:
141
- invariant(!!modelFqn, "ModelRef expected");
142
- xynodes.push({
143
- ...base,
144
- type: "compound-element",
145
- data: {
146
- ...compoundData,
147
- ...navigateTo,
148
- modelFqn
149
- }
150
- });
151
- break;
152
201
  case !!deploymentFqn:
153
202
  xynodes.push({
154
203
  ...base,
@@ -174,6 +223,7 @@ function diagramToXY(opts) {
174
223
  });
175
224
  }
176
225
  }
226
+ let stepnum = 1;
177
227
  for (const edge of view.edges) {
178
228
  const source = edge.source;
179
229
  const target = edge.target;
@@ -187,6 +237,7 @@ function diagramToXY(opts) {
187
237
  type: "relationship",
188
238
  source: ns + source,
189
239
  target: ns + target,
240
+ ariaLabel: edgeAriaLabel(edge, nodeById(source), nodeById(target)),
190
241
  zIndex: ZIndexes.Edge,
191
242
  hidden: !visiblePredicate(edge),
192
243
  deletable,
@@ -207,7 +258,8 @@ function diagramToXY(opts) {
207
258
  head: edge.head ?? "normal",
208
259
  tail: edge.tail ?? "none",
209
260
  astPath: edge.astPath,
210
- drifts: edge.drifts ?? null
261
+ drifts: edge.drifts ?? null,
262
+ ...isDynamic && isStepPath(edge.id) && { stepnum: stepnum++ }
211
263
  },
212
264
  interactionWidth: 20
213
265
  });
@@ -1,6 +1,14 @@
1
- import { DiagramEdge, DiagramNode, EdgeId } from '@likec4/core/types';
1
+ import { BBox, DiagramEdge, DiagramNode, NodeId, StepPath, ViewId } from '@likec4/core/types';
2
+ export type Spacing = number | Partial<{
3
+ top: number;
4
+ left: number;
5
+ right: number;
6
+ bottom: number;
7
+ x: number;
8
+ y: number;
9
+ }>;
2
10
  export type Step = {
3
- id: EdgeId;
11
+ id: StepPath;
4
12
  from: {
5
13
  column: number;
6
14
  row: number;
@@ -18,7 +26,7 @@ export type Step = {
18
26
  };
19
27
  isSelfLoop: boolean;
20
28
  isBack: boolean;
21
- parallelPrefix: string | null;
29
+ parent: StepPath | null;
22
30
  offset: number;
23
31
  edge: DiagramEdge;
24
32
  };
@@ -28,8 +36,7 @@ export type Compound = {
28
36
  to: DiagramNode;
29
37
  nested: Compound[];
30
38
  };
31
- export type ParallelRect = {
32
- parallelPrefix: string;
39
+ export type Rect = {
33
40
  min: {
34
41
  column: number;
35
42
  row: number;
@@ -39,3 +46,46 @@ export type ParallelRect = {
39
46
  row: number;
40
47
  };
41
48
  };
49
+ export type ParallelRect = Rect & {
50
+ parallelPrefix: string;
51
+ };
52
+ export interface SequenceActorStepPort {
53
+ id: string;
54
+ cx: number;
55
+ cy: number;
56
+ height: number;
57
+ type: 'target' | 'source';
58
+ position: 'left' | 'right' | 'top' | 'bottom';
59
+ hidden?: boolean;
60
+ }
61
+ export interface SequenceActor {
62
+ id: NodeId;
63
+ x: number;
64
+ y: number;
65
+ width: number;
66
+ height: number;
67
+ ports: Array<SequenceActorStepPort>;
68
+ }
69
+ export interface SequenceCompound {
70
+ id: NodeId;
71
+ origin: NodeId;
72
+ x: number;
73
+ y: number;
74
+ width: number;
75
+ height: number;
76
+ depth: number;
77
+ }
78
+ export interface SequenceParallelArea {
79
+ parallelPrefix: string;
80
+ x: number;
81
+ y: number;
82
+ width: number;
83
+ height: number;
84
+ }
85
+ export interface SequenceViewLayout {
86
+ id: ViewId;
87
+ actors: Array<SequenceActor>;
88
+ compounds: Array<SequenceCompound>;
89
+ parallelAreas: Array<SequenceParallelArea>;
90
+ bounds: BBox;
91
+ }
@@ -1,13 +1,13 @@
1
- export declare const ACTOR_GAP = 60;
2
- export declare const COLUMN_GAP = 32;
3
- export declare const MIN_ROW_HEIGHT = 80;
4
- export declare const PORT_HEIGHT = 32;
1
+ export declare const ACTOR_GAP = 80;
2
+ export declare const COLUMN_GAP = 50;
3
+ export declare const MIN_ROW_HEIGHT = 100;
4
+ export declare const PORT_HEIGHT = 24;
5
5
  export declare const STEP_LABEL_MARGIN = 50;
6
6
  export declare const FIRST_STEP_OFFSET = 30;
7
7
  export declare const CONTINUOUS_OFFSET = 22;
8
8
  export declare const SeqZIndex: {
9
9
  compound: number;
10
- parallel: number;
10
+ subflows: number;
11
11
  actor: number;
12
12
  step: number;
13
13
  };
@@ -1,9 +1,9 @@
1
1
  //#region src/likec4diagram/xyflow-sequence/const.ts
2
2
  var SeqZIndex = {
3
- compound: 0,
4
- parallel: 1,
5
- actor: 10,
6
- step: 20
3
+ compound: 1,
4
+ subflows: 10,
5
+ actor: 50,
6
+ step: 100
7
7
  };
8
8
  var SeqParallelAreaColor = {
9
9
  default: "gray",
@@ -1,15 +1,31 @@
1
- import { BBox, DiagramNode, NonEmptyArray } from '@likec4/core/types';
1
+ import { BBox, DiagramNode, DynamicViewFlow, NonEmptyArray, StepPath } from '@likec4/core/types';
2
2
  import { Compound, Step } from './_types';
3
+ import * as kiwi from '@lume/kiwi';
4
+ export interface BBoxVars {
5
+ x1: kiwi.Expression | kiwi.Variable;
6
+ y1: kiwi.Expression | kiwi.Variable;
7
+ x2: kiwi.Expression | kiwi.Variable;
8
+ y2: kiwi.Expression | kiwi.Variable;
9
+ }
10
+ export declare const Strength: {
11
+ required: number;
12
+ strong: number;
13
+ medium: number;
14
+ soft: number;
15
+ weak: number;
16
+ };
3
17
  export declare class SequenceViewLayouter {
4
18
  #private;
5
- constructor({ actors, steps, compounds, }: {
19
+ constructor({ actors, steps, compounds, flow, collapsedFlows, }: {
6
20
  actors: NonEmptyArray<DiagramNode>;
7
21
  steps: Array<Step>;
8
22
  compounds: Array<Compound>;
23
+ flow: DynamicViewFlow;
24
+ collapsedFlows: StepPath[];
9
25
  });
10
- getParallelBoxes(): Array<BBox & {
11
- parallelPrefix: string;
12
- }>;
26
+ getSubflowAreas(): Array<{
27
+ id: StepPath;
28
+ } & BBox>;
13
29
  getActorBox(actor: DiagramNode): BBox;
14
30
  getCompoundBoxes(): Array<BBox & {
15
31
  node: DiagramNode;
@@ -20,6 +36,7 @@ export declare class SequenceViewLayouter {
20
36
  cy: number;
21
37
  height: number;
22
38
  };
39
+ isStepCollapsed(step: Step): boolean;
23
40
  getViewBounds(): {
24
41
  x: number;
25
42
  y: number;
@@ -29,9 +46,16 @@ export declare class SequenceViewLayouter {
29
46
  private actorBox;
30
47
  private addActors;
31
48
  private addStep;
32
- private addParallelRect;
49
+ /**
50
+ * Recursively adds a compound and its nested compounds to the layout.
51
+ * Also updates offsets of the actor boxes to accommodate the compound.
52
+ */
33
53
  private addCompound;
34
54
  private ensureRow;
55
+ private collapseRect;
56
+ private getRectBounds;
57
+ private wrapAroundRect;
58
+ private createSubflowAreas;
35
59
  private newVar;
36
60
  /**
37
61
  * Adds a required constraint: