@uipath/apollo-react 4.45.1 → 4.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +2 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +2 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +0 -33
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +0 -2
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +1 -28
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +2 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +2 -1
- package/dist/canvas/components/Edges/CanvasEdge.cjs +197 -0
- package/dist/canvas/components/Edges/CanvasEdge.d.ts +3 -0
- package/dist/canvas/components/Edges/CanvasEdge.d.ts.map +1 -0
- package/dist/canvas/components/Edges/CanvasEdge.js +163 -0
- package/dist/canvas/components/Edges/SequenceEdge.cjs +18 -200
- package/dist/canvas/components/Edges/SequenceEdge.d.ts +2 -2
- package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.js +19 -201
- package/dist/canvas/components/Edges/index.cjs +32 -3
- package/dist/canvas/components/Edges/index.d.ts +4 -0
- package/dist/canvas/components/Edges/index.d.ts.map +1 -1
- package/dist/canvas/components/Edges/index.js +3 -0
- package/dist/canvas/components/Edges/shared/areEdgePropsEqual.cjs +54 -0
- package/dist/canvas/components/Edges/shared/areEdgePropsEqual.d.ts +3 -0
- package/dist/canvas/components/Edges/shared/areEdgePropsEqual.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/areEdgePropsEqual.js +20 -0
- package/dist/canvas/components/Edges/shared/constants.cjs +107 -0
- package/dist/canvas/components/Edges/shared/constants.d.ts +33 -0
- package/dist/canvas/components/Edges/shared/constants.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/constants.js +55 -0
- package/dist/canvas/components/Edges/shared/geometry.cjs +489 -0
- package/dist/canvas/components/Edges/shared/geometry.d.ts +20 -0
- package/dist/canvas/components/Edges/shared/geometry.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/geometry.js +416 -0
- package/dist/canvas/components/Edges/shared/hooks/index.cjs +48 -0
- package/dist/canvas/components/Edges/shared/hooks/index.d.ts +5 -0
- package/dist/canvas/components/Edges/shared/hooks/index.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/index.js +5 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.cjs +103 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.d.ts +30 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeGeometry.js +69 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeWaypointWriter.cjs +69 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeWaypointWriter.d.ts +3 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeWaypointWriter.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useEdgeWaypointWriter.js +35 -0
- package/dist/canvas/components/Edges/shared/hooks/useExecutionEdge.cjs +57 -0
- package/dist/canvas/components/Edges/shared/hooks/useExecutionEdge.d.ts +13 -0
- package/dist/canvas/components/Edges/shared/hooks/useExecutionEdge.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useExecutionEdge.js +23 -0
- package/dist/canvas/components/Edges/shared/hooks/useNodeDragRebalance.cjs +98 -0
- package/dist/canvas/components/Edges/shared/hooks/useNodeDragRebalance.d.ts +18 -0
- package/dist/canvas/components/Edges/shared/hooks/useNodeDragRebalance.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useNodeDragRebalance.js +64 -0
- package/dist/canvas/components/Edges/shared/hooks/useWaypointEditor.cjs +184 -0
- package/dist/canvas/components/Edges/shared/hooks/useWaypointEditor.d.ts +23 -0
- package/dist/canvas/components/Edges/shared/hooks/useWaypointEditor.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/hooks/useWaypointEditor.js +150 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.cjs +57 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.d.ts +10 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeArrow.js +23 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.cjs +66 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.d.ts +8 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgeLabel.js +32 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.cjs +84 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.d.ts +16 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/EdgePath.js +50 -0
- package/dist/canvas/components/Edges/shared/primitives/SegmentDragHandle.cjs +117 -0
- package/dist/canvas/components/Edges/shared/primitives/SegmentDragHandle.d.ts +9 -0
- package/dist/canvas/components/Edges/shared/primitives/SegmentDragHandle.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/SegmentDragHandle.js +83 -0
- package/dist/canvas/components/Edges/shared/primitives/WaypointHandle.cjs +75 -0
- package/dist/canvas/components/Edges/shared/primitives/WaypointHandle.d.ts +10 -0
- package/dist/canvas/components/Edges/shared/primitives/WaypointHandle.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/WaypointHandle.js +41 -0
- package/dist/canvas/components/Edges/shared/primitives/index.cjs +52 -0
- package/dist/canvas/components/Edges/shared/primitives/index.d.ts +11 -0
- package/dist/canvas/components/Edges/shared/primitives/index.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/primitives/index.js +6 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.cjs +46 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.d.ts +11 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/resolveEdgeColor.js +12 -0
- package/dist/canvas/components/Edges/shared/routing/defaultEdgeRouter.cjs +51 -0
- package/dist/canvas/components/Edges/shared/routing/defaultEdgeRouter.d.ts +3 -0
- package/dist/canvas/components/Edges/shared/routing/defaultEdgeRouter.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/routing/defaultEdgeRouter.js +17 -0
- package/dist/canvas/components/Edges/shared/routing/index.cjs +43 -0
- package/dist/canvas/components/Edges/shared/routing/index.d.ts +4 -0
- package/dist/canvas/components/Edges/shared/routing/index.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/routing/index.js +3 -0
- package/dist/canvas/components/Edges/shared/routing/types.cjs +18 -0
- package/dist/canvas/components/Edges/shared/routing/types.d.ts +33 -0
- package/dist/canvas/components/Edges/shared/routing/types.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/routing/types.js +0 -0
- package/dist/canvas/components/Edges/shared/routing/useGraphRouter.cjs +175 -0
- package/dist/canvas/components/Edges/shared/routing/useGraphRouter.d.ts +5 -0
- package/dist/canvas/components/Edges/shared/routing/useGraphRouter.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/routing/useGraphRouter.js +138 -0
- package/dist/canvas/components/Edges/shared/types.cjs +18 -0
- package/dist/canvas/components/Edges/shared/types.d.ts +36 -0
- package/dist/canvas/components/Edges/shared/types.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/types.js +0 -0
- package/dist/canvas/components/Edges/shared/waypoints.cjs +216 -0
- package/dist/canvas/components/Edges/shared/waypoints.d.ts +17 -0
- package/dist/canvas/components/Edges/shared/waypoints.d.ts.map +1 -0
- package/dist/canvas/components/Edges/shared/waypoints.js +158 -0
- package/dist/canvas/hooks/useEdgePath.cjs +6 -22
- package/dist/canvas/hooks/useEdgePath.d.ts +1 -1
- package/dist/canvas/hooks/useEdgePath.d.ts.map +1 -1
- package/dist/canvas/hooks/useEdgePath.js +5 -21
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/handle-positioning.cjs +62 -0
- package/dist/canvas/utils/handle-positioning.d.ts +2 -0
- package/dist/canvas/utils/handle-positioning.d.ts.map +1 -0
- package/dist/canvas/utils/handle-positioning.js +28 -0
- package/dist/canvas/utils/index.cjs +21 -14
- package/dist/canvas/utils/index.d.ts +1 -0
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWaypointEditor.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/hooks/useWaypointEditor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAS,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAqBrE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,UAAU,EAAE,UAAU,EAAE,CAAC;IAMzB,OAAO,EAAE,OAAO,CAAC;IAKjB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC1D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC7D,aAAa,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,OAAO,CAAC;IAEpB,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAaF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc,CAoJ7E"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { useReactFlow } from "../../../../xyflow/react.js";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { snapPointToGrid } from "../geometry.js";
|
|
4
|
+
import { insertWaypoint, materializePathWaypoints, moveSegmentByDelta, moveWaypoint, removeWaypoint, waypointsEqual } from "../waypoints.js";
|
|
5
|
+
import { useEdgeWaypointWriter } from "./useEdgeWaypointWriter.js";
|
|
6
|
+
function useWaypointEditor(args) {
|
|
7
|
+
const { edgeId, waypoints, pathPoints, enabled, onChange } = args;
|
|
8
|
+
const { screenToFlowPosition } = useReactFlow();
|
|
9
|
+
const writeWaypoints = useEdgeWaypointWriter(edgeId, onChange);
|
|
10
|
+
const [dragState, setDragState] = useState({
|
|
11
|
+
type: 'none'
|
|
12
|
+
});
|
|
13
|
+
const dragStartRef = useRef(null);
|
|
14
|
+
const rafRef = useRef(null);
|
|
15
|
+
const waypointsRef = useRef(waypoints);
|
|
16
|
+
const pathPointsRef = useRef(pathPoints);
|
|
17
|
+
useEffect(()=>{
|
|
18
|
+
waypointsRef.current = waypoints;
|
|
19
|
+
pathPointsRef.current = pathPoints;
|
|
20
|
+
});
|
|
21
|
+
const updateWaypoints = useCallback((next)=>{
|
|
22
|
+
if (waypointsEqual(waypointsRef.current, next)) return;
|
|
23
|
+
writeWaypoints(next);
|
|
24
|
+
}, [
|
|
25
|
+
writeWaypoints
|
|
26
|
+
]);
|
|
27
|
+
useEffect(()=>{
|
|
28
|
+
if (!enabled || 'none' === dragState.type) return;
|
|
29
|
+
const handleMouseMove = (e)=>{
|
|
30
|
+
if (!dragStartRef.current) return;
|
|
31
|
+
if (null !== rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
32
|
+
rafRef.current = requestAnimationFrame(()=>{
|
|
33
|
+
const start = screenToFlowPosition(dragStartRef.current, {
|
|
34
|
+
snapToGrid: false
|
|
35
|
+
});
|
|
36
|
+
const current = screenToFlowPosition({
|
|
37
|
+
x: e.clientX,
|
|
38
|
+
y: e.clientY
|
|
39
|
+
}, {
|
|
40
|
+
snapToGrid: false
|
|
41
|
+
});
|
|
42
|
+
const delta = {
|
|
43
|
+
x: current.x - start.x,
|
|
44
|
+
y: current.y - start.y
|
|
45
|
+
};
|
|
46
|
+
if ('waypoint' === dragState.type) {
|
|
47
|
+
const initial = dragState.initialWaypoints[dragState.waypointIndex];
|
|
48
|
+
if (!initial) return;
|
|
49
|
+
updateWaypoints(moveWaypoint(dragState.initialWaypoints, dragState.waypointIndex, {
|
|
50
|
+
x: initial.x + delta.x,
|
|
51
|
+
y: initial.y + delta.y
|
|
52
|
+
}));
|
|
53
|
+
} else if ('segment' === dragState.type) updateWaypoints(moveSegmentByDelta(dragState.initialWaypoints, dragState.segment, delta, dragState.initialPathPoints));
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const handleMouseUp = ()=>{
|
|
57
|
+
if (null !== rafRef.current) {
|
|
58
|
+
cancelAnimationFrame(rafRef.current);
|
|
59
|
+
rafRef.current = null;
|
|
60
|
+
}
|
|
61
|
+
setDragState({
|
|
62
|
+
type: 'none'
|
|
63
|
+
});
|
|
64
|
+
dragStartRef.current = null;
|
|
65
|
+
};
|
|
66
|
+
window.addEventListener('mousemove', handleMouseMove);
|
|
67
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
68
|
+
return ()=>{
|
|
69
|
+
window.removeEventListener('mousemove', handleMouseMove);
|
|
70
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
71
|
+
if (null !== rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
72
|
+
};
|
|
73
|
+
}, [
|
|
74
|
+
enabled,
|
|
75
|
+
dragState,
|
|
76
|
+
updateWaypoints,
|
|
77
|
+
screenToFlowPosition
|
|
78
|
+
]);
|
|
79
|
+
const waypointHandlers = useMemo(()=>({
|
|
80
|
+
onMouseDown: (index, e)=>{
|
|
81
|
+
if (!enabled) return;
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
dragStartRef.current = {
|
|
85
|
+
x: e.clientX,
|
|
86
|
+
y: e.clientY
|
|
87
|
+
};
|
|
88
|
+
setDragState({
|
|
89
|
+
type: 'waypoint',
|
|
90
|
+
waypointIndex: index,
|
|
91
|
+
initialWaypoints: [
|
|
92
|
+
...waypointsRef.current
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
onDoubleClick: (index)=>{
|
|
97
|
+
if (!enabled) return;
|
|
98
|
+
updateWaypoints(removeWaypoint(waypointsRef.current, index));
|
|
99
|
+
}
|
|
100
|
+
}), [
|
|
101
|
+
enabled,
|
|
102
|
+
updateWaypoints
|
|
103
|
+
]);
|
|
104
|
+
const segmentHandlers = useMemo(()=>({
|
|
105
|
+
onMouseDown: (segment, e)=>{
|
|
106
|
+
if (!enabled) return;
|
|
107
|
+
e.stopPropagation();
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
dragStartRef.current = {
|
|
110
|
+
x: e.clientX,
|
|
111
|
+
y: e.clientY
|
|
112
|
+
};
|
|
113
|
+
const materialized = materializePathWaypoints(pathPointsRef.current, waypointsRef.current);
|
|
114
|
+
setDragState({
|
|
115
|
+
type: 'segment',
|
|
116
|
+
segment,
|
|
117
|
+
initialWaypoints: materialized,
|
|
118
|
+
initialPathPoints: [
|
|
119
|
+
...pathPointsRef.current
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
onDoubleClick: (segmentIndex, e)=>{
|
|
124
|
+
if (!enabled) return;
|
|
125
|
+
e.stopPropagation();
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
const flowPoint = screenToFlowPosition({
|
|
128
|
+
x: e.clientX,
|
|
129
|
+
y: e.clientY
|
|
130
|
+
});
|
|
131
|
+
const snapped = snapPointToGrid(flowPoint);
|
|
132
|
+
updateWaypoints(insertWaypoint(pathPointsRef.current, waypointsRef.current, segmentIndex, snapped));
|
|
133
|
+
}
|
|
134
|
+
}), [
|
|
135
|
+
enabled,
|
|
136
|
+
screenToFlowPosition,
|
|
137
|
+
updateWaypoints
|
|
138
|
+
]);
|
|
139
|
+
const isDragging = enabled && 'none' !== dragState.type;
|
|
140
|
+
return useMemo(()=>({
|
|
141
|
+
isDragging,
|
|
142
|
+
waypointHandlers,
|
|
143
|
+
segmentHandlers
|
|
144
|
+
}), [
|
|
145
|
+
isDragging,
|
|
146
|
+
waypointHandlers,
|
|
147
|
+
segmentHandlers
|
|
148
|
+
]);
|
|
149
|
+
}
|
|
150
|
+
export { useWaypointEditor };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
EdgeArrow: ()=>EdgeArrow
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
31
|
+
const { ARROW_SIZE, ARROW_HALF_ANGLE } = external_constants_cjs_namespaceObject.EDGE_CONSTANTS;
|
|
32
|
+
const ARROW_TRANSITION = 'fill 0.2s ease, opacity 0.2s ease';
|
|
33
|
+
function EdgeArrow({ target, angle, offset, color, opacity = 1 }) {
|
|
34
|
+
const tipX = target.x;
|
|
35
|
+
const tipY = target.y;
|
|
36
|
+
const leftX = tipX - ARROW_SIZE * Math.cos(angle - ARROW_HALF_ANGLE);
|
|
37
|
+
const leftY = tipY - ARROW_SIZE * Math.sin(angle - ARROW_HALF_ANGLE);
|
|
38
|
+
const rightX = tipX - ARROW_SIZE * Math.cos(angle + ARROW_HALF_ANGLE);
|
|
39
|
+
const rightY = tipY - ARROW_SIZE * Math.sin(angle + ARROW_HALF_ANGLE);
|
|
40
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("polygon", {
|
|
41
|
+
points: `${tipX},${tipY} ${leftX},${leftY} ${rightX},${rightY}`,
|
|
42
|
+
fill: color,
|
|
43
|
+
style: {
|
|
44
|
+
pointerEvents: 'none',
|
|
45
|
+
opacity,
|
|
46
|
+
transition: ARROW_TRANSITION,
|
|
47
|
+
transform: `translate(${offset.x}px, ${offset.y}px)`
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.EdgeArrow = __webpack_exports__.EdgeArrow;
|
|
52
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
53
|
+
"EdgeArrow"
|
|
54
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
55
|
+
Object.defineProperty(exports, '__esModule', {
|
|
56
|
+
value: true
|
|
57
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Point } from '../types';
|
|
2
|
+
export type EdgeArrowProps = {
|
|
3
|
+
target: Point;
|
|
4
|
+
angle: number;
|
|
5
|
+
offset: Point;
|
|
6
|
+
color: string;
|
|
7
|
+
opacity?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function EdgeArrow({ target, angle, offset, color, opacity }: EdgeArrowProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=EdgeArrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EdgeArrow.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/primitives/EdgeArrow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKtC,MAAM,MAAM,cAAc,GAAG;IAE3B,MAAM,EAAE,KAAK,CAAC;IAEd,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAW,EAAE,EAAE,cAAc,2CAoBtF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EDGE_CONSTANTS } from "../constants.js";
|
|
3
|
+
const { ARROW_SIZE, ARROW_HALF_ANGLE } = EDGE_CONSTANTS;
|
|
4
|
+
const ARROW_TRANSITION = 'fill 0.2s ease, opacity 0.2s ease';
|
|
5
|
+
function EdgeArrow({ target, angle, offset, color, opacity = 1 }) {
|
|
6
|
+
const tipX = target.x;
|
|
7
|
+
const tipY = target.y;
|
|
8
|
+
const leftX = tipX - ARROW_SIZE * Math.cos(angle - ARROW_HALF_ANGLE);
|
|
9
|
+
const leftY = tipY - ARROW_SIZE * Math.sin(angle - ARROW_HALF_ANGLE);
|
|
10
|
+
const rightX = tipX - ARROW_SIZE * Math.cos(angle + ARROW_HALF_ANGLE);
|
|
11
|
+
const rightY = tipY - ARROW_SIZE * Math.sin(angle + ARROW_HALF_ANGLE);
|
|
12
|
+
return /*#__PURE__*/ jsx("polygon", {
|
|
13
|
+
points: `${tipX},${tipY} ${leftX},${leftY} ${rightX},${rightY}`,
|
|
14
|
+
fill: color,
|
|
15
|
+
style: {
|
|
16
|
+
pointerEvents: 'none',
|
|
17
|
+
opacity,
|
|
18
|
+
transition: ARROW_TRANSITION,
|
|
19
|
+
transform: `translate(${offset.x}px, ${offset.y}px)`
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export { EdgeArrow };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
EdgeLabel: ()=>EdgeLabel
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
function EdgeLabel({ x, y, text, selected }) {
|
|
31
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("foreignObject", {
|
|
32
|
+
x: x,
|
|
33
|
+
y: y,
|
|
34
|
+
width: 1,
|
|
35
|
+
height: 1,
|
|
36
|
+
overflow: "visible",
|
|
37
|
+
style: {
|
|
38
|
+
pointerEvents: 'none'
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
41
|
+
className: "react-flow__edge-label nodrag nopan",
|
|
42
|
+
style: {
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
transform: 'translate(-50%, -50%)',
|
|
45
|
+
whiteSpace: 'nowrap',
|
|
46
|
+
pointerEvents: 'none',
|
|
47
|
+
color: 'var(--canvas-foreground)',
|
|
48
|
+
background: 'var(--canvas-background)',
|
|
49
|
+
padding: '4px 8px',
|
|
50
|
+
borderRadius: '4px',
|
|
51
|
+
fontSize: '12px',
|
|
52
|
+
fontWeight: 500,
|
|
53
|
+
border: `1px solid ${selected ? 'var(--canvas-primary)' : 'var(--canvas-border)'}`,
|
|
54
|
+
boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.1)'
|
|
55
|
+
},
|
|
56
|
+
children: text
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
exports.EdgeLabel = __webpack_exports__.EdgeLabel;
|
|
61
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
62
|
+
"EdgeLabel"
|
|
63
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
64
|
+
Object.defineProperty(exports, '__esModule', {
|
|
65
|
+
value: true
|
|
66
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EdgeLabel.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/primitives/EdgeLabel.tsx"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,cAAc,2CA+BjE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function EdgeLabel({ x, y, text, selected }) {
|
|
3
|
+
return /*#__PURE__*/ jsx("foreignObject", {
|
|
4
|
+
x: x,
|
|
5
|
+
y: y,
|
|
6
|
+
width: 1,
|
|
7
|
+
height: 1,
|
|
8
|
+
overflow: "visible",
|
|
9
|
+
style: {
|
|
10
|
+
pointerEvents: 'none'
|
|
11
|
+
},
|
|
12
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
13
|
+
className: "react-flow__edge-label nodrag nopan",
|
|
14
|
+
style: {
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
transform: 'translate(-50%, -50%)',
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
pointerEvents: 'none',
|
|
19
|
+
color: 'var(--canvas-foreground)',
|
|
20
|
+
background: 'var(--canvas-background)',
|
|
21
|
+
padding: '4px 8px',
|
|
22
|
+
borderRadius: '4px',
|
|
23
|
+
fontSize: '12px',
|
|
24
|
+
fontWeight: 500,
|
|
25
|
+
border: `1px solid ${selected ? 'var(--canvas-primary)' : 'var(--canvas-border)'}`,
|
|
26
|
+
boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.1)'
|
|
27
|
+
},
|
|
28
|
+
children: text
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export { EdgeLabel };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
EdgePath: ()=>EdgePath
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
31
|
+
const { INTERACTION_STROKE_WIDTH, STROKE_WIDTH, SELECTED_STROKE_WIDTH, SELECTED_OUTLINE_STROKE_WIDTH, SELECTED_OUTLINE_OPACITY } = external_constants_cjs_namespaceObject.EDGE_CONSTANTS;
|
|
32
|
+
function EdgePath(props) {
|
|
33
|
+
const { d, color, selected, animated, strokeStyle, isReadOnly, pathRef, id, style, opacity = 1 } = props;
|
|
34
|
+
const dasharray = animated ? void 0 : 'dashed' === strokeStyle ? external_constants_cjs_namespaceObject.EDGE_DASHARRAY.dashed : external_constants_cjs_namespaceObject.EDGE_DASHARRAY.solid;
|
|
35
|
+
const strokeWidth = style?.strokeWidth ?? (selected ? SELECTED_STROKE_WIDTH : STROKE_WIDTH);
|
|
36
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
39
|
+
className: "react-flow__edge-interaction",
|
|
40
|
+
d: d,
|
|
41
|
+
fill: "none",
|
|
42
|
+
stroke: "transparent",
|
|
43
|
+
strokeWidth: INTERACTION_STROKE_WIDTH,
|
|
44
|
+
style: {
|
|
45
|
+
pointerEvents: 'stroke',
|
|
46
|
+
cursor: isReadOnly ? 'default' : 'pointer'
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
selected && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
50
|
+
className: "react-flow__edge-outline",
|
|
51
|
+
d: d,
|
|
52
|
+
fill: "none",
|
|
53
|
+
stroke: external_constants_cjs_namespaceObject.EDGE_COLORS.selected,
|
|
54
|
+
strokeWidth: SELECTED_OUTLINE_STROKE_WIDTH,
|
|
55
|
+
opacity: SELECTED_OUTLINE_OPACITY,
|
|
56
|
+
style: {
|
|
57
|
+
pointerEvents: 'none',
|
|
58
|
+
transition: 'opacity 0.2s ease'
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
62
|
+
id: id,
|
|
63
|
+
ref: pathRef,
|
|
64
|
+
className: "react-flow__edge-path",
|
|
65
|
+
d: d,
|
|
66
|
+
fill: "none",
|
|
67
|
+
strokeWidth: strokeWidth,
|
|
68
|
+
style: {
|
|
69
|
+
stroke: color,
|
|
70
|
+
strokeDasharray: dasharray,
|
|
71
|
+
opacity,
|
|
72
|
+
transition: external_constants_cjs_namespaceObject.EDGE_PATH_TRANSITION
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
exports.EdgePath = __webpack_exports__.EdgePath;
|
|
79
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
80
|
+
"EdgePath"
|
|
81
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
82
|
+
Object.defineProperty(exports, '__esModule', {
|
|
83
|
+
value: true
|
|
84
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { EdgeStrokeStyle } from '../types';
|
|
3
|
+
export type EdgePathProps = {
|
|
4
|
+
d: string;
|
|
5
|
+
color: string;
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
animated?: boolean;
|
|
8
|
+
strokeStyle?: EdgeStrokeStyle;
|
|
9
|
+
isReadOnly?: boolean;
|
|
10
|
+
pathRef?: React.Ref<SVGPathElement>;
|
|
11
|
+
id?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
opacity?: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function EdgePath(props: EdgePathProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=EdgePath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EdgePath.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/primitives/EdgePath.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAUhD,MAAM,MAAM,aAAa,GAAG;IAE1B,CAAC,EAAE,MAAM,CAAC;IAEV,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IAMnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAQF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CA2D5C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { EDGE_COLORS, EDGE_CONSTANTS, EDGE_DASHARRAY, EDGE_PATH_TRANSITION } from "../constants.js";
|
|
3
|
+
const { INTERACTION_STROKE_WIDTH, STROKE_WIDTH, SELECTED_STROKE_WIDTH, SELECTED_OUTLINE_STROKE_WIDTH, SELECTED_OUTLINE_OPACITY } = EDGE_CONSTANTS;
|
|
4
|
+
function EdgePath(props) {
|
|
5
|
+
const { d, color, selected, animated, strokeStyle, isReadOnly, pathRef, id, style, opacity = 1 } = props;
|
|
6
|
+
const dasharray = animated ? void 0 : 'dashed' === strokeStyle ? EDGE_DASHARRAY.dashed : EDGE_DASHARRAY.solid;
|
|
7
|
+
const strokeWidth = style?.strokeWidth ?? (selected ? SELECTED_STROKE_WIDTH : STROKE_WIDTH);
|
|
8
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ jsx("path", {
|
|
11
|
+
className: "react-flow__edge-interaction",
|
|
12
|
+
d: d,
|
|
13
|
+
fill: "none",
|
|
14
|
+
stroke: "transparent",
|
|
15
|
+
strokeWidth: INTERACTION_STROKE_WIDTH,
|
|
16
|
+
style: {
|
|
17
|
+
pointerEvents: 'stroke',
|
|
18
|
+
cursor: isReadOnly ? 'default' : 'pointer'
|
|
19
|
+
}
|
|
20
|
+
}),
|
|
21
|
+
selected && /*#__PURE__*/ jsx("path", {
|
|
22
|
+
className: "react-flow__edge-outline",
|
|
23
|
+
d: d,
|
|
24
|
+
fill: "none",
|
|
25
|
+
stroke: EDGE_COLORS.selected,
|
|
26
|
+
strokeWidth: SELECTED_OUTLINE_STROKE_WIDTH,
|
|
27
|
+
opacity: SELECTED_OUTLINE_OPACITY,
|
|
28
|
+
style: {
|
|
29
|
+
pointerEvents: 'none',
|
|
30
|
+
transition: 'opacity 0.2s ease'
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
/*#__PURE__*/ jsx("path", {
|
|
34
|
+
id: id,
|
|
35
|
+
ref: pathRef,
|
|
36
|
+
className: "react-flow__edge-path",
|
|
37
|
+
d: d,
|
|
38
|
+
fill: "none",
|
|
39
|
+
strokeWidth: strokeWidth,
|
|
40
|
+
style: {
|
|
41
|
+
stroke: color,
|
|
42
|
+
strokeDasharray: dasharray,
|
|
43
|
+
opacity,
|
|
44
|
+
transition: EDGE_PATH_TRANSITION
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export { EdgePath };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
SegmentDragHandle: ()=>SegmentDragHandle_SegmentDragHandle
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
32
|
+
const external_geometry_cjs_namespaceObject = require("../geometry.cjs");
|
|
33
|
+
const { INTERACTION_STROKE_WIDTH } = external_constants_cjs_namespaceObject.EDGE_CONSTANTS;
|
|
34
|
+
const SEGMENT_CURSOR = {
|
|
35
|
+
horizontal: 'ns-resize',
|
|
36
|
+
vertical: 'ew-resize'
|
|
37
|
+
};
|
|
38
|
+
const HANDLE_RECT = {
|
|
39
|
+
horizontal: {
|
|
40
|
+
x: -12,
|
|
41
|
+
y: -5,
|
|
42
|
+
width: 24,
|
|
43
|
+
height: 10
|
|
44
|
+
},
|
|
45
|
+
vertical: {
|
|
46
|
+
x: -5,
|
|
47
|
+
y: -12,
|
|
48
|
+
width: 10,
|
|
49
|
+
height: 24
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const SegmentDragHandle_SegmentDragHandle = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(function({ segment, segmentIndex, handlers }) {
|
|
53
|
+
const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
|
|
54
|
+
const midpoint = (0, external_geometry_cjs_namespaceObject.getSegmentMidpoint)(segment);
|
|
55
|
+
const cursor = SEGMENT_CURSOR[segment.orientation];
|
|
56
|
+
const rect = HANDLE_RECT[segment.orientation];
|
|
57
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("line", {
|
|
60
|
+
className: "nopan",
|
|
61
|
+
x1: segment.start.x,
|
|
62
|
+
y1: segment.start.y,
|
|
63
|
+
x2: segment.end.x,
|
|
64
|
+
y2: segment.end.y,
|
|
65
|
+
stroke: "transparent",
|
|
66
|
+
strokeWidth: INTERACTION_STROKE_WIDTH,
|
|
67
|
+
style: {
|
|
68
|
+
cursor,
|
|
69
|
+
pointerEvents: 'stroke'
|
|
70
|
+
},
|
|
71
|
+
onMouseEnter: ()=>setIsHovered(true),
|
|
72
|
+
onMouseLeave: ()=>setIsHovered(false),
|
|
73
|
+
onMouseDown: (e)=>handlers.onMouseDown(segment, e),
|
|
74
|
+
onDoubleClick: (e)=>handlers.onDoubleClick(segmentIndex, e)
|
|
75
|
+
}),
|
|
76
|
+
isHovered && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
77
|
+
children: [
|
|
78
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("line", {
|
|
79
|
+
x1: segment.start.x,
|
|
80
|
+
y1: segment.start.y,
|
|
81
|
+
x2: segment.end.x,
|
|
82
|
+
y2: segment.end.y,
|
|
83
|
+
stroke: external_constants_cjs_namespaceObject.EDGE_COLORS.selected,
|
|
84
|
+
strokeWidth: 4,
|
|
85
|
+
opacity: 0.4,
|
|
86
|
+
style: {
|
|
87
|
+
pointerEvents: 'none'
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("g", {
|
|
91
|
+
transform: `translate(${midpoint.x}, ${midpoint.y})`,
|
|
92
|
+
style: {
|
|
93
|
+
pointerEvents: 'none'
|
|
94
|
+
},
|
|
95
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("rect", {
|
|
96
|
+
x: rect.x,
|
|
97
|
+
y: rect.y,
|
|
98
|
+
width: rect.width,
|
|
99
|
+
height: rect.height,
|
|
100
|
+
rx: 5,
|
|
101
|
+
fill: external_constants_cjs_namespaceObject.EDGE_COLORS.selected,
|
|
102
|
+
stroke: "white",
|
|
103
|
+
strokeWidth: 2
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
exports.SegmentDragHandle = __webpack_exports__.SegmentDragHandle;
|
|
112
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
113
|
+
"SegmentDragHandle"
|
|
114
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
115
|
+
Object.defineProperty(exports, '__esModule', {
|
|
116
|
+
value: true
|
|
117
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SegmentHandlers } from '../hooks/useWaypointEditor';
|
|
2
|
+
import type { Segment } from '../types';
|
|
3
|
+
export type SegmentDragHandleProps = {
|
|
4
|
+
segment: Segment;
|
|
5
|
+
segmentIndex: number;
|
|
6
|
+
handlers: SegmentHandlers;
|
|
7
|
+
};
|
|
8
|
+
export declare const SegmentDragHandle: import("react").NamedExoticComponent<SegmentDragHandleProps>;
|
|
9
|
+
//# sourceMappingURL=SegmentDragHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentDragHandle.d.ts","sourceRoot":"","sources":["../../../../../../src/canvas/components/Edges/shared/primitives/SegmentDragHandle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAsB,MAAM,UAAU,CAAC;AAiB5D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC;IAEjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,8DA4D5B,CAAC"}
|