@aiderdesk/aiderdesk 0.76.0 → 0.78.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/out/cli.js +124 -17
- package/out/renderer/assets/{AgentSettings-Dc8h1zSI.js → AgentSettings-mSGpRs0A.js} +1228 -4469
- package/out/renderer/assets/{InfoIcon-BuABw5oZ.js → InfoIcon-Dllba1sv.js} +1 -1
- package/out/renderer/assets/{Onboarding-lX23sGcW.js → Onboarding-D_AT4vxY.js} +4 -4
- package/out/renderer/assets/{ProviderHeader-s7JSikLR.js → ProviderHeader-DAchpkUt.js} +8 -20
- package/out/renderer/assets/{SettingsPage-CcsH6kmE.js → SettingsPage-DPaPSR-0.js} +5649 -299
- package/out/renderer/assets/{UsageDashboard-oAQNYvYh.js → UsageDashboard-CfP-txzz.js} +3 -3
- package/out/renderer/assets/abnfDiagram-N423BO3Z-tqPb0OUs.js +118 -0
- package/out/renderer/assets/{arc-BiaIwS79.js → arc-lUzj6CoE.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-3BPJPVTR-d7fu6X13.js → architectureDiagram-T3A2C74G-CuNUo8J6.js} +242 -133
- package/out/renderer/assets/{blockDiagram-GPEHLZMM-CWD8GVpw.js → blockDiagram-VBNYF7ZC-CIiOkZ_D.js} +76 -77
- package/out/renderer/assets/{c4Diagram-AAUBKEIU-b5nYOm14.js → c4Diagram-5PPSVZJV-DcgBNVnI.js} +2 -2
- package/out/renderer/assets/{channel-B99g0IUF.js → channel-PMBABQAa.js} +1 -1
- package/out/renderer/assets/{chunk-ND2GUHAM-BkVCmcvx.js → chunk-2GRJ4B5K-CJI-utiZ.js} +4 -4
- package/out/renderer/assets/{chunk-QZHKN3VN-DwLbWeqf.js → chunk-2Q5K7J3B-D8LOcAuY.js} +1 -1
- package/out/renderer/assets/{chunk-AQP2D5EJ-m8ArTZfD.js → chunk-5RXB4S5H-dp0xqMbI.js} +67 -32
- package/out/renderer/assets/{chunk-FMBD7UC4-yWO_9Kky.js → chunk-5VM5RSS4-D731WvT8.js} +1 -1
- package/out/renderer/assets/chunk-6Q2QTUOP-BjzdFhNB.js +860 -0
- package/out/renderer/assets/{chunk-727SXJPM-CVxcBF7D.js → chunk-GF5L2VYU-Ct3zh1DW.js} +18 -8
- package/out/renderer/assets/{chunk-4BX2VUAB-4Soxfj2i.js → chunk-JWPE2WC7-OPg0X7jU.js} +1 -1
- package/out/renderer/assets/{chunk-2J33WTMH-DmrXuNY-.js → chunk-KBJHAD2P-qbM4OnIO.js} +1 -1
- package/out/renderer/assets/{dagre-BM42HDAG-D_Val_ih.js → chunk-RYQCIY6F-DQI4Jds6.js} +85 -316
- package/out/renderer/assets/{chunk-55IACEB6-BtS727h4.js → chunk-XXDRQBXY-D_LC4QkV.js} +1 -1
- package/out/renderer/assets/{classDiagram-4FO5ZUOK-B3t9RWJZ.js → classDiagram-JCYQIIEL-D4e_9tkA.js} +6 -6
- package/out/renderer/assets/{classDiagram-v2-Q7XG4LA2-B3t9RWJZ.js → classDiagram-v2-OCEON4UE-D4e_9tkA.js} +6 -6
- package/out/renderer/assets/{cose-bilkent-S5V4N54A-W70GNPEp.js → cose-bilkent-JH36ORCC-tRlBuEjd.js} +2 -2
- package/out/renderer/assets/{wardley-L42UT6IY-Dnx4ZTc4.js → cynefin-VYW2F7L2-BiEI2vQb.js} +1527 -120
- package/out/renderer/assets/cynefinDiagram-MW4NZA55-DBSV1HcE.js +453 -0
- package/out/renderer/assets/{cytoscape.esm-BNSvh83I.js → cytoscape.esm-Bx_1tVW-.js} +160 -67
- package/out/renderer/assets/dagre-VZM6K2ZE-DRrMrSSw.js +522 -0
- package/out/renderer/assets/diagram-7IWD3JNH-CreTV9nH.js +488 -0
- package/out/renderer/assets/{diagram-KO2AKTUF-CGi0HZww.js → diagram-B4RE2ZJO-3tlgxoIb.js} +3 -3
- package/out/renderer/assets/{diagram-LMA3HP47-bdoVxL2p.js → diagram-LBJQPF4R-BFO2qTLJ.js} +3 -3
- package/out/renderer/assets/{diagram-OG6HWLK6-2K829auL.js → diagram-Q27KOJAE-BDgXUH9Q.js} +30 -24
- package/out/renderer/assets/{diagram-2AECGRRQ-Z7UeOtJN.js → diagram-UB23O5K3-Qw-ipaCG.js} +18 -8
- package/out/renderer/assets/ebnfDiagram-BXEA7PRR-izS1zYs0.js +138 -0
- package/out/renderer/assets/{erDiagram-TEJ5UH35-D4sO1GH8.js → erDiagram-JOGREHBK-ld9lNh2F.js} +88 -77
- package/out/renderer/assets/{flowDiagram-I6XJVG4X-DQNz4Jg_.js → flowDiagram-UKHOOZJN-g11KS_zg.js} +112 -96
- package/out/renderer/assets/{ganttDiagram-6RSMTGT7-B3dUFX1p.js → ganttDiagram-PKOTCBZU-CMsbJWqv.js} +31 -19
- package/out/renderer/assets/{gitGraphDiagram-PVQCEYII-B95Lrq_7.js → gitGraphDiagram-DS77QQ5N-CKiYKjBJ.js} +4 -4
- package/out/renderer/assets/{graph-7kCtdoo_.js → graph--1WSNErU.js} +10 -10
- package/out/renderer/assets/{index-58fbbmhI.js → index-BJGP-Ed0.js} +1 -1
- package/out/renderer/assets/{index-Bihcg0ql.js → index-BSQTFZZV.js} +1 -1
- package/out/renderer/assets/{index-GRVDmgjb.js → index-BSRjTKaQ.js} +1 -1
- package/out/renderer/assets/{index-CNgsMipO.js → index-BahRAP01.js} +7200 -3741
- package/out/renderer/assets/{index-BoogYopJ.js → index-BbYkC4ZX.js} +1 -1
- package/out/renderer/assets/{index-BHaWBJe9.js → index-BktqS5iT.js} +1 -1
- package/out/renderer/assets/{index-BnFS7uhp.js → index-DJfxm3SJ.js} +3 -3
- package/out/renderer/assets/{index-DcD881Q1.css → index-DVEVSdXO.css} +21 -0
- package/out/renderer/assets/{index-B2TL7Kll.js → index-DqZ8FyZG.js} +1 -1
- package/out/renderer/assets/{index-CRfveI6m.js → index-r15oFU5X.js} +1 -1
- package/out/renderer/assets/{index-pvhejocY.js → index-xC4jIIdf.js} +1 -1
- package/out/renderer/assets/{infoDiagram-5YYISTIA-C0OH2to7.js → infoDiagram-6WML65LV-CZoJK8b2.js} +3 -3
- package/out/renderer/assets/{ishikawaDiagram-YF4QCWOH-DsgR-cKp.js → ishikawaDiagram-WSZJBQD7-BrUuSNZ-.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-JHISSGLW-Bg6okgzG.js → journeyDiagram-NVQOT4AX-w91U6vB5.js} +4 -4
- package/out/renderer/assets/{jsx-dev-runtime-DLJNe6VM.js → jsx-dev-runtime-Bu2_G2cv.js} +1 -1
- package/out/renderer/assets/{kanban-definition-UN3LZRKU-1UvLCrWk.js → kanban-definition-27J2QSJJ-DVuGbAnS.js} +2 -2
- package/out/renderer/assets/{katex-Co8xHYNH.js → katex-oVG3DVWa.js} +4039 -4063
- package/out/renderer/assets/{layout-9w0fH2nL.js → layout-BA4uCGdL.js} +36 -320
- package/out/renderer/assets/{linear-WTE7GZY2.js → linear-CWQmShZV.js} +1 -1
- package/out/renderer/assets/map-DSwlVIuN.js +299 -0
- package/out/renderer/assets/{mindmap-definition-RKZ34NQL-BlxjYw-a.js → mindmap-definition-FAOFIHXS-CbswsknG.js} +3 -3
- package/out/renderer/assets/pegDiagram-VL7TDLO6-CCqeWB6l.js +126 -0
- package/out/renderer/assets/{pieDiagram-4H26LBE5-C4jZuzAH.js → pieDiagram-7S7Q4E2Y-Chd5qh8F.js} +89 -19
- package/out/renderer/assets/pierre-dark-BL-l9r39.js +4 -0
- package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-BBjGuJQU.js +4 -0
- package/out/renderer/assets/pierre-dark-soft-B6TBhICr.js +4 -0
- package/out/renderer/assets/pierre-dark-tritanopia-f-j_EX9A.js +4 -0
- package/out/renderer/assets/pierre-dark-vibrant-yElMGqZN.js +4 -0
- package/out/renderer/assets/pierre-light-BUzWTcjO.js +4 -0
- package/out/renderer/assets/pierre-light-protanopia-deuteranopia-DlvVSCaI.js +4 -0
- package/out/renderer/assets/pierre-light-soft-CCMU-Zh0.js +4 -0
- package/out/renderer/assets/pierre-light-tritanopia-v4xacE1C.js +4 -0
- package/out/renderer/assets/pierre-light-vibrant-BRUbQnMc.js +4 -0
- package/out/renderer/assets/{quadrantDiagram-W4KKPZXB-BLG4PrcM.js → quadrantDiagram-CIZ2JOQS-CzmUVvXi.js} +8 -9
- package/out/renderer/assets/railroadDiagram-AXF67PYL-CXY83yzR.js +92 -0
- package/out/renderer/assets/{requirementDiagram-4Y6WPE33-CTTFFDvR.js → requirementDiagram-LRYGKXZP-DToxgkKr.js} +3 -3
- package/out/renderer/assets/{sankeyDiagram-5OEKKPKP-CjDlOfXf.js → sankeyDiagram-W5VNT64P-CRs67mfK.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-3UESZ5HK-6PJo_0SQ.js → sequenceDiagram-SI44F4Z6-CzmgqSt2.js} +11 -11
- package/out/renderer/assets/sizeCapture-X5ZJPWSS-mheyKWG9.js +62 -0
- package/out/renderer/assets/{stateDiagram-AJRCARHV-Cnhm9mmx.js → stateDiagram-OKZ733FA-DGyuxXU_.js} +8 -6
- package/out/renderer/assets/{stateDiagram-v2-BHNVJYJU-BxKTEg-3.js → stateDiagram-v2-UEYNNEHI-TldVLbtJ.js} +5 -4
- package/out/renderer/assets/swimlanes-SLNWSIFB-B3lFy2HE.js +8557 -0
- package/out/renderer/assets/swimlanesDiagram-ULZ7WXOC-BxN-HDA3.js +20 -0
- package/out/renderer/assets/{time-YGhgEMYh.js → time-DcFzC-ob.js} +1 -1
- package/out/renderer/assets/{timeline-definition-PNZ67QCA-ooi5Tti4.js → timeline-definition-Z64GVDOM-DQ7vCcJR.js} +2 -2
- package/out/renderer/assets/{vennDiagram-CIIHVFJN-B_kwCHhU.js → vennDiagram-T6HMQDX7-MrgLWWY3.js} +32 -3
- package/out/renderer/assets/{wardleyDiagram-YWT4CUSO-cqZcXF7R.js → wardleyDiagram-T6FBY63Y-BCA6xyJ2.js} +3 -3
- package/out/renderer/assets/{worker-BdXuKH1Q.js → worker-CdcPcIJG.js} +322 -102
- package/out/renderer/assets/{xychartDiagram-2RQKCTM6-BBUpFNY4.js → xychartDiagram-ELKLHX3M-BZmPte5b.js} +125 -57
- package/out/renderer/index.html +2 -2
- package/out/renderer/sw.js +4 -0
- package/out/resources/connector/connector.py +3 -1
- package/out/resources/prompts/init-project.hbs +16 -42
- package/out/resources/prompts/system-prompt.hbs +25 -60
- package/out/resources/prompts/workflow.hbs +17 -52
- package/out/resources/skills/extension-creator/SKILL.md +1 -0
- package/out/resources/skills/extension-creator/references/event-types.md +13 -1
- package/out/resources/skills/extension-creator/references/extension-interface.md +3 -0
- package/out/runner.js +5735 -3379
- package/package.json +5 -4
- package/out/renderer/assets/diagram-5GNKFQAL-DY9Yifty.js +0 -169
- package/out/renderer/assets/pierre-dark-C-Drv5KU.js +0 -4
- package/out/renderer/assets/pierre-dark-soft-Cd74uQaL.js +0 -4
- package/out/renderer/assets/pierre-light-CfQnmt6J.js +0 -4
- package/out/renderer/assets/pierre-light-soft-DMVdU74b.js +0 -4
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { I as ImperativeState } from "./chunk-2Q5K7J3B-D8LOcAuY.js";
|
|
2
|
+
import { p as populateCommonDb } from "./chunk-JWPE2WC7-OPg0X7jU.js";
|
|
3
|
+
import { a3 as setDiagramTitle, K as setAccTitle, C as setAccDescription, a4 as getDiagramTitle, H as getAccDescription, J as getAccTitle, _ as __name, ae as cleanAndMerge, O as log, ah as selectSvgElement, Q as configureSvgSize, ac as getConfig, a5 as clear, W as sanitizeText, aX as getIconSVG, af as defaultConfig_default, aY as registerIconPacks } from "./index-BahRAP01.js";
|
|
4
|
+
import { p as parse } from "./cynefin-VYW2F7L2-BiEI2vQb.js";
|
|
5
|
+
var ALL_BOX_CHARS = /[─━│┃└┗├┣]/;
|
|
6
|
+
var BRANCH_CHAR = /[└┗├┣]/;
|
|
7
|
+
var DASH_CHAR = /[─━]/;
|
|
8
|
+
var DECORATION_ONLY = /^[\s│┃]+$/;
|
|
9
|
+
var METADATA_LINE = /^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/;
|
|
10
|
+
var COMMENT_LINE = /^\s*%%/;
|
|
11
|
+
var INDENT_UNIT = " ";
|
|
12
|
+
function isBoxDrawingFormat(lines) {
|
|
13
|
+
return lines.some((line) => ALL_BOX_CHARS.test(line));
|
|
14
|
+
}
|
|
15
|
+
__name(isBoxDrawingFormat, "isBoxDrawingFormat");
|
|
16
|
+
function inferSegmentWidth(contentLines) {
|
|
17
|
+
for (const line of contentLines) {
|
|
18
|
+
const match = BRANCH_CHAR.exec(line);
|
|
19
|
+
if (match?.index && match.index > 0) {
|
|
20
|
+
return match.index;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return 4;
|
|
24
|
+
}
|
|
25
|
+
__name(inferSegmentWidth, "inferSegmentWidth");
|
|
26
|
+
function remapErrorLines(message, lineMap) {
|
|
27
|
+
return message.replace(/\bline\s+(\d+)\b/gi, (match, lineStr) => {
|
|
28
|
+
const line = parseInt(lineStr, 10);
|
|
29
|
+
const original = lineMap.get(line);
|
|
30
|
+
return original ? `line ${original}` : match;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
__name(remapErrorLines, "remapErrorLines");
|
|
34
|
+
function preprocessBoxDrawing(input) {
|
|
35
|
+
const lines = input.split("\n");
|
|
36
|
+
const lineMap = /* @__PURE__ */ new Map();
|
|
37
|
+
let keywordIdx = -1;
|
|
38
|
+
for (const [i, line] of lines.entries()) {
|
|
39
|
+
if (line.trim() === "treeView-beta") {
|
|
40
|
+
keywordIdx = i;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (keywordIdx === -1) {
|
|
45
|
+
return { text: input, lineMap };
|
|
46
|
+
}
|
|
47
|
+
const contentLineTexts = [];
|
|
48
|
+
for (let i = keywordIdx + 1; i < lines.length; i++) {
|
|
49
|
+
const line = lines[i];
|
|
50
|
+
const trimmed = line.trim();
|
|
51
|
+
if (trimmed === "" || COMMENT_LINE.test(line) || METADATA_LINE.test(line)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (DECORATION_ONLY.test(line)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
contentLineTexts.push(line.replace(/\t/g, " "));
|
|
58
|
+
}
|
|
59
|
+
if (!isBoxDrawingFormat(contentLineTexts)) {
|
|
60
|
+
return { text: input, lineMap };
|
|
61
|
+
}
|
|
62
|
+
const segmentWidth = inferSegmentWidth(contentLineTexts);
|
|
63
|
+
const outputLines = [];
|
|
64
|
+
let outLineNo = 0;
|
|
65
|
+
for (let i = 0; i <= keywordIdx; i++) {
|
|
66
|
+
outputLines.push(lines[i]);
|
|
67
|
+
outLineNo++;
|
|
68
|
+
lineMap.set(outLineNo, i + 1);
|
|
69
|
+
}
|
|
70
|
+
for (let i = keywordIdx + 1; i < lines.length; i++) {
|
|
71
|
+
const line = lines[i];
|
|
72
|
+
const trimmed = line.trim();
|
|
73
|
+
const origLineNo = i + 1;
|
|
74
|
+
if (trimmed === "") {
|
|
75
|
+
outputLines.push(line);
|
|
76
|
+
outLineNo++;
|
|
77
|
+
lineMap.set(outLineNo, origLineNo);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (COMMENT_LINE.test(line)) {
|
|
81
|
+
outputLines.push(line);
|
|
82
|
+
outLineNo++;
|
|
83
|
+
lineMap.set(outLineNo, origLineNo);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (METADATA_LINE.test(line)) {
|
|
87
|
+
outputLines.push(line);
|
|
88
|
+
outLineNo++;
|
|
89
|
+
lineMap.set(outLineNo, origLineNo);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (DECORATION_ONLY.test(line)) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const normalized = line.replace(/\t/g, " ");
|
|
96
|
+
const branchMatch = BRANCH_CHAR.exec(normalized);
|
|
97
|
+
if (branchMatch?.index !== void 0) {
|
|
98
|
+
const branchCol = branchMatch.index;
|
|
99
|
+
const depth = Math.round(branchCol / segmentWidth) + 1;
|
|
100
|
+
let pos = branchCol + 1;
|
|
101
|
+
while (pos < normalized.length && DASH_CHAR.test(normalized[pos])) {
|
|
102
|
+
pos++;
|
|
103
|
+
}
|
|
104
|
+
while (pos < normalized.length && normalized[pos] === " ") {
|
|
105
|
+
pos++;
|
|
106
|
+
}
|
|
107
|
+
const content = normalized.slice(pos).trimEnd();
|
|
108
|
+
if (!content) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`Line ${origLineNo}: Empty node — expected a filename or directory name after the box-drawing prefix`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
const indent = INDENT_UNIT.repeat(depth);
|
|
114
|
+
outputLines.push(indent + content);
|
|
115
|
+
outLineNo++;
|
|
116
|
+
lineMap.set(outLineNo, origLineNo);
|
|
117
|
+
} else if (/^[\s─━│┃└┗├┣]+$/.test(normalized)) {
|
|
118
|
+
continue;
|
|
119
|
+
} else if (ALL_BOX_CHARS.test(normalized)) {
|
|
120
|
+
outputLines.push(line);
|
|
121
|
+
outLineNo++;
|
|
122
|
+
lineMap.set(outLineNo, origLineNo);
|
|
123
|
+
} else if (/^\s+/.test(normalized)) {
|
|
124
|
+
throw new Error(
|
|
125
|
+
`Line ${origLineNo}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`
|
|
126
|
+
);
|
|
127
|
+
} else {
|
|
128
|
+
outputLines.push(line);
|
|
129
|
+
outLineNo++;
|
|
130
|
+
lineMap.set(outLineNo, origLineNo);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return { text: outputLines.join("\n"), lineMap };
|
|
134
|
+
}
|
|
135
|
+
__name(preprocessBoxDrawing, "preprocessBoxDrawing");
|
|
136
|
+
var state = new ImperativeState(() => ({
|
|
137
|
+
cnt: 1,
|
|
138
|
+
stack: [
|
|
139
|
+
{
|
|
140
|
+
id: 0,
|
|
141
|
+
level: -1,
|
|
142
|
+
name: "/",
|
|
143
|
+
nodeType: "directory",
|
|
144
|
+
children: []
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
}));
|
|
148
|
+
var clear2 = /* @__PURE__ */ __name(() => {
|
|
149
|
+
state.reset();
|
|
150
|
+
clear();
|
|
151
|
+
}, "clear");
|
|
152
|
+
var getRoot = /* @__PURE__ */ __name(() => {
|
|
153
|
+
return state.records.stack[0];
|
|
154
|
+
}, "getRoot");
|
|
155
|
+
var getCount = /* @__PURE__ */ __name(() => state.records.cnt, "getCount");
|
|
156
|
+
var defaultConfig = defaultConfig_default.treeView;
|
|
157
|
+
var getConfig2 = /* @__PURE__ */ __name(() => {
|
|
158
|
+
return cleanAndMerge(defaultConfig, getConfig().treeView);
|
|
159
|
+
}, "getConfig");
|
|
160
|
+
var addNode = /* @__PURE__ */ __name((level, name, nodeType, cssClass, icon, description) => {
|
|
161
|
+
while (level <= state.records.stack[state.records.stack.length - 1].level) {
|
|
162
|
+
state.records.stack.pop();
|
|
163
|
+
}
|
|
164
|
+
const node = {
|
|
165
|
+
id: state.records.cnt++,
|
|
166
|
+
level,
|
|
167
|
+
name,
|
|
168
|
+
nodeType,
|
|
169
|
+
icon,
|
|
170
|
+
cssClass,
|
|
171
|
+
description,
|
|
172
|
+
children: []
|
|
173
|
+
};
|
|
174
|
+
state.records.stack[state.records.stack.length - 1].children.push(node);
|
|
175
|
+
state.records.stack.push(node);
|
|
176
|
+
}, "addNode");
|
|
177
|
+
var db = {
|
|
178
|
+
clear: clear2,
|
|
179
|
+
addNode,
|
|
180
|
+
getRoot,
|
|
181
|
+
getCount,
|
|
182
|
+
getConfig: getConfig2,
|
|
183
|
+
getAccTitle,
|
|
184
|
+
getAccDescription,
|
|
185
|
+
getDiagramTitle,
|
|
186
|
+
setAccDescription,
|
|
187
|
+
setAccTitle,
|
|
188
|
+
setDiagramTitle
|
|
189
|
+
};
|
|
190
|
+
var db_default = db;
|
|
191
|
+
var populate = /* @__PURE__ */ __name((ast) => {
|
|
192
|
+
populateCommonDb(ast, db_default);
|
|
193
|
+
for (const node of ast.nodes) {
|
|
194
|
+
const level = typeof node.indent === "number" ? node.indent : 0;
|
|
195
|
+
let name = node.name;
|
|
196
|
+
const isDirectory = name.endsWith("/");
|
|
197
|
+
if (isDirectory) {
|
|
198
|
+
name = name.slice(0, -1);
|
|
199
|
+
}
|
|
200
|
+
const nodeType = isDirectory ? "directory" : "file";
|
|
201
|
+
const cssClass = node.classAnnotation || void 0;
|
|
202
|
+
const rawIcon = node.iconAnnotation;
|
|
203
|
+
const icon = rawIcon !== void 0 ? rawIcon || "none" : void 0;
|
|
204
|
+
const rawDesc = node.descAnnotation || void 0;
|
|
205
|
+
const description = rawDesc ? sanitizeText(rawDesc, getConfig()) : void 0;
|
|
206
|
+
db_default.addNode(level, name, nodeType, cssClass, icon, description);
|
|
207
|
+
}
|
|
208
|
+
}, "populate");
|
|
209
|
+
var parser = {
|
|
210
|
+
parse: /* @__PURE__ */ __name(async (input) => {
|
|
211
|
+
const { text, lineMap } = preprocessBoxDrawing(input);
|
|
212
|
+
try {
|
|
213
|
+
const ast = await parse("treeView", text);
|
|
214
|
+
log.debug(ast);
|
|
215
|
+
populate(ast);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
if (lineMap.size > 0 && error instanceof Error) {
|
|
218
|
+
error.message = remapErrorLines(error.message, lineMap);
|
|
219
|
+
}
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
}, "parse")
|
|
223
|
+
};
|
|
224
|
+
var treeViewIcons = {
|
|
225
|
+
prefix: "mermaid-treeview",
|
|
226
|
+
height: 24,
|
|
227
|
+
width: 24,
|
|
228
|
+
icons: {
|
|
229
|
+
folder: {
|
|
230
|
+
body: '<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'
|
|
231
|
+
},
|
|
232
|
+
file: {
|
|
233
|
+
body: '<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
function detectIcon(name, config) {
|
|
238
|
+
const filenameIcon = config?.filenameIcons?.[name];
|
|
239
|
+
if (filenameIcon) {
|
|
240
|
+
return filenameIcon;
|
|
241
|
+
}
|
|
242
|
+
const dotIdx = name.lastIndexOf(".");
|
|
243
|
+
if (dotIdx > 0) {
|
|
244
|
+
const ext = name.substring(dotIdx).toLowerCase();
|
|
245
|
+
const extensionIcons = config?.extensionIcons;
|
|
246
|
+
return extensionIcons?.[ext] ?? extensionIcons?.[ext.slice(1)];
|
|
247
|
+
}
|
|
248
|
+
return void 0;
|
|
249
|
+
}
|
|
250
|
+
__name(detectIcon, "detectIcon");
|
|
251
|
+
function qualifyIcon(icon, defaultIconPack) {
|
|
252
|
+
if (icon.includes(":")) {
|
|
253
|
+
return icon;
|
|
254
|
+
}
|
|
255
|
+
if (icon in treeViewIcons.icons || !defaultIconPack) {
|
|
256
|
+
return `${treeViewIcons.prefix}:${icon}`;
|
|
257
|
+
}
|
|
258
|
+
return `${defaultIconPack}:${icon}`;
|
|
259
|
+
}
|
|
260
|
+
__name(qualifyIcon, "qualifyIcon");
|
|
261
|
+
function getNodeIcon(node, config) {
|
|
262
|
+
if (node.icon === "none") {
|
|
263
|
+
return void 0;
|
|
264
|
+
}
|
|
265
|
+
if (node.icon) {
|
|
266
|
+
return qualifyIcon(node.icon, config.defaultIconPack);
|
|
267
|
+
}
|
|
268
|
+
if (!config.showIcons) {
|
|
269
|
+
return void 0;
|
|
270
|
+
}
|
|
271
|
+
if (node.nodeType === "file") {
|
|
272
|
+
const detected = detectIcon(node.name, config);
|
|
273
|
+
if (detected === "none") {
|
|
274
|
+
return void 0;
|
|
275
|
+
}
|
|
276
|
+
if (detected) {
|
|
277
|
+
return qualifyIcon(detected, config.defaultIconPack);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return `${treeViewIcons.prefix}:${node.nodeType === "directory" ? "folder" : "file"}`;
|
|
281
|
+
}
|
|
282
|
+
__name(getNodeIcon, "getNodeIcon");
|
|
283
|
+
registerIconPacks([
|
|
284
|
+
{
|
|
285
|
+
name: treeViewIcons.prefix,
|
|
286
|
+
icons: treeViewIcons
|
|
287
|
+
}
|
|
288
|
+
]);
|
|
289
|
+
var ICON_SIZE = 14;
|
|
290
|
+
var ICON_GAP = 4;
|
|
291
|
+
var DESC_GAP = 16;
|
|
292
|
+
var iconSymbolId = /* @__PURE__ */ __name((diagramId, icon) => `tv-icon-${diagramId}-${icon.replace(/[^\w-]/g, "-")}`, "iconSymbolId");
|
|
293
|
+
var injectIconDefs = /* @__PURE__ */ __name(async (svg, root, config, diagramId) => {
|
|
294
|
+
const usedIcons = /* @__PURE__ */ new Set();
|
|
295
|
+
const collect = /* @__PURE__ */ __name((node) => {
|
|
296
|
+
const icon = getNodeIcon(node, config);
|
|
297
|
+
if (icon) {
|
|
298
|
+
usedIcons.add(icon);
|
|
299
|
+
}
|
|
300
|
+
node.children.forEach(collect);
|
|
301
|
+
}, "collect");
|
|
302
|
+
collect(root);
|
|
303
|
+
if (usedIcons.size === 0) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const iconSVGs = await Promise.all(
|
|
307
|
+
[...usedIcons].map(async (icon) => ({
|
|
308
|
+
icon,
|
|
309
|
+
svg: await getIconSVG(icon, {
|
|
310
|
+
height: ICON_SIZE,
|
|
311
|
+
width: ICON_SIZE
|
|
312
|
+
})
|
|
313
|
+
}))
|
|
314
|
+
);
|
|
315
|
+
const defs = svg.append("defs");
|
|
316
|
+
for (const { icon, svg: iconSVG } of iconSVGs) {
|
|
317
|
+
defs.append("g").attr("id", iconSymbolId(diagramId, icon)).html(iconSVG);
|
|
318
|
+
}
|
|
319
|
+
}, "injectIconDefs");
|
|
320
|
+
var positionLabel = /* @__PURE__ */ __name((x, y, node, domElem, config, diagramId) => {
|
|
321
|
+
const nodeGroup = domElem.append("g");
|
|
322
|
+
let cssClasses = "treeView-node-label";
|
|
323
|
+
if (node.nodeType === "directory") {
|
|
324
|
+
cssClasses += " treeView-node-dir";
|
|
325
|
+
}
|
|
326
|
+
if (node.cssClass) {
|
|
327
|
+
cssClasses += ` ${node.cssClass}`;
|
|
328
|
+
}
|
|
329
|
+
const iconOffset = ICON_SIZE + ICON_GAP;
|
|
330
|
+
const icon = getNodeIcon(node, config);
|
|
331
|
+
const showIcon = icon !== void 0;
|
|
332
|
+
if (icon) {
|
|
333
|
+
nodeGroup.append("use").attr("xlink:href", `#${iconSymbolId(diagramId, icon)}`).attr("x", x + config.paddingX).attr("y", y + config.paddingY).attr("class", "treeView-node-icon");
|
|
334
|
+
}
|
|
335
|
+
const label = nodeGroup.append("text").text(node.name).attr("dominant-baseline", "middle").attr("class", cssClasses);
|
|
336
|
+
const { height: labelHeight, width: labelWidth } = label.node().getBBox();
|
|
337
|
+
const height = labelHeight + config.paddingY * 2;
|
|
338
|
+
const labelX = x + config.paddingX + (showIcon ? iconOffset : 0);
|
|
339
|
+
label.attr("x", labelX);
|
|
340
|
+
label.attr("y", y + height / 2);
|
|
341
|
+
const labelRightEdge = labelX + labelWidth;
|
|
342
|
+
const width = labelWidth + config.paddingX * 2 + (showIcon ? iconOffset : 0);
|
|
343
|
+
node.BBox = { x, y, width, height };
|
|
344
|
+
if (node.cssClass?.split(/\s+/).includes("highlight")) {
|
|
345
|
+
nodeGroup.insert("rect", ":first-child").attr("x", x).attr("y", y + 1).attr("width", 0).attr("height", height - 2).attr("rx", 3).attr("class", "treeView-highlight-bg");
|
|
346
|
+
}
|
|
347
|
+
return { node, nodeGroup, labelRightEdge, centerY: y + height / 2 };
|
|
348
|
+
}, "positionLabel");
|
|
349
|
+
var positionLine = /* @__PURE__ */ __name((domElem, x1, y1, x2, y2, lineThickness) => {
|
|
350
|
+
return domElem.append("line").attr("x1", x1).attr("y1", y1).attr("x2", x2).attr("y2", y2).attr("stroke-width", lineThickness).attr("class", "treeView-node-line");
|
|
351
|
+
}, "positionLine");
|
|
352
|
+
var drawTree = /* @__PURE__ */ __name((elem, root, config, diagramId) => {
|
|
353
|
+
let totalHeight = 0;
|
|
354
|
+
let totalWidth = 0;
|
|
355
|
+
const renderInfos = [];
|
|
356
|
+
const drawNode = /* @__PURE__ */ __name((elem2, node, config2, depth) => {
|
|
357
|
+
const indent = depth * (config2.rowIndent + config2.paddingX);
|
|
358
|
+
const info = positionLabel(indent, totalHeight, node, elem2, config2, diagramId);
|
|
359
|
+
renderInfos.push(info);
|
|
360
|
+
const { height, width } = node.BBox;
|
|
361
|
+
positionLine(
|
|
362
|
+
elem2,
|
|
363
|
+
indent - config2.rowIndent,
|
|
364
|
+
totalHeight + height / 2,
|
|
365
|
+
indent,
|
|
366
|
+
totalHeight + height / 2,
|
|
367
|
+
config2.lineThickness
|
|
368
|
+
);
|
|
369
|
+
totalWidth = Math.max(totalWidth, indent + width);
|
|
370
|
+
totalHeight += height;
|
|
371
|
+
}, "drawNode");
|
|
372
|
+
const processNode = /* @__PURE__ */ __name((node, depth = 0) => {
|
|
373
|
+
drawNode(elem, node, config, depth);
|
|
374
|
+
node.children.forEach((child) => {
|
|
375
|
+
processNode(child, depth + 1);
|
|
376
|
+
});
|
|
377
|
+
const { x, y, height } = node.BBox;
|
|
378
|
+
if (node.children.length) {
|
|
379
|
+
const { y: endY, height: endHeight } = node.children[node.children.length - 1].BBox;
|
|
380
|
+
positionLine(
|
|
381
|
+
elem,
|
|
382
|
+
x + config.paddingX,
|
|
383
|
+
y + height,
|
|
384
|
+
x + config.paddingX,
|
|
385
|
+
endY + endHeight / 2 + config.lineThickness / 2,
|
|
386
|
+
config.lineThickness
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
}, "processNode");
|
|
390
|
+
processNode(root);
|
|
391
|
+
const nodesWithDesc = renderInfos.filter((ri) => ri.node.description);
|
|
392
|
+
if (nodesWithDesc.length > 0) {
|
|
393
|
+
const maxLabelRight = Math.max(...renderInfos.map((ri) => ri.labelRightEdge));
|
|
394
|
+
const descX = maxLabelRight + DESC_GAP;
|
|
395
|
+
for (const ri of nodesWithDesc) {
|
|
396
|
+
const desc = ri.nodeGroup.append("text").text(ri.node.description).attr("dominant-baseline", "middle").attr("class", "treeView-node-description").attr("x", descX).attr("y", ri.centerY);
|
|
397
|
+
const descBBox = desc.node().getBBox();
|
|
398
|
+
totalWidth = Math.max(totalWidth, descX + descBBox.width + config.paddingX);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
for (const ri of renderInfos) {
|
|
402
|
+
if (ri.node.cssClass?.split(/\s+/).includes("highlight")) {
|
|
403
|
+
const rect = ri.nodeGroup.select(".treeView-highlight-bg");
|
|
404
|
+
if (!rect.empty()) {
|
|
405
|
+
const rectWidth = totalWidth - ri.node.BBox.x + 8;
|
|
406
|
+
rect.attr("width", rectWidth);
|
|
407
|
+
totalWidth = Math.max(totalWidth, ri.node.BBox.x + rectWidth + 2);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return { totalHeight, totalWidth };
|
|
412
|
+
}, "drawTree");
|
|
413
|
+
var draw = /* @__PURE__ */ __name(async (text, id, _ver, diagObj) => {
|
|
414
|
+
log.debug("Rendering treeView diagram\n" + text);
|
|
415
|
+
const db2 = diagObj.db;
|
|
416
|
+
const root = db2.getRoot();
|
|
417
|
+
const config = db2.getConfig();
|
|
418
|
+
const svg = selectSvgElement(id);
|
|
419
|
+
await injectIconDefs(svg, root, config, id);
|
|
420
|
+
const treeElem = svg.append("g");
|
|
421
|
+
treeElem.attr("class", "tree-view");
|
|
422
|
+
const { totalHeight, totalWidth } = drawTree(treeElem, root, config, id);
|
|
423
|
+
svg.attr("viewBox", `-${config.lineThickness / 2} 0 ${totalWidth} ${totalHeight}`);
|
|
424
|
+
configureSvgSize(svg, totalHeight, totalWidth, config.useMaxWidth);
|
|
425
|
+
}, "draw");
|
|
426
|
+
var renderer = {
|
|
427
|
+
draw
|
|
428
|
+
};
|
|
429
|
+
var renderer_default = renderer;
|
|
430
|
+
var defaultTreeViewDiagramStyles = {
|
|
431
|
+
labelFontSize: "16px",
|
|
432
|
+
labelColor: "black",
|
|
433
|
+
lineColor: "black",
|
|
434
|
+
iconColor: "#546e7a",
|
|
435
|
+
descriptionColor: "#6a9955",
|
|
436
|
+
highlightBg: "rgba(255, 193, 7, 0.15)",
|
|
437
|
+
highlightStroke: "#ffc107"
|
|
438
|
+
};
|
|
439
|
+
var styles = /* @__PURE__ */ __name(({
|
|
440
|
+
treeView
|
|
441
|
+
}) => {
|
|
442
|
+
const {
|
|
443
|
+
labelFontSize,
|
|
444
|
+
labelColor,
|
|
445
|
+
lineColor,
|
|
446
|
+
iconColor,
|
|
447
|
+
descriptionColor,
|
|
448
|
+
highlightBg,
|
|
449
|
+
highlightStroke
|
|
450
|
+
} = cleanAndMerge(defaultTreeViewDiagramStyles, treeView);
|
|
451
|
+
return `
|
|
452
|
+
.treeView-node-label {
|
|
453
|
+
font-size: ${labelFontSize};
|
|
454
|
+
fill: ${labelColor};
|
|
455
|
+
white-space: pre;
|
|
456
|
+
}
|
|
457
|
+
.treeView-node-dir {
|
|
458
|
+
font-weight: bold;
|
|
459
|
+
}
|
|
460
|
+
.treeView-node-line {
|
|
461
|
+
stroke: ${lineColor};
|
|
462
|
+
}
|
|
463
|
+
.treeView-node-icon {
|
|
464
|
+
color: ${iconColor};
|
|
465
|
+
}
|
|
466
|
+
.treeView-node-description {
|
|
467
|
+
font-size: ${labelFontSize};
|
|
468
|
+
fill: ${descriptionColor};
|
|
469
|
+
font-style: italic;
|
|
470
|
+
white-space: pre;
|
|
471
|
+
}
|
|
472
|
+
.treeView-highlight-bg {
|
|
473
|
+
fill: ${highlightBg};
|
|
474
|
+
stroke: ${highlightStroke};
|
|
475
|
+
stroke-width: 1;
|
|
476
|
+
}
|
|
477
|
+
`;
|
|
478
|
+
}, "styles");
|
|
479
|
+
var styles_default = styles;
|
|
480
|
+
var diagram = {
|
|
481
|
+
db: db_default,
|
|
482
|
+
renderer: renderer_default,
|
|
483
|
+
parser,
|
|
484
|
+
styles: styles_default
|
|
485
|
+
};
|
|
486
|
+
export {
|
|
487
|
+
diagram
|
|
488
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as populateCommonDb } from "./chunk-
|
|
2
|
-
import {
|
|
3
|
-
import { p as parse, i as isEmResetFrame } from "./
|
|
1
|
+
import { p as populateCommonDb } from "./chunk-JWPE2WC7-OPg0X7jU.js";
|
|
2
|
+
import { a4 as getDiagramTitle, a3 as setDiagramTitle, C as setAccDescription, H as getAccDescription, J as getAccTitle, K as setAccTitle, _ as __name, O as log, L as getConfig2, N as select, ad as setupGraphViewbox2, a5 as clear, ae as cleanAndMerge, ac as getConfig, af as defaultConfig_default, W as sanitizeText, Y as wrapLabel, aZ as calculateTextDimensions } from "./index-BahRAP01.js";
|
|
3
|
+
import { p as parse, i as isEmResetFrame } from "./cynefin-VYW2F7L2-BiEI2vQb.js";
|
|
4
4
|
var PositionFrameKind = "position frame";
|
|
5
5
|
var FramePositionedKind = "frame positioned";
|
|
6
6
|
var PositionRelationKind = "position relation";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { p as parse } from "./
|
|
1
|
+
import { p as populateCommonDb } from "./chunk-JWPE2WC7-OPg0X7jU.js";
|
|
2
|
+
import { _ as __name, ae as cleanAndMerge, ah as selectSvgElement, Q as configureSvgSize, O as log, K as setAccTitle, J as getAccTitle, a3 as setDiagramTitle, a4 as getDiagramTitle, H as getAccDescription, C as setAccDescription, ac as getConfig, af as defaultConfig_default, a5 as clear } from "./index-BahRAP01.js";
|
|
3
|
+
import { p as parse } from "./cynefin-VYW2F7L2-BiEI2vQb.js";
|
|
4
4
|
var DEFAULT_PACKET_CONFIG = defaultConfig_default.packet;
|
|
5
5
|
var PacketDB = class {
|
|
6
6
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { p as parse } from "./
|
|
1
|
+
import { p as populateCommonDb } from "./chunk-JWPE2WC7-OPg0X7jU.js";
|
|
2
|
+
import { _ as __name, ax as getThemeVariables3, ac as getConfig, ae as cleanAndMerge, ah as selectSvgElement, Q as configureSvgSize, O as log, cB as styles2String, N as select, K as setAccTitle, J as getAccTitle, a3 as setDiagramTitle, a4 as getDiagramTitle, H as getAccDescription, C as setAccDescription, af as defaultConfig_default, cC as isLabelStyle, a5 as clear } from "./index-BahRAP01.js";
|
|
3
|
+
import { s as setupViewPortForSVG } from "./chunk-KBJHAD2P-qbM4OnIO.js";
|
|
4
|
+
import { p as parse } from "./cynefin-VYW2F7L2-BiEI2vQb.js";
|
|
5
5
|
import { b as format } from "./defaultLocale-B2RvLBDe.js";
|
|
6
6
|
import { o as ordinal } from "./ordinal-BD3Y6v77.js";
|
|
7
7
|
import "./init-CTO7spbL.js";
|
|
@@ -617,7 +617,7 @@ var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
|
617
617
|
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
618
618
|
return styles.nodeStyles + ";" + styles.borderStyles.join(";");
|
|
619
619
|
});
|
|
620
|
-
sections.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", SECTION_HEADER_HEIGHT / 2).attr("dominant-baseline", "middle").text((d) => d.depth === 0 ? "" : d.data.name).attr("font-weight", "bold").attr("style", (d) => {
|
|
620
|
+
sections.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", SECTION_HEADER_HEIGHT / 2).attr("dominant-baseline", "middle").text((d) => d.depth === 0 ? "" : d.data.name).attr("font-weight", "bold").attr("clip-path", (_d, i) => `url(#clip-section-${id}-${i})`).attr("style", (d) => {
|
|
621
621
|
if (d.depth === 0) {
|
|
622
622
|
return "display: none;";
|
|
623
623
|
}
|
|
@@ -678,6 +678,14 @@ var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
680
|
const leafNodes = treemapData.leaves();
|
|
681
|
+
const isComplexTreemap = leafNodes.length > 20;
|
|
682
|
+
const baseLabelFontSize = isComplexTreemap ? 16 : 38;
|
|
683
|
+
const baseValueFontSize = isComplexTreemap ? 14 : 28;
|
|
684
|
+
const minLabelFontSize = isComplexTreemap ? 4 : 8;
|
|
685
|
+
const minValueFontSize = isComplexTreemap ? 4 : 6;
|
|
686
|
+
const labelPadding = isComplexTreemap ? 2 : 4;
|
|
687
|
+
const minDisplayThreshold = isComplexTreemap ? 8 : 10;
|
|
688
|
+
const spacingBetweenLabelAndValue = isComplexTreemap ? 1 : 2;
|
|
681
689
|
const cell = g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class", (d, i) => {
|
|
682
690
|
return `treemapNode treemapLeafGroup leaf${i}${d.data.classSelector ? ` ${d.data.classSelector}` : ""}x`;
|
|
683
691
|
}).attr("transform", (d) => `translate(${d.x0},${d.y0})`);
|
|
@@ -691,7 +699,7 @@ var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
|
691
699
|
}).attr("stroke-width", 3);
|
|
692
700
|
cell.append("clipPath").attr("id", (_d, i) => `clip-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 4)).attr("height", (d) => Math.max(0, d.y1 - d.y0 - 4));
|
|
693
701
|
const leafLabels = cell.append("text").attr("class", "treemapLabel").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", (d) => (d.y1 - d.y0) / 2).attr("style", (d) => {
|
|
694
|
-
const labelStyles =
|
|
702
|
+
const labelStyles = `text-anchor: middle; dominant-baseline: middle; font-size: ${baseLabelFontSize}px;fill:` + colorScaleLabel(d.data.name) + ";";
|
|
695
703
|
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
696
704
|
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
|
697
705
|
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.data.name);
|
|
@@ -700,33 +708,28 @@ var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
|
700
708
|
const nodeWidth = d.x1 - d.x0;
|
|
701
709
|
const nodeHeight = d.y1 - d.y0;
|
|
702
710
|
const textNode = self.node();
|
|
703
|
-
const
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
if (availableWidth < 10 || availableHeight < 10) {
|
|
711
|
+
const availableWidth = nodeWidth - 2 * labelPadding;
|
|
712
|
+
const availableHeight = nodeHeight - 2 * labelPadding;
|
|
713
|
+
if (availableWidth < minDisplayThreshold || availableHeight < minDisplayThreshold) {
|
|
707
714
|
self.style("display", "none");
|
|
708
715
|
return;
|
|
709
716
|
}
|
|
710
717
|
let currentLabelFontSize = parseInt(self.style("font-size"), 10);
|
|
711
|
-
const minLabelFontSize = 8;
|
|
712
|
-
const originalValueRelFontSize = 28;
|
|
713
718
|
const valueScaleFactor = 0.6;
|
|
714
|
-
const minValueFontSize = 6;
|
|
715
|
-
const spacingBetweenLabelAndValue = 2;
|
|
716
719
|
while (textNode.getComputedTextLength() > availableWidth && currentLabelFontSize > minLabelFontSize) {
|
|
717
720
|
currentLabelFontSize--;
|
|
718
721
|
self.style("font-size", `${currentLabelFontSize}px`);
|
|
719
722
|
}
|
|
720
723
|
let prospectiveValueFontSize = Math.max(
|
|
721
724
|
minValueFontSize,
|
|
722
|
-
Math.min(
|
|
725
|
+
Math.min(baseValueFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
|
|
723
726
|
);
|
|
724
727
|
let combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
|
|
725
728
|
while (combinedHeight > availableHeight && currentLabelFontSize > minLabelFontSize) {
|
|
726
729
|
currentLabelFontSize--;
|
|
727
730
|
prospectiveValueFontSize = Math.max(
|
|
728
731
|
minValueFontSize,
|
|
729
|
-
Math.min(
|
|
732
|
+
Math.min(baseValueFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
|
|
730
733
|
);
|
|
731
734
|
if (prospectiveValueFontSize < minValueFontSize && currentLabelFontSize === minLabelFontSize) {
|
|
732
735
|
break;
|
|
@@ -735,15 +738,21 @@ var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
|
735
738
|
combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
|
|
736
739
|
}
|
|
737
740
|
self.style("font-size", `${currentLabelFontSize}px`);
|
|
738
|
-
if (
|
|
739
|
-
|
|
741
|
+
if (isComplexTreemap) {
|
|
742
|
+
if (currentLabelFontSize < minLabelFontSize || availableHeight < minLabelFontSize) {
|
|
743
|
+
self.style("display", "none");
|
|
744
|
+
}
|
|
745
|
+
} else {
|
|
746
|
+
if (textNode.getComputedTextLength() > availableWidth || currentLabelFontSize < minLabelFontSize || availableHeight < currentLabelFontSize) {
|
|
747
|
+
self.style("display", "none");
|
|
748
|
+
}
|
|
740
749
|
}
|
|
741
750
|
});
|
|
742
751
|
if (config.showValues !== false) {
|
|
743
752
|
const leafValues = cell.append("text").attr("class", "treemapValue").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", function(d) {
|
|
744
753
|
return (d.y1 - d.y0) / 2;
|
|
745
754
|
}).attr("style", (d) => {
|
|
746
|
-
const labelStyles =
|
|
755
|
+
const labelStyles = `text-anchor: middle; dominant-baseline: hanging; font-size: ${baseValueFontSize}px;fill:` + colorScaleLabel(d.data.name) + ";";
|
|
747
756
|
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
748
757
|
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
|
749
758
|
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.value ? valueFormat(d.value) : "");
|
|
@@ -760,13 +769,10 @@ var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
|
760
769
|
return;
|
|
761
770
|
}
|
|
762
771
|
const finalLabelFontSize = parseFloat(labelElement.style("font-size"));
|
|
763
|
-
const originalValueFontSize = 28;
|
|
764
772
|
const valueScaleFactor = 0.6;
|
|
765
|
-
const minValueFontSize = 6;
|
|
766
|
-
const spacingBetweenLabelAndValue = 2;
|
|
767
773
|
const actualValueFontSize = Math.max(
|
|
768
774
|
minValueFontSize,
|
|
769
|
-
Math.min(
|
|
775
|
+
Math.min(baseValueFontSize, Math.round(finalLabelFontSize * valueScaleFactor))
|
|
770
776
|
);
|
|
771
777
|
valueTextElement.style("font-size", `${actualValueFontSize}px`);
|
|
772
778
|
const labelCenterY = (d.y1 - d.y0) / 2;
|
|
@@ -776,7 +782,7 @@ var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
|
776
782
|
const nodeTotalHeight = d.y1 - d.y0;
|
|
777
783
|
const cellBottomPadding = 4;
|
|
778
784
|
const maxValueBottomY = nodeTotalHeight - cellBottomPadding;
|
|
779
|
-
const availableWidthForValue = nodeWidth - 2 *
|
|
785
|
+
const availableWidthForValue = nodeWidth - 2 * labelPadding;
|
|
780
786
|
if (valueTextElement.node().getComputedTextLength() > availableWidthForValue || valueTopActualY + actualValueFontSize > maxValueBottomY || actualValueFontSize < minValueFontSize) {
|
|
781
787
|
valueTextElement.style("display", "none");
|
|
782
788
|
} else {
|