@uipath/apollo-react 4.6.3 → 4.8.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/AgentCanvas/nodes/AgentNode.cjs +0 -4
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.d.ts.map +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.js +0 -4
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.cjs +5 -10
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.d.ts.map +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.js +5 -10
- package/dist/canvas/components/BaseNode/BaseNode.cjs +93 -86
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +88 -81
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.cjs +68 -0
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts +9 -0
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.js +34 -0
- package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts +2 -1
- package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +88 -0
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +21 -0
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeContainer.js +51 -0
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.cjs +49 -0
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts +9 -0
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.js +15 -0
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.cjs +62 -0
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts +9 -0
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.js +28 -0
- package/dist/canvas/components/BaseNode/NodeLabel.cjs +64 -18
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts +8 -1
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.js +58 -15
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +75 -128
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +6 -5
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +77 -130
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +4 -7
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +4 -7
- package/dist/canvas/components/ButtonHandle/HandleButton.cjs +152 -0
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts +16 -0
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts.map +1 -0
- package/dist/canvas/components/ButtonHandle/HandleButton.js +115 -0
- package/dist/canvas/components/ButtonHandle/HandleLabel.cjs +62 -0
- package/dist/canvas/components/ButtonHandle/HandleLabel.d.ts +9 -0
- package/dist/canvas/components/ButtonHandle/HandleLabel.d.ts.map +1 -0
- package/dist/canvas/components/ButtonHandle/HandleLabel.js +28 -0
- package/dist/canvas/components/ButtonHandle/HandleNotch.cjs +53 -0
- package/dist/canvas/components/ButtonHandle/HandleNotch.d.ts +9 -0
- package/dist/canvas/components/ButtonHandle/HandleNotch.d.ts.map +1 -0
- package/dist/canvas/components/ButtonHandle/HandleNotch.js +19 -0
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +28 -91
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts +1 -2
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +29 -92
- package/dist/canvas/components/ButtonHandle/useButtonHandles.cjs +5 -4
- package/dist/canvas/components/ButtonHandle/useButtonHandles.d.ts +4 -2
- package/dist/canvas/components/ButtonHandle/useButtonHandles.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/useButtonHandles.js +5 -4
- package/dist/canvas/components/CodedAgent/CodedAgentFlow.cjs +4 -4
- package/dist/canvas/components/CodedAgent/CodedAgentFlow.js +4 -4
- package/dist/canvas/constants.cjs +64 -0
- package/dist/canvas/constants.d.ts +16 -0
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +17 -1
- package/dist/canvas/index.cjs +39 -35
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.d.ts.map +1 -1
- package/dist/canvas/index.js +1 -0
- package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
- package/dist/canvas/styles/reactflow-reset.css +12 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +2 -2
- package/dist/canvas/components/BaseNode/BaseNode.styles.cjs +0 -410
- package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts +0 -75
- package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts.map +0 -1
- package/dist/canvas/components/BaseNode/BaseNode.styles.js +0 -342
- package/dist/canvas/components/ButtonHandle/ButtonHandle.styles.cjs +0 -220
- package/dist/canvas/components/ButtonHandle/ButtonHandle.styles.d.ts +0 -46
- package/dist/canvas/components/ButtonHandle/ButtonHandle.styles.d.ts.map +0 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.styles.js +0 -161
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
HandleHoverBridge: ()=>HandleHoverBridge,
|
|
28
|
+
HandleButton: ()=>HandleButton
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const index_cjs_namespaceObject = require("../../layouts/index.cjs");
|
|
32
|
+
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
33
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
34
|
+
const external_react_namespaceObject = require("react");
|
|
35
|
+
const CssUtil_cjs_namespaceObject = require("../../utils/CssUtil.cjs");
|
|
36
|
+
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
37
|
+
const BUTTON_POSITION = {
|
|
38
|
+
[react_cjs_namespaceObject.Position.Top]: 'flex-col-reverse bottom-full left-1/2 -translate-x-1/2',
|
|
39
|
+
[react_cjs_namespaceObject.Position.Bottom]: 'flex-col top-full left-1/2 -translate-x-1/2',
|
|
40
|
+
[react_cjs_namespaceObject.Position.Left]: 'flex-row-reverse right-full top-1/2 -translate-y-1/2',
|
|
41
|
+
[react_cjs_namespaceObject.Position.Right]: 'flex-row left-full top-1/2 -translate-y-1/2'
|
|
42
|
+
};
|
|
43
|
+
const DRAG_THRESHOLD = 5;
|
|
44
|
+
const HandleButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor })=>{
|
|
45
|
+
const didDragRef = (0, external_react_namespaceObject.useRef)(false);
|
|
46
|
+
const teardownRef = (0, external_react_namespaceObject.useRef)(null);
|
|
47
|
+
(0, external_react_namespaceObject.useEffect)(()=>()=>teardownRef.current?.(), []);
|
|
48
|
+
const handleClick = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
if (didDragRef.current) return;
|
|
51
|
+
onAction(e);
|
|
52
|
+
}, [
|
|
53
|
+
onAction
|
|
54
|
+
]);
|
|
55
|
+
const handlePointerDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
56
|
+
teardownRef.current?.();
|
|
57
|
+
didDragRef.current = false;
|
|
58
|
+
const startX = e.clientX;
|
|
59
|
+
const startY = e.clientY;
|
|
60
|
+
const onMove = (moveEvt)=>{
|
|
61
|
+
if (didDragRef.current) return;
|
|
62
|
+
const dx = moveEvt.clientX - startX;
|
|
63
|
+
const dy = moveEvt.clientY - startY;
|
|
64
|
+
if (dx * dx + dy * dy < DRAG_THRESHOLD * DRAG_THRESHOLD) return;
|
|
65
|
+
didDragRef.current = true;
|
|
66
|
+
const handleEl = handleRef?.current;
|
|
67
|
+
if (handleEl) {
|
|
68
|
+
const rect = handleEl.getBoundingClientRect();
|
|
69
|
+
handleEl.dispatchEvent(new MouseEvent('mousedown', {
|
|
70
|
+
bubbles: true,
|
|
71
|
+
cancelable: true,
|
|
72
|
+
clientX: rect.left + rect.width / 2,
|
|
73
|
+
clientY: rect.top + rect.height / 2
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const cleanup = ()=>{
|
|
78
|
+
document.removeEventListener('pointermove', onMove);
|
|
79
|
+
document.removeEventListener('pointerup', cleanup);
|
|
80
|
+
document.removeEventListener('pointercancel', cleanup);
|
|
81
|
+
teardownRef.current = null;
|
|
82
|
+
};
|
|
83
|
+
document.addEventListener('pointermove', onMove);
|
|
84
|
+
document.addEventListener('pointerup', cleanup);
|
|
85
|
+
document.addEventListener('pointercancel', cleanup);
|
|
86
|
+
teardownRef.current = cleanup;
|
|
87
|
+
}, []);
|
|
88
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
89
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('absolute flex items-center gap-1 pointer-events-none', BUTTON_POSITION[position]),
|
|
90
|
+
children: [
|
|
91
|
+
visible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
92
|
+
"aria-label": "Add node",
|
|
93
|
+
variant: "outline",
|
|
94
|
+
size: "3xs",
|
|
95
|
+
icon: true,
|
|
96
|
+
onClick: handleClick,
|
|
97
|
+
onPointerDown: handlePointerDown,
|
|
98
|
+
className: "nodrag nopan pointer-events-auto rounded-[10px] animate-fade-in w-7 h-7",
|
|
99
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
100
|
+
icon: "plus",
|
|
101
|
+
size: 14
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InlineLabel, {
|
|
105
|
+
label: label,
|
|
106
|
+
labelIcon: labelIcon,
|
|
107
|
+
backgroundColor: labelBackgroundColor,
|
|
108
|
+
visible: labelVisible
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
const InlineLabel = ({ label, labelIcon, backgroundColor, visible = true })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
114
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('px-1.5 py-0.5 rounded-sm whitespace-nowrap select-none transition-opacity duration-250', visible ? 'opacity-100' : 'opacity-0'),
|
|
115
|
+
style: backgroundColor ? {
|
|
116
|
+
backgroundColor
|
|
117
|
+
} : void 0,
|
|
118
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
|
|
119
|
+
align: "center",
|
|
120
|
+
gap: 4,
|
|
121
|
+
children: [
|
|
122
|
+
labelIcon,
|
|
123
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
124
|
+
className: "text-xs font-bold text-foreground-muted",
|
|
125
|
+
children: label
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
const BRIDGE_BASE = 'absolute pointer-events-auto cursor-default';
|
|
131
|
+
const BRIDGE_POSITION = {
|
|
132
|
+
[react_cjs_namespaceObject.Position.Top]: 'bottom-full left-0 w-full',
|
|
133
|
+
[react_cjs_namespaceObject.Position.Bottom]: 'top-full left-0 w-full',
|
|
134
|
+
[react_cjs_namespaceObject.Position.Left]: 'right-full top-0 h-full',
|
|
135
|
+
[react_cjs_namespaceObject.Position.Right]: 'left-full top-0 h-full'
|
|
136
|
+
};
|
|
137
|
+
const HandleHoverBridge = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ position, visible })=>{
|
|
138
|
+
if (!visible) return null;
|
|
139
|
+
const isVertical = position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
140
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
141
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)(BRIDGE_BASE, BRIDGE_POSITION[position], isVertical ? 'h-14' : 'w-14')
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
exports.HandleButton = __webpack_exports__.HandleButton;
|
|
145
|
+
exports.HandleHoverBridge = __webpack_exports__.HandleHoverBridge;
|
|
146
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
147
|
+
"HandleButton",
|
|
148
|
+
"HandleHoverBridge"
|
|
149
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
150
|
+
Object.defineProperty(exports, '__esModule', {
|
|
151
|
+
value: true
|
|
152
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Position } from '../../xyflow/react.ts';
|
|
2
|
+
export declare const HandleButton: import("react").MemoExoticComponent<({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor, }: {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
labelVisible?: boolean;
|
|
5
|
+
position: Position;
|
|
6
|
+
onAction: (event: React.MouseEvent) => void;
|
|
7
|
+
handleRef?: React.RefObject<HTMLDivElement | null>;
|
|
8
|
+
label?: string;
|
|
9
|
+
labelIcon?: React.ReactNode;
|
|
10
|
+
labelBackgroundColor?: string;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export declare const HandleHoverBridge: import("react").MemoExoticComponent<({ position, visible }: {
|
|
13
|
+
position: Position;
|
|
14
|
+
visible?: boolean;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element | null>;
|
|
16
|
+
//# sourceMappingURL=HandleButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandleButton.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/HandleButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAqBpE,eAAO,MAAM,YAAY,0IAUpB;IACD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,6CA+FF,CAAC;AAqCF,eAAO,MAAM,iBAAiB,8DACJ;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,oDAOlE,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Row } from "../../layouts/index.js";
|
|
3
|
+
import { Position } from "../../xyflow/react.js";
|
|
4
|
+
import { Button } from "@uipath/apollo-wind";
|
|
5
|
+
import { memo, useCallback, useEffect, useRef } from "react";
|
|
6
|
+
import { cx } from "../../utils/CssUtil.js";
|
|
7
|
+
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
8
|
+
const BUTTON_POSITION = {
|
|
9
|
+
[Position.Top]: 'flex-col-reverse bottom-full left-1/2 -translate-x-1/2',
|
|
10
|
+
[Position.Bottom]: 'flex-col top-full left-1/2 -translate-x-1/2',
|
|
11
|
+
[Position.Left]: 'flex-row-reverse right-full top-1/2 -translate-y-1/2',
|
|
12
|
+
[Position.Right]: 'flex-row left-full top-1/2 -translate-y-1/2'
|
|
13
|
+
};
|
|
14
|
+
const DRAG_THRESHOLD = 5;
|
|
15
|
+
const HandleButton = /*#__PURE__*/ memo(({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor })=>{
|
|
16
|
+
const didDragRef = useRef(false);
|
|
17
|
+
const teardownRef = useRef(null);
|
|
18
|
+
useEffect(()=>()=>teardownRef.current?.(), []);
|
|
19
|
+
const handleClick = useCallback((e)=>{
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
if (didDragRef.current) return;
|
|
22
|
+
onAction(e);
|
|
23
|
+
}, [
|
|
24
|
+
onAction
|
|
25
|
+
]);
|
|
26
|
+
const handlePointerDown = useCallback((e)=>{
|
|
27
|
+
teardownRef.current?.();
|
|
28
|
+
didDragRef.current = false;
|
|
29
|
+
const startX = e.clientX;
|
|
30
|
+
const startY = e.clientY;
|
|
31
|
+
const onMove = (moveEvt)=>{
|
|
32
|
+
if (didDragRef.current) return;
|
|
33
|
+
const dx = moveEvt.clientX - startX;
|
|
34
|
+
const dy = moveEvt.clientY - startY;
|
|
35
|
+
if (dx * dx + dy * dy < DRAG_THRESHOLD * DRAG_THRESHOLD) return;
|
|
36
|
+
didDragRef.current = true;
|
|
37
|
+
const handleEl = handleRef?.current;
|
|
38
|
+
if (handleEl) {
|
|
39
|
+
const rect = handleEl.getBoundingClientRect();
|
|
40
|
+
handleEl.dispatchEvent(new MouseEvent('mousedown', {
|
|
41
|
+
bubbles: true,
|
|
42
|
+
cancelable: true,
|
|
43
|
+
clientX: rect.left + rect.width / 2,
|
|
44
|
+
clientY: rect.top + rect.height / 2
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const cleanup = ()=>{
|
|
49
|
+
document.removeEventListener('pointermove', onMove);
|
|
50
|
+
document.removeEventListener('pointerup', cleanup);
|
|
51
|
+
document.removeEventListener('pointercancel', cleanup);
|
|
52
|
+
teardownRef.current = null;
|
|
53
|
+
};
|
|
54
|
+
document.addEventListener('pointermove', onMove);
|
|
55
|
+
document.addEventListener('pointerup', cleanup);
|
|
56
|
+
document.addEventListener('pointercancel', cleanup);
|
|
57
|
+
teardownRef.current = cleanup;
|
|
58
|
+
}, []);
|
|
59
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
60
|
+
className: cx('absolute flex items-center gap-1 pointer-events-none', BUTTON_POSITION[position]),
|
|
61
|
+
children: [
|
|
62
|
+
visible && /*#__PURE__*/ jsx(Button, {
|
|
63
|
+
"aria-label": "Add node",
|
|
64
|
+
variant: "outline",
|
|
65
|
+
size: "3xs",
|
|
66
|
+
icon: true,
|
|
67
|
+
onClick: handleClick,
|
|
68
|
+
onPointerDown: handlePointerDown,
|
|
69
|
+
className: "nodrag nopan pointer-events-auto rounded-[10px] animate-fade-in w-7 h-7",
|
|
70
|
+
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
71
|
+
icon: "plus",
|
|
72
|
+
size: 14
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
75
|
+
label && /*#__PURE__*/ jsx(InlineLabel, {
|
|
76
|
+
label: label,
|
|
77
|
+
labelIcon: labelIcon,
|
|
78
|
+
backgroundColor: labelBackgroundColor,
|
|
79
|
+
visible: labelVisible
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
const InlineLabel = ({ label, labelIcon, backgroundColor, visible = true })=>/*#__PURE__*/ jsx("div", {
|
|
85
|
+
className: cx('px-1.5 py-0.5 rounded-sm whitespace-nowrap select-none transition-opacity duration-250', visible ? 'opacity-100' : 'opacity-0'),
|
|
86
|
+
style: backgroundColor ? {
|
|
87
|
+
backgroundColor
|
|
88
|
+
} : void 0,
|
|
89
|
+
children: /*#__PURE__*/ jsxs(Row, {
|
|
90
|
+
align: "center",
|
|
91
|
+
gap: 4,
|
|
92
|
+
children: [
|
|
93
|
+
labelIcon,
|
|
94
|
+
/*#__PURE__*/ jsx("span", {
|
|
95
|
+
className: "text-xs font-bold text-foreground-muted",
|
|
96
|
+
children: label
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
const BRIDGE_BASE = 'absolute pointer-events-auto cursor-default';
|
|
102
|
+
const BRIDGE_POSITION = {
|
|
103
|
+
[Position.Top]: 'bottom-full left-0 w-full',
|
|
104
|
+
[Position.Bottom]: 'top-full left-0 w-full',
|
|
105
|
+
[Position.Left]: 'right-full top-0 h-full',
|
|
106
|
+
[Position.Right]: 'left-full top-0 h-full'
|
|
107
|
+
};
|
|
108
|
+
const HandleHoverBridge = /*#__PURE__*/ memo(({ position, visible })=>{
|
|
109
|
+
if (!visible) return null;
|
|
110
|
+
const isVertical = position === Position.Top || position === Position.Bottom;
|
|
111
|
+
return /*#__PURE__*/ jsx("div", {
|
|
112
|
+
className: cx(BRIDGE_BASE, BRIDGE_POSITION[position], isVertical ? 'h-14' : 'w-14')
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
export { HandleButton, HandleHoverBridge };
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
HandleLabel: ()=>HandleLabel
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const index_cjs_namespaceObject = require("../../layouts/index.cjs");
|
|
31
|
+
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
32
|
+
const CssUtil_cjs_namespaceObject = require("../../utils/CssUtil.cjs");
|
|
33
|
+
const LABEL_POSITION = {
|
|
34
|
+
[react_cjs_namespaceObject.Position.Top]: 'bottom-[calc(100%+4px)] left-1/2 -translate-x-1/2',
|
|
35
|
+
[react_cjs_namespaceObject.Position.Bottom]: 'top-[calc(100%+4px)] left-1/2 -translate-x-1/2',
|
|
36
|
+
[react_cjs_namespaceObject.Position.Left]: 'right-[calc(100%+4px)] top-1/2 -translate-y-1/2',
|
|
37
|
+
[react_cjs_namespaceObject.Position.Right]: 'left-[calc(100%+4px)] top-1/2 -translate-y-1/2'
|
|
38
|
+
};
|
|
39
|
+
const HandleLabel = ({ position, backgroundColor, label, labelIcon, shouldTruncate })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
40
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('absolute px-1.5 py-0.5 rounded-sm z-1 whitespace-nowrap select-none', LABEL_POSITION[position], shouldTruncate && 'max-w-[50px] overflow-hidden'),
|
|
41
|
+
style: {
|
|
42
|
+
backgroundColor
|
|
43
|
+
},
|
|
44
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
|
|
45
|
+
align: "center",
|
|
46
|
+
gap: 4,
|
|
47
|
+
children: [
|
|
48
|
+
labelIcon,
|
|
49
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
50
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('text-xs font-bold text-foreground-muted', shouldTruncate && 'overflow-hidden text-ellipsis whitespace-nowrap'),
|
|
51
|
+
children: label
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
exports.HandleLabel = __webpack_exports__.HandleLabel;
|
|
57
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
58
|
+
"HandleLabel"
|
|
59
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
60
|
+
Object.defineProperty(exports, '__esModule', {
|
|
61
|
+
value: true
|
|
62
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Position } from '../../xyflow/react.ts';
|
|
2
|
+
export declare const HandleLabel: ({ position, backgroundColor, label, labelIcon, shouldTruncate, }: {
|
|
3
|
+
position: Position;
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
label: string;
|
|
6
|
+
labelIcon?: React.ReactNode;
|
|
7
|
+
shouldTruncate?: boolean;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=HandleLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandleLabel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/HandleLabel.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAUpE,eAAO,MAAM,WAAW,GAAI,kEAMzB;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,4CAqBA,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Row } from "../../layouts/index.js";
|
|
3
|
+
import { Position } from "../../xyflow/react.js";
|
|
4
|
+
import { cx } from "../../utils/CssUtil.js";
|
|
5
|
+
const LABEL_POSITION = {
|
|
6
|
+
[Position.Top]: 'bottom-[calc(100%+4px)] left-1/2 -translate-x-1/2',
|
|
7
|
+
[Position.Bottom]: 'top-[calc(100%+4px)] left-1/2 -translate-x-1/2',
|
|
8
|
+
[Position.Left]: 'right-[calc(100%+4px)] top-1/2 -translate-y-1/2',
|
|
9
|
+
[Position.Right]: 'left-[calc(100%+4px)] top-1/2 -translate-y-1/2'
|
|
10
|
+
};
|
|
11
|
+
const HandleLabel = ({ position, backgroundColor, label, labelIcon, shouldTruncate })=>/*#__PURE__*/ jsx("div", {
|
|
12
|
+
className: cx('absolute px-1.5 py-0.5 rounded-sm z-1 whitespace-nowrap select-none', LABEL_POSITION[position], shouldTruncate && 'max-w-[50px] overflow-hidden'),
|
|
13
|
+
style: {
|
|
14
|
+
backgroundColor
|
|
15
|
+
},
|
|
16
|
+
children: /*#__PURE__*/ jsxs(Row, {
|
|
17
|
+
align: "center",
|
|
18
|
+
gap: 4,
|
|
19
|
+
children: [
|
|
20
|
+
labelIcon,
|
|
21
|
+
/*#__PURE__*/ jsx("span", {
|
|
22
|
+
className: cx('text-xs font-bold text-foreground-muted', shouldTruncate && 'overflow-hidden text-ellipsis whitespace-nowrap'),
|
|
23
|
+
children: label
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
export { HandleLabel };
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
HandleNotch: ()=>HandleNotch
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const CssUtil_cjs_namespaceObject = require("../../utils/CssUtil.cjs");
|
|
31
|
+
const getNotchWidth = (handleType, isVertical)=>{
|
|
32
|
+
if ('input' === handleType && !isVertical) return 'w-2';
|
|
33
|
+
if ('artifact' === handleType) return 'w-2.5';
|
|
34
|
+
return 'w-3';
|
|
35
|
+
};
|
|
36
|
+
const getNotchHeight = (handleType, isVertical)=>{
|
|
37
|
+
if ('input' === handleType && isVertical) return 'h-2';
|
|
38
|
+
if ('artifact' === handleType) return 'h-2.5';
|
|
39
|
+
return 'h-3';
|
|
40
|
+
};
|
|
41
|
+
const HandleNotch = ({ handleType, isVertical, selected, hovered, showNotch })=>{
|
|
42
|
+
const isActive = selected || hovered;
|
|
43
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
44
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('border-2 pointer-events-none transition-all duration-250 ease-in-out', getNotchWidth(handleType, isVertical), getNotchHeight(handleType, isVertical), 'artifact' === handleType || 'input' === handleType ? 'rounded-none' : 'rounded-full', 'artifact' === handleType && 'rotate-45', isActive ? 'border-brand bg-brand' : 'border-border bg-surface', showNotch ? 'opacity-100' : 'opacity-0')
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
exports.HandleNotch = __webpack_exports__.HandleNotch;
|
|
48
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
49
|
+
"HandleNotch"
|
|
50
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
51
|
+
Object.defineProperty(exports, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type HandleType = 'artifact' | 'input' | 'output';
|
|
2
|
+
export declare const HandleNotch: ({ handleType, isVertical, selected, hovered, showNotch, }: {
|
|
3
|
+
handleType: HandleType;
|
|
4
|
+
isVertical?: boolean;
|
|
5
|
+
selected: boolean;
|
|
6
|
+
hovered?: boolean;
|
|
7
|
+
showNotch?: boolean;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=HandleNotch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HandleNotch.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/HandleNotch.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAczD,eAAO,MAAM,WAAW,GAAI,2DAMzB;IACD,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,4CAeA,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../../utils/CssUtil.js";
|
|
3
|
+
const getNotchWidth = (handleType, isVertical)=>{
|
|
4
|
+
if ('input' === handleType && !isVertical) return 'w-2';
|
|
5
|
+
if ('artifact' === handleType) return 'w-2.5';
|
|
6
|
+
return 'w-3';
|
|
7
|
+
};
|
|
8
|
+
const getNotchHeight = (handleType, isVertical)=>{
|
|
9
|
+
if ('input' === handleType && isVertical) return 'h-2';
|
|
10
|
+
if ('artifact' === handleType) return 'h-2.5';
|
|
11
|
+
return 'h-3';
|
|
12
|
+
};
|
|
13
|
+
const HandleNotch = ({ handleType, isVertical, selected, hovered, showNotch })=>{
|
|
14
|
+
const isActive = selected || hovered;
|
|
15
|
+
return /*#__PURE__*/ jsx("div", {
|
|
16
|
+
className: cx('border-2 pointer-events-none transition-all duration-250 ease-in-out', getNotchWidth(handleType, isVertical), getNotchHeight(handleType, isVertical), 'artifact' === handleType || 'input' === handleType ? 'rounded-none' : 'rounded-full', 'artifact' === handleType && 'rotate-45', isActive ? 'border-brand bg-brand' : 'border-border bg-surface', showNotch ? 'opacity-100' : 'opacity-0')
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export { HandleNotch };
|