@code0-tech/pictor 0.0.0-mvp.29 → 0.0.0-mvp.30

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 (125) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +6 -0
  2. package/dist/_virtual/index.js +4 -0
  3. package/dist/_virtual/index2.js +4 -0
  4. package/dist/_virtual/react-contenteditable.js +7 -0
  5. package/dist/_virtual/react-contenteditable2.js +4 -0
  6. package/dist/_virtual/react-dom-server-legacy.browser.development.js +4 -0
  7. package/dist/_virtual/react-dom-server-legacy.browser.production.js +4 -0
  8. package/dist/_virtual/react-dom-server.browser.development.js +4 -0
  9. package/dist/_virtual/react-dom-server.browser.production.js +4 -0
  10. package/dist/_virtual/react-is.development.js +4 -0
  11. package/dist/_virtual/react-is.production.min.js +4 -0
  12. package/dist/_virtual/server.browser.js +5 -0
  13. package/dist/_virtual/server.browser2.js +4 -0
  14. package/dist/assets/components/d-resizable/DResizable.style.css +1 -1
  15. package/dist/assets/components/form/Input.style.css +1 -1
  16. package/dist/components/breadcrumb/Breadcrumb.js +12 -12
  17. package/dist/components/button-group/ButtonGroup.js +12 -12
  18. package/dist/components/d-flow/DFlow.edges.hook.js +57 -54
  19. package/dist/components/d-flow/DFlow.js +304 -268
  20. package/dist/components/d-flow/DFlow.nodes.hook.js +60 -59
  21. package/dist/components/d-flow/DFlow.service.d.ts +3 -2
  22. package/dist/components/d-flow/DFlow.service.js +62 -47
  23. package/dist/components/d-flow/DFlow.util.d.ts +4 -0
  24. package/dist/components/d-flow/DFlow.util.js +63 -0
  25. package/dist/components/d-flow/DFlowEdge.js +34 -34
  26. package/dist/components/d-flow-data-type/DFlowDataType.service.js +17 -14
  27. package/dist/components/d-flow-data-type/DFlowDataType.view.d.ts +7 -4
  28. package/dist/components/d-flow-data-type/DFlowDataType.view.js +11 -6
  29. package/dist/components/d-flow-file/DFlowTabDefault.d.ts +0 -3
  30. package/dist/components/d-flow-file/DFlowTabDefault.js +77 -112
  31. package/dist/components/d-flow-file/DFlowTabTrigger.js +38 -49
  32. package/dist/components/d-flow-file/DFlowTabs.js +26 -27
  33. package/dist/components/d-flow-folder/DFlowFolder.js +170 -143
  34. package/dist/components/d-flow-folder/DFlowFolderContextMenu.js +18 -11
  35. package/dist/components/d-flow-folder/DFlowFolderItemPathInput.js +1 -0
  36. package/dist/components/d-flow-function/DFlowFunction.input.hook.js +4 -5
  37. package/dist/components/d-flow-function/DFlowFunction.return.hook.js +1 -1
  38. package/dist/components/d-flow-function/DFlowFunction.view.d.ts +14 -11
  39. package/dist/components/d-flow-function/DFlowFunction.view.js +19 -12
  40. package/dist/components/d-flow-function/DFlowFunctionDefaultCard.js +72 -75
  41. package/dist/components/d-flow-function/DFlowFunctionSuggestionCard.js +27 -32
  42. package/dist/components/d-flow-function/DFlowFunctionTriggerCard.js +17 -10
  43. package/dist/components/d-flow-input/DFlowInputDataType.js +38 -33
  44. package/dist/components/d-flow-input/DFlowInputDefault.d.ts +10 -0
  45. package/dist/components/d-flow-input/DFlowInputDefault.js +128 -0
  46. package/dist/components/d-flow-input/DFlowInputLiteralBadge.d.ts +7 -0
  47. package/dist/components/d-flow-input/DFlowInputLiteralBadge.js +24 -0
  48. package/dist/components/d-flow-input/DFlowInputNodeBadge.d.ts +11 -0
  49. package/dist/components/d-flow-input/DFlowInputNodeBadge.js +44 -0
  50. package/dist/components/d-flow-input/DFlowInputReferenceBadge.d.ts +11 -0
  51. package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +33 -0
  52. package/dist/components/d-flow-panel/DFlowExport.js +1 -1
  53. package/dist/components/d-flow-panel/DFlowMiniMap.js +1 -1
  54. package/dist/components/d-flow-panel/DFlowPanelControl.js +34 -32
  55. package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.d.ts +3 -0
  56. package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.js +34 -0
  57. package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.d.ts +3 -0
  58. package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.js +50 -0
  59. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.d.ts +3 -0
  60. package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +133 -0
  61. package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.d.ts +3 -18
  62. package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.js +19 -156
  63. package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +47 -58
  64. package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.util.js +5 -4
  65. package/dist/components/d-flow-suggestion/DFlowSuggestionSearchInput.js +6 -6
  66. package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.d.ts +3 -0
  67. package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.js +44 -0
  68. package/dist/components/d-flow-type/DFlowType.view.d.ts +5 -5
  69. package/dist/components/d-flow-type/DFlowType.view.js +22 -12
  70. package/dist/components/d-flow-validation/DFlowValidation.hook.js +1 -1
  71. package/dist/components/d-flow-validation/DNodeValidation.hook.js +39 -43
  72. package/dist/components/d-resizable/DResizable.d.ts +4 -4
  73. package/dist/components/d-resizable/DResizable.js +22 -21
  74. package/dist/components/d-user/DUserInput.js +23 -21
  75. package/dist/components/file-tabs/FileTabs.service.d.ts +0 -1
  76. package/dist/components/file-tabs/FileTabs.service.js +49 -53
  77. package/dist/components/form/EmailInput.js +9 -9
  78. package/dist/components/form/Input.d.ts +2 -1
  79. package/dist/components/form/Input.js +294 -397
  80. package/dist/components/form/Input.syntax.hook.d.ts +1 -18
  81. package/dist/components/form/Input.syntax.hook.js +7 -73
  82. package/dist/components/form/Input.utils.d.ts +1 -2
  83. package/dist/components/form/Input.utils.js +26 -21
  84. package/dist/components/form/InputContentEditable.hook.d.ts +40 -0
  85. package/dist/components/form/InputContentEditable.hook.js +471 -0
  86. package/dist/components/form/InputSuggestion.d.ts +2 -2
  87. package/dist/components/form/InputSuggestion.js +169 -107
  88. package/dist/components/form/PasswordInput.js +8 -8
  89. package/dist/components/form/TextInput.js +11 -11
  90. package/dist/components/form/useForm.d.ts +1 -0
  91. package/dist/components/form/useForm.js +45 -60
  92. package/dist/components/menu/Menu.js +4 -4
  93. package/dist/index.js +155 -154
  94. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +30 -30
  95. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +8 -8
  96. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +8 -8
  97. package/dist/node_modules/fast-deep-equal/index.js +31 -0
  98. package/dist/node_modules/object-assign/index.js +49 -0
  99. package/dist/node_modules/prop-types/checkPropTypes.js +54 -0
  100. package/dist/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
  101. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
  102. package/dist/node_modules/prop-types/index.js +17 -0
  103. package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
  104. package/dist/node_modules/prop-types/lib/has.js +7 -0
  105. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +87 -0
  106. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +70 -0
  107. package/dist/node_modules/prop-types/node_modules/react-is/index.js +10 -0
  108. package/dist/node_modules/react-contenteditable/lib/react-contenteditable.js +132 -0
  109. package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +6235 -0
  110. package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +4096 -0
  111. package/dist/node_modules/react-dom/cjs/react-dom-server.browser.development.js +6753 -0
  112. package/dist/node_modules/react-dom/cjs/react-dom-server.browser.production.js +4645 -0
  113. package/dist/node_modules/react-dom/server.browser.js +15 -0
  114. package/dist/utils/generics.d.ts +2 -0
  115. package/dist/utils/generics.js +93 -80
  116. package/dist/utils/index.js +22 -21
  117. package/dist/utils/inspection.d.ts +4 -2
  118. package/dist/utils/inspection.js +27 -2
  119. package/package.json +10 -8
  120. package/dist/components/form/Input.selection.hook.d.ts +0 -17
  121. package/dist/components/form/Input.selection.hook.js +0 -78
  122. package/dist/components/form/InputSyntax.d.ts +0 -19
  123. package/dist/components/form/InputSyntax.js +0 -52
  124. package/dist/components/form/inputSyntaxMapping.d.ts +0 -3
  125. package/dist/components/form/inputSyntaxMapping.js +0 -42
