@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.
Files changed (34) hide show
  1. package/dist/assets/components/d-flow-folder/DFlowFolder.style.css +1 -1
  2. package/dist/components/context-menu/ContextMenu.js +8 -8
  3. package/dist/components/d-flow/DFlow.d.ts +3 -1
  4. package/dist/components/d-flow/DFlow.edges.hook.d.ts +2 -2
  5. package/dist/components/d-flow/DFlow.edges.hook.js +10 -10
  6. package/dist/components/d-flow/DFlow.js +220 -218
  7. package/dist/components/d-flow/DFlow.nodes.hook.d.ts +2 -2
  8. package/dist/components/d-flow/DFlow.nodes.hook.js +66 -63
  9. package/dist/components/d-flow/DFlow.service.d.ts +7 -3
  10. package/dist/components/d-flow/DFlow.service.js +2 -2
  11. package/dist/components/d-flow-data-type/DFlowDataType.service.d.ts +11 -6
  12. package/dist/components/d-flow-data-type/DFlowDataType.service.js +34 -34
  13. package/dist/components/d-flow-file/DFlowTabs.d.ts +3 -1
  14. package/dist/components/d-flow-file/DFlowTabs.js +29 -24
  15. package/dist/components/d-flow-folder/DFlowFolder.d.ts +16 -8
  16. package/dist/components/d-flow-folder/DFlowFolder.js +144 -121
  17. package/dist/components/d-flow-folder/DFlowFolderContextMenu.d.ts +2 -2
  18. package/dist/components/d-flow-folder/DFlowFolderContextMenu.js +31 -62
  19. package/dist/components/d-flow-folder/DFlowFolderCreateDialog.d.ts +2 -2
  20. package/dist/components/d-flow-folder/DFlowFolderDeleteDialog.d.ts +10 -0
  21. package/dist/components/d-flow-folder/DFlowFolderDeleteDialog.js +55 -0
  22. package/dist/components/d-flow-folder/DFlowFolderRenameDialog.d.ts +3 -2
  23. package/dist/components/d-flow-folder/DFlowFolderRenameDialog.js +16 -16
  24. package/dist/components/d-flow-folder/index.d.ts +3 -0
  25. package/dist/components/d-flow-folder/index.js +10 -4
  26. package/dist/components/d-flow-function/DFlowFunction.service.d.ts +8 -3
  27. package/dist/components/d-flow-function/DFlowFunction.service.js +5 -5
  28. package/dist/components/d-flow-panel/DFlowPanelLayout.js +14 -14
  29. package/dist/components/d-flow-type/DFlowType.service.d.ts +8 -3
  30. package/dist/components/d-flow-type/DFlowType.service.js +5 -5
  31. package/dist/index.js +221 -215
  32. package/dist/node_modules/@radix-ui/react-context-menu/dist/index.js +8 -8
  33. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +4 -4
  34. package/package.json +1 -2
