@likec4/diagram 1.58.0 → 1.59.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.
- package/dist/LikeC4Diagram.js +1 -1
- package/dist/LikeC4Diagram.props.d.ts +1 -1
- package/dist/LikeC4Styles.js +1 -1
- package/dist/LikeC4View.js +2 -2
- package/dist/ReactLikeC4.d.ts +1 -1
- package/dist/base/Base.d.ts +3 -2
- package/dist/base/Base.js +14 -26
- package/dist/base/BaseXYFlow.d.ts +2 -1
- package/dist/base/BaseXYFlow.js +63 -4
- package/dist/base/keyboardZoom.d.ts +3 -0
- package/dist/base/keyboardZoom.js +20 -0
- package/dist/base/updateEdges.js +7 -16
- package/dist/base/updateNodes.js +3 -9
- package/dist/base-primitives/compound/CompoundActionButton.d.ts +2 -1
- package/dist/base-primitives/compound/CompoundActionButton.js +5 -2
- package/dist/base-primitives/compound/CompoundDetailsButton.d.ts +2 -1
- package/dist/base-primitives/compound/CompoundDetailsButton.js +5 -2
- package/dist/base-primitives/compound/CompoundTitle.d.ts +7 -1
- package/dist/base-primitives/compound/CompoundTitle.js +2 -1
- package/dist/base-primitives/compound/actionbtns.css.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeActionButton.d.ts +2 -1
- package/dist/base-primitives/edge/EdgeActionButton.js +2 -1
- package/dist/base-primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeContainer.js +4 -2
- package/dist/base-primitives/edge/EdgeLabel.d.ts +2 -0
- package/dist/base-primitives/edge/EdgeLabel.js +2 -5
- package/dist/base-primitives/element/ElementActionButtons.d.ts +1 -0
- package/dist/base-primitives/element/ElementActionButtons.js +4 -1
- package/dist/base-primitives/element/ElementData.d.ts +3 -1
- package/dist/base-primitives/element/ElementData.js +2 -1
- package/dist/base-primitives/element/ElementDetailsButton.d.ts +2 -1
- package/dist/base-primitives/element/ElementDetailsButton.js +5 -2
- package/dist/base-primitives/element/ElementNodeContainer.js +1 -1
- package/dist/base-primitives/element/ElementShape.js +3 -0
- package/dist/components/ErrorFallback.js +3 -5
- package/dist/components/Link.js +6 -6
- package/dist/components/NavigationPanel.js +1 -1
- package/dist/components/SearchControl.css.js +11 -11
- package/dist/context/TagStylesContext.d.ts +3 -3
- package/dist/context/TagStylesContext.js +16 -16
- package/dist/custom/index.d.ts +1 -0
- package/dist/custom/index.js +3 -2
- package/dist/editor/actor/actions.js +1 -1
- package/dist/editor/actor/machine.d.ts +4 -6
- package/dist/editor/actor/setup.d.ts +16 -2
- package/dist/editor/actor/setup.js +5 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/safeContext.d.ts +156 -3
- package/dist/hooks/safeContext.js +60 -12
- package/dist/hooks/useCurrentViewModel.js +1 -1
- package/dist/hooks/useDiagram.d.ts +8 -0
- package/dist/hooks/useDiagram.js +9 -2
- package/dist/hooks/useEditorActor.js +1 -1
- package/dist/hooks/useLikeC4ElementsTree.js +1 -1
- package/dist/hooks/useLikeC4Model.js +1 -1
- package/dist/hooks/useXYFlow.d.ts +1 -0
- package/dist/hooks/useXYFlow.js +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/likec4diagram/DiagramUI.js +19 -6
- package/dist/likec4diagram/DiagramXYFlow.js +39 -14
- package/dist/likec4diagram/convert-to-xyflow.d.ts +3 -5
- package/dist/likec4diagram/convert-to-xyflow.js +29 -10
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +13 -4
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +11 -4
- package/dist/likec4diagram/custom/edges/edges.css.js +1 -1
- package/dist/likec4diagram/custom/index.d.ts +2 -1
- package/dist/likec4diagram/custom/index.js +5 -3
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +1 -0
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.js +13 -3
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +0 -4
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +32 -19
- package/dist/likec4diagram/custom/nodes/SequenceSubFlow.d.ts +2 -0
- package/dist/likec4diagram/custom/nodes/SequenceSubFlow.js +234 -0
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.js +20 -5
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -14
- package/dist/likec4diagram/relationship-popover/components.d.ts +1 -1
- package/dist/likec4diagram/state/DiagramActorProvider.js +11 -20
- package/dist/likec4diagram/state/aligners.js +1 -1
- package/dist/likec4diagram/state/assign.d.ts +1 -1
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/createViewChange.js +1 -1
- package/dist/likec4diagram/state/diagram-api.d.ts +18 -10
- package/dist/likec4diagram/state/diagram-api.js +333 -229
- package/dist/likec4diagram/state/machine.actions.d.ts +1026 -332
- package/dist/likec4diagram/state/machine.actions.js +115 -44
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +123 -51
- package/dist/likec4diagram/state/machine.actions.layout.js +40 -33
- package/dist/likec4diagram/state/machine.d.ts +154 -16
- package/dist/likec4diagram/state/machine.js +5 -41
- package/dist/likec4diagram/state/machine.setup.d.ts +84 -19
- package/dist/likec4diagram/state/machine.setup.js +65 -12
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +59 -33
- package/dist/likec4diagram/state/machine.state.navigating.js +7 -3
- package/dist/likec4diagram/state/machine.state.ready.d.ts +1540 -476
- package/dist/likec4diagram/state/machine.state.ready.focused.d.ts +294 -53
- package/dist/likec4diagram/state/machine.state.ready.focused.js +3 -3
- package/dist/likec4diagram/state/machine.state.ready.idle.d.ts +264 -73
- package/dist/likec4diagram/state/machine.state.ready.idle.js +31 -6
- package/dist/likec4diagram/state/machine.state.ready.js +22 -16
- package/dist/likec4diagram/state/machine.state.ready.printing.d.ts +23 -9
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +288 -84
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +135 -66
- package/dist/likec4diagram/state/types.d.ts +4 -2
- package/dist/likec4diagram/state/utils.d.ts +7 -0
- package/dist/likec4diagram/state/utils.js +36 -34
- package/dist/likec4diagram/types.d.ts +47 -3
- package/dist/likec4diagram/ui/FloatingSequenceActors.d.ts +6 -0
- package/dist/likec4diagram/ui/FloatingSequenceActors.js +155 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +2 -2
- package/dist/likec4diagram/ui/index.d.ts +2 -0
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +5 -5
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.js +519 -0
- package/dist/likec4diagram/ui/sequence-outline/state.d.ts +36 -0
- package/dist/likec4diagram/ui/sequence-outline/state.js +55 -0
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +1 -1
- package/dist/likec4diagram/xyflow-diagram/diagram-view.js +112 -60
- package/dist/likec4diagram/xyflow-sequence/_types.d.ts +55 -5
- package/dist/likec4diagram/xyflow-sequence/const.d.ts +5 -5
- package/dist/likec4diagram/xyflow-sequence/const.js +4 -4
- package/dist/likec4diagram/xyflow-sequence/layouter.d.ts +30 -6
- package/dist/likec4diagram/xyflow-sequence/layouter.js +561 -0
- package/dist/likec4diagram/xyflow-sequence/{sequence-layout.d.ts → sequence-view-to-xy.d.ts} +8 -2
- package/dist/likec4diagram/xyflow-sequence/{sequence-layout.js → sequence-view-to-xy.js} +111 -14
- package/dist/likec4diagram/xyflow-sequence/sequence-view.d.ts +2 -7
- package/dist/likec4diagram/xyflow-sequence/sequence-view.js +144 -0
- package/dist/likec4diagram/xyflow-sequence/utils.d.ts +9 -1
- package/dist/likec4diagram/xyflow-sequence/utils.js +96 -0
- package/dist/navigationpanel/NavigationPanel.d.ts +5 -2
- package/dist/navigationpanel/NavigationPanel.js +58 -59
- package/dist/navigationpanel/NavigationPanelDropdown.js +45 -38
- package/dist/navigationpanel/_common.js +2 -2
- package/dist/navigationpanel/actor.actions.d.ts +19 -0
- package/dist/navigationpanel/actor.actions.js +45 -0
- package/dist/navigationpanel/actor.d.ts +34 -96
- package/dist/navigationpanel/actor.js +21 -84
- package/dist/navigationpanel/actor.setup.d.ts +98 -0
- package/dist/navigationpanel/actor.setup.js +31 -0
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +4 -5
- package/dist/navigationpanel/controls/DetailsControls.js +7 -8
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
- package/dist/navigationpanel/editorpanel/styles.js +8 -8
- package/dist/navigationpanel/hooks.d.ts +20 -5
- package/dist/navigationpanel/hooks.js +4 -18
- package/dist/navigationpanel/styles.css.d.ts +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +2 -2
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +4 -4
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +23 -25
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +5 -5
- package/dist/overlays/Overlays.d.ts +4 -2
- package/dist/overlays/Overlays.js +10 -10
- package/dist/overlays/element-details/ElementDetailsCard.css.js +17 -17
- package/dist/overlays/element-details/MetadataValue.js +15 -15
- package/dist/overlays/element-details/TabPanelDeployments.css.js +5 -5
- package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -11
- package/dist/overlays/element-details/TabPanelRelationships.js +1 -1
- package/dist/overlays/element-details/TabPanelStructure.css.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +1 -1
- package/dist/overlays/element-details/actor.d.ts +2 -3
- package/dist/overlays/hooks.d.ts +28 -0
- package/dist/overlays/hooks.js +5 -0
- package/dist/overlays/overlay/Overlay.js +34 -25
- package/dist/overlays/overlaysActor.js +0 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationship-details/layout.js +1 -1
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
- package/dist/overlays/relationships-browser/actor.js +79 -78
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationships-browser/hooks.js +1 -1
- package/dist/overlays/relationships-browser/layout.js +2 -2
- package/dist/projects-overview/actor.js +4 -4
- package/dist/search/Search.js +1 -1
- package/dist/search/components/ElementsColumn.css.js +2 -2
- package/dist/search/components/ViewsColum.js +1 -1
- package/dist/search/components/_shared.css.d.ts +1 -1
- package/dist/search/components/_shared.css.js +23 -23
- package/dist/search/components/styles.css.js +4 -4
- package/dist/shadowroot/ShadowRoot.d.ts +1 -1
- package/dist/shadowroot/ShadowRoot.js +76 -28
- package/dist/styles2.js +1 -1
- package/dist/utils/defineActors.d.ts +21 -0
- package/dist/utils/defineActors.js +13 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +5 -4
- package/dist/utils/readableText.d.ts +11 -0
- package/dist/utils/readableText.js +18 -0
- package/package.json +18 -30
- package/panda.buildinfo.json +267 -288
- package/styles-min.css +1 -1
- package/styles.css +1 -1
- package/adhoc-editor/package.json +0 -4
- package/dist/adhoc-editor/EditorPanel.d.ts +0 -1
- package/dist/adhoc-editor/EditorPanel.js +0 -106
- package/dist/adhoc-editor/ElementsTree.d.ts +0 -2
- package/dist/adhoc-editor/ElementsTree.js +0 -112
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.d.ts +0 -4
- package/dist/adhoc-editor/LikeC4AdHocViewEditor.js +0 -83
- package/dist/adhoc-editor/components/Tree.d.ts +0 -48
- package/dist/adhoc-editor/components/Tree.js +0 -213
- package/dist/adhoc-editor/hooks.d.ts +0 -14
- package/dist/adhoc-editor/hooks.js +0 -34
- package/dist/adhoc-editor/index.d.ts +0 -2
- package/dist/adhoc-editor/index.js +0 -2
- package/dist/adhoc-editor/state/ActorProvider.d.ts +0 -5
- package/dist/adhoc-editor/state/ActorProvider.js +0 -37
- package/dist/adhoc-editor/state/actor.d.ts +0 -13
- package/dist/adhoc-editor/state/actor.editor.d.ts +0 -56
- package/dist/adhoc-editor/state/actor.editor.js +0 -167
- package/dist/adhoc-editor/state/actor.js +0 -14
- package/dist/adhoc-editor/state/actor.layouter.d.ts +0 -51
- package/dist/adhoc-editor/state/actor.layouter.js +0 -54
- package/dist/adhoc-editor/state/actor.types.d.ts +0 -63
- package/dist/adhoc-editor/state/actor.types.js +0 -25
- package/dist/adhoc-editor/state/panel.d.ts +0 -95
- package/dist/adhoc-editor/state/panel.js +0 -124
- package/dist/adhoc-editor/state/utils.d.ts +0 -17
- package/dist/adhoc-editor/state/utils.js +0 -25
- package/dist/adhoc-editor/useElementsTree.d.ts +0 -18
- package/dist/adhoc-editor/useElementsTree.js +0 -98
- package/dist/adhoc-editor/viewrules/ViewRulesPanel.d.ts +0 -6
- package/dist/context/ShadowRootContext.d.ts +0 -3
- package/dist/context/ShadowRootContext.js +0 -5
- package/dist/shadowroot/styles.d.ts +0 -13
- 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
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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,
|
|
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:
|
|
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
|
-
|
|
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
|
|
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 =
|
|
2
|
-
export declare const COLUMN_GAP =
|
|
3
|
-
export declare const MIN_ROW_HEIGHT =
|
|
4
|
-
export declare const PORT_HEIGHT =
|
|
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
|
-
|
|
10
|
+
subflows: number;
|
|
11
11
|
actor: number;
|
|
12
12
|
step: number;
|
|
13
13
|
};
|
|
@@ -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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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:
|