@linkdlab/funcnodes_pyodide_react_flow 0.1.0 → 0.1.1

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.
@@ -12,98 +12,6 @@
12
12
  stroke: #11ff00;
13
13
  }
14
14
 
15
- .dialogoverlay {
16
- background-color: rgba(0, 0, 0, 0.5);
17
- position: fixed;
18
- inset: 0;
19
- animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
20
- z-index: 2000;
21
- }
22
-
23
- .dialogconent {
24
- background-color: var(--funcnodesbackground1);
25
- border-radius: 6px;
26
- box-shadow: var(--funheadercolor) 0px 10px 38px -10px, var(--funheadercolor) 0px 10px 20px -15px;
27
- position: fixed;
28
- top: 50%;
29
- left: 50%;
30
- transform: translate(-50%, -50%);
31
- width: 90vw;
32
- max-width: 85vw;
33
- max-height: 85vh;
34
- padding: 25px;
35
- animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
36
- color: var(--funcnodestextcolor1);
37
- border: 1px solid var(--funheadercolor);
38
- display: flex;
39
- flex-direction: column;
40
- z-index: 2001;
41
- }
42
-
43
- .dialogtitle {
44
- margin: 0;
45
- font-weight: 500;
46
- color: var(--funheadercolor);
47
- font-size: 17px;
48
- }
49
-
50
- .dialogdescription {
51
- margin: 10px 0 20px;
52
- font-size: 15px;
53
- line-height: 1.5;
54
- }
55
-
56
- .dialogclosebutton {
57
- border-radius: 100%;
58
- height: 25px;
59
- width: 25px;
60
- display: inline-flex;
61
- background-color: inherit;
62
- align-items: center;
63
- justify-content: center;
64
- color: var(--funheadercolor);
65
- position: absolute;
66
- top: 10px;
67
- right: 10px;
68
- border: none;
69
- }
70
-
71
- .dialogclosebutton:hover {
72
- background-color: var(--funheadercolor);
73
- color: var(--funcnodesbackground1);
74
- }
75
-
76
- .dialogclosebutton:active {
77
- background-color: var(--funheadercolor);
78
- color: var(--funcnodestextcolor1);
79
- }
80
-
81
- .dialogsendbutton {
82
- background-color: var(--funcnodesbackground1);
83
- color: var(--funheadercolor);
84
- border: 1px solid var(--funheadercolor);
85
- border-radius: 99rem;
86
- padding: 10px 20px;
87
- cursor: pointer;
88
- font-size: 15px;
89
- margin-top: 20px;
90
- }
91
-
92
- .dialogsendbutton:hover {
93
- background-color: var(--funheadercolor);
94
- color: var(--funcnodesbackground1);
95
- }
96
-
97
- .dialogsendbutton:active {
98
- background-color: var(--funheadercolor);
99
- color: var(--funcnodestextcolor1);
100
- }
101
-
102
- .dialogchildren {
103
- margin-top: 20px;
104
- overflow: auto;
105
- }
106
-
107
15
  :root {
108
16
  --expandtime: 0.3s;
109
17
  --libnodebgcolor: #48465f;
@@ -381,6 +289,98 @@
381
289
  color: #0056b3;
382
290
  }
383
291
 
