@likec4/diagram 1.59.2 → 1.59.4
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/README.md +53 -0
- package/dist/LikeC4Diagram.d.ts +1 -1
- package/dist/LikeC4Diagram.js +36 -21
- package/dist/LikeC4Diagram.props.d.ts +23 -0
- package/dist/LikeC4MantineProvider.d.ts +24 -0
- package/dist/LikeC4MantineProvider.js +156 -0
- package/dist/LikeC4ProjectsOverview.js +1 -1
- package/dist/LikeC4ProjectsProvider.d.ts +17 -2
- package/dist/LikeC4Styles.d.ts +13 -3
- package/dist/LikeC4Styles.js +10 -6
- package/dist/LikeC4View.js +2 -2
- package/dist/StaticLikeC4Diagram.d.ts +1 -1
- package/dist/base/BaseXYFlow.d.ts +1 -1
- package/dist/base/BaseXYFlow.js +19 -9
- package/dist/base/const.d.ts +1 -0
- package/dist/base/const.js +3 -1
- package/dist/base-primitives/Markdown.d.ts +3 -3
- package/dist/base-primitives/compound/CompoundNodeContainer.js +2 -3
- package/dist/base-primitives/compound/CompoundTitle.js +5 -4
- package/dist/base-primitives/compound/actionbtns.css.d.ts +3 -3
- package/dist/base-primitives/compound/actionbtns.css.js +3 -3
- package/dist/base-primitives/element/ElementData.js +6 -1
- package/dist/base-primitives/element/ElementShape.js +9 -10
- package/dist/base-primitives/element/ElementTags.d.ts +2 -2
- package/dist/base-primitives/element/ElementTags.js +5 -5
- package/dist/components/EmptyBox.d.ts +3 -0
- package/dist/components/EmptyBox.js +9 -0
- package/dist/components/ErrorFallback.js +7 -6
- package/dist/components/FloatingWindow.d.ts +18 -0
- package/dist/components/FloatingWindow.js +89 -0
- package/dist/components/Link.js +7 -7
- package/dist/components/NavigationPanel.d.ts +2 -2
- package/dist/components/NavigationPanel.js +5 -6
- package/dist/components/SearchControl.css.js +10 -12
- package/dist/components/ViewIcon.d.ts +11 -0
- package/dist/components/ViewIcon.js +71 -0
- package/dist/context/CurrentViewModelProvider.js +2 -1
- package/dist/context/DiagramEventHandlers.js +4 -2
- package/dist/context/EnsureMantine.js +3 -3
- package/dist/context/IconRenderer.d.ts +2 -1
- package/dist/context/IconRenderer.js +78 -26
- package/dist/context/LikeC4ProjectsContext.d.ts +3 -2
- package/dist/context/TagStylesContext.d.ts +11 -4
- package/dist/context/TagStylesContext.js +39 -27
- package/dist/custom/index.d.ts +3 -0
- package/dist/custom/index.js +7 -4
- package/dist/editor/LikeC4EditorCallbacks.d.ts +20 -1
- package/dist/editor/LikeC4EditorCallbacks.js +4 -1
- package/dist/editor/actor/setup.d.ts +1 -0
- package/dist/editor/actor/setup.js +17 -12
- package/dist/editor/actor/state.sync-queue.js +1 -0
- package/dist/editor/applyChangesToManualLayout.js +5 -2
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/useEditorActorLogic.js +10 -3
- package/dist/hooks/safeContext.d.ts +12 -4
- package/dist/hooks/safeContext.js +2 -2
- package/dist/hooks/useCurrentView.js +5 -5
- package/dist/hooks/useDiagram.js +3 -23
- package/dist/hooks/useDiagramCompareLayout.d.ts +16 -6
- package/dist/hooks/useDiagramCompareLayout.js +20 -17
- package/dist/hooks/useEditorActor.js +3 -5
- package/dist/hooks/useLikeC4Model.js +8 -3
- package/dist/hooks/useLikeC4Project.d.ts +4 -3
- package/dist/hooks/useOverlaysActor.d.ts +1 -1
- package/dist/hooks/useUpdateEffect.js +2 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +8 -6
- package/dist/likec4diagram/DiagramUI.js +4 -3
- package/dist/likec4diagram/DiagramXYFlow.d.ts +6 -0
- package/dist/likec4diagram/DiagramXYFlow.js +33 -19
- package/dist/likec4diagram/custom/edges/EdgeDrifts.js +4 -4
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +2 -4
- package/dist/likec4diagram/custom/edges/SequenceStepEdge.js +1 -3
- package/dist/likec4diagram/custom/edges/edges.css.js +13 -13
- package/dist/likec4diagram/custom/edges/useRelationshipEdgePath.js +3 -2
- package/dist/likec4diagram/custom/nodes/NodeDrifts.js +2 -2
- package/dist/likec4diagram/custom/nodes/NodeNotes.js +4 -4
- package/dist/likec4diagram/custom/nodes/SequenceActorNode.js +2 -2
- package/dist/likec4diagram/custom/nodes/SequenceSubFlow.js +8 -5
- package/dist/likec4diagram/custom/nodes/nodes.js +8 -5
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/Toolbar.js +9 -8
- package/dist/likec4diagram/custom/nodes/toolbar/styles.css.js +1 -1
- package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +3 -2
- package/dist/likec4diagram/relationship-popover/components.d.ts +1 -1
- package/dist/likec4diagram/relationship-popover/components.js +6 -2
- package/dist/likec4diagram/state/DiagramActorProvider.d.ts +7 -2
- package/dist/likec4diagram/state/DiagramActorProvider.js +20 -4
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/createViewChange.js +1 -6
- package/dist/likec4diagram/state/diagram-api.d.ts +2 -2
- package/dist/likec4diagram/state/diagram-api.js +3 -2
- package/dist/likec4diagram/state/machine.actions.js +15 -8
- package/dist/likec4diagram/state/machine.actions.layout.d.ts +1 -0
- package/dist/likec4diagram/state/machine.actions.layout.js +7 -5
- package/dist/likec4diagram/state/machine.setup.d.ts +10 -1
- package/dist/likec4diagram/state/machine.setup.js +15 -9
- package/dist/likec4diagram/state/machine.state.initializing.d.ts +2 -26
- package/dist/likec4diagram/state/machine.state.initializing.js +9 -6
- package/dist/likec4diagram/state/machine.state.navigating.js +1 -1
- package/dist/likec4diagram/state/machine.state.ready.d.ts +134 -3
- package/dist/likec4diagram/state/machine.state.ready.js +2 -1
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.d.ts +106 -1
- package/dist/likec4diagram/state/machine.state.ready.walkthrough.js +40 -7
- package/dist/likec4diagram/state/utils.d.ts +1 -1
- package/dist/likec4diagram/state/utils.js +7 -4
- package/dist/likec4diagram/ui/FloatingSequenceActors.js +2 -1
- package/dist/likec4diagram/ui/LayoutDriftFrame.js +16 -10
- package/dist/likec4diagram/ui/index.d.ts +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.css.js +13 -15
- package/dist/likec4diagram/ui/notation/NotationPanel.js +9 -9
- package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.d.ts +9 -0
- package/dist/likec4diagram/ui/sequence-outline/ActiveTrail.js +81 -0
- package/dist/likec4diagram/ui/sequence-outline/FlowRow.d.ts +11 -0
- package/dist/likec4diagram/ui/sequence-outline/FlowRow.js +70 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineBody.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineBody.js +106 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineHeader.js +140 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.d.ts +17 -0
- package/dist/likec4diagram/ui/sequence-outline/OutlineNodes.js +83 -0
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.d.ts +4 -0
- package/dist/likec4diagram/ui/sequence-outline/SequenceOutlinePanel.js +49 -525
- package/dist/likec4diagram/ui/sequence-outline/StepBadge.d.ts +8 -0
- package/dist/likec4diagram/ui/sequence-outline/StepBadge.js +52 -0
- package/dist/likec4diagram/ui/sequence-outline/StepRow.d.ts +7 -0
- package/dist/likec4diagram/ui/sequence-outline/StepRow.js +190 -0
- package/dist/likec4diagram/ui/sequence-outline/StoreProvider.d.ts +238 -0
- package/dist/likec4diagram/ui/sequence-outline/StoreProvider.js +94 -0
- package/dist/likec4diagram/ui/sequence-outline/depth-of-field.d.ts +21 -0
- package/dist/likec4diagram/ui/sequence-outline/depth-of-field.js +71 -0
- package/dist/likec4diagram/ui/sequence-outline/index.d.ts +2 -0
- package/dist/likec4diagram/ui/sequence-outline/motion.d.ts +13 -0
- package/dist/likec4diagram/ui/sequence-outline/motion.js +21 -0
- package/dist/likec4diagram/ui/sequence-outline/presentation.d.ts +10 -0
- package/dist/likec4diagram/ui/sequence-outline/presentation.js +80 -0
- package/dist/likec4diagram/ui/sequence-outline/tree.d.ts +9 -0
- package/dist/likec4diagram/ui/sequence-outline/tree.js +67 -0
- package/dist/likec4diagram/ui/sequence-outline/{state.d.ts → types.d.ts} +4 -2
- package/dist/likec4diagram/ui/sequence-outline/types.js +12 -0
- package/dist/likec4diagram/useLayoutConstraints.js +13 -1
- package/dist/likec4diagram/xyflow-sequence/layouter.js +8 -10
- package/dist/likec4diagram/xyflow-sequence/sequence-view-to-xy.js +1 -0
- package/dist/likec4diagram/xyflow-sequence/utils.js +0 -1
- package/dist/navigationpanel/NavigationPanel.js +45 -41
- package/dist/navigationpanel/NavigationPanelControls.js +102 -63
- package/dist/navigationpanel/NavigationPanelDropdown.js +52 -77
- package/dist/navigationpanel/_common.d.ts +6 -6
- package/dist/navigationpanel/_common.js +31 -42
- package/dist/navigationpanel/actor.actions.js +6 -5
- package/dist/navigationpanel/actor.js +2 -2
- package/dist/navigationpanel/actor.setup.d.ts +6 -6
- package/dist/navigationpanel/actor.setup.js +2 -1
- package/dist/navigationpanel/comparepanel/CompareActionsMenu.js +2 -4
- package/dist/navigationpanel/comparepanel/ComparePanel.js +8 -10
- package/dist/navigationpanel/comparepanel/DriftsSummary.d.ts +1 -1
- package/dist/navigationpanel/comparepanel/DriftsSummary.js +11 -9
- package/dist/navigationpanel/controls/LayoutWarning.js +69 -72
- package/dist/navigationpanel/controls/NavigationButtons.d.ts +1 -1
- package/dist/navigationpanel/controls/NavigationButtons.js +8 -8
- package/dist/navigationpanel/controls/OpenSource.d.ts +1 -1
- package/dist/navigationpanel/controls/OpenSource.js +5 -8
- package/dist/navigationpanel/controls/SearchControl.js +24 -9
- package/dist/navigationpanel/controls/ToggleReadonly.d.ts +4 -1
- package/dist/navigationpanel/controls/ToggleReadonly.js +56 -76
- package/dist/navigationpanel/controls/ViewDetailsButton.d.ts +5 -0
- package/dist/navigationpanel/controls/ViewDetailsButton.js +121 -0
- package/dist/navigationpanel/controls/index.d.ts +1 -1
- package/dist/navigationpanel/dropdown/ProjectsMenu.js +27 -16
- package/dist/navigationpanel/editorpanel/ApplySemanticLayout.js +2 -1
- package/dist/navigationpanel/editorpanel/ChangeAutoLayoutButton.js +12 -10
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.d.ts +2 -0
- package/dist/navigationpanel/editorpanel/ManualLayoutToolsButton.js +19 -10
- package/dist/navigationpanel/editorpanel/styles.js +8 -15
- package/dist/navigationpanel/hooks.d.ts +6 -2
- package/dist/navigationpanel/styles.css.d.ts +2 -2
- package/dist/navigationpanel/styles.css.js +0 -1
- package/dist/navigationpanel/walkthrough/ActiveWalkthroughControls.js +3 -2
- package/dist/navigationpanel/walkthrough/DynamicViewControls.d.ts +5 -4
- package/dist/navigationpanel/walkthrough/DynamicViewControls.js +10 -39
- package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.d.ts +1 -0
- package/dist/navigationpanel/walkthrough/DynamicViewModeSwitcher.js +49 -0
- package/dist/navigationpanel/walkthrough/WalkthroughPanel.js +8 -8
- package/dist/navigationpanel/windows/ViewDetailsWindow.d.ts +1 -0
- package/dist/navigationpanel/windows/ViewDetailsWindow.js +379 -0
- package/dist/overlays/Overlays.js +29 -17
- package/dist/overlays/element-details/ElementDetailsCard.css.js +28 -36
- package/dist/overlays/element-details/ElementDetailsCard.js +3 -3
- package/dist/overlays/element-details/MetadataValue.js +18 -16
- package/dist/overlays/element-details/TabPanelDeployments.css.js +6 -14
- package/dist/overlays/element-details/TabPanelRelationships.css.js +8 -12
- package/dist/overlays/element-details/TabPanelStructure.css.js +4 -8
- package/dist/overlays/hooks.d.ts +3 -1
- package/dist/overlays/overlay/Overlay.js +8 -7
- package/dist/overlays/overlaysActor.js +20 -17
- package/dist/overlays/relationship-details/RelationshipDetails.js +2 -1
- package/dist/overlays/relationship-details/SelectEdge.css.js +14 -9
- package/dist/overlays/relationship-details/actor.js +1 -1
- package/dist/overlays/relationship-details/hooks.js +2 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +6 -0
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +15 -8
- package/dist/overlays/relationships-browser/SelectElement.css.js +2 -8
- package/dist/overlays/relationships-browser/SelectElement.js +5 -1
- package/dist/overlays/relationships-browser/actor.js +3 -2
- package/dist/overlays/relationships-browser/custom/ElementActions.js +39 -38
- package/dist/overlays/relationships-browser/custom/EmptyNode.js +7 -9
- package/dist/overlays/relationships-browser/hooks.js +2 -1
- package/dist/projects-overview/ProjectsOverview.js +8 -7
- package/dist/projects-overview/actor.js +1 -1
- package/dist/projects-overview/hooks.js +2 -1
- package/dist/search/Search.js +9 -7
- package/dist/search/components/ElementsColumn.css.js +6 -5
- package/dist/search/components/ElementsColumn.js +4 -3
- package/dist/search/components/SearchByTags.js +3 -3
- package/dist/search/components/ViewsColum.js +46 -43
- package/dist/search/components/ViewsColumn.css.js +4 -4
- package/dist/search/components/_shared.css.d.ts +2 -2
- package/dist/search/components/_shared.css.js +31 -46
- package/dist/search/components/styles.css.js +4 -4
- package/dist/search/hooks.js +2 -1
- package/dist/shadowroot/ShadowRoot.js +6 -5
- package/dist/styles2.js +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +29 -29
- package/panda.buildinfo.json +342 -299
- package/styles-min.css +1 -1
- package/styles-xyflow.css +1 -1
- package/styles.css +1 -1
- package/dist/context/DefaultMantineProvider.d.ts +0 -2
- package/dist/context/DefaultMantineProvider.js +0 -48
- package/dist/likec4diagram/ui/sequence-outline/state.js +0 -55
- package/dist/navigationpanel/controls/DetailsControls.d.ts +0 -2
- package/dist/navigationpanel/controls/DetailsControls.js +0 -223
|
@@ -106,8 +106,8 @@ function DeploymentNode(props) {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
var compoundHasDrifts = css({
|
|
109
|
-
outlineColor: "likec4.compare.
|
|
110
|
-
outlineWidth: "
|
|
109
|
+
outlineColor: "likec4.compare.outline",
|
|
110
|
+
outlineWidth: "extra",
|
|
111
111
|
outlineStyle: "dashed",
|
|
112
112
|
outlineOffset: "1.5"
|
|
113
113
|
});
|
|
@@ -116,8 +116,9 @@ var hasDrifts = (props) => {
|
|
|
116
116
|
};
|
|
117
117
|
function CompoundElementNode(props) {
|
|
118
118
|
const { enableElementDetails, enableReadOnly, enableCompareWithLatest } = useEnabledFeatures();
|
|
119
|
+
const showDrifts = enableCompareWithLatest && hasDrifts(props);
|
|
119
120
|
return /* @__PURE__ */ jsxs(CompoundNodeContainer, {
|
|
120
|
-
className:
|
|
121
|
+
className: showDrifts ? compoundHasDrifts : void 0,
|
|
121
122
|
nodeProps: props,
|
|
122
123
|
children: [
|
|
123
124
|
enableCompareWithLatest && /* @__PURE__ */ jsx(NodeDrifts, { nodeProps: props }),
|
|
@@ -134,8 +135,9 @@ function CompoundElementNode(props) {
|
|
|
134
135
|
}
|
|
135
136
|
function CompoundDeploymentNode(props) {
|
|
136
137
|
const { enableElementDetails, enableReadOnly, enableCompareWithLatest } = useEnabledFeatures();
|
|
138
|
+
const showDrifts = enableCompareWithLatest && hasDrifts(props);
|
|
137
139
|
return /* @__PURE__ */ jsxs(CompoundNodeContainer, {
|
|
138
|
-
className:
|
|
140
|
+
className: showDrifts ? compoundHasDrifts : void 0,
|
|
139
141
|
nodeProps: props,
|
|
140
142
|
children: [
|
|
141
143
|
enableCompareWithLatest && /* @__PURE__ */ jsx(NodeDrifts, { nodeProps: props }),
|
|
@@ -152,8 +154,9 @@ function CompoundDeploymentNode(props) {
|
|
|
152
154
|
}
|
|
153
155
|
function ViewGroupNode(props) {
|
|
154
156
|
const { enableCompareWithLatest } = useEnabledFeatures();
|
|
157
|
+
const showDrifts = enableCompareWithLatest && hasDrifts(props);
|
|
155
158
|
return /* @__PURE__ */ jsxs(CompoundNodeContainer, {
|
|
156
|
-
className:
|
|
159
|
+
className: showDrifts ? compoundHasDrifts : void 0,
|
|
157
160
|
nodeProps: props,
|
|
158
161
|
children: [
|
|
159
162
|
enableCompareWithLatest && /* @__PURE__ */ jsx(NodeDrifts, { nodeProps: props }),
|
|
@@ -73,7 +73,7 @@ function ColorSwatches({ theme, elementColor, onColorPreview, onChange }) {
|
|
|
73
73
|
openDelay: 1e3,
|
|
74
74
|
closeDelay: 300,
|
|
75
75
|
children: [/* @__PURE__ */ jsx(Flex$1, {
|
|
76
|
-
maxW: "120px",
|
|
76
|
+
maxW: "[120px]",
|
|
77
77
|
gap: "1.5",
|
|
78
78
|
justify: "flex-start",
|
|
79
79
|
align: "flex-start",
|
|
@@ -107,7 +107,7 @@ function ColorSwatches({ theme, elementColor, onColorPreview, onChange }) {
|
|
|
107
107
|
}, color))
|
|
108
108
|
}), /* @__PURE__ */ jsx(Flex$1, {
|
|
109
109
|
mt: "sm",
|
|
110
|
-
maxW: "110px",
|
|
110
|
+
maxW: "[110px]",
|
|
111
111
|
gap: "1.5",
|
|
112
112
|
justify: "flex-start",
|
|
113
113
|
align: "flex-start",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { stopPropagation } from "../../../../utils/xyflow.js";
|
|
3
|
-
import {
|
|
3
|
+
import { selectDiagramContext, useDiagramSelector } from "../../../../hooks/safeContext.js";
|
|
4
4
|
import { toolbarTitle } from "./styles.css.js";
|
|
5
5
|
import { cx } from "@likec4/styles/css";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -9,20 +9,21 @@ import { Paper, Text } from "@mantine/core";
|
|
|
9
9
|
import { useDebouncedValue } from "@mantine/hooks";
|
|
10
10
|
import { Box as Box$1, HStack, VStack } from "@likec4/styles/jsx";
|
|
11
11
|
//#region src/likec4diagram/custom/nodes/toolbar/Toolbar.tsx
|
|
12
|
-
var selectSelectedNodesCount = (context) => {
|
|
12
|
+
var selectSelectedNodesCount = selectDiagramContext((context) => {
|
|
13
13
|
return context.xynodes.filter((x) => x.selected).length;
|
|
14
|
-
};
|
|
14
|
+
});
|
|
15
15
|
var useSelectedNodesCount = () => {
|
|
16
|
-
return
|
|
16
|
+
return useDiagramSelector(selectSelectedNodesCount);
|
|
17
17
|
};
|
|
18
18
|
function Toolbar({ title, children, nodeProps, ...props }) {
|
|
19
19
|
const selectedNodesCount = useSelectedNodesCount();
|
|
20
20
|
const { selected = false, dragging = false, data: { hovered = false } } = nodeProps;
|
|
21
21
|
const _isToolbarVisible = hovered && selectedNodesCount === 0 || selected && selectedNodesCount === 1;
|
|
22
22
|
let delay = 150;
|
|
23
|
-
if (_isToolbarVisible)
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
if (_isToolbarVisible) {
|
|
24
|
+
if (selected) delay = 100;
|
|
25
|
+
else delay = 1e3;
|
|
26
|
+
} else if (selectedNodesCount > 0) delay = 50;
|
|
26
27
|
const [isToolbarVisible] = useDebouncedValue(_isToolbarVisible, delay);
|
|
27
28
|
if (!isToolbarVisible) return null;
|
|
28
29
|
return /* @__PURE__ */ jsx(NodeToolbar, {
|
|
@@ -35,7 +36,7 @@ function Toolbar({ title, children, nodeProps, ...props }) {
|
|
|
35
36
|
pb: 8,
|
|
36
37
|
pt: 4,
|
|
37
38
|
radius: "sm",
|
|
38
|
-
shadow: "
|
|
39
|
+
shadow: "lg",
|
|
39
40
|
onDoubleClickCapture: stopPropagation,
|
|
40
41
|
onPointerDown: stopPropagation,
|
|
41
42
|
onClick: stopPropagation,
|
|
@@ -134,7 +134,6 @@ var RelationshipPopover = memo(() => {
|
|
|
134
134
|
var getEdgeLabelElement = (edgeId, container) => {
|
|
135
135
|
return container?.querySelector(`.likec4-edge-label[data-edge-id="${edgeId}"]`) ?? container?.querySelector(`.likec4-edge-middle-point[data-edge-id="${edgeId}"]`) ?? null;
|
|
136
136
|
};
|
|
137
|
-
var POPOVER_PADDING = 8;
|
|
138
137
|
var RelationshipPopoverInternal = ({ viewId, diagramEdge, direct, nested, sourceNode, targetNode, onMouseEnter, onMouseLeave }) => {
|
|
139
138
|
const ref = useRef(null);
|
|
140
139
|
const { enableNavigateTo, enableVscode } = useEnabledFeatures();
|
|
@@ -180,7 +179,7 @@ var RelationshipPopoverInternal = ({ viewId, diagramEdge, direct, nested, source
|
|
|
180
179
|
})}px`
|
|
181
180
|
});
|
|
182
181
|
} }),
|
|
183
|
-
hide({ padding:
|
|
182
|
+
hide({ padding: 16 })
|
|
184
183
|
]
|
|
185
184
|
}).then(({ x, y, middlewareData }) => {
|
|
186
185
|
if (wasCanceled) return;
|
|
@@ -230,6 +229,8 @@ var RelationshipPopoverInternal = ({ viewId, diagramEdge, direct, nested, source
|
|
|
230
229
|
} },
|
|
231
230
|
className: cx(css({
|
|
232
231
|
layerStyle: "likec4.dropdown",
|
|
232
|
+
border: "subtle",
|
|
233
|
+
rounded: "sm",
|
|
233
234
|
p: "0",
|
|
234
235
|
pointerEvents: {
|
|
235
236
|
base: "all",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Color } from '@likec4/core/types';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import { StyledComponent } from '
|
|
3
|
+
import { StyledComponent } from '@likec4/styles/types';
|
|
4
4
|
export declare const Endpoint: ({ children, likec4color }: PropsWithChildren<{
|
|
5
5
|
likec4color: Color;
|
|
6
6
|
}>) => import("react").JSX.Element;
|
|
@@ -12,7 +12,7 @@ var Endpoint = ({ children, likec4color }) => {
|
|
|
12
12
|
whiteSpace: "nowrap",
|
|
13
13
|
overflow: "hidden",
|
|
14
14
|
textOverflow: "ellipsis",
|
|
15
|
-
|
|
15
|
+
truncate: true,
|
|
16
16
|
paddingX: "1",
|
|
17
17
|
paddingY: "0.5",
|
|
18
18
|
rounded: "xs",
|
|
@@ -25,6 +25,10 @@ var Endpoint = ({ children, likec4color }) => {
|
|
|
25
25
|
_dark: "var(--likec4-palette-loContrast)"
|
|
26
26
|
}
|
|
27
27
|
}),
|
|
28
|
+
style: {
|
|
29
|
+
minWidth: 0,
|
|
30
|
+
maxWidth: 160
|
|
31
|
+
},
|
|
28
32
|
children
|
|
29
33
|
});
|
|
30
34
|
};
|
|
@@ -35,7 +39,7 @@ var RelationshipTitle = styled("div", { base: {
|
|
|
35
39
|
userSelect: "all",
|
|
36
40
|
overflowWrap: "anywhere",
|
|
37
41
|
wordBreak: "break-word",
|
|
38
|
-
minWidth: 0
|
|
42
|
+
minWidth: "0"
|
|
39
43
|
} });
|
|
40
44
|
//#endregion
|
|
41
45
|
export { Endpoint, RelationshipTitle };
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { DiagramView, DynamicViewDisplayVariant, WhereOperator } from '@likec4/core/types';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
|
-
import { ViewPaddings } from '../../LikeC4Diagram.props';
|
|
4
|
-
export declare function DiagramActorProvider({ id, view, zoomable, pannable, nodesDraggable, nodesSelectable, fitViewPadding, where, children, dynamicViewVariant: _defaultVariant, }: PropsWithChildren<{
|
|
3
|
+
import { RelationshipBrowserScope, ViewPaddings } from '../../LikeC4Diagram.props';
|
|
4
|
+
export declare function DiagramActorProvider({ id, view, zoomable, pannable, fitView, initialZoom, nodesDraggable, nodesSelectable, fitViewPadding, where, minZoom, maxZoom, children, dynamicViewVariant: _defaultVariant, relationshipBrowserScope, }: PropsWithChildren<{
|
|
5
5
|
id: string;
|
|
6
6
|
view: DiagramView;
|
|
7
7
|
zoomable: boolean;
|
|
8
8
|
pannable: boolean;
|
|
9
|
+
fitView: boolean;
|
|
10
|
+
initialZoom?: number | undefined;
|
|
11
|
+
minZoom?: number | undefined;
|
|
12
|
+
maxZoom?: number | undefined;
|
|
9
13
|
nodesDraggable: boolean;
|
|
10
14
|
nodesSelectable: boolean;
|
|
11
15
|
fitViewPadding: ViewPaddings;
|
|
12
16
|
where?: WhereOperator | null;
|
|
13
17
|
dynamicViewVariant?: DynamicViewDisplayVariant | undefined;
|
|
18
|
+
relationshipBrowserScope: RelationshipBrowserScope;
|
|
14
19
|
}>): import("react").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { MinZoom } from "../../base/const.js";
|
|
2
3
|
import { useUpdateEffect } from "../../hooks/useUpdateEffect.js";
|
|
3
4
|
import { useDiagramEventHandlersRef } from "../../context/DiagramEventHandlers.js";
|
|
4
5
|
import { DiagramFeatures, useEnabledFeatures } from "../../context/DiagramFeatures.js";
|
|
@@ -14,7 +15,7 @@ import { useStoreApi } from "@xyflow/react";
|
|
|
14
15
|
import { isNullish } from "remeda";
|
|
15
16
|
import { useActorRef } from "@xstate/react";
|
|
16
17
|
//#region src/likec4diagram/state/DiagramActorProvider.tsx
|
|
17
|
-
function DiagramActorProvider({ id, view, zoomable, pannable, nodesDraggable, nodesSelectable, fitViewPadding, where = null, children, dynamicViewVariant: _defaultVariant }) {
|
|
18
|
+
function DiagramActorProvider({ id, view, zoomable, pannable, fitView, initialZoom, nodesDraggable, nodesSelectable, fitViewPadding, where = null, minZoom = MinZoom, maxZoom = 3, children, dynamicViewVariant: _defaultVariant, relationshipBrowserScope }) {
|
|
18
19
|
const xystore = useStoreApi();
|
|
19
20
|
const editor = useEditorActorLogic();
|
|
20
21
|
const features = useEnabledFeatures();
|
|
@@ -26,12 +27,17 @@ function DiagramActorProvider({ id, view, zoomable, pannable, nodesDraggable, no
|
|
|
26
27
|
view,
|
|
27
28
|
zoomable,
|
|
28
29
|
pannable,
|
|
30
|
+
fitView,
|
|
31
|
+
initialZoom,
|
|
32
|
+
minZoom,
|
|
33
|
+
maxZoom,
|
|
29
34
|
fitViewPadding,
|
|
30
35
|
nodesDraggable,
|
|
31
36
|
nodesSelectable,
|
|
32
37
|
where,
|
|
33
38
|
features,
|
|
34
|
-
dynamicViewVariant: _defaultVariant
|
|
39
|
+
dynamicViewVariant: _defaultVariant,
|
|
40
|
+
relationshipBrowserScope
|
|
35
41
|
}
|
|
36
42
|
});
|
|
37
43
|
const actorRef = useRef(actor);
|
|
@@ -54,18 +60,28 @@ function DiagramActorProvider({ id, view, zoomable, pannable, nodesDraggable, no
|
|
|
54
60
|
zoomable,
|
|
55
61
|
where,
|
|
56
62
|
pannable,
|
|
63
|
+
fitView,
|
|
64
|
+
initialZoom,
|
|
65
|
+
minZoom,
|
|
66
|
+
maxZoom,
|
|
57
67
|
fitViewPadding,
|
|
58
68
|
nodesDraggable,
|
|
59
|
-
nodesSelectable
|
|
69
|
+
nodesSelectable,
|
|
70
|
+
relationshipBrowserScope
|
|
60
71
|
}
|
|
61
72
|
}), [
|
|
62
73
|
actor,
|
|
63
74
|
zoomable,
|
|
64
75
|
where,
|
|
65
76
|
pannable,
|
|
77
|
+
fitView,
|
|
78
|
+
initialZoom,
|
|
79
|
+
minZoom,
|
|
80
|
+
maxZoom,
|
|
66
81
|
fitViewPadding,
|
|
67
82
|
nodesDraggable,
|
|
68
|
-
nodesSelectable
|
|
83
|
+
nodesSelectable,
|
|
84
|
+
relationshipBrowserScope
|
|
69
85
|
]);
|
|
70
86
|
useUpdateEffect(() => {
|
|
71
87
|
if (!_defaultVariant) return;
|
|
@@ -86,7 +86,7 @@ function resetEdgeControlPoints(nodeLookup, edge) {
|
|
|
86
86
|
if (source === target) {
|
|
87
87
|
const loopSize = 80;
|
|
88
88
|
const centerOfTopBoundary = vector(0, source.height || 0).multiply(-.5).add(sourceCenter);
|
|
89
|
-
return [centerOfTopBoundary.add(vector(-
|
|
89
|
+
return [centerOfTopBoundary.add(vector(-32, -80)).round().toObject(), centerOfTopBoundary.add(vector(loopSize / 2.5, -80)).round().toObject()];
|
|
90
90
|
}
|
|
91
91
|
const sourceToTargetVector = targetCenter.subtract(sourceCenter);
|
|
92
92
|
const sourceBorderPoint = getBorderPointOnVector(source, sourceCenter, sourceToTargetVector);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { bezierControlPoints, isSamePoint } from "../../utils/xyflow.js";
|
|
3
2
|
import { calcViewBounds } from "../../utils/view-bounds.js";
|
|
4
3
|
import { hasAtLeast, map } from "remeda";
|
|
5
4
|
import { getNodeDimensions } from "@xyflow/system";
|
|
@@ -7,7 +6,6 @@ import { getNodeDimensions } from "@xyflow/system";
|
|
|
7
6
|
function createViewChange(parentContext) {
|
|
8
7
|
const { view: { drifts: _1, _layout: _2, ...view }, xynodes, xystore } = parentContext;
|
|
9
8
|
const { nodeLookup, edgeLookup } = xystore.getState();
|
|
10
|
-
const movedNodes = /* @__PURE__ */ new Set();
|
|
11
9
|
const nodes = map(view.nodes, (node) => {
|
|
12
10
|
const internal = nodeLookup.get(node.id);
|
|
13
11
|
if (!internal) {
|
|
@@ -17,7 +15,6 @@ function createViewChange(parentContext) {
|
|
|
17
15
|
const xynodedata = xynodes.find((n) => n.data.id === node.id)?.data ?? internal.data;
|
|
18
16
|
const position = internal.internals.positionAbsolute;
|
|
19
17
|
const { width, height } = getNodeDimensions(internal);
|
|
20
|
-
if (!isSamePoint(position, node) || node.width !== width || node.height !== height) movedNodes.add(node.id);
|
|
21
18
|
return {
|
|
22
19
|
...node,
|
|
23
20
|
shape: xynodedata.shape,
|
|
@@ -36,9 +33,7 @@ function createViewChange(parentContext) {
|
|
|
36
33
|
return edge;
|
|
37
34
|
}
|
|
38
35
|
const data = xyedge.data;
|
|
39
|
-
|
|
40
|
-
const sourceOrTargetMoved = movedNodes.has(xyedge.source) || movedNodes.has(xyedge.target);
|
|
41
|
-
if (controlPoints.length === 0 && sourceOrTargetMoved) controlPoints = bezierControlPoints(data.points);
|
|
36
|
+
const controlPoints = data.controlPoints ?? [];
|
|
42
37
|
const _updated = {
|
|
43
38
|
...edge,
|
|
44
39
|
points: data.points
|
|
@@ -3,7 +3,7 @@ import { RefObject } from 'react';
|
|
|
3
3
|
import { PartialDeep } from 'type-fest';
|
|
4
4
|
import { TogglableFeature } from '../../context/DiagramFeatures';
|
|
5
5
|
import { EditorActorRef } from '../../editor/actor/machine';
|
|
6
|
-
import { OpenSourceParams } from '../../LikeC4Diagram.props';
|
|
6
|
+
import { OpenSourceParams, RelationshipBrowserScope } from '../../LikeC4Diagram.props';
|
|
7
7
|
import { OverlaysActorRef } from '../../overlays/overlaysActor';
|
|
8
8
|
import { SearchActorRef } from '../../search/searchActor';
|
|
9
9
|
import { Types } from '../types';
|
|
@@ -69,7 +69,7 @@ export declare class DiagramApi<A extends Any = Unknown> {
|
|
|
69
69
|
/**
|
|
70
70
|
* Open relationships browser
|
|
71
71
|
*/
|
|
72
|
-
openRelationshipsBrowser(fqn: Fqn<A
|
|
72
|
+
openRelationshipsBrowser(fqn: Fqn<A>, scope?: RelationshipBrowserScope): void;
|
|
73
73
|
/**
|
|
74
74
|
* If running in editor, trigger opening source file
|
|
75
75
|
*/
|
|
@@ -88,10 +88,11 @@ var DiagramApi = class DiagramApi {
|
|
|
88
88
|
/**
|
|
89
89
|
* Open relationships browser
|
|
90
90
|
*/
|
|
91
|
-
openRelationshipsBrowser(fqn) {
|
|
91
|
+
openRelationshipsBrowser(fqn, scope) {
|
|
92
92
|
this.send({
|
|
93
93
|
type: "open.relationshipsBrowser",
|
|
94
|
-
fqn
|
|
94
|
+
fqn,
|
|
95
|
+
...scope && { scope }
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { Base } from "../../base/Base.js";
|
|
3
|
+
import { convertToXYFlow } from "../convert-to-xyflow.js";
|
|
3
4
|
import { findDiagramEdge, findDiagramNode, typedSystem, viewBounds } from "./utils.js";
|
|
4
5
|
import { machine } from "./machine.setup.js";
|
|
5
6
|
import { createLayoutConstraints } from "../useLayoutConstraints.js";
|
|
6
7
|
import { focusNodesEdges, mergeXYNodesEdges, resetEdgeControlPoints } from "./assign.js";
|
|
7
|
-
import { convertToXYFlow } from "../convert-to-xyflow.js";
|
|
8
8
|
import { getAligner, toNodeRect } from "./aligners.js";
|
|
9
9
|
import { assignViewportBefore, cancelFitDiagram, centerOnNodeOrEdge, fitDiagram, fitFocusedBounds, raiseFitDiagram, raiseSetViewport, raiseUpdateView, returnViewportBefore, setViewport, setViewportCenter } from "./machine.actions.layout.js";
|
|
10
10
|
import { hasAtLeast, isTruthy, mapToObj } from "remeda";
|
|
@@ -13,6 +13,7 @@ import { BBox as BBox$1 } from "@likec4/core/geometry";
|
|
|
13
13
|
import { difference as difference$1, isString as isString$1 } from "@likec4/core/utils";
|
|
14
14
|
import { nodeToRect } from "@xyflow/system";
|
|
15
15
|
import { assertEvent } from "xstate";
|
|
16
|
+
import { getViewFolderPath } from "@likec4/core/model";
|
|
16
17
|
import { produce } from "immer";
|
|
17
18
|
//#region src/likec4diagram/state/machine.actions.ts
|
|
18
19
|
var resetSelection = () => machine.raise({ type: "xyflow.resetSelection" });
|
|
@@ -231,7 +232,7 @@ var emitOnLayoutTypeChange = () => machine.enqueueActions(({ event, system, cont
|
|
|
231
232
|
return;
|
|
232
233
|
}
|
|
233
234
|
if (context.toggledFeatures.enableCompareWithLatest === true) {
|
|
234
|
-
if (currentLayoutType === "manual" && nextLayoutType === "auto") typedSystem
|
|
235
|
+
if (currentLayoutType === "manual" && nextLayoutType === "auto") enqueue.sendTo(typedSystem.editorActor, { type: "cancel" });
|
|
235
236
|
const currentViewport = context.viewport;
|
|
236
237
|
if (currentLayoutType === "auto") enqueue.assign({ viewportOnAutoLayout: currentViewport });
|
|
237
238
|
if (currentLayoutType === "manual") enqueue.assign({ viewportOnManualLayout: currentViewport });
|
|
@@ -250,7 +251,8 @@ var layoutAlign = (params) => machine.createAction(({ context, event }) => {
|
|
|
250
251
|
}
|
|
251
252
|
const xystore = nonNullable(context.xystore, "xystore is not initialized");
|
|
252
253
|
const { nodeLookup, parentLookup } = xystore.getState();
|
|
253
|
-
const
|
|
254
|
+
const selectedNodes = new Set(nodeLookup.values().filter((n) => n.selected).map((n) => n.id));
|
|
255
|
+
const nodesToAlign = [...difference$1(selectedNodes, new Set(parentLookup.keys()))];
|
|
254
256
|
if (!hasAtLeast(nodesToAlign, 2)) {
|
|
255
257
|
console.warn("At least 2 nodes must be selected to align");
|
|
256
258
|
return;
|
|
@@ -307,8 +309,9 @@ var notationsHighlight = () => machine.assign(({ context, event }) => {
|
|
|
307
309
|
});
|
|
308
310
|
var tagHighlight = () => machine.assign(({ context, event }) => {
|
|
309
311
|
assertEvent(event, "tag.highlight");
|
|
312
|
+
const tag = event.tag.startsWith("#") ? event.tag.slice(1) : event.tag;
|
|
310
313
|
return { xynodes: context.xynodes.map((n) => {
|
|
311
|
-
if (n.data.tags
|
|
314
|
+
if (n.data.tags && n.data.tags.includes(tag)) return Base.setDimmed(n, false);
|
|
312
315
|
return Base.setDimmed(n, true);
|
|
313
316
|
}) };
|
|
314
317
|
});
|
|
@@ -476,7 +479,7 @@ var openOverlay = () => machine.enqueueActions(({ context, event, enqueue, check
|
|
|
476
479
|
type: "open.relationshipsBrowser",
|
|
477
480
|
subject: event.fqn,
|
|
478
481
|
viewId: context.view.id,
|
|
479
|
-
scope:
|
|
482
|
+
scope: event.scope ?? context.relationshipBrowserScope,
|
|
480
483
|
closeable: true,
|
|
481
484
|
enableChangeScope: true,
|
|
482
485
|
enableSelectSubject: true
|
|
@@ -536,12 +539,13 @@ var ensureNavigationPanelActor = () => machine.enqueueActions(({ enqueue, check,
|
|
|
536
539
|
const enabled = check("enabled: NavigationPanel");
|
|
537
540
|
const running = typedSystem(system).navigationActorRef;
|
|
538
541
|
if (enabled && !running) {
|
|
542
|
+
const viewFolder = context.view.title ? getViewFolderPath(context.view.title) : "";
|
|
539
543
|
enqueue.spawnChild("navigationPanel", {
|
|
540
544
|
id: "navigationPanel",
|
|
541
545
|
systemId: "navigationPanel",
|
|
542
546
|
input: {
|
|
543
|
-
|
|
544
|
-
|
|
547
|
+
viewId: context.view.id,
|
|
548
|
+
viewFolder: viewFolder ?? ""
|
|
545
549
|
},
|
|
546
550
|
syncSnapshot: true
|
|
547
551
|
});
|
|
@@ -737,7 +741,10 @@ var updateView = () => machine.enqueueActions(({ enqueue, event, context }) => {
|
|
|
737
741
|
let recenter = !context.viewportChangedManually && !context.focusedNode && !context.activeWalkthrough;
|
|
738
742
|
recenter = recenter || context.toggledFeatures.enableCompareWithLatest === true && !!nextView._layout && context.view._layout !== nextView._layout;
|
|
739
743
|
if (nextView._type === "dynamic" && context.view._type === "dynamic") {
|
|
740
|
-
if (nextView.variant === context.view.variant && nextView.variant !== context.dynamicViewVariant)
|
|
744
|
+
if (nextView.variant === context.view.variant && nextView.variant !== context.dynamicViewVariant) {
|
|
745
|
+
const nextCenter = BBox$1.center(viewBounds(context, nextView));
|
|
746
|
+
enqueue(setViewportCenter(nextCenter));
|
|
747
|
+
}
|
|
741
748
|
}
|
|
742
749
|
if (recenter) {
|
|
743
750
|
enqueue(cancelFitDiagram());
|
|
@@ -225,6 +225,7 @@ export declare const centerOnNodeOrEdge: () => ActionFunction<Context, Events, E
|
|
|
225
225
|
export declare const fitDiagram: (params?: {
|
|
226
226
|
duration?: number;
|
|
227
227
|
bounds?: BBox;
|
|
228
|
+
zoom?: number | undefined;
|
|
228
229
|
}) => ActionFunction<Context, Events, Events, unknown, {
|
|
229
230
|
src: "search";
|
|
230
231
|
logic: SearchActorLogic;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { MinZoom } from "../../base/const.js";
|
|
3
2
|
import { calcEdgeBounds } from "../../utils/view-bounds.js";
|
|
4
3
|
import { activeSequenceBounds, focusedBounds, getEdgeBounds, viewBounds } from "./utils.js";
|
|
5
4
|
import { isActiveSequenceWalkthrough, machine } from "./machine.setup.js";
|
|
@@ -77,15 +76,16 @@ var centerOnNodeOrEdge = () => machine.raise(({ context, event }) => {
|
|
|
77
76
|
bounds: getNodesBounds([node], xystate)
|
|
78
77
|
};
|
|
79
78
|
});
|
|
80
|
-
function fitBoundsInViewport(context, bounds, duration) {
|
|
79
|
+
function fitBoundsInViewport(context, bounds, duration, zoom) {
|
|
81
80
|
let { width, height, panZoom, transform } = nonNullable(context.xystore).getState();
|
|
82
81
|
let left = void 0;
|
|
83
82
|
if (isActiveSequenceWalkthrough(context)) {
|
|
84
83
|
left = context.activeWalkthrough.outlinePanelWidth;
|
|
85
84
|
width -= left;
|
|
86
85
|
}
|
|
87
|
-
const
|
|
88
|
-
const
|
|
86
|
+
const minZoom = zoom ?? context.minZoom;
|
|
87
|
+
const maxZoom = zoom ?? calcMaxZoom(context, transform);
|
|
88
|
+
const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, context.fitViewPadding);
|
|
89
89
|
viewport.x = Math.round(viewport.x);
|
|
90
90
|
viewport.y = Math.round(viewport.y);
|
|
91
91
|
if (left !== void 0) viewport.x += left;
|
|
@@ -100,16 +100,18 @@ function fitBoundsInViewport(context, bounds, duration) {
|
|
|
100
100
|
var fitDiagram = (params) => machine.createAction(({ context, event }) => {
|
|
101
101
|
let bounds;
|
|
102
102
|
let duration;
|
|
103
|
+
let zoom;
|
|
103
104
|
if (params) {
|
|
104
105
|
bounds = params.bounds;
|
|
105
106
|
duration = params.duration;
|
|
107
|
+
zoom = params.zoom;
|
|
106
108
|
} else if (event.type === "xyflow.fitDiagram") {
|
|
107
109
|
bounds = event.bounds;
|
|
108
110
|
duration = event.duration;
|
|
109
111
|
}
|
|
110
112
|
bounds ??= viewBounds(context);
|
|
111
113
|
duration ??= 450;
|
|
112
|
-
fitBoundsInViewport(context, bounds, duration);
|
|
114
|
+
fitBoundsInViewport(context, bounds, duration, zoom);
|
|
113
115
|
});
|
|
114
116
|
var fitFocusedBounds = (params) => machine.createAction(({ context }) => {
|
|
115
117
|
let { bounds, duration = 450 } = !!context.activeWalkthrough ? activeSequenceBounds({ context }) : focusedBounds({ context });
|
|
@@ -6,7 +6,7 @@ import { PartialDeep } from 'type-fest';
|
|
|
6
6
|
import { ActorRefFromLogic, StateMachine, StateValue, SetupReturn, NonReducibleUnknown, MetaObject } from 'xstate';
|
|
7
7
|
import { EnabledFeatures, TogglableFeature } from '../../context/DiagramFeatures';
|
|
8
8
|
import { XYFlowInstance, XYStoreApi } from '../../hooks/useXYFlow';
|
|
9
|
-
import { OpenSourceParams, ViewPaddings } from '../../LikeC4Diagram.props';
|
|
9
|
+
import { OpenSourceParams, RelationshipBrowserScope, ViewPaddings } from '../../LikeC4Diagram.props';
|
|
10
10
|
import { Types } from '../types';
|
|
11
11
|
import { AlignmentMode } from './aligners';
|
|
12
12
|
import { HotKeyEvent, HotkeyActorLogic } from './hotkeyActor';
|
|
@@ -40,17 +40,23 @@ export interface Input {
|
|
|
40
40
|
xystore: XYStoreApi;
|
|
41
41
|
zoomable: boolean;
|
|
42
42
|
pannable: boolean;
|
|
43
|
+
fitView?: boolean | undefined;
|
|
44
|
+
initialZoom?: number | undefined;
|
|
45
|
+
minZoom?: number | undefined;
|
|
46
|
+
maxZoom?: number | undefined;
|
|
43
47
|
nodesDraggable: boolean;
|
|
44
48
|
nodesSelectable: boolean;
|
|
45
49
|
fitViewPadding: ViewPaddings;
|
|
46
50
|
where: WhereOperator | null;
|
|
47
51
|
dynamicViewVariant?: DynamicViewDisplayVariant | undefined;
|
|
52
|
+
relationshipBrowserScope?: RelationshipBrowserScope | undefined;
|
|
48
53
|
features?: EnabledFeatures;
|
|
49
54
|
}
|
|
50
55
|
export type ToggledFeatures = {
|
|
51
56
|
[P in `enable${TogglableFeature}`]?: boolean;
|
|
52
57
|
};
|
|
53
58
|
export interface Context extends Input {
|
|
59
|
+
relationshipBrowserScope: RelationshipBrowserScope;
|
|
54
60
|
xynodes: Types.Node[];
|
|
55
61
|
xyedges: Types.Edge[];
|
|
56
62
|
features: EnabledFeatures;
|
|
@@ -100,6 +106,8 @@ export interface Context extends Input {
|
|
|
100
106
|
collapsedSequenceFlows: {
|
|
101
107
|
[flowId: StepPath]: boolean;
|
|
102
108
|
};
|
|
109
|
+
minZoom: number;
|
|
110
|
+
maxZoom: number;
|
|
103
111
|
}
|
|
104
112
|
export declare function Context({ input }: {
|
|
105
113
|
input: Input;
|
|
@@ -206,6 +214,7 @@ export type Events = HotKeyEvent | MediaPrintEvent | {
|
|
|
206
214
|
} | {
|
|
207
215
|
type: 'open.relationshipsBrowser';
|
|
208
216
|
fqn: Fqn;
|
|
217
|
+
scope?: RelationshipBrowserScope | undefined;
|
|
209
218
|
} | {
|
|
210
219
|
type: 'open.search';
|
|
211
220
|
search?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import "../../base/const.js";
|
|
2
3
|
import { DefaultFeatures } from "../../context/DiagramFeatures.js";
|
|
3
4
|
import { defineActors } from "../../utils/defineActors.js";
|
|
4
5
|
import { editorActorLogic } from "../../editor/actor/machine.js";
|
|
@@ -16,6 +17,8 @@ import { assertEvent, setup } from "xstate";
|
|
|
16
17
|
function Context({ input }) {
|
|
17
18
|
return {
|
|
18
19
|
...input,
|
|
20
|
+
fitView: input.fitView ?? true,
|
|
21
|
+
relationshipBrowserScope: input.relationshipBrowserScope ?? "view",
|
|
19
22
|
xynodes: [],
|
|
20
23
|
xyedges: [],
|
|
21
24
|
features: {
|
|
@@ -51,7 +54,9 @@ function Context({ input }) {
|
|
|
51
54
|
xyflow: null,
|
|
52
55
|
dynamicViewVariant: input.dynamicViewVariant ?? (input.view._type === "dynamic" ? input.view.variant : "diagram") ?? "diagram",
|
|
53
56
|
activeWalkthrough: null,
|
|
54
|
-
collapsedSequenceFlows: {}
|
|
57
|
+
collapsedSequenceFlows: {},
|
|
58
|
+
minZoom: input.minZoom ?? .05,
|
|
59
|
+
maxZoom: input.maxZoom ?? 3
|
|
55
60
|
};
|
|
56
61
|
}
|
|
57
62
|
var deriveToggledFeatures = (context) => {
|
|
@@ -67,6 +72,14 @@ var isReadOnly = (context) => deriveToggledFeatures(context).enableReadOnly;
|
|
|
67
72
|
function isActiveSequenceWalkthrough(context) {
|
|
68
73
|
return isDynamicView(context.view) && context.dynamicViewVariant === "sequence" && !!context.activeWalkthrough && hasProp(context.view, "flow");
|
|
69
74
|
}
|
|
75
|
+
var actors = defineActors({
|
|
76
|
+
hotkey: hotkeyActorLogic,
|
|
77
|
+
overlays: overlaysActorLogic,
|
|
78
|
+
search: searchActorLogic,
|
|
79
|
+
mediaPrint: mediaPrintActorLogic,
|
|
80
|
+
editor: editorActorLogic,
|
|
81
|
+
navigationPanel: navigationPanelActorLogic
|
|
82
|
+
});
|
|
70
83
|
var machine = setup({
|
|
71
84
|
types: {
|
|
72
85
|
context: {},
|
|
@@ -75,14 +88,7 @@ var machine = setup({
|
|
|
75
88
|
events: {},
|
|
76
89
|
emitted: {}
|
|
77
90
|
},
|
|
78
|
-
actors
|
|
79
|
-
hotkey: hotkeyActorLogic,
|
|
80
|
-
overlays: overlaysActorLogic,
|
|
81
|
-
search: searchActorLogic,
|
|
82
|
-
mediaPrint: mediaPrintActorLogic,
|
|
83
|
-
editor: editorActorLogic,
|
|
84
|
-
navigationPanel: navigationPanelActorLogic
|
|
85
|
-
}),
|
|
91
|
+
actors,
|
|
86
92
|
guards: {
|
|
87
93
|
"isReady": ({ context }) => context.initialized.xydata && context.initialized.xyflow,
|
|
88
94
|
"enabled: Editor": ({ context }) => context.features.enableEditor,
|
|
@@ -96,7 +96,7 @@ export declare const initializing: {
|
|
|
96
96
|
export declare const isReady: {
|
|
97
97
|
always: ({
|
|
98
98
|
guard: "isReady";
|
|
99
|
-
actions:
|
|
99
|
+
actions: ActionFunction<Context, Events, Events, undefined, {
|
|
100
100
|
src: "search";
|
|
101
101
|
logic: SearchActorLogic;
|
|
102
102
|
id: "search";
|
|
@@ -198,31 +198,7 @@ export declare const isReady: {
|
|
|
198
198
|
} | {
|
|
199
199
|
type: "click: active walkthrough step";
|
|
200
200
|
params: unknown;
|
|
201
|
-
}, never, EmittedEvents
|
|
202
|
-
src: "search";
|
|
203
|
-
logic: SearchActorLogic;
|
|
204
|
-
id: "search";
|
|
205
|
-
} | {
|
|
206
|
-
src: "hotkey";
|
|
207
|
-
logic: HotkeyActorLogic;
|
|
208
|
-
id: "hotkey";
|
|
209
|
-
} | {
|
|
210
|
-
src: "overlays";
|
|
211
|
-
logic: OverlaysActorLogic;
|
|
212
|
-
id: "overlays";
|
|
213
|
-
} | {
|
|
214
|
-
src: "mediaPrint";
|
|
215
|
-
logic: MediaPrintActorLogic;
|
|
216
|
-
id: "mediaPrint";
|
|
217
|
-
} | {
|
|
218
|
-
src: "editor";
|
|
219
|
-
logic: EditorActorLogic;
|
|
220
|
-
id: "editor";
|
|
221
|
-
} | {
|
|
222
|
-
src: "navigationPanel";
|
|
223
|
-
logic: NavigationPanelActorLogic;
|
|
224
|
-
id: "navigationPanel";
|
|
225
|
-
}, never, never, never, never> | ActionFunction<Context, Events, Events, undefined, never, never, never, never, EmittedEvents>)[];
|
|
201
|
+
}, never, EmittedEvents>;
|
|
226
202
|
target: string;
|
|
227
203
|
} | {
|
|
228
204
|
target: string;
|