@linkdlab/funcnodes_react_flow 0.3.15 → 0.3.17

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.
@@ -11,6 +11,94 @@
11
11
  stroke: #11ff00;
12
12
  }
13
13
 
14
+ .dialogoverlay {
15
+ background-color: rgba(0, 0, 0, 0.5);
16
+ position: fixed;
17
+ inset: 0;
18
+ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
19
+ z-index: 2000;
20
+ }
21
+
22
+ .dialogconent {
23
+ background-color: var(--funcnodesbackground1);
24
+ border-radius: 6px;
25
+ box-shadow: var(--funheadercolor) 0px 10px 38px -10px, var(--funheadercolor) 0px 10px 20px -15px;
26
+ position: fixed;
27
+ top: 50%;
28
+ left: 50%;
29
+ transform: translate(-50%, -50%);
30
+ width: 90vw;
31
+ max-width: 85vw;
32
+ max-height: 85vh;
33
+ padding: 25px;
34
+ animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
35
+ color: var(--funcnodestextcolor1);
36
+ border: 1px solid var(--funheadercolor);
37
+ display: flex;
38
+ flex-direction: column;
39
+ z-index: 2001;
40
+ }
41
+
42
+ .dialogtitle {
43
+ margin: 0;
44
+ font-weight: 500;
45
+ color: var(--funheadercolor);
46
+ font-size: 17px;
47
+ }
48
+
49
+ .dialogdescription {
50
+ margin: 10px 0 20px;
51
+ font-size: 15px;
52
+ line-height: 1.5;
53
+ }
54
+
55
+ .dialogclosebutton {
56
+ border-radius: 100%;
57
+ height: 25px;
58
+ width: 25px;
59
+ display: inline-flex;
60
+ background-color: inherit;
61
+ align-items: center;
62
+ justify-content: center;
63
+ color: var(--funheadercolor);
64
+ position: absolute;
65
+ top: 10px;
66
+ right: 10px;
67
+ border: none;
68
+ }
69
+ .dialogclosebutton:hover {
70
+ background-color: var(--funheadercolor);
71
+ color: var(--funcnodesbackground1);
72
+ }
73
+ .dialogclosebutton:active {
74
+ background-color: var(--funheadercolor);
75
+ color: var(--funcnodestextcolor1);
76
+ }
77
+
78
+ .dialogsendbutton {
79
+ background-color: var(--funcnodesbackground1);
80
+ color: var(--funheadercolor);
81
+ border: 1px solid var(--funheadercolor);
82
+ border-radius: 99rem;
83
+ padding: 10px 20px;
84
+ cursor: pointer;
85
+ font-size: 15px;
86
+ margin-top: 20px;
87
+ }
88
+ .dialogsendbutton:hover {
89
+ background-color: var(--funheadercolor);
90
+ color: var(--funcnodesbackground1);
91
+ }
92
+ .dialogsendbutton:active {
93
+ background-color: var(--funheadercolor);
94
+ color: var(--funcnodestextcolor1);
95
+ }
96
+
97
+ .dialogchildren {
98
+ margin-top: 20px;
99
+ overflow: auto;
100
+ }
101
+
14
102
  :root {
15
103
  --expandtime: 0.3s;
16
104
  --libnodebgcolor: #48465f;
@@ -20,7 +108,7 @@
20
108
  .libcontainer {
21
109
  top: 0;
22
110
  left: 0;
23
- height: 100%;
111
+ min-height: 100%;
24
112
  padding: 0.5rem;
25
113
  box-sizing: border-box;
26
114
  display: flex;
@@ -256,94 +344,6 @@
256
344
  color: #0056b3;
257
345
  }
258
346
 
259
- .dialogoverlay {
260
- background-color: rgba(0, 0, 0, 0.5);
261
- position: fixed;
262
- inset: 0;
263
- animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
264
- z-index: 2000;
265
- }
266
-
267
- .dialogconent {
268
- background-color: var(--funcnodesbackground1);
269
- border-radius: 6px;
270
- box-shadow: var(--funheadercolor) 0px 10px 38px -10px, var(--funheadercolor) 0px 10px 20px -15px;
271
- position: fixed;
272
- top: 50%;
273
- left: 50%;
274
- transform: translate(-50%, -50%);
275
- width: 90vw;
276
- max-width: 85vw;
277
- max-height: 85vh;
278
- padding: 25px;
279
- animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
280
- color: var(--funcnodestextcolor1);
281
- border: 1px solid var(--funheadercolor);
282
- display: flex;
283
- flex-direction: column;
284
- z-index: 2001;
285
- }
286
-
287
- .dialogtitle {
288
- margin: 0;
289
- font-weight: 500;
290
- color: var(--funheadercolor);
291
- font-size: 17px;
292
- }
293
-
294
- .dialogdescription {
295
- margin: 10px 0 20px;
296
- font-size: 15px;
297
- line-height: 1.5;
298
- }
299
-
300
- .dialogclosebutton {
301
- border-radius: 100%;
302
- height: 25px;
303
- width: 25px;
304
- display: inline-flex;
305
- background-color: inherit;
306
- align-items: center;
307
- justify-content: center;
308
- color: var(--funheadercolor);
309
- position: absolute;
310
- top: 10px;
311
- right: 10px;
312
- border: none;
313
- }
314
- .dialogclosebutton:hover {
315
- background-color: var(--funheadercolor);
316
- color: var(--funcnodesbackground1);
317
- }
318
- .dialogclosebutton:active {
319
- background-color: var(--funheadercolor);
320
- color: var(--funcnodestextcolor1);
321
- }
322
-
323
- .dialogsendbutton {
324
- background-color: var(--funcnodesbackground1);
325
- color: var(--funheadercolor);
326
- border: 1px solid var(--funheadercolor);
327
- border-radius: 99rem;
328
- padding: 10px 20px;
329
- cursor: pointer;
330
- font-size: 15px;
331
- margin-top: 20px;
332
- }
333
- .dialogsendbutton:hover {
334
- background-color: var(--funheadercolor);
335
- color: var(--funcnodesbackground1);
336
- }
337
- .dialogsendbutton:active {
338
- background-color: var(--funheadercolor);
339
- color: var(--funcnodestextcolor1);
340
- }
341
-
342
- .dialogchildren {
343
- margin-top: 20px;
344
- overflow: auto;
345
- }
346
-
347
347
  /* this gets exported as style.css and can be used for the default theming */
348
348
  /* these are the necessary styles for React Flow, they get used by base.css and style.css */
349
349
  .react-flow {
@@ -832,14 +832,6 @@
832
832
  top: 100%;
833
833
  }
834
834
 
835
- .smooth-expand-expanded {
836
- position: absolute;
837
- top: 0;
838
- left: 0;
839
- width: 100vw;
840
- height: 100vh;
841
- }
842
-
843
835
  .basicstyleelement, .headermenucontent, .styled-select__menu, .styleelement, .styledcheckbox, .styledinput, .styledbtn, .styleddropdown {
844
836
  background-color: var(--funcnodesbackground1);
845
837
  color: var(--funcnodestextcolor1);
@@ -969,6 +961,14 @@ button {
969
961
  font-size: inherit;
970
962
  }
971
963
 
964
+ .smooth-expand-expanded {
965
+ position: absolute;
966
+ top: 0;
967
+ left: 0;
968
+ width: 100vw;
969
+ height: 100vh;
970
+ }
971
+
972
972
  :root {
973
973
  --funheadercolor: #00d9ff;
974
974
  --funcnodesbackground1: hsl(243, 26%, 13%);
@@ -976,6 +976,7 @@ button {
976
976
  --funcnodesbackground_light: hsl(240, 22%, 38%);
977
977
  --containerboarderradius: 1rem;
978
978
  --funcnodestextcolor1: #ffffff;
979
+ --funcnodes-z-index: 1000;
979
980
  }
980
981
 
981
982
  .funcnodescontainer {
@@ -990,6 +991,8 @@ button {
990
991
  .funcnodesreactflowcontainer {
991
992
  width: 100%;
992
993
  height: 100%;
994
+ flex-grow: 1;
995
+ z-index: var(--funcnodes-z-index);
993
996
  background-color: var(--funcnodesbackground1);
994
997
  position: relative;
995
998
  display: flex;
@@ -1043,12 +1046,20 @@ button {
1043
1046
  position: absolute;
1044
1047
  right: 0;
1045
1048
  padding: 10px;
1046
- z-index: 1001;
1049
+ z-index: 2;
1047
1050
  display: flex;
1048
1051
  flex-direction: row;
1049
1052
  margin-right: 10px;
1050
1053
  }
1051
1054
 
1055
+ .FuncnodesApp {
1056
+ height: 100%;
1057
+ width: 100%;
1058
+ flex-grow: 1;
1059
+ display: flex;
1060
+ flex-direction: column;
1061
+ }
1062
+
1052
1063
  .funcnodesreactflowheader {
1053
1064
  display: flex;
1054
1065
  flex-direction: row;
@@ -1057,7 +1068,7 @@ button {
1057
1068
  position: relative;
1058
1069
  top: 0;
1059
1070
  left: 0;
1060
- z-index: 1000;
1071
+ z-index: 1;
1061
1072
  }
1062
1073
  .funcnodesreactflowheader .headerelement {
1063
1074
  height: 100%;
@@ -1117,12 +1128,12 @@ button {
1117
1128
  }
1118
1129
 
1119
1130
  .nodesettings_container {
1120
- height: 100%;
1131
+ min-height: 100%;
1121
1132
  display: flex;
1122
1133
  flex-direction: row;
1123
1134
  }
1124
1135
  .nodesettings_expander {
1125
- height: 100%;
1136
+ min-height: 100%;
1126
1137
  display: flex;
1127
1138
  align-items: center;
1128
1139
  justify-content: center;
@@ -1153,83 +1164,6 @@ button {
1153
1164
  margin-top: 0.5rem;
1154
1165
  }
1155
1166
 
1156
- .tablecontainer {
1157
- overflow: auto;
1158
- background-color: white;
1159
- min-height: 20rem;
1160
- }
1161
-
1162
- .tableHead {
1163
- color: var(--funheadercolor) !important;
1164
- background-color: var(--funcnodesbackground1);
1165
- font-weight: bold !important;
1166
- }
1167
-
1168
- .tableheadercolor {
1169
- color: inherit !important;
1170
- font-family: inherit !important;
1171
- font-weight: inherit !important;
1172
- }
1173
-
1174
- .indexcol {
1175
- background-color: var(--funcnodesbackground2);
1176
- color: var(--funheadercolor) !important;
1177
- font-family: inherit !important;
1178
- font-weight: inherit !important;
1179
- }
1180
-
1181
- .styled-select__control {
1182
- height: 100%;
1183
- min-height: initial;
1184
- min-width: 10px;
1185
- }
1186
- .styled-select__menu-list {
1187
- max-height: 200px;
1188
- }
1189
- .styled-select__single-value {
1190
- text-align: start;
1191
- }
1192
- .styled-select__option {
1193
- text-align: start;
1194
- padding: 2px 5px;
1195
- }
1196
- .styled-select__option:hover {
1197
- cursor: pointer;
1198
- }
1199
-
1200
- .colorspace {
1201
- margin: 0.2rem;
1202
- display: grid;
1203
- grid-template-columns: auto minmax(0, 1fr);
1204
- }
1205
- .colorspace_title {
1206
- font-size: 0.7em;
1207
- font-weight: bold;
1208
- }
1209
- .colorspace label {
1210
- font-size: 0.7rem;
1211
- }
1212
- .colorspace input {
1213
- font-size: 0.7rem;
1214
- max-height: 0.7rem;
1215
- }
1216
- .colorspace input[type=range] {
1217
- width: 100%;
1218
- margin: 0;
1219
- padding: 0;
1220
- -webkit-appearance: none;
1221
- background-color: #666;
1222
- height: 0.7rem;
1223
- border-radius: 5px;
1224
- }
1225
- .colorspace input[type=range]::-webkit-slider-thumb, .colorspace input[type=range]::-webkit-range-thumb, .colorspace input[type=range]::-moz-range-thumb {
1226
- width: 0.7rem;
1227
- height: 0.7rem;
1228
- background-color: #cc1c1c;
1229
- border-radius: 50%;
1230
- cursor: pointer;
1231
- }
1232
-
1233
1167
  :root {
1234
1168
  --node_border_radius: 5px;
1235
1169
  --handle_outer_radius: 4px;
@@ -1499,6 +1433,83 @@ input.nodedatainput.styledinput,
1499
1433
  transition: width 0.3s ease;
1500
1434
  }
1501
1435
 
1436
+ .styled-select__control {
1437
+ height: 100%;
1438
+ min-height: initial;
1439
+ min-width: 10px;
1440
+ }
1441
+ .styled-select__menu-list {
1442
+ max-height: 200px;
1443
+ }
1444
+ .styled-select__single-value {
1445
+ text-align: start;
1446
+ }
1447
+ .styled-select__option {
1448
+ text-align: start;
1449
+ padding: 2px 5px;
1450
+ }
1451
+ .styled-select__option:hover {
1452
+ cursor: pointer;
1453
+ }
1454
+
1455
+ .tablecontainer {
1456
+ overflow: auto;
1457
+ background-color: white;
1458
+ min-height: 20rem;
1459
+ }
1460
+
1461
+ .tableHead {
1462
+ color: var(--funheadercolor) !important;
1463
+ background-color: var(--funcnodesbackground1);
1464
+ font-weight: bold !important;
1465
+ }
1466
+
1467
+ .tableheadercolor {
1468
+ color: inherit !important;
1469
+ font-family: inherit !important;
1470
+ font-weight: inherit !important;
1471
+ }
1472
+
1473
+ .indexcol {
1474
+ background-color: var(--funcnodesbackground2);
1475
+ color: var(--funheadercolor) !important;
1476
+ font-family: inherit !important;
1477
+ font-weight: inherit !important;
1478
+ }
1479
+
1480
+ .colorspace {
1481
+ margin: 0.2rem;
1482
+ display: grid;
1483
+ grid-template-columns: auto minmax(0, 1fr);
1484
+ }
1485
+ .colorspace_title {
1486
+ font-size: 0.7em;
1487
+ font-weight: bold;
1488
+ }
1489
+ .colorspace label {
1490
+ font-size: 0.7rem;
1491
+ }
1492
+ .colorspace input {
1493
+ font-size: 0.7rem;
1494
+ max-height: 0.7rem;
1495
+ }
1496
+ .colorspace input[type=range] {
1497
+ width: 100%;
1498
+ margin: 0;
1499
+ padding: 0;
1500
+ -webkit-appearance: none;
1501
+ background-color: #666;
1502
+ height: 0.7rem;
1503
+ border-radius: 5px;
1504
+ }
1505
+ .colorspace input[type=range]::-webkit-slider-thumb, .colorspace input[type=range]::-webkit-range-thumb, .colorspace input[type=range]::-moz-range-thumb {
1506
+ width: 0.7rem;
1507
+ height: 0.7rem;
1508
+ background-color: #cc1c1c;
1509
+ border-radius: 50%;
1510
+ cursor: pointer;
1511
+ }
1512
+
1502
1513
  s slideUpAndFade from {
1503
1514
  opacity: 0;
1504
1515
  transform: translateY(2px);
package/dist/index.d.ts CHANGED
@@ -6,7 +6,109 @@ import { Node, Edge, OnNodesChange, OnEdgesChange, OnConnect, useReactFlow } fro
6
6
  type DeepPartial<T> = T extends object ? {
7
7
  [P in keyof T]?: DeepPartial<T[P]>;
8
8
  } : T;
9
- type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
9
+ type Prev = [
10
+ never,
11
+ 0,
12
+ 1,
13
+ 2,
14
+ 3,
15
+ 4,
16
+ 5,
17
+ 6,
18
+ 7,
19
+ 8,
20
+ 9,
21
+ 10,
22
+ 11,
23
+ 12,
24
+ 13,
25
+ 14,
26
+ 15,
27
+ 16,
28
+ 17,
29
+ 18,
30
+ 19,
31
+ 20,
32
+ 21,
33
+ 22,
34
+ 23,
35
+ 24,
36
+ 25,
37
+ 26,
38
+ 27,
39
+ 28,
40
+ 29,
41
+ 30,
42
+ 31,
43
+ 32,
44
+ 33,
45
+ 34,
46
+ 35,
47
+ 36,
48
+ 37,
49
+ 38,
50
+ 39,
51
+ 40,
52
+ 41,
53
+ 42,
54
+ 43,
55
+ 44,
56
+ 45,
57
+ 46,
58
+ 47,
59
+ 48,
60
+ 49,
61
+ 50,
62
+ 51,
63
+ 52,
64
+ 53,
65
+ 54,
66
+ 55,
67
+ 56,
68
+ 57,
69
+ 58,
70
+ 59,
71
+ 60,
72
+ 61,
73
+ 62,
74
+ 63,
75
+ 64,
76
+ 65,
77
+ 66,
78
+ 67,
79
+ 68,
80
+ 69,
81
+ 70,
82
+ 71,
83
+ 72,
84
+ 73,
85
+ 74,
86
+ 75,
87
+ 76,
88
+ 77,
89
+ 78,
90
+ 79,
91
+ 80,
92
+ 81,
93
+ 82,
94
+ 83,
95
+ 84,
96
+ 85,
97
+ 86,
98
+ 87,
99
+ 88,
100
+ 89,
101
+ 90,
102
+ 91,
103
+ 92,
104
+ 93,
105
+ 94,
106
+ 95,
107
+ 96,
108
+ 97,
109
+ 98,
110
+ 99
111
+ ];
10
112
  type LimitedDeepPartial<T, D extends number = 10> = D extends 0 ? T : T extends object ? {
11
113
  [K in keyof T]?: LimitedDeepPartial<T[K], Prev[D]>;
12
114
  } : T;
@@ -58,7 +160,6 @@ interface TypeOf {
58
160
  }
59
161
  type SerializedType = string | AllOf | AnyOf | ArrayOf | DictOf | EnumOf | TypeOf;
60
162
  interface IORenderOptions extends BaseRenderOptions {
61
- step?: number;
62
163
  set_default: boolean;
63
164
  }
64
165
  interface IOValueOptions {
@@ -221,6 +322,10 @@ interface WorkerProps {
221
322
  interface FuncNodesWorkerState {
222
323
  is_open: boolean;
223
324
  }
325
+ interface HookProperties {
326
+ worker: FuncNodesWorker;
327
+ data: any;
328
+ }
224
329
  declare class FuncNodesWorker {
225
330
  messagePromises: Map<string, any>;
226
331
  _zustand?: FuncNodesReactFlowZustandInterface;
@@ -229,9 +334,15 @@ declare class FuncNodesWorker {
229
334
  uuid: string;
230
335
  state: UseBoundStore<StoreApi<FuncNodesWorkerState>>;
231
336
  on_sync_complete: (worker: FuncNodesWorker) => Promise<void>;
337
+ _hooks: Map<string, ((p: HookProperties) => Promise<void>)[]>;
338
+ _ns_event_intercepts: Map<string, ((event: NodeSpaceEvent) => Promise<NodeSpaceEvent>)[]>;
232
339
  on_error: (error: any) => void;
233
340
  constructor(data: WorkerProps);
234
341
  set_zustand(zustand: FuncNodesReactFlowZustandInterface): void;
342
+ add_hook(hook: string, callback: (p: HookProperties) => Promise<void>): () => void;
343
+ call_hooks(hook: string, data?: any): Promise<void>;
344
+ add_ns_event_intercept(hook: string, callback: (event: NodeSpaceEvent) => Promise<NodeSpaceEvent>): () => void;
345
+ intercept_ns_event(event: NodeSpaceEvent): Promise<NodeSpaceEvent>;
235
346
  get is_open(): boolean;
236
347
  set is_open(v: boolean);
237
348
  stepwise_fullsync(): Promise<void>;
@@ -285,6 +396,7 @@ declare class FuncNodesWorker {
285
396
  }): Promise<{
286
397
  [ioid: string]: any;
287
398
  }>;
399
+ get_runstate(): Promise<any>;
288
400
  _send_cmd({ cmd, kwargs, wait_for_response, response_timeout, retries, }: {
289
401
  cmd: string;
290
402
  kwargs?: any;
@@ -300,7 +412,7 @@ declare class FuncNodesWorker {
300
412
  }): Promise<string[]>;
301
413
  handle_large_message_hint({}: LargeMessageHint): Promise<void>;
302
414
  receive_workerevent({ event, data }: WorkerEvent): Promise<void>;
303
- receive_nodespace_event({ event, data }: NodeSpaceEvent): Promise<void>;
415
+ receive_nodespace_event(ns_event: NodeSpaceEvent): Promise<void>;
304
416
  add_lib(lib: string, release: string): Promise<any>;
305
417
  remove_lib(lib: string): Promise<any>;
306
418
  receive(data: JSONMessage): Promise<any>;
@@ -641,6 +753,7 @@ interface ReactFlowLayerProps {
641
753
  maxZoom: number;
642
754
  allowFullScreen: boolean;
643
755
  allowExpand: boolean;
756
+ showNodeSettings: boolean;
644
757
  }
645
758
  interface FuncnodesReactFlowProps {
646
759
  id: string;
@@ -697,6 +810,7 @@ interface FuncNodesReactFlowZustandInterface {
697
810
  add_plugin: (name: string, plugin: FuncNodesReactPlugin) => void;
698
811
  reactflowRef: HTMLDivElement | null;
699
812
  clear_all: () => void;
813
+ center_node: (node_id: string | string[]) => void;
700
814
  dev_settings: DevSettings;
701
815
  logger: Logger;
702
816
  }
@@ -719,6 +833,6 @@ declare const ReactFlowLayer: (props: ReactFlowLayerProps) => React.JSX.Element;
719
833
 
720
834
  declare const assert_full_node: (node: PartialNodeType) => NodeType;
721
835
 
722
- declare const FuncNodes: (props: Partial<FuncnodesReactFlowProps>) => React.JSX.Element;
836
+ declare const FuncNodes: (props: LimitedDeepPartial<FuncnodesReactFlowProps>) => React.JSX.Element;
723
837
 
724
838
  export { type DataOverlayRendererType, type DataPreviewViewRendererType, type DataViewRendererType, FuncNodesContext, FuncNodesReactFlowZustand, type FuncNodesReactFlowZustandInterface, type FuncNodesReactPlugin, FuncNodesWorker, FuncnodesReactFlow, type FuncnodesReactFlowProps, type HandlePreviewRendererType, type IOType, type InputRendererProps, type NodeType, type OutputRendererProps, type PartialNodeType, type ProgressState, ReactFlowLayer, RenderMappingProvider, type RenderPluginFactoryProps, type RendererPlugin, WebSocketWorker, type WorkerProps, assert_full_node, deep_update, FuncNodes as default, helperfunctions };