@versini/sassysaint 8.107.4 → 8.108.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/dist/chunks/{AboutChangelog.DeRcKN5H.js → AboutChangelog.BQtbpOat.js} +2 -2
- package/dist/chunks/{AboutEntry.6mTHwkfb.js → AboutEntry.Bb0L9eCQ.js} +7 -7
- package/dist/chunks/{App.DTjbiLAP.js → App.CSBqbQnm.js} +1147 -1146
- package/dist/chunks/{Bubble.ltolxxta.js → Bubble.Jl_vP6Bg.js} +1 -1
- package/dist/chunks/{DeleteButtonIcon.P0LgJDjE.js → ButtonIconDelete.C3bf-YVf.js} +3 -3
- package/dist/chunks/{Chart.BzOmOhOW.js → Chart.KnjXKeEm.js} +2 -2
- package/dist/chunks/{ChatBubbleAssistant.lGE_8ao1.js → ChatBubbleAssistant.8hHak3Xb.js} +4 -4
- package/dist/chunks/{ChatBubbleUser.DC661ePq.js → ChatBubbleUser.C3QnvRpy.js} +3 -3
- package/dist/chunks/{ChatHistoryTable.BkRFWpsA.js → ChatHistoryTable.CIIrZME7.js} +4 -4
- package/dist/chunks/{HistoryEntry.uUjsDuT0.js → HistoryEntry.B0U0RQ7-.js} +6 -6
- package/dist/chunks/{LoginEntry.BGZdTDwf.js → LoginEntry.Cf03Pbyq.js} +4 -4
- package/dist/chunks/{LogoEntry.Bpddd0yA.js → LogoEntry.C_oLwnbv.js} +3 -3
- package/dist/chunks/{MemoriesEntry.BYQm9cuU.js → MemoriesEntry.CeMfI8F3.js} +5 -5
- package/dist/chunks/{ProfileEntry.BqcZXSeT.js → ProfileEntry.BasVTLyr.js} +4 -4
- package/dist/chunks/{SettingsEntry.BdC5Vyof.js → SettingsEntry.DqKtJfKG.js} +5 -5
- package/dist/chunks/{UsageEntry._O8Q6TwS.js → UsageEntry.phb8YqH1.js} +5 -5
- package/dist/chunks/_basePickBy.DiyBcH_b.js +151 -0
- package/dist/chunks/_baseUniq.B9L9wOT1.js +614 -0
- package/dist/chunks/arc.C1rfS5dQ.js +83 -0
- package/dist/chunks/architecture-U656AL7Q.Bw4J2QgD.js +36 -0
- package/dist/chunks/architectureDiagram-VXUJARFQ.DuwD3xDO.js +4653 -0
- package/dist/chunks/blockDiagram-VD42YOAC.BeIrwe07.js +2254 -0
- package/dist/chunks/browser.BQGdandl.js +260 -0
- package/dist/chunks/c4Diagram-YG6GDRKO.YzJEqJgk.js +1579 -0
- package/dist/chunks/channel.BPPTH6mh.js +5 -0
- package/dist/chunks/chunk-4BX2VUAB.BCIoHYCy.js +8 -0
- package/dist/chunks/chunk-55IACEB6.CFEkh5zE.js +8 -0
- package/dist/chunks/chunk-B4BG7PRW.CwfV87jH.js +1375 -0
- package/dist/chunks/chunk-DI55MBZ5.CcFvwYqB.js +1370 -0
- package/dist/chunks/chunk-FMBD7UC4.C9__m3G-.js +19 -0
- package/dist/chunks/chunk-QN33PNHL.EonhZUcV.js +19 -0
- package/dist/chunks/chunk-QZHKN3VN.CKR_DhAb.js +15 -0
- package/dist/chunks/chunk-TZMSLE5B.eMD178H9.js +64 -0
- package/dist/chunks/classDiagram-2ON5EDUG.DCsDc7LM.js +16 -0
- package/dist/chunks/classDiagram-v2-WZHVMYZB.DCsDc7LM.js +16 -0
- package/dist/chunks/clone.DG_v08Gm.js +8 -0
- package/dist/chunks/cose-bilkent-S5V4N54A.Bw5tPVeS.js +2600 -0
- package/dist/chunks/cytoscape.esm.DmRZGnqW.js +18700 -0
- package/dist/chunks/dagre-6UL2VRFP.CTW14kZK.js +444 -0
- package/dist/chunks/defaultLocale.CPJLP5jg.js +171 -0
- package/dist/chunks/diagram-PSM6KHXK.DDyW__Et.js +531 -0
- package/dist/chunks/diagram-QEK2KX5R.C8Y6Nyjq.js +217 -0
- package/dist/chunks/diagram-S2PKOQOG.DnnZ1m7x.js +142 -0
- package/dist/chunks/erDiagram-Q2GNP2WA.BavKd766.js +841 -0
- package/dist/chunks/flowDiagram-NV44I4VS.roMN4lsc.js +1620 -0
- package/dist/chunks/ganttDiagram-JELNMOA3.B_SkSqyi.js +2647 -0
- package/dist/chunks/gitGraph-F6HP7TQM.C7PwqG55.js +27 -0
- package/dist/chunks/gitGraphDiagram-NY62KEGX.BHfSeSWk.js +699 -0
- package/dist/chunks/graph.CsxOkYbN.js +247 -0
- package/dist/chunks/{index.D2nN0rC6.js → index.BHKlxxP5.js} +1 -1
- package/dist/chunks/{index.CYcieK1H.js → index.BUYdarBy.js} +1 -1
- package/dist/chunks/{index.BxbWxVtd.js → index.BetC5DSu.js} +1 -1
- package/dist/chunks/{index.DuxTgnco.js → index.BmLHPbgB.js} +1 -1
- package/dist/chunks/{index.C70LcKzU.js → index.Bq1fyGUB.js} +1 -1
- package/dist/chunks/{index.CaofbEIP.js → index.DQPv0lQj.js} +2 -3
- package/dist/chunks/{index.BlviGqw0.js → index.DbyaywZN.js} +3 -3
- package/dist/chunks/{index.DG-VhqKw.js → index.DjuVXA0R.js} +1 -1
- package/dist/chunks/index.DzRoQenq.js +67 -0
- package/dist/chunks/info-NVLQJR56.DZPZ5T1V.js +27 -0
- package/dist/chunks/infoDiagram-WHAUD3N6.Bi7I8DQ6.js +24 -0
- package/dist/chunks/init.DAGnb5BH.js +16 -0
- package/dist/chunks/journeyDiagram-XKPGCS4Q.D8VPEfAI.js +834 -0
- package/dist/chunks/kanban-definition-3W4ZIXB7.BWUqPfZ4.js +719 -0
- package/dist/chunks/{index.s8Izh8-Q.js → katex.D0sQThIv.js} +1638 -1943
- package/dist/chunks/layout.BVs5Fo34.js +1332 -0
- package/dist/chunks/linear.CIDfImUo.js +625 -0
- package/dist/chunks/mermaid-parser.core.ORd6OSMH.js +12724 -0
- package/dist/chunks/mindmap-definition-VGOIOE7T.B8li-u54.js +784 -0
- package/dist/chunks/ordinal.EWT-qnu7.js +61 -0
- package/dist/chunks/packet-BFZMPI3H.ucR6ljZQ.js +27 -0
- package/dist/chunks/pie-7BOR55EZ.CUpVQfSo.js +32 -0
- package/dist/chunks/pieDiagram-ADFJNKIX.GfyALym8.js +161 -0
- package/dist/chunks/quadrantDiagram-AYHSOK5B.CsUp44jt.js +1022 -0
- package/dist/chunks/radar-NHE76QYJ.Es4sfwW2.js +27 -0
- package/dist/chunks/rehype-mermaid.QzUnaHa9.js +14283 -0
- package/dist/chunks/requirementDiagram-UZGBJVZJ.DQTWxv7j.js +850 -0
- package/dist/chunks/sankeyDiagram-TZEHDZUN.DJdcOMBP.js +810 -0
- package/dist/chunks/sequenceDiagram-WL72ISMW.CIFR_pCj.js +2511 -0
- package/dist/chunks/stateDiagram-FKZM4ZOC.DgM5pVKO.js +263 -0
- package/dist/chunks/stateDiagram-v2-4FDKWEC3.BUygW1pY.js +16 -0
- package/dist/chunks/timeline-definition-IT6M3QCI.Ca0YkAdx.js +795 -0
- package/dist/chunks/treemap-KMMF4GRG.Xsds0Pr-.js +81 -0
- package/dist/chunks/{useMarkdown.DjEZz9lH.js → useMarkdown.DgNUxPe8.js} +1951 -1936
- package/dist/chunks/xychartDiagram-PRI3JC2R.DyQEBwDk.js +1340 -0
- package/dist/components/SassySaint/SassySaint.js +1 -1
- package/dist/index.js +3 -3
- package/package.json +5 -5
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { __name as l, setAccDescription as k, getAccDescription as R, getDiagramTitle as I, setDiagramTitle as E, getAccTitle as F, setAccTitle as _, selectSvgElement as D, clear as G, cleanAndMerge as y, getConfig as C, defaultConfig_default as P, log as z, getThemeVariables3 as V } from "./rehype-mermaid.QzUnaHa9.js";
|
|
2
|
+
import { populateCommonDb as W } from "./chunk-4BX2VUAB.BCIoHYCy.js";
|
|
3
|
+
import { parse as B } from "./mermaid-parser.core.ORd6OSMH.js";
|
|
4
|
+
var x = {
|
|
5
|
+
showLegend: !0,
|
|
6
|
+
ticks: 5,
|
|
7
|
+
max: null,
|
|
8
|
+
min: 0,
|
|
9
|
+
graticule: "circle"
|
|
10
|
+
}, w = {
|
|
11
|
+
axes: [],
|
|
12
|
+
curves: [],
|
|
13
|
+
options: x
|
|
14
|
+
}, h = structuredClone(w), H = P.radar, j = /* @__PURE__ */ l(() => y({
|
|
15
|
+
...H,
|
|
16
|
+
...C().radar
|
|
17
|
+
}), "getConfig"), b = /* @__PURE__ */ l(() => h.axes, "getAxes"), N = /* @__PURE__ */ l(() => h.curves, "getCurves"), U = /* @__PURE__ */ l(() => h.options, "getOptions"), X = /* @__PURE__ */ l((a) => {
|
|
18
|
+
h.axes = a.map((t) => ({
|
|
19
|
+
name: t.name,
|
|
20
|
+
label: t.label ?? t.name
|
|
21
|
+
}));
|
|
22
|
+
}, "setAxes"), Y = /* @__PURE__ */ l((a) => {
|
|
23
|
+
h.curves = a.map((t) => ({
|
|
24
|
+
name: t.name,
|
|
25
|
+
label: t.label ?? t.name,
|
|
26
|
+
entries: Z(t.entries)
|
|
27
|
+
}));
|
|
28
|
+
}, "setCurves"), Z = /* @__PURE__ */ l((a) => {
|
|
29
|
+
if (a[0].axis == null)
|
|
30
|
+
return a.map((e) => e.value);
|
|
31
|
+
const t = b();
|
|
32
|
+
if (t.length === 0)
|
|
33
|
+
throw new Error("Axes must be populated before curves for reference entries");
|
|
34
|
+
return t.map((e) => {
|
|
35
|
+
const r = a.find((n) => n.axis?.$refText === e.name);
|
|
36
|
+
if (r === void 0)
|
|
37
|
+
throw new Error("Missing entry for axis " + e.label);
|
|
38
|
+
return r.value;
|
|
39
|
+
});
|
|
40
|
+
}, "computeCurveEntries"), q = /* @__PURE__ */ l((a) => {
|
|
41
|
+
const t = a.reduce(
|
|
42
|
+
(e, r) => (e[r.name] = r, e),
|
|
43
|
+
{}
|
|
44
|
+
);
|
|
45
|
+
h.options = {
|
|
46
|
+
showLegend: t.showLegend?.value ?? x.showLegend,
|
|
47
|
+
ticks: t.ticks?.value ?? x.ticks,
|
|
48
|
+
max: t.max?.value ?? x.max,
|
|
49
|
+
min: t.min?.value ?? x.min,
|
|
50
|
+
graticule: t.graticule?.value ?? x.graticule
|
|
51
|
+
};
|
|
52
|
+
}, "setOptions"), J = /* @__PURE__ */ l(() => {
|
|
53
|
+
G(), h = structuredClone(w);
|
|
54
|
+
}, "clear"), $ = {
|
|
55
|
+
getAxes: b,
|
|
56
|
+
getCurves: N,
|
|
57
|
+
getOptions: U,
|
|
58
|
+
setAxes: X,
|
|
59
|
+
setCurves: Y,
|
|
60
|
+
setOptions: q,
|
|
61
|
+
getConfig: j,
|
|
62
|
+
clear: J,
|
|
63
|
+
setAccTitle: _,
|
|
64
|
+
getAccTitle: F,
|
|
65
|
+
setDiagramTitle: E,
|
|
66
|
+
getDiagramTitle: I,
|
|
67
|
+
getAccDescription: R,
|
|
68
|
+
setAccDescription: k
|
|
69
|
+
}, K = /* @__PURE__ */ l((a) => {
|
|
70
|
+
W(a, $);
|
|
71
|
+
const { axes: t, curves: e, options: r } = a;
|
|
72
|
+
$.setAxes(t), $.setCurves(e), $.setOptions(r);
|
|
73
|
+
}, "populate"), Q = {
|
|
74
|
+
parse: /* @__PURE__ */ l(async (a) => {
|
|
75
|
+
const t = await B("radar", a);
|
|
76
|
+
z.debug(t), K(t);
|
|
77
|
+
}, "parse")
|
|
78
|
+
}, tt = /* @__PURE__ */ l((a, t, e, r) => {
|
|
79
|
+
const n = r.db, o = n.getAxes(), i = n.getCurves(), s = n.getOptions(), c = n.getConfig(), d = n.getDiagramTitle(), p = D(t), u = et(p, c), g = s.max ?? Math.max(...i.map((f) => Math.max(...f.entries))), m = s.min, v = Math.min(c.width, c.height) / 2;
|
|
80
|
+
at(u, o, v, s.ticks, s.graticule), rt(u, o, v, c), M(u, o, i, m, g, s.graticule, c), T(u, i, s.showLegend, c), u.append("text").attr("class", "radarTitle").text(d).attr("x", 0).attr("y", -c.height / 2 - c.marginTop);
|
|
81
|
+
}, "draw"), et = /* @__PURE__ */ l((a, t) => {
|
|
82
|
+
const e = t.width + t.marginLeft + t.marginRight, r = t.height + t.marginTop + t.marginBottom, n = {
|
|
83
|
+
x: t.marginLeft + t.width / 2,
|
|
84
|
+
y: t.marginTop + t.height / 2
|
|
85
|
+
};
|
|
86
|
+
return a.attr("viewbox", `0 0 ${e} ${r}`).attr("width", e).attr("height", r), a.append("g").attr("transform", `translate(${n.x}, ${n.y})`);
|
|
87
|
+
}, "drawFrame"), at = /* @__PURE__ */ l((a, t, e, r, n) => {
|
|
88
|
+
if (n === "circle")
|
|
89
|
+
for (let o = 0; o < r; o++) {
|
|
90
|
+
const i = e * (o + 1) / r;
|
|
91
|
+
a.append("circle").attr("r", i).attr("class", "radarGraticule");
|
|
92
|
+
}
|
|
93
|
+
else if (n === "polygon") {
|
|
94
|
+
const o = t.length;
|
|
95
|
+
for (let i = 0; i < r; i++) {
|
|
96
|
+
const s = e * (i + 1) / r, c = t.map((d, p) => {
|
|
97
|
+
const u = 2 * p * Math.PI / o - Math.PI / 2, g = s * Math.cos(u), m = s * Math.sin(u);
|
|
98
|
+
return `${g},${m}`;
|
|
99
|
+
}).join(" ");
|
|
100
|
+
a.append("polygon").attr("points", c).attr("class", "radarGraticule");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, "drawGraticule"), rt = /* @__PURE__ */ l((a, t, e, r) => {
|
|
104
|
+
const n = t.length;
|
|
105
|
+
for (let o = 0; o < n; o++) {
|
|
106
|
+
const i = t[o].label, s = 2 * o * Math.PI / n - Math.PI / 2;
|
|
107
|
+
a.append("line").attr("x1", 0).attr("y1", 0).attr("x2", e * r.axisScaleFactor * Math.cos(s)).attr("y2", e * r.axisScaleFactor * Math.sin(s)).attr("class", "radarAxisLine"), a.append("text").text(i).attr("x", e * r.axisLabelFactor * Math.cos(s)).attr("y", e * r.axisLabelFactor * Math.sin(s)).attr("class", "radarAxisLabel");
|
|
108
|
+
}
|
|
109
|
+
}, "drawAxes");
|
|
110
|
+
function M(a, t, e, r, n, o, i) {
|
|
111
|
+
const s = t.length, c = Math.min(i.width, i.height) / 2;
|
|
112
|
+
e.forEach((d, p) => {
|
|
113
|
+
if (d.entries.length !== s)
|
|
114
|
+
return;
|
|
115
|
+
const u = d.entries.map((g, m) => {
|
|
116
|
+
const v = 2 * Math.PI * m / s - Math.PI / 2, f = A(g, r, n, c), O = f * Math.cos(v), S = f * Math.sin(v);
|
|
117
|
+
return { x: O, y: S };
|
|
118
|
+
});
|
|
119
|
+
o === "circle" ? a.append("path").attr("d", L(u, i.curveTension)).attr("class", `radarCurve-${p}`) : o === "polygon" && a.append("polygon").attr("points", u.map((g) => `${g.x},${g.y}`).join(" ")).attr("class", `radarCurve-${p}`);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
l(M, "drawCurves");
|
|
123
|
+
function A(a, t, e, r) {
|
|
124
|
+
const n = Math.min(Math.max(a, t), e);
|
|
125
|
+
return r * (n - t) / (e - t);
|
|
126
|
+
}
|
|
127
|
+
l(A, "relativeRadius");
|
|
128
|
+
function L(a, t) {
|
|
129
|
+
const e = a.length;
|
|
130
|
+
let r = `M${a[0].x},${a[0].y}`;
|
|
131
|
+
for (let n = 0; n < e; n++) {
|
|
132
|
+
const o = a[(n - 1 + e) % e], i = a[n], s = a[(n + 1) % e], c = a[(n + 2) % e], d = {
|
|
133
|
+
x: i.x + (s.x - o.x) * t,
|
|
134
|
+
y: i.y + (s.y - o.y) * t
|
|
135
|
+
}, p = {
|
|
136
|
+
x: s.x - (c.x - i.x) * t,
|
|
137
|
+
y: s.y - (c.y - i.y) * t
|
|
138
|
+
};
|
|
139
|
+
r += ` C${d.x},${d.y} ${p.x},${p.y} ${s.x},${s.y}`;
|
|
140
|
+
}
|
|
141
|
+
return `${r} Z`;
|
|
142
|
+
}
|
|
143
|
+
l(L, "closedRoundCurve");
|
|
144
|
+
function T(a, t, e, r) {
|
|
145
|
+
if (!e)
|
|
146
|
+
return;
|
|
147
|
+
const n = (r.width / 2 + r.marginRight) * 3 / 4, o = -(r.height / 2 + r.marginTop) * 3 / 4, i = 20;
|
|
148
|
+
t.forEach((s, c) => {
|
|
149
|
+
const d = a.append("g").attr("transform", `translate(${n}, ${o + c * i})`);
|
|
150
|
+
d.append("rect").attr("width", 12).attr("height", 12).attr("class", `radarLegendBox-${c}`), d.append("text").attr("x", 16).attr("y", 0).attr("class", "radarLegendText").text(s.label);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
l(T, "drawLegend");
|
|
154
|
+
var nt = { draw: tt }, st = /* @__PURE__ */ l((a, t) => {
|
|
155
|
+
let e = "";
|
|
156
|
+
for (let r = 0; r < a.THEME_COLOR_LIMIT; r++) {
|
|
157
|
+
const n = a[`cScale${r}`];
|
|
158
|
+
e += `
|
|
159
|
+
.radarCurve-${r} {
|
|
160
|
+
color: ${n};
|
|
161
|
+
fill: ${n};
|
|
162
|
+
fill-opacity: ${t.curveOpacity};
|
|
163
|
+
stroke: ${n};
|
|
164
|
+
stroke-width: ${t.curveStrokeWidth};
|
|
165
|
+
}
|
|
166
|
+
.radarLegendBox-${r} {
|
|
167
|
+
fill: ${n};
|
|
168
|
+
fill-opacity: ${t.curveOpacity};
|
|
169
|
+
stroke: ${n};
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
}
|
|
173
|
+
return e;
|
|
174
|
+
}, "genIndexStyles"), ot = /* @__PURE__ */ l((a) => {
|
|
175
|
+
const t = V(), e = C(), r = y(t, e.themeVariables), n = y(r.radar, a);
|
|
176
|
+
return { themeVariables: r, radarOptions: n };
|
|
177
|
+
}, "buildRadarStyleOptions"), it = /* @__PURE__ */ l(({ radar: a } = {}) => {
|
|
178
|
+
const { themeVariables: t, radarOptions: e } = ot(a);
|
|
179
|
+
return `
|
|
180
|
+
.radarTitle {
|
|
181
|
+
font-size: ${t.fontSize};
|
|
182
|
+
color: ${t.titleColor};
|
|
183
|
+
dominant-baseline: hanging;
|
|
184
|
+
text-anchor: middle;
|
|
185
|
+
}
|
|
186
|
+
.radarAxisLine {
|
|
187
|
+
stroke: ${e.axisColor};
|
|
188
|
+
stroke-width: ${e.axisStrokeWidth};
|
|
189
|
+
}
|
|
190
|
+
.radarAxisLabel {
|
|
191
|
+
dominant-baseline: middle;
|
|
192
|
+
text-anchor: middle;
|
|
193
|
+
font-size: ${e.axisLabelFontSize}px;
|
|
194
|
+
color: ${e.axisColor};
|
|
195
|
+
}
|
|
196
|
+
.radarGraticule {
|
|
197
|
+
fill: ${e.graticuleColor};
|
|
198
|
+
fill-opacity: ${e.graticuleOpacity};
|
|
199
|
+
stroke: ${e.graticuleColor};
|
|
200
|
+
stroke-width: ${e.graticuleStrokeWidth};
|
|
201
|
+
}
|
|
202
|
+
.radarLegendText {
|
|
203
|
+
text-anchor: start;
|
|
204
|
+
font-size: ${e.legendFontSize}px;
|
|
205
|
+
dominant-baseline: hanging;
|
|
206
|
+
}
|
|
207
|
+
${st(t, e)}
|
|
208
|
+
`;
|
|
209
|
+
}, "styles"), ut = {
|
|
210
|
+
parser: Q,
|
|
211
|
+
db: $,
|
|
212
|
+
renderer: nt,
|
|
213
|
+
styles: it
|
|
214
|
+
};
|
|
215
|
+
export {
|
|
216
|
+
ut as diagram
|
|
217
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { __name as b, cleanAndMerge as m, selectSvgElement as B, configureSvgSize as C, log as w, setAccTitle as S, getAccTitle as D, setDiagramTitle as T, getDiagramTitle as P, getAccDescription as z, setAccDescription as E, getConfig as F, defaultConfig_default as A, clear as W } from "./rehype-mermaid.QzUnaHa9.js";
|
|
2
|
+
import { populateCommonDb as _ } from "./chunk-4BX2VUAB.BCIoHYCy.js";
|
|
3
|
+
import { parse as N } from "./mermaid-parser.core.ORd6OSMH.js";
|
|
4
|
+
var L = A.packet, u, v = (u = class {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.packet = [], this.setAccTitle = S, this.getAccTitle = D, this.setDiagramTitle = T, this.getDiagramTitle = P, this.getAccDescription = z, this.setAccDescription = E;
|
|
7
|
+
}
|
|
8
|
+
getConfig() {
|
|
9
|
+
const t = m({
|
|
10
|
+
...L,
|
|
11
|
+
...F().packet
|
|
12
|
+
});
|
|
13
|
+
return t.showBits && (t.paddingY += 10), t;
|
|
14
|
+
}
|
|
15
|
+
getPacket() {
|
|
16
|
+
return this.packet;
|
|
17
|
+
}
|
|
18
|
+
pushWord(t) {
|
|
19
|
+
t.length > 0 && this.packet.push(t);
|
|
20
|
+
}
|
|
21
|
+
clear() {
|
|
22
|
+
W(), this.packet = [];
|
|
23
|
+
}
|
|
24
|
+
}, b(u, "PacketDB"), u), M = 1e4, Y = /* @__PURE__ */ b((e, t) => {
|
|
25
|
+
_(e, t);
|
|
26
|
+
let r = -1, o = [], n = 1;
|
|
27
|
+
const { bitsPerRow: l } = t.getConfig();
|
|
28
|
+
for (let { start: a, end: s, bits: d, label: c } of e.blocks) {
|
|
29
|
+
if (a !== void 0 && s !== void 0 && s < a)
|
|
30
|
+
throw new Error(`Packet block ${a} - ${s} is invalid. End must be greater than start.`);
|
|
31
|
+
if (a ??= r + 1, a !== r + 1)
|
|
32
|
+
throw new Error(
|
|
33
|
+
`Packet block ${a} - ${s ?? a} is not contiguous. It should start from ${r + 1}.`
|
|
34
|
+
);
|
|
35
|
+
if (d === 0)
|
|
36
|
+
throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);
|
|
37
|
+
for (s ??= a + (d ?? 1) - 1, d ??= s - a + 1, r = s, w.debug(`Packet block ${a} - ${r} with label ${c}`); o.length <= l + 1 && t.getPacket().length < M; ) {
|
|
38
|
+
const [p, i] = I({ start: a, end: s, bits: d, label: c }, n, l);
|
|
39
|
+
if (o.push(p), p.end + 1 === n * l && (t.pushWord(o), o = [], n++), !i)
|
|
40
|
+
break;
|
|
41
|
+
({ start: a, end: s, bits: d, label: c } = i);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
t.pushWord(o);
|
|
45
|
+
}, "populate"), I = /* @__PURE__ */ b((e, t, r) => {
|
|
46
|
+
if (e.start === void 0)
|
|
47
|
+
throw new Error("start should have been set during first phase");
|
|
48
|
+
if (e.end === void 0)
|
|
49
|
+
throw new Error("end should have been set during first phase");
|
|
50
|
+
if (e.start > e.end)
|
|
51
|
+
throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);
|
|
52
|
+
if (e.end + 1 <= t * r)
|
|
53
|
+
return [e, void 0];
|
|
54
|
+
const o = t * r - 1, n = t * r;
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
start: e.start,
|
|
58
|
+
end: o,
|
|
59
|
+
label: e.label,
|
|
60
|
+
bits: o - e.start
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
start: n,
|
|
64
|
+
end: e.end,
|
|
65
|
+
label: e.label,
|
|
66
|
+
bits: e.end - n
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
}, "getNextFittingBlock"), x = {
|
|
70
|
+
// @ts-expect-error - PacketDB is not assignable to DiagramDB
|
|
71
|
+
parser: { yy: void 0 },
|
|
72
|
+
parse: /* @__PURE__ */ b(async (e) => {
|
|
73
|
+
const t = await N("packet", e), r = x.parser?.yy;
|
|
74
|
+
if (!(r instanceof v))
|
|
75
|
+
throw new Error(
|
|
76
|
+
"parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
|
|
77
|
+
);
|
|
78
|
+
w.debug(t), Y(t, r);
|
|
79
|
+
}, "parse")
|
|
80
|
+
}, O = /* @__PURE__ */ b((e, t, r, o) => {
|
|
81
|
+
const n = o.db, l = n.getConfig(), { rowHeight: a, paddingY: s, bitWidth: d, bitsPerRow: c } = l, p = n.getPacket(), i = n.getDiagramTitle(), h = a + s, g = h * (p.length + 1) - (i ? 0 : a), k = d * c + 2, f = B(t);
|
|
82
|
+
f.attr("viewbox", `0 0 ${k} ${g}`), C(f, g, k, l.useMaxWidth);
|
|
83
|
+
for (const [y, $] of p.entries())
|
|
84
|
+
j(f, $, y, l);
|
|
85
|
+
f.append("text").text(i).attr("x", k / 2).attr("y", g - h / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
|
|
86
|
+
}, "draw"), j = /* @__PURE__ */ b((e, t, r, { rowHeight: o, paddingX: n, paddingY: l, bitWidth: a, bitsPerRow: s, showBits: d }) => {
|
|
87
|
+
const c = e.append("g"), p = r * (o + l) + l;
|
|
88
|
+
for (const i of t) {
|
|
89
|
+
const h = i.start % s * a + 1, g = (i.end - i.start + 1) * a - n;
|
|
90
|
+
if (c.append("rect").attr("x", h).attr("y", p).attr("width", g).attr("height", o).attr("class", "packetBlock"), c.append("text").attr("x", h + g / 2).attr("y", p + o / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(i.label), !d)
|
|
91
|
+
continue;
|
|
92
|
+
const k = i.end === i.start, f = p - 2;
|
|
93
|
+
c.append("text").attr("x", h + (k ? g / 2 : 0)).attr("y", f).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", k ? "middle" : "start").text(i.start), k || c.append("text").attr("x", h + g).attr("y", f).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(i.end);
|
|
94
|
+
}
|
|
95
|
+
}, "drawWord"), G = { draw: O }, H = {
|
|
96
|
+
byteFontSize: "10px",
|
|
97
|
+
startByteColor: "black",
|
|
98
|
+
endByteColor: "black",
|
|
99
|
+
labelColor: "black",
|
|
100
|
+
labelFontSize: "12px",
|
|
101
|
+
titleColor: "black",
|
|
102
|
+
titleFontSize: "14px",
|
|
103
|
+
blockStrokeColor: "black",
|
|
104
|
+
blockStrokeWidth: "1",
|
|
105
|
+
blockFillColor: "#efefef"
|
|
106
|
+
}, K = /* @__PURE__ */ b(({ packet: e } = {}) => {
|
|
107
|
+
const t = m(H, e);
|
|
108
|
+
return `
|
|
109
|
+
.packetByte {
|
|
110
|
+
font-size: ${t.byteFontSize};
|
|
111
|
+
}
|
|
112
|
+
.packetByte.start {
|
|
113
|
+
fill: ${t.startByteColor};
|
|
114
|
+
}
|
|
115
|
+
.packetByte.end {
|
|
116
|
+
fill: ${t.endByteColor};
|
|
117
|
+
}
|
|
118
|
+
.packetLabel {
|
|
119
|
+
fill: ${t.labelColor};
|
|
120
|
+
font-size: ${t.labelFontSize};
|
|
121
|
+
}
|
|
122
|
+
.packetTitle {
|
|
123
|
+
fill: ${t.titleColor};
|
|
124
|
+
font-size: ${t.titleFontSize};
|
|
125
|
+
}
|
|
126
|
+
.packetBlock {
|
|
127
|
+
stroke: ${t.blockStrokeColor};
|
|
128
|
+
stroke-width: ${t.blockStrokeWidth};
|
|
129
|
+
fill: ${t.blockFillColor};
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
}, "styles"), q = {
|
|
133
|
+
parser: x,
|
|
134
|
+
get db() {
|
|
135
|
+
return new v();
|
|
136
|
+
},
|
|
137
|
+
renderer: G,
|
|
138
|
+
styles: K
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
q as diagram
|
|
142
|
+
};
|