@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,8 @@
|
|
|
1
|
+
import { DiagramView, LikeC4Model } from '@likec4/core';
|
|
2
|
+
type RelationshipsTabPanelProps = {
|
|
3
|
+
currentView: DiagramView;
|
|
4
|
+
node: LikeC4Model.Node;
|
|
5
|
+
element: LikeC4Model.Element;
|
|
6
|
+
};
|
|
7
|
+
export declare function TabPanelRelationships({ currentView, node, element }: RelationshipsTabPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { nameFromFqn } from "@likec4/core";
|
|
3
|
+
import { Stack, Group, Box, ThemeIcon, Text, SegmentedControl, Button, Paper } from "@mantine/core";
|
|
4
|
+
import { useId } from "@mantine/hooks";
|
|
5
|
+
import { IconArrowRight, IconInfoCircle, IconExternalLink } from "@tabler/icons-react";
|
|
6
|
+
import { Panel } from "@xyflow/react";
|
|
7
|
+
import { LayoutGroup } from "framer-motion";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { unique } from "remeda";
|
|
10
|
+
import { useOverlayDialog } from "../OverlayContext.js";
|
|
11
|
+
import { RelationshipsXYFlow } from "../relationships-of/RelationshipsXYFlow.js";
|
|
12
|
+
import { useLayoutedRelationships } from "../relationships-of/use-layouted-relationships.js";
|
|
13
|
+
import { fqn, xyflow, panelScope, relationshipStat } from "./TabPanelRelationships.css.js";
|
|
14
|
+
import { useDiagramState } from "../../hooks/useDiagramState.js";
|
|
15
|
+
function TabPanelRelationships({
|
|
16
|
+
currentView,
|
|
17
|
+
node,
|
|
18
|
+
element
|
|
19
|
+
}) {
|
|
20
|
+
const layoutId = useId();
|
|
21
|
+
const enableRelationshipBrowser = useDiagramState((s) => s.enableRelationshipBrowser);
|
|
22
|
+
const overlay = useOverlayDialog();
|
|
23
|
+
const [scope, setScope] = useState("view");
|
|
24
|
+
const incoming = element.incoming().map((r) => r.id).toArray();
|
|
25
|
+
const outgoing = element.outgoing().map((r) => r.id).toArray();
|
|
26
|
+
const incomingInView = unique(node.incoming().flatMap((e) => e.$edge.relations).toArray());
|
|
27
|
+
const outgoingInView = unique(node.outgoing().flatMap((e) => e.$edge.relations).toArray());
|
|
28
|
+
const notIncludedRelations = [
|
|
29
|
+
...incoming,
|
|
30
|
+
...outgoing
|
|
31
|
+
].filter((r) => !incomingInView.includes(r) && !outgoingInView.includes(r)).length;
|
|
32
|
+
const {
|
|
33
|
+
edges,
|
|
34
|
+
nodes,
|
|
35
|
+
bounds
|
|
36
|
+
} = useLayoutedRelationships(element.id, currentView, scope);
|
|
37
|
+
return /* @__PURE__ */ jsxs(Stack, { gap: "xs", pos: "relative", w: "100%", h: "100%", children: [
|
|
38
|
+
incoming.length + outgoing.length > 0 && /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", align: "center", children: [
|
|
39
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Group, { gap: 8, mb: 4, wrap: "nowrap", children: [
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
RelationshipsStat,
|
|
42
|
+
{
|
|
43
|
+
title: "incoming",
|
|
44
|
+
total: incoming.length,
|
|
45
|
+
included: incomingInView.length
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", c: "dimmed", children: /* @__PURE__ */ jsx(IconArrowRight, { style: { width: 16 } }) }),
|
|
49
|
+
/* @__PURE__ */ jsx(Text, { className: fqn, children: nameFromFqn(element.id) }),
|
|
50
|
+
/* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", c: "dimmed", children: /* @__PURE__ */ jsx(IconArrowRight, { style: { width: 16 } }) }),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
RelationshipsStat,
|
|
53
|
+
{
|
|
54
|
+
title: "outgoing",
|
|
55
|
+
total: outgoing.length,
|
|
56
|
+
included: outgoingInView.length
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }) }),
|
|
60
|
+
notIncludedRelations > 0 && /* @__PURE__ */ jsxs(
|
|
61
|
+
Group,
|
|
62
|
+
{
|
|
63
|
+
mt: "xs",
|
|
64
|
+
gap: 6,
|
|
65
|
+
c: "orange",
|
|
66
|
+
style: { cursor: "pointer" },
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx(IconInfoCircle, { style: { width: 14 } }),
|
|
69
|
+
/* @__PURE__ */ jsxs(Text, { fz: "sm", children: [
|
|
70
|
+
notIncludedRelations,
|
|
71
|
+
" relationship",
|
|
72
|
+
notIncludedRelations > 1 ? "s are" : " is",
|
|
73
|
+
" hidden"
|
|
74
|
+
] })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ jsx(Box, { className: xyflow, children: /* @__PURE__ */ jsx(LayoutGroup, { id: layoutId, children: /* @__PURE__ */ jsxs(
|
|
80
|
+
RelationshipsXYFlow,
|
|
81
|
+
{
|
|
82
|
+
subjectId: element.id,
|
|
83
|
+
bounds,
|
|
84
|
+
nodes,
|
|
85
|
+
edges,
|
|
86
|
+
view: currentView,
|
|
87
|
+
elementsSelectable: false,
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ jsx(Panel, { position: "top-left", className: panelScope, children: /* @__PURE__ */ jsx(
|
|
90
|
+
SegmentedControl,
|
|
91
|
+
{
|
|
92
|
+
size: "xs",
|
|
93
|
+
withItemsBorders: false,
|
|
94
|
+
value: scope,
|
|
95
|
+
onChange: setScope,
|
|
96
|
+
data: [
|
|
97
|
+
{ label: "Global", value: "global" },
|
|
98
|
+
{ label: "View", value: "view" }
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
) }),
|
|
102
|
+
enableRelationshipBrowser && /* @__PURE__ */ jsx(Panel, { position: "top-right", children: /* @__PURE__ */ jsx(
|
|
103
|
+
Button,
|
|
104
|
+
{
|
|
105
|
+
size: "compact-sm",
|
|
106
|
+
variant: "default",
|
|
107
|
+
fz: "xs",
|
|
108
|
+
fw: 500,
|
|
109
|
+
rightSection: /* @__PURE__ */ jsx(IconExternalLink, { stroke: 1.6, style: { width: 16 } }),
|
|
110
|
+
onClick: (e) => {
|
|
111
|
+
e.stopPropagation();
|
|
112
|
+
overlay.close(() => {
|
|
113
|
+
overlay.openOverlay({
|
|
114
|
+
relationshipsOf: element.id
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
children: "Open"
|
|
119
|
+
}
|
|
120
|
+
) })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
) }) })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
function RelationshipsStat({
|
|
127
|
+
title,
|
|
128
|
+
total,
|
|
129
|
+
included
|
|
130
|
+
}) {
|
|
131
|
+
return /* @__PURE__ */ jsx(
|
|
132
|
+
Paper,
|
|
133
|
+
{
|
|
134
|
+
withBorder: true,
|
|
135
|
+
shadow: "none",
|
|
136
|
+
className: relationshipStat,
|
|
137
|
+
px: "md",
|
|
138
|
+
py: "xs",
|
|
139
|
+
radius: "md",
|
|
140
|
+
mod: {
|
|
141
|
+
zero: total === 0,
|
|
142
|
+
missing: total !== included
|
|
143
|
+
},
|
|
144
|
+
children: /* @__PURE__ */ jsxs(Stack, { gap: 4, align: "flex-end", children: [
|
|
145
|
+
/* @__PURE__ */ jsx(Text, { component: "div", c: total !== included ? "orange" : "dimmed", tt: "uppercase", fw: 600, fz: 10, lh: 1, children: title }),
|
|
146
|
+
/* @__PURE__ */ jsx(Text, { fw: 600, fz: "xl", component: "div", lh: 1, children: total !== included ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
147
|
+
included,
|
|
148
|
+
" / ",
|
|
149
|
+
total
|
|
150
|
+
] }) : /* @__PURE__ */ jsx(Fragment, { children: total }) })
|
|
151
|
+
] })
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
TabPanelRelationships
|
|
157
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LikeC4Model } from '@likec4/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
interface ElementTreeNodeData {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
value: string;
|
|
6
|
+
element: LikeC4Model.Element;
|
|
7
|
+
type: 'ancestor' | 'current' | 'descedant';
|
|
8
|
+
children: TreeNodeData[];
|
|
9
|
+
}
|
|
10
|
+
export interface MessageNodeData {
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
value: string;
|
|
13
|
+
type: 'message';
|
|
14
|
+
children: TreeNodeData[];
|
|
15
|
+
}
|
|
16
|
+
export type TreeNodeData = ElementTreeNodeData | MessageNodeData;
|
|
17
|
+
type TabPanelStructureProps = {
|
|
18
|
+
element: LikeC4Model.Element;
|
|
19
|
+
};
|
|
20
|
+
export declare const ElementLabel: ({ element }: {
|
|
21
|
+
element: LikeC4Model.Element;
|
|
22
|
+
type: "ancestor" | "current" | "descedant";
|
|
23
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function TabPanelStructure({ element }: TabPanelStructureProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useTree, Alert, Anchor, Tree, Box, Text, Pill } from "@mantine/core";
|
|
3
|
+
import { IconInfoCircle } from "@tabler/icons-react";
|
|
4
|
+
import { useMemo, useEffect } from "react";
|
|
5
|
+
import { treeNodeLabel, elementLabel } from "./TabPanelStructure.css.js";
|
|
6
|
+
const ElementLabel = ({
|
|
7
|
+
element
|
|
8
|
+
}) => /* @__PURE__ */ jsx(Box, { className: elementLabel, children: /* @__PURE__ */ jsx(Text, { component: "div", fz: "sm", fw: "500", children: element.title }) });
|
|
9
|
+
function TabPanelStructure({
|
|
10
|
+
element
|
|
11
|
+
}) {
|
|
12
|
+
const tree = useTree({
|
|
13
|
+
multiple: false
|
|
14
|
+
});
|
|
15
|
+
const data = useMemo(() => {
|
|
16
|
+
let seq = 1;
|
|
17
|
+
const messageNode = (label) => ({
|
|
18
|
+
label,
|
|
19
|
+
value: `msg${seq++}`,
|
|
20
|
+
type: "message",
|
|
21
|
+
children: []
|
|
22
|
+
});
|
|
23
|
+
const current = {
|
|
24
|
+
label: /* @__PURE__ */ jsx(ElementLabel, { type: "current", element }),
|
|
25
|
+
value: element.id,
|
|
26
|
+
element,
|
|
27
|
+
type: "current",
|
|
28
|
+
children: [...element.children()].map((child) => ({
|
|
29
|
+
label: /* @__PURE__ */ jsx(ElementLabel, { type: "descedant", element: child }),
|
|
30
|
+
value: child.id,
|
|
31
|
+
element: child,
|
|
32
|
+
type: "descedant",
|
|
33
|
+
children: []
|
|
34
|
+
}))
|
|
35
|
+
};
|
|
36
|
+
if (current.children.length === 0) {
|
|
37
|
+
current.children.push(
|
|
38
|
+
messageNode(/* @__PURE__ */ jsx(Pill, { radius: "sm", children: "no nested" }))
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
let ancestor = element.ancestors().reduce((acc, parent) => ({
|
|
42
|
+
label: /* @__PURE__ */ jsx(ElementLabel, { type: "ancestor", element: parent }),
|
|
43
|
+
value: parent.id,
|
|
44
|
+
element: parent,
|
|
45
|
+
type: "ancestor",
|
|
46
|
+
children: [acc]
|
|
47
|
+
}), current);
|
|
48
|
+
return [
|
|
49
|
+
ancestor
|
|
50
|
+
];
|
|
51
|
+
}, [element]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
tree.expandAllNodes();
|
|
54
|
+
}, [data]);
|
|
55
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
/* @__PURE__ */ jsxs(Alert, { variant: "light", color: "orange", title: "In development", icon: /* @__PURE__ */ jsx(IconInfoCircle, {}), children: [
|
|
57
|
+
"We need your feedback. Share your thoughts and ideas -",
|
|
58
|
+
" ",
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
Anchor,
|
|
61
|
+
{
|
|
62
|
+
fz: "sm",
|
|
63
|
+
fw: 500,
|
|
64
|
+
underline: "hover",
|
|
65
|
+
c: "orange",
|
|
66
|
+
href: "https://github.com/likec4/likec4/discussions/",
|
|
67
|
+
target: "_blank",
|
|
68
|
+
children: "GitHub discussions"
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Tree,
|
|
74
|
+
{
|
|
75
|
+
levelOffset: "xl",
|
|
76
|
+
allowRangeSelection: false,
|
|
77
|
+
expandOnClick: false,
|
|
78
|
+
expandOnSpace: false,
|
|
79
|
+
classNames: {
|
|
80
|
+
label: treeNodeLabel
|
|
81
|
+
},
|
|
82
|
+
data,
|
|
83
|
+
tree
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
ElementLabel,
|
|
90
|
+
TabPanelStructure
|
|
91
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Overlays } from './Overlays';
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "@likec4/core";
|
|
3
|
+
import { Group, Button, Space, Box, SegmentedControl, Text } from "@mantine/core";
|
|
4
|
+
import { useLocalStorage, useStateHistory } from "@mantine/hooks";
|
|
5
|
+
import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
|
|
6
|
+
import { Panel } from "@xyflow/react";
|
|
7
|
+
import { memo, useEffect } from "react";
|
|
8
|
+
import { useDiagramState } from "../../hooks/useDiagramState.js";
|
|
9
|
+
import { useOverlayDialog } from "../OverlayContext.js";
|
|
10
|
+
import { RelationshipsXYFlow } from "./RelationshipsXYFlow.js";
|
|
11
|
+
import { SelectElement } from "./SelectElement.js";
|
|
12
|
+
import { useLayoutedRelationships } from "./use-layouted-relationships.js";
|
|
13
|
+
const RelationshipsOverlay = memo(function RelationshipsOverlay2({ subjectId }) {
|
|
14
|
+
const view = useDiagramState((s) => s.view);
|
|
15
|
+
const [_scope, setScope] = useLocalStorage({
|
|
16
|
+
key: "likec4:scope-relationships-of",
|
|
17
|
+
getInitialValueInEffect: false,
|
|
18
|
+
defaultValue: "view"
|
|
19
|
+
});
|
|
20
|
+
const {
|
|
21
|
+
notIncludedRelations,
|
|
22
|
+
viewIncludesSubject,
|
|
23
|
+
edges,
|
|
24
|
+
nodes,
|
|
25
|
+
subject,
|
|
26
|
+
bounds
|
|
27
|
+
} = useLayoutedRelationships(subjectId, view, _scope);
|
|
28
|
+
const scope = viewIncludesSubject ? _scope : "global";
|
|
29
|
+
const showSubjectWarning = !viewIncludesSubject && _scope === "view";
|
|
30
|
+
const [historySubjectId, historyOps, { history, current }] = useStateHistory(subjectId);
|
|
31
|
+
const overlay = useOverlayDialog();
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (historySubjectId !== subjectId) {
|
|
34
|
+
historyOps.set(subjectId);
|
|
35
|
+
}
|
|
36
|
+
}, [subjectId]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (historySubjectId !== subjectId) {
|
|
39
|
+
overlay.openOverlay({
|
|
40
|
+
relationshipsOf: historySubjectId
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, [historySubjectId]);
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
RelationshipsXYFlow,
|
|
46
|
+
{
|
|
47
|
+
nodes,
|
|
48
|
+
edges,
|
|
49
|
+
bounds,
|
|
50
|
+
view,
|
|
51
|
+
subjectId,
|
|
52
|
+
viewportPadding: 0.2,
|
|
53
|
+
onNodeClick: (e, node) => {
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
if (node.type === "empty") return;
|
|
56
|
+
overlay.openOverlay({
|
|
57
|
+
relationshipsOf: node.data.fqn
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
children: /* @__PURE__ */ jsx(Panel, { position: "top-center", children: /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
Button,
|
|
63
|
+
{
|
|
64
|
+
leftSection: /* @__PURE__ */ jsx(IconArrowLeft, { stroke: 3, size: 14 }),
|
|
65
|
+
color: "dimmed",
|
|
66
|
+
variant: "subtle",
|
|
67
|
+
style: {
|
|
68
|
+
visibility: current > 0 ? "visible" : "hidden",
|
|
69
|
+
padding: "0.25rem 0.75rem"
|
|
70
|
+
},
|
|
71
|
+
styles: {
|
|
72
|
+
label: {
|
|
73
|
+
fontWeight: 400
|
|
74
|
+
},
|
|
75
|
+
section: {
|
|
76
|
+
marginInlineEnd: 6
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
size: "sm",
|
|
80
|
+
onClick: (e) => {
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
historyOps.back();
|
|
83
|
+
},
|
|
84
|
+
children: "Back"
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsx(Space, { w: 2 }),
|
|
88
|
+
/* @__PURE__ */ jsxs(Group, { gap: "xs", pos: "relative", wrap: "nowrap", flex: "1 0 auto", children: [
|
|
89
|
+
/* @__PURE__ */ jsx(Box, { fz: "sm", fw: "400", style: { whiteSpace: "nowrap", userSelect: "none" }, children: "Relationships of" }),
|
|
90
|
+
/* @__PURE__ */ jsx(Box, { flex: "1 0 auto", children: /* @__PURE__ */ jsx(
|
|
91
|
+
SelectElement,
|
|
92
|
+
{
|
|
93
|
+
scope,
|
|
94
|
+
subject: subject.$element,
|
|
95
|
+
onSelect: (fqn) => overlay.openOverlay({
|
|
96
|
+
relationshipsOf: fqn
|
|
97
|
+
}),
|
|
98
|
+
viewId: view.id
|
|
99
|
+
}
|
|
100
|
+
) }),
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
SegmentedControl,
|
|
103
|
+
{
|
|
104
|
+
flex: "1 0 auto",
|
|
105
|
+
size: "xs",
|
|
106
|
+
withItemsBorders: false,
|
|
107
|
+
value: scope,
|
|
108
|
+
onChange: setScope,
|
|
109
|
+
data: [
|
|
110
|
+
{ label: "Global", value: "global" },
|
|
111
|
+
{ label: "Current view", value: "view", disabled: !viewIncludesSubject }
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
showSubjectWarning && /* @__PURE__ */ jsx(
|
|
116
|
+
Box,
|
|
117
|
+
{
|
|
118
|
+
pos: "absolute",
|
|
119
|
+
top: "calc(100% + .5rem)",
|
|
120
|
+
left: "50%",
|
|
121
|
+
w: "max-content",
|
|
122
|
+
style: {
|
|
123
|
+
transform: "translateX(-50%)",
|
|
124
|
+
textAlign: "center",
|
|
125
|
+
cursor: "pointer"
|
|
126
|
+
},
|
|
127
|
+
onClick: (e) => {
|
|
128
|
+
e.stopPropagation();
|
|
129
|
+
setScope("global");
|
|
130
|
+
},
|
|
131
|
+
children: /* @__PURE__ */ jsx(Text, { fw: 500, size: "xs", c: "orange", component: "div", children: "Current view doesn't include this element, switched to Global" })
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
viewIncludesSubject && scope === "view" && notIncludedRelations > 0 && /* @__PURE__ */ jsx(
|
|
135
|
+
Box,
|
|
136
|
+
{
|
|
137
|
+
pos: "absolute",
|
|
138
|
+
top: "calc(100% + .5rem)",
|
|
139
|
+
left: "50%",
|
|
140
|
+
w: "max-content",
|
|
141
|
+
style: {
|
|
142
|
+
transform: "translateX(-50%)",
|
|
143
|
+
textAlign: "center",
|
|
144
|
+
cursor: "pointer"
|
|
145
|
+
},
|
|
146
|
+
onClick: (e) => {
|
|
147
|
+
e.stopPropagation();
|
|
148
|
+
setScope("global");
|
|
149
|
+
},
|
|
150
|
+
children: /* @__PURE__ */ jsxs(Text, { fw: 500, size: "xs", c: "orange", component: "div", children: [
|
|
151
|
+
"View does not include ",
|
|
152
|
+
notIncludedRelations,
|
|
153
|
+
" ",
|
|
154
|
+
"relationship",
|
|
155
|
+
notIncludedRelations > 1 ? "s" : "",
|
|
156
|
+
". Switch to Global to compare"
|
|
157
|
+
] })
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
162
|
+
Button,
|
|
163
|
+
{
|
|
164
|
+
rightSection: /* @__PURE__ */ jsx(IconArrowRight, { stroke: 3, size: 14 }),
|
|
165
|
+
color: "dimmed",
|
|
166
|
+
variant: "subtle",
|
|
167
|
+
style: {
|
|
168
|
+
visibility: current + 1 < history.length ? "visible" : "hidden",
|
|
169
|
+
padding: "0.25rem 0.75rem"
|
|
170
|
+
},
|
|
171
|
+
styles: {
|
|
172
|
+
label: {
|
|
173
|
+
fontWeight: 400
|
|
174
|
+
},
|
|
175
|
+
section: {
|
|
176
|
+
marginInlineStart: 4
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
size: "sm",
|
|
180
|
+
onClick: (e) => {
|
|
181
|
+
e.stopPropagation();
|
|
182
|
+
historyOps.forward();
|
|
183
|
+
},
|
|
184
|
+
children: "Forward"
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }) })
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
export {
|
|
192
|
+
RelationshipsOverlay
|
|
193
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DiagramView, Fqn } from '@likec4/core';
|
|
2
|
+
import { ReactFlowProps } from '@xyflow/react';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
import { RelationshipsOfFlowTypes } from './_types';
|
|
5
|
+
type RelationshipsXYFlowProps = PropsWithChildren<{
|
|
6
|
+
subjectId: Fqn;
|
|
7
|
+
view: DiagramView;
|
|
8
|
+
nodes: RelationshipsOfFlowTypes.Node[];
|
|
9
|
+
edges: RelationshipsOfFlowTypes.Edge[];
|
|
10
|
+
bounds: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
viewportPadding?: number | undefined;
|
|
17
|
+
}> & Pick<ReactFlowProps<RelationshipsOfFlowTypes.Node, RelationshipsOfFlowTypes.Edge>, 'onNodeClick' | 'elementsSelectable' | 'maxZoom' | 'minZoom'>;
|
|
18
|
+
export declare function RelationshipsXYFlow(props: RelationshipsXYFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|