@zjlab-frontier/markdown 1.0.4
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 +148 -0
- package/dist/Tableau10-D7jGxypv.mjs +8 -0
- package/dist/arc-BkFOiLi7.mjs +84 -0
- package/dist/array-CqVTtuYm.mjs +6 -0
- package/dist/blockDiagram-c4efeb88-CngVNufX.mjs +1221 -0
- package/dist/c4Diagram-c83219d4-CvSWXhSV.mjs +1579 -0
- package/dist/channel-BCTzeqLo.mjs +5 -0
- package/dist/classDiagram-beda092f-8UkpWDgI.mjs +218 -0
- package/dist/classDiagram-v2-2358418a-D3LsBhTm.mjs +200 -0
- package/dist/clone-DZgGXtyK.mjs +8 -0
- package/dist/createText-1719965b-DMv-Bu7A.mjs +155 -0
- package/dist/edges-96097737-BeVwLt3S.mjs +1088 -0
- package/dist/erDiagram-0228fc6a-GXXkRZ8r.mjs +929 -0
- package/dist/flowDb-c6c81e3f-CrOg5i55.mjs +1126 -0
- package/dist/flowDiagram-50d868cf-sXe_oFAW.mjs +788 -0
- package/dist/flowDiagram-v2-4f6560a1-CoKYvZkH.mjs +17 -0
- package/dist/flowchart-elk-definition-6af322e1-SuvGsuBl.mjs +48146 -0
- package/dist/ganttDiagram-a2739b55-BbWq9bqY.mjs +2477 -0
- package/dist/gitGraphDiagram-82fe8481-C6-e4UmK.mjs +1264 -0
- package/dist/graph-CoIGCRFf.mjs +847 -0
- package/dist/index-5325376f-BENBY8aO.mjs +373 -0
- package/dist/index-5_ujiRGo.mjs +46276 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +8 -0
- package/dist/index.umd.js +2421 -0
- package/dist/infoDiagram-8eee0895-BEAb2pCD.mjs +319 -0
- package/dist/init-DjUOC4st.mjs +16 -0
- package/dist/journeyDiagram-c64418c1-CERjyYnA.mjs +801 -0
- package/dist/layout-aCAVHR2T.mjs +1472 -0
- package/dist/line-BGunMwE-.mjs +33 -0
- package/dist/linear-DciWi0hE.mjs +423 -0
- package/dist/markdown.d.ts +25 -0
- package/dist/mindmap-definition-8da855dc-Cc8_U7zD.mjs +21936 -0
- package/dist/ordinal-C0oynhte.mjs +61 -0
- package/dist/path-DLwuMfdd.mjs +84 -0
- package/dist/pieDiagram-a8764435-B00hy7Ez.mjs +500 -0
- package/dist/quadrantDiagram-1e28029f-DR7IGAoM.mjs +903 -0
- package/dist/requirementDiagram-08caed73-o6N3X3-m.mjs +767 -0
- package/dist/sankeyDiagram-a04cb91d-CYF9Ro1W.mjs +802 -0
- package/dist/sequenceDiagram-c5b8d532-vz_R7xBU.mjs +2234 -0
- package/dist/stateDiagram-1ecb1508-B0YUHnuE.mjs +266 -0
- package/dist/stateDiagram-v2-c2b004d7-CDTm1Jfb.mjs +184 -0
- package/dist/styles/highlight.scss +115 -0
- package/dist/styles/markdown.scss +1163 -0
- package/dist/styles-b4e223ce-C_-huVuQ.mjs +1089 -0
- package/dist/styles-ca3715f6-soe07Bnw.mjs +960 -0
- package/dist/styles-d45a18b0-0ZXwJp5P.mjs +436 -0
- package/dist/svgDrawCommon-b86b1483-UCLksviB.mjs +64 -0
- package/dist/timeline-definition-faaaa080-Dt5unv7p.mjs +792 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/xychartDiagram-f5964ef8-BZWS0E_9.mjs +1282 -0
- package/package.json +66 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { s as P, d as N, p as W } from "./styles-ca3715f6-soe07Bnw.mjs";
|
|
2
|
+
import { g as t, d as H, l as b, e as R, k as T, F as v, B as U } from "./index-5_ujiRGo.mjs";
|
|
3
|
+
import { G as C } from "./graph-CoIGCRFf.mjs";
|
|
4
|
+
import { l as F } from "./layout-aCAVHR2T.mjs";
|
|
5
|
+
import { l as $ } from "./line-BGunMwE-.mjs";
|
|
6
|
+
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), J = (e, i) => {
|
|
7
|
+
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();
|
|
8
|
+
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;
|
|
9
|
+
}, Y = (e, i) => {
|
|
10
|
+
const o = function(l, m, w) {
|
|
11
|
+
const E = l.append("tspan").attr("x", 2 * t().state.padding).text(m);
|
|
12
|
+
w || E.attr("dy", t().state.textHeight);
|
|
13
|
+
}, 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(
|
|
14
|
+
"y",
|
|
15
|
+
g + t().state.padding * 0.4 + t().state.dividerMargin + t().state.textHeight
|
|
16
|
+
).attr("class", "state-description");
|
|
17
|
+
let a = !0, r = !0;
|
|
18
|
+
i.descriptions.forEach(function(l) {
|
|
19
|
+
a || (o(p, l, r), r = !1), a = !1;
|
|
20
|
+
});
|
|
21
|
+
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);
|
|
22
|
+
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;
|
|
23
|
+
}, I = (e, i, o) => {
|
|
24
|
+
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;
|
|
25
|
+
let d = Math.max(x, p);
|
|
26
|
+
d === p && (d = d + s);
|
|
27
|
+
let l;
|
|
28
|
+
const m = e.node().getBBox();
|
|
29
|
+
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);
|
|
30
|
+
const w = 1 - t().state.textHeight;
|
|
31
|
+
return e.insert("rect", ":first-child").attr("x", l).attr("y", w).attr("class", o ? "alt-composit" : "composit").attr("width", d).attr(
|
|
32
|
+
"height",
|
|
33
|
+
m.height + t().state.textHeight + t().state.titleShift + 1
|
|
34
|
+
).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(
|
|
35
|
+
"y",
|
|
36
|
+
t().state.titleShift - t().state.textHeight - t().state.padding
|
|
37
|
+
).attr("width", d).attr("height", t().state.textHeight * 3).attr("rx", t().state.radius), 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", m.height + 3 + 2 * t().state.textHeight).attr("rx", t().state.radius), e;
|
|
41
|
+
}, _ = (e) => (e.append("circle").attr("class", "end-state-outer").attr("r", t().state.sizeUnit + t().state.miniPadding).attr(
|
|
42
|
+
"cx",
|
|
43
|
+
t().state.padding + t().state.sizeUnit + t().state.miniPadding
|
|
44
|
+
).attr(
|
|
45
|
+
"cy",
|
|
46
|
+
t().state.padding + t().state.sizeUnit + t().state.miniPadding
|
|
47
|
+
), 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) => {
|
|
48
|
+
let o = t().state.forkWidth, c = t().state.forkHeight;
|
|
49
|
+
if (i.parentId) {
|
|
50
|
+
let s = o;
|
|
51
|
+
o = c, c = s;
|
|
52
|
+
}
|
|
53
|
+
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);
|
|
54
|
+
}, Z = (e, i, o, c) => {
|
|
55
|
+
let s = 0;
|
|
56
|
+
const g = c.append("text");
|
|
57
|
+
g.style("text-anchor", "start"), g.attr("class", "noteText");
|
|
58
|
+
let p = e.replace(/\r\n/g, "<br/>");
|
|
59
|
+
p = p.replace(/\n/g, "<br/>");
|
|
60
|
+
const a = p.split(T.lineBreakRegex);
|
|
61
|
+
let r = 1.25 * t().state.noteMargin;
|
|
62
|
+
for (const y of a) {
|
|
63
|
+
const x = y.trim();
|
|
64
|
+
if (x.length > 0) {
|
|
65
|
+
const d = g.append("tspan");
|
|
66
|
+
if (d.text(x), r === 0) {
|
|
67
|
+
const l = d.node().getBBox();
|
|
68
|
+
r += l.height;
|
|
69
|
+
}
|
|
70
|
+
s += r, d.attr("x", i + t().state.noteMargin), d.attr("y", o + s + 1.25 * t().state.noteMargin);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { textWidth: g.node().getBBox().width, textHeight: s };
|
|
74
|
+
}, K = (e, i) => {
|
|
75
|
+
i.attr("class", "state-note");
|
|
76
|
+
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);
|
|
77
|
+
return o.attr("height", g + 2 * t().state.noteMargin), o.attr("width", s + t().state.noteMargin * 2), o;
|
|
78
|
+
}, L = function(e, i) {
|
|
79
|
+
const o = i.id, c = {
|
|
80
|
+
id: o,
|
|
81
|
+
label: i.id,
|
|
82
|
+
width: 0,
|
|
83
|
+
height: 0
|
|
84
|
+
}, s = e.append("g").attr("id", o).attr("class", "stateGroup");
|
|
85
|
+
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 && J(s, i), i.type === "default" && i.descriptions.length > 0 && Y(s, i);
|
|
86
|
+
const g = s.node().getBBox();
|
|
87
|
+
return c.width = g.width + 2 * t().state.padding, c.height = g.height + 2 * t().state.padding, c;
|
|
88
|
+
};
|
|
89
|
+
let G = 0;
|
|
90
|
+
const Q = function(e, i, o) {
|
|
91
|
+
const c = function(r) {
|
|
92
|
+
switch (r) {
|
|
93
|
+
case N.relationType.AGGREGATION:
|
|
94
|
+
return "aggregation";
|
|
95
|
+
case N.relationType.EXTENSION:
|
|
96
|
+
return "extension";
|
|
97
|
+
case N.relationType.COMPOSITION:
|
|
98
|
+
return "composition";
|
|
99
|
+
case N.relationType.DEPENDENCY:
|
|
100
|
+
return "dependency";
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
i.points = i.points.filter((r) => !Number.isNaN(r.y));
|
|
104
|
+
const s = i.points, g = $().x(function(r) {
|
|
105
|
+
return r.x;
|
|
106
|
+
}).y(function(r) {
|
|
107
|
+
return r.y;
|
|
108
|
+
}).curve(v), p = e.append("path").attr("d", g(s)).attr("id", "edge" + G).attr("class", "transition");
|
|
109
|
+
let a = "";
|
|
110
|
+
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(
|
|
111
|
+
"marker-end",
|
|
112
|
+
"url(" + a + "#" + c(N.relationType.DEPENDENCY) + "End)"
|
|
113
|
+
), o.title !== void 0) {
|
|
114
|
+
const r = e.append("g").attr("class", "stateLabel"), { x: y, y: x } = U.calcLabelPosition(i.points), d = T.getRows(o.title);
|
|
115
|
+
let l = 0;
|
|
116
|
+
const m = [];
|
|
117
|
+
let w = 0, E = 0;
|
|
118
|
+
for (let u = 0; u <= d.length; u++) {
|
|
119
|
+
const h = r.append("text").attr("text-anchor", "middle").text(d[u]).attr("x", y).attr("y", x + l), f = h.node().getBBox();
|
|
120
|
+
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);
|
|
121
|
+
}
|
|
122
|
+
let k = l * d.length;
|
|
123
|
+
if (d.length > 1) {
|
|
124
|
+
const u = (d.length - 1) * l * 0.5;
|
|
125
|
+
m.forEach((h, f) => h.attr("y", x + f * l - u)), k = l * d.length;
|
|
126
|
+
}
|
|
127
|
+
const n = r.node().getBBox();
|
|
128
|
+
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);
|
|
129
|
+
}
|
|
130
|
+
G++;
|
|
131
|
+
};
|
|
132
|
+
let B;
|
|
133
|
+
const z = {}, V = function() {
|
|
134
|
+
}, j = function(e) {
|
|
135
|
+
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");
|
|
136
|
+
}, D = function(e, i, o, c) {
|
|
137
|
+
B = t().state;
|
|
138
|
+
const s = t().securityLevel;
|
|
139
|
+
let g;
|
|
140
|
+
s === "sandbox" && (g = H("#i" + i));
|
|
141
|
+
const p = s === "sandbox" ? H(g.nodes()[0].contentDocument.body) : H("body"), a = s === "sandbox" ? g.nodes()[0].contentDocument : document;
|
|
142
|
+
b.debug("Rendering diagram " + e);
|
|
143
|
+
const r = p.select(`[id='${i}']`);
|
|
144
|
+
j(r);
|
|
145
|
+
const y = c.db.getRootDoc();
|
|
146
|
+
A(y, r, void 0, !1, p, a, c);
|
|
147
|
+
const x = B.padding, d = r.node().getBBox(), l = d.width + x * 2, m = d.height + x * 2, w = l * 1.75;
|
|
148
|
+
R(r, m, w, B.useMaxWidth), r.attr(
|
|
149
|
+
"viewBox",
|
|
150
|
+
`${d.x - B.padding} ${d.y - B.padding} ` + l + " " + m
|
|
151
|
+
);
|
|
152
|
+
}, tt = (e) => e ? e.length * B.fontSizeFactor : 1, A = (e, i, o, c, s, g, p) => {
|
|
153
|
+
const a = new C({
|
|
154
|
+
compound: !0,
|
|
155
|
+
multigraph: !0
|
|
156
|
+
});
|
|
157
|
+
let r, y = !0;
|
|
158
|
+
for (r = 0; r < e.length; r++)
|
|
159
|
+
if (e[r].stmt === "relation") {
|
|
160
|
+
y = !1;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
o ? a.setGraph({
|
|
164
|
+
rankdir: "LR",
|
|
165
|
+
multigraph: !0,
|
|
166
|
+
compound: !0,
|
|
167
|
+
// acyclicer: 'greedy',
|
|
168
|
+
ranker: "tight-tree",
|
|
169
|
+
ranksep: y ? 1 : B.edgeLengthFactor,
|
|
170
|
+
nodeSep: y ? 1 : 50,
|
|
171
|
+
isMultiGraph: !0
|
|
172
|
+
// ranksep: 5,
|
|
173
|
+
// nodesep: 1
|
|
174
|
+
}) : a.setGraph({
|
|
175
|
+
rankdir: "TB",
|
|
176
|
+
multigraph: !0,
|
|
177
|
+
compound: !0,
|
|
178
|
+
// isCompound: true,
|
|
179
|
+
// acyclicer: 'greedy',
|
|
180
|
+
// ranker: 'longest-path'
|
|
181
|
+
ranksep: y ? 1 : B.edgeLengthFactor,
|
|
182
|
+
nodeSep: y ? 1 : 50,
|
|
183
|
+
ranker: "tight-tree",
|
|
184
|
+
// ranker: 'network-simplex'
|
|
185
|
+
isMultiGraph: !0
|
|
186
|
+
}), a.setDefaultEdgeLabel(function() {
|
|
187
|
+
return {};
|
|
188
|
+
}), p.db.extract(e);
|
|
189
|
+
const x = p.db.getStates(), d = p.db.getRelations(), l = Object.keys(x);
|
|
190
|
+
for (const n of l) {
|
|
191
|
+
const u = x[n];
|
|
192
|
+
o && (u.parentId = o);
|
|
193
|
+
let h;
|
|
194
|
+
if (u.doc) {
|
|
195
|
+
let f = i.append("g").attr("id", u.id).attr("class", "stateGroup");
|
|
196
|
+
h = A(u.doc, f, u.id, !c, s, g, p);
|
|
197
|
+
{
|
|
198
|
+
f = I(f, u, c);
|
|
199
|
+
let S = f.node().getBBox();
|
|
200
|
+
h.width = S.width, h.height = S.height + B.padding / 2, z[u.id] = { y: B.compositTitleSize };
|
|
201
|
+
}
|
|
202
|
+
} else
|
|
203
|
+
h = L(i, u);
|
|
204
|
+
if (u.note) {
|
|
205
|
+
const f = {
|
|
206
|
+
descriptions: [],
|
|
207
|
+
id: u.id + "-note",
|
|
208
|
+
note: u.note,
|
|
209
|
+
type: "note"
|
|
210
|
+
}, S = L(i, f);
|
|
211
|
+
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");
|
|
212
|
+
} else
|
|
213
|
+
a.setNode(h.id, h);
|
|
214
|
+
}
|
|
215
|
+
b.debug("Count=", a.nodeCount(), a);
|
|
216
|
+
let m = 0;
|
|
217
|
+
d.forEach(function(n) {
|
|
218
|
+
m++, b.debug("Setting edge", n), a.setEdge(
|
|
219
|
+
n.id1,
|
|
220
|
+
n.id2,
|
|
221
|
+
{
|
|
222
|
+
relation: n,
|
|
223
|
+
width: tt(n.title),
|
|
224
|
+
height: B.labelHeight * T.getRows(n.title).length,
|
|
225
|
+
labelpos: "c"
|
|
226
|
+
},
|
|
227
|
+
"id" + m
|
|
228
|
+
);
|
|
229
|
+
}), F(a), b.debug("Graph after layout", a.nodes());
|
|
230
|
+
const w = i.node();
|
|
231
|
+
a.nodes().forEach(function(n) {
|
|
232
|
+
n !== void 0 && a.node(n) !== void 0 ? (b.warn("Node " + n + ": " + JSON.stringify(a.node(n))), s.select("#" + w.id + " #" + n).attr(
|
|
233
|
+
"transform",
|
|
234
|
+
"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) + " )"
|
|
235
|
+
), 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) => {
|
|
236
|
+
const f = h.parentElement;
|
|
237
|
+
let S = 0, M = 0;
|
|
238
|
+
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);
|
|
239
|
+
})) : b.debug("No Node " + n + ": " + JSON.stringify(a.node(n)));
|
|
240
|
+
});
|
|
241
|
+
let E = w.getBBox();
|
|
242
|
+
a.edges().forEach(function(n) {
|
|
243
|
+
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));
|
|
244
|
+
}), E = w.getBBox();
|
|
245
|
+
const k = {
|
|
246
|
+
id: o || "root",
|
|
247
|
+
label: o || "root",
|
|
248
|
+
width: 0,
|
|
249
|
+
height: 0
|
|
250
|
+
};
|
|
251
|
+
return k.width = E.width + 2 * B.padding, k.height = E.height + 2 * B.padding, b.debug("Doc rendered", k, a), k;
|
|
252
|
+
}, et = {
|
|
253
|
+
setConf: V,
|
|
254
|
+
draw: D
|
|
255
|
+
}, ot = {
|
|
256
|
+
parser: W,
|
|
257
|
+
db: N,
|
|
258
|
+
renderer: et,
|
|
259
|
+
styles: P,
|
|
260
|
+
init: (e) => {
|
|
261
|
+
e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute, N.clear();
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
export {
|
|
265
|
+
ot as diagram
|
|
266
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { s as Q, d as B, p as X, D as Z, a as H, b as F, S as m, c as I } from "./styles-ca3715f6-soe07Bnw.mjs";
|
|
2
|
+
import { G as tt } from "./graph-CoIGCRFf.mjs";
|
|
3
|
+
import { l as E, g, d as x, B as et, e as ot, k as w } from "./index-5_ujiRGo.mjs";
|
|
4
|
+
import { r as st } from "./index-5325376f-BENBY8aO.mjs";
|
|
5
|
+
import "./layout-aCAVHR2T.mjs";
|
|
6
|
+
const h = "rect", C = "rectWithTitle", nt = "start", ct = "end", it = "divider", rt = "roundedWithTitle", lt = "note", at = "noteGroup", p = "statediagram", dt = "state", Et = `${p}-${dt}`, U = "transition", St = "note", Tt = "note-edge", _t = `${U} ${Tt}`, pt = `${p}-${St}`, ut = "cluster", Dt = `${p}-${ut}`, bt = "cluster-alt", ft = `${p}-${bt}`, V = "parent", Y = "note", At = "state", N = "----", ht = `${N}${Y}`, M = `${N}${V}`, W = "fill:none", z = "fill: #333", q = "c", K = "text", j = "normal";
|
|
7
|
+
let y = {}, d = 0;
|
|
8
|
+
const yt = function(t) {
|
|
9
|
+
const n = Object.keys(t);
|
|
10
|
+
for (const e of n)
|
|
11
|
+
t[e];
|
|
12
|
+
}, gt = function(t, n) {
|
|
13
|
+
return n.db.extract(n.db.getRootDocV2()), n.db.getClasses();
|
|
14
|
+
};
|
|
15
|
+
function $t(t) {
|
|
16
|
+
return t == null ? "" : t.classes ? t.classes.join(" ") : "";
|
|
17
|
+
}
|
|
18
|
+
function R(t = "", n = 0, e = "", c = N) {
|
|
19
|
+
const i = e !== null && e.length > 0 ? `${c}${e}` : "";
|
|
20
|
+
return `${At}-${t}${i}-${n}`;
|
|
21
|
+
}
|
|
22
|
+
const A = (t, n, e, c, i, r) => {
|
|
23
|
+
const o = e.id, u = $t(c[o]);
|
|
24
|
+
if (o !== "root") {
|
|
25
|
+
let T = h;
|
|
26
|
+
e.start === !0 && (T = nt), e.start === !1 && (T = ct), e.type !== H && (T = e.type), y[o] || (y[o] = {
|
|
27
|
+
id: o,
|
|
28
|
+
shape: T,
|
|
29
|
+
description: w.sanitizeText(o, g()),
|
|
30
|
+
classes: `${u} ${Et}`
|
|
31
|
+
});
|
|
32
|
+
const s = y[o];
|
|
33
|
+
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 === F ? it : rt, s.classes = s.classes + " " + Dt + " " + (r ? ft : ""));
|
|
34
|
+
const _ = {
|
|
35
|
+
labelStyle: "",
|
|
36
|
+
shape: s.shape,
|
|
37
|
+
labelText: s.description,
|
|
38
|
+
// typeof newNode.description === 'object'
|
|
39
|
+
// ? newNode.description[0]
|
|
40
|
+
// : newNode.description,
|
|
41
|
+
classes: s.classes,
|
|
42
|
+
style: "",
|
|
43
|
+
//styles.style,
|
|
44
|
+
id: o,
|
|
45
|
+
dir: s.dir,
|
|
46
|
+
domId: R(o, d),
|
|
47
|
+
type: s.type,
|
|
48
|
+
padding: 15
|
|
49
|
+
//getConfig().flowchart.padding
|
|
50
|
+
};
|
|
51
|
+
if (_.centerLabel = !0, e.note) {
|
|
52
|
+
const l = {
|
|
53
|
+
labelStyle: "",
|
|
54
|
+
shape: lt,
|
|
55
|
+
labelText: e.note.text,
|
|
56
|
+
classes: pt,
|
|
57
|
+
// useHtmlLabels: false,
|
|
58
|
+
style: "",
|
|
59
|
+
// styles.style,
|
|
60
|
+
id: o + ht + "-" + d,
|
|
61
|
+
domId: R(o, d, Y),
|
|
62
|
+
type: s.type,
|
|
63
|
+
padding: 15
|
|
64
|
+
//getConfig().flowchart.padding
|
|
65
|
+
}, a = {
|
|
66
|
+
labelStyle: "",
|
|
67
|
+
shape: at,
|
|
68
|
+
labelText: e.note.text,
|
|
69
|
+
classes: s.classes,
|
|
70
|
+
style: "",
|
|
71
|
+
// styles.style,
|
|
72
|
+
id: o + M,
|
|
73
|
+
domId: R(o, d, V),
|
|
74
|
+
type: "group",
|
|
75
|
+
padding: 0
|
|
76
|
+
//getConfig().flowchart.padding
|
|
77
|
+
};
|
|
78
|
+
d++;
|
|
79
|
+
const D = o + M;
|
|
80
|
+
t.setNode(D, a), t.setNode(l.id, l), t.setNode(o, _), t.setParent(o, D), t.setParent(l.id, D);
|
|
81
|
+
let S = o, b = l.id;
|
|
82
|
+
e.note.position === "left of" && (S = l.id, b = o), t.setEdge(S, b, {
|
|
83
|
+
arrowhead: "none",
|
|
84
|
+
arrowType: "",
|
|
85
|
+
style: W,
|
|
86
|
+
labelStyle: "",
|
|
87
|
+
classes: _t,
|
|
88
|
+
arrowheadStyle: z,
|
|
89
|
+
labelpos: q,
|
|
90
|
+
labelType: K,
|
|
91
|
+
thickness: j
|
|
92
|
+
});
|
|
93
|
+
} else
|
|
94
|
+
t.setNode(o, _);
|
|
95
|
+
}
|
|
96
|
+
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, c, i, !r));
|
|
97
|
+
}, xt = (t, n, e, c, i, r) => {
|
|
98
|
+
E.trace("items", e), e.forEach((o) => {
|
|
99
|
+
switch (o.stmt) {
|
|
100
|
+
case I:
|
|
101
|
+
A(t, n, o, c, i, r);
|
|
102
|
+
break;
|
|
103
|
+
case H:
|
|
104
|
+
A(t, n, o, c, i, r);
|
|
105
|
+
break;
|
|
106
|
+
case m:
|
|
107
|
+
{
|
|
108
|
+
A(t, n, o.state1, c, i, r), A(t, n, o.state2, c, i, r);
|
|
109
|
+
const u = {
|
|
110
|
+
id: "edge" + d,
|
|
111
|
+
arrowhead: "normal",
|
|
112
|
+
arrowTypeEnd: "arrow_barb",
|
|
113
|
+
style: W,
|
|
114
|
+
labelStyle: "",
|
|
115
|
+
label: w.sanitizeText(o.description, g()),
|
|
116
|
+
arrowheadStyle: z,
|
|
117
|
+
labelpos: q,
|
|
118
|
+
labelType: K,
|
|
119
|
+
thickness: j,
|
|
120
|
+
classes: U
|
|
121
|
+
};
|
|
122
|
+
t.setEdge(o.state1.id, o.state2.id, u, d), d++;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}, G = (t, n = Z) => {
|
|
128
|
+
let e = n;
|
|
129
|
+
if (t.doc)
|
|
130
|
+
for (let c = 0; c < t.doc.length; c++) {
|
|
131
|
+
const i = t.doc[c];
|
|
132
|
+
i.stmt === "dir" && (e = i.value);
|
|
133
|
+
}
|
|
134
|
+
return e;
|
|
135
|
+
}, Ct = async function(t, n, e, c) {
|
|
136
|
+
E.info("Drawing state diagram (v2)", n), y = {}, c.db.getDirection();
|
|
137
|
+
const { securityLevel: i, state: r } = g(), o = r.nodeSpacing || 50, u = r.rankSpacing || 50;
|
|
138
|
+
E.info(c.db.getRootDocV2()), c.db.extract(c.db.getRootDocV2()), E.info(c.db.getRootDocV2());
|
|
139
|
+
const T = c.db.getStates(), s = new tt({
|
|
140
|
+
multigraph: !0,
|
|
141
|
+
compound: !0
|
|
142
|
+
}).setGraph({
|
|
143
|
+
rankdir: G(c.db.getRootDocV2()),
|
|
144
|
+
nodesep: o,
|
|
145
|
+
ranksep: u,
|
|
146
|
+
marginx: 8,
|
|
147
|
+
marginy: 8
|
|
148
|
+
}).setDefaultEdgeLabel(function() {
|
|
149
|
+
return {};
|
|
150
|
+
});
|
|
151
|
+
A(s, void 0, c.db.getRootDocV2(), T, c.db, !0);
|
|
152
|
+
let _;
|
|
153
|
+
i === "sandbox" && (_ = x("#i" + n));
|
|
154
|
+
const l = i === "sandbox" ? x(_.nodes()[0].contentDocument.body) : x("body"), a = l.select(`[id="${n}"]`), D = l.select("#" + n + " g");
|
|
155
|
+
await st(D, s, ["barb"], p, n);
|
|
156
|
+
const S = 8;
|
|
157
|
+
et.insertTitle(a, "statediagramTitleText", r.titleTopMargin, c.db.getDiagramTitle());
|
|
158
|
+
const b = a.node().getBBox(), L = b.width + S * 2, P = b.height + S * 2;
|
|
159
|
+
a.attr("class", p);
|
|
160
|
+
const O = a.node().getBBox();
|
|
161
|
+
ot(a, P, L, r.useMaxWidth);
|
|
162
|
+
const k = `${O.x - S} ${O.y - S} ${L} ${P}`;
|
|
163
|
+
E.debug(`viewBox ${k}`), a.attr("viewBox", k);
|
|
164
|
+
const J = document.querySelectorAll('[id="' + n + '"] .edgeLabel .label');
|
|
165
|
+
for (const $ of J) {
|
|
166
|
+
const v = $.getBBox(), f = document.createElementNS("http://www.w3.org/2000/svg", h);
|
|
167
|
+
f.setAttribute("rx", 0), f.setAttribute("ry", 0), f.setAttribute("width", v.width), f.setAttribute("height", v.height), $.insertBefore(f, $.firstChild);
|
|
168
|
+
}
|
|
169
|
+
}, Rt = {
|
|
170
|
+
setConf: yt,
|
|
171
|
+
getClasses: gt,
|
|
172
|
+
draw: Ct
|
|
173
|
+
}, Ot = {
|
|
174
|
+
parser: X,
|
|
175
|
+
db: B,
|
|
176
|
+
renderer: Rt,
|
|
177
|
+
styles: Q,
|
|
178
|
+
init: (t) => {
|
|
179
|
+
t.state || (t.state = {}), t.state.arrowMarkerAbsolute = t.arrowMarkerAbsolute, B.clear();
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
export {
|
|
183
|
+
Ot as diagram
|
|
184
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
.markdown-body {
|
|
2
|
+
pre {
|
|
3
|
+
padding: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
pre,
|
|
7
|
+
code {
|
|
8
|
+
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
pre code {
|
|
12
|
+
display: block;
|
|
13
|
+
overflow-x: auto;
|
|
14
|
+
padding: 1em;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
code {
|
|
18
|
+
padding: 3px 5px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.hljs,
|
|
22
|
+
pre {
|
|
23
|
+
background: #1a1b26;
|
|
24
|
+
color: #cbd2ea;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/*!
|
|
28
|
+
Theme: Tokyo-night-Dark
|
|
29
|
+
origin: https://github.com/enkia/tokyo-night-vscode-theme
|
|
30
|
+
Description: Original highlight.js style
|
|
31
|
+
Author: (c) Henri Vandersleyen <hvandersleyen@gmail.com>
|
|
32
|
+
License: see project LICENSE
|
|
33
|
+
Touched: 2022
|
|
34
|
+
*/
|
|
35
|
+
.hljs-comment,
|
|
36
|
+
.hljs-meta {
|
|
37
|
+
color: #565f89;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.hljs-deletion,
|
|
41
|
+
.hljs-doctag,
|
|
42
|
+
.hljs-regexp,
|
|
43
|
+
.hljs-selector-attr,
|
|
44
|
+
.hljs-selector-class,
|
|
45
|
+
.hljs-selector-id,
|
|
46
|
+
.hljs-selector-pseudo,
|
|
47
|
+
.hljs-tag,
|
|
48
|
+
.hljs-template-tag,
|
|
49
|
+
.hljs-variable.language_ {
|
|
50
|
+
color: #f7768e;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.hljs-link,
|
|
54
|
+
.hljs-literal,
|
|
55
|
+
.hljs-number,
|
|
56
|
+
.hljs-params,
|
|
57
|
+
.hljs-template-variable,
|
|
58
|
+
.hljs-type,
|
|
59
|
+
.hljs-variable {
|
|
60
|
+
color: #ff9e64;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.hljs-attribute,
|
|
64
|
+
.hljs-built_in {
|
|
65
|
+
color: #e0af68;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.hljs-keyword,
|
|
69
|
+
.hljs-property,
|
|
70
|
+
.hljs-subst,
|
|
71
|
+
.hljs-title,
|
|
72
|
+
.hljs-title.class_,
|
|
73
|
+
.hljs-title.class_.inherited__,
|
|
74
|
+
.hljs-title.function_ {
|
|
75
|
+
color: #7dcfff;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.hljs-selector-tag {
|
|
79
|
+
color: #73daca;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.hljs-addition,
|
|
83
|
+
.hljs-bullet,
|
|
84
|
+
.hljs-quote,
|
|
85
|
+
.hljs-string,
|
|
86
|
+
.hljs-symbol {
|
|
87
|
+
color: #9ece6a;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.hljs-code,
|
|
91
|
+
.hljs-formula,
|
|
92
|
+
.hljs-section {
|
|
93
|
+
color: #7aa2f7;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.hljs-attr,
|
|
97
|
+
.hljs-char.escape_,
|
|
98
|
+
.hljs-keyword,
|
|
99
|
+
.hljs-name,
|
|
100
|
+
.hljs-operator {
|
|
101
|
+
color: #bb9af7;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.hljs-punctuation {
|
|
105
|
+
color: #c0caf5;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.hljs-emphasis {
|
|
109
|
+
font-style: italic;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.hljs-strong {
|
|
113
|
+
font-weight: 700;
|
|
114
|
+
}
|
|
115
|
+
}
|