@likec4/diagram 1.27.3 → 1.28.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/bundle/index.js +974 -1036
- package/dist/LikeC4CustomColors.js +2 -2
- package/dist/LikeC4Diagram.js +2 -2
- package/dist/LikeC4ModelProvider.js +1 -1
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +3 -0
- package/dist/_virtual/react.production.js +3 -0
- package/dist/base/BaseXYFlow.js +5 -5
- package/dist/base/primitives/compound/CompoundActionButton.js +1 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundNodeContainer.js +2 -2
- package/dist/base/primitives/customEdge.js +2 -2
- package/dist/base/primitives/customNode.js +2 -2
- package/dist/base/primitives/edge/EdgeActionButton.d.ts +1 -2
- package/dist/base/primitives/edge/EdgeContainer.js +1 -1
- package/dist/base/primitives/edge/EdgeLabel.js +1 -1
- package/dist/base/primitives/edge/EdgeLabelContainer.js +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +10 -42
- package/dist/base/primitives/edge/EdgePath.js +23 -16
- package/dist/base/primitives/edge/edge.css.js +1 -1
- package/dist/base/primitives/element/ElementActionButtons.d.ts +1 -1
- package/dist/base/primitives/element/ElementActionButtons.js +6 -5
- package/dist/base/primitives/element/ElementDetailsButton.js +5 -2
- package/dist/base/primitives/element/ElementNodeContainer.js +3 -3
- package/dist/base/updateEdges.js +7 -2
- package/dist/base/updateNodes.js +11 -3
- package/dist/bundle/LikeC4View.js +3 -3
- package/dist/bundle/ReactLikeC4.js +1 -1
- package/dist/bundle/ShadowRoot.js +3 -3
- package/dist/bundle/styles.css.js +4 -4
- package/dist/context/ControlsCustomLayout.js +1 -1
- package/dist/context/DiagramEventHandlers.js +5 -5
- package/dist/context/DiagramFeatures.js +7 -7
- package/dist/context/EnsureMantine.js +2 -2
- package/dist/context/FramerMotionConfig.js +2 -2
- package/dist/context/IconRenderer.js +4 -4
- package/dist/context/ReduceGraphics.js +2 -2
- package/dist/context/RootContainer.js +5 -9
- package/dist/hooks/safeContext.js +3 -3
- package/dist/hooks/useCurrentViewId.js +1 -1
- package/dist/hooks/useDiagram.d.ts +3 -7
- package/dist/hooks/useDiagram.js +2 -2
- package/dist/hooks/useMantinePortalProps.js +2 -2
- package/dist/hooks/useSetState.js +3 -3
- package/dist/hooks/useUpdateEffect.js +1 -1
- package/dist/likec4diagram/DiagramUI.js +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +2 -2
- package/dist/likec4diagram/custom/edges/NotePopover.js +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +17 -7
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +6 -6
- package/dist/likec4diagram/custom/nodes/toolbar/ColorButton.js +2 -2
- package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -3
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.js +2 -2
- package/dist/likec4diagram/ui/controls/ChangeAutoLayoutButton.js +4 -4
- package/dist/likec4diagram/ui/controls/Controls.js +6 -6
- package/dist/likec4diagram/ui/controls/NavigationButtons.js +1 -1
- package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +1 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +4 -5
- package/dist/likec4diagram/ui/search/ElementsColumn.js +88 -77
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +2 -1
- package/dist/likec4diagram/ui/search/LikeC4Search.js +27 -24
- package/dist/likec4diagram/ui/search/SearchInput.js +1 -1
- package/dist/likec4diagram/ui/search/ViewsColum.js +3 -2
- package/dist/likec4diagram/ui/search/state.js +11 -9
- package/dist/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.js +1 -1
- package/dist/likec4diagram/useLayoutConstraints.js +3 -3
- package/dist/likec4model/LikeC4ModelContext.js +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.js +2 -2
- package/dist/likec4model/useLikeC4Model.js +2 -2
- package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react.production.js +548 -0
- package/dist/node_modules/.pnpm/react@19.0.0/node_modules/react/index.js +15 -0
- package/dist/overlays/Overlays.js +8 -8
- package/dist/overlays/element-details/ElementDetailsCard.js +5 -5
- package/dist/overlays/element-details/TabPanelDeployments.js +7 -4
- package/dist/overlays/element-details/TabPanelRelationships.js +2 -2
- package/dist/overlays/element-details/TabPanelStructure.js +6 -3
- package/dist/overlays/element-details/actor.d.ts +301 -301
- package/dist/overlays/element-details/actorContext.js +3 -3
- package/dist/overlays/overlay/Overlay.css.d.ts +2 -25
- package/dist/overlays/overlay/Overlay.css.js +0 -40
- package/dist/overlays/overlay/Overlay.d.ts +1 -1
- package/dist/overlays/overlay/Overlay.js +99 -89
- package/dist/overlays/overlaysActor.js +4 -1
- package/dist/overlays/relationship-details/RelationshipDetails.js +28 -23
- package/dist/overlays/relationship-details/SelectEdge.js +3 -6
- package/dist/overlays/relationship-details/actor.d.ts +2 -0
- package/dist/overlays/relationship-details/custom/edgeTypes.js +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationship-details/hooks.d.ts +3 -1
- package/dist/overlays/relationship-details/hooks.js +4 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.js +9 -11
- package/dist/overlays/relationships-browser/SelectElement.js +8 -5
- package/dist/overlays/relationships-browser/actor.d.ts +1 -1
- package/dist/overlays/relationships-browser/actor.js +6 -12
- package/dist/overlays/relationships-browser/const.d.ts +2 -1
- package/dist/overlays/relationships-browser/const.js +6 -1
- package/dist/overlays/relationships-browser/custom/edgeTypes.js +3 -4
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +2 -2
- package/dist/overlays/relationships-browser/hooks.d.ts +1 -1
- package/dist/overlays/relationships-browser/hooks.js +4 -4
- package/dist/overlays/relationships-browser/layout.js +2 -2
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +1 -2
- package/dist/state/DiagramActorProvider.js +5 -3
- package/dist/state/diagram-machine.d.ts +2 -2
- package/dist/state/diagram-machine.js +3 -4
- package/dist/state/hotkeyActor.js +12 -3
- package/dist/styles.css.js +1 -1
- package/package.json +21 -17
- package/src/base/BaseXYFlow.tsx +2 -2
- package/src/base/primitives/compound/CompoundActionButton.tsx +1 -1
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +1 -1
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -3
- package/src/base/primitives/compound/CompoundNodeContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgeActionButton.tsx +1 -2
- package/src/base/primitives/edge/EdgePath.tsx +22 -14
- package/src/base/primitives/edge/edge.css.ts +1 -1
- package/src/base/primitives/element/ElementActionButtons.tsx +7 -5
- package/src/base/primitives/element/ElementDetailsButton.tsx +5 -1
- package/src/base/primitives/element/ElementNodeContainer.css.ts +0 -18
- package/src/base/primitives/element/ElementNodeContainer.tsx +1 -1
- package/src/base/updateEdges.ts +6 -9
- package/src/base/updateNodes.ts +10 -14
- package/src/bundle/styles.css.ts +7 -2
- package/src/components/SearchControl.css.ts +4 -8
- package/src/context/FramerMotionConfig.tsx +1 -1
- package/src/context/RootContainer.tsx +0 -4
- package/src/hooks/useDiagram.ts +1 -1
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +8 -2
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +1 -1
- package/src/likec4diagram/custom/edges/edges.css.ts +0 -2
- package/src/likec4diagram/ui/controls/Controls.tsx +53 -55
- package/src/likec4diagram/ui/controls/NavigationButtons.tsx +1 -1
- package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +1 -1
- package/src/likec4diagram/ui/notation/NotationPanel.css.ts +0 -4
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +1 -2
- package/src/likec4diagram/ui/search/ElementsColumn.tsx +94 -71
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +48 -55
- package/src/likec4diagram/ui/search/ViewsColum.tsx +2 -2
- package/src/likec4diagram/ui/search/ViewsColumn.css.ts +0 -4
- package/src/likec4diagram/ui/search/state.ts +8 -6
- package/src/likec4diagram/ui/walkthrough/DynamicViewWalkthrough.tsx +1 -1
- package/src/overlays/Overlays.tsx +4 -4
- package/src/overlays/element-details/ElementDetailsCard.tsx +1 -1
- package/src/overlays/element-details/TabPanelDeployments.tsx +2 -0
- package/src/overlays/element-details/TabPanelStructure.tsx +2 -1
- package/src/overlays/overlay/Overlay.css.ts +0 -40
- package/src/overlays/overlay/Overlay.tsx +109 -99
- package/src/overlays/overlaysActor.ts +5 -1
- package/src/overlays/relationship-details/RelationshipDetails.tsx +25 -16
- package/src/overlays/relationship-details/SelectEdge.tsx +0 -14
- package/src/overlays/relationship-details/actor.ts +2 -1
- package/src/overlays/relationship-details/custom/edgeTypes.tsx +1 -1
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +1 -1
- package/src/overlays/relationships-browser/RelationshipsBrowser.tsx +1 -3
- package/src/overlays/relationships-browser/SelectElement.tsx +2 -0
- package/src/overlays/relationships-browser/actor.ts +8 -13
- package/src/overlays/relationships-browser/const.ts +8 -1
- package/src/overlays/relationships-browser/custom/edgeTypes.tsx +2 -3
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +2 -2
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +1 -2
- package/src/state/DiagramActorProvider.tsx +4 -1
- package/src/state/diagram-machine.ts +2 -3
- package/src/state/hotkeyActor.ts +13 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as reactExports } from '../../_virtual/index.js';
|
|
2
2
|
|
|
3
|
-
const ElementDetailsActorContext = createContext(null);
|
|
3
|
+
const ElementDetailsActorContext = reactExports.createContext(null);
|
|
4
4
|
ElementDetailsActorContext.displayName = "ElementDetailsActorContext";
|
|
5
5
|
const useElementDetailsActorRef = () => {
|
|
6
|
-
const ctx = useContext(ElementDetailsActorContext);
|
|
6
|
+
const ctx = reactExports.useContext(ElementDetailsActorContext);
|
|
7
7
|
if (ctx === null) {
|
|
8
8
|
throw new Error("ElementDetailsActorRef is not provided");
|
|
9
9
|
}
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
import { SlotRecipeRuntimeFn } from '@likec4/styles/types';
|
|
1
|
+
import { SlotRecipeRuntimeFn, SlotRecipeVariantRecord } from '@likec4/styles/types';
|
|
2
2
|
export declare const backdropBlur = "--_blur";
|
|
3
3
|
export declare const backdropOpacity = "--_opacity";
|
|
4
4
|
export declare const level = "--_level";
|
|
5
|
-
export declare const overlay: SlotRecipeRuntimeFn<"body" | "dialog",
|
|
6
|
-
level: {
|
|
7
|
-
0: {
|
|
8
|
-
dialog: {
|
|
9
|
-
"--_level": "0";
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
1: {
|
|
13
|
-
dialog: {
|
|
14
|
-
"--_level": "1";
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
2: {
|
|
18
|
-
dialog: {
|
|
19
|
-
"--_level": "2";
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
3: {
|
|
23
|
-
dialog: {
|
|
24
|
-
"--_level": "3";
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
}>;
|
|
5
|
+
export declare const overlay: SlotRecipeRuntimeFn<"body" | "dialog", SlotRecipeVariantRecord<"body" | "dialog">>;
|
|
@@ -59,22 +59,6 @@ const dialog = css.raw({
|
|
|
59
59
|
xl: {
|
|
60
60
|
[offset]: "4rem"
|
|
61
61
|
}
|
|
62
|
-
// inset: '[calc(2rem + var(--_level, 0) * 1rem), 2rem, 2rem, 2rem]',
|
|
63
|
-
// width: 'calc(100vw - 4rem)',
|
|
64
|
-
// height: 'calc(100vh - 4rem - var(--_level, 0) * 1rem)',
|
|
65
|
-
// },
|
|
66
|
-
// lg: {
|
|
67
|
-
// inset: '[calc(4rem + var(--_level, 0) * 1rem), 4rem, 4rem, 4rem]',
|
|
68
|
-
// width: 'calc(100vw - 8rem)',
|
|
69
|
-
// height: 'calc(100vh - 8rem)',
|
|
70
|
-
// },
|
|
71
|
-
// xl: {
|
|
72
|
-
// [borderRadius]: '8px',
|
|
73
|
-
// padding: '8px',
|
|
74
|
-
// inset: '[calc(5rem + var(--_level, 0) * 1rem), 5rem, 5rem, 5rem]',
|
|
75
|
-
// width: 'calc(100vw - 10rem)',
|
|
76
|
-
// height: 'calc(100vh - 10rem - var(--_level, 0) * 1rem)',
|
|
77
|
-
// },
|
|
78
62
|
});
|
|
79
63
|
const body = css.raw({
|
|
80
64
|
position: "relative",
|
|
@@ -94,30 +78,6 @@ const overlay = sva({
|
|
|
94
78
|
base: {
|
|
95
79
|
dialog,
|
|
96
80
|
body
|
|
97
|
-
},
|
|
98
|
-
variants: {
|
|
99
|
-
level: {
|
|
100
|
-
0: {
|
|
101
|
-
dialog: {
|
|
102
|
-
[level]: "0"
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
1: {
|
|
106
|
-
dialog: {
|
|
107
|
-
[level]: "1"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
2: {
|
|
111
|
-
dialog: {
|
|
112
|
-
[level]: "2"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
3: {
|
|
116
|
-
dialog: {
|
|
117
|
-
[level]: "3"
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
81
|
}
|
|
122
82
|
});
|
|
123
83
|
|
|
@@ -3,101 +3,111 @@ import { cx } from '@likec4/styles/css';
|
|
|
3
3
|
import { RemoveScroll, Box } from '@mantine/core';
|
|
4
4
|
import { useMergedRef } from '@mantine/hooks';
|
|
5
5
|
import { useSyncedRef, useDebouncedCallback, useTimeoutEffect } from '@react-hookz/web';
|
|
6
|
-
import { useReducedMotionConfig, m } from '
|
|
7
|
-
import {
|
|
8
|
-
import { overlay, backdropOpacity, backdropBlur } from './Overlay.css.js';
|
|
6
|
+
import { useReducedMotionConfig, m } from 'motion/react';
|
|
7
|
+
import { r as reactExports } from '../../_virtual/index.js';
|
|
8
|
+
import { overlay, backdropOpacity, backdropBlur, level } from './Overlay.css.js';
|
|
9
9
|
import { stopPropagation } from '../../utils/xyflow.js';
|
|
10
10
|
|
|
11
|
-
const Overlay = forwardRef(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
const Overlay = reactExports.forwardRef(({
|
|
12
|
+
onClose,
|
|
13
|
+
className,
|
|
14
|
+
classes,
|
|
15
|
+
overlayLevel = 0,
|
|
16
|
+
children,
|
|
17
|
+
...rest
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const [opened, setOpened] = reactExports.useState(false);
|
|
20
|
+
const dialogRef = reactExports.useRef(null);
|
|
21
|
+
const isClosingRef = reactExports.useRef(false);
|
|
22
|
+
const motionNotReduced = useReducedMotionConfig() !== true;
|
|
23
|
+
const onCloseRef = useSyncedRef(onClose);
|
|
24
|
+
const close = useDebouncedCallback(
|
|
25
|
+
() => {
|
|
26
|
+
if (isClosingRef.current) return;
|
|
27
|
+
isClosingRef.current = true;
|
|
28
|
+
onCloseRef.current();
|
|
29
|
+
},
|
|
30
|
+
[],
|
|
31
|
+
50
|
|
32
|
+
);
|
|
33
|
+
reactExports.useEffect(() => {
|
|
34
|
+
const cancel = (e) => {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
close();
|
|
38
|
+
};
|
|
39
|
+
dialogRef.current?.addEventListener("cancel", cancel, { capture: true });
|
|
40
|
+
return () => {
|
|
41
|
+
dialogRef.current?.removeEventListener("cancel", cancel, { capture: true });
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
useTimeoutEffect(() => {
|
|
45
|
+
if (!dialogRef.current?.open) {
|
|
46
|
+
dialogRef.current?.showModal();
|
|
47
|
+
}
|
|
48
|
+
}, 30);
|
|
49
|
+
useTimeoutEffect(() => {
|
|
50
|
+
setOpened(true);
|
|
51
|
+
}, 120);
|
|
52
|
+
const styles = overlay({
|
|
53
|
+
level: overlayLevel
|
|
54
|
+
});
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
m.dialog,
|
|
57
|
+
{
|
|
58
|
+
ref: useMergedRef(dialogRef, ref),
|
|
59
|
+
className: cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes?.dialog, className),
|
|
60
|
+
layout: true,
|
|
61
|
+
style: {
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
[level]: overlayLevel
|
|
23
64
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
close();
|
|
31
|
-
};
|
|
32
|
-
dialogRef.current?.addEventListener("cancel", cancel, { capture: true });
|
|
33
|
-
return () => {
|
|
34
|
-
dialogRef.current?.removeEventListener("cancel", cancel, { capture: true });
|
|
35
|
-
};
|
|
36
|
-
}, []);
|
|
37
|
-
useTimeoutEffect(() => {
|
|
38
|
-
if (!dialogRef.current?.open) {
|
|
39
|
-
dialogRef.current?.showModal();
|
|
40
|
-
}
|
|
41
|
-
}, 20);
|
|
42
|
-
useTimeoutEffect(() => {
|
|
43
|
-
setOpened(true);
|
|
44
|
-
}, 120);
|
|
45
|
-
const styles = overlay({
|
|
46
|
-
level: overlayLevel
|
|
47
|
-
});
|
|
48
|
-
return /* @__PURE__ */ jsx(
|
|
49
|
-
m.dialog,
|
|
50
|
-
{
|
|
51
|
-
ref: useMergedRef(dialogRef, ref),
|
|
52
|
-
className: cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes?.dialog, className),
|
|
53
|
-
layout: true,
|
|
54
|
-
...motionNotReduced ? {
|
|
55
|
-
initial: {
|
|
56
|
-
[backdropBlur]: "0px",
|
|
57
|
-
[backdropOpacity]: "0%",
|
|
58
|
-
scale: overlayLevel > 0 ? 0.9 : 1.075,
|
|
59
|
-
opacity: 0
|
|
60
|
-
},
|
|
61
|
-
animate: {
|
|
62
|
-
[backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
|
|
63
|
-
[backdropOpacity]: overlayLevel > 0 ? "50%" : "60%",
|
|
64
|
-
scale: 1,
|
|
65
|
-
opacity: 1,
|
|
66
|
-
transition: {
|
|
67
|
-
delay: 0.075
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
exit: {
|
|
71
|
-
scale: 1.2,
|
|
72
|
-
opacity: 0,
|
|
73
|
-
[backdropBlur]: "0px",
|
|
74
|
-
[backdropOpacity]: "0%"
|
|
75
|
-
}
|
|
76
|
-
} : {
|
|
77
|
-
initial: {
|
|
78
|
-
[backdropBlur]: "8px",
|
|
79
|
-
[backdropOpacity]: "60%"
|
|
80
|
-
}
|
|
65
|
+
...motionNotReduced ? {
|
|
66
|
+
initial: {
|
|
67
|
+
[backdropBlur]: "0px",
|
|
68
|
+
[backdropOpacity]: "0%",
|
|
69
|
+
scale: overlayLevel > 0 ? 0.9 : 1.075,
|
|
70
|
+
opacity: 0
|
|
81
71
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
animate: {
|
|
73
|
+
[backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
|
|
74
|
+
[backdropOpacity]: overlayLevel > 0 ? "50%" : "60%",
|
|
75
|
+
scale: 1,
|
|
76
|
+
opacity: 1,
|
|
77
|
+
transition: {
|
|
78
|
+
delay: 0.075
|
|
87
79
|
}
|
|
88
80
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
exit: {
|
|
82
|
+
scale: 1.2,
|
|
83
|
+
opacity: 0,
|
|
84
|
+
[backdropBlur]: "0px",
|
|
85
|
+
[backdropOpacity]: "0%"
|
|
86
|
+
}
|
|
87
|
+
} : {
|
|
88
|
+
initial: {
|
|
89
|
+
[backdropBlur]: "8px",
|
|
90
|
+
[backdropOpacity]: "60%"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
onClick: (e) => {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
if (e.target?.nodeName?.toUpperCase() === "DIALOG") {
|
|
96
|
+
dialogRef.current?.close();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onDoubleClick: stopPropagation,
|
|
101
|
+
onPointerDown: stopPropagation,
|
|
102
|
+
onClose: (e) => {
|
|
103
|
+
e.stopPropagation();
|
|
104
|
+
close();
|
|
105
|
+
},
|
|
106
|
+
...rest,
|
|
107
|
+
children: /* @__PURE__ */ jsx(RemoveScroll, { forwardProps: true, removeScrollBar: false, children: /* @__PURE__ */ jsx(Box, { className: cx(styles.body, "overlay-body", classes?.body), children: opened && /* @__PURE__ */ jsx(Fragment, { children }) }) })
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
});
|
|
101
111
|
Overlay.displayName = "Overlay";
|
|
102
112
|
|
|
103
113
|
export { Overlay };
|
|
@@ -7,7 +7,10 @@ import { relationshipsBrowserLogic } from './relationships-browser/actor.js';
|
|
|
7
7
|
|
|
8
8
|
const hotkeyLogic = fromCallback(({ sendBack }) => {
|
|
9
9
|
const handler = getHotkeyHandler([
|
|
10
|
-
["Escape", () =>
|
|
10
|
+
["Escape", (event) => {
|
|
11
|
+
event.stopPropagation();
|
|
12
|
+
sendBack({ type: "close" });
|
|
13
|
+
}, {
|
|
11
14
|
preventDefault: true
|
|
12
15
|
}]
|
|
13
16
|
]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { invariant, nonNullable,
|
|
2
|
+
import { invariant, nonNullable, isAncestor } from '@likec4/core';
|
|
3
3
|
import { ActionIcon, Group } from '@mantine/core';
|
|
4
4
|
import { useCallbackRef, useStateHistory } from '@mantine/hooks';
|
|
5
5
|
import { IconX, IconChevronLeft, IconChevronRight } from '@tabler/icons-react';
|
|
@@ -7,9 +7,9 @@ import { useSelector } from '@xstate/react';
|
|
|
7
7
|
import { ReactFlowProvider, Panel, useStoreApi, useReactFlow } from '@xyflow/react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import { deepEqual } from 'fast-equals';
|
|
10
|
-
import { LayoutGroup, AnimatePresence, m } from '
|
|
11
|
-
import {
|
|
12
|
-
import 'remeda';
|
|
10
|
+
import { LayoutGroup, AnimatePresence, m } from 'motion/react';
|
|
11
|
+
import { r as reactExports } from '../../_virtual/index.js';
|
|
12
|
+
import { isTruthy, find } from 'remeda';
|
|
13
13
|
import { BaseXYFlow } from '../../base/BaseXYFlow.js';
|
|
14
14
|
import { useLikeC4Model } from '../../likec4model/useLikeC4Model.js';
|
|
15
15
|
import { computeEdgeDetailsViewData, computeRelationshipDetailsViewData } from './compute.js';
|
|
@@ -27,38 +27,40 @@ const edgeTypes = {
|
|
|
27
27
|
relationship: RelationshipEdge
|
|
28
28
|
};
|
|
29
29
|
function RelationshipDetails({ actorRef }) {
|
|
30
|
-
const initialRef = useRef(null);
|
|
30
|
+
const initialRef = reactExports.useRef(null);
|
|
31
31
|
if (initialRef.current == null) {
|
|
32
32
|
initialRef.current = {
|
|
33
33
|
defaultNodes: [],
|
|
34
34
|
defaultEdges: []
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
return /* @__PURE__ */ jsx(RelationshipDetailsActorContext.Provider, { value: actorRef, children: /* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
39
|
-
/* @__PURE__ */ jsx(SyncRelationshipDetailsXYFlow, {})
|
|
40
|
-
] }) });
|
|
37
|
+
return /* @__PURE__ */ jsx(RelationshipDetailsActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsx(ReactFlowProvider, { ...initialRef.current, children: /* @__PURE__ */ jsx(LayoutGroup, { id: actorRef.sessionId, inherit: false, children: /* @__PURE__ */ jsxs(AnimatePresence, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(RelationshipDetailsInner, {}, "xyflow"),
|
|
39
|
+
/* @__PURE__ */ jsx(SyncRelationshipDetailsXYFlow, {}, "sync")
|
|
40
|
+
] }) }) }) });
|
|
41
41
|
}
|
|
42
42
|
const selectSubject = (state) => ({
|
|
43
43
|
...state.context.subject,
|
|
44
44
|
viewId: state.context.viewId
|
|
45
45
|
});
|
|
46
|
-
|
|
46
|
+
const SyncRelationshipDetailsXYFlow = reactExports.memo(() => {
|
|
47
47
|
const actor = useRelationshipDetailsActor();
|
|
48
48
|
const subject = useSelector(actor, selectSubject, deepEqual);
|
|
49
49
|
const likec4model = useLikeC4Model(true);
|
|
50
50
|
const view = likec4model.findView(subject.viewId) ?? null;
|
|
51
|
-
const data = useMemo(() => {
|
|
51
|
+
const data = reactExports.useMemo(() => {
|
|
52
52
|
let data2;
|
|
53
|
-
if ("edgeId" in subject) {
|
|
53
|
+
if ("edgeId" in subject && isTruthy(subject.edgeId)) {
|
|
54
54
|
invariant(view, `view ${subject.viewId} not found`);
|
|
55
55
|
const edge = nonNullable(view.findEdge(subject.edgeId), `edge ${subject.edgeId} not found in ${subject.viewId}`);
|
|
56
56
|
data2 = computeEdgeDetailsViewData([edge.id], view);
|
|
57
|
-
} else {
|
|
57
|
+
} else if (!!subject.source && !!subject.target) {
|
|
58
58
|
data2 = computeRelationshipDetailsViewData({
|
|
59
59
|
source: likec4model.element(subject.source),
|
|
60
60
|
target: likec4model.element(subject.target)
|
|
61
61
|
});
|
|
62
|
+
} else {
|
|
63
|
+
return null;
|
|
62
64
|
}
|
|
63
65
|
return layoutRelationshipDetails(data2, view);
|
|
64
66
|
}, [
|
|
@@ -68,16 +70,18 @@ function SyncRelationshipDetailsXYFlow() {
|
|
|
68
70
|
]);
|
|
69
71
|
const store = useStoreApi();
|
|
70
72
|
const instance = useReactFlow();
|
|
71
|
-
useEffect(() => {
|
|
73
|
+
reactExports.useEffect(() => {
|
|
72
74
|
if (instance.viewportInitialized) {
|
|
73
75
|
actor.send({ type: "xyflow.init", instance, store });
|
|
74
76
|
}
|
|
75
77
|
}, [store, instance.viewportInitialized, actor]);
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
|
|
78
|
+
reactExports.useEffect(() => {
|
|
79
|
+
if (data !== null) {
|
|
80
|
+
actor.send({ type: "update.layoutData", data });
|
|
81
|
+
}
|
|
78
82
|
}, [data, actor]);
|
|
79
83
|
return null;
|
|
80
|
-
}
|
|
84
|
+
});
|
|
81
85
|
const selector = ({ context }) => ({
|
|
82
86
|
// subject: context.subject,
|
|
83
87
|
// view: state.context.view,
|
|
@@ -85,7 +89,7 @@ const selector = ({ context }) => ({
|
|
|
85
89
|
nodes: context.xynodes,
|
|
86
90
|
edges: context.xyedges
|
|
87
91
|
});
|
|
88
|
-
const RelationshipDetailsInner = memo(() => {
|
|
92
|
+
const RelationshipDetailsInner = reactExports.memo(() => {
|
|
89
93
|
const browser = useRelationshipDetails();
|
|
90
94
|
const {
|
|
91
95
|
initialized,
|
|
@@ -164,15 +168,16 @@ const topLeftPanelselector = ({ context }) => ({
|
|
|
164
168
|
subject: context.subject,
|
|
165
169
|
viewId: context.viewId
|
|
166
170
|
});
|
|
167
|
-
const TopLeftPanel = memo(() => {
|
|
171
|
+
const TopLeftPanel = reactExports.memo(() => {
|
|
168
172
|
const { subject, viewId } = useRelationshipDetailsState(topLeftPanelselector, deepEqual);
|
|
169
173
|
const likec4model = useLikeC4Model(true);
|
|
170
174
|
const view = likec4model.findView(viewId);
|
|
171
175
|
if (!view || !view.isDiagram()) {
|
|
172
176
|
return null;
|
|
173
177
|
}
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
const edges = [...view.edges()];
|
|
179
|
+
let edge = "edgeId" in subject && isTruthy(subject.edgeId) ? edges.find((e) => e.id === subject.edgeId) : find(edges, (e) => e.source.element?.id === subject.source && e.target.element?.id === subject.target) || find(edges, (e) => {
|
|
180
|
+
return (e.source.element?.id === subject.source || isAncestor(e.source.element?.id ?? "--", subject.source ?? "__")) && (e.target.element?.id === subject.target || isAncestor(e.target.element?.id ?? "", subject.target ?? "__"));
|
|
176
181
|
});
|
|
177
182
|
if (!edge) {
|
|
178
183
|
return null;
|
|
@@ -183,12 +188,12 @@ const TopLeftPanelInner = ({ edge, view }) => {
|
|
|
183
188
|
const browser = useRelationshipDetails();
|
|
184
189
|
const edgeId = edge.id;
|
|
185
190
|
const [historyEdgeId, historyOps, { history, current }] = useStateHistory(edge.id);
|
|
186
|
-
useEffect(() => {
|
|
191
|
+
reactExports.useEffect(() => {
|
|
187
192
|
if (historyEdgeId !== edgeId) {
|
|
188
193
|
historyOps.set(edgeId);
|
|
189
194
|
}
|
|
190
195
|
}, [edgeId]);
|
|
191
|
-
useEffect(() => {
|
|
196
|
+
reactExports.useEffect(() => {
|
|
192
197
|
if (historyEdgeId !== edgeId) {
|
|
193
198
|
browser.navigateTo(historyEdgeId);
|
|
194
199
|
}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import '@likec4/core';
|
|
3
|
-
import {
|
|
3
|
+
import { Popover, PopoverTarget, Button, Box, Text, ThemeIcon, PopoverDropdown, ScrollAreaAutosize } from '@mantine/core';
|
|
4
4
|
import { IconArrowRight, IconSelector } from '@tabler/icons-react';
|
|
5
|
-
import {
|
|
5
|
+
import { r as reactExports } from '../../_virtual/index.js';
|
|
6
6
|
import { useRelationshipDetails } from './hooks.js';
|
|
7
7
|
import { edgeSource, edgeTarget, scrollArea, edgeGrid, edgeRow, edgeArrow, edgeLabel } from './SelectEdge.css.js';
|
|
8
|
-
import { useMantinePortalProps } from '../../hooks/useMantinePortalProps.js';
|
|
9
8
|
|
|
10
9
|
const SelectEdge = ({
|
|
11
10
|
edge,
|
|
12
11
|
view
|
|
13
12
|
}) => {
|
|
14
13
|
const browser = useRelationshipDetails();
|
|
15
|
-
const viewport = useRef(null);
|
|
16
|
-
useMantinePortalProps();
|
|
17
|
-
useComputedColorScheme();
|
|
14
|
+
const viewport = reactExports.useRef(null);
|
|
18
15
|
const edgeSource$1 = view.nodes.find((n) => n.id === edge.source);
|
|
19
16
|
const edgeTarget$1 = view.nodes.find((n) => n.id === edge.target);
|
|
20
17
|
const edges = view.edges.flatMap((edge2) => {
|
|
@@ -19,7 +19,7 @@ const RelationshipEdge = customEdge((props) => {
|
|
|
19
19
|
const [svgPath, labelX, labelY] = getBezierPath(props);
|
|
20
20
|
const diagram = useDiagram();
|
|
21
21
|
return /* @__PURE__ */ jsxs(EdgeContainer, { ...props, children: [
|
|
22
|
-
/* @__PURE__ */ jsx(EdgePath, {
|
|
22
|
+
/* @__PURE__ */ jsx(EdgePath, { edgeProps: props, svgPath }),
|
|
23
23
|
/* @__PURE__ */ jsx(
|
|
24
24
|
EdgeLabelContainer,
|
|
25
25
|
{
|
|
@@ -27,7 +27,7 @@ const ElementDetailsButtonWithHandler = (props) => {
|
|
|
27
27
|
const ElementNode = customNode((props) => {
|
|
28
28
|
return /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
|
|
29
29
|
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
30
|
-
/* @__PURE__ */ jsx(ElementTitle, { ...props
|
|
30
|
+
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
31
31
|
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
|
|
32
32
|
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
33
33
|
/* @__PURE__ */ jsx(ElementPorts, { ...props })
|
|
@@ -12,6 +12,8 @@ export declare function useRelationshipDetails(): {
|
|
|
12
12
|
getState: () => Readonly<{
|
|
13
13
|
subject: {
|
|
14
14
|
edgeId: EdgeId;
|
|
15
|
+
source?: never;
|
|
16
|
+
target?: never;
|
|
15
17
|
} | {
|
|
16
18
|
source: Fqn;
|
|
17
19
|
target: Fqn;
|
|
@@ -57,7 +59,7 @@ export declare function useRelationshipDetails(): {
|
|
|
57
59
|
active?: boolean;
|
|
58
60
|
dimmed?: import("../../base").Base.Dimmed;
|
|
59
61
|
};
|
|
60
|
-
}> &
|
|
62
|
+
}> & ViewportHelperFunctions & {
|
|
61
63
|
viewportInitialized: boolean;
|
|
62
64
|
}) | null;
|
|
63
65
|
xystore: {
|
|
@@ -2,11 +2,11 @@ import { nonNullable } from '@likec4/core';
|
|
|
2
2
|
import { useCallbackRef } from '@mantine/hooks';
|
|
3
3
|
import { useSelector } from '@xstate/react';
|
|
4
4
|
import { shallowEqual } from 'fast-equals';
|
|
5
|
-
import {
|
|
5
|
+
import { r as reactExports } from '../../_virtual/index.js';
|
|
6
6
|
|
|
7
|
-
const RelationshipDetailsActorContext = createContext(null);
|
|
7
|
+
const RelationshipDetailsActorContext = reactExports.createContext(null);
|
|
8
8
|
function useRelationshipDetailsActor() {
|
|
9
|
-
return nonNullable(useContext(RelationshipDetailsActorContext), "No RelationshipDetailsActorContext");
|
|
9
|
+
return nonNullable(reactExports.useContext(RelationshipDetailsActorContext), "No RelationshipDetailsActorContext");
|
|
10
10
|
}
|
|
11
11
|
function useRelationshipDetailsState(selector, compare = shallowEqual) {
|
|
12
12
|
const select = useCallbackRef(selector);
|
|
@@ -15,7 +15,7 @@ function useRelationshipDetailsState(selector, compare = shallowEqual) {
|
|
|
15
15
|
}
|
|
16
16
|
function useRelationshipDetails() {
|
|
17
17
|
const actor = useRelationshipDetailsActor();
|
|
18
|
-
return useMemo(() => ({
|
|
18
|
+
return reactExports.useMemo(() => ({
|
|
19
19
|
actor,
|
|
20
20
|
get rootElementId() {
|
|
21
21
|
return `relationship-details-${actor.sessionId.replaceAll(":", "_")}`;
|
|
@@ -5,10 +5,9 @@ import { useCallbackRef, useStateHistory } from '@mantine/hooks';
|
|
|
5
5
|
import { IconX, IconChevronLeft, IconChevronRight } from '@tabler/icons-react';
|
|
6
6
|
import { ReactFlowProvider, useStoreApi, useReactFlow, Panel } from '@xyflow/react';
|
|
7
7
|
import { shallowEqual } from 'fast-equals';
|
|
8
|
-
import { LayoutGroup, AnimatePresence, m } from '
|
|
9
|
-
import {
|
|
8
|
+
import { LayoutGroup, AnimatePresence, m } from 'motion/react';
|
|
9
|
+
import { r as reactExports } from '../../_virtual/index.js';
|
|
10
10
|
import { BaseXYFlow } from '../../base/BaseXYFlow.js';
|
|
11
|
-
import { ViewPadding } from './const.js';
|
|
12
11
|
import { RelationshipsBrowserActorContext, useRelationshipsBrowser, useRelationshipsBrowserState } from './hooks.js';
|
|
13
12
|
import { useRelationshipsView } from './layout.js';
|
|
14
13
|
import { SelectElement } from './SelectElement.js';
|
|
@@ -24,7 +23,7 @@ const edgeTypes = {
|
|
|
24
23
|
relationship: RelationshipEdge
|
|
25
24
|
};
|
|
26
25
|
function RelationshipsBrowser({ actorRef }) {
|
|
27
|
-
const initialRef = useRef(null);
|
|
26
|
+
const initialRef = reactExports.useRef(null);
|
|
28
27
|
if (initialRef.current == null) {
|
|
29
28
|
initialRef.current = {
|
|
30
29
|
initialNodes: [],
|
|
@@ -39,7 +38,7 @@ const selector = (state) => ({
|
|
|
39
38
|
edges: state.context.xyedges
|
|
40
39
|
});
|
|
41
40
|
const selectorEq = (a, b) => a.isActive === b.isActive && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges);
|
|
42
|
-
const RelationshipsBrowserXYFlow = memo(() => {
|
|
41
|
+
const RelationshipsBrowserXYFlow = reactExports.memo(() => {
|
|
43
42
|
const browser = useRelationshipsBrowser();
|
|
44
43
|
const {
|
|
45
44
|
isActive,
|
|
@@ -62,7 +61,6 @@ const RelationshipsBrowserXYFlow = memo(() => {
|
|
|
62
61
|
nodeTypes,
|
|
63
62
|
edgeTypes,
|
|
64
63
|
fitView: false,
|
|
65
|
-
fitViewPadding: ViewPadding,
|
|
66
64
|
onNodeClick: useCallbackRef((e, node) => {
|
|
67
65
|
browser.send({ type: "xyflow.nodeClick", node });
|
|
68
66
|
}),
|
|
@@ -110,7 +108,7 @@ const selector2 = (state) => ({
|
|
|
110
108
|
scope: state.context.scope,
|
|
111
109
|
closeable: state.context.closeable
|
|
112
110
|
});
|
|
113
|
-
const RelationshipsBrowserInner = memo(() => {
|
|
111
|
+
const RelationshipsBrowserInner = reactExports.memo(() => {
|
|
114
112
|
const browser = useRelationshipsBrowser();
|
|
115
113
|
const {
|
|
116
114
|
subjectId,
|
|
@@ -120,24 +118,24 @@ const RelationshipsBrowserInner = memo(() => {
|
|
|
120
118
|
} = useRelationshipsBrowserState(selector2);
|
|
121
119
|
const store = useStoreApi();
|
|
122
120
|
const instance = useReactFlow();
|
|
123
|
-
useEffect(() => {
|
|
121
|
+
reactExports.useEffect(() => {
|
|
124
122
|
if (instance.viewportInitialized) {
|
|
125
123
|
browser.send({ type: "xyflow.init", instance, store });
|
|
126
124
|
}
|
|
127
125
|
}, [store, instance.viewportInitialized, browser]);
|
|
128
126
|
const layouted = useRelationshipsView(subjectId, viewId, scope);
|
|
129
127
|
const [historySubjectId, historyOps, { history, current }] = useStateHistory(subjectId);
|
|
130
|
-
useEffect(() => {
|
|
128
|
+
reactExports.useEffect(() => {
|
|
131
129
|
if (historySubjectId !== subjectId) {
|
|
132
130
|
historyOps.set(subjectId);
|
|
133
131
|
}
|
|
134
132
|
}, [subjectId]);
|
|
135
|
-
useEffect(() => {
|
|
133
|
+
reactExports.useEffect(() => {
|
|
136
134
|
if (historySubjectId !== subjectId) {
|
|
137
135
|
browser.navigateTo(historySubjectId);
|
|
138
136
|
}
|
|
139
137
|
}, [historySubjectId, browser]);
|
|
140
|
-
useEffect(() => {
|
|
138
|
+
reactExports.useEffect(() => {
|
|
141
139
|
browser.updateView(layouted);
|
|
142
140
|
}, [layouted, browser]);
|
|
143
141
|
const hasStepBack = current > 0;
|