flow-lib-creomnia 1.0.15 → 1.0.16-dev.2
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/lib/modules/common/components/HorizontalDrawer/index.js +38 -15
- package/lib/modules/flow/components/NodesFlow/index.js +1 -1
- package/lib/modules/node/components/ChoiseNode/index.js +1 -1
- package/lib/modules/node/components/ChoiseNode/styled.d.ts +3 -16
- package/lib/modules/node/components/ChoiseNode/styled.js +22 -14
- package/lib/modules/node/contexts/SettingsContext/index.js +3 -3
- package/lib/modules/node/enums/index.d.ts +2 -1
- package/lib/modules/node/enums/index.js +1 -0
- package/lib/modules/node/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -26,22 +26,37 @@ const HorizontalDrawer = ({ Content, HeaderContent, open, onClose }) => {
|
|
|
26
26
|
return "40%";
|
|
27
27
|
return "35%";
|
|
28
28
|
};
|
|
29
|
-
const handleDrag = (event) => {
|
|
30
|
-
const maxWidthPercent = 90;
|
|
31
|
-
const minWidthPercent = 30;
|
|
32
|
-
const newWidthPercent = ((window.innerWidth - event.clientX) * 100) / window.innerWidth;
|
|
33
|
-
if (newWidthPercent < minWidthPercent || newWidthPercent > maxWidthPercent) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
setDrawerWidth(`${newWidthPercent}%`);
|
|
37
|
-
};
|
|
38
29
|
const DraggerElement = () => {
|
|
39
30
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { onMouseDown: (e) => {
|
|
40
31
|
e.preventDefault();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
// Capture the drawer paper + its positioned host (canvas
|
|
33
|
+
// Box) at drag start. We can't rely on `event.target` during
|
|
34
|
+
// mousemove because the cursor is over the canvas, not the
|
|
35
|
+
// drawer; closing over `host` here keeps the math correct
|
|
36
|
+
// both in the main editor (host = NodesFlow Box ≈ viewport)
|
|
37
|
+
// and inside a modal (host = the same canvas Box, just
|
|
38
|
+
// rendered inside a smaller window).
|
|
39
|
+
const dragger = e.currentTarget;
|
|
40
|
+
const drawerEl = dragger.closest(".MuiDrawer-paper");
|
|
41
|
+
const host = drawerEl?.parentElement;
|
|
42
|
+
const onMove = (ev) => {
|
|
43
|
+
const rect = host?.getBoundingClientRect();
|
|
44
|
+
const hostRight = rect?.right ?? window.innerWidth;
|
|
45
|
+
const hostWidth = rect?.width ?? window.innerWidth;
|
|
46
|
+
const maxWidthPercent = 90;
|
|
47
|
+
const minWidthPercent = 30;
|
|
48
|
+
const newWidthPercent = ((hostRight - ev.clientX) * 100) / hostWidth;
|
|
49
|
+
if (newWidthPercent < minWidthPercent || newWidthPercent > maxWidthPercent) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
setDrawerWidth(`${newWidthPercent}%`);
|
|
53
|
+
};
|
|
54
|
+
const onUp = () => {
|
|
55
|
+
window.removeEventListener("mousemove", onMove);
|
|
56
|
+
window.removeEventListener("mouseup", onUp);
|
|
57
|
+
};
|
|
58
|
+
window.addEventListener("mousemove", onMove);
|
|
59
|
+
window.addEventListener("mouseup", onUp);
|
|
45
60
|
}, sx: {
|
|
46
61
|
display: "flex",
|
|
47
62
|
alignItems: "center",
|
|
@@ -55,10 +70,18 @@ const HorizontalDrawer = ({ Content, HeaderContent, open, onClose }) => {
|
|
|
55
70
|
};
|
|
56
71
|
return ((0, jsx_runtime_1.jsx)(material_1.Drawer, { variant: "persistent", open: open, anchor: "right", sx: {
|
|
57
72
|
flexShrink: 0,
|
|
73
|
+
// Anchor paper to its positioned ancestor (the NodesFlow Box,
|
|
74
|
+
// which sets `position: relative`) rather than the viewport.
|
|
75
|
+
// The top offset is read from `--drawer-top-offset` so the
|
|
76
|
+
// main flow editor can leave room for the app header (66px,
|
|
77
|
+
// default), while a host like `ToolFlowConfigModal` can set
|
|
78
|
+
// it to `0` and have the drawer fill the entire canvas.
|
|
58
79
|
"& .MuiDrawer-paper": {
|
|
80
|
+
position: "absolute",
|
|
59
81
|
width: drawerWidth || getDefaultWidth(),
|
|
60
|
-
height: "calc(100% - 66px)",
|
|
61
|
-
marginTop: "66px",
|
|
82
|
+
height: "calc(100% - var(--drawer-top-offset, 66px))",
|
|
83
|
+
marginTop: "var(--drawer-top-offset, 66px)",
|
|
84
|
+
right: 0,
|
|
62
85
|
borderTopLeftRadius: "16px",
|
|
63
86
|
boxShadow: "0px 9px 46px 0px #00000014",
|
|
64
87
|
border: "none",
|
|
@@ -31,6 +31,6 @@ const NodesFlow = ({ theme, nodes, menuTabs, addNewNodeCallback, permissions, dr
|
|
|
31
31
|
addNewNodeCallback,
|
|
32
32
|
}), [nodeDrawers, menuTabs, addNewNodeCallback, processedNodeIds]);
|
|
33
33
|
const containerRef = (0, react_1.useRef)(null);
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: permissions.canRead && ((0, jsx_runtime_1.jsx)(ThemeContext_1.ThemeContextProvider, { themContextValue: theme, children: (0, jsx_runtime_1.jsx)(react_dnd_1.DndProvider, { backend: react_dnd_html5_backend_1.HTML5Backend, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ref: containerRef, style: { height: "100%", width: "100%", background: theme?.palette.background.default || colors_1.Colors.DIRTY_WHITE }, children: (0, jsx_runtime_1.jsx)(SettingsContext_1.NodeSettingsProvider, { permissions: permissions, drawerProps: drawerProps, children: (0, jsx_runtime_1.jsx)(FlowPosition_1.FlowPositionProvider, { children: (0, jsx_runtime_1.jsx)(FlowSandbox_1.default, { permissions: permissions, connectionDrawers: connectionDrawers, nodeDrawers: nodeDrawers, containerRef: containerRef, processedNodeIds: processedNodeIds, failedNodeId: failedNodeId, failedNodeColor: failedNodeColor, onRedirect: onRedirect, onUpdateNodePosition: onUpdateNodePosition, emptyMenuItemsComponent: emptyMenuItemsComponent, searchPlaceholder: searchPlaceholder }) }) }) }) }) })) }));
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: permissions.canRead && ((0, jsx_runtime_1.jsx)(ThemeContext_1.ThemeContextProvider, { themContextValue: theme, children: (0, jsx_runtime_1.jsx)(react_dnd_1.DndProvider, { backend: react_dnd_html5_backend_1.HTML5Backend, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ref: containerRef, style: { position: "relative", height: "100%", width: "100%", background: theme?.palette.background.default || colors_1.Colors.DIRTY_WHITE }, children: (0, jsx_runtime_1.jsx)(SettingsContext_1.NodeSettingsProvider, { permissions: permissions, drawerProps: drawerProps, children: (0, jsx_runtime_1.jsx)(FlowPosition_1.FlowPositionProvider, { children: (0, jsx_runtime_1.jsx)(FlowSandbox_1.default, { permissions: permissions, connectionDrawers: connectionDrawers, nodeDrawers: nodeDrawers, containerRef: containerRef, processedNodeIds: processedNodeIds, failedNodeId: failedNodeId, failedNodeColor: failedNodeColor, onRedirect: onRedirect, onUpdateNodePosition: onUpdateNodePosition, emptyMenuItemsComponent: emptyMenuItemsComponent, searchPlaceholder: searchPlaceholder }) }) }) }) }) })) }));
|
|
35
35
|
};
|
|
36
36
|
exports.default = NodesFlow;
|
|
@@ -40,6 +40,6 @@ const ChoiceNode = ({ nodeData, isProcessed, isFailed, failedNodeColor }) => {
|
|
|
40
40
|
});
|
|
41
41
|
const ChoiceNodeImg = (0, react_1.useMemo)(() => (0, styled_1.createChoiceNodeImg)(), [color, node?.id, nodeData?.id]);
|
|
42
42
|
const AnimatedChoiceNodeImg = (0, web_1.animated)(ChoiceNodeImg);
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(AnimatedChoiceNodeImg, { src: ChoiceNodeIcon_svg_1.default, style: props }), (0, jsx_runtime_1.jsx)(styled_1.Container, { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: onNodeClick, children: (0, jsx_runtime_1.jsxs)(
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(AnimatedChoiceNodeImg, { src: ChoiceNodeIcon_svg_1.default, style: props }), (0, jsx_runtime_1.jsx)(styled_1.Container, { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: onNodeClick, children: (0, jsx_runtime_1.jsxs)(styled_1.ContentRow, { children: [(0, jsx_runtime_1.jsx)(styled_1.ArrowImg, { src: LeftArrowIcon_svg_1.default, alt: "leftArrow" }), (0, jsx_runtime_1.jsx)(styled_1.NameGreed, { children: (0, jsx_runtime_1.jsx)(styled_1.NameText, { children: nodeData?.name || nodeData?.nodeType }) }), (0, jsx_runtime_1.jsx)(styled_1.ArrowImg, { src: RightArrowIcon_svg_1.default, alt: "RightArrow" })] }) })] }));
|
|
44
44
|
};
|
|
45
45
|
exports.default = ChoiceNode;
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
+
export declare const ContentRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
4
|
export declare const createChoiceNodeImg: () => FC<any>;
|
|
4
|
-
export declare const NameGreed: import("@emotion/styled").StyledComponent<import("@mui/system").
|
|
5
|
-
|
|
6
|
-
classes?: Partial<import("@mui/material").GridClasses> | undefined;
|
|
7
|
-
columns?: import("@mui/system").ResponsiveStyleValue<number> | undefined;
|
|
8
|
-
columnSpacing?: import("@mui/system").ResponsiveStyleValue<import("@mui/material").GridSpacing> | undefined;
|
|
9
|
-
container?: boolean | undefined;
|
|
10
|
-
direction?: import("@mui/system").ResponsiveStyleValue<import("@mui/material").GridDirection> | undefined;
|
|
11
|
-
item?: boolean | undefined;
|
|
12
|
-
rowSpacing?: import("@mui/system").ResponsiveStyleValue<import("@mui/material").GridSpacing> | undefined;
|
|
13
|
-
spacing?: import("@mui/system").ResponsiveStyleValue<import("@mui/material").GridSpacing> | undefined;
|
|
14
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
-
wrap?: import("@mui/material").GridWrap | undefined;
|
|
16
|
-
zeroMinWidth?: boolean | undefined;
|
|
17
|
-
} & import("@mui/material").RegularBreakpoints & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
19
|
-
}, "item" | "columns" | "container" | "direction" | "children" | "wrap" | "spacing" | ("flex" | "height" | "width" | "left" | "top" | "alignContent" | "alignItems" | "alignSelf" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "bottom" | "boxShadow" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gap" | "gridArea" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumn" | "gridRow" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "margin" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "overflow" | "padding" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "zIndex" | "p" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "sx" | "columnSpacing" | "rowSpacing" | keyof import("@mui/material/OverridableComponent").CommonProps | "zeroMinWidth" | keyof import("@mui/material").RegularBreakpoints> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
|
|
5
|
+
export declare const NameGreed: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const NameText: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
20
7
|
export declare const ArrowImg: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrowImg = exports.NameGreed = exports.createChoiceNodeImg = exports.Container = void 0;
|
|
3
|
+
exports.ArrowImg = exports.NameText = exports.NameGreed = exports.createChoiceNodeImg = exports.ContentRow = exports.Container = void 0;
|
|
4
4
|
const config_1 = require("../../../../config");
|
|
5
|
-
const material_1 = require("@mui/material");
|
|
6
5
|
const system_1 = require("@mui/system");
|
|
7
6
|
const react_svg_1 = require("react-svg");
|
|
8
7
|
exports.Container = (0, system_1.styled)('div') `
|
|
9
|
-
width:
|
|
10
|
-
max-width: 376px;
|
|
8
|
+
min-width: 300px;
|
|
11
9
|
height: ${config_1.Config.NODE_HEIGHT}px;
|
|
12
10
|
cursor: pointer;
|
|
13
11
|
display: flex;
|
|
14
|
-
flex-direction: row;
|
|
15
12
|
align-items: center;
|
|
16
|
-
|
|
17
|
-
padding: 0 32px;
|
|
13
|
+
position: relative;
|
|
18
14
|
z-index: 1000;
|
|
19
15
|
`;
|
|
16
|
+
exports.ContentRow = (0, system_1.styled)('div') `
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
flex-wrap: nowrap;
|
|
23
|
+
`;
|
|
20
24
|
const createChoiceNodeImg = () => (0, system_1.styled)(react_svg_1.ReactSVG) `
|
|
21
25
|
top: -23px;
|
|
22
26
|
position: absolute;
|
|
@@ -28,22 +32,26 @@ const createChoiceNodeImg = () => (0, system_1.styled)(react_svg_1.ReactSVG) `
|
|
|
28
32
|
}
|
|
29
33
|
`;
|
|
30
34
|
exports.createChoiceNodeImg = createChoiceNodeImg;
|
|
31
|
-
exports.NameGreed = (0, system_1.styled)(
|
|
32
|
-
display:
|
|
35
|
+
exports.NameGreed = (0, system_1.styled)('div') `
|
|
36
|
+
display: flex;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
align-items: center;
|
|
33
39
|
min-width: 0;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
flex: 1 1 auto;
|
|
41
|
+
`;
|
|
42
|
+
exports.NameText = (0, system_1.styled)('span') `
|
|
43
|
+
display: block;
|
|
44
|
+
max-width: 80%;
|
|
38
45
|
overflow: hidden;
|
|
39
46
|
text-overflow: ellipsis;
|
|
40
47
|
white-space: nowrap;
|
|
41
48
|
font-size: 16px;
|
|
42
49
|
font-weight: 700;
|
|
50
|
+
line-height: 1.2;
|
|
51
|
+
text-align: left;
|
|
43
52
|
color: ${props => `${props.theme.palette.text.primary}`};
|
|
44
53
|
font-family: Inter, 'circular', serif;;
|
|
45
54
|
`;
|
|
46
55
|
exports.ArrowImg = (0, system_1.styled)('img') `
|
|
47
|
-
margin-top: 5px;
|
|
48
56
|
flex-shrink: 0;
|
|
49
57
|
`;
|
|
@@ -47,9 +47,9 @@ const NodeSettingsProvider = ({ children, permissions: { canUpdate, canDelete },
|
|
|
47
47
|
setInternalNodeBase(null);
|
|
48
48
|
}, config_1.Config.CLEAR_NODE_DELAY);
|
|
49
49
|
};
|
|
50
|
-
const onSaveNode =
|
|
51
|
-
const result =
|
|
52
|
-
if (result
|
|
50
|
+
const onSaveNode = () => {
|
|
51
|
+
const result = node?.settings?.footer?.onSave?.(node?.id);
|
|
52
|
+
if (result === false)
|
|
53
53
|
return;
|
|
54
54
|
handleClose();
|
|
55
55
|
};
|
|
@@ -14,4 +14,5 @@ var NodeMenuItemType;
|
|
|
14
14
|
(function (NodeMenuItemType) {
|
|
15
15
|
NodeMenuItemType["EXTENSION"] = "extension";
|
|
16
16
|
NodeMenuItemType["AI_AGENT"] = "ai-agent";
|
|
17
|
+
NodeMenuItemType["S2S_AGENT"] = "s2s-agent";
|
|
17
18
|
})(NodeMenuItemType || (exports.NodeMenuItemType = NodeMenuItemType = {}));
|
|
@@ -5,7 +5,7 @@ export type NodesFooterType = {
|
|
|
5
5
|
saveText?: string;
|
|
6
6
|
cancelText?: string;
|
|
7
7
|
deleteText?: string;
|
|
8
|
-
onSave?: (nodeId: string) => void |
|
|
8
|
+
onSave?: (nodeId: string) => void | false;
|
|
9
9
|
onCancel?: (nodeId: string) => void;
|
|
10
10
|
onDelete?: (nodeId: string) => void;
|
|
11
11
|
};
|