@code0-tech/pictor 0.0.0-mvp.44 → 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.
Files changed (37) hide show
  1. package/dist/assets/components/d-flow-input/DFlowInputDataType.style.css +1 -1
  2. package/dist/assets/components/d-flow-suggestion/DFlowSuggestionSearchInput.style.css +1 -1
  3. package/dist/assets/components/menu/Menu.style.css +1 -1
  4. package/dist/components/d-flow/DFlow.service.js +31 -23
  5. package/dist/components/d-flow-data-type/DFlowDataType.service.d.ts +2 -2
  6. package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js +22 -13
  7. package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js +19 -13
  8. package/dist/components/d-flow-file/DFlowTabDefault.js +38 -37
  9. package/dist/components/d-flow-file/DFlowTabTrigger.js +1 -1
  10. package/dist/components/d-flow-file/DFlowTabs.js +57 -105
  11. package/dist/components/d-flow-input/DFlowInput.d.ts +11 -0
  12. package/dist/components/d-flow-input/DFlowInput.js +29 -0
  13. package/dist/components/d-flow-input/DFlowInputDefault.d.ts +2 -7
  14. package/dist/components/d-flow-input/DFlowInputNodeBadge.js +13 -13
  15. package/dist/components/d-flow-input/DFlowInputObject.d.ts +10 -0
  16. package/dist/components/d-flow-input/DFlowInputObject.js +83 -0
  17. package/dist/components/d-flow-input/DFlowInputObjectEditDialog.d.ts +16 -0
  18. package/dist/components/d-flow-input/DFlowInputObjectEditDialog.js +118 -0
  19. package/dist/components/d-flow-input/DFlowInputObjectTree.d.ts +16 -0
  20. package/dist/components/d-flow-input/DFlowInputObjectTree.js +99 -0
  21. package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +12 -12
  22. package/dist/components/d-flow-node/DFlowNodeReference.return.hook.d.ts +4 -0
  23. package/dist/components/d-flow-node/DFlowNodeReference.return.hook.js +77 -0
  24. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +104 -103
  25. package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +43 -50
  26. package/dist/components/d-flow-validation/DNodeValidation.hook.js +44 -39
  27. package/dist/components/d-project/DNamespaceProject.view.d.ts +7 -1
  28. package/dist/components/d-project/DNamespaceProject.view.js +7 -1
  29. package/dist/components/editor/Editor.js +15 -15
  30. package/dist/components/form/InputSuggestion.js +29 -29
  31. package/dist/components/form/useForm.d.ts +3 -3
  32. package/dist/components/form/useForm.js +16 -16
  33. package/dist/node_modules/prettier/plugins/babel.js +6674 -6685
  34. package/dist/node_modules/prettier/plugins/estree.js +2830 -2628
  35. package/dist/node_modules/prettier/standalone.js +1657 -1440
  36. package/dist/utils/generics.js +85 -97
  37. package/package.json +26 -26
