@linkdlab/funcnodes_react_flow 0.1.0 → 0.1.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.
Files changed (194) hide show
  1. package/dist/frontend/datarenderer/images.d.ts +11 -0
  2. package/dist/frontend/datarenderer/images.js +13 -0
  3. package/dist/frontend/datarenderer/images.js.map +1 -0
  4. package/dist/frontend/datarenderer/index.d.ts +16 -0
  5. package/dist/frontend/datarenderer/index.js +26 -0
  6. package/dist/frontend/datarenderer/index.js.map +1 -0
  7. package/dist/frontend/datarenderer/plotly.d.ts +14 -0
  8. package/dist/frontend/datarenderer/plotly.js +53 -0
  9. package/dist/frontend/datarenderer/plotly.js.map +1 -0
  10. package/dist/frontend/dialog.d.ts +17 -0
  11. package/dist/frontend/dialog.js +26 -0
  12. package/dist/frontend/dialog.js.map +1 -0
  13. package/dist/frontend/edge.d.ts +5 -0
  14. package/dist/frontend/edge.js +40 -0
  15. package/dist/frontend/edge.js.map +1 -0
  16. package/dist/frontend/funcnodesreactflow/index.d.ts +6 -0
  17. package/dist/frontend/funcnodesreactflow/index.js +94 -0
  18. package/dist/frontend/funcnodesreactflow/index.js.map +1 -0
  19. package/dist/frontend/funcnodesreactflow/react_flow_layer.d.ts +5 -0
  20. package/dist/frontend/funcnodesreactflow/react_flow_layer.js +149 -0
  21. package/dist/frontend/funcnodesreactflow/react_flow_layer.js.map +1 -0
  22. package/dist/frontend/header/index.d.ts +4 -0
  23. package/dist/frontend/header/index.js +227 -0
  24. package/dist/frontend/header/index.js.map +1 -0
  25. package/{src/frontend/index.tsx → dist/frontend/index.d.ts} +0 -1
  26. package/dist/frontend/index.js +4 -0
  27. package/dist/frontend/index.js.map +1 -0
  28. package/dist/frontend/lib.d.ts +10 -0
  29. package/dist/frontend/lib.js +107 -0
  30. package/dist/frontend/lib.js.map +1 -0
  31. package/{src/frontend/node/index.tsx → dist/frontend/node/index.d.ts} +0 -1
  32. package/dist/frontend/node/index.js +3 -0
  33. package/dist/frontend/node/index.js.map +1 -0
  34. package/dist/frontend/node/io/default_input_renderer.d.ts +11 -0
  35. package/dist/frontend/node/io/default_input_renderer.js +235 -0
  36. package/dist/frontend/node/io/default_input_renderer.js.map +1 -0
  37. package/dist/frontend/node/io/default_output_render.d.ts +6 -0
  38. package/dist/frontend/node/io/default_output_render.js +23 -0
  39. package/dist/frontend/node/io/default_output_render.js.map +1 -0
  40. package/dist/frontend/node/io/handle_renderer.d.ts +6 -0
  41. package/dist/frontend/node/io/handle_renderer.js +70 -0
  42. package/dist/frontend/node/io/handle_renderer.js.map +1 -0
  43. package/{src/frontend/node/io/index.tsx → dist/frontend/node/io/index.d.ts} +0 -1
  44. package/dist/frontend/node/io/index.js +4 -0
  45. package/dist/frontend/node/io/index.js.map +1 -0
  46. package/dist/frontend/node/io/io.d.ts +16 -0
  47. package/dist/frontend/node/io/io.js +98 -0
  48. package/dist/frontend/node/io/io.js.map +1 -0
  49. package/dist/frontend/node/io/nodeinput.d.ts +6 -0
  50. package/dist/frontend/node/io/nodeinput.js +74 -0
  51. package/dist/frontend/node/io/nodeinput.js.map +1 -0
  52. package/dist/frontend/node/io/nodeoutput.d.ts +6 -0
  53. package/dist/frontend/node/io/nodeoutput.js +19 -0
  54. package/dist/frontend/node/io/nodeoutput.js.map +1 -0
  55. package/dist/frontend/node/node.d.ts +20 -0
  56. package/dist/frontend/node/node.js +118 -0
  57. package/dist/frontend/node/node.js.map +1 -0
  58. package/dist/frontend/utils/colorpicker.d.ts +19 -0
  59. package/dist/frontend/utils/colorpicker.js +209 -0
  60. package/dist/frontend/utils/colorpicker.js.map +1 -0
  61. package/dist/frontend/utils/jsondata.d.ts +6 -0
  62. package/dist/frontend/utils/jsondata.js +8 -0
  63. package/dist/frontend/utils/jsondata.js.map +1 -0
  64. package/dist/frontend/utils/table.d.ts +11 -0
  65. package/dist/frontend/utils/table.js +108 -0
  66. package/dist/frontend/utils/table.js.map +1 -0
  67. package/dist/funcnodes/funcnodesworker.d.ts +72 -0
  68. package/dist/funcnodes/funcnodesworker.js +532 -0
  69. package/dist/funcnodes/funcnodesworker.js.map +1 -0
  70. package/dist/funcnodes/index.js +5 -0
  71. package/dist/funcnodes/index.js.map +1 -0
  72. package/dist/funcnodes/websocketworker.d.ts +27 -0
  73. package/dist/funcnodes/websocketworker.js +224 -0
  74. package/dist/funcnodes/websocketworker.js.map +1 -0
  75. package/dist/funcnodes/workermanager.d.ts +32 -0
  76. package/dist/funcnodes/workermanager.js +241 -0
  77. package/dist/funcnodes/workermanager.js.map +1 -0
  78. package/dist/index.d.ts +2 -0
  79. package/dist/index.js +3 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/states/edge.d.ts +7 -0
  82. package/dist/states/edge.js +6 -0
  83. package/dist/states/edge.js.map +1 -0
  84. package/dist/states/edge.t.d.ts +16 -0
  85. package/dist/states/edge.t.js +2 -0
  86. package/dist/states/edge.t.js.map +1 -0
  87. package/dist/states/fnrfzst.d.ts +10 -0
  88. package/dist/states/fnrfzst.js +378 -0
  89. package/dist/states/fnrfzst.js.map +1 -0
  90. package/dist/states/fnrfzst.t.d.ts +100 -0
  91. package/dist/states/fnrfzst.t.js +2 -0
  92. package/dist/states/fnrfzst.t.js.map +1 -0
  93. package/dist/states/index.d.ts +7 -0
  94. package/dist/states/index.js +6 -0
  95. package/dist/states/index.js.map +1 -0
  96. package/dist/states/lib.d.ts +3 -0
  97. package/dist/states/lib.js +14 -0
  98. package/dist/states/lib.js.map +1 -0
  99. package/dist/states/lib.t.d.ts +24 -0
  100. package/dist/states/lib.t.js +2 -0
  101. package/dist/states/lib.t.js.map +1 -0
  102. package/dist/states/node.d.ts +4 -0
  103. package/dist/states/node.js +43 -0
  104. package/dist/states/node.js.map +1 -0
  105. package/dist/states/node.t.d.ts +73 -0
  106. package/dist/states/node.t.js +2 -0
  107. package/dist/states/node.t.js.map +1 -0
  108. package/dist/states/nodeio.t.d.ts +67 -0
  109. package/dist/states/nodeio.t.js +2 -0
  110. package/dist/states/nodeio.t.js.map +1 -0
  111. package/dist/states/nodespace.d.ts +3 -0
  112. package/dist/states/nodespace.js +77 -0
  113. package/dist/states/nodespace.js.map +1 -0
  114. package/dist/states/nodespace.t.d.ts +16 -0
  115. package/dist/states/nodespace.t.js +2 -0
  116. package/dist/states/nodespace.t.js.map +1 -0
  117. package/dist/states/reactflow.d.ts +8 -0
  118. package/dist/states/reactflow.js +33 -0
  119. package/dist/states/reactflow.js.map +1 -0
  120. package/dist/states/reactflow.t.d.ts +11 -0
  121. package/dist/states/reactflow.t.js +2 -0
  122. package/dist/states/reactflow.t.js.map +1 -0
  123. package/dist/types/rendering.t.d.ts +10 -0
  124. package/dist/types/rendering.t.js +2 -0
  125. package/dist/types/rendering.t.js.map +1 -0
  126. package/dist/utils/index.d.ts +3 -0
  127. package/dist/utils/index.js +3 -0
  128. package/dist/utils/index.js.map +1 -0
  129. package/dist/utils/objects.d.ts +19 -0
  130. package/dist/utils/objects.js +118 -0
  131. package/dist/utils/objects.js.map +1 -0
  132. package/package.json +52 -21
  133. package/package copy.json +0 -63
  134. package/public/favicon.ico +0 -0
  135. package/public/index.html +0 -43
  136. package/public/logo192.png +0 -0
  137. package/public/logo512.png +0 -0
  138. package/public/manifest.json +0 -25
  139. package/public/robots.txt +0 -3
  140. package/public/worker_manager +0 -1
  141. package/src/App.css +0 -38
  142. package/src/App.test.tsx +0 -9
  143. package/src/App.tsx +0 -22
  144. package/src/frontend/datarenderer/images.tsx +0 -28
  145. package/src/frontend/datarenderer/index.tsx +0 -53
  146. package/src/frontend/datarenderer/plotly.tsx +0 -82
  147. package/src/frontend/dialog.scss +0 -88
  148. package/src/frontend/dialog.tsx +0 -70
  149. package/src/frontend/edge.scss +0 -15
  150. package/src/frontend/edge.tsx +0 -31
  151. package/src/frontend/funcnodesreactflow.scss +0 -63
  152. package/src/frontend/funcnodesreactflow.tsx +0 -283
  153. package/src/frontend/header/header.scss +0 -48
  154. package/src/frontend/header/index.tsx +0 -268
  155. package/src/frontend/layout/htmlelements.scss +0 -63
  156. package/src/frontend/lib.scss +0 -157
  157. package/src/frontend/lib.tsx +0 -198
  158. package/src/frontend/node/io/default_input_renderer.tsx +0 -327
  159. package/src/frontend/node/io/default_output_render.tsx +0 -26
  160. package/src/frontend/node/io/handle_renderer.tsx +0 -89
  161. package/src/frontend/node/io/io.scss +0 -91
  162. package/src/frontend/node/io/io.tsx +0 -114
  163. package/src/frontend/node/io/nodeinput.tsx +0 -125
  164. package/src/frontend/node/io/nodeoutput.tsx +0 -37
  165. package/src/frontend/node/node.scss +0 -265
  166. package/src/frontend/node/node.tsx +0 -208
  167. package/src/frontend/nodecontextmenu.scss +0 -18
  168. package/src/frontend/utils/colorpicker.scss +0 -37
  169. package/src/frontend/utils/colorpicker.tsx +0 -342
  170. package/src/frontend/utils/jsondata.tsx +0 -19
  171. package/src/frontend/utils/table.scss +0 -22
  172. package/src/frontend/utils/table.tsx +0 -159
  173. package/src/funcnodes/funcnodesworker.ts +0 -455
  174. package/src/funcnodes/websocketworker.ts +0 -153
  175. package/src/funcnodes/workermanager.ts +0 -229
  176. package/src/index.css +0 -13
  177. package/src/index.tsx +0 -19
  178. package/src/logo.svg +0 -1
  179. package/src/react-app-env.d.ts +0 -1
  180. package/src/reportWebVitals.ts +0 -15
  181. package/src/setupTests.ts +0 -5
  182. package/src/state/edge.ts +0 -35
  183. package/src/state/fnrfzst.ts +0 -440
  184. package/src/state/index.ts +0 -139
  185. package/src/state/lib.ts +0 -26
  186. package/src/state/node.ts +0 -118
  187. package/src/state/nodespace.ts +0 -151
  188. package/src/state/reactflow.ts +0 -65
  189. package/src/types/lib.d.ts +0 -16
  190. package/src/types/node.d.ts +0 -29
  191. package/src/types/nodeio.d.ts +0 -82
  192. package/src/types/worker.d.ts +0 -56
  193. package/tsconfig.json +0 -20
  194. /package/{src/funcnodes/index.ts → dist/funcnodes/index.d.ts} +0 -0
