@likec4/diagram 1.57.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/Markdown.d.ts +1 -1
- package/dist/base-primitives/NodeHandles.d.ts +1 -1
- 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/CompoundNodeContainer.d.ts +1 -1
- 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/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base-primitives/edge/EdgeMarkers.d.ts +8 -8
- package/dist/base-primitives/element/ElementActionButtons.d.ts +2 -1
- package/dist/base-primitives/element/ElementActionButtons.js +4 -1
- package/dist/base-primitives/element/ElementData.d.ts +4 -2
- 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.d.ts +1 -1
- package/dist/base-primitives/element/ElementShape.js +3 -0
- package/dist/base-primitives/element/ElementTags.d.ts +1 -1
- package/dist/base-primitives/element/ElementTags.js +1 -3
- package/dist/components/ErrorFallback.d.ts +2 -2
- package/dist/components/ErrorFallback.js +3 -5
- package/dist/components/Link.js +6 -6
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +1 -1
- package/dist/components/PortalToContainer.d.ts +1 -1
- package/dist/components/RootContainer.d.ts +1 -1
- package/dist/components/SearchControl.css.js +11 -11
- package/dist/components/SearchControl.d.ts +2 -2
- package/dist/components/ViewNotFound.d.ts +2 -2
- package/dist/context/CurrentViewModelProvider.d.ts +1 -1
- package/dist/context/DefaultMantineProvider.d.ts +1 -1
- package/dist/context/DiagramEventHandlers.d.ts +1 -1
- package/dist/context/EnsureMantine.d.ts +1 -1
- package/dist/context/FramerMotionConfig.d.ts +3 -3
- package/dist/context/FramerMotionConfig.js +2 -2
- package/dist/context/IconRenderer.d.ts +2 -2
- package/dist/context/IconRenderer.js +32 -12
- package/dist/context/LikeC4ModelContext.d.ts +1 -1
- package/dist/context/TagStylesContext.d.ts +4 -3
- package/dist/context/TagStylesContext.js +20 -22
- package/dist/custom/index.d.ts +1 -0
- package/dist/custom/index.js +3 -2
- package/dist/editor/LikeC4EditorProvider.d.ts +2 -2
- package/dist/editor/actor/actions.d.ts +74 -15
- package/dist/editor/actor/actions.js +91 -25
- package/dist/editor/actor/hotkey.d.ts +1 -1
- package/dist/editor/actor/hotkey.js +7 -0
- package/dist/editor/actor/machine.d.ts +4 -6
- package/dist/editor/actor/machine.js +1 -0
- package/dist/editor/actor/setup.d.ts +25 -4
- package/dist/editor/actor/setup.js +8 -6
- package/dist/editor/actor/state.editor.d.ts +64 -14
- package/dist/editor/actor/state.editor.js +12 -11
- package/dist/editor/actor/state.sync-queue.d.ts +283 -91
- package/dist/editor/actor/state.sync-queue.js +93 -56
- package/dist/editor/actor/types.d.ts +6 -1
- package/dist/editor/actor/types.js +1 -1
- package/dist/editor/useEditorActorLogic.js +14 -2
- 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.d.ts +5 -0
- package/dist/hooks/useEditorActor.js +4 -3
- 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 +3 -1
- package/dist/index.js +4 -2
- package/dist/likec4diagram/DiagramUI.d.ts +1 -1
- package/dist/likec4diagram/DiagramUI.js +19 -6
- package/dist/likec4diagram/DiagramXYFlow.js +54 -17
- package/dist/likec4diagram/convert-to-xyflow.d.ts +3 -5
- package/dist/likec4diagram/convert-to-xyflow.js +29 -10
- package/dist/likec4diagram/custom/edges/EdgeDrifts.d.ts +1 -1
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +140 -18
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.d.ts +1 -1
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +11 -4
- package/dist/likec4diagram/custom/edges/edges.css.d.ts +1 -0
- package/dist/likec4diagram/custom/edges/edges.css.js +6 -2
- package/dist/likec4diagram/custom/index.d.ts +2 -1
- package/dist/likec4diagram/custom/index.js +5 -3
- package/dist/likec4diagram/custom/nodes/CompoundActions.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/CompoundActions.js +1 -0
- package/dist/likec4diagram/custom/nodes/ElementActions.d.ts +4 -4
- package/dist/likec4diagram/custom/nodes/ElementActions.js +13 -3
- package/dist/likec4diagram/custom/nodes/NodeDrifts.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/NodeNotes.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +0 -4
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.d.ts +2 -2
- 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.d.ts +7 -7
- package/dist/likec4diagram/custom/nodes/nodes.js +20 -5
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.d.ts +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/ElementToolbar.d.ts +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.d.ts +1 -1
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.d.ts +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +15 -14
- package/dist/likec4diagram/relationship-popover/components.d.ts +2 -2
- package/dist/likec4diagram/state/DiagramActorProvider.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 +2 -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 +118 -46
- 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 +49 -3
- package/dist/likec4diagram/ui/FloatingSequenceActors.d.ts +6 -0
- package/dist/likec4diagram/ui/FloatingSequenceActors.js +155 -0
- package/dist/likec4diagram/ui/LayoutDriftFrame.d.ts +1 -1
- 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/notation/NotationPanel.d.ts +1 -1
- 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 +116 -62
- 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} +112 -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/NavigationPanelControls.d.ts +1 -1
- package/dist/navigationpanel/NavigationPanelDropdown.d.ts +1 -1
- package/dist/navigationpanel/NavigationPanelDropdown.js +47 -40
- package/dist/navigationpanel/_common.d.ts +2 -2
- 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/CompareActionsMenu.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/ComparePanel.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/ComparePanelControls.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +4 -5
- package/dist/navigationpanel/comparepanel/LayoutTypeSwitcher.d.ts +1 -1
- package/dist/navigationpanel/controls/DetailsControls.d.ts +1 -1
- package/dist/navigationpanel/controls/DetailsControls.js +7 -8
- package/dist/navigationpanel/controls/LayoutWarning.d.ts +1 -1
- package/dist/navigationpanel/controls/LogoButton.d.ts +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.d.ts +1 -1
- package/dist/navigationpanel/controls/OpenSource.d.ts +1 -1
- package/dist/navigationpanel/controls/SearchControl.d.ts +1 -1
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +1 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +1 -1
- package/dist/navigationpanel/editorpanel/CenterCamera.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/EditorPanel.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +1 -1
- package/dist/navigationpanel/editorpanel/ToggleReadonly.d.ts +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.d.ts +1 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +2 -2
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +5 -5
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +23 -25
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.d.ts +1 -1
- 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/ElementDetails.d.ts +1 -1
- package/dist/overlays/element-details/ElementDetailsCard.css.js +17 -17
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +1 -1
- package/dist/overlays/element-details/MetadataValue.d.ts +2 -2
- 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.d.ts +1 -1
- 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.d.ts +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/RelationshipDetails.d.ts +1 -1
- package/dist/overlays/relationship-details/SelectEdge.d.ts +1 -1
- package/dist/overlays/relationship-details/custom/ElementActions.d.ts +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +4 -4
- package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationship-details/layout.js +1 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -2
- package/dist/overlays/relationships-browser/SelectElement.d.ts +1 -1
- package/dist/overlays/relationships-browser/actor.js +79 -78
- package/dist/overlays/relationships-browser/custom/ElementActions.d.ts +1 -1
- package/dist/overlays/relationships-browser/custom/EmptyNode.d.ts +1 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +4 -4
- 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/ProjectsOverview.d.ts +1 -1
- package/dist/projects-overview/actor.js +4 -4
- package/dist/projects-overview/custom/nodeTypes.d.ts +1 -1
- package/dist/projects-overview/panel/ProjectsOverviewPanel.d.ts +1 -1
- package/dist/search/Search.d.ts +1 -1
- package/dist/search/Search.js +1 -1
- package/dist/search/XStateSearchAdapter.d.ts +1 -1
- package/dist/search/components/ElementsColumn.css.js +2 -2
- package/dist/search/components/ElementsColumn.d.ts +1 -1
- package/dist/search/components/PickView.d.ts +1 -1
- package/dist/search/components/SearchByTags.d.ts +1 -1
- package/dist/search/components/SearchInput.d.ts +1 -1
- package/dist/search/components/ViewsColum.d.ts +3 -3
- 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 +2 -3
- package/dist/shadowroot/ShadowRoot.js +95 -41
- package/dist/shadowroot/index.d.ts +1 -0
- 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 +30 -43
- package/panda.buildinfo.json +271 -295
- package/styles-min.css +1 -1
- package/styles-xyflow.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/shadowroot/styles.css.d.ts +0 -12
- package/dist/shadowroot/styles.css.js +0 -59
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { roundDpr } from "../../utils/roundDpr.js";
|
|
2
3
|
import { Base } from "../../base/Base.js";
|
|
3
|
-
import { machine, targetState } from "./machine.setup.js";
|
|
4
|
-
import { SeqParallelAreaColor } from "../xyflow-sequence/const.js";
|
|
4
|
+
import { machine, targetState, to } from "./machine.setup.js";
|
|
5
5
|
import { assignViewportBefore, cancelFitDiagram, fitFocusedBounds, returnViewportBefore } from "./machine.actions.layout.js";
|
|
6
|
-
import { cancelEditing, emitEdgeClick, startHotKeyActor, stopHotKeyActor,
|
|
7
|
-
import { clamp,
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { assignLastClickedNode, cancelEditing, emitEdgeClick, emitPaneClick, resetLastClickedNode, resetSelection, startHotKeyActor, stopHotKeyActor, updateView } from "./machine.actions.js";
|
|
7
|
+
import { clamp, firstBy, isNumber, map } from "remeda";
|
|
8
|
+
import { invariant, nonNullable } from "@likec4/core";
|
|
9
|
+
import { dynamicViewFlow as dynamicViewFlow$1, isDynamicView as isDynamicView$1, isStepPath as isStepPath$1, parentFlow } from "@likec4/core/types";
|
|
10
|
+
import { assertEvent, enqueueActions } from "xstate";
|
|
11
|
+
import { assign as assign$1, raise as raise$1 } from "xstate/actions";
|
|
11
12
|
//#region src/likec4diagram/state/machine.state.ready.walkthrough.ts
|
|
13
|
+
var byId = (id) => (e) => e.data.id === id && isNumber(e.data.stepnum);
|
|
14
|
+
var outlinePanelWidth = ({ activeWalkthrough, xystore }) => {
|
|
15
|
+
if (activeWalkthrough) return activeWalkthrough.outlinePanelWidth;
|
|
16
|
+
const { width } = xystore.getState();
|
|
17
|
+
return clamp(roundDpr(width * .3), {
|
|
18
|
+
min: 180,
|
|
19
|
+
max: 400
|
|
20
|
+
});
|
|
21
|
+
};
|
|
12
22
|
var updateActiveWalkthroughState = () => machine.enqueueActions(({ context, enqueue }) => {
|
|
13
23
|
const { activeWalkthrough } = context;
|
|
14
24
|
if (!activeWalkthrough) {
|
|
@@ -16,77 +26,106 @@ var updateActiveWalkthroughState = () => machine.enqueueActions(({ context, enqu
|
|
|
16
26
|
enqueue.raise({ type: "walkthrough.end" });
|
|
17
27
|
return;
|
|
18
28
|
}
|
|
19
|
-
const { stepId,
|
|
20
|
-
const step = context.xyedges.find((
|
|
29
|
+
const { stepId, activeFlow } = activeWalkthrough;
|
|
30
|
+
const step = context.xyedges.find(byId(stepId));
|
|
21
31
|
if (!step) {
|
|
22
32
|
console.warn("Invalid walkthrough stepId:", stepId);
|
|
23
33
|
enqueue.raise({ type: "walkthrough.end" });
|
|
24
34
|
return;
|
|
25
35
|
}
|
|
36
|
+
invariant(isDynamicView$1(context.view));
|
|
37
|
+
let processedSteps;
|
|
38
|
+
if (context.view.flow && context.dynamicViewVariant == "sequence") {
|
|
39
|
+
const flow = dynamicViewFlow$1(context.view);
|
|
40
|
+
processedSteps = new Set(flow.stepPathsBefore(stepId));
|
|
41
|
+
} else processedSteps = /* @__PURE__ */ new Set();
|
|
42
|
+
const parentActiveFlow = activeFlow ? parentFlow(activeFlow) : null;
|
|
26
43
|
enqueue.assign({
|
|
27
44
|
xyedges: context.xyedges.map((edge) => {
|
|
28
|
-
|
|
45
|
+
if (edge.data.id === step.data.id) return Base.setData(edge, {
|
|
46
|
+
active: true,
|
|
47
|
+
state: "active",
|
|
48
|
+
dimmed: false
|
|
49
|
+
});
|
|
50
|
+
if (processedSteps.has(edge.data.id)) return Base.setData(edge, {
|
|
51
|
+
active: false,
|
|
52
|
+
state: "processed",
|
|
53
|
+
dimmed: true
|
|
54
|
+
});
|
|
55
|
+
if (isNumber(edge.data.stepnum) && edge.data.stepnum <= step.data.stepnum) return Base.setData(edge, {
|
|
56
|
+
active: false,
|
|
57
|
+
state: "skipped",
|
|
58
|
+
dimmed: true
|
|
59
|
+
});
|
|
29
60
|
return Base.setData(edge, {
|
|
30
|
-
active,
|
|
31
|
-
|
|
61
|
+
active: false,
|
|
62
|
+
state: "pending",
|
|
63
|
+
dimmed: true
|
|
32
64
|
});
|
|
33
65
|
}),
|
|
34
66
|
xynodes: context.xynodes.map((node) => {
|
|
35
67
|
const dimmed = step.source !== node.id && step.target !== node.id;
|
|
36
|
-
if (node.type === "seq-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
68
|
+
if (node.type === "seq-subflow" && activeFlow) switch (true) {
|
|
69
|
+
case node.data.flowId == parentActiveFlow && (node.data.flowType === "try" || node.data.flowType === "alt"):
|
|
70
|
+
case node.data.flowId == activeFlow: return Base.setDimmed(node, false);
|
|
71
|
+
default: return Base.setDimmed(node, true);
|
|
72
|
+
}
|
|
40
73
|
return Base.setDimmed(node, dimmed);
|
|
41
74
|
})
|
|
42
75
|
});
|
|
76
|
+
enqueue(resetSelection());
|
|
77
|
+
});
|
|
78
|
+
var clearWalkthroughState = () => machine.assign(({ context }) => {
|
|
79
|
+
return {
|
|
80
|
+
activeWalkthrough: null,
|
|
81
|
+
xynodes: map(context.xynodes, Base.setDimmed(false)),
|
|
82
|
+
xyedges: map(context.xyedges, Base.setData({
|
|
83
|
+
state: null,
|
|
84
|
+
dimmed: false,
|
|
85
|
+
active: false
|
|
86
|
+
}))
|
|
87
|
+
};
|
|
43
88
|
});
|
|
44
89
|
var emitWalkthroughStarted = () => machine.emit(({ context }) => {
|
|
45
|
-
const edge = context.xyedges.find((x) => x.id === context.activeWalkthrough?.stepId);
|
|
46
|
-
invariant(edge, "Invalid walkthrough state");
|
|
47
90
|
return {
|
|
48
91
|
type: "walkthroughStarted",
|
|
49
|
-
edge
|
|
92
|
+
edge: nonNullable(context.xyedges.find((x) => x.data.id === context.activeWalkthrough?.stepId), "Walkthrough step not found")
|
|
50
93
|
};
|
|
51
94
|
});
|
|
52
95
|
var emitWalkthroughStopped = () => machine.emit(() => ({ type: "walkthroughStopped" }));
|
|
53
96
|
var emitWalkthroughStep = () => machine.emit(({ context }) => {
|
|
54
|
-
const
|
|
55
|
-
invariant(edge, "Invalid walkthrough state");
|
|
97
|
+
const stepId = nonNullable(context.activeWalkthrough?.stepId);
|
|
56
98
|
return {
|
|
57
99
|
type: "walkthroughStep",
|
|
58
|
-
edge
|
|
100
|
+
edge: nonNullable(context.xyedges.find((x) => x.data.id === stepId), `Walkthrough step edge ${stepId} not found`),
|
|
101
|
+
stepId
|
|
59
102
|
};
|
|
60
103
|
});
|
|
61
104
|
var walkthrough = machine.createStateConfig({
|
|
62
105
|
id: targetState.walkthrough.slice(1),
|
|
63
106
|
entry: [
|
|
64
|
-
startHotKeyActor(),
|
|
65
107
|
cancelEditing(),
|
|
66
108
|
cancelFitDiagram(),
|
|
67
109
|
assignViewportBefore(),
|
|
68
|
-
assign$1(
|
|
110
|
+
assign$1(({ context, event }) => {
|
|
69
111
|
assertEvent(event, "walkthrough.start");
|
|
70
|
-
const stepId = event.stepId ??
|
|
71
|
-
return {
|
|
112
|
+
const stepId = event.stepId ?? firstBy(context.xyedges, (e) => isStepPath$1(e.data.id))?.data.id;
|
|
113
|
+
return { activeWalkthrough: isStepPath$1(stepId) ? {
|
|
72
114
|
stepId,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
115
|
+
activeFlow: parentFlow(stepId),
|
|
116
|
+
outlinePanelWidth: outlinePanelWidth(context)
|
|
117
|
+
} : null };
|
|
118
|
+
}),
|
|
76
119
|
updateActiveWalkthroughState(),
|
|
77
120
|
fitFocusedBounds(),
|
|
78
|
-
emitWalkthroughStarted()
|
|
121
|
+
emitWalkthroughStarted(),
|
|
122
|
+
startHotKeyActor()
|
|
79
123
|
],
|
|
80
124
|
exit: [
|
|
81
125
|
stopHotKeyActor(),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (n.type === "seq-parallel") return Base.setData(n, { color: SeqParallelAreaColor.default });
|
|
86
|
-
return n;
|
|
87
|
-
}) });
|
|
88
|
-
}),
|
|
89
|
-
undimEverything(),
|
|
126
|
+
cancelFitDiagram(),
|
|
127
|
+
clearWalkthroughState(),
|
|
128
|
+
resetSelection(),
|
|
90
129
|
returnViewportBefore(),
|
|
91
130
|
emitWalkthroughStopped()
|
|
92
131
|
],
|
|
@@ -94,11 +133,11 @@ var walkthrough = machine.createStateConfig({
|
|
|
94
133
|
"key.esc": { target: targetState.idle },
|
|
95
134
|
"key.arrow.left": { actions: raise$1({
|
|
96
135
|
type: "walkthrough.step",
|
|
97
|
-
direction: "
|
|
136
|
+
direction: "prev"
|
|
98
137
|
}) },
|
|
99
138
|
"key.arrow.up": { actions: raise$1({
|
|
100
139
|
type: "walkthrough.step",
|
|
101
|
-
direction: "
|
|
140
|
+
direction: "prev"
|
|
102
141
|
}) },
|
|
103
142
|
"key.arrow.right": { actions: raise$1({
|
|
104
143
|
type: "walkthrough.step",
|
|
@@ -108,50 +147,80 @@ var walkthrough = machine.createStateConfig({
|
|
|
108
147
|
type: "walkthrough.step",
|
|
109
148
|
direction: "next"
|
|
110
149
|
}) },
|
|
111
|
-
"walkthrough.step": { actions: [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
150
|
+
"walkthrough.step": { actions: [enqueueActions(({ enqueue, context, event }) => {
|
|
151
|
+
let predicate;
|
|
152
|
+
const activeWalkthrough = nonNullable(context.activeWalkthrough, "walkthrough.step: activeWalkthrough is null");
|
|
153
|
+
if (event.direction) {
|
|
154
|
+
invariant(isDynamicView$1(context.view));
|
|
155
|
+
const { stepId } = activeWalkthrough;
|
|
156
|
+
const prevNext = dynamicViewFlow$1(context.view).prevAndNext(stepId, (flowId) => context.collapsedSequenceFlows[flowId] ?? false);
|
|
157
|
+
predicate = (edge) => edge.data.id === prevNext[event.direction];
|
|
158
|
+
} else predicate = (edge) => edge.data.id === event.stepId;
|
|
159
|
+
const nextStepId = context.xyedges.find(predicate)?.data.id;
|
|
160
|
+
if (!isStepPath$1(nextStepId) || activeWalkthrough.stepId === nextStepId) return;
|
|
161
|
+
enqueue.assign({ activeWalkthrough: {
|
|
162
|
+
...activeWalkthrough,
|
|
163
|
+
stepId: nextStepId,
|
|
164
|
+
activeFlow: parentFlow(nextStepId)
|
|
165
|
+
} });
|
|
166
|
+
enqueue(updateActiveWalkthroughState());
|
|
167
|
+
enqueue(fitFocusedBounds());
|
|
168
|
+
enqueue(emitWalkthroughStep());
|
|
169
|
+
})] },
|
|
130
170
|
"xyflow.edgeClick": [{
|
|
131
171
|
guard: "click: active walkthrough step",
|
|
132
172
|
actions: [fitFocusedBounds(), emitEdgeClick()]
|
|
133
173
|
}, { actions: [
|
|
134
|
-
assign$1(({ event }) => {
|
|
135
|
-
|
|
136
|
-
invariant(
|
|
174
|
+
assign$1(({ event, context }) => {
|
|
175
|
+
invariant(event.edge.type === "seq-step", `Expected seq-step edge, but got "${event.edge.type}"`);
|
|
176
|
+
invariant(!!context.activeWalkthrough);
|
|
177
|
+
const stepId = event.edge.data.id;
|
|
137
178
|
return { activeWalkthrough: {
|
|
179
|
+
...context.activeWalkthrough,
|
|
138
180
|
stepId,
|
|
139
|
-
|
|
181
|
+
activeFlow: parentFlow(stepId)
|
|
140
182
|
} };
|
|
141
183
|
}),
|
|
142
184
|
updateActiveWalkthroughState(),
|
|
143
|
-
fitFocusedBounds(),
|
|
185
|
+
fitFocusedBounds({ duration: 600 }),
|
|
144
186
|
emitEdgeClick(),
|
|
145
187
|
emitWalkthroughStep()
|
|
146
188
|
] }],
|
|
189
|
+
"xyflow.nodeClick": {
|
|
190
|
+
guard: "click: node.type = seq-subflow",
|
|
191
|
+
actions: [enqueueActions(({ enqueue, event: { node }, context }) => {
|
|
192
|
+
invariant(node.type === "seq-subflow");
|
|
193
|
+
if (node.data.collapsed) {
|
|
194
|
+
enqueue.raise({
|
|
195
|
+
type: "sequence.flow.expand",
|
|
196
|
+
flowId: node.data.flowId
|
|
197
|
+
});
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
invariant(isDynamicView$1(context.view));
|
|
201
|
+
const flow = dynamicViewFlow$1(context.view);
|
|
202
|
+
const nextStepId = flow.firstStep(node.data.flowId) ?? flow.firstStep();
|
|
203
|
+
if (nextStepId !== context.activeWalkthrough?.stepId) {
|
|
204
|
+
enqueue.raise({
|
|
205
|
+
type: "walkthrough.step",
|
|
206
|
+
stepId: nextStepId
|
|
207
|
+
});
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (context.lastClickedNode?.id === node.id && context.lastClickedNode.clicks > 2) enqueue.raise({ type: "walkthrough.end" });
|
|
211
|
+
}), assignLastClickedNode()]
|
|
212
|
+
},
|
|
147
213
|
"notations.unhighlight": { actions: updateActiveWalkthroughState() },
|
|
148
214
|
"tag.unhighlight": { actions: updateActiveWalkthroughState() },
|
|
149
215
|
"update.view": {
|
|
150
216
|
guard: "is same view",
|
|
151
217
|
actions: [updateView(), updateActiveWalkthroughState()]
|
|
152
218
|
},
|
|
153
|
-
"walkthrough.end": {
|
|
154
|
-
"xyflow.paneDblClick": {
|
|
219
|
+
"walkthrough.end": { ...to.idle },
|
|
220
|
+
"xyflow.paneDblClick": {
|
|
221
|
+
actions: [resetLastClickedNode(), emitPaneClick()],
|
|
222
|
+
...to.idle
|
|
223
|
+
}
|
|
155
224
|
}
|
|
156
225
|
});
|
|
157
226
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ActorSystem } from 'xstate';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseEditorActorRef } from '../../editor/actor/setup';
|
|
3
|
+
import { NavigationPanelActorRef } from '../../navigationpanel/actor';
|
|
3
4
|
import { OverlaysActorRef } from '../../overlays/overlaysActor';
|
|
4
5
|
import { SearchActorRef } from '../../search/searchActor';
|
|
5
6
|
import { DiagramMachineRef } from './machine';
|
|
@@ -12,7 +13,8 @@ export type System = ActorSystem<{
|
|
|
12
13
|
diagram: DiagramMachineRef;
|
|
13
14
|
overlays: OverlaysActorRef;
|
|
14
15
|
search: SearchActorRef;
|
|
15
|
-
editor:
|
|
16
|
+
editor: BaseEditorActorRef;
|
|
17
|
+
navigationPanel: NavigationPanelActorRef;
|
|
16
18
|
};
|
|
17
19
|
}>;
|
|
18
20
|
export interface DiagramActorRef extends DiagramMachineRef {
|
|
@@ -3,6 +3,8 @@ import { DeploymentFqn, DiagramEdge, DiagramNode, DiagramView, Fqn } from '@like
|
|
|
3
3
|
import { Viewport } from '@xyflow/system';
|
|
4
4
|
import { ActorSystem } from 'xstate';
|
|
5
5
|
import { EditorActorRef } from '../../editor/actor/machine';
|
|
6
|
+
import { XYStoreState } from '../../hooks/useXYFlow';
|
|
7
|
+
import { NavigationPanelActorRef } from '../../navigationpanel/actor';
|
|
6
8
|
import { OverlaysActorRef } from '../../overlays/overlaysActor';
|
|
7
9
|
import { SearchActorRef } from '../../search/searchActor';
|
|
8
10
|
import { Types } from '../types';
|
|
@@ -18,6 +20,7 @@ export declare function typedSystem(system: ActorSystem<any>): {
|
|
|
18
20
|
readonly diagramActorRef: DiagramActorRef;
|
|
19
21
|
readonly searchActorRef: SearchActorRef | null;
|
|
20
22
|
readonly editorActorRef: EditorActorRef | null;
|
|
23
|
+
readonly navigationActorRef: NavigationPanelActorRef | null;
|
|
21
24
|
};
|
|
22
25
|
export declare namespace typedSystem {
|
|
23
26
|
var editorActor: ({ system }: {
|
|
@@ -32,6 +35,9 @@ export declare namespace typedSystem {
|
|
|
32
35
|
var searchActor: ({ system }: {
|
|
33
36
|
system: ActorSystem<any>;
|
|
34
37
|
}) => SearchActorRef;
|
|
38
|
+
var navigationActor: ({ system }: {
|
|
39
|
+
system: ActorSystem<any>;
|
|
40
|
+
}) => NavigationPanelActorRef;
|
|
35
41
|
}
|
|
36
42
|
export declare function findDiagramNode(ctx: Context, xynodeId: string): DiagramNode | null;
|
|
37
43
|
export declare function findDiagramEdge(ctx: Context, xyedgeId: string): DiagramEdge | null;
|
|
@@ -52,6 +58,7 @@ export declare function activeSequenceBounds(params: {
|
|
|
52
58
|
bounds: BBox;
|
|
53
59
|
duration: number;
|
|
54
60
|
};
|
|
61
|
+
export declare function getEdgeBounds(edge: Types.Edge, store: XYStoreState): BBox | null;
|
|
55
62
|
export declare function nodeRef(node: Types.Node): Fqn | DeploymentFqn | null;
|
|
56
63
|
export declare function findCorrespondingNode(context: Pick<Context, 'lastOnNavigate' | 'xynodes'>, event: {
|
|
57
64
|
view: DiagramView;
|
|
@@ -2,26 +2,31 @@ import "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { MinZoom } from "../../base/const.js";
|
|
3
3
|
import { pickViewBounds } from "../../utils/view-bounds.js";
|
|
4
4
|
import { BBox } from "@likec4/core/geometry";
|
|
5
|
-
import { nonNullable, nonexhaustive } from "@likec4/core/utils";
|
|
6
|
-
import { getEdgePosition,
|
|
5
|
+
import { invariant, nonNullable, nonexhaustive } from "@likec4/core/utils";
|
|
6
|
+
import { getEdgePosition, getNodesBounds, getViewportForBounds } from "@xyflow/system";
|
|
7
|
+
import { isDynamicView } from "@likec4/core/types";
|
|
7
8
|
//#region src/likec4diagram/state/utils.ts
|
|
8
9
|
var findNodeByModelFqn = (xynodes, elementFqn) => {
|
|
9
10
|
const node = xynodes.find((n) => "modelFqn" in n.data && n.data["modelFqn"] === elementFqn);
|
|
10
11
|
return node ? node : null;
|
|
11
12
|
};
|
|
12
13
|
function typedSystem(system) {
|
|
14
|
+
const sys = system;
|
|
13
15
|
return {
|
|
14
16
|
get overlaysActorRef() {
|
|
15
|
-
return
|
|
17
|
+
return sys.get("overlays") ?? null;
|
|
16
18
|
},
|
|
17
19
|
get diagramActorRef() {
|
|
18
|
-
return nonNullable(
|
|
20
|
+
return nonNullable(sys.get("diagram"), "Diagram actor not found");
|
|
19
21
|
},
|
|
20
22
|
get searchActorRef() {
|
|
21
|
-
return
|
|
23
|
+
return sys.get("search") ?? null;
|
|
22
24
|
},
|
|
23
25
|
get editorActorRef() {
|
|
24
|
-
return
|
|
26
|
+
return sys.get("editor") ?? null;
|
|
27
|
+
},
|
|
28
|
+
get navigationActorRef() {
|
|
29
|
+
return sys.get("navigationPanel") ?? null;
|
|
25
30
|
}
|
|
26
31
|
};
|
|
27
32
|
}
|
|
@@ -37,6 +42,9 @@ typedSystem.diagramActor = ({ system }) => {
|
|
|
37
42
|
typedSystem.searchActor = ({ system }) => {
|
|
38
43
|
return system.get("search");
|
|
39
44
|
};
|
|
45
|
+
typedSystem.navigationActor = ({ system }) => {
|
|
46
|
+
return system.get("navigationPanel");
|
|
47
|
+
};
|
|
40
48
|
function findDiagramNode(ctx, xynodeId) {
|
|
41
49
|
return ctx.view.nodes.find((n) => n.id === xynodeId) ?? null;
|
|
42
50
|
}
|
|
@@ -51,20 +59,8 @@ function viewBounds(ctx, nextView) {
|
|
|
51
59
|
return pickViewBounds(nextView ?? ctx.view, ctx.dynamicViewVariant);
|
|
52
60
|
}
|
|
53
61
|
function focusedBounds(params) {
|
|
54
|
-
const knownAbsolutes = /* @__PURE__ */ new Map();
|
|
55
62
|
const b = params.context.xynodes.reduce((acc, node) => {
|
|
56
|
-
let position = node.
|
|
57
|
-
if (node.parentId) {
|
|
58
|
-
const parent = knownAbsolutes.get(node.parentId) ?? {
|
|
59
|
-
x: 0,
|
|
60
|
-
y: 0
|
|
61
|
-
};
|
|
62
|
-
position = {
|
|
63
|
-
x: position.x + parent.x,
|
|
64
|
-
y: position.y + parent.y
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
knownAbsolutes.set(node.id, position);
|
|
63
|
+
let position = node.data;
|
|
68
64
|
if (node.hidden || node.data.dimmed) return acc;
|
|
69
65
|
const width = node.measured?.width ?? node.width ?? node.initialWidth;
|
|
70
66
|
const height = node.measured?.height ?? node.height ?? node.initialHeight;
|
|
@@ -93,23 +89,28 @@ function focusedBounds(params) {
|
|
|
93
89
|
var MARGIN = 32;
|
|
94
90
|
function activeSequenceBounds(params) {
|
|
95
91
|
const activeWalkthrough = nonNullable(params.context.activeWalkthrough);
|
|
96
|
-
const
|
|
92
|
+
const view = params.context.view;
|
|
93
|
+
invariant(isDynamicView(view));
|
|
94
|
+
const stepEdge = nonNullable(params.context.xyedges.find((e) => e.data.id === activeWalkthrough.stepId));
|
|
97
95
|
const xystate = params.context.xystore.getState();
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
const edgeBounds = getEdgeBounds(stepEdge, xystate);
|
|
97
|
+
if (edgeBounds && params.context.dynamicViewVariant === "sequence") {
|
|
98
|
+
const h = stepEdge.data.labelBBox?.height ?? 80;
|
|
99
|
+
const [top, bottom] = stepEdge.data.dir !== "back" ? [20, h] : [h, 20];
|
|
100
|
+
return {
|
|
101
|
+
duration: 500,
|
|
102
|
+
bounds: BBox.expand(edgeBounds, {
|
|
103
|
+
left: 100,
|
|
104
|
+
right: 100,
|
|
105
|
+
top,
|
|
106
|
+
bottom
|
|
107
|
+
})
|
|
106
108
|
};
|
|
107
109
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
else stepBounds = actorsBounds;
|
|
110
|
+
const actorsBounds = getNodesBounds([nonNullable(xystate.nodeLookup.get(stepEdge.source)), nonNullable(xystate.nodeLookup.get(stepEdge.target))], xystate);
|
|
111
|
+
let stepBounds = edgeBounds ? BBox.merge(edgeBounds, actorsBounds) : actorsBounds;
|
|
111
112
|
return {
|
|
112
|
-
duration:
|
|
113
|
+
duration: 500,
|
|
113
114
|
bounds: BBox.expand(stepBounds, MARGIN)
|
|
114
115
|
};
|
|
115
116
|
}
|
|
@@ -125,7 +126,7 @@ function getEdgeBounds(edge, store) {
|
|
|
125
126
|
targetHandle: edge.targetHandle || null,
|
|
126
127
|
connectionMode: store.connectionMode
|
|
127
128
|
});
|
|
128
|
-
if (!edgePosition) return null;
|
|
129
|
+
if (!edgePosition) return edge.data.labelBBox ?? null;
|
|
129
130
|
return BBox.fromPoints([[edgePosition.sourceX, edgePosition.sourceY], [edgePosition.targetX, edgePosition.targetY]]);
|
|
130
131
|
}
|
|
131
132
|
function nodeRef(node) {
|
|
@@ -136,6 +137,7 @@ function nodeRef(node) {
|
|
|
136
137
|
case "deployment":
|
|
137
138
|
case "compound-deployment": return node.data.modelFqn ?? node.data.deploymentFqn;
|
|
138
139
|
case "seq-parallel":
|
|
140
|
+
case "seq-subflow":
|
|
139
141
|
case "view-group": return null;
|
|
140
142
|
default: nonexhaustive(node);
|
|
141
143
|
}
|
|
@@ -158,4 +160,4 @@ function calcViewportForBounds(context, bounds) {
|
|
|
158
160
|
return getViewportForBounds(bounds, width, height, MinZoom, Math.max(transform[2], 1), context.fitViewPadding);
|
|
159
161
|
}
|
|
160
162
|
//#endregion
|
|
161
|
-
export { activeSequenceBounds, calcViewportForBounds, findCorrespondingNode, findDiagramEdge, findDiagramNode, findNodeByModelFqn, focusedBounds, nodeRef, typedSystem, viewBounds };
|
|
163
|
+
export { activeSequenceBounds, calcViewportForBounds, findCorrespondingNode, findDiagramEdge, findDiagramNode, findNodeByModelFqn, focusedBounds, getEdgeBounds, nodeRef, typedSystem, viewBounds };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutoLayoutDirection, BBox, DeploymentFqn, DiagramEdge, DiagramNode, DiagramNodeDriftReason, ExclusiveUnion, Fqn, IconUrl, MarkdownOrString, NonEmptyReadonlyArray, ViewId } from '@likec4/core/types';
|
|
1
|
+
import { AutoLayoutDirection, BBox, DeploymentFqn, DiagramEdge, DiagramNode, DiagramNodeDriftReason, DynamicViewFlow, ExclusiveUnion, Fqn, IconUrl, MarkdownOrString, NonEmptyReadonlyArray, StepPath, ViewId } from '@likec4/core/types';
|
|
2
2
|
import { XYPosition } from '@xyflow/system';
|
|
3
3
|
import { FunctionComponent } from 'react';
|
|
4
4
|
import { Simplify } from 'type-fest';
|
|
@@ -43,6 +43,7 @@ export declare namespace Types {
|
|
|
43
43
|
height: number;
|
|
44
44
|
type: 'target' | 'source';
|
|
45
45
|
position: 'left' | 'right' | 'top' | 'bottom';
|
|
46
|
+
hidden?: boolean;
|
|
46
47
|
};
|
|
47
48
|
type SequenceActorNodeData = Simplify<LeafNodeData & {
|
|
48
49
|
navigateTo: ViewId | null;
|
|
@@ -50,6 +51,34 @@ export declare namespace Types {
|
|
|
50
51
|
ports: Array<SequenceActorNodePort>;
|
|
51
52
|
viewHeight: number;
|
|
52
53
|
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Represents subflow area in the diagram
|
|
56
|
+
* `try` and `alt` flows have special handling in the diagram
|
|
57
|
+
*/
|
|
58
|
+
type SequenceSubflowData = LeafNodeData & {
|
|
59
|
+
flowId: StepPath;
|
|
60
|
+
title: string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* This is first subflow in current flow
|
|
63
|
+
*/
|
|
64
|
+
isFirst?: boolean | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* This is last subflow in current flow
|
|
67
|
+
*/
|
|
68
|
+
isLast?: boolean | undefined;
|
|
69
|
+
collapsed: boolean;
|
|
70
|
+
} & ({
|
|
71
|
+
flowType: Exclude<DynamicViewFlow.SubFlowType, 'try' | 'alt'>;
|
|
72
|
+
} | SequenceSubflowData.AltOrTry);
|
|
73
|
+
namespace SequenceSubflowData {
|
|
74
|
+
type AltOrTry = {
|
|
75
|
+
flowType: 'try' | 'alt';
|
|
76
|
+
headerHeight: number;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated Use {@link SequenceSubflowData} instead
|
|
81
|
+
*/
|
|
53
82
|
type SequenceParallelAreaData = Simplify<LeafNodeData & {
|
|
54
83
|
parallelPrefix: string;
|
|
55
84
|
}>;
|
|
@@ -92,10 +121,11 @@ export declare namespace Types {
|
|
|
92
121
|
type DeploymentElementNode = BaseNode<DeploymentElementNodeData, 'deployment'>;
|
|
93
122
|
type SequenceActorNode = BaseNode<SequenceActorNodeData, 'seq-actor'>;
|
|
94
123
|
type SequenceParallelArea = BaseNode<SequenceParallelAreaData, 'seq-parallel'>;
|
|
124
|
+
type SequenceSubflowArea = BaseNode<SequenceSubflowData, 'seq-subflow'>;
|
|
95
125
|
type CompoundElementNode = BaseNode<CompoundElementNodeData, 'compound-element'>;
|
|
96
126
|
type CompoundDeploymentNode = BaseNode<CompoundDeploymentNodeData, 'compound-deployment'>;
|
|
97
127
|
type ViewGroupNode = BaseNode<ViewGroupNodeData, 'view-group'>;
|
|
98
|
-
type AnyNode = ElementNode | DeploymentElementNode | CompoundElementNode | CompoundDeploymentNode | ViewGroupNode | SequenceActorNode | SequenceParallelArea;
|
|
128
|
+
type AnyNode = ElementNode | DeploymentElementNode | CompoundElementNode | CompoundDeploymentNode | ViewGroupNode | SequenceActorNode | SequenceParallelArea | SequenceSubflowArea;
|
|
99
129
|
type NodeType = AnyNode['type'];
|
|
100
130
|
type NodeData = ExclusiveUnion<{
|
|
101
131
|
ElementNodeData: ElementNodeData;
|
|
@@ -105,6 +135,7 @@ export declare namespace Types {
|
|
|
105
135
|
ViewGroupNodeData: ViewGroupNodeData;
|
|
106
136
|
SequenceActorNodeData: SequenceActorNodeData;
|
|
107
137
|
SequenceParallelAreaData: SequenceParallelAreaData;
|
|
138
|
+
SequenceSubflowAreaData: SequenceSubflowData;
|
|
108
139
|
}>;
|
|
109
140
|
type Node<Type extends NodeType = NodeType> = Extract<AnyNode, {
|
|
110
141
|
type: Type;
|
|
@@ -113,12 +144,27 @@ export declare namespace Types {
|
|
|
113
144
|
type RelationshipEdgeData = Simplify<BaseEdgeData & NonOptional<Pick<DiagramEdge, 'id' | 'label' | 'labelBBox' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo' | 'astPath' | 'drifts'>> & {
|
|
114
145
|
notes: MarkdownOrString | null;
|
|
115
146
|
labelXY: XYPosition | null;
|
|
147
|
+
isLabelCustomized?: boolean | undefined;
|
|
116
148
|
controlPoints: XYPosition[] | undefined | null;
|
|
149
|
+
/**
|
|
150
|
+
* When dynamic view in "diagram" variant
|
|
151
|
+
* Edges are RelationshipEdgeData - stepnum is used to determine the step number
|
|
152
|
+
* (backward compatibility)
|
|
153
|
+
*/
|
|
154
|
+
stepnum?: number;
|
|
117
155
|
}>;
|
|
118
|
-
type SequenceStepEdgeData = Simplify<BaseEdgeData & NonOptional<Pick<DiagramEdge, '
|
|
156
|
+
type SequenceStepEdgeData = Simplify<BaseEdgeData & NonOptional<Pick<DiagramEdge, 'label' | 'technology' | 'points' | 'dir' | 'color' | 'line' | 'head' | 'tail' | 'navigateTo' | 'astPath' | 'drifts'>> & {
|
|
157
|
+
id: StepPath;
|
|
158
|
+
state?: 'processed' | 'active' | 'skipped' | 'pending' | null;
|
|
159
|
+
stepnum: number;
|
|
160
|
+
parentFlow: null | {
|
|
161
|
+
id: StepPath;
|
|
162
|
+
type: DynamicViewFlow.SubFlowType;
|
|
163
|
+
};
|
|
119
164
|
notes: MarkdownOrString | null;
|
|
120
165
|
labelXY: XYPosition | null;
|
|
121
166
|
labelBBox: BBox;
|
|
167
|
+
isLabelCustomized?: boolean | undefined;
|
|
122
168
|
controlPoints: XYPosition[] | undefined | null;
|
|
123
169
|
}>;
|
|
124
170
|
type RelationshipEdge = BaseEdge<RelationshipEdgeData, 'relationship'>;
|