@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,158 +1,181 @@
1
- import { jsxs as g, Fragment as j, jsx as n } from "react/jsx-runtime";
2
- import { c as M } from "../../_virtual/compiler-runtime.js";
1
+ import { jsxs as k, Fragment as R, jsx as c } from "react/jsx-runtime";
2
+ import { c as T } from "../../_virtual/compiler-runtime.js";
3
3
  import '../../assets/components/d-flow-folder/DFlowFolder.style.css';/* empty css */
4
- import C from "react";
5
- import { useService as k, useStore as B } from "../../utils/contextStore.js";
6
- import { mergeCode0Props as N } from "../../utils/utils.js";
7
- import { IconFolderOpen as P, IconFolder as E, IconDots as G, IconChevronDown as V, IconChevronRight as q } from "@tabler/icons-react";
4
+ import p from "react";
5
+ import { useService as E, useStore as H } from "../../utils/contextStore.js";
6
+ import { mergeCode0Props as j } from "../../utils/utils.js";
7
+ import { IconFolderOpen as N, IconFolderFilled as G, IconDots as V, IconChevronDown as q, IconChevronRight as J, IconFile as K } from "@tabler/icons-react";
8
8
  import "../d-flow/DFlow.js";
9
- import { DFlowReactiveService as z } from "../d-flow/DFlow.service.js";
9
+ import { DFlowReactiveService as A } from "../d-flow/DFlow.service.js";
10
10
  import "../d-flow-data-type/rules/DFlowDataTypeRegexRule.js";
11
11
  import "../d-flow-data-type/rules/DFlowDataTypeNumberRangeRule.js";
12
12
  import "../d-flow-data-type/rules/DFlowDataTypeItemOfCollectionRule.js";
13
13
  import "../d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js";
14
14
  import "../d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js";
15
15
  import "../d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.js";
