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,269 @@
|
|
|
1
|
+
import { p as P, d as N, s as W } from "./styles-6aaf32cf-e32ec570.mjs";
|
|
2
|
+
import { Y as t, a1 as H, a2 as b, a3 as R, a5 as T, ap as v, ak as U } from "./main-740da2e1.mjs";
|
|
3
|
+
import { G as C } from "./graph-9ea4e80a.mjs";
|
|
4
|
+
import { l as F } from "./layout-d3bc02b9.mjs";
|
|
5
|
+
import { l as $ } from "./line-b044df13.mjs";
|
|
6
|
+
import "vue";
|
|
7
|
+
import "./array-2ff2c7a6.mjs";
|
|
8
|
+
import "./path-428ebac9.mjs";
|
|
9
|
+
const O = (e) => e.append("circle").attr("class", "start-state").attr("r", t().state.sizeUnit).attr("cx", t().state.padding + t().state.sizeUnit).attr("cy", t().state.padding + t().state.sizeUnit), X = (e) => e.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", t().state.textHeight).attr("class", "divider").attr("x2", t().state.textHeight * 2).attr("y1", 0).attr("y2", 0), Y = (e, i) => {
|
|
10
|
+
const o = e.append("text").attr("x", 2 * t().state.padding).attr("y", t().state.textHeight + 2 * t().state.padding).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.id), c = o.node().getBBox();
|
|
11
|
+
return e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", c.width + 2 * t().state.padding).attr("height", c.height + 2 * t().state.padding).attr("rx", t().state.radius), o;
|
|
12
|
+
}, J = (e, i) => {
|
|
13
|
+
const o = function(l, m, w) {
|
|
14
|
+
const E = l.append("tspan").attr("x", 2 * t().state.padding).text(m);
|
|
15
|
+
w || E.attr("dy", t().state.textHeight);
|
|
16
|
+
}, s = e.append("text").attr("x", 2 * t().state.padding).attr("y", t().state.textHeight + 1.3 * t().state.padding).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.descriptions[0]).node().getBBox(), g = s.height, p = e.append("text").attr("x", t().state.padding).attr(
|
|
17
|
+
"y",
|
|
18
|
+
g + t().state.padding * 0.4 + t().state.dividerMargin + t().state.textHeight
|
|
19
|
+
).attr("class", "state-description");
|
|
20
|
+
let a = !0, r = !0;
|
|
21
|
+
i.descriptions.forEach(function(l) {
|
|
22
|
+
a || (o(p, l, r), r = !1), a = !1;
|
|
23
|
+
});
|
|
24
|
+
const y = e.append("line").attr("x1", t().state.padding).attr("y1", t().state.padding + g + t().state.dividerMargin / 2).attr("y2", t().state.padding + g + t().state.dividerMargin / 2).attr("class", "descr-divider"), x = p.node().getBBox(), d = Math.max(x.width, s.width);
|
|
25
|
+
return y.attr("x2", d + 3 * t().state.padding), e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", d + 2 * t().state.padding).attr("height", x.height + g + 2 * t().state.padding).attr("rx", t().state.radius), e;
|
|
26
|
+
}, I = (e, i, o) => {
|
|
27
|
+
const c = t().state.padding, s = 2 * t().state.padding, g = e.node().getBBox(), p = g.width, a = g.x, r = e.append("text").attr("x", 0).attr("y", t().state.titleShift).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.id), x = r.node().getBBox().width + s;
|
|
28
|
+
let d = Math.max(x, p);
|
|
29
|
+
d === p && (d = d + s);
|
|
30
|
+
let l;
|
|
31
|
+
const m = e.node().getBBox();
|
|
32
|
+
i.doc, l = a - c, x > p && (l = (p - d) / 2 + c), Math.abs(a - m.x) < c && x > p && (l = a - (x - p) / 2);
|
|
33
|
+
const w = 1 - t().state.textHeight;
|
|
34
|
+
return e.insert("rect", ":first-child").attr("x", l).attr("y", w).attr("class", o ? "alt-composit" : "composit").attr("width", d).attr(
|
|
35
|
+
"height",
|
|
36
|
+
m.height + t().state.textHeight + t().state.titleShift + 1
|
|
37
|
+
).attr("rx", "0"), r.attr("x", l + c), x <= p && r.attr("x", a + (d - s) / 2 - x / 2 + c), e.insert("rect", ":first-child").attr("x", l).attr(
|
|
38
|
+
"y",
|
|
39
|
+
t().state.titleShift - t().state.textHeight - t().state.padding
|
|
40
|
+
).attr("width", d).attr("height", t().state.textHeight * 3).attr("rx", t().state.radius), e.insert("rect", ":first-child").attr("x", l).attr(
|
|
41
|
+
"y",
|
|
42
|
+
t().state.titleShift - t().state.textHeight - t().state.padding
|
|
43
|
+
).attr("width", d).attr("height", m.height + 3 + 2 * t().state.textHeight).attr("rx", t().state.radius), e;
|
|
44
|
+
}, _ = (e) => (e.append("circle").attr("class", "end-state-outer").attr("r", t().state.sizeUnit + t().state.miniPadding).attr(
|
|
45
|
+
"cx",
|
|
46
|
+
t().state.padding + t().state.sizeUnit + t().state.miniPadding
|
|
47
|
+
).attr(
|
|
48
|
+
"cy",
|
|
49
|
+
t().state.padding + t().state.sizeUnit + t().state.miniPadding
|
|
50
|
+
), e.append("circle").attr("class", "end-state-inner").attr("r", t().state.sizeUnit).attr("cx", t().state.padding + t().state.sizeUnit + 2).attr("cy", t().state.padding + t().state.sizeUnit + 2)), q = (e, i) => {
|
|
51
|
+
let o = t().state.forkWidth, c = t().state.forkHeight;
|
|
52
|
+
if (i.parentId) {
|
|
53
|
+
let s = o;
|
|
54
|
+
o = c, c = s;
|
|
55
|
+
}
|
|
56
|
+
return e.append("rect").style("stroke", "black").style("fill", "black").attr("width", o).attr("height", c).attr("x", t().state.padding).attr("y", t().state.padding);
|
|
57
|
+
}, Z = (e, i, o, c) => {
|
|
58
|
+
let s = 0;
|
|
59
|
+
const g = c.append("text");
|
|
60
|
+
g.style("text-anchor", "start"), g.attr("class", "noteText");
|
|
61
|
+
let p = e.replace(/\r\n/g, "<br/>");
|
|
62
|
+
p = p.replace(/\n/g, "<br/>");
|
|
63
|
+
const a = p.split(T.lineBreakRegex);
|
|
64
|
+
let r = 1.25 * t().state.noteMargin;
|
|
65
|
+
for (const y of a) {
|
|
66
|
+
const x = y.trim();
|
|
67
|
+
if (x.length > 0) {
|
|
68
|
+
const d = g.append("tspan");
|
|
69
|
+
if (d.text(x), r === 0) {
|
|
70
|
+
const l = d.node().getBBox();
|
|
71
|
+
r += l.height;
|
|
72
|
+
}
|
|
73
|
+
s += r, d.attr("x", i + t().state.noteMargin), d.attr("y", o + s + 1.25 * t().state.noteMargin);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return { textWidth: g.node().getBBox().width, textHeight: s };
|
|
77
|
+
}, K = (e, i) => {
|
|
78
|
+
i.attr("class", "state-note");
|
|
79
|
+
const o = i.append("rect").attr("x", 0).attr("y", t().state.padding), c = i.append("g"), { textWidth: s, textHeight: g } = Z(e, 0, 0, c);
|
|
80
|
+
return o.attr("height", g + 2 * t().state.noteMargin), o.attr("width", s + t().state.noteMargin * 2), o;
|
|
81
|
+
}, L = function(e, i) {
|
|
82
|
+
const o = i.id, c = {
|
|
83
|
+
id: o,
|
|
84
|
+
label: i.id,
|
|
85
|
+
width: 0,
|
|
86
|
+
height: 0
|
|
87
|
+
}, s = e.append("g").attr("id", o).attr("class", "stateGroup");
|
|
88
|
+
i.type === "start" && O(s), i.type === "end" && _(s), (i.type === "fork" || i.type === "join") && q(s, i), i.type === "note" && K(i.note.text, s), i.type === "divider" && X(s), i.type === "default" && i.descriptions.length === 0 && Y(s, i), i.type === "default" && i.descriptions.length > 0 && J(s, i);
|
|
89
|
+
const g = s.node().getBBox();
|
|
90
|
+
return c.width = g.width + 2 * t().state.padding, c.height = g.height + 2 * t().state.padding, c;
|
|
91
|
+
};
|
|
92
|
+
let G = 0;
|
|
93
|
+
const Q = function(e, i, o) {
|
|
94
|
+
const c = function(r) {
|
|
95
|
+
switch (r) {
|
|
96
|
+
case N.relationType.AGGREGATION:
|
|
97
|
+
return "aggregation";
|
|
98
|
+
case N.relationType.EXTENSION:
|
|
99
|
+
return "extension";
|
|
100
|
+
case N.relationType.COMPOSITION:
|
|
101
|
+
return "composition";
|
|
102
|
+
case N.relationType.DEPENDENCY:
|
|
103
|
+
return "dependency";
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
i.points = i.points.filter((r) => !Number.isNaN(r.y));
|
|
107
|
+
const s = i.points, g = $().x(function(r) {
|
|
108
|
+
return r.x;
|
|
109
|
+
}).y(function(r) {
|
|
110
|
+
return r.y;
|
|
111
|
+
}).curve(v), p = e.append("path").attr("d", g(s)).attr("id", "edge" + G).attr("class", "transition");
|
|
112
|
+
let a = "";
|
|
113
|
+
if (t().state.arrowMarkerAbsolute && (a = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, a = a.replace(/\(/g, "\\("), a = a.replace(/\)/g, "\\)")), p.attr(
|
|
114
|
+
"marker-end",
|
|
115
|
+
"url(" + a + "#" + c(N.relationType.DEPENDENCY) + "End)"
|
|
116
|
+
), o.title !== void 0) {
|
|
117
|
+
const r = e.append("g").attr("class", "stateLabel"), { x: y, y: x } = U.calcLabelPosition(i.points), d = T.getRows(o.title);
|
|
118
|
+
let l = 0;
|
|
119
|
+
const m = [];
|
|
120
|
+
let w = 0, E = 0;
|
|
121
|
+
for (let u = 0; u <= d.length; u++) {
|
|
122
|
+
const h = r.append("text").attr("text-anchor", "middle").text(d[u]).attr("x", y).attr("y", x + l), f = h.node().getBBox();
|
|
123
|
+
w = Math.max(w, f.width), E = Math.min(E, f.x), b.info(f.x, y, x + l), l === 0 && (l = h.node().getBBox().height, b.info("Title height", l, x)), m.push(h);
|
|
124
|
+
}
|
|
125
|
+
let k = l * d.length;
|
|
126
|
+
if (d.length > 1) {
|
|
127
|
+
const u = (d.length - 1) * l * 0.5;
|
|
128
|
+
m.forEach((h, f) => h.attr("y", x + f * l - u)), k = l * d.length;
|
|
129
|
+
}
|
|
130
|
+
const n = r.node().getBBox();
|
|
131
|
+
r.insert("rect", ":first-child").attr("class", "box").attr("x", y - w / 2 - t().state.padding / 2).attr("y", x - k / 2 - t().state.padding / 2 - 3.5).attr("width", w + t().state.padding).attr("height", k + t().state.padding), b.info(n);
|
|
132
|
+
}
|
|
133
|
+
G++;
|
|
134
|
+
};
|
|
135
|
+
let B;
|
|
136
|
+
const z = {}, V = function() {
|
|
137
|
+
}, j = function(e) {
|
|
138
|
+
e.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");
|
|
139
|
+
}, D = function(e, i, o, c) {
|
|
140
|
+
B = t().state;
|
|
141
|
+
const s = t().securityLevel;
|
|
142
|
+
let g;
|
|
143
|
+
s === "sandbox" && (g = H("#i" + i));
|
|
144
|
+
const p = s === "sandbox" ? H(g.nodes()[0].contentDocument.body) : H("body"), a = s === "sandbox" ? g.nodes()[0].contentDocument : document;
|
|
145
|
+
b.debug("Rendering diagram " + e);
|
|
146
|
+
const r = p.select(`[id='${i}']`);
|
|
147
|
+
j(r);
|
|
148
|
+
const y = c.db.getRootDoc();
|
|
149
|
+
A(y, r, void 0, !1, p, a, c);
|
|
150
|
+
const x = B.padding, d = r.node().getBBox(), l = d.width + x * 2, m = d.height + x * 2, w = l * 1.75;
|
|
151
|
+
R(r, m, w, B.useMaxWidth), r.attr(
|
|
152
|
+
"viewBox",
|
|
153
|
+
`${d.x - B.padding} ${d.y - B.padding} ` + l + " " + m
|
|
154
|
+
);
|
|
155
|
+
}, tt = (e) => e ? e.length * B.fontSizeFactor : 1, A = (e, i, o, c, s, g, p) => {
|
|
156
|
+
const a = new C({
|
|
157
|
+
compound: !0,
|
|
158
|
+
multigraph: !0
|
|
159
|
+
});
|
|
160
|
+
let r, y = !0;
|
|
161
|
+
for (r = 0; r < e.length; r++)
|
|
162
|
+
if (e[r].stmt === "relation") {
|
|
163
|
+
y = !1;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
o ? a.setGraph({
|
|
167
|
+
rankdir: "LR",
|
|
168
|
+
multigraph: !0,
|
|
169
|
+
compound: !0,
|
|
170
|
+
// acyclicer: 'greedy',
|
|
171
|
+
ranker: "tight-tree",
|
|
172
|
+
ranksep: y ? 1 : B.edgeLengthFactor,
|
|
173
|
+
nodeSep: y ? 1 : 50,
|
|
174
|
+
isMultiGraph: !0
|
|
175
|
+
// ranksep: 5,
|
|
176
|
+
// nodesep: 1
|
|
177
|
+
}) : a.setGraph({
|
|
178
|
+
rankdir: "TB",
|
|
179
|
+
multigraph: !0,
|
|
180
|
+
compound: !0,
|
|
181
|
+
// isCompound: true,
|
|
182
|
+
// acyclicer: 'greedy',
|
|
183
|
+
// ranker: 'longest-path'
|
|
184
|
+
ranksep: y ? 1 : B.edgeLengthFactor,
|
|
185
|
+
nodeSep: y ? 1 : 50,
|
|
186
|
+
ranker: "tight-tree",
|
|
187
|
+
// ranker: 'network-simplex'
|
|
188
|
+
isMultiGraph: !0
|
|
189
|
+
}), a.setDefaultEdgeLabel(function() {
|
|
190
|
+
return {};
|
|
191
|
+
}), p.db.extract(e);
|
|
192
|
+
const x = p.db.getStates(), d = p.db.getRelations(), l = Object.keys(x);
|
|
193
|
+
for (const n of l) {
|
|
194
|
+
const u = x[n];
|
|
195
|
+
o && (u.parentId = o);
|
|
196
|
+
let h;
|
|
197
|
+
if (u.doc) {
|
|
198
|
+
let f = i.append("g").attr("id", u.id).attr("class", "stateGroup");
|
|
199
|
+
h = A(u.doc, f, u.id, !c, s, g, p);
|
|
200
|
+
{
|
|
201
|
+
f = I(f, u, c);
|
|
202
|
+
let S = f.node().getBBox();
|
|
203
|
+
h.width = S.width, h.height = S.height + B.padding / 2, z[u.id] = { y: B.compositTitleSize };
|
|
204
|
+
}
|
|
205
|
+
} else
|
|
206
|
+
h = L(i, u);
|
|
207
|
+
if (u.note) {
|
|
208
|
+
const f = {
|
|
209
|
+
descriptions: [],
|
|
210
|
+
id: u.id + "-note",
|
|
211
|
+
note: u.note,
|
|
212
|
+
type: "note"
|
|
213
|
+
}, S = L(i, f);
|
|
214
|
+
u.note.position === "left of" ? (a.setNode(h.id + "-note", S), a.setNode(h.id, h)) : (a.setNode(h.id, h), a.setNode(h.id + "-note", S)), a.setParent(h.id, h.id + "-group"), a.setParent(h.id + "-note", h.id + "-group");
|
|
215
|
+
} else
|
|
216
|
+
a.setNode(h.id, h);
|
|
217
|
+
}
|
|
218
|
+
b.debug("Count=", a.nodeCount(), a);
|
|
219
|
+
let m = 0;
|
|
220
|
+
d.forEach(function(n) {
|
|
221
|
+
m++, b.debug("Setting edge", n), a.setEdge(
|
|
222
|
+
n.id1,
|
|
223
|
+
n.id2,
|
|
224
|
+
{
|
|
225
|
+
relation: n,
|
|
226
|
+
width: tt(n.title),
|
|
227
|
+
height: B.labelHeight * T.getRows(n.title).length,
|
|
228
|
+
labelpos: "c"
|
|
229
|
+
},
|
|
230
|
+
"id" + m
|
|
231
|
+
);
|
|
232
|
+
}), F(a), b.debug("Graph after layout", a.nodes());
|
|
233
|
+
const w = i.node();
|
|
234
|
+
a.nodes().forEach(function(n) {
|
|
235
|
+
n !== void 0 && a.node(n) !== void 0 ? (b.warn("Node " + n + ": " + JSON.stringify(a.node(n))), s.select("#" + w.id + " #" + n).attr(
|
|
236
|
+
"transform",
|
|
237
|
+
"translate(" + (a.node(n).x - a.node(n).width / 2) + "," + (a.node(n).y + (z[n] ? z[n].y : 0) - a.node(n).height / 2) + " )"
|
|
238
|
+
), s.select("#" + w.id + " #" + n).attr("data-x-shift", a.node(n).x - a.node(n).width / 2), g.querySelectorAll("#" + w.id + " #" + n + " .divider").forEach((h) => {
|
|
239
|
+
const f = h.parentElement;
|
|
240
|
+
let S = 0, M = 0;
|
|
241
|
+
f && (f.parentElement && (S = f.parentElement.getBBox().width), M = parseInt(f.getAttribute("data-x-shift"), 10), Number.isNaN(M) && (M = 0)), h.setAttribute("x1", 0 - M + 8), h.setAttribute("x2", S - M - 8);
|
|
242
|
+
})) : b.debug("No Node " + n + ": " + JSON.stringify(a.node(n)));
|
|
243
|
+
});
|
|
244
|
+
let E = w.getBBox();
|
|
245
|
+
a.edges().forEach(function(n) {
|
|
246
|
+
n !== void 0 && a.edge(n) !== void 0 && (b.debug("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(a.edge(n))), Q(i, a.edge(n), a.edge(n).relation));
|
|
247
|
+
}), E = w.getBBox();
|
|
248
|
+
const k = {
|
|
249
|
+
id: o || "root",
|
|
250
|
+
label: o || "root",
|
|
251
|
+
width: 0,
|
|
252
|
+
height: 0
|
|
253
|
+
};
|
|
254
|
+
return k.width = E.width + 2 * B.padding, k.height = E.height + 2 * B.padding, b.debug("Doc rendered", k, a), k;
|
|
255
|
+
}, et = {
|
|
256
|
+
setConf: V,
|
|
257
|
+
draw: D
|
|
258
|
+
}, lt = {
|
|
259
|
+
parser: P,
|
|
260
|
+
db: N,
|
|
261
|
+
renderer: et,
|
|
262
|
+
styles: W,
|
|
263
|
+
init: (e) => {
|
|
264
|
+
e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute, N.clear();
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
export {
|
|
268
|
+
lt as diagram
|
|
269
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { p as J, d as B, s as Q, D as H, a as X, S as Z, b as F, c as I } from "./styles-6aaf32cf-e32ec570.mjs";
|
|
2
|
+
import { G as tt } from "./graph-9ea4e80a.mjs";
|
|
3
|
+
import { a2 as E, Y as g, a1 as x, ak as et, a3 as ot, a5 as w } from "./main-740da2e1.mjs";
|
|
4
|
+
import { r as st } 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 h = "rect", C = "rectWithTitle", nt = "start", it = "end", ct = "divider", rt = "roundedWithTitle", at = "note", lt = "noteGroup", _ = "statediagram", dt = "state", Et = `${_}-${dt}`, U = "transition", St = "note", Tt = "note-edge", pt = `${U} ${Tt}`, _t = `${_}-${St}`, ut = "cluster", Dt = `${_}-${ut}`, bt = "cluster-alt", ft = `${_}-${bt}`, V = "parent", Y = "note", At = "state", N = "----", ht = `${N}${Y}`, M = `${N}${V}`, m = "fill:none", W = "fill: #333", z = "c", q = "text", K = "normal";
|
|
14
|
+
let y = {}, d = 0;
|
|
15
|
+
const yt = function(t) {
|
|
16
|
+
const n = Object.keys(t);
|
|
17
|
+
for (const e of n)
|
|
18
|
+
t[e];
|
|
19
|
+
}, gt = function(t, n) {
|
|
20
|
+
return n.db.extract(n.db.getRootDocV2()), n.db.getClasses();
|
|
21
|
+
};
|
|
22
|
+
function $t(t) {
|
|
23
|
+
return t == null ? "" : t.classes ? t.classes.join(" ") : "";
|
|
24
|
+
}
|
|
25
|
+
function R(t = "", n = 0, e = "", i = N) {
|
|
26
|
+
const c = e !== null && e.length > 0 ? `${i}${e}` : "";
|
|
27
|
+
return `${At}-${t}${c}-${n}`;
|
|
28
|
+
}
|
|
29
|
+
const A = (t, n, e, i, c, r) => {
|
|
30
|
+
const o = e.id, u = $t(i[o]);
|
|
31
|
+
if (o !== "root") {
|
|
32
|
+
let T = h;
|
|
33
|
+
e.start === !0 && (T = nt), e.start === !1 && (T = it), e.type !== H && (T = e.type), y[o] || (y[o] = {
|
|
34
|
+
id: o,
|
|
35
|
+
shape: T,
|
|
36
|
+
description: w.sanitizeText(o, g()),
|
|
37
|
+
classes: `${u} ${Et}`
|
|
38
|
+
});
|
|
39
|
+
const s = y[o];
|
|
40
|
+
e.description && (Array.isArray(s.description) ? (s.shape = C, s.description.push(e.description)) : s.description.length > 0 ? (s.shape = C, s.description === o ? s.description = [e.description] : s.description = [s.description, e.description]) : (s.shape = h, s.description = e.description), s.description = w.sanitizeTextOrArray(s.description, g())), s.description.length === 1 && s.shape === C && (s.shape = h), !s.type && e.doc && (E.info("Setting cluster for ", o, G(e)), s.type = "group", s.dir = G(e), s.shape = e.type === X ? ct : rt, s.classes = s.classes + " " + Dt + " " + (r ? ft : ""));
|
|
41
|
+
const p = {
|
|
42
|
+
labelStyle: "",
|
|
43
|
+
shape: s.shape,
|
|
44
|
+
labelText: s.description,
|
|
45
|
+
// typeof newNode.description === 'object'
|
|
46
|
+
// ? newNode.description[0]
|
|
47
|
+
// : newNode.description,
|
|
48
|
+
classes: s.classes,
|
|
49
|
+
style: "",
|
|
50
|
+
//styles.style,
|
|
51
|
+
id: o,
|
|
52
|
+
dir: s.dir,
|
|
53
|
+
domId: R(o, d),
|
|
54
|
+
type: s.type,
|
|
55
|
+
padding: 15
|
|
56
|
+
//getConfig().flowchart.padding
|
|
57
|
+
};
|
|
58
|
+
if (p.centerLabel = !0, e.note) {
|
|
59
|
+
const a = {
|
|
60
|
+
labelStyle: "",
|
|
61
|
+
shape: at,
|
|
62
|
+
labelText: e.note.text,
|
|
63
|
+
classes: _t,
|
|
64
|
+
// useHtmlLabels: false,
|
|
65
|
+
style: "",
|
|
66
|
+
// styles.style,
|
|
67
|
+
id: o + ht + "-" + d,
|
|
68
|
+
domId: R(o, d, Y),
|
|
69
|
+
type: s.type,
|
|
70
|
+
padding: 15
|
|
71
|
+
//getConfig().flowchart.padding
|
|
72
|
+
}, l = {
|
|
73
|
+
labelStyle: "",
|
|
74
|
+
shape: lt,
|
|
75
|
+
labelText: e.note.text,
|
|
76
|
+
classes: s.classes,
|
|
77
|
+
style: "",
|
|
78
|
+
// styles.style,
|
|
79
|
+
id: o + M,
|
|
80
|
+
domId: R(o, d, V),
|
|
81
|
+
type: "group",
|
|
82
|
+
padding: 0
|
|
83
|
+
//getConfig().flowchart.padding
|
|
84
|
+
};
|
|
85
|
+
d++;
|
|
86
|
+
const D = o + M;
|
|
87
|
+
t.setNode(D, l), t.setNode(a.id, a), t.setNode(o, p), t.setParent(o, D), t.setParent(a.id, D);
|
|
88
|
+
let S = o, b = a.id;
|
|
89
|
+
e.note.position === "left of" && (S = a.id, b = o), t.setEdge(S, b, {
|
|
90
|
+
arrowhead: "none",
|
|
91
|
+
arrowType: "",
|
|
92
|
+
style: m,
|
|
93
|
+
labelStyle: "",
|
|
94
|
+
classes: pt,
|
|
95
|
+
arrowheadStyle: W,
|
|
96
|
+
labelpos: z,
|
|
97
|
+
labelType: q,
|
|
98
|
+
thickness: K
|
|
99
|
+
});
|
|
100
|
+
} else
|
|
101
|
+
t.setNode(o, p);
|
|
102
|
+
}
|
|
103
|
+
n && n.id !== "root" && (E.trace("Setting node ", o, " to be child of its parent ", n.id), t.setParent(o, n.id)), e.doc && (E.trace("Adding nodes children "), xt(t, e, e.doc, i, c, !r));
|
|
104
|
+
}, xt = (t, n, e, i, c, r) => {
|
|
105
|
+
E.trace("items", e), e.forEach((o) => {
|
|
106
|
+
switch (o.stmt) {
|
|
107
|
+
case F:
|
|
108
|
+
A(t, n, o, i, c, r);
|
|
109
|
+
break;
|
|
110
|
+
case H:
|
|
111
|
+
A(t, n, o, i, c, r);
|
|
112
|
+
break;
|
|
113
|
+
case Z:
|
|
114
|
+
{
|
|
115
|
+
A(t, n, o.state1, i, c, r), A(t, n, o.state2, i, c, r);
|
|
116
|
+
const u = {
|
|
117
|
+
id: "edge" + d,
|
|
118
|
+
arrowhead: "normal",
|
|
119
|
+
arrowTypeEnd: "arrow_barb",
|
|
120
|
+
style: m,
|
|
121
|
+
labelStyle: "",
|
|
122
|
+
label: w.sanitizeText(o.description, g()),
|
|
123
|
+
arrowheadStyle: W,
|
|
124
|
+
labelpos: z,
|
|
125
|
+
labelType: q,
|
|
126
|
+
thickness: K,
|
|
127
|
+
classes: U
|
|
128
|
+
};
|
|
129
|
+
t.setEdge(o.state1.id, o.state2.id, u, d), d++;
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}, G = (t, n = I) => {
|
|
135
|
+
let e = n;
|
|
136
|
+
if (t.doc)
|
|
137
|
+
for (let i = 0; i < t.doc.length; i++) {
|
|
138
|
+
const c = t.doc[i];
|
|
139
|
+
c.stmt === "dir" && (e = c.value);
|
|
140
|
+
}
|
|
141
|
+
return e;
|
|
142
|
+
}, Ct = async function(t, n, e, i) {
|
|
143
|
+
E.info("Drawing state diagram (v2)", n), y = {}, i.db.getDirection();
|
|
144
|
+
const { securityLevel: c, state: r } = g(), o = r.nodeSpacing || 50, u = r.rankSpacing || 50;
|
|
145
|
+
E.info(i.db.getRootDocV2()), i.db.extract(i.db.getRootDocV2()), E.info(i.db.getRootDocV2());
|
|
146
|
+
const T = i.db.getStates(), s = new tt({
|
|
147
|
+
multigraph: !0,
|
|
148
|
+
compound: !0
|
|
149
|
+
}).setGraph({
|
|
150
|
+
rankdir: G(i.db.getRootDocV2()),
|
|
151
|
+
nodesep: o,
|
|
152
|
+
ranksep: u,
|
|
153
|
+
marginx: 8,
|
|
154
|
+
marginy: 8
|
|
155
|
+
}).setDefaultEdgeLabel(function() {
|
|
156
|
+
return {};
|
|
157
|
+
});
|
|
158
|
+
A(s, void 0, i.db.getRootDocV2(), T, i.db, !0);
|
|
159
|
+
let p;
|
|
160
|
+
c === "sandbox" && (p = x("#i" + n));
|
|
161
|
+
const a = c === "sandbox" ? x(p.nodes()[0].contentDocument.body) : x("body"), l = a.select(`[id="${n}"]`), D = a.select("#" + n + " g");
|
|
162
|
+
await st(D, s, ["barb"], _, n);
|
|
163
|
+
const S = 8;
|
|
164
|
+
et.insertTitle(l, "statediagramTitleText", r.titleTopMargin, i.db.getDiagramTitle());
|
|
165
|
+
const b = l.node().getBBox(), L = b.width + S * 2, P = b.height + S * 2;
|
|
166
|
+
l.attr("class", _);
|
|
167
|
+
const O = l.node().getBBox();
|
|
168
|
+
ot(l, P, L, r.useMaxWidth);
|
|
169
|
+
const k = `${O.x - S} ${O.y - S} ${L} ${P}`;
|
|
170
|
+
E.debug(`viewBox ${k}`), l.attr("viewBox", k);
|
|
171
|
+
const j = document.querySelectorAll('[id="' + n + '"] .edgeLabel .label');
|
|
172
|
+
for (const $ of j) {
|
|
173
|
+
const v = $.getBBox(), f = document.createElementNS("http://www.w3.org/2000/svg", h);
|
|
174
|
+
f.setAttribute("rx", 0), f.setAttribute("ry", 0), f.setAttribute("width", v.width), f.setAttribute("height", v.height), $.insertBefore(f, $.firstChild);
|
|
175
|
+
}
|
|
176
|
+
}, Rt = {
|
|
177
|
+
setConf: yt,
|
|
178
|
+
getClasses: gt,
|
|
179
|
+
draw: Ct
|
|
180
|
+
}, Vt = {
|
|
181
|
+
parser: J,
|
|
182
|
+
db: B,
|
|
183
|
+
renderer: Rt,
|
|
184
|
+
styles: Q,
|
|
185
|
+
init: (t) => {
|
|
186
|
+
t.state || (t.state = {}), t.state.arrowMarkerAbsolute = t.arrowMarkerAbsolute, B.clear();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
export {
|
|
190
|
+
Vt as diagram
|
|
191
|
+
};
|