@@ -1,133 +1,132 @@
1
- import { jsx as V, jsxs as U } from "react/jsx-runtime";
2
- import { c as $ } from "../../_virtual/compiler-runtime.js";
1
+ import { jsx as z, jsxs as Q } from "react/jsx-runtime";
2
+ import { c as Z } from "../../_virtual/compiler-runtime.js";
3
3
  import "../../utils/contextStore.js";
4
- import K from "react";
5
- import { mergeCode0Props as J } from "../../utils/utils.js";
6
- import { ReactFlowProvider as Q, useNodesState as Z, useEdgesState as tt, useUpdateNodeInternals as et, ReactFlow as ot, Background as st, BackgroundVariant as nt } from "@xyflow/react";
4
+ import W from "react";
5
+ import { mergeCode0Props as tt } from "../../utils/utils.js";
6
+ import { ReactFlowProvider as et, useNodesState as ot, useEdgesState as st, useUpdateNodeInternals as nt, ReactFlow as it, Background as rt, BackgroundVariant as at } from "@xyflow/react";
7
7
  import '../../assets/components/d-flow-panel/DFlowMiniMap.style.css';import '../../assets/components/d-flow/DFlow.style.css';import '../../assets/node_modules/@xyflow/react/dist/style.css';/* empty css */
8
8
  /* empty css */
9
- import { DFlowFunctionDefaultCard as it } from "../d-flow-function/DFlowFunctionDefaultCard.js";
10
- import { DFlowFunctionGroupCard as rt } from "../d-flow-function/DFlowFunctionGroupCard.js";
11
- import { DFlowFunctionSuggestionCard as at } from "../d-flow-function/DFlowFunctionSuggestionCard.js";
12
- import { DFlowFunctionTriggerCard as dt } from "../d-flow-function/DFlowFunctionTriggerCard.js";
13
- import { DFlowEdge as ct } from "./DFlowEdge.js";
14
- import { DFlowPanelSize as ht } from "../d-flow-panel/DFlowPanelSize.js";
15
- import { DFlowPanelControl as lt } from "../d-flow-panel/DFlowPanelControl.js";
16
- import { useFlowEdges as pt } from "./DFlow.edges.hook.js";
17
- import { useFlowNodes as gt } from "./DFlow.nodes.hook.js";
9
+ import { DFlowFunctionDefaultCard as ct } from "../d-flow-function/DFlowFunctionDefaultCard.js";
10
+ import { DFlowFunctionGroupCard as dt } from "../d-flow-function/DFlowFunctionGroupCard.js";
11
+ import { DFlowFunctionSuggestionCard as ht } from "../d-flow-function/DFlowFunctionSuggestionCard.js";
12
+ import { DFlowFunctionTriggerCard as lt } from "../d-flow-function/DFlowFunctionTriggerCard.js";
13
+ import { DFlowEdge as gt } from "./DFlowEdge.js";
14
+ import { DFlowPanelSize as pt } from "../d-flow-panel/DFlowPanelSize.js";
15
+ import { DFlowPanelControl as mt } from "../d-flow-panel/DFlowPanelControl.js";
16
+ import { useFlowEdges as ft } from "./DFlow.edges.hook.js";
17
+ import { useFlowNodes as ut } from "./DFlow.nodes.hook.js";
18
18
  import "../button/Button.js";
