@draftably/editor 0.0.0-stage → 0.1.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/README.md +26 -2
- package/dist/LICENSE +21 -0
- package/dist/assets/engine.worker-DmHew5f6.js +6813 -0
- package/dist/assets/import-d2.worker-CnXfFXoa.js +5395 -0
- package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +87 -0
- package/dist/chunks/arc-rJj0TtXf.js +83 -0
- package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +4781 -0
- package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +1440 -0
- package/dist/chunks/browser-iNhbPsGc.js +40 -0
- package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +1524 -0
- package/dist/chunks/channel-qMvPU6eH.js +5 -0
- package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +670 -0
- package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +18 -0
- package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +262 -0
- package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +68 -0
- package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +19 -0
- package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +8 -0
- package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +19 -0
- package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +8 -0
- package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +451 -0
- package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +1570 -0
- package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +2608 -0
- package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +22361 -0
- package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +299 -0
- package/dist/chunks/cytoscape.esm-CRsF_JA3.js +18791 -0
- package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +2157 -0
- package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
- package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +531 -0
- package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +153 -0
- package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +346 -0
- package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +480 -0
- package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +219 -0
- package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +2586 -0
- package/dist/chunks/dot-importer-B23jwEkx.js +1547 -0
- package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +109 -0
- package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +49229 -0
- package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +1064 -0
- package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +1771 -0
- package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +2729 -0
- package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +815 -0
- package/dist/chunks/graph-CKJmgLki.js +1541 -0
- package/dist/chunks/import-core-C-I1wGfw.js +145 -0
- package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +24 -0
- package/dist/chunks/init-DjUOC4st.js +16 -0
- package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +624 -0
- package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +834 -0
- package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +724 -0
- package/dist/chunks/katex-BsrBVQKd.js +11314 -0
- package/dist/chunks/linear-4t7D_ros.js +259 -0
- package/dist/chunks/mermaid-facade-BoLWBerE.js +289 -0
- package/dist/chunks/mermaid-importer-Cgx1IhmR.js +478 -0
- package/dist/chunks/mermaid.core-DXv6D2Sm.js +19244 -0
- package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +837 -0
- package/dist/chunks/mount-C1Xk_GQz.js +22131 -0
- package/dist/chunks/ordinal-DfAQgscy.js +61 -0
- package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +95 -0
- package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +208 -0
- package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +1029 -0
- package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +77 -0
- package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +889 -0
- package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +859 -0
- package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +2972 -0
- package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +46 -0
- package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +1520 -0
- package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +4991 -0
- package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +13 -0
- package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +1058 -0
- package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +7945 -0
- package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +1578 -0
- package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +678 -0
- package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +1536 -0
- package/dist/element.js +36 -0
- package/dist/index.js +4 -0
- package/dist/types/src/cli/links.d.ts +4 -0
- package/dist/types/src/cli/pdf.d.ts +29 -0
- package/dist/types/src/cli/png.d.ts +23 -0
- package/dist/types/src/cli/svg.d.ts +4 -0
- package/dist/types/src/components/Icon.d.ts +14 -0
- package/dist/types/src/components/LayoutPreviewBar.d.ts +2 -0
- package/dist/types/src/components/canvas/Canvas.d.ts +15 -0
- package/dist/types/src/components/canvas/Frame.d.ts +22 -0
- package/dist/types/src/components/canvas/InlineEditor.d.ts +2 -0
- package/dist/types/src/components/canvas/Notes.d.ts +5 -0
- package/dist/types/src/components/canvas/Overlay.d.ts +2 -0
- package/dist/types/src/components/canvas/StateBar.d.ts +5 -0
- package/dist/types/src/components/canvas/TextHits.d.ts +6 -0
- package/dist/types/src/components/canvas/ZoomControls.d.ts +1 -0
- package/dist/types/src/components/canvas/text-boxes.d.ts +24 -0
- package/dist/types/src/components/controls.d.ts +88 -0
- package/dist/types/src/components/scene/EdgeView.d.ts +22 -0
- package/dist/types/src/components/scene/GroupView.d.ts +22 -0
- package/dist/types/src/components/scene/Lifelines.d.ts +15 -0
- package/dist/types/src/components/scene/LinkMark.d.ts +11 -0
- package/dist/types/src/components/scene/NodeView.d.ts +18 -0
- package/dist/types/src/components/scene/parts.d.ts +50 -0
- package/dist/types/src/components/sculpt/BrushDock.d.ts +2 -0
- package/dist/types/src/components/sculpt/TimelineDeck.d.ts +2 -0
- package/dist/types/src/components/session-context.d.ts +486 -0
- package/dist/types/src/dsl/cells.d.ts +91 -0
- package/dist/types/src/dsl/channels.d.ts +53 -0
- package/dist/types/src/dsl/compile.d.ts +162 -0
- package/dist/types/src/dsl/frame.d.ts +38 -0
- package/dist/types/src/dsl/lanes.d.ts +23 -0
- package/dist/types/src/dsl/layout-edits.d.ts +58 -0
- package/dist/types/src/dsl/legend-notes.d.ts +3 -0
- package/dist/types/src/dsl/project.d.ts +39 -0
- package/dist/types/src/dsl/source-edits.d.ts +37 -0
- package/dist/types/src/dsl/syntax.d.ts +317 -0
- package/dist/types/src/dsl/translate.d.ts +69 -0
- package/dist/types/src/editor/Editor.d.ts +6 -0
- package/dist/types/src/editor/element.d.ts +15 -0
- package/dist/types/src/editor/mount.d.ts +23 -0
- package/dist/types/src/import/browser.d.ts +3 -0
- package/dist/types/src/import/detect.d.ts +31 -0
- package/dist/types/src/import/dot-importer.d.ts +3 -0
- package/dist/types/src/import/import-core.d.ts +105 -0
- package/dist/types/src/import/mermaid-facade.d.ts +120 -0
- package/dist/types/src/import/mermaid-importer.d.ts +4 -0
- package/dist/types/src/import/mermaid-sequence.d.ts +8 -0
- package/dist/types/src/import/scratch.d.ts +3 -0
- package/dist/types/src/lib/engine-tasks.d.ts +88 -0
- package/dist/types/src/lib/font-data.d.ts +9 -0
- package/dist/types/src/lib/saved-diagram.d.ts +4 -0
- package/dist/types/src/lib/scene-cache.d.ts +4 -0
- package/dist/types/src/lib/source-hash.d.ts +7 -0
- package/dist/types/src/lib/svg-export.d.ts +15 -0
- package/dist/types/src/model/appearance.d.ts +209 -0
- package/dist/types/src/model/bounds.d.ts +19 -0
- package/dist/types/src/model/camera.d.ts +21 -0
- package/dist/types/src/model/candidates.d.ts +53 -0
- package/dist/types/src/model/colors.d.ts +22 -0
- package/dist/types/src/model/document.d.ts +24 -0
- package/dist/types/src/model/edits.d.ts +133 -0
- package/dist/types/src/model/embed.d.ts +17 -0
- package/dist/types/src/model/examples.d.ts +15 -0
- package/dist/types/src/model/font-faces.d.ts +24 -0
- package/dist/types/src/model/fonts.d.ts +47 -0
- package/dist/types/src/model/footnote.d.ts +34 -0
- package/dist/types/src/model/frame.d.ts +71 -0
- package/dist/types/src/model/geometry.d.ts +29 -0
- package/dist/types/src/model/graph.d.ts +53 -0
- package/dist/types/src/model/heading.d.ts +38 -0
- package/dist/types/src/model/icons.d.ts +2 -0
- package/dist/types/src/model/label-hits.d.ts +27 -0
- package/dist/types/src/model/labels.d.ts +88 -0
- package/dist/types/src/model/legend.d.ts +25 -0
- package/dist/types/src/model/link.d.ts +63 -0
- package/dist/types/src/model/markers.d.ts +47 -0
- package/dist/types/src/model/note.d.ts +75 -0
- package/dist/types/src/model/panels.d.ts +11 -0
- package/dist/types/src/model/rich-text.d.ts +24 -0
- package/dist/types/src/model/routes.d.ts +170 -0
- package/dist/types/src/model/samples.d.ts +11 -0
- package/dist/types/src/model/stack.d.ts +8 -0
- package/dist/types/src/model/static-scene.d.ts +15 -0
- package/dist/types/src/model/status.d.ts +84 -0
- package/dist/types/src/model/styles.d.ts +13 -0
- package/dist/types/src/model/surface.d.ts +31 -0
- package/dist/types/src/model/types.d.ts +277 -0
- package/dist/types/src/runtime/svg-renderer.d.ts +38 -0
- package/dist/types/src/server/file-session.d.ts +19 -0
- package/dist/types/src/server/workspace.d.ts +21 -0
- package/dist/types/src/state/active-session.d.ts +479 -0
- package/dist/types/src/state/commands.d.ts +529 -0
- package/dist/types/src/state/comparison.d.ts +151 -0
- package/dist/types/src/state/files.d.ts +61 -0
- package/dist/types/src/state/keyboard.d.ts +6 -0
- package/dist/types/src/state/keys.d.ts +5 -0
- package/dist/types/src/state/launch.d.ts +61 -0
- package/dist/types/src/state/links.d.ts +11 -0
- package/dist/types/src/state/session/actions.d.ts +77 -0
- package/dist/types/src/state/session/canvas-text.d.ts +24 -0
- package/dist/types/src/state/session/document.d.ts +84 -0
- package/dist/types/src/state/session/editor.d.ts +81 -0
- package/dist/types/src/state/session/emphasis.d.ts +11 -0
- package/dist/types/src/state/session/file-session.d.ts +98 -0
- package/dist/types/src/state/session/index.d.ts +496 -0
- package/dist/types/src/state/session/layout.d.ts +79 -0
- package/dist/types/src/state/session/pointer.d.ts +19 -0
- package/dist/types/src/state/session/routing.d.ts +20 -0
- package/dist/types/src/state/session/scene.d.ts +144 -0
- package/dist/types/src/state/session/sculpt.d.ts +70 -0
- package/dist/types/src/state/toast.d.ts +14 -0
- package/dist/types/src/state/ui.d.ts +39 -0
- package/package.json +41 -3
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { p as me } from "./chunk-JWPE2WC7-CnAFS2xF.js";
|
|
2
|
+
import { _ as w, R as ge, L as te, N as K, Q as ye, d as Se, l as ee, bq as B, k as j, b as ve, a as xe, q as be, t as we, g as Ce, s as Te, O as Le, br as $e, A as Ae } from "./mermaid.core-DXv6D2Sm.js";
|
|
3
|
+
import { s as Fe } from "./chunk-VQ5W62QI-CXRv7FiX.js";
|
|
4
|
+
import { p as Ne } from "./cynefin-EF2NZ3EQ-Bt6b88hY.js";
|
|
5
|
+
import { b as I } from "./defaultLocale-BgPVtth8.js";
|
|
6
|
+
import { o as J } from "./ordinal-DfAQgscy.js";
|
|
7
|
+
function Me(e) {
|
|
8
|
+
var a = 0, n = e.children, l = n && n.length;
|
|
9
|
+
if (!l) a = 1;
|
|
10
|
+
else for (; --l >= 0; ) a += n[l].value;
|
|
11
|
+
e.value = a;
|
|
12
|
+
}
|
|
13
|
+
function _e() {
|
|
14
|
+
return this.eachAfter(Me);
|
|
15
|
+
}
|
|
16
|
+
function ke(e, a) {
|
|
17
|
+
let n = -1;
|
|
18
|
+
for (const l of this)
|
|
19
|
+
e.call(a, l, ++n, this);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
function ze(e, a) {
|
|
23
|
+
for (var n = this, l = [n], s, o, h = -1; n = l.pop(); )
|
|
24
|
+
if (e.call(a, n, ++h, this), s = n.children)
|
|
25
|
+
for (o = s.length - 1; o >= 0; --o)
|
|
26
|
+
l.push(s[o]);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
function Ve(e, a) {
|
|
30
|
+
for (var n = this, l = [n], s = [], o, h, d, g = -1; n = l.pop(); )
|
|
31
|
+
if (s.push(n), o = n.children)
|
|
32
|
+
for (h = 0, d = o.length; h < d; ++h)
|
|
33
|
+
l.push(o[h]);
|
|
34
|
+
for (; n = s.pop(); )
|
|
35
|
+
e.call(a, n, ++g, this);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
function De(e, a) {
|
|
39
|
+
let n = -1;
|
|
40
|
+
for (const l of this)
|
|
41
|
+
if (e.call(a, l, ++n, this))
|
|
42
|
+
return l;
|
|
43
|
+
}
|
|
44
|
+
function Pe(e) {
|
|
45
|
+
return this.eachAfter(function(a) {
|
|
46
|
+
for (var n = +e(a.data) || 0, l = a.children, s = l && l.length; --s >= 0; ) n += l[s].value;
|
|
47
|
+
a.value = n;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function Be(e) {
|
|
51
|
+
return this.eachBefore(function(a) {
|
|
52
|
+
a.children && a.children.sort(e);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function Re(e) {
|
|
56
|
+
for (var a = this, n = Ee(a, e), l = [a]; a !== n; )
|
|
57
|
+
a = a.parent, l.push(a);
|
|
58
|
+
for (var s = l.length; e !== n; )
|
|
59
|
+
l.splice(s, 0, e), e = e.parent;
|
|
60
|
+
return l;
|
|
61
|
+
}
|
|
62
|
+
function Ee(e, a) {
|
|
63
|
+
if (e === a) return e;
|
|
64
|
+
var n = e.ancestors(), l = a.ancestors(), s = null;
|
|
65
|
+
for (e = n.pop(), a = l.pop(); e === a; )
|
|
66
|
+
s = e, e = n.pop(), a = l.pop();
|
|
67
|
+
return s;
|
|
68
|
+
}
|
|
69
|
+
function We() {
|
|
70
|
+
for (var e = this, a = [e]; e = e.parent; )
|
|
71
|
+
a.push(e);
|
|
72
|
+
return a;
|
|
73
|
+
}
|
|
74
|
+
function He() {
|
|
75
|
+
return Array.from(this);
|
|
76
|
+
}
|
|
77
|
+
function Ie() {
|
|
78
|
+
var e = [];
|
|
79
|
+
return this.eachBefore(function(a) {
|
|
80
|
+
a.children || e.push(a);
|
|
81
|
+
}), e;
|
|
82
|
+
}
|
|
83
|
+
function Oe() {
|
|
84
|
+
var e = this, a = [];
|
|
85
|
+
return e.each(function(n) {
|
|
86
|
+
n !== e && a.push({ source: n.parent, target: n });
|
|
87
|
+
}), a;
|
|
88
|
+
}
|
|
89
|
+
function* qe() {
|
|
90
|
+
var e = this, a, n = [e], l, s, o;
|
|
91
|
+
do
|
|
92
|
+
for (a = n.reverse(), n = []; e = a.pop(); )
|
|
93
|
+
if (yield e, l = e.children)
|
|
94
|
+
for (s = 0, o = l.length; s < o; ++s)
|
|
95
|
+
n.push(l[s]);
|
|
96
|
+
while (n.length);
|
|
97
|
+
}
|
|
98
|
+
function ae(e, a) {
|
|
99
|
+
e instanceof Map ? (e = [void 0, e], a === void 0 && (a = Ye)) : a === void 0 && (a = Xe);
|
|
100
|
+
for (var n = new Q(e), l, s = [n], o, h, d, g; l = s.pop(); )
|
|
101
|
+
if ((h = a(l.data)) && (g = (h = Array.from(h)).length))
|
|
102
|
+
for (l.children = h, d = g - 1; d >= 0; --d)
|
|
103
|
+
s.push(o = h[d] = new Q(h[d])), o.parent = l, o.depth = l.depth + 1;
|
|
104
|
+
return n.eachBefore(Qe);
|
|
105
|
+
}
|
|
106
|
+
function Ge() {
|
|
107
|
+
return ae(this).eachBefore(je);
|
|
108
|
+
}
|
|
109
|
+
function Xe(e) {
|
|
110
|
+
return e.children;
|
|
111
|
+
}
|
|
112
|
+
function Ye(e) {
|
|
113
|
+
return Array.isArray(e) ? e[1] : null;
|
|
114
|
+
}
|
|
115
|
+
function je(e) {
|
|
116
|
+
e.data.value !== void 0 && (e.value = e.data.value), e.data = e.data.data;
|
|
117
|
+
}
|
|
118
|
+
function Qe(e) {
|
|
119
|
+
var a = 0;
|
|
120
|
+
do
|
|
121
|
+
e.height = a;
|
|
122
|
+
while ((e = e.parent) && e.height < ++a);
|
|
123
|
+
}
|
|
124
|
+
function Q(e) {
|
|
125
|
+
this.data = e, this.depth = this.height = 0, this.parent = null;
|
|
126
|
+
}
|
|
127
|
+
Q.prototype = ae.prototype = {
|
|
128
|
+
constructor: Q,
|
|
129
|
+
count: _e,
|
|
130
|
+
each: ke,
|
|
131
|
+
eachAfter: Ve,
|
|
132
|
+
eachBefore: ze,
|
|
133
|
+
find: De,
|
|
134
|
+
sum: Pe,
|
|
135
|
+
sort: Be,
|
|
136
|
+
path: Re,
|
|
137
|
+
ancestors: We,
|
|
138
|
+
descendants: He,
|
|
139
|
+
leaves: Ie,
|
|
140
|
+
links: Oe,
|
|
141
|
+
copy: Ge,
|
|
142
|
+
[Symbol.iterator]: qe
|
|
143
|
+
};
|
|
144
|
+
function Ue(e) {
|
|
145
|
+
if (typeof e != "function") throw new Error();
|
|
146
|
+
return e;
|
|
147
|
+
}
|
|
148
|
+
function O() {
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
function q(e) {
|
|
152
|
+
return function() {
|
|
153
|
+
return e;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function Ze(e) {
|
|
157
|
+
e.x0 = Math.round(e.x0), e.y0 = Math.round(e.y0), e.x1 = Math.round(e.x1), e.y1 = Math.round(e.y1);
|
|
158
|
+
}
|
|
159
|
+
function Je(e, a, n, l, s) {
|
|
160
|
+
for (var o = e.children, h, d = -1, g = o.length, c = e.value && (l - a) / e.value; ++d < g; )
|
|
161
|
+
h = o[d], h.y0 = n, h.y1 = s, h.x0 = a, h.x1 = a += h.value * c;
|
|
162
|
+
}
|
|
163
|
+
function Ke(e, a, n, l, s) {
|
|
164
|
+
for (var o = e.children, h, d = -1, g = o.length, c = e.value && (s - n) / e.value; ++d < g; )
|
|
165
|
+
h = o[d], h.x0 = a, h.x1 = l, h.y0 = n, h.y1 = n += h.value * c;
|
|
166
|
+
}
|
|
167
|
+
var et = (1 + Math.sqrt(5)) / 2;
|
|
168
|
+
function tt(e, a, n, l, s, o) {
|
|
169
|
+
for (var h = [], d = a.children, g, c, u = 0, b = 0, r = d.length, x, S, v = a.value, p, y, N, $, V, E, M; u < r; ) {
|
|
170
|
+
x = s - n, S = o - l;
|
|
171
|
+
do
|
|
172
|
+
p = d[b++].value;
|
|
173
|
+
while (!p && b < r);
|
|
174
|
+
for (y = N = p, E = Math.max(S / x, x / S) / (v * e), M = p * p * E, V = Math.max(N / M, M / y); b < r; ++b) {
|
|
175
|
+
if (p += c = d[b].value, c < y && (y = c), c > N && (N = c), M = p * p * E, $ = Math.max(N / M, M / y), $ > V) {
|
|
176
|
+
p -= c;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
V = $;
|
|
180
|
+
}
|
|
181
|
+
h.push(g = { value: p, dice: x < S, children: d.slice(u, b) }), g.dice ? Je(g, n, l, s, v ? l += S * p / v : o) : Ke(g, n, l, v ? n += x * p / v : s, o), v -= p, u = b;
|
|
182
|
+
}
|
|
183
|
+
return h;
|
|
184
|
+
}
|
|
185
|
+
const at = (function e(a) {
|
|
186
|
+
function n(l, s, o, h, d) {
|
|
187
|
+
tt(a, l, s, o, h, d);
|
|
188
|
+
}
|
|
189
|
+
return n.ratio = function(l) {
|
|
190
|
+
return e((l = +l) > 1 ? l : 1);
|
|
191
|
+
}, n;
|
|
192
|
+
})(et);
|
|
193
|
+
function nt() {
|
|
194
|
+
var e = at, a = !1, n = 1, l = 1, s = [0], o = O, h = O, d = O, g = O, c = O;
|
|
195
|
+
function u(r) {
|
|
196
|
+
return r.x0 = r.y0 = 0, r.x1 = n, r.y1 = l, r.eachBefore(b), s = [0], a && r.eachBefore(Ze), r;
|
|
197
|
+
}
|
|
198
|
+
function b(r) {
|
|
199
|
+
var x = s[r.depth], S = r.x0 + x, v = r.y0 + x, p = r.x1 - x, y = r.y1 - x;
|
|
200
|
+
p < S && (S = p = (S + p) / 2), y < v && (v = y = (v + y) / 2), r.x0 = S, r.y0 = v, r.x1 = p, r.y1 = y, r.children && (x = s[r.depth + 1] = o(r) / 2, S += c(r) - x, v += h(r) - x, p -= d(r) - x, y -= g(r) - x, p < S && (S = p = (S + p) / 2), y < v && (v = y = (v + y) / 2), e(r, S, v, p, y));
|
|
201
|
+
}
|
|
202
|
+
return u.round = function(r) {
|
|
203
|
+
return arguments.length ? (a = !!r, u) : a;
|
|
204
|
+
}, u.size = function(r) {
|
|
205
|
+
return arguments.length ? (n = +r[0], l = +r[1], u) : [n, l];
|
|
206
|
+
}, u.tile = function(r) {
|
|
207
|
+
return arguments.length ? (e = Ue(r), u) : e;
|
|
208
|
+
}, u.padding = function(r) {
|
|
209
|
+
return arguments.length ? u.paddingInner(r).paddingOuter(r) : u.paddingInner();
|
|
210
|
+
}, u.paddingInner = function(r) {
|
|
211
|
+
return arguments.length ? (o = typeof r == "function" ? r : q(+r), u) : o;
|
|
212
|
+
}, u.paddingOuter = function(r) {
|
|
213
|
+
return arguments.length ? u.paddingTop(r).paddingRight(r).paddingBottom(r).paddingLeft(r) : u.paddingTop();
|
|
214
|
+
}, u.paddingTop = function(r) {
|
|
215
|
+
return arguments.length ? (h = typeof r == "function" ? r : q(+r), u) : h;
|
|
216
|
+
}, u.paddingRight = function(r) {
|
|
217
|
+
return arguments.length ? (d = typeof r == "function" ? r : q(+r), u) : d;
|
|
218
|
+
}, u.paddingBottom = function(r) {
|
|
219
|
+
return arguments.length ? (g = typeof r == "function" ? r : q(+r), u) : g;
|
|
220
|
+
}, u.paddingLeft = function(r) {
|
|
221
|
+
return arguments.length ? (c = typeof r == "function" ? r : q(+r), u) : c;
|
|
222
|
+
}, u;
|
|
223
|
+
}
|
|
224
|
+
var ie = class {
|
|
225
|
+
constructor() {
|
|
226
|
+
this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = ve, this.getAccTitle = xe, this.setDiagramTitle = be, this.getDiagramTitle = we, this.getAccDescription = Ce, this.setAccDescription = Te;
|
|
227
|
+
}
|
|
228
|
+
static {
|
|
229
|
+
w(this, "TreeMapDB");
|
|
230
|
+
}
|
|
231
|
+
getNodes() {
|
|
232
|
+
return this.nodes;
|
|
233
|
+
}
|
|
234
|
+
getConfig() {
|
|
235
|
+
const e = Le, a = te();
|
|
236
|
+
return K({
|
|
237
|
+
...e.treemap,
|
|
238
|
+
...a.treemap ?? {}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
addNode(e, a) {
|
|
242
|
+
this.nodes.push(e), this.levels.set(e, a), a === 0 && (this.outerNodes.push(e), this.root ??= e);
|
|
243
|
+
}
|
|
244
|
+
getRoot() {
|
|
245
|
+
return { name: "", children: this.outerNodes };
|
|
246
|
+
}
|
|
247
|
+
addClass(e, a) {
|
|
248
|
+
const n = this.classes.get(e) ?? { id: e, styles: [], textStyles: [] }, l = a.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
|
|
249
|
+
l && l.forEach((s) => {
|
|
250
|
+
$e(s) && (n?.textStyles ? n.textStyles.push(s) : n.textStyles = [s]), n?.styles ? n.styles.push(s) : n.styles = [s];
|
|
251
|
+
}), this.classes.set(e, n);
|
|
252
|
+
}
|
|
253
|
+
getClasses() {
|
|
254
|
+
return this.classes;
|
|
255
|
+
}
|
|
256
|
+
getStylesForClass(e) {
|
|
257
|
+
return this.classes.get(e)?.styles ?? [];
|
|
258
|
+
}
|
|
259
|
+
clear() {
|
|
260
|
+
Ae(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
function oe(e) {
|
|
264
|
+
if (!e.length)
|
|
265
|
+
return [];
|
|
266
|
+
const a = [], n = [];
|
|
267
|
+
return e.forEach((l) => {
|
|
268
|
+
const s = {
|
|
269
|
+
name: l.name,
|
|
270
|
+
children: l.type === "Leaf" ? void 0 : []
|
|
271
|
+
};
|
|
272
|
+
for (s.classSelector = l?.classSelector, l?.cssCompiledStyles && (s.cssCompiledStyles = l.cssCompiledStyles), l.type === "Leaf" && l.value !== void 0 && (s.value = l.value); n.length > 0 && n[n.length - 1].level >= l.level; )
|
|
273
|
+
n.pop();
|
|
274
|
+
if (n.length === 0)
|
|
275
|
+
a.push(s);
|
|
276
|
+
else {
|
|
277
|
+
const o = n[n.length - 1].node;
|
|
278
|
+
o.children ? o.children.push(s) : o.children = [s];
|
|
279
|
+
}
|
|
280
|
+
l.type !== "Leaf" && n.push({ node: s, level: l.level });
|
|
281
|
+
}), a;
|
|
282
|
+
}
|
|
283
|
+
w(oe, "buildHierarchy");
|
|
284
|
+
var lt = /* @__PURE__ */ w((e, a) => {
|
|
285
|
+
me(e, a);
|
|
286
|
+
const n = [];
|
|
287
|
+
for (const o of e.TreemapRows ?? [])
|
|
288
|
+
o.$type === "ClassDefStatement" && a.addClass(o.className ?? "", o.styleText ?? "");
|
|
289
|
+
for (const o of e.TreemapRows ?? []) {
|
|
290
|
+
const h = o.item;
|
|
291
|
+
if (!h)
|
|
292
|
+
continue;
|
|
293
|
+
const d = o.indent ? parseInt(o.indent) : 0, g = st(h), c = h.classSelector ? a.getStylesForClass(h.classSelector) : [], u = c.length > 0 ? c : void 0, b = {
|
|
294
|
+
level: d,
|
|
295
|
+
name: g,
|
|
296
|
+
type: h.$type,
|
|
297
|
+
value: h.value,
|
|
298
|
+
classSelector: h.classSelector,
|
|
299
|
+
cssCompiledStyles: u
|
|
300
|
+
};
|
|
301
|
+
n.push(b);
|
|
302
|
+
}
|
|
303
|
+
const l = oe(n), s = /* @__PURE__ */ w((o, h) => {
|
|
304
|
+
for (const d of o)
|
|
305
|
+
a.addNode(d, h), d.children && d.children.length > 0 && s(d.children, h + 1);
|
|
306
|
+
}, "addNodesRecursively");
|
|
307
|
+
s(l, 0);
|
|
308
|
+
}, "populate"), st = /* @__PURE__ */ w((e) => e.name ? String(e.name) : "", "getItemName"), ce = {
|
|
309
|
+
// @ts-expect-error - TreeMapDB is not assignable to DiagramDB
|
|
310
|
+
parser: { yy: void 0 },
|
|
311
|
+
parse: /* @__PURE__ */ w(async (e) => {
|
|
312
|
+
try {
|
|
313
|
+
const n = await Ne("treemap", e);
|
|
314
|
+
ee.debug("Treemap AST:", n);
|
|
315
|
+
const l = ce.parser?.yy;
|
|
316
|
+
if (!(l instanceof ie))
|
|
317
|
+
throw new Error(
|
|
318
|
+
"parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
|
|
319
|
+
);
|
|
320
|
+
lt(n, l);
|
|
321
|
+
} catch (a) {
|
|
322
|
+
throw ee.error("Error parsing treemap:", a), a;
|
|
323
|
+
}
|
|
324
|
+
}, "parse")
|
|
325
|
+
}, rt = 10, R = 10, G = 25, it = /* @__PURE__ */ w((e, a, n, l) => {
|
|
326
|
+
const s = l.db, o = s.getConfig(), h = o.padding ?? rt, d = s.getDiagramTitle(), g = s.getRoot(), { themeVariables: c } = te();
|
|
327
|
+
if (!g)
|
|
328
|
+
return;
|
|
329
|
+
const u = d ? 30 : 0, b = ye(a), r = o.nodeWidth ? o.nodeWidth * R : 960, x = o.nodeHeight ? o.nodeHeight * R : 500, S = r, v = x + u;
|
|
330
|
+
b.attr("viewBox", `0 0 ${S} ${v}`), Se(b, v, S, o.useMaxWidth);
|
|
331
|
+
let p;
|
|
332
|
+
try {
|
|
333
|
+
const t = o.valueFormat || ",";
|
|
334
|
+
if (t === "$0,0")
|
|
335
|
+
p = /* @__PURE__ */ w((i) => "$" + I(",")(i), "valueFormat");
|
|
336
|
+
else if (t.startsWith("$") && t.includes(",")) {
|
|
337
|
+
const i = /\.\d+/.exec(t), f = i ? i[0] : "";
|
|
338
|
+
p = /* @__PURE__ */ w((C) => "$" + I("," + f)(C), "valueFormat");
|
|
339
|
+
} else if (t.startsWith("$")) {
|
|
340
|
+
const i = t.substring(1);
|
|
341
|
+
p = /* @__PURE__ */ w((f) => "$" + I(i || "")(f), "valueFormat");
|
|
342
|
+
} else
|
|
343
|
+
p = I(t);
|
|
344
|
+
} catch (t) {
|
|
345
|
+
ee.error("Error creating format function:", t), p = I(",");
|
|
346
|
+
}
|
|
347
|
+
const y = J().range([
|
|
348
|
+
"transparent",
|
|
349
|
+
c.cScale0,
|
|
350
|
+
c.cScale1,
|
|
351
|
+
c.cScale2,
|
|
352
|
+
c.cScale3,
|
|
353
|
+
c.cScale4,
|
|
354
|
+
c.cScale5,
|
|
355
|
+
c.cScale6,
|
|
356
|
+
c.cScale7,
|
|
357
|
+
c.cScale8,
|
|
358
|
+
c.cScale9,
|
|
359
|
+
c.cScale10,
|
|
360
|
+
c.cScale11
|
|
361
|
+
]), N = J().range([
|
|
362
|
+
"transparent",
|
|
363
|
+
c.cScalePeer0,
|
|
364
|
+
c.cScalePeer1,
|
|
365
|
+
c.cScalePeer2,
|
|
366
|
+
c.cScalePeer3,
|
|
367
|
+
c.cScalePeer4,
|
|
368
|
+
c.cScalePeer5,
|
|
369
|
+
c.cScalePeer6,
|
|
370
|
+
c.cScalePeer7,
|
|
371
|
+
c.cScalePeer8,
|
|
372
|
+
c.cScalePeer9,
|
|
373
|
+
c.cScalePeer10,
|
|
374
|
+
c.cScalePeer11
|
|
375
|
+
]), $ = J().range([
|
|
376
|
+
c.cScaleLabel0,
|
|
377
|
+
c.cScaleLabel1,
|
|
378
|
+
c.cScaleLabel2,
|
|
379
|
+
c.cScaleLabel3,
|
|
380
|
+
c.cScaleLabel4,
|
|
381
|
+
c.cScaleLabel5,
|
|
382
|
+
c.cScaleLabel6,
|
|
383
|
+
c.cScaleLabel7,
|
|
384
|
+
c.cScaleLabel8,
|
|
385
|
+
c.cScaleLabel9,
|
|
386
|
+
c.cScaleLabel10,
|
|
387
|
+
c.cScaleLabel11
|
|
388
|
+
]);
|
|
389
|
+
d && b.append("text").attr("x", S / 2).attr("y", u / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(d);
|
|
390
|
+
const V = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), E = ae(g).sum((t) => t.value ?? 0).sort((t, i) => (i.value ?? 0) - (t.value ?? 0)), ne = nt().size([r, x]).paddingTop(
|
|
391
|
+
(t) => t.children && t.children.length > 0 ? G + R : 0
|
|
392
|
+
).paddingInner(h).paddingLeft((t) => t.children && t.children.length > 0 ? R : 0).paddingRight((t) => t.children && t.children.length > 0 ? R : 0).paddingBottom((t) => t.children && t.children.length > 0 ? R : 0).round(!0)(E), he = ne.descendants().filter((t) => t.children && t.children.length > 0), W = V.selectAll(".treemapSection").data(he).enter().append("g").attr("class", "treemapSection").attr("transform", (t) => `translate(${t.x0},${t.y0})`);
|
|
393
|
+
W.append("rect").attr("width", (t) => t.x1 - t.x0).attr("height", G).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (t) => t.depth === 0 ? "display: none;" : ""), W.append("clipPath").attr("id", (t, i) => `clip-section-${a}-${i}`).append("rect").attr("width", (t) => Math.max(0, t.x1 - t.x0 - 12)).attr("height", G), W.append("rect").attr("width", (t) => t.x1 - t.x0).attr("height", (t) => t.y1 - t.y0).attr("class", (t, i) => `treemapSection section${i}`).attr("fill", (t) => y(t.data.name)).attr("fill-opacity", 0.6).attr("stroke", (t) => N(t.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (t) => {
|
|
394
|
+
if (t.depth === 0)
|
|
395
|
+
return "display: none;";
|
|
396
|
+
const i = B({ cssCompiledStyles: t.data.cssCompiledStyles });
|
|
397
|
+
return i.nodeStyles + ";" + i.borderStyles.join(";");
|
|
398
|
+
}), W.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", G / 2).attr("dominant-baseline", "middle").text((t) => t.depth === 0 ? "" : t.data.name).attr("font-weight", "bold").attr("clip-path", (t, i) => `url(#clip-section-${a}-${i})`).attr("style", (t) => {
|
|
399
|
+
if (t.depth === 0)
|
|
400
|
+
return "display: none;";
|
|
401
|
+
const i = "dominant-baseline: middle; font-size: 12px; fill:" + $(t.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = B({ cssCompiledStyles: t.data.cssCompiledStyles });
|
|
402
|
+
return i + f.labelStyles.replace("color:", "fill:");
|
|
403
|
+
}).each(function(t) {
|
|
404
|
+
if (t.depth === 0)
|
|
405
|
+
return;
|
|
406
|
+
const i = j(this), f = t.data.name;
|
|
407
|
+
i.text(f);
|
|
408
|
+
const C = t.x1 - t.x0, L = 6;
|
|
409
|
+
let T;
|
|
410
|
+
o.showValues !== !1 && t.value ? T = C - 10 - 30 - 10 - L : T = C - L - 6;
|
|
411
|
+
const m = Math.max(15, T), _ = i.node();
|
|
412
|
+
if (_.getComputedTextLength() > m) {
|
|
413
|
+
let z = f;
|
|
414
|
+
for (; z.length > 0; ) {
|
|
415
|
+
if (z = f.substring(0, z.length - 1), z.length === 0) {
|
|
416
|
+
i.text("..."), _.getComputedTextLength() > m && i.text("");
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
if (i.text(z + "..."), _.getComputedTextLength() <= m)
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}), o.showValues !== !1 && W.append("text").attr("class", "treemapSectionValue").attr("x", (t) => t.x1 - t.x0 - 10).attr("y", G / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((t) => t.value ? p(t.value) : "").attr("font-style", "italic").attr("style", (t) => {
|
|
424
|
+
if (t.depth === 0)
|
|
425
|
+
return "display: none;";
|
|
426
|
+
const i = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + $(t.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = B({ cssCompiledStyles: t.data.cssCompiledStyles });
|
|
427
|
+
return i + f.labelStyles.replace("color:", "fill:");
|
|
428
|
+
});
|
|
429
|
+
const le = ne.leaves(), A = le.length > 20, de = A ? 16 : 38, X = A ? 14 : 28, D = A ? 4 : 8, H = A ? 4 : 6, U = A ? 2 : 4, se = A ? 8 : 10, Z = A ? 1 : 2, Y = V.selectAll(".treemapLeafGroup").data(le).enter().append("g").attr("class", (t, i) => `treemapNode treemapLeafGroup leaf${i}${t.data.classSelector ? ` ${t.data.classSelector}` : ""}x`).attr("transform", (t) => `translate(${t.x0},${t.y0})`);
|
|
430
|
+
Y.append("rect").attr("width", (t) => t.x1 - t.x0).attr("height", (t) => t.y1 - t.y0).attr("class", "treemapLeaf").attr("fill", (t) => t.parent ? y(t.parent.data.name) : y(t.data.name)).attr("style", (t) => B({ cssCompiledStyles: t.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (t) => t.parent ? y(t.parent.data.name) : y(t.data.name)).attr("stroke-width", 3), Y.append("clipPath").attr("id", (t, i) => `clip-${a}-${i}`).append("rect").attr("width", (t) => Math.max(0, t.x1 - t.x0 - 4)).attr("height", (t) => Math.max(0, t.y1 - t.y0 - 4)), Y.append("text").attr("class", "treemapLabel").attr("x", (t) => (t.x1 - t.x0) / 2).attr("y", (t) => (t.y1 - t.y0) / 2).attr("style", (t) => {
|
|
431
|
+
const i = `text-anchor: middle; dominant-baseline: middle; font-size: ${de}px;fill:` + $(t.data.name) + ";", f = B({ cssCompiledStyles: t.data.cssCompiledStyles });
|
|
432
|
+
return i + f.labelStyles.replace("color:", "fill:");
|
|
433
|
+
}).attr("clip-path", (t, i) => `url(#clip-${a}-${i})`).text((t) => t.data.name).each(function(t) {
|
|
434
|
+
const i = j(this), f = t.x1 - t.x0, C = t.y1 - t.y0, L = i.node(), T = f - 2 * U, P = C - 2 * U;
|
|
435
|
+
if (T < se || P < se) {
|
|
436
|
+
i.style("display", "none");
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
let m = parseInt(i.style("font-size"), 10);
|
|
440
|
+
const _ = 0.6;
|
|
441
|
+
for (; L.getComputedTextLength() > T && m > D; )
|
|
442
|
+
m--, i.style("font-size", `${m}px`);
|
|
443
|
+
let F = Math.max(
|
|
444
|
+
H,
|
|
445
|
+
Math.min(X, Math.round(m * _))
|
|
446
|
+
), k = m + Z + F;
|
|
447
|
+
for (; k > P && m > D && (m--, F = Math.max(
|
|
448
|
+
H,
|
|
449
|
+
Math.min(X, Math.round(m * _))
|
|
450
|
+
), !(F < H && m === D)); )
|
|
451
|
+
i.style("font-size", `${m}px`), k = m + Z + F;
|
|
452
|
+
i.style("font-size", `${m}px`), A ? (m < D || P < D) && i.style("display", "none") : (L.getComputedTextLength() > T || m < D || P < m) && i.style("display", "none");
|
|
453
|
+
}), o.showValues !== !1 && Y.append("text").attr("class", "treemapValue").attr("x", (i) => (i.x1 - i.x0) / 2).attr("y", function(i) {
|
|
454
|
+
return (i.y1 - i.y0) / 2;
|
|
455
|
+
}).attr("style", (i) => {
|
|
456
|
+
const f = `text-anchor: middle; dominant-baseline: hanging; font-size: ${X}px;fill:` + $(i.data.name) + ";", C = B({ cssCompiledStyles: i.data.cssCompiledStyles });
|
|
457
|
+
return f + C.labelStyles.replace("color:", "fill:");
|
|
458
|
+
}).attr("clip-path", (i, f) => `url(#clip-${a}-${f})`).text((i) => i.value ? p(i.value) : "").each(function(i) {
|
|
459
|
+
const f = j(this), C = this.parentNode;
|
|
460
|
+
if (!C) {
|
|
461
|
+
f.style("display", "none");
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const L = j(C).select(".treemapLabel");
|
|
465
|
+
if (L.empty() || L.style("display") === "none") {
|
|
466
|
+
f.style("display", "none");
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const T = parseFloat(L.style("font-size")), m = Math.max(
|
|
470
|
+
H,
|
|
471
|
+
Math.min(X, Math.round(T * 0.6))
|
|
472
|
+
);
|
|
473
|
+
f.style("font-size", `${m}px`);
|
|
474
|
+
const F = (i.y1 - i.y0) / 2 + T / 2 + Z;
|
|
475
|
+
f.attr("y", F);
|
|
476
|
+
const k = i.x1 - i.x0, re = i.y1 - i.y0 - 4, fe = k - 2 * U;
|
|
477
|
+
f.node().getComputedTextLength() > fe || F + m > re || m < H ? f.style("display", "none") : f.style("display", null);
|
|
478
|
+
});
|
|
479
|
+
const ue = o.diagramPadding ?? 8;
|
|
480
|
+
Fe(b, ue, "flowchart", o?.useMaxWidth || !1);
|
|
481
|
+
}, "draw"), ot = /* @__PURE__ */ w(function(e, a) {
|
|
482
|
+
return a.db.getClasses();
|
|
483
|
+
}, "getClasses"), ct = { draw: it, getClasses: ot }, ht = {
|
|
484
|
+
sectionStrokeColor: "black",
|
|
485
|
+
sectionStrokeWidth: "1",
|
|
486
|
+
sectionFillColor: "#efefef",
|
|
487
|
+
leafStrokeColor: "black",
|
|
488
|
+
leafStrokeWidth: "1",
|
|
489
|
+
leafFillColor: "#efefef",
|
|
490
|
+
labelFontSize: "12px",
|
|
491
|
+
valueFontSize: "10px",
|
|
492
|
+
titleFontSize: "14px"
|
|
493
|
+
}, dt = /* @__PURE__ */ w(({
|
|
494
|
+
treemap: e
|
|
495
|
+
} = {}) => {
|
|
496
|
+
const a = ge(), n = te(), l = K(a, n.themeVariables), s = K(ht, e), o = s.titleColor ?? l.titleColor, h = s.labelColor ?? l.textColor, d = s.valueColor ?? l.textColor;
|
|
497
|
+
return `
|
|
498
|
+
.treemapNode.section {
|
|
499
|
+
stroke: ${s.sectionStrokeColor};
|
|
500
|
+
stroke-width: ${s.sectionStrokeWidth};
|
|
501
|
+
fill: ${s.sectionFillColor};
|
|
502
|
+
}
|
|
503
|
+
.treemapNode.leaf {
|
|
504
|
+
stroke: ${s.leafStrokeColor};
|
|
505
|
+
stroke-width: ${s.leafStrokeWidth};
|
|
506
|
+
fill: ${s.leafFillColor};
|
|
507
|
+
}
|
|
508
|
+
.treemapLabel {
|
|
509
|
+
fill: ${h};
|
|
510
|
+
font-size: ${s.labelFontSize};
|
|
511
|
+
}
|
|
512
|
+
.treemapValue {
|
|
513
|
+
fill: ${d};
|
|
514
|
+
font-size: ${s.valueFontSize};
|
|
515
|
+
}
|
|
516
|
+
.treemapTitle {
|
|
517
|
+
fill: ${o};
|
|
518
|
+
font-size: ${s.titleFontSize};
|
|
519
|
+
}
|
|
520
|
+
`;
|
|
521
|
+
}, "getStyles"), ut = dt, xt = {
|
|
522
|
+
parser: ce,
|
|
523
|
+
get db() {
|
|
524
|
+
return new ie();
|
|
525
|
+
},
|
|
526
|
+
renderer: ct,
|
|
527
|
+
styles: ut
|
|
528
|
+
};
|
|
529
|
+
export {
|
|
530
|
+
xt as diagram
|
|
531
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { p as T } from "./chunk-JWPE2WC7-CnAFS2xF.js";
|
|
2
|
+
import { _ as f, N as y, Q as z, d as A, l as B, b as E, a as F, q as P, t as W, g as _, s as N, L, O as M, A as O } from "./mermaid.core-DXv6D2Sm.js";
|
|
3
|
+
import { p as Y } from "./cynefin-EF2NZ3EQ-Bt6b88hY.js";
|
|
4
|
+
var I = M.packet, $ = class {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.packet = [], this.setAccTitle = E, this.getAccTitle = F, this.setDiagramTitle = P, this.getDiagramTitle = W, this.getAccDescription = _, this.setAccDescription = N;
|
|
7
|
+
}
|
|
8
|
+
static {
|
|
9
|
+
f(this, "PacketDB");
|
|
10
|
+
}
|
|
11
|
+
getConfig() {
|
|
12
|
+
const t = y({
|
|
13
|
+
...I,
|
|
14
|
+
...L().packet
|
|
15
|
+
});
|
|
16
|
+
return t.showBits && (t.paddingY += 10), t;
|
|
17
|
+
}
|
|
18
|
+
getPacket() {
|
|
19
|
+
return this.packet;
|
|
20
|
+
}
|
|
21
|
+
pushWord(t) {
|
|
22
|
+
t.length > 0 && this.packet.push(t);
|
|
23
|
+
}
|
|
24
|
+
clear() {
|
|
25
|
+
O(), this.packet = [];
|
|
26
|
+
}
|
|
27
|
+
}, j = 1e4, q = /* @__PURE__ */ f((t, e) => {
|
|
28
|
+
T(t, e);
|
|
29
|
+
let r = -1, s = [], i = 1;
|
|
30
|
+
const { bitsPerRow: l } = e.getConfig();
|
|
31
|
+
for (let { start: a, end: o, bits: d, label: g } of t.blocks) {
|
|
32
|
+
if (a !== void 0 && o !== void 0 && o < a)
|
|
33
|
+
throw new Error(`Packet block ${a} - ${o} is invalid. End must be greater than start.`);
|
|
34
|
+
if (a ??= r + 1, a !== r + 1)
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Packet block ${a} - ${o ?? a} is not contiguous. It should start from ${r + 1}.`
|
|
37
|
+
);
|
|
38
|
+
if (d === 0)
|
|
39
|
+
throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);
|
|
40
|
+
for (o ??= a + (d ?? 1) - 1, d ??= o - a + 1, r = o, B.debug(`Packet block ${a} - ${r} with label ${g}`); s.length <= l + 1 && e.getPacket().length < j; ) {
|
|
41
|
+
const [c, p] = G({ start: a, end: o, bits: d, label: g }, i, l);
|
|
42
|
+
if (s.push(c), c.end + 1 === i * l && (e.pushWord(s), s = [], i++), !p)
|
|
43
|
+
break;
|
|
44
|
+
({ start: a, end: o, bits: d, label: g } = p);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
e.pushWord(s);
|
|
48
|
+
}, "populate"), G = /* @__PURE__ */ f((t, e, r) => {
|
|
49
|
+
if (t.start === void 0)
|
|
50
|
+
throw new Error("start should have been set during first phase");
|
|
51
|
+
if (t.end === void 0)
|
|
52
|
+
throw new Error("end should have been set during first phase");
|
|
53
|
+
if (t.start > t.end)
|
|
54
|
+
throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);
|
|
55
|
+
if (t.end + 1 <= e * r)
|
|
56
|
+
return [t, void 0];
|
|
57
|
+
const s = e * r - 1, i = e * r;
|
|
58
|
+
return [
|
|
59
|
+
{
|
|
60
|
+
start: t.start,
|
|
61
|
+
end: s,
|
|
62
|
+
label: t.label,
|
|
63
|
+
bits: s - t.start
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
start: i,
|
|
67
|
+
end: t.end,
|
|
68
|
+
label: t.label,
|
|
69
|
+
bits: t.end - i
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
}, "getNextFittingBlock"), C = {
|
|
73
|
+
// @ts-expect-error - PacketDB is not assignable to DiagramDB
|
|
74
|
+
parser: { yy: void 0 },
|
|
75
|
+
parse: /* @__PURE__ */ f(async (t) => {
|
|
76
|
+
const e = await Y("packet", t), r = C.parser?.yy;
|
|
77
|
+
if (!(r instanceof $))
|
|
78
|
+
throw new Error(
|
|
79
|
+
"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."
|
|
80
|
+
);
|
|
81
|
+
B.debug(e), q(e, r);
|
|
82
|
+
}, "parse")
|
|
83
|
+
}, H = /* @__PURE__ */ f((t, e, r, s) => {
|
|
84
|
+
const i = s.db, l = i.getConfig(), { rowHeight: a, paddingY: o, bitWidth: d, bitsPerRow: g } = l, c = i.getPacket(), p = i.getDiagramTitle(), b = a + o, n = b * (c.length + 1) - (p ? 0 : a), h = d * g + 2, k = z(e);
|
|
85
|
+
k.attr("viewBox", `0 0 ${h} ${n}`), A(k, n, h, l.useMaxWidth);
|
|
86
|
+
for (const [v, u] of c.entries())
|
|
87
|
+
K(k, u, v, l);
|
|
88
|
+
k.append("text").text(p).attr("x", h / 2).attr("y", n - b / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
|
|
89
|
+
}, "draw"), K = /* @__PURE__ */ f((t, e, r, {
|
|
90
|
+
rowHeight: s,
|
|
91
|
+
paddingX: i,
|
|
92
|
+
paddingY: l,
|
|
93
|
+
bitWidth: a,
|
|
94
|
+
bitsPerRow: o,
|
|
95
|
+
showBits: d,
|
|
96
|
+
bitOrder: g
|
|
97
|
+
}) => {
|
|
98
|
+
const c = t.append("g"), p = r * (s + l) + l, b = g === "descending";
|
|
99
|
+
for (const n of e) {
|
|
100
|
+
const h = n.end - n.start + 1, k = n.start % o, u = (b ? o - k - h : k) * a + 1, m = h * a - i;
|
|
101
|
+
if (c.append("rect").attr("x", u).attr("y", p).attr("width", m).attr("height", s).attr("class", "packetBlock"), c.append("text").attr("x", u + m / 2).attr("y", p + s / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(n.label), !d)
|
|
102
|
+
continue;
|
|
103
|
+
const [S, D] = b ? [n.end, n.start] : [n.start, n.end], w = h === 1, x = p - 2;
|
|
104
|
+
c.append("text").attr("x", u + (w ? m / 2 : 0)).attr("y", x).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", w ? "middle" : "start").text(S), w || c.append("text").attr("x", u + m).attr("y", x).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(D);
|
|
105
|
+
}
|
|
106
|
+
}, "drawWord"), Q = { draw: H }, U = {
|
|
107
|
+
byteFontSize: "10px",
|
|
108
|
+
startByteColor: "black",
|
|
109
|
+
endByteColor: "black",
|
|
110
|
+
labelColor: "black",
|
|
111
|
+
labelFontSize: "12px",
|
|
112
|
+
titleColor: "black",
|
|
113
|
+
titleFontSize: "14px",
|
|
114
|
+
blockStrokeColor: "black",
|
|
115
|
+
blockStrokeWidth: "1",
|
|
116
|
+
blockFillColor: "#efefef"
|
|
117
|
+
}, X = /* @__PURE__ */ f(({ packet: t } = {}) => {
|
|
118
|
+
const e = y(U, t);
|
|
119
|
+
return `
|
|
120
|
+
.packetByte {
|
|
121
|
+
font-size: ${e.byteFontSize};
|
|
122
|
+
}
|
|
123
|
+
.packetByte.start {
|
|
124
|
+
fill: ${e.startByteColor};
|
|
125
|
+
}
|
|
126
|
+
.packetByte.end {
|
|
127
|
+
fill: ${e.endByteColor};
|
|
128
|
+
}
|
|
129
|
+
.packetLabel {
|
|
130
|
+
fill: ${e.labelColor};
|
|
131
|
+
font-size: ${e.labelFontSize};
|
|
132
|
+
}
|
|
133
|
+
.packetTitle {
|
|
134
|
+
fill: ${e.titleColor};
|
|
135
|
+
font-size: ${e.titleFontSize};
|
|
136
|
+
}
|
|
137
|
+
.packetBlock {
|
|
138
|
+
stroke: ${e.blockStrokeColor};
|
|
139
|
+
stroke-width: ${e.blockStrokeWidth};
|
|
140
|
+
fill: ${e.blockFillColor};
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
}, "styles"), Z = {
|
|
144
|
+
parser: C,
|
|
145
|
+
get db() {
|
|
146
|
+
return new $();
|
|
147
|
+
},
|
|
148
|
+
renderer: Q,
|
|
149
|
+
styles: X
|
|
150
|
+
};
|
|
151
|
+
export {
|
|
152
|
+
Z as diagram
|
|
153
|
+
};
|