@likec4/diagram 1.18.0 → 1.19.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/LICENSE +1 -1
- package/dist/LikeC4CustomColors.d.ts +7 -0
- package/dist/LikeC4CustomColors.js +30 -0
- package/dist/LikeC4Diagram.css.d.ts +5 -0
- package/dist/LikeC4Diagram.css.js +13 -0
- package/dist/LikeC4Diagram.d.ts +6 -0
- package/dist/LikeC4Diagram.js +194 -0
- package/dist/LikeC4Diagram.props.d.ts +166 -0
- package/dist/LikeC4ModelProvider.d.ts +9 -0
- package/dist/LikeC4ModelProvider.js +12 -0
- package/dist/LikeC4Search.css.d.ts +1 -0
- package/dist/LikeC4Search.css.js +5 -0
- package/dist/LikeC4Search.d.ts +2 -0
- package/dist/LikeC4Search.js +96 -0
- package/dist/StaticLikeC4Diagram.d.ts +3 -0
- package/dist/StaticLikeC4Diagram.js +41 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/controls/Text.d.ts +2 -0
- package/dist/controls/Text.js +7 -0
- package/dist/controls/action-button-bar/ActionButtonBar.css.d.ts +1 -0
- package/dist/controls/action-button-bar/ActionButtonBar.css.js +5 -0
- package/dist/controls/action-button-bar/ActionButtonBar.d.ts +9 -0
- package/dist/controls/action-button-bar/ActionButtonBar.js +100 -0
- package/dist/controls/action-button-bar/useActionButtonBarCtx.d.ts +10 -0
- package/dist/controls/action-button-bar/useActionButtonBarCtx.js +9 -0
- package/dist/controls/action-buttons/ActionButton.css.d.ts +1 -0
- package/dist/controls/action-buttons/ActionButton.css.js +5 -0
- package/dist/controls/action-buttons/ActionButton.d.ts +9 -0
- package/dist/controls/action-buttons/ActionButton.js +66 -0
- package/dist/controls/action-buttons/ActionButtons.d.ts +12 -0
- package/dist/controls/action-buttons/ActionButtons.js +99 -0
- package/dist/globals.css.d.ts +1 -0
- package/dist/globals.css.js +92 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/useDiagramState.d.ts +6 -0
- package/dist/hooks/useDiagramState.js +27 -0
- package/dist/hooks/useMantinePortalProps.d.ts +9 -0
- package/dist/hooks/useMantinePortalProps.js +9 -0
- package/dist/hooks/useSetState.d.ts +2 -0
- package/dist/hooks/useSetState.js +19 -0
- package/dist/hooks/useUpdateEffect.d.ts +4 -0
- package/dist/hooks/useUpdateEffect.js +32 -0
- package/dist/hooks/useXYFlow.d.ts +270 -0
- package/dist/hooks/useXYFlow.js +20 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +25 -0
- package/dist/likec4model/LikeC4ModelContext.d.ts +3 -0
- package/dist/likec4model/LikeC4ModelContext.js +5 -0
- package/dist/likec4model/index.d.ts +2 -0
- package/dist/likec4model/useLikeC4ElementsTree.d.ts +12 -0
- package/dist/likec4model/useLikeC4ElementsTree.js +25 -0
- package/dist/likec4model/useLikeC4Model.d.ts +20 -0
- package/dist/likec4model/useLikeC4Model.js +55 -0
- package/dist/overlays/OverlayContext.d.ts +10 -0
- package/dist/overlays/OverlayContext.js +9 -0
- package/dist/overlays/Overlays.css.d.ts +3 -0
- package/dist/overlays/Overlays.css.js +7 -0
- package/dist/overlays/Overlays.d.ts +2 -0
- package/dist/overlays/Overlays.js +137 -0
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.d.ts +5 -0
- package/dist/overlays/edge-details/EdgeDetailsXYFlow.js +185 -0
- package/dist/overlays/edge-details/SelectEdge.css.d.ts +7 -0
- package/dist/overlays/edge-details/SelectEdge.css.js +17 -0
- package/dist/overlays/edge-details/SelectEdge.d.ts +5 -0
- package/dist/overlays/edge-details/SelectEdge.js +129 -0
- package/dist/overlays/edge-details/_types.d.ts +14 -0
- package/dist/overlays/edge-details/use-layouted-edge-details.d.ts +21 -0
- package/dist/overlays/edge-details/use-layouted-edge-details.js +270 -0
- package/dist/overlays/edge-details/xyflow/CompoundNode.d.ts +5 -0
- package/dist/overlays/edge-details/xyflow/CompoundNode.js +76 -0
- package/dist/overlays/edge-details/xyflow/ElementNode.d.ts +5 -0
- package/dist/overlays/edge-details/xyflow/ElementNode.js +159 -0
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.d.ts +3 -0
- package/dist/overlays/edge-details/xyflow/RelationshipEdge.js +84 -0
- package/dist/overlays/edge-details/xyflow/styles.css.d.ts +9 -0
- package/dist/overlays/edge-details/xyflow/styles.css.js +21 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.d.ts +16 -0
- package/dist/overlays/element-details/ElementDetailsCard.css.js +33 -0
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +7 -0
- package/dist/overlays/element-details/ElementDetailsCard.js +484 -0
- package/dist/overlays/element-details/TabPanelDeployments.css.d.ts +4 -0
- package/dist/overlays/element-details/TabPanelDeployments.css.js +11 -0
- package/dist/overlays/element-details/TabPanelDeployments.d.ts +7 -0
- package/dist/overlays/element-details/TabPanelDeployments.js +173 -0
- package/dist/overlays/element-details/TabPanelRelationships.css.d.ts +5 -0
- package/dist/overlays/element-details/TabPanelRelationships.css.js +11 -0
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +8 -0
- package/dist/overlays/element-details/TabPanelRelationships.js +157 -0
- package/dist/overlays/element-details/TabPanelStructure.css.d.ts +2 -0
- package/dist/overlays/element-details/TabPanelStructure.css.js +7 -0
- package/dist/overlays/element-details/TabPanelStructure.d.ts +25 -0
- package/dist/overlays/element-details/TabPanelStructure.js +91 -0
- package/dist/overlays/index.d.ts +1 -0
- package/dist/overlays/relationships-of/RelationshipsOverlay.d.ts +5 -0
- package/dist/overlays/relationships-of/RelationshipsOverlay.js +193 -0
- package/dist/overlays/relationships-of/RelationshipsXYFlow.d.ts +19 -0
- package/dist/overlays/relationships-of/RelationshipsXYFlow.js +290 -0
- package/dist/overlays/relationships-of/SelectElement.css.d.ts +2 -0
- package/dist/overlays/relationships-of/SelectElement.css.js +7 -0
- package/dist/overlays/relationships-of/SelectElement.d.ts +7 -0
- package/dist/overlays/relationships-of/SelectElement.js +126 -0
- package/dist/overlays/relationships-of/_types.d.ts +28 -0
- package/dist/overlays/relationships-of/use-layouted-relationships.d.ts +22 -0
- package/dist/overlays/relationships-of/use-layouted-relationships.js +496 -0
- package/dist/overlays/relationships-of/xyflow/CompoundNode.d.ts +6 -0
- package/dist/overlays/relationships-of/xyflow/CompoundNode.js +120 -0
- package/dist/overlays/relationships-of/xyflow/ElementNode.d.ts +6 -0
- package/dist/overlays/relationships-of/xyflow/ElementNode.js +194 -0
- package/dist/overlays/relationships-of/xyflow/EmptyNode.d.ts +5 -0
- package/dist/overlays/relationships-of/xyflow/EmptyNode.js +18 -0
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.d.ts +3 -0
- package/dist/overlays/relationships-of/xyflow/RelationshipEdge.js +123 -0
- package/dist/overlays/relationships-of/xyflow/styles.css.d.ts +14 -0
- package/dist/overlays/relationships-of/xyflow/styles.css.js +24 -0
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.d.ts +4 -0
- package/dist/overlays/shared/xyflow/RelationshipEdge.css.js +12 -0
- package/dist/overlays/shared/xyflow/_types.d.ts +77 -0
- package/dist/state/DiagramContext.d.ts +1609 -0
- package/dist/state/DiagramContext.js +101 -0
- package/dist/state/aligners.d.ts +42 -0
- package/dist/state/aligners.js +349 -0
- package/dist/state/diagram-to-xyflow.d.ts +11 -0
- package/dist/state/diagram-to-xyflow.js +113 -0
- package/dist/state/diagramStore.d.ts +1705 -0
- package/dist/state/diagramStore.js +808 -0
- package/dist/state/diagramStore.layout.d.ts +4 -0
- package/dist/state/diagramStore.layout.js +56 -0
- package/dist/style.css +1 -0
- package/dist/theme-vars.css.d.ts +72 -0
- package/dist/theme-vars.css.js +6 -0
- package/dist/theme-vars.css.ts.vanilla.css.js +1 -0
- package/dist/theme-vars.d.ts +3 -0
- package/dist/theme-vars.js +5 -0
- package/dist/ui/DiagramTitlePanel.css.d.ts +4 -0
- package/dist/ui/DiagramTitlePanel.css.js +11 -0
- package/dist/ui/DiagramTitlePanel.d.ts +1 -0
- package/dist/ui/DiagramTitlePanel.js +159 -0
- package/dist/ui/DynamicViewWalkthrough.css.d.ts +4 -0
- package/dist/ui/DynamicViewWalkthrough.css.js +11 -0
- package/dist/ui/DynamicViewWalkthrough.d.ts +1 -0
- package/dist/ui/DynamicViewWalkthrough.js +156 -0
- package/dist/ui/EnsureMantine.d.ts +7 -0
- package/dist/ui/EnsureMantine.js +14 -0
- package/dist/ui/FramerMotionConfig.d.ts +2 -0
- package/dist/ui/FramerMotionConfig.js +14 -0
- package/dist/ui/Link.d.ts +4 -0
- package/dist/ui/Link.js +36 -0
- package/dist/ui/notation/NotationPanel.css.d.ts +6 -0
- package/dist/ui/notation/NotationPanel.css.js +16 -0
- package/dist/ui/notation/NotationPanel.d.ts +1 -0
- package/dist/ui/notation/NotationPanel.js +250 -0
- package/dist/ui/notation/index.d.ts +1 -0
- package/dist/ui/top-left/ChangeAutoLayoutButton.d.ts +2 -0
- package/dist/ui/top-left/ChangeAutoLayoutButton.js +159 -0
- package/dist/ui/top-left/ManualLayoutToolsButton.d.ts +2 -0
- package/dist/ui/top-left/ManualLayoutToolsButton.js +137 -0
- package/dist/ui/top-left/TopLeftPanel.d.ts +4 -0
- package/dist/ui/top-left/TopLeftPanel.js +211 -0
- package/dist/ui/top-left/_shared.d.ts +7 -0
- package/dist/ui/top-left/_shared.js +22 -0
- package/dist/ui/top-left/styles.css.d.ts +8 -0
- package/dist/ui/top-left/styles.css.js +17 -0
- package/dist/utils/types.d.ts +8 -0
- package/dist/utils/vector.d.ts +24 -0
- package/dist/utils/vector.js +55 -0
- package/dist/xyflow/EdgeMarkers.d.ts +12 -0
- package/dist/xyflow/EdgeMarkers.js +192 -0
- package/dist/xyflow/FitviewOnDiagramChange.d.ts +4 -0
- package/dist/xyflow/FitviewOnDiagramChange.js +72 -0
- package/dist/xyflow/SelectEdgesOnNodeFocus.d.ts +1 -0
- package/dist/xyflow/SelectEdgesOnNodeFocus.js +96 -0
- package/dist/xyflow/XYFlow.d.ts +8 -0
- package/dist/xyflow/XYFlow.js +145 -0
- package/dist/xyflow/XYFlowBackground.d.ts +10 -0
- package/dist/xyflow/XYFlowBackground.js +25 -0
- package/dist/xyflow/XYFlowInner.d.ts +8 -0
- package/dist/xyflow/XYFlowInner.js +41 -0
- package/dist/xyflow/const.d.ts +7 -0
- package/dist/xyflow/const.js +12 -0
- package/dist/xyflow/edges/EdgeLabel.d.ts +7 -0
- package/dist/xyflow/edges/EdgeLabel.js +160 -0
- package/dist/xyflow/edges/RelationshipEdge.d.ts +6 -0
- package/dist/xyflow/edges/RelationshipEdge.js +443 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.css.d.ts +4 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.css.js +11 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.d.ts +13 -0
- package/dist/xyflow/edges/RelationshipsDropdownMenu.js +211 -0
- package/dist/xyflow/edges/edges.css.d.ts +17 -0
- package/dist/xyflow/edges/edges.css.js +37 -0
- package/dist/xyflow/edges/utils.d.ts +16 -0
- package/dist/xyflow/edges/utils.js +24 -0
- package/dist/xyflow/nodes/AnimateVariants.d.ts +1313 -0
- package/dist/xyflow/nodes/AnimateVariants.js +123 -0
- package/dist/xyflow/nodes/Node.css.d.ts +3 -0
- package/dist/xyflow/nodes/Node.css.js +9 -0
- package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +14 -0
- package/dist/xyflow/nodes/compound/CompoundNode.css.js +27 -0
- package/dist/xyflow/nodes/compound/CompoundNode.d.ts +6 -0
- package/dist/xyflow/nodes/compound/CompoundNode.js +216 -0
- package/dist/xyflow/nodes/compound/index.d.ts +1 -0
- package/dist/xyflow/nodes/element/ElementLink.css.d.ts +3 -0
- package/dist/xyflow/nodes/element/ElementLink.d.ts +6 -0
- package/dist/xyflow/nodes/element/ElementNode.d.ts +6 -0
- package/dist/xyflow/nodes/element/ElementNode.js +190 -0
- package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +17 -0
- package/dist/xyflow/nodes/element/ElementShapeSvg.js +175 -0
- package/dist/xyflow/nodes/element/element.css.d.ts +18 -0
- package/dist/xyflow/nodes/element/element.css.js +31 -0
- package/dist/xyflow/nodes/element/index.d.ts +1 -0
- package/dist/xyflow/nodes/shared/ElementIcon.d.ts +8 -0
- package/dist/xyflow/nodes/shared/ElementIcon.js +38 -0
- package/dist/xyflow/nodes/shared/Toolbar.d.ts +9 -0
- package/dist/xyflow/nodes/shared/Toolbar.js +436 -0
- package/dist/xyflow/types.d.ts +36 -0
- package/dist/xyflow/useLayoutConstraints.d.ts +42 -0
- package/dist/xyflow/useLayoutConstraints.js +226 -0
- package/dist/xyflow/useXYFlowEvents.d.ts +160 -0
- package/dist/xyflow/useXYFlowEvents.js +275 -0
- package/dist/xyflow/utils.d.ts +22 -0
- package/dist/xyflow/utils.js +72 -0
- package/package.json +34 -27
- package/src/LikeC4Diagram.tsx +4 -4
- package/src/LikeC4Search.css.ts +12 -0
- package/src/LikeC4Search.tsx +39 -90
- package/src/controls/Text.ts +5 -0
- package/src/controls/action-button-bar/ActionButtonBar.css.ts +13 -0
- package/src/controls/action-button-bar/ActionButtonBar.tsx +138 -0
- package/src/controls/action-button-bar/useActionButtonBarCtx.ts +13 -0
- package/src/controls/action-buttons/ActionButton.css.ts +29 -0
- package/src/controls/action-buttons/ActionButton.tsx +66 -0
- package/src/controls/action-buttons/ActionButtons.tsx +138 -0
- package/src/hooks/useXYFlow.ts +8 -8
- package/src/index.ts +12 -6
- package/src/likec4model/index.ts +12 -2
- package/src/overlays/edge-details/EdgeDetailsXYFlow.tsx +18 -12
- package/src/overlays/edge-details/_types.ts +13 -37
- package/src/overlays/edge-details/use-layouted-edge-details.ts +16 -14
- package/src/overlays/edge-details/xyflow/CompoundNode.tsx +3 -11
- package/src/overlays/edge-details/xyflow/ElementNode.tsx +4 -11
- package/src/overlays/edge-details/xyflow/RelationshipEdge.tsx +3 -3
- package/src/overlays/edge-details/xyflow/styles.css.ts +1 -59
- package/src/overlays/relationships-of/RelationshipsXYFlow.tsx +23 -23
- package/src/overlays/relationships-of/_types.ts +20 -58
- package/src/overlays/relationships-of/use-layouted-relationships.ts +36 -40
- package/src/overlays/relationships-of/xyflow/CompoundNode.tsx +9 -13
- package/src/overlays/relationships-of/xyflow/ElementNode.tsx +12 -15
- package/src/overlays/relationships-of/xyflow/EmptyNode.tsx +4 -7
- package/src/overlays/relationships-of/xyflow/RelationshipEdge.tsx +16 -14
- package/src/overlays/shared/xyflow/RelationshipEdge.css.ts +60 -0
- package/src/overlays/shared/xyflow/_types.ts +87 -0
- package/src/state/diagram-to-xyflow.ts +6 -7
- package/src/state/diagramStore.layout.ts +3 -4
- package/src/state/diagramStore.ts +35 -37
- package/src/theme-vars.css.ts +81 -0
- package/src/theme-vars.ts +8 -81
- package/src/ui/DiagramTitlePanel.tsx +6 -6
- package/src/utils/types.ts +6 -0
- package/src/xyflow/SelectEdgesOnNodeFocus.tsx +3 -3
- package/src/xyflow/XYFlow.tsx +2 -2
- package/src/xyflow/edges/EdgeLabel.tsx +25 -18
- package/src/xyflow/edges/RelationshipEdge.tsx +5 -3
- package/src/xyflow/edges/RelationshipsDropdownMenu.tsx +3 -3
- package/src/xyflow/edges/edges.css.ts +68 -74
- package/src/xyflow/edges/utils.ts +6 -6
- package/src/xyflow/nodes/AnimateVariants.ts +143 -0
- package/src/xyflow/nodes/Node.css.ts +44 -0
- package/src/xyflow/nodes/compound/CompoundNode.css.ts +1 -64
- package/src/xyflow/nodes/compound/CompoundNode.tsx +69 -182
- package/src/xyflow/nodes/element/ElementLink.tsx +2 -3
- package/src/xyflow/nodes/element/ElementNode.tsx +64 -266
- package/src/xyflow/nodes/element/element.css.ts +0 -57
- package/src/xyflow/nodes/shared/Toolbar.tsx +30 -30
- package/src/xyflow/types.ts +48 -51
- package/src/xyflow/useLayoutConstraints.ts +9 -9
- package/src/xyflow/useXYFlowEvents.ts +13 -30
- package/src/xyflow/utils.ts +2 -2
- package/src/xyflow/nodes/use-animate-variants.tsx +0 -64
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { invariant, nameFromFqn } from "@likec4/core";
|
|
3
|
+
import { Tooltip as Tooltip$1, Menu, MenuTarget, MenuDropdown, MenuLabel, MenuDivider, Box, ActionIcon, Stack, Group, Text, TooltipGroup, Space, MenuItem } from "@mantine/core";
|
|
4
|
+
import { IconInfoCircle, IconArrowRight, IconZoomScan, IconFileSymlink } from "@tabler/icons-react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { useCallback, forwardRef, Fragment as Fragment$1 } from "react";
|
|
7
|
+
import { pick, pipe, map, filter, isTruthy, partition } from "remeda";
|
|
8
|
+
import { Link } from "../../ui/Link.js";
|
|
9
|
+
import { menuDropdown, menuItemRelationship, endpoint, title } from "./RelationshipsDropdownMenu.css.js";
|
|
10
|
+
import { useXYNodesData } from "../../hooks/useXYFlow.js";
|
|
11
|
+
import { useDiagramState, useDiagramStoreApi } from "../../hooks/useDiagramState.js";
|
|
12
|
+
import { useMantinePortalProps } from "../../hooks/useMantinePortalProps.js";
|
|
13
|
+
const stopPropagation = (e) => e.stopPropagation();
|
|
14
|
+
const Tooltip = Tooltip$1.withProps({
|
|
15
|
+
color: "gray",
|
|
16
|
+
fz: "xs",
|
|
17
|
+
openDelay: 300,
|
|
18
|
+
closeDelay: 150,
|
|
19
|
+
label: "",
|
|
20
|
+
children: null,
|
|
21
|
+
offset: 8,
|
|
22
|
+
withinPortal: false
|
|
23
|
+
});
|
|
24
|
+
function RelationshipsDropdownMenu({
|
|
25
|
+
edge,
|
|
26
|
+
disabled = false,
|
|
27
|
+
likec4model,
|
|
28
|
+
children
|
|
29
|
+
}) {
|
|
30
|
+
const {
|
|
31
|
+
openOverlay,
|
|
32
|
+
enableRelationshipBrowser
|
|
33
|
+
} = useDiagramState(pick(["openOverlay", "enableRelationshipBrowser"]));
|
|
34
|
+
const portalProps = useMantinePortalProps();
|
|
35
|
+
const [sourceXYNode, targetXYNode] = useXYNodesData([edge.source, edge.target]);
|
|
36
|
+
invariant(sourceXYNode, `Source XYNode ${edge.source} not found for edge ${edge.id}`);
|
|
37
|
+
invariant(targetXYNode, `Target XYNode ${edge.target} not found for edge ${edge.id}`);
|
|
38
|
+
const [direct, nested] = pipe(
|
|
39
|
+
edge.relations,
|
|
40
|
+
map((id) => {
|
|
41
|
+
try {
|
|
42
|
+
return likec4model.relationship(id);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.error(
|
|
45
|
+
`View is cached and likec4model missing relationship ${id} from ${edge.source} -> ${edge.target}`,
|
|
46
|
+
e
|
|
47
|
+
);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
filter(isTruthy),
|
|
52
|
+
partition((r) => r.source.id === edge.source && r.target.id === edge.target)
|
|
53
|
+
);
|
|
54
|
+
const onClickOpenOverlay = useCallback((e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
if (enableRelationshipBrowser) {
|
|
57
|
+
openOverlay({
|
|
58
|
+
edgeDetails: edge.id
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}, [edge.id, openOverlay, enableRelationshipBrowser]);
|
|
62
|
+
const renderRelationship = (relationship, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
63
|
+
index > 0 && /* @__PURE__ */ jsx(MenuDivider, { opacity: 0.65 }),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
MenuItem,
|
|
66
|
+
{
|
|
67
|
+
onClick: onClickOpenOverlay,
|
|
68
|
+
component: Relationship,
|
|
69
|
+
relationship,
|
|
70
|
+
sourceNode: sourceXYNode.data.element,
|
|
71
|
+
targetNode: targetXYNode.data.element,
|
|
72
|
+
edge
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] }, relationship.id);
|
|
76
|
+
if (direct.length + nested.length === 0) {
|
|
77
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
78
|
+
}
|
|
79
|
+
return /* @__PURE__ */ jsxs(
|
|
80
|
+
Menu,
|
|
81
|
+
{
|
|
82
|
+
trigger: "click-hover",
|
|
83
|
+
openDelay: 300,
|
|
84
|
+
closeDelay: 450,
|
|
85
|
+
floatingStrategy: "fixed",
|
|
86
|
+
closeOnClickOutside: true,
|
|
87
|
+
clickOutsideEvents: ["pointerdown", "mousedown", "click"],
|
|
88
|
+
closeOnEscape: true,
|
|
89
|
+
closeOnItemClick: false,
|
|
90
|
+
disabled,
|
|
91
|
+
...portalProps,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx(MenuTarget, { children }),
|
|
94
|
+
/* @__PURE__ */ jsxs(
|
|
95
|
+
MenuDropdown,
|
|
96
|
+
{
|
|
97
|
+
className: menuDropdown,
|
|
98
|
+
onPointerDownCapture: stopPropagation,
|
|
99
|
+
onPointerDown: stopPropagation,
|
|
100
|
+
onClick: stopPropagation,
|
|
101
|
+
children: [
|
|
102
|
+
direct.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
103
|
+
/* @__PURE__ */ jsx(MenuLabel, { children: "direct relationships" }),
|
|
104
|
+
direct.map(renderRelationship)
|
|
105
|
+
] }),
|
|
106
|
+
nested.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
107
|
+
direct.length > 0 && /* @__PURE__ */ jsx(MenuDivider, {}),
|
|
108
|
+
/* @__PURE__ */ jsx(MenuLabel, { children: "resolved from nested" }),
|
|
109
|
+
nested.map(renderRelationship)
|
|
110
|
+
] }),
|
|
111
|
+
enableRelationshipBrowser && /* @__PURE__ */ jsx(Box, { pos: "absolute", top: 5, right: 6, children: /* @__PURE__ */ jsx(
|
|
112
|
+
ActionIcon,
|
|
113
|
+
{
|
|
114
|
+
size: 24,
|
|
115
|
+
variant: "subtle",
|
|
116
|
+
onClick: onClickOpenOverlay,
|
|
117
|
+
children: /* @__PURE__ */ jsx(IconInfoCircle, { style: { width: "70%" } })
|
|
118
|
+
}
|
|
119
|
+
) })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
const Relationship = forwardRef(({
|
|
128
|
+
className,
|
|
129
|
+
relationship: r,
|
|
130
|
+
edge,
|
|
131
|
+
sourceNode,
|
|
132
|
+
targetNode,
|
|
133
|
+
...props
|
|
134
|
+
}, ref) => {
|
|
135
|
+
var _a, _b;
|
|
136
|
+
const diagramApi = useDiagramStoreApi();
|
|
137
|
+
const {
|
|
138
|
+
viewId,
|
|
139
|
+
hasOnOpenSourceRelation,
|
|
140
|
+
hasOnNavigateTo
|
|
141
|
+
} = useDiagramState((s) => ({
|
|
142
|
+
viewId: s.view.id,
|
|
143
|
+
hasOnOpenSourceRelation: !!s.onOpenSource,
|
|
144
|
+
hasOnNavigateTo: !!s.onNavigateTo
|
|
145
|
+
}));
|
|
146
|
+
const sourceId = nameFromFqn(edge.source) + r.source.id.slice(edge.source.length);
|
|
147
|
+
const targetId = nameFromFqn(edge.target) + r.target.id.slice(edge.target.length);
|
|
148
|
+
const navigateTo = hasOnNavigateTo && ((_a = r.navigateTo) == null ? void 0 : _a.id) !== viewId ? (_b = r.navigateTo) == null ? void 0 : _b.id : void 0;
|
|
149
|
+
const links = r.links;
|
|
150
|
+
return /* @__PURE__ */ jsxs(Stack, { ref, className: clsx(menuItemRelationship, className), ...props, children: [
|
|
151
|
+
/* @__PURE__ */ jsxs(Group, { gap: 4, children: [
|
|
152
|
+
/* @__PURE__ */ jsx(Text, { component: "div", className: endpoint, "data-likec4-color": sourceNode.color, children: sourceId }),
|
|
153
|
+
/* @__PURE__ */ jsx(IconArrowRight, { stroke: 2.5, size: 11 }),
|
|
154
|
+
/* @__PURE__ */ jsx(Text, { component: "div", className: endpoint, "data-likec4-color": targetNode.color, children: targetId }),
|
|
155
|
+
(navigateTo || hasOnOpenSourceRelation) && /* @__PURE__ */ jsxs(TooltipGroup, { openDelay: 100, children: [
|
|
156
|
+
/* @__PURE__ */ jsx(Space, { w: "xs" }),
|
|
157
|
+
navigateTo && /* @__PURE__ */ jsx(Tooltip, { label: "Open dynamic view", children: /* @__PURE__ */ jsx(
|
|
158
|
+
ActionIcon,
|
|
159
|
+
{
|
|
160
|
+
className: clsx("nodrag nopan"),
|
|
161
|
+
size: "sm",
|
|
162
|
+
radius: "sm",
|
|
163
|
+
variant: "default",
|
|
164
|
+
onPointerDownCapture: stopPropagation,
|
|
165
|
+
onClick: (event) => {
|
|
166
|
+
var _a2, _b2;
|
|
167
|
+
event.stopPropagation();
|
|
168
|
+
(_b2 = (_a2 = diagramApi.getState()).onNavigateTo) == null ? void 0 : _b2.call(_a2, navigateTo, event);
|
|
169
|
+
},
|
|
170
|
+
role: "button",
|
|
171
|
+
children: /* @__PURE__ */ jsx(IconZoomScan, { size: "80%", stroke: 2 })
|
|
172
|
+
}
|
|
173
|
+
) }),
|
|
174
|
+
hasOnOpenSourceRelation && /* @__PURE__ */ jsx(Tooltip, { label: "Open source", children: /* @__PURE__ */ jsx(
|
|
175
|
+
ActionIcon,
|
|
176
|
+
{
|
|
177
|
+
className: clsx("nodrag nopan"),
|
|
178
|
+
size: "sm",
|
|
179
|
+
radius: "sm",
|
|
180
|
+
variant: "default",
|
|
181
|
+
onPointerDownCapture: stopPropagation,
|
|
182
|
+
onClick: (event) => {
|
|
183
|
+
var _a2, _b2;
|
|
184
|
+
event.stopPropagation();
|
|
185
|
+
(_b2 = (_a2 = diagramApi.getState()).onOpenSource) == null ? void 0 : _b2.call(_a2, {
|
|
186
|
+
relation: r.id
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
role: "button",
|
|
190
|
+
children: /* @__PURE__ */ jsx(IconFileSymlink, { size: "80%", stroke: 2 })
|
|
191
|
+
}
|
|
192
|
+
) })
|
|
193
|
+
] })
|
|
194
|
+
] }),
|
|
195
|
+
/* @__PURE__ */ jsx(Box, { className: title, children: r.title || "untitled" }),
|
|
196
|
+
r.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: r.description }),
|
|
197
|
+
links.length > 0 && /* @__PURE__ */ jsx(
|
|
198
|
+
Stack,
|
|
199
|
+
{
|
|
200
|
+
gap: 3,
|
|
201
|
+
justify: "stretch",
|
|
202
|
+
align: "stretch",
|
|
203
|
+
children: links.map((link) => /* @__PURE__ */ jsx(Link, { link }, link.url))
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] });
|
|
207
|
+
});
|
|
208
|
+
export {
|
|
209
|
+
RelationshipsDropdownMenu,
|
|
210
|
+
Tooltip
|
|
211
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const container: string;
|
|
2
|
+
export declare const dimmed: string;
|
|
3
|
+
export declare const edgePathBg: string;
|
|
4
|
+
export declare const markerContext: string;
|
|
5
|
+
export declare const controlPoint: string;
|
|
6
|
+
export declare const controlDragging: string;
|
|
7
|
+
export declare const cssEdgePath: string;
|
|
8
|
+
export declare const stepEdgeNumber: string;
|
|
9
|
+
export declare const varLabelX: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
10
|
+
export declare const varLabelY: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
11
|
+
export declare const edgeLabel: string;
|
|
12
|
+
export declare const edgeLabelText: string;
|
|
13
|
+
export declare const edgeLabelTechnology: string;
|
|
14
|
+
export declare const edgeNoteCloseButton: string;
|
|
15
|
+
export declare const edgeNoteText: string;
|
|
16
|
+
export declare const cssNavigateBtn: string;
|
|
17
|
+
export declare const cssNavigateBtnIcon: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
var container = "bexn7q1";
|
|
3
|
+
var dimmed = "bexn7q2";
|
|
4
|
+
var edgePathBg = "bexn7q3";
|
|
5
|
+
var markerContext = "bexn7q4";
|
|
6
|
+
var controlPoint = "bexn7q5";
|
|
7
|
+
var controlDragging = "bexn7q6";
|
|
8
|
+
var cssEdgePath = "bexn7q8";
|
|
9
|
+
var stepEdgeNumber = "bexn7q9";
|
|
10
|
+
var varLabelX = "var(--bexn7qa)";
|
|
11
|
+
var varLabelY = "var(--bexn7qb)";
|
|
12
|
+
var edgeLabel = "bexn7qd";
|
|
13
|
+
var edgeLabelText = "bexn7qe";
|
|
14
|
+
var edgeLabelTechnology = "bexn7qf";
|
|
15
|
+
var edgeNoteCloseButton = "bexn7qg";
|
|
16
|
+
var edgeNoteText = "bexn7qh";
|
|
17
|
+
var cssNavigateBtn = "bexn7qi";
|
|
18
|
+
var cssNavigateBtnIcon = "bexn7qj";
|
|
19
|
+
export {
|
|
20
|
+
container,
|
|
21
|
+
controlDragging,
|
|
22
|
+
controlPoint,
|
|
23
|
+
cssEdgePath,
|
|
24
|
+
cssNavigateBtn,
|
|
25
|
+
cssNavigateBtnIcon,
|
|
26
|
+
dimmed,
|
|
27
|
+
edgeLabel,
|
|
28
|
+
edgeLabelTechnology,
|
|
29
|
+
edgeLabelText,
|
|
30
|
+
edgeNoteCloseButton,
|
|
31
|
+
edgeNoteText,
|
|
32
|
+
edgePathBg,
|
|
33
|
+
markerContext,
|
|
34
|
+
stepEdgeNumber,
|
|
35
|
+
varLabelX,
|
|
36
|
+
varLabelY
|
|
37
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Position, XYPosition } from '@xyflow/react';
|
|
2
|
+
import { DiagramFlowTypes } from '../types';
|
|
3
|
+
export declare function getNodeCenter(node: DiagramFlowTypes.InternalNode): XYPosition;
|
|
4
|
+
export declare function getNodeIntersectionFromCenterToPoint(intersectionNode: DiagramFlowTypes.InternalNode, { x: x1, y: y1 }: XYPosition): {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function getPointPosition(node: DiagramFlowTypes.InternalNode, intersectionPoint: XYPosition): readonly [number, number, Position];
|
|
9
|
+
export declare function getEdgeParams(source: DiagramFlowTypes.InternalNode, target: DiagramFlowTypes.InternalNode): {
|
|
10
|
+
sx: number;
|
|
11
|
+
sy: number;
|
|
12
|
+
tx: number;
|
|
13
|
+
ty: number;
|
|
14
|
+
sourcePos: Position;
|
|
15
|
+
targetPos: Position;
|
|
16
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "@xyflow/react";
|
|
2
|
+
import { getNodeDimensions } from "@xyflow/system";
|
|
3
|
+
function getNodeIntersectionFromCenterToPoint(intersectionNode, { x: x1, y: y1 }) {
|
|
4
|
+
const {
|
|
5
|
+
width: intersectionNodeWidth,
|
|
6
|
+
height: intersectionNodeHeight
|
|
7
|
+
} = getNodeDimensions(intersectionNode);
|
|
8
|
+
const intersectionNodePosition = intersectionNode.internals.positionAbsolute;
|
|
9
|
+
const w = intersectionNodeWidth / 2;
|
|
10
|
+
const h = intersectionNodeHeight / 2;
|
|
11
|
+
const x2 = intersectionNodePosition.x + w;
|
|
12
|
+
const y2 = intersectionNodePosition.y + h;
|
|
13
|
+
const xx1 = (x1 - x2) / (2 * w) - (y1 - y2) / (2 * h);
|
|
14
|
+
const yy1 = (x1 - x2) / (2 * w) + (y1 - y2) / (2 * h);
|
|
15
|
+
const a = 1 / (Math.abs(xx1) + Math.abs(yy1));
|
|
16
|
+
const xx3 = a * xx1;
|
|
17
|
+
const yy3 = a * yy1;
|
|
18
|
+
const x = w * (xx3 + yy3) + x2;
|
|
19
|
+
const y = h * (-xx3 + yy3) + y2;
|
|
20
|
+
return { x, y };
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
getNodeIntersectionFromCenterToPoint
|
|
24
|
+
};
|