@diagrammo/dgmo 0.46.0 → 0.47.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/dist/advanced.d.cts +3 -855
- package/dist/advanced.d.ts +3 -855
- package/dist/advanced.js +541 -70107
- package/dist/analyzer-UYKBXAKR.js +15 -0
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/auto.mjs +1 -1
- package/dist/block.js +83 -69417
- package/dist/calculator-LDYQCDDY.js +11 -0
- package/dist/charts-d3-QOZHKTCT.js +25 -0
- package/dist/chunk-2DXMZRWJ.js +800 -0
- package/dist/chunk-2LACINWN.js +786 -0
- package/dist/chunk-33LCUH4H.js +893 -0
- package/dist/chunk-3CIOJ5YJ.js +35 -0
- package/dist/chunk-3HDBAXF5.js +86 -0
- package/dist/chunk-3JLKYGBQ.js +290 -0
- package/dist/chunk-3MQQNXPD.js +415 -0
- package/dist/chunk-3R5POCTZ.js +967 -0
- package/dist/chunk-3SMGIJDD.js +112 -0
- package/dist/chunk-44CM72SQ.js +409 -0
- package/dist/chunk-4GRI7MEB.js +1604 -0
- package/dist/chunk-4OHACBGX.js +606 -0
- package/dist/chunk-5DH3KYFH.js +21 -0
- package/dist/chunk-5MLYVTYM.js +76 -0
- package/dist/chunk-5QXL4NYS.js +553 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6EK55ART.js +117 -0
- package/dist/chunk-6FZYCKXB.js +2065 -0
- package/dist/chunk-6HO5ZTXK.js +277 -0
- package/dist/chunk-6KFWC4CO.js +7 -0
- package/dist/chunk-6MTWIQVO.js +121 -0
- package/dist/chunk-6NYWYNBI.js +329 -0
- package/dist/chunk-6SM5NJQH.js +620 -0
- package/dist/chunk-725LDASD.js +422 -0
- package/dist/chunk-76OWZ3BA.js +130 -0
- package/dist/chunk-7JEGTRLD.js +338 -0
- package/dist/chunk-A44USUV7.js +923 -0
- package/dist/chunk-A4GOY3PE.js +25 -0
- package/dist/chunk-A4VFQH5G.js +251 -0
- package/dist/chunk-AELOBFW5.js +375 -0
- package/dist/chunk-AN2MOO5T.js +522 -0
- package/dist/chunk-BMR4CIEO.js +41 -0
- package/dist/chunk-BS7SV7C3.js +51 -0
- package/dist/chunk-BUPDIHML.js +613 -0
- package/dist/chunk-BUVJFRPY.js +887 -0
- package/dist/chunk-C3Z4DX3V.js +112 -0
- package/dist/chunk-CI2G3OEB.js +1818 -0
- package/dist/chunk-CKNVO24D.js +54 -0
- package/dist/chunk-CUVHQHZ7.js +391 -0
- package/dist/chunk-CXK4DZH3.js +114 -0
- package/dist/chunk-DKEPS5LH.js +315 -0
- package/dist/chunk-DU7W62N5.js +487 -0
- package/dist/chunk-DZAQBW35.js +751 -0
- package/dist/chunk-EB6FPQUP.js +316 -0
- package/dist/chunk-EMS2SK26.js +376 -0
- package/dist/chunk-ERLBPDGU.js +510 -0
- package/dist/chunk-EVCVDTXE.js +732 -0
- package/dist/chunk-FCIIHT24.js +384 -0
- package/dist/chunk-FFUN5D66.js +97 -0
- package/dist/chunk-FITOLXSX.js +714 -0
- package/dist/chunk-FMDSF3OV.js +68 -0
- package/dist/chunk-FNB3PNGF.js +410 -0
- package/dist/chunk-G2H74XJZ.js +2104 -0
- package/dist/chunk-GMR5MFHJ.js +339 -0
- package/dist/chunk-H6PI3KJT.js +305 -0
- package/dist/chunk-I46X5VUA.js +59 -0
- package/dist/chunk-I5IGB56C.js +255 -0
- package/dist/chunk-IH6ZMVQ5.js +3950 -0
- package/dist/chunk-IJZFN3HM.js +463 -0
- package/dist/chunk-IPWPWM6R.js +3079 -0
- package/dist/chunk-IYULMRBE.js +23 -0
- package/dist/chunk-IZMRON6C.js +167 -0
- package/dist/chunk-J5FIXQRT.js +813 -0
- package/dist/chunk-JED6ZDEE.js +73 -0
- package/dist/chunk-JEUJOX5X.js +136 -0
- package/dist/chunk-JM4LEPY3.js +436 -0
- package/dist/chunk-L3UHP6TD.js +101 -0
- package/dist/chunk-L66GEFB6.js +524 -0
- package/dist/chunk-LIOHW36Z.js +469 -0
- package/dist/chunk-LP7EC4MI.js +16 -0
- package/dist/chunk-MITI6NOL.js +548 -0
- package/dist/chunk-MO5YHHMQ.js +168 -0
- package/dist/chunk-MZSBFAPJ.js +885 -0
- package/dist/chunk-NNAAJVBU.js +9 -0
- package/dist/chunk-NOTA6TEI.js +47 -0
- package/dist/chunk-NURGB5Z4.js +335 -0
- package/dist/chunk-NX4EQS3U.js +1062 -0
- package/dist/chunk-NXMESY4J.js +1 -0
- package/dist/chunk-OJR3MQYV.js +1458 -0
- package/dist/chunk-OURHMODR.js +454 -0
- package/dist/chunk-P235SVAH.js +1057 -0
- package/dist/chunk-P4RH4OSP.js +1038 -0
- package/dist/chunk-P6T66CCZ.js +226 -0
- package/dist/chunk-PBAHEPLQ.js +223 -0
- package/dist/chunk-PBHE5UG6.js +1530 -0
- package/dist/chunk-PDKUANDZ.js +35 -0
- package/dist/chunk-PWIHZ6NJ.js +296 -0
- package/dist/chunk-QEBUY5NY.js +1685 -0
- package/dist/chunk-QLCCJEJI.js +253 -0
- package/dist/chunk-QOOUC2J5.js +52 -0
- package/dist/chunk-QYTPPDAO.js +402 -0
- package/dist/chunk-R3XI2VC7.js +801 -0
- package/dist/chunk-RCERWOJR.js +154 -0
- package/dist/chunk-RJE5JTVK.js +362 -0
- package/dist/chunk-RTLBSQ3G.js +1155 -0
- package/dist/chunk-RUNNI6VE.js +448 -0
- package/dist/chunk-RVMRZAPB.js +354 -0
- package/dist/chunk-RYEGFMUO.js +955 -0
- package/dist/chunk-RZCF2VVM.js +528 -0
- package/dist/chunk-SML67VPV.js +1025 -0
- package/dist/chunk-SQ7IY53Q.js +44 -0
- package/dist/chunk-SQAG3UXH.js +161 -0
- package/dist/chunk-SRTU6HMQ.js +1851 -0
- package/dist/chunk-T2OE3YQB.js +550 -0
- package/dist/chunk-T3UBLACL.js +299 -0
- package/dist/chunk-TLVIHFRO.js +296 -0
- package/dist/chunk-TYS6CSS5.js +52 -0
- package/dist/chunk-U6EQI3U6.js +130 -0
- package/dist/chunk-UJ4FJLBF.js +86 -0
- package/dist/chunk-ULOEATBZ.js +347 -0
- package/dist/chunk-UNCCZ3NU.js +127 -0
- package/dist/chunk-USZW2HHU.js +197 -0
- package/dist/chunk-UWN33VNX.js +1610 -0
- package/dist/chunk-UZ7EZW3B.js +40 -0
- package/dist/chunk-VOKGH627.js +37 -0
- package/dist/chunk-WBRZJOEC.js +204 -0
- package/dist/chunk-WCSOJFU3.js +380 -0
- package/dist/chunk-WCT3NYCV.js +160 -0
- package/dist/chunk-WVAJFAIA.js +529 -0
- package/dist/chunk-X5LCYCL5.js +394 -0
- package/dist/chunk-XAKEUMEJ.js +1256 -0
- package/dist/chunk-Y2ZE3MSG.js +590 -0
- package/dist/chunk-Y3J7VR52.js +646 -0
- package/dist/chunk-Y5QGVTVC.js +33 -0
- package/dist/chunk-YAA6IID3.js +548 -0
- package/dist/chunk-YGJTDXVR.js +692 -0
- package/dist/chunk-YRYKTYMQ.js +186 -0
- package/dist/chunk-YYVTBZZC.js +61 -0
- package/dist/chunk-Z5CGSFJB.js +647 -0
- package/dist/chunk-Z72XRXD4.js +787 -0
- package/dist/chunk-ZGR7ULFJ.js +978 -0
- package/dist/chunk-ZJEL4H2R.js +851 -0
- package/dist/chunk-ZO27FGJS.js +554 -0
- package/dist/collapse-CLPJD2RL.js +11 -0
- package/dist/collapse-SLINJQW6.js +9 -0
- package/dist/collapse-ZWUFFCK2.js +9 -0
- package/dist/compute-G55RG53N.js +8 -0
- package/dist/dgmo-router-DZCIDUO5.js +73 -0
- package/dist/dimensions-J3FHIMJ6.js +22 -0
- package/dist/element.cjs +1 -1
- package/dist/element.js +1 -1
- package/dist/element.mjs +1 -1
- package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
- package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -469
- package/dist/index.d.ts +3 -469
- package/dist/index.js +137 -69685
- package/dist/layout-46N4JJYK.js +17 -0
- package/dist/layout-5RA6QWR6.js +26 -0
- package/dist/layout-5T6RH5M6.js +14 -0
- package/dist/layout-7QXCNOVS.js +13 -0
- package/dist/layout-EE6GE46Y.js +17 -0
- package/dist/layout-G23F7LDH.js +9 -0
- package/dist/layout-HRBZPFCN.js +23 -0
- package/dist/layout-HWDSRX5E.js +20 -0
- package/dist/layout-HYZPWAK5.js +18 -0
- package/dist/layout-N76NR4ZO.js +19 -0
- package/dist/layout-OB3RI63S.js +14 -0
- package/dist/layout-S2QBYSK2.js +15 -0
- package/dist/layout-UM5F4DJB.js +15 -0
- package/dist/layout-search-OYV77HHS.js +1655 -0
- package/dist/load-data-EHDDZ5ZS.js +8 -0
- package/dist/palettes-PRJ2RI6D.js +56 -0
- package/dist/parser-2MFP2H2E.js +11 -0
- package/dist/parser-3STE62GB.js +21 -0
- package/dist/parser-4FL2CMDG.js +18 -0
- package/dist/parser-4OGOBJJ4.js +13 -0
- package/dist/parser-6BTRLKRZ.js +15 -0
- package/dist/parser-AQETEVRW.js +21 -0
- package/dist/parser-CFZD5IBL.js +12 -0
- package/dist/parser-FUSKFGZN.js +16 -0
- package/dist/parser-I6KXEYFK.js +13 -0
- package/dist/parser-IXSZZQHY.js +18 -0
- package/dist/parser-JAL2HD4I.js +13 -0
- package/dist/parser-KNSQSKQO.js +20 -0
- package/dist/parser-N5O4IHUN.js +13 -0
- package/dist/parser-NGU3ETO6.js +16 -0
- package/dist/parser-NRAI6O25.js +19 -0
- package/dist/parser-O5J4VBII.js +11 -0
- package/dist/parser-OV7NOBW6.js +21 -0
- package/dist/parser-PQ3POX45.js +23 -0
- package/dist/parser-TFZFBVWN.js +11 -0
- package/dist/parser-TRTHDFPP.js +18 -0
- package/dist/parser-VQP2UJ6W.js +11 -0
- package/dist/parser-XDVELHRK.js +13 -0
- package/dist/parser-XKRP7QKP.js +11 -0
- package/dist/parser-Y6WTBU76.js +14 -0
- package/dist/parser-ZSDPZYQP.js +12 -0
- package/dist/renderer-2XQQQ6QR.js +28 -0
- package/dist/renderer-5NDVNDAZ.js +26 -0
- package/dist/renderer-6EEZHMH4.js +26 -0
- package/dist/renderer-6W5462RB.js +43 -0
- package/dist/renderer-7MVLWWQD.js +22 -0
- package/dist/renderer-AWWAF6XD.js +33 -0
- package/dist/renderer-BYCNMBF7.js +34 -0
- package/dist/renderer-CLJHQPBJ.js +29 -0
- package/dist/renderer-GHPZMFU2.js +15 -0
- package/dist/renderer-JGBKUCZD.js +16 -0
- package/dist/renderer-KQB7UGDS.js +19 -0
- package/dist/renderer-PGX2TKVS.js +24 -0
- package/dist/renderer-QIWVHWZO.js +15 -0
- package/dist/renderer-RPOA5YPZ.js +35 -0
- package/dist/renderer-SMIBCRVB.js +24 -0
- package/dist/renderer-T7YKC5VP.js +28 -0
- package/dist/renderer-TOCOVLHS.js +37 -0
- package/dist/renderer-UWA5XS74.js +39 -0
- package/dist/renderer-VACVQYML.js +25 -0
- package/dist/renderer-W4M6QLIJ.js +37 -0
- package/dist/renderer-WZRREQ2P.js +23 -0
- package/dist/renderer-YY2OSF6E.js +27 -0
- package/dist/renderer-Z7I3W2PP.js +24 -0
- package/dist/renderer-ZGNTUWC4.js +22 -0
- package/dist/renderer-ZTR3DER3.js +19 -0
- package/dist/renderer-radial-C32GPJQ7.js +21 -0
- package/dist/resolver-NOAA7ID7.js +13 -0
- package/dist/state-collapse-HCGD6IVJ.js +8 -0
- package/dist/state-parser-Z2V23ATR.js +18 -0
- package/dist/state-renderer-RFYHSP4K.js +34 -0
- package/dist/themes-1-CuKpeH.d.cts +908 -0
- package/dist/themes-1-CuKpeH.d.ts +908 -0
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
collapseTree
|
|
3
|
+
} from "./chunk-BS7SV7C3.js";
|
|
4
|
+
|
|
5
|
+
// src/mindmap/collapse.ts
|
|
6
|
+
function cloneNode(node) {
|
|
7
|
+
return {
|
|
8
|
+
id: node.id,
|
|
9
|
+
label: node.label,
|
|
10
|
+
...node.description !== void 0 && {
|
|
11
|
+
description: [...node.description]
|
|
12
|
+
},
|
|
13
|
+
metadata: { ...node.metadata },
|
|
14
|
+
children: node.children.map(cloneNode),
|
|
15
|
+
parentId: node.parentId,
|
|
16
|
+
lineNumber: node.lineNumber,
|
|
17
|
+
...node.color !== void 0 && { color: node.color },
|
|
18
|
+
...node.collapsed !== void 0 && { collapsed: node.collapsed }
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var MINDMAP_SHAPE = {
|
|
22
|
+
getId: (node) => node.id,
|
|
23
|
+
getChildren: (node) => node.children,
|
|
24
|
+
clone: cloneNode,
|
|
25
|
+
setChildren: (node, children) => {
|
|
26
|
+
node.children = children;
|
|
27
|
+
},
|
|
28
|
+
countsAsHidden: () => true
|
|
29
|
+
};
|
|
30
|
+
function collapseMindmapTree(roots, collapsedIds) {
|
|
31
|
+
if (collapsedIds.size === 0) {
|
|
32
|
+
return { roots: [...roots], hiddenCounts: /* @__PURE__ */ new Map() };
|
|
33
|
+
}
|
|
34
|
+
return collapseTree(roots, collapsedIds, MINDMAP_SHAPE);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
collapseMindmapTree
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=chunk-UZ7EZW3B.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
measureText
|
|
3
|
+
} from "./chunk-WCT3NYCV.js";
|
|
4
|
+
|
|
5
|
+
// src/utils/card.ts
|
|
6
|
+
function renderNodeCard(container, opts) {
|
|
7
|
+
const rect = container.append("rect").attr("x", 0).attr("y", 0).attr("width", opts.width).attr("height", opts.height).attr("rx", opts.rx).attr("fill", opts.fill).attr("stroke", opts.stroke).attr("stroke-width", opts.strokeWidth);
|
|
8
|
+
if (opts.dashed) {
|
|
9
|
+
rect.attr("stroke-dasharray", "6 3");
|
|
10
|
+
}
|
|
11
|
+
container.append("text").attr("x", opts.width / 2).attr("y", opts.headerHeight / 2 + opts.labelFontSize / 2 - 2).attr("text-anchor", "middle").attr("fill", opts.labelColor).attr("font-size", opts.labelFontSize).attr("font-weight", "bold").text(opts.label);
|
|
12
|
+
const meta = opts.meta;
|
|
13
|
+
if (!meta || meta.rows.length === 0) return;
|
|
14
|
+
container.append("line").attr("x1", 0).attr("y1", opts.headerHeight).attr("x2", opts.width).attr("y2", opts.headerHeight).attr("stroke", meta.separatorColor).attr("stroke-opacity", 0.3).attr("stroke-width", 1);
|
|
15
|
+
const keyX = meta.keyX ?? 10;
|
|
16
|
+
const maxKeyWidth = Math.max(
|
|
17
|
+
...meta.rows.map(([key]) => measureText(`${key}: `, meta.fontSize))
|
|
18
|
+
);
|
|
19
|
+
const valueX = keyX + maxKeyWidth;
|
|
20
|
+
const metaStartY = opts.headerHeight + meta.separatorGap + meta.fontSize;
|
|
21
|
+
for (let i = 0; i < meta.rows.length; i++) {
|
|
22
|
+
const [displayKey, value] = meta.rows[i];
|
|
23
|
+
const rowY = metaStartY + i * meta.lineHeight;
|
|
24
|
+
container.append("text").attr("x", keyX).attr("y", rowY).attr("fill", meta.textColor).attr("font-size", meta.fontSize).text(`${displayKey}: `);
|
|
25
|
+
container.append("text").attr("x", valueX).attr("y", rowY).attr("fill", meta.textColor).attr("font-size", meta.fontSize).text(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function renderCollapseBar(container, opts) {
|
|
29
|
+
container.append("clipPath").attr("id", opts.clipId).append("rect").attr("width", opts.width).attr("height", opts.height).attr("rx", opts.rx);
|
|
30
|
+
container.append("rect").attr("x", opts.inset).attr("y", opts.height - opts.barHeight).attr("width", opts.width - opts.inset * 2).attr("height", opts.barHeight).attr("fill", opts.fill).attr("clip-path", `url(#${opts.clipId})`).attr("class", opts.className);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
renderNodeCard,
|
|
35
|
+
renderCollapseBar
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=chunk-VOKGH627.js.map
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildPlacedNotes
|
|
3
|
+
} from "./chunk-JED6ZDEE.js";
|
|
4
|
+
import {
|
|
5
|
+
noteCanvasShift
|
|
6
|
+
} from "./chunk-6EK55ART.js";
|
|
7
|
+
import {
|
|
8
|
+
measureText
|
|
9
|
+
} from "./chunk-WCT3NYCV.js";
|
|
10
|
+
import {
|
|
11
|
+
resolveNotes
|
|
12
|
+
} from "./chunk-FMDSF3OV.js";
|
|
13
|
+
|
|
14
|
+
// src/class/layout.ts
|
|
15
|
+
import dagre from "@dagrejs/dagre";
|
|
16
|
+
var MIN_WIDTH = 140;
|
|
17
|
+
var PADDING_X = 24;
|
|
18
|
+
var HEADER_BASE = 36;
|
|
19
|
+
var CLASS_FONT_SIZE = 13;
|
|
20
|
+
var MEMBER_FONT_SIZE = 11;
|
|
21
|
+
var MODIFIER_BADGE = 16;
|
|
22
|
+
var MEMBER_LINE_HEIGHT = 18;
|
|
23
|
+
var COMPARTMENT_PADDING_Y = 8;
|
|
24
|
+
var SEPARATOR_HEIGHT = 1;
|
|
25
|
+
function computeNodeDimensions(node) {
|
|
26
|
+
const fields = node.members.filter((m) => !m.isMethod);
|
|
27
|
+
const methods = node.members.filter((m) => m.isMethod);
|
|
28
|
+
const isEnum = node.modifier === "enum";
|
|
29
|
+
let maxTextWidth = measureText(node.name, CLASS_FONT_SIZE);
|
|
30
|
+
if (node.modifier) {
|
|
31
|
+
maxTextWidth = Math.max(
|
|
32
|
+
maxTextWidth,
|
|
33
|
+
measureText(`\xAB${node.modifier}\xBB`, MEMBER_FONT_SIZE)
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
for (const m of node.members) {
|
|
37
|
+
let memberText = m.name;
|
|
38
|
+
if (m.isMethod) {
|
|
39
|
+
memberText += `(${m.params ?? ""})`;
|
|
40
|
+
if (m.type) memberText += `: ${m.type}`;
|
|
41
|
+
} else if (m.type) {
|
|
42
|
+
memberText += `: ${m.type}`;
|
|
43
|
+
}
|
|
44
|
+
memberText = `+ ${memberText}`;
|
|
45
|
+
maxTextWidth = Math.max(
|
|
46
|
+
maxTextWidth,
|
|
47
|
+
measureText(memberText, MEMBER_FONT_SIZE)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const width = Math.max(MIN_WIDTH, maxTextWidth + PADDING_X);
|
|
51
|
+
const headerHeight = HEADER_BASE + (node.modifier ? MODIFIER_BADGE : 0);
|
|
52
|
+
let fieldsHeight;
|
|
53
|
+
if (isEnum) {
|
|
54
|
+
const enumValues = node.members;
|
|
55
|
+
if (enumValues.length > 0) {
|
|
56
|
+
fieldsHeight = COMPARTMENT_PADDING_Y * 2 + enumValues.length * MEMBER_LINE_HEIGHT + SEPARATOR_HEIGHT;
|
|
57
|
+
} else {
|
|
58
|
+
fieldsHeight = SEPARATOR_HEIGHT + COMPARTMENT_PADDING_Y;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
if (fields.length > 0) {
|
|
62
|
+
fieldsHeight = COMPARTMENT_PADDING_Y * 2 + fields.length * MEMBER_LINE_HEIGHT + SEPARATOR_HEIGHT;
|
|
63
|
+
} else {
|
|
64
|
+
fieldsHeight = SEPARATOR_HEIGHT + COMPARTMENT_PADDING_Y;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let methodsHeight = 0;
|
|
68
|
+
if (!isEnum) {
|
|
69
|
+
if (methods.length > 0) {
|
|
70
|
+
methodsHeight = COMPARTMENT_PADDING_Y * 2 + methods.length * MEMBER_LINE_HEIGHT + SEPARATOR_HEIGHT;
|
|
71
|
+
} else {
|
|
72
|
+
methodsHeight = SEPARATOR_HEIGHT + COMPARTMENT_PADDING_Y;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const height = headerHeight + fieldsHeight + methodsHeight;
|
|
76
|
+
return { width, height, headerHeight, fieldsHeight, methodsHeight };
|
|
77
|
+
}
|
|
78
|
+
function layoutClassDiagram(parsed, options) {
|
|
79
|
+
if (parsed.classes.length === 0) {
|
|
80
|
+
return { nodes: [], edges: [], width: 0, height: 0 };
|
|
81
|
+
}
|
|
82
|
+
const g = new dagre.graphlib.Graph();
|
|
83
|
+
g.setGraph({
|
|
84
|
+
rankdir: "TB",
|
|
85
|
+
nodesep: 60,
|
|
86
|
+
ranksep: 80,
|
|
87
|
+
edgesep: 20
|
|
88
|
+
});
|
|
89
|
+
g.setDefaultEdgeLabel(() => ({}));
|
|
90
|
+
const dimMap = /* @__PURE__ */ new Map();
|
|
91
|
+
for (const node of parsed.classes) {
|
|
92
|
+
const dims = computeNodeDimensions(node);
|
|
93
|
+
dimMap.set(node.id, dims);
|
|
94
|
+
g.setNode(node.id, {
|
|
95
|
+
label: node.name,
|
|
96
|
+
width: dims.width,
|
|
97
|
+
height: dims.height
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
for (const rel of parsed.relationships) {
|
|
101
|
+
g.setEdge(rel.source, rel.target, { label: rel.label ?? "" });
|
|
102
|
+
}
|
|
103
|
+
dagre.layout(g);
|
|
104
|
+
const notesSuppressed = parsed.options?.["no-notes"] === "on";
|
|
105
|
+
const noteByNode = notesSuppressed || !parsed.notes ? /* @__PURE__ */ new Map() : resolveNotes(
|
|
106
|
+
parsed.notes,
|
|
107
|
+
parsed.classes.map((c) => ({ id: c.id, label: c.name }))
|
|
108
|
+
);
|
|
109
|
+
const placedNotes = buildPlacedNotes(
|
|
110
|
+
parsed.classes.map((node) => {
|
|
111
|
+
const pos = g.node(node.id);
|
|
112
|
+
return {
|
|
113
|
+
id: node.id,
|
|
114
|
+
x: pos.x,
|
|
115
|
+
y: pos.y,
|
|
116
|
+
width: pos.width,
|
|
117
|
+
height: pos.height
|
|
118
|
+
};
|
|
119
|
+
}),
|
|
120
|
+
noteByNode,
|
|
121
|
+
"TB",
|
|
122
|
+
options?.collapsedNotes
|
|
123
|
+
);
|
|
124
|
+
const layoutNodes = parsed.classes.map((node) => {
|
|
125
|
+
const pos = g.node(node.id);
|
|
126
|
+
const dims = dimMap.get(node.id);
|
|
127
|
+
const note = placedNotes.get(node.id);
|
|
128
|
+
return {
|
|
129
|
+
...node,
|
|
130
|
+
x: pos.x,
|
|
131
|
+
y: pos.y,
|
|
132
|
+
width: dims.width,
|
|
133
|
+
height: dims.height,
|
|
134
|
+
headerHeight: dims.headerHeight,
|
|
135
|
+
fieldsHeight: dims.fieldsHeight,
|
|
136
|
+
methodsHeight: dims.methodsHeight,
|
|
137
|
+
...note && { note }
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
const layoutEdges = parsed.relationships.map((rel) => {
|
|
141
|
+
const edgeData = g.edge(rel.source, rel.target);
|
|
142
|
+
const layoutEdge = {
|
|
143
|
+
source: rel.source,
|
|
144
|
+
target: rel.target,
|
|
145
|
+
type: rel.type,
|
|
146
|
+
points: edgeData?.points ?? [],
|
|
147
|
+
...rel.label !== void 0 && { label: rel.label },
|
|
148
|
+
lineNumber: rel.lineNumber
|
|
149
|
+
};
|
|
150
|
+
return layoutEdge;
|
|
151
|
+
});
|
|
152
|
+
let bbMinX = Infinity;
|
|
153
|
+
let bbMinY = Infinity;
|
|
154
|
+
let bbMaxX = -Infinity;
|
|
155
|
+
let bbMaxY = -Infinity;
|
|
156
|
+
const extend = (l, t, r, b) => {
|
|
157
|
+
if (l < bbMinX) bbMinX = l;
|
|
158
|
+
if (t < bbMinY) bbMinY = t;
|
|
159
|
+
if (r > bbMaxX) bbMaxX = r;
|
|
160
|
+
if (b > bbMaxY) bbMaxY = b;
|
|
161
|
+
};
|
|
162
|
+
for (const node of layoutNodes) {
|
|
163
|
+
extend(
|
|
164
|
+
node.x - node.width / 2,
|
|
165
|
+
node.y - node.height / 2,
|
|
166
|
+
node.x + node.width / 2,
|
|
167
|
+
node.y + node.height / 2
|
|
168
|
+
);
|
|
169
|
+
if (node.note && !node.note.collapsed) {
|
|
170
|
+
extend(
|
|
171
|
+
node.x + node.note.x,
|
|
172
|
+
node.y + node.note.y,
|
|
173
|
+
node.x + node.note.x + node.note.width,
|
|
174
|
+
node.y + node.note.y + node.note.height
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (!Number.isFinite(bbMinX)) {
|
|
179
|
+
bbMinX = 0;
|
|
180
|
+
bbMinY = 0;
|
|
181
|
+
bbMaxX = 0;
|
|
182
|
+
bbMaxY = 0;
|
|
183
|
+
}
|
|
184
|
+
const { shiftX, shiftY } = noteCanvasShift(bbMinX, bbMinY);
|
|
185
|
+
const shifted = shiftX !== 0 || shiftY !== 0;
|
|
186
|
+
const finalNodes = shifted ? layoutNodes.map((n) => ({ ...n, x: n.x + shiftX, y: n.y + shiftY })) : layoutNodes;
|
|
187
|
+
const finalEdges = shifted ? layoutEdges.map((e) => ({
|
|
188
|
+
...e,
|
|
189
|
+
points: e.points.map((pt) => ({ x: pt.x + shiftX, y: pt.y + shiftY }))
|
|
190
|
+
})) : layoutEdges;
|
|
191
|
+
const totalWidth = bbMaxX + shiftX + 40;
|
|
192
|
+
const totalHeight = bbMaxY + shiftY + 40;
|
|
193
|
+
return {
|
|
194
|
+
nodes: finalNodes,
|
|
195
|
+
edges: finalEdges,
|
|
196
|
+
width: totalWidth,
|
|
197
|
+
height: totalHeight
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export {
|
|
202
|
+
layoutClassDiagram
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=chunk-WBRZJOEC.js.map
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AUTO_TAG_COLOR_SENTINEL,
|
|
3
|
+
cascadeTagMetadata,
|
|
4
|
+
finalizeAutoTagColors,
|
|
5
|
+
matchTagBlockHeading,
|
|
6
|
+
stripDefaultModifier,
|
|
7
|
+
tagAttrKey,
|
|
8
|
+
validateTagGroupNames,
|
|
9
|
+
validateTagValues
|
|
10
|
+
} from "./chunk-QLCCJEJI.js";
|
|
11
|
+
import {
|
|
12
|
+
TREEMAP_REGISTRY,
|
|
13
|
+
extractColor,
|
|
14
|
+
measureIndent,
|
|
15
|
+
parseFirstLine,
|
|
16
|
+
peelRampColors,
|
|
17
|
+
splitNameAndMeta,
|
|
18
|
+
stripQuotes,
|
|
19
|
+
warnUnknownMetaKeys,
|
|
20
|
+
withTagAliases
|
|
21
|
+
} from "./chunk-Y3J7VR52.js";
|
|
22
|
+
import {
|
|
23
|
+
emit,
|
|
24
|
+
formatDgmoError,
|
|
25
|
+
makeDgmoError,
|
|
26
|
+
makeFail,
|
|
27
|
+
suggest
|
|
28
|
+
} from "./chunk-CXK4DZH3.js";
|
|
29
|
+
|
|
30
|
+
// src/treemap/diagnostics.ts
|
|
31
|
+
var TREEMAP_DX = {
|
|
32
|
+
NEGATIVE_VALUE: {
|
|
33
|
+
code: "E_TREEMAP_NEGATIVE_VALUE",
|
|
34
|
+
severity: "error",
|
|
35
|
+
chartType: "treemap",
|
|
36
|
+
title: "Negative leaf value",
|
|
37
|
+
message: (p) => `Leaf "${p.label ?? "X"}" has a negative value (${p.value ?? -5}) \u2014 treemap sizes must be \u2265 0`,
|
|
38
|
+
hint: "Segment magnitude must be zero or greater \u2014 use a value of 0 or more.",
|
|
39
|
+
example: "treemap T\nA\n Bad -5"
|
|
40
|
+
},
|
|
41
|
+
LEAF_NO_VALUE: {
|
|
42
|
+
code: "W_TREEMAP_LEAF_NO_VALUE",
|
|
43
|
+
severity: "warning",
|
|
44
|
+
chartType: "treemap",
|
|
45
|
+
title: "Leaf has no value",
|
|
46
|
+
message: (p) => `Leaf "${p.label ?? "Lonely"}" has no value \u2014 it renders with zero size`,
|
|
47
|
+
hint: "Add a trailing number (e.g. `Lonely 40`) so the leaf gets a size.",
|
|
48
|
+
example: "treemap T\nA\n Lonely"
|
|
49
|
+
},
|
|
50
|
+
BRANCH_VALUE_IGNORED: {
|
|
51
|
+
code: "W_TREEMAP_BRANCH_VALUE_IGNORED",
|
|
52
|
+
severity: "warning",
|
|
53
|
+
chartType: "treemap",
|
|
54
|
+
title: "Branch value ignored",
|
|
55
|
+
message: (p) => `"${p.label ?? "Operations"}" is a branch \u2014 its trailing number is ignored; the size is the auto-sum of its children`,
|
|
56
|
+
hint: "Remove the trailing number from a branch \u2014 a parent's size is the sum of its children.",
|
|
57
|
+
example: "treemap T\nOperations 999\n Cloud 110\n Support 70"
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var TREEMAP_DIAGNOSTICS = Object.values(TREEMAP_DX);
|
|
61
|
+
|
|
62
|
+
// src/treemap/parser.ts
|
|
63
|
+
var VALUE_TOKEN_RE = /^(.+?)\s+(-?\d[\d_.]*)$/;
|
|
64
|
+
function isFullyQuoted(s) {
|
|
65
|
+
return s.length >= 2 && (s.startsWith('"') && s.endsWith('"') || s.startsWith("'") && s.endsWith("'"));
|
|
66
|
+
}
|
|
67
|
+
function parseTreemap(content, palette) {
|
|
68
|
+
const options = {
|
|
69
|
+
heatColors: [],
|
|
70
|
+
noValues: false,
|
|
71
|
+
noPercent: false,
|
|
72
|
+
noHeaders: false,
|
|
73
|
+
noLegend: false,
|
|
74
|
+
solidFill: false,
|
|
75
|
+
radial: false
|
|
76
|
+
};
|
|
77
|
+
const result = {
|
|
78
|
+
type: "treemap",
|
|
79
|
+
title: null,
|
|
80
|
+
titleLineNumber: null,
|
|
81
|
+
roots: [],
|
|
82
|
+
tagGroups: [],
|
|
83
|
+
hasHeat: false,
|
|
84
|
+
defaultColorMode: "branch",
|
|
85
|
+
options,
|
|
86
|
+
diagnostics: [],
|
|
87
|
+
error: null
|
|
88
|
+
};
|
|
89
|
+
const fail = makeFail(result);
|
|
90
|
+
const pushError = (line, message, code) => {
|
|
91
|
+
const diag = makeDgmoError(line, message, "error", code);
|
|
92
|
+
result.diagnostics.push(diag);
|
|
93
|
+
if (!result.error) result.error = formatDgmoError(diag);
|
|
94
|
+
};
|
|
95
|
+
const pushWarning = (line, message, code) => {
|
|
96
|
+
result.diagnostics.push(makeDgmoError(line, message, "warning", code));
|
|
97
|
+
};
|
|
98
|
+
if (!content?.trim()) {
|
|
99
|
+
return fail(0, "No content provided");
|
|
100
|
+
}
|
|
101
|
+
const lines = content.split("\n");
|
|
102
|
+
let contentStarted = false;
|
|
103
|
+
let nodeCounter = 0;
|
|
104
|
+
let currentTagGroup = null;
|
|
105
|
+
const aliasMap = /* @__PURE__ */ new Map();
|
|
106
|
+
const indentStack = [];
|
|
107
|
+
for (let i = 0; i < lines.length; i++) {
|
|
108
|
+
const line = lines[i];
|
|
109
|
+
const lineNumber = i + 1;
|
|
110
|
+
const trimmed = line.trim();
|
|
111
|
+
if (!trimmed) {
|
|
112
|
+
currentTagGroup = null;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (trimmed.startsWith("//")) continue;
|
|
116
|
+
if (!contentStarted) {
|
|
117
|
+
const firstLine = parseFirstLine(trimmed);
|
|
118
|
+
if (firstLine && result.titleLineNumber === null && i === 0) {
|
|
119
|
+
if (firstLine.chartType !== "treemap") {
|
|
120
|
+
let msg = `Expected chart type "treemap", got "${firstLine.chartType}"`;
|
|
121
|
+
const hint = suggest(firstLine.chartType, ["treemap"]);
|
|
122
|
+
if (hint) msg += `. ${hint}`;
|
|
123
|
+
return fail(lineNumber, msg);
|
|
124
|
+
}
|
|
125
|
+
result.title = firstLine.title ?? null;
|
|
126
|
+
result.titleLineNumber = lineNumber;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const tagBlockMatch = matchTagBlockHeading(trimmed);
|
|
131
|
+
if (tagBlockMatch) {
|
|
132
|
+
if (contentStarted) {
|
|
133
|
+
pushError(
|
|
134
|
+
lineNumber,
|
|
135
|
+
"Tag groups must appear before treemap content",
|
|
136
|
+
"E_TAG_DECLARED_AFTER_CONTENT"
|
|
137
|
+
);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
currentTagGroup = {
|
|
141
|
+
name: tagBlockMatch.name,
|
|
142
|
+
...tagBlockMatch.alias !== void 0 && {
|
|
143
|
+
alias: tagBlockMatch.alias
|
|
144
|
+
},
|
|
145
|
+
entries: [],
|
|
146
|
+
lineNumber
|
|
147
|
+
};
|
|
148
|
+
if (tagBlockMatch.alias) {
|
|
149
|
+
aliasMap.set(
|
|
150
|
+
tagBlockMatch.alias.toLowerCase(),
|
|
151
|
+
tagAttrKey(tagBlockMatch.name)
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
aliasMap.set(
|
|
155
|
+
tagAttrKey(tagBlockMatch.name),
|
|
156
|
+
tagAttrKey(tagBlockMatch.name)
|
|
157
|
+
);
|
|
158
|
+
result.tagGroups.push(currentTagGroup);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (currentTagGroup && !contentStarted) {
|
|
162
|
+
const indent2 = measureIndent(line);
|
|
163
|
+
if (indent2 > 0) {
|
|
164
|
+
const { text: cleanEntry, isDefault } = stripDefaultModifier(trimmed);
|
|
165
|
+
const { label, color } = extractColor(
|
|
166
|
+
cleanEntry,
|
|
167
|
+
palette,
|
|
168
|
+
result.diagnostics,
|
|
169
|
+
lineNumber
|
|
170
|
+
);
|
|
171
|
+
if (isDefault) {
|
|
172
|
+
currentTagGroup.defaultValue = label;
|
|
173
|
+
} else if (currentTagGroup.entries.length === 0) {
|
|
174
|
+
currentTagGroup.defaultValue = label;
|
|
175
|
+
}
|
|
176
|
+
currentTagGroup.entries.push({
|
|
177
|
+
value: label,
|
|
178
|
+
color: color ?? AUTO_TAG_COLOR_SENTINEL,
|
|
179
|
+
lineNumber
|
|
180
|
+
});
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
currentTagGroup = null;
|
|
184
|
+
}
|
|
185
|
+
if (!contentStarted && measureIndent(line) === 0) {
|
|
186
|
+
if (handleDirective(trimmed, options, result, pushWarning, lineNumber)) {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
contentStarted = true;
|
|
191
|
+
currentTagGroup = null;
|
|
192
|
+
const indent = measureIndent(line);
|
|
193
|
+
const node = parseNodeLine(
|
|
194
|
+
trimmed,
|
|
195
|
+
lineNumber,
|
|
196
|
+
++nodeCounter,
|
|
197
|
+
aliasMap,
|
|
198
|
+
result.diagnostics
|
|
199
|
+
);
|
|
200
|
+
if (node.heat !== void 0) result.hasHeat = true;
|
|
201
|
+
attachNode(node, indent, indentStack, result);
|
|
202
|
+
}
|
|
203
|
+
finalizeAutoTagColors(result.tagGroups, palette);
|
|
204
|
+
const allNodes = [];
|
|
205
|
+
const collectAll = (nodes) => {
|
|
206
|
+
for (const n of nodes) {
|
|
207
|
+
allNodes.push(n);
|
|
208
|
+
collectAll(n.children);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
collectAll(result.roots);
|
|
212
|
+
for (const n of allNodes) {
|
|
213
|
+
const node = n;
|
|
214
|
+
const isBranch = node.children.length > 0;
|
|
215
|
+
if (isBranch) {
|
|
216
|
+
if (node.value !== void 0) {
|
|
217
|
+
result.diagnostics.push(
|
|
218
|
+
emit(TREEMAP_DX.BRANCH_VALUE_IGNORED, node.lineNumber, {
|
|
219
|
+
label: node.label
|
|
220
|
+
})
|
|
221
|
+
);
|
|
222
|
+
delete node.value;
|
|
223
|
+
}
|
|
224
|
+
} else if (node.value === void 0) {
|
|
225
|
+
result.diagnostics.push(
|
|
226
|
+
emit(TREEMAP_DX.LEAF_NO_VALUE, node.lineNumber, {
|
|
227
|
+
label: node.label
|
|
228
|
+
})
|
|
229
|
+
);
|
|
230
|
+
node.value = 0;
|
|
231
|
+
} else if (node.value < 0) {
|
|
232
|
+
result.diagnostics.push(
|
|
233
|
+
emit(TREEMAP_DX.NEGATIVE_VALUE, node.lineNumber, {
|
|
234
|
+
label: node.label,
|
|
235
|
+
value: node.value
|
|
236
|
+
})
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (result.hasHeat || options.heatLabel !== void 0) {
|
|
241
|
+
result.hasHeat = true;
|
|
242
|
+
}
|
|
243
|
+
if (result.tagGroups.length > 0) {
|
|
244
|
+
validateTagValues(allNodes, result.tagGroups, pushWarning, suggest);
|
|
245
|
+
validateTagGroupNames(result.tagGroups, pushWarning);
|
|
246
|
+
cascadeTagMetadata(result.roots, result.tagGroups);
|
|
247
|
+
}
|
|
248
|
+
result.defaultColorMode = resolveDefaultColorMode(result);
|
|
249
|
+
if (result.roots.length === 0 && !result.error) {
|
|
250
|
+
const diag = makeDgmoError(1, "No nodes found in treemap");
|
|
251
|
+
result.diagnostics.push(diag);
|
|
252
|
+
result.error = formatDgmoError(diag);
|
|
253
|
+
}
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
256
|
+
function handleDirective(trimmed, options, result, pushWarning, lineNumber) {
|
|
257
|
+
const depthMatch = trimmed.match(/^depth\s+(-?\d+)\s*$/i);
|
|
258
|
+
if (depthMatch) {
|
|
259
|
+
const n = parseInt(depthMatch[1], 10);
|
|
260
|
+
if (n >= 1) options.maxDepth = n;
|
|
261
|
+
else pushWarning(lineNumber, '"depth" must be \u2265 1 \u2014 ignored');
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
if (/^other-below\b/i.test(trimmed)) {
|
|
265
|
+
pushWarning(
|
|
266
|
+
lineNumber,
|
|
267
|
+
'"other-below" is no longer supported \u2014 remove this line'
|
|
268
|
+
);
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
const heatMatch = trimmed.match(/^heat\s+(.+)$/i);
|
|
272
|
+
if (heatMatch) {
|
|
273
|
+
const { label, low, high } = peelRampColors(heatMatch[1].trim());
|
|
274
|
+
options.heatLabel = label || "Value";
|
|
275
|
+
const colors = [];
|
|
276
|
+
if (low !== void 0) colors.push(low);
|
|
277
|
+
if (high !== void 0) colors.push(high);
|
|
278
|
+
options.heatColors = colors;
|
|
279
|
+
result.hasHeat = true;
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
const noMatch = trimmed.match(/^no-(values|percent|headers|legend)\s*$/i);
|
|
283
|
+
if (noMatch) {
|
|
284
|
+
const key = noMatch[1].toLowerCase();
|
|
285
|
+
if (key === "values") options.noValues = true;
|
|
286
|
+
else if (key === "percent") options.noPercent = true;
|
|
287
|
+
else if (key === "headers") options.noHeaders = true;
|
|
288
|
+
else if (key === "legend") options.noLegend = true;
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
if (/^solid-fill\s*$/i.test(trimmed)) {
|
|
292
|
+
options.solidFill = true;
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
if (/^radial\s*$/i.test(trimmed)) {
|
|
296
|
+
options.radial = true;
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
function resolveDefaultColorMode(result) {
|
|
302
|
+
if (result.tagGroups.length > 0) return "tag";
|
|
303
|
+
if (result.hasHeat) return "heat";
|
|
304
|
+
return "branch";
|
|
305
|
+
}
|
|
306
|
+
function parseNodeLine(trimmed, lineNumber, counter, aliasMap, diagnostics) {
|
|
307
|
+
const registry = withTagAliases(TREEMAP_REGISTRY, new Set(aliasMap.keys()));
|
|
308
|
+
const split = splitNameAndMeta(
|
|
309
|
+
trimmed,
|
|
310
|
+
registry,
|
|
311
|
+
aliasMap,
|
|
312
|
+
void 0,
|
|
313
|
+
diagnostics,
|
|
314
|
+
lineNumber
|
|
315
|
+
);
|
|
316
|
+
warnUnknownMetaKeys(
|
|
317
|
+
split.meta,
|
|
318
|
+
registry,
|
|
319
|
+
(msg) => diagnostics.push(makeDgmoError(lineNumber, msg, "warning")),
|
|
320
|
+
split.name
|
|
321
|
+
);
|
|
322
|
+
const metadata = { ...split.meta };
|
|
323
|
+
let heat;
|
|
324
|
+
if ("heat" in metadata) {
|
|
325
|
+
const h = parseFloat(metadata["heat"].replace(/_/g, ""));
|
|
326
|
+
if (Number.isFinite(h)) heat = h;
|
|
327
|
+
delete metadata["heat"];
|
|
328
|
+
}
|
|
329
|
+
const rawName = split.name;
|
|
330
|
+
let label;
|
|
331
|
+
let value;
|
|
332
|
+
if (isFullyQuoted(rawName)) {
|
|
333
|
+
label = stripQuotes(rawName);
|
|
334
|
+
} else {
|
|
335
|
+
const vm = rawName.match(VALUE_TOKEN_RE);
|
|
336
|
+
if (vm) {
|
|
337
|
+
const labelPart = vm[1].trim();
|
|
338
|
+
const token = vm[2];
|
|
339
|
+
const cleaned = token.replace(/_/g, "");
|
|
340
|
+
const parsed = parseFloat(cleaned);
|
|
341
|
+
if (Number.isFinite(parsed)) {
|
|
342
|
+
value = parsed;
|
|
343
|
+
label = isFullyQuoted(labelPart) ? stripQuotes(labelPart) : labelPart;
|
|
344
|
+
} else {
|
|
345
|
+
label = rawName;
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
label = rawName;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
id: `treemap-node-${counter}`,
|
|
353
|
+
label,
|
|
354
|
+
...value !== void 0 && { value },
|
|
355
|
+
...heat !== void 0 && { heat },
|
|
356
|
+
metadata,
|
|
357
|
+
children: [],
|
|
358
|
+
lineNumber
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function attachNode(node, indent, indentStack, result) {
|
|
362
|
+
while (indentStack.length > 0) {
|
|
363
|
+
const top = indentStack[indentStack.length - 1];
|
|
364
|
+
if (top.indent < indent) break;
|
|
365
|
+
indentStack.pop();
|
|
366
|
+
}
|
|
367
|
+
if (indentStack.length > 0) {
|
|
368
|
+
const parent = indentStack[indentStack.length - 1].node;
|
|
369
|
+
parent.children.push(node);
|
|
370
|
+
} else {
|
|
371
|
+
result.roots.push(node);
|
|
372
|
+
}
|
|
373
|
+
indentStack.push({ node, indent });
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export {
|
|
377
|
+
TREEMAP_DIAGNOSTICS,
|
|
378
|
+
parseTreemap
|
|
379
|
+
};
|
|
380
|
+
//# sourceMappingURL=chunk-WCSOJFU3.js.map
|