lowcoder-comps 0.0.31 → 0.0.32

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 (86) hide show
  1. package/1e5cb9c2.js +447 -0
  2. package/24307cf2.js +25 -0
  3. package/256b619e.js +92 -0
  4. package/2b031be2.js +2967 -0
  5. package/2ff2c7a6.js +6 -0
  6. package/2ff7471d.js +9 -0
  7. package/444e09f1.js +268 -0
  8. package/4564a1bc.js +86 -0
  9. package/4a489df6.js +8 -0
  10. package/4a860f5d.js +505 -0
  11. package/4cc9caa5.js +2501 -0
  12. package/64d87c95.js +1536 -0
  13. package/6deaf0be.js +881 -0
  14. package/794e64d5.js +208 -0
  15. package/7a3f27e4.js +391 -0
  16. package/7ae6dd1c.js +319 -0
  17. package/92e85b65.js +65 -0
  18. package/97059d88.js +237 -0
  19. package/98955949.js +134435 -0
  20. package/a408f817.js +796 -0
  21. package/a40faea7.js +11624 -0
  22. package/a969f4ca.js +48428 -0
  23. package/aa1becc7.js +455 -0
  24. package/aa82b740.js +1269 -0
  25. package/c289b0aa.js +1102 -0
  26. package/c4d99b09.js +5 -0
  27. package/c9bb75eb.js +960 -0
  28. package/cb40fdd9.js +933 -0
  29. package/cc799554.js +1276 -0
  30. package/d3700d97.js +2284 -0
  31. package/d622fb26.js +818 -0
  32. package/d8c50a91.js +34 -0
  33. package/dce9fa3f.js +769 -0
  34. package/de8c90a7.js +1284 -0
  35. package/debd9490.js +819 -0
  36. package/df803461.js +220 -0
  37. package/e06dcfb0.js +1089 -0
  38. package/e6388bfd.js +915 -0
  39. package/ee801edf.js +804 -0
  40. package/f7c6b13d.js +19104 -0
  41. package/f8b68c1a.js +1127 -0
  42. package/f9637058.js +16 -0
  43. package/fcee2d3c.js +64 -0
  44. package/fd51bb2f.js +1579 -0
  45. package/index.js +5 -0
  46. package/package.json +4 -3
  47. package/README.md +0 -120
  48. package/index.html +0 -26
  49. package/index.tsx +0 -21
  50. package/jest.config.js +0 -6
  51. package/src/__test__/allComp.test.tsx +0 -61
  52. package/src/app-env.d.ts +0 -3
  53. package/src/comps/calendarComp/calendarComp.tsx +0 -633
  54. package/src/comps/calendarComp/calendarConstants.tsx +0 -1048
  55. package/src/comps/calendarComp/errorBoundary.tsx +0 -30
  56. package/src/comps/chartComp/chartComp.tsx +0 -442
  57. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +0 -51
  58. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +0 -307
  59. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +0 -9
  60. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +0 -55
  61. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +0 -96
  62. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +0 -83
  63. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +0 -62
  64. package/src/comps/chartComp/chartConstants.tsx +0 -299
  65. package/src/comps/chartComp/chartPropertyView.tsx +0 -235
  66. package/src/comps/chartComp/chartUtils.ts +0 -291
  67. package/src/comps/chartComp/reactEcharts/core.tsx +0 -194
  68. package/src/comps/chartComp/reactEcharts/index.ts +0 -21
  69. package/src/comps/chartComp/reactEcharts/types.ts +0 -76
  70. package/src/comps/chartComp/seriesComp.tsx +0 -119
  71. package/src/comps/imageEditorComp/imageEditorClass.tsx +0 -52
  72. package/src/comps/imageEditorComp/imageEditorConstants.tsx +0 -109
  73. package/src/comps/imageEditorComp/index.tsx +0 -184
  74. package/src/comps/mermaidComp/index.tsx +0 -44
  75. package/src/comps/mermaidComp/mermaid.tsx +0 -29
  76. package/src/global.ts +0 -1
  77. package/src/i18n/comps/index.tsx +0 -29
  78. package/src/i18n/comps/locales/en.ts +0 -163
  79. package/src/i18n/comps/locales/enObj.tsx +0 -198
  80. package/src/i18n/comps/locales/index.ts +0 -7
  81. package/src/i18n/comps/locales/types.tsx +0 -10
  82. package/src/i18n/comps/locales/zh.ts +0 -156
  83. package/src/i18n/comps/locales/zhObj.tsx +0 -4
  84. package/src/index.ts +0 -11
  85. package/tsconfig.json +0 -22
  86. package/vite.config.js +0 -10
