local-operator-ui 0.9.2 → 0.10.0

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 (50) hide show
  1. package/out/main/index.jsc +0 -0
  2. package/out/preload/index.jsc +0 -0
  3. package/out/renderer/assets/_basePickBy-BJo5TtXZ.js +195 -0
  4. package/out/renderer/assets/_baseUniq-DChptfgP.js +835 -0
  5. package/out/renderer/assets/arc-DX1E3h9F.js +131 -0
  6. package/out/renderer/assets/architectureDiagram-IEHRJDOE-mNLa7bzo.js +8653 -0
  7. package/out/renderer/assets/blockDiagram-JOT3LUYC-CFXQFQqH.js +3585 -0
  8. package/out/renderer/assets/c4Diagram-VJAJSXHY-B5VrPZYL.js +2487 -0
  9. package/out/renderer/assets/channel-CoNRRPF4.js +7 -0
  10. package/out/renderer/assets/chunk-4BMEZGHF-rxEBPFA3.js +16 -0
  11. package/out/renderer/assets/chunk-A2AXSNBT-HqweOv4t.js +1827 -0
  12. package/out/renderer/assets/chunk-AEK57VVT-Bi5ch9d5.js +1953 -0
  13. package/out/renderer/assets/chunk-D6G4REZN-B3A-ILe9.js +108 -0
  14. package/out/renderer/assets/chunk-RZ5BOZE2-BVX34Tni.js +34 -0
  15. package/out/renderer/assets/chunk-XZIHB7SX-ywEQj9yW.js +19 -0
  16. package/out/renderer/assets/classDiagram-GIVACNV2-DMn8pk7x.js +21 -0
  17. package/out/renderer/assets/classDiagram-v2-COTLJTTW-DMn8pk7x.js +21 -0
  18. package/out/renderer/assets/clone-za200Y1v.js +8 -0
  19. package/out/renderer/assets/cytoscape.esm-C0AOj4uS.js +30062 -0
  20. package/out/renderer/assets/dagre-OKDRZEBW-D4IEt0nK.js +695 -0
  21. package/out/renderer/assets/diagram-SSKATNLV-CKwTmUPI.js +304 -0
  22. package/out/renderer/assets/diagram-VNBRO52H-B1g8mjNA.js +193 -0
  23. package/out/renderer/assets/erDiagram-Q7BY3M3F-DugxQiOz.js +1160 -0
  24. package/out/renderer/assets/flowDiagram-4HSFHLVR-e25PmCoL.js +2324 -0
  25. package/out/renderer/assets/{fonts-Bx8fKQfu.js → fonts-DrtyYWn4.js} +177 -178
  26. package/out/renderer/assets/ganttDiagram-APWFNJXF-CffOoRih.js +2500 -0
  27. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-CzBJNIqf.js +1204 -0
  28. package/out/renderer/assets/graph-BM-Fbuwu.js +424 -0
  29. package/out/renderer/assets/{index-DtFlp8rf.js → index-CLDHeUsn.js} +2 -2
  30. package/out/renderer/assets/{index-Cf8ixUbJ.js → index-Dpjcu7Ux.js} +99144 -75522
  31. package/out/renderer/assets/{index-n_d5-ePx.js → index-Dzn44e_b.js} +2 -2
  32. package/out/renderer/assets/infoDiagram-PH2N3AL5-DsUIwRuF.js +33 -0
  33. package/out/renderer/assets/{installer-Cn81GyOR.js → installer-JGj_vW61.js} +1 -1
  34. package/out/renderer/assets/journeyDiagram-U35MCT3I-CGwuYi5x.js +1199 -0
  35. package/out/renderer/assets/kanban-definition-NDS4AKOZ-DZEB2jhI.js +1046 -0
  36. package/out/renderer/assets/layout-DgKkvpjr.js +2060 -0
  37. package/out/renderer/assets/mindmap-definition-ALO5MXBD-B9Qyvo51.js +5836 -0
  38. package/out/renderer/assets/pieDiagram-IB7DONF6-CWVIIzbP.js +239 -0
  39. package/out/renderer/assets/quadrantDiagram-7GDLP6J5-DXuKt2Bl.js +1340 -0
  40. package/out/renderer/assets/radar-MK3ICKWK-5vdES7mG.js +16935 -0
  41. package/out/renderer/assets/requirementDiagram-KVF5MWMF-CAqaeybl.js +1163 -0
  42. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-Cg0cLJAO.js +1201 -0
  43. package/out/renderer/assets/sequenceDiagram-X6HHIX6F-BxenFsrt.js +3415 -0
  44. package/out/renderer/assets/stateDiagram-DGXRK772-CobhNycm.js +467 -0
  45. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-D7nd37b5.js +21 -0
  46. package/out/renderer/assets/timeline-definition-BDJGKUSR-Dj0FLvqa.js +1223 -0
  47. package/out/renderer/assets/xychartDiagram-VJFVF3MP-DuyOBFpM.js +1800 -0
  48. package/out/renderer/index.html +4 -4
  49. package/out/renderer/installer.html +2 -2
  50. package/package.json +2 -1
