@data_wise/hyper-markdown 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +201 -0
- package/dist/_basePickBy-CU9zxouA.js +151 -0
- package/dist/_baseUniq-Dfv1esQT.js +614 -0
- package/dist/arc-c3dke9_g.js +83 -0
- package/dist/architecture-U656AL7Q-zgUqrnAb.js +5 -0
- package/dist/architectureDiagram-VXUJARFQ-Dv4YjP5o.js +4665 -0
- package/dist/blockDiagram-VD42YOAC-D98UGbTn.js +2265 -0
- package/dist/c4Diagram-YG6GDRKO-XUzUdD_2.js +1581 -0
- package/dist/channel-C5xtftmJ.js +5 -0
- package/dist/chunk-4BX2VUAB-DEeESiZ5.js +9 -0
- package/dist/chunk-55IACEB6-DHxOGacI.js +8 -0
- package/dist/chunk-B4BG7PRW-8o0v-7qo.js +1376 -0
- package/dist/chunk-DI55MBZ5-DW3vqV--.js +1382 -0
- package/dist/chunk-FMBD7UC4-DDdtUAG0.js +19 -0
- package/dist/chunk-QN33PNHL-CSSbo0QX.js +20 -0
- package/dist/chunk-QZHKN3VN-w9zLiEAG.js +15 -0
- package/dist/chunk-TZMSLE5B-t-rP83k8.js +64 -0
- package/dist/classDiagram-2ON5EDUG-e9sZhnve.js +16 -0
- package/dist/classDiagram-v2-WZHVMYZB-e9sZhnve.js +16 -0
- package/dist/clone-DiTglB0h.js +8 -0
- package/dist/cose-bilkent-S5V4N54A-CWVtemhp.js +2605 -0
- package/dist/cytoscape.esm-ZmItrg9y.js +18731 -0
- package/dist/dagre-6UL2VRFP-MV2ZfZta.js +447 -0
- package/dist/defaultLocale-D7EN2tov.js +171 -0
- package/dist/diagram-PSM6KHXK-5lJpUCK9.js +534 -0
- package/dist/diagram-QEK2KX5R-CNU6jJsS.js +221 -0
- package/dist/diagram-S2PKOQOG-BKjk2v_A.js +143 -0
- package/dist/erDiagram-Q2GNP2WA-BtAVbAYU.js +842 -0
- package/dist/flowDiagram-NV44I4VS-DISVIV3t.js +1627 -0
- package/dist/ganttDiagram-LVOFAZNH-Ddt7ksjd.js +2499 -0
- package/dist/gitGraph-F6HP7TQM-BAIad0GA.js +5 -0
- package/dist/gitGraphDiagram-NY62KEGX-C-l5siHi.js +712 -0
- package/dist/graph-DoqhIGWS.js +247 -0
- package/dist/hyper-markdown.es.js +11 -0
- package/dist/hyper-markdown.umd.js +3180 -0
- package/dist/index-D8q1QLkY.js +139643 -0
- package/dist/info-NVLQJR56-temdJZnQ.js +5 -0
- package/dist/infoDiagram-ER5ION4S-CWrTqrrP.js +24 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/journeyDiagram-XKPGCS4Q-033aYkz7.js +836 -0
- package/dist/kanban-definition-3W4ZIXB7-Dz47qxF_.js +720 -0
- package/dist/katex-dDbcVckU.js +11687 -0
- package/dist/layout-DRpSHON1.js +1335 -0
- package/dist/linear-BO6pDEmK.js +259 -0
- package/dist/mermaid-parser.core-D_tMj5cA.js +12921 -0
- package/dist/mindmap-definition-VGOIOE7T-BsHgjAmS.js +786 -0
- package/dist/ordinal-DfAQgscy.js +61 -0
- package/dist/packet-BFZMPI3H-Bzlf_wLW.js +5 -0
- package/dist/pie-7BOR55EZ-Czidi0ky.js +5 -0
- package/dist/pieDiagram-ADFJNKIX-CSpQeOry.js +161 -0
- package/dist/quadrantDiagram-AYHSOK5B-flM7H9xo.js +1024 -0
- package/dist/radar-NHE76QYJ-D1f__eiC.js +5 -0
- package/dist/requirementDiagram-UZGBJVZJ-1iG0LrwF.js +852 -0
- package/dist/sankeyDiagram-TZEHDZUN-0SClKoX9.js +810 -0
- package/dist/sequenceDiagram-WL72ISMW-Bwbc6j-1.js +2518 -0
- package/dist/stateDiagram-FKZM4ZOC-BuNY3ZqE.js +263 -0
- package/dist/stateDiagram-v2-4FDKWEC3-CB1nMpEc.js +16 -0
- package/dist/style.css +10 -0
- package/dist/timeline-definition-IT6M3QCI-CjFYKVsS.js +801 -0
- package/dist/treemap-KMMF4GRG-Cs8Vv-VD.js +5 -0
- package/dist/xychartDiagram-PRI3JC2R-B6hpuUj2.js +1340 -0
- package/package.json +70 -0
- package/types/index.d.ts +34 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { _ as l, s as k, g as R, q as E, p as F, a as I, b as _, H as D, y as G, D as f, E as C, F as P, l as z, K as H } from "./index-D8q1QLkY.js";
|
|
2
|
+
import { p as V } from "./chunk-4BX2VUAB-DEeESiZ5.js";
|
|
3
|
+
import { p as W } from "./mermaid-parser.core-D_tMj5cA.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), B = P.radar, j = /* @__PURE__ */ l(() => f({
|
|
15
|
+
...B,
|
|
16
|
+
...C().radar
|
|
17
|
+
}), "getConfig"), b = /* @__PURE__ */ l(() => h.axes, "getAxes"), q = /* @__PURE__ */ l(() => h.curves, "getCurves"), K = /* @__PURE__ */ l(() => h.options, "getOptions"), N = /* @__PURE__ */ l((a) => {
|
|
18
|
+
h.axes = a.map((t) => ({
|
|
19
|
+
name: t.name,
|
|
20
|
+
label: t.label ?? t.name
|
|
21
|
+
}));
|
|
22
|
+
}, "setAxes"), U = /* @__PURE__ */ l((a) => {
|
|
23
|
+
h.curves = a.map((t) => ({
|
|
24
|
+
name: t.name,
|
|
25
|
+
label: t.label ?? t.name,
|
|
26
|
+
entries: X(t.entries)
|
|
27
|
+
}));
|
|
28
|
+
}, "setCurves"), X = /* @__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((s) => {
|
|
36
|
+
var o;
|
|
37
|
+
return ((o = s.axis) == null ? void 0 : o.$refText) === e.name;
|
|
38
|
+
});
|
|
39
|
+
if (r === void 0)
|
|
40
|
+
throw new Error("Missing entry for axis " + e.label);
|
|
41
|
+
return r.value;
|
|
42
|
+
});
|
|
43
|
+
}, "computeCurveEntries"), Y = /* @__PURE__ */ l((a) => {
|
|
44
|
+
var e, r, s, o, i;
|
|
45
|
+
const t = a.reduce(
|
|
46
|
+
(n, c) => (n[c.name] = c, n),
|
|
47
|
+
{}
|
|
48
|
+
);
|
|
49
|
+
h.options = {
|
|
50
|
+
showLegend: ((e = t.showLegend) == null ? void 0 : e.value) ?? x.showLegend,
|
|
51
|
+
ticks: ((r = t.ticks) == null ? void 0 : r.value) ?? x.ticks,
|
|
52
|
+
max: ((s = t.max) == null ? void 0 : s.value) ?? x.max,
|
|
53
|
+
min: ((o = t.min) == null ? void 0 : o.value) ?? x.min,
|
|
54
|
+
graticule: ((i = t.graticule) == null ? void 0 : i.value) ?? x.graticule
|
|
55
|
+
};
|
|
56
|
+
}, "setOptions"), Z = /* @__PURE__ */ l(() => {
|
|
57
|
+
G(), h = structuredClone(w);
|
|
58
|
+
}, "clear"), $ = {
|
|
59
|
+
getAxes: b,
|
|
60
|
+
getCurves: q,
|
|
61
|
+
getOptions: K,
|
|
62
|
+
setAxes: N,
|
|
63
|
+
setCurves: U,
|
|
64
|
+
setOptions: Y,
|
|
65
|
+
getConfig: j,
|
|
66
|
+
clear: Z,
|
|
67
|
+
setAccTitle: _,
|
|
68
|
+
getAccTitle: I,
|
|
69
|
+
setDiagramTitle: F,
|
|
70
|
+
getDiagramTitle: E,
|
|
71
|
+
getAccDescription: R,
|
|
72
|
+
setAccDescription: k
|
|
73
|
+
}, J = /* @__PURE__ */ l((a) => {
|
|
74
|
+
V(a, $);
|
|
75
|
+
const { axes: t, curves: e, options: r } = a;
|
|
76
|
+
$.setAxes(t), $.setCurves(e), $.setOptions(r);
|
|
77
|
+
}, "populate"), Q = {
|
|
78
|
+
parse: /* @__PURE__ */ l(async (a) => {
|
|
79
|
+
const t = await W("radar", a);
|
|
80
|
+
z.debug(t), J(t);
|
|
81
|
+
}, "parse")
|
|
82
|
+
}, tt = /* @__PURE__ */ l((a, t, e, r) => {
|
|
83
|
+
const s = r.db, o = s.getAxes(), i = s.getCurves(), n = s.getOptions(), c = s.getConfig(), d = s.getDiagramTitle(), p = D(t), u = et(p, c), g = n.max ?? Math.max(...i.map((y) => Math.max(...y.entries))), m = n.min, v = Math.min(c.width, c.height) / 2;
|
|
84
|
+
at(u, o, v, n.ticks, n.graticule), rt(u, o, v, c), M(u, o, i, m, g, n.graticule, c), T(u, i, n.showLegend, c), u.append("text").attr("class", "radarTitle").text(d).attr("x", 0).attr("y", -c.height / 2 - c.marginTop);
|
|
85
|
+
}, "draw"), et = /* @__PURE__ */ l((a, t) => {
|
|
86
|
+
const e = t.width + t.marginLeft + t.marginRight, r = t.height + t.marginTop + t.marginBottom, s = {
|
|
87
|
+
x: t.marginLeft + t.width / 2,
|
|
88
|
+
y: t.marginTop + t.height / 2
|
|
89
|
+
};
|
|
90
|
+
return a.attr("viewbox", `0 0 ${e} ${r}`).attr("width", e).attr("height", r), a.append("g").attr("transform", `translate(${s.x}, ${s.y})`);
|
|
91
|
+
}, "drawFrame"), at = /* @__PURE__ */ l((a, t, e, r, s) => {
|
|
92
|
+
if (s === "circle")
|
|
93
|
+
for (let o = 0; o < r; o++) {
|
|
94
|
+
const i = e * (o + 1) / r;
|
|
95
|
+
a.append("circle").attr("r", i).attr("class", "radarGraticule");
|
|
96
|
+
}
|
|
97
|
+
else if (s === "polygon") {
|
|
98
|
+
const o = t.length;
|
|
99
|
+
for (let i = 0; i < r; i++) {
|
|
100
|
+
const n = e * (i + 1) / r, c = t.map((d, p) => {
|
|
101
|
+
const u = 2 * p * Math.PI / o - Math.PI / 2, g = n * Math.cos(u), m = n * Math.sin(u);
|
|
102
|
+
return `${g},${m}`;
|
|
103
|
+
}).join(" ");
|
|
104
|
+
a.append("polygon").attr("points", c).attr("class", "radarGraticule");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, "drawGraticule"), rt = /* @__PURE__ */ l((a, t, e, r) => {
|
|
108
|
+
const s = t.length;
|
|
109
|
+
for (let o = 0; o < s; o++) {
|
|
110
|
+
const i = t[o].label, n = 2 * o * Math.PI / s - Math.PI / 2;
|
|
111
|
+
a.append("line").attr("x1", 0).attr("y1", 0).attr("x2", e * r.axisScaleFactor * Math.cos(n)).attr("y2", e * r.axisScaleFactor * Math.sin(n)).attr("class", "radarAxisLine"), a.append("text").text(i).attr("x", e * r.axisLabelFactor * Math.cos(n)).attr("y", e * r.axisLabelFactor * Math.sin(n)).attr("class", "radarAxisLabel");
|
|
112
|
+
}
|
|
113
|
+
}, "drawAxes");
|
|
114
|
+
function M(a, t, e, r, s, o, i) {
|
|
115
|
+
const n = t.length, c = Math.min(i.width, i.height) / 2;
|
|
116
|
+
e.forEach((d, p) => {
|
|
117
|
+
if (d.entries.length !== n)
|
|
118
|
+
return;
|
|
119
|
+
const u = d.entries.map((g, m) => {
|
|
120
|
+
const v = 2 * Math.PI * m / n - Math.PI / 2, y = A(g, r, s, c), O = y * Math.cos(v), S = y * Math.sin(v);
|
|
121
|
+
return { x: O, y: S };
|
|
122
|
+
});
|
|
123
|
+
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}`);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
l(M, "drawCurves");
|
|
127
|
+
function A(a, t, e, r) {
|
|
128
|
+
const s = Math.min(Math.max(a, t), e);
|
|
129
|
+
return r * (s - t) / (e - t);
|
|
130
|
+
}
|
|
131
|
+
l(A, "relativeRadius");
|
|
132
|
+
function L(a, t) {
|
|
133
|
+
const e = a.length;
|
|
134
|
+
let r = `M${a[0].x},${a[0].y}`;
|
|
135
|
+
for (let s = 0; s < e; s++) {
|
|
136
|
+
const o = a[(s - 1 + e) % e], i = a[s], n = a[(s + 1) % e], c = a[(s + 2) % e], d = {
|
|
137
|
+
x: i.x + (n.x - o.x) * t,
|
|
138
|
+
y: i.y + (n.y - o.y) * t
|
|
139
|
+
}, p = {
|
|
140
|
+
x: n.x - (c.x - i.x) * t,
|
|
141
|
+
y: n.y - (c.y - i.y) * t
|
|
142
|
+
};
|
|
143
|
+
r += ` C${d.x},${d.y} ${p.x},${p.y} ${n.x},${n.y}`;
|
|
144
|
+
}
|
|
145
|
+
return `${r} Z`;
|
|
146
|
+
}
|
|
147
|
+
l(L, "closedRoundCurve");
|
|
148
|
+
function T(a, t, e, r) {
|
|
149
|
+
if (!e)
|
|
150
|
+
return;
|
|
151
|
+
const s = (r.width / 2 + r.marginRight) * 3 / 4, o = -(r.height / 2 + r.marginTop) * 3 / 4, i = 20;
|
|
152
|
+
t.forEach((n, c) => {
|
|
153
|
+
const d = a.append("g").attr("transform", `translate(${s}, ${o + c * i})`);
|
|
154
|
+
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(n.label);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
l(T, "drawLegend");
|
|
158
|
+
var st = { draw: tt }, nt = /* @__PURE__ */ l((a, t) => {
|
|
159
|
+
let e = "";
|
|
160
|
+
for (let r = 0; r < a.THEME_COLOR_LIMIT; r++) {
|
|
161
|
+
const s = a[`cScale${r}`];
|
|
162
|
+
e += `
|
|
163
|
+
.radarCurve-${r} {
|
|
164
|
+
color: ${s};
|
|
165
|
+
fill: ${s};
|
|
166
|
+
fill-opacity: ${t.curveOpacity};
|
|
167
|
+
stroke: ${s};
|
|
168
|
+
stroke-width: ${t.curveStrokeWidth};
|
|
169
|
+
}
|
|
170
|
+
.radarLegendBox-${r} {
|
|
171
|
+
fill: ${s};
|
|
172
|
+
fill-opacity: ${t.curveOpacity};
|
|
173
|
+
stroke: ${s};
|
|
174
|
+
}
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
return e;
|
|
178
|
+
}, "genIndexStyles"), ot = /* @__PURE__ */ l((a) => {
|
|
179
|
+
const t = H(), e = C(), r = f(t, e.themeVariables), s = f(r.radar, a);
|
|
180
|
+
return { themeVariables: r, radarOptions: s };
|
|
181
|
+
}, "buildRadarStyleOptions"), it = /* @__PURE__ */ l(({ radar: a } = {}) => {
|
|
182
|
+
const { themeVariables: t, radarOptions: e } = ot(a);
|
|
183
|
+
return `
|
|
184
|
+
.radarTitle {
|
|
185
|
+
font-size: ${t.fontSize};
|
|
186
|
+
color: ${t.titleColor};
|
|
187
|
+
dominant-baseline: hanging;
|
|
188
|
+
text-anchor: middle;
|
|
189
|
+
}
|
|
190
|
+
.radarAxisLine {
|
|
191
|
+
stroke: ${e.axisColor};
|
|
192
|
+
stroke-width: ${e.axisStrokeWidth};
|
|
193
|
+
}
|
|
194
|
+
.radarAxisLabel {
|
|
195
|
+
dominant-baseline: middle;
|
|
196
|
+
text-anchor: middle;
|
|
197
|
+
font-size: ${e.axisLabelFontSize}px;
|
|
198
|
+
color: ${e.axisColor};
|
|
199
|
+
}
|
|
200
|
+
.radarGraticule {
|
|
201
|
+
fill: ${e.graticuleColor};
|
|
202
|
+
fill-opacity: ${e.graticuleOpacity};
|
|
203
|
+
stroke: ${e.graticuleColor};
|
|
204
|
+
stroke-width: ${e.graticuleStrokeWidth};
|
|
205
|
+
}
|
|
206
|
+
.radarLegendText {
|
|
207
|
+
text-anchor: start;
|
|
208
|
+
font-size: ${e.legendFontSize}px;
|
|
209
|
+
dominant-baseline: hanging;
|
|
210
|
+
}
|
|
211
|
+
${nt(t, e)}
|
|
212
|
+
`;
|
|
213
|
+
}, "styles"), ut = {
|
|
214
|
+
parser: Q,
|
|
215
|
+
db: $,
|
|
216
|
+
renderer: st,
|
|
217
|
+
styles: it
|
|
218
|
+
};
|
|
219
|
+
export {
|
|
220
|
+
ut as diagram
|
|
221
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { _ as b, D as m, H as B, e as C, l as w, b as S, a as D, p as T, q as E, g as F, s as P, E as z, F as A, y as W } from "./index-D8q1QLkY.js";
|
|
2
|
+
import { p as _ } from "./chunk-4BX2VUAB-DEeESiZ5.js";
|
|
3
|
+
import { p as N } from "./mermaid-parser.core-D_tMj5cA.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 = E, this.getAccDescription = F, this.setAccDescription = P;
|
|
7
|
+
}
|
|
8
|
+
getConfig() {
|
|
9
|
+
const t = m({
|
|
10
|
+
...L,
|
|
11
|
+
...z().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 s = -1, r = [], n = 1;
|
|
27
|
+
const { bitsPerRow: l } = t.getConfig();
|
|
28
|
+
for (let { start: a, end: i, bits: d, label: c } of e.blocks) {
|
|
29
|
+
if (a !== void 0 && i !== void 0 && i < a)
|
|
30
|
+
throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);
|
|
31
|
+
if (a ?? (a = s + 1), a !== s + 1)
|
|
32
|
+
throw new Error(
|
|
33
|
+
`Packet block ${a} - ${i ?? a} is not contiguous. It should start from ${s + 1}.`
|
|
34
|
+
);
|
|
35
|
+
if (d === 0)
|
|
36
|
+
throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);
|
|
37
|
+
for (i ?? (i = a + (d ?? 1) - 1), d ?? (d = i - a + 1), s = i, w.debug(`Packet block ${a} - ${s} with label ${c}`); r.length <= l + 1 && t.getPacket().length < M; ) {
|
|
38
|
+
const [p, o] = H({ start: a, end: i, bits: d, label: c }, n, l);
|
|
39
|
+
if (r.push(p), p.end + 1 === n * l && (t.pushWord(r), r = [], n++), !o)
|
|
40
|
+
break;
|
|
41
|
+
({ start: a, end: i, bits: d, label: c } = o);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
t.pushWord(r);
|
|
45
|
+
}, "populate"), H = /* @__PURE__ */ b((e, t, s) => {
|
|
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 * s)
|
|
53
|
+
return [e, void 0];
|
|
54
|
+
const r = t * s - 1, n = t * s;
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
start: e.start,
|
|
58
|
+
end: r,
|
|
59
|
+
label: e.label,
|
|
60
|
+
bits: r - 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
|
+
var r;
|
|
74
|
+
const t = await N("packet", e), s = (r = x.parser) == null ? void 0 : r.yy;
|
|
75
|
+
if (!(s instanceof v))
|
|
76
|
+
throw new Error(
|
|
77
|
+
"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."
|
|
78
|
+
);
|
|
79
|
+
w.debug(t), Y(t, s);
|
|
80
|
+
}, "parse")
|
|
81
|
+
}, I = /* @__PURE__ */ b((e, t, s, r) => {
|
|
82
|
+
const n = r.db, l = n.getConfig(), { rowHeight: a, paddingY: i, bitWidth: d, bitsPerRow: c } = l, p = n.getPacket(), o = n.getDiagramTitle(), h = a + i, g = h * (p.length + 1) - (o ? 0 : a), k = d * c + 2, f = B(t);
|
|
83
|
+
f.attr("viewbox", `0 0 ${k} ${g}`), C(f, g, k, l.useMaxWidth);
|
|
84
|
+
for (const [y, $] of p.entries())
|
|
85
|
+
O(f, $, y, l);
|
|
86
|
+
f.append("text").text(o).attr("x", k / 2).attr("y", g - h / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
|
|
87
|
+
}, "draw"), O = /* @__PURE__ */ b((e, t, s, { rowHeight: r, paddingX: n, paddingY: l, bitWidth: a, bitsPerRow: i, showBits: d }) => {
|
|
88
|
+
const c = e.append("g"), p = s * (r + l) + l;
|
|
89
|
+
for (const o of t) {
|
|
90
|
+
const h = o.start % i * a + 1, g = (o.end - o.start + 1) * a - n;
|
|
91
|
+
if (c.append("rect").attr("x", h).attr("y", p).attr("width", g).attr("height", r).attr("class", "packetBlock"), c.append("text").attr("x", h + g / 2).attr("y", p + r / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(o.label), !d)
|
|
92
|
+
continue;
|
|
93
|
+
const k = o.end === o.start, f = p - 2;
|
|
94
|
+
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(o.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(o.end);
|
|
95
|
+
}
|
|
96
|
+
}, "drawWord"), j = { draw: I }, q = {
|
|
97
|
+
byteFontSize: "10px",
|
|
98
|
+
startByteColor: "black",
|
|
99
|
+
endByteColor: "black",
|
|
100
|
+
labelColor: "black",
|
|
101
|
+
labelFontSize: "12px",
|
|
102
|
+
titleColor: "black",
|
|
103
|
+
titleFontSize: "14px",
|
|
104
|
+
blockStrokeColor: "black",
|
|
105
|
+
blockStrokeWidth: "1",
|
|
106
|
+
blockFillColor: "#efefef"
|
|
107
|
+
}, G = /* @__PURE__ */ b(({ packet: e } = {}) => {
|
|
108
|
+
const t = m(q, e);
|
|
109
|
+
return `
|
|
110
|
+
.packetByte {
|
|
111
|
+
font-size: ${t.byteFontSize};
|
|
112
|
+
}
|
|
113
|
+
.packetByte.start {
|
|
114
|
+
fill: ${t.startByteColor};
|
|
115
|
+
}
|
|
116
|
+
.packetByte.end {
|
|
117
|
+
fill: ${t.endByteColor};
|
|
118
|
+
}
|
|
119
|
+
.packetLabel {
|
|
120
|
+
fill: ${t.labelColor};
|
|
121
|
+
font-size: ${t.labelFontSize};
|
|
122
|
+
}
|
|
123
|
+
.packetTitle {
|
|
124
|
+
fill: ${t.titleColor};
|
|
125
|
+
font-size: ${t.titleFontSize};
|
|
126
|
+
}
|
|
127
|
+
.packetBlock {
|
|
128
|
+
stroke: ${t.blockStrokeColor};
|
|
129
|
+
stroke-width: ${t.blockStrokeWidth};
|
|
130
|
+
fill: ${t.blockFillColor};
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
}, "styles"), X = {
|
|
134
|
+
parser: x,
|
|
135
|
+
get db() {
|
|
136
|
+
return new v();
|
|
137
|
+
},
|
|
138
|
+
renderer: j,
|
|
139
|
+
styles: G
|
|
140
|
+
};
|
|
141
|
+
export {
|
|
142
|
+
X as diagram
|
|
143
|
+
};
|