package/794e64d5.js ADDED
@@ -0,0 +1,208 @@
1
+ var B = (e, n, t) => new Promise((i, c) => {
2
+ var r = (l) => {
3
+ try {
4
+ a(t.next(l));
5
+ } catch (s) {
6
+ c(s);
7
+ }
8
+ }, o = (l) => {
9
+ try {
10
+ a(t.throw(l));
11
+ } catch (s) {
12
+ c(s);
13
+ }
14
+ }, a = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(r, o);
15
+ a((t = t.apply(e, n)).next());
16
+ });
17
+ import { p as Q, d as M, s as X, D as U, a as Z, S as F, b as I, c as tt } from "./c9bb75eb.js";
18
+ import { G as et } from "./6deaf0be.js";
19
+ import { l as T, c as g, h as x, A as ot, i as st, j as w } from "./98955949.js";
20
+ import { r as nt } from "./7a3f27e4.js";
21
+ import "./64d87c95.js";
22
+ import "./4a489df6.js";
23
+ import "./c289b0aa.js";
24
+ import "./2b031be2.js";
25
+ import "./d8c50a91.js";
26
+ import "./2ff2c7a6.js";
27
+ import "./256b619e.js";
28
+ const h = "rect", C = "rectWithTitle", it = "start", ct = "end", rt = "divider", lt = "roundedWithTitle", at = "note", dt = "noteGroup", u = "statediagram", Et = "state", St = `${u}-${Et}`, V = "transition", Tt = "note", pt = "note-edge", _t = `${V} ${pt}`, ut = `${u}-${Tt}`, Dt = "cluster", bt = `${u}-${Dt}`, ft = "cluster-alt", At = `${u}-${ft}`, Y = "parent", W = "note", ht = "state", N = "----", yt = `${N}${W}`, H = `${N}${Y}`, m = "fill:none", z = "fill: #333", j = "c", q = "text", K = "normal";
29
+ let y = {}, S = 0;
30
+ const gt = function(e) {
31
+ const n = Object.keys(e);
32
+ for (const t of n)
33
+ e[t];
34
+ }, $t = function(e, n) {
35
+ return n.db.extract(n.db.getRootDocV2()), n.db.getClasses();
36
+ };
37
+ function xt(e) {
38
+ return e == null ? "" : e.classes ? e.classes.join(" ") : "";
39
+ }
40
+ function R(e = "", n = 0, t = "", i = N) {
41
+ const c = t !== null && t.length > 0 ? `${i}${t}` : "";
42
+ return `${ht}-${e}${c}-${n}`;
43
+ }
44
+ const A = (e, n, t, i, c, r) => {
45
+ const o = t.id, a = xt(i[o]);
46
+ if (o !== "root") {
47
+ let l = h;
48
+ t.start === !0 && (l = it), t.start === !1 && (l = ct), t.type !== U && (l = t.type), y[o] || (y[o] = {
49
+ id: o,
50
+ shape: l,
51
+ description: w.sanitizeText(o, g()),
52
+ classes: `${a} ${St}`
53
+ });
54
+ const s = y[o];
55
+ t.description && (Array.isArray(s.description) ? (s.shape = C, s.description.push(t.description)) : s.description.length > 0 ? (s.shape = C, s.description === o ? s.description = [t.description] : s.description = [s.description, t.description]) : (s.shape = h, s.description = t.description), s.description = w.sanitizeTextOrArray(s.description, g())), s.description.length === 1 && s.shape === C && (s.shape = h), !s.type && t.doc && (T.info("Setting cluster for ", o, G(t)), s.type = "group", s.dir = G(t), s.shape = t.type === Z ? rt : lt, s.classes = s.classes + " " + bt + " " + (r ? At : ""));
56
+ const _ = {
57
+ labelStyle: "",
58
+ shape: s.shape,
59
+ labelText: s.description,
60
+ // typeof newNode.description === 'object'
61
+ // ? newNode.description[0]
62
+ // : newNode.description,
63
+ classes: s.classes,
64
+ style: "",
65
+ //styles.style,
66
+ id: o,
67
+ dir: s.dir,
68
+ domId: R(o, S),
69
+ type: s.type,
70
+ padding: 15
71
+ //getConfig().flowchart.padding
72
+ };
73
+ if (_.centerLabel = !0, t.note) {
74
+ const d = {
75
+ labelStyle: "",
76
+ shape: at,
77
+ labelText: t.note.text,
78
+ classes: ut,
79
+ // useHtmlLabels: false,
80
+ style: "",
81
+ // styles.style,
82
+ id: o + yt + "-" + S,
83
+ domId: R(o, S, W),
84
+ type: s.type,
85
+ padding: 15
86
+ //getConfig().flowchart.padding
87
+ }, E = {
88
+ labelStyle: "",
89
+ shape: dt,
90
+ labelText: t.note.text,
91
+ classes: s.classes,
92
+ style: "",
93
+ // styles.style,
94
+ id: o + H,
95
+ domId: R(o, S, Y),
96
+ type: "group",
97
+ padding: 0
98
+ //getConfig().flowchart.padding
99
+ };
100
+ S++;
101
+ const D = o + H;
102
+ e.setNode(D, E), e.setNode(d.id, d), e.setNode(o, _), e.setParent(o, D), e.setParent(d.id, D);
103
+ let p = o, b = d.id;
104
+ t.note.position === "left of" && (p = d.id, b = o), e.setEdge(p, b, {
105
+ arrowhead: "none",
106
+ arrowType: "",
107
+ style: m,
108
+ labelStyle: "",
109
+ classes: _t,
110
+ arrowheadStyle: z,
111
+ labelpos: j,
112
+ labelType: q,
113
+ thickness: K
114
+ });
115
+ } else
116
+ e.setNode(o, _);
117
+ }
118
+ n && n.id !== "root" && (T.trace("Setting node ", o, " to be child of its parent ", n.id), e.setParent(o, n.id)), t.doc && (T.trace("Adding nodes children "), Ct(e, t, t.doc, i, c, !r));
119
+ }, Ct = (e, n, t, i, c, r) => {
120
+ T.trace("items", t), t.forEach((o) => {
121
+ switch (o.stmt) {
122
+ case I:
123
+ A(e, n, o, i, c, r);
124
+ break;
125
+ case U:
126
+ A(e, n, o, i, c, r);
127
+ break;
128
+ case F:
129
+ {
130
+ A(e, n, o.state1, i, c, r), A(e, n, o.state2, i, c, r);
131
+ const a = {
132
+ id: "edge" + S,
133
+ arrowhead: "normal",
134
+ arrowTypeEnd: "arrow_barb",
135
+ style: m,
136
+ labelStyle: "",
137
+ label: w.sanitizeText(o.description, g()),
138
+ arrowheadStyle: z,
139
+ labelpos: j,
140
+ labelType: q,
141
+ thickness: K,
142
+ classes: V
143
+ };
144
+ e.setEdge(o.state1.id, o.state2.id, a, S), S++;
145
+ }
146
+ break;
147
+ }
148
+ });
149
+ }, G = (e, n = tt) => {
150
+ let t = n;
151
+ if (e.doc)
152
+ for (let i = 0; i < e.doc.length; i++) {
153
+ const c = e.doc[i];
154
+ c.stmt === "dir" && (t = c.value);
155
+ }
156
+ return t;
157
+ }, Rt = function(e, n, t, i) {
158
+ return B(this, null, function* () {
159
+ T.info("Drawing state diagram (v2)", n), y = {}, i.db.getDirection();
160
+ const { securityLevel: c, state: r } = g(), o = r.nodeSpacing || 50, a = r.rankSpacing || 50;
161
+ T.info(i.db.getRootDocV2()), i.db.extract(i.db.getRootDocV2()), T.info(i.db.getRootDocV2());
162
+ const l = i.db.getStates(), s = new et({
163
+ multigraph: !0,
164
+ compound: !0
165
+ }).setGraph({
166
+ rankdir: G(i.db.getRootDocV2()),
167
+ nodesep: o,
168
+ ranksep: a,
169
+ marginx: 8,
170
+ marginy: 8
171
+ }).setDefaultEdgeLabel(function() {
172
+ return {};
173
+ });
174
+ A(s, void 0, i.db.getRootDocV2(), l, i.db, !0);
175
+ let _;
176
+ c === "sandbox" && (_ = x("#i" + n));
177
+ const d = c === "sandbox" ? x(_.nodes()[0].contentDocument.body) : x("body"), E = d.select(`[id="${n}"]`), D = d.select("#" + n + " g");
178
+ yield nt(D, s, ["barb"], u, n);
179
+ const p = 8;
180
+ ot.insertTitle(E, "statediagramTitleText", r.titleTopMargin, i.db.getDiagramTitle());
181
+ const b = E.node().getBBox(), L = b.width + p * 2, P = b.height + p * 2;
182
+ E.attr("class", u);
183
+ const O = E.node().getBBox();
184
+ st(E, P, L, r.useMaxWidth);
185
+ const k = `${O.x - p} ${O.y - p} ${L} ${P}`;
186
+ T.debug(`viewBox ${k}`), E.attr("viewBox", k);
187
+ const J = document.querySelectorAll('[id="' + n + '"] .edgeLabel .label');
188
+ for (const $ of J) {
189
+ const v = $.getBBox(), f = document.createElementNS("http://www.w3.org/2000/svg", h);
190
+ f.setAttribute("rx", 0), f.setAttribute("ry", 0), f.setAttribute("width", v.width), f.setAttribute("height", v.height), $.insertBefore(f, $.firstChild);
191
+ }
192
+ });
193
+ }, wt = {
194
+ setConf: gt,
195
+ getClasses: $t,
196
+ draw: Rt
197
+ }, Yt = {
198
+ parser: Q,
199
+ db: M,
200
+ renderer: wt,
201
+ styles: X,
202
+ init: (e) => {
203
+ e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute, M.clear();
204
+ }
205
+ };
206
+ export {
207
+ Yt as diagram
208
+ };
package/7a3f27e4.js ADDED
@@ -0,0 +1,391 @@
1
+ var X = (n, t, e) => new Promise((r, i) => {
2
+ var a = (l) => {
3
+ try {
4
+ d(e.next(l));
5
+ } catch (h) {
6
+ i(h);
7
+ }
8
+ }, u = (l) => {
9
+ try {
10
+ d(e.throw(l));
11
+ } catch (h) {
12
+ i(h);
13
+ }
14
+ }, d = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(a, u);
15
+ d((e = e.apply(n, t)).next());
16
+ });
17
+ import { i as N, G as H } from "./6deaf0be.js";
18
+ import { m as J, l as V } from "./64d87c95.js";
19
+ import { c as U } from "./4a489df6.js";
20
+ import { i as W, u as _, s as q, a as z, b as K, g as T, p as $, c as Q, d as Y, e as Z, f as I, h as L, j as D } from "./c289b0aa.js";
21
+ import { l as s, c as O, p as B, h as R } from "./98955949.js";
22
+ import { a as tt } from "./2b031be2.js";
23
+ function m(n) {
24
+ var t = {
25
+ options: {
26
+ directed: n.isDirected(),
27
+ multigraph: n.isMultigraph(),
28
+ compound: n.isCompound()
29
+ },
30
+ nodes: et(n),
31
+ edges: nt(n)
32
+ };
33
+ return N(n.graph()) || (t.value = U(n.graph())), t;
34
+ }
35
+ function et(n) {
36
+ return J(n.nodes(), function(t) {
37
+ var e = n.node(t), r = n.parent(t), i = { v: t };
38
+ return N(e) || (i.value = e), N(r) || (i.parent = r), i;
39
+ });
40
+ }
41
+ function nt(n) {
42
+ return J(n.edges(), function(t) {
43
+ var e = n.edge(t), r = { v: t.v, w: t.w };
44
+ return N(t.name) || (r.name = t.name), N(e) || (r.value = e), r;
45
+ });
46
+ }
47
+ let f = {}, g = {}, P = {};
48
+ const it = () => {
49
+ g = {}, P = {}, f = {};
50
+ }, p = (n, t) => (s.trace("In isDescendant", t, " ", n, " = ", g[t].includes(n)), !!g[t].includes(n)), st = (n, t) => (s.info("Descendants of ", t, " is ", g[t]), s.info("Edge is ", n), n.v === t || n.w === t ? !1 : g[t] ? g[t].includes(n.v) || p(n.v, t) || p(n.w, t) || g[t].includes(n.w) : (s.debug("Tilt, ", t, ",not in descendants"), !1)), k = (n, t, e, r) => {
51
+ s.warn(
52
+ "Copying children of ",
53
+ n,
54
+ "root",
55
+ r,
56
+ "data",
57
+ t.node(n),
58
+ r
59
+ );
60
+ const i = t.children(n) || [];
61
+ n !== r && i.push(n), s.warn("Copying (nodes) clusterId", n, "nodes", i), i.forEach((a) => {
62
+ if (t.children(a).length > 0)
63
+ k(a, t, e, r);
64
+ else {
65
+ const u = t.node(a);
66
+ s.info("cp ", a, " to ", r, " with parent ", n), e.setNode(a, u), r !== t.parent(a) && (s.warn("Setting parent", a, t.parent(a)), e.setParent(a, t.parent(a))), n !== r && a !== n ? (s.debug("Setting parent", a, n), e.setParent(a, n)) : (s.info("In copy ", n, "root", r, "data", t.node(n), r), s.debug(
67
+ "Not Setting parent for node=",
68
+ a,
69
+ "cluster!==rootId",
70
+ n !== r,
71
+ "node!==clusterId",
72
+ a !== n
73
+ ));
74
+ const d = t.edges(a);
75
+ s.debug("Copying Edges", d), d.forEach((l) => {
76
+ s.info("Edge", l);
77
+ const h = t.edge(l.v, l.w, l.name);
78
+ s.info("Edge data", h, r);
79
+ try {
80
+ st(l, r) ? (s.info("Copying as ", l.v, l.w, h, l.name), e.setEdge(l.v, l.w, h, l.name), s.info("newGraph edges ", e.edges(), e.edge(e.edges()[0]))) : s.info(
81
+ "Skipping copy of edge ",
82
+ l.v,
83
+ "-->",
84
+ l.w,
85
+ " rootId: ",
86
+ r,
87
+ " clusterId:",
88
+ n
89
+ );
90
+ } catch (w) {
91
+ s.error(w);
92
+ }
93
+ });
94
+ }
95
+ s.debug("Removing node", a), t.removeNode(a);
96
+ });
97
+ }, F = (n, t) => {
98
+ const e = t.children(n);
99
+ let r = [...e];
100
+ for (const i of e)
101
+ P[i] = n, r = [...r, ...F(i, t)];
102
+ return r;
103
+ }, C = (n, t) => {
104
+ s.trace("Searching", n);
105
+ const e = t.children(n);
106
+ if (s.trace("Searching children of id ", n, e), e.length < 1)
107
+ return s.trace("This is a valid node", n), n;
108
+ for (const r of e) {
109
+ const i = C(r, t);
110
+ if (i)
111
+ return s.trace("Found replacement for", n, " => ", i), i;
112
+ }
113
+ }, S = (n) => !f[n] || !f[n].externalConnections ? n : f[n] ? f[n].id : n, rt = (n, t) => {
114
+ if (!n || t > 10) {
115
+ s.debug("Opting out, no graph ");
116
+ return;
117
+ } else
118
+ s.debug("Opting in, graph ");
119
+ n.nodes().forEach(function(e) {
120
+ n.children(e).length > 0 && (s.warn(
121
+ "Cluster identified",
122
+ e,
123
+ " Replacement id in edges: ",
124
+ C(e, n)
125
+ ), g[e] = F(e, n), f[e] = { id: C(e, n), clusterData: n.node(e) });
126
+ }), n.nodes().forEach(function(e) {
127
+ const r = n.children(e), i = n.edges();
128
+ r.length > 0 ? (s.debug("Cluster identified", e, g), i.forEach((a) => {
129
+ if (a.v !== e && a.w !== e) {
130
+ const u = p(a.v, e), d = p(a.w, e);
131
+ u ^ d && (s.warn("Edge: ", a, " leaves cluster ", e), s.warn("Descendants of XXX ", e, ": ", g[e]), f[e].externalConnections = !0);
132
+ }
133
+ })) : s.debug("Not a cluster ", e, g);
134
+ });
135
+ for (let e of Object.keys(f)) {
136
+ const r = f[e].id, i = n.parent(r);
137
+ i !== e && f[i] && !f[i].externalConnections && (f[e].id = i);
138
+ }
139
+ n.edges().forEach(function(e) {
140
+ const r = n.edge(e);
141
+ s.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e)), s.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(n.edge(e)));
142
+ let i = e.v, a = e.w;
143
+ if (s.warn(
144
+ "Fix XXX",
145
+ f,
146
+ "ids:",
147
+ e.v,
148
+ e.w,
149
+ "Translating: ",
150
+ f[e.v],
151
+ " --- ",
152
+ f[e.w]
153
+ ), f[e.v] && f[e.w] && f[e.v] === f[e.w]) {
154
+ s.warn("Fixing and trixing link to self - removing XXX", e.v, e.w, e.name), s.warn("Fixing and trixing - removing XXX", e.v, e.w, e.name), i = S(e.v), a = S(e.w), n.removeEdge(e.v, e.w, e.name);
155
+ const u = e.w + "---" + e.v;
156
+ n.setNode(u, {
157
+ domId: u,
158
+ id: u,
159
+ labelStyle: "",
160
+ labelText: r.label,
161
+ padding: 0,
162
+ shape: "labelRect",
163
+ style: ""
164
+ });
165
+ const d = structuredClone(r), l = structuredClone(r);
166
+ d.label = "", d.arrowTypeEnd = "none", l.label = "", d.fromCluster = e.v, l.toCluster = e.v, n.setEdge(i, u, d, e.name + "-cyclic-special"), n.setEdge(u, a, l, e.name + "-cyclic-special");
167
+ } else if (f[e.v] || f[e.w]) {
168
+ if (s.warn("Fixing and trixing - removing XXX", e.v, e.w, e.name), i = S(e.v), a = S(e.w), n.removeEdge(e.v, e.w, e.name), i !== e.v) {
169
+ const u = n.parent(i);
170
+ f[u].externalConnections = !0, r.fromCluster = e.v;
171
+ }
172
+ if (a !== e.w) {
173
+ const u = n.parent(a);
174
+ f[u].externalConnections = !0, r.toCluster = e.w;
175
+ }
176
+ s.warn("Fix Replacing with XXX", i, a, e.name), n.setEdge(i, a, r, e.name);
177
+ }
178
+ }), s.warn("Adjusted Graph", m(n)), G(n, 0), s.trace(f);
179
+ }, G = (n, t) => {
180
+ if (s.warn("extractor - ", t, m(n), n.children("D")), t > 10) {
181
+ s.error("Bailing out");
182
+ return;
183
+ }
184
+ let e = n.nodes(), r = !1;
185
+ for (const i of e) {
186
+ const a = n.children(i);
187
+ r = r || a.length > 0;
188
+ }
189
+ if (!r) {
190
+ s.debug("Done, no node has children", n.nodes());
191
+ return;
192
+ }
193
+ s.debug("Nodes = ", e, t);
194
+ for (const i of e)
195
+ if (s.debug(
196
+ "Extracting node",
197
+ i,
198
+ f,
199
+ f[i] && !f[i].externalConnections,
200
+ !n.parent(i),
201
+ n.node(i),
202
+ n.children("D"),
203
+ " Depth ",
204
+ t
205
+ ), !f[i])
206
+ s.debug("Not a cluster", i, t);
207
+ else if (!f[i].externalConnections && // !graph.parent(node) &&
208
+ n.children(i) && n.children(i).length > 0) {
209
+ s.warn(
210
+ "Cluster without external connections, without a parent and with children",
211
+ i,
212
+ t
213
+ );
214
+ let u = n.graph().rankdir === "TB" ? "LR" : "TB";
215
+ f[i] && f[i].clusterData && f[i].clusterData.dir && (u = f[i].clusterData.dir, s.warn("Fixing dir", f[i].clusterData.dir, u));
216
+ const d = new H({
217
+ multigraph: !0,
218
+ compound: !0
219
+ }).setGraph({
220
+ rankdir: u,
221
+ // Todo: set proper spacing
222
+ nodesep: 50,
223
+ ranksep: 50,
224
+ marginx: 8,
225
+ marginy: 8
226
+ }).setDefaultEdgeLabel(function() {
227
+ return {};
228
+ });
229
+ s.warn("Old graph before copy", m(n)), k(i, n, d, i), n.setNode(i, {
230
+ clusterNode: !0,
231
+ id: i,
232
+ clusterData: f[i].clusterData,
233
+ labelText: f[i].labelText,
234
+ graph: d
235
+ }), s.warn("New graph after copy node: (", i, ")", m(d)), s.debug("Old graph after copy", m(n));
236
+ } else
237
+ s.warn(
238
+ "Cluster ** ",
239
+ i,
240
+ " **not meeting the criteria !externalConnections:",
241
+ !f[i].externalConnections,
242
+ " no parent: ",
243
+ !n.parent(i),
244
+ " children ",
245
+ n.children(i) && n.children(i).length > 0,
246
+ n.children("D"),
247
+ t
248
+ ), s.debug(f);
249
+ e = n.nodes(), s.warn("New list of nodes", e);
250
+ for (const i of e) {
251
+ const a = n.node(i);
252
+ s.warn(" Now next level", i, a), a.clusterNode && G(a.graph, t + 1);
253
+ }
254
+ }, j = (n, t) => {
255
+ if (t.length === 0)
256
+ return [];
257
+ let e = Object.assign(t);
258
+ return t.forEach((r) => {
259
+ const i = n.children(r), a = j(n, i);
260
+ e = [...e, ...a];
261
+ }), e;
262
+ }, at = (n) => j(n, n.children()), ct = (n, t) => {
263
+ s.info("Creating subgraph rect for ", t.id, t);
264
+ const e = O(), r = n.insert("g").attr("class", "cluster" + (t.class ? " " + t.class : "")).attr("id", t.id), i = r.insert("rect", ":first-child"), a = B(e.flowchart.htmlLabels), u = r.insert("g").attr("class", "cluster-label"), d = t.labelType === "markdown" ? tt(u, t.labelText, { style: t.labelStyle, useHtmlLabels: a }) : u.node().appendChild(L(t.labelText, t.labelStyle, void 0, !0));
265
+ let l = d.getBBox();
266
+ if (B(e.flowchart.htmlLabels)) {
267
+ const c = d.children[0], o = R(d);
268
+ l = c.getBoundingClientRect(), o.attr("width", l.width), o.attr("height", l.height);
269
+ }
270
+ const h = 0 * t.padding, w = h / 2, x = t.width <= l.width + h ? l.width + h : t.width;
271
+ t.width <= l.width + h ? t.diff = (l.width - t.width) / 2 - t.padding / 2 : t.diff = -t.padding / 2, s.trace("Data ", t, JSON.stringify(t)), i.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - x / 2).attr("y", t.y - t.height / 2 - w).attr("width", x).attr("height", t.height + h);
272
+ const { subGraphTitleTopMargin: v } = T(e);
273
+ a ? u.attr(
274
+ "transform",
275
+ // This puts the label on top of the box instead of inside it
276
+ `translate(${t.x - l.width / 2}, ${t.y - t.height / 2 + v})`
277
+ ) : u.attr(
278
+ "transform",
279
+ // This puts the label on top of the box instead of inside it
280
+ `translate(${t.x}, ${t.y - t.height / 2 + v})`
281
+ );
282
+ const y = i.node().getBBox();
283
+ return t.width = y.width, t.height = y.height, t.intersect = function(c) {
284
+ return D(t, c);
285
+ }, r;
286
+ }, ot = (n, t) => {
287
+ const e = n.insert("g").attr("class", "note-cluster").attr("id", t.id), r = e.insert("rect", ":first-child"), i = 0 * t.padding, a = i / 2;
288
+ r.attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2 - a).attr("width", t.width + i).attr("height", t.height + i).attr("fill", "none");
289
+ const u = r.node().getBBox();
290
+ return t.width = u.width, t.height = u.height, t.intersect = function(d) {
291
+ return D(t, d);
292
+ }, e;
293
+ }, lt = (n, t) => {
294
+ const e = O(), r = n.insert("g").attr("class", t.classes).attr("id", t.id), i = r.insert("rect", ":first-child"), a = r.insert("g").attr("class", "cluster-label"), u = r.append("rect"), d = a.node().appendChild(L(t.labelText, t.labelStyle, void 0, !0));
295
+ let l = d.getBBox();
296
+ if (B(e.flowchart.htmlLabels)) {
297
+ const c = d.children[0], o = R(d);
298
+ l = c.getBoundingClientRect(), o.attr("width", l.width), o.attr("height", l.height);
299
+ }
300
+ l = d.getBBox();
301
+ const h = 0 * t.padding, w = h / 2, x = t.width <= l.width + t.padding ? l.width + t.padding : t.width;
302
+ t.width <= l.width + t.padding ? t.diff = (l.width + t.padding * 0 - t.width) / 2 : t.diff = -t.padding / 2, i.attr("class", "outer").attr("x", t.x - x / 2 - w).attr("y", t.y - t.height / 2 - w).attr("width", x + h).attr("height", t.height + h), u.attr("class", "inner").attr("x", t.x - x / 2 - w).attr("y", t.y - t.height / 2 - w + l.height - 1).attr("width", x + h).attr("height", t.height + h - l.height - 3);
303
+ const { subGraphTitleTopMargin: v } = T(e);
304
+ a.attr(
305
+ "transform",
306
+ `translate(${t.x - l.width / 2}, ${t.y - t.height / 2 - t.padding / 3 + (B(e.flowchart.htmlLabels) ? 5 : 3) + v})`
307
+ );
308
+ const y = i.node().getBBox();
309
+ return t.height = y.height, t.intersect = function(c) {
310
+ return D(t, c);
311
+ }, r;
312
+ }, ft = (n, t) => {
313
+ const e = n.insert("g").attr("class", t.classes).attr("id", t.id), r = e.insert("rect", ":first-child"), i = 0 * t.padding, a = i / 2;
314
+ r.attr("class", "divider").attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2).attr("width", t.width + i).attr("height", t.height + i);
315
+ const u = r.node().getBBox();
316
+ return t.width = u.width, t.height = u.height, t.diff = -t.padding / 2, t.intersect = function(d) {
317
+ return D(t, d);
318
+ }, e;
319
+ }, dt = { rect: ct, roundedWithTitle: lt, noteGroup: ot, divider: ft };
320
+ let M = {};
321
+ const ut = (n, t) => {
322
+ s.trace("Inserting cluster");
323
+ const e = t.shape || "rect";
324
+ M[t.id] = dt[e](n, t);
325
+ }, ht = () => {
326
+ M = {};
327
+ }, A = (n, t, e, r, i, a) => X(void 0, null, function* () {
328
+ s.info("Graph in recursive render: XXX", m(t), i);
329
+ const u = t.graph().rankdir;
330
+ s.trace("Dir in recursive render - dir:", u);
331
+ const d = n.insert("g").attr("class", "root");
332
+ t.nodes() ? s.info("Recursive render XXX", t.nodes()) : s.info("No nodes found for", t), t.edges().length > 0 && s.trace("Recursive edges", t.edge(t.edges()[0]));
333
+ const l = d.insert("g").attr("class", "clusters"), h = d.insert("g").attr("class", "edgePaths"), w = d.insert("g").attr("class", "edgeLabels"), x = d.insert("g").attr("class", "nodes");
334
+ yield Promise.all(
335
+ t.nodes().map(function(c) {
336
+ return X(this, null, function* () {
337
+ const o = t.node(c);
338
+ if (i !== void 0) {
339
+ const b = JSON.parse(JSON.stringify(i.clusterData));
340
+ s.info("Setting data for cluster XXX (", c, ") ", b, i), t.setNode(i.id, b), t.parent(c) || (s.trace("Setting parent", c, i.id), t.setParent(c, i.id, b));
341
+ }
342
+ if (s.info("(Insert) Node XXX" + c + ": " + JSON.stringify(t.node(c))), o && o.clusterNode) {
343
+ s.info("Cluster identified", c, o.width, t.node(c));
344
+ const b = yield A(
345
+ x,
346
+ o.graph,
347
+ e,
348
+ r,
349
+ t.node(c),
350
+ a
351
+ ), E = b.elem;
352
+ _(o, E), o.diff = b.diff || 0, s.info("Node bounds (abc123)", c, o, o.width, o.x, o.y), q(E, o), s.warn("Recursive render complete ", E, o);
353
+ } else
354
+ t.children(c).length > 0 ? (s.info("Cluster - the non recursive path XXX", c, o.id, o, t), s.info(C(o.id, t)), f[o.id] = { id: C(o.id, t), node: o }) : (s.info("Node - the non recursive path", c, o.id, o), yield z(x, t.node(c), u));
355
+ });
356
+ })
357
+ ), t.edges().forEach(function(c) {
358
+ const o = t.edge(c.v, c.w, c.name);
359
+ s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c)), s.info("Edge " + c.v + " -> " + c.w + ": ", c, " ", JSON.stringify(t.edge(c))), s.info("Fix", f, "ids:", c.v, c.w, "Translating: ", f[c.v], f[c.w]), K(w, o);
360
+ }), t.edges().forEach(function(c) {
361
+ s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c));
362
+ }), s.info("#############################################"), s.info("### Layout ###"), s.info("#############################################"), s.info(t), V(t), s.info("Graph after layout:", m(t));
363
+ let v = 0;
364
+ const { subGraphTitleTotalMargin: y } = T(a);
365
+ return at(t).forEach(function(c) {
366
+ const o = t.node(c);
367
+ s.info("Position " + c + ": " + JSON.stringify(t.node(c))), s.info(
368
+ "Position " + c + ": (" + o.x,
369
+ "," + o.y,
370
+ ") width: ",
371
+ o.width,
372
+ " height: ",
373
+ o.height
374
+ ), o && o.clusterNode ? (o.y += y, $(o)) : t.children(c).length > 0 ? (o.height += y, ut(l, o), f[o.id].node = o) : (o.y += y / 2, $(o));
375
+ }), t.edges().forEach(function(c) {
376
+ const o = t.edge(c);
377
+ s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(o), o), o.points.forEach((E) => E.y += y / 2);
378
+ const b = Q(h, c, o, f, e, t, r);
379
+ Y(o, b);
380
+ }), t.nodes().forEach(function(c) {
381
+ const o = t.node(c);
382
+ s.info(c, o.type, o.diff), o.type === "group" && (v = o.diff);
383
+ }), { elem: d, diff: v };
384
+ }), Et = (n, t, e, r, i) => X(void 0, null, function* () {
385
+ W(n, e, r, i), Z(), I(), ht(), it(), s.warn("Graph at first:", JSON.stringify(m(t))), rt(t), s.warn("Graph after:", JSON.stringify(m(t)));
386
+ const a = O();
387
+ yield A(n, t, r, i, void 0, a);
388
+ });
389
+ export {
390
+ Et as r
391
+ };