smart-chat-asp 2.11.1
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.
- package/README.md +364 -0
- package/README.zh.md +367 -0
- package/lib/Tableau10-2ff7471d.mjs +9 -0
- package/lib/arc-33fcfaff.mjs +86 -0
- package/lib/array-2ff2c7a6.mjs +6 -0
- package/lib/blockDiagram-38ab4fdb-3c912e88.mjs +1230 -0
- package/lib/c4Diagram-3d4e48cf-49908d37.mjs +1580 -0
- package/lib/channel-890a888a.mjs +5 -0
- package/lib/classDiagram-70f12bd4-ace7b178.mjs +221 -0
- package/lib/classDiagram-v2-f2320105-5848085d.mjs +207 -0
- package/lib/clone-59a3b16a.mjs +8 -0
- package/lib/createText-2e5e7dd3-898a4de3.mjs +2966 -0
- package/lib/edges-e0da2a9e-91b210e9.mjs +1083 -0
- package/lib/erDiagram-9861fffd-c13b7611.mjs +933 -0
- package/lib/favicon.ico +0 -0
- package/lib/favicon.svg +1 -0
- package/lib/flowDb-956e92f1-56fdcb20.mjs +1126 -0
- package/lib/flowDiagram-66a62f08-4023035a.mjs +798 -0
- package/lib/flowDiagram-v2-96b9c2cf-d28d8b17.mjs +26 -0
- package/lib/flowchart-elk-definition-4a651766-ab5b1391.mjs +48407 -0
- package/lib/ganttDiagram-c361ad54-ae59a5e3.mjs +2504 -0
- package/lib/gitGraphDiagram-72cf32ee-5bdf46bb.mjs +1265 -0
- package/lib/graph-9ea4e80a.mjs +512 -0
- package/lib/index-3862675e-b7177fa1.mjs +373 -0
- package/lib/index-958a220b.mjs +1470 -0
- package/lib/index-c42b0ff4.mjs +40 -0
- package/lib/index-f76d9453.mjs +28 -0
- package/lib/infoDiagram-f8f76790-5f3835f9.mjs +320 -0
- package/lib/init-f9637058.mjs +16 -0
- package/lib/journeyDiagram-49397b02-df06b21d.mjs +805 -0
- package/lib/layout-d3bc02b9.mjs +1495 -0
- package/lib/line-b044df13.mjs +34 -0
- package/lib/linear-e60140ad.mjs +447 -0
- package/lib/main-740da2e1.mjs +117801 -0
- package/lib/mindmap-definition-fc14e90a-3bfaf2a6.mjs +19384 -0
- package/lib/ordinal-980380c7.mjs +65 -0
- package/lib/path-428ebac9.mjs +91 -0
- package/lib/pieDiagram-8a3498a8-a8359c54.mjs +503 -0
- package/lib/pwa-192x192.png +0 -0
- package/lib/pwa-512x512.png +0 -0
- package/lib/quadrantDiagram-120e2f19-367eeae7.mjs +905 -0
- package/lib/requirementDiagram-deff3bca-27d1e96b.mjs +770 -0
- package/lib/sankeyDiagram-04a897e0-a9e993ee.mjs +818 -0
- package/lib/sequenceDiagram-704730f1-05f9d7b1.mjs +2235 -0
- package/lib/smart-chat.es.js +5 -0
- package/lib/smart-chat.umd.js +5444 -0
- package/lib/stateDiagram-587899a1-f3e4a81e.mjs +269 -0
- package/lib/stateDiagram-v2-d93cdb3a-763ad0ff.mjs +191 -0
- package/lib/style.css +1 -0
- package/lib/styles-6aaf32cf-e32ec570.mjs +960 -0
- package/lib/styles-9a916d00-18b5fd0d.mjs +1089 -0
- package/lib/styles-c10674c1-134300a0.mjs +433 -0
- package/lib/svgDrawCommon-08f97a94-f04d54dc.mjs +64 -0
- package/lib/timeline-definition-85554ec2-1989252c.mjs +796 -0
- package/lib/xychartDiagram-e933f94c-f7d5a550.mjs +1285 -0
- package/license +21 -0
- package/package.json +79 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { p as A, d as S, s as G } from "./styles-9a916d00-18b5fd0d.mjs";
|
|
2
|
+
import { Y as v, a2 as y, a1 as B, a3 as W, ap as $, ak as M, aq as I } from "./main-740da2e1.mjs";
|
|
3
|
+
import { G as Y } from "./graph-9ea4e80a.mjs";
|
|
4
|
+
import { l as O } from "./layout-d3bc02b9.mjs";
|
|
5
|
+
import { l as P } from "./line-b044df13.mjs";
|
|
6
|
+
import "vue";
|
|
7
|
+
import "./array-2ff2c7a6.mjs";
|
|
8
|
+
import "./path-428ebac9.mjs";
|
|
9
|
+
let H = 0;
|
|
10
|
+
const X = function(i, a, t, o, p) {
|
|
11
|
+
const g = function(e) {
|
|
12
|
+
switch (e) {
|
|
13
|
+
case p.db.relationType.AGGREGATION:
|
|
14
|
+
return "aggregation";
|
|
15
|
+
case p.db.relationType.EXTENSION:
|
|
16
|
+
return "extension";
|
|
17
|
+
case p.db.relationType.COMPOSITION:
|
|
18
|
+
return "composition";
|
|
19
|
+
case p.db.relationType.DEPENDENCY:
|
|
20
|
+
return "dependency";
|
|
21
|
+
case p.db.relationType.LOLLIPOP:
|
|
22
|
+
return "lollipop";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
a.points = a.points.filter((e) => !Number.isNaN(e.y));
|
|
26
|
+
const s = a.points, c = P().x(function(e) {
|
|
27
|
+
return e.x;
|
|
28
|
+
}).y(function(e) {
|
|
29
|
+
return e.y;
|
|
30
|
+
}).curve($), n = i.append("path").attr("d", c(s)).attr("id", "edge" + H).attr("class", "relation");
|
|
31
|
+
let r = "";
|
|
32
|
+
o.arrowMarkerAbsolute && (r = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, r = r.replace(/\(/g, "\\("), r = r.replace(/\)/g, "\\)")), t.relation.lineType == 1 && n.attr("class", "relation dashed-line"), t.relation.lineType == 10 && n.attr("class", "relation dotted-line"), t.relation.type1 !== "none" && n.attr(
|
|
33
|
+
"marker-start",
|
|
34
|
+
"url(" + r + "#" + g(t.relation.type1) + "Start)"
|
|
35
|
+
), t.relation.type2 !== "none" && n.attr(
|
|
36
|
+
"marker-end",
|
|
37
|
+
"url(" + r + "#" + g(t.relation.type2) + "End)"
|
|
38
|
+
);
|
|
39
|
+
let f, h;
|
|
40
|
+
const x = a.points.length;
|
|
41
|
+
let k = M.calcLabelPosition(a.points);
|
|
42
|
+
f = k.x, h = k.y;
|
|
43
|
+
let u, m, w, b;
|
|
44
|
+
if (x % 2 !== 0 && x > 1) {
|
|
45
|
+
let e = M.calcCardinalityPosition(
|
|
46
|
+
t.relation.type1 !== "none",
|
|
47
|
+
a.points,
|
|
48
|
+
a.points[0]
|
|
49
|
+
), d = M.calcCardinalityPosition(
|
|
50
|
+
t.relation.type2 !== "none",
|
|
51
|
+
a.points,
|
|
52
|
+
a.points[x - 1]
|
|
53
|
+
);
|
|
54
|
+
y.debug("cardinality_1_point " + JSON.stringify(e)), y.debug("cardinality_2_point " + JSON.stringify(d)), u = e.x, m = e.y, w = d.x, b = d.y;
|
|
55
|
+
}
|
|
56
|
+
if (t.title !== void 0) {
|
|
57
|
+
const e = i.append("g").attr("class", "classLabel"), d = e.append("text").attr("class", "label").attr("x", f).attr("y", h).attr("fill", "red").attr("text-anchor", "middle").text(t.title);
|
|
58
|
+
window.label = d;
|
|
59
|
+
const l = d.node().getBBox();
|
|
60
|
+
e.insert("rect", ":first-child").attr("class", "box").attr("x", l.x - o.padding / 2).attr("y", l.y - o.padding / 2).attr("width", l.width + o.padding).attr("height", l.height + o.padding);
|
|
61
|
+
}
|
|
62
|
+
y.info("Rendering relation " + JSON.stringify(t)), t.relationTitle1 !== void 0 && t.relationTitle1 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type1").attr("x", u).attr("y", m).attr("fill", "black").attr("font-size", "6").text(t.relationTitle1), t.relationTitle2 !== void 0 && t.relationTitle2 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type2").attr("x", w).attr("y", b).attr("fill", "black").attr("font-size", "6").text(t.relationTitle2), H++;
|
|
63
|
+
}, J = function(i, a, t, o) {
|
|
64
|
+
y.debug("Rendering class ", a, t);
|
|
65
|
+
const p = a.id, g = {
|
|
66
|
+
id: p,
|
|
67
|
+
label: a.id,
|
|
68
|
+
width: 0,
|
|
69
|
+
height: 0
|
|
70
|
+
}, s = i.append("g").attr("id", o.db.lookUpDomId(p)).attr("class", "classGroup");
|
|
71
|
+
let c;
|
|
72
|
+
a.link ? c = s.append("svg:a").attr("xlink:href", a.link).attr("target", a.linkTarget).append("text").attr("y", t.textHeight + t.padding).attr("x", 0) : c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
|
73
|
+
let n = !0;
|
|
74
|
+
a.annotations.forEach(function(d) {
|
|
75
|
+
const l = c.append("tspan").text("«" + d + "»");
|
|
76
|
+
n || l.attr("dy", t.textHeight), n = !1;
|
|
77
|
+
});
|
|
78
|
+
let r = C(a);
|
|
79
|
+
const f = c.append("tspan").text(r).attr("class", "title");
|
|
80
|
+
n || f.attr("dy", t.textHeight);
|
|
81
|
+
const h = c.node().getBBox().height;
|
|
82
|
+
let x, k, u;
|
|
83
|
+
if (a.members.length > 0) {
|
|
84
|
+
x = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin / 2).attr("y2", t.padding + h + t.dividerMargin / 2);
|
|
85
|
+
const d = s.append("text").attr("x", t.padding).attr("y", h + t.dividerMargin + t.textHeight).attr("fill", "white").attr("class", "classText");
|
|
86
|
+
n = !0, a.members.forEach(function(l) {
|
|
87
|
+
_(d, l, n, t), n = !1;
|
|
88
|
+
}), k = d.node().getBBox();
|
|
89
|
+
}
|
|
90
|
+
if (a.methods.length > 0) {
|
|
91
|
+
u = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin + k.height).attr("y2", t.padding + h + t.dividerMargin + k.height);
|
|
92
|
+
const d = s.append("text").attr("x", t.padding).attr("y", h + 2 * t.dividerMargin + k.height + t.textHeight).attr("fill", "white").attr("class", "classText");
|
|
93
|
+
n = !0, a.methods.forEach(function(l) {
|
|
94
|
+
_(d, l, n, t), n = !1;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const m = s.node().getBBox();
|
|
98
|
+
var w = " ";
|
|
99
|
+
a.cssClasses.length > 0 && (w = w + a.cssClasses.join(" "));
|
|
100
|
+
const e = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", m.width + 2 * t.padding).attr("height", m.height + t.padding + 0.5 * t.dividerMargin).attr("class", w).node().getBBox().width;
|
|
101
|
+
return c.node().childNodes.forEach(function(d) {
|
|
102
|
+
d.setAttribute("x", (e - d.getBBox().width) / 2);
|
|
103
|
+
}), a.tooltip && c.insert("title").text(a.tooltip), x && x.attr("x2", e), u && u.attr("x2", e), g.width = e, g.height = m.height + t.padding + 0.5 * t.dividerMargin, g;
|
|
104
|
+
}, C = function(i) {
|
|
105
|
+
let a = i.id;
|
|
106
|
+
return i.type && (a += "<" + I(i.type) + ">"), a;
|
|
107
|
+
}, Z = function(i, a, t, o) {
|
|
108
|
+
y.debug("Rendering note ", a, t);
|
|
109
|
+
const p = a.id, g = {
|
|
110
|
+
id: p,
|
|
111
|
+
text: a.text,
|
|
112
|
+
width: 0,
|
|
113
|
+
height: 0
|
|
114
|
+
}, s = i.append("g").attr("id", p).attr("class", "classGroup");
|
|
115
|
+
let c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
|
116
|
+
const n = JSON.parse(`"${a.text}"`).split(`
|
|
117
|
+
`);
|
|
118
|
+
n.forEach(function(x) {
|
|
119
|
+
y.debug(`Adding line: ${x}`), c.append("tspan").text(x).attr("class", "title").attr("dy", t.textHeight);
|
|
120
|
+
});
|
|
121
|
+
const r = s.node().getBBox(), h = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", r.width + 2 * t.padding).attr(
|
|
122
|
+
"height",
|
|
123
|
+
r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin
|
|
124
|
+
).node().getBBox().width;
|
|
125
|
+
return c.node().childNodes.forEach(function(x) {
|
|
126
|
+
x.setAttribute("x", (h - x.getBBox().width) / 2);
|
|
127
|
+
}), g.width = h, g.height = r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin, g;
|
|
128
|
+
}, _ = function(i, a, t, o) {
|
|
129
|
+
const { displayText: p, cssStyle: g } = a.getDisplayDetails(), s = i.append("tspan").attr("x", o.padding).text(p);
|
|
130
|
+
g !== "" && s.attr("style", a.cssStyle), t || s.attr("dy", o.textHeight);
|
|
131
|
+
}, N = {
|
|
132
|
+
getClassTitleString: C,
|
|
133
|
+
drawClass: J,
|
|
134
|
+
drawEdge: X,
|
|
135
|
+
drawNote: Z
|
|
136
|
+
};
|
|
137
|
+
let T = {};
|
|
138
|
+
const E = 20, L = function(i) {
|
|
139
|
+
const a = Object.entries(T).find((t) => t[1].label === i);
|
|
140
|
+
if (a)
|
|
141
|
+
return a[0];
|
|
142
|
+
}, R = function(i) {
|
|
143
|
+
i.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), i.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), i.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), i.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 18,7 L9,13 L14,7 L9,1 Z");
|
|
144
|
+
}, F = function(i, a, t, o) {
|
|
145
|
+
const p = v().class;
|
|
146
|
+
T = {}, y.info("Rendering diagram " + i);
|
|
147
|
+
const g = v().securityLevel;
|
|
148
|
+
let s;
|
|
149
|
+
g === "sandbox" && (s = B("#i" + a));
|
|
150
|
+
const c = g === "sandbox" ? B(s.nodes()[0].contentDocument.body) : B("body"), n = c.select(`[id='${a}']`);
|
|
151
|
+
R(n);
|
|
152
|
+
const r = new Y({
|
|
153
|
+
multigraph: !0
|
|
154
|
+
});
|
|
155
|
+
r.setGraph({
|
|
156
|
+
isMultiGraph: !0
|
|
157
|
+
}), r.setDefaultEdgeLabel(function() {
|
|
158
|
+
return {};
|
|
159
|
+
});
|
|
160
|
+
const f = o.db.getClasses(), h = Object.keys(f);
|
|
161
|
+
for (const e of h) {
|
|
162
|
+
const d = f[e], l = N.drawClass(n, d, p, o);
|
|
163
|
+
T[l.id] = l, r.setNode(l.id, l), y.info("Org height: " + l.height);
|
|
164
|
+
}
|
|
165
|
+
o.db.getRelations().forEach(function(e) {
|
|
166
|
+
y.info(
|
|
167
|
+
// cspell:ignore tjoho
|
|
168
|
+
"tjoho" + L(e.id1) + L(e.id2) + JSON.stringify(e)
|
|
169
|
+
), r.setEdge(
|
|
170
|
+
L(e.id1),
|
|
171
|
+
L(e.id2),
|
|
172
|
+
{
|
|
173
|
+
relation: e
|
|
174
|
+
},
|
|
175
|
+
e.title || "DEFAULT"
|
|
176
|
+
);
|
|
177
|
+
}), o.db.getNotes().forEach(function(e) {
|
|
178
|
+
y.debug(`Adding note: ${JSON.stringify(e)}`);
|
|
179
|
+
const d = N.drawNote(n, e, p, o);
|
|
180
|
+
T[d.id] = d, r.setNode(d.id, d), e.class && e.class in f && r.setEdge(
|
|
181
|
+
e.id,
|
|
182
|
+
L(e.class),
|
|
183
|
+
{
|
|
184
|
+
relation: {
|
|
185
|
+
id1: e.id,
|
|
186
|
+
id2: e.class,
|
|
187
|
+
relation: {
|
|
188
|
+
type1: "none",
|
|
189
|
+
type2: "none",
|
|
190
|
+
lineType: 10
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"DEFAULT"
|
|
195
|
+
);
|
|
196
|
+
}), O(r), r.nodes().forEach(function(e) {
|
|
197
|
+
e !== void 0 && r.node(e) !== void 0 && (y.debug("Node " + e + ": " + JSON.stringify(r.node(e))), c.select("#" + (o.db.lookUpDomId(e) || e)).attr(
|
|
198
|
+
"transform",
|
|
199
|
+
"translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
|
|
200
|
+
));
|
|
201
|
+
}), r.edges().forEach(function(e) {
|
|
202
|
+
e !== void 0 && r.edge(e) !== void 0 && (y.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(r.edge(e))), N.drawEdge(n, r.edge(e), r.edge(e).relation, p, o));
|
|
203
|
+
});
|
|
204
|
+
const u = n.node().getBBox(), m = u.width + E * 2, w = u.height + E * 2;
|
|
205
|
+
W(n, w, m, p.useMaxWidth);
|
|
206
|
+
const b = `${u.x - E} ${u.y - E} ${m} ${w}`;
|
|
207
|
+
y.debug(`viewBox ${b}`), n.attr("viewBox", b);
|
|
208
|
+
}, U = {
|
|
209
|
+
draw: F
|
|
210
|
+
}, et = {
|
|
211
|
+
parser: A,
|
|
212
|
+
db: S,
|
|
213
|
+
renderer: U,
|
|
214
|
+
styles: G,
|
|
215
|
+
init: (i) => {
|
|
216
|
+
i.class || (i.class = {}), i.class.arrowMarkerAbsolute = i.arrowMarkerAbsolute, S.clear();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
export {
|
|
220
|
+
et as diagram
|
|
221
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { p as M, d as _, s as R } from "./styles-9a916d00-18b5fd0d.mjs";
|
|
2
|
+
import { a2 as d, Y as c, a1 as w, ak as B, ad as G, a9 as D, ac as E, a8 as C, a5 as A } from "./main-740da2e1.mjs";
|
|
3
|
+
import { G as z } from "./graph-9ea4e80a.mjs";
|
|
4
|
+
import { r as P } from "./index-3862675e-b7177fa1.mjs";
|
|
5
|
+
import "./layout-d3bc02b9.mjs";
|
|
6
|
+
import "vue";
|
|
7
|
+
import "./clone-59a3b16a.mjs";
|
|
8
|
+
import "./edges-e0da2a9e-91b210e9.mjs";
|
|
9
|
+
import "./createText-2e5e7dd3-898a4de3.mjs";
|
|
10
|
+
import "./line-b044df13.mjs";
|
|
11
|
+
import "./array-2ff2c7a6.mjs";
|
|
12
|
+
import "./path-428ebac9.mjs";
|
|
13
|
+
const S = (s) => A.sanitizeText(s, c());
|
|
14
|
+
let k = {
|
|
15
|
+
dividerMargin: 10,
|
|
16
|
+
padding: 5,
|
|
17
|
+
textHeight: 10,
|
|
18
|
+
curve: void 0
|
|
19
|
+
};
|
|
20
|
+
const q = function(s, e, y, a) {
|
|
21
|
+
const t = Object.keys(s);
|
|
22
|
+
d.info("keys:", t), d.info(s), t.forEach(function(i) {
|
|
23
|
+
var o, r;
|
|
24
|
+
const l = s[i], p = {
|
|
25
|
+
shape: "rect",
|
|
26
|
+
id: l.id,
|
|
27
|
+
domId: l.domId,
|
|
28
|
+
labelText: S(l.id),
|
|
29
|
+
labelStyle: "",
|
|
30
|
+
style: "fill: none; stroke: black",
|
|
31
|
+
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
32
|
+
padding: ((o = c().flowchart) == null ? void 0 : o.padding) ?? ((r = c().class) == null ? void 0 : r.padding)
|
|
33
|
+
};
|
|
34
|
+
e.setNode(l.id, p), $(l.classes, e, y, a, l.id), d.info("setNode", p);
|
|
35
|
+
});
|
|
36
|
+
}, $ = function(s, e, y, a, t) {
|
|
37
|
+
const i = Object.keys(s);
|
|
38
|
+
d.info("keys:", i), d.info(s), i.filter((o) => s[o].parent == t).forEach(function(o) {
|
|
39
|
+
var r, l;
|
|
40
|
+
const n = s[o], p = n.cssClasses.join(" "), f = D(n.styles), h = n.label ?? n.id, b = 0, m = "class_box", u = {
|
|
41
|
+
labelStyle: f.labelStyle,
|
|
42
|
+
shape: m,
|
|
43
|
+
labelText: S(h),
|
|
44
|
+
classData: n,
|
|
45
|
+
rx: b,
|
|
46
|
+
ry: b,
|
|
47
|
+
class: p,
|
|
48
|
+
style: f.style,
|
|
49
|
+
id: n.id,
|
|
50
|
+
domId: n.domId,
|
|
51
|
+
tooltip: a.db.getTooltip(n.id, t) || "",
|
|
52
|
+
haveCallback: n.haveCallback,
|
|
53
|
+
link: n.link,
|
|
54
|
+
width: n.type === "group" ? 500 : void 0,
|
|
55
|
+
type: n.type,
|
|
56
|
+
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
57
|
+
padding: ((r = c().flowchart) == null ? void 0 : r.padding) ?? ((l = c().class) == null ? void 0 : l.padding)
|
|
58
|
+
};
|
|
59
|
+
e.setNode(n.id, u), t && e.setParent(n.id, t), d.info("setNode", u);
|
|
60
|
+
});
|
|
61
|
+
}, F = function(s, e, y, a) {
|
|
62
|
+
d.info(s), s.forEach(function(t, i) {
|
|
63
|
+
var o, r;
|
|
64
|
+
const l = t, n = "", p = { labelStyle: "", style: "" }, f = l.text, h = 0, b = "note", m = {
|
|
65
|
+
labelStyle: p.labelStyle,
|
|
66
|
+
shape: b,
|
|
67
|
+
labelText: S(f),
|
|
68
|
+
noteData: l,
|
|
69
|
+
rx: h,
|
|
70
|
+
ry: h,
|
|
71
|
+
class: n,
|
|
72
|
+
style: p.style,
|
|
73
|
+
id: l.id,
|
|
74
|
+
domId: l.id,
|
|
75
|
+
tooltip: "",
|
|
76
|
+
type: "note",
|
|
77
|
+
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
78
|
+
padding: ((o = c().flowchart) == null ? void 0 : o.padding) ?? ((r = c().class) == null ? void 0 : r.padding)
|
|
79
|
+
};
|
|
80
|
+
if (e.setNode(l.id, m), d.info("setNode", m), !l.class || !(l.class in a))
|
|
81
|
+
return;
|
|
82
|
+
const u = y + i, x = {
|
|
83
|
+
id: `edgeNote${u}`,
|
|
84
|
+
//Set relationship style and line type
|
|
85
|
+
classes: "relation",
|
|
86
|
+
pattern: "dotted",
|
|
87
|
+
// Set link type for rendering
|
|
88
|
+
arrowhead: "none",
|
|
89
|
+
//Set edge extra labels
|
|
90
|
+
startLabelRight: "",
|
|
91
|
+
endLabelLeft: "",
|
|
92
|
+
//Set relation arrow types
|
|
93
|
+
arrowTypeStart: "none",
|
|
94
|
+
arrowTypeEnd: "none",
|
|
95
|
+
style: "fill:none",
|
|
96
|
+
labelStyle: "",
|
|
97
|
+
curve: E(k.curve, C)
|
|
98
|
+
};
|
|
99
|
+
e.setEdge(l.id, l.class, x, u);
|
|
100
|
+
});
|
|
101
|
+
}, H = function(s, e) {
|
|
102
|
+
const y = c().flowchart;
|
|
103
|
+
let a = 0;
|
|
104
|
+
s.forEach(function(t) {
|
|
105
|
+
var i;
|
|
106
|
+
a++;
|
|
107
|
+
const o = {
|
|
108
|
+
//Set relationship style and line type
|
|
109
|
+
classes: "relation",
|
|
110
|
+
pattern: t.relation.lineType == 1 ? "dashed" : "solid",
|
|
111
|
+
id: `id_${t.id1}_${t.id2}_${a}`,
|
|
112
|
+
// Set link type for rendering
|
|
113
|
+
arrowhead: t.type === "arrow_open" ? "none" : "normal",
|
|
114
|
+
//Set edge extra labels
|
|
115
|
+
startLabelRight: t.relationTitle1 === "none" ? "" : t.relationTitle1,
|
|
116
|
+
endLabelLeft: t.relationTitle2 === "none" ? "" : t.relationTitle2,
|
|
117
|
+
//Set relation arrow types
|
|
118
|
+
arrowTypeStart: N(t.relation.type1),
|
|
119
|
+
arrowTypeEnd: N(t.relation.type2),
|
|
120
|
+
style: "fill:none",
|
|
121
|
+
labelStyle: "",
|
|
122
|
+
curve: E(y == null ? void 0 : y.curve, C)
|
|
123
|
+
};
|
|
124
|
+
if (d.info(o, t), t.style !== void 0) {
|
|
125
|
+
const r = D(t.style);
|
|
126
|
+
o.style = r.style, o.labelStyle = r.labelStyle;
|
|
127
|
+
}
|
|
128
|
+
t.text = t.title, t.text === void 0 ? t.style !== void 0 && (o.arrowheadStyle = "fill: #333") : (o.arrowheadStyle = "fill: #333", o.labelpos = "c", ((i = c().flowchart) == null ? void 0 : i.htmlLabels) ?? c().htmlLabels ? (o.labelType = "html", o.label = '<span class="edgeLabel">' + t.text + "</span>") : (o.labelType = "text", o.label = t.text.replace(A.lineBreakRegex, `
|
|
129
|
+
`), t.style === void 0 && (o.style = o.style || "stroke: #333; stroke-width: 1.5px;fill:none"), o.labelStyle = o.labelStyle.replace("color:", "fill:"))), e.setEdge(t.id1, t.id2, o, a);
|
|
130
|
+
});
|
|
131
|
+
}, V = function(s) {
|
|
132
|
+
k = {
|
|
133
|
+
...k,
|
|
134
|
+
...s
|
|
135
|
+
};
|
|
136
|
+
}, W = async function(s, e, y, a) {
|
|
137
|
+
d.info("Drawing class - ", e);
|
|
138
|
+
const t = c().flowchart ?? c().class, i = c().securityLevel;
|
|
139
|
+
d.info("config:", t);
|
|
140
|
+
const o = (t == null ? void 0 : t.nodeSpacing) ?? 50, r = (t == null ? void 0 : t.rankSpacing) ?? 50, l = new z({
|
|
141
|
+
multigraph: !0,
|
|
142
|
+
compound: !0
|
|
143
|
+
}).setGraph({
|
|
144
|
+
rankdir: a.db.getDirection(),
|
|
145
|
+
nodesep: o,
|
|
146
|
+
ranksep: r,
|
|
147
|
+
marginx: 8,
|
|
148
|
+
marginy: 8
|
|
149
|
+
}).setDefaultEdgeLabel(function() {
|
|
150
|
+
return {};
|
|
151
|
+
}), n = a.db.getNamespaces(), p = a.db.getClasses(), f = a.db.getRelations(), h = a.db.getNotes();
|
|
152
|
+
d.info(f), q(n, l, e, a), $(p, l, e, a), H(f, l), F(h, l, f.length + 1, p);
|
|
153
|
+
let b;
|
|
154
|
+
i === "sandbox" && (b = w("#i" + e));
|
|
155
|
+
const m = i === "sandbox" ? w(b.nodes()[0].contentDocument.body) : w("body"), u = m.select(`[id="${e}"]`), x = m.select("#" + e + " g");
|
|
156
|
+
if (await P(
|
|
157
|
+
x,
|
|
158
|
+
l,
|
|
159
|
+
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
160
|
+
"classDiagram",
|
|
161
|
+
e
|
|
162
|
+
), B.insertTitle(u, "classTitleText", (t == null ? void 0 : t.titleTopMargin) ?? 5, a.db.getDiagramTitle()), G(l, u, t == null ? void 0 : t.diagramPadding, t == null ? void 0 : t.useMaxWidth), !(t != null && t.htmlLabels)) {
|
|
163
|
+
const T = i === "sandbox" ? b.nodes()[0].contentDocument : document, I = T.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
|
|
164
|
+
for (const g of I) {
|
|
165
|
+
const L = g.getBBox(), v = T.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
166
|
+
v.setAttribute("rx", 0), v.setAttribute("ry", 0), v.setAttribute("width", L.width), v.setAttribute("height", L.height), g.insertBefore(v, g.firstChild);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
function N(s) {
|
|
171
|
+
let e;
|
|
172
|
+
switch (s) {
|
|
173
|
+
case 0:
|
|
174
|
+
e = "aggregation";
|
|
175
|
+
break;
|
|
176
|
+
case 1:
|
|
177
|
+
e = "extension";
|
|
178
|
+
break;
|
|
179
|
+
case 2:
|
|
180
|
+
e = "composition";
|
|
181
|
+
break;
|
|
182
|
+
case 3:
|
|
183
|
+
e = "dependency";
|
|
184
|
+
break;
|
|
185
|
+
case 4:
|
|
186
|
+
e = "lollipop";
|
|
187
|
+
break;
|
|
188
|
+
default:
|
|
189
|
+
e = "none";
|
|
190
|
+
}
|
|
191
|
+
return e;
|
|
192
|
+
}
|
|
193
|
+
const Y = {
|
|
194
|
+
setConf: V,
|
|
195
|
+
draw: W
|
|
196
|
+
}, st = {
|
|
197
|
+
parser: M,
|
|
198
|
+
db: _,
|
|
199
|
+
renderer: Y,
|
|
200
|
+
styles: R,
|
|
201
|
+
init: (s) => {
|
|
202
|
+
s.class || (s.class = {}), s.class.arrowMarkerAbsolute = s.arrowMarkerAbsolute, _.clear();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
export {
|
|
206
|
+
st as diagram
|
|
207
|
+
};
|