@@ -0,0 +1,467 @@
1
+ import { s as styles_default, a as stateDiagram_default, S as StateDB } from "./chunk-AEK57VVT-Bi5ch9d5.js";
2
+ import { _ as __name, c as getConfig2, d as select, l as log, e as configureSvgSize, k as common_default, a5 as line, ac as curveBasis, u as utils_default } from "./index-Dpjcu7Ux.js";
3
+ import { G as Graph } from "./graph-BM-Fbuwu.js";
4
+ import { l as layout } from "./layout-DgKkvpjr.js";
5
+ import "./chunk-RZ5BOZE2-BVX34Tni.js";
6
+ import "./fonts-DrtyYWn4.js";
7
+ import "./_baseUniq-DChptfgP.js";
8
+ import "./_basePickBy-BJo5TtXZ.js";
9
+ var idCache = {};
10
+ var set = /* @__PURE__ */ __name((key, val) => {
11
+ idCache[key] = val;
12
+ }, "set");
13
+ var get = /* @__PURE__ */ __name((k) => idCache[k], "get");
14
+ var keys = /* @__PURE__ */ __name(() => Object.keys(idCache), "keys");
15
+ var size = /* @__PURE__ */ __name(() => keys().length, "size");
16
+ var id_cache_default = {
17
+ get,
18
+ set,
19
+ keys,
20
+ size
21
+ };
22
+ var drawStartState = /* @__PURE__ */ __name((g) => g.append("circle").attr("class", "start-state").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit), "drawStartState");
23
+ var drawDivider = /* @__PURE__ */ __name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig2().state.textHeight).attr("class", "divider").attr("x2", getConfig2().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
24
+ var drawSimpleState = /* @__PURE__ */ __name((g, stateDef) => {
25
+ const state = g.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 2 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
26
+ const classBox = state.node().getBBox();
27
+ g.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", classBox.width + 2 * getConfig2().state.padding).attr("height", classBox.height + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius);
28
+ return state;
29
+ }, "drawSimpleState");
30
+ var drawDescrState = /* @__PURE__ */ __name((g, stateDef) => {
31
+ const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) {
32
+ const tSpan = textEl.append("tspan").attr("x", 2 * getConfig2().state.padding).text(txt);
33
+ if (!isFirst2) {
34
+ tSpan.attr("dy", getConfig2().state.textHeight);
35
+ }
36
+ }, "addTspan");
37
+ const title = g.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 1.3 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
38
+ const titleBox = title.node().getBBox();
39
+ const titleHeight = titleBox.height;
40
+ const description = g.append("text").attr("x", getConfig2().state.padding).attr(
41
+ "y",
42
+ titleHeight + getConfig2().state.padding * 0.4 + getConfig2().state.dividerMargin + getConfig2().state.textHeight
43
+ ).attr("class", "state-description");
44
+ let isFirst = true;
45
+ let isSecond = true;
46
+ stateDef.descriptions.forEach(function(descr) {
47
+ if (!isFirst) {
48
+ addTspan(description, descr, isSecond);
49
+ isSecond = false;
50
+ }
51
+ isFirst = false;
52
+ });
53
+ const descrLine = g.append("line").attr("x1", getConfig2().state.padding).attr("y1", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("y2", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("class", "descr-divider");
54
+ const descrBox = description.node().getBBox();
55
+ const width = Math.max(descrBox.width, titleBox.width);
56
+ descrLine.attr("x2", width + 3 * getConfig2().state.padding);
57
+ g.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", width + 2 * getConfig2().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius);
58
+ return g;
59
+ }, "drawDescrState");
60
+ var addTitleAndBox = /* @__PURE__ */ __name((g, stateDef, altBkg) => {
61
+ const pad = getConfig2().state.padding;
62
+ const dblPad = 2 * getConfig2().state.padding;
63
+ const orgBox = g.node().getBBox();
64
+ const orgWidth = orgBox.width;
65
+ const orgX = orgBox.x;
66
+ const title = g.append("text").attr("x", 0).attr("y", getConfig2().state.titleShift).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
67
+ const titleBox = title.node().getBBox();
68
+ const titleWidth = titleBox.width + dblPad;
69
+ let width = Math.max(titleWidth, orgWidth);
70
+ if (width === orgWidth) {
71
+ width = width + dblPad;
72
+ }
73
+ let startX;
74
+ const graphBox = g.node().getBBox();
75
+ if (stateDef.doc) ;
76
+ startX = orgX - pad;
77
+ if (titleWidth > orgWidth) {
78
+ startX = (orgWidth - width) / 2 + pad;
79
+ }
80
+ if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
81
+ startX = orgX - (titleWidth - orgWidth) / 2;
82
+ }
83
+ const lineY = 1 - getConfig2().state.textHeight;
84
+ g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr(
85
+ "height",
86
+ graphBox.height + getConfig2().state.textHeight + getConfig2().state.titleShift + 1
87
+ ).attr("rx", "0");
88
+ title.attr("x", startX + pad);
89
+ if (titleWidth <= orgWidth) {
90
+ title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
91
+ }
92
+ g.insert("rect", ":first-child").attr("x", startX).attr(
93
+ "y",
94
+ getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding
95
+ ).attr("width", width).attr("height", getConfig2().state.textHeight * 3).attr("rx", getConfig2().state.radius);
96
+ g.insert("rect", ":first-child").attr("x", startX).attr(
97
+ "y",
98
+ getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding
99
+ ).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig2().state.textHeight).attr("rx", getConfig2().state.radius);
100
+ return g;
101
+ }, "addTitleAndBox");
102
+ var drawEndState = /* @__PURE__ */ __name((g) => {
103
+ g.append("circle").attr("class", "end-state-outer").attr("r", getConfig2().state.sizeUnit + getConfig2().state.miniPadding).attr(
104
+ "cx",
105
+ getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding
106
+ ).attr(
107
+ "cy",
108
+ getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding
109
+ );
110
+ return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit + 2).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit + 2);
111
+ }, "drawEndState");
112
+ var drawForkJoinState = /* @__PURE__ */ __name((g, stateDef) => {
113
+ let width = getConfig2().state.forkWidth;
114
+ let height = getConfig2().state.forkHeight;
115
+ if (stateDef.parentId) {
116
+ let tmp = width;
117
+ width = height;
118
+ height = tmp;
119
+ }
120
+ return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding);
121
+ }, "drawForkJoinState");
122
+ var _drawLongText = /* @__PURE__ */ __name((_text, x, y, g) => {
123
+ let textHeight = 0;
124
+ const textElem = g.append("text");
125
+ textElem.style("text-anchor", "start");
126
+ textElem.attr("class", "noteText");
127
+ let text = _text.replace(/\r\n/g, "<br/>");
128
+ text = text.replace(/\n/g, "<br/>");
129
+ const lines = text.split(common_default.lineBreakRegex);
130
+ let tHeight = 1.25 * getConfig2().state.noteMargin;
131
+ for (const line2 of lines) {
132
+ const txt = line2.trim();
133
+ if (txt.length > 0) {
134
+ const span = textElem.append("tspan");
135
+ span.text(txt);
136
+ if (tHeight === 0) {
137
+ const textBounds = span.node().getBBox();
138
+ tHeight += textBounds.height;
139
+ }
140
+ textHeight += tHeight;
141
+ span.attr("x", x + getConfig2().state.noteMargin);
142
+ span.attr("y", y + textHeight + 1.25 * getConfig2().state.noteMargin);
143
+ }
144
+ }
145
+ return { textWidth: textElem.node().getBBox().width, textHeight };
146
+ }, "_drawLongText");
147
+ var drawNote = /* @__PURE__ */ __name((text, g) => {
148
+ g.attr("class", "state-note");
149
+ const note = g.append("rect").attr("x", 0).attr("y", getConfig2().state.padding);
150
+ const rectElem = g.append("g");
151
+ const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
152
+ note.attr("height", textHeight + 2 * getConfig2().state.noteMargin);
153
+ note.attr("width", textWidth + getConfig2().state.noteMargin * 2);
154
+ return note;
155
+ }, "drawNote");
156
+ var drawState = /* @__PURE__ */ __name(function(elem, stateDef) {
157
+ const id = stateDef.id;
158
+ const stateInfo = {
159
+ id,
160
+ label: stateDef.id,
161
+ width: 0,
162
+ height: 0
163
+ };
164
+ const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
165
+ if (stateDef.type === "start") {
166
+ drawStartState(g);
167
+ }
168
+ if (stateDef.type === "end") {
169
+ drawEndState(g);
170
+ }
171
+ if (stateDef.type === "fork" || stateDef.type === "join") {
172
+ drawForkJoinState(g, stateDef);
173
+ }
174
+ if (stateDef.type === "note") {
175
+ drawNote(stateDef.note.text, g);
176
+ }
177
+ if (stateDef.type === "divider") {
178
+ drawDivider(g);
179
+ }
180
+ if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
181
+ drawSimpleState(g, stateDef);
182
+ }
183
+ if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
184
+ drawDescrState(g, stateDef);
185
+ }
186
+ const stateBox = g.node().getBBox();
187
+ stateInfo.width = stateBox.width + 2 * getConfig2().state.padding;
188
+ stateInfo.height = stateBox.height + 2 * getConfig2().state.padding;
189
+ id_cache_default.set(id, stateInfo);
190
+ return stateInfo;
191
+ }, "drawState");
192
+ var edgeCount = 0;
193
+ var drawEdge = /* @__PURE__ */ __name(function(elem, path, relation) {
194
+ const getRelationType = /* @__PURE__ */ __name(function(type) {
195
+ switch (type) {
196
+ case StateDB.relationType.AGGREGATION:
197
+ return "aggregation";
198
+ case StateDB.relationType.EXTENSION:
199
+ return "extension";
200
+ case StateDB.relationType.COMPOSITION:
201
+ return "composition";
202
+ case StateDB.relationType.DEPENDENCY:
203
+ return "dependency";
204
+ }
205
+ }, "getRelationType");
206
+ path.points = path.points.filter((p) => !Number.isNaN(p.y));
207
+ const lineData = path.points;
208
+ const lineFunction = line().x(function(d) {
209
+ return d.x;
210
+ }).y(function(d) {
211
+ return d.y;
212
+ }).curve(curveBasis);
213
+ const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
214
+ let url = "";
215
+ if (getConfig2().state.arrowMarkerAbsolute) {
216
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
217
+ url = url.replace(/\(/g, "\\(");
218
+ url = url.replace(/\)/g, "\\)");
219
+ }
220
+ svgPath.attr(
221
+ "marker-end",
222
+ "url(" + url + "#" + getRelationType(StateDB.relationType.DEPENDENCY) + "End)"
223
+ );
224
+ if (relation.title !== void 0) {
225
+ const label = elem.append("g").attr("class", "stateLabel");
226
+ const { x, y } = utils_default.calcLabelPosition(path.points);
227
+ const rows = common_default.getRows(relation.title);
228
+ let titleHeight = 0;
229
+ const titleRows = [];
230
+ let maxWidth = 0;
231
+ let minX = 0;
232
+ for (let i = 0; i <= rows.length; i++) {
233
+ const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
234
+ const boundsTmp = title.node().getBBox();
235
+ maxWidth = Math.max(maxWidth, boundsTmp.width);
236
+ minX = Math.min(minX, boundsTmp.x);
237
+ log.info(boundsTmp.x, x, y + titleHeight);
238
+ if (titleHeight === 0) {
239
+ const titleBox = title.node().getBBox();
240
+ titleHeight = titleBox.height;
241
+ log.info("Title height", titleHeight, y);
242
+ }
243
+ titleRows.push(title);
244
+ }
245
+ let boxHeight = titleHeight * rows.length;
246
+ if (rows.length > 1) {
247
+ const heightAdj = (rows.length - 1) * titleHeight * 0.5;
248
+ titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
249
+ boxHeight = titleHeight * rows.length;
250
+ }
251
+ const bounds = label.node().getBBox();
252
+ label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - getConfig2().state.padding / 2).attr("y", y - boxHeight / 2 - getConfig2().state.padding / 2 - 3.5).attr("width", maxWidth + getConfig2().state.padding).attr("height", boxHeight + getConfig2().state.padding);
253
+ log.info(bounds);
254
+ }
255
+ edgeCount++;
256
+ }, "drawEdge");
257
+ var conf;
258
+ var transformationLog = {};
259
+ var setConf = /* @__PURE__ */ __name(function() {
260
+ }, "setConf");
261
+ var insertMarkers = /* @__PURE__ */ __name(function(elem) {
262
+ elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
263
+ }, "insertMarkers");
264
+ var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
265
+ conf = getConfig2().state;
266
+ const securityLevel = getConfig2().securityLevel;
267
+ let sandboxElement;
268
+ if (securityLevel === "sandbox") {
269
+ sandboxElement = select("#i" + id);
270
+ }
271
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
272
+ const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
273
+ log.debug("Rendering diagram " + text);
274
+ const diagram2 = root.select(`[id='${id}']`);
275
+ insertMarkers(diagram2);
276
+ const rootDoc = diagObj.db.getRootDoc();
277
+ renderDoc(rootDoc, diagram2, void 0, false, root, doc, diagObj);
278
+ const padding = conf.padding;
279
+ const bounds = diagram2.node().getBBox();
280
+ const width = bounds.width + padding * 2;
281
+ const height = bounds.height + padding * 2;
282
+ const svgWidth = width * 1.75;
283
+ configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
284
+ diagram2.attr(
285
+ "viewBox",
286
+ `${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height
287
+ );
288
+ }, "draw");
289
+ var getLabelWidth = /* @__PURE__ */ __name((text) => {
290
+ return text ? text.length * conf.fontSizeFactor : 1;
291
+ }, "getLabelWidth");
292
+ var renderDoc = /* @__PURE__ */ __name((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
293
+ const graph = new Graph({
294
+ compound: true,
295
+ multigraph: true
296
+ });
297
+ let i;
298
+ let edgeFreeDoc = true;
299
+ for (i = 0; i < doc.length; i++) {
300
+ if (doc[i].stmt === "relation") {
301
+ edgeFreeDoc = false;
302
+ break;
303
+ }
304
+ }
305
+ if (parentId) {
306
+ graph.setGraph({
307
+ rankdir: "LR",
308
+ multigraph: true,
309
+ compound: true,
310
+ // acyclicer: 'greedy',
311
+ ranker: "tight-tree",
312
+ ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
313
+ nodeSep: edgeFreeDoc ? 1 : 50,
314
+ isMultiGraph: true
315
+ // ranksep: 5,
316
+ // nodesep: 1
317
+ });
318
+ } else {
319
+ graph.setGraph({
320
+ rankdir: "TB",
321
+ multigraph: true,
322
+ compound: true,
323
+ // isCompound: true,
324
+ // acyclicer: 'greedy',
325
+ // ranker: 'longest-path'
326
+ ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
327
+ nodeSep: edgeFreeDoc ? 1 : 50,
328
+ ranker: "tight-tree",
329
+ // ranker: 'network-simplex'
330
+ isMultiGraph: true
331
+ });
332
+ }
333
+ graph.setDefaultEdgeLabel(function() {
334
+ return {};
335
+ });
336
+ const states = diagObj.db.getStates();
337
+ const relations = diagObj.db.getRelations();
338
+ const keys2 = Object.keys(states);
339
+ for (const key of keys2) {
340
+ const stateDef = states[key];
341
+ if (parentId) {
342
+ stateDef.parentId = parentId;
343
+ }
344
+ let node;
345
+ if (stateDef.doc) {
346
+ let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
347
+ node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
348
+ {
349
+ sub = addTitleAndBox(sub, stateDef, altBkg);
350
+ let boxBounds = sub.node().getBBox();
351
+ node.width = boxBounds.width;
352
+ node.height = boxBounds.height + conf.padding / 2;
353
+ transformationLog[stateDef.id] = { y: conf.compositTitleSize };
354
+ }
355
+ } else {
356
+ node = drawState(diagram2, stateDef, graph);
357
+ }
358
+ if (stateDef.note) {
359
+ const noteDef = {
360
+ descriptions: [],
361
+ id: stateDef.id + "-note",
362
+ note: stateDef.note,
363
+ type: "note"
364
+ };
365
+ const note = drawState(diagram2, noteDef, graph);
366
+ if (stateDef.note.position === "left of") {
367
+ graph.setNode(node.id + "-note", note);
368
+ graph.setNode(node.id, node);
369
+ } else {
370
+ graph.setNode(node.id, node);
371
+ graph.setNode(node.id + "-note", note);
372
+ }
373
+ graph.setParent(node.id, node.id + "-group");
374
+ graph.setParent(node.id + "-note", node.id + "-group");
375
+ } else {
376
+ graph.setNode(node.id, node);
377
+ }
378
+ }
379
+ log.debug("Count=", graph.nodeCount(), graph);
380
+ let cnt = 0;
381
+ relations.forEach(function(relation) {
382
+ cnt++;
383
+ log.debug("Setting edge", relation);
384
+ graph.setEdge(
385
+ relation.id1,
386
+ relation.id2,
387
+ {
388
+ relation,
389
+ width: getLabelWidth(relation.title),
390
+ height: conf.labelHeight * common_default.getRows(relation.title).length,
391
+ labelpos: "c"
392
+ },
393
+ "id" + cnt
394
+ );
395
+ });
396
+ layout(graph);
397
+ log.debug("Graph after layout", graph.nodes());
398
+ const svgElem = diagram2.node();
399
+ graph.nodes().forEach(function(v) {
400
+ if (v !== void 0 && graph.node(v) !== void 0) {
401
+ log.warn("Node " + v + ": " + JSON.stringify(graph.node(v)));
402
+ root.select("#" + svgElem.id + " #" + v).attr(
403
+ "transform",
404
+ "translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + " )"
405
+ );
406
+ root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph.node(v).x - graph.node(v).width / 2);
407
+ const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
408
+ dividers.forEach((divider) => {
409
+ const parent = divider.parentElement;
410
+ let pWidth = 0;
411
+ let pShift = 0;
412
+ if (parent) {
413
+ if (parent.parentElement) {
414
+ pWidth = parent.parentElement.getBBox().width;
415
+ }
416
+ pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
417
+ if (Number.isNaN(pShift)) {
418
+ pShift = 0;
419
+ }
420
+ }
421
+ divider.setAttribute("x1", 0 - pShift + 8);
422
+ divider.setAttribute("x2", pWidth - pShift - 8);
423
+ });
424
+ } else {
425
+ log.debug("No Node " + v + ": " + JSON.stringify(graph.node(v)));
426
+ }
427
+ });
428
+ let stateBox = svgElem.getBBox();
429
+ graph.edges().forEach(function(e) {
430
+ if (e !== void 0 && graph.edge(e) !== void 0) {
431
+ log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
432
+ drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);
433
+ }
434
+ });
435
+ stateBox = svgElem.getBBox();
436
+ const stateInfo = {
437
+ id: parentId ? parentId : "root",
438
+ label: parentId ? parentId : "root",
439
+ width: 0,
440
+ height: 0
441
+ };
442
+ stateInfo.width = stateBox.width + 2 * conf.padding;
443
+ stateInfo.height = stateBox.height + 2 * conf.padding;
444
+ log.debug("Doc rendered", stateInfo, graph);
445
+ return stateInfo;
446
+ }, "renderDoc");
447
+ var stateRenderer_default = {
448
+ setConf,
449
+ draw
450
+ };
451
+ var diagram = {
452
+ parser: stateDiagram_default,
453
+ get db() {
454
+ return new StateDB(1);
455
+ },
456
+ renderer: stateRenderer_default,
457
+ styles: styles_default,
458
+ init: /* @__PURE__ */ __name((cnf) => {
459
+ if (!cnf.state) {
460
+ cnf.state = {};
461
+ }
462
+ cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
463
+ }, "init")
464
+ };
465
+ export {
466
+ diagram
467
+ };
@@ -0,0 +1,21 @@
1
+ import { s as styles_default, b as stateRenderer_v3_unified_default, a as stateDiagram_default, S as StateDB } from "./chunk-AEK57VVT-Bi5ch9d5.js";
2
+ import { _ as __name } from "./index-Dpjcu7Ux.js";
3
+ import "./chunk-RZ5BOZE2-BVX34Tni.js";
4
+ import "./fonts-DrtyYWn4.js";
5
+ var diagram = {
6
+ parser: stateDiagram_default,
7
+ get db() {
8
+ return new StateDB(2);
9
+ },
10
+ renderer: stateRenderer_v3_unified_default,
11
+ styles: styles_default,
12
+ init: /* @__PURE__ */ __name((cnf) => {
13
+ if (!cnf.state) {
14
+ cnf.state = {};
15
+ }
16
+ cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
17
+ }, "init")
18
+ };
19
+ export {
20
+ diagram
21
+ };