@likec4/diagram 1.21.0 → 1.22.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/dist/LikeC4Diagram.js +9 -13
- package/dist/base/BaseXYFlow.js +0 -1
- package/dist/base/index.d.ts +0 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
- package/dist/base/primitives/edge/EdgeLabel.js +2 -2
- package/dist/base/primitives/element/ElementNodeContainer.d.ts +6 -1
- package/dist/base/primitives/element/ElementNodeContainer.js +31 -13
- package/dist/base/primitives/element/ElementTitle.js +7 -3
- package/dist/base/primitives/element/styles.css.js +1 -1
- package/dist/{base → components}/Link.css.js +3 -3
- package/dist/components/SearchControl.css.d.ts +2 -0
- package/dist/components/SearchControl.css.js +7 -0
- package/dist/components/SearchControl.d.ts +5 -0
- package/dist/components/SearchControl.js +17 -0
- package/dist/context/IconRenderer.d.ts +10 -0
- package/dist/context/IconRenderer.js +34 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useDiagram.d.ts +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/likec4diagram/DiagramUI.js +1 -4
- package/dist/likec4diagram/XYFlow.d.ts +6 -1
- package/dist/likec4diagram/XYFlow.js +28 -29
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +3 -1
- package/dist/likec4diagram/state/actorContext.d.ts +16 -16
- package/dist/likec4diagram/state/assign.js +1 -1
- package/dist/likec4diagram/state/machine.d.ts +7 -7
- package/dist/likec4diagram/state/machine.js +10 -7
- package/dist/likec4diagram/ui/controls/Controls.js +63 -48
- package/dist/likec4diagram/ui/controls/NavigationButtons.js +44 -69
- package/dist/likec4diagram/ui/controls/_shared.js +1 -1
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +5 -4
- package/dist/likec4diagram/ui/index.d.ts +2 -0
- package/dist/likec4diagram/ui/search/ElementsColumn.css.d.ts +15 -0
- package/dist/likec4diagram/ui/search/ElementsColumn.css.js +30 -0
- package/dist/likec4diagram/ui/search/ElementsColumn.d.ts +1 -0
- package/dist/likec4diagram/ui/search/ElementsColumn.js +243 -0
- package/dist/likec4diagram/ui/search/LikeC4Search.css.d.ts +8 -0
- package/dist/likec4diagram/ui/search/LikeC4Search.css.js +20 -0
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +1 -0
- package/dist/likec4diagram/ui/search/LikeC4Search.js +265 -0
- package/dist/likec4diagram/ui/search/SearchInput.d.ts +1 -0
- package/dist/likec4diagram/ui/search/SearchInput.js +196 -0
- package/dist/likec4diagram/ui/search/ViewsColum.d.ts +9 -0
- package/dist/likec4diagram/ui/search/ViewsColum.js +130 -0
- package/dist/likec4diagram/ui/search/ViewsColumn.css.d.ts +5 -0
- package/dist/likec4diagram/ui/search/ViewsColumn.css.js +12 -0
- package/dist/likec4diagram/ui/search/_shared.css.d.ts +16 -0
- package/dist/likec4diagram/ui/search/_shared.css.js +5 -0
- package/dist/likec4diagram/ui/search/state.d.ts +19 -0
- package/dist/likec4diagram/ui/search/state.js +72 -0
- package/dist/likec4diagram/ui/search/utils.d.ts +3 -0
- package/dist/likec4diagram/ui/search/utils.js +23 -0
- package/dist/likec4diagram/useLayoutConstraints.js +4 -5
- package/dist/likec4model/useLikeC4ElementsTree.d.ts +1 -0
- package/dist/likec4model/useLikeC4ElementsTree.js +1 -0
- package/dist/overlays/Overlays.js +10 -10
- package/dist/overlays/element-details/ElementDetailsCard.js +20 -13
- package/dist/overlays/element-details/TabPanelDeployments.js +4 -2
- package/dist/overlays/overlay/Overlay.d.ts +6 -2
- package/dist/overlays/overlay/Overlay.js +18 -29
- package/dist/overlays/relationship-details/SelectEdge.js +1 -3
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +6 -5
- package/dist/overlays/relationships-browser/SelectElement.js +10 -6
- package/dist/overlays/relationships-browser/actor.d.ts +2 -2
- package/dist/overlays/relationships-browser/actor.js +8 -8
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +2 -2
- package/dist/style.css +1 -1
- package/package.json +15 -14
- package/src/LikeC4Diagram.tsx +0 -1
- package/src/base/BaseXYFlow.tsx +0 -1
- package/src/base/index.ts +0 -2
- package/src/base/primitives/element/ElementNodeContainer.css.ts +4 -7
- package/src/base/primitives/element/ElementNodeContainer.tsx +36 -16
- package/src/base/primitives/element/ElementTitle.css.ts +12 -9
- package/src/base/primitives/element/ElementTitle.tsx +6 -2
- package/src/base/primitives/element/styles.css.ts +18 -40
- package/src/{base → components}/Link.css.ts +3 -3
- package/src/components/SearchControl.css.ts +69 -0
- package/src/components/SearchControl.tsx +33 -0
- package/src/context/IconRenderer.tsx +54 -1
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +15 -1
- package/src/likec4diagram/DiagramUI.tsx +1 -8
- package/src/likec4diagram/XYFlow.tsx +30 -30
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +0 -1
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.ts +1 -0
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +3 -1
- package/src/likec4diagram/state/assign.ts +1 -1
- package/src/likec4diagram/state/machine.ts +12 -10
- package/src/likec4diagram/ui/controls/Controls.tsx +35 -25
- package/src/likec4diagram/ui/controls/NavigationButtons.tsx +36 -58
- package/src/likec4diagram/ui/controls/styles.css.ts +3 -1
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +111 -108
- package/src/likec4diagram/ui/index.ts +2 -0
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -3
- package/src/likec4diagram/ui/search/ElementsColumn.css.ts +119 -0
- package/src/likec4diagram/ui/search/ElementsColumn.tsx +291 -0
- package/src/likec4diagram/ui/search/LikeC4Search.css.ts +117 -0
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +312 -0
- package/src/likec4diagram/ui/search/SearchInput.tsx +235 -0
- package/src/likec4diagram/ui/search/ViewsColum.tsx +158 -0
- package/src/likec4diagram/ui/search/ViewsColumn.css.ts +37 -0
- package/src/likec4diagram/ui/search/_shared.css.ts +104 -0
- package/src/likec4diagram/ui/search/state.ts +76 -0
- package/src/likec4diagram/ui/search/utils.ts +20 -0
- package/src/likec4diagram/useLayoutConstraints.ts +4 -5
- package/src/likec4model/useLikeC4ElementsTree.ts +4 -4
- package/src/overlays/Overlays.tsx +32 -26
- package/src/overlays/element-details/ElementDetailsCard.css.ts +4 -4
- package/src/overlays/element-details/ElementDetailsCard.tsx +246 -244
- package/src/overlays/element-details/TabPanelDeployments.tsx +4 -4
- package/src/overlays/overlay/Overlay.css.ts +10 -9
- package/src/overlays/overlay/Overlay.tsx +38 -26
- package/src/overlays/relationship-details/SelectEdge.css.ts +1 -0
- package/src/overlays/relationship-details/SelectEdge.tsx +2 -4
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +10 -5
- package/src/overlays/relationships-browser/SelectElement.tsx +88 -82
- package/src/overlays/relationships-browser/actor.ts +10 -10
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +2 -2
- package/dist/LikeC4Search.css.d.ts +0 -1
- package/dist/LikeC4Search.css.js +0 -5
- package/dist/LikeC4Search.d.ts +0 -2
- package/dist/LikeC4Search.js +0 -88
- package/src/LikeC4Search.css.ts +0 -12
- package/src/LikeC4Search.tsx +0 -91
- /package/dist/{base → components}/Link.css.d.ts +0 -0
- /package/dist/{base → components}/Link.d.ts +0 -0
- /package/dist/{base → components}/Link.js +0 -0
- /package/src/{base → components}/Link.tsx +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { isScopedElementView, isDeploymentView } from "@likec4/core";
|
|
3
|
-
import {
|
|
3
|
+
import { Card, Box, Group, Text, CloseButton, Badge, Flex, ActionIconGroup, ActionIcon, Tooltip as Tooltip$1, Tabs, TabsList, TabsTab, TabsPanel, ScrollArea, Stack, Divider as Divider$1, Code, UnstyledButton, ThemeIcon } from "@mantine/core";
|
|
4
4
|
import { useViewportSize, useSessionStorage } from "@mantine/hooks";
|
|
5
|
-
import { useSyncedRef, useDebouncedCallback } from "@react-hookz/web";
|
|
5
|
+
import { useSyncedRef, useDebouncedCallback, useTimeoutEffect } from "@react-hookz/web";
|
|
6
6
|
import { IconExternalLink, IconFileSymlink, IconZoomScan, IconStack2 } from "@tabler/icons-react";
|
|
7
7
|
import { useDragControls, useMotionValue, m } from "framer-motion";
|
|
8
|
-
import { useCallback, useRef } from "react";
|
|
8
|
+
import { useState, useCallback, useRef } from "react";
|
|
9
9
|
import { pipe, map, partition, only, clamp, isNullish } from "remeda";
|
|
10
|
+
import { Link } from "../../components/Link.js";
|
|
10
11
|
import { useDiagram } from "../../hooks/useDiagram.js";
|
|
11
12
|
import { dialog, card, cardHeader, title, tabsPanel, tabsTab, tabsList, tabsRoot, propertiesGrid, resizeHandle, elementIcon, propertyLabel, viewButton, viewButtonTitle } from "./ElementDetailsCard.css.js";
|
|
12
13
|
import { TabPanelDeployments } from "./TabPanelDeployments.js";
|
|
@@ -16,7 +17,6 @@ import { useLikeC4Model } from "../../likec4model/useLikeC4Model.js";
|
|
|
16
17
|
import { useUpdateEffect } from "../../hooks/useUpdateEffect.js";
|
|
17
18
|
import { IconRenderer } from "../../context/IconRenderer.js";
|
|
18
19
|
import { IfEnabled, DiagramFeatures } from "../../context/DiagramFeatures.js";
|
|
19
|
-
import { Link } from "../../base/Link.js";
|
|
20
20
|
const Divider = Divider$1.withProps({
|
|
21
21
|
mb: 8,
|
|
22
22
|
labelPosition: "left",
|
|
@@ -54,6 +54,7 @@ function ElementDetailsCard({
|
|
|
54
54
|
onClose
|
|
55
55
|
}) {
|
|
56
56
|
var _a, _b, _c;
|
|
57
|
+
const [opened, setOpened] = useState(false);
|
|
57
58
|
const windowSize = useViewportSize();
|
|
58
59
|
const windowWidth = windowSize.width || window.innerWidth || 1200, windowHeight = windowSize.height || window.innerHeight || 800;
|
|
59
60
|
const [activeTab, setActiveTab] = useSessionStorage({
|
|
@@ -138,11 +139,21 @@ function ElementDetailsCard({
|
|
|
138
139
|
},
|
|
139
140
|
className: elementIcon
|
|
140
141
|
});
|
|
142
|
+
useTimeoutEffect(() => {
|
|
143
|
+
var _a2, _b2;
|
|
144
|
+
if (!((_a2 = ref.current) == null ? void 0 : _a2.open)) {
|
|
145
|
+
(_b2 = ref.current) == null ? void 0 : _b2.showModal();
|
|
146
|
+
}
|
|
147
|
+
}, 30);
|
|
148
|
+
useTimeoutEffect(() => {
|
|
149
|
+
setOpened(true);
|
|
150
|
+
}, 120);
|
|
141
151
|
return /* @__PURE__ */ jsx(
|
|
142
152
|
m.dialog,
|
|
143
153
|
{
|
|
144
154
|
ref,
|
|
145
155
|
className: dialog,
|
|
156
|
+
layout: true,
|
|
146
157
|
initial: {
|
|
147
158
|
"--backdrop-blur": "0px",
|
|
148
159
|
"--backdrop-opacity": "10%"
|
|
@@ -158,22 +169,18 @@ function ElementDetailsCard({
|
|
|
158
169
|
duration: 0.1
|
|
159
170
|
}
|
|
160
171
|
},
|
|
161
|
-
onAnimationStart: () => {
|
|
162
|
-
var _a2;
|
|
163
|
-
(_a2 = ref.current) == null ? void 0 : _a2.showModal();
|
|
164
|
-
},
|
|
165
172
|
onClick: (e) => {
|
|
166
|
-
var _a2, _b2;
|
|
173
|
+
var _a2, _b2, _c2;
|
|
167
174
|
if (((_b2 = (_a2 = e.target) == null ? void 0 : _a2.nodeName) == null ? void 0 : _b2.toUpperCase()) === "DIALOG") {
|
|
168
175
|
e.stopPropagation();
|
|
169
|
-
close();
|
|
176
|
+
(_c2 = ref.current) == null ? void 0 : _c2.close();
|
|
170
177
|
}
|
|
171
178
|
},
|
|
172
179
|
onClose: (e) => {
|
|
173
180
|
e.stopPropagation();
|
|
174
181
|
close();
|
|
175
182
|
},
|
|
176
|
-
children: /* @__PURE__ */
|
|
183
|
+
children: /* @__PURE__ */ jsxs(
|
|
177
184
|
Card,
|
|
178
185
|
{
|
|
179
186
|
drag: true,
|
|
@@ -347,7 +354,7 @@ function ElementDetailsCard({
|
|
|
347
354
|
enableRelationshipBrowser: false,
|
|
348
355
|
enableNavigateTo: false
|
|
349
356
|
},
|
|
350
|
-
children: !!nodeModel && activeTab === "Relationships" && /* @__PURE__ */ jsx(
|
|
357
|
+
children: opened && !!nodeModel && activeTab === "Relationships" && /* @__PURE__ */ jsx(
|
|
351
358
|
TabPanelRelationships,
|
|
352
359
|
{
|
|
353
360
|
element: elementModel,
|
|
@@ -399,7 +406,7 @@ function ElementDetailsCard({
|
|
|
399
406
|
)
|
|
400
407
|
]
|
|
401
408
|
}
|
|
402
|
-
)
|
|
409
|
+
)
|
|
403
410
|
}
|
|
404
411
|
);
|
|
405
412
|
}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTree, Alert, Tree, Box, rem, Button, Group, Text, ThemeIcon, Menu } from "@mantine/core";
|
|
3
3
|
import { IconInfoCircle, IconTarget, IconZoomScan } from "@tabler/icons-react";
|
|
4
4
|
import { memo, useMemo, useEffect } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { useDiagram } from "../../hooks/useDiagram.js";
|
|
6
6
|
import { useLikeC4Model } from "../../likec4model/useLikeC4Model.js";
|
|
7
7
|
import { treeNodeLabel, treeNode, nodeLabel, instanceLabel } from "./TabPanelDeployments.css.js";
|
|
8
8
|
import { stopPropagation } from "../../utils/xyflow.js";
|
|
@@ -18,7 +18,8 @@ const DeploymentNodeRenderer = ({
|
|
|
18
18
|
const DeployedInstanceRenderer = ({
|
|
19
19
|
instance
|
|
20
20
|
}) => {
|
|
21
|
-
const
|
|
21
|
+
const diagram = useDiagram();
|
|
22
|
+
const currentViewId = diagram.currentView().id;
|
|
22
23
|
const views = [...instance.views()];
|
|
23
24
|
return /* @__PURE__ */ jsxs(Group, { className: instanceLabel, gap: 4, children: [
|
|
24
25
|
/* @__PURE__ */ jsx(ThemeIcon, { color: "gray", variant: "transparent", size: "xs", flex: 0, children: /* @__PURE__ */ jsx(IconTarget, { stroke: 1.2 }) }),
|
|
@@ -56,6 +57,7 @@ const DeployedInstanceRenderer = ({
|
|
|
56
57
|
},
|
|
57
58
|
onClick: (e) => {
|
|
58
59
|
e.stopPropagation();
|
|
60
|
+
diagram.navigateTo(view.id);
|
|
59
61
|
},
|
|
60
62
|
children: view.title
|
|
61
63
|
},
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { HTMLMotionProps } from 'framer-motion';
|
|
2
|
-
import { PropsWithChildren
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
3
|
type OverlayProps = PropsWithChildren<HTMLMotionProps<'dialog'> & {
|
|
4
|
+
classes?: {
|
|
5
|
+
dialog?: string;
|
|
6
|
+
body?: string;
|
|
7
|
+
};
|
|
4
8
|
onClose: () => void;
|
|
5
9
|
onClick?: never;
|
|
6
10
|
}>;
|
|
7
|
-
export declare
|
|
11
|
+
export declare function Overlay({ children, onClose, className, classes, ...rest }: OverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
8
12
|
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { RemoveScroll, Box } from "@mantine/core";
|
|
3
|
-
import {
|
|
4
|
-
import { useSyncedRef, useDebouncedCallback } from "@react-hookz/web";
|
|
3
|
+
import { useSyncedRef, useDebouncedCallback, useTimeoutEffect } from "@react-hookz/web";
|
|
5
4
|
import clsx from "clsx";
|
|
6
5
|
import { m } from "framer-motion";
|
|
7
|
-
import {
|
|
6
|
+
import { useState, useRef } from "react";
|
|
8
7
|
import { body, dialog } from "./Overlay.css.js";
|
|
9
|
-
|
|
8
|
+
function Overlay({ children, onClose, className, classes, ...rest }) {
|
|
10
9
|
const [opened, setOpened] = useState(false);
|
|
11
10
|
const dialogRef = useRef(null);
|
|
12
11
|
const onCloseRef = useSyncedRef(onClose);
|
|
@@ -17,23 +16,18 @@ const Overlay = forwardRef(({ children, onClose, className, ...rest }, ref) => {
|
|
|
17
16
|
[],
|
|
18
17
|
50
|
|
19
18
|
);
|
|
20
|
-
|
|
21
|
-
var _a;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return () => {
|
|
28
|
-
var _a2;
|
|
29
|
-
(_a2 = dialogRef.current) == null ? void 0 : _a2.removeEventListener("cancel", cancel, { capture: true });
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
19
|
+
useTimeoutEffect(() => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
if (!((_a = dialogRef.current) == null ? void 0 : _a.open)) {
|
|
22
|
+
(_b = dialogRef.current) == null ? void 0 : _b.showModal();
|
|
23
|
+
}
|
|
24
|
+
setOpened(true);
|
|
25
|
+
}, 30);
|
|
32
26
|
return /* @__PURE__ */ jsx(
|
|
33
27
|
m.dialog,
|
|
34
28
|
{
|
|
35
|
-
ref:
|
|
36
|
-
className: clsx(dialog, className),
|
|
29
|
+
ref: dialogRef,
|
|
30
|
+
className: clsx(dialog, classes == null ? void 0 : classes.dialog, className),
|
|
37
31
|
initial: {
|
|
38
32
|
"--backdrop-blur": "0px",
|
|
39
33
|
"--backdrop-opacity": "5%",
|
|
@@ -50,13 +44,8 @@ const Overlay = forwardRef(({ children, onClose, className, ...rest }, ref) => {
|
|
|
50
44
|
// delay: 0.25,
|
|
51
45
|
// }
|
|
52
46
|
},
|
|
53
|
-
onAnimationStart: () => {
|
|
54
|
-
var _a;
|
|
55
|
-
(_a = dialogRef.current) == null ? void 0 : _a.showModal();
|
|
56
|
-
setOpened(true);
|
|
57
|
-
},
|
|
58
47
|
exit: {
|
|
59
|
-
opacity: 0
|
|
48
|
+
opacity: 0,
|
|
60
49
|
translateY: -10,
|
|
61
50
|
"--backdrop-blur": "0px",
|
|
62
51
|
"--backdrop-opacity": "0%",
|
|
@@ -65,22 +54,22 @@ const Overlay = forwardRef(({ children, onClose, className, ...rest }, ref) => {
|
|
|
65
54
|
}
|
|
66
55
|
},
|
|
67
56
|
onClick: (e) => {
|
|
68
|
-
var _a, _b;
|
|
57
|
+
var _a, _b, _c;
|
|
69
58
|
if (((_b = (_a = e.target) == null ? void 0 : _a.nodeName) == null ? void 0 : _b.toUpperCase()) === "DIALOG") {
|
|
70
59
|
e.stopPropagation();
|
|
71
|
-
close();
|
|
60
|
+
(_c = dialogRef.current) == null ? void 0 : _c.close();
|
|
61
|
+
return;
|
|
72
62
|
}
|
|
73
63
|
},
|
|
74
64
|
onClose: (e) => {
|
|
75
|
-
e.preventDefault();
|
|
76
65
|
e.stopPropagation();
|
|
77
66
|
close();
|
|
78
67
|
},
|
|
79
68
|
...rest,
|
|
80
|
-
children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: true, children: /* @__PURE__ */ jsx(Box, { className: body, children: opened && /* @__PURE__ */ jsx(Fragment, { children }) }) })
|
|
69
|
+
children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: true, children: /* @__PURE__ */ jsx(Box, { className: clsx(body, classes == null ? void 0 : classes.body), children: opened && /* @__PURE__ */ jsx(Fragment, { children }) }) })
|
|
81
70
|
}
|
|
82
71
|
);
|
|
83
|
-
}
|
|
72
|
+
}
|
|
84
73
|
export {
|
|
85
74
|
Overlay
|
|
86
75
|
};
|
|
@@ -81,7 +81,7 @@ const SelectEdge = ({
|
|
|
81
81
|
]
|
|
82
82
|
}
|
|
83
83
|
) }),
|
|
84
|
-
/* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw:
|
|
84
|
+
/* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { className: scrollArea, scrollbars: "y", type: "never", viewportRef: viewport, children: /* @__PURE__ */ jsx(Box, { className: edgeGrid, p: "xs", maw: 400, children: edges.map((e) => /* @__PURE__ */ jsxs(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
87
|
className: edgeRow,
|
|
@@ -95,7 +95,6 @@ const SelectEdge = ({
|
|
|
95
95
|
Box,
|
|
96
96
|
{
|
|
97
97
|
className: edgeSource,
|
|
98
|
-
maw: 160,
|
|
99
98
|
mod: {
|
|
100
99
|
"edge-id": e.id,
|
|
101
100
|
"likec4-color": e.source.color
|
|
@@ -108,7 +107,6 @@ const SelectEdge = ({
|
|
|
108
107
|
Box,
|
|
109
108
|
{
|
|
110
109
|
className: edgeTarget,
|
|
111
|
-
maw: 160,
|
|
112
110
|
mod: {
|
|
113
111
|
"likec4-color": e.target.color
|
|
114
112
|
},
|
|
@@ -5,8 +5,8 @@ import { IconX, IconChevronLeft, IconChevronRight } from "@tabler/icons-react";
|
|
|
5
5
|
import { ReactFlowProvider, useStoreApi, Panel } from "@xyflow/react";
|
|
6
6
|
import clsx from "clsx";
|
|
7
7
|
import { shallowEqual } from "fast-equals";
|
|
8
|
-
import { AnimatePresence, m } from "framer-motion";
|
|
9
|
-
import { useRef, memo, useEffect } from "react";
|
|
8
|
+
import { AnimatePresence, LayoutGroup, m } from "framer-motion";
|
|
9
|
+
import { useId, useRef, memo, useEffect } from "react";
|
|
10
10
|
import { BaseXYFlow } from "../../base/BaseXYFlow.js";
|
|
11
11
|
import { useRelationshipsView } from "./-useRelationshipsView.js";
|
|
12
12
|
import { ViewPadding } from "./const.js";
|
|
@@ -15,6 +15,7 @@ import { nodeTypes } from "./custom/nodeTypes.js";
|
|
|
15
15
|
import { RelationshipsBrowserActorContext, useRelationshipsBrowser, useRelationshipsBrowserState } from "./hooks.js";
|
|
16
16
|
import { SelectElement } from "./SelectElement.js";
|
|
17
17
|
function RelationshipsBrowser({ actorRef }) {
|
|
18
|
+
const id = useId();
|
|
18
19
|
const initialRef = useRef(null);
|
|
19
20
|
if (initialRef.current == null) {
|
|
20
21
|
initialRef.current = {
|
|
@@ -22,7 +23,7 @@ function RelationshipsBrowser({ actorRef }) {
|
|
|
22
23
|
initialEdges: []
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
return /* @__PURE__ */ jsx(RelationshipsBrowserActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsx(ReactFlowProvider, { ...initialRef.current, children: /* @__PURE__ */ jsx(RelationshipsBrowserXYFlow, {}) }) });
|
|
26
|
+
return /* @__PURE__ */ jsx(RelationshipsBrowserActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsx(ReactFlowProvider, { ...initialRef.current, children: /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(LayoutGroup, { id, children: /* @__PURE__ */ jsx(RelationshipsBrowserXYFlow, {}) }) }) }) });
|
|
26
27
|
}
|
|
27
28
|
const selector = (state) => ({
|
|
28
29
|
initialized: state.context.initialized,
|
|
@@ -76,10 +77,10 @@ const RelationshipsBrowserXYFlow = memo(() => {
|
|
|
76
77
|
browser.send({ type: "xyflow.resized" });
|
|
77
78
|
}),
|
|
78
79
|
onNodesChange: useCallbackRef((changes) => {
|
|
79
|
-
browser.send({ type: "xyflow.
|
|
80
|
+
browser.send({ type: "xyflow.applyNodeChanges", changes });
|
|
80
81
|
}),
|
|
81
82
|
onEdgesChange: useCallbackRef((changes) => {
|
|
82
|
-
browser.send({ type: "xyflow.
|
|
83
|
+
browser.send({ type: "xyflow.applyEdgeChanges", changes });
|
|
83
84
|
}),
|
|
84
85
|
nodesDraggable: false,
|
|
85
86
|
fitView: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ancestorsFqn } from "@likec4/core";
|
|
3
|
-
import { useTree, useComputedColorScheme, Popover, PopoverTarget, Button, PopoverDropdown, ScrollAreaAutosize, Tree, Group, ActionIcon,
|
|
3
|
+
import { useTree, useComputedColorScheme, Box, Popover, PopoverTarget, Button, PopoverDropdown, ScrollAreaAutosize, Tree, Group, ActionIcon, Text } from "@mantine/core";
|
|
4
4
|
import { IconSelector, IconChevronRight } from "@tabler/icons-react";
|
|
5
5
|
import { useRef, useEffect } from "react";
|
|
6
6
|
import * as SelectElement_css from "./SelectElement.css.js";
|
|
@@ -27,12 +27,12 @@ const SelectElement = ({
|
|
|
27
27
|
tree.select(subjectId);
|
|
28
28
|
}, [subjectId]);
|
|
29
29
|
const theme = useComputedColorScheme();
|
|
30
|
-
return /* @__PURE__ */ jsxs(
|
|
30
|
+
return /* @__PURE__ */ jsx(Box, { pos: "relative", children: /* @__PURE__ */ jsxs(
|
|
31
31
|
Popover,
|
|
32
32
|
{
|
|
33
|
-
position: "bottom",
|
|
33
|
+
position: "bottom-start",
|
|
34
34
|
shadow: "md",
|
|
35
|
-
keepMounted:
|
|
35
|
+
keepMounted: false,
|
|
36
36
|
withinPortal: false,
|
|
37
37
|
closeOnClickOutside: true,
|
|
38
38
|
clickOutsideEvents: ["pointerdown", "mousedown", "click"],
|
|
@@ -67,6 +67,10 @@ const SelectElement = ({
|
|
|
67
67
|
classNames: SelectElement_css,
|
|
68
68
|
levelOffset: 8,
|
|
69
69
|
styles: {
|
|
70
|
+
root: {
|
|
71
|
+
maxWidth: 400,
|
|
72
|
+
overflow: "hidden"
|
|
73
|
+
},
|
|
70
74
|
label: {
|
|
71
75
|
paddingTop: 5,
|
|
72
76
|
paddingBottom: 6
|
|
@@ -122,7 +126,7 @@ const SelectElement = ({
|
|
|
122
126
|
) }) })
|
|
123
127
|
]
|
|
124
128
|
}
|
|
125
|
-
);
|
|
129
|
+
) });
|
|
126
130
|
};
|
|
127
131
|
export {
|
|
128
132
|
SelectElement
|
|
@@ -33,10 +33,10 @@ export type Events = {
|
|
|
33
33
|
type: 'xyflow.edgeClick';
|
|
34
34
|
edge: RelationshipsBrowserTypes.Edge;
|
|
35
35
|
} | {
|
|
36
|
-
type: 'xyflow.
|
|
36
|
+
type: 'xyflow.applyNodeChanges';
|
|
37
37
|
changes: NodeChange<RelationshipsBrowserTypes.Node>[];
|
|
38
38
|
} | {
|
|
39
|
-
type: 'xyflow.
|
|
39
|
+
type: 'xyflow.applyEdgeChanges';
|
|
40
40
|
changes: EdgeChange<RelationshipsBrowserTypes.Edge>[];
|
|
41
41
|
} | {
|
|
42
42
|
type: 'xyflow.paneClick';
|
|
@@ -99,7 +99,7 @@ const relationshipsBrowserActor = setup({
|
|
|
99
99
|
const currentSubjectNode = findRootSubject(currentNodes);
|
|
100
100
|
const existingNode = navigateFromNode ? currentNodes.find((n) => n.id === navigateFromNode) : currentNodes.find((n) => n.type !== "empty" && n.data.column !== "subjects" && n.data.fqn === subjectId);
|
|
101
101
|
if (!nextSubjectNode || !existingNode || nextSubjectNode.type === "empty" || !currentSubjectNode || nextSubjectNode.data.fqn === currentSubjectNode.data.fqn) {
|
|
102
|
-
xyflow.setViewport(nextviewport);
|
|
102
|
+
await xyflow.setViewport(nextviewport);
|
|
103
103
|
return updateXYData();
|
|
104
104
|
}
|
|
105
105
|
const nextSubjectCenter = {
|
|
@@ -168,7 +168,7 @@ const relationshipsBrowserActor = setup({
|
|
|
168
168
|
return updateXYData();
|
|
169
169
|
}
|
|
170
170
|
await xyflow.setCenter(currentSubjectCenter.x, currentSubjectCenter.y, { zoom, duration: 350 });
|
|
171
|
-
xyflow.setCenter(nextSubjectCenter.x, nextSubjectCenter.y, { zoom });
|
|
171
|
+
await xyflow.setCenter(nextSubjectCenter.x, nextSubjectCenter.y, { zoom });
|
|
172
172
|
return updateXYData();
|
|
173
173
|
})
|
|
174
174
|
}
|
|
@@ -260,11 +260,11 @@ const relationshipsBrowserActor = setup({
|
|
|
260
260
|
xyedges: ({ event }) => event.xyedges
|
|
261
261
|
})
|
|
262
262
|
},
|
|
263
|
-
"xyflow.
|
|
264
|
-
// actions: log('layouting: ignore xyflow.
|
|
263
|
+
"xyflow.applyEdgeChanges": {
|
|
264
|
+
// actions: log('layouting: ignore xyflow.applyEdgeChanges'),
|
|
265
265
|
},
|
|
266
|
-
"xyflow.
|
|
267
|
-
// actions: log('layouting: ignore xyflow.
|
|
266
|
+
"xyflow.applyNodeChanges": {
|
|
267
|
+
// actions: log('layouting: ignore xyflow.applyNodeChanges'),
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
}
|
|
@@ -335,14 +335,14 @@ const relationshipsBrowserActor = setup({
|
|
|
335
335
|
}
|
|
336
336
|
},
|
|
337
337
|
on: {
|
|
338
|
-
"xyflow.
|
|
338
|
+
"xyflow.applyNodeChanges": {
|
|
339
339
|
actions: assign({
|
|
340
340
|
xynodes: ({ context, event }) => {
|
|
341
341
|
return applyNodeChanges(event.changes, context.xynodes);
|
|
342
342
|
}
|
|
343
343
|
})
|
|
344
344
|
},
|
|
345
|
-
"xyflow.
|
|
345
|
+
"xyflow.applyEdgeChanges": {
|
|
346
346
|
actions: assign({
|
|
347
347
|
xyedges: ({ context, event }) => {
|
|
348
348
|
return applyEdgeChanges(event.changes, context.xyedges);
|
|
@@ -17,13 +17,13 @@ const nodeTypes = {
|
|
|
17
17
|
/* @__PURE__ */ jsx(ElementTitle, { ...props, iconSize: 40 }),
|
|
18
18
|
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
19
19
|
/* @__PURE__ */ jsx(ElementPorts, { ...props })
|
|
20
|
-
] });
|
|
20
|
+
] }, props.id);
|
|
21
21
|
}),
|
|
22
22
|
compound: customNode((props) => {
|
|
23
23
|
return /* @__PURE__ */ jsxs(CompoundNodeContainer, { component: m.div, layoutId: props.id, nodeProps: props, children: [
|
|
24
24
|
/* @__PURE__ */ jsx(CompoundTitle, { ...props }),
|
|
25
25
|
/* @__PURE__ */ jsx(CompoundPorts, { ...props })
|
|
26
|
-
] });
|
|
26
|
+
] }, props.id);
|
|
27
27
|
}),
|
|
28
28
|
empty: customNode((props) => {
|
|
29
29
|
return /* @__PURE__ */ jsx(EmptyNode, { ...props });
|