@code0-tech/pictor 0.0.0-mvp.28 → 0.0.0-mvp.29
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.
- package/dist/assets/components/d-flow-folder/DFlowFolder.style.css +1 -1
- package/dist/components/context-menu/ContextMenu.js +8 -8
- package/dist/components/d-flow/DFlow.d.ts +3 -1
- package/dist/components/d-flow/DFlow.edges.hook.d.ts +2 -2
- package/dist/components/d-flow/DFlow.edges.hook.js +10 -10
- package/dist/components/d-flow/DFlow.js +220 -218
- package/dist/components/d-flow/DFlow.nodes.hook.d.ts +2 -2
- package/dist/components/d-flow/DFlow.nodes.hook.js +66 -63
- package/dist/components/d-flow/DFlow.service.d.ts +7 -3
- package/dist/components/d-flow/DFlow.service.js +2 -2
- package/dist/components/d-flow-data-type/DFlowDataType.service.d.ts +11 -6
- package/dist/components/d-flow-data-type/DFlowDataType.service.js +34 -34
- package/dist/components/d-flow-file/DFlowTabs.d.ts +3 -1
- package/dist/components/d-flow-file/DFlowTabs.js +29 -24
- package/dist/components/d-flow-folder/DFlowFolder.d.ts +16 -8
- package/dist/components/d-flow-folder/DFlowFolder.js +144 -121
- package/dist/components/d-flow-folder/DFlowFolderContextMenu.d.ts +2 -2
- package/dist/components/d-flow-folder/DFlowFolderContextMenu.js +31 -62
- package/dist/components/d-flow-folder/DFlowFolderCreateDialog.d.ts +2 -2
- package/dist/components/d-flow-folder/DFlowFolderDeleteDialog.d.ts +10 -0
- package/dist/components/d-flow-folder/DFlowFolderDeleteDialog.js +55 -0
- package/dist/components/d-flow-folder/DFlowFolderRenameDialog.d.ts +3 -2
- package/dist/components/d-flow-folder/DFlowFolderRenameDialog.js +16 -16
- package/dist/components/d-flow-folder/index.d.ts +3 -0
- package/dist/components/d-flow-folder/index.js +10 -4
- package/dist/components/d-flow-function/DFlowFunction.service.d.ts +8 -3
- package/dist/components/d-flow-function/DFlowFunction.service.js +5 -5
- package/dist/components/d-flow-panel/DFlowPanelLayout.js +14 -14
- package/dist/components/d-flow-type/DFlowType.service.d.ts +8 -3
- package/dist/components/d-flow-type/DFlowType.service.js +5 -5
- package/dist/index.js +221 -215
- package/dist/node_modules/@radix-ui/react-context-menu/dist/index.js +8 -8
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +4 -4
- package/package.json +1 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as V, jsxs as U } from "react/jsx-runtime";
|
|
2
2
|
import { c as $ } from "../../_virtual/compiler-runtime.js";
|
|
3
3
|
import "../../utils/contextStore.js";
|
|
4
4
|
import K from "react";
|
|
@@ -19,86 +19,86 @@ import "../button/Button.js";
|
|
|
19
19
|
/* empty css */
|
|
20
20
|
import { DFlowPanelLayout as mt } from "../d-flow-panel/DFlowPanelLayout.js";
|
|
21
21
|
import { DFlowValidation as ft } from "../d-flow-validation/DFlowValidation.js";
|
|
22
|
-
const ut = (
|
|
23
|
-
if (!
|
|
22
|
+
const ut = (E, k) => {
|
|
23
|
+
if (!k || k.size === 0)
|
|
24
24
|
return {
|
|
25
|
-
nodes:
|
|
25
|
+
nodes: E
|
|
26
26
|
};
|
|
27
|
-
const
|
|
28
|
-
let
|
|
29
|
-
const f =
|
|
27
|
+
const m = 50, B = 50, b = 16, Y = 0.25;
|
|
28
|
+
let _ = 0, D = !1;
|
|
29
|
+
const f = E.map((o) => ({
|
|
30
30
|
...o
|
|
31
|
-
})),
|
|
31
|
+
})), z = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
|
|
32
32
|
for (const o of f) {
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
let
|
|
36
|
-
|
|
33
|
+
const n = o.data?.linkingId;
|
|
34
|
+
if (n) {
|
|
35
|
+
let s = H.get(n);
|
|
36
|
+
s || (s = [], H.set(n, s)), s.push(o.id);
|
|
37
37
|
}
|
|
38
|
-
if (o.parentId && !
|
|
39
|
-
let
|
|
40
|
-
|
|
38
|
+
if (o.parentId && !n) {
|
|
39
|
+
let s = z.get(o.parentId);
|
|
40
|
+
s || (s = [], z.set(o.parentId, s)), s.push(o.id);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
const
|
|
44
|
-
for (const [o,
|
|
45
|
-
const
|
|
46
|
-
for (let
|
|
47
|
-
|
|
43
|
+
const L = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new Map(), G = new Map(f.map((o) => [o.id, o]));
|
|
44
|
+
for (const [o, n] of z) {
|
|
45
|
+
const s = new Array(n.length);
|
|
46
|
+
for (let u = 0; u < n.length; u++) s[u] = G.get(n[u]);
|
|
47
|
+
L.set(o, s);
|
|
48
48
|
}
|
|
49
|
-
for (const [o,
|
|
50
|
-
const
|
|
51
|
-
for (let
|
|
52
|
-
|
|
49
|
+
for (const [o, n] of H) {
|
|
50
|
+
const s = new Array(n.length);
|
|
51
|
+
for (let u = 0; u < n.length; u++) s[u] = G.get(n[u]);
|
|
52
|
+
W.set(o, s);
|
|
53
53
|
}
|
|
54
|
-
const
|
|
54
|
+
const F = /* @__PURE__ */ new Map();
|
|
55
55
|
for (const o of f) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
w:
|
|
59
|
-
h:
|
|
56
|
+
const n = typeof o.style?.width == "number" ? o.style.width : void 0, s = typeof o.style?.height == "number" ? o.style.height : void 0, u = o.measured?.width && o.measured.width > 0 ? o.measured.width : void 0, T = o.measured?.height && o.measured.height > 0 ? o.measured.height : void 0;
|
|
57
|
+
F.set(o.id, {
|
|
58
|
+
w: n ?? u ?? 200,
|
|
59
|
+
h: s ?? T ?? 80
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
62
|
+
const C = /* @__PURE__ */ new Map(), l = (o) => {
|
|
63
|
+
if (C.has(o.id)) return C.get(o.id);
|
|
64
64
|
if (o.type !== "group") {
|
|
65
|
-
const
|
|
66
|
-
return
|
|
65
|
+
const M = F.get(o.id);
|
|
66
|
+
return C.set(o.id, M), M;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
71
|
-
w:
|
|
72
|
-
h:
|
|
68
|
+
const n = typeof o.style?.width == "number" ? o.style.width : void 0, s = typeof o.style?.height == "number" ? o.style.height : void 0;
|
|
69
|
+
if (n !== void 0 && s !== void 0) {
|
|
70
|
+
const M = {
|
|
71
|
+
w: n,
|
|
72
|
+
h: s
|
|
73
73
|
};
|
|
74
|
-
return
|
|
74
|
+
return C.set(o.id, M), M;
|
|
75
75
|
}
|
|
76
|
-
const
|
|
77
|
-
let
|
|
78
|
-
for (const
|
|
79
|
-
const
|
|
80
|
-
|
|
76
|
+
const u = L.get(o.id) ?? [];
|
|
77
|
+
let T = 0, x = 0, N = 0;
|
|
78
|
+
for (const M of u) {
|
|
79
|
+
const A = l(M);
|
|
80
|
+
T += A.h, A.w > x && (x = A.w), N++;
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
w:
|
|
85
|
-
h: (
|
|
82
|
+
T += m * Math.max(0, N - 1);
|
|
83
|
+
const v = {
|
|
84
|
+
w: x + 2 * b,
|
|
85
|
+
h: (N ? T : 0) + 2 * b
|
|
86
86
|
};
|
|
87
|
-
return
|
|
87
|
+
return C.set(o.id, v), v;
|
|
88
88
|
};
|
|
89
89
|
do {
|
|
90
|
-
D = !1,
|
|
91
|
-
for (const e of f)
|
|
92
|
-
const o = /* @__PURE__ */ new Map(),
|
|
93
|
-
const
|
|
90
|
+
D = !1, _++, C.clear();
|
|
91
|
+
for (const e of f) l(e);
|
|
92
|
+
const o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), s = (e) => Math.round(e / 10), u = (e, p, g) => {
|
|
93
|
+
const h = [{
|
|
94
94
|
node: e,
|
|
95
|
-
cx:
|
|
96
|
-
cy:
|
|
95
|
+
cx: p,
|
|
96
|
+
cy: g,
|
|
97
97
|
phase: 0
|
|
98
98
|
}];
|
|
99
99
|
let y = 0;
|
|
100
|
-
for (;
|
|
101
|
-
const t =
|
|
100
|
+
for (; h.length; ) {
|
|
101
|
+
const t = h[h.length - 1];
|
|
102
102
|
switch (t.phase) {
|
|
103
103
|
case 0: {
|
|
104
104
|
o.set(t.node.id, {
|
|
@@ -106,28 +106,28 @@ const ut = (F, N) => {
|
|
|
106
106
|
y: t.cy
|
|
107
107
|
});
|
|
108
108
|
const {
|
|
109
|
-
w:
|
|
110
|
-
h:
|
|
111
|
-
} =
|
|
112
|
-
t.w =
|
|
113
|
-
const
|
|
114
|
-
for (const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
let
|
|
118
|
-
for (const
|
|
119
|
-
|
|
109
|
+
w: i,
|
|
110
|
+
h: r
|
|
111
|
+
} = l(t.node);
|
|
112
|
+
t.w = i, t.h = r;
|
|
113
|
+
const a = W.get(t.node.id) ?? [], d = [], w = [];
|
|
114
|
+
for (const I of a)
|
|
115
|
+
I.type === "group" ? w.push(I) : d.push(I);
|
|
116
|
+
d.sort((I, c) => +I.data?.paramIndex - +c.data?.paramIndex), w.sort((I, c) => +I.data?.paramIndex - +c.data?.paramIndex), t.right = d, t.gParams = w;
|
|
117
|
+
let P = 0;
|
|
118
|
+
for (const I of d) P += l(I).h;
|
|
119
|
+
P += m * Math.max(0, d.length - 1), t.py = t.cy - P / 2, t.rightBottom = t.cy + r / 2, t.rightIndex = 0, t.phase = 1;
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
122
|
case 1: {
|
|
123
123
|
if (t.rightIndex < t.right.length) {
|
|
124
|
-
const
|
|
125
|
-
let
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
node:
|
|
129
|
-
cx:
|
|
130
|
-
cy:
|
|
124
|
+
const i = t.right[t.rightIndex], r = l(i), a = t.cx + t.w / 2 + B + r.w / 2;
|
|
125
|
+
let d = t.py + r.h / 2;
|
|
126
|
+
const w = s(a), I = (n.get(w) ?? Number.NEGATIVE_INFINITY) + m;
|
|
127
|
+
d - r.h / 2 < I && (d = I + r.h / 2, t.py = d - r.h / 2), t.childKey = w, t.childPs = r, h.push({
|
|
128
|
+
node: i,
|
|
129
|
+
cx: a,
|
|
130
|
+
cy: d,
|
|
131
131
|
phase: 0
|
|
132
132
|
}), t.phase = 10;
|
|
133
133
|
} else
|
|
@@ -135,254 +135,256 @@ const ut = (F, N) => {
|
|
|
135
135
|
break;
|
|
136
136
|
}
|
|
137
137
|
case 10: {
|
|
138
|
-
const
|
|
139
|
-
|
|
138
|
+
const i = t.lastChildBottom;
|
|
139
|
+
n.set(t.childKey, Math.max(n.get(t.childKey) ?? Number.NEGATIVE_INFINITY, i)), t.rightBottom = Math.max(t.rightBottom, i), t.py = Math.max(t.py + t.childPs.h + m, i + m), t.rightIndex++, t.phase = 1;
|
|
140
140
|
break;
|
|
141
141
|
}
|
|
142
142
|
case 2: {
|
|
143
143
|
if (t.gParams && t.gParams.length) {
|
|
144
|
-
const
|
|
145
|
-
let
|
|
146
|
-
for (const
|
|
147
|
-
const
|
|
148
|
-
|
|
144
|
+
const i = [];
|
|
145
|
+
let r = 0;
|
|
146
|
+
for (const a of t.gParams) {
|
|
147
|
+
const d = l(a);
|
|
148
|
+
i.push(d), r += d.w;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
r += B * (t.gParams.length - 1), t.gSizes = i, t.gx = t.cx - r / 2, t.gy = t.bottom + m, t.rowBottom = t.bottom, t.gIndex = 0, t.phase = 3;
|
|
151
151
|
} else
|
|
152
152
|
t.phase = 4;
|
|
153
153
|
break;
|
|
154
154
|
}
|
|
155
155
|
case 3: {
|
|
156
156
|
if (t.gIndex < t.gParams.length) {
|
|
157
|
-
const
|
|
158
|
-
t.gx +=
|
|
159
|
-
node:
|
|
160
|
-
cx:
|
|
161
|
-
cy:
|
|
157
|
+
const i = t.gParams[t.gIndex], r = t.gSizes[t.gIndex], a = t.gx + r.w / 2, d = t.gy + r.h / 2;
|
|
158
|
+
t.gx += r.w + B, h.push({
|
|
159
|
+
node: i,
|
|
160
|
+
cx: a,
|
|
161
|
+
cy: d,
|
|
162
162
|
phase: 0
|
|
163
|
-
}), t.childPs =
|
|
163
|
+
}), t.childPs = r, t.phase = 30;
|
|
164
164
|
} else
|
|
165
165
|
t.bottom = t.rowBottom, t.phase = 4;
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
case 30: {
|
|
169
|
-
const
|
|
170
|
-
t.rowBottom = Math.max(t.rowBottom,
|
|
169
|
+
const i = t.lastChildBottom;
|
|
170
|
+
t.rowBottom = Math.max(t.rowBottom, i), t.gIndex++, t.phase = 3;
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
case 4: {
|
|
174
174
|
if (t.node.type === "group") {
|
|
175
|
-
const
|
|
176
|
-
for (const
|
|
177
|
-
|
|
178
|
-
t.kids =
|
|
175
|
+
const i = L.get(t.node.id) ?? [], r = [];
|
|
176
|
+
for (const a of i)
|
|
177
|
+
a.data?.linkingId || r.push(a);
|
|
178
|
+
t.kids = r, t.kidIndex = 0, t.curY = t.cy - t.h / 2 + b, t.phase = 5;
|
|
179
179
|
} else
|
|
180
180
|
t.phase = 6;
|
|
181
181
|
break;
|
|
182
182
|
}
|
|
183
183
|
case 5: {
|
|
184
184
|
if (t.kidIndex < t.kids.length) {
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
node:
|
|
185
|
+
const i = t.kids[t.kidIndex], r = l(i), a = t.curY + r.h / 2;
|
|
186
|
+
h.push({
|
|
187
|
+
node: i,
|
|
188
188
|
cx: t.cx,
|
|
189
|
-
cy:
|
|
189
|
+
cy: a,
|
|
190
190
|
phase: 0
|
|
191
|
-
}), t.childPs =
|
|
191
|
+
}), t.childPs = r, t.phase = 50;
|
|
192
192
|
} else {
|
|
193
|
-
const
|
|
194
|
-
t.bottom = Math.max(t.bottom,
|
|
193
|
+
const i = t.curY - m;
|
|
194
|
+
t.bottom = Math.max(t.bottom, i + b), t.phase = 6;
|
|
195
195
|
}
|
|
196
196
|
break;
|
|
197
197
|
}
|
|
198
198
|
case 50: {
|
|
199
|
-
const
|
|
200
|
-
t.curY =
|
|
199
|
+
const i = t.lastChildBottom;
|
|
200
|
+
t.curY = i + m, t.kidIndex++, t.phase = 5;
|
|
201
201
|
break;
|
|
202
202
|
}
|
|
203
203
|
case 6: {
|
|
204
|
-
const
|
|
205
|
-
|
|
204
|
+
const i = h.pop();
|
|
205
|
+
h.length ? h[h.length - 1].lastChildBottom = i.bottom : y = i.bottom;
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
return y;
|
|
211
211
|
};
|
|
212
|
-
let
|
|
212
|
+
let T = 0;
|
|
213
213
|
for (const e of f)
|
|
214
|
-
!e.data?.linkingId && !e.parentId && (
|
|
215
|
-
const
|
|
216
|
-
for (const e of f)
|
|
217
|
-
const
|
|
214
|
+
!e.data?.linkingId && !e.parentId && (T = u(e, 0, T + l(e).h / 2) + m);
|
|
215
|
+
const x = /* @__PURE__ */ new Map();
|
|
216
|
+
for (const e of f) x.set(e.id, o.get(e.id));
|
|
217
|
+
const N = /* @__PURE__ */ new Map();
|
|
218
218
|
for (const e of f) {
|
|
219
219
|
const {
|
|
220
|
-
w:
|
|
221
|
-
h:
|
|
222
|
-
} =
|
|
223
|
-
x:
|
|
220
|
+
w: p,
|
|
221
|
+
h: g
|
|
222
|
+
} = l(e), {
|
|
223
|
+
x: h,
|
|
224
224
|
y
|
|
225
|
-
} =
|
|
226
|
-
|
|
227
|
-
x:
|
|
228
|
-
y: y -
|
|
225
|
+
} = x.get(e.id);
|
|
226
|
+
N.set(e.id, {
|
|
227
|
+
x: h - p / 2,
|
|
228
|
+
y: y - g / 2
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
for (const e of f) {
|
|
232
|
-
const
|
|
233
|
-
let
|
|
232
|
+
const p = N.get(e.id);
|
|
233
|
+
let g = p.x, h = p.y;
|
|
234
234
|
if (e.parentId) {
|
|
235
|
-
const y =
|
|
236
|
-
|
|
235
|
+
const y = N.get(e.parentId);
|
|
236
|
+
g -= y.x, h -= y.y;
|
|
237
237
|
}
|
|
238
238
|
e.position = {
|
|
239
|
-
x:
|
|
240
|
-
y:
|
|
239
|
+
x: g,
|
|
240
|
+
y: h
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
|
-
const
|
|
244
|
-
for (const e of f)
|
|
245
|
-
const
|
|
246
|
-
let
|
|
247
|
-
for (;
|
|
243
|
+
const v = /* @__PURE__ */ new Map();
|
|
244
|
+
for (const e of f) v.set(e.id, e);
|
|
245
|
+
const M = (e) => {
|
|
246
|
+
let p = 0, g = e;
|
|
247
|
+
for (; g?.parentId && (p++, g = v.get(g.parentId), !!g); )
|
|
248
248
|
;
|
|
249
|
-
return
|
|
250
|
-
},
|
|
249
|
+
return p;
|
|
250
|
+
}, A = [];
|
|
251
251
|
for (const e of f)
|
|
252
|
-
e.type === "group" &&
|
|
253
|
-
|
|
254
|
-
for (const e of
|
|
255
|
-
const
|
|
256
|
-
for (const
|
|
257
|
-
|
|
258
|
-
if (!
|
|
259
|
-
const
|
|
252
|
+
e.type === "group" && A.push(e);
|
|
253
|
+
A.sort((e, p) => M(p) - M(e));
|
|
254
|
+
for (const e of A) {
|
|
255
|
+
const p = [];
|
|
256
|
+
for (const c of f)
|
|
257
|
+
c.parentId === e.id && p.push(c);
|
|
258
|
+
if (!p.length) {
|
|
259
|
+
const c = typeof e.style?.width == "number" ? e.style.width : 2 * b, S = typeof e.style?.height == "number" ? e.style.height : 2 * b;
|
|
260
260
|
e.style = {
|
|
261
261
|
...e.style,
|
|
262
|
-
width:
|
|
263
|
-
height:
|
|
262
|
+
width: c,
|
|
263
|
+
height: S
|
|
264
264
|
};
|
|
265
265
|
continue;
|
|
266
266
|
}
|
|
267
|
-
const
|
|
268
|
-
const
|
|
267
|
+
const g = (c) => {
|
|
268
|
+
const S = typeof c.style?.width == "number" ? c.style.width : void 0, q = typeof c.style?.height == "number" ? c.style.height : void 0, X = F.get(c.id);
|
|
269
269
|
return {
|
|
270
|
-
w:
|
|
270
|
+
w: S ?? X.w,
|
|
271
271
|
h: q ?? X.h
|
|
272
272
|
};
|
|
273
273
|
};
|
|
274
|
-
let
|
|
275
|
-
for (const
|
|
276
|
-
const
|
|
277
|
-
|
|
274
|
+
let h = Number.POSITIVE_INFINITY, y = Number.POSITIVE_INFINITY, t = Number.NEGATIVE_INFINITY, i = Number.NEGATIVE_INFINITY;
|
|
275
|
+
for (const c of p) {
|
|
276
|
+
const S = g(c);
|
|
277
|
+
c.position.x < h && (h = c.position.x), c.position.y < y && (y = c.position.y), c.position.x + S.w > t && (t = c.position.x + S.w), c.position.y + S.h > i && (i = c.position.y + S.h);
|
|
278
278
|
}
|
|
279
|
-
const
|
|
280
|
-
if (Math.abs(
|
|
281
|
-
for (const
|
|
282
|
-
|
|
279
|
+
const r = h - b, a = y - b;
|
|
280
|
+
if (Math.abs(r) > Y || Math.abs(a) > Y) {
|
|
281
|
+
for (const c of p)
|
|
282
|
+
c.position.x -= r, c.position.y -= a;
|
|
283
283
|
D = !0;
|
|
284
284
|
}
|
|
285
|
-
const
|
|
286
|
-
(Math.abs(
|
|
287
|
-
width:
|
|
288
|
-
height:
|
|
285
|
+
const d = t - h + 2 * b, w = i - y + 2 * b, P = typeof e.style?.width == "number" ? e.style.width : l(e).w, I = typeof e.style?.height == "number" ? e.style.height : l(e).h;
|
|
286
|
+
(Math.abs(d - P) > Y || Math.abs(w - I) > Y) && (D = !0), e.measured = {
|
|
287
|
+
width: d,
|
|
288
|
+
height: w
|
|
289
289
|
}, e.style = {
|
|
290
290
|
...e.style,
|
|
291
|
-
width:
|
|
292
|
-
height:
|
|
293
|
-
},
|
|
294
|
-
w:
|
|
295
|
-
h:
|
|
291
|
+
width: d,
|
|
292
|
+
height: w
|
|
293
|
+
}, F.set(e.id, {
|
|
294
|
+
w: d,
|
|
295
|
+
h: w
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
|
-
|
|
299
|
-
for (const e of f)
|
|
298
|
+
C.clear();
|
|
299
|
+
for (const e of f) l(e);
|
|
300
300
|
const R = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map();
|
|
301
301
|
for (const e of f) {
|
|
302
|
-
const
|
|
303
|
-
O.set(e.id,
|
|
304
|
-
x:
|
|
305
|
-
y:
|
|
302
|
+
const p = l(e), g = o.get(e.id);
|
|
303
|
+
O.set(e.id, g), R.set(e.id, {
|
|
304
|
+
x: g.x - p.w / 2,
|
|
305
|
+
y: g.y - p.h / 2
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
308
|
for (const e of f) {
|
|
309
|
-
const
|
|
310
|
-
for (const
|
|
311
|
-
|
|
312
|
-
if (!
|
|
313
|
-
const
|
|
314
|
-
for (const
|
|
315
|
-
const
|
|
316
|
-
y.push(
|
|
309
|
+
const p = [], g = W.get(e.id) ?? [];
|
|
310
|
+
for (const a of g)
|
|
311
|
+
a.type === "group" && p.push(a);
|
|
312
|
+
if (!p.length) continue;
|
|
313
|
+
const h = p.slice().sort((a, d) => (+a.data?.paramIndex || 0) - (+d.data?.paramIndex || 0)), y = [];
|
|
314
|
+
for (const a of h) {
|
|
315
|
+
const d = v.get(a.id), w = typeof d.style?.width == "number" ? d.style.width : void 0;
|
|
316
|
+
y.push(w ?? l(d).w);
|
|
317
317
|
}
|
|
318
318
|
let t = 0;
|
|
319
|
-
for (const
|
|
320
|
-
t +=
|
|
321
|
-
let
|
|
322
|
-
for (let
|
|
323
|
-
const
|
|
319
|
+
for (const a of y) t += a;
|
|
320
|
+
t += B * (h.length - 1);
|
|
321
|
+
let r = O.get(e.id).x - t / 2;
|
|
322
|
+
for (let a = 0; a < h.length; a++) {
|
|
323
|
+
const d = h[a], w = v.get(d.id), P = w.parentId ? R.get(w.parentId) : {
|
|
324
324
|
x: 0
|
|
325
325
|
};
|
|
326
|
-
|
|
326
|
+
w.position.x = r - P.x, r += y[a] + B;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
} while (D &&
|
|
329
|
+
} while (D && _ < 5);
|
|
330
330
|
return {
|
|
331
331
|
nodes: f
|
|
332
332
|
};
|
|
333
|
-
}, j = K.cache(ut), Ht = (
|
|
334
|
-
const
|
|
335
|
-
let
|
|
336
|
-
return
|
|
337
|
-
}, wt = (
|
|
333
|
+
}, j = K.cache(ut), Ht = (E) => {
|
|
334
|
+
const k = $.c(2);
|
|
335
|
+
let m;
|
|
336
|
+
return k[0] !== E ? (m = /* @__PURE__ */ V(Q, { children: /* @__PURE__ */ V(wt, { ...E }) }), k[0] = E, k[1] = m) : m = k[1], m;
|
|
337
|
+
}, wt = (E) => {
|
|
338
338
|
const {
|
|
339
|
-
flowId:
|
|
340
|
-
|
|
339
|
+
flowId: k,
|
|
340
|
+
namespaceId: m,
|
|
341
|
+
projectId: B
|
|
342
|
+
} = E, b = {
|
|
341
343
|
default: it,
|
|
342
344
|
group: rt,
|
|
343
345
|
suggestion: at,
|
|
344
346
|
trigger: dt
|
|
345
|
-
},
|
|
347
|
+
}, Y = {
|
|
346
348
|
default: ct
|
|
347
|
-
},
|
|
349
|
+
}, _ = gt(k, m, B), D = pt(k, m, B), [f, z] = Z([]), [H, L, W] = tt([]), G = et(), F = K.useCallback((l) => {
|
|
348
350
|
requestAnimationFrame(() => {
|
|
349
|
-
|
|
351
|
+
l.forEach((o) => G(o));
|
|
350
352
|
});
|
|
351
|
-
}, [
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
const
|
|
355
|
-
if (!
|
|
356
|
-
const
|
|
353
|
+
}, [G]), C = K.useCallback((l) => {
|
|
354
|
+
const o = Array.from(new Set(l.filter((s) => s.type === "dimensions" || s.type === "position").map((s) => s.id))), n = /* @__PURE__ */ new Map();
|
|
355
|
+
l.filter((s) => s.type === "dimensions").forEach((s) => n.set(s.id, s.dimensions)), z((s) => {
|
|
356
|
+
const u = s.map((x) => {
|
|
357
|
+
if (!n.has(x.id)) return x;
|
|
358
|
+
const N = n.get(x.id) || {};
|
|
357
359
|
return {
|
|
358
|
-
...
|
|
360
|
+
...x,
|
|
359
361
|
measured: {
|
|
360
|
-
width:
|
|
361
|
-
height:
|
|
362
|
+
width: N.width ?? x.measured?.width ?? 0,
|
|
363
|
+
height: N.height ?? x.measured?.height ?? 0
|
|
362
364
|
}
|
|
363
365
|
};
|
|
364
366
|
});
|
|
365
|
-
return j(
|
|
366
|
-
}),
|
|
367
|
-
}, [
|
|
367
|
+
return j(u, new Set(o)).nodes;
|
|
368
|
+
}), F(o);
|
|
369
|
+
}, [F]);
|
|
368
370
|
return K.useEffect(() => {
|
|
369
|
-
const
|
|
370
|
-
const
|
|
371
|
+
const l = _.map((n) => {
|
|
372
|
+
const s = n.measured ? [] : document.querySelectorAll("[data-id='" + n.id + "']");
|
|
371
373
|
return {
|
|
372
|
-
...
|
|
374
|
+
...n,
|
|
373
375
|
measured: {
|
|
374
|
-
width:
|
|
375
|
-
height:
|
|
376
|
+
width: n.measured?.width ?? s[0]?.clientWidth ?? 0,
|
|
377
|
+
height: n.measured?.height ?? s[0]?.clientHeight ?? 0
|
|
376
378
|
}
|
|
377
379
|
};
|
|
378
|
-
}),
|
|
379
|
-
|
|
380
|
-
}, [
|
|
381
|
-
/* @__PURE__ */
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
380
|
+
}), o = j(l, new Set(l.map((n) => n.id)));
|
|
381
|
+
z(o.nodes), L(D), F(o.nodes.map((n) => n.id));
|
|
382
|
+
}, [_, D, F]), /* @__PURE__ */ U(ot, { onlyRenderVisibleElements: !0, panOnScroll: !1, nodeTypes: b, edgeTypes: Y, onInit: (l) => l.fitView(), onNodesChange: C, onEdgesChange: W, fitView: !0, ...J("flow", E), nodes: f, edges: H, children: [
|
|
383
|
+
/* @__PURE__ */ V(st, { variant: nt.Dots, color: "rgba(255,255,255, .05)", gap: 8, size: 2 }),
|
|
384
|
+
/* @__PURE__ */ V(ht, {}),
|
|
385
|
+
/* @__PURE__ */ V(mt, {}),
|
|
386
|
+
/* @__PURE__ */ V(ft, { flowId: "gid://sagittarius/Flow/1" }),
|
|
387
|
+
/* @__PURE__ */ V(lt, { flowId: k })
|
|
386
388
|
] });
|
|
387
389
|
};
|
|
388
390
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Node } from '@xyflow/react';
|
|
2
|
-
import { Flow } from '@code0-tech/sagittarius-graphql-types';
|
|
2
|
+
import { Flow, Namespace, NamespaceProject } from '@code0-tech/sagittarius-graphql-types';
|
|
3
3
|
import { DFlowFunctionDefaultCardDataProps } from '../d-flow-function/DFlowFunctionDefaultCard';
|
|
4
4
|
import { DFlowFunctionSuggestionCardDataProps } from '../d-flow-function/DFlowFunctionSuggestionCard';
|
|
5
5
|
import { DFlowFunctionTriggerCardDataProps } from '../d-flow-function/DFlowFunctionTriggerCard';
|
|
6
6
|
import { DFlowFunctionGroupCardDataProps } from '../d-flow-function/DFlowFunctionGroupCard';
|
|
7
|
-
export declare const useFlowNodes: (flowId: Flow["id"]) => Node<DFlowFunctionDefaultCardDataProps | DFlowFunctionSuggestionCardDataProps | DFlowFunctionTriggerCardDataProps | DFlowFunctionGroupCardDataProps>[];
|
|
7
|
+
export declare const useFlowNodes: (flowId: Flow["id"], namespaceId?: Namespace["id"], projectId?: NamespaceProject["id"]) => Node<DFlowFunctionDefaultCardDataProps | DFlowFunctionSuggestionCardDataProps | DFlowFunctionTriggerCardDataProps | DFlowFunctionGroupCardDataProps>[];
|