@@ -1,89 +0,0 @@
1
- import { useContext } from "react";
2
- import { FuncNodesReactFlowZustandInterface } from "../../../state";
3
- import { FuncNodesContext } from "../../funcnodesreactflow";
4
- import { pick_best_io_type } from "./io";
5
- import { SortableTable } from "../../utils/table";
6
- import JSONDataDisplay from "../../utils/jsondata";
7
- import { Base64ImageRenderer } from "../../datarenderer/images";
8
-
9
- const TableOutput = ({ io }: { io: IOType }) => {
10
- const fnrf_zst: FuncNodesReactFlowZustandInterface =
11
- useContext(FuncNodesContext);
12
-
13
- let value = io.fullvalue;
14
- if (value == undefined) value = io.value;
15
- if (value === undefined) {
16
- value = [];
17
- }
18
-
19
- return <SortableTable tabledata={value} />;
20
- };
21
-
22
- const DictOutput = ({ io }: { io: IOType }) => {
23
- let value = io.fullvalue;
24
-
25
- if (value === undefined) value = io.value;
26
- if (value === undefined) {
27
- value = {};
28
- }
29
-
30
- return <JSONDataDisplay data={value} />;
31
- };
32
-
33
- const Base64ImageOutput = ({ io }: { io: IOType }) => {
34
- const fnrf_zst: FuncNodesReactFlowZustandInterface =
35
- useContext(FuncNodesContext);
36
-
37
- let value = io.fullvalue;
38
- if (value == undefined) value = io.value;
39
- if (value === undefined) {
40
- value = "";
41
- }
42
-
43
- return <Base64ImageRenderer value={value} />;
44
- };
45
-
46
- const SingleValueOutput = ({ io }: { io: IOType }) => {
47
- const fnrf_zst: FuncNodesReactFlowZustandInterface =
48
- useContext(FuncNodesContext);
49
-
50
- let value = io.fullvalue;
51
- if (value == undefined) value = io.value;
52
- if (value === undefined) {
53
- value = "";
54
- } else {
55
- value = JSON.stringify(io.value).replace(/\\n/g, "\n"); //respect "\n" in strings
56
- }
57
-
58
- return (
59
- <div>
60
- <pre>{value}</pre>
61
- </div>
62
- );
63
- };
64
-
65
- const HandlePreviouGenerators: {
66
- [key: string]: ({ io }: { io: IOType }) => JSX.Element;
67
- } = {
68
- string: SingleValueOutput,
69
- table: TableOutput,
70
- image: Base64ImageOutput,
71
- dict: DictOutput,
72
- };
73
-
74
- const PreviewHandleDataRendererForIo = (io: IOType) => {
75
- const fnrf_zst: FuncNodesReactFlowZustandInterface =
76
- useContext(FuncNodesContext);
77
- const render: RenderOptions = fnrf_zst.render_options();
78
-
79
- const [typestring, otypestring] = pick_best_io_type(
80
- io.type,
81
- render.typemap || {}
82
- );
83
-
84
- return typestring && HandlePreviouGenerators[typestring]
85
- ? HandlePreviouGenerators[typestring]
86
- : DictOutput;
87
- };
88
-
89
- export { PreviewHandleDataRendererForIo };
@@ -1,91 +0,0 @@
1
- s slideUpAndFade {
2
- from {
3
- opacity: 0;
4
- transform: translateY(2px);
5
- }
6
- to {
7
- opacity: 1;
8
- transform: translateY(0);
9
- }
10
- }
11
-
12
- @keyframes slideRightAndFade {
13
- from {
14
- opacity: 0;
15
- transform: translateX(-2px);
16
- }
17
- to {
18
- opacity: 1;
19
- transform: translateX(0);
20
- }
21
- }
22
-
23
- @keyframes slideDownAndFade {
24
- from {
25
- opacity: 0;
26
- transform: translateY(-2px);
27
- }
28
- to {
29
- opacity: 1;
30
- transform: translateY(0);
31
- }
32
- }
33
-
34
- @keyframes slideLeftAndFade {
35
- from {
36
- opacity: 0;
37
- transform: translateX(2px);
38
- }
39
- to {
40
- opacity: 1;
41
- transform: translateX(0);
42
- }
43
- }
44
-
45
- .iotooltipcontent {
46
- background-color: #f9f9f9;
47
- border: 1px solid #ffffff;
48
- border-radius: 5px;
49
- padding: 10px;
50
- box-shadow: hsl(206 22% 7% / 35%) 0px 10px 38px -10px,
51
- hsl(206 22% 7% / 20%) 0px 10px 20px -15px;
52
- font-size: 10px;
53
- color: #333;
54
- max-width: 30vw;
55
- max-height: 30vh;
56
- cursor: default;
57
-
58
- &.fullsize {
59
- max-width: 100vw;
60
- max-height: 100vh;
61
- position: fixed;
62
- top: 0;
63
- }
64
-
65
- overflow: auto;
66
- display: flex;
67
- flex-direction: column;
68
- &[data-state="delayed-open"][data-side="top"] {
69
- animation-name: slideDownAndFade;
70
- }
71
- &[data-state="delayed-open"][data-side="right"] {
72
- animation-name: slideLeftAndFade;
73
- }
74
- &[data-state="delayed-open"][data-side="bottom"] {
75
- animation-name: slideUpAndFade;
76
- }
77
- &[data-state="delayed-open"][data-side="left"] {
78
- animation-name: slideRightAndFade;
79
- }
80
- }
81
-
82
- .iotooltip_container {
83
- display: flex;
84
- flex-direction: column;
85
- max-width: inherit;
86
- max-height: inherit;
87
- }
88
-
89
- .iotooltipcontentarrow {
90
- fill: white;
91
- }
@@ -1,114 +0,0 @@
1
- import * as Tooltip from "@radix-ui/react-tooltip";
2
- import LockOpenIcon from "@mui/icons-material/LockOpen";
3
- import LockIcon from "@mui/icons-material/Lock";
4
- import FullscreenIcon from "@mui/icons-material/Fullscreen";
5
-
6
- import "./io.scss";
7
- import { Handle, HandleProps } from "reactflow";
8
- import { useMemo, useState } from "react";
9
- import CustomDialog from "../../dialog";
10
- import { PreviewHandleDataRendererForIo } from "./handle_renderer";
11
- const pick_best_io_type = (
12
- iot: SerializedType,
13
- typemap: { [key: string]: string }
14
- ): [string | undefined, string | undefined] => {
15
- // check if iot is string
16
- if (typeof iot === "string") {
17
- if (iot in typemap) {
18
- return [typemap[iot], iot];
19
- }
20
- return [iot, iot];
21
- }
22
- if ("allOf" in iot && iot.allOf !== undefined) {
23
- return [undefined, undefined];
24
- }
25
- if ("anyOf" in iot && iot.anyOf !== undefined) {
26
- const picks = iot.anyOf.map((x) => pick_best_io_type(x, typemap));
27
- for (const pick of picks) {
28
- switch (pick[0]) {
29
- case "bool":
30
- return ["bool", pick[1]];
31
- case "enum":
32
- return ["enum", pick[1]];
33
- case "float":
34
- return ["float", pick[1]];
35
- case "int":
36
- return ["int", pick[1]];
37
- case "string":
38
- return ["string", pick[1]];
39
- case "str":
40
- return ["string", pick[1]];
41
- }
42
- }
43
-
44
- return [undefined, undefined];
45
- }
46
- if (!("type" in iot) || iot.type === undefined) {
47
- return [undefined, undefined];
48
- }
49
-
50
- if (iot.type === "enum") {
51
- return ["enum", "enum"];
52
- }
53
- return [undefined, undefined];
54
- };
55
-
56
- type HandleWithPreviewProps = {
57
- io: IOType;
58
- typestring: string | undefined;
59
- preview?: React.FC<{ io: IOType }>;
60
- } & HandleProps;
61
-
62
- const HandleWithPreview = ({
63
- io,
64
- typestring,
65
- preview,
66
- ...props
67
- }: HandleWithPreviewProps) => {
68
- const [locked, setLocked] = useState(false);
69
- const [opened, setOpened] = useState(false);
70
-
71
- const pvhandle: React.FC<{ io: IOType }> =
72
- preview || PreviewHandleDataRendererForIo(io);
73
-
74
- return (
75
- <Tooltip.Provider>
76
- <Tooltip.Root open={locked || opened} onOpenChange={setOpened}>
77
- <Tooltip.Trigger asChild>
78
- <Handle id={io.id} {...props} />
79
- </Tooltip.Trigger>
80
- <Tooltip.Portal>
81
- <Tooltip.Content className={"iotooltipcontent"} sideOffset={5}>
82
- <div className="iotooltip_container">
83
- <div className="iotooltip_header">
84
- {locked ? (
85
- <LockIcon onClick={() => setLocked(false)} />
86
- ) : (
87
- <LockOpenIcon onClick={() => setLocked(true)} />
88
- )}
89
- {pvhandle && (
90
- <CustomDialog
91
- trigger={<FullscreenIcon />}
92
- onOpenChange={(open: boolean) => {
93
- if (open) {
94
- io.try_get_full_value();
95
- }
96
- setLocked(open);
97
- }}
98
- >
99
- {pvhandle({ io })}
100
- </CustomDialog>
101
- )}
102
- </div>
103
- {pvhandle
104
- ? pvhandle({ io })
105
- : `no preview available for "${typestring}"`}
106
- </div>
107
- <Tooltip.Arrow className="iotooltipcontentarrow" />
108
- </Tooltip.Content>
109
- </Tooltip.Portal>
110
- </Tooltip.Root>
111
- </Tooltip.Provider>
112
- );
113
- };
114
- export { pick_best_io_type, HandleWithPreview };
@@ -1,125 +0,0 @@
1
- import { useContext, useEffect, useRef, useState } from "react";
2
- import { FuncNodesContext } from "../..";
3
- import * as Tooltip from "@radix-ui/react-tooltip";
4
- import { Handle, Position } from "reactflow";
5
- import { FuncNodesReactFlowZustandInterface } from "../../../state/fnrfzst";
6
- import { HandleWithPreview, pick_best_io_type } from "./io";
7
- import {
8
- BooleanInput,
9
- FloatInput,
10
- IntegerInput,
11
- StringInput,
12
- SelectionInput,
13
- ColorInput,
14
- } from "./default_input_renderer";
15
-
16
- const Inputrenderer: {
17
- [key: string]: InputRendererType;
18
- } = {};
19
-
20
- const register_input_renderer = (type: string, renderer: InputRendererType) => {
21
- Inputrenderer[type] = renderer;
22
- };
23
-
24
- register_input_renderer("float", FloatInput);
25
- register_input_renderer("int", IntegerInput);
26
- register_input_renderer("bool", BooleanInput);
27
- register_input_renderer("string", StringInput);
28
- register_input_renderer("str", StringInput);
29
- register_input_renderer("color", ColorInput);
30
- register_input_renderer("select", SelectionInput);
31
- register_input_renderer("enum", SelectionInput);
32
-
33
- const INPUTCONVERTER: {
34
- [key: string]: (v: any) => any;
35
- } = {
36
- "": (v: any) => v,
37
- str_to_json: (v: any) => {
38
- return JSON.parse(v);
39
- },
40
- str_to_list: (v: any) => {
41
- try {
42
- const a = JSON.parse(v);
43
- if (Array.isArray(a)) return a;
44
- return [a];
45
- } catch (e) {
46
- try {
47
- return JSON.parse("[" + v + "]");
48
- } catch (e) {}
49
- }
50
-
51
- throw new Error("Invalid list");
52
- },
53
- };
54
-
55
- const NodeInput = ({ io }: { io: IOType }) => {
56
- const fnrf_zst: FuncNodesReactFlowZustandInterface =
57
- useContext(FuncNodesContext);
58
- const render: RenderOptions = fnrf_zst.render_options();
59
-
60
- if (io.render_options === undefined) {
61
- io.render_options = {};
62
- }
63
- if (io.render_options.set_default === undefined) {
64
- io.render_options.set_default = true;
65
- }
66
-
67
- const [typestring, otypestring] = pick_best_io_type(
68
- io.type,
69
- render.typemap || {}
70
- );
71
-
72
- const Input = typestring
73
- ? io.value_options?.options
74
- ? SelectionInput
75
- : Inputrenderer[typestring]
76
- : undefined;
77
- const inputconverterf: (v: any) => any =
78
- INPUTCONVERTER[(otypestring && render.inputconverter?.[otypestring]) ?? ""];
79
- return (
80
- <div className="nodeinput">
81
- <HandleWithPreview
82
- io={io}
83
- typestring={typestring}
84
- position={Position.Left}
85
- type="target"
86
- />
87
-
88
- {Input && (
89
- <div className="iovaluefield nodrag">
90
- <Input io={io} inputconverter={inputconverterf} />
91
- </div>
92
- )}
93
- <div className="ioname">{io.name}</div>
94
- </div>
95
- );
96
- };
97
-
98
- export default NodeInput;
99
-
100
- type Renderotion = ({ text }: { text: string }) => JSX.Element;
101
-
102
- const renderoptions: { [key: string]: Renderotion } = {};
103
-
104
- const Renderer = () => {
105
- const [text, setText] = useState("");
106
- const [render, setRender] = useState<Renderotion | undefined>(undefined);
107
-
108
- return (
109
- <div>
110
- <input
111
- type="text"
112
- value={text}
113
- onChange={(e) => setText(e.target.value)}
114
- />
115
- <select onChange={(e) => setRender(renderoptions[e.target.value])}>
116
- {Object.keys(renderoptions).map((key) => (
117
- <option key={key} value={key}>
118
- {key}
119
- </option>
120
- ))}
121
- </select>
122
- {render && render({ text })}
123
- </div>
124
- );
125
- };
@@ -1,37 +0,0 @@
1
- import { useContext, useEffect, useRef, useState } from "react";
2
-
3
- import { Handle, Position } from "reactflow";
4
- import { FuncNodesContext } from "../..";
5
- import { FuncNodesReactFlowZustandInterface } from "../../../state/fnrfzst";
6
- import { HandleWithPreview, pick_best_io_type } from "./io";
7
- import { InLineOutput } from "./default_output_render";
8
-
9
- const NodeOutput = ({ io }: { io: IOType }) => {
10
- const fnrf_zst: FuncNodesReactFlowZustandInterface =
11
- useContext(FuncNodesContext);
12
- const render: RenderOptions = fnrf_zst.render_options();
13
-
14
- const [typestring, otypestring] = pick_best_io_type(
15
- io.type,
16
- render.typemap || {}
17
- );
18
-
19
- return (
20
- <div className="nodeoutput">
21
- <HandleWithPreview
22
- io={io}
23
- typestring={typestring}
24
- position={Position.Right}
25
- type="source"
26
- />
27
-
28
- <div className="ioname">{io.name}</div>
29
-
30
- <div className="iovaluefield">
31
- <InLineOutput io={io} />
32
- </div>
33
- </div>
34
- );
35
- };
36
-
37
- export default NodeOutput;
@@ -1,265 +0,0 @@
1
- :root {
2
- --node_border_radius: 5px;
3
- --handle_outer_radius: 4px;
4
- --handle_inner_radius: 2px;
5
- --handle_width: 10;
6
- --handle_width_hover: 15;
7
- --handle_overlap: 3;
8
- --nodeinput_margin: 2;
9
- --nodeio_shift: calc(var(--handle_overlap) - var(--nodeinput_margin));
10
- --handle_source_color: hsl(190, 98%, 49%);
11
- --handle_target_color: hsl(204, 98%, 51%);
12
- --node_background: hsl(245, 51%, 42%);
13
- --node_header_color: hsl(245, 51%, 22%);
14
- }
15
-
16
- .react-flow {
17
- &__node {
18
- padding: 0;
19
- border-radius: var(--node_border_radius);
20
- background-color: var(--node_background);
21
- display: flex;
22
- flex-direction: column;
23
- color: aliceblue;
24
- box-sizing: content-box;
25
- transform: (-50%, -50%);
26
- border: 2px solid #ffffff00;
27
- font-size: 0.5rem;
28
- width: auto;
29
- max-width: 200px;
30
- min-width: 100px;
31
- &.selected {
32
- border-color: #ffffff99;
33
- }
34
- background-clip: content-box;
35
-
36
- & * {
37
- box-sizing: border-box;
38
- }
39
- }
40
-
41
- &__handle {
42
- height: calc(100% - 4px);
43
- border-radius: 0;
44
- width: calc(var(--handle_width) * 1px);
45
-
46
- transition: left 0.2s ease-in-out, right 0.2s ease-in-out,
47
- width 0.2s ease-in-out;
48
- &:hover {
49
- width: calc(var(--handle_width_hover) * 1px);
50
- }
51
-
52
- &.source {
53
- background-color: var(--handle_source_color);
54
- }
55
- &.target {
56
- background-color: var(--handle_target_color);
57
- }
58
- &-left {
59
- border-radius: var(--handle_outer_radius) var(--handle_inner_radius)
60
- var(--handle_inner_radius) var(--handle_outer_radius);
61
- left: calc((var(--nodeio_shift) - var(--handle_width)) * 1px);
62
- &:hover {
63
- left: calc((var(--nodeio_shift) - var(--handle_width_hover)) * 1px);
64
- }
65
- }
66
- &-right {
67
- border-radius: var(--handle_inner_radius) var(--handle_outer_radius)
68
- var(--handle_outer_radius) var(--handle_inner_radius);
69
- right: calc((var(--nodeio_shift) - var(--handle_width)) * 1px);
70
- &:hover {
71
- right: calc((var(--nodeio_shift) - var(--handle_width_hover)) * 1px);
72
- }
73
- }
74
- &-top {
75
- border-radius: var(--handle_outer_radius) var(--handle_outer_radius)
76
- var(--handle_inner_radius) var(--handle_inner_radius);
77
- }
78
- &-bottom {
79
- border-radius: var(--handle_inner_radius) var(--handle_inner_radius)
80
- var(--handle_outer_radius) var(--handle_outer_radius);
81
- }
82
- }
83
- }
84
-
85
- .innernode {
86
- width: 100%;
87
- height: 100%;
88
- flex-direction: column;
89
- display: flex;
90
- // padding: 2px;
91
- box-sizing: border-box;
92
-
93
- &.intrigger {
94
- & .nodeheader {
95
- background-color: #abb408;
96
- }
97
- }
98
-
99
- &.error {
100
- & .nodeheader {
101
- background-color: #ff0000;
102
- }
103
- }
104
- }
105
- .nodeheader {
106
- box-sizing: border-box;
107
- background-color: var(--node_header_color);
108
- width: 100%;
109
- padding: 0.1rem;
110
- border-radius: var(--node_border_radius) var(--node_border_radius) 0 0;
111
- display: flex; /* Use flex layout */
112
- align-items: center; /* Align items vertically in the center */
113
- justify-content: space-between; /* Distribute space between items */
114
-
115
- &_element {
116
- display: flex; /* Enable flex within each child to center content */
117
- align-items: center; /* Align items vertically in the center */
118
- }
119
- &_title {
120
- flex-grow: 1; /* Allow the text div to grow and fill available space */
121
- margin: 0 10px; /* Add some space around the text for aesthetics */
122
- white-space: nowrap; /* Prevent wrapping */
123
- overflow: hidden; /* Hide overflow */
124
- text-overflow: ellipsis; /* Add ellipsis to overflow */
125
- justify-content: center; /* Center the text horizontally */
126
- &_text {
127
- overflow: hidden;
128
- text-overflow: ellipsis;
129
- white-space: nowrap;
130
- max-width: 100%; /* Ensure it does not overflow the parent */
131
- }
132
- }
133
-
134
- & .triggerbutton {
135
- cursor: pointer;
136
-
137
- &:hover {
138
- color: #0cc3f5;
139
- }
140
- &:active {
141
- color: #075d74;
142
- }
143
- }
144
- }
145
-
146
- .nodename_input {
147
- // remove the default
148
- border: 1px solid #000000;
149
- border-radius: 2px;
150
- background: none;
151
- color: white;
152
- text-align: center;
153
-
154
- font-size: inherit;
155
- margin: 2px;
156
- box-sizing: border-box;
157
- }
158
-
159
- .nodefooter {
160
- background-color: #4e0ba5;
161
- width: 100%;
162
- padding: 0.1rem;
163
- border-radius: 0 0 var(--node_border_radius) var(--node_border_radius);
164
- &:empty {
165
- display: none;
166
- }
167
- & .nodeerror {
168
- border: 1px solid #ff0000;
169
- border-radius: 2px;
170
- padding: 0.25rem;
171
- background-color: #ff000075;
172
- }
173
- }
174
-
175
- .nodebody {
176
- flex-grow: 1;
177
- }
178
-
179
- .nodedatabody {
180
- overflow: hidden;
181
- }
182
-
183
- .noderesizecontrol {
184
- background: transparent !important;
185
- border: none !important;
186
- font-size: 0.5rem;
187
- }
188
- .noderesizeicon {
189
- position: absolute;
190
- bottom: 4px;
191
- right: 4px;
192
- font-size: 0.5rem;
193
- }
194
-
195
- .nodeio {
196
- width: auto;
197
- background-color: inherit;
198
- padding: 0.1rem;
199
- margin-top: 0.1rem;
200
- margin-bottom: 0.1rem;
201
- position: relative;
202
- display: flex;
203
- flex-direction: row;
204
-
205
- border: 1px solid #ffffff88;
206
- border-radius: 3px;
207
- box-sizing: border-box;
208
- margin-left: calc(var(--nodeinput_margin) * 1px);
209
- margin-right: calc(var(--nodeinput_margin) * 1px);
210
- }
211
-
212
- .nodeinput {
213
- @extend .nodeio;
214
- }
215
-
216
- .nodeoutput {
217
- @extend .nodeio;
218
- }
219
-
220
- .iovaluefield {
221
- flex-grow: 1;
222
- flex-shrink: 1;
223
- overflow: hidden;
224
- align-items: start;
225
- justify-content: start;
226
- display: flex;
227
- margin: 0.2rem;
228
- line-break: anywhere;
229
- & > input {
230
- width: 100%;
231
- }
232
- }
233
- .ioname {
234
- flex-grow: 1;
235
- flex-shrink: 1;
236
- color: inherit;
237
- margin: 0.2rem;
238
- overflow: hidden;
239
- min-width: 2rem;
240
-
241
- .nodeinput & {
242
- text-align: left;
243
- }
244
- .nodeoutput & {
245
- text-align: right;
246
- }
247
- }
248
-
249
- input.nodedatainput {
250
- &:focus {
251
- outline: none;
252
- }
253
- }
254
-
255
- .nodedatastyledelement {
256
- background-color: var(--node_header_color);
257
-
258
- font-size: 0.5rem;
259
- height: 1.5rem;
260
- }
261
-
262
- input.nodedatainput.styledinput,
263
- select.nodedatainput.styleddropdown {
264
- @extend .nodedatastyledelement;
265
- }