19
19
  /* empty css */
20
- import { DFlowPanelLayout as mt } from "../d-flow-panel/DFlowPanelLayout.js";
21
- import { DFlowValidation as ft } from "../d-flow-validation/DFlowValidation.js";
22
- const ut = (E, k) => {
23
- if (!k || k.size === 0)
24
- return {
25
- nodes: E
26
- };
27
- const m = 50, B = 50, b = 16, Y = 0.25;
28
- let _ = 0, D = !1;
29
- const f = E.map((o) => ({
30
- ...o
31
- })), z = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
32
- for (const o of f) {
33
- const n = o.data?.linkingId;
34
- if (n) {
35
- let s = H.get(n);
36
- s || (s = [], H.set(n, s)), s.push(o.id);
20
+ import { DFlowPanelLayout as wt } from "../d-flow-panel/DFlowPanelLayout.js";
21
+ import { DFlowValidation as yt } from "../d-flow-validation/DFlowValidation.js";
22
+ const xt = (m, F) => {
23
+ if (!F || F.size === 0) return {
24
+ nodes: m
25
+ };
26
+ const w = 50, Y = 50, N = 16, x = 0.25;
27
+ let G = 0, A = !1;
28
+ const K = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
29
+ for (const e of m) {
30
+ const a = e.data?.linkingId;
31
+ if (a) {
32
+ const l = H.get(a) ?? [];
33
+ l.push(e.id), H.set(a, l);
37
34
  }
38
- if (o.parentId && !n) {
39
- let s = z.get(o.parentId);
40
- s || (s = [], z.set(o.parentId, s)), s.push(o.id);
35
+ if (e.parentId && !a) {
36
+ const l = K.get(e.parentId) ?? [];
37
+ l.push(e.id), K.set(e.parentId, l);
41
38
  }
42
39
  }
43
- const L = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new Map(), G = new Map(f.map((o) => [o.id, o]));
44
- for (const [o, n] of z) {
45
- const s = new Array(n.length);
46
- for (let u = 0; u < n.length; u++) s[u] = G.get(n[u]);
47
- L.set(o, s);
40
+ const R = new Map(m.map((e) => [e.id, e])), O = /* @__PURE__ */ new Map();
41
+ for (const [e, a] of K) {
42
+ const l = new Array(a.length);
43
+ for (let p = 0; p < a.length; p++) l[p] = R.get(a[p]);
44
+ O.set(e, l);
48
45
  }
49
- for (const [o, n] of H) {
50
- const s = new Array(n.length);
51
- for (let u = 0; u < n.length; u++) s[u] = G.get(n[u]);
52
- W.set(o, s);
46
+ const X = /* @__PURE__ */ new Map();
47
+ for (const [e, a] of H) {
48
+ const l = new Array(a.length);
49
+ for (let p = 0; p < a.length; p++) l[p] = R.get(a[p]);
50
+ X.set(e, l);
53
51
  }
54
- const F = /* @__PURE__ */ new Map();
55
- for (const o of f) {
56
- const n = typeof o.style?.width == "number" ? o.style.width : void 0, s = typeof o.style?.height == "number" ? o.style.height : void 0, u = o.measured?.width && o.measured.width > 0 ? o.measured.width : void 0, T = o.measured?.height && o.measured.height > 0 ? o.measured.height : void 0;
57
- F.set(o.id, {
58
- w: n ?? u ?? 200,
59
- h: s ?? T ?? 80
52
+ const C = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
53
+ for (const e of m) {
54
+ const a = typeof e.style?.width == "number" ? e.style.width : void 0, l = typeof e.style?.height == "number" ? e.style.height : void 0, p = e.measured?.width && e.measured.width > 0 ? e.measured.width : void 0, T = e.measured?.height && e.measured.height > 0 ? e.measured.height : void 0;
55
+ b.set(e.id, {
56
+ w: a ?? p ?? 200,
57
+ h: l ?? T ?? 80
60
58
  });
61
59
  }
62
- const C = /* @__PURE__ */ new Map(), l = (o) => {
63
- if (C.has(o.id)) return C.get(o.id);
64
- if (o.type !== "group") {
65
- const M = F.get(o.id);
66
- return C.set(o.id, M), M;
60
+ const E = (e) => B.get(e.id)?.width, y = (e) => B.get(e.id)?.height, f = /* @__PURE__ */ new Map(), I = (e) => {
61
+ const a = f.get(e.id);
62
+ if (a) return a;
63
+ if (e.type !== "group") {
64
+ const S = b.get(e.id);
65
+ return f.set(e.id, S), S;
67
66
  }
68
- const n = typeof o.style?.width == "number" ? o.style.width : void 0, s = typeof o.style?.height == "number" ? o.style.height : void 0;
69
- if (n !== void 0 && s !== void 0) {
70
- const M = {
71
- w: n,
72
- h: s
67
+ const l = E(e), p = y(e);
68
+ if (l !== void 0 && p !== void 0) {
69
+ const S = {
70
+ w: l,
71
+ h: p
73
72
  };
74
- return C.set(o.id, M), M;
73
+ return f.set(e.id, S), S;
75
74
  }
76
- const u = L.get(o.id) ?? [];
77
- let T = 0, x = 0, N = 0;
78
- for (const M of u) {
79
- const A = l(M);
80
- T += A.h, A.w > x && (x = A.w), N++;
75
+ const T = O.get(e.id) ?? [];
76
+ let k = 0, V = 0, _ = 0;
77
+ for (const S of T) {
78
+ const L = I(S);
79
+ k += L.h, L.w > V && (V = L.w), _++;
81
80
  }
82
- T += m * Math.max(0, N - 1);
83
- const v = {
84
- w: x + 2 * b,
85
- h: (N ? T : 0) + 2 * b
81
+ k += w * Math.max(0, _ - 1);
82
+ const q = {
83
+ w: V + 2 * N,
84
+ h: (_ ? k : 0) + 2 * N
86
85
  };
87
- return C.set(o.id, v), v;
86
+ return f.set(e.id, q), q;
88
87
  };
89
88
  do {
90
- D = !1, _++, C.clear();
91
- for (const e of f) l(e);
92
- const o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), s = (e) => Math.round(e / 10), u = (e, p, g) => {
93
- const h = [{
94
- node: e,
95
- cx: p,
89
+ A = !1, G++, f.clear();
90
+ for (const o of m) I(o);
91
+ const e = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), l = (o) => Math.round(o / 10), p = (o, h, g) => {
92
+ const i = [{
93
+ node: o,
94
+ cx: h,
96
95
  cy: g,
97
96
  phase: 0
98
97
  }];
99
- let y = 0;
100
- for (; h.length; ) {
101
- const t = h[h.length - 1];
98
+ let M = 0;
99
+ for (; i.length; ) {
100
+ const t = i[i.length - 1];
102
101
  switch (t.phase) {
103
102
  case 0: {
104
- o.set(t.node.id, {
103
+ e.set(t.node.id, {
105
104
  x: t.cx,
106
105
  y: t.cy
107
106
  });
108
107
  const {
109
- w: i,
108
+ w: n,
110
109
  h: r
111
- } = l(t.node);
112
- t.w = i, t.h = r;
113
- const a = W.get(t.node.id) ?? [], d = [], w = [];
114
- for (const I of a)
115
- I.type === "group" ? w.push(I) : d.push(I);
116
- d.sort((I, c) => +I.data?.paramIndex - +c.data?.paramIndex), w.sort((I, c) => +I.data?.paramIndex - +c.data?.paramIndex), t.right = d, t.gParams = w;
117
- let P = 0;
118
- for (const I of d) P += l(I).h;
119
- P += m * Math.max(0, d.length - 1), t.py = t.cy - P / 2, t.rightBottom = t.cy + r / 2, t.rightIndex = 0, t.phase = 1;
110
+ } = I(t.node);
111
+ t.w = n, t.h = r;
112
+ const s = X.get(t.node.id) ?? [], c = [], D = [];
113
+ for (const d of s)
114
+ d.type === "group" ? D.push(d) : c.push(d);
115
+ c.sort((d, u) => +d.data?.paramIndex - +u.data?.paramIndex), D.sort((d, u) => +d.data?.paramIndex - +u.data?.paramIndex), t.right = c, t.gParams = D;
116
+ let v = 0;
117
+ for (const d of c) v += I(d).h;
118
+ v += w * Math.max(0, c.length - 1), t.py = t.cy - v / 2, t.rightBottom = t.cy + r / 2, t.rightIndex = 0, t.phase = 1;
120
119
  break;
121
120
  }
122
121
  case 1: {
123
122
  if (t.rightIndex < t.right.length) {
124
- const i = t.right[t.rightIndex], r = l(i), a = t.cx + t.w / 2 + B + r.w / 2;
125
- let d = t.py + r.h / 2;
126
- const w = s(a), I = (n.get(w) ?? Number.NEGATIVE_INFINITY) + m;
127
- d - r.h / 2 < I && (d = I + r.h / 2, t.py = d - r.h / 2), t.childKey = w, t.childPs = r, h.push({
128
- node: i,
129
- cx: a,
130
- cy: d,
123
+ const n = t.right[t.rightIndex], r = I(n), s = t.cx + t.w / 2 + Y + r.w / 2;
124
+ let c = t.py + r.h / 2;
125
+ const D = l(s), d = (a.get(D) ?? Number.NEGATIVE_INFINITY) + w;
126
+ c - r.h / 2 < d && (c = d + r.h / 2, t.py = c - r.h / 2), t.childKey = D, t.childPs = r, i.push({
127
+ node: n,
128
+ cx: s,
129
+ cy: c,
131
130
  phase: 0
132
131
  }), t.phase = 10;
133
132
  } else
@@ -135,30 +134,30 @@ const ut = (E, k) => {
135
134
  break;
136
135
  }
137
136
  case 10: {
138
- const i = t.lastChildBottom;
139
- n.set(t.childKey, Math.max(n.get(t.childKey) ?? Number.NEGATIVE_INFINITY, i)), t.rightBottom = Math.max(t.rightBottom, i), t.py = Math.max(t.py + t.childPs.h + m, i + m), t.rightIndex++, t.phase = 1;
137
+ const n = t.lastChildBottom;
138
+ a.set(t.childKey, Math.max(a.get(t.childKey) ?? Number.NEGATIVE_INFINITY, n)), t.rightBottom = Math.max(t.rightBottom, n), t.py = Math.max(t.py + t.childPs.h + w, n + w), t.rightIndex++, t.phase = 1;
140
139
  break;
141
140
  }
142
141
  case 2: {
143
142
  if (t.gParams && t.gParams.length) {
144
- const i = [];
143
+ const n = [];
145
144
  let r = 0;
146
- for (const a of t.gParams) {
147
- const d = l(a);
148
- i.push(d), r += d.w;
145
+ for (const s of t.gParams) {
146
+ const c = I(s);
147
+ n.push(c), r += c.w;
149
148
  }
150
- r += B * (t.gParams.length - 1), t.gSizes = i, t.gx = t.cx - r / 2, t.gy = t.bottom + m, t.rowBottom = t.bottom, t.gIndex = 0, t.phase = 3;
149
+ r += Y * (t.gParams.length - 1), t.gSizes = n, t.gx = t.cx - r / 2, t.gy = t.bottom + w, t.rowBottom = t.bottom, t.gIndex = 0, t.phase = 3;
151
150
  } else
152
151
  t.phase = 4;
153
152
  break;
154
153
  }
155
154
  case 3: {
156
155
  if (t.gIndex < t.gParams.length) {
157
- const i = t.gParams[t.gIndex], r = t.gSizes[t.gIndex], a = t.gx + r.w / 2, d = t.gy + r.h / 2;
158
- t.gx += r.w + B, h.push({
159
- node: i,
160
- cx: a,
161
- cy: d,
156
+ const n = t.gParams[t.gIndex], r = t.gSizes[t.gIndex], s = t.gx + r.w / 2, c = t.gy + r.h / 2;
157
+ t.gx += r.w + Y, i.push({
158
+ node: n,
159
+ cx: s,
160
+ cy: c,
162
161
  phase: 0
163
162
  }), t.childPs = r, t.phase = 30;
164
163
  } else
@@ -166,227 +165,264 @@ const ut = (E, k) => {
166
165
  break;
167
166
  }
168
167
  case 30: {
169
- const i = t.lastChildBottom;
170
- t.rowBottom = Math.max(t.rowBottom, i), t.gIndex++, t.phase = 3;
168
+ const n = t.lastChildBottom;
169
+ t.rowBottom = Math.max(t.rowBottom, n), t.gIndex++, t.phase = 3;
171
170
  break;
172
171
  }
173
172
  case 4: {
174
173
  if (t.node.type === "group") {
175
- const i = L.get(t.node.id) ?? [], r = [];
176
- for (const a of i)
177
- a.data?.linkingId || r.push(a);
178
- t.kids = r, t.kidIndex = 0, t.curY = t.cy - t.h / 2 + b, t.phase = 5;
174
+ const n = O.get(t.node.id) ?? [], r = [];
175
+ for (const s of n)
176
+ s.data?.linkingId || r.push(s);
177
+ t.kids = r, t.kidIndex = 0, t.curY = t.cy - t.h / 2 + N, t.phase = 5;
179
178
  } else
180
179
  t.phase = 6;
181
180
  break;
182
181
  }
183
182
  case 5: {
184
183
  if (t.kidIndex < t.kids.length) {
185
- const i = t.kids[t.kidIndex], r = l(i), a = t.curY + r.h / 2;
186
- h.push({
187
- node: i,
184
+ const n = t.kids[t.kidIndex], r = I(n), s = t.curY + r.h / 2;
185
+ i.push({
186
+ node: n,
188
187
  cx: t.cx,
189
- cy: a,
188
+ cy: s,
190
189
  phase: 0
191
190
  }), t.childPs = r, t.phase = 50;
192
191
  } else {
193
- const i = t.curY - m;
194
- t.bottom = Math.max(t.bottom, i + b), t.phase = 6;
192
+ const n = t.curY - w;
193
+ t.bottom = Math.max(t.bottom, n + N), t.phase = 6;
195
194
  }
196
195
  break;
197
196
  }
198
197
  case 50: {
199
- const i = t.lastChildBottom;
200
- t.curY = i + m, t.kidIndex++, t.phase = 5;
198
+ const n = t.lastChildBottom;
199
+ t.curY = n + w, t.kidIndex++, t.phase = 5;
201
200
  break;
202
201
  }
203
202
  case 6: {
204
- const i = h.pop();
205
- h.length ? h[h.length - 1].lastChildBottom = i.bottom : y = i.bottom;
203
+ const n = i.pop();
204
+ i.length ? i[i.length - 1].lastChildBottom = n.bottom : M = n.bottom;
206
205
  break;
207
206
  }
208
207
  }
209
208
  }
210
- return y;
209
+ return M;
211
210
  };
212
211
  let T = 0;
213
- for (const e of f)
214
- !e.data?.linkingId && !e.parentId && (T = u(e, 0, T + l(e).h / 2) + m);
215
- const x = /* @__PURE__ */ new Map();
216
- for (const e of f) x.set(e.id, o.get(e.id));
217
- const N = /* @__PURE__ */ new Map();
218
- for (const e of f) {
212
+ for (const o of m)
213
+ !o.data?.linkingId && !o.parentId && (T = p(o, 0, T + I(o).h / 2) + w);
214
+ const k = /* @__PURE__ */ new Map();
215
+ for (const o of m) {
219
216
  const {
220
- w: p,
217
+ w: h,
221
218
  h: g
222
- } = l(e), {
223
- x: h,
224
- y
225
- } = x.get(e.id);
226
- N.set(e.id, {
227
- x: h - p / 2,
228
- y: y - g / 2
219
+ } = I(o), i = e.get(o.id);
220
+ k.set(o.id, {
221
+ x: i.x - h / 2,
222
+ y: i.y - g / 2
229
223
  });
230
224
  }
231
- for (const e of f) {
232
- const p = N.get(e.id);
233
- let g = p.x, h = p.y;
234
- if (e.parentId) {
235
- const y = N.get(e.parentId);
236
- g -= y.x, h -= y.y;
225
+ for (const o of m) {
226
+ const h = k.get(o.id);
227
+ let g = h.x, i = h.y;
228
+ if (o.parentId) {
229
+ const t = k.get(o.parentId);
230
+ g -= t.x, i -= t.y;
237
231
  }
238
- e.position = {
232
+ const M = C.get(o.id);
233
+ (!M || Math.abs(M.x - g) > x || Math.abs(M.y - i) > x) && (C.set(o.id, {
239
234
  x: g,
240
- y: h
241
- };
235
+ y: i
236
+ }), A = !0);
242
237
  }
243
- const v = /* @__PURE__ */ new Map();
244
- for (const e of f) v.set(e.id, e);
245
- const M = (e) => {
246
- let p = 0, g = e;
247
- for (; g?.parentId && (p++, g = v.get(g.parentId), !!g); )
238
+ const V = (o) => {
239
+ let h = 0, g = o;
240
+ for (; g?.parentId && (h++, g = R.get(g.parentId), !!g); )
248
241
  ;
249
- return p;
250
- }, A = [];
251
- for (const e of f)
252
- e.type === "group" && A.push(e);
253
- A.sort((e, p) => M(p) - M(e));
254
- for (const e of A) {
255
- const p = [];
256
- for (const c of f)
257
- c.parentId === e.id && p.push(c);
258
- if (!p.length) {
259
- const c = typeof e.style?.width == "number" ? e.style.width : 2 * b, S = typeof e.style?.height == "number" ? e.style.height : 2 * b;
260
- e.style = {
261
- ...e.style,
262
- width: c,
263
- height: S
264
- };
265
- continue;
266
- }
267
- const g = (c) => {
268
- const S = typeof c.style?.width == "number" ? c.style.width : void 0, q = typeof c.style?.height == "number" ? c.style.height : void 0, X = F.get(c.id);
269
- return {
270
- w: S ?? X.w,
271
- h: q ?? X.h
272
- };
242
+ return h;
243
+ }, _ = [];
244
+ for (const o of m) o.type === "group" && _.push(o);
245
+ _.sort((o, h) => V(h) - V(o));
246
+ const q = (o) => {
247
+ const h = typeof o.style?.width == "number" ? o.style.width : void 0, g = typeof o.style?.height == "number" ? o.style.height : void 0, i = b.get(o.id);
248
+ return {
249
+ w: h ?? i.w,
250
+ h: g ?? i.h
273
251
  };
274
- let h = Number.POSITIVE_INFINITY, y = Number.POSITIVE_INFINITY, t = Number.NEGATIVE_INFINITY, i = Number.NEGATIVE_INFINITY;
275
- for (const c of p) {
276
- const S = g(c);
277
- c.position.x < h && (h = c.position.x), c.position.y < y && (y = c.position.y), c.position.x + S.w > t && (t = c.position.x + S.w), c.position.y + S.h > i && (i = c.position.y + S.h);
252
+ };
253
+ for (const o of _) {
254
+ const h = [];
255
+ for (const d of m)
256
+ d.parentId === o.id && h.push(d);
257
+ if (!h.length) {
258
+ const d = E(o) ?? (typeof o.style?.width == "number" ? o.style.width : 2 * N), u = y(o) ?? (typeof o.style?.height == "number" ? o.style.height : 2 * N);
259
+ B.set(o.id, {
260
+ width: d,
261
+ height: u
262
+ }), j.set(o.id, {
263
+ width: d,
264
+ height: u
265
+ }), b.set(o.id, {
266
+ w: d,
267
+ h: u
268
+ });
269
+ continue;
278
270
  }
279
- const r = h - b, a = y - b;
280
- if (Math.abs(r) > Y || Math.abs(a) > Y) {
281
- for (const c of p)
282
- c.position.x -= r, c.position.y -= a;
283
- D = !0;
271
+ let g = Number.POSITIVE_INFINITY, i = Number.POSITIVE_INFINITY, M = Number.NEGATIVE_INFINITY, t = Number.NEGATIVE_INFINITY;
272
+ for (const d of h) {
273
+ const u = q(d), P = C.get(d.id);
274
+ P.x < g && (g = P.x), P.y < i && (i = P.y), P.x + u.w > M && (M = P.x + u.w), P.y + u.h > t && (t = P.y + u.h);
284
275
  }
285
- const d = t - h + 2 * b, w = i - y + 2 * b, P = typeof e.style?.width == "number" ? e.style.width : l(e).w, I = typeof e.style?.height == "number" ? e.style.height : l(e).h;
286
- (Math.abs(d - P) > Y || Math.abs(w - I) > Y) && (D = !0), e.measured = {
287
- width: d,
288
- height: w
289
- }, e.style = {
290
- ...e.style,
291
- width: d,
292
- height: w
293
- }, F.set(e.id, {
294
- w: d,
295
- h: w
276
+ const n = g - N, r = i - N;
277
+ if (Math.abs(n) > x || Math.abs(r) > x)
278
+ for (const d of h) {
279
+ const u = C.get(d.id), P = u.x - n, U = u.y - r;
280
+ (Math.abs(u.x - P) > x || Math.abs(u.y - U) > x) && (C.set(d.id, {
281
+ x: P,
282
+ y: U
283
+ }), A = !0);
284
+ }
285
+ const s = M - g + 2 * N, c = t - i + 2 * N, D = E(o) ?? (typeof o.style?.width == "number" ? o.style.width : I(o).w), v = y(o) ?? (typeof o.style?.height == "number" ? o.style.height : I(o).h);
286
+ (Math.abs(s - D) > x || Math.abs(c - v) > x) && (A = !0), B.set(o.id, {
287
+ width: s,
288
+ height: c
289
+ }), j.set(o.id, {
290
+ width: s,
291
+ height: c
292
+ }), b.set(o.id, {
293
+ w: s,
294
+ h: c
296
295
  });
297
296
  }
298
- C.clear();
299
- for (const e of f) l(e);
300
- const R = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map();
301
- for (const e of f) {
302
- const p = l(e), g = o.get(e.id);
303
- O.set(e.id, g), R.set(e.id, {
304
- x: g.x - p.w / 2,
305
- y: g.y - p.h / 2
297
+ f.clear();
298
+ for (const o of m) I(o);
299
+ const S = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map();
300
+ for (const o of m) {
301
+ const h = I(o), g = e.get(o.id);
302
+ L.set(o.id, g), S.set(o.id, {
303
+ x: g.x - h.w / 2,
304
+ y: g.y - h.h / 2
306
305
  });
307
306
  }
308
- for (const e of f) {
309
- const p = [], g = W.get(e.id) ?? [];
310
- for (const a of g)
311
- a.type === "group" && p.push(a);
312
- if (!p.length) continue;
313
- const h = p.slice().sort((a, d) => (+a.data?.paramIndex || 0) - (+d.data?.paramIndex || 0)), y = [];
314
- for (const a of h) {
315
- const d = v.get(a.id), w = typeof d.style?.width == "number" ? d.style.width : void 0;
316
- y.push(w ?? l(d).w);
307
+ for (const o of m) {
308
+ const h = [], g = X.get(o.id) ?? [];
309
+ for (const s of g) s.type === "group" && h.push(s);
310
+ if (!h.length) continue;
311
+ const i = h.slice().sort((s, c) => (+s.data?.paramIndex || 0) - (+c.data?.paramIndex || 0)), M = [];
312
+ for (const s of i) {
313
+ const c = E(s) ?? (typeof s.style?.width == "number" ? s.style.width : void 0);
314
+ M.push(c ?? I(s).w);
317
315
  }
318
316
  let t = 0;
319
- for (const a of y) t += a;
320
- t += B * (h.length - 1);
321
- let r = O.get(e.id).x - t / 2;
322
- for (let a = 0; a < h.length; a++) {
323
- const d = h[a], w = v.get(d.id), P = w.parentId ? R.get(w.parentId) : {
317
+ for (const s of M) t += s;
318
+ t += Y * (i.length - 1);
319
+ let r = L.get(o.id).x - t / 2;
320
+ for (let s = 0; s < i.length; s++) {
321
+ const c = i[s], D = c.parentId ? S.get(c.parentId) : {
324
322
  x: 0
325
- };
326
- w.position.x = r - P.x, r += y[a] + B;
323
+ }, v = C.get(c.id), d = r - D.x, u = v.y;
324
+ (Math.abs(v.x - d) > x || Math.abs(v.y - u) > x) && (C.set(c.id, {
325
+ x: d,
326
+ y: u
327
+ }), A = !0), r += M[s] + Y;
327
328
  }
328
329
  }
329
- } while (D && _ < 5);
330
+ } while (A && G < 5);
330
331
  return {
331
- nodes: f
332
+ nodes: m.map((e) => {
333
+ const a = C.get(e.id), l = j.get(e.id), p = B.get(e.id);
334
+ let T = !1;
335
+ if (a) {
336
+ const k = e.position ?? {
337
+ x: 0,
338
+ y: 0
339
+ };
340
+ (Math.abs(k.x - a.x) > x || Math.abs(k.y - a.y) > x) && (T = !0);
341
+ }
342
+ if (l) {
343
+ const k = e.measured ?? {
344
+ width: 0,
345
+ height: 0
346
+ };
347
+ (Math.abs(k.width - l.width) > x || Math.abs(k.height - l.height) > x) && (T = !0);
348
+ }
349
+ if (p) {
350
+ const k = typeof e.style?.width == "number" ? e.style.width : void 0, V = typeof e.style?.height == "number" ? e.style.height : void 0;
351
+ (k !== p.width || V !== p.height) && (T = !0);
352
+ }
353
+ return T ? {
354
+ ...e,
355
+ position: a ?? e.position,
356
+ measured: l ? {
357
+ ...e.measured,
358
+ width: l.width,
359
+ height: l.height
360
+ } : e.measured,
361
+ style: p ? {
362
+ ...e.style,
363
+ width: p.width,
364
+ height: p.height
365
+ } : e.style
366
+ } : e;
367
+ })
332
368
  };
333
- }, j = K.cache(ut), Ht = (E) => {
334
- const k = $.c(2);
335
- let m;
336
- return k[0] !== E ? (m = /* @__PURE__ */ V(Q, { children: /* @__PURE__ */ V(wt, { ...E }) }), k[0] = E, k[1] = m) : m = k[1], m;
337
- }, wt = (E) => {
369
+ }, $ = W.cache(xt), Gt = (m) => {
370
+ const F = Z.c(2);
371
+ let w;
372
+ return F[0] !== m ? (w = /* @__PURE__ */ z(et, { children: /* @__PURE__ */ z(It, { ...m }) }), F[0] = m, F[1] = w) : w = F[1], w;
373
+ }, It = (m) => {
338
374
  const {
339
- flowId: k,
340
- namespaceId: m,
341
- projectId: B
342
- } = E, b = {
343
- default: it,
344
- group: rt,
345
- suggestion: at,
346
- trigger: dt
347
- }, Y = {
348
- default: ct
349
- }, _ = gt(k, m, B), D = pt(k, m, B), [f, z] = Z([]), [H, L, W] = tt([]), G = et(), F = K.useCallback((l) => {
375
+ flowId: F,
376
+ namespaceId: w,
377
+ projectId: Y
378
+ } = m, N = W.useMemo(() => ({
379
+ default: ct,
380
+ group: dt,
381
+ suggestion: ht,
382
+ trigger: lt
383
+ }), []), x = W.useMemo(() => ({
384
+ default: gt
385
+ }), []), G = ut(F, w, Y), A = ft(F, w, Y), [K, H] = ot([]), [R, O, X] = st([]), C = nt(), B = W.useCallback((b) => {
350
386
  requestAnimationFrame(() => {
351
- l.forEach((o) => G(o));
387
+ b.forEach((E) => C(E));
352
388
  });
353
- }, [G]), C = K.useCallback((l) => {
354
- const o = Array.from(new Set(l.filter((s) => s.type === "dimensions" || s.type === "position").map((s) => s.id))), n = /* @__PURE__ */ new Map();
355
- l.filter((s) => s.type === "dimensions").forEach((s) => n.set(s.id, s.dimensions)), z((s) => {
356
- const u = s.map((x) => {
357
- if (!n.has(x.id)) return x;
358
- const N = n.get(x.id) || {};
389
+ }, [C]), j = W.useCallback((b) => {
390
+ const E = Array.from(new Set(b.filter((f) => f.type === "dimensions" || f.type === "position").map((f) => f.id))), y = /* @__PURE__ */ new Map();
391
+ b.filter((f) => f.type === "dimensions").forEach((f) => y.set(f.id, f.dimensions)), H((f) => {
392
+ const I = f.map((e) => {
393
+ if (!y.has(e.id)) return e;
394
+ const a = y.get(e.id) || {};
359
395
  return {
360
- ...x,
396
+ ...e,
361
397
  measured: {
362
- width: N.width ?? x.measured?.width ?? 0,
363
- height: N.height ?? x.measured?.height ?? 0
398
+ width: a.width ?? e.measured?.width ?? 0,
399
+ height: a.height ?? e.measured?.height ?? 0
364
400
  }
365
401
  };
366
402
  });
367
- return j(u, new Set(o)).nodes;
368
- }), F(o);
369
- }, [F]);
370
- return K.useEffect(() => {
371
- const l = _.map((n) => {
372
- const s = n.measured ? [] : document.querySelectorAll("[data-id='" + n.id + "']");
403
+ return $(I, new Set(E)).nodes;
404
+ }), B(E);
405
+ }, [B]);
406
+ return W.useEffect(() => {
407
+ const b = G.map((y) => {
408
+ const f = y.measured ? [] : document.querySelectorAll("[data-id='" + y.id + "']");
373
409
  return {
374
- ...n,
410
+ ...y,
375
411
  measured: {
376
- width: n.measured?.width ?? s[0]?.clientWidth ?? 0,
377
- height: n.measured?.height ?? s[0]?.clientHeight ?? 0
412
+ width: y.measured?.width ?? f[0]?.clientWidth ?? 0,
413
+ height: y.measured?.height ?? f[0]?.clientHeight ?? 0
378
414
  }
379
415
  };
380
- }), o = j(l, new Set(l.map((n) => n.id)));
381
- z(o.nodes), L(D), F(o.nodes.map((n) => n.id));
382
- }, [_, D, F]), /* @__PURE__ */ U(ot, { onlyRenderVisibleElements: !0, panOnScroll: !1, nodeTypes: b, edgeTypes: Y, onInit: (l) => l.fitView(), onNodesChange: C, onEdgesChange: W, fitView: !0, ...J("flow", E), nodes: f, edges: H, children: [
383
- /* @__PURE__ */ V(st, { variant: nt.Dots, color: "rgba(255,255,255, .05)", gap: 8, size: 2 }),
384
- /* @__PURE__ */ V(ht, {}),
385
- /* @__PURE__ */ V(mt, {}),
386
- /* @__PURE__ */ V(ft, { flowId: "gid://sagittarius/Flow/1" }),
387
- /* @__PURE__ */ V(lt, { flowId: k })
416
+ }), E = $(b, new Set(b.map((y) => y.id)));
417
+ H(E.nodes), O(A), B(E.nodes.map((y) => y.id));
418
+ }, [G, A, B]), /* @__PURE__ */ Q(it, { onlyRenderVisibleElements: !0, panOnScroll: !1, nodeTypes: N, edgeTypes: x, onInit: (b) => b.fitView(), onNodesChange: j, onEdgesChange: X, ...tt("flow", m), nodes: K, edges: R, children: [
419
+ /* @__PURE__ */ z(rt, { variant: at.Dots, color: "rgba(255,255,255, .05)", gap: 8, size: 2 }),
420
+ /* @__PURE__ */ z(pt, {}),
421
+ /* @__PURE__ */ z(wt, {}),
422
+ /* @__PURE__ */ z(yt, { flowId: "gid://sagittarius/Flow/1" }),
423
+ /* @__PURE__ */ z(mt, { flowId: F })
388
424
  ] });
389
425
  };
390
426
  export {
391
- Ht as DFlow
427
+ Gt as DFlow
392
428
  };