@linkdlab/funcnodes_react_flow 0.1.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 (67) hide show
  1. package/README.md +46 -0
  2. package/package copy.json +63 -0
  3. package/package.json +75 -0
  4. package/public/favicon.ico +0 -0
  5. package/public/index.html +43 -0
  6. package/public/logo192.png +0 -0
  7. package/public/logo512.png +0 -0
  8. package/public/manifest.json +25 -0
  9. package/public/robots.txt +3 -0
  10. package/public/worker_manager +1 -0
  11. package/src/App.css +38 -0
  12. package/src/App.test.tsx +9 -0
  13. package/src/App.tsx +22 -0
  14. package/src/frontend/datarenderer/images.tsx +28 -0
  15. package/src/frontend/datarenderer/index.tsx +53 -0
  16. package/src/frontend/datarenderer/plotly.tsx +82 -0
  17. package/src/frontend/dialog.scss +88 -0
  18. package/src/frontend/dialog.tsx +70 -0
  19. package/src/frontend/edge.scss +15 -0
  20. package/src/frontend/edge.tsx +31 -0
  21. package/src/frontend/funcnodesreactflow.scss +63 -0
  22. package/src/frontend/funcnodesreactflow.tsx +283 -0
  23. package/src/frontend/header/header.scss +48 -0
  24. package/src/frontend/header/index.tsx +268 -0
  25. package/src/frontend/index.tsx +4 -0
  26. package/src/frontend/layout/htmlelements.scss +63 -0
  27. package/src/frontend/lib.scss +157 -0
  28. package/src/frontend/lib.tsx +198 -0
  29. package/src/frontend/node/index.tsx +3 -0
  30. package/src/frontend/node/io/default_input_renderer.tsx +327 -0
  31. package/src/frontend/node/io/default_output_render.tsx +26 -0
  32. package/src/frontend/node/io/handle_renderer.tsx +89 -0
  33. package/src/frontend/node/io/index.tsx +4 -0
  34. package/src/frontend/node/io/io.scss +91 -0
  35. package/src/frontend/node/io/io.tsx +114 -0
  36. package/src/frontend/node/io/nodeinput.tsx +125 -0
  37. package/src/frontend/node/io/nodeoutput.tsx +37 -0
  38. package/src/frontend/node/node.scss +265 -0
  39. package/src/frontend/node/node.tsx +208 -0
  40. package/src/frontend/nodecontextmenu.scss +18 -0
  41. package/src/frontend/utils/colorpicker.scss +37 -0
  42. package/src/frontend/utils/colorpicker.tsx +342 -0
  43. package/src/frontend/utils/jsondata.tsx +19 -0
  44. package/src/frontend/utils/table.scss +22 -0
  45. package/src/frontend/utils/table.tsx +159 -0
  46. package/src/funcnodes/funcnodesworker.ts +455 -0
  47. package/src/funcnodes/index.ts +4 -0
  48. package/src/funcnodes/websocketworker.ts +153 -0
  49. package/src/funcnodes/workermanager.ts +229 -0
  50. package/src/index.css +13 -0
  51. package/src/index.tsx +19 -0
  52. package/src/logo.svg +1 -0
  53. package/src/react-app-env.d.ts +1 -0
  54. package/src/reportWebVitals.ts +15 -0
  55. package/src/setupTests.ts +5 -0
  56. package/src/state/edge.ts +35 -0
  57. package/src/state/fnrfzst.ts +440 -0
  58. package/src/state/index.ts +139 -0
  59. package/src/state/lib.ts +26 -0
  60. package/src/state/node.ts +118 -0
  61. package/src/state/nodespace.ts +151 -0
  62. package/src/state/reactflow.ts +65 -0
  63. package/src/types/lib.d.ts +16 -0
  64. package/src/types/node.d.ts +29 -0
  65. package/src/types/nodeio.d.ts +82 -0
  66. package/src/types/worker.d.ts +56 -0
  67. package/tsconfig.json +20 -0
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Getting Started with Create React App
2
+
3
+ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run:
8
+
9
+ ### `yarn start`
10
+
11
+ Runs the app in the development mode.\
12
+ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
+
14
+ The page will reload if you make edits.\
15
+ You will also see any lint errors in the console.
16
+
17
+ ### `yarn test`
18
+
19
+ Launches the test runner in the interactive watch mode.\
20
+ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21
+
22
+ ### `yarn build`
23
+
24
+ Builds the app for production to the `build` folder.\
25
+ It correctly bundles React in production mode and optimizes the build for the best performance.
26
+
27
+ The build is minified and the filenames include the hashes.\
28
+ Your app is ready to be deployed!
29
+
30
+ See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31
+
32
+ ### `yarn eject`
33
+
34
+ **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35
+
36
+ If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
+
38
+ Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39
+
40
+ You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41
+
42
+ ## Learn More
43
+
44
+ You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
+
46
+ To learn React, check out the [React documentation](https://reactjs.org/).
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "funcnodes_react_flow",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "dependencies": {
6
+ "@emotion/react": "^11.11.3",
7
+ "@emotion/styled": "^11.11.0",
8
+ "@mui/icons-material": "^5.15.10",
9
+ "@mui/material": "^5.15.10",
10
+ "@radix-ui/react-dialog": "^1.0.5",
11
+ "@radix-ui/react-popover": "^1.0.7",
12
+ "@radix-ui/react-tooltip": "^1.0.7",
13
+ "@testing-library/jest-dom": "^5.14.1",
14
+ "@testing-library/react": "^13.0.0",
15
+ "@testing-library/user-event": "^13.2.1",
16
+ "@types/color-convert": "^2.0.3",
17
+ "@types/jest": "^27.0.1",
18
+ "@types/node": "^16.7.13",
19
+ "@types/plotly.js": "^2.29.1",
20
+ "@types/react": "^18.0.0",
21
+ "@types/react-dom": "^18.0.0",
22
+ "@types/react-plotly.js": "^2.6.3",
23
+ "@types/uuid": "^9.0.8",
24
+ "color-convert": "^2.0.1",
25
+ "plotly.js": "^2.29.1",
26
+ "react": "^18.2.0",
27
+ "react-dom": "^18.2.0",
28
+ "react-json-view-lite": "^1.3.0",
29
+ "react-plotly.js": "^2.6.0",
30
+ "react-scripts": "5.0.1",
31
+ "reactflow": "^11.10.3",
32
+ "sass": "^1.70.0",
33
+ "scss": "^0.2.4",
34
+ "typescript": "^4.4.2",
35
+ "uuid": "^9.0.1",
36
+ "web-vitals": "^2.1.0",
37
+ "zustand": "^4.5.0"
38
+ },
39
+ "scripts": {
40
+ "start": "react-scripts start",
41
+ "build": "react-scripts build",
42
+ "test": "react-scripts test",
43
+ "eject": "react-scripts eject"
44
+ },
45
+ "eslintConfig": {
46
+ "extends": [
47
+ "react-app",
48
+ "react-app/jest"
49
+ ]
50
+ },
51
+ "browserslist": {
52
+ "production": [
53
+ ">0.2%",
54
+ "not dead",
55
+ "not op_mini all"
56
+ ],
57
+ "development": [
58
+ "last 1 chrome version",
59
+ "last 1 firefox version",
60
+ "last 1 safari version"
61
+ ]
62
+ }
63
+ }
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@linkdlab/funcnodes_react_flow",
3
+ "version": "0.1.0",
4
+ "dependencies": {
5
+ "@emotion/react": "^11.11.3",
6
+ "@emotion/styled": "^11.11.0",
7
+ "@mui/icons-material": "^5.15.10",
8
+ "@mui/material": "^5.15.10",
9
+ "@radix-ui/react-dialog": "^1.0.5",
10
+ "@radix-ui/react-popover": "^1.0.7",
11
+ "@radix-ui/react-tooltip": "^1.0.7",
12
+ "@testing-library/jest-dom": "^5.14.1",
13
+ "@testing-library/react": "^13.0.0",
14
+ "@testing-library/user-event": "^13.2.1",
15
+ "@types/color-convert": "^2.0.3",
16
+ "@types/jest": "^27.0.1",
17
+ "@types/node": "^16.7.13",
18
+ "@types/plotly.js": "^2.29.1",
19
+ "@types/react": "^18.0.0",
20
+ "@types/react-dom": "^18.0.0",
21
+ "@types/react-plotly.js": "^2.6.3",
22
+ "@types/uuid": "^9.0.8",
23
+ "color-convert": "^2.0.1",
24
+ "plotly.js": "^2.29.1",
25
+ "react": "^18.2.0",
26
+ "react-dom": "^18.2.0",
27
+ "react-json-view-lite": "^1.3.0",
28
+ "react-plotly.js": "^2.6.0",
29
+ "react-scripts": "5.0.1",
30
+ "reactflow": "^11.10.3",
31
+ "sass": "^1.70.0",
32
+ "scss": "^0.2.4",
33
+ "typescript": "^4.4.2",
34
+ "uuid": "^9.0.1",
35
+ "web-vitals": "^2.1.0",
36
+ "zustand": "^4.5.0"
37
+ },
38
+ "scripts": {
39
+ "start": "react-scripts start",
40
+ "build": "react-scripts build",
41
+ "test": "react-scripts test",
42
+ "eject": "react-scripts eject"
43
+ },
44
+ "eslintConfig": {
45
+ "extends": [
46
+ "react-app",
47
+ "react-app/jest"
48
+ ]
49
+ },
50
+ "browserslist": {
51
+ "production": [
52
+ ">0.2%",
53
+ "not dead",
54
+ "not op_mini all"
55
+ ],
56
+ "development": [
57
+ "last 1 chrome version",
58
+ "last 1 firefox version",
59
+ "last 1 safari version"
60
+ ]
61
+ },
62
+ "description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
63
+ "main": "index.js",
64
+ "devDependencies": {},
65
+ "repository": {
66
+ "type": "git",
67
+ "url": "git+https://github.com/Linkdlab/FuncNodesReact.git"
68
+ },
69
+ "author": "Julian Kimmig",
70
+ "license": "ISC",
71
+ "bugs": {
72
+ "url": "https://github.com/Linkdlab/FuncNodesReact/issues"
73
+ },
74
+ "homepage": "https://github.com/Linkdlab/FuncNodesReact#readme"
75
+ }
Binary file
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>FuncNodes</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root"></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
@@ -0,0 +1 @@
1
+ ws://localhost:9380
package/src/App.css ADDED
@@ -0,0 +1,38 @@
1
+ .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-logo {
6
+ height: 40vmin;
7
+ pointer-events: none;
8
+ }
9
+
10
+ @media (prefers-reduced-motion: no-preference) {
11
+ .App-logo {
12
+ animation: App-logo-spin infinite 20s linear;
13
+ }
14
+ }
15
+
16
+ .App-header {
17
+ background-color: #282c34;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: calc(10px + 2vmin);
24
+ color: white;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ @keyframes App-logo-spin {
32
+ from {
33
+ transform: rotate(0deg);
34
+ }
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import App from './App';
4
+
5
+ test('renders learn react link', () => {
6
+ render(<App />);
7
+ const linkElement = screen.getByText(/learn react/i);
8
+ expect(linkElement).toBeInTheDocument();
9
+ });
package/src/App.tsx ADDED
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import "./App.css";
3
+ import "reactflow/dist/style.css";
4
+ import FuncnodesReactFlow from "./frontend";
5
+
6
+ function App() {
7
+ return (
8
+ <div
9
+ className="App"
10
+ style={{
11
+ height: "98vh",
12
+ width: "98vw",
13
+ marginLeft: "1vw",
14
+ marginTop: "1vh",
15
+ }}
16
+ >
17
+ <FuncnodesReactFlow></FuncnodesReactFlow>
18
+ </div>
19
+ );
20
+ }
21
+
22
+ export default App;
@@ -0,0 +1,28 @@
1
+ import { BaseRenderOptions } from ".";
2
+ interface ImageRenderOptions extends BaseRenderOptions {
3
+ format?: "png" | "jpeg";
4
+ }
5
+
6
+ const Base64ImageRenderer = ({
7
+ value,
8
+ renderoptions,
9
+ }: {
10
+ value: string;
11
+ renderoptions?: ImageRenderOptions;
12
+ }) => {
13
+ if (renderoptions === undefined) renderoptions = {};
14
+ if (renderoptions.format === undefined) renderoptions.format = "jpeg";
15
+
16
+ return (
17
+ <img
18
+ src={"data:image/"+renderoptions.format+";base64," + value}
19
+ style={{
20
+ maxWidth: "100%",
21
+ maxHeight: "100%",
22
+ }}
23
+ />
24
+ );
25
+ };
26
+
27
+ export { Base64ImageRenderer };
28
+ export type { ImageRenderOptions };
@@ -0,0 +1,53 @@
1
+ import { Base64ImageRenderer, ImageRenderOptions } from "./images";
2
+ import AnyPlot from "./plotly";
3
+
4
+ interface BaseRenderOptions {
5
+ type?: RenderType;
6
+ }
7
+
8
+ interface StringRenderOptions extends BaseRenderOptions {
9
+ max_length?: number;
10
+ }
11
+ type RenderOptions =
12
+ | BaseRenderOptions
13
+ | ImageRenderOptions
14
+ | StringRenderOptions;
15
+
16
+ const StringRenderer = ({
17
+ value,
18
+ renderoptions,
19
+ }: {
20
+ value: any;
21
+ renderoptions?: StringRenderOptions;
22
+ }) => {
23
+ let string = JSON.stringify(value, null, 2);
24
+ const max_length = renderoptions?.max_length || 1000;
25
+ // shorten string if too long
26
+ if (string.length > max_length) {
27
+ string = string.substring(0, max_length) + "...";
28
+ }
29
+
30
+ return <>{string}</>;
31
+ };
32
+ const RENDERTYPES: {
33
+ [key: string]: ({
34
+ value,
35
+ renderoptions,
36
+ }: {
37
+ value: any;
38
+ renderoptions?: RenderOptions;
39
+ }) => JSX.Element;
40
+ } = {
41
+ image: Base64ImageRenderer,
42
+ string: StringRenderer,
43
+ str: StringRenderer,
44
+ plot: AnyPlot,
45
+ };
46
+ const get_rendertype = (rendertype: string) => {
47
+ const rt = RENDERTYPES[rendertype];
48
+ if (rt === undefined) return RENDERTYPES["string"];
49
+ return rt;
50
+ };
51
+
52
+ export default get_rendertype;
53
+ export type { RenderOptions, BaseRenderOptions };
@@ -0,0 +1,82 @@
1
+ import Plot from "react-plotly.js";
2
+ import { BaseRenderOptions } from ".";
3
+
4
+ interface PlotlyRenderOptions extends BaseRenderOptions {
5
+ plottype?: "line" | "scatter" | "imshow";
6
+ layout?: any;
7
+ colorscale?: string;
8
+ }
9
+ const AnyPlot = ({
10
+ value,
11
+ renderoptions,
12
+ }: {
13
+ value: any;
14
+ renderoptions?: PlotlyRenderOptions;
15
+ }) => {
16
+ if (renderoptions === undefined) {
17
+ renderoptions = {};
18
+ }
19
+ if (value === undefined) {
20
+ return <></>;
21
+ }
22
+
23
+ renderoptions.plottype = renderoptions.plottype || "line";
24
+
25
+ const data: Plotly.Data[] = [];
26
+ const layout: Partial<Plotly.Layout> = renderoptions.layout || {};
27
+
28
+ // tight layout
29
+ layout.margin = { t: 50, r: 50, l: 50, b: 50 };
30
+
31
+ if (renderoptions.plottype === "imshow") {
32
+ // check if value is a 2D array
33
+ if (!Array.isArray(value) || !Array.isArray(value[0])) {
34
+ console.error("imshow plottype requires a 2D array");
35
+ return <></>;
36
+ }
37
+ // if is 3data, aassume rgb
38
+ if (Array.isArray(value[0][0])) {
39
+ //check image colorchannel
40
+ if (renderoptions?.colorscale === "bgr") {
41
+ value = value.map((row: any) =>
42
+ row.map((pixel: any) => [pixel[2], pixel[1], pixel[0]])
43
+ );
44
+ }
45
+ data.push({
46
+ z: value,
47
+ type: "image",
48
+ colorscale: "rgb",
49
+ });
50
+ // disable axis
51
+ layout.xaxis = { visible: false };
52
+ layout.yaxis = { visible: false };
53
+ layout.margin = { t: 0, r: 0, l: 0, b: 0 };
54
+ } else {
55
+ data.push({
56
+ z: value,
57
+ type: "heatmap",
58
+ colorscale: renderoptions?.colorscale || "Viridis",
59
+ });
60
+ }
61
+ }
62
+
63
+ // auto resize
64
+ layout.autosize = true;
65
+
66
+ return (
67
+ <div
68
+ style={{ minWidth: 300, maxHeight: 300, maxWidth: 300, minHeight: 300 }}
69
+ >
70
+ <Plot
71
+ data={data}
72
+ layout={layout}
73
+ useResizeHandler={true}
74
+ style={{ width: "100%", height: "100%" }}
75
+ />
76
+ </div>
77
+ );
78
+ };
79
+
80
+ export {};
81
+ export default AnyPlot;
82
+ export type { PlotlyRenderOptions };
@@ -0,0 +1,88 @@
1
+ .dialogoverlay {
2
+ background-color: rgba(0, 0, 0, 0.5);
3
+ position: fixed;
4
+ inset: 0;
5
+ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
6
+ }
7
+
8
+ .dialogconent {
9
+ background-color: var(--funcnodesbackground1);
10
+ border-radius: 6px;
11
+ box-shadow: var(--funheadercolor) 0px 10px 38px -10px,
12
+ var(--funheadercolor) 0px 10px 20px -15px;
13
+ position: fixed;
14
+ top: 50%;
15
+ left: 50%;
16
+ transform: translate(-50%, -50%);
17
+ width: 90vw;
18
+ max-width: 85vh;
19
+ max-height: 85vh;
20
+ padding: 25px;
21
+ animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
22
+ color: var(--funcnodestextcolor1);
23
+ border: 1px solid var(--funheadercolor);
24
+ display: flex;
25
+ flex-direction: column;
26
+ }
27
+
28
+ .dialogtitle {
29
+ margin: 0;
30
+ font-weight: 500;
31
+ color: var(--funheadercolor);
32
+ font-size: 17px;
33
+ }
34
+
35
+ .dialogdescription {
36
+ margin: 10px 0 20px;
37
+ font-size: 15px;
38
+ line-height: 1.5;
39
+ }
40
+
41
+ .dialogclosebutton {
42
+ border-radius: 100%;
43
+ height: 25px;
44
+ width: 25px;
45
+ display: inline-flex;
46
+ background-color: inherit;
47
+ align-items: center;
48
+ justify-content: center;
49
+ color: var(--funheadercolor);
50
+ position: absolute;
51
+ top: 10px;
52
+ right: 10px;
53
+ border: none;
54
+
55
+ &:hover {
56
+ background-color: var(--funheadercolor);
57
+ color: var(--funcnodesbackground1);
58
+ }
59
+ &:active {
60
+ background-color: var(--funheadercolor);
61
+ color: var(--funcnodestextcolor1);
62
+ }
63
+ }
64
+
65
+ .dialogsendbutton {
66
+ background-color: var(--funcnodesbackground1);
67
+ color: var(--funheadercolor);
68
+ border: 1px solid var(--funheadercolor);
69
+ border-radius: 99rem;
70
+ padding: 10px 20px;
71
+ cursor: pointer;
72
+ font-size: 15px;
73
+ margin-top: 20px;
74
+
75
+ &:hover {
76
+ background-color: var(--funheadercolor);
77
+ color: var(--funcnodesbackground1);
78
+ }
79
+ &:active {
80
+ background-color: var(--funheadercolor);
81
+ color: var(--funcnodestextcolor1);
82
+ }
83
+ }
84
+
85
+ .dialogchildren {
86
+ margin-top: 20px;
87
+ overflow: auto;
88
+ }
@@ -0,0 +1,70 @@
1
+ import * as Dialog from "@radix-ui/react-dialog";
2
+ import CloseIcon from "@mui/icons-material/Close";
3
+ import "./dialog.scss";
4
+ interface CustomDialogProps {
5
+ trigger?: React.ReactNode;
6
+ title?: string;
7
+ description?: string | React.ReactNode;
8
+ children: React.ReactNode;
9
+ closebutton?: boolean;
10
+ onOpenChange?: (open: boolean) => void;
11
+ buttons?: {
12
+ text: string;
13
+ onClick: () => void;
14
+ }[];
15
+ }
16
+ const CustomDialog = ({
17
+ trigger,
18
+ title,
19
+ description,
20
+ children,
21
+ closebutton = true,
22
+ onOpenChange,
23
+
24
+ buttons = [],
25
+ }: CustomDialogProps) => {
26
+ return (
27
+ <Dialog.Root onOpenChange={onOpenChange}>
28
+ {trigger && <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>}
29
+ <Dialog.Portal>
30
+ <Dialog.Overlay className="dialogoverlay" />
31
+ <Dialog.Content className="dialogconent">
32
+ {title && (
33
+ <Dialog.Title className="dialogtitle">{title}</Dialog.Title>
34
+ )}
35
+ {description && (
36
+ <Dialog.Description className="dialogdescription">
37
+ {description}
38
+ </Dialog.Description>
39
+ )}
40
+ <div className="dialogchildren">{children}</div>
41
+ <div
42
+ style={{
43
+ display: "flex",
44
+ marginTop: 25,
45
+ justifyContent: "flex-end",
46
+ }}
47
+ >
48
+ {(buttons || []).map((button, index) => (
49
+ <Dialog.Close asChild key={index}>
50
+ <button className="dialogsendbutton" onClick={button.onClick}>
51
+ {button.text}
52
+ </button>
53
+ </Dialog.Close>
54
+ ))}
55
+ </div>
56
+ {closebutton && (
57
+ <Dialog.Close asChild>
58
+ <button className="dialogclosebutton" aria-label="Close">
59
+ <CloseIcon />
60
+ </button>
61
+ </Dialog.Close>
62
+ )}
63
+ </Dialog.Content>
64
+ </Dialog.Portal>
65
+ </Dialog.Root>
66
+ );
67
+ };
68
+
69
+ export default CustomDialog;
70
+ export type { CustomDialogProps };
@@ -0,0 +1,15 @@
1
+ :root {
2
+ --funcnodesedgecolor: #7bb3ec;
3
+ }
4
+ .funcnodes-edge {
5
+ & .react-flow__edge-path {
6
+ stroke: var(--funcnodesedgecolor);
7
+ stroke-width: 2px;
8
+ }
9
+
10
+ &.selected {
11
+ & .react-flow__edge-path {
12
+ stroke: #11ff00;
13
+ }
14
+ }
15
+ }