292
+ .dialogoverlay {
293
+ background-color: rgba(0, 0, 0, 0.5);
294
+ position: fixed;
295
+ inset: 0;
296
+ animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
297
+ z-index: 2000;
298
+ }
299
+
300
+ .dialogconent {
301
+ background-color: var(--funcnodesbackground1);
302
+ border-radius: 6px;
303
+ box-shadow: var(--funheadercolor) 0px 10px 38px -10px, var(--funheadercolor) 0px 10px 20px -15px;
304
+ position: fixed;
305
+ top: 50%;
306
+ left: 50%;
307
+ transform: translate(-50%, -50%);
308
+ width: 90vw;
309
+ max-width: 85vw;
310
+ max-height: 85vh;
311
+ padding: 25px;
312
+ animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
313
+ color: var(--funcnodestextcolor1);
314
+ border: 1px solid var(--funheadercolor);
315
+ display: flex;
316
+ flex-direction: column;
317
+ z-index: 2001;
318
+ }
319
+
320
+ .dialogtitle {
321
+ margin: 0;
322
+ font-weight: 500;
323
+ color: var(--funheadercolor);
324
+ font-size: 17px;
325
+ }
326
+
327
+ .dialogdescription {
328
+ margin: 10px 0 20px;
329
+ font-size: 15px;
330
+ line-height: 1.5;
331
+ }
332
+
333
+ .dialogclosebutton {
334
+ border-radius: 100%;
335
+ height: 25px;
336
+ width: 25px;
337
+ display: inline-flex;
338
+ background-color: inherit;
339
+ align-items: center;
340
+ justify-content: center;
341
+ color: var(--funheadercolor);
342
+ position: absolute;
343
+ top: 10px;
344
+ right: 10px;
345
+ border: none;
346
+ }
347
+
348
+ .dialogclosebutton:hover {
349
+ background-color: var(--funheadercolor);
350
+ color: var(--funcnodesbackground1);
351
+ }
352
+
353
+ .dialogclosebutton:active {
354
+ background-color: var(--funheadercolor);
355
+ color: var(--funcnodestextcolor1);
356
+ }
357
+
358
+ .dialogsendbutton {
359
+ background-color: var(--funcnodesbackground1);
360
+ color: var(--funheadercolor);
361
+ border: 1px solid var(--funheadercolor);
362
+ border-radius: 99rem;
363
+ padding: 10px 20px;
364
+ cursor: pointer;
365
+ font-size: 15px;
366
+ margin-top: 20px;
367
+ }
368
+
369
+ .dialogsendbutton:hover {
370
+ background-color: var(--funheadercolor);
371
+ color: var(--funcnodesbackground1);
372
+ }
373
+
374
+ .dialogsendbutton:active {
375
+ background-color: var(--funheadercolor);
376
+ color: var(--funcnodestextcolor1);
377
+ }
378
+
379
+ .dialogchildren {
380
+ margin-top: 20px;
381
+ overflow: auto;
382
+ }
383
+
384
384
  /* this gets exported as style.css and can be used for the default theming */
385
385
  /* these are the necessary styles for React Flow, they get used by base.css and style.css */
386
386
  .react-flow {
@@ -869,112 +869,46 @@
869
869
  top: 100%;
870
870
  }
871
871
 