@@ -0,0 +1,99 @@
1
+ import { jsx as t, jsxs as u } from "react/jsx-runtime";
2
+ import N from "react";
3
+ import { IconChevronUp as w, IconChevronDown as R } from "@tabler/icons-react";
4
+ import { Flex as j } from "../flex/Flex.js";
5
+ import { Text as a } from "../text/Text.js";
6
+ import "../../utils/contextStore.js";
7
+ import { hashToColor as I } from "../../utils/utils.js";
8
+ import { Badge as A } from "../badge/Badge.js";
9
+ const F = (O) => {
10
+ const {
11
+ object: g,
12
+ parentKey: v,
13
+ isRoot: p = !v,
14
+ onEntryClick: _,
15
+ collapsedState: d,
16
+ setCollapsedState: y,
17
+ path: m = [],
18
+ activePath: i = null,
19
+ onDoubleClick: x,
20
+ parentColor: E
21
+ } = O, o = p ? g?.value : g;
22
+ if (typeof o != "object" || o === null) return null;
23
+ const n = N.useRef(null), S = 250, T = (e) => {
24
+ n.current && clearTimeout(n.current), n.current = setTimeout(() => {
25
+ _(e), n.current = null;
26
+ }, S);
27
+ }, k = (e, r) => {
28
+ n.current && (clearTimeout(n.current), n.current = null), x ? x(e, r) : y(e, !r);
29
+ };
30
+ N.useEffect(() => {
31
+ const e = m ?? [], r = (p ? ["root"] : e).join(".");
32
+ e.length > 1 && d[r] === void 0 && y(e.length === 0 ? ["root"] : e, !0);
33
+ }, [m, p, d, y]);
34
+ const W = () => {
35
+ const e = [...m], r = "root", l = d[r] || !1, h = typeof o == "object" && o !== null && (Array.isArray(o) ? o.length > 0 : Object.keys(o).length > 0), c = Array.isArray(i) && i.length === 0 && v === void 0;
36
+ return /* @__PURE__ */ u("div", { onClick: (s) => {
37
+ s.stopPropagation(), T({
38
+ key: r,
39
+ value: g,
40
+ path: e
41
+ });
42
+ }, onDoubleClick: (s) => {
43
+ s.stopPropagation(), k(e, l);
44
+ }, "aria-selected": c || void 0, children: [
45
+ /* @__PURE__ */ u(j, { align: "center", style: {
46
+ gap: ".35rem",
47
+ textWrap: "nowrap"
48
+ }, "aria-selected": c || void 0, className: "rule", children: [
49
+ h ? l ? /* @__PURE__ */ t(w, { size: 13 }) : /* @__PURE__ */ t(R, { size: 13 }) : null,
50
+ /* @__PURE__ */ t(a, { hierarchy: "tertiary", children: Array.isArray(o) ? "is a list of" : "is a nested object" })
51
+ ] }),
52
+ !l && /* @__PURE__ */ t("ul", { children: z })
53
+ ] });
54
+ }, z = Array.isArray(o) || o && typeof o == "object" ? Object.entries(o).map(([e, r]) => {
55
+ const l = [...m, e], h = l.join("."), c = d[h] || !1, b = i && i.length > 0 && l.join(".") === i.join("."), s = E ?? I("root"), f = typeof r == "object" && r !== null && (Array.isArray(r) ? r.length > 0 : Object.keys(r ?? {}).length > 0), K = f ? I(h) : s, B = f ? /* @__PURE__ */ u(j, { align: "center", style: {
56
+ gap: ".35rem",
57
+ textWrap: "nowrap"
58
+ }, className: "rule", "aria-selected": b || void 0, children: [
59
+ f ? c ? /* @__PURE__ */ t(w, { size: 13 }) : /* @__PURE__ */ t(R, { size: 13 }) : null,
60
+ /* @__PURE__ */ t(A, { border: !0, color: K, style: {
61
+ verticalAlign: "middle"
62
+ }, children: /* @__PURE__ */ t(a, { size: "xs", style: {
63
+ color: "inherit"
64
+ }, children: e }) }),
65
+ /* @__PURE__ */ t(a, { hierarchy: "tertiary", children: Array.isArray(r) ? "is a list of" : "is a nested object" })
66
+ ] }) : /* @__PURE__ */ u(j, { align: "center", style: {
67
+ gap: ".35rem",
68
+ textWrap: "nowrap"
69
+ }, className: "rule", "aria-selected": b || void 0, children: [
70
+ /* @__PURE__ */ t(A, { border: !0, color: s, style: {
71
+ verticalAlign: "middle"
72
+ }, children: /* @__PURE__ */ t(a, { size: "xs", style: {
73
+ color: "inherit"
74
+ }, children: e }) }),
75
+ /* @__PURE__ */ t(a, { hierarchy: "tertiary", children: "has value" }),
76
+ /* @__PURE__ */ t(A, { border: !0, color: "tertiary", style: {
77
+ verticalAlign: "middle"
78
+ }, children: /* @__PURE__ */ t(a, { size: "xs", style: {
79
+ color: "inherit"
80
+ }, children: String(r) }) })
81
+ ] });
82
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ u("div", { onClick: (C) => {
83
+ C.stopPropagation(), T({
84
+ key: e,
85
+ value: r,
86
+ path: l
87
+ });
88
+ }, onDoubleClick: (C) => {
89
+ C.stopPropagation(), k(l, c);
90
+ }, children: [
91
+ B,
92
+ f && !c ? /* @__PURE__ */ t(F, { object: r, parentKey: e, isRoot: !1, onEntryClick: _, collapsedState: d, setCollapsedState: y, path: l, activePath: i, parentColor: K }) : null
93
+ ] }) }, h);
94
+ }) : null, D = W(), P = ((D && p ? [D] : z) ?? []).filter(Boolean);
95
+ return P.length === 0 ? null : /* @__PURE__ */ t("ul", { children: P });
96
+ };
97
+ export {
98
+ F as DFlowInputObjectTree
99
+ };
@@ -1,29 +1,29 @@
1
- import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
- import { Badge as c } from "../badge/Badge.js";
3
- import m from "react";
4
- import { Text as a } from "../text/Text.js";
1
+ import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
+ import { Badge as m } from "../badge/Badge.js";
3
+ import a from "react";
4
+ import { Text as c } from "../text/Text.js";
5
5
  import { Flex as f } from "../flex/Flex.js";
