@likec4/diagram 1.18.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,76 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Handle, Position } from "@xyflow/react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { m } from "framer-motion";
|
|
5
|
+
import { compoundNodeBody, compoundNodeTitle } from "./styles.css.js";
|
|
6
|
+
import { Text } from "../../../controls/Text.js";
|
|
7
|
+
function CompoundNode({
|
|
8
|
+
data: {
|
|
9
|
+
element,
|
|
10
|
+
ports,
|
|
11
|
+
...data
|
|
12
|
+
},
|
|
13
|
+
width = 200,
|
|
14
|
+
selectable = true
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
m.div,
|
|
19
|
+
{
|
|
20
|
+
className: clsx([
|
|
21
|
+
compoundNodeBody,
|
|
22
|
+
"likec4-compound-node"
|
|
23
|
+
]),
|
|
24
|
+
"data-compound-depth": 3,
|
|
25
|
+
"data-likec4-color": element.color,
|
|
26
|
+
animate: {
|
|
27
|
+
opacity: data.dimmed ? 0.15 : 1,
|
|
28
|
+
transition: {
|
|
29
|
+
delay: data.dimmed === true ? 0.4 : 0
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
...selectable && {
|
|
33
|
+
whileHover: {
|
|
34
|
+
scale: 1.04,
|
|
35
|
+
transition: {
|
|
36
|
+
delay: 0.15
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
whileTap: {
|
|
40
|
+
scale: 1
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
children: /* @__PURE__ */ jsx(Text, { className: compoundNodeTitle, maw: width - 20, children: element.title })
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
ports.out.map((id, i) => /* @__PURE__ */ jsx(
|
|
47
|
+
Handle,
|
|
48
|
+
{
|
|
49
|
+
id,
|
|
50
|
+
type: "source",
|
|
51
|
+
position: Position.Right,
|
|
52
|
+
style: {
|
|
53
|
+
visibility: "hidden",
|
|
54
|
+
top: `${16 + 20 * i}px`
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
id
|
|
58
|
+
)),
|
|
59
|
+
ports.in.map((id, i) => /* @__PURE__ */ jsx(
|
|
60
|
+
Handle,
|
|
61
|
+
{
|
|
62
|
+
id,
|
|
63
|
+
type: "target",
|
|
64
|
+
position: Position.Left,
|
|
65
|
+
style: {
|
|
66
|
+
visibility: "hidden",
|
|
67
|
+
top: `${16 + 20 * i}px`
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
id
|
|
71
|
+
))
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
CompoundNode
|
|
76
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NodeProps } from '@xyflow/react';
|
|
2
|
+
import { SharedFlowTypes } from '../../shared/xyflow/_types';
|
|
3
|
+
type ElementNodeProps = NodeProps<SharedFlowTypes.ElementNode>;
|
|
4
|
+
export declare function ElementNode({ data: { element, ports, navigateTo, ...data }, selectable, width: w, height: h }: ElementNodeProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
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 { m } from "framer-motion";
|
|
7
|
+
import { ElementShapeSvg } from "../../../xyflow/nodes/element/ElementShapeSvg.js";
|
|
8
|
+
import { stopPropagation } from "../../../xyflow/utils.js";
|
|
9
|
+
import { useOverlayDialog } from "../../OverlayContext.js";
|
|
10
|
+
import { navigateBtn, elementNode, cssShapeSvg, elementNodeContent, elementNodeTitle, elementNodeDescription, navigateBtnBox } from "./styles.css.js";
|
|
11
|
+
import { Text } from "../../../controls/Text.js";
|
|
12
|
+
import { useDiagramState } from "../../../hooks/useDiagramState.js";
|
|
13
|
+
const Action = ActionIcon.withProps({
|
|
14
|
+
className: "nodrag nopan " + navigateBtn,
|
|
15
|
+
radius: "md",
|
|
16
|
+
role: "button",
|
|
17
|
+
onDoubleClick: stopPropagation,
|
|
18
|
+
onPointerDownCapture: stopPropagation
|
|
19
|
+
});
|
|
20
|
+
function selector(s) {
|
|
21
|
+
return {
|
|
22
|
+
currentViewId: s.view.id,
|
|
23
|
+
enableRelationshipBrowser: s.enableRelationshipBrowser,
|
|
24
|
+
onNavigateTo: s.onNavigateTo,
|
|
25
|
+
onOpenSource: s.onOpenSource
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function ElementNode({
|
|
29
|
+
data: {
|
|
30
|
+
element,
|
|
31
|
+
ports,
|
|
32
|
+
navigateTo,
|
|
33
|
+
...data
|
|
34
|
+
},
|
|
35
|
+
selectable = true,
|
|
36
|
+
width: w = 100,
|
|
37
|
+
height: h = 100
|
|
38
|
+
}) {
|
|
39
|
+
const overlay = useOverlayDialog();
|
|
40
|
+
const {
|
|
41
|
+
currentViewId,
|
|
42
|
+
onNavigateTo,
|
|
43
|
+
onOpenSource,
|
|
44
|
+
enableRelationshipBrowser
|
|
45
|
+
} = useDiagramState(selector);
|
|
46
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
47
|
+
/* @__PURE__ */ jsxs(
|
|
48
|
+
m.div,
|
|
49
|
+
{
|
|
50
|
+
className: clsx([
|
|
51
|
+
elementNode,
|
|
52
|
+
"likec4-element-node"
|
|
53
|
+
]),
|
|
54
|
+
"data-likec4-color": element.color,
|
|
55
|
+
"data-likec4-shape": element.shape,
|
|
56
|
+
animate: {
|
|
57
|
+
opacity: data.dimmed ? 0.15 : 1,
|
|
58
|
+
transition: {
|
|
59
|
+
delay: data.dimmed === true ? 0.4 : 0
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
...selectable && {
|
|
63
|
+
whileHover: {
|
|
64
|
+
scale: 1.045,
|
|
65
|
+
transition: {
|
|
66
|
+
delay: 0.15
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
whileTap: {
|
|
70
|
+
scale: 0.97
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"svg",
|
|
76
|
+
{
|
|
77
|
+
className: clsx(
|
|
78
|
+
cssShapeSvg
|
|
79
|
+
),
|
|
80
|
+
viewBox: `0 0 ${w} ${h}`,
|
|
81
|
+
width: w,
|
|
82
|
+
height: h,
|
|
83
|
+
children: /* @__PURE__ */ jsx(ElementShapeSvg, { shape: element.shape, w, h })
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ jsxs(Box, { className: elementNodeContent, children: [
|
|
87
|
+
/* @__PURE__ */ jsx(Text, { className: elementNodeTitle, lineClamp: 2, children: element.title }),
|
|
88
|
+
element.description && /* @__PURE__ */ jsx(Text, { className: elementNodeDescription, lineClamp: 4, children: element.description })
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsxs(Group, { className: navigateBtnBox, children: [
|
|
91
|
+
navigateTo && onNavigateTo && navigateTo !== currentViewId && /* @__PURE__ */ jsx(
|
|
92
|
+
Action,
|
|
93
|
+
{
|
|
94
|
+
onClick: (event) => {
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
overlay.close(() => onNavigateTo(navigateTo));
|
|
97
|
+
},
|
|
98
|
+
children: /* @__PURE__ */ jsx(IconZoomScan, { stroke: 1.8, style: { width: "75%" } })
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
enableRelationshipBrowser && /* @__PURE__ */ jsx(
|
|
102
|
+
Action,
|
|
103
|
+
{
|
|
104
|
+
onClick: (event) => {
|
|
105
|
+
event.stopPropagation();
|
|
106
|
+
overlay.openOverlay({
|
|
107
|
+
relationshipsOf: data.fqn
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
children: /* @__PURE__ */ jsx(IconTransform, { stroke: 1.8, style: { width: "72%" } })
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
onOpenSource && /* @__PURE__ */ jsx(
|
|
114
|
+
Action,
|
|
115
|
+
{
|
|
116
|
+
onClick: (event) => {
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
onOpenSource({
|
|
119
|
+
element: data.fqn
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
children: /* @__PURE__ */ jsx(IconFileSymlink, { stroke: 1.8, style: { width: "72%" } })
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
ports.out.map((id, i) => /* @__PURE__ */ jsx(
|
|
130
|
+
Handle,
|
|
131
|
+
{
|
|
132
|
+
id,
|
|
133
|
+
type: "source",
|
|
134
|
+
position: Position.Right,
|
|
135
|
+
style: {
|
|
136
|
+
visibility: "hidden",
|
|
137
|
+
top: `${15 + (i + 1) * ((h - 30) / (ports.out.length + 1))}px`
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
id
|
|
141
|
+
)),
|
|
142
|
+
ports.in.map((id, i) => /* @__PURE__ */ jsx(
|
|
143
|
+
Handle,
|
|
144
|
+
{
|
|
145
|
+
id,
|
|
146
|
+
type: "target",
|
|
147
|
+
position: Position.Left,
|
|
148
|
+
style: {
|
|
149
|
+
visibility: "hidden",
|
|
150
|
+
top: `${15 + (i + 1) * ((h - 30) / (ports.in.length + 1))}px`
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
id
|
|
154
|
+
))
|
|
155
|
+
] });
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
ElementNode
|
|
159
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Stack, Text, Box, ActionIcon } from "@mantine/core";
|
|
3
|
+
import { IconZoomScan } from "@tabler/icons-react";
|
|
4
|
+
import { getBezierPath, BaseEdge, EdgeLabelRenderer } from "@xyflow/react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { useDiagramState } from "../../../hooks/useDiagramState.js";
|
|
7
|
+
import { stopPropagation } from "../../../xyflow/utils.js";
|
|
8
|
+
import { useOverlayDialog } from "../../OverlayContext.js";
|
|
9
|
+
import { edgeContainer, edgeLabel, edgeLabelText, edgeLabelTechnology } from "../../shared/xyflow/RelationshipEdge.css.js";
|
|
10
|
+
import { ZIndexes } from "../use-layouted-edge-details.js";
|
|
11
|
+
function RelationshipEdge({
|
|
12
|
+
data,
|
|
13
|
+
label,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const overlay = useOverlayDialog();
|
|
17
|
+
const onNavigateTo = useDiagramState((s) => s.onNavigateTo);
|
|
18
|
+
const [edgePath, labelX, labelY] = getBezierPath(props);
|
|
19
|
+
const navigateTo = data.navigateTo;
|
|
20
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
"g",
|
|
23
|
+
{
|
|
24
|
+
className: edgeContainer,
|
|
25
|
+
"data-edge-dimmed": data.dimmed,
|
|
26
|
+
"data-edge-hovered": data.hovered,
|
|
27
|
+
children: /* @__PURE__ */ jsx(
|
|
28
|
+
BaseEdge,
|
|
29
|
+
{
|
|
30
|
+
path: edgePath,
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsxs(
|
|
37
|
+
Stack,
|
|
38
|
+
{
|
|
39
|
+
gap: 2,
|
|
40
|
+
style: {
|
|
41
|
+
position: "absolute",
|
|
42
|
+
transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
|
|
43
|
+
maxWidth: Math.abs(props.targetX - props.sourceX - 40),
|
|
44
|
+
zIndex: ZIndexes.max
|
|
45
|
+
},
|
|
46
|
+
className: clsx([
|
|
47
|
+
edgeLabel,
|
|
48
|
+
"nodrag nopan"
|
|
49
|
+
]),
|
|
50
|
+
"data-edge-dimmed": data.dimmed,
|
|
51
|
+
"data-edge-hovered": data.hovered,
|
|
52
|
+
children: [
|
|
53
|
+
label && /* @__PURE__ */ jsx(Text, { component: "div", className: edgeLabelText, lineClamp: 3, children: label }),
|
|
54
|
+
data.technology && /* @__PURE__ */ jsxs(Text, { component: "div", className: edgeLabelTechnology, children: [
|
|
55
|
+
"[ ",
|
|
56
|
+
data.technology,
|
|
57
|
+
" ]"
|
|
58
|
+
] }),
|
|
59
|
+
navigateTo && onNavigateTo && /* @__PURE__ */ jsx(Box, { ta: "center", mt: 4, children: /* @__PURE__ */ jsx(
|
|
60
|
+
ActionIcon,
|
|
61
|
+
{
|
|
62
|
+
variant: "default",
|
|
63
|
+
size: "sm",
|
|
64
|
+
radius: "sm",
|
|
65
|
+
onPointerDownCapture: stopPropagation,
|
|
66
|
+
onClick: (event) => {
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
overlay.close(() => {
|
|
69
|
+
onNavigateTo(navigateTo);
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
role: "button",
|
|
73
|
+
onDoubleClick: stopPropagation,
|
|
74
|
+
children: /* @__PURE__ */ jsx(IconZoomScan, {})
|
|
75
|
+
}
|
|
76
|
+
) })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
) })
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
RelationshipEdge
|
|
84
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
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 navigateBtnBox: string;
|
|
9
|
+
export declare const navigateBtn: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
var elementNode = "_144zcea0";
|
|
3
|
+
var elementNodeContent = "_144zcea1";
|
|
4
|
+
var elementNodeTitle = "_144zcea2";
|
|
5
|
+
var elementNodeDescription = "_144zcea3";
|
|
6
|
+
var compoundNodeBody = "_144zcea4";
|
|
7
|
+
var compoundNodeTitle = "_144zcea5";
|
|
8
|
+
var cssShapeSvg = "_144zcea6";
|
|
9
|
+
var navigateBtnBox = "_144zcea7";
|
|
10
|
+
var navigateBtn = "_144zcea8";
|
|
11
|
+
export {
|
|
12
|
+
compoundNodeBody,
|
|
13
|
+
compoundNodeTitle,
|
|
14
|
+
cssShapeSvg,
|
|
15
|
+
elementNode,
|
|
16
|
+
elementNodeContent,
|
|
17
|
+
elementNodeDescription,
|
|
18
|
+
elementNodeTitle,
|
|
19
|
+
navigateBtn,
|
|
20
|
+
navigateBtnBox
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const cardBg: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
2
|
+
export declare const dialog: string;
|
|
3
|
+
export declare const card: string;
|
|
4
|
+
export declare const cardHeader: string;
|
|
5
|
+
export declare const title: string;
|
|
6
|
+
export declare const elementIcon: string;
|
|
7
|
+
export declare const viewButton: string;
|
|
8
|
+
export declare const viewButtonTitle: string;
|
|
9
|
+
export declare const tabsRoot: string;
|
|
10
|
+
export declare const tabsList: string;
|
|
11
|
+
export declare const tabsTab: string;
|
|
12
|
+
export declare const tabsPanel: string;
|
|
13
|
+
export declare const propertiesGrid: string;
|
|
14
|
+
export declare const propertyLabel: string;
|
|
15
|
+
export declare const elementLink: string;
|
|
16
|
+
export declare const resizeHandle: string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
var dialog = "paikoy2";
|
|
3
|
+
var card = "paikoy3";
|
|
4
|
+
var cardHeader = "paikoy4";
|
|
5
|
+
var title = "paikoy5";
|
|
6
|
+
var elementIcon = "paikoy6";
|
|
7
|
+
var viewButton = "paikoy9";
|
|
8
|
+
var viewButtonTitle = "paikoya";
|
|
9
|
+
var tabsRoot = "paikoyb";
|
|
10
|
+
var tabsList = "paikoyc";
|
|
11
|
+
var tabsTab = "paikoyd";
|
|
12
|
+
var tabsPanel = "paikoye";
|
|
13
|
+
var propertiesGrid = "paikoyf";
|
|
14
|
+
var propertyLabel = "paikoyg";
|
|
15
|
+
var elementLink = "paikoyh";
|
|
16
|
+
var resizeHandle = "paikoyi";
|
|
17
|
+
export {
|
|
18
|
+
card,
|
|
19
|
+
cardHeader,
|
|
20
|
+
dialog,
|
|
21
|
+
elementIcon,
|
|
22
|
+
elementLink,
|
|
23
|
+
propertiesGrid,
|
|
24
|
+
propertyLabel,
|
|
25
|
+
resizeHandle,
|
|
26
|
+
tabsList,
|
|
27
|
+
tabsPanel,
|
|
28
|
+
tabsRoot,
|
|
29
|
+
tabsTab,
|
|
30
|
+
title,
|
|
31
|
+
viewButton,
|
|
32
|
+
viewButtonTitle
|
|
33
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Fqn } from '@likec4/core';
|
|
2
|
+
import { MemoExoticComponent } from 'react';
|
|
3
|
+
type ElementDetailsCardProps = {
|
|
4
|
+
fqn: Fqn;
|
|
5
|
+
};
|
|
6
|
+
export declare const ElementDetailsCard: MemoExoticComponent<({ fqn }: ElementDetailsCardProps) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
export {};
|