@likec4/diagram 1.31.0 → 1.32.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/{chunk-BBzMXzCg.js → chunk-BvTQaUYl.js} +1675 -1207
- package/bundle/custom.js +50 -47
- package/bundle/index.js +2482 -2438
- package/dist/LikeC4CustomColors.d.ts +2 -7
- package/dist/LikeC4CustomColors.js +17 -6
- package/dist/LikeC4Diagram.d.ts +3 -2
- package/dist/LikeC4Diagram.js +10 -14
- package/dist/LikeC4Diagram.props.d.ts +28 -22
- package/dist/LikeC4ModelProvider.d.ts +5 -4
- package/dist/StaticLikeC4Diagram.d.ts +3 -2
- package/dist/StaticLikeC4Diagram.js +2 -2
- package/dist/base/BaseXYFlow.js +5 -5
- package/dist/base/const.d.ts +1 -1
- package/dist/base/const.js +1 -1
- package/dist/base/index.d.ts +2 -1
- package/dist/base/primitives/compound/CompoundActionButton.js +2 -1
- package/dist/base/primitives/compound/CompoundDetailsButton.js +2 -1
- package/dist/base/primitives/compound/CompoundTitle.d.ts +1 -1
- package/dist/base/primitives/compound/CompoundTitle.js +2 -1
- package/dist/base/primitives/edge/EdgeContainer.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeLabel.css.js +1 -0
- package/dist/base/primitives/edge/EdgeLabel.d.ts +3 -3
- package/dist/base/primitives/edge/EdgeLabel.js +6 -4
- package/dist/base/primitives/edge/EdgeLabelContainer.d.ts +1 -1
- package/dist/base/primitives/edge/EdgeMarkers.d.ts +1 -1
- package/dist/base/primitives/edge/EdgePath.d.ts +1 -1
- package/dist/base/primitives/element/ElementActionButtons.js +10 -9
- package/dist/base/primitives/element/ElementDetailsButton.js +2 -1
- package/dist/base/primitives/element/ElementShape.d.ts +1 -1
- package/dist/base/primitives/element/ElementTags.d.ts +14 -0
- package/dist/base/primitives/element/ElementTags.js +176 -0
- package/dist/base/primitives/element/ElementTitle.d.ts +5 -4
- package/dist/base/primitives/element/ElementTitle.js +6 -6
- package/dist/base/primitives/index.d.ts +1 -0
- package/dist/base/types.Base.d.ts +54 -0
- package/dist/base/types.Base.js +48 -0
- package/dist/base/types.d.ts +2 -52
- package/dist/bundle/LikeC4View.d.ts +2 -1
- package/dist/bundle/LikeC4View.js +8 -6
- package/dist/bundle/LikeC4View.props.d.ts +15 -4
- package/dist/bundle/ReactLikeC4.d.ts +4 -7
- package/dist/bundle/ReactLikeC4.js +3 -2
- package/dist/bundle/index.js +1 -1
- package/dist/components/ErrorFallback.d.ts +2 -0
- package/dist/components/ErrorFallback.js +29 -0
- package/dist/context/DiagramEventHandlers.d.ts +6 -5
- package/dist/context/DiagramFeatures.d.ts +2 -2
- package/dist/context/DiagramFeatures.js +3 -31
- package/dist/context/EnsureMantine.js +1 -1
- package/dist/context/IconRenderer.js +1 -4
- package/dist/context/RootContainer.js +5 -1
- package/dist/context/TagStylesContext.d.ts +7 -0
- package/dist/context/TagStylesContext.js +85 -0
- package/dist/custom/components.d.ts +1 -1
- package/dist/custom/customNodes.d.ts +27 -17
- package/dist/custom/hooks.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useDiagram.d.ts +73 -38
- package/dist/hooks/useDiagram.js +7 -3
- package/dist/hooks/useMantinePortalProps.d.ts +2 -2
- package/dist/hooks/useSearchActor.d.ts +2 -0
- package/dist/hooks/useSearchActor.js +10 -0
- package/dist/hooks/useUpdateEffect.js +3 -0
- package/dist/hooks/useXYFlow.d.ts +39 -37
- package/dist/hooks/useXYFlow.js +5 -1
- package/dist/index.js +1 -1
- package/dist/likec4diagram/DiagramUI.js +7 -2
- package/dist/likec4diagram/DiagramXYFlow.d.ts +4 -3
- package/dist/likec4diagram/DiagramXYFlow.js +104 -107
- package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +7 -6
- package/dist/likec4diagram/custom/edges/RelationshipEdge.js +8 -0
- package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +7 -5
- package/dist/likec4diagram/custom/index.d.ts +7 -6
- package/dist/likec4diagram/custom/nodes/nodes.js +39 -26
- package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +3 -3
- package/dist/likec4diagram/types.d.ts +5 -5
- package/dist/likec4diagram/ui/controls/Controls.js +12 -4
- package/dist/likec4diagram/ui/notation/NotationPanel.js +1 -1
- package/dist/likec4diagram/useViewToNodesEdges.d.ts +5 -3
- package/dist/likec4diagram/useViewToNodesEdges.js +20 -30
- package/dist/likec4model/LikeC4ModelContext.d.ts +2 -2
- package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
- package/dist/likec4model/useLikeC4Model.d.ts +22 -10
- package/dist/likec4model/useLikeC4Model.js +11 -7
- package/dist/overlays/Overlays.js +4 -27
- package/dist/overlays/element-details/ElementDetailsCard.d.ts +1 -1
- package/dist/overlays/element-details/ElementDetailsCard.js +19 -12
- package/dist/overlays/element-details/TabPanelDeployments.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelDeployments.js +1 -1
- package/dist/overlays/element-details/TabPanelRelationships.d.ts +1 -1
- package/dist/overlays/element-details/TabPanelStructure.d.ts +1 -1
- package/dist/overlays/element-details/actor.d.ts +288 -286
- package/dist/overlays/overlay/Overlay.css.d.ts +57 -2
- package/dist/overlays/overlay/Overlay.css.js +76 -39
- package/dist/overlays/overlay/Overlay.d.ts +12 -0
- package/dist/overlays/overlay/Overlay.js +36 -25
- package/dist/overlays/overlaysActor.d.ts +1 -1
- package/dist/overlays/relationship-details/RelationshipDetails.d.ts +3 -2
- package/dist/overlays/relationship-details/RelationshipDetails.js +3 -3
- package/dist/overlays/relationship-details/_types.d.ts +2 -2
- package/dist/overlays/relationship-details/actor.js +7 -7
- package/dist/overlays/relationship-details/custom/edgeTypes.d.ts +3 -2
- package/dist/overlays/relationship-details/custom/nodeTypes.js +4 -0
- package/dist/overlays/relationship-details/hooks.d.ts +10 -9
- package/dist/overlays/relationship-details/layout-to-xyflow.js +1 -0
- package/dist/overlays/relationship-details/layout.js +3 -1
- package/dist/overlays/relationships-browser/RelationshipsBrowser.d.ts +3 -2
- package/dist/overlays/relationships-browser/SelectElement.js +1 -1
- package/dist/overlays/relationships-browser/_types.d.ts +2 -2
- package/dist/overlays/relationships-browser/actor.d.ts +1 -1
- package/dist/overlays/relationships-browser/actor.js +7 -7
- package/dist/overlays/relationships-browser/custom/edgeTypes.d.ts +3 -2
- package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +8 -5
- package/dist/overlays/relationships-browser/custom/nodeTypes.js +4 -0
- package/dist/overlays/relationships-browser/layout.d.ts +2 -2
- package/dist/overlays/relationships-browser/layout.js +10 -6
- package/dist/overlays/relationships-browser/useViewToNodesEdges.js +4 -3
- package/dist/search/Search.d.ts +5 -0
- package/dist/search/Search.js +192 -0
- package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.css.js +0 -1
- package/dist/search/components/ElementsColumn.d.ts +2 -0
- package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.js +21 -19
- package/dist/search/components/PickView.d.ts +4 -0
- package/dist/search/components/PickView.js +135 -0
- package/dist/search/components/SearchByTags.d.ts +1 -0
- package/dist/search/components/SearchByTags.js +116 -0
- package/dist/search/components/SearchInput.d.ts +2 -0
- package/dist/{likec4diagram/ui/search → search/components}/SearchInput.js +53 -34
- package/dist/{likec4diagram/ui/search → search/components}/ViewsColum.d.ts +3 -2
- package/dist/{likec4diagram/ui/search → search/components}/ViewsColum.js +14 -13
- package/dist/{likec4diagram/ui/search → search/components}/_shared.css.js +26 -35
- package/dist/{likec4diagram/ui/search/LikeC4Search.css.d.ts → search/components/styles.css.d.ts} +0 -2
- package/dist/search/components/styles.css.js +60 -0
- package/dist/{likec4diagram/ui/search → search/components}/utils.d.ts +1 -0
- package/dist/{likec4diagram/ui/search → search/components}/utils.js +7 -1
- package/dist/search/hooks.d.ts +16 -0
- package/dist/search/hooks.js +35 -0
- package/dist/search/searchActor.d.ts +90 -0
- package/dist/search/searchActor.js +75 -0
- package/dist/state/DiagramActorProvider.d.ts +9 -7
- package/dist/state/DiagramActorProvider.js +24 -18
- package/dist/state/assign.d.ts +0 -1
- package/dist/state/assign.js +9 -19
- package/dist/state/diagram-machine.d.ts +430 -176
- package/dist/state/diagram-machine.js +119 -54
- package/dist/state/syncManualLayoutActor.d.ts +2 -2
- package/dist/state/types.d.ts +2 -0
- package/dist/state/utils.d.ts +2 -0
- package/dist/state/utils.js +3 -0
- package/dist/styles-min.css +1 -1
- package/dist/styles-xyflow.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css2.js +1 -1
- package/package.json +18 -18
- package/panda.buildinfo.json +171 -148
- package/src/LikeC4CustomColors.tsx +21 -6
- package/src/LikeC4Diagram.props.ts +35 -30
- package/src/LikeC4Diagram.tsx +19 -20
- package/src/LikeC4ModelProvider.tsx +6 -5
- package/src/StaticLikeC4Diagram.tsx +8 -6
- package/src/base/const.ts +1 -1
- package/src/base/index.ts +2 -1
- package/src/base/primitives/compound/CompoundActionButton.tsx +2 -1
- package/src/base/primitives/compound/CompoundDetailsButton.tsx +2 -1
- package/src/base/primitives/compound/CompoundTitle.tsx +3 -2
- package/src/base/primitives/edge/EdgeContainer.tsx +2 -1
- package/src/base/primitives/edge/EdgeLabel.css.ts +1 -0
- package/src/base/primitives/edge/EdgeLabel.tsx +20 -15
- package/src/base/primitives/edge/EdgeLabelContainer.tsx +1 -1
- package/src/base/primitives/edge/EdgeMarkers.tsx +2 -1
- package/src/base/primitives/edge/EdgePath.tsx +1 -1
- package/src/base/primitives/element/ElementActionButtons.tsx +11 -10
- package/src/base/primitives/element/ElementDetailsButton.tsx +2 -1
- package/src/base/primitives/element/ElementShape.tsx +2 -1
- package/src/base/primitives/element/ElementTags.tsx +182 -0
- package/src/base/primitives/element/ElementTitle.tsx +21 -15
- package/src/base/primitives/index.ts +1 -0
- package/src/base/types.Base.ts +104 -0
- package/src/base/types.ts +2 -99
- package/src/bundle/LikeC4View.props.ts +17 -4
- package/src/bundle/LikeC4View.tsx +17 -19
- package/src/bundle/ReactLikeC4.tsx +14 -26
- package/src/components/ErrorFallback.tsx +30 -0
- package/src/context/DiagramEventHandlers.tsx +5 -4
- package/src/context/DiagramFeatures.tsx +3 -22
- package/src/context/EnsureMantine.tsx +1 -1
- package/src/context/IconRenderer.tsx +1 -4
- package/src/context/RootContainer.tsx +9 -3
- package/src/context/TagStylesContext.tsx +96 -0
- package/src/custom/components.ts +2 -0
- package/src/custom/customNodes.tsx +24 -14
- package/src/custom/hooks.ts +1 -0
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useCurrentViewId.ts +1 -4
- package/src/hooks/useDiagram.ts +104 -12
- package/src/hooks/useMantinePortalProps.ts +10 -1
- package/src/hooks/useSearchActor.ts +11 -0
- package/src/hooks/useUpdateEffect.ts +7 -4
- package/src/hooks/useXYFlow.ts +5 -0
- package/src/likec4diagram/DiagramUI.tsx +5 -0
- package/src/likec4diagram/DiagramXYFlow.tsx +115 -118
- package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +9 -0
- package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +10 -9
- package/src/likec4diagram/custom/nodes/nodes.tsx +45 -43
- package/src/likec4diagram/custom/nodes/toolbar/_shared.tsx +11 -3
- package/src/likec4diagram/types.ts +5 -3
- package/src/likec4diagram/ui/controls/Controls.tsx +11 -4
- package/src/likec4diagram/ui/notation/NotationPanel.tsx +2 -2
- package/src/likec4diagram/useViewToNodesEdges.ts +34 -36
- package/src/likec4model/LikeC4ModelContext.ts +2 -2
- package/src/likec4model/useLikeC4ElementsTree.ts +1 -1
- package/src/likec4model/useLikeC4Model.ts +18 -16
- package/src/overlays/Overlays.tsx +5 -32
- package/src/overlays/element-details/ElementDetailsCard.tsx +25 -18
- package/src/overlays/element-details/TabPanelDeployments.tsx +3 -2
- package/src/overlays/element-details/TabPanelRelationships.tsx +2 -1
- package/src/overlays/element-details/TabPanelStructure.tsx +1 -1
- package/src/overlays/element-details/actor.ts +2 -2
- package/src/overlays/overlay/Overlay.css.ts +75 -38
- package/src/overlays/overlay/Overlay.tsx +43 -26
- package/src/overlays/overlaysActor.ts +1 -1
- package/src/overlays/relationship-details/RelationshipDetails.tsx +4 -4
- package/src/overlays/relationship-details/_types.ts +2 -1
- package/src/overlays/relationship-details/custom/nodeTypes.tsx +4 -0
- package/src/overlays/relationship-details/layout-to-xyflow.ts +1 -0
- package/src/overlays/relationship-details/layout.ts +3 -1
- package/src/overlays/relationships-browser/SelectElement.tsx +1 -1
- package/src/overlays/relationships-browser/_types.ts +2 -1
- package/src/overlays/relationships-browser/custom/nodeTypes.tsx +4 -0
- package/src/overlays/relationships-browser/layout.ts +12 -7
- package/src/overlays/relationships-browser/useViewToNodesEdges.ts +4 -4
- package/src/search/Search.tsx +237 -0
- package/src/{likec4diagram/ui/search → search/components}/ElementsColumn.css.ts +0 -29
- package/src/{likec4diagram/ui/search → search/components}/ElementsColumn.tsx +24 -22
- package/src/search/components/PickView.tsx +140 -0
- package/src/search/components/SearchByTags.tsx +109 -0
- package/src/{likec4diagram/ui/search → search/components}/SearchInput.tsx +63 -36
- package/src/{likec4diagram/ui/search → search/components}/ViewsColum.tsx +17 -18
- package/src/{likec4diagram/ui/search → search/components}/_shared.css.ts +26 -37
- package/src/{likec4diagram/ui/search/LikeC4Search.css.ts → search/components/styles.css.ts} +9 -36
- package/src/{likec4diagram/ui/search → search/components}/utils.ts +7 -0
- package/src/search/hooks.ts +41 -0
- package/src/search/searchActor.ts +99 -0
- package/src/state/DiagramActorProvider.tsx +36 -25
- package/src/state/assign.ts +10 -10
- package/src/state/diagram-machine.ts +115 -52
- package/src/state/syncManualLayoutActor.ts +1 -1
- package/src/state/types.ts +2 -0
- package/src/state/utils.ts +4 -0
- package/dist/base/types.js +0 -54
- package/dist/likec4diagram/ui/search/ElementsColumn.d.ts +0 -1
- package/dist/likec4diagram/ui/search/LikeC4Search.css.js +0 -87
- package/dist/likec4diagram/ui/search/LikeC4Search.d.ts +0 -2
- package/dist/likec4diagram/ui/search/LikeC4Search.js +0 -267
- package/dist/likec4diagram/ui/search/SearchInput.d.ts +0 -1
- package/dist/likec4diagram/ui/search/state.d.ts +0 -19
- package/dist/likec4diagram/ui/search/state.js +0 -63
- package/src/likec4diagram/ui/search/LikeC4Search.tsx +0 -301
- package/src/likec4diagram/ui/search/state.ts +0 -78
- /package/dist/{likec4diagram/ui/search → search/components}/ElementsColumn.css.d.ts +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/ViewsColumn.css.d.ts +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/ViewsColumn.css.js +0 -0
- /package/dist/{likec4diagram/ui/search → search/components}/_shared.css.d.ts +0 -0
- /package/src/{likec4diagram/ui/search → search/components}/ViewsColumn.css.ts +0 -0
|
@@ -2,7 +2,8 @@ import { ReactFlowState, ReactFlowInstance, InternalNode } from '@xyflow/react';
|
|
|
2
2
|
import { Types } from '../likec4diagram/types';
|
|
3
3
|
import { EdgeMarkerType, HandleType, XYPosition } from '@xyflow/system';
|
|
4
4
|
import { ReactNode, CSSProperties } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { Dimmed } from '../base/types.Base';
|
|
6
|
+
import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId } from '@likec4/core';
|
|
6
7
|
export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
|
|
7
8
|
id: string;
|
|
8
9
|
source: string;
|
|
@@ -33,18 +34,18 @@ export declare const useXYFlow: () => ReactFlowInstance<Types.Node, {
|
|
|
33
34
|
data: {
|
|
34
35
|
hovered?: boolean;
|
|
35
36
|
active?: boolean;
|
|
36
|
-
dimmed?:
|
|
37
|
+
dimmed?: Dimmed;
|
|
37
38
|
id: EdgeId;
|
|
38
39
|
label: string | null;
|
|
39
40
|
points: NonEmptyArray<Point>;
|
|
40
41
|
color: Color | undefined;
|
|
42
|
+
head: RelationshipArrowType | undefined;
|
|
41
43
|
line: RelationshipLineType | undefined;
|
|
42
44
|
dir: "forward" | "back" | "both" | undefined;
|
|
43
|
-
tail: RelationshipArrowType | undefined;
|
|
44
|
-
head: RelationshipArrowType | undefined;
|
|
45
45
|
technology: string | undefined;
|
|
46
|
+
tail: RelationshipArrowType | undefined;
|
|
46
47
|
labelBBox: BBox | null | undefined;
|
|
47
|
-
navigateTo: ViewId<string> | undefined;
|
|
48
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
48
49
|
notes: string | undefined;
|
|
49
50
|
labelXY: XYPosition | null;
|
|
50
51
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -82,18 +83,18 @@ export declare const useXYStoreApi: () => {
|
|
|
82
83
|
data: {
|
|
83
84
|
hovered?: boolean;
|
|
84
85
|
active?: boolean;
|
|
85
|
-
dimmed?:
|
|
86
|
+
dimmed?: Dimmed;
|
|
86
87
|
id: EdgeId;
|
|
87
88
|
label: string | null;
|
|
88
89
|
points: NonEmptyArray<Point>;
|
|
89
90
|
color: Color | undefined;
|
|
91
|
+
head: RelationshipArrowType | undefined;
|
|
90
92
|
line: RelationshipLineType | undefined;
|
|
91
93
|
dir: "forward" | "back" | "both" | undefined;
|
|
92
|
-
tail: RelationshipArrowType | undefined;
|
|
93
|
-
head: RelationshipArrowType | undefined;
|
|
94
94
|
technology: string | undefined;
|
|
95
|
+
tail: RelationshipArrowType | undefined;
|
|
95
96
|
labelBBox: BBox | null | undefined;
|
|
96
|
-
navigateTo: ViewId<string> | undefined;
|
|
97
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
97
98
|
notes: string | undefined;
|
|
98
99
|
labelXY: XYPosition | null;
|
|
99
100
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -129,18 +130,18 @@ export declare const useXYStoreApi: () => {
|
|
|
129
130
|
data: {
|
|
130
131
|
hovered?: boolean;
|
|
131
132
|
active?: boolean;
|
|
132
|
-
dimmed?:
|
|
133
|
+
dimmed?: Dimmed;
|
|
133
134
|
id: EdgeId;
|
|
134
135
|
label: string | null;
|
|
135
136
|
points: NonEmptyArray<Point>;
|
|
136
137
|
color: Color | undefined;
|
|
138
|
+
head: RelationshipArrowType | undefined;
|
|
137
139
|
line: RelationshipLineType | undefined;
|
|
138
140
|
dir: "forward" | "back" | "both" | undefined;
|
|
139
|
-
tail: RelationshipArrowType | undefined;
|
|
140
|
-
head: RelationshipArrowType | undefined;
|
|
141
141
|
technology: string | undefined;
|
|
142
|
+
tail: RelationshipArrowType | undefined;
|
|
142
143
|
labelBBox: BBox | null | undefined;
|
|
143
|
-
navigateTo: ViewId<string> | undefined;
|
|
144
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
144
145
|
notes: string | undefined;
|
|
145
146
|
labelXY: XYPosition | null;
|
|
146
147
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -175,18 +176,18 @@ export declare const useXYStoreApi: () => {
|
|
|
175
176
|
data: {
|
|
176
177
|
hovered?: boolean;
|
|
177
178
|
active?: boolean;
|
|
178
|
-
dimmed?:
|
|
179
|
+
dimmed?: Dimmed;
|
|
179
180
|
id: EdgeId;
|
|
180
181
|
label: string | null;
|
|
181
182
|
points: NonEmptyArray<Point>;
|
|
182
183
|
color: Color | undefined;
|
|
184
|
+
head: RelationshipArrowType | undefined;
|
|
183
185
|
line: RelationshipLineType | undefined;
|
|
184
186
|
dir: "forward" | "back" | "both" | undefined;
|
|
185
|
-
tail: RelationshipArrowType | undefined;
|
|
186
|
-
head: RelationshipArrowType | undefined;
|
|
187
187
|
technology: string | undefined;
|
|
188
|
+
tail: RelationshipArrowType | undefined;
|
|
188
189
|
labelBBox: BBox | null | undefined;
|
|
189
|
-
navigateTo: ViewId<string> | undefined;
|
|
190
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
190
191
|
notes: string | undefined;
|
|
191
192
|
labelXY: XYPosition | null;
|
|
192
193
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -221,18 +222,18 @@ export declare const useXYStoreApi: () => {
|
|
|
221
222
|
data: {
|
|
222
223
|
hovered?: boolean;
|
|
223
224
|
active?: boolean;
|
|
224
|
-
dimmed?:
|
|
225
|
+
dimmed?: Dimmed;
|
|
225
226
|
id: EdgeId;
|
|
226
227
|
label: string | null;
|
|
227
228
|
points: NonEmptyArray<Point>;
|
|
228
229
|
color: Color | undefined;
|
|
230
|
+
head: RelationshipArrowType | undefined;
|
|
229
231
|
line: RelationshipLineType | undefined;
|
|
230
232
|
dir: "forward" | "back" | "both" | undefined;
|
|
231
|
-
tail: RelationshipArrowType | undefined;
|
|
232
|
-
head: RelationshipArrowType | undefined;
|
|
233
233
|
technology: string | undefined;
|
|
234
|
+
tail: RelationshipArrowType | undefined;
|
|
234
235
|
labelBBox: BBox | null | undefined;
|
|
235
|
-
navigateTo: ViewId<string> | undefined;
|
|
236
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
236
237
|
notes: string | undefined;
|
|
237
238
|
labelXY: XYPosition | null;
|
|
238
239
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -267,18 +268,18 @@ export declare const useXYStoreApi: () => {
|
|
|
267
268
|
data: {
|
|
268
269
|
hovered?: boolean;
|
|
269
270
|
active?: boolean;
|
|
270
|
-
dimmed?:
|
|
271
|
+
dimmed?: Dimmed;
|
|
271
272
|
id: EdgeId;
|
|
272
273
|
label: string | null;
|
|
273
274
|
points: NonEmptyArray<Point>;
|
|
274
275
|
color: Color | undefined;
|
|
276
|
+
head: RelationshipArrowType | undefined;
|
|
275
277
|
line: RelationshipLineType | undefined;
|
|
276
278
|
dir: "forward" | "back" | "both" | undefined;
|
|
277
|
-
tail: RelationshipArrowType | undefined;
|
|
278
|
-
head: RelationshipArrowType | undefined;
|
|
279
279
|
technology: string | undefined;
|
|
280
|
+
tail: RelationshipArrowType | undefined;
|
|
280
281
|
labelBBox: BBox | null | undefined;
|
|
281
|
-
navigateTo: ViewId<string> | undefined;
|
|
282
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
282
283
|
notes: string | undefined;
|
|
283
284
|
labelXY: XYPosition | null;
|
|
284
285
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -313,18 +314,18 @@ export declare const useXYStoreApi: () => {
|
|
|
313
314
|
data: {
|
|
314
315
|
hovered?: boolean;
|
|
315
316
|
active?: boolean;
|
|
316
|
-
dimmed?:
|
|
317
|
+
dimmed?: Dimmed;
|
|
317
318
|
id: EdgeId;
|
|
318
319
|
label: string | null;
|
|
319
320
|
points: NonEmptyArray<Point>;
|
|
320
321
|
color: Color | undefined;
|
|
322
|
+
head: RelationshipArrowType | undefined;
|
|
321
323
|
line: RelationshipLineType | undefined;
|
|
322
324
|
dir: "forward" | "back" | "both" | undefined;
|
|
323
|
-
tail: RelationshipArrowType | undefined;
|
|
324
|
-
head: RelationshipArrowType | undefined;
|
|
325
325
|
technology: string | undefined;
|
|
326
|
+
tail: RelationshipArrowType | undefined;
|
|
326
327
|
labelBBox: BBox | null | undefined;
|
|
327
|
-
navigateTo: ViewId<string> | undefined;
|
|
328
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
328
329
|
notes: string | undefined;
|
|
329
330
|
labelXY: XYPosition | null;
|
|
330
331
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -360,18 +361,18 @@ export declare const useXYStoreApi: () => {
|
|
|
360
361
|
data: {
|
|
361
362
|
hovered?: boolean;
|
|
362
363
|
active?: boolean;
|
|
363
|
-
dimmed?:
|
|
364
|
+
dimmed?: Dimmed;
|
|
364
365
|
id: EdgeId;
|
|
365
366
|
label: string | null;
|
|
366
367
|
points: NonEmptyArray<Point>;
|
|
367
368
|
color: Color | undefined;
|
|
369
|
+
head: RelationshipArrowType | undefined;
|
|
368
370
|
line: RelationshipLineType | undefined;
|
|
369
371
|
dir: "forward" | "back" | "both" | undefined;
|
|
370
|
-
tail: RelationshipArrowType | undefined;
|
|
371
|
-
head: RelationshipArrowType | undefined;
|
|
372
372
|
technology: string | undefined;
|
|
373
|
+
tail: RelationshipArrowType | undefined;
|
|
373
374
|
labelBBox: BBox | null | undefined;
|
|
374
|
-
navigateTo: ViewId<string> | undefined;
|
|
375
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
375
376
|
notes: string | undefined;
|
|
376
377
|
labelXY: XYPosition | null;
|
|
377
378
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -406,18 +407,18 @@ export declare const useXYStoreApi: () => {
|
|
|
406
407
|
data: {
|
|
407
408
|
hovered?: boolean;
|
|
408
409
|
active?: boolean;
|
|
409
|
-
dimmed?:
|
|
410
|
+
dimmed?: Dimmed;
|
|
410
411
|
id: EdgeId;
|
|
411
412
|
label: string | null;
|
|
412
413
|
points: NonEmptyArray<Point>;
|
|
413
414
|
color: Color | undefined;
|
|
415
|
+
head: RelationshipArrowType | undefined;
|
|
414
416
|
line: RelationshipLineType | undefined;
|
|
415
417
|
dir: "forward" | "back" | "both" | undefined;
|
|
416
|
-
tail: RelationshipArrowType | undefined;
|
|
417
|
-
head: RelationshipArrowType | undefined;
|
|
418
418
|
technology: string | undefined;
|
|
419
|
+
tail: RelationshipArrowType | undefined;
|
|
419
420
|
labelBBox: BBox | null | undefined;
|
|
420
|
-
navigateTo: ViewId<string> | undefined;
|
|
421
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
421
422
|
notes: string | undefined;
|
|
422
423
|
labelXY: XYPosition | null;
|
|
423
424
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -426,4 +427,5 @@ export declare const useXYStoreApi: () => {
|
|
|
426
427
|
};
|
|
427
428
|
export type XYStoreApi = ReturnType<typeof useXYStoreApi>;
|
|
428
429
|
export declare const useXYInternalNode: (id: string) => InternalNode<Types.Node> | undefined;
|
|
430
|
+
export declare function useCurrentZoom(): number;
|
|
429
431
|
export declare function useIsZoomTooSmall(): boolean;
|
package/dist/hooks/useXYFlow.js
CHANGED
|
@@ -11,9 +11,13 @@ function useXYStore(selector, equalityFn) {
|
|
|
11
11
|
}
|
|
12
12
|
const useXYStoreApi = useStoreApi;
|
|
13
13
|
const useXYInternalNode = useInternalNode;
|
|
14
|
+
const selectCurrentZoom = (state) => Math.round(state.transform[2] * 100) / 100;
|
|
15
|
+
function useCurrentZoom() {
|
|
16
|
+
return useStore(selectCurrentZoom);
|
|
17
|
+
}
|
|
14
18
|
const selectZoom = (state) => state.transform[2] < 0.2;
|
|
15
19
|
function useIsZoomTooSmall() {
|
|
16
20
|
return useStore(selectZoom);
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
export { useIsZoomTooSmall, useXYFlow, useXYInternalNode, useXYStore, useXYStoreApi };
|
|
23
|
+
export { useCurrentZoom, useIsZoomTooSmall, useXYFlow, useXYInternalNode, useXYStore, useXYStoreApi };
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { useEnabledFeatures } from './context/DiagramFeatures.js';
|
|
|
9
9
|
export { useCurrentViewId } from './hooks/useCurrentViewId.js';
|
|
10
10
|
export { useDiagram, useDiagramContext } from './hooks/useDiagram.js';
|
|
11
11
|
export { useXYFlow, useXYInternalNode, useXYStore, useXYStoreApi } from './hooks/useXYFlow.js';
|
|
12
|
-
export { useLikeC4Model } from './likec4model/useLikeC4Model.js';
|
|
12
|
+
export { useLikeC4Model, useLikeC4Specification } from './likec4model/useLikeC4Model.js';
|
|
13
13
|
export { useMantinePortalProps } from './hooks/useMantinePortalProps.js';
|
|
14
14
|
export { useSetState } from './hooks/useSetState.js';
|
|
15
15
|
export { useUpdateEffect } from './hooks/useUpdateEffect.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { useOverlaysActorRef } from '../hooks/useOverlaysActor.js';
|
|
4
|
+
import { useSearchActorRef } from '../hooks/useSearchActor.js';
|
|
4
5
|
import { Overlays } from '../overlays/Overlays.js';
|
|
6
|
+
import { Search } from '../search/Search.js';
|
|
5
7
|
import { useEnabledFeatures } from '../context/DiagramFeatures.js';
|
|
6
8
|
import { Controls } from './ui/controls/Controls.js';
|
|
7
9
|
import { DiagramTitlePanel } from './ui/diagram-title/DiagramTitlePanel.js';
|
|
@@ -12,15 +14,18 @@ const DiagramUI = memo(() => {
|
|
|
12
14
|
const {
|
|
13
15
|
enableViewTitle,
|
|
14
16
|
enableNotations,
|
|
15
|
-
enableDynamicViewWalkthrough
|
|
17
|
+
enableDynamicViewWalkthrough,
|
|
18
|
+
enableSearch
|
|
16
19
|
} = useEnabledFeatures();
|
|
17
20
|
const overlaysActorRef = useOverlaysActorRef();
|
|
21
|
+
const searchActorRef = useSearchActorRef();
|
|
18
22
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
23
|
/* @__PURE__ */ jsx(Controls, {}),
|
|
20
24
|
overlaysActorRef && /* @__PURE__ */ jsx(Overlays, { overlaysActorRef }),
|
|
21
25
|
enableViewTitle && /* @__PURE__ */ jsx(DiagramTitlePanel, {}),
|
|
22
26
|
enableNotations && /* @__PURE__ */ jsx(NotationPanel, {}),
|
|
23
|
-
enableDynamicViewWalkthrough && /* @__PURE__ */ jsx(DynamicViewWalkthrough, {})
|
|
27
|
+
enableDynamicViewWalkthrough && /* @__PURE__ */ jsx(DynamicViewWalkthrough, {}),
|
|
28
|
+
enableSearch && searchActorRef && /* @__PURE__ */ jsx(Search, { searchActorRef })
|
|
24
29
|
] });
|
|
25
30
|
});
|
|
26
31
|
DiagramUI.displayName = "DiagramUI";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { Simplify } from 'type-fest';
|
|
2
3
|
import { LikeC4DiagramProperties } from '../LikeC4Diagram.props';
|
|
3
|
-
export type LikeC4DiagramXYFlowProps = PropsWithChildren<Pick<LikeC4DiagramProperties
|
|
4
|
-
export declare
|
|
4
|
+
export type LikeC4DiagramXYFlowProps = PropsWithChildren<Simplify<Pick<LikeC4DiagramProperties<any>, 'background' | 'nodesDraggable' | 'nodesSelectable' | 'reactFlowProps' | 'renderNodes'>>>;
|
|
5
|
+
export declare function LikeC4DiagramXYFlow({ background, nodesDraggable, nodesSelectable, reactFlowProps, children, renderNodes, }: LikeC4DiagramXYFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { nonNullable } from '@likec4/core';
|
|
3
3
|
import { cx } from '@likec4/styles/css';
|
|
4
4
|
import { useTimeout, useDebouncedCallback, useCallbackRef } from '@mantine/hooks';
|
|
5
5
|
import { useCustomCompareMemo } from '@react-hookz/web';
|
|
6
|
-
import { shallowEqual
|
|
7
|
-
import { memo } from 'react';
|
|
6
|
+
import { shallowEqual } from 'fast-equals';
|
|
8
7
|
import { BaseXYFlow } from '../base/BaseXYFlow.js';
|
|
9
8
|
import { useIsReducedGraphics, usePanningAtom } from '../context/ReduceGraphics.js';
|
|
10
9
|
import { useDiagram, useDiagramContext } from '../hooks/useDiagram.js';
|
|
@@ -32,15 +31,14 @@ const selectXYProps = (ctx) => ({
|
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
33
|
const equalsXYProps = (a, b) => a.initialized === b.initialized && a.pannable === b.pannable && a.zoomable === b.zoomable && a.fitViewPadding === b.fitViewPadding && a.enableFitView === b.enableFitView && a.enableReadOnly === b.enableReadOnly && shallowEqual(a.nodes, b.nodes) && shallowEqual(a.edges, b.edges) && shallowEqual(a.viewport ?? null, b.viewport ?? null);
|
|
35
|
-
|
|
36
|
-
const LikeC4DiagramXYFlow = memo(({
|
|
34
|
+
function LikeC4DiagramXYFlow({
|
|
37
35
|
background = "dots",
|
|
38
36
|
nodesDraggable = false,
|
|
39
37
|
nodesSelectable = false,
|
|
40
38
|
reactFlowProps = {},
|
|
41
39
|
children,
|
|
42
40
|
renderNodes
|
|
43
|
-
})
|
|
41
|
+
}) {
|
|
44
42
|
const diagram = useDiagram();
|
|
45
43
|
const {
|
|
46
44
|
initialized,
|
|
@@ -96,107 +94,106 @@ const LikeC4DiagramXYFlow = memo(({
|
|
|
96
94
|
);
|
|
97
95
|
useUpdateEffect(() => {
|
|
98
96
|
console.warn("renderNodes changed - this might degrade performance");
|
|
99
|
-
}, [
|
|
100
|
-
return /* @__PURE__ */ jsxs(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
e
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
e
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
e
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
e
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
_event
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
_event
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
_event
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
_event
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
/* @__PURE__ */ jsx(DiagramUI, {}, "DiagramUI"),
|
|
97
|
+
}, [nodeTypes]);
|
|
98
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
BaseXYFlow,
|
|
101
|
+
{
|
|
102
|
+
nodes,
|
|
103
|
+
edges,
|
|
104
|
+
className: cx(initialized ? "initialized" : "not-initialized"),
|
|
105
|
+
nodeTypes,
|
|
106
|
+
edgeTypes,
|
|
107
|
+
onNodesChange: useCallbackRef((changes) => {
|
|
108
|
+
diagram.send({ type: "xyflow.applyNodeChanges", changes });
|
|
109
|
+
}),
|
|
110
|
+
onEdgesChange: useCallbackRef((changes) => {
|
|
111
|
+
diagram.send({ type: "xyflow.applyEdgeChanges", changes });
|
|
112
|
+
}),
|
|
113
|
+
background: initialized ? background : "transparent",
|
|
114
|
+
fitView: false,
|
|
115
|
+
onNodeClick: useCallbackRef((e, node) => {
|
|
116
|
+
e.stopPropagation();
|
|
117
|
+
diagram.send({ type: "xyflow.nodeClick", node });
|
|
118
|
+
onNodeClick?.(diagram.findDiagramNode(node.id), e);
|
|
119
|
+
}),
|
|
120
|
+
onEdgeClick: useCallbackRef((e, edge) => {
|
|
121
|
+
e.stopPropagation();
|
|
122
|
+
diagram.send({ type: "xyflow.edgeClick", edge });
|
|
123
|
+
onEdgeClick?.(diagram.findDiagramEdge(edge.id), e);
|
|
124
|
+
}),
|
|
125
|
+
onPaneClick: useCallbackRef((e) => {
|
|
126
|
+
e.stopPropagation();
|
|
127
|
+
diagram.send({ type: "xyflow.paneClick" });
|
|
128
|
+
onCanvasClick?.(e);
|
|
129
|
+
}),
|
|
130
|
+
onDoubleClick: useCallbackRef((e) => {
|
|
131
|
+
e.stopPropagation();
|
|
132
|
+
e.preventDefault();
|
|
133
|
+
diagram.send({ type: "xyflow.paneDblClick" });
|
|
134
|
+
onCanvasDblClick?.(e);
|
|
135
|
+
}),
|
|
136
|
+
onNodeMouseEnter: useCallbackRef((_event, node) => {
|
|
137
|
+
_event.stopPropagation();
|
|
138
|
+
if (!node.data.hovered) {
|
|
139
|
+
diagram.send({ type: "xyflow.nodeMouseEnter", node });
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
onNodeMouseLeave: useCallbackRef((_event, node) => {
|
|
143
|
+
_event.stopPropagation();
|
|
144
|
+
if (node.data.hovered) {
|
|
145
|
+
diagram.send({ type: "xyflow.nodeMouseLeave", node });
|
|
146
|
+
}
|
|
147
|
+
}),
|
|
148
|
+
onEdgeMouseEnter: useCallbackRef((_event, edge) => {
|
|
149
|
+
_event.stopPropagation();
|
|
150
|
+
if (!edge.data.hovered) {
|
|
151
|
+
diagram.send({ type: "xyflow.edgeMouseEnter", edge });
|
|
152
|
+
}
|
|
153
|
+
}),
|
|
154
|
+
onEdgeMouseLeave: useCallbackRef((_event, edge) => {
|
|
155
|
+
_event.stopPropagation();
|
|
156
|
+
if (edge.data.hovered) {
|
|
157
|
+
diagram.send({ type: "xyflow.edgeMouseLeave", edge });
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
...props.pannable && {
|
|
161
|
+
onMove
|
|
162
|
+
},
|
|
163
|
+
onMoveEnd,
|
|
164
|
+
onInit: useCallbackRef((instance) => {
|
|
165
|
+
diagram.send({ type: "xyflow.init", instance });
|
|
166
|
+
}),
|
|
167
|
+
onNodeContextMenu: useCallbackRef((event, node) => {
|
|
168
|
+
const diagramNode = nonNullable(
|
|
169
|
+
diagram.findDiagramNode(node.id),
|
|
170
|
+
`diagramNode ${node.id} not found`
|
|
171
|
+
);
|
|
172
|
+
onNodeContextMenu?.(diagramNode, event);
|
|
173
|
+
}),
|
|
174
|
+
onEdgeContextMenu: useCallbackRef((event, edge) => {
|
|
175
|
+
const diagramEdge = nonNullable(
|
|
176
|
+
diagram.findDiagramEdge(edge.id),
|
|
177
|
+
`diagramEdge ${edge.id} not found`
|
|
178
|
+
);
|
|
179
|
+
onEdgeContextMenu?.(diagramEdge, event);
|
|
180
|
+
}),
|
|
181
|
+
onPaneContextMenu: useCallbackRef((event) => {
|
|
182
|
+
onCanvasContextMenu?.(event);
|
|
183
|
+
}),
|
|
184
|
+
...enableFitView && {
|
|
185
|
+
onViewportResize
|
|
186
|
+
},
|
|
187
|
+
nodesDraggable: notReadOnly && nodesDraggable,
|
|
188
|
+
nodesSelectable,
|
|
189
|
+
...notReadOnly && nodesDraggable && layoutConstraints,
|
|
190
|
+
...props,
|
|
191
|
+
...reactFlowProps,
|
|
195
192
|
children
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
/* @__PURE__ */ jsx(DiagramUI, {}, "DiagramUI")
|
|
196
|
+
] });
|
|
197
|
+
}
|
|
201
198
|
|
|
202
199
|
export { LikeC4DiagramXYFlow };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { EdgeId, NonEmptyArray, Point, Color,
|
|
1
|
+
import { EdgeId, NonEmptyArray, Point, Color, RelationshipArrowType, RelationshipLineType, BBox, ViewId } from '@likec4/core';
|
|
2
2
|
import { XYPosition } from '@xyflow/react';
|
|
3
3
|
import { FunctionComponent, CSSProperties, ReactNode } from 'react';
|
|
4
4
|
import { Position } from '@xyflow/system';
|
|
5
|
+
import { EdgeData, Dimmed } from '../../../base/types.Base';
|
|
5
6
|
export declare const RelationshipEdge: FunctionComponent<{
|
|
6
7
|
id: string;
|
|
7
8
|
selected?: boolean;
|
|
@@ -29,21 +30,21 @@ export declare const RelationshipEdge: FunctionComponent<{
|
|
|
29
30
|
markerEnd?: string;
|
|
30
31
|
pathOptions?: any;
|
|
31
32
|
interactionWidth?: number;
|
|
32
|
-
data:
|
|
33
|
+
data: EdgeData & {
|
|
33
34
|
hovered?: boolean;
|
|
34
35
|
active?: boolean;
|
|
35
|
-
dimmed?:
|
|
36
|
+
dimmed?: Dimmed;
|
|
36
37
|
id: EdgeId;
|
|
37
38
|
label: string | null;
|
|
38
39
|
points: NonEmptyArray<Point>;
|
|
39
40
|
color: Color | undefined;
|
|
41
|
+
head: RelationshipArrowType | undefined;
|
|
40
42
|
line: RelationshipLineType | undefined;
|
|
41
43
|
dir: "forward" | "back" | "both" | undefined;
|
|
42
|
-
tail: RelationshipArrowType | undefined;
|
|
43
|
-
head: RelationshipArrowType | undefined;
|
|
44
44
|
technology: string | undefined;
|
|
45
|
+
tail: RelationshipArrowType | undefined;
|
|
45
46
|
labelBBox: BBox | null | undefined;
|
|
46
|
-
navigateTo: ViewId<string> | undefined;
|
|
47
|
+
navigateTo: ViewId<string> | null | undefined;
|
|
47
48
|
notes: string | undefined;
|
|
48
49
|
labelXY: XYPosition | null;
|
|
49
50
|
controlPoints: XYPosition[] | undefined | null;
|
|
@@ -158,6 +158,10 @@ const RelationshipEdge = customEdge((props) => {
|
|
|
158
158
|
}
|
|
159
159
|
setIsControlPointDragging(false);
|
|
160
160
|
};
|
|
161
|
+
const onClick = (e2) => {
|
|
162
|
+
e2.stopPropagation();
|
|
163
|
+
e2.preventDefault();
|
|
164
|
+
};
|
|
161
165
|
domNode.addEventListener("pointermove", onPointerMove, {
|
|
162
166
|
capture: true
|
|
163
167
|
});
|
|
@@ -165,6 +169,10 @@ const RelationshipEdge = customEdge((props) => {
|
|
|
165
169
|
once: true,
|
|
166
170
|
capture: true
|
|
167
171
|
});
|
|
172
|
+
domNode.addEventListener("click", onClick, {
|
|
173
|
+
capture: true,
|
|
174
|
+
once: true
|
|
175
|
+
});
|
|
168
176
|
};
|
|
169
177
|
const onRmbControlPointerDown = (index, e, domNode) => {
|
|
170
178
|
if (controlPoints.length <= 1) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { nameFromFqn } from '@likec4/core';
|
|
3
3
|
import { cx, css } from '@likec4/styles/css';
|
|
4
4
|
import { Menu, MenuTarget, MenuDropdown, MenuLabel, MenuDivider, Box, ActionIcon, MenuItem, Stack, Group, Text, TooltipGroup, Space, Tooltip as Tooltip$1 } from '@mantine/core';
|
|
5
5
|
import { IconInfoCircle, IconArrowRight, IconZoomScan, IconFileSymlink } from '@tabler/icons-react';
|
|
@@ -33,13 +33,15 @@ const RelationshipsDropdownMenu = memo(({
|
|
|
33
33
|
children
|
|
34
34
|
}) => {
|
|
35
35
|
const { diagramEdge, sourceNode, targetNode } = useDiagramContext(
|
|
36
|
-
|
|
36
|
+
(ctx) => ({
|
|
37
37
|
diagramEdge: findDiagramEdge(ctx, edgeId),
|
|
38
38
|
sourceNode: findDiagramNode(ctx, source),
|
|
39
39
|
targetNode: findDiagramNode(ctx, target)
|
|
40
|
-
}),
|
|
40
|
+
}),
|
|
41
|
+
void 0,
|
|
42
|
+
[edgeId, source, target]
|
|
41
43
|
);
|
|
42
|
-
const likec4model = useLikeC4Model(
|
|
44
|
+
const likec4model = useLikeC4Model();
|
|
43
45
|
const diagram = useDiagram();
|
|
44
46
|
const portalProps = useMantinePortalProps();
|
|
45
47
|
const onClickOpenOverlay = useCallback((e) => {
|
|
@@ -203,7 +205,7 @@ const Relationship = forwardRef(({
|
|
|
203
205
|
] });
|
|
204
206
|
});
|
|
205
207
|
function getShortId(r, actualEndpointId, diagramNode) {
|
|
206
|
-
const diagramNodeId = r.isDeploymentRelation() ? diagramNode.id :
|
|
208
|
+
const diagramNodeId = r.isDeploymentRelation() ? diagramNode.id : diagramNode.modelRef || "";
|
|
207
209
|
return nameFromFqn(diagramNodeId) + actualEndpointId.slice(diagramNodeId.length);
|
|
208
210
|
}
|
|
209
211
|
|