6
6
  import { DFlowInputNodeBadge as u } from "./DFlowInputNodeBadge.js";
7
7
  import { IconVariable as s } from "@tabler/icons-react";
8
8
  const T = (t) => {
9
9
  const {
10
10
  value: e,
11
- flowId: r,
11
+ flowId: n,
12
12
  definition: o,
13
13
  ...d
14
- } = t, p = m.useMemo(() => e.nodeFunctionId && r ? /* @__PURE__ */ i(f, { align: "center", display: "inline-flex", children: [
15
- /* @__PURE__ */ n(u, { definition: o, value: {
14
+ } = t, p = a.useMemo(() => n ? /* @__PURE__ */ i(f, { align: "center", display: "inline-flex", children: [
15
+ /* @__PURE__ */ r(u, { definition: o, value: {
16
16
  id: e.nodeFunctionId,
17
17
  __typename: "NodeFunctionIdWrapper"
18
- }, flowId: r }),
18
+ }, flowId: n }),
19
19
  "inputTypeIdentifier" in e && e.inputTypeIdentifier ? "." + e.inputTypeIdentifier : "",
20
20
  e.referencePath ? "." + (e.referencePath?.map((l) => l.path).join(".") ?? "") : ""
21
- ] }) : "undefineds", [e]);
22
- return /* @__PURE__ */ i(c, { style: {
21
+ ] }) : "undefined", [e]);
22
+ return /* @__PURE__ */ i(m, { style: {
23
23
  verticalAlign: "middle"
24
24
  }, color: "warning", py: "0", border: !0, ...d, children: [
25
- /* @__PURE__ */ n(s, { size: 12 }),
26
- /* @__PURE__ */ n(a, { size: "sm", style: {
25
+ /* @__PURE__ */ r(s, { size: 12 }),
26
+ /* @__PURE__ */ r(c, { size: "sm", style: {
27
27
  color: "inherit"
28
28
  }, children: p })
29
29
  ] });
@@ -0,0 +1,4 @@
1
+ import { DataTypeIdentifier, FlowType, NodeFunction, ReferenceValue } from '@code0-tech/sagittarius-graphql-types';
2
+ import { DFlowFunctionReactiveService, FunctionDefinitionView } from '../d-flow-function';
3
+ import { DFlowDataTypeReactiveService } from '../d-flow-data-type';
4
+ export declare const getReferenceType: (reference: ReferenceValue, dataTypeService: DFlowDataTypeReactiveService, functionService: DFlowFunctionReactiveService, functionDefinition?: FunctionDefinitionView, node?: NodeFunction, flowType?: FlowType) => DataTypeIdentifier | undefined;
@@ -0,0 +1,77 @@
1
+ import { resolveGenericKeys as M, targetForGenericKey as T, replaceGenericKeysInType as h, resolveType as m } from "../../utils/generics.js";
2
+ const G = (e, o, c, D, f, y) => {
3
+ let t, g = /* @__PURE__ */ new Map();
4
+ if (e.nodeFunctionId && (e.inputIndex === void 0 || e.parameterIndex === void 0)) {
5
+ const n = D;
6
+ if (n && n.returnType) {
7
+ if (t = n.returnType, f && f.parameters && n.parameterDefinitions) {
8
+ const r = f.parameters.nodes?.map((a) => a?.value).filter(Boolean);
9
+ if (g = M(n, r, o, c), t) {
10
+ const a = T(n, t), l = new Map(Array.from(g.entries()).filter(([, i]) => i && i.__typename === "DataTypeIdentifier")), p = new Map([...l.entries()].map(([i, u]) => [a.get(i) ?? i, u]));
11
+ t = h(t, p);
12
+ }
13
+ }
14
+ t = t ? m(t, o) : void 0;
15
+ }
16
+ }
17
+ if (e.nodeFunctionId && e.inputIndex !== void 0 && e.inputIndex !== null && e.parameterIndex !== void 0 && e.parameterIndex !== null) {
18
+ const n = D;
19
+ if (n && n.parameterDefinitions) {
20
+ const r = n.parameterDefinitions[e.parameterIndex];
21
+ if (r && r.dataTypeIdentifier) {
22
+ const a = o.getDataType(r.dataTypeIdentifier);
23
+ if (a && a.rules?.nodes) {
24
+ const l = a.rules.nodes.find((p) => p?.variant === "INPUT_TYPES");
25
+ if (l && l.config) {
26
+ const p = l.config;
27
+ if (Array.isArray(p.inputTypes) && e.inputIndex !== void 0 && e.inputIndex !== null) {
28
+ const i = p.inputTypes[e.inputIndex];
29
+ if (i && i.dataTypeIdentifier) {
30
+ if (t = i.dataTypeIdentifier, f && f.parameters && n.parameterDefinitions && t) {
31
+ const u = f.parameters.nodes?.map((d) => d?.value).filter(Boolean);
32
+ g = M(n, u, o, c);
33
+ const s = T(n, t), I = new Map(Array.from(g.entries()).filter(([, d]) => d && d.__typename === "DataTypeIdentifier")), v = new Map([...I.entries()].map(([d, _]) => [s.get(d) ?? d, _]));
34
+ t = h(t, v);
35
+ }
36
+ t = t ? m(t, o) : void 0;
37
+ }
38
+ }
39
+ }
40
+ }
41
+ if (!t) {
42
+ if (t = r.dataTypeIdentifier, f && f.parameters && n.parameterDefinitions && t) {
43
+ const l = f.parameters.nodes?.map((s) => s?.value).filter(Boolean);
44
+ g = M(n, l, o, c);
45
+ const p = T(n, t), i = new Map(Array.from(g.entries()).filter(([, s]) => s && s.__typename === "DataTypeIdentifier")), u = new Map([...i.entries()].map(([s, I]) => [p.get(s) ?? s, I]));
46
+ t = h(t, u);
47
+ }
48
+ t = t ? m(t, o) : void 0;
49
+ }
50
+ }
51
+ }
52
+ }
53
+ !e.nodeFunctionId && y && y.inputType && (t = {
54
+ dataType: y.inputType
55
+ }, t = t ? m(t, o) : void 0);
56
+ function x(n, r) {
57
+ if (!n || !r || r.length === 0) return n;
58
+ const [a, ...l] = r, p = n.dataType ? o.getDataType(n) : n.genericType?.dataType;
59
+ if (!p || !p.rules?.nodes) return n;
60
+ const i = p.rules.nodes.find((s) => s?.variant === "CONTAINS_KEY" && s.config?.key === a.path);
61
+ if (!i || !i.config) return n;
62
+ const u = i.config;
63
+ return u.dataTypeIdentifier ? x(u.dataTypeIdentifier, l) : n;
64
+ }
65
+ if (t && e.referencePath && e.referencePath.length > 0) {
66
+ const n = e.referencePath.map((a) => ({
67
+ path: typeof a.path == "string" ? a.path : void 0
68
+ })).filter((a) => !!a.path);
69
+ if (n.length !== e.referencePath.length) return t ? m(t, o) : void 0;
70
+ const r = x(t, n);
71
+ return r ? m(r, o) : void 0;
72
+ }
73
+ return t ? m(t, o) : void 0;
74
+ };
75
+ export {
76
+ G as getReferenceType
77
+ };
@@ -1,132 +1,133 @@
1
- import g from "react";
2
- import { useService as I, useStore as N } from "../../utils/contextStore.js";
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 x } from "../d-flow-data-type/DFlowDataType.service.js";
6
- import { DFlowSuggestionType as A } from "./DFlowSuggestion.view.js";
7
- import { replaceGenericsAndSortType as C, resolveType as P, isMatchingType as V, resolveGenericKeys as Y, targetForGenericKey as k, replaceGenericKeysInType as J } from "../../utils/generics.js";
8
- import { DFlowFunctionReactiveService as O } from "../d-flow-function/DFlowFunction.service.js";
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 R } from "../d-flow/DFlow.service.js";
11
- import { useReturnTypes as j } from "../d-flow-node/DFlowNode.return.hook.js";
12
- const re = (n, t, o, u = []) => {
13
- const m = I(x), r = N(x), v = I(R), T = N(R), M = $(n), S = g.useMemo(() => t ? M?.find((i) => i.nodeFunctionId === t) : void 0, [M, t]), B = g.useMemo(() => t ? v.getNodeById(n, t)?.parameters?.nodes?.map((a) => a?.value).filter((a) => a?.__typename === "NodeFunctionIdWrapper") ?? [] : [], [n, t, v, T]), c = g.useMemo(() => o ? C(P(o, m), u) : void 0, [o, m, r, u]), p = U(n), f = j(n);
14
- return g.useMemo(() => {
15
- if (!c || !S) return [];
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: a,
19
- node: l
20
- } = S;
21
- return p.flatMap((e) => {
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 d = e.parameterIndex !== void 0 && e.inputTypeIndex !== void 0, D = d ? e.scope?.every((s, F) => a?.[F] === s) : !0;
26
- if (d && !D) return [];
27
- if (B.some((s) => s.id === e.nodeFunctionId)) return [];
28
- if (!d && e.node >= l) return [];
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((s) => !a.includes(s))) return [];
31
- const h = f.get(e.nodeFunctionId), E = C(P(h, m), []);
32
- return V(c, E) ? [{
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: A.REF_OBJECT,
35
- displayText: [`${e.depth}-${e.scope}-${e.node || ""}-${e.referencePath?.map((s) => s.path).join(".") ?? ""}`],
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, S, B, p, c, f]);
40
- }, U = (n) => {
41
- const t = I(x);
42
- N(x);
43
- const o = I(O), u = I(R), m = N(R), r = g.useMemo(() => u.getById(n), [n, m]), v = $(n), T = j(n), M = g.useMemo(() => r?.nodes?.nodes?.map((c) => {
44
- const p = T.get(c?.id), f = v?.find((i) => i.nodeFunctionId === c?.id);
45
- return p && f ? G(f, p, t) : {};
46
- }) ?? [], [r]), S = g.useMemo(() => G({
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: r?.inputType
53
- }), [r]);
54
- return [...g.useMemo(() => r?.nodes?.nodes?.length ? r.nodes.nodes.flatMap((c) => {
55
- const p = o.getById(c?.functionDefinition?.id);
56
- if (!p) return [];
57
- const f = c?.parameters?.nodes?.map((i) => i?.value).filter(Boolean) ?? [];
58
- return (p.parameterDefinitions ?? []).flatMap((i, a) => {
59
- const l = i?.dataTypeIdentifier;
60
- if (!l) return [];
61
- const e = t.getDataType(l);
62
- if (!e || e.variant !== "NODE") return [];
63
- const d = c?.parameters?.nodes?.find((y) => y?.parameterDefinition?.id === i?.id);
64
- if (!d?.value || d.value.__typename !== "NodeFunctionIdWrapper") return [];
65
- const D = v?.find((y) => d?.value?.__typename === "NodeFunctionIdWrapper" && y.nodeFunctionId === d.value?.id);
66
- if (!D) return [];
67
- const h = e.rules?.nodes?.filter((y) => y?.variant === "INPUT_TYPES") ?? [], E = Y(p, f, t, o), s = k(p, l), F = new Map([...E].map(([y, b]) => [s.get(y) ?? y, b]));
68
- return h.flatMap((y) => (y?.config?.inputTypes ?? []).flatMap((W, K) => {
69
- const w = J(W.dataTypeIdentifier, F);
70
- return w ? G({
71
- ...D,
72
- nodeFunctionId: c?.id,
73
- parameterIndex: a,
74
- inputTypeIndex: K,
75
- inputTypeIdentifier: W.inputIdentifier
76
- }, w, t) : [];
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
- }) : [], [r, v, o, t]), ...S, ...M].flat();
80
- }, G = (n, t, o) => {
81
- const u = o ? o.getDataType(t) : t.dataType ?? t.genericType?.dataType;
82
- return u ? [...u.rules?.nodes?.map((r) => {
83
- if (r?.variant === "CONTAINS_KEY")
84
- return t ? G({
85
- ...n,
86
- referencePath: [...n.referencePath ?? [], {
87
- path: r.config.key
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
- }, r.config.dataTypeIdentifier) : void 0;
90
- }).flat().filter((r) => !!r) ?? [], {
89
+ }, u.config.dataTypeIdentifier, n) : void 0;
90
+ }).flat().filter((u) => !!u) ?? [], {
91
+ ...o,
91
92
  __typename: "ReferenceValue",
92
- nodeFunctionId: n.nodeFunctionId,
93
- ...n
93
+ nodeFunctionId: o.nodeFunctionId,
94
+ dataTypeIdentifier: t
94
95
  }] : [];
95
- }, $ = (n) => {
96
- const t = I(x), o = I(R), u = I(O), m = N(R), r = N(O), v = N(x), T = g.useMemo(() => o.getById(n), [n, m]);
97
- return g.useMemo(() => {
98
- if (!t || !o || !u || !T?.startingNodeId) return;
99
- let M = 0;
100
- const S = () => ++M;
101
- let B = 0;
102
- const c = () => ++B, p = [], f = (i, a, l) => {
103
- if (!i) return;
104
- let e = i.__typename === "NodeFunctionIdWrapper" ? o.getNodeById(n, i.id) : i;
105
- for (; e; ) {
106
- const d = u.getById(e.functionDefinition?.id);
107
- if (!d) break;
108
- if (e.parameters && d.parameterDefinitions)
109
- for (const h of d.parameterDefinitions) {
110
- const E = t.getDataType(h.dataTypeIdentifier), s = e.parameters?.nodes?.find((F) => F?.parameterDefinition?.id === h.id);
111
- if (E?.variant === "NODE") {
112
- if (s?.value && s.value.__typename === "NodeFunctionIdWrapper") {
113
- const F = [...l, S()];
114
- f(s.value, a + 1, F);
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 s?.value && s.value.__typename === "NodeFunctionIdWrapper" && f(s.value, a, l);
117
+ } else v?.value && v.value.__typename === "NodeFunctionIdWrapper" && i(v.value, T, e);
117
118
  }
118
- const D = c();
119
- p.push({
120
- node: D,
121
- depth: a,
122
- scope: l,
123
- nodeFunctionId: e.id
124
- }), e = o.getNodeById(T.id, e.nextNodeId);
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 f(o.getNodeById(T.id, T.startingNodeId), 0, [0]), p;
128
- }, [t, T, n, o, u, v, m, r]) ?? [];
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
- re as useReferenceSuggestions
132
+ pe as useReferenceSuggestions
132
133
  };
@@ -1,8 +1,7 @@
1
- import { jsx as r, jsxs as _ } from "react/jsx-runtime";
2
- import { c as k } from "../../_virtual/compiler-runtime.js";
3
- import { MenuTrigger as v, MenuSeparator as C, MenuPortal as A, Menu as E } from "../menu/Menu.js";
4
- import I from "react";
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 L, InputSuggestionMenuContent as P } from "../form/InputSuggestion.js";
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 U } from "./DFlowSuggestionMenu.util.js";
21
- import { DFlowSuggestionMenuSearchBar as $ } from "./DFlowSuggestionMenuSearchBar.js";
22
- const ue = (R) => {
23
- const e = k.c(25), {
24
- suggestions: f,
25
- triggerContent: M,
26
- onSuggestionSelect: x
27
- } = R;
28
- let c;
29
- e[0] !== f ? (c = f === void 0 ? [] : f, e[0] = f, e[1] = c) : c = e[1];
30
- const t = c, D = x === void 0 ? q : x, w = I.useRef(null), [y, F] = I.useState(t);
31
- let p, g;
32
- e[2] !== t ? (p = () => {
33
- F(t);
34
- }, g = [t], e[2] = t, e[3] = p, e[4] = g) : (p = e[3], g = e[4]), I.useEffect(p, g);
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
- e[5] !== M ? (i = /* @__PURE__ */ r(v, { asChild: !0, children: M }), e[5] = M, e[6] = i) : i = e[6];
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
- e[7] !== t ? (s = /* @__PURE__ */ r($, { onType: (o) => {
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
- e[10] !== y ? (n = U(y), e[10] = y, e[11] = n) : n = e[11];
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
- e[12] !== D ? (l = (o) => {
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
- e[14] !== n || e[15] !== l ? (u = /* @__PURE__ */ r(L, { ref: w, suggestions: n, onSuggestionSelect: l }), e[14] = n, e[15] = l, e[16] = u) : u = e[16];
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
- m
67
- ] }), e[22] = m, e[23] = i, e[24] = h) : h = e[24], h;
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 q() {
62
+ function P() {
70
63
  }
71
64
  export {
72
- ue as DFlowSuggestionMenu
65
+ it as DFlowSuggestionMenu
73
66
  };