@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.
Files changed (33) 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/components/d-flow/DFlow.service.js +31 -23
  4. package/dist/components/d-flow-data-type/DFlowDataType.service.d.ts +2 -2
  5. package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js +22 -13
  6. package/dist/components/d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js +19 -13
  7. package/dist/components/d-flow-file/DFlowTabDefault.js +38 -37
  8. package/dist/components/d-flow-file/DFlowTabTrigger.js +1 -1
  9. package/dist/components/d-flow-input/DFlowInput.d.ts +11 -0
  10. package/dist/components/d-flow-input/DFlowInput.js +29 -0
  11. package/dist/components/d-flow-input/DFlowInputDefault.d.ts +2 -7
  12. package/dist/components/d-flow-input/DFlowInputNodeBadge.js +13 -13
  13. package/dist/components/d-flow-input/DFlowInputObject.d.ts +10 -0
  14. package/dist/components/d-flow-input/DFlowInputObject.js +83 -0
  15. package/dist/components/d-flow-input/DFlowInputObjectEditDialog.d.ts +16 -0
  16. package/dist/components/d-flow-input/DFlowInputObjectEditDialog.js +118 -0
  17. package/dist/components/d-flow-input/DFlowInputObjectTree.d.ts +16 -0
  18. package/dist/components/d-flow-input/DFlowInputObjectTree.js +99 -0
  19. package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +12 -12
  20. package/dist/components/d-flow-node/DFlowNodeReference.return.hook.d.ts +4 -0
  21. package/dist/components/d-flow-node/DFlowNodeReference.return.hook.js +77 -0
  22. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +104 -103
  23. package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +43 -50
  24. package/dist/components/d-flow-validation/DNodeValidation.hook.js +44 -39
  25. package/dist/components/editor/Editor.js +15 -15
  26. package/dist/components/form/InputSuggestion.js +29 -29
  27. package/dist/components/form/useForm.d.ts +3 -3
  28. package/dist/components/form/useForm.js +16 -16
  29. package/dist/node_modules/prettier/plugins/babel.js +6674 -6685
  30. package/dist/node_modules/prettier/plugins/estree.js +2830 -2628
  31. package/dist/node_modules/prettier/standalone.js +1657 -1440
  32. package/dist/utils/generics.js +85 -97
  33. package/package.json +22 -22
