@code0-tech/pictor 0.0.0-mvp.45 → 0.0.0-mvp.46
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-input/DFlowInputDataType.style.css +1 -1
- package/dist/assets/components/d-flow-suggestion/DFlowSuggestionSearchInput.style.css +1 -1
- package/dist/components/d-flow/DFlow.service.js +31 -23
- package/dist/components/d-flow-data-type/DFlowDataType.service.d.ts +2 -2
- package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js +22 -13
- package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js +19 -13
- package/dist/components/d-flow-file/DFlowTabDefault.js +38 -37
- package/dist/components/d-flow-file/DFlowTabTrigger.js +1 -1
- package/dist/components/d-flow-input/DFlowInput.d.ts +11 -0
- package/dist/components/d-flow-input/DFlowInput.js +29 -0
- package/dist/components/d-flow-input/DFlowInputDefault.d.ts +2 -7
- package/dist/components/d-flow-input/DFlowInputNodeBadge.js +13 -13
- package/dist/components/d-flow-input/DFlowInputObject.d.ts +10 -0
- package/dist/components/d-flow-input/DFlowInputObject.js +83 -0
- package/dist/components/d-flow-input/DFlowInputObjectEditDialog.d.ts +16 -0
- package/dist/components/d-flow-input/DFlowInputObjectEditDialog.js +118 -0
- package/dist/components/d-flow-input/DFlowInputObjectTree.d.ts +16 -0
- package/dist/components/d-flow-input/DFlowInputObjectTree.js +99 -0
- package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +12 -12
- package/dist/components/d-flow-node/DFlowNodeReference.return.hook.d.ts +4 -0
- package/dist/components/d-flow-node/DFlowNodeReference.return.hook.js +77 -0
- package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +104 -103
- package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +43 -50
- package/dist/components/d-flow-validation/DNodeValidation.hook.js +44 -39
- package/dist/components/editor/Editor.js +15 -15
- package/dist/components/form/InputSuggestion.js +29 -29
- package/dist/components/form/useForm.d.ts +3 -3
- package/dist/components/form/useForm.js +16 -16
- package/dist/node_modules/prettier/plugins/babel.js +6674 -6685
- package/dist/node_modules/prettier/plugins/estree.js +2830 -2628
- package/dist/node_modules/prettier/standalone.js +1657 -1440
- package/dist/utils/generics.js +85 -97
- package/package.json +22 -22
|
@@ -1,132 +1,133 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useService as
|
|
1
|
+
import f from "react";
|
|
2
|
+
import { useService as g, useStore as I } from "../../utils/contextStore.js";
|
|
3
3
|
import "merge-props";
|
|
4
4
|
import "js-md5";
|
|
5
|
-
import { DFlowDataTypeReactiveService as
|
|
6
|
-
import { DFlowSuggestionType as
|
|
7
|
-
import { replaceGenericsAndSortType as C, resolveType as P, isMatchingType as
|
|
8
|
-
import { DFlowFunctionReactiveService as
|
|
5
|
+
import { DFlowDataTypeReactiveService as R } from "../d-flow-data-type/DFlowDataType.service.js";
|
|
6
|
+
import { DFlowSuggestionType as Y } from "./DFlowSuggestion.view.js";
|
|
7
|
+
import { replaceGenericsAndSortType as C, resolveType as P, isMatchingType as k, resolveGenericKeys as J, targetForGenericKey as U, replaceGenericKeysInType as q } from "../../utils/generics.js";
|
|
8
|
+
import { DFlowFunctionReactiveService as G } from "../d-flow-function/DFlowFunction.service.js";
|
|
9
9
|
import "../d-flow/DFlow.js";
|
|
10
|
-
import { DFlowReactiveService as
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import { DFlowReactiveService as B } from "../d-flow/DFlow.service.js";
|
|
11
|
+
import { useReturnType as z } from "../d-flow-function/DFlowFunction.return.hook.js";
|
|
12
|
+
import { DFlowTypeReactiveService as j } from "../d-flow-type/DFlowType.service.js";
|
|
13
|
+
const pe = (o, t, n, d = []) => {
|
|
14
|
+
const m = g(R), u = I(R), M = g(B), s = I(B), N = $(o), l = f.useMemo(() => t ? N?.find((i) => i.nodeFunctionId === t) : void 0, [N, t]), D = f.useMemo(() => t ? M.getNodeById(o, t)?.parameters?.nodes?.map((r) => r?.value).filter((r) => r?.__typename === "NodeFunctionIdWrapper") ?? [] : [], [o, t, M, s]), S = f.useMemo(() => n ? C(P(n, m), d) : void 0, [n, m, u, d]), h = H(o);
|
|
15
|
+
return f.useMemo(() => {
|
|
16
|
+
if (!S || !l) return [];
|
|
16
17
|
const {
|
|
17
18
|
depth: i,
|
|
18
|
-
scope:
|
|
19
|
-
node:
|
|
20
|
-
} =
|
|
21
|
-
return
|
|
19
|
+
scope: r,
|
|
20
|
+
node: T
|
|
21
|
+
} = l;
|
|
22
|
+
return h.flatMap((e) => {
|
|
22
23
|
if (e.node === null || e.node === void 0) return [];
|
|
23
24
|
if (e.depth === null || e.depth === void 0) return [];
|
|
24
25
|
if (e.scope === null || e.scope === void 0) return [];
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
if (!
|
|
26
|
+
const c = e.parameterIndex !== void 0 && e.inputIndex !== void 0, a = c ? e.scope?.every((p, x) => r?.[x] === p) : !0;
|
|
27
|
+
if (c && !a) return [];
|
|
28
|
+
if (D.some((p) => p.id === e.nodeFunctionId)) return [];
|
|
29
|
+
if (!c && e.node >= T) return [];
|
|
29
30
|
if (e.depth > i) return [];
|
|
30
|
-
if (e.scope.some((
|
|
31
|
-
const
|
|
32
|
-
return
|
|
31
|
+
if (e.scope.some((p) => !r.includes(p))) return [];
|
|
32
|
+
const F = C(P(e.dataTypeIdentifier, m), []);
|
|
33
|
+
return k(S, F) ? [{
|
|
33
34
|
path: [],
|
|
34
|
-
type:
|
|
35
|
-
displayText: [`${e.depth}-${e.scope}-${e.node || ""}-${e.referencePath?.map((
|
|
35
|
+
type: Y.REF_OBJECT,
|
|
36
|
+
displayText: [`${e.depth}-${e.scope}-${e.node || ""}-${e.referencePath?.map((p) => p.path).join(".") ?? ""}`],
|
|
36
37
|
value: e
|
|
37
38
|
}] : [];
|
|
38
39
|
});
|
|
39
|
-
}, [m,
|
|
40
|
-
},
|
|
41
|
-
const t =
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
}) ?? [], [
|
|
40
|
+
}, [m, l, D, h, S]);
|
|
41
|
+
}, H = (o) => {
|
|
42
|
+
const t = g(R);
|
|
43
|
+
I(R);
|
|
44
|
+
const n = g(G), d = g(B), m = I(B), u = g(j), M = I(j), s = f.useMemo(() => d.getById(o), [o, m]), N = f.useMemo(() => u.getById(s?.type?.id), [s?.type?.id, M]), l = $(o), D = f.useMemo(() => s?.nodes?.nodes?.map((i) => {
|
|
45
|
+
const r = i?.parameters?.nodes?.map((a) => a?.value) ?? [], T = n.getById(i?.functionDefinition?.id), e = z(T, r, t, n), c = l?.find((a) => a.nodeFunctionId === i?.id);
|
|
46
|
+
return e && c ? E(c, e, t) : {};
|
|
47
|
+
}) ?? [], [s]), S = f.useMemo(() => E({
|
|
47
48
|
node: 0,
|
|
48
49
|
depth: 0,
|
|
49
|
-
nodeFunctionId: "gid://sagittarius/NodeFunction/-1",
|
|
50
50
|
scope: [0]
|
|
51
51
|
}, {
|
|
52
|
-
dataType:
|
|
53
|
-
}), [
|
|
54
|
-
return [...
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
const
|
|
58
|
-
return (
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
67
|
-
const
|
|
68
|
-
return
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
-
...
|
|
72
|
-
nodeFunctionId:
|
|
73
|
-
parameterIndex:
|
|
74
|
-
|
|
75
|
-
inputTypeIdentifier:
|
|
76
|
-
},
|
|
52
|
+
dataType: N?.inputType
|
|
53
|
+
}, t), [s]);
|
|
54
|
+
return [...f.useMemo(() => s?.nodes?.nodes?.length ? s.nodes.nodes.flatMap((i) => {
|
|
55
|
+
const r = n.getById(i?.functionDefinition?.id);
|
|
56
|
+
if (!r) return [];
|
|
57
|
+
const T = i?.parameters?.nodes?.map((e) => e?.value).filter(Boolean) ?? [];
|
|
58
|
+
return (r.parameterDefinitions ?? []).flatMap((e, c) => {
|
|
59
|
+
const a = e?.dataTypeIdentifier;
|
|
60
|
+
if (!a) return [];
|
|
61
|
+
const F = t.getDataType(a);
|
|
62
|
+
if (!F || F.variant !== "NODE") return [];
|
|
63
|
+
const p = i?.parameters?.nodes?.find((y) => y?.parameterDefinition?.id === e?.id);
|
|
64
|
+
if (!p?.value || p.value.__typename !== "NodeFunctionIdWrapper") return [];
|
|
65
|
+
const x = l?.find((y) => p?.value?.__typename === "NodeFunctionIdWrapper" && y.nodeFunctionId === p.value?.id);
|
|
66
|
+
if (!x) return [];
|
|
67
|
+
const v = F.rules?.nodes?.filter((y) => y?.variant === "INPUT_TYPES") ?? [], w = J(r, T, t, n), K = U(r, a), V = new Map([...w].map(([y, O]) => [K.get(y) ?? y, O]));
|
|
68
|
+
return v.flatMap((y) => (y?.config?.inputTypes ?? []).flatMap((b, A) => {
|
|
69
|
+
const W = q(b.dataTypeIdentifier, V);
|
|
70
|
+
return W ? E({
|
|
71
|
+
...x,
|
|
72
|
+
nodeFunctionId: i?.id,
|
|
73
|
+
parameterIndex: c,
|
|
74
|
+
inputIndex: A,
|
|
75
|
+
inputTypeIdentifier: b.inputIdentifier
|
|
76
|
+
}, W, t) : [];
|
|
77
77
|
}));
|
|
78
78
|
});
|
|
79
|
-
}) : [], [
|
|
80
|
-
},
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
if (
|
|
84
|
-
return t ?
|
|
85
|
-
...
|
|
86
|
-
referencePath: [...
|
|
87
|
-
path:
|
|
79
|
+
}) : [], [s, l, n, t]), ...S, ...D].flat();
|
|
80
|
+
}, E = (o, t, n) => {
|
|
81
|
+
const d = t.dataType ? n.getDataType(t) : t.genericType?.dataType;
|
|
82
|
+
return d ? [...d.rules?.nodes?.map((u) => {
|
|
83
|
+
if (u?.variant === "CONTAINS_KEY")
|
|
84
|
+
return t ? E({
|
|
85
|
+
...o,
|
|
86
|
+
referencePath: [...o.referencePath ?? [], {
|
|
87
|
+
path: u.config.key
|
|
88
88
|
}]
|
|
89
|
-
},
|
|
90
|
-
}).flat().filter((
|
|
89
|
+
}, u.config.dataTypeIdentifier, n) : void 0;
|
|
90
|
+
}).flat().filter((u) => !!u) ?? [], {
|
|
91
|
+
...o,
|
|
91
92
|
__typename: "ReferenceValue",
|
|
92
|
-
nodeFunctionId:
|
|
93
|
-
|
|
93
|
+
nodeFunctionId: o.nodeFunctionId,
|
|
94
|
+
dataTypeIdentifier: t
|
|
94
95
|
}] : [];
|
|
95
|
-
}, $ = (
|
|
96
|
-
const t =
|
|
97
|
-
return
|
|
98
|
-
if (!t || !
|
|
99
|
-
let
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
104
|
-
let
|
|
105
|
-
for (;
|
|
106
|
-
const
|
|
107
|
-
if (!
|
|
108
|
-
if (
|
|
109
|
-
for (const
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
|
|
96
|
+
}, $ = (o) => {
|
|
97
|
+
const t = g(R), n = g(B), d = g(G), m = I(B), u = I(G), M = I(R), s = f.useMemo(() => n.getById(o), [o, m]);
|
|
98
|
+
return f.useMemo(() => {
|
|
99
|
+
if (!t || !n || !d || !s?.startingNodeId) return;
|
|
100
|
+
let N = 0;
|
|
101
|
+
const l = () => ++N;
|
|
102
|
+
let D = 0;
|
|
103
|
+
const S = () => ++D, h = [], i = (r, T, e) => {
|
|
104
|
+
if (!r) return;
|
|
105
|
+
let c = r.__typename === "NodeFunctionIdWrapper" ? n.getNodeById(o, r.id) : r;
|
|
106
|
+
for (; c; ) {
|
|
107
|
+
const a = d.getById(c.functionDefinition?.id);
|
|
108
|
+
if (!a) break;
|
|
109
|
+
if (c.parameters && a.parameterDefinitions)
|
|
110
|
+
for (const p of a.parameterDefinitions) {
|
|
111
|
+
const x = t.getDataType(p.dataTypeIdentifier), v = c.parameters?.nodes?.find((w) => w?.parameterDefinition?.id === p.id);
|
|
112
|
+
if (x?.variant === "NODE") {
|
|
113
|
+
if (v?.value && v.value.__typename === "NodeFunctionIdWrapper") {
|
|
114
|
+
const w = [...e, l()];
|
|
115
|
+
i(v.value, T + 1, w);
|
|
115
116
|
}
|
|
116
|
-
} else
|
|
117
|
+
} else v?.value && v.value.__typename === "NodeFunctionIdWrapper" && i(v.value, T, e);
|
|
117
118
|
}
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
node:
|
|
121
|
-
depth:
|
|
122
|
-
scope:
|
|
123
|
-
nodeFunctionId:
|
|
124
|
-
}),
|
|
119
|
+
const F = S();
|
|
120
|
+
h.push({
|
|
121
|
+
node: F,
|
|
122
|
+
depth: T,
|
|
123
|
+
scope: e,
|
|
124
|
+
nodeFunctionId: c.id
|
|
125
|
+
}), c = n.getNodeById(s.id, c.nextNodeId);
|
|
125
126
|
}
|
|
126
127
|
};
|
|
127
|
-
return
|
|
128
|
-
}, [t,
|
|
128
|
+
return i(n.getNodeById(s.id, s.startingNodeId), 0, [0]), h;
|
|
129
|
+
}, [t, s, o, n, d, M, m, u]) ?? [];
|
|
129
130
|
};
|
|
130
131
|
export {
|
|
131
|
-
|
|
132
|
+
pe as useReferenceSuggestions
|
|
132
133
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { MenuTrigger as
|
|
4
|
-
import
|
|
5
|
-
import { DFlowSuggestionMenuFooter as B } from "./DFlowSuggestionMenuFooter.js";
|
|
1
|
+
import { jsx as m, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { c as F } from "../../_virtual/compiler-runtime.js";
|
|
3
|
+
import { MenuTrigger as j, MenuPortal as k, Menu as v } from "../menu/Menu.js";
|
|
4
|
+
import D from "react";
|
|
6
5
|
import "@radix-ui/react-checkbox";
|
|
7
6
|
import "merge-props";
|
|
8
7
|
import "js-md5";
|
|
@@ -10,64 +9,58 @@ import "@tabler/icons-react";
|
|
|
10
9
|
import '../../assets/components/form/Input.style.css';/* empty css */
|
|
11
10
|
import "../form/EmailInput.js";
|
|
12
11
|
import "../form/Input.js";
|
|
13
|
-
import { InputSuggestionMenuContentItems as
|
|
12
|
+
import { InputSuggestionMenuContentItems as A, InputSuggestionMenuContent as E } from "../form/InputSuggestion.js";
|
|
14
13
|
import "../form/NumberInput.js";
|
|
15
14
|
import "../form/PasswordInput.js";
|
|
16
15
|
import "@radix-ui/react-one-time-password-field";
|
|
17
16
|
import "@radix-ui/react-radio-group";
|
|
18
17
|
import "../form/SwitchInput.js";
|
|
19
18
|
import "../form/TextInput.js";
|
|
20
|
-
import { toInputSuggestions as
|
|
21
|
-
import { DFlowSuggestionMenuSearchBar as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
import { toInputSuggestions as z } from "./DFlowSuggestionMenu.util.js";
|
|
20
|
+
import { DFlowSuggestionMenuSearchBar as B } from "./DFlowSuggestionMenuSearchBar.js";
|
|
21
|
+
import { Card as L } from "../card/Card.js";
|
|
22
|
+
const it = (y) => {
|
|
23
|
+
const t = F.c(22), {
|
|
24
|
+
suggestions: p,
|
|
25
|
+
triggerContent: S,
|
|
26
|
+
onSuggestionSelect: M
|
|
27
|
+
} = y;
|
|
28
|
+
let g;
|
|
29
|
+
t[0] !== p ? (g = p === void 0 ? [] : p, t[0] = p, t[1] = g) : g = t[1];
|
|
30
|
+
const e = g, d = M === void 0 ? P : M, h = D.useRef(null), [x, I] = D.useState(e);
|
|
31
|
+
let c, f;
|
|
32
|
+
t[2] !== e ? (c = () => {
|
|
33
|
+
I(e);
|
|
34
|
+
}, f = [e], t[2] = e, t[3] = c, t[4] = f) : (c = t[3], f = t[4]), D.useEffect(c, f);
|
|
35
|
+
let r;
|
|
36
|
+
t[5] !== S ? (r = /* @__PURE__ */ m(j, { asChild: !0, children: S }), t[5] = S, t[6] = r) : r = t[6];
|
|
35
37
|
let i;
|
|
36
|
-
|
|
38
|
+
t[7] !== e ? (i = /* @__PURE__ */ m(B, { onType: (o) => {
|
|
39
|
+
o.key === "ArrowDown" ? (o.preventDefault(), h.current?.focusFirstItem()) : o.key === "ArrowUp" && (o.preventDefault(), h.current?.focusLastItem());
|
|
40
|
+
const C = o.target.value;
|
|
41
|
+
return I(e.filter((R) => R.displayText.some((T) => T.includes(C)))), o.preventDefault(), !1;
|
|
42
|
+
} }), t[7] = e, t[8] = i) : i = t[8];
|
|
37
43
|
let s;
|
|
38
|
-
|
|
39
|
-
o.key === "ArrowDown" ? (o.preventDefault(), w.current?.focusFirstItem()) : o.key === "ArrowUp" && (o.preventDefault(), w.current?.focusLastItem());
|
|
40
|
-
const T = o.target.value;
|
|
41
|
-
return F(t.filter((b) => b.displayText.some((j) => j.includes(T)))), o.preventDefault(), !1;
|
|
42
|
-
} }), e[7] = t, e[8] = s) : s = e[8];
|
|
43
|
-
let a;
|
|
44
|
-
e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ r(C, {}), e[9] = a) : a = e[9];
|
|
44
|
+
t[9] !== x ? (s = z(x), t[9] = x, t[10] = s) : s = t[10];
|
|
45
45
|
let n;
|
|
46
|
-
|
|
46
|
+
t[11] !== d ? (n = (o) => {
|
|
47
|
+
d(o.valueData);
|
|
48
|
+
}, t[11] = d, t[12] = n) : n = t[12];
|
|
47
49
|
let l;
|
|
48
|
-
|
|
49
|
-
D(o.valueData);
|
|
50
|
-
}, e[12] = D, e[13] = l) : l = e[13];
|
|
50
|
+
t[13] !== s || t[14] !== n ? (l = /* @__PURE__ */ m(L, { paddingSize: "xxs", mt: -0.2, mx: -0.2, children: /* @__PURE__ */ m(A, { ref: h, suggestions: s, onSuggestionSelect: n }) }), t[13] = s, t[14] = n, t[15] = l) : l = t[15];
|
|
51
51
|
let u;
|
|
52
|
-
|
|
53
|
-
let S, d;
|
|
54
|
-
e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ r(C, {}), d = /* @__PURE__ */ r(B, {}), e[17] = S, e[18] = d) : (S = e[17], d = e[18]);
|
|
55
|
-
let m;
|
|
56
|
-
e[19] !== u || e[20] !== s ? (m = /* @__PURE__ */ r(A, { children: /* @__PURE__ */ _(P, { align: "center", children: [
|
|
57
|
-
s,
|
|
58
|
-
a,
|
|
59
|
-
u,
|
|
60
|
-
S,
|
|
61
|
-
d
|
|
62
|
-
] }) }), e[19] = u, e[20] = s, e[21] = m) : m = e[21];
|
|
63
|
-
let h;
|
|
64
|
-
return e[22] !== m || e[23] !== i ? (h = /* @__PURE__ */ _(E, { children: [
|
|
52
|
+
t[16] !== i || t[17] !== l ? (u = /* @__PURE__ */ m(k, { children: /* @__PURE__ */ w(E, { align: "center", color: "secondary", children: [
|
|
65
53
|
i,
|
|
66
|
-
|
|
67
|
-
] }),
|
|
54
|
+
l
|
|
55
|
+
] }) }), t[16] = i, t[17] = l, t[18] = u) : u = t[18];
|
|
56
|
+
let a;
|
|
57
|
+
return t[19] !== u || t[20] !== r ? (a = /* @__PURE__ */ w(v, { children: [
|
|
58
|
+
r,
|
|
59
|
+
u
|
|
60
|
+
] }), t[19] = u, t[20] = r, t[21] = a) : a = t[21], a;
|
|
68
61
|
};
|
|
69
|
-
function
|
|
62
|
+
function P() {
|
|
70
63
|
}
|
|
71
64
|
export {
|
|
72
|
-
|
|
65
|
+
it as DFlowSuggestionMenu
|
|
73
66
|
};
|
|
@@ -1,58 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DFlowDataTypeReactiveService as
|
|
3
|
-
import { DataTypeView as
|
|
4
|
-
import { useService as
|
|
5
|
-
import { InspectionSeverity as
|
|
1
|
+
import V from "react";
|
|
2
|
+
import { DFlowDataTypeReactiveService as x } from "../d-flow-data-type/DFlowDataType.service.js";
|
|
3
|
+
import { DataTypeView as q } from "../d-flow-data-type/DFlowDataType.view.js";
|
|
4
|
+
import { useService as _, useStore as R } from "../../utils/contextStore.js";
|
|
5
|
+
import { InspectionSeverity as z } from "../../utils/inspection.js";
|
|
6
6
|
import "merge-props";
|
|
7
7
|
import "js-md5";
|
|
8
|
-
import { resolveGenericKeys as
|
|
9
|
-
import { useReturnType as
|
|
10
|
-
import { DFlowFunctionReactiveService as
|
|
11
|
-
import { useDataTypeValidation as
|
|
12
|
-
import { useValueValidation as
|
|
8
|
+
import { resolveGenericKeys as H, replaceGenericKeysInType as J, replaceGenericKeysInDataTypeObject as L } from "../../utils/generics.js";
|
|
9
|
+
import { useReturnType as Q } from "../d-flow-function/DFlowFunction.return.hook.js";
|
|
10
|
+
import { DFlowFunctionReactiveService as E } from "../d-flow-function/DFlowFunction.service.js";
|
|
11
|
+
import { useDataTypeValidation as G } from "./DDataTypeValidation.hook.js";
|
|
12
|
+
import { useValueValidation as O } from "./DValueValidation.hook.js";
|
|
13
13
|
import "../d-flow/DFlow.js";
|
|
14
14
|
import { DFlowReactiveService as M } from "../d-flow/DFlow.service.js";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import { getReferenceType as X } from "../d-flow-node/DFlowNodeReference.return.hook.js";
|
|
16
|
+
import { DFlowTypeReactiveService as W } from "../d-flow-type/DFlowType.service.js";
|
|
17
|
+
const F = (r) => r.__typename === "ReferenceValue", I = (r) => r.__typename === "NodeFunctionIdWrapper", b = (r, i) => new q(L(r.json, i)), j = (r, i, n) => ({
|
|
18
|
+
parameterId: r,
|
|
19
|
+
type: z.ERROR,
|
|
18
20
|
message: [{
|
|
19
21
|
code: "en-US",
|
|
20
|
-
content: `Argument of type ${
|
|
22
|
+
content: `Argument of type ${n?.name[0]?.content} is not assignable to parameter of type ${i?.name[0]?.content}`
|
|
21
23
|
}]
|
|
22
|
-
}),
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
return
|
|
24
|
+
}), ue = (r, i) => {
|
|
25
|
+
const n = _(E), $ = R(E), y = _(M), N = R(M), k = _(W), A = R(W), o = _(x), B = R(x), s = y.getById(i), T = y.getNodeById(i, r), g = T?.parameters?.nodes?.map((e) => e?.value) ?? [], f = n.getById(T?.functionDefinition?.id), S = f?.parameterDefinitions ?? [], w = f?.genericKeys ?? [], D = V.useMemo(() => H(f, g, o, n, s), [f, g, o, B, s, N]), K = V.useCallback((e, p) => {
|
|
26
|
+
if (I(e) && p?.variant !== "NODE") {
|
|
27
|
+
const a = y.getNodeById(i, e.__typename == "NodeFunctionIdWrapper" ? e.id : e.__typename === "ReferenceValue" ? e.nodeFunctionId : void 0), t = n.getById(a?.functionDefinition?.id), m = a?.parameters?.nodes?.map((d) => d?.value) ?? [];
|
|
28
|
+
return Q(t, m, o, n);
|
|
29
|
+
} else if (F(e)) {
|
|
30
|
+
const a = y.getNodeById(i, e.__typename == "NodeFunctionIdWrapper" ? e.id : e.__typename === "ReferenceValue" ? e.nodeFunctionId : void 0), t = n.getById(a?.functionDefinition?.id), m = k.getById(s?.type?.id)?.json();
|
|
31
|
+
return X(e, o, n, t, a, m);
|
|
27
32
|
}
|
|
28
|
-
return
|
|
29
|
-
}, [
|
|
30
|
-
return
|
|
33
|
+
return o.getTypeFromValue(e, s);
|
|
34
|
+
}, [o, s, i, y, n, A]);
|
|
35
|
+
return V.useMemo(() => {
|
|
31
36
|
const e = [];
|
|
32
|
-
for (let
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
const
|
|
36
|
-
if (!c || !
|
|
37
|
-
e.push(
|
|
37
|
+
for (let p = 0; p < S.length; p++) {
|
|
38
|
+
const a = S[p], t = g[p], m = T?.parameters?.nodes?.find((v) => v?.parameterDefinition?.id === a.id);
|
|
39
|
+
if (!t) continue;
|
|
40
|
+
const d = a.dataTypeIdentifier, h = J(d, D), c = o.getDataType(h), C = K(t, c), u = o.getDataType(C);
|
|
41
|
+
if (!c || !u) {
|
|
42
|
+
e.push(j(m?.id, c, u));
|
|
38
43
|
continue;
|
|
39
44
|
}
|
|
40
|
-
const
|
|
41
|
-
let
|
|
42
|
-
if (
|
|
45
|
+
const P = !!d?.genericType || !!d?.genericKey && w.includes(d.genericKey);
|
|
46
|
+
let l = !0;
|
|
47
|
+
if (P) {
|
|
43
48
|
const v = b(c, D);
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
|
|
49
|
+
if (F(t) || I(t) && c.variant !== "NODE") {
|
|
50
|
+
const U = b(u, D);
|
|
51
|
+
l = G(v, U);
|
|
47
52
|
} else
|
|
48
|
-
|
|
53
|
+
l = O(t, v, o, s, h?.genericType?.genericMappers, n);
|
|
49
54
|
} else
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
F(t) || I(t) && c.variant !== "NODE" ? l = G(c, u) : l = O(t, c, o, s, [], n);
|
|
56
|
+
l || e.push(j(m?.id, c, u));
|
|
52
57
|
}
|
|
53
58
|
return e.length > 0 ? e : null;
|
|
54
|
-
}, [s,
|
|
59
|
+
}, [s, T, g, f, S, w, D, K, r, i, $, N, B, o]);
|
|
55
60
|
};
|
|
56
61
|
export {
|
|
57
|
-
|
|
62
|
+
ue as useNodeValidation
|
|
58
63
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import m, { isValidElement as ce } from "react";
|
|
3
|
-
import { createPortal as
|
|
3
|
+
import { createPortal as K } from "react-dom";
|
|
4
4
|
import "../../utils/contextStore.js";
|
|
5
5
|
import { mergeCode0Props as ue } from "../../utils/utils.js";
|
|
6
|
-
import de, { Prec as
|
|
6
|
+
import de, { Prec as _, keymap as J, ViewPlugin as me, RangeSetBuilder as he, Decoration as F, EditorView as fe, WidgetType as ge } from "@uiw/react-codemirror";
|
|
7
7
|
import { json as pe, jsonParseLinter as ye } from "@codemirror/lang-json";
|
|
8
8
|
import { syntaxTree as L } from "@codemirror/language";
|
|
9
9
|
import { linter as be } from "@codemirror/lint";
|
|
@@ -15,7 +15,7 @@ import { tags as b, getStyleTags as Te } from "../../node_modules/@lezer/highlig
|
|
|
15
15
|
import { hashToColor as v } from "../d-flow/DFlow.util.js";
|
|
16
16
|
import '../../assets/components/editor/Editor.styles.css';/* empty css */
|
|
17
17
|
import { Badge as y } from "../badge/Badge.js";
|
|
18
|
-
import { IconExclamationCircle as
|
|
18
|
+
import { IconExclamationCircle as Ae, IconAlertTriangle as xe, IconAlertSquareRounded as ke, IconInfoCircle as Ee, IconSpace as ze, IconArrowBarToRight as Pe, IconCornerDownLeft as je } from "@tabler/icons-react";
|
|
19
19
|
import { Text as a } from "../text/Text.js";
|
|
20
20
|
import { Flex as k } from "../flex/Flex.js";
|
|
21
21
|
import { Tooltip as E, TooltipTrigger as z, TooltipPortal as P, TooltipContent as j, TooltipArrow as V } from "../tooltip/Tooltip.js";
|
|
@@ -140,10 +140,10 @@ const Fe = Ce({
|
|
|
140
140
|
} : {
|
|
141
141
|
override: [w]
|
|
142
142
|
}
|
|
143
|
-
})), e.push(
|
|
143
|
+
})), e.push(_.highest(J.of([{
|
|
144
144
|
key: "Tab",
|
|
145
145
|
run: Re
|
|
146
|
-
}]))), D && e.push(
|
|
146
|
+
}]))), D && e.push(_.highest(J.of([{
|
|
147
147
|
key: "ArrowUp",
|
|
148
148
|
run: (l) => (f || N(l), !0)
|
|
149
149
|
}, {
|
|
@@ -165,15 +165,15 @@ const Fe = Ce({
|
|
|
165
165
|
const l = new he(), u = Object.keys(g || {});
|
|
166
166
|
return L(o.state).iterate({
|
|
167
167
|
enter: (d) => {
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
168
|
+
const A = o.state.doc.sliceString(d.from, d.to);
|
|
169
|
+
if (A.includes(`
|
|
170
170
|
`)) return;
|
|
171
|
-
const q = h?.(
|
|
172
|
-
|
|
173
|
-
widget: new X(
|
|
171
|
+
const q = h?.(A), ae = Te(d)?.tags.map((x) => "name" in x ? x.name : void 0), H = u.find((x) => ae?.includes(x));
|
|
172
|
+
H && !q ? l.add(d.from, d.to, F.replace({
|
|
173
|
+
widget: new X(H, A),
|
|
174
174
|
point: !0
|
|
175
175
|
})) : q && l.add(d.from, d.to, F.replace({
|
|
176
|
-
widget: new X(q,
|
|
176
|
+
widget: new X(q, A),
|
|
177
177
|
point: !0
|
|
178
178
|
}));
|
|
179
179
|
}
|
|
@@ -237,7 +237,7 @@ const Fe = Ce({
|
|
|
237
237
|
}, align: "center", children: [
|
|
238
238
|
c.filter((e) => e.severity == "error").length > 0 ? /* @__PURE__ */ s(E, { children: [
|
|
239
239
|
/* @__PURE__ */ t(z, { asChild: !0, children: /* @__PURE__ */ s(y, { color: "red", children: [
|
|
240
|
-
/* @__PURE__ */ t(
|
|
240
|
+
/* @__PURE__ */ t(Ae, { size: 13 }),
|
|
241
241
|
/* @__PURE__ */ t(a, { children: c.filter((e) => e.severity == "error").length })
|
|
242
242
|
] }) }),
|
|
243
243
|
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ s(j, { side: "bottom", children: [
|
|
@@ -247,7 +247,7 @@ const Fe = Ce({
|
|
|
247
247
|
] }) : null,
|
|
248
248
|
c.filter((e) => e.severity == "warning").length > 0 ? /* @__PURE__ */ s(E, { children: [
|
|
249
249
|
/* @__PURE__ */ t(z, { asChild: !0, children: /* @__PURE__ */ s(y, { color: "orange", children: [
|
|
250
|
-
/* @__PURE__ */ t(
|
|
250
|
+
/* @__PURE__ */ t(xe, { size: 13 }),
|
|
251
251
|
/* @__PURE__ */ t(a, { children: c.filter((e) => e.severity == "warning").length })
|
|
252
252
|
] }) }),
|
|
253
253
|
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ s(j, { side: "bottom", children: [
|
|
@@ -316,13 +316,13 @@ const Fe = Ce({
|
|
|
316
316
|
}, onUpdate: M, basicSetup: ee }),
|
|
317
317
|
g && Array.from(oe.entries()).map(([e, n]) => {
|
|
318
318
|
const o = g[n.type];
|
|
319
|
-
return o ?
|
|
319
|
+
return o ? K(/* @__PURE__ */ t("div", { style: {
|
|
320
320
|
display: "contents"
|
|
321
321
|
}, children: o({
|
|
322
322
|
content: n.value
|
|
323
323
|
}) }, e.outerHTML + n.value), e) : null;
|
|
324
324
|
}),
|
|
325
|
-
f &&
|
|
325
|
+
f && K(/* @__PURE__ */ t("div", { ref: B, style: {
|
|
326
326
|
position: "fixed",
|
|
327
327
|
top: f.position.top,
|
|
328
328
|
left: f.position.left,
|