@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.
- package/bundle/{chunk-CW_KClZe.js → chunk-FGcODVxo.js} +1059 -1023
- package/bundle/custom.js +61 -60
- package/bundle/index.js +2932 -764
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +7 -4
- package/dist/LikeC4Diagram.props.d.ts +6 -1
- package/dist/base/const.d.ts +9 -0
- package/dist/base/const.js +10 -1
- package/dist/base/index.d.ts +1 -0
- package/dist/base/primitives/MarkdownBlock.js +2 -0
- package/dist/base/primitives/edge/EdgeLabel.js +2 -1
- package/dist/base/primitives/edge/EdgeLabelContainer.js +10 -4
- package/dist/base/primitives/edge/EdgePath.js +17 -8
- package/dist/base/primitives/edge/edge.css.d.ts +0 -1
- package/dist/base/primitives/edge/edge.css.js +6 -14
- package/dist/base/primitives/element/ElementActionButtons.js +1 -3
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +0 -6
- package/dist/base/primitives/element/ElementNodeContainer.js +3 -26
- package/dist/base/primitives/element/ElementTitle.js +2 -2
- package/dist/base/types.d.ts +3 -3
- package/dist/bundle/LikeC4View.js +4 -12
- package/dist/bundle/LikeC4View.props.d.ts +12 -3
- package/dist/bundle/custom.js +1 -1
- package/dist/components/Link.js +28 -20
- package/dist/custom/customNodes.d.ts +6 -0
- package/dist/custom/customNodes.js +2 -1
- package/dist/custom/index.js +1 -1
- package/dist/hooks/useDiagram.d.ts +5 -1
- package/dist/hooks/useDiagram.js +3 -0
- package/dist/hooks/useXYFlow.d.ts +4 -439
- package/dist/likec4diagram/DiagramUI.js +1 -1
- package/dist/likec4diagram/DiagramXYFlow.js +8 -4
- package/dist/likec4diagram/convert-to-xyflow.d.ts +14 -0
- package/dist/likec4diagram/convert-to-xyflow.js +29 -0
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +4 -4
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +0 -1
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.d.ts +3 -0
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +71 -0
- package/dist/likec4diagram/custom/index.js +7 -2
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +2 -1
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.d.ts +4 -0
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +157 -0
- package/dist/likec4diagram/custom/nodes/index.d.ts +1 -0
- package/dist/likec4diagram/custom/nodes/nodes.d.ts +1 -2
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +31 -27
- package/dist/likec4diagram/types.d.ts +41 -7
- package/dist/likec4diagram/xyflow-diagram/diagram-view.d.ts +11 -0
- package/dist/likec4diagram/{useViewToNodesEdges.js → xyflow-diagram/diagram-view.js} +4 -13
- package/dist/likec4diagram/xyflow-sequence/_types.d.ts +41 -0
- package/dist/likec4diagram/xyflow-sequence/const.d.ts +17 -0
- package/dist/likec4diagram/xyflow-sequence/const.js +16 -0
- package/dist/likec4diagram/xyflow-sequence/layouter.d.ts +46 -0
- package/dist/likec4diagram/xyflow-sequence/layouter.js +408 -0
- package/dist/likec4diagram/xyflow-sequence/sequence-view.d.ts +7 -0
- package/dist/likec4diagram/xyflow-sequence/sequence-view.js +273 -0
- package/dist/likec4diagram/xyflow-sequence/utils.d.ts +14 -0
- package/dist/likec4diagram/xyflow-sequence/utils.js +92 -0
- package/dist/navigationpanel/NavigationPanelControls.js +2 -2
- package/dist/navigationpanel/controls/ViewDetailsCard.js +27 -12
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +53 -44
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.d.ts +1 -2
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +10 -41
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +292 -0
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +119 -0
- package/dist/navigationpanel/walkthrough/index.d.ts +2 -1
- package/dist/overlays/element-details/ElementDetailsCard.css.js +7 -1
- package/dist/overlays/element-details/ElementDetailsCard.js +17 -19
- package/dist/overlays/relationship-details/RelationshipDetails.js +4 -1
- package/dist/overlays/relationship-details/layout.d.ts +3 -2
- package/dist/overlays/relationship-details/layout.js +1 -2
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +2 -1
- package/dist/overlays/relationships-browser/layout.js +1 -1
- package/dist/search/components/ElementsColumn.js +1 -1
- package/dist/state/DiagramActorProvider.d.ts +3 -2
- package/dist/state/DiagramActorProvider.js +40 -41
- package/dist/state/assign.js +11 -4
- package/dist/state/diagram-machine.d.ts +224 -194
- package/dist/state/diagram-machine.js +170 -63
- package/dist/state/utils.d.ts +7 -1
- package/dist/state/utils.js +67 -7
- package/dist/styles-min.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css2.js +1 -1
- package/package.json +8 -7
- package/panda.buildinfo.json +45 -24
- package/src/LikeC4Diagram.props.ts +14 -1
- package/src/LikeC4Diagram.tsx +7 -4
- package/src/base/const.ts +12 -0
- package/src/base/index.ts +2 -0
- package/src/base/primitives/MarkdownBlock.tsx +2 -0
- package/src/base/primitives/edge/EdgeLabel.tsx +23 -19
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +12 -7
- package/src/base/primitives/edge/EdgePath.tsx +25 -14
- package/src/base/primitives/edge/edge.css.ts +5 -14
- package/src/base/primitives/element/ElementActionButtons.tsx +1 -3
- package/src/base/primitives/element/ElementNodeContainer.tsx +3 -30
- package/src/base/primitives/element/ElementTitle.tsx +2 -3
- package/src/base/types.ts +7 -5
- package/src/bundle/LikeC4View.props.ts +14 -3
- package/src/bundle/LikeC4View.tsx +4 -14
- package/src/bundle/ReactLikeC4.tsx +1 -2
- package/src/components/Link.tsx +21 -18
- package/src/custom/customNodes.ts +7 -0
- package/src/hooks/useDiagram.ts +10 -0
- package/src/likec4diagram/DiagramUI.tsx +1 -1
- package/src/likec4diagram/DiagramXYFlow.tsx +10 -5
- package/src/likec4diagram/convert-to-xyflow.ts +45 -0
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +0 -1
- package/src/likec4diagram/custom/edges/SequenceStepEdge.tsx +65 -0
- package/src/likec4diagram/custom/index.ts +7 -1
- package/src/likec4diagram/custom/nodes/ElementActions.tsx +4 -2
- package/src/likec4diagram/custom/nodes/SequenceActorNode.tsx +175 -0
- package/src/likec4diagram/custom/nodes/index.ts +1 -0
- package/src/likec4diagram/custom/nodes/nodes.tsx +1 -1
- package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +36 -30
- package/src/likec4diagram/types.ts +96 -13
- package/src/likec4diagram/{useViewToNodesEdges.ts → xyflow-diagram/diagram-view.ts} +7 -28
- package/src/likec4diagram/xyflow-sequence/_types.ts +45 -0
- package/src/likec4diagram/xyflow-sequence/const.ts +37 -0
- package/src/likec4diagram/xyflow-sequence/layouter.ts +567 -0
- package/src/likec4diagram/xyflow-sequence/sequence-view.ts +337 -0
- package/src/likec4diagram/xyflow-sequence/utils.ts +112 -0
- package/src/navigationpanel/NavigationPanelControls.tsx +2 -2
- package/src/navigationpanel/controls/ViewDetailsCard.tsx +29 -12
- package/src/navigationpanel/dropdown/ProjectsMenu.tsx +5 -1
- package/src/navigationpanel/walkthrough/ActiveWalkthroughControls.tsx +5 -40
- package/src/navigationpanel/walkthrough/DynamicViewControls.tsx +125 -0
- package/src/navigationpanel/walkthrough/index.tsx +2 -1
- package/src/overlays/element-details/ElementDetailsCard.css.ts +7 -1
- package/src/overlays/element-details/ElementDetailsCard.tsx +24 -25
- package/src/overlays/relationship-details/RelationshipDetails.tsx +5 -2
- package/src/overlays/relationship-details/layout.ts +4 -3
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +2 -1
- package/src/overlays/relationships-browser/layout.ts +1 -1
- package/src/search/components/ElementsColumn.tsx +1 -1
- package/src/state/DiagramActorProvider.tsx +46 -51
- package/src/state/assign.ts +18 -5
- package/src/state/diagram-machine.ts +207 -75
- package/src/state/utils.ts +81 -7
- package/dist/likec4diagram/useViewToNodesEdges.d.ts +0 -12
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Stack, isAncestor, nonNullable } from '@likec4/core/utils';
|
|
2
|
+
import { pipe, groupBy, mapValues, values } from 'remeda';
|
|
3
|
+
|
|
4
|
+
function findParallelRects(steps) {
|
|
5
|
+
return pipe(
|
|
6
|
+
steps,
|
|
7
|
+
groupBy((s) => s.parallelPrefix ?? void 0),
|
|
8
|
+
mapValues((steps2, parallelPrefix) => {
|
|
9
|
+
return steps2.reduce(
|
|
10
|
+
(acc, step) => {
|
|
11
|
+
acc.min.column = Math.min(acc.min.column, step.from.column, step.to.column);
|
|
12
|
+
acc.min.row = Math.min(acc.min.row, step.from.row, step.to.row);
|
|
13
|
+
acc.max.column = Math.max(acc.max.column, step.from.column, step.to.column);
|
|
14
|
+
acc.max.row = Math.max(acc.max.row, step.from.row, step.to.row);
|
|
15
|
+
return acc;
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
parallelPrefix,
|
|
19
|
+
min: {
|
|
20
|
+
column: Infinity,
|
|
21
|
+
row: Infinity
|
|
22
|
+
},
|
|
23
|
+
max: {
|
|
24
|
+
column: -Infinity,
|
|
25
|
+
row: -Infinity
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}),
|
|
30
|
+
values()
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function buildCompounds(actors, nodes) {
|
|
34
|
+
if (actors.length === 0 || actors.length === nodes.length) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const getNode = (id) => nonNullable(nodes.find((n) => n.id === id));
|
|
38
|
+
function parentsLookup(node) {
|
|
39
|
+
const parent = node.parent ? getNode(node.parent) : null;
|
|
40
|
+
if (parent) {
|
|
41
|
+
return [parent, ...parentsLookup(parent)];
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const stack = new Stack();
|
|
46
|
+
const result = [];
|
|
47
|
+
actors.forEach((actor) => {
|
|
48
|
+
const _ancestors = parentsLookup(actor);
|
|
49
|
+
if (_ancestors.length === 0) {
|
|
50
|
+
stack.clear();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const ancestors = Stack.from(_ancestors);
|
|
54
|
+
let compound;
|
|
55
|
+
let parent;
|
|
56
|
+
while (true) {
|
|
57
|
+
compound = stack.peek()?.node;
|
|
58
|
+
parent = ancestors.peek();
|
|
59
|
+
if (!parent || !compound) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
if (isAncestor(parent.id, compound.id) || parent.id === compound.id) {
|
|
63
|
+
ancestors.pop();
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (!isAncestor(compound.id, parent.id)) {
|
|
67
|
+
stack.pop();
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
while (parent = ancestors.pop()) {
|
|
73
|
+
const parentAsCompound = {
|
|
74
|
+
node: parent,
|
|
75
|
+
from: actor,
|
|
76
|
+
to: actor,
|
|
77
|
+
nested: []
|
|
78
|
+
};
|
|
79
|
+
let compound2 = stack.peek();
|
|
80
|
+
if (!compound2) {
|
|
81
|
+
result.push(parentAsCompound);
|
|
82
|
+
} else {
|
|
83
|
+
compound2.nested.push(parentAsCompound);
|
|
84
|
+
}
|
|
85
|
+
stack.push(parentAsCompound);
|
|
86
|
+
}
|
|
87
|
+
stack.forEach((c) => c.to = actor);
|
|
88
|
+
});
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { buildCompounds, findParallelRects };
|
|
@@ -15,7 +15,7 @@ import { NavigationButtons } from './controls/NavigationButtons.js';
|
|
|
15
15
|
import { ViewDetailsCard } from './controls/ViewDetailsCard.js';
|
|
16
16
|
import { OpenSource } from './controls/OpenSource.js';
|
|
17
17
|
import { ToggleReadonly } from './controls/ToggleReadonly.js';
|
|
18
|
-
import {
|
|
18
|
+
import { DynamicViewControls } from './walkthrough/DynamicViewControls.js';
|
|
19
19
|
import { SearchControl } from './controls/SearchControl.js';
|
|
20
20
|
|
|
21
21
|
const selectBreadcrumbs = ({ context }) => {
|
|
@@ -139,7 +139,7 @@ const NavigationPanelControls = () => {
|
|
|
139
139
|
},
|
|
140
140
|
"actions"
|
|
141
141
|
),
|
|
142
|
-
enableDynamicViewWalkthrough && isDynamicView && /* @__PURE__ */ jsx(
|
|
142
|
+
enableDynamicViewWalkthrough && isDynamicView && /* @__PURE__ */ jsx(DynamicViewControls, {}, "dynamic-view-controls"),
|
|
143
143
|
enableSearch && /* @__PURE__ */ jsx(SearchControl, {}, "search-control")
|
|
144
144
|
] });
|
|
145
145
|
};
|
|
@@ -4,8 +4,9 @@ import { HStack, Box, styled } from '@likec4/styles/jsx';
|
|
|
4
4
|
import { hstack, vstack } from '@likec4/styles/patterns';
|
|
5
5
|
import { Popover, UnstyledButton, Text, Badge } from '@mantine/core';
|
|
6
6
|
import * as m from 'motion/react-m';
|
|
7
|
+
import { useState } from 'react';
|
|
7
8
|
import { Link } from '../../components/Link.js';
|
|
8
|
-
import { useDiagram } from '../../hooks/useDiagram.js';
|
|
9
|
+
import { useDiagram, useOnDiagramEvent } from '../../hooks/useDiagram.js';
|
|
9
10
|
import { useMantinePortalProps } from '../../hooks/useMantinePortalProps.js';
|
|
10
11
|
import { useNavigationActorSnapshot } from '../hooks.js';
|
|
11
12
|
import IconId from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconId.js';
|
|
@@ -25,6 +26,7 @@ const selector = ({ context }) => {
|
|
|
25
26
|
};
|
|
26
27
|
};
|
|
27
28
|
const ViewDetailsCard = (props) => {
|
|
29
|
+
const [opened, setOpened] = useState(false);
|
|
28
30
|
const data = useNavigationActorSnapshot(selector);
|
|
29
31
|
const portalProps = useMantinePortalProps();
|
|
30
32
|
return /* @__PURE__ */ jsxs(
|
|
@@ -33,17 +35,21 @@ const ViewDetailsCard = (props) => {
|
|
|
33
35
|
position: "bottom-end",
|
|
34
36
|
shadow: "xl",
|
|
35
37
|
clickOutsideEvents: ["pointerdown", "mousedown", "click"],
|
|
36
|
-
|
|
38
|
+
offset: {
|
|
39
|
+
mainAxis: 4
|
|
40
|
+
},
|
|
41
|
+
opened,
|
|
42
|
+
onChange: setOpened,
|
|
37
43
|
...portalProps,
|
|
38
44
|
...props,
|
|
39
45
|
children: [
|
|
40
|
-
/* @__PURE__ */ jsx(ViewDetailsCardTrigger, { linksCount: data.links.length }),
|
|
41
|
-
/* @__PURE__ */ jsx(ViewDetailsCardDropdown, { data })
|
|
46
|
+
/* @__PURE__ */ jsx(ViewDetailsCardTrigger, { linksCount: data.links.length, onOpen: () => setOpened(true) }),
|
|
47
|
+
opened && /* @__PURE__ */ jsx(ViewDetailsCardDropdown, { data, onClose: () => setOpened(false) })
|
|
42
48
|
]
|
|
43
49
|
}
|
|
44
50
|
);
|
|
45
51
|
};
|
|
46
|
-
const ViewDetailsCardTrigger = ({ linksCount }) => /* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsxs(
|
|
52
|
+
const ViewDetailsCardTrigger = ({ linksCount, onOpen }) => /* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsxs(
|
|
47
53
|
UnstyledButton,
|
|
48
54
|
{
|
|
49
55
|
component: m.button,
|
|
@@ -52,12 +58,16 @@ const ViewDetailsCardTrigger = ({ linksCount }) => /* @__PURE__ */ jsx(Popover.T
|
|
|
52
58
|
scale: 0.95,
|
|
53
59
|
translateY: 1
|
|
54
60
|
},
|
|
61
|
+
onClick: (e) => {
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
onOpen();
|
|
64
|
+
},
|
|
55
65
|
className: cx(
|
|
56
66
|
"group",
|
|
57
67
|
hstack({
|
|
58
68
|
gap: "2",
|
|
59
|
-
paddingInline: "
|
|
60
|
-
paddingBlock: "
|
|
69
|
+
paddingInline: "2",
|
|
70
|
+
paddingBlock: "1",
|
|
61
71
|
rounded: "sm",
|
|
62
72
|
userSelect: "none",
|
|
63
73
|
cursor: "pointer",
|
|
@@ -112,9 +122,12 @@ const ViewDetailsCardDropdown = ({
|
|
|
112
122
|
tags,
|
|
113
123
|
links,
|
|
114
124
|
relativePath
|
|
115
|
-
}
|
|
125
|
+
},
|
|
126
|
+
onClose
|
|
116
127
|
}) => {
|
|
117
128
|
const diagram = useDiagram();
|
|
129
|
+
useOnDiagramEvent("paneClick", onClose);
|
|
130
|
+
useOnDiagramEvent("nodeClick", onClose);
|
|
118
131
|
return /* @__PURE__ */ jsxs(
|
|
119
132
|
Popover.Dropdown,
|
|
120
133
|
{
|
|
@@ -125,9 +138,10 @@ const ViewDetailsCardDropdown = ({
|
|
|
125
138
|
layerStyle: "likec4.dropdown",
|
|
126
139
|
gap: "md",
|
|
127
140
|
padding: "md",
|
|
141
|
+
paddingBottom: "lg",
|
|
128
142
|
pointerEvents: "all",
|
|
129
|
-
maxWidth: "calc(100cqw -
|
|
130
|
-
minWidth: "
|
|
143
|
+
maxWidth: "calc(100cqw - 52px)",
|
|
144
|
+
minWidth: "200px",
|
|
131
145
|
maxHeight: "calc(100cqh - 100px)",
|
|
132
146
|
width: "max-content",
|
|
133
147
|
cursor: "default",
|
|
@@ -144,7 +158,7 @@ const ViewDetailsCardDropdown = ({
|
|
|
144
158
|
),
|
|
145
159
|
children: [
|
|
146
160
|
/* @__PURE__ */ jsxs("section", { children: [
|
|
147
|
-
/* @__PURE__ */ jsx(Text, { component: "div", fw: 500, size: "xl", children: title }),
|
|
161
|
+
/* @__PURE__ */ jsx(Text, { component: "div", fw: 500, size: "xl", lh: "sm", children: title }),
|
|
148
162
|
/* @__PURE__ */ jsxs(HStack, { alignItems: "flex-start", mt: "1", children: [
|
|
149
163
|
/* @__PURE__ */ jsx(ViewBadge, { label: "id", value: id }),
|
|
150
164
|
/* @__PURE__ */ jsx(HStack, { gap: "xs", flexWrap: "wrap", children: tags.map((tag, i) => /* @__PURE__ */ jsx(
|
|
@@ -165,7 +179,7 @@ const ViewDetailsCardDropdown = ({
|
|
|
165
179
|
/* @__PURE__ */ jsx(SectionHeader, { children: "Links" }),
|
|
166
180
|
/* @__PURE__ */ jsx(HStack, { gap: "xs", flexWrap: "wrap", children: links.map((link, i) => /* @__PURE__ */ jsx(Link, { value: link }, `${i}-${link.url}`)) })
|
|
167
181
|
] }),
|
|
168
|
-
description.isEmpty && /* @__PURE__ */ jsx(Text, { component: "div", fw: 500, size: "xs", c: "dimmed",
|
|
182
|
+
description.isEmpty && /* @__PURE__ */ jsx(Text, { component: "div", fw: 500, size: "xs", c: "dimmed", style: { userSelect: "none" }, children: "No description" }),
|
|
169
183
|
description.nonEmpty && /* @__PURE__ */ jsxs("section", { children: [
|
|
170
184
|
/* @__PURE__ */ jsx(SectionHeader, { children: "Description" }),
|
|
171
185
|
/* @__PURE__ */ jsx(
|
|
@@ -205,6 +219,7 @@ const ViewBadge = ({
|
|
|
205
219
|
overflow: "visible",
|
|
206
220
|
px: "1",
|
|
207
221
|
color: {
|
|
222
|
+
_dark: "mantine.colors.gray[4]",
|
|
208
223
|
_light: "mantine.colors.gray[8]"
|
|
209
224
|
}
|
|
210
225
|
}),
|
|
@@ -24,51 +24,60 @@ function ProjectsMenu(props) {
|
|
|
24
24
|
children: "Project"
|
|
25
25
|
}
|
|
26
26
|
),
|
|
27
|
-
/* @__PURE__ */ jsxs(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
color:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
e.stopPropagation();
|
|
63
|
-
return;
|
|
27
|
+
/* @__PURE__ */ jsxs(
|
|
28
|
+
Menu,
|
|
29
|
+
{
|
|
30
|
+
withinPortal: false,
|
|
31
|
+
shadow: "md",
|
|
32
|
+
position: "bottom-start",
|
|
33
|
+
offset: { mainAxis: 2 },
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx(MenuTarget, { children: /* @__PURE__ */ jsx(
|
|
36
|
+
Button,
|
|
37
|
+
{
|
|
38
|
+
tabIndex: -1,
|
|
39
|
+
autoFocus: false,
|
|
40
|
+
variant: "subtle",
|
|
41
|
+
size: "compact-xs",
|
|
42
|
+
color: "gray",
|
|
43
|
+
classNames: {
|
|
44
|
+
root: css({
|
|
45
|
+
fontWeight: "400",
|
|
46
|
+
fontSize: "xxs",
|
|
47
|
+
height: "auto",
|
|
48
|
+
lineHeight: 1.1,
|
|
49
|
+
color: {
|
|
50
|
+
_light: "mantine.colors.gray[9]"
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
section: css({
|
|
54
|
+
'&:is([data-position="right"])': {
|
|
55
|
+
marginInlineStart: "1"
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
rightSection: /* @__PURE__ */ jsx(IconChevronDown, { opacity: 0.5, size: 12, stroke: 1.5 }),
|
|
60
|
+
...props,
|
|
61
|
+
children: projectId
|
|
64
62
|
}
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
) }),
|
|
64
|
+
/* @__PURE__ */ jsx(MenuDropdown, { children: projects.map(({ id, title }) => /* @__PURE__ */ jsx(
|
|
65
|
+
MenuItem,
|
|
66
|
+
{
|
|
67
|
+
onClick: (e) => {
|
|
68
|
+
if (projectId === id) {
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
onProjectChange(id);
|
|
73
|
+
},
|
|
74
|
+
children: title ?? id
|
|
75
|
+
},
|
|
76
|
+
id
|
|
77
|
+
)) })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
)
|
|
72
81
|
] });
|
|
73
82
|
}
|
|
74
83
|
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
export declare const ActiveWalkthroughControls: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function ActiveWalkthroughControls(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { RichText } from '@likec4/core';
|
|
3
2
|
import { css } from '@likec4/styles/css';
|
|
4
3
|
import { Box } from '@likec4/styles/jsx';
|
|
5
4
|
import { Button, Badge, Portal } from '@mantine/core';
|
|
@@ -7,42 +6,12 @@ import { AnimatePresence } from 'motion/react';
|
|
|
7
6
|
import * as m from 'motion/react-m';
|
|
8
7
|
import { isTruthy } from 'remeda';
|
|
9
8
|
import { useDiagram, useDiagramContext } from '../../hooks/useDiagram.js';
|
|
10
|
-
import {
|
|
11
|
-
import { useNavigationActor } from '../hooks.js';
|
|
9
|
+
import { TriggerWalkthroughButton } from './DynamicViewControls.js';
|
|
12
10
|
import IconPlayerStopFilled from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerStopFilled.js';
|
|
13
11
|
import IconPlayerSkipBackFilled from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipBackFilled.js';
|
|
14
12
|
import IconPlayerSkipForwardFilled from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerSkipForwardFilled.js';
|
|
15
13
|
import { useMantinePortalProps } from '../../hooks/useMantinePortalProps.js';
|
|
16
|
-
import IconPlayerPlayFilled from '../../node_modules/.pnpm/@tabler_icons-react@3.34.1_react@19.1.1/node_modules/@tabler/icons-react/dist/esm/icons/IconPlayerPlayFilled.js';
|
|
17
14
|
|
|
18
|
-
const TriggerWalkthroughButton = Button.withProps({
|
|
19
|
-
// Button is polymorphic, but we dont want it to inherit the motion props
|
|
20
|
-
component: m.button,
|
|
21
|
-
// @ts-expect-error
|
|
22
|
-
layoutId: "trigger-dynamic-walkthrough",
|
|
23
|
-
variant: "filled",
|
|
24
|
-
size: "xs",
|
|
25
|
-
fw: "500",
|
|
26
|
-
className: css({
|
|
27
|
-
flexShrink: 0
|
|
28
|
-
})
|
|
29
|
-
});
|
|
30
|
-
const StartWalkthroughButton = () => {
|
|
31
|
-
const diagram = useDiagram();
|
|
32
|
-
const actor = useNavigationActor();
|
|
33
|
-
return /* @__PURE__ */ jsx(Tooltip, { label: "Start Dynamic View Walkthrough", children: /* @__PURE__ */ jsx(
|
|
34
|
-
TriggerWalkthroughButton,
|
|
35
|
-
{
|
|
36
|
-
onClick: (e) => {
|
|
37
|
-
e.stopPropagation();
|
|
38
|
-
actor.closeDropdown();
|
|
39
|
-
diagram.startWalkthrough();
|
|
40
|
-
},
|
|
41
|
-
rightSection: /* @__PURE__ */ jsx(IconPlayerPlayFilled, { size: 10 }),
|
|
42
|
-
children: "Start"
|
|
43
|
-
}
|
|
44
|
-
) });
|
|
45
|
-
};
|
|
46
15
|
const PrevNextButton = Button.withProps({
|
|
47
16
|
// Button is polymorphic, but we dont want it to inherit the motion props
|
|
48
17
|
component: m.button,
|
|
@@ -73,15 +42,14 @@ const ParallelFrame = () => {
|
|
|
73
42
|
}
|
|
74
43
|
) });
|
|
75
44
|
};
|
|
76
|
-
|
|
45
|
+
function ActiveWalkthroughControls() {
|
|
77
46
|
const diagram = useDiagram();
|
|
78
47
|
const {
|
|
79
48
|
isParallel,
|
|
80
49
|
hasNext,
|
|
81
50
|
hasPrevious,
|
|
82
51
|
currentStep,
|
|
83
|
-
totalSteps
|
|
84
|
-
notes
|
|
52
|
+
totalSteps
|
|
85
53
|
} = useDiagramContext((s) => {
|
|
86
54
|
const currentStepIndex = s.xyedges.findIndex((e) => e.id === s.activeWalkthrough?.stepId);
|
|
87
55
|
return {
|
|
@@ -89,8 +57,7 @@ const ActiveWalkthroughControls = () => {
|
|
|
89
57
|
hasNext: currentStepIndex < s.xyedges.length - 1,
|
|
90
58
|
hasPrevious: currentStepIndex > 0,
|
|
91
59
|
currentStep: currentStepIndex + 1,
|
|
92
|
-
totalSteps: s.xyedges.length
|
|
93
|
-
notes: s.xyedges[currentStepIndex]?.data?.notes ?? RichText.EMPTY
|
|
60
|
+
totalSteps: s.xyedges.length
|
|
94
61
|
};
|
|
95
62
|
});
|
|
96
63
|
return /* @__PURE__ */ jsxs(AnimatePresence, { propagate: true, children: [
|
|
@@ -98,6 +65,7 @@ const ActiveWalkthroughControls = () => {
|
|
|
98
65
|
TriggerWalkthroughButton,
|
|
99
66
|
{
|
|
100
67
|
variant: "light",
|
|
68
|
+
size: "xs",
|
|
101
69
|
color: "orange",
|
|
102
70
|
mr: "sm",
|
|
103
71
|
onClick: (e) => {
|
|
@@ -106,7 +74,8 @@ const ActiveWalkthroughControls = () => {
|
|
|
106
74
|
},
|
|
107
75
|
rightSection: /* @__PURE__ */ jsx(IconPlayerStopFilled, { size: 10 }),
|
|
108
76
|
children: "Stop"
|
|
109
|
-
}
|
|
77
|
+
},
|
|
78
|
+
"stop-walkthrough"
|
|
110
79
|
),
|
|
111
80
|
/* @__PURE__ */ jsx(
|
|
112
81
|
PrevNextButton,
|
|
@@ -157,8 +126,8 @@ const ActiveWalkthroughControls = () => {
|
|
|
157
126
|
},
|
|
158
127
|
"next"
|
|
159
128
|
),
|
|
160
|
-
isParallel && /* @__PURE__ */ jsx(ParallelFrame, {})
|
|
129
|
+
isParallel && /* @__PURE__ */ jsx(ParallelFrame, {}, "parallel-frame")
|
|
161
130
|
] });
|
|
162
|
-
}
|
|
131
|
+
}
|
|
163
132
|
|
|
164
|
-
export { ActiveWalkthroughControls
|
|
133
|
+
export { ActiveWalkthroughControls };
|