@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.
- 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 +540 -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 +566 -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 +270 -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
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { selectDiagramContext, useDiagram, useDiagramSelector } from "../../../hooks/safeContext.js";
|
|
3
|
+
import { useOnDiagramEvent } from "../../../hooks/useDiagram.js";
|
|
4
|
+
import { Markdown } from "../../../base-primitives/Markdown.js";
|
|
5
|
+
import { PortalToContainer } from "../../../components/PortalToContainer.js";
|
|
6
|
+
import { useTreeData } from "./state.js";
|
|
7
|
+
import { css, cx } from "@likec4/styles/css";
|
|
8
|
+
import { IconAlertTriangle, IconArrowFork, IconArrowGuide, IconArrowRight, IconChevronRight, IconCornerDownRight, IconDirectionSignFilled, IconListTree, IconPlayerSkipBackFilled, IconPlayerSkipForwardFilled, IconPlayerStop, IconRepeat } from "@tabler/icons-react";
|
|
9
|
+
import { memo, useMemo } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { mapToObj, only } from "remeda";
|
|
12
|
+
import { RichText, dynamicViewFlow, flowAncestors, hasProp, isDynamicView } from "@likec4/core";
|
|
13
|
+
import { ActionIcon, Button, CloseButton, ScrollArea, Spoiler, Tooltip, Tree, useTree } from "@mantine/core";
|
|
14
|
+
import { AnimatePresence, m } from "motion/react";
|
|
15
|
+
import { Box as Box$1, HStack, Txt, VStack, styled } from "@likec4/styles/jsx";
|
|
16
|
+
import { vstack } from "@likec4/styles/patterns";
|
|
17
|
+
import { extractViewTitleFromPath } from "@likec4/core/model";
|
|
18
|
+
//#region src/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.tsx
|
|
19
|
+
/**
|
|
20
|
+
* PandaCSS `colorPalette` classes for each sub-flow palette.
|
|
21
|
+
* Declared as literals so the static analyzer can extract them.
|
|
22
|
+
*/
|
|
23
|
+
var palette = {
|
|
24
|
+
loop: css({ colorPalette: "subflow.loop" }),
|
|
25
|
+
opt: css({ colorPalette: "subflow.opt" }),
|
|
26
|
+
par: css({ colorPalette: "subflow.par" }),
|
|
27
|
+
break: css({ colorPalette: "subflow.break" }),
|
|
28
|
+
alt: css({ colorPalette: "subflow.alt" }),
|
|
29
|
+
try: css({ colorPalette: "subflow.try" })
|
|
30
|
+
};
|
|
31
|
+
var flowPresentation = {
|
|
32
|
+
loop: {
|
|
33
|
+
paletteClass: palette.loop,
|
|
34
|
+
tag: "loop",
|
|
35
|
+
Icon: IconRepeat
|
|
36
|
+
},
|
|
37
|
+
opt: {
|
|
38
|
+
paletteClass: palette.opt,
|
|
39
|
+
tag: "opt",
|
|
40
|
+
Icon: IconArrowGuide
|
|
41
|
+
},
|
|
42
|
+
par: {
|
|
43
|
+
paletteClass: palette.par,
|
|
44
|
+
tag: "par",
|
|
45
|
+
Icon: IconArrowFork
|
|
46
|
+
},
|
|
47
|
+
break: {
|
|
48
|
+
paletteClass: palette.break,
|
|
49
|
+
tag: "break",
|
|
50
|
+
Icon: IconPlayerStop
|
|
51
|
+
},
|
|
52
|
+
alt: {
|
|
53
|
+
paletteClass: palette.alt,
|
|
54
|
+
tag: "alt",
|
|
55
|
+
Icon: IconArrowFork
|
|
56
|
+
},
|
|
57
|
+
"alt-when": {
|
|
58
|
+
paletteClass: palette.alt,
|
|
59
|
+
tag: "when",
|
|
60
|
+
Icon: IconCornerDownRight
|
|
61
|
+
},
|
|
62
|
+
"alt-else": {
|
|
63
|
+
paletteClass: palette.alt,
|
|
64
|
+
tag: "else",
|
|
65
|
+
Icon: IconCornerDownRight
|
|
66
|
+
},
|
|
67
|
+
"alt-if": {
|
|
68
|
+
paletteClass: palette.alt,
|
|
69
|
+
tag: "if",
|
|
70
|
+
Icon: IconCornerDownRight
|
|
71
|
+
},
|
|
72
|
+
try: {
|
|
73
|
+
paletteClass: palette.try,
|
|
74
|
+
tag: "try",
|
|
75
|
+
Icon: IconAlertTriangle
|
|
76
|
+
},
|
|
77
|
+
"try-block": {
|
|
78
|
+
paletteClass: palette.try,
|
|
79
|
+
tag: "block",
|
|
80
|
+
Icon: IconCornerDownRight
|
|
81
|
+
},
|
|
82
|
+
"try-catch": {
|
|
83
|
+
paletteClass: palette.break,
|
|
84
|
+
tag: "catch",
|
|
85
|
+
Icon: IconCornerDownRight
|
|
86
|
+
},
|
|
87
|
+
"try-finally": {
|
|
88
|
+
paletteClass: palette.break,
|
|
89
|
+
tag: "finally",
|
|
90
|
+
Icon: IconCornerDownRight
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var SectionLabel = styled("div", { base: {
|
|
94
|
+
textStyle: "dimmed.xs",
|
|
95
|
+
fontWeight: "semibold",
|
|
96
|
+
letterSpacing: "wider",
|
|
97
|
+
textTransform: "uppercase",
|
|
98
|
+
userSelect: "none"
|
|
99
|
+
} });
|
|
100
|
+
/** Numeric step badge (e.g. `12`). */
|
|
101
|
+
var StepNum = styled("div", { base: {
|
|
102
|
+
flex: "none",
|
|
103
|
+
display: "flex",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
justifyContent: "center",
|
|
106
|
+
minWidth: "22px",
|
|
107
|
+
height: "18px",
|
|
108
|
+
paddingInline: "1",
|
|
109
|
+
rounded: "sm",
|
|
110
|
+
bg: "surface.sunken",
|
|
111
|
+
color: "text.dimmed",
|
|
112
|
+
fontSize: "[10px]",
|
|
113
|
+
fontWeight: "bold",
|
|
114
|
+
fontVariantNumeric: "tabular-nums",
|
|
115
|
+
userSelect: "none"
|
|
116
|
+
} });
|
|
117
|
+
/** Small pill tag for the sub-flow operator (`loop`, `par`, `try`, …). */
|
|
118
|
+
var FlowTag = styled("div", { base: {
|
|
119
|
+
flex: "none",
|
|
120
|
+
paddingInline: "1.5",
|
|
121
|
+
paddingBlock: "0.5",
|
|
122
|
+
rounded: "sm",
|
|
123
|
+
bg: "colorPalette.label",
|
|
124
|
+
color: "colorPalette.text",
|
|
125
|
+
fontSize: "[9px]",
|
|
126
|
+
fontWeight: "bold",
|
|
127
|
+
lineHeight: "xs",
|
|
128
|
+
letterSpacing: "tight",
|
|
129
|
+
textTransform: "uppercase",
|
|
130
|
+
userSelect: "none"
|
|
131
|
+
} });
|
|
132
|
+
var rowBase = css.raw({
|
|
133
|
+
display: "flex",
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
gap: "2",
|
|
136
|
+
width: "100%",
|
|
137
|
+
paddingInline: "1.5",
|
|
138
|
+
paddingBlock: "1",
|
|
139
|
+
rounded: "md",
|
|
140
|
+
cursor: "pointer",
|
|
141
|
+
color: "text",
|
|
142
|
+
userSelect: "none",
|
|
143
|
+
transition: "background-color 120ms ease",
|
|
144
|
+
_hover: { bg: "surface.sunken/60" },
|
|
145
|
+
"&[data-selected=\"true\"]": {
|
|
146
|
+
bg: "mantine.primary.light",
|
|
147
|
+
color: "mantine.primary.lightColor"
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
var labelText = css.raw({
|
|
151
|
+
flex: "1",
|
|
152
|
+
minWidth: "0",
|
|
153
|
+
fontSize: "xs",
|
|
154
|
+
whiteSpace: "nowrap",
|
|
155
|
+
overflow: "hidden",
|
|
156
|
+
textOverflow: "ellipsis"
|
|
157
|
+
});
|
|
158
|
+
var LabelSpan = styled("span", { base: labelText });
|
|
159
|
+
/**
|
|
160
|
+
* Height of the leading step badge; also the line-height of the first label line
|
|
161
|
+
* so that a multiline label keeps its first line aligned with the badge/arrow.
|
|
162
|
+
*/
|
|
163
|
+
var rowLeadingHeight = "18px";
|
|
164
|
+
/** Groups the step badge and arrow so they stay centered against the first label line. */
|
|
165
|
+
var leadingIcons = css.raw({
|
|
166
|
+
flex: "none",
|
|
167
|
+
display: "flex",
|
|
168
|
+
alignItems: "center",
|
|
169
|
+
gap: "2",
|
|
170
|
+
height: rowLeadingHeight
|
|
171
|
+
});
|
|
172
|
+
var MultilineLabelSpan = styled("span", { base: css.raw({
|
|
173
|
+
flex: "1",
|
|
174
|
+
minWidth: "0",
|
|
175
|
+
fontSize: "xs",
|
|
176
|
+
lineHeight: rowLeadingHeight,
|
|
177
|
+
whiteSpace: "pre-line",
|
|
178
|
+
overflowWrap: "anywhere"
|
|
179
|
+
}) });
|
|
180
|
+
var selectFlow = selectDiagramContext((s) => {
|
|
181
|
+
const title = extractViewTitleFromPath(s.view.title ?? "Untitled");
|
|
182
|
+
const description = s.view.description;
|
|
183
|
+
const activeStep = s.activeWalkthrough?.stepId ?? null;
|
|
184
|
+
if (activeStep) return {
|
|
185
|
+
flow: isDynamicView(s.view) && hasProp(s.view, "flow") ? dynamicViewFlow(s.view) : null,
|
|
186
|
+
activeStep,
|
|
187
|
+
title,
|
|
188
|
+
description,
|
|
189
|
+
outlinePanelWidth: s.activeWalkthrough?.outlinePanelWidth ?? 0,
|
|
190
|
+
collapsed: s.collapsedSequenceFlows
|
|
191
|
+
};
|
|
192
|
+
return {
|
|
193
|
+
flow: null,
|
|
194
|
+
activeStep: null,
|
|
195
|
+
title,
|
|
196
|
+
description
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
var SequenceOutlinePanel = memo(() => {
|
|
200
|
+
const props = useDiagramSelector(selectFlow);
|
|
201
|
+
return /* @__PURE__ */ jsx(PortalToContainer, { children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
202
|
+
propagate: true,
|
|
203
|
+
children: props.activeStep && props.flow && /* @__PURE__ */ jsx(m.div, {
|
|
204
|
+
layout: "position",
|
|
205
|
+
className: vstack({
|
|
206
|
+
position: "absolute",
|
|
207
|
+
top: "0",
|
|
208
|
+
left: "0",
|
|
209
|
+
layerStyle: "likec4.panel",
|
|
210
|
+
rounded: "0",
|
|
211
|
+
gap: "0",
|
|
212
|
+
padding: "0",
|
|
213
|
+
pointerEvents: "all",
|
|
214
|
+
maxWidth: "85cqw",
|
|
215
|
+
height: "100cqh",
|
|
216
|
+
maxHeight: "100cqh",
|
|
217
|
+
cursor: "default",
|
|
218
|
+
overflow: "hidden"
|
|
219
|
+
}),
|
|
220
|
+
style: { width: props.outlinePanelWidth },
|
|
221
|
+
initial: {
|
|
222
|
+
opacity: .5,
|
|
223
|
+
translateX: -40
|
|
224
|
+
},
|
|
225
|
+
animate: {
|
|
226
|
+
opacity: 1,
|
|
227
|
+
translateX: 0
|
|
228
|
+
},
|
|
229
|
+
exit: {
|
|
230
|
+
opacity: 0,
|
|
231
|
+
translateX: -props.outlinePanelWidth
|
|
232
|
+
},
|
|
233
|
+
children: /* @__PURE__ */ jsx(SequenceOutlinePanelBody, {
|
|
234
|
+
title: props.title,
|
|
235
|
+
description: props.description,
|
|
236
|
+
activeStep: props.activeStep,
|
|
237
|
+
flow: props.flow,
|
|
238
|
+
collapsed: props.collapsed
|
|
239
|
+
})
|
|
240
|
+
})
|
|
241
|
+
}) });
|
|
242
|
+
});
|
|
243
|
+
SequenceOutlinePanel.displayName = "SequenceOutlinePanel";
|
|
244
|
+
function SequenceOutlinePanelBody(props) {
|
|
245
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(OutlineHeader, {
|
|
246
|
+
title: props.title,
|
|
247
|
+
flow: props.flow,
|
|
248
|
+
description: props.description
|
|
249
|
+
}), /* @__PURE__ */ jsx(OutlineBody, {
|
|
250
|
+
activeStep: props.activeStep,
|
|
251
|
+
flow: props.flow,
|
|
252
|
+
collapsed: props.collapsed
|
|
253
|
+
})] });
|
|
254
|
+
}
|
|
255
|
+
var OutlineHeader = ({ title, flow, description }) => {
|
|
256
|
+
const diagram = useDiagram();
|
|
257
|
+
const stepCount = flow.stepsCount;
|
|
258
|
+
return /* @__PURE__ */ jsxs(VStack, {
|
|
259
|
+
css: {
|
|
260
|
+
gap: "2.5",
|
|
261
|
+
width: "100%",
|
|
262
|
+
paddingInline: "2.5",
|
|
263
|
+
paddingBlock: "2",
|
|
264
|
+
borderBottom: "1px solid {colors.likec4.panel.border}"
|
|
265
|
+
},
|
|
266
|
+
children: [/* @__PURE__ */ jsxs(HStack, {
|
|
267
|
+
css: {
|
|
268
|
+
gap: "2.5",
|
|
269
|
+
alignItems: "center",
|
|
270
|
+
width: "100%",
|
|
271
|
+
padding: "0"
|
|
272
|
+
},
|
|
273
|
+
children: [
|
|
274
|
+
/* @__PURE__ */ jsx(Box$1, {
|
|
275
|
+
css: {
|
|
276
|
+
flex: "none",
|
|
277
|
+
display: "flex",
|
|
278
|
+
alignItems: "center",
|
|
279
|
+
justifyContent: "center",
|
|
280
|
+
boxSize: "20px",
|
|
281
|
+
rounded: "sm",
|
|
282
|
+
colorPalette: "subflow.loop",
|
|
283
|
+
bg: "colorPalette.label",
|
|
284
|
+
color: "colorPalette.text"
|
|
285
|
+
},
|
|
286
|
+
children: /* @__PURE__ */ jsx(IconDirectionSignFilled, { size: 14 })
|
|
287
|
+
}),
|
|
288
|
+
/* @__PURE__ */ jsxs(VStack, {
|
|
289
|
+
css: {
|
|
290
|
+
gap: "0",
|
|
291
|
+
alignItems: "stretch",
|
|
292
|
+
flex: "1",
|
|
293
|
+
minWidth: "0"
|
|
294
|
+
},
|
|
295
|
+
children: [/* @__PURE__ */ jsx(styled.div, {
|
|
296
|
+
css: {
|
|
297
|
+
fontSize: "sm",
|
|
298
|
+
fontWeight: "semibold",
|
|
299
|
+
color: "text",
|
|
300
|
+
whiteSpace: "nowrap",
|
|
301
|
+
overflow: "hidden",
|
|
302
|
+
textOverflow: "ellipsis"
|
|
303
|
+
},
|
|
304
|
+
children: title ?? "Sequence"
|
|
305
|
+
}), /* @__PURE__ */ jsxs(Txt, {
|
|
306
|
+
size: "xxs",
|
|
307
|
+
dimmed: true,
|
|
308
|
+
noUserSelect: true,
|
|
309
|
+
children: [
|
|
310
|
+
stepCount,
|
|
311
|
+
" ",
|
|
312
|
+
stepCount === 1 ? "step" : "steps"
|
|
313
|
+
]
|
|
314
|
+
})]
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ jsx(Box$1, {
|
|
317
|
+
css: {
|
|
318
|
+
flex: "none",
|
|
319
|
+
alignItems: "center",
|
|
320
|
+
justifyContent: "center"
|
|
321
|
+
},
|
|
322
|
+
children: /* @__PURE__ */ jsx(CloseButton, {
|
|
323
|
+
size: "sm",
|
|
324
|
+
onClick: () => diagram.stopWalkthrough()
|
|
325
|
+
})
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
}), description && /* @__PURE__ */ jsx(Spoiler, {
|
|
329
|
+
showLabel: /* @__PURE__ */ jsx(Txt, {
|
|
330
|
+
size: "xxs",
|
|
331
|
+
children: "show description"
|
|
332
|
+
}),
|
|
333
|
+
hideLabel: /* @__PURE__ */ jsx(Txt, {
|
|
334
|
+
size: "xxs",
|
|
335
|
+
children: "hide"
|
|
336
|
+
}),
|
|
337
|
+
maxHeight: 16,
|
|
338
|
+
children: /* @__PURE__ */ jsx(Markdown, {
|
|
339
|
+
value: RichText.from(description),
|
|
340
|
+
className: css({ color: "text.dimmed" }),
|
|
341
|
+
fontSize: "xxs"
|
|
342
|
+
})
|
|
343
|
+
})]
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
var OutlineBody = ({ activeStep, flow, collapsed }) => {
|
|
347
|
+
const diagram = useDiagram();
|
|
348
|
+
const treeData = useTreeData(flow, collapsed);
|
|
349
|
+
const initialExpandedState = useMemo(() => mapToObj(flowAncestors(activeStep), (id) => [id, true]), []);
|
|
350
|
+
const tree = useTree({
|
|
351
|
+
initialSelectedState: [activeStep],
|
|
352
|
+
initialExpandedState,
|
|
353
|
+
multiple: false,
|
|
354
|
+
onSelectedStateChange(selected) {
|
|
355
|
+
const step = only(selected);
|
|
356
|
+
if (step && flow.isStep(step)) diagram.walkthroughStep({ step });
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
useOnDiagramEvent("walkthroughStep", ({ stepId }) => {
|
|
360
|
+
if (!tree.selectedState.includes(stepId)) {
|
|
361
|
+
const ancestors = flowAncestors(stepId);
|
|
362
|
+
if (ancestors.length > 0) {
|
|
363
|
+
const expanded = { ...tree.expandedState };
|
|
364
|
+
for (const parent of ancestors) expanded[parent] = true;
|
|
365
|
+
tree.setExpandedState(expanded);
|
|
366
|
+
}
|
|
367
|
+
tree.setSelectedState([stepId]);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
const allCollapsed = useMemo(() => Object.values(tree.expandedState).every((v) => !v), [tree.expandedState]);
|
|
371
|
+
const { prev, next } = flow.prevAndNext(activeStep, (flowId) => collapsed[flowId] ?? false);
|
|
372
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(HStack, {
|
|
373
|
+
css: {
|
|
374
|
+
justifyContent: "space-between",
|
|
375
|
+
alignItems: "center",
|
|
376
|
+
width: "100%",
|
|
377
|
+
paddingInline: "2.5",
|
|
378
|
+
paddingTop: "2",
|
|
379
|
+
paddingBottom: "1"
|
|
380
|
+
},
|
|
381
|
+
children: [
|
|
382
|
+
/* @__PURE__ */ jsx(SectionLabel, {
|
|
383
|
+
flex: "1",
|
|
384
|
+
children: "Outline"
|
|
385
|
+
}),
|
|
386
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
387
|
+
label: allCollapsed ? "Expand all" : "Collapse all",
|
|
388
|
+
fz: "xs",
|
|
389
|
+
openDelay: 500,
|
|
390
|
+
withinPortal: false,
|
|
391
|
+
children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
392
|
+
tabIndex: -1,
|
|
393
|
+
variant: "subtle",
|
|
394
|
+
size: "sm",
|
|
395
|
+
onClick: () => allCollapsed ? tree.expandAllNodes() : tree.collapseAllNodes(),
|
|
396
|
+
children: /* @__PURE__ */ jsx(IconListTree, { size: 14 })
|
|
397
|
+
})
|
|
398
|
+
}),
|
|
399
|
+
/* @__PURE__ */ jsx(Button, {
|
|
400
|
+
tabIndex: -1,
|
|
401
|
+
size: "compact-xs",
|
|
402
|
+
variant: "light",
|
|
403
|
+
className: css({ fontSize: "xxs" }),
|
|
404
|
+
leftSection: /* @__PURE__ */ jsx(IconPlayerSkipBackFilled, { size: 10 }),
|
|
405
|
+
onClick: () => prev && diagram.walkthroughStep({ step: prev }),
|
|
406
|
+
disabled: !prev,
|
|
407
|
+
children: "Back"
|
|
408
|
+
}),
|
|
409
|
+
/* @__PURE__ */ jsx(Button, {
|
|
410
|
+
tabIndex: -1,
|
|
411
|
+
size: "compact-xs",
|
|
412
|
+
variant: "light",
|
|
413
|
+
className: css({ fontSize: "xxs" }),
|
|
414
|
+
rightSection: /* @__PURE__ */ jsx(IconPlayerSkipForwardFilled, { size: 10 }),
|
|
415
|
+
onClick: () => next && diagram.walkthroughStep({ step: next }),
|
|
416
|
+
disabled: !next,
|
|
417
|
+
children: "Next"
|
|
418
|
+
})
|
|
419
|
+
]
|
|
420
|
+
}), /* @__PURE__ */ jsx(ScrollArea, {
|
|
421
|
+
type: "auto",
|
|
422
|
+
overscrollBehavior: "contain",
|
|
423
|
+
className: css({
|
|
424
|
+
flex: "1",
|
|
425
|
+
width: "100%",
|
|
426
|
+
minHeight: "0"
|
|
427
|
+
}),
|
|
428
|
+
children: /* @__PURE__ */ jsx(Tree, {
|
|
429
|
+
levelOffset: "var(--spacing-2\\.5)",
|
|
430
|
+
data: treeData,
|
|
431
|
+
tree,
|
|
432
|
+
selectOnClick: true,
|
|
433
|
+
classNames: { root: css({
|
|
434
|
+
paddingInline: "2",
|
|
435
|
+
paddingBottom: "3"
|
|
436
|
+
}) },
|
|
437
|
+
styles: { node: { paddingInlineStart: "var(--label-offset)" } },
|
|
438
|
+
renderNode: renderTreeNode
|
|
439
|
+
})
|
|
440
|
+
})] });
|
|
441
|
+
};
|
|
442
|
+
var renderTreeNode = ((payload) => {
|
|
443
|
+
return payload.node.nodeProps.type === "step" ? /* @__PURE__ */ jsx(StepRow, { ...payload }) : /* @__PURE__ */ jsx(FlowRow, { ...payload });
|
|
444
|
+
});
|
|
445
|
+
var StepRow = ({ node, elementProps, selected }) => {
|
|
446
|
+
const { stepnum, source, target, label, notes } = node.nodeProps;
|
|
447
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box$1, {
|
|
448
|
+
...elementProps,
|
|
449
|
+
className: cx(elementProps.className, css(rowBase, { alignItems: "flex-start" })),
|
|
450
|
+
children: [/* @__PURE__ */ jsxs(Box$1, {
|
|
451
|
+
className: css(leadingIcons),
|
|
452
|
+
children: [/* @__PURE__ */ jsx(StepNum, { children: stepnum }), /* @__PURE__ */ jsx(IconArrowRight, {
|
|
453
|
+
size: 13,
|
|
454
|
+
className: css({
|
|
455
|
+
flex: "none",
|
|
456
|
+
color: "text.dimmed"
|
|
457
|
+
})
|
|
458
|
+
})]
|
|
459
|
+
}), label ? /* @__PURE__ */ jsx(MultilineLabelSpan, { children: label }) : /* @__PURE__ */ jsxs(HStack, {
|
|
460
|
+
css: {
|
|
461
|
+
gap: "1",
|
|
462
|
+
minWidth: "0",
|
|
463
|
+
flex: "1",
|
|
464
|
+
minHeight: rowLeadingHeight
|
|
465
|
+
},
|
|
466
|
+
children: [
|
|
467
|
+
/* @__PURE__ */ jsx(LabelSpan, {
|
|
468
|
+
css: {
|
|
469
|
+
flex: "none",
|
|
470
|
+
color: "text.dimmed"
|
|
471
|
+
},
|
|
472
|
+
children: source
|
|
473
|
+
}),
|
|
474
|
+
/* @__PURE__ */ jsx(IconArrowRight, {
|
|
475
|
+
size: 11,
|
|
476
|
+
className: css({
|
|
477
|
+
flex: "none",
|
|
478
|
+
color: "text.dimmed"
|
|
479
|
+
})
|
|
480
|
+
}),
|
|
481
|
+
/* @__PURE__ */ jsx(LabelSpan, { children: target })
|
|
482
|
+
]
|
|
483
|
+
})]
|
|
484
|
+
}), notes && /* @__PURE__ */ jsx(Markdown, {
|
|
485
|
+
value: RichText.from(notes),
|
|
486
|
+
fontSize: "sm",
|
|
487
|
+
textScale: .9,
|
|
488
|
+
className: css({
|
|
489
|
+
background: "surface.sunken",
|
|
490
|
+
border: "1px solid {colors.surface.sunken.border}",
|
|
491
|
+
rounded: "md",
|
|
492
|
+
cursor: "default",
|
|
493
|
+
marginBlockStart: "1",
|
|
494
|
+
marginBlockEnd: "2",
|
|
495
|
+
paddingInline: "4",
|
|
496
|
+
paddingBlock: "2"
|
|
497
|
+
}),
|
|
498
|
+
style: {
|
|
499
|
+
marginInlineStart: "calc(-1 * var(--label-offset))",
|
|
500
|
+
display: selected ? "block" : "none"
|
|
501
|
+
}
|
|
502
|
+
})] });
|
|
503
|
+
};
|
|
504
|
+
var FlowRow = ({ node, expanded, elementProps }) => {
|
|
505
|
+
const { type, title } = node.nodeProps;
|
|
506
|
+
const { paletteClass, tag, Icon } = flowPresentation[type];
|
|
507
|
+
return /* @__PURE__ */ jsxs(Box$1, {
|
|
508
|
+
...elementProps,
|
|
509
|
+
className: cx(elementProps.className, paletteClass, css(rowBase)),
|
|
510
|
+
children: [
|
|
511
|
+
/* @__PURE__ */ jsx(IconChevronRight, {
|
|
512
|
+
size: 14,
|
|
513
|
+
className: css({
|
|
514
|
+
flex: "none",
|
|
515
|
+
color: "text.dimmed",
|
|
516
|
+
transition: "transform 150ms ease",
|
|
517
|
+
"&[data-expanded=\"true\"]": { transform: "rotate(90deg)" }
|
|
518
|
+
}),
|
|
519
|
+
"data-expanded": expanded
|
|
520
|
+
}),
|
|
521
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
522
|
+
size: 14,
|
|
523
|
+
className: css({
|
|
524
|
+
flex: "none",
|
|
525
|
+
color: "colorPalette.text"
|
|
526
|
+
})
|
|
527
|
+
}),
|
|
528
|
+
/* @__PURE__ */ jsx(styled.span, {
|
|
529
|
+
css: {
|
|
530
|
+
...labelText,
|
|
531
|
+
fontWeight: "medium"
|
|
532
|
+
},
|
|
533
|
+
children: title ?? tag
|
|
534
|
+
}),
|
|
535
|
+
/* @__PURE__ */ jsx(FlowTag, { children: tag })
|
|
536
|
+
]
|
|
537
|
+
});
|
|
538
|
+
};
|
|
539
|
+
//#endregion
|
|
540
|
+
export { SequenceOutlinePanel };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DynamicViewFlow, scalar, StepPath } from '@likec4/core';
|
|
2
|
+
import { TreeNodeData } from '@mantine/core';
|
|
3
|
+
import { DiagramContext } from '../../state/types';
|
|
4
|
+
export interface OutlineTreeNodeStep extends TreeNodeData {
|
|
5
|
+
readonly value: StepPath;
|
|
6
|
+
readonly nodeProps: Readonly<{
|
|
7
|
+
readonly type: 'step';
|
|
8
|
+
/** Global step number (1-based) across all flows */
|
|
9
|
+
readonly stepnum: number;
|
|
10
|
+
/** Title of the source actor */
|
|
11
|
+
readonly source: string;
|
|
12
|
+
/** Title of the target actor */
|
|
13
|
+
readonly target: string;
|
|
14
|
+
/** Relationship label, if any */
|
|
15
|
+
readonly label: string | null;
|
|
16
|
+
readonly notes: scalar.MarkdownOrString | null;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
export interface OutlineTreeNodeFlow extends TreeNodeData {
|
|
20
|
+
readonly value: StepPath;
|
|
21
|
+
readonly nodeProps: Readonly<{
|
|
22
|
+
readonly type: DynamicViewFlow.SubFlowType;
|
|
23
|
+
/** Friendly title of the sub-flow, if defined */
|
|
24
|
+
readonly title: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
children: OutlineTreeNodeData[];
|
|
27
|
+
}
|
|
28
|
+
export type OutlineTreeNodeData = OutlineTreeNodeStep | OutlineTreeNodeFlow;
|
|
29
|
+
export type OutlineTreeNodes = OutlineTreeNodeData[];
|
|
30
|
+
/**
|
|
31
|
+
* Type guard narrowing a tree node to a sub-flow node.
|
|
32
|
+
* (The discriminant lives on the nested `nodeProps.type`, so an explicit guard
|
|
33
|
+
* is needed for reliable narrowing.)
|
|
34
|
+
*/
|
|
35
|
+
export declare function isOutlineFlowNode(node: OutlineTreeNodeData): node is OutlineTreeNodeFlow;
|
|
36
|
+
export declare function useTreeData(flow: DynamicViewFlow, collapsed: DiagramContext['collapsedSequenceFlows']): OutlineTreeNodes;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import "@likec4/core";
|
|
4
|
+
//#region src/likec4diagram/ui/sequence-outline/state.ts
|
|
5
|
+
function buildTree(flow, collapsedFlows) {
|
|
6
|
+
const tree = [];
|
|
7
|
+
let currentFlow = tree;
|
|
8
|
+
let isCollapsed = false;
|
|
9
|
+
flow.walk({
|
|
10
|
+
step: ({ step, stepnum, source, target, edge }) => {
|
|
11
|
+
if (isCollapsed) return;
|
|
12
|
+
currentFlow.push({
|
|
13
|
+
label: edge.label ?? `${source.title} → ${target.title}`,
|
|
14
|
+
value: step,
|
|
15
|
+
nodeProps: {
|
|
16
|
+
type: "step",
|
|
17
|
+
stepnum: stepnum.global,
|
|
18
|
+
source: source.title,
|
|
19
|
+
target: target.title,
|
|
20
|
+
label: edge.label,
|
|
21
|
+
notes: edge.notes ?? null
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
subflow: ({ subflow }) => {
|
|
26
|
+
if (collapsedFlows[subflow.id]) {
|
|
27
|
+
isCollapsed = true;
|
|
28
|
+
return () => {
|
|
29
|
+
isCollapsed = false;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const node = {
|
|
33
|
+
label: subflow.title ?? subflow._type,
|
|
34
|
+
value: subflow.id,
|
|
35
|
+
nodeProps: {
|
|
36
|
+
type: subflow._type,
|
|
37
|
+
title: subflow.title
|
|
38
|
+
},
|
|
39
|
+
children: []
|
|
40
|
+
};
|
|
41
|
+
const parent = currentFlow;
|
|
42
|
+
parent.push(node);
|
|
43
|
+
currentFlow = node.children;
|
|
44
|
+
return () => {
|
|
45
|
+
currentFlow = parent;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return tree;
|
|
50
|
+
}
|
|
51
|
+
function useTreeData(flow, collapsed) {
|
|
52
|
+
return useMemo(() => buildTree(flow, collapsed), [flow, collapsed]);
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { useTreeData };
|
|
@@ -9,7 +9,7 @@ import { Types } from '../types';
|
|
|
9
9
|
* @returns An object containing an array of XY flow nodes and an array of XY flow edges.
|
|
10
10
|
*/
|
|
11
11
|
export declare function diagramToXY(opts: {
|
|
12
|
-
view: Pick<DiagramView, 'id' | 'nodes' | 'edges' | '_type' | 'autoLayout'>;
|
|
12
|
+
view: Pick<DiagramView, 'id' | 'nodes' | 'bounds' | 'edges' | '_type' | 'autoLayout'>;
|
|
13
13
|
currentViewId: ViewId | undefined;
|
|
14
14
|
where: WhereOperator | null;
|
|
15
15
|
}): {
|