872
- :root {
873
- --funheadercolor: #00d9ff;
874
- --funcnodesbackground1: hsl(243, 26%, 13%);
875
- --funcnodesbackground2: hsl(245, 22%, 22%);
876
- --funcnodesbackground_light: hsl(240, 22%, 38%);
877
- --containerboarderradius: 1rem;
878
- --funcnodestextcolor1: #ffffff;
879
- }
880
-
881
- .funcnodescontainer {
882
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
883
- -webkit-font-smoothing: antialiased;
884
- -moz-osx-font-smoothing: grayscale;
885
- }
886
-
887
- .funcnodescontainer code {
888
- font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
872
+ .smooth-expand-expanded {
873
+ position: absolute;
874
+ top: 0;
875
+ left: 0;
876
+ width: 100vw;
877
+ height: 100vh;
889
878
  }
890
879
 
891
- .funcnodesreactflowcontainer {
892
- width: 100%;
893
- height: 100%;
880
+ .basicstyleelement, .headermenucontent, .styled-select__menu, .styleelement, .styledcheckbox, .styledinput, .styledbtn, .styleddropdown {
894
881
  background-color: var(--funcnodesbackground1);
895
- position: relative;
896
- display: flex;
897
- flex-direction: column;
898
882
  color: var(--funcnodestextcolor1);
883
+ border-radius: 0.75rem;
884
+ border: 1px solid var(--funheadercolor);
899
885
  }
900
886
 
901
- .funcnodesreactflowcontainer * {
902
- box-sizing: border-box;
887
+ .styleelement, .styledcheckbox, .styledinput, .styledbtn, .styleddropdown {
888
+ height: 2rem;
889
+ padding-left: 0.5rem;
890
+ padding-right: 0.5rem;
903
891
  }
904
892
 
905
- .funcnodesreactflowbody {
906
- flex-grow: 1;
907
- position: relative;
908
- display: flex;
909
- flex-direction: row;
910
- overflow: hidden;
893
+ .styleelement:hover, .styledcheckbox:hover, .styledinput:hover, .styledbtn:hover, .styleddropdown:hover {
894
+ background-color: var(--funcnodesbackground_light);
911
895
  }
912
896
 
913
- .reactflowlayer {
914
- flex-grow: 1;
915
- position: relative;
916
- overflow: hidden;
917
- background-color: var(--funcnodesbackground2);
918
- margin: 0.5rem;
919
- border-radius: var(--containerboarderradius);
897
+ .styleelement:active, .styledcheckbox:active, .styledinput:active, .styledbtn:active, .styleddropdown:active {
898
+ background-color: var(--funheadercolor);
899
+ color: var(--funcnodesbackground1);
920
900
  }
921
901
 
922
- .vscrollcontainer {
923
- overflow-y: auto;
924
- overflow-x: hidden;
925
- flex-grow: 1;
926
- padding: 0.5rem;
927
- box-sizing: border-box;
902
+ .styleelement:focus, .styledcheckbox:focus, .styledinput:focus, .styledbtn:focus, .styleddropdown:focus {
903
+ outline: 1px solid var(--funheadercolor);
928
904
  }
929
905
 
930
- .workerselect {
931
- max-width: 140px;
906
+ .styleddropdown {
907
+ padding-right: 0.25rem;
932
908
  }
933
909
 
934
- .workerselectoption.selected {
935
- color: var(--funcnodestextcolor1);
936
- }
937
-
938
- .workerselectoption.active {
939
- color: green;
940
- }
941
-
942
- .workerselectoption.inactive {
943
- color: red;
944
- }
945
-
946
- .basicstyleelement, .headermenucontent, .styled-select__menu, .styleelement, .styledcheckbox, .styledinput, .styledbtn, .styleddropdown {
947
- background-color: var(--funcnodesbackground1);
948
- color: var(--funcnodestextcolor1);
949
- border-radius: 0.75rem;
950
- border: 1px solid var(--funheadercolor);
951
- }
952
-
953
- .styleelement, .styledcheckbox, .styledinput, .styledbtn, .styleddropdown {
954
- height: 2rem;
955
- padding-left: 0.5rem;
956
- padding-right: 0.5rem;
957
- }
958
-
959
- .styleelement:hover, .styledcheckbox:hover, .styledinput:hover, .styledbtn:hover, .styleddropdown:hover {
960
- background-color: var(--funcnodesbackground_light);
961
- }
962
-
963
- .styleelement:active, .styledcheckbox:active, .styledinput:active, .styledbtn:active, .styleddropdown:active {
964
- background-color: var(--funheadercolor);
965
- color: var(--funcnodesbackground1);
966
- }
967
-
968
- .styleelement:focus, .styledcheckbox:focus, .styledinput:focus, .styledbtn:focus, .styleddropdown:focus {
969
- outline: 1px solid var(--funheadercolor);
970
- }
971
-
972
- .styleddropdown {
973
- padding-right: 0.25rem;
974
- }
975
-
976
- .styledbtn {
977
- cursor: pointer;
910
+ .styledbtn {
911
+ cursor: pointer;
978
912
  }
979
913
 
980
914
  .styledinput :focus {
@@ -1081,6 +1015,90 @@ button {
1081
1015
  font-size: inherit;
1082
1016
  }
1083
1017
 
1018
+ :root {
1019
+ --funheadercolor: #00d9ff;
1020
+ --funcnodesbackground1: hsl(243, 26%, 13%);
1021
+ --funcnodesbackground2: hsl(245, 22%, 22%);
1022
+ --funcnodesbackground_light: hsl(240, 22%, 38%);
1023
+ --containerboarderradius: 1rem;
1024
+ --funcnodestextcolor1: #ffffff;
1025
+ }
1026
+
1027
+ .funcnodescontainer {
1028
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
1029
+ -webkit-font-smoothing: antialiased;
1030
+ -moz-osx-font-smoothing: grayscale;
1031
+ }
1032
+
1033
+ .funcnodescontainer code {
1034
+ font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
1035
+ }
1036
+
1037
+ .funcnodesreactflowcontainer {
1038
+ width: 100%;
1039
+ height: 100%;
1040
+ background-color: var(--funcnodesbackground1);
1041
+ position: relative;
1042
+ display: flex;
1043
+ flex-direction: column;
1044
+ color: var(--funcnodestextcolor1);
1045
+ }
1046
+
1047
+ .funcnodesreactflowcontainer * {
1048
+ box-sizing: border-box;
1049
+ }
1050
+
1051
+ .funcnodesreactflowbody {
1052
+ flex-grow: 1;
1053
+ position: relative;
1054
+ display: flex;
1055
+ flex-direction: row;
1056
+ overflow: hidden;
1057
+ }
1058
+
1059
+ .reactflowlayer {
1060
+ flex-grow: 1;
1061
+ position: relative;
1062
+ overflow: hidden;
1063
+ background-color: var(--funcnodesbackground2);
1064
+ margin: 0.5rem;
1065
+ border-radius: var(--containerboarderradius);
1066
+ }
1067
+
1068
+ .vscrollcontainer {
1069
+ overflow-y: auto;
1070
+ overflow-x: hidden;
1071
+ flex-grow: 1;
1072
+ padding: 0.5rem;
1073
+ box-sizing: border-box;
1074
+ }
1075
+
1076
+ .workerselect {
1077
+ max-width: 140px;
1078
+ }
1079
+
1080
+ .workerselectoption.selected {
1081
+ color: var(--funcnodestextcolor1);
1082
+ }
1083
+
1084
+ .workerselectoption.active {
1085
+ color: green;
1086
+ }
1087
+
1088
+ .workerselectoption.inactive {
1089
+ color: red;
1090
+ }
1091
+
1092
+ .funcnodesflaotingmenu {
1093
+ position: absolute;
1094
+ right: 0;
1095
+ padding: 10px;
1096
+ z-index: 1001;
1097
+ display: flex;
1098
+ flex-direction: row;
1099
+ margin-right: 10px;
1100
+ }
1101
+
1084
1102
  .funcnodesreactflowheader {
1085
1103
  display: flex;
1086
1104
  flex-direction: row;
@@ -1198,6 +1216,92 @@ button {
1198
1216
  margin-top: 0.5rem;
1199
1217
  }
1200
1218
 
1219
+ .tablecontainer {
1220
+ overflow: auto;
1221
+ background-color: white;
1222
+ min-height: 20rem;
1223
+ }
1224
+
1225
+ .tableHead {
1226
+ color: var(--funheadercolor) !important;
1227
+ background-color: var(--funcnodesbackground1);
1228
+ font-weight: bold !important;
1229
+ }
1230
+
1231
+ .tableheadercolor {
1232
+ color: inherit !important;
1233
+ font-family: inherit !important;
1234
+ font-weight: inherit !important;
1235
+ }
1236
+
1237
+ .indexcol {
1238
+ background-color: var(--funcnodesbackground2);
1239
+ color: var(--funheadercolor) !important;
1240
+ font-family: inherit !important;
1241
+ font-weight: inherit !important;
1242
+ }
1243
+
1244
+ .styled-select__control {
1245
+ height: 100%;
1246
+ min-height: initial;
1247
+ min-width: 10px;
1248
+ }
1249
+
1250
+ .styled-select__menu-list {
1251
+ max-height: 200px;
1252
+ }
1253
+
1254
+ .styled-select__single-value {
1255
+ text-align: start;
1256
+ }
1257
+
1258
+ .styled-select__option {
1259
+ text-align: start;
1260
+ padding: 2px 5px;
1261
+ }
1262
+
1263
+ .styled-select__option:hover {
1264
+ cursor: pointer;
1265
+ }
1266
+
1267
+ .colorspace {
1268
+ margin: 0.2rem;
1269
+ display: grid;
1270
+ grid-template-columns: auto minmax(0, 1fr);
1271
+ }
1272
+
1273
+ .colorspace_title {
1274
+ font-size: 0.7em;
1275
+ font-weight: bold;
1276
+ }
1277
+
1278
+ .colorspace label {
1279
+ font-size: 0.7rem;
1280
+ }
1281
+
1282
+ .colorspace input {
1283
+ font-size: 0.7rem;
1284
+ max-height: 0.7rem;
1285
+ }
1286
+
1287
+ .colorspace input[type=range] {
1288
+ width: 100%;
1289
+ margin: 0;
1290
+ padding: 0;
1291
+ -webkit-appearance: none;
1292
+ background-color: #666;
1293
+ height: 0.7rem;
1294
+ border-radius: 5px;
1295
+ }
1296
+
1297
+ .colorspace input[type=range]::-webkit-slider-thumb, .colorspace input[type=range]::-webkit-range-thumb, .colorspace input[type=range]::-moz-range-thumb {
1298
+ width: 0.7rem;
1299
+ height: 0.7rem;
1300
+ background-color: #cc1c1c;
1301
+ border-radius: 50%;
1302
+ cursor: pointer;
1303
+ }
1304
+
1201
1305
  :root {
1202
1306
  --node_border_radius: 5px;
1203
1307
  --handle_outer_radius: 4px;
@@ -1496,92 +1600,6 @@ input.nodedatainput.styledinput,
1496
1600
  transition: width 0.3s ease;
1497
1601
  }
1498
1602
 
1499
- .styled-select__control {
1500
- height: 100%;
1501
- min-height: initial;
1502
- min-width: 10px;
1503
- }
1504
-
1505
- .styled-select__menu-list {
1506
- max-height: 200px;
1507
- }
1508
-
1509
- .styled-select__single-value {
1510
- text-align: start;
1511
- }
1512
-
1513
- .styled-select__option {
1514
- text-align: start;
1515
- padding: 2px 5px;
1516
- }
1517
-
1518
- .styled-select__option:hover {
1519
- cursor: pointer;
1520
- }
1521
-
1522
- .tablecontainer {
1523
- overflow: auto;
1524
- background-color: white;
1525
- min-height: 20rem;
1526
- }
1527
-
1528
- .tableHead {
1529
- color: var(--funheadercolor) !important;
1530
- background-color: var(--funcnodesbackground1);
1531
- font-weight: bold !important;
1532
- }
1533
-
1534
- .tableheadercolor {
1535
- color: inherit !important;
1536
- font-family: inherit !important;
1537
- font-weight: inherit !important;
1538
- }
1539
-
1540
- .indexcol {
1541
- background-color: var(--funcnodesbackground2);
1542
- color: var(--funheadercolor) !important;
1543
- font-family: inherit !important;
1544
- font-weight: inherit !important;
1545
- }
1546
-
1547
- .colorspace {
1548
- margin: 0.2rem;
1549
- display: grid;
1550
- grid-template-columns: auto minmax(0, 1fr);
1551
- }
1552
-
1553
- .colorspace_title {
1554
- font-size: 0.7em;
1555
- font-weight: bold;
1556
- }
1557
-
1558
- .colorspace label {
1559
- font-size: 0.7rem;
1560
- }
1561
-
1562
- .colorspace input {
1563
- font-size: 0.7rem;
1564
- max-height: 0.7rem;
1565
- }
1566
-
1567
- .colorspace input[type=range] {
1568
- width: 100%;
1569
- margin: 0;
1570
- padding: 0;
1571
- -webkit-appearance: none;
1572
- background-color: #666;
1573
- height: 0.7rem;
1574
- border-radius: 5px;
1575
- }
1576
-
1577
- .colorspace input[type=range]::-webkit-slider-thumb, .colorspace input[type=range]::-webkit-range-thumb, .colorspace input[type=range]::-moz-range-thumb {
1578
- width: 0.7rem;
1579
- height: 0.7rem;
1580
- background-color: #cc1c1c;
1581
- border-radius: 50%;
1582
- cursor: pointer;
1583
- }
1584
-
1585
1603
  s slideUpAndFade from {
1586
1604
  opacity: 0;
1587
1605
  transform: translateY(2px);
package/dist/index.d.ts CHANGED
@@ -4,14 +4,20 @@ interface FuncnodesPyodideWorkerProps extends Partial<WorkerProps> {
4
4
  debug?: boolean;
5
5
  worker_url: string;
6
6
  shared_worker?: boolean;
7
+ worker?: Worker | SharedWorker;
7
8
  }
8
9
  declare class FuncnodesPyodideWorker extends FuncNodesWorker {
9
10
  _worker: Worker | SharedWorker;
10
11
  initPromise: Promise<void>;
11
- _workerstate: any;
12
+ _workerstate: {
13
+ loaded: boolean;
14
+ };
12
15
  _port: MessagePort | undefined;
16
+ _message_hooks: ((data: any) => Promise<void>)[];
13
17
  constructor(_data: FuncnodesPyodideWorkerProps);
14
18
  send(data: any): Promise<void>;
19
+ postMessage(data: any): void;
20
+ registerMessageHook(hook: (data: any) => Promise<void>): () => void;
15
21
  onmessage(event: MessageEvent): void;
16
22
  }
17
23
 
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- import{FuncNodesWorker as t}from"@linkdlab/funcnodes_react_flow";function e(t,e,r,s){return new(r||(r=Promise))((function(o,n){function i(t){try{d(s.next(t))}catch(t){n(t)}}function a(t){try{d(s.throw(t))}catch(t){n(t)}}function d(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,a)}d((s=s.apply(t,e||[])).next())}))}let r;"function"==typeof SuppressedError&&SuppressedError;const s=new Uint8Array(16);function o(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(s)}const n=[];for(let t=0;t<256;++t)n.push((t+256).toString(16).slice(1));var i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function a(t,e,r){if(i.randomUUID&&!t)return i.randomUUID();const s=(t=t||{}).random||(t.rng||o)();return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(t,e=0){return n[t[e+0]]+n[t[e+1]]+n[t[e+2]]+n[t[e+3]]+"-"+n[t[e+4]]+n[t[e+5]]+"-"+n[t[e+6]]+n[t[e+7]]+"-"+n[t[e+8]]+n[t[e+9]]+"-"+n[t[e+10]]+n[t[e+11]]+n[t[e+12]]+n[t[e+13]]+n[t[e+14]]+n[t[e+15]]}(s)}class d extends t{constructor(t){const r=Object.assign({uuid:a()},t);super(r);const s=`${r.worker_url}?debug=${r.debug}`;r.shared_worker?(this._worker=new SharedWorker(s,{type:"module",name:r.uuid}),this._port=this._worker.port,this._port.start(),this._port.addEventListener("message",this.onmessage.bind(this)),setInterval((()=>{var t;null===(t=this._port)||void 0===t||t.postMessage({cmd:"state"})}),1e3)):(this._worker=new Worker(s,{type:"module"}),this._worker.addEventListener("message",this.onmessage.bind(this)),setInterval((()=>{this._worker.postMessage({cmd:"state"})}),1e3)),this._workerstate={loaded:!1},this.initPromise=new Promise((t=>e(this,void 0,void 0,(function*(){for(var e;!this._workerstate.loaded;)yield new Promise((t=>setTimeout(t,100)));this.is_open=!0,null===(e=this._zustand)||void 0===e||e.auto_progress(),t()})))),this.initPromise.then((()=>{this.stepwise_fullsync()}))}send(t){return e(this,void 0,void 0,(function*(){yield this.initPromise,this._port?this._port.postMessage({cmd:"send",msg:JSON.stringify(t)}):yield this._worker.postMessage({cmd:"send",msg:JSON.stringify(t)})}))}onmessage(t){t.data.result?t.data.result.state&&(this._workerstate=t.data.result.state):t.data.cmd&&"receive"===t.data.cmd&&this.receive(JSON.parse(t.data.msg))}}export{d as default};
1
+ import{FuncNodesWorker as e}from"@linkdlab/funcnodes_react_flow";function r(e,r,t,s){return new(t||(t=Promise))((function(o,i){function n(e){try{d(s.next(e))}catch(e){i(e)}}function a(e){try{d(s.throw(e))}catch(e){i(e)}}function d(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(n,a)}d((s=s.apply(e,r||[])).next())}))}let t;"function"==typeof SuppressedError&&SuppressedError;const s=new Uint8Array(16);function o(){if(!t&&(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!t))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(s)}const i=[];for(let e=0;e<256;++e)i.push((e+256).toString(16).slice(1));var n={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function a(e,r,t){if(n.randomUUID&&!e)return n.randomUUID();const s=(e=e||{}).random||(e.rng||o)();return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(e,r=0){return i[e[r+0]]+i[e[r+1]]+i[e[r+2]]+i[e[r+3]]+"-"+i[e[r+4]]+i[e[r+5]]+"-"+i[e[r+6]]+i[e[r+7]]+"-"+i[e[r+8]]+i[e[r+9]]+"-"+i[e[r+10]]+i[e[r+11]]+i[e[r+12]]+i[e[r+13]]+i[e[r+14]]+i[e[r+15]]}(s)}class d extends e{constructor(e){const t=Object.assign({uuid:a()},e);super(t),this._message_hooks=[];const s=`${t.worker_url}?debug=${t.debug}`;if(t.worker)if(t.worker instanceof SharedWorker)t.shared_worker=!0;else{if(!(t.worker instanceof Worker))throw new Error("worker must be an instance of Worker or SharedWorker");t.shared_worker=!1}t.shared_worker?(t.worker||(t.worker=new SharedWorker(s,{type:"module",name:t.uuid})),this._worker=t.worker,this._port=this._worker.port,this._port.start(),this._port.addEventListener("message",this.onmessage.bind(this))):(t.worker||(t.worker=new Worker(s,{type:"module"})),this._worker=t.worker,this._worker.addEventListener("message",this.onmessage.bind(this))),setInterval((()=>{this.postMessage({cmd:"state"})}),1e3),this._workerstate={loaded:!1},this.initPromise=new Promise((e=>r(this,void 0,void 0,(function*(){for(var r;!this._workerstate.loaded;)yield new Promise((e=>setTimeout(e,100)));this.is_open=!0,null===(r=this._zustand)||void 0===r||r.auto_progress(),e()})))),this.initPromise.then((()=>{this.stepwise_fullsync()}))}send(e){return r(this,void 0,void 0,(function*(){yield this.initPromise,this.postMessage({cmd:"worker:send",msg:JSON.stringify(e),worker_id:this.uuid})}))}postMessage(e){this._port?this._port.postMessage(e):this._worker.postMessage(e)}registerMessageHook(e){return this._message_hooks.push(e),()=>{this._message_hooks=this._message_hooks.filter((r=>r!==e))}}onmessage(e){for(const r of this._message_hooks)r(e.data);if(e.data.result)e.data.result.state&&(this._workerstate=Object.assign(Object.assign({},this._workerstate),e.data.result.state));else if(e.data.cmd&&"receive"===e.data.cmd){if(void 0===e.data.worker_id)throw new Error("worker_id is undefined");e.data.worker_id===this.uuid&&this.receive(JSON.parse(e.data.msg))}}}export{d as default};
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@linkdlab/funcnodes_react_flow");function t(e,t,r,s){return new(r||(r=Promise))((function(o,n){function i(e){try{d(s.next(e))}catch(e){n(e)}}function a(e){try{d(s.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}d((s=s.apply(e,t||[])).next())}))}let r;"function"==typeof SuppressedError&&SuppressedError;const s=new Uint8Array(16);function o(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(s)}const n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));var i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function a(e,t,r){if(i.randomUUID&&!e)return i.randomUUID();const s=(e=e||{}).random||(e.rng||o)();return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(e,t=0){return n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]}(s)}class d extends e.FuncNodesWorker{constructor(e){const r=Object.assign({uuid:a()},e);super(r);const s=`${r.worker_url}?debug=${r.debug}`;r.shared_worker?(this._worker=new SharedWorker(s,{type:"module",name:r.uuid}),this._port=this._worker.port,this._port.start(),this._port.addEventListener("message",this.onmessage.bind(this)),setInterval((()=>{var e;null===(e=this._port)||void 0===e||e.postMessage({cmd:"state"})}),1e3)):(this._worker=new Worker(s,{type:"module"}),this._worker.addEventListener("message",this.onmessage.bind(this)),setInterval((()=>{this._worker.postMessage({cmd:"state"})}),1e3)),this._workerstate={loaded:!1},this.initPromise=new Promise((e=>t(this,void 0,void 0,(function*(){for(var t;!this._workerstate.loaded;)yield new Promise((e=>setTimeout(e,100)));this.is_open=!0,null===(t=this._zustand)||void 0===t||t.auto_progress(),e()})))),this.initPromise.then((()=>{this.stepwise_fullsync()}))}send(e){return t(this,void 0,void 0,(function*(){yield this.initPromise,this._port?this._port.postMessage({cmd:"send",msg:JSON.stringify(e)}):yield this._worker.postMessage({cmd:"send",msg:JSON.stringify(e)})}))}onmessage(e){e.data.result?e.data.result.state&&(this._workerstate=e.data.result.state):e.data.cmd&&"receive"===e.data.cmd&&this.receive(JSON.parse(e.data.msg))}}exports.default=d;
1
+ Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@linkdlab/funcnodes_react_flow");function r(e,r,t,s){return new(t||(t=Promise))((function(o,i){function n(e){try{d(s.next(e))}catch(e){i(e)}}function a(e){try{d(s.throw(e))}catch(e){i(e)}}function d(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(n,a)}d((s=s.apply(e,r||[])).next())}))}let t;"function"==typeof SuppressedError&&SuppressedError;const s=new Uint8Array(16);function o(){if(!t&&(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!t))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(s)}const i=[];for(let e=0;e<256;++e)i.push((e+256).toString(16).slice(1));var n={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function a(e,r,t){if(n.randomUUID&&!e)return n.randomUUID();const s=(e=e||{}).random||(e.rng||o)();return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(e,r=0){return i[e[r+0]]+i[e[r+1]]+i[e[r+2]]+i[e[r+3]]+"-"+i[e[r+4]]+i[e[r+5]]+"-"+i[e[r+6]]+i[e[r+7]]+"-"+i[e[r+8]]+i[e[r+9]]+"-"+i[e[r+10]]+i[e[r+11]]+i[e[r+12]]+i[e[r+13]]+i[e[r+14]]+i[e[r+15]]}(s)}class d extends e.FuncNodesWorker{constructor(e){const t=Object.assign({uuid:a()},e);super(t),this._message_hooks=[];const s=`${t.worker_url}?debug=${t.debug}`;if(t.worker)if(t.worker instanceof SharedWorker)t.shared_worker=!0;else{if(!(t.worker instanceof Worker))throw new Error("worker must be an instance of Worker or SharedWorker");t.shared_worker=!1}t.shared_worker?(t.worker||(t.worker=new SharedWorker(s,{type:"module",name:t.uuid})),this._worker=t.worker,this._port=this._worker.port,this._port.start(),this._port.addEventListener("message",this.onmessage.bind(this))):(t.worker||(t.worker=new Worker(s,{type:"module"})),this._worker=t.worker,this._worker.addEventListener("message",this.onmessage.bind(this))),setInterval((()=>{this.postMessage({cmd:"state"})}),1e3),this._workerstate={loaded:!1},this.initPromise=new Promise((e=>r(this,void 0,void 0,(function*(){for(var r;!this._workerstate.loaded;)yield new Promise((e=>setTimeout(e,100)));this.is_open=!0,null===(r=this._zustand)||void 0===r||r.auto_progress(),e()})))),this.initPromise.then((()=>{this.stepwise_fullsync()}))}send(e){return r(this,void 0,void 0,(function*(){yield this.initPromise,this.postMessage({cmd:"worker:send",msg:JSON.stringify(e),worker_id:this.uuid})}))}postMessage(e){this._port?this._port.postMessage(e):this._worker.postMessage(e)}registerMessageHook(e){return this._message_hooks.push(e),()=>{this._message_hooks=this._message_hooks.filter((r=>r!==e))}}onmessage(e){for(const r of this._message_hooks)r(e.data);if(e.data.result)e.data.result.state&&(this._workerstate=Object.assign(Object.assign({},this._workerstate),e.data.result.state));else if(e.data.cmd&&"receive"===e.data.cmd){if(void 0===e.data.worker_id)throw new Error("worker_id is undefined");e.data.worker_id===this.uuid&&this.receive(JSON.parse(e.data.msg))}}}exports.default=d;
2
2
  //# sourceMappingURL=index.umd.js.map