@@ -1 +1 @@
1
- ul{list-style:none;margin:0;margin-inline-start:2px;margin-block-start:.35rem;padding-inline-start:.35rem;text-wrap:nowrap;position:relative;display:flex;flex-direction:column;gap:.35rem}li{position:relative;padding-inline-start:.7rem}li:before{content:"";position:absolute;background:transparent;width:.7rem;left:-.35rem;height:20px;top:5px;transform:translateY(-50%);border-left:2px solid rgb(31.8,30,43.5);border-bottom:2px solid rgb(31.8,30,43.5);border-bottom-left-radius:.5rem}li:not(:last-child):after{content:"";position:absolute;width:2px;height:100%;background:#201e2c;top:0;left:-.35rem}.rule{padding:.175rem .35rem;margin-left:-.35rem;width:calc(100% + .35rem)}.rule{border-radius:1rem;background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.rule:hover{background:#23212e;box-shadow:inset 0 1px 1px #bfbfbf1a}.rule:active,.rule:focus,.rule[aria-selected=true],.rule[data-state=open]{background:#2c2a36;box-shadow:inset 0 1px 1px #bfbfbf1a;outline:none}.rule{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px;box-shadow:none;cursor:pointer}
1
+ ul{list-style:none;margin:0;margin-inline-start:2px;margin-block-start:.35rem;padding-inline-start:.35rem;text-wrap:nowrap;position:relative;display:flex;flex-direction:column;gap:.35rem}li{position:relative;padding-inline-start:.7rem;list-style:none}li:before{content:"";position:absolute;background:transparent;width:.7rem;left:-.35rem;height:20px;top:5px;transform:translateY(-50%);border-left:2px solid rgb(31.8,30,43.5);border-bottom:2px solid rgb(31.8,30,43.5);border-bottom-left-radius:.5rem}li:not(:last-child):after{content:"";position:absolute;width:2px;height:100%;background:#201e2c;top:0;left:-.35rem}.rule{padding:.175rem .35rem;margin-left:-.35rem;width:calc(100% + .35rem)}.rule{border-radius:1rem;background:#070514;box-shadow:inset 0 1px 1px #bfbfbf1a;border:none;color:#ffffffbf;position:relative;box-sizing:border-box}.rule:hover{background:#23212e;box-shadow:inset 0 1px 1px #bfbfbf1a}.rule:active,.rule:focus,.rule[aria-selected=true],.rule[data-state=open]{background:#2c2a36;box-shadow:inset 0 1px 1px #bfbfbf1a;outline:none}.rule{font-family:Inter,sans-serif;font-weight:400;letter-spacing:-.5px;box-shadow:none;cursor:pointer}
@@ -1 +1 @@
1
- .d-flow-suggestion-search-input{border:none!important;background:none!important;margin:-.35rem;padding-left:.35rem;padding-right:.35rem;border-radius:0!important}.d-flow-suggestion-search-input>input{padding-top:0!important;padding-bottom:0!important}
1
+ .d-flow-suggestion-search-input{border:none!important;background:none!important;margin:-.35rem;padding-left:.35rem;padding-right:.35rem;border-radius:0!important;box-shadow:none!important}.d-flow-suggestion-search-input>input{padding-top:0!important;padding-bottom:0!important}
@@ -1,10 +1,10 @@
1
1
  import "../../utils/contextStore.js";
2
2
  import "react";
3
- import { ReactiveArrayService as l } from "../../utils/reactiveArrayService.js";
3
+ import { ReactiveArrayService as I } from "../../utils/reactiveArrayService.js";
4
4
  import "merge-props";
5
5
  import "js-md5";
6
6
  import { View as c } from "../../utils/view.js";
7
- class x extends l {
7
+ class v extends I {
8
8
  getById(n, i) {
9
9
  return this.values(i).find((t) => t.id === n);
10
10
  }
@@ -28,8 +28,8 @@ class x extends l {
28
28
  const t = this.getNodeById(n, i), e = t ? this.getLinkedNodesById(n, t.nextNodeId) : [], d = [];
29
29
  return t?.parameters?.nodes?.forEach((o) => {
30
30
  if (o?.value?.__typename === "NodeFunctionIdWrapper") {
31
- const r = this.getNodeById(n, o.value?.id);
32
- r && (d.push(r), d.push(...r ? this.getLinkedNodesById(n, r.nextNodeId) : []));
31
+ const a = this.getNodeById(n, o.value?.id);
32
+ a && (d.push(a), d.push(...a ? this.getLinkedNodesById(n, a.nextNodeId) : []));
33
33
  }
34
34
  }), [...t ? [t] : [], ...d, ...e];
35
35
  }
@@ -66,8 +66,16 @@ class x extends l {
66
66
  const o = e.value;
67
67
  d = {
68
68
  referenceValue: {
69
- nodeFunctionId: o.nodeFunctionId,
70
- referencePath: o.referencePath ?? []
69
+ ...o.nodeFunctionId ? {
70
+ nodeFunctionId: o.nodeFunctionId
71
+ } : {},
72
+ ...o.parameterIndex && o.inputIndex ? {
73
+ parameterIndex: o.parameterIndex,
74
+ inputIndex: o.inputIndex
75
+ } : {},
76
+ referencePath: o.referencePath?.map((a) => ({
77
+ path: a.path
78
+ })) ?? []
71
79
  }
72
80
  };
73
81
  break;
@@ -87,54 +95,54 @@ class x extends l {
87
95
  };
88
96
  }
89
97
  async deleteNodeById(n, i) {
90
- const t = this.getById(n), e = this.getNodeById(n, i), d = t?.nodes?.nodes?.find((s) => s?.parameters?.nodes?.find((a) => a?.value?.__typename === "NodeFunctionIdWrapper" && a.value?.id === i)), o = t?.nodes?.nodes?.find((s) => s?.nextNodeId === i), r = this.values().findIndex((s) => s.id === n);
98
+ const t = this.getById(n), e = this.getNodeById(n, i), d = t?.nodes?.nodes?.find((s) => s?.parameters?.nodes?.find((r) => r?.value?.__typename === "NodeFunctionIdWrapper" && r.value?.id === i)), o = t?.nodes?.nodes?.find((s) => s?.nextNodeId === i), a = this.values().findIndex((s) => s.id === n);
91
99
  if (!(!t || !e)) {
92
100
  if (t.nodes.nodes = t.nodes.nodes.filter((s) => s?.id !== i), e.parameters?.nodes?.forEach((s) => this.removeParameterNode(t, s)), o ? o.nextNodeId = e.nextNodeId : d || (t.startingNodeId = e.nextNodeId ?? void 0), d) {
93
- const s = d.parameters?.nodes?.find((a) => a?.value?.__typename === "NodeFunctionIdWrapper" && a.value?.id === i);
101
+ const s = d.parameters?.nodes?.find((r) => r?.value?.__typename === "NodeFunctionIdWrapper" && r.value?.id === i);
94
102
  s && (s.value = void 0);
95
103
  }
96
- t.editedAt = (/* @__PURE__ */ new Date()).toISOString(), this.set(r, new c(t));
104
+ t.editedAt = (/* @__PURE__ */ new Date()).toISOString(), this.set(a, new c(t));
97
105
  }
98
106
  }
99
107
  async addNextNodeById(n, i, t) {
100
108
  const e = this.getById(n), d = this.values().findIndex((u) => u.id === n), o = i ? this.getNodeById(n, i) : void 0;
101
109
  if (!e || i && !o) return;
102
- const s = `gid://sagittarius/NodeFunction/${Math.max(0, ...e.nodes?.nodes?.map((u) => Number(u?.id?.match(/NodeFunction\/(\d+)$/)?.[1] ?? 0)) ?? [0]) + 1}`, a = {
110
+ const s = `gid://sagittarius/NodeFunction/${Math.max(0, ...e.nodes?.nodes?.map((u) => Number(u?.id?.match(/NodeFunction\/(\d+)$/)?.[1] ?? 0)) ?? [0]) + 1}`, r = {
103
111
  ...JSON.parse(JSON.stringify(t)),
104
112
  id: s
105
113
  };
106
- o && o.nextNodeId ? a.nextNodeId = o.nextNodeId : !o && e.startingNodeId && (a.nextNodeId = e.startingNodeId), e.nodes?.nodes?.push(a), o ? o.nextNodeId = a.id : e.startingNodeId = a.id, e.editedAt = (/* @__PURE__ */ new Date()).toISOString(), this.set(d, new c(e));
114
+ o && o.nextNodeId ? r.nextNodeId = o.nextNodeId : !o && e.startingNodeId && (r.nextNodeId = e.startingNodeId), e.nodes?.nodes?.push(r), o ? o.nextNodeId = r.id : e.startingNodeId = r.id, e.editedAt = (/* @__PURE__ */ new Date()).toISOString(), this.set(d, new c(e));
107
115
  }
108
116
  async setSettingValue(n, i, t) {
109
- const e = this.getById(n), d = this.values().findIndex((r) => r.id === n);
117
+ const e = this.getById(n), d = this.values().findIndex((a) => a.id === n);
110
118
  if (!e) return;
111
119
  e.editedAt = (/* @__PURE__ */ new Date()).toISOString();
112
- const o = e.settings?.nodes?.find((r) => r?.flowSettingIdentifier === i);
120
+ const o = e.settings?.nodes?.find((a) => a?.flowSettingIdentifier === i);
113
121
  if (o)
114
122
  o.value = t;
115
123
  else {
116
- const r = {
124
+ const a = {
117
125
  flowSettingIdentifier: i,
118
126
  value: null
119
127
  };
120
- r.value = t, e.settings.nodes.push(r);
128
+ a.value = t, e.settings.nodes.push(a);
121
129
  }
122
130
  this.set(d, new c(e));
123
131
  }
124
132
  async setParameterValue(n, i, t, e) {
125
- const d = this.getById(n), o = this.values().findIndex((a) => a.id === n);
133
+ const d = this.getById(n), o = this.values().findIndex((r) => r.id === n);
126
134
  if (!d) return;
127
- const r = this.getNodeById(n, i);
128
- if (!r) return;
129
- const s = r.parameters?.nodes?.find((a) => a?.id === t);
135
+ const a = this.getNodeById(n, i);
136
+ if (!a) return;
137
+ const s = a.parameters?.nodes?.find((r) => r?.id === t);
130
138
  if (s) {
131
139
  if (this.removeParameterNode(d, s), e?.__typename === "NodeFunction") {
132
- const a = Math.max(0, ...d.nodes?.nodes?.map((N) => Number(N?.id?.match(/NodeFunction\/(\d+)$/)?.[1] ?? 0)) ?? [0]), u = {
140
+ const r = Math.max(0, ...d.nodes?.nodes?.map((N) => Number(N?.id?.match(/NodeFunction\/(\d+)$/)?.[1] ?? 0)) ?? [0]), u = {
133
141
  ...e,
134
- id: `gid://sagittarius/NodeFunction/${a + 1}`
142
+ id: `gid://sagittarius/NodeFunction/${r + 1}`
135
143
  };
136
144
  d.nodes?.nodes?.push(u), s.value = {
137
- id: `gid://sagittarius/NodeFunction/${a + 1}`,
145
+ id: `gid://sagittarius/NodeFunction/${r + 1}`,
138
146
  __typename: "NodeFunctionIdWrapper"
139
147
  };
140
148
  } else
@@ -144,5 +152,5 @@ class x extends l {
144
152
  }
145
153
  }
146
154
  export {
147
- x as DFlowReactiveService
155
+ v as DFlowReactiveService
148
156
  };
@@ -1,6 +1,6 @@
1
1
  import { ReactiveArrayService } from '../../utils';
2
2
  import { DataTypeView } from './DFlowDataType.view';
3
- import { DataTypeIdentifier, Flow, Maybe, Namespace, NamespaceProject, NodeParameterValue, Runtime } from '@code0-tech/sagittarius-graphql-types';
3
+ import { DataTypeIdentifier, Flow, LiteralValue, Maybe, Namespace, NamespaceProject, NodeParameterValue, Runtime } from '@code0-tech/sagittarius-graphql-types';
4
4
  export type DFlowDataTypeDependencies = {
5
5
  namespaceId: Namespace['id'];
6
6
  projectId: NamespaceProject['id'];
@@ -9,7 +9,7 @@ export type DFlowDataTypeDependencies = {
9
9
  export declare abstract class DFlowDataTypeReactiveService extends ReactiveArrayService<DataTypeView, DFlowDataTypeDependencies> {
10
10
  getDataType(type: DataTypeIdentifier, dependencies?: DFlowDataTypeDependencies): DataTypeView | undefined;
11
11
  getDataTypeFromValue(value: NodeParameterValue, flow?: Flow, dependencies?: DFlowDataTypeDependencies): DataTypeView | undefined;
12
- getValueFromType(dataTypeIdentifier: DataTypeIdentifier, flow?: Flow, dependencies?: DFlowDataTypeDependencies): NodeParameterValue | undefined;
12
+ getValueFromType(dataTypeIdentifier: DataTypeIdentifier, flow?: Flow, dependencies?: DFlowDataTypeDependencies): LiteralValue | undefined;
13
13
  getTypeFromValue(value: NodeParameterValue, flow?: Flow, dependencies?: DFlowDataTypeDependencies): Maybe<DataTypeIdentifier> | undefined;
14
14
  hasDataTypes(types: DataTypeIdentifier[], dependencies?: DFlowDataTypeDependencies): boolean;
15
15
  }
@@ -3,7 +3,7 @@ import { useValueValidation as m } from "../../d-flow-validation/DValueValidatio
3
3
  function A(r, e, t, n) {
4
4
  var i = k(), o = e(function(s) {
5
5
  i.initializeInstanceElements(s, a.elements);
6
- }, t), a = i.decorateClass(I(o.d.map(P)), r);
6
+ }, t), a = i.decorateClass(_(o.d.map(P)), r);
7
7
  return i.initializeClassElements(o.F, a.elements), i.runClassFinishers(o.F, a.finishers);
8
8
  }
9
9
  function k() {
@@ -39,7 +39,7 @@ function k() {
39
39
  if (e.forEach(function(s) {
40
40
  this.addElementPlacement(s, o);
41
41
  }, this), e.forEach(function(s) {
42
- if (!u(s)) return n.push(s);
42
+ if (!f(s)) return n.push(s);
43
43
  var l = this.decorateElement(s, o);
44
44
  n.push(l.element), n.push.apply(n, l.extras), i.push.apply(i, l.finishers);
45
45
  }, this), !t) return { elements: n, finishers: i };
@@ -122,18 +122,18 @@ function P(r) {
122
122
  function C(r, e) {
123
123
  r.descriptor.get !== void 0 ? e.descriptor.get = r.descriptor.get : e.descriptor.set = r.descriptor.set;
124
124
  }
125
- function I(r) {
125
+ function _(r) {
126
126
  for (var e = [], t = function(a) {
127
127
  return a.kind === "method" && a.key === o.key && a.placement === o.placement;
128
128
  }, n = 0; n < r.length; n++) {
129
129
  var i, o = r[n];
130
130
  if (o.kind === "method" && (i = e.find(t)))
131
- if (y(o.descriptor) || y(i.descriptor)) {
132
- if (u(o) || u(i)) throw new ReferenceError("Duplicated methods (" + o.key + ") can't be decorated.");
131
+ if (h(o.descriptor) || h(i.descriptor)) {
132
+ if (f(o) || f(i)) throw new ReferenceError("Duplicated methods (" + o.key + ") can't be decorated.");
133
133
  i.descriptor = o.descriptor;
134
134
  } else {
135
- if (u(o)) {
136
- if (u(i)) throw new ReferenceError("Decorators can't be placed on different accessors with for the same property (" + o.key + ").");
135
+ if (f(o)) {
136
+ if (f(i)) throw new ReferenceError("Decorators can't be placed on different accessors with for the same property (" + o.key + ").");
137
137
  i.decorators = o.decorators;
138
138
  }
139
139
  C(o, i);
@@ -142,10 +142,10 @@ function I(r) {
142
142
  }
143
143
  return e;
144
144
  }
145
- function u(r) {
145
+ function f(r) {
146
146
  return r.decorators && r.decorators.length;
147
147
  }
148
- function y(r) {
148
+ function h(r) {
149
149
  return r !== void 0 && !(r.value === void 0 && r.writable === void 0);
150
150
  }
151
151
  function v(r, e) {
@@ -154,10 +154,10 @@ function v(r, e) {
154
154
  return t;
155
155
  }
156
156
  function w(r) {
157
- var e = _(r, "string");
157
+ var e = I(r, "string");
158
158
  return typeof e == "symbol" ? e : e + "";
159
159
  }
160
- function _(r, e) {
160
+ function I(r, e) {
161
161
  if (typeof r != "object" || !r) return r;
162
162
  var t = r[Symbol.toPrimitive];
163
163
  if (t !== void 0) {
@@ -209,10 +209,19 @@ let M = A([T()], function(r) {
209
209
  if ((i?.key ?? "") in n && i?.dataTypeIdentifier?.genericKey && !l && !s?.getDataType(i.dataTypeIdentifier)) return !0;
210
210
  if (!(s?.getDataType(i.dataTypeIdentifier) || l) || l && !s?.hasDataTypes(c) || l && (p?.length ?? 0) + 1 != c.length) return !1;
211
211
  if (i?.dataTypeIdentifier?.genericKey && l && c) {
212
- const d = c.map((f) => m(n.value[i?.key ?? ""], s?.getDataType(f), s, a, f.genericType.genericMappers)), E = d.length > 1 ? d.reduce((f, h, g) => p && p[g - 1].type == "OR" ? f || h : f && h) : d[0];
212
+ const d = c.map((u) => m({
213
+ __typename: "LiteralValue",
214
+ value: n.value[i?.key ?? ""]
215
+ }, s?.getDataType(u), s, a, u.genericType.genericMappers)), E = d.length > 1 ? d.reduce((u, y, g) => p && p[g - 1].type == "OR" ? u || y : u && y) : d[0];
213
216
  return (i?.key ?? "") in n && E;
214
217
  }
215
- return i?.dataTypeIdentifier?.dataType ? (i?.key ?? "") in n && m(n.value[i?.key ?? ""], s?.getDataType(i.dataTypeIdentifier), s) : (i?.key ?? "") in n && m(n.value[i?.key ?? ""], s?.getDataType(i.dataTypeIdentifier), s, a, D(i?.dataTypeIdentifier?.genericType?.genericMappers, o));
218
+ return i?.dataTypeIdentifier?.dataType ? (i?.key ?? "") in n.value && m({
219
+ __typename: "LiteralValue",
220
+ value: n.value[i?.key ?? ""]
221
+ }, s?.getDataType(i.dataTypeIdentifier), s) : (i?.key ?? "") in n.value && m({
222
+ __typename: "LiteralValue",
223
+ value: n.value[i?.key ?? ""]
224
+ }, s?.getDataType(i.dataTypeIdentifier), s, a, D(i?.dataTypeIdentifier?.genericType?.genericMappers, o));
216
225
  }
217
226
  }]
218
227
  };
@@ -3,7 +3,7 @@ import { useValueValidation as h } from "../../d-flow-validation/DValueValidatio
3
3
  function T(r, e, t, n) {
4
4
  var i = w(), o = e(function(s) {
5
5
  i.initializeInstanceElements(s, a.elements);
6
- }, t), a = i.decorateClass(C(o.d.map(A)), r);
6
+ }, t), a = i.decorateClass(_(o.d.map(A)), r);
7
7
  return i.initializeClassElements(o.F, a.elements), i.runClassFinishers(o.F, a.finishers);
8
8
  }
9
9
  function w() {
@@ -75,7 +75,7 @@ function w() {
75
75
  var t = { kind: e.kind, key: e.key, placement: e.placement, descriptor: e.descriptor };
76
76
  return Object.defineProperty(t, Symbol.toStringTag, { value: "Descriptor", configurable: !0 }), e.kind === "field" && (t.initializer = e.initializer), t;
77
77
  }, toElementDescriptors: function(e) {
78
- if (e !== void 0) return _(e).map(function(t) {
78
+ if (e !== void 0) return I(e).map(function(t) {
79
79
  var n = this.toElementDescriptor(t);
80
80
  return this.disallowProperty(t, "finisher", "An element descriptor"), this.disallowProperty(t, "extras", "An element descriptor"), n;
81
81
  }, this);
@@ -122,7 +122,7 @@ function A(r) {
122
122
  function P(r, e) {
123
123
  r.descriptor.get !== void 0 ? e.descriptor.get = r.descriptor.get : e.descriptor.set = r.descriptor.set;
124
124
  }
125
- function C(r) {
125
+ function _(r) {
126
126
  for (var e = [], t = function(a) {
127
127
  return a.kind === "method" && a.key === o.key && a.placement === o.placement;
128
128
  }, n = 0; n < r.length; n++) {
@@ -154,10 +154,10 @@ function v(r, e) {
154
154
  return t;
155
155
  }
156
156
  function g(r) {
157
- var e = I(r, "string");
157
+ var e = C(r, "string");
158
158
  return typeof e == "symbol" ? e : e + "";
159
159
  }
160
- function I(r, e) {
160
+ function C(r, e) {
161
161
  if (typeof r != "object" || !r) return r;
162
162
  var t = r[Symbol.toPrimitive];
163
163
  if (t !== void 0) {
@@ -167,7 +167,7 @@ function I(r, e) {
167
167
  }
168
168
  return (e === "string" ? String : Number)(r);
169
169
  }
170
- function _(r) {
170
+ function I(r) {
171
171
  return O(r) || F(r) || z(r) || x();
172
172
  }
173
173
  function x() {
@@ -210,16 +210,22 @@ let R = T([D()], function(r) {
210
210
  if (i?.dataTypeIdentifier?.genericKey && !l && !s?.getDataType(i.dataTypeIdentifier)) return !0;
211
211
  if (!(s?.getDataType(i.dataTypeIdentifier) || l) || l && !s?.hasDataTypes(p) || l && (d?.length ?? 0) + 1 != p.length) return !1;
212
212
  if (i?.dataTypeIdentifier?.genericKey && l && p) {
213
- const c = p.map((f) => n.value.every((u) => f.genericType ? h({
213
+ const c = p.map((u) => n.value.every((f) => u.genericType ? h({
214
214
  __typename: "LiteralValue",
215
- value: u
216
- }, s?.getDataType(f), s, a, f.genericType.genericMappers) : h({
215
+ value: f
216
+ }, s?.getDataType(u), s, a, u.genericType.genericMappers) : h({
217
217
  __typename: "LiteralValue",
218
- value: u
219
- }, s?.getDataType(f), s, a)));
220
- return c.length > 1 ? c.reduce((f, u, k) => d && d[k - 1].type == "OR" ? f || u : f && u) : c[0];
218
+ value: f
219
+ }, s?.getDataType(u), s, a)));
220
+ return c.length > 1 ? c.reduce((u, f, k) => d && d[k - 1].type == "OR" ? u || f : u && f) : c[0];
221
221
  }
222
- return i?.dataTypeIdentifier?.dataType ? n.value.every((c) => h(c, s?.getDataType(i.dataTypeIdentifier), s)) : n.value.every((c) => h(c, s?.getDataType(i.dataTypeIdentifier), s, a, E((i.dataTypeIdentifier?.genericType).genericMappers, o)));
222
+ return i?.dataTypeIdentifier?.dataType ? n.value.every((c) => h({
223
+ __typename: "LiteralValue",
224
+ value: c
225
+ }, s?.getDataType(i.dataTypeIdentifier), s)) : n.value.every((c) => h({
226
+ __typename: "LiteralValue",
227
+ value: c
228
+ }, s?.getDataType(i.dataTypeIdentifier), s, a, E((i.dataTypeIdentifier?.genericType).genericMappers, o)));
223
229
  }
224
230
  }]
225
231
  };
@@ -1,4 +1,4 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as p } from "react/jsx-runtime";
2
2
  import r from "react";
3
3
  import "../../_virtual/compiler-runtime.js";
4
4
  import "@radix-ui/react-checkbox";
@@ -16,11 +16,11 @@ import "@radix-ui/react-radio-group";
16
16
  import "../form/SwitchInput.js";
17
17
  import "../form/TextInput.js";
18
18
  import { useForm as M } from "../form/useForm.js";
19
- import { Flex as k } from "../flex/Flex.js";
20
- import { useService as p, useStore as S } from "../../utils/contextStore.js";
21
- import { DFlowFunctionReactiveService as g } from "../d-flow-function/DFlowFunction.service.js";
19
+ import { Flex as O } from "../flex/Flex.js";
20
+ import { useService as f, useStore as V } from "../../utils/contextStore.js";
21
+ import { DFlowFunctionReactiveService as N } from "../d-flow-function/DFlowFunction.service.js";
22
22
  import "../d-flow/DFlow.js";
23
- import { DFlowReactiveService as V } from "../d-flow/DFlow.service.js";
23
+ import { DFlowReactiveService as g } from "../d-flow/DFlow.service.js";
24
24
  import "../d-flow-data-type/rules/DFlowDataTypeRegexRule.js";
25
25
  import "../d-flow-data-type/rules/DFlowDataTypeNumberRangeRule.js";
26
26
  import "../d-flow-data-type/rules/DFlowDataTypeItemOfCollectionRule.js";
@@ -28,19 +28,19 @@ import "../d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.js";
28
28
  import "../d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.js";
29
29
  import "../d-flow-data-type/rules/DFlowDataTypeReturnTypeRule.js";
30
30
  import "../d-flow-data-type/variants/DFlowDataTypeNodeVariant.js";
31
- import { useNodeValidation as B } from "../d-flow-validation/DNodeValidation.hook.js";
32
- import { FileTabsService as E } from "../file-tabs/FileTabs.service.js";
33
- import { DFlowInputDefault as J } from "../d-flow-input/DFlowInputDefault.js";
34
- const ye = (D) => {
31
+ import { useNodeValidation as k } from "../d-flow-validation/DNodeValidation.hook.js";
32
+ import { FileTabsService as B } from "../file-tabs/FileTabs.service.js";
33
+ import { DFlowInput as E } from "../d-flow-input/DFlowInput.js";
34
+ const Se = (w) => {
35
35
  const {
36
36
  node: o,
37
37
  flowId: a
38
- } = D, N = p(g), w = S(g), u = p(V), I = S(V), h = p(E), f = B(o.id, a), d = r.useRef(/* @__PURE__ */ new Set()), [, b] = r.useTransition(), v = r.useMemo(() => N.getById(o.functionDefinition?.id), [w]), F = r.useMemo(() => {
38
+ } = w, D = f(N), I = V(N), c = f(g), b = V(g), h = f(B), v = k(o.id, a), m = r.useRef(/* @__PURE__ */ new Set()), [, _] = r.useTransition(), y = r.useMemo(() => D.getById(o.functionDefinition?.id), [I]), F = r.useMemo(() => {
39
39
  const t = {};
40
- return v?.parameterDefinitions?.forEach((e) => {
40
+ return y?.parameterDefinitions?.forEach((e) => {
41
41
  t[e.id] = e;
42
42
  }), t;
43
- }, [v]), s = r.useMemo(() => [...o.parameters?.nodes || []].sort((t, e) => t.id.localeCompare(e?.id)), [o]), _ = r.useMemo(() => {
43
+ }, [y]), s = r.useMemo(() => [...o.parameters?.nodes || []].sort((t, e) => t.id.localeCompare(e?.id)), [o]), x = r.useMemo(() => {
44
44
  const t = {};
45
45
  return s.forEach((e) => {
46
46
  t[e?.id] = e?.value?.__typename === "LiteralValue" ? typeof e.value?.value == "object" && e.value?.value != null ? JSON.stringify(e.value?.value) : e.value.value : e?.value != null ? JSON.stringify(e?.value) : e?.value;
@@ -48,58 +48,59 @@ const ye = (D) => {
48
48
  }, [s]), P = r.useMemo(() => {
49
49
  const t = {};
50
50
  return s.forEach((e) => {
51
- t[e?.id] = (c) => {
52
- const n = f?.find((i) => i.parameterId === e?.id);
51
+ t[e?.id] = (l) => {
52
+ const n = v?.find((i) => i.parameterId === e?.id);
53
53
  return n ? n.message[0]?.content || "Invalid value" : null;
54
54
  };
55
55
  }), t;
56
- }, [s, f]), x = r.useCallback((t) => {
57
- b(async () => {
56
+ }, [s, v]), T = r.useCallback((t) => {
57
+ _(async () => {
58
58
  for (const e of s) {
59
- if (!d.current.has(e?.id)) continue;
60
- const c = t[e?.id], n = e?.value, i = c?.[0]?.value;
61
- n && n.__typename === "NodeFunctionIdWrapper" && n.id && u.getLinkedNodesById(a, n.id).reverse().forEach((y) => {
62
- y.id && h.deleteById(y.id);
63
- }), (!i || !c) && await u.setParameterValue(a, o.id, e.id, void 0);
59
+ if (!m.current.has(e?.id)) continue;
60
+ const l = t[e?.id], n = e?.value, i = l?.[0]?.value ?? l?.value ?? l;
61
+ n && n.__typename === "NodeFunctionIdWrapper" && n.id && c.getLinkedNodesById(a, n.id).reverse().forEach((S) => {
62
+ S.id && h.deleteById(S.id);
63
+ }), (!i || !l) && await c.setParameterValue(a, o.id, e.id, void 0);
64
64
  try {
65
- const l = Number.isNaN(Number(i)) ? JSON.parse(String(i)) : String(i);
66
- if (!i?.__typename) {
67
- await u.setParameterValue(a, o.id, e.id, i ? {
65
+ const u = Number.isNaN(Number(i)) ? JSON.parse(i) : i;
66
+ if (!u?.__typename) {
67
+ await c.setParameterValue(a, o.id, e.id, i ? {
68
68
  __typename: "LiteralValue",
69
- value: l ?? String(l)
69
+ value: u ?? String(u)
70
70
  } : void 0);
71
71
  continue;
72
72
  }
73
73
  } catch {
74
74
  if (!i?.__typename) {
75
- await u.setParameterValue(a, o.id, e.id, i ? {
75
+ await c.setParameterValue(a, o.id, e.id, i ? {
76
76
  __typename: "LiteralValue",
77
77
  value: i
78
78
  } : void 0);
79
79
  continue;
80
80
  }
81
81
  }
82
- await u.setParameterValue(a, o.id, e.id, i.__typename === "LiteralValue" ? i.value ? i : void 0 : i);
82
+ const d = typeof i == "object" ? i : JSON.parse(i);
83
+ await c.setParameterValue(a, o.id, e.id, d.__typename === "LiteralValue" ? d.value ? d : void 0 : d);
83
84
  }
84
- d.current.clear();
85
+ m.current.clear();
85
86
  });
86
- }, [I, s]), [T, L] = M({
87
- initialValues: _,
87
+ }, [b, s]), [J, L] = M({
88
+ initialValues: x,
88
89
  validate: P,
89
90
  truthyValidationBeforeSubmit: !1,
90
- onSubmit: x
91
+ onSubmit: T
91
92
  });
92
- return /* @__PURE__ */ m(k, { style: {
93
+ return /* @__PURE__ */ p(O, { style: {
93
94
  gap: ".7rem",
94
95
  flexDirection: "column"
95
96
  }, children: s.map((t) => {
96
97
  if (!t) return null;
97
- const e = F[t?.parameterDefinition?.id], c = e?.names ? e?.names[0]?.content : e?.id, n = e?.descriptions ? e?.descriptions[0]?.content : JSON.stringify(e?.dataTypeIdentifier);
98
- return /* @__PURE__ */ m("div", { children: /* @__PURE__ */ m(J, { flowId: a, nodeId: o.id, parameterId: t.id, title: c, description: n, clearable: !0, onChange: () => {
99
- d.current.add(t.id), L();
100
- }, ...T.getInputProps(t.id) }) });
98
+ const e = F[t?.parameterDefinition?.id], l = e?.names ? e?.names[0]?.content : e?.id, n = e?.descriptions ? e?.descriptions[0]?.content : JSON.stringify(e?.dataTypeIdentifier);
99
+ return /* @__PURE__ */ p("div", { children: /* @__PURE__ */ p(E, { flowId: a, nodeId: o.id, parameterId: t.id, title: l, description: n, clearable: !0, onChange: () => {
100
+ m.current.add(t.id), L();
101
+ }, ...J.getInputProps(t.id) }) });
101
102
  }) });
102
103
  };
103
104
  export {
104
- ye as DFlowTabDefault
105
+ Se as DFlowTabDefault
105
106
  };
@@ -43,7 +43,7 @@ const Q = (i) => {
43
43
  gap: ".7rem",
44
44
  flexDirection: "column"
45
45
  }, children: [
46
- n?.inputType ? /* @__PURE__ */ u(R, { initialValue: S, label: "Test Data Type", description: "Data type used for testing", onChange: (e) => console.log(e) }) : null,
46
+ n?.inputType ? /* @__PURE__ */ u(R, { initialValue: S || void 0, label: "Test Data Type", description: "Data type used for testing", onChange: (e) => console.log(e) }) : null,
47
47
  n?.flowTypeSettings?.map((e) => {
48
48
  const t = p.settings?.nodes?.find((a) => a?.flowSettingIdentifier == e.identifier), s = e.names[0]?.content ?? "", l = e?.descriptions[0]?.content ?? "", T = m[e.identifier], w = (t?.value?.__typename === "LiteralValue", typeof t?.value == "object" ? JSON.stringify(t?.value) : t?.value), o = (a) => {
49
49
  v(async () => {
@@ -0,0 +1,11 @@
1
+ import { Flow, NodeFunction, NodeParameter } from '@code0-tech/sagittarius-graphql-types';
2
+ import { default as React } from 'react';
3
+ import { InputProps } from '../form';
4
+ export interface DFlowInputProps extends Omit<InputProps<any | null>, "wrapperComponent" | "type"> {
5
+ flowId: Flow['id'];
6
+ nodeId: NodeFunction['id'];
7
+ parameterId: NodeParameter['id'];
8
+ clearable?: boolean;
9
+ onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;
10
+ }
11
+ export declare const DFlowInput: React.FC<DFlowInputProps>;
@@ -0,0 +1,29 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import e from "react";
3
+ import { DFlowInputDefault as R } from "./DFlowInputDefault.js";
4
+ import { useService as a, useStore as c } from "../../utils/contextStore.js";
5
+ import "merge-props";
6
+ import "js-md5";
7
+ import "../d-flow/DFlow.js";
8
+ import { DFlowReactiveService as u } from "../d-flow/DFlow.service.js";
9
+ import { DFlowFunctionReactiveService as D } from "../d-flow-function/DFlowFunction.service.js";
10
+ import { DFlowDataTypeReactiveService as l } from "../d-flow-data-type/DFlowDataType.service.js";
11
+ import { DFlowInputObject as M } from "./DFlowInputObject.js";
12
+ const Y = (v) => {
13
+ const {
14
+ flowId: t,
15
+ nodeId: o,
16
+ parameterId: i,
17
+ ...m
18
+ } = v, S = a(u), w = c(u), y = a(l), I = c(l), T = a(D), F = c(D), r = e.useMemo(() => S.getNodeById(t, o), [w, t, o]), p = e.useMemo(() => r?.parameters?.nodes?.find((n) => n?.id === i), [r, i]), s = e.useMemo(() => T.getById(r?.functionDefinition?.id), [F, r]), f = e.useMemo(() => s?.parameterDefinitions?.find((n) => n.id === p?.parameterDefinition?.id), [s, p]);
19
+ switch (e.useMemo(() => y.getDataType(f?.dataTypeIdentifier), [I, f])?.variant) {
20
+ case "ARRAY":
21
+ case "OBJECT":
22
+ return /* @__PURE__ */ d(M, { flowId: t, nodeId: o, parameterId: i, ...m });
23
+ default:
24
+ return /* @__PURE__ */ d(R, { flowId: t, nodeId: o, parameterId: i, ...m });
25
+ }
26
+ };
27
+ export {
28
+ Y as DFlowInput
29
+ };
@@ -1,10 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { TextInputProps } from '../form';
3
- import { Flow, NodeFunction, NodeParameter } from '@code0-tech/sagittarius-graphql-types';
4
- export interface DFlowInputDefaultProps extends TextInputProps {
5
- flowId: Flow['id'];
6
- nodeId: NodeFunction['id'];
7
- parameterId: NodeParameter['id'];
8
- }
2
+ import { DFlowInputProps } from './DFlowInput';
3
+ export type DFlowInputDefaultProps = DFlowInputProps;
9
4
  export declare const splitTextAndObjects: (input: string) => (string | Record<string, any>)[];
10
5
  export declare const DFlowInputDefault: React.FC<DFlowInputDefaultProps>;
@@ -1,13 +1,13 @@
1
1
  import { jsxs as B, jsx as i } from "react/jsx-runtime";
2
2
  import { Badge as T } from "../badge/Badge.js";
3
- import p from "react";
4
- import { IconBolt as N, IconNote as h } from "@tabler/icons-react";
5
- import { Text as x } from "../text/Text.js";
3
+ import s from "react";
4
+ import { IconBolt as h, IconNote as x } from "@tabler/icons-react";
5
+ import { Text as D } from "../text/Text.js";
6
6
  import { useService as n, useStore as m } from "../../utils/contextStore.js";
7
7
  import "merge-props";
8
8
  import "js-md5";
9
9
  import { DFlowFunctionReactiveService as f } from "../d-flow-function/DFlowFunction.service.js";
10
- import { hashToColor as D } from "../d-flow/DFlow.util.js";
10
+ import { hashToColor as N } from "../d-flow/DFlow.util.js";
11
11
  import "../d-flow/DFlow.js";
12
12
  import { DFlowReactiveService as d } from "../d-flow/DFlow.service.js";
13
13
  import "../d-flow-data-type/rules/DFlowDataTypeRegexRule.js";
@@ -25,21 +25,21 @@ const X = (a) => {
25
25
  flowId: c,
26
26
  definition: o,
27
27
  ...u
28
- } = a, w = o || n(f), y = o || m(f), s = o || n(d), g = o || m(d), v = o || n(l), S = o || m(l), t = e.__typename === "NodeFunctionIdWrapper" && e.id === "gid://sagittarius/NodeFunction/-1", r = p.useMemo(() => {
28
+ } = a, w = o || n(f), y = o || m(f), p = o || n(d), v = o || m(d), S = o || n(l), g = o || m(l), t = e.__typename === "NodeFunctionIdWrapper" && !e.id, r = s.useMemo(() => {
29
29
  if (t && !o) {
30
- const I = s.getById(c);
31
- return v.getById(I?.type?.id);
30
+ const F = p.getById(c);
31
+ return S.getById(F?.type?.id);
32
32
  }
33
- return e.__typename === "NodeFunction" || o ? e : s.getNodeById(c, e.id);
34
- }, [g, S]), F = p.useMemo(() => o ? o.names?.[0]?.content : t && r instanceof R ? r.names?.[0]?.content : w.getById(r?.functionDefinition?.id)?.names?.[0]?.content, [y, r]);
33
+ return e.__typename === "NodeFunction" || o ? e : p.getNodeById(c, e.id);
34
+ }, [v, g]), I = s.useMemo(() => o ? o.names?.[0]?.content : t && r instanceof R ? r.names?.[0]?.content : w.getById(r?.functionDefinition?.id)?.names?.[0]?.content, [y, r]);
35
35
  return /* @__PURE__ */ B(T, { style: {
36
36
  verticalAlign: "middle",
37
37
  textWrap: "nowrap"
38
- }, color: t ? "info" : D(e.id || ""), border: !0, ...u, children: [
39
- t ? /* @__PURE__ */ i(N, { size: 12 }) : /* @__PURE__ */ i(h, { size: 12 }),
40
- /* @__PURE__ */ i(x, { size: "sm", style: {
38
+ }, color: t ? "info" : N(e.id || ""), border: !0, ...u, children: [
39
+ t ? /* @__PURE__ */ i(h, { size: 12 }) : /* @__PURE__ */ i(x, { size: 12 }),
40
+ /* @__PURE__ */ i(D, { size: "sm", style: {
41
41
  color: "inherit"
42
- }, children: String(F) })
42
+ }, children: String(I) })
43
43
  ] });
44
44
  };
45
45
  export {
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { DFlowInputProps } from './DFlowInput';
3
+ import { LiteralValue } from '@code0-tech/sagittarius-graphql-types';
4
+ export interface EditableObjectEntry {
5
+ key: string;
6
+ value: LiteralValue | null;
7
+ path: string[];
8
+ }
9
+ export type DFlowInputObjectProps = DFlowInputProps;
10
+ export declare const DFlowInputObject: React.FC<DFlowInputObjectProps>;