16
- import "js-md5";
17
- import { ScrollArea as H, ScrollAreaViewport as J, ScrollAreaScrollbar as K, ScrollAreaThumb as L } from "../scroll-area/ScrollArea.js";
18
- import { Flex as $ } from "../flex/Flex.js";
19
- import { Text as R } from "../text/Text.js";
20
- import { Button as A } from "../button/Button.js";
21
- import { DFlowFolderContextMenu as T } from "./DFlowFolderContextMenu.js";
22
- const _e = (u) => {
16
+ import { md5 as L } from "js-md5";
17
+ import { ScrollArea as Q, ScrollAreaViewport as U, ScrollAreaScrollbar as W, ScrollAreaThumb as X } from "../scroll-area/ScrollArea.js";
18
+ import { Flex as z } from "../flex/Flex.js";
19
+ import { Text as P } from "../text/Text.js";
20
+ import { Button as M } from "../button/Button.js";
21
+ import { DFlowFolderContextMenu as B } from "./DFlowFolderContextMenu.js";
22
+ const be = p.forwardRef((h, e) => {
23
23
  const {
24
- activeFlowId: e
25
- } = u, f = k(z), d = B(z), p = (l) => l.replace(/^\/+|\/+$/g, "").split("/").filter(Boolean), h = C.useMemo(() => (f.values?.() ?? []).filter((o) => !!o?.name), [d]), m = C.useMemo(() => {
26
- const l = h.find((o) => o.id === e);
27
- return l?.name ? p(l.name) : [];
28
- }, [h, e]), v = C.useMemo(() => {
24
+ activeFlowId: i,
25
+ namespaceId: _,
26
+ projectId: S
27
+ } = h, $ = E(A), u = H(A), v = (l) => l.replace(/^\/+|\/+$/g, "").split("/").filter(Boolean), o = p.useMemo(() => ($.values?.({
28
+ namespaceId: _,
29
+ projectId: S
30
+ }) ?? []).filter((n) => !!n?.name), [u]), b = p.useMemo(() => {
31
+ const l = o.find((n) => n.id === i);
32
+ return l?.name ? v(l.name) : [];
33
+ }, [o, i]), D = p.useMemo(() => {
29
34
  const l = {
30
35
  name: "",
31
36
  path: "",
32
37
  children: {}
33
38
  };
34
- for (const o of h) {
35
- const s = p(o.name);
36
- if (s.length === 0) continue;
39
+ for (const n of o) {
40
+ const w = v(n.name);
41
+ if (w.length === 0) continue;
37
42
  let r = l, t = "";
38
- for (let i = 0; i < s.length; i++) {
39
- const c = s[i];
40
- t = t ? `${t}/${c}` : c, i === s.length - 1 ? r.children[c] ? r.children[c].flow = o : r.children[c] = {
41
- name: c,
43
+ for (let O = 0; O < w.length; O++) {
44
+ const x = w[O];
45
+ t = t ? `${t}/${x}` : x, O === w.length - 1 ? r.children[x] ? r.children[x].flow = n : r.children[x] = {
46
+ name: x,
42
47
  path: t,
43
48
  children: {},
44
- flow: o
45
- } : (r.children[c] || (r.children[c] = {
46
- name: c,
49
+ flow: n
50
+ } : (r.children[x] || (r.children[x] = {
51
+ name: x,
47
52
  path: t,
48
53
  children: {}
49
- }), r = r.children[c]);
54
+ }), r = r.children[x]);
50
55
  }
51
56
  }
52
57
  return l;
53
- }, [h]), a = C.useCallback((l) => l ? l.split("/").filter(Boolean).every((s, r) => m[r] === s) : !1, [m]), w = C.useCallback((l) => {
54
- const o = Object.values(l), s = o.filter((t) => !t.flow), r = o.filter((t) => !!t.flow);
55
- return s.sort((t, i) => t.name.localeCompare(i.name)), r.sort((t, i) => t.name.localeCompare(i.name)), /* @__PURE__ */ g(j, { children: [
56
- s.map((t) => /* @__PURE__ */ n(Q, { name: t.name, flows: Object.values(t.children).map((i) => i.flow), defaultOpen: a(t.path), ...u, children: w(t.children) }, t.path)),
57
- r.map((t) => /* @__PURE__ */ n(U, { name: t.name, path: t.path, flow: t.flow, active: t.flow.id === e, "data-flow-id": t.flow.id ?? void 0, ...u }, t.flow.id ?? t.path))
58
+ }, [o]), a = p.useCallback((l) => l ? l.split("/").filter(Boolean).every((w, r) => b[r] === w) : !1, [b]), [s, m] = p.useState("default"), [C, g] = p.useState(0), d = p.useCallback(() => {
59
+ m("allOpen"), g((l) => l + 1);
60
+ }, []), f = p.useCallback(() => {
61
+ m("allClosed"), g((l) => l + 1);
62
+ }, []), I = p.useCallback(() => {
63
+ m("activePath"), g((l) => l + 1);
64
+ }, []);
65
+ p.useImperativeHandle(e, () => ({
66
+ openAll: d,
67
+ closeAll: f,
68
+ openActivePath: I
69
+ }), [d, f, I]);
70
+ const y = p.useCallback((l) => s === "allOpen" ? !0 : s === "allClosed" ? !1 : a(l), [a, s]), F = p.useCallback((l) => {
71
+ const n = Object.values(l), w = n.filter((t) => !t.flow), r = n.filter((t) => !!t.flow);
72
+ return w.sort((t, O) => t.name.localeCompare(O.name)), r.sort((t, O) => t.name.localeCompare(O.name)), /* @__PURE__ */ k(R, { children: [
73
+ w.map((t) => /* @__PURE__ */ c(Y, { name: t.name, flows: Object.values(t.children).map((O) => O.flow), defaultOpen: y(t.path), ...h, children: F(t.children) }, `${t.path}-${C}`)),
74
+ r.map((t) => /* @__PURE__ */ c(Z, { name: t.name, path: t.path, flow: t.flow, active: t.flow.id === i, "data-flow-id": t.flow.id ?? void 0, ...h }, t.flow.id ?? t.path))
58
75
  ] });
59
- }, [e, a]);
60
- return /* @__PURE__ */ g(H, { h: "100%", children: [
61
- /* @__PURE__ */ n(J, { children: /* @__PURE__ */ n("div", { className: "d-folder__root", children: w(v.children) }) }),
62
- /* @__PURE__ */ n(K, { orientation: "vertical", children: /* @__PURE__ */ n(L, {}) })
76
+ }, [i, y, C]);
77
+ return /* @__PURE__ */ k(Q, { h: "100%", children: [
78
+ /* @__PURE__ */ c(U, { children: /* @__PURE__ */ c("div", { className: "d-folder__root", children: F(D.children) }) }),
79
+ /* @__PURE__ */ c(W, { orientation: "vertical", children: /* @__PURE__ */ c(X, {}) })
63
80
  ] });
64
- }, Q = (u) => {
65
- const e = M.c(31), {
66
- name: f,
67
- flows: d,
68
- defaultOpen: p,
69
- children: h,
70
- ...m
71
- } = u, v = p === void 0 ? !1 : p, [a, w] = C.useState(v), l = T;
72
- let o;
73
- e[0] !== d || e[1] !== f ? (o = {
74
- name: f,
75
- flows: d,
76
- type: "group"
77
- }, e[0] = d, e[1] = f, e[2] = o) : o = e[2];
81
+ }), Y = (h) => {
82
+ const e = T.c(31), {
83
+ name: i,
84
+ flows: _,
85
+ defaultOpen: S,
86
+ children: $,
87
+ ...u
88
+ } = h, v = S === void 0 ? !1 : S, [o, b] = p.useState(v), D = B;
89
+ let a;
90
+ e[0] !== _ || e[1] !== i ? (a = {
91
+ name: i,
92
+ flow: _,
93
+ type: "folder"
94
+ }, e[0] = _, e[1] = i, e[2] = a) : a = e[2];
78
95
  let s;
79
- e[3] === Symbol.for("react.memo_cache_sentinel") ? (s = () => w(W), e[3] = s) : s = e[3];
80
- const r = N("d-folder", m);
81
- let t;
82
- e[4] === Symbol.for("react.memo_cache_sentinel") ? (t = {
96
+ e[3] === Symbol.for("react.memo_cache_sentinel") ? (s = () => b(ee), e[3] = s) : s = e[3];
97
+ const m = j("d-folder", u);
98
+ let C;
99
+ e[4] === Symbol.for("react.memo_cache_sentinel") ? (C = {
83
100
  gap: "0.35rem"
84
- }, e[4] = t) : t = e[4];
85
- let i;
86
- e[5] !== a ? (i = /* @__PURE__ */ n("span", { className: "d-folder__icon", children: a ? /* @__PURE__ */ n(P, { size: 12 }) : /* @__PURE__ */ n(E, { size: 12 }) }), e[5] = a, e[6] = i) : i = e[6];
87
- let c;
88
- e[7] !== f ? (c = /* @__PURE__ */ n(R, { children: f }), e[7] = f, e[8] = c) : c = e[8];
89
- let _;
90
- e[9] !== i || e[10] !== c ? (_ = /* @__PURE__ */ g($, { align: "center", style: t, children: [
91
- i,
92
- c
93
- ] }), e[9] = i, e[10] = c, e[11] = _) : _ = e[11];
94
- let y;
95
- e[12] === Symbol.for("react.memo_cache_sentinel") ? (y = {
101
+ }, e[4] = C) : C = e[4];
102
+ let g;
103
+ e[5] !== o ? (g = o ? /* @__PURE__ */ c(N, { size: 12 }) : /* @__PURE__ */ c(G, { size: 12 }), e[5] = o, e[6] = g) : g = e[6];
104
+ let d;
105
+ e[7] !== i ? (d = /* @__PURE__ */ c(P, { children: i }), e[7] = i, e[8] = d) : d = e[8];
106
+ let f;
107
+ e[9] !== g || e[10] !== d ? (f = /* @__PURE__ */ k(z, { align: "center", style: C, children: [
108
+ g,
109
+ d
110
+ ] }), e[9] = g, e[10] = d, e[11] = f) : f = e[11];
111
+ let I;
112
+ e[12] === Symbol.for("react.memo_cache_sentinel") ? (I = {
96
113
  gap: "0.35rem"
97
- }, e[12] = y) : y = e[12];
98
- let D;
99
- e[13] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ n(A, { p: "0", variant: "none", children: /* @__PURE__ */ n(G, { size: 12 }) }), e[13] = D) : D = e[13];
100
- let S;
101
- e[14] !== a ? (S = /* @__PURE__ */ g($, { align: "center", style: y, children: [
102
- D,
103
- /* @__PURE__ */ n(A, { p: "0", variant: "none", children: a ? /* @__PURE__ */ n(V, { size: 12 }) : /* @__PURE__ */ n(q, { size: 12 }) })
104
- ] }), e[14] = a, e[15] = S) : S = e[15];
114
+ }, e[12] = I) : I = e[12];
115
+ let y;
116
+ e[13] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ c(M, { p: "0", variant: "none", children: /* @__PURE__ */ c(V, { size: 12 }) }), e[13] = y) : y = e[13];
105
117
  let F;
106
- e[16] !== S || e[17] !== s || e[18] !== r || e[19] !== _ ? (F = /* @__PURE__ */ g("div", { onClick: s, ...r, children: [
107
- _,
108
- S
109
- ] }), e[16] = S, e[17] = s, e[18] = r, e[19] = _, e[20] = F) : F = e[20];
110
- let b;
111
- e[21] !== l || e[22] !== m || e[23] !== o || e[24] !== F ? (b = /* @__PURE__ */ n(l, { contextData: o, ...m, children: F }), e[21] = l, e[22] = m, e[23] = o, e[24] = F, e[25] = b) : b = e[25];
112
- const I = a ? h : null;
113
- let x;
114
- e[26] !== I ? (x = /* @__PURE__ */ n("div", { className: "d-folder__content", children: I }), e[26] = I, e[27] = x) : x = e[27];
115
- let O;
116
- return e[28] !== b || e[29] !== x ? (O = /* @__PURE__ */ g(j, { children: [
117
- b,
118
- x
119
- ] }), e[28] = b, e[29] = x, e[30] = O) : O = e[30], O;
120
- }, U = (u) => {
121
- const e = M.c(23);
122
- let f, d, p, h, m, v;
123
- if (e[0] !== u) {
118
+ e[14] !== o ? (F = /* @__PURE__ */ k(z, { align: "center", style: I, children: [
119
+ y,
120
+ /* @__PURE__ */ c(M, { p: "0", variant: "none", children: o ? /* @__PURE__ */ c(q, { size: 12 }) : /* @__PURE__ */ c(J, { size: 12 }) })
121
+ ] }), e[14] = o, e[15] = F) : F = e[15];
122
+ let l;
123
+ e[16] !== F || e[17] !== s || e[18] !== m || e[19] !== f ? (l = /* @__PURE__ */ k("div", { onClick: s, ...m, children: [
124
+ f,
125
+ F
126
+ ] }), e[16] = F, e[17] = s, e[18] = m, e[19] = f, e[20] = l) : l = e[20];
127
+ let n;
128
+ e[21] !== D || e[22] !== u || e[23] !== a || e[24] !== l ? (n = /* @__PURE__ */ c(D, { contextData: a, ...u, children: l }), e[21] = D, e[22] = u, e[23] = a, e[24] = l, e[25] = n) : n = e[25];
129
+ const w = o ? $ : null;
130
+ let r;
131
+ e[26] !== w ? (r = /* @__PURE__ */ c("div", { className: "d-folder__content", children: w }), e[26] = w, e[27] = r) : r = e[27];
132
+ let t;
133
+ return e[28] !== n || e[29] !== r ? (t = /* @__PURE__ */ k(R, { children: [
134
+ n,
135
+ r
136
+ ] }), e[28] = n, e[29] = r, e[30] = t) : t = e[30], t;
137
+ }, Z = (h) => {
138
+ const e = T.c(30);
139
+ let i, _, S, $, u, v, o, b;
140
+ if (e[0] !== h) {
124
141
  const {
125
- name: s,
126
- path: r,
127
- flow: t,
128
- icon: i,
129
- active: c,
130
- ..._
131
- } = u;
132
- p = s, d = i, f = T, e[7] !== t || e[8] !== r ? (m = {
133
- name: r,
134
- flow: t,
142
+ name: g,
143
+ path: d,
144
+ flow: f,
145
+ onSelect: I,
146
+ active: y,
147
+ ...F
148
+ } = h;
149
+ S = g;
150
+ const l = L(d + S), n = te;
151
+ _ = B, e[9] !== f || e[10] !== d ? (o = {
152
+ name: d,
153
+ flow: f,
135
154
  type: "item"
136
- }, e[7] = t, e[8] = r, e[9] = m) : m = e[9], v = _, h = N(`d-folder__item ${c ? "d-folder__item--active" : ""}`, _), e[0] = u, e[1] = f, e[2] = d, e[3] = p, e[4] = h, e[5] = m, e[6] = v;
155
+ }, e[9] = f, e[10] = d, e[11] = o) : o = e[11], b = F, u = j(`d-folder__item ${y ? "d-folder__item--active" : ""}`, F), e[12] !== f || e[13] !== I ? (v = () => I?.(f), e[12] = f, e[13] = I, e[14] = v) : v = e[14], i = K, $ = n(l), e[0] = h, e[1] = i, e[2] = _, e[3] = S, e[4] = $, e[5] = u, e[6] = v, e[7] = o, e[8] = b;
137
156
  } else
138
- f = e[1], d = e[2], p = e[3], h = e[4], m = e[5], v = e[6];
157
+ i = e[1], _ = e[2], S = e[3], $ = e[4], u = e[5], v = e[6], o = e[7], b = e[8];
158
+ const D = `hsl(${$}, 100%, 72%)`;
139
159
  let a;
140
- e[10] !== d ? (a = d ? /* @__PURE__ */ n("span", { className: "d-folder__item-icon", children: d }) : null, e[10] = d, e[11] = a) : a = e[11];
141
- let w;
142
- e[12] !== p ? (w = /* @__PURE__ */ n(R, { children: p }), e[12] = p, e[13] = w) : w = e[13];
143
- let l;
144
- e[14] !== h || e[15] !== a || e[16] !== w ? (l = /* @__PURE__ */ g("div", { ...h, children: [
160
+ e[15] !== i || e[16] !== D ? (a = /* @__PURE__ */ c(i, { color: D, size: 12 }), e[15] = i, e[16] = D, e[17] = a) : a = e[17];
161
+ let s;
162
+ e[18] !== S ? (s = /* @__PURE__ */ c(P, { children: S }), e[18] = S, e[19] = s) : s = e[19];
163
+ let m;
164
+ e[20] !== u || e[21] !== v || e[22] !== a || e[23] !== s ? (m = /* @__PURE__ */ k("div", { ...u, onClick: v, children: [
145
165
  a,
146
- w
147
- ] }), e[14] = h, e[15] = a, e[16] = w, e[17] = l) : l = e[17];
148
- let o;
149
- return e[18] !== f || e[19] !== m || e[20] !== v || e[21] !== l ? (o = /* @__PURE__ */ n(f, { contextData: m, ...v, children: l }), e[18] = f, e[19] = m, e[20] = v, e[21] = l, e[22] = o) : o = e[22], o;
166
+ s
167
+ ] }), e[20] = u, e[21] = v, e[22] = a, e[23] = s, e[24] = m) : m = e[24];
168
+ let C;
169
+ return e[25] !== _ || e[26] !== o || e[27] !== b || e[28] !== m ? (C = /* @__PURE__ */ c(_, { contextData: o, ...b, children: m }), e[25] = _, e[26] = o, e[27] = b, e[28] = m, e[29] = C) : C = e[29], C;
150
170
  };
151
- function W(u) {
152
- return !u;
171
+ function ee(h) {
172
+ return !h;
173
+ }
174
+ function te(h) {
175
+ return parseInt(h.slice(0, 8), 16) % 360;
153
176
  }
154
177
  export {
155
- _e as DFlowFolder,
156
- Q as DFlowFolderGroup,
157
- U as DFlowFolderItem
178
+ be as DFlowFolder,
179
+ Y as DFlowFolderGroup,
180
+ Z as DFlowFolderItem
158
181
  };
@@ -3,8 +3,8 @@ import { default as React } from 'react';
3
3
  import { Flow } from '@code0-tech/sagittarius-graphql-types';
4
4
  export interface DFlowFolderContextMenuGroupData {
5
5
  name: string;
6
- flows: Flow[];
7
- type: "group";
6
+ flow: Flow[];
7
+ type: "folder";
8
8
  }
9
9
  export interface DFlowFolderContextMenuItemData {
10
10
  name: string;
@@ -1,69 +1,38 @@
1
- import { jsxs as n, Fragment as v, jsx as e } from "react/jsx-runtime";
2
- import r from "react";
3
- import { ContextMenu as F, ContextMenuTrigger as M, ContextMenuPortal as O, ContextMenuContent as R, ContextMenuSub as b, ContextMenuSubTrigger as T, ContextMenuSubContent as I, ContextMenuItem as i, ContextMenuSeparator as j } from "../context-menu/ContextMenu.js";
4
- import { Flex as u } from "../flex/Flex.js";
5
- import { Text as l } from "../text/Text.js";
6
- import { IconChevronRight as z, IconEdit as B, IconTrash as k } from "@tabler/icons-react";
7
- import { Dialog as A, DialogPortal as E, DialogContent as N, DialogClose as m } from "../dialog/Dialog.js";
8
- import { Badge as P } from "../badge/Badge.js";
9
- import { Button as s } from "../button/Button.js";
10
- import { useService as _, useStore as Y } from "../../utils/contextStore.js";
1
+ import { jsx as e, Fragment as a, jsxs as n } from "react/jsx-runtime";
2
+ import h from "react";
3
+ import { ContextMenu as s, ContextMenuTrigger as x, ContextMenuPortal as C, ContextMenuContent as S, ContextMenuSub as f, ContextMenuSubTrigger as M, ContextMenuSubContent as g, ContextMenuItem as r, ContextMenuSeparator as p } from "../context-menu/ContextMenu.js";
4
+ import { Flex as v } from "../flex/Flex.js";
5
+ import { Text as i } from "../text/Text.js";
6
+ import { IconChevronRight as w, IconEdit as D, IconTrash as F } from "@tabler/icons-react";
7
+ import { useService as R, useStore as T } from "../../utils/contextStore.js";
11
8
  import "merge-props";
12
- import { DFlowTypeReactiveService as h } from "../d-flow-type/DFlowType.service.js";
13
- import { DFlowFolderRenameDialog as q } from "./DFlowFolderRenameDialog.js";
14
- import { DFlowFolderCreateDialog as G } from "./DFlowFolderCreateDialog.js";
15
- const ne = (t) => {
9
+ import { DFlowTypeReactiveService as c } from "../d-flow-type/DFlowType.service.js";
10
+ const k = (t) => {
16
11
  const {
17
- children: f
18
- } = t, D = _(h), g = Y(h), C = r.useMemo(() => D.values(), [g]), [x, a] = r.useState(!1), [p, c] = r.useState(!1), [w, d] = r.useState(!1), [y, S] = r.useState(null);
19
- return /* @__PURE__ */ n(v, { children: [
20
- /* @__PURE__ */ e(A, { open: x, onOpenChange: (o) => a(o), children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ n(N, { autoFocus: !0, showCloseButton: !0, title: t.contextData.type == "item" ? "Remove flow" : "Remove folder", children: [
21
- /* @__PURE__ */ n(l, { size: "md", hierarchy: "secondary", children: [
22
- t.contextData.type == "item" ? "Are you sure you want to remove flow" : "Are you sure you want to remove folder",
23
- " ",
24
- " ",
25
- /* @__PURE__ */ e(P, { color: "info", children: /* @__PURE__ */ e(l, { size: "md", style: {
26
- color: "inherit"
27
- }, children: t.contextData.name }) }),
28
- " ",
29
- " ",
30
- t.contextData.type == "group" ? ", all flows and sub-folders inside " : "",
31
- "from the this project?"
12
+ children: l
13
+ } = t, d = R(c), m = T(c), u = h.useMemo(() => d.values(), [m]);
14
+ return /* @__PURE__ */ e(a, { children: /* @__PURE__ */ n(s, { children: [
15
+ /* @__PURE__ */ e(x, { asChild: !0, children: l }),
16
+ /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(S, { children: /* @__PURE__ */ n(f, { children: [
17
+ /* @__PURE__ */ e(M, { children: /* @__PURE__ */ n(v, { align: "center", justify: "space-between", w: "100%", children: [
18
+ /* @__PURE__ */ e(i, { children: "New flow" }),
19
+ /* @__PURE__ */ e(w, { size: 12 })
20
+ ] }) }),
21
+ /* @__PURE__ */ e(g, { children: u.map((o) => /* @__PURE__ */ e(r, { onSelect: () => {
22
+ t.onCreate?.(o.id);
23
+ }, children: o.names?.nodes[0]?.content ?? o.id }, o.id)) }),
24
+ /* @__PURE__ */ e(p, {}),
25
+ /* @__PURE__ */ n(r, { onSelect: () => t.onRename?.(t.contextData), children: [
26
+ /* @__PURE__ */ e(D, { size: 12, color: "purple" }),
27
+ /* @__PURE__ */ e(i, { children: "Rename" })
32
28
  ] }),
33
- /* @__PURE__ */ n(u, { justify: "space-between", align: "center", children: [
34
- /* @__PURE__ */ e(m, { asChild: !0, children: /* @__PURE__ */ e(s, { color: "secondary", children: "No, go back!" }) }),
35
- /* @__PURE__ */ e(m, { asChild: !0, children: /* @__PURE__ */ e(s, { color: "error", onClick: () => {
36
- t.contextData.type === "item" ? t.onDelete?.(t.contextData.flow) : t.contextData.type === "group" && t.contextData.flows.forEach((o) => {
37
- t.onDelete?.(o);
38
- });
39
- }, children: "Yes, remove!" }) })
29
+ /* @__PURE__ */ n(r, { onSelect: () => t.onDelete?.(t.contextData), children: [
30
+ /* @__PURE__ */ e(F, { size: 12, color: "red" }),
31
+ /* @__PURE__ */ e(i, { children: "Delete" })
40
32
  ] })
41
- ] }) }) }),
42
- /* @__PURE__ */ e(q, { onOpenChange: (o) => c(o), open: p, ...t }),
43
- /* @__PURE__ */ e(G, { flowTypeId: y, onOpenChange: (o) => d(o), open: w, ...t }),
44
- /* @__PURE__ */ n(F, { children: [
45
- /* @__PURE__ */ e(M, { asChild: !0, children: f }),
46
- /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(R, { children: /* @__PURE__ */ n(b, { children: [
47
- /* @__PURE__ */ e(T, { children: /* @__PURE__ */ n(u, { align: "center", justify: "space-between", w: "100%", children: [
48
- /* @__PURE__ */ e(l, { children: "New flow" }),
49
- /* @__PURE__ */ e(z, { size: 12 })
50
- ] }) }),
51
- /* @__PURE__ */ e(I, { children: C.map((o) => /* @__PURE__ */ e(i, { onSelect: () => {
52
- S(o.id), d(!0);
53
- }, children: o.names?.nodes[0]?.content ?? o.id }, o.id)) }),
54
- /* @__PURE__ */ e(j, {}),
55
- /* @__PURE__ */ n(i, { onSelect: () => c(!0), children: [
56
- /* @__PURE__ */ e(B, { size: 12, color: "purple" }),
57
- /* @__PURE__ */ e(l, { children: "Rename" })
58
- ] }),
59
- /* @__PURE__ */ n(i, { onSelect: () => a(!0), children: [
60
- /* @__PURE__ */ e(k, { size: 12, color: "red" }),
61
- /* @__PURE__ */ e(l, { children: "Delete" })
62
- ] })
63
- ] }) }) })
64
- ] })
65
- ] });
33
+ ] }) }) })
34
+ ] }) });
66
35
  };
67
36
  export {
68
- ne as DFlowFolderContextMenu
37
+ k as DFlowFolderContextMenu
69
38
  };
@@ -1,9 +1,9 @@
1
- import { DFlowFolderProps } from './DFlowFolder';
2
1
  import { default as React } from 'react';
3
2
  import { FlowType } from '@code0-tech/sagittarius-graphql-types';
4
- export interface DFlowFolderCreateDialogProps extends DFlowFolderProps {
3
+ export interface DFlowFolderCreateDialogProps {
5
4
  open?: boolean;
6
5
  onOpenChange?: (open: boolean) => void;
7
6
  flowTypeId: FlowType['id'];
7
+ onCreate?: (name: string, type: FlowType['id']) => void;
8
8
  }
9
9
  export declare const DFlowFolderCreateDialog: React.FC<DFlowFolderCreateDialogProps>;
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { DFlowFolderContextMenuGroupData, DFlowFolderContextMenuItemData } from './DFlowFolderContextMenu';
3
+ import { Flow } from '@code0-tech/sagittarius-graphql-types';
4
+ export interface DFlowFolderDeleteDialogProps {
5
+ open?: boolean;
6
+ onOpenChange?: (open: boolean) => void;
7
+ contextData: DFlowFolderContextMenuGroupData | DFlowFolderContextMenuItemData;
8
+ onDelete?: (flow: Flow) => void;
9
+ }
10
+ export declare const DFlowFolderDeleteDialog: React.FC<DFlowFolderDeleteDialogProps>;
@@ -0,0 +1,55 @@
1
+ import { jsx as o, jsxs as y } from "react/jsx-runtime";
2
+ import { c as b } from "../../_virtual/compiler-runtime.js";
3
+ import { DialogClose as x, DialogPortal as v, DialogContent as j, Dialog as F } from "../dialog/Dialog.js";
4
+ import { Text as g } from "../text/Text.js";
5
+ import { Badge as R } from "../badge/Badge.js";
6
+ import { Flex as S } from "../flex/Flex.js";
7
+ import { Button as w } from "../button/Button.js";
8
+ import B from "react";
9
+ const Y = (t) => {
10
+ const e = b.c(18), {
11
+ open: _
12
+ } = t, [s, C] = B.useState(_);
13
+ let a;
14
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (a = (u) => C(u), e[0] = a) : a = e[0];
15
+ const d = t.contextData.type == "item" ? "Remove flow" : "Remove folder", h = t.contextData.type == "item" ? "Are you sure you want to remove flow" : "Are you sure you want to remove folder";
16
+ let c;
17
+ e[1] === Symbol.for("react.memo_cache_sentinel") ? (c = {
18
+ color: "inherit"
19
+ }, e[1] = c) : c = e[1];
20
+ let l;
21
+ e[2] !== t.contextData.name ? (l = /* @__PURE__ */ o(R, { color: "info", children: /* @__PURE__ */ o(g, { size: "md", style: c, children: t.contextData.name }) }), e[2] = t.contextData.name, e[3] = l) : l = e[3];
22
+ const D = t.contextData.type == "folder" ? ", all flows and sub-folders inside " : "";
23
+ let n;
24
+ e[4] !== h || e[5] !== l || e[6] !== D ? (n = /* @__PURE__ */ y(g, { size: "md", hierarchy: "secondary", children: [
25
+ h,
26
+ " ",
27
+ " ",
28
+ l,
29
+ " ",
30
+ " ",
31
+ D,
32
+ "from the this project?"
33
+ ] }), e[4] = h, e[5] = l, e[6] = D, e[7] = n) : n = e[7];
34
+ let m;
35
+ e[8] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ o(x, { asChild: !0, children: /* @__PURE__ */ o(w, { color: "secondary", children: "No, go back!" }) }), e[8] = m) : m = e[8];
36
+ let i;
37
+ e[9] !== t ? (i = /* @__PURE__ */ y(S, { justify: "space-between", align: "center", children: [
38
+ m,
39
+ /* @__PURE__ */ o(x, { asChild: !0, children: /* @__PURE__ */ o(w, { color: "error", onClick: () => {
40
+ t.contextData.type === "item" ? t.onDelete?.(t.contextData.flow) : t.contextData.type === "folder" && t.contextData.flow.forEach((u) => {
41
+ t.onDelete?.(u);
42
+ });
43
+ }, children: "Yes, remove!" }) })
44
+ ] }), e[9] = t, e[10] = i) : i = e[10];
45
+ let r;
46
+ e[11] !== d || e[12] !== n || e[13] !== i ? (r = /* @__PURE__ */ o(v, { children: /* @__PURE__ */ y(j, { autoFocus: !0, showCloseButton: !0, title: d, children: [
47
+ n,
48
+ i
49
+ ] }) }), e[11] = d, e[12] = n, e[13] = i, e[14] = r) : r = e[14];
50
+ let f;
51
+ return e[15] !== s || e[16] !== r ? (f = /* @__PURE__ */ o(F, { open: s, onOpenChange: a, children: r }), e[15] = s, e[16] = r, e[17] = f) : f = e[17], f;
52
+ };
53
+ export {
54
+ Y as DFlowFolderDeleteDialog
55
+ };
@@ -1,9 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  import { DFlowFolderContextMenuGroupData, DFlowFolderContextMenuItemData } from './DFlowFolderContextMenu';
3
- import { DFlowFolderProps } from './DFlowFolder';
4
- export interface DFlowFolderRenameDialogProps extends DFlowFolderProps {
3
+ import { Flow } from '@code0-tech/sagittarius-graphql-types';
4
+ export interface DFlowFolderRenameDialogProps {
5
5
  contextData: DFlowFolderContextMenuGroupData | DFlowFolderContextMenuItemData;
6
6
  open?: boolean;
7
7
  onOpenChange?: (open: boolean) => void;
8
+ onRename?: (flow: Flow, newName: string) => void;
8
9
  }
9
10
  export declare const DFlowFolderRenameDialog: React.FC<DFlowFolderRenameDialogProps>;
@@ -1,9 +1,9 @@
1
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
2
  import i from "react";
3
- import { Dialog as f, DialogPortal as D, DialogContent as g, DialogClose as l } from "../dialog/Dialog.js";
3
+ import { Dialog as f, DialogPortal as D, DialogContent as g, DialogClose as m } from "../dialog/Dialog.js";
4
4
  import { DFlowFolderItemPathInput as x } from "./DFlowFolderItemPathInput.js";
5
5
  import { Flex as w } from "../flex/Flex.js";
6
- import { Button as c } from "../button/Button.js";
6
+ import { Button as l } from "../button/Button.js";
7
7
  import "../../_virtual/compiler-runtime.js";
8
8
  import "@radix-ui/react-checkbox";
9
9
  import "merge-props";
@@ -22,31 +22,31 @@ import { useForm as C } from "../form/useForm.js";
22
22
  const G = (e) => {
23
23
  const {
24
24
  open: a
25
- } = e, [u, r] = i.useState(a), h = i.useMemo(() => ({
25
+ } = e, [c, h] = i.useState(a), u = i.useMemo(() => ({
26
26
  path: e.contextData.name
27
27
  }), []);
28
28
  i.useEffect(() => {
29
- r(a);
29
+ h(a);
30
30
  }, [a]);
31
- const [s, p] = C({
32
- initialValues: h,
31
+ const [s, d] = C({
32
+ initialValues: u,
33
33
  validate: {
34
34
  path: (o) => null
35
35
  },
36
36
  onSubmit: (o) => {
37
- e.contextData.type === "item" ? e.onRename?.(e.contextData.flow, o.path) : e.contextData.type === "group" && e.contextData.flows.forEach((n) => {
38
- const d = n.name?.replace(e.contextData.name, o.path) ?? n.name;
39
- e.onRename?.(n, d);
37
+ e.contextData.type === "item" ? e.onRename?.(e.contextData.flow, o.path) : e.contextData.type === "folder" && e.contextData.flow.forEach((n) => {
38
+ const p = n.name?.replace(e.contextData.name, o.path) ?? n.name;
39
+ e.onRename?.(n, p);
40
40
  });
41
41
  }
42
42
  });
43
- return /* @__PURE__ */ t(f, { open: u, onOpenChange: (o) => {
44
- e.onOpenChange?.(o), r(o);
45
- }, children: /* @__PURE__ */ t(D, { children: /* @__PURE__ */ m(g, { autoFocus: !0, showCloseButton: !0, title: e.contextData.type == "item" ? "Rename flow" : "Rename folder", children: [
43
+ return /* @__PURE__ */ t(f, { open: c, onOpenChange: (o) => {
44
+ e.onOpenChange?.(o);
45
+ }, children: /* @__PURE__ */ t(D, { children: /* @__PURE__ */ r(g, { autoFocus: !0, showCloseButton: !0, title: e.contextData.type == "item" ? "Rename flow" : "Rename folder", children: [
46
46
  /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(x, { description: "You can choose a new name here and only use alphanumeric names.", title: e.contextData.type == "item" ? "Name of the flow" : "Name of the folder", ...s.getInputProps("path") }) }),
47
- /* @__PURE__ */ m(w, { justify: "space-between", align: "center", children: [
48
- /* @__PURE__ */ t(l, { asChild: !0, children: /* @__PURE__ */ t(c, { color: "secondary", children: "No, go back!" }) }),
49
- /* @__PURE__ */ t(l, { asChild: !0, children: /* @__PURE__ */ t(c, { color: "success", onClick: p, children: "Yes, save!" }) })
47
+ /* @__PURE__ */ r(w, { justify: "space-between", align: "center", children: [
48
+ /* @__PURE__ */ t(m, { asChild: !0, children: /* @__PURE__ */ t(l, { color: "secondary", children: "No, go back!" }) }),
49
+ /* @__PURE__ */ t(m, { asChild: !0, children: /* @__PURE__ */ t(l, { color: "success", onClick: d, children: "Yes, save!" }) })
50
50
  ] })
51
51
  ] }) }) });
52
52
  };
@@ -1 +1,4 @@
1
1
  export * from './DFlowFolder';
2
+ export * from './DFlowFolderDeleteDialog';
3
+ export * from './DFlowFolderCreateDialog';
4
+ export * from './DFlowFolderRenameDialog';
@@ -1,6 +1,12 @@
1
- import { DFlowFolder as r, DFlowFolderGroup as F, DFlowFolderItem as e } from "./DFlowFolder.js";
1
+ import { DFlowFolder as l, DFlowFolderGroup as r, DFlowFolderItem as F } from "./DFlowFolder.js";
2
+ import { DFlowFolderDeleteDialog as t } from "./DFlowFolderDeleteDialog.js";
3
+ import { DFlowFolderCreateDialog as m } from "./DFlowFolderCreateDialog.js";
4
+ import { DFlowFolderRenameDialog as a } from "./DFlowFolderRenameDialog.js";
2
5
  export {
3
- r as DFlowFolder,
4
- F as DFlowFolderGroup,
5
- e as DFlowFolderItem
6
+ l as DFlowFolder,
7
+ m as DFlowFolderCreateDialog,
8
+ t as DFlowFolderDeleteDialog,
9
+ r as DFlowFolderGroup,
10
+ F as DFlowFolderItem,
11
+ a as DFlowFolderRenameDialog
6
12
  };
@@ -1,6 +1,11 @@
1
1
  import { ReactiveArrayService } from '../../utils';
2
2
  import { FunctionDefinitionView } from './DFlowFunction.view';
3
- import { FunctionDefinition } from '@code0-tech/sagittarius-graphql-types';
4
- export declare abstract class DFlowFunctionReactiveService extends ReactiveArrayService<FunctionDefinitionView> {
5
- getById(id: FunctionDefinition['id']): FunctionDefinitionView | undefined;
3
+ import { FunctionDefinition, Namespace, NamespaceProject, Runtime } from '@code0-tech/sagittarius-graphql-types';
4
+ export type DFlowFunctionDependencies = {
5
+ namespaceId: Namespace['id'];
6
+ projectId: NamespaceProject['id'];
7
+ runtimeId: Runtime['id'];
8
+ };
9
+ export declare abstract class DFlowFunctionReactiveService extends ReactiveArrayService<FunctionDefinitionView, DFlowFunctionDependencies> {
10
+ getById(id: FunctionDefinition['id'], dependencies?: DFlowFunctionDependencies): FunctionDefinitionView | undefined;
6
11
  }