flow-lib-creomnia 1.0.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.
Files changed (111) hide show
  1. package/README.md +12 -0
  2. package/lib/assets/icons/ChoiceNodeIcon.svg +16 -0
  3. package/lib/assets/icons/LeftArrowIcon.svg +3 -0
  4. package/lib/assets/icons/ParallelIcon.svg +5 -0
  5. package/lib/assets/icons/RightArrowIcon.svg +3 -0
  6. package/lib/assets/icons/flowIcon.svg +7 -0
  7. package/lib/config/colors.d.ts +13 -0
  8. package/lib/config/colors.js +16 -0
  9. package/lib/config/index.d.ts +20 -0
  10. package/lib/config/index.js +28 -0
  11. package/lib/index.d.ts +4 -0
  12. package/lib/index.js +24 -0
  13. package/lib/modules/common/components/HorizontalDrawer/index.d.ts +9 -0
  14. package/lib/modules/common/components/HorizontalDrawer/index.js +86 -0
  15. package/lib/modules/common/components/ZoomToolbar/index.d.ts +8 -0
  16. package/lib/modules/common/components/ZoomToolbar/index.js +15 -0
  17. package/lib/modules/common/components/ZoomToolbar/styled.d.ts +9 -0
  18. package/lib/modules/common/components/ZoomToolbar/styled.js +13 -0
  19. package/lib/modules/common/components/index.d.ts +2 -0
  20. package/lib/modules/common/components/index.js +10 -0
  21. package/lib/modules/common/contexts/ThemeContext/index.d.ts +24 -0
  22. package/lib/modules/common/contexts/ThemeContext/index.js +9 -0
  23. package/lib/modules/common/hooks/useDragNode.d.ts +10 -0
  24. package/lib/modules/common/hooks/useDragNode.js +27 -0
  25. package/lib/modules/common/hooks/useDropNode.d.ts +11 -0
  26. package/lib/modules/common/hooks/useDropNode.js +16 -0
  27. package/lib/modules/common/types/index.d.ts +69 -0
  28. package/lib/modules/common/types/index.js +2 -0
  29. package/lib/modules/connection/components/AddButton/index.d.ts +16 -0
  30. package/lib/modules/connection/components/AddButton/index.js +45 -0
  31. package/lib/modules/connection/components/AddButton/styled.d.ts +29 -0
  32. package/lib/modules/connection/components/AddButton/styled.js +41 -0
  33. package/lib/modules/connection/components/BaseConnection/index.d.ts +4 -0
  34. package/lib/modules/connection/components/BaseConnection/index.js +40 -0
  35. package/lib/modules/connection/components/BaseConnection/styled.d.ts +18 -0
  36. package/lib/modules/connection/components/BaseConnection/styled.js +28 -0
  37. package/lib/modules/connection/components/ConnectionWithButton/index.d.ts +12 -0
  38. package/lib/modules/connection/components/ConnectionWithButton/index.js +83 -0
  39. package/lib/modules/connection/components/ConnectionWithButton/styled.d.ts +44 -0
  40. package/lib/modules/connection/components/ConnectionWithButton/styled.js +55 -0
  41. package/lib/modules/connection/enums/index.d.ts +4 -0
  42. package/lib/modules/connection/enums/index.js +8 -0
  43. package/lib/modules/connection/index.d.ts +9 -0
  44. package/lib/modules/connection/index.js +11 -0
  45. package/lib/modules/connection/services/connectionParametersServices.d.ts +28 -0
  46. package/lib/modules/connection/services/connectionParametersServices.js +84 -0
  47. package/lib/modules/connection/services/connectionServices.d.ts +7 -0
  48. package/lib/modules/connection/services/connectionServices.js +82 -0
  49. package/lib/modules/connection/types/index.d.ts +41 -0
  50. package/lib/modules/connection/types/index.js +2 -0
  51. package/lib/modules/flow/components/FlowSandbox/index.d.ts +18 -0
  52. package/lib/modules/flow/components/FlowSandbox/index.js +63 -0
  53. package/lib/modules/flow/components/FlowSandbox/styled.d.ts +9 -0
  54. package/lib/modules/flow/components/FlowSandbox/styled.js +32 -0
  55. package/lib/modules/flow/components/NodesFlow/index.d.ts +4 -0
  56. package/lib/modules/flow/components/NodesFlow/index.js +36 -0
  57. package/lib/modules/flow/components/Space/index.d.ts +3 -0
  58. package/lib/modules/flow/components/Space/index.js +35 -0
  59. package/lib/modules/flow/components/Space/styled.d.ts +2 -0
  60. package/lib/modules/flow/components/Space/styled.js +13 -0
  61. package/lib/modules/flow/context/FlowPosition/index.d.ts +13 -0
  62. package/lib/modules/flow/context/FlowPosition/index.js +23 -0
  63. package/lib/modules/flow/types/index.d.ts +29 -0
  64. package/lib/modules/flow/types/index.js +2 -0
  65. package/lib/modules/node/components/BaseNode/index.d.ts +4 -0
  66. package/lib/modules/node/components/BaseNode/index.js +51 -0
  67. package/lib/modules/node/components/BaseNode/styled.d.ts +18 -0
  68. package/lib/modules/node/components/BaseNode/styled.js +98 -0
  69. package/lib/modules/node/components/ChoiseNode/index.d.ts +4 -0
  70. package/lib/modules/node/components/ChoiseNode/index.js +45 -0
  71. package/lib/modules/node/components/ChoiseNode/styled.d.ts +20 -0
  72. package/lib/modules/node/components/ChoiseNode/styled.js +39 -0
  73. package/lib/modules/node/components/DragWrapper/index.d.ts +8 -0
  74. package/lib/modules/node/components/DragWrapper/index.js +15 -0
  75. package/lib/modules/node/components/EndNode/index.d.ts +3 -0
  76. package/lib/modules/node/components/EndNode/index.js +8 -0
  77. package/lib/modules/node/components/EndNode/styled.d.ts +16 -0
  78. package/lib/modules/node/components/EndNode/styled.js +22 -0
  79. package/lib/modules/node/components/HubNode/index.d.ts +3 -0
  80. package/lib/modules/node/components/HubNode/index.js +8 -0
  81. package/lib/modules/node/components/HubNode/styled.d.ts +2 -0
  82. package/lib/modules/node/components/HubNode/styled.js +12 -0
  83. package/lib/modules/node/components/NodesMenu/index.d.ts +14 -0
  84. package/lib/modules/node/components/NodesMenu/index.js +28 -0
  85. package/lib/modules/node/components/NodesMenu/styled.d.ts +127 -0
  86. package/lib/modules/node/components/NodesMenu/styled.js +69 -0
  87. package/lib/modules/node/components/ParallelNode/index.d.ts +4 -0
  88. package/lib/modules/node/components/ParallelNode/index.js +22 -0
  89. package/lib/modules/node/components/ParallelNode/styled.d.ts +2 -0
  90. package/lib/modules/node/components/ParallelNode/styled.js +16 -0
  91. package/lib/modules/node/components/StartNode/index.d.ts +3 -0
  92. package/lib/modules/node/components/StartNode/index.js +8 -0
  93. package/lib/modules/node/components/StartNode/styled.d.ts +16 -0
  94. package/lib/modules/node/components/StartNode/styled.js +22 -0
  95. package/lib/modules/node/contexts/SettingsContext/index.d.ts +10 -0
  96. package/lib/modules/node/contexts/SettingsContext/index.js +47 -0
  97. package/lib/modules/node/contexts/SettingsContext/styled.d.ts +20 -0
  98. package/lib/modules/node/contexts/SettingsContext/styled.js +40 -0
  99. package/lib/modules/node/enums/index.d.ts +8 -0
  100. package/lib/modules/node/enums/index.js +12 -0
  101. package/lib/modules/node/index.d.ts +10 -0
  102. package/lib/modules/node/index.js +22 -0
  103. package/lib/modules/node/services/expandCoefficientServices.d.ts +24 -0
  104. package/lib/modules/node/services/expandCoefficientServices.js +47 -0
  105. package/lib/modules/node/services/nodeServices.d.ts +11 -0
  106. package/lib/modules/node/services/nodeServices.js +145 -0
  107. package/lib/modules/node/services/pointCalculationServices.d.ts +11 -0
  108. package/lib/modules/node/services/pointCalculationServices.js +22 -0
  109. package/lib/modules/node/types/index.d.ts +49 -0
  110. package/lib/modules/node/types/index.js +2 -0
  111. package/package.json +65 -0
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # Nodes flow
2
+
3
+ ## Components
4
+
5
+ `<NodesFlow />`
6
+
7
+ Props:
8
+
9
+ - `nodes` - `NodeType[]`
10
+ - `menuTabs` - `MenuTabType[]`
11
+ - `addNewNodeCallback` - `AddNewNodeCallbackType`
12
+ - `addButtonColor`(optional) - `string`
@@ -0,0 +1,16 @@
1
+ <svg width="376" height="132" viewBox="0 0 376 132" xmlns="http://www.w3.org/2000/svg">
2
+ <g filter="url(#filter0_d_4646_869)">
3
+ <path d="M63.5925 96C61.3074 96 59.1314 95.0228 57.6133 93.3149L32.7244 65.3149C30.0301 62.2838 30.0301 57.7162 32.7244 54.6851L57.6133 26.6851C59.1314 24.9772 61.3074 24 63.5925 24H312.407C314.693 24 316.869 24.9772 318.387 26.6851L343.276 54.6851C345.97 57.7162 345.97 62.2838 343.276 65.3149L318.387 93.3149C316.869 95.0228 314.693 96 312.407 96H63.5925Z"/>
4
+ </g>
5
+ <defs>
6
+ <filter id="filter0_d_4646_869" x="0.703125" y="0" width="374.594" height="132" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
7
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
8
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
9
+ <feOffset dy="6"/>
10
+ <feGaussianBlur stdDeviation="15"/>
11
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"/>
12
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_4646_869"/>
13
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_4646_869" result="shape"/>
14
+ </filter>
15
+ </defs>
16
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="15" height="22" viewBox="0 0 15 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path id="triangle 40x80" d="M1.82843 13.8284L8.17157 20.1716C10.6914 22.6914 15 20.9068 15 17.3431L15 4.65686C15 1.09324 10.6914 -0.691433 8.17158 1.82843L1.82843 8.17157C0.266331 9.73367 0.266329 12.2663 1.82843 13.8284Z" fill="#16B364"/>
3
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="addons/parallel">
3
+ <path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M12.0007 2.66683C12.3688 2.66683 12.6673 2.36835 12.6673 2.00016C12.6673 1.63197 12.3688 1.3335 12.0007 1.3335C11.6325 1.3335 11.334 1.63197 11.334 2.00016C11.334 2.36835 11.6325 2.66683 12.0007 2.66683ZM12.6673 4.00016C12.6673 4.36835 12.3688 4.66683 12.0007 4.66683C11.6325 4.66683 11.334 4.36835 11.334 4.00016C11.334 3.63197 11.6325 3.3335 12.0007 3.3335C12.3688 3.3335 12.6673 3.63197 12.6673 4.00016ZM5.33398 6.00016C5.33398 5.63197 5.03551 5.3335 4.66732 5.3335C4.29913 5.3335 4.00065 5.63197 4.00065 6.00016V12.3907L2.47211 10.8621L1.5293 11.805L4.66737 14.943L7.80544 11.805L6.86263 10.8621L5.33398 12.3908V6.00016ZM12.6673 6.00016C12.6673 5.63197 12.3688 5.3335 12.0007 5.3335C11.6325 5.3335 11.334 5.63197 11.334 6.00016V12.3907L9.80544 10.8621L8.86263 11.805L12.0007 14.943L15.1388 11.805L14.196 10.8621L12.6673 12.3908V6.00016ZM5.33398 2.00016C5.33398 2.36835 5.03551 2.66683 4.66732 2.66683C4.29913 2.66683 4.00065 2.36835 4.00065 2.00016C4.00065 1.63197 4.29913 1.3335 4.66732 1.3335C5.03551 1.3335 5.33398 1.63197 5.33398 2.00016ZM4.66732 4.66683C5.03551 4.66683 5.33398 4.36835 5.33398 4.00016C5.33398 3.63197 5.03551 3.3335 4.66732 3.3335C4.29913 3.3335 4.00065 3.63197 4.00065 4.00016C4.00065 4.36835 4.29913 4.66683 4.66732 4.66683Z" fill="white"/>
4
+ </g>
5
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="15" height="22" viewBox="0 0 15 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path id="triangle 16x32" d="M13.1716 13.8284L6.82843 20.1716C4.30857 22.6914 -5.32687e-07 20.9068 -8.44229e-07 17.3431L-1.9533e-06 4.65686C-2.26484e-06 1.09324 4.30856 -0.691433 6.82842 1.82843L13.1716 8.17157C14.7337 9.73367 14.7337 12.2663 13.1716 13.8284Z" fill="#F04438"/>
3
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg width="14" height="20" viewBox="0 0 14 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M5 2C5 0.895431 5.89543 0 7 0C8.10457 0 9 0.895431 9 2C9 3.10457 8.10457 4 7 4C5.89543 4 5 3.10457 5 2Z" fill="#6C737F"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M0 9C0 7.34315 1.34315 6 3 6H11C12.6569 6 14 7.34315 14 9V11C14 12.6569 12.6569 14 11 14H3C1.34315 14 0 12.6569 0 11V9ZM3 8C2.44772 8 2 8.44772 2 9V11C2 11.5523 2.44772 12 3 12H11C11.5523 12 12 11.5523 12 11V9C12 8.44772 11.5523 8 11 8H3Z" fill="#6C737F"/>
4
+ <path d="M5 18C5 16.8954 5.89543 16 7 16C8.10457 16 9 16.8954 9 18C9 19.1046 8.10457 20 7 20C5.89543 20 5 19.1046 5 18Z" fill="#6C737F"/>
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M6 7V3H8V7H6Z" fill="#6C737F"/>
6
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M6 18V13H8V18H6Z" fill="#6C737F"/>
7
+ </svg>
@@ -0,0 +1,13 @@
1
+ export declare const Colors: {
2
+ NAVY_BLUE: string;
3
+ WHITE: string;
4
+ BLACK: string;
5
+ GRAY: string;
6
+ DIRTY_WHITE: string;
7
+ BLUE: string;
8
+ DEEP_BLUE: string;
9
+ DARK_BLUE: string;
10
+ GREEN: string;
11
+ NEUTRAL: string;
12
+ RED: string;
13
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Colors = void 0;
4
+ exports.Colors = {
5
+ NAVY_BLUE: '#6366f1',
6
+ WHITE: '#ffffff',
7
+ BLACK: '#000000',
8
+ GRAY: '#a0a0a0',
9
+ DIRTY_WHITE: '#f3f3f3',
10
+ BLUE: '#2970ff',
11
+ DEEP_BLUE: '#2970ff56',
12
+ DARK_BLUE: '#1C2536',
13
+ GREEN: '#16b364',
14
+ NEUTRAL: '#e4e7e7',
15
+ RED: '#F04438'
16
+ };
@@ -0,0 +1,20 @@
1
+ import { NodeTypeEnum } from '../modules/node/enums';
2
+ export declare const Config: {
3
+ VERTICAL_SHIFT: number;
4
+ HORIZONTAL_SHIFT: number;
5
+ NODE_HEIGHT: number;
6
+ NODE_WIDTH: number;
7
+ SETTINGS_WINDOW_MIN_WIDTH: number;
8
+ ADD_BUTTON_WIDTH: number;
9
+ CONNECTION_WIDTH: number;
10
+ NODES_WITH_DOUBLE_CONNECTION: NodeTypeEnum[];
11
+ NODES_WITHOUT_SAVE_BUTTON: NodeTypeEnum[];
12
+ HUB_NODE_HEIGHT: number;
13
+ EDGE_NODE_HEIGHT: number;
14
+ PARALLEL_NODE_HEIGHT: number;
15
+ ADD_BUTTON_SHIFT: number;
16
+ MAX_SCALE: number;
17
+ MIN_SCALE: number;
18
+ SET_NODE_DELAY: number;
19
+ CLEAR_NODE_DELAY: number;
20
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Config = void 0;
4
+ const enums_1 = require("../modules/node/enums");
5
+ exports.Config = {
6
+ VERTICAL_SHIFT: 152,
7
+ HORIZONTAL_SHIFT: 400,
8
+ NODE_HEIGHT: 72,
9
+ NODE_WIDTH: 320,
10
+ SETTINGS_WINDOW_MIN_WIDTH: 600,
11
+ ADD_BUTTON_WIDTH: 18,
12
+ CONNECTION_WIDTH: 2,
13
+ NODES_WITH_DOUBLE_CONNECTION: [
14
+ enums_1.NodeTypeEnum.ChoiceNode,
15
+ enums_1.NodeTypeEnum.ParallelNode,
16
+ ],
17
+ NODES_WITHOUT_SAVE_BUTTON: [
18
+ enums_1.NodeTypeEnum.ParallelNode
19
+ ],
20
+ HUB_NODE_HEIGHT: 10,
21
+ EDGE_NODE_HEIGHT: 48,
22
+ PARALLEL_NODE_HEIGHT: 32,
23
+ ADD_BUTTON_SHIFT: 30,
24
+ MAX_SCALE: 1,
25
+ MIN_SCALE: 0.3,
26
+ SET_NODE_DELAY: 250,
27
+ CLEAR_NODE_DELAY: 200
28
+ };
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import NodesFlow from "./modules/flow/components/NodesFlow";
2
+ export * from "./modules/node/enums";
3
+ export * from "./modules/node/types";
4
+ export { NodesFlow };
package/lib/index.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.NodesFlow = void 0;
21
+ const NodesFlow_1 = __importDefault(require("./modules/flow/components/NodesFlow"));
22
+ exports.NodesFlow = NodesFlow_1.default;
23
+ __exportStar(require("./modules/node/enums"), exports);
24
+ __exportStar(require("./modules/node/types"), exports);
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface IProps {
3
+ Content?: JSX.Element;
4
+ HeaderContent?: JSX.Element;
5
+ open: boolean;
6
+ onClose: () => void;
7
+ }
8
+ export declare const HorizontalDrawer: ({ Content, HeaderContent, open, onClose }: IProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HorizontalDrawer = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const material_1 = require("@mui/material");
10
+ const Close_1 = __importDefault(require("@mui/icons-material/Close"));
11
+ const DragHandle_1 = __importDefault(require("@mui/icons-material/DragHandle"));
12
+ const HorizontalDrawer = ({ Content, HeaderContent, open, onClose }) => {
13
+ const [drawerWidth, setDrawerWidth] = (0, react_1.useState)("");
14
+ const isWidthLessThan1300 = (0, material_1.useMediaQuery)("(max-width:1300px)");
15
+ const isWidthLessThan1000 = (0, material_1.useMediaQuery)("(max-width:1000px)");
16
+ const isWidthLessThan700 = (0, material_1.useMediaQuery)("(max-width:700px)");
17
+ const isWidthLessThan400 = (0, material_1.useMediaQuery)("(max-width:400px)");
18
+ const getDefaultWidth = () => {
19
+ if (isWidthLessThan400)
20
+ return "80%";
21
+ if (isWidthLessThan700)
22
+ return "70%";
23
+ if (isWidthLessThan1000)
24
+ return "50%";
25
+ if (isWidthLessThan1300)
26
+ return "40%";
27
+ return "35%";
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
+ const DraggerElement = () => {
39
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { onMouseDown: (e) => {
40
+ e.preventDefault();
41
+ window.addEventListener("mousemove", handleDrag);
42
+ window.addEventListener("mouseup", () => {
43
+ window.removeEventListener("mousemove", handleDrag);
44
+ });
45
+ }, sx: {
46
+ display: "flex",
47
+ alignItems: "center",
48
+ width: "24px",
49
+ height: "24px",
50
+ cursor: "ew-resize",
51
+ }, children: (0, jsx_runtime_1.jsx)(DragHandle_1.default, { sx: {
52
+ transform: "rotate(90deg)",
53
+ color: "#a0a0a0",
54
+ } }) }));
55
+ };
56
+ return ((0, jsx_runtime_1.jsx)(material_1.Drawer, { variant: "persistent", open: open, anchor: "right", sx: {
57
+ flexShrink: 0,
58
+ "& .MuiDrawer-paper": {
59
+ width: drawerWidth || getDefaultWidth(),
60
+ height: "calc(100% - 66px)",
61
+ marginTop: "66px",
62
+ borderTopLeftRadius: "16px",
63
+ boxShadow: "0px 9px 46px 0px #00000014",
64
+ border: "none",
65
+ },
66
+ }, children: open && ((0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: onClose, mouseEvent: "onPointerDown", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
67
+ overflow: "hidden",
68
+ height: "100%",
69
+ display: "flex",
70
+ flexDirection: "row",
71
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
72
+ display: "flex",
73
+ justifyContent: "center",
74
+ alignItems: "center",
75
+ padding: "6px",
76
+ }, children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: "flex", alignItems: "center" }, children: (0, jsx_runtime_1.jsx)(DraggerElement, {}) }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
77
+ display: "grid",
78
+ flexGrow: 1,
79
+ overflow: "auto",
80
+ paddingTop: "40px",
81
+ paddingBottom: "24px",
82
+ paddingRight: "40px",
83
+ gridTemplateRows: 'min-content'
84
+ }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginBottom: "10px", children: [HeaderContent && HeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": "close", onClick: onClose, children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { flex: 1 }, children: Content })] })] }) })) }));
85
+ };
86
+ exports.HorizontalDrawer = HorizontalDrawer;
@@ -0,0 +1,8 @@
1
+ import { FC } from "react";
2
+ type PropsType = {
3
+ zoomIn: () => void;
4
+ zoomOut: () => void;
5
+ resetTransform: () => void;
6
+ };
7
+ declare const ZoomToolbar: FC<PropsType>;
8
+ export default ZoomToolbar;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const material_1 = require("@mui/material");
8
+ const ZoomOut_1 = __importDefault(require("@mui/icons-material/ZoomOut"));
9
+ const ZoomIn_1 = __importDefault(require("@mui/icons-material/ZoomIn"));
10
+ const RestartAlt_1 = __importDefault(require("@mui/icons-material/RestartAlt"));
11
+ const styled_1 = require("./styled");
12
+ const ZoomToolbar = ({ zoomIn, zoomOut, resetTransform }) => {
13
+ return ((0, jsx_runtime_1.jsx)(styled_1.Container, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 2, direction: 'row', alignItems: 'center', width: '100%', children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => zoomIn(), children: (0, jsx_runtime_1.jsx)(ZoomIn_1.default, {}) }), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => zoomOut(), children: (0, jsx_runtime_1.jsx)(ZoomOut_1.default, {}) }), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => resetTransform(), children: (0, jsx_runtime_1.jsx)(RestartAlt_1.default, {}) })] }) }));
14
+ };
15
+ exports.default = ZoomToolbar;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
+ children?: import("react").ReactNode;
4
+ component?: import("react").ElementType<any> | undefined;
5
+ ref?: import("react").Ref<unknown> | undefined;
6
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
7
+ } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
8
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
9
+ }, "children" | "ref" | ("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") | "component" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Container = void 0;
4
+ const system_1 = require("@mui/system");
5
+ const material_1 = require("@mui/material");
6
+ exports.Container = (0, system_1.styled)(material_1.Box) `
7
+ width: 100%;
8
+ border-radius: 8px;
9
+ box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.1);
10
+ border: 2px solid;
11
+ border-color: ${props => `${props.theme.palette?.background?.paper}`};
12
+ background: ${props => `${props.theme.palette?.background?.paper}`};
13
+ `;
@@ -0,0 +1,2 @@
1
+ export { default as ZoomToolbar } from './ZoomToolbar';
2
+ export { HorizontalDrawer } from "./HorizontalDrawer";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HorizontalDrawer = exports.ZoomToolbar = void 0;
7
+ var ZoomToolbar_1 = require("./ZoomToolbar");
8
+ Object.defineProperty(exports, "ZoomToolbar", { enumerable: true, get: function () { return __importDefault(ZoomToolbar_1).default; } });
9
+ var HorizontalDrawer_1 = require("./HorizontalDrawer");
10
+ Object.defineProperty(exports, "HorizontalDrawer", { enumerable: true, get: function () { return HorizontalDrawer_1.HorizontalDrawer; } });
@@ -0,0 +1,24 @@
1
+ import React, { FC, PropsWithChildren } from "react";
2
+ import { Theme } from "../../types";
3
+ import { PaletteColorOptions } from "@mui/material";
4
+ declare module '@mui/material/styles' {
5
+ interface Palette {
6
+ myAwesomeColor: PaletteColorOptions;
7
+ neutral50: PaletteColorOptions;
8
+ }
9
+ interface PaletteOptions {
10
+ myAwesomeColor: PaletteColorOptions;
11
+ neutral50: PaletteColorOptions;
12
+ }
13
+ interface TypographyVariants {
14
+ buttonLarge: React.CSSProperties;
15
+ }
16
+ interface TypographyVariantsOptions {
17
+ buttonLarge?: React.CSSProperties;
18
+ }
19
+ }
20
+ type PropTypes = {
21
+ themContextValue: Theme;
22
+ } & PropsWithChildren;
23
+ declare const ThemeContextProvider: FC<PropTypes>;
24
+ export { ThemeContextProvider };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThemeContextProvider = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const ThemeContextProvider = ({ children, themContextValue }) => {
7
+ return (0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: themContextValue, children: children });
8
+ };
9
+ exports.ThemeContextProvider = ThemeContextProvider;
@@ -0,0 +1,10 @@
1
+ import { UpdateNodePosition } from "../types";
2
+ interface IProps {
3
+ id: string;
4
+ onUpdate?: UpdateNodePosition;
5
+ }
6
+ export declare const useDragNode: ({ id, onUpdate }: IProps) => {
7
+ isDragging: boolean;
8
+ drag: import("react-dnd").ConnectDragSource;
9
+ };
10
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDragNode = void 0;
4
+ const react_dnd_1 = require("react-dnd");
5
+ const useDragNode = ({ id, onUpdate }) => {
6
+ const [{ isDragging }, drag] = (0, react_dnd_1.useDrag)(() => ({
7
+ type: 'Node',
8
+ item: { id },
9
+ end: (item, monitor) => {
10
+ const dropPosition = monitor.getDropResult();
11
+ const isSamePosition = dropPosition?.parentId === id;
12
+ if (item && dropPosition && !isSamePosition && onUpdate) {
13
+ onUpdate({
14
+ nodeId: id,
15
+ branch: dropPosition.branch,
16
+ parentId: dropPosition.parentId
17
+ });
18
+ }
19
+ },
20
+ collect: (monitor) => ({
21
+ isDragging: monitor.isDragging(),
22
+ handlerId: monitor.getHandlerId(),
23
+ }),
24
+ }));
25
+ return { isDragging, drag };
26
+ };
27
+ exports.useDragNode = useDragNode;
@@ -0,0 +1,11 @@
1
+ interface IProps {
2
+ parentId?: string;
3
+ branch: number;
4
+ childId: string;
5
+ }
6
+ export declare const useDropNode: ({ parentId, branch, childId }: IProps) => {
7
+ canDrop: boolean;
8
+ isOver: boolean;
9
+ drop: import("react-dnd").ConnectDropTarget;
10
+ };
11
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDropNode = void 0;
4
+ const react_dnd_1 = require("react-dnd");
5
+ const useDropNode = ({ parentId, branch, childId }) => {
6
+ const [{ canDrop, isOver }, drop] = (0, react_dnd_1.useDrop)(() => ({
7
+ accept: 'Node',
8
+ drop: () => ({ childId, parentId, branch }),
9
+ collect: (monitor) => ({
10
+ isOver: monitor.isOver(),
11
+ canDrop: monitor.canDrop(),
12
+ }),
13
+ }));
14
+ return { canDrop, isOver, drop };
15
+ };
16
+ exports.useDropNode = useDropNode;
@@ -0,0 +1,69 @@
1
+ /// <reference types="react" />
2
+ export type MenuItemType = {
3
+ name: string;
4
+ value: string;
5
+ icon: JSX.Element;
6
+ };
7
+ export type MenuTabType = {
8
+ name: string;
9
+ menuItems: MenuItemType[];
10
+ };
11
+ export type PointType = {
12
+ name?: string;
13
+ x: number;
14
+ y: number;
15
+ };
16
+ interface Color {
17
+ main: string;
18
+ contrastText?: string;
19
+ light?: string;
20
+ dark?: string;
21
+ }
22
+ interface Palette {
23
+ mode: 'light' | 'dark';
24
+ primary: Color;
25
+ secondary: Color;
26
+ info: Color;
27
+ error: Color;
28
+ success: Color;
29
+ background: {
30
+ default: string;
31
+ paper: string;
32
+ };
33
+ text: {
34
+ primary: string;
35
+ secondary: string;
36
+ disabled: string;
37
+ };
38
+ myAwesomeColor: Color;
39
+ divider: string;
40
+ neutral50: Color;
41
+ }
42
+ interface TypographyVariant {
43
+ fontSize: string;
44
+ fontWeight: string;
45
+ fontFamily?: string;
46
+ textTransform?: string;
47
+ }
48
+ interface Typography {
49
+ fontFamily: string;
50
+ button: TypographyVariant;
51
+ h3: TypographyVariant;
52
+ h4: TypographyVariant;
53
+ h6: TypographyVariant;
54
+ body2: TypographyVariant;
55
+ buttonLarge: TypographyVariant;
56
+ }
57
+ export interface Theme {
58
+ palette: Palette;
59
+ typography: Typography;
60
+ }
61
+ export interface ThemeContextValueType extends Theme {
62
+ addButtonColor?: string;
63
+ }
64
+ export type UpdateNodePosition = (props: {
65
+ nodeId: string;
66
+ branch: number;
67
+ parentId: string;
68
+ }) => any;
69
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import React, { Ref } from "react";
2
+ import { PointType } from "../../../common/types";
3
+ import { NodeType } from "../../../node/types";
4
+ import { ConnectionCurveEnum } from "../../enums";
5
+ interface IProps {
6
+ startPoint: PointType;
7
+ endPoint: PointType;
8
+ parentId: string | undefined;
9
+ childNodeId: string;
10
+ node: NodeType;
11
+ curveType?: ConnectionCurveEnum;
12
+ onClick?: (event: React.MouseEvent<SVGSVGElement>) => void;
13
+ innerRef: Ref<any>;
14
+ }
15
+ export declare const AddButton: ({ endPoint, startPoint, node, curveType, parentId, childNodeId, onClick, innerRef }: IProps) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddButton = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const useDropNode_1 = require("../../../common/hooks/useDropNode");
6
+ const connectionParametersServices_1 = require("../../services/connectionParametersServices");
7
+ const config_1 = require("../../../../config");
8
+ const styled_1 = require("./styled");
9
+ const ConnectionWithButton_1 = require("../ConnectionWithButton");
10
+ const enums_1 = require("../../enums");
11
+ const colors_1 = require("../../../../config/colors");
12
+ const material_1 = require("@mui/material");
13
+ const AddButton = ({ endPoint, startPoint, node, curveType, parentId, childNodeId, onClick, innerRef }) => {
14
+ const theme = (0, material_1.useTheme)();
15
+ const background = theme.palette?.background?.default || colors_1.Colors.DIRTY_WHITE;
16
+ const positionIntoEmptyChoiceNode = !curveType ? 0 : curveType === enums_1.ConnectionCurveEnum.RIGHT ? 2 : 1;
17
+ const branch = positionIntoEmptyChoiceNode || (node?.rightChildrenId === childNodeId ? 2 : 1);
18
+ const { drop, canDrop, isOver } = (0, useDropNode_1.useDropNode)({
19
+ parentId,
20
+ branch,
21
+ childId: childNodeId
22
+ });
23
+ const { width, y, top, } = connectionParametersServices_1.connectionParametersServices.calculateConnectionParameters({
24
+ endPoint,
25
+ startPoint,
26
+ node,
27
+ curveType,
28
+ });
29
+ const widthDiff = (config_1.Config.ADD_BUTTON_WIDTH - config_1.Config.CONNECTION_WIDTH) / 2;
30
+ const xPosition = top ? startPoint.x - widthDiff + width : startPoint.x - widthDiff;
31
+ const yPosition = y + ConnectionWithButton_1.nodeHeightByType[node.type] / 2 + config_1.Config.ADD_BUTTON_SHIFT;
32
+ const PlusButton = (0, styled_1.createAddButton)({
33
+ background,
34
+ x: xPosition,
35
+ y: yPosition,
36
+ });
37
+ const Placeholder = (0, styled_1.createPlaceholder)(isOver, canDrop);
38
+ const xDropZone = xPosition - (config_1.Config.NODE_WIDTH / 2 - 5);
39
+ const yDropZone = yPosition - (config_1.Config.NODE_HEIGHT / 2 - config_1.Config.ADD_BUTTON_WIDTH / 2);
40
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Placeholder, { ref: drop, sx: {
41
+ top: yDropZone,
42
+ left: xDropZone,
43
+ } }), (0, jsx_runtime_1.jsx)(PlusButton, { onClick: onClick, ref: innerRef })] }));
44
+ };
45
+ exports.AddButton = AddButton;
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ type AddButtonPropsType = {
3
+ background?: string;
4
+ x: number;
5
+ y: number;
6
+ };
7
+ export declare const createAddButton: ({ background, x, y, }: AddButtonPropsType) => import("@emotion/styled").StyledComponent<{
8
+ children?: import("react").ReactNode;
9
+ classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
10
+ color?: import("@mui/types").OverridableStringUnion<"error" | "inherit" | "action" | "disabled" | "success" | "info" | "warning" | "primary" | "secondary", import("@mui/material").SvgIconPropsColorOverrides> | undefined;
11
+ fontSize?: import("@mui/types").OverridableStringUnion<"small" | "medium" | "inherit" | "large", import("@mui/material").SvgIconPropsSizeOverrides> | undefined;
12
+ htmlColor?: string | undefined;
13
+ inheritViewBox?: boolean | undefined;
14
+ shapeRendering?: string | undefined;
15
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
16
+ titleAccess?: string | undefined;
17
+ viewBox?: string | undefined;
18
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & {
19
+ ref?: ((instance: SVGSVGElement | null) => void) | import("react").RefObject<SVGSVGElement> | null | undefined;
20
+ }, "color" | "fontSize" | "shapeRendering" | "children" | "viewBox" | "sx" | keyof import("@mui/material/OverridableComponent").CommonProps | "htmlColor" | "inheritViewBox" | "titleAccess"> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
21
+ export declare const createPlaceholder: (isOver: boolean, canDrop: boolean) => import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
22
+ children?: import("react").ReactNode;
23
+ component?: import("react").ElementType<any> | undefined;
24
+ ref?: import("react").Ref<unknown> | undefined;
25
+ sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
26
+ } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
27
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
28
+ }, "children" | "ref" | ("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") | "component" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
29
+ export {};