@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,194 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ActionIcon, Box, Group } from "@mantine/core";
|
|
3
|
+
import { IconZoomScan, IconTransform, IconFileSymlink } from "@tabler/icons-react";
|
|
4
|
+
import { Handle, Position } from "@xyflow/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { deepEqual } from "fast-equals";
|
|
7
|
+
import { m } from "framer-motion";
|
|
8
|
+
import { memo } from "react";
|
|
9
|
+
import { ElementShapeSvg } from "../../../xyflow/nodes/element/ElementShapeSvg.js";
|
|
10
|
+
import { stopPropagation } from "../../../xyflow/utils.js";
|
|
11
|
+
import { useOverlayDialog } from "../../OverlayContext.js";
|
|
12
|
+
import { navigateBtn, elementNode, cssShapeSvg, elementNodeContent, elementNodeTitle, elementNodeDescription, navigateBtnBox } from "./styles.css.js";
|
|
13
|
+
import { Text } from "../../../controls/Text.js";
|
|
14
|
+
import { useDiagramState } from "../../../hooks/useDiagramState.js";
|
|
15
|
+
const Action = ActionIcon.withProps({
|
|
16
|
+
className: "nodrag nopan " + navigateBtn,
|
|
17
|
+
radius: "md",
|
|
18
|
+
role: "button",
|
|
19
|
+
onDoubleClick: stopPropagation,
|
|
20
|
+
onPointerDownCapture: stopPropagation
|
|
21
|
+
});
|
|
22
|
+
function selector(s) {
|
|
23
|
+
return {
|
|
24
|
+
currentViewId: s.view.id,
|
|
25
|
+
onNavigateTo: s.onNavigateTo,
|
|
26
|
+
onOpenSource: s.onOpenSource
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const ElementNode = memo(({
|
|
30
|
+
id,
|
|
31
|
+
data: {
|
|
32
|
+
element,
|
|
33
|
+
ports,
|
|
34
|
+
navigateTo,
|
|
35
|
+
layoutId = id,
|
|
36
|
+
leaving = false,
|
|
37
|
+
entering = true,
|
|
38
|
+
...data
|
|
39
|
+
},
|
|
40
|
+
selectable = true,
|
|
41
|
+
width: w = 100,
|
|
42
|
+
height: h = 100
|
|
43
|
+
}) => {
|
|
44
|
+
const overlay = useOverlayDialog();
|
|
45
|
+
const {
|
|
46
|
+
currentViewId,
|
|
47
|
+
onNavigateTo,
|
|
48
|
+
onOpenSource
|
|
49
|
+
} = useDiagramState(selector);
|
|
50
|
+
const maxWH = Math.max(w, h);
|
|
51
|
+
const scale = (diff) => {
|
|
52
|
+
const s = (maxWH + diff) / maxWH;
|
|
53
|
+
return {
|
|
54
|
+
scaleX: s,
|
|
55
|
+
scaleY: s
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
let opacity = 1;
|
|
59
|
+
if (data.dimmed) {
|
|
60
|
+
opacity = data.dimmed === "immediate" ? 0.05 : 0.15;
|
|
61
|
+
}
|
|
62
|
+
if (leaving) {
|
|
63
|
+
opacity = 0;
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
66
|
+
/* @__PURE__ */ jsxs(
|
|
67
|
+
m.div,
|
|
68
|
+
{
|
|
69
|
+
className: clsx([
|
|
70
|
+
elementNode,
|
|
71
|
+
"likec4-element-node"
|
|
72
|
+
]),
|
|
73
|
+
layoutId,
|
|
74
|
+
"data-likec4-color": element.color,
|
|
75
|
+
initial: layoutId === id && entering ? {
|
|
76
|
+
...scale(-20),
|
|
77
|
+
opacity: 0,
|
|
78
|
+
width: w,
|
|
79
|
+
height: h
|
|
80
|
+
} : false,
|
|
81
|
+
animate: {
|
|
82
|
+
...scale(0),
|
|
83
|
+
opacity,
|
|
84
|
+
width: w,
|
|
85
|
+
height: h,
|
|
86
|
+
transition: {
|
|
87
|
+
opacity: {
|
|
88
|
+
delay: !leaving && data.dimmed === true ? 0.4 : 0,
|
|
89
|
+
...(leaving || data.dimmed === "immediate") && {
|
|
90
|
+
duration: 0.09
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
...selectable && {
|
|
96
|
+
whileHover: {
|
|
97
|
+
...scale(16)
|
|
98
|
+
// transition: {
|
|
99
|
+
// delay: 0.1
|
|
100
|
+
// }
|
|
101
|
+
},
|
|
102
|
+
whileTap: {
|
|
103
|
+
...scale(-8)
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
"svg",
|
|
109
|
+
{
|
|
110
|
+
className: clsx(
|
|
111
|
+
cssShapeSvg
|
|
112
|
+
),
|
|
113
|
+
viewBox: `0 0 ${w} ${h}`,
|
|
114
|
+
width: w,
|
|
115
|
+
height: h,
|
|
116
|
+
children: /* @__PURE__ */ jsx(ElementShapeSvg, { shape: element.shape, w, h })
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ jsxs(Box, { className: elementNodeContent, children: [
|
|
120
|
+
/* @__PURE__ */ jsx(Text, { className: elementNodeTitle, lineClamp: 2, children: element.title }),
|
|
121
|
+
element.description && /* @__PURE__ */ jsx(Text, { className: elementNodeDescription, lineClamp: 4, children: element.description })
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ jsxs(Group, { className: navigateBtnBox, children: [
|
|
124
|
+
navigateTo && onNavigateTo && navigateTo !== currentViewId && /* @__PURE__ */ jsx(
|
|
125
|
+
Action,
|
|
126
|
+
{
|
|
127
|
+
onClick: (event) => {
|
|
128
|
+
event.stopPropagation();
|
|
129
|
+
overlay.close(() => onNavigateTo(navigateTo));
|
|
130
|
+
},
|
|
131
|
+
children: /* @__PURE__ */ jsx(IconZoomScan, { stroke: 1.8, style: { width: "75%" } })
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
data.column !== "subjects" && /* @__PURE__ */ jsx(
|
|
135
|
+
Action,
|
|
136
|
+
{
|
|
137
|
+
onClick: (event) => {
|
|
138
|
+
event.stopPropagation();
|
|
139
|
+
overlay.openOverlay({
|
|
140
|
+
relationshipsOf: data.fqn
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
children: /* @__PURE__ */ jsx(IconTransform, { stroke: 1.8, style: { width: "72%" } })
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
onOpenSource && /* @__PURE__ */ jsx(
|
|
147
|
+
Action,
|
|
148
|
+
{
|
|
149
|
+
onClick: (event) => {
|
|
150
|
+
event.stopPropagation();
|
|
151
|
+
onOpenSource == null ? void 0 : onOpenSource({
|
|
152
|
+
element: data.fqn
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
children: /* @__PURE__ */ jsx(IconFileSymlink, { stroke: 1.8, style: { width: "72%" } })
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
] })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
ports.in.map((id2, i) => /* @__PURE__ */ jsx(
|
|
163
|
+
Handle,
|
|
164
|
+
{
|
|
165
|
+
id: id2,
|
|
166
|
+
type: "target",
|
|
167
|
+
position: Position.Left,
|
|
168
|
+
style: {
|
|
169
|
+
visibility: "hidden",
|
|
170
|
+
top: `${15 + (i + 1) * ((h - 30) / (ports.in.length + 1))}px`
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
id2
|
|
174
|
+
)),
|
|
175
|
+
ports.out.map((id2, i) => /* @__PURE__ */ jsx(
|
|
176
|
+
Handle,
|
|
177
|
+
{
|
|
178
|
+
id: id2,
|
|
179
|
+
type: "source",
|
|
180
|
+
position: Position.Right,
|
|
181
|
+
style: {
|
|
182
|
+
visibility: "hidden",
|
|
183
|
+
top: `${15 + (i + 1) * ((h - 30) / (ports.out.length + 1))}px`
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
id2
|
|
187
|
+
))
|
|
188
|
+
] });
|
|
189
|
+
}, (prev, next) => {
|
|
190
|
+
return deepEqual(prev.data, next.data);
|
|
191
|
+
});
|
|
192
|
+
export {
|
|
193
|
+
ElementNode
|
|
194
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NodeProps } from '@xyflow/react';
|
|
2
|
+
import { RelationshipsOfFlowTypes } from '../_types';
|
|
3
|
+
type EmptyNodeProps = NodeProps<RelationshipsOfFlowTypes.EmptyNode>;
|
|
4
|
+
export declare function EmptyNode({ data: { column } }: EmptyNodeProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@mantine/core";
|
|
3
|
+
import "@xyflow/react";
|
|
4
|
+
import { emptyNode } from "./styles.css.js";
|
|
5
|
+
import { Text } from "../../../controls/Text.js";
|
|
6
|
+
function EmptyNode({
|
|
7
|
+
data: {
|
|
8
|
+
column
|
|
9
|
+
}
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Box, { className: emptyNode, children: /* @__PURE__ */ jsxs(Text, { c: "dimmed", fz: "lg", fw: 500, children: [
|
|
12
|
+
"No ",
|
|
13
|
+
column === "incomers" ? "incoming" : "outgoing"
|
|
14
|
+
] }) });
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
EmptyNode
|
|
18
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as Tooltip$1, Stack, Group, ThemeIcon, Text, Box, ActionIcon } from "@mantine/core";
|
|
3
|
+
import { IconBoxMultipleFilled, IconZoomScan } from "@tabler/icons-react";
|
|
4
|
+
import { getBezierPath, BaseEdge, EdgeLabelRenderer } from "@xyflow/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { only } from "remeda";
|
|
7
|
+
import { useDiagramState } from "../../../hooks/useDiagramState.js";
|
|
8
|
+
import { stopPropagation } from "../../../xyflow/utils.js";
|
|
9
|
+
import { useOverlayDialog } from "../../OverlayContext.js";
|
|
10
|
+
import { edgeContainer, edgeLabel, edgeLabelText, edgeLabelTechnology } from "../../shared/xyflow/RelationshipEdge.css.js";
|
|
11
|
+
import { ZIndexes } from "../use-layouted-relationships.js";
|
|
12
|
+
const Tooltip = Tooltip$1.withProps({
|
|
13
|
+
color: "dark",
|
|
14
|
+
fz: "sm",
|
|
15
|
+
openDelay: 400,
|
|
16
|
+
closeDelay: 150,
|
|
17
|
+
withinPortal: false,
|
|
18
|
+
label: "",
|
|
19
|
+
children: null,
|
|
20
|
+
offset: 4
|
|
21
|
+
});
|
|
22
|
+
function RelationshipEdge({
|
|
23
|
+
data,
|
|
24
|
+
label,
|
|
25
|
+
// Exclude the following props from the rest
|
|
26
|
+
animated: _animated,
|
|
27
|
+
...props
|
|
28
|
+
}) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const {
|
|
31
|
+
viewId,
|
|
32
|
+
onNavigateTo
|
|
33
|
+
} = useDiagramState((s) => ({
|
|
34
|
+
viewId: s.view.id,
|
|
35
|
+
onNavigateTo: s.onNavigateTo
|
|
36
|
+
}));
|
|
37
|
+
const overlay = useOverlayDialog();
|
|
38
|
+
const [edgePath, labelX, labelY] = getBezierPath(props);
|
|
39
|
+
const navigateTo = onNavigateTo ? (_a = only(data.relations)) == null ? void 0 : _a.navigateTo : void 0;
|
|
40
|
+
const isMultiRelation = data.relations.length > 1;
|
|
41
|
+
const technology = (_b = only(data.relations)) == null ? void 0 : _b.technology;
|
|
42
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"g",
|
|
45
|
+
{
|
|
46
|
+
className: edgeContainer,
|
|
47
|
+
"data-edge-dimmed": data.dimmed,
|
|
48
|
+
"data-edge-hovered": data.hovered,
|
|
49
|
+
"data-likec4-color": data.existsInCurrentView ? "gray" : "amber",
|
|
50
|
+
children: /* @__PURE__ */ jsx(
|
|
51
|
+
BaseEdge,
|
|
52
|
+
{
|
|
53
|
+
path: edgePath,
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsxs(
|
|
60
|
+
Stack,
|
|
61
|
+
{
|
|
62
|
+
gap: 2,
|
|
63
|
+
style: {
|
|
64
|
+
position: "absolute",
|
|
65
|
+
transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
|
|
66
|
+
maxWidth: Math.abs(props.targetX - props.sourceX - 70),
|
|
67
|
+
zIndex: ZIndexes.max
|
|
68
|
+
},
|
|
69
|
+
className: clsx([
|
|
70
|
+
edgeLabel,
|
|
71
|
+
"nodrag nopan"
|
|
72
|
+
]),
|
|
73
|
+
"data-edge-dimmed": data.dimmed,
|
|
74
|
+
"data-edge-hovered": data.hovered,
|
|
75
|
+
"data-likec4-color": data.existsInCurrentView ? "gray" : "amber",
|
|
76
|
+
children: [
|
|
77
|
+
label && /* @__PURE__ */ jsx(Tooltip, { label: "Not included in current view", disabled: data.existsInCurrentView, color: "orange", children: /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", children: [
|
|
78
|
+
isMultiRelation && /* @__PURE__ */ jsx(ThemeIcon, { size: "sm", variant: "transparent", color: "orange", children: /* @__PURE__ */ jsx(IconBoxMultipleFilled, { style: { width: "80%" } }) }),
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
Text,
|
|
81
|
+
{
|
|
82
|
+
fw: isMultiRelation ? "500" : "400",
|
|
83
|
+
style: {
|
|
84
|
+
whiteSpace: isMultiRelation ? "nowrap" : void 0
|
|
85
|
+
},
|
|
86
|
+
component: "div",
|
|
87
|
+
className: edgeLabelText,
|
|
88
|
+
lineClamp: 3,
|
|
89
|
+
children: label
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] }) }),
|
|
93
|
+
technology && /* @__PURE__ */ jsxs(Text, { component: "div", className: edgeLabelTechnology, children: [
|
|
94
|
+
"[ ",
|
|
95
|
+
technology,
|
|
96
|
+
" ]"
|
|
97
|
+
] }),
|
|
98
|
+
navigateTo && viewId !== navigateTo && /* @__PURE__ */ jsx(Box, { ta: "center", mt: 4, children: /* @__PURE__ */ jsx(
|
|
99
|
+
ActionIcon,
|
|
100
|
+
{
|
|
101
|
+
variant: "default",
|
|
102
|
+
size: "sm",
|
|
103
|
+
radius: "sm",
|
|
104
|
+
onPointerDownCapture: stopPropagation,
|
|
105
|
+
onClick: (event) => {
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
overlay.close(() => {
|
|
108
|
+
onNavigateTo == null ? void 0 : onNavigateTo(navigateTo, event);
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
role: "button",
|
|
112
|
+
onDoubleClick: stopPropagation,
|
|
113
|
+
children: /* @__PURE__ */ jsx(IconZoomScan, {})
|
|
114
|
+
}
|
|
115
|
+
) })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
) })
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
RelationshipEdge
|
|
123
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const elementNode: string;
|
|
2
|
+
export declare const elementNodeContent: string;
|
|
3
|
+
export declare const elementNodeTitle: string;
|
|
4
|
+
export declare const elementNodeDescription: string;
|
|
5
|
+
export declare const compoundNodeBody: string;
|
|
6
|
+
export declare const compoundNodeTitle: string;
|
|
7
|
+
export declare const cssShapeSvg: string;
|
|
8
|
+
export declare const edgeContainer: string;
|
|
9
|
+
export declare const edgeLabel: string;
|
|
10
|
+
export declare const edgeLabelText: string;
|
|
11
|
+
export declare const edgeLabelTechnology: string;
|
|
12
|
+
export declare const emptyNode: string;
|
|
13
|
+
export declare const navigateBtnBox: string;
|
|
14
|
+
export declare const navigateBtn: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
var elementNode = "_19duq0h0";
|
|
4
|
+
var elementNodeContent = "_19duq0h1";
|
|
5
|
+
var elementNodeTitle = "_19duq0h2";
|
|
6
|
+
var elementNodeDescription = "_19duq0h3";
|
|
7
|
+
var compoundNodeBody = "_19duq0h4";
|
|
8
|
+
var compoundNodeTitle = "_19duq0h5";
|
|
9
|
+
var cssShapeSvg = "_19duq0h6";
|
|
10
|
+
var emptyNode = "_19duq0hb";
|
|
11
|
+
var navigateBtnBox = "_19duq0hc";
|
|
12
|
+
var navigateBtn = "_19duq0hd";
|
|
13
|
+
export {
|
|
14
|
+
compoundNodeBody,
|
|
15
|
+
compoundNodeTitle,
|
|
16
|
+
cssShapeSvg,
|
|
17
|
+
elementNode,
|
|
18
|
+
elementNodeContent,
|
|
19
|
+
elementNodeDescription,
|
|
20
|
+
elementNodeTitle,
|
|
21
|
+
emptyNode,
|
|
22
|
+
navigateBtn,
|
|
23
|
+
navigateBtnBox
|
|
24
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
var edgeContainer = "_5hogu30";
|
|
4
|
+
var edgeLabel = "_5hogu31 _5hogu30";
|
|
5
|
+
var edgeLabelText = "_5hogu32";
|
|
6
|
+
var edgeLabelTechnology = "_5hogu33";
|
|
7
|
+
export {
|
|
8
|
+
edgeContainer,
|
|
9
|
+
edgeLabel,
|
|
10
|
+
edgeLabelTechnology,
|
|
11
|
+
edgeLabelText
|
|
12
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AbstractRelation, ComputedNode, Fqn, ViewId } from '@likec4/core';
|
|
2
|
+
import { Edge as ReactFlowEdge, Node as ReactFlowNode } from '@xyflow/react';
|
|
3
|
+
import { SetRequired } from 'type-fest';
|
|
4
|
+
export declare namespace SharedFlowTypes {
|
|
5
|
+
type EmptyNodeData = {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the cursor is hovering over the node
|
|
8
|
+
*/
|
|
9
|
+
hovered?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the node is currently leaving the overlay
|
|
12
|
+
*/
|
|
13
|
+
leaving?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the node is currently entering the overlay
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
entering?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the node is dimmed
|
|
21
|
+
* 'immediate' means that the node is dimmed without delay
|
|
22
|
+
*/
|
|
23
|
+
dimmed?: 'immediate' | boolean;
|
|
24
|
+
};
|
|
25
|
+
type NonEmptyNodeData = EmptyNodeData & {
|
|
26
|
+
/**
|
|
27
|
+
* The node's fully qualified name
|
|
28
|
+
*/
|
|
29
|
+
fqn: Fqn;
|
|
30
|
+
};
|
|
31
|
+
type OverlayNodeData = NonEmptyNodeData & {
|
|
32
|
+
/**
|
|
33
|
+
* The ComputedNode backing this node
|
|
34
|
+
*/
|
|
35
|
+
element: Pick<ComputedNode, 'color' | 'title' | 'description' | 'shape' | 'kind'>;
|
|
36
|
+
/**
|
|
37
|
+
* The node's incoming and outgoing ports
|
|
38
|
+
*/
|
|
39
|
+
ports: {
|
|
40
|
+
in: string[];
|
|
41
|
+
out: string[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The id of the view that should be navigated to when clicking the navigate button
|
|
45
|
+
*/
|
|
46
|
+
navigateTo: ViewId | null;
|
|
47
|
+
/**
|
|
48
|
+
* The node's visual depth on the screen, 1 being the highest
|
|
49
|
+
*/
|
|
50
|
+
depth?: number;
|
|
51
|
+
};
|
|
52
|
+
type ElementNode = SetRequired<ReactFlowNode<OverlayNodeData, 'element'>, 'type'>;
|
|
53
|
+
type CompoundNode = SetRequired<ReactFlowNode<OverlayNodeData, 'compound'>, 'type'>;
|
|
54
|
+
type NonEmptyNode = ElementNode | CompoundNode;
|
|
55
|
+
type EmptyNode = SetRequired<ReactFlowNode<EmptyNodeData, 'empty'>, 'type'>;
|
|
56
|
+
type Node = NonEmptyNode | EmptyNode;
|
|
57
|
+
type EdgeData = {
|
|
58
|
+
/**
|
|
59
|
+
* The model's relations represented by this edge
|
|
60
|
+
*/
|
|
61
|
+
relations: [AbstractRelation, ...AbstractRelation[]];
|
|
62
|
+
/**
|
|
63
|
+
* Whether the cursor is hovering over the node
|
|
64
|
+
*/
|
|
65
|
+
hovered?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the node is dimmed
|
|
68
|
+
* 'immediate' means that the node is dimmed without delay
|
|
69
|
+
*/
|
|
70
|
+
dimmed?: 'immediate' | boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The id of the view that should be navigated to when clicking the edge
|
|
73
|
+
*/
|
|
74
|
+
navigateTo?: ViewId | null;
|
|
75
|
+
};
|
|
76
|
+
type Edge = SetRequired<ReactFlowEdge<EdgeData, 'relation'>, 'data' | 'type'>;
|
|
77
|
+
}
|