@@ -1,4 +1,4 @@
1
- import { jsx as Y, jsxs as U } from "react/jsx-runtime";
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 = (F, N) => {
23
- if (!N || N.size === 0)
22
+ const ut = (E, k) => {
23
+ if (!k || k.size === 0)
24
24
  return {
25
- nodes: F
25
+ nodes: E
26
26
  };
27
- const w = 50, P = 50, k = 16, S = 0.25;
28
- let W = 0, D = !1;
29
- const f = F.map((o) => ({
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
- })), H = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map();
31
+ })), z = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
32
32
  for (const o of f) {
33
- const l = o.data?.linkingId;
34
- if (l) {
35
- let p = L.get(l);
36
- p || (p = [], L.set(l, p)), p.push(o.id);
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 && !l) {
39
- let p = H.get(o.parentId);
40
- p || (p = [], H.set(o.parentId, p)), p.push(o.id);
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 z = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), G = new Map(f.map((o) => [o.id, o]));
44
- for (const [o, l] of H) {
45
- const p = new Array(l.length);
46
- for (let g = 0; g < l.length; g++) p[g] = G.get(l[g]);
47
- z.set(o, p);
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, l] of L) {
50
- const p = new Array(l.length);
51
- for (let g = 0; g < l.length; g++) p[g] = G.get(l[g]);
52
- C.set(o, p);
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 x = /* @__PURE__ */ new Map();
54
+ const F = /* @__PURE__ */ new Map();
55
55
  for (const o of f) {
56
- const l = typeof o.style?.width == "number" ? o.style.width : void 0, p = typeof o.style?.height == "number" ? o.style.height : void 0, g = o.measured?.width && o.measured.width > 0 ? o.measured.width : void 0, M = o.measured?.height && o.measured.height > 0 ? o.measured.height : void 0;
57
- x.set(o.id, {
58
- w: l ?? g ?? 200,
59
- h: p ?? M ?? 80
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 I = /* @__PURE__ */ new Map(), r = (o) => {
63
- if (I.has(o.id)) return I.get(o.id);
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 E = x.get(o.id);
66
- return I.set(o.id, E), E;
65
+ const M = F.get(o.id);
66
+ return C.set(o.id, M), M;
67
67
  }
68
- const l = typeof o.style?.width == "number" ? o.style.width : void 0, p = typeof o.style?.height == "number" ? o.style.height : void 0;
69
- if (l !== void 0 && p !== void 0) {
70
- const E = {
71
- w: l,
72
- h: p
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 I.set(o.id, E), E;
74
+ return C.set(o.id, M), M;
75
75
  }
76
- const g = z.get(o.id) ?? [];
77
- let M = 0, _ = 0, v = 0;
78
- for (const E of g) {
79
- const V = r(E);
80
- M += V.h, V.w > _ && (_ = V.w), v++;
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
- M += w * Math.max(0, v - 1);
83
- const A = {
84
- w: _ + 2 * k,
85
- h: (v ? M : 0) + 2 * k
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 I.set(o.id, A), A;
87
+ return C.set(o.id, v), v;
88
88
  };
89
89
  do {
90
- D = !1, W++, I.clear();
91
- for (const e of f) r(e);
92
- const o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), p = (e) => Math.round(e / 10), g = (e, h, m) => {
93
- const c = [{
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: h,
96
- cy: m,
95
+ cx: p,
96
+ cy: g,
97
97
  phase: 0
98
98
  }];
99
99
  let y = 0;
100
- for (; c.length; ) {
101
- const t = c[c.length - 1];
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: s,
110
- h: n
111
- } = r(t.node);
112
- t.w = s, t.h = n;
113
- const i = C.get(t.node.id) ?? [], a = [], u = [];
114
- for (const b of i)
115
- b.type === "group" ? u.push(b) : a.push(b);
116
- a.sort((b, d) => +b.data?.paramIndex - +d.data?.paramIndex), u.sort((b, d) => +b.data?.paramIndex - +d.data?.paramIndex), t.right = a, t.gParams = u;
117
- let T = 0;
118
- for (const b of a) T += r(b).h;
119
- T += w * Math.max(0, a.length - 1), t.py = t.cy - T / 2, t.rightBottom = t.cy + n / 2, t.rightIndex = 0, t.phase = 1;
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 s = t.right[t.rightIndex], n = r(s), i = t.cx + t.w / 2 + P + n.w / 2;
125
- let a = t.py + n.h / 2;
126
- const u = p(i), b = (l.get(u) ?? Number.NEGATIVE_INFINITY) + w;
127
- a - n.h / 2 < b && (a = b + n.h / 2, t.py = a - n.h / 2), t.childKey = u, t.childPs = n, c.push({
128
- node: s,
129
- cx: i,
130
- cy: a,
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 s = t.lastChildBottom;
139
- l.set(t.childKey, Math.max(l.get(t.childKey) ?? Number.NEGATIVE_INFINITY, s)), t.rightBottom = Math.max(t.rightBottom, s), t.py = Math.max(t.py + t.childPs.h + w, s + w), t.rightIndex++, t.phase = 1;
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 s = [];
145
- let n = 0;
146
- for (const i of t.gParams) {
147
- const a = r(i);
148
- s.push(a), n += a.w;
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
- n += P * (t.gParams.length - 1), t.gSizes = s, t.gx = t.cx - n / 2, t.gy = t.bottom + w, t.rowBottom = t.bottom, t.gIndex = 0, t.phase = 3;
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 s = t.gParams[t.gIndex], n = t.gSizes[t.gIndex], i = t.gx + n.w / 2, a = t.gy + n.h / 2;
158
- t.gx += n.w + P, c.push({
159
- node: s,
160
- cx: i,
161
- cy: a,
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 = n, t.phase = 30;
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 s = t.lastChildBottom;
170
- t.rowBottom = Math.max(t.rowBottom, s), t.gIndex++, t.phase = 3;
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 s = z.get(t.node.id) ?? [], n = [];
176
- for (const i of s)
177
- i.data?.linkingId || n.push(i);
178
- t.kids = n, t.kidIndex = 0, t.curY = t.cy - t.h / 2 + k, t.phase = 5;
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 s = t.kids[t.kidIndex], n = r(s), i = t.curY + n.h / 2;
186
- c.push({
187
- node: s,
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: i,
189
+ cy: a,
190
190
  phase: 0
191
- }), t.childPs = n, t.phase = 50;
191
+ }), t.childPs = r, t.phase = 50;
192
192
  } else {
193
- const s = t.curY - w;
194
- t.bottom = Math.max(t.bottom, s + k), t.phase = 6;
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 s = t.lastChildBottom;
200
- t.curY = s + w, t.kidIndex++, t.phase = 5;
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 s = c.pop();
205
- c.length ? c[c.length - 1].lastChildBottom = s.bottom : y = s.bottom;
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 M = 0;
212
+ let T = 0;
213
213
  for (const e of f)
214
- !e.data?.linkingId && !e.parentId && (M = g(e, 0, M + r(e).h / 2) + w);
215
- const _ = /* @__PURE__ */ new Map();
216
- for (const e of f) _.set(e.id, o.get(e.id));
217
- const v = /* @__PURE__ */ new Map();
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: h,
221
- h: m
222
- } = r(e), {
223
- x: c,
220
+ w: p,
221
+ h: g
222
+ } = l(e), {
223
+ x: h,
224
224
  y
225
- } = _.get(e.id);
226
- v.set(e.id, {
227
- x: c - h / 2,
228
- y: y - m / 2
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 h = v.get(e.id);
233
- let m = h.x, c = h.y;
232
+ const p = N.get(e.id);
233
+ let g = p.x, h = p.y;
234
234
  if (e.parentId) {
235
- const y = v.get(e.parentId);
236
- m -= y.x, c -= y.y;
235
+ const y = N.get(e.parentId);
236
+ g -= y.x, h -= y.y;
237
237
  }
238
238
  e.position = {
239
- x: m,
240
- y: c
239
+ x: g,
240
+ y: h
241
241
  };
242
242
  }
243
- const A = /* @__PURE__ */ new Map();
244
- for (const e of f) A.set(e.id, e);
245
- const E = (e) => {
246
- let h = 0, m = e;
247
- for (; m?.parentId && (h++, m = A.get(m.parentId), !!m); )
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 h;
250
- }, V = [];
249
+ return p;
250
+ }, A = [];
251
251
  for (const e of f)
252
- e.type === "group" && V.push(e);
253
- V.sort((e, h) => E(h) - E(e));
254
- for (const e of V) {
255
- const h = [];
256
- for (const d of f)
257
- d.parentId === e.id && h.push(d);
258
- if (!h.length) {
259
- const d = typeof e.style?.width == "number" ? e.style.width : 2 * k, B = typeof e.style?.height == "number" ? e.style.height : 2 * k;
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: d,
263
- height: B
262
+ width: c,
263
+ height: S
264
264
  };
265
265
  continue;
266
266
  }
267
- const m = (d) => {
268
- const B = typeof d.style?.width == "number" ? d.style.width : void 0, q = typeof d.style?.height == "number" ? d.style.height : void 0, X = x.get(d.id);
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: B ?? X.w,
270
+ w: S ?? X.w,
271
271
  h: q ?? X.h
272
272
  };
273
273
  };
274
- let c = Number.POSITIVE_INFINITY, y = Number.POSITIVE_INFINITY, t = Number.NEGATIVE_INFINITY, s = Number.NEGATIVE_INFINITY;
275
- for (const d of h) {
276
- const B = m(d);
277
- d.position.x < c && (c = d.position.x), d.position.y < y && (y = d.position.y), d.position.x + B.w > t && (t = d.position.x + B.w), d.position.y + B.h > s && (s = d.position.y + B.h);
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 n = c - k, i = y - k;
280
- if (Math.abs(n) > S || Math.abs(i) > S) {
281
- for (const d of h)
282
- d.position.x -= n, d.position.y -= i;
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 a = t - c + 2 * k, u = s - y + 2 * k, T = typeof e.style?.width == "number" ? e.style.width : r(e).w, b = typeof e.style?.height == "number" ? e.style.height : r(e).h;
286
- (Math.abs(a - T) > S || Math.abs(u - b) > S) && (D = !0), e.measured = {
287
- width: a,
288
- height: u
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: a,
292
- height: u
293
- }, x.set(e.id, {
294
- w: a,
295
- h: u
291
+ width: d,
292
+ height: w
293
+ }, F.set(e.id, {
294
+ w: d,
295
+ h: w
296
296
  });
297
297
  }
298
- I.clear();
299
- for (const e of f) r(e);
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 h = r(e), m = o.get(e.id);
303
- O.set(e.id, m), R.set(e.id, {
304
- x: m.x - h.w / 2,
305
- y: m.y - h.h / 2
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 h = [], m = C.get(e.id) ?? [];
310
- for (const i of m)
311
- i.type === "group" && h.push(i);
312
- if (!h.length) continue;
313
- const c = h.slice().sort((i, a) => (+i.data?.paramIndex || 0) - (+a.data?.paramIndex || 0)), y = [];
314
- for (const i of c) {
315
- const a = A.get(i.id), u = typeof a.style?.width == "number" ? a.style.width : void 0;
316
- y.push(u ?? r(a).w);
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 i of y) t += i;
320
- t += P * (c.length - 1);
321
- let n = O.get(e.id).x - t / 2;
322
- for (let i = 0; i < c.length; i++) {
323
- const a = c[i], u = A.get(a.id), T = u.parentId ? R.get(u.parentId) : {
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
- u.position.x = n - T.x, n += y[i] + P;
326
+ w.position.x = r - P.x, r += y[a] + B;
327
327
  }
328
328
  }
329
- } while (D && W < 5);
329
+ } while (D && _ < 5);
330
330
  return {
331
331
  nodes: f
332
332
  };
333
- }, j = K.cache(ut), Ht = (F) => {
334
- const N = $.c(2);
335
- let w;
336
- return N[0] !== F ? (w = /* @__PURE__ */ Y(Q, { children: /* @__PURE__ */ Y(wt, { ...F }) }), N[0] = F, N[1] = w) : w = N[1], w;
337
- }, wt = (F) => {
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: N
340
- } = F, w = {
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
- }, P = {
347
+ }, Y = {
346
348
  default: ct
347
- }, k = gt(N), S = pt(N), [W, D] = Z([]), [f, H, L] = tt([]), z = et(), C = K.useCallback((x) => {
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
- x.forEach((I) => z(I));
351
+ l.forEach((o) => G(o));
350
352
  });
351
- }, [z]), G = K.useCallback((x) => {
352
- const I = Array.from(new Set(x.filter((o) => o.type === "dimensions" || o.type === "position").map((o) => o.id))), r = /* @__PURE__ */ new Map();
353
- x.filter((o) => o.type === "dimensions").forEach((o) => r.set(o.id, o.dimensions)), D((o) => {
354
- const l = o.map((g) => {
355
- if (!r.has(g.id)) return g;
356
- const M = r.get(g.id) || {};
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
- ...g,
360
+ ...x,
359
361
  measured: {
360
- width: M.width ?? g.measured?.width ?? 0,
361
- height: M.height ?? g.measured?.height ?? 0
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(l, new Set(I)).nodes;
366
- }), C(I);
367
- }, [C]);
367
+ return j(u, new Set(o)).nodes;
368
+ }), F(o);
369
+ }, [F]);
368
370
  return K.useEffect(() => {
369
- const x = k.map((r) => {
370
- const o = r.measured ? [] : document.querySelectorAll("[data-id='" + r.id + "']");
371
+ const l = _.map((n) => {
372
+ const s = n.measured ? [] : document.querySelectorAll("[data-id='" + n.id + "']");
371
373
  return {
372
- ...r,
374
+ ...n,
373
375
  measured: {
374
- width: r.measured?.width ?? o[0]?.clientWidth ?? 0,
375
- height: r.measured?.height ?? o[0]?.clientHeight ?? 0
376
+ width: n.measured?.width ?? s[0]?.clientWidth ?? 0,
377
+ height: n.measured?.height ?? s[0]?.clientHeight ?? 0
376
378
  }
377
379
  };
378
- }), I = j(x, new Set(x.map((r) => r.id)));
379
- D(I.nodes), H(S), C(I.nodes.map((r) => r.id));
380
- }, [k, S, C]), /* @__PURE__ */ U(ot, { onlyRenderVisibleElements: !0, panOnScroll: !1, nodeTypes: w, edgeTypes: P, onInit: (x) => x.fitView(), onNodesChange: G, onEdgesChange: L, fitView: !0, ...J("flow", F), nodes: W, edges: f, children: [
381
- /* @__PURE__ */ Y(st, { variant: nt.Dots, color: "rgba(255,255,255, .05)", gap: 8, size: 2 }),
382
- /* @__PURE__ */ Y(ht, {}),
383
- /* @__PURE__ */ Y(mt, {}),
384
- /* @__PURE__ */ Y(ft, { flowId: "gid://sagittarius/Flow/1" }),
385
- /* @__PURE__ */ Y(lt, { flowId: N })
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>[];