@likec4/diagram 1.27.2 → 1.28.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/bundle/index.js +715 -616
- package/dist/base/primitives/customEdge.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeActionButton.d.ts +1 -2
- package/dist/base/primitives/edge/EdgeLabelContainer.js +3 -2
- package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
- package/dist/base/primitives/element/ElementActionButtons.d.ts +1 -1
- package/dist/base/primitives/element/ElementActionButtons.js +11 -7
- package/dist/base/primitives/element/ElementDetailsButton.js +5 -1
- package/dist/bundle/styles.css.js +2 -2
- package/dist/hooks/useDiagram.d.ts +2 -2
- package/dist/hooks/useDiagram.js +9 -20
- package/dist/hooks/useXYFlow.d.ts +2 -2
- package/dist/likec4diagram/DiagramXYFlow.js +6 -6
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +2 -2
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +11 -1
- package/dist/likec4diagram/custom/index.d.ts +2 -1
- package/dist/likec4diagram/ui/notation/NotationPanel.js +0 -1
- package/dist/overlays/Overlays.js +2 -2
- package/dist/overlays/element-details/actor.d.ts +303 -303
- package/dist/overlays/overlay/Overlay.css.d.ts +2 -25
- package/dist/overlays/overlay/Overlay.css.js +3 -43
- package/dist/overlays/overlay/Overlay.d.ts +1 -1
- package/dist/overlays/overlay/Overlay.js +97 -90
- package/dist/overlays/overlaysActor.js +4 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +1 -1
- package/dist/overlays/relationship-details/actor.d.ts +16 -7
- package/dist/overlays/relationship-details/actor.js +1 -6
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +1 -1
- package/dist/overlays/relationship-details/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationship-details/hooks.d.ts +2 -3
- package/dist/overlays/relationship-details/hooks.js +2 -5
- package/dist/overlays/relationship-details/layout-to-xyflow.js +0 -4
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +1 -1
- package/dist/overlays/relationships-browser/actor.d.ts +2 -3
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +1 -1
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +1 -1
- package/dist/overlays/relationships-browser/hooks.d.ts +2 -3
- package/dist/overlays/relationships-browser/hooks.js +5 -8
- package/dist/overlays/relationships-browser/layout.d.ts +1 -1
- package/dist/overlays/relationships-browser/layout.js +2 -6
- package/dist/state/diagram-machine.d.ts +2 -2
- package/dist/state/hotkeyActor.js +12 -3
- package/dist/styles.css.js +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/package.json +10 -10
- package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -3
- package/src/base/primitives/edge/EdgeActionButton.tsx +1 -2
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +7 -5
- package/src/base/primitives/element/ElementActionButtons.tsx +11 -9
- package/src/base/primitives/element/ElementDetailsButton.tsx +4 -0
- package/src/base/primitives/element/ElementNodeContainer.css.ts +0 -18
- package/src/bundle/styles.css.ts +7 -2
- package/src/components/SearchControl.css.ts +4 -8
- package/src/hooks/useDiagram.ts +9 -20
- package/src/likec4diagram/DiagramXYFlow.tsx +6 -6
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +7 -1
- package/src/likec4diagram/custom/edges/edges.css.ts +0 -2
- package/src/likec4diagram/ui/notation/NotationPanel.css.ts +0 -4
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +0 -1
- package/src/likec4diagram/ui/search/ViewsColumn.css.ts +0 -4
- package/src/overlays/Overlays.tsx +3 -3
- package/src/overlays/overlay/Overlay.css.ts +3 -43
- package/src/overlays/overlay/Overlay.tsx +108 -101
- package/src/overlays/overlaysActor.ts +5 -1
- package/src/overlays/relationship-details/actor.ts +1 -6
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +1 -1
- package/src/overlays/relationship-details/hooks.ts +2 -5
- package/src/overlays/relationship-details/layout-to-xyflow.ts +2 -25
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +1 -1
- package/src/overlays/relationships-browser/hooks.ts +5 -8
- package/src/overlays/relationships-browser/layout.ts +3 -20
- package/src/state/hotkeyActor.ts +13 -3
- package/src/utils/index.ts +0 -1
- package/dist/utils/types.d.ts +0 -8
- package/src/utils/types.ts +0 -6
|
@@ -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">>;
|
|
@@ -22,7 +22,7 @@ const dialog = css.raw({
|
|
|
22
22
|
[backdropBlur]: "0px",
|
|
23
23
|
[level]: "0",
|
|
24
24
|
[offset]: "0px",
|
|
25
|
-
[inset]: "calc((1 + var(--_level) * 0.
|
|
25
|
+
[inset]: "calc((1 + var(--_level) * 0.75) * var(--_offset))",
|
|
26
26
|
[backdropOpacity]: "0%",
|
|
27
27
|
_backdrop: {
|
|
28
28
|
cursor: "zoom-out",
|
|
@@ -43,8 +43,8 @@ const dialog = css.raw({
|
|
|
43
43
|
height: "100vh"
|
|
44
44
|
},
|
|
45
45
|
sm: {
|
|
46
|
-
inset: "[var(--_inset) var(--
|
|
47
|
-
width: "calc(100vw -
|
|
46
|
+
inset: "[var(--_inset) var(--_inset) var(--_offset) var(--_inset)]",
|
|
47
|
+
width: "calc(100vw - 2 * var(--_inset))",
|
|
48
48
|
height: "calc(100vh - var(--_offset) - var(--_inset))",
|
|
49
49
|
[borderRadius]: "6px",
|
|
50
50
|
padding: "6px",
|
|
@@ -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
|
|
|
@@ -4,102 +4,109 @@ import { RemoveScroll, Box } from '@mantine/core';
|
|
|
4
4
|
import { useMergedRef } from '@mantine/hooks';
|
|
5
5
|
import { useSyncedRef, useDebouncedCallback, useTimeoutEffect } from '@react-hookz/web';
|
|
6
6
|
import { useReducedMotionConfig, m } from 'framer-motion';
|
|
7
|
-
import { forwardRef, useState, useRef,
|
|
8
|
-
import { overlay, backdropOpacity, backdropBlur } from './Overlay.css.js';
|
|
7
|
+
import { forwardRef, useState, useRef, useEffect } from 'react';
|
|
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 = forwardRef(({
|
|
12
|
+
onClose,
|
|
13
|
+
className,
|
|
14
|
+
classes,
|
|
15
|
+
overlayLevel = 0,
|
|
16
|
+
children,
|
|
17
|
+
...rest
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const [opened, setOpened] = useState(false);
|
|
20
|
+
const dialogRef = useRef(null);
|
|
21
|
+
const isClosingRef = 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
|
+
useEffect(() => {
|
|
34
|
+
const cancel = (e) => {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
close();
|
|
37
|
+
};
|
|
38
|
+
dialogRef.current?.addEventListener("cancel", cancel, { capture: true });
|
|
39
|
+
return () => {
|
|
40
|
+
dialogRef.current?.removeEventListener("cancel", cancel, { capture: true });
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
useTimeoutEffect(() => {
|
|
44
|
+
if (!dialogRef.current?.open) {
|
|
45
|
+
dialogRef.current?.showModal();
|
|
46
|
+
}
|
|
47
|
+
}, 30);
|
|
48
|
+
useTimeoutEffect(() => {
|
|
49
|
+
setOpened(true);
|
|
50
|
+
}, 120);
|
|
51
|
+
const styles = overlay({
|
|
52
|
+
level: overlayLevel
|
|
53
|
+
});
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
m.dialog,
|
|
56
|
+
{
|
|
57
|
+
ref: useMergedRef(dialogRef, ref),
|
|
58
|
+
className: cx(RemoveScroll.classNames.fullWidth, styles.dialog, classes?.dialog, className),
|
|
59
|
+
layout: true,
|
|
60
|
+
style: {
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
[level]: overlayLevel
|
|
23
63
|
},
|
|
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
|
-
translateY: 0,
|
|
67
|
-
transition: {
|
|
68
|
-
delay: 0.075
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
exit: {
|
|
72
|
-
scale: 1.3,
|
|
73
|
-
opacity: 0,
|
|
74
|
-
translateY: -10,
|
|
75
|
-
[backdropBlur]: "0px",
|
|
76
|
-
[backdropOpacity]: "0%"
|
|
77
|
-
}
|
|
78
|
-
} : {
|
|
79
|
-
initial: {
|
|
80
|
-
[backdropBlur]: "8px",
|
|
81
|
-
[backdropOpacity]: "60%"
|
|
82
|
-
}
|
|
64
|
+
...motionNotReduced ? {
|
|
65
|
+
initial: {
|
|
66
|
+
[backdropBlur]: "0px",
|
|
67
|
+
[backdropOpacity]: "0%",
|
|
68
|
+
scale: overlayLevel > 0 ? 0.9 : 1.075,
|
|
69
|
+
opacity: 0
|
|
83
70
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
animate: {
|
|
72
|
+
[backdropBlur]: overlayLevel > 0 ? "4px" : "8px",
|
|
73
|
+
[backdropOpacity]: overlayLevel > 0 ? "50%" : "60%",
|
|
74
|
+
scale: 1,
|
|
75
|
+
opacity: 1,
|
|
76
|
+
transition: {
|
|
77
|
+
delay: 0.075
|
|
89
78
|
}
|
|
90
79
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
80
|
+
exit: {
|
|
81
|
+
scale: 1.2,
|
|
82
|
+
opacity: 0,
|
|
83
|
+
[backdropBlur]: "0px",
|
|
84
|
+
[backdropOpacity]: "0%"
|
|
85
|
+
}
|
|
86
|
+
} : {
|
|
87
|
+
initial: {
|
|
88
|
+
[backdropBlur]: "8px",
|
|
89
|
+
[backdropOpacity]: "60%"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
onClick: (e) => {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
if (e.target?.nodeName?.toUpperCase() === "DIALOG") {
|
|
95
|
+
dialogRef.current?.close();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
onDoubleClick: stopPropagation,
|
|
100
|
+
onPointerDown: stopPropagation,
|
|
101
|
+
onClose: (e) => {
|
|
102
|
+
e.stopPropagation();
|
|
103
|
+
close();
|
|
104
|
+
},
|
|
105
|
+
...rest,
|
|
106
|
+
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 }) }) })
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
});
|
|
103
110
|
Overlay.displayName = "Overlay";
|
|
104
111
|
|
|
105
112
|
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,6 +1,6 @@
|
|
|
1
1
|
import { RelationshipDetailsActorRef } from './actor';
|
|
2
2
|
import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { Position } from '@xyflow/
|
|
3
|
+
import { Position } from '@xyflow/react';
|
|
4
4
|
import { RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
|
|
5
5
|
export declare const edgeTypes: {
|
|
6
6
|
relationship: NamedExoticComponent<{
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BBox, EdgeId, ExclusiveUnion, Fqn, ViewId, RelationId, Color, RelationshipLineType } from '@likec4/core';
|
|
2
|
-
import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi } from '@xyflow/react';
|
|
2
|
+
import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi, EdgeMarkerType, HandleType } from '@xyflow/react';
|
|
3
3
|
import { ActorLogicFrom, ActorRefFromLogic, SnapshotFrom, StateMachine, Values, NonReducibleUnknown, EventObject, MetaObject, AnyActorLogic, ConditionalRequired, InputFrom, RequiredLogicInput, IsNotNever, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, CancelAction } from 'xstate';
|
|
4
4
|
import { Base } from '../../base';
|
|
5
5
|
import { RelationshipDetailsTypes } from './_types';
|
|
6
6
|
import { LayoutResult } from './layout';
|
|
7
|
-
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
8
7
|
import { ReactNode, CSSProperties } from 'react';
|
|
9
8
|
type XYFLowInstance = ReactFlowInstance<RelationshipDetailsTypes.Node, RelationshipDetailsTypes.Edge>;
|
|
10
9
|
type XYStoreApi = ReturnType<typeof useStoreApi<RelationshipDetailsTypes.Node, RelationshipDetailsTypes.Edge>>;
|
|
@@ -455,12 +454,22 @@ export declare const relationshipDetailsLogic: StateMachine<Readonly<{
|
|
|
455
454
|
}>, {
|
|
456
455
|
type: "update.layoutData";
|
|
457
456
|
data: LayoutResult;
|
|
458
|
-
}, undefined, Events>, {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
457
|
+
}, undefined, Events>, ActionFunction<Readonly<{
|
|
458
|
+
subject: Subject;
|
|
459
|
+
viewId: ViewId;
|
|
460
|
+
xyflow: XYFLowInstance | null;
|
|
461
|
+
xystore: XYStoreApi | null;
|
|
462
|
+
initialized: {
|
|
463
|
+
xydata: boolean;
|
|
464
|
+
xyflow: boolean;
|
|
462
465
|
};
|
|
463
|
-
|
|
466
|
+
xynodes: RelationshipDetailsTypes.Node[];
|
|
467
|
+
xyedges: RelationshipDetailsTypes.Edge[];
|
|
468
|
+
bounds: BBox;
|
|
469
|
+
}>, {
|
|
470
|
+
type: "update.layoutData";
|
|
471
|
+
data: LayoutResult;
|
|
472
|
+
}, Events, undefined, never, never, never, never, never>, ActionFunction<Readonly<{
|
|
464
473
|
subject: Subject;
|
|
465
474
|
viewId: ViewId;
|
|
466
475
|
xyflow: XYFLowInstance | null;
|
|
@@ -218,12 +218,7 @@ const relationshipDetailsLogic = setup({
|
|
|
218
218
|
actions: [
|
|
219
219
|
"updateLayoutData",
|
|
220
220
|
cancel("fitDiagram"),
|
|
221
|
-
{
|
|
222
|
-
type: "xyflow:fitDiagram",
|
|
223
|
-
params: {
|
|
224
|
-
duration: 0
|
|
225
|
-
}
|
|
226
|
-
},
|
|
221
|
+
raise({ type: "fitDiagram", duration: 0 }, { id: "fitDiagram", delay: 50 }),
|
|
227
222
|
raise({ type: "xyflow.updateNodeInternals" }, { delay: 75 })
|
|
228
223
|
]
|
|
229
224
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { Position } from '@xyflow/
|
|
2
|
+
import { Position } from '@xyflow/react';
|
|
3
3
|
import { RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
|
|
4
4
|
export declare const RelationshipEdge: NamedExoticComponent<{
|
|
5
5
|
id: string;
|
|
@@ -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 })
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { EdgeId, Fqn, ViewId, RelationId, Color, RelationshipLineType, BBox } from '@likec4/core';
|
|
2
2
|
import { RelationshipDetailsActorRef, RelationshipDetailsSnapshot, Events } from './actor';
|
|
3
3
|
import { Context, ReactNode, CSSProperties } from 'react';
|
|
4
|
-
import { GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
|
|
5
|
-
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
4
|
+
import { GeneralHelpers, EdgeMarkerType, HandleType, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
|
|
6
5
|
export declare const RelationshipDetailsActorContext: Context<RelationshipDetailsActorRef | null>;
|
|
7
6
|
export declare function useRelationshipDetailsActor(): RelationshipDetailsActorRef;
|
|
8
7
|
export declare function useRelationshipDetailsState<T = unknown>(selector: (state: RelationshipDetailsSnapshot) => T, compare?: (a: NoInfer<T>, b: NoInfer<T>) => boolean): T;
|
|
@@ -57,7 +56,7 @@ export declare function useRelationshipDetails(): {
|
|
|
57
56
|
active?: boolean;
|
|
58
57
|
dimmed?: import("../../base").Base.Dimmed;
|
|
59
58
|
};
|
|
60
|
-
}> &
|
|
59
|
+
}> & ViewportHelperFunctions & {
|
|
61
60
|
viewportInitialized: boolean;
|
|
62
61
|
}) | null;
|
|
63
62
|
xystore: {
|
|
@@ -2,7 +2,7 @@ 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 { createContext,
|
|
5
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
6
6
|
|
|
7
7
|
const RelationshipDetailsActorContext = createContext(null);
|
|
8
8
|
function useRelationshipDetailsActor() {
|
|
@@ -15,7 +15,6 @@ function useRelationshipDetailsState(selector, compare = shallowEqual) {
|
|
|
15
15
|
}
|
|
16
16
|
function useRelationshipDetails() {
|
|
17
17
|
const actor = useRelationshipDetailsActor();
|
|
18
|
-
const [, startTransition] = useTransition();
|
|
19
18
|
return useMemo(() => ({
|
|
20
19
|
actor,
|
|
21
20
|
get rootElementId() {
|
|
@@ -31,9 +30,7 @@ function useRelationshipDetails() {
|
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
32
|
fitDiagram: () => {
|
|
34
|
-
|
|
35
|
-
actor.send({ type: "fitDiagram" });
|
|
36
|
-
});
|
|
33
|
+
actor.send({ type: "fitDiagram" });
|
|
37
34
|
},
|
|
38
35
|
close: () => {
|
|
39
36
|
if (actor._parent) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RelationshipsBrowserActorRef } from './actor';
|
|
2
2
|
import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { Position } from '@xyflow/
|
|
3
|
+
import { Position } from '@xyflow/react';
|
|
4
4
|
import { Fqn, NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
|
|
5
5
|
export declare const edgeTypes: {
|
|
6
6
|
relationship: NamedExoticComponent<{
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BBox, Fqn, ViewId, NonEmptyArray, RelationId, Color, RelationshipLineType } from '@likec4/core';
|
|
2
|
-
import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi, GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
|
|
2
|
+
import { EdgeChange, NodeChange, ReactFlowInstance, useStoreApi, EdgeMarkerType, HandleType, GeneralHelpers, ViewportHelperFunctions, ReactFlowState } from '@xyflow/react';
|
|
3
3
|
import { ActorLogicFrom, ActorRefFromLogic, SnapshotFrom, PromiseActorLogic, EventObject, StateMachine, Values, NonReducibleUnknown, MetaObject, ConditionalRequired, InputFrom, RequiredActorOptions, IsNotNever, GetConcreteByKey, AnyActorLogic, RequiredLogicInput, ActorRef, MachineSnapshot, AnyActorRef, StateValue, AnyEventObject, ActionFunction, CancelAction, DoneActorEvent } from 'xstate';
|
|
4
4
|
import { Base } from '../../base';
|
|
5
5
|
import { RelationshipsBrowserTypes } from './_types';
|
|
6
6
|
import { LayoutRelationshipsViewResult } from './layout';
|
|
7
|
-
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
8
7
|
import { ReactNode, CSSProperties } from 'react';
|
|
9
8
|
type XYFLowInstance = ReactFlowInstance<RelationshipsBrowserTypes.Node, RelationshipsBrowserTypes.Edge>;
|
|
10
9
|
export type XYStoreApi = ReturnType<typeof useStoreApi<RelationshipsBrowserTypes.Node, RelationshipsBrowserTypes.Edge>>;
|
|
@@ -1140,7 +1139,7 @@ export declare const relationshipsBrowserLogic: StateMachine<Readonly<{
|
|
|
1140
1139
|
active?: boolean;
|
|
1141
1140
|
dimmed?: Base.Dimmed;
|
|
1142
1141
|
};
|
|
1143
|
-
}> &
|
|
1142
|
+
}> & ViewportHelperFunctions & {
|
|
1144
1143
|
viewportInitialized: boolean;
|
|
1145
1144
|
};
|
|
1146
1145
|
xystore: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NamedExoticComponent, CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { Position } from '@xyflow/
|
|
2
|
+
import { Position } from '@xyflow/react';
|
|
3
3
|
import { Fqn, NonEmptyArray, RelationId, Color, ViewId, RelationshipLineType } from '@likec4/core';
|
|
4
4
|
export declare const RelationshipEdge: NamedExoticComponent<{
|
|
5
5
|
id: string;
|
|
@@ -29,7 +29,7 @@ const ElementDetailsButtonWithHandler = (props) => {
|
|
|
29
29
|
const ElementNode = customNode((props) => {
|
|
30
30
|
return /* @__PURE__ */ jsxs(ElementNodeContainer, { component: m.div, layoutId: props.id, nodeProps: props, children: [
|
|
31
31
|
/* @__PURE__ */ jsx(ElementShape, { ...props }),
|
|
32
|
-
/* @__PURE__ */ jsx(ElementTitle, { ...props
|
|
32
|
+
/* @__PURE__ */ jsx(ElementTitle, { ...props }),
|
|
33
33
|
/* @__PURE__ */ jsx(ElementDetailsButtonWithHandler, { ...props }),
|
|
34
34
|
/* @__PURE__ */ jsx(ElementActions, { ...props }),
|
|
35
35
|
/* @__PURE__ */ jsx(ElementPorts, { ...props })
|
|
@@ -2,8 +2,7 @@ import { Fqn, ViewId, NonEmptyArray, RelationId, Color, RelationshipLineType } f
|
|
|
2
2
|
import { RelationshipsBrowserActorRef, RelationshipsBrowserSnapshot, XYStoreApi, Events } from './actor';
|
|
3
3
|
import { LayoutRelationshipsViewResult } from './layout';
|
|
4
4
|
import { Context, ReactNode, CSSProperties } from 'react';
|
|
5
|
-
import { GeneralHelpers, ViewportHelperFunctions } from '@xyflow/react';
|
|
6
|
-
import { EdgeMarkerType, HandleType } from '@xyflow/system';
|
|
5
|
+
import { GeneralHelpers, EdgeMarkerType, HandleType, ViewportHelperFunctions } from '@xyflow/react';
|
|
7
6
|
export declare const RelationshipsBrowserActorContext: Context<RelationshipsBrowserActorRef | null>;
|
|
8
7
|
export declare function useRelationshipsBrowserActor(): RelationshipsBrowserActorRef;
|
|
9
8
|
export declare function useRelationshipsBrowserState<T>(selector: (state: RelationshipsBrowserSnapshot) => T, compare?: (a: T, b: T) => boolean): T;
|
|
@@ -57,7 +56,7 @@ export declare function useRelationshipsBrowser(): {
|
|
|
57
56
|
active?: boolean;
|
|
58
57
|
dimmed?: import("../../base").Base.Dimmed;
|
|
59
58
|
};
|
|
60
|
-
}> &
|
|
59
|
+
}> & ViewportHelperFunctions & {
|
|
61
60
|
viewportInitialized: boolean;
|
|
62
61
|
}) | null;
|
|
63
62
|
xystore: XYStoreApi | null;
|
|
@@ -2,7 +2,7 @@ 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 { createContext,
|
|
5
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
6
6
|
|
|
7
7
|
const RelationshipsBrowserActorContext = createContext(null);
|
|
8
8
|
function useRelationshipsBrowserActor() {
|
|
@@ -14,7 +14,6 @@ function useRelationshipsBrowserState(selector, compare = shallowEqual) {
|
|
|
14
14
|
}
|
|
15
15
|
function useRelationshipsBrowser() {
|
|
16
16
|
const actor = useRelationshipsBrowserActor();
|
|
17
|
-
const [, startTransition] = useTransition();
|
|
18
17
|
return useMemo(() => ({
|
|
19
18
|
actor,
|
|
20
19
|
get rootElementId() {
|
|
@@ -35,12 +34,10 @@ function useRelationshipsBrowser() {
|
|
|
35
34
|
});
|
|
36
35
|
},
|
|
37
36
|
navigateTo: (subject, fromNode) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
fromNode
|
|
43
|
-
});
|
|
37
|
+
actor.send({
|
|
38
|
+
type: "navigate.to",
|
|
39
|
+
subject,
|
|
40
|
+
fromNode
|
|
44
41
|
});
|
|
45
42
|
},
|
|
46
43
|
fitDiagram: () => {
|
|
@@ -11,7 +11,7 @@ export type LayoutRelationshipsViewResult = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare namespace LayoutRelationshipsViewResult {
|
|
13
13
|
const Empty: ElementKind;
|
|
14
|
-
type Node = DiagramNode & {
|
|
14
|
+
type Node = Omit<DiagramNode, 'deploymentRef' | 'inEdges' | 'outEdges'> & {
|
|
15
15
|
column: RelationshipsBrowserTypes.Column;
|
|
16
16
|
ports: RelationshipsBrowserTypes.Ports;
|
|
17
17
|
existsInCurrentView: boolean;
|
|
@@ -13,7 +13,7 @@ const Sizes = {
|
|
|
13
13
|
edgesep: 25
|
|
14
14
|
},
|
|
15
15
|
edgeLabel: {
|
|
16
|
-
width:
|
|
16
|
+
width: 140,
|
|
17
17
|
height: 10,
|
|
18
18
|
minlen: 1,
|
|
19
19
|
weight: 1
|
|
@@ -235,7 +235,7 @@ function layoutRelationshipsView(data, scope) {
|
|
|
235
235
|
for (const edge of g.edges()) {
|
|
236
236
|
g.setEdge(edge, {
|
|
237
237
|
...Sizes.edgeLabel,
|
|
238
|
-
width: edgeCount >
|
|
238
|
+
width: edgeCount > 25 ? 800 : 400
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -346,8 +346,6 @@ function layoutRelationshipsView(data, scope) {
|
|
|
346
346
|
width,
|
|
347
347
|
height
|
|
348
348
|
},
|
|
349
|
-
inEdges: [],
|
|
350
|
-
outEdges: [],
|
|
351
349
|
children: [],
|
|
352
350
|
width,
|
|
353
351
|
height,
|
|
@@ -393,8 +391,6 @@ function layoutRelationshipsView(data, scope) {
|
|
|
393
391
|
...element.$element.style
|
|
394
392
|
},
|
|
395
393
|
navigateTo,
|
|
396
|
-
inEdges: [],
|
|
397
|
-
outEdges: [],
|
|
398
394
|
...children.length > 0 && { depth: nodeDepth(id) },
|
|
399
395
|
children,
|
|
400
396
|
width,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BBox, DiagramView, EdgeId, ElementNotation, Fqn, NodeId, StepEdgeId, ViewChange, ViewId, XYPoint, NonEmptyArray, Point, Color, RelationshipLineType, RelationshipArrowType } from '@likec4/core';
|
|
2
|
-
import { ReactFlowInstance, useStoreApi } from '@xyflow/react';
|
|
3
|
-
import { EdgeChange, NodeChange, Rect, Viewport,
|
|
2
|
+
import { ReactFlowInstance, useStoreApi, EdgeMarkerType, HandleType } from '@xyflow/react';
|
|
3
|
+
import { EdgeChange, NodeChange, Rect, Viewport, XYPosition } from '@xyflow/system';
|
|
4
4
|
import { ActorLogicFrom, ActorRef, AnyEventObject, Snapshot, StateMachine, ActorRefFromLogic, NonReducibleUnknown, EventObject, MetaObject, AnyActorLogic, ConditionalRequired, InputFrom, RequiredLogicInput, IsNotNever, MachineSnapshot, AnyActorRef, StateValue, ActionFunction, CallbackActorLogic, Values, RequiredActorOptions, GetConcreteByKey, CancelAction, StopAction } from 'xstate';
|
|
5
5
|
import { Base } from '../base/types';
|
|
6
6
|
import { EnabledFeatures, FeatureName } from '../context/DiagramFeatures';
|
|
@@ -3,15 +3,24 @@ import { fromCallback } from 'xstate';
|
|
|
3
3
|
|
|
4
4
|
const hotkeyActorLogic = fromCallback(({ sendBack }) => {
|
|
5
5
|
const escHandler = getHotkeyHandler([
|
|
6
|
-
["Escape", () =>
|
|
6
|
+
["Escape", (event) => {
|
|
7
|
+
event.stopPropagation();
|
|
8
|
+
sendBack({ type: "key.esc" });
|
|
9
|
+
}, {
|
|
7
10
|
preventDefault: true
|
|
8
11
|
}]
|
|
9
12
|
]);
|
|
10
13
|
const arrowshandler = getHotkeyHandler([
|
|
11
|
-
["ArrowLeft", () =>
|
|
14
|
+
["ArrowLeft", (event) => {
|
|
15
|
+
event.stopPropagation();
|
|
16
|
+
sendBack({ type: "key.arrow.left" });
|
|
17
|
+
}, {
|
|
12
18
|
preventDefault: true
|
|
13
19
|
}],
|
|
14
|
-
["ArrowRight", () =>
|
|
20
|
+
["ArrowRight", (event) => {
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
sendBack({ type: "key.arrow.right" });
|
|
23
|
+
}, {
|
|
15
24
|
preventDefault: true
|
|
16
25
|
}]
|
|
17
26
|
]);
|