@umami/shiso 1.11.0 → 1.13.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/bin/shiso.mjs +20 -1
- package/dist/chunks/App.js +412 -51
- package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
- package/dist/chunks/arc.js +130 -0
- package/dist/chunks/architecture-7GRP2DOG.js +4 -0
- package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
- package/dist/chunks/array.js +8 -0
- package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
- package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
- package/dist/chunks/channel.js +9 -0
- package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
- package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
- package/dist/chunks/chunk-5VM5RSS4.js +21 -0
- package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
- package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
- package/dist/chunks/chunk-F27PBJKO.js +95 -0
- package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
- package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
- package/dist/chunks/chunk-GVQU2GXP.js +58 -0
- package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
- package/dist/chunks/chunk-JWPE2WC7.js +12 -0
- package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
- package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
- package/dist/chunks/chunk-P2QGCYS3.js +95 -0
- package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
- package/dist/chunks/chunk-PWAF6VOD.js +467 -0
- package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
- package/dist/chunks/chunk-SVP7TREG.js +686 -0
- package/dist/chunks/chunk-TICWLB2K.js +3800 -0
- package/dist/chunks/chunk-XXDRQBXY.js +12 -0
- package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
- package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
- package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
- package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
- package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
- package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
- package/dist/chunks/cytoscape.esm.js +28282 -0
- package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
- package/dist/chunks/dagre.js +4235 -0
- package/dist/chunks/defaultLocale.js +246 -0
- package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
- package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
- package/dist/chunks/diagram-VSXAHHWV.js +553 -0
- package/dist/chunks/diagram-VX7I27RA.js +798 -0
- package/dist/chunks/diagram-Z3DM3KII.js +186 -0
- package/dist/chunks/dist.js +92 -0
- package/dist/chunks/docs.js +989 -93
- package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
- package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
- package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
- package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
- package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
- package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
- package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
- package/dist/chunks/graphlib.js +4194 -0
- package/dist/chunks/info-A6RAGUB7.js +4 -0
- package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
- package/dist/chunks/init.js +14 -0
- package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
- package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
- package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
- package/dist/chunks/katex.js +26463 -0
- package/dist/chunks/line.js +48 -0
- package/dist/chunks/linear.js +391 -0
- package/dist/chunks/mermaid-parser.core.js +754 -0
- package/dist/chunks/mermaid.core.js +4898 -0
- package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
- package/dist/chunks/ordinal.js +84 -0
- package/dist/chunks/packet-AYTQ26CC.js +4 -0
- package/dist/chunks/path.js +106 -0
- package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
- package/dist/chunks/pie-WAS4IAKB.js +4 -0
- package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
- package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
- package/dist/chunks/radar-RG4KPBEZ.js +4 -0
- package/dist/chunks/railroad-74A4TZTK.js +4 -0
- package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
- package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
- package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
- package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
- package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
- package/dist/chunks/rough.esm.js +1396 -0
- package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
- package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
- package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
- package/dist/chunks/src.js +2653 -0
- package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
- package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
- package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
- package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
- package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
- package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
- package/dist/chunks/treemap-WGGIJYW6.js +4 -0
- package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
- package/dist/chunks/wardley-WFR3VGLG.js +4 -0
- package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
- package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
- package/dist/components.js +2 -2
- package/dist/entry-client.js +2 -2
- package/dist/entry-server.js +31 -3
- package/docs.schema.json +90 -0
- package/mdx.config.ts +13 -97
- package/package.json +6 -4
- package/scripts/build-runtime.mjs +1 -0
- package/scripts/check-content.mjs +358 -0
- package/scripts/expand-navigation-globs.mjs +277 -0
- package/scripts/expand-openapi-navigation.mjs +94 -0
- package/scripts/generate-openapi.mjs +117 -0
- package/scripts/generate-search-index.mjs +31 -1
- package/scripts/lib/openapi.mjs +653 -0
- package/scripts/load-docs-config.mjs +52 -6
- package/scripts/load-shiso-config.mjs +45 -3
- package/scripts/prerender.mjs +83 -3
- package/scripts/vite-docs-config.mjs +27 -6
- package/src/App.tsx +0 -1
- package/src/components/CodeBlock.tsx +108 -8
- package/src/components/DocContent.tsx +18 -0
- package/src/components/Docs.tsx +45 -17
- package/src/components/OpenApiOperation.tsx +205 -0
- package/src/components/SideNav.tsx +13 -2
- package/src/components/docs/Changelog.tsx +163 -0
- package/src/components/docs/CodeGroup.tsx +6 -2
- package/src/components/docs/Mermaid.tsx +164 -0
- package/src/components/docs/Panel.tsx +23 -0
- package/src/components/docs/ParamField.tsx +17 -5
- package/src/components/docs/PropertiesTable.tsx +2 -2
- package/src/components/docs/ResponseField.tsx +17 -5
- package/src/components/docs/Tiles.tsx +59 -0
- package/src/components/docs/Tree.tsx +359 -0
- package/src/components/docs/Update.tsx +72 -0
- package/src/components/docs/index.ts +7 -0
- package/src/components/docs/panel-context.tsx +25 -0
- package/src/components/docs/styles.ts +49 -0
- package/src/components/icons/index.ts +4 -0
- package/src/entry-server.tsx +50 -0
- package/src/lib/code-blocks.ts +18 -0
- package/src/lib/code-meta.ts +87 -0
- package/src/lib/docs-config.ts +4 -1
- package/src/lib/openapi.generated.ts +4 -0
- package/src/lib/openapi.ts +63 -0
- package/src/lib/rehype-shiki.ts +213 -0
- package/src/lib/site-model.ts +2 -0
- package/src/lib/types.ts +116 -2
- package/src/styles/global.css +63 -73
- package/types/components.d.ts +79 -0
- package/types/config.d.ts +11 -4
- package/vite.config.ts +49 -3
- package/CHANGELOG.md +0 -171
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatDecimal.js
|
|
2
|
+
function formatDecimal_default(x) {
|
|
3
|
+
return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
|
|
4
|
+
}
|
|
5
|
+
function formatDecimalParts(x, p) {
|
|
6
|
+
if (!isFinite(x) || x === 0) return null;
|
|
7
|
+
var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
|
|
8
|
+
return [coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1)];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/exponent.js
|
|
13
|
+
function exponent_default(x) {
|
|
14
|
+
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatGroup.js
|
|
19
|
+
function formatGroup_default(grouping, thousands) {
|
|
20
|
+
return function(value, width) {
|
|
21
|
+
var i = value.length, t = [], j = 0, g = grouping[0], length = 0;
|
|
22
|
+
while (i > 0 && g > 0) {
|
|
23
|
+
if (length + g + 1 > width) g = Math.max(1, width - length);
|
|
24
|
+
t.push(value.substring(i -= g, i + g));
|
|
25
|
+
if ((length += g + 1) > width) break;
|
|
26
|
+
g = grouping[j = (j + 1) % grouping.length];
|
|
27
|
+
}
|
|
28
|
+
return t.reverse().join(thousands);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatNumerals.js
|
|
34
|
+
function formatNumerals_default(numerals) {
|
|
35
|
+
return function(value) {
|
|
36
|
+
return value.replace(/[0-9]/g, function(i) {
|
|
37
|
+
return numerals[+i];
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatSpecifier.js
|
|
44
|
+
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
45
|
+
function formatSpecifier(specifier) {
|
|
46
|
+
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
|
47
|
+
var match;
|
|
48
|
+
return new FormatSpecifier({
|
|
49
|
+
fill: match[1],
|
|
50
|
+
align: match[2],
|
|
51
|
+
sign: match[3],
|
|
52
|
+
symbol: match[4],
|
|
53
|
+
zero: match[5],
|
|
54
|
+
width: match[6],
|
|
55
|
+
comma: match[7],
|
|
56
|
+
precision: match[8] && match[8].slice(1),
|
|
57
|
+
trim: match[9],
|
|
58
|
+
type: match[10]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
formatSpecifier.prototype = FormatSpecifier.prototype;
|
|
62
|
+
function FormatSpecifier(specifier) {
|
|
63
|
+
this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
|
|
64
|
+
this.align = specifier.align === void 0 ? ">" : specifier.align + "";
|
|
65
|
+
this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
|
|
66
|
+
this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
|
|
67
|
+
this.zero = !!specifier.zero;
|
|
68
|
+
this.width = specifier.width === void 0 ? void 0 : +specifier.width;
|
|
69
|
+
this.comma = !!specifier.comma;
|
|
70
|
+
this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
|
|
71
|
+
this.trim = !!specifier.trim;
|
|
72
|
+
this.type = specifier.type === void 0 ? "" : specifier.type + "";
|
|
73
|
+
}
|
|
74
|
+
FormatSpecifier.prototype.toString = function() {
|
|
75
|
+
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatTrim.js
|
|
80
|
+
function formatTrim_default(s) {
|
|
81
|
+
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) switch (s[i]) {
|
|
82
|
+
case ".":
|
|
83
|
+
i0 = i1 = i;
|
|
84
|
+
break;
|
|
85
|
+
case "0":
|
|
86
|
+
if (i0 === 0) i0 = i;
|
|
87
|
+
i1 = i;
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
if (!+s[i]) break out;
|
|
91
|
+
if (i0 > 0) i0 = 0;
|
|
92
|
+
}
|
|
93
|
+
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatPrefixAuto.js
|
|
98
|
+
var prefixExponent;
|
|
99
|
+
function formatPrefixAuto_default(x, p) {
|
|
100
|
+
var d = formatDecimalParts(x, p);
|
|
101
|
+
if (!d) return prefixExponent = void 0, x.toPrecision(p);
|
|
102
|
+
var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
|
|
103
|
+
return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatRounded.js
|
|
108
|
+
function formatRounded_default(x, p) {
|
|
109
|
+
var d = formatDecimalParts(x, p);
|
|
110
|
+
if (!d) return x + "";
|
|
111
|
+
var coefficient = d[0], exponent = d[1];
|
|
112
|
+
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatTypes.js
|
|
117
|
+
var formatTypes_default = {
|
|
118
|
+
"%": (x, p) => (x * 100).toFixed(p),
|
|
119
|
+
"b": (x) => Math.round(x).toString(2),
|
|
120
|
+
"c": (x) => x + "",
|
|
121
|
+
"d": formatDecimal_default,
|
|
122
|
+
"e": (x, p) => x.toExponential(p),
|
|
123
|
+
"f": (x, p) => x.toFixed(p),
|
|
124
|
+
"g": (x, p) => x.toPrecision(p),
|
|
125
|
+
"o": (x) => Math.round(x).toString(8),
|
|
126
|
+
"p": (x, p) => formatRounded_default(x * 100, p),
|
|
127
|
+
"r": formatRounded_default,
|
|
128
|
+
"s": formatPrefixAuto_default,
|
|
129
|
+
"X": (x) => Math.round(x).toString(16).toUpperCase(),
|
|
130
|
+
"x": (x) => Math.round(x).toString(16)
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/identity.js
|
|
135
|
+
function identity_default(x) {
|
|
136
|
+
return x;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/locale.js
|
|
141
|
+
var map = Array.prototype.map;
|
|
142
|
+
var prefixes = [
|
|
143
|
+
"y",
|
|
144
|
+
"z",
|
|
145
|
+
"a",
|
|
146
|
+
"f",
|
|
147
|
+
"p",
|
|
148
|
+
"n",
|
|
149
|
+
"µ",
|
|
150
|
+
"m",
|
|
151
|
+
"",
|
|
152
|
+
"k",
|
|
153
|
+
"M",
|
|
154
|
+
"G",
|
|
155
|
+
"T",
|
|
156
|
+
"P",
|
|
157
|
+
"E",
|
|
158
|
+
"Z",
|
|
159
|
+
"Y"
|
|
160
|
+
];
|
|
161
|
+
function locale_default(locale) {
|
|
162
|
+
var group = locale.grouping === void 0 || locale.thousands === void 0 ? identity_default : formatGroup_default(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === void 0 ? "" : locale.currency[0] + "", currencySuffix = locale.currency === void 0 ? "" : locale.currency[1] + "", decimal = locale.decimal === void 0 ? "." : locale.decimal + "", numerals = locale.numerals === void 0 ? identity_default : formatNumerals_default(map.call(locale.numerals, String)), percent = locale.percent === void 0 ? "%" : locale.percent + "", minus = locale.minus === void 0 ? "−" : locale.minus + "", nan = locale.nan === void 0 ? "NaN" : locale.nan + "";
|
|
163
|
+
function newFormat(specifier, options) {
|
|
164
|
+
specifier = formatSpecifier(specifier);
|
|
165
|
+
var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
|
|
166
|
+
if (type === "n") comma = true, type = "g";
|
|
167
|
+
else if (!formatTypes_default[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
|
|
168
|
+
if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
|
|
169
|
+
var prefix = (options && options.prefix !== void 0 ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== void 0 ? options.suffix : "");
|
|
170
|
+
var formatType = formatTypes_default[type], maybeSuffix = /[defgprs%]/.test(type);
|
|
171
|
+
precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
|
|
172
|
+
function format(value) {
|
|
173
|
+
var valuePrefix = prefix, valueSuffix = suffix, i, n, c;
|
|
174
|
+
if (type === "c") {
|
|
175
|
+
valueSuffix = formatType(value) + valueSuffix;
|
|
176
|
+
value = "";
|
|
177
|
+
} else {
|
|
178
|
+
value = +value;
|
|
179
|
+
var valueNegative = value < 0 || 1 / value < 0;
|
|
180
|
+
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
|
|
181
|
+
if (trim) value = formatTrim_default(value);
|
|
182
|
+
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
|
|
183
|
+
valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
|
184
|
+
valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== void 0 ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
185
|
+
if (maybeSuffix) {
|
|
186
|
+
i = -1, n = value.length;
|
|
187
|
+
while (++i < n) if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
|
188
|
+
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
|
189
|
+
value = value.slice(0, i);
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (comma && !zero) value = group(value, Infinity);
|
|
195
|
+
var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
|
196
|
+
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
|
197
|
+
switch (align) {
|
|
198
|
+
case "<":
|
|
199
|
+
value = valuePrefix + value + valueSuffix + padding;
|
|
200
|
+
break;
|
|
201
|
+
case "=":
|
|
202
|
+
value = valuePrefix + padding + value + valueSuffix;
|
|
203
|
+
break;
|
|
204
|
+
case "^":
|
|
205
|
+
value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
|
|
206
|
+
break;
|
|
207
|
+
default: value = padding + valuePrefix + value + valueSuffix;
|
|
208
|
+
}
|
|
209
|
+
return numerals(value);
|
|
210
|
+
}
|
|
211
|
+
format.toString = function() {
|
|
212
|
+
return specifier + "";
|
|
213
|
+
};
|
|
214
|
+
return format;
|
|
215
|
+
}
|
|
216
|
+
function formatPrefix(specifier, value) {
|
|
217
|
+
var e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), { suffix: prefixes[8 + e / 3] });
|
|
218
|
+
return function(value) {
|
|
219
|
+
return f(k * value);
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
format: newFormat,
|
|
224
|
+
formatPrefix
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region ../../node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/defaultLocale.js
|
|
230
|
+
var locale;
|
|
231
|
+
var format;
|
|
232
|
+
var formatPrefix;
|
|
233
|
+
defaultLocale({
|
|
234
|
+
thousands: ",",
|
|
235
|
+
grouping: [3],
|
|
236
|
+
currency: ["$", ""]
|
|
237
|
+
});
|
|
238
|
+
function defaultLocale(definition) {
|
|
239
|
+
locale = locale_default(definition);
|
|
240
|
+
format = locale.format;
|
|
241
|
+
formatPrefix = locale.formatPrefix;
|
|
242
|
+
return locale;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
//#endregion
|
|
246
|
+
export { exponent_default as i, formatPrefix as n, formatSpecifier as r, format as t };
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { n as parse } from "./mermaid-parser.core.js";
|
|
2
|
+
import { n as __name } from "./chunk-Y2CYZVJY.js";
|
|
3
|
+
import { m as log } from "./src.js";
|
|
4
|
+
import { H as setAccDescription, K as setDiagramTitle, U as setAccTitle, a as clear, b as getConfig, c as configureSvgSize, f as defaultConfig_default, v as getAccDescription, w as getDiagramTitle, y as getAccTitle, z as sanitizeText } from "./chunk-DU6HZSFF.js";
|
|
5
|
+
import { i as cleanAndMerge } from "./chunk-75Z2AOVW.js";
|
|
6
|
+
import { t as populateCommonDb } from "./chunk-JWPE2WC7.js";
|
|
7
|
+
import { r as registerIconPacks, t as getIconSVG } from "./chunk-PWAF6VOD.js";
|
|
8
|
+
import { t as ImperativeState } from "./chunk-2Q5K7J3B.js";
|
|
9
|
+
import { f as selectSvgElement } from "./mermaid.core.js";
|
|
10
|
+
|
|
11
|
+
//#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/diagram-S7CK7UJ4.mjs
|
|
12
|
+
var ALL_BOX_CHARS = /[─━│┃└┗├┣]/;
|
|
13
|
+
var BRANCH_CHAR = /[└┗├┣]/;
|
|
14
|
+
var DASH_CHAR = /[─━]/;
|
|
15
|
+
var DECORATION_ONLY = /^[\s│┃]+$/;
|
|
16
|
+
var METADATA_LINE = /^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/;
|
|
17
|
+
var COMMENT_LINE = /^\s*%%/;
|
|
18
|
+
var INDENT_UNIT = " ";
|
|
19
|
+
function isBoxDrawingFormat(lines) {
|
|
20
|
+
return lines.some((line) => ALL_BOX_CHARS.test(line));
|
|
21
|
+
}
|
|
22
|
+
__name(isBoxDrawingFormat, "isBoxDrawingFormat");
|
|
23
|
+
function inferSegmentWidth(contentLines) {
|
|
24
|
+
for (const line of contentLines) {
|
|
25
|
+
const match = BRANCH_CHAR.exec(line);
|
|
26
|
+
if (match?.index && match.index > 0) return match.index;
|
|
27
|
+
}
|
|
28
|
+
return 4;
|
|
29
|
+
}
|
|
30
|
+
__name(inferSegmentWidth, "inferSegmentWidth");
|
|
31
|
+
function remapErrorLines(message, lineMap) {
|
|
32
|
+
return message.replace(/\bline\s+(\d+)\b/gi, (match, lineStr) => {
|
|
33
|
+
const line = parseInt(lineStr, 10);
|
|
34
|
+
const original = lineMap.get(line);
|
|
35
|
+
return original ? `line ${original}` : match;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
__name(remapErrorLines, "remapErrorLines");
|
|
39
|
+
function preprocessBoxDrawing(input) {
|
|
40
|
+
const lines = input.split("\n");
|
|
41
|
+
const lineMap = /* @__PURE__ */ new Map();
|
|
42
|
+
let keywordIdx = -1;
|
|
43
|
+
for (const [i, line] of lines.entries()) if (line.trim() === "treeView-beta") {
|
|
44
|
+
keywordIdx = i;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
if (keywordIdx === -1) return {
|
|
48
|
+
text: input,
|
|
49
|
+
lineMap
|
|
50
|
+
};
|
|
51
|
+
const contentLineTexts = [];
|
|
52
|
+
for (let i = keywordIdx + 1; i < lines.length; i++) {
|
|
53
|
+
const line = lines[i];
|
|
54
|
+
if (line.trim() === "" || COMMENT_LINE.test(line) || METADATA_LINE.test(line)) continue;
|
|
55
|
+
if (DECORATION_ONLY.test(line)) continue;
|
|
56
|
+
contentLineTexts.push(line.replace(/\t/g, " "));
|
|
57
|
+
}
|
|
58
|
+
if (!isBoxDrawingFormat(contentLineTexts)) return {
|
|
59
|
+
text: input,
|
|
60
|
+
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)) continue;
|
|
93
|
+
const normalized = line.replace(/\t/g, " ");
|
|
94
|
+
const branchMatch = BRANCH_CHAR.exec(normalized);
|
|
95
|
+
if (branchMatch?.index !== void 0) {
|
|
96
|
+
const branchCol = branchMatch.index;
|
|
97
|
+
const depth = Math.round(branchCol / segmentWidth) + 1;
|
|
98
|
+
let pos = branchCol + 1;
|
|
99
|
+
while (pos < normalized.length && DASH_CHAR.test(normalized[pos])) pos++;
|
|
100
|
+
while (pos < normalized.length && normalized[pos] === " ") pos++;
|
|
101
|
+
const content = normalized.slice(pos).trimEnd();
|
|
102
|
+
if (!content) throw new Error(`Line ${origLineNo}: Empty node \u2014 expected a filename or directory name after the box-drawing prefix`);
|
|
103
|
+
const indent = INDENT_UNIT.repeat(depth);
|
|
104
|
+
outputLines.push(indent + content);
|
|
105
|
+
outLineNo++;
|
|
106
|
+
lineMap.set(outLineNo, origLineNo);
|
|
107
|
+
} else if (/^[\s─━│┃└┗├┣]+$/.test(normalized)) continue;
|
|
108
|
+
else if (ALL_BOX_CHARS.test(normalized)) {
|
|
109
|
+
outputLines.push(line);
|
|
110
|
+
outLineNo++;
|
|
111
|
+
lineMap.set(outLineNo, origLineNo);
|
|
112
|
+
} else if (/^\s+/.test(normalized)) throw new Error(`Line ${origLineNo}: Unexpected indentation without box-drawing characters. In box-drawing format, use \u251C\u2500\u2500 or \u2514\u2500\u2500 prefixes for indented nodes.`);
|
|
113
|
+
else {
|
|
114
|
+
outputLines.push(line);
|
|
115
|
+
outLineNo++;
|
|
116
|
+
lineMap.set(outLineNo, origLineNo);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
text: outputLines.join("\n"),
|
|
121
|
+
lineMap
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
__name(preprocessBoxDrawing, "preprocessBoxDrawing");
|
|
125
|
+
var state = new ImperativeState(() => ({
|
|
126
|
+
cnt: 1,
|
|
127
|
+
stack: [{
|
|
128
|
+
id: 0,
|
|
129
|
+
level: -1,
|
|
130
|
+
name: "/",
|
|
131
|
+
nodeType: "directory",
|
|
132
|
+
children: []
|
|
133
|
+
}]
|
|
134
|
+
}));
|
|
135
|
+
var clear2 = /* @__PURE__ */ __name(() => {
|
|
136
|
+
state.reset();
|
|
137
|
+
clear();
|
|
138
|
+
}, "clear");
|
|
139
|
+
var getRoot = /* @__PURE__ */ __name(() => {
|
|
140
|
+
return state.records.stack[0];
|
|
141
|
+
}, "getRoot");
|
|
142
|
+
var getCount = /* @__PURE__ */ __name(() => state.records.cnt, "getCount");
|
|
143
|
+
var defaultConfig = defaultConfig_default.treeView;
|
|
144
|
+
var db_default = {
|
|
145
|
+
clear: clear2,
|
|
146
|
+
addNode: /* @__PURE__ */ __name((level, name, nodeType, cssClass, icon, description) => {
|
|
147
|
+
while (level <= state.records.stack[state.records.stack.length - 1].level) state.records.stack.pop();
|
|
148
|
+
const node = {
|
|
149
|
+
id: state.records.cnt++,
|
|
150
|
+
level,
|
|
151
|
+
name,
|
|
152
|
+
nodeType,
|
|
153
|
+
icon,
|
|
154
|
+
cssClass,
|
|
155
|
+
description,
|
|
156
|
+
children: []
|
|
157
|
+
};
|
|
158
|
+
state.records.stack[state.records.stack.length - 1].children.push(node);
|
|
159
|
+
state.records.stack.push(node);
|
|
160
|
+
}, "addNode"),
|
|
161
|
+
getRoot,
|
|
162
|
+
getCount,
|
|
163
|
+
getConfig: /* @__PURE__ */ __name(() => {
|
|
164
|
+
return cleanAndMerge(defaultConfig, getConfig().treeView);
|
|
165
|
+
}, "getConfig"),
|
|
166
|
+
getAccTitle,
|
|
167
|
+
getAccDescription,
|
|
168
|
+
getDiagramTitle,
|
|
169
|
+
setAccDescription,
|
|
170
|
+
setAccTitle,
|
|
171
|
+
setDiagramTitle
|
|
172
|
+
};
|
|
173
|
+
var populate = /* @__PURE__ */ __name((ast) => {
|
|
174
|
+
populateCommonDb(ast, db_default);
|
|
175
|
+
for (const node of ast.nodes) {
|
|
176
|
+
const level = typeof node.indent === "number" ? node.indent : 0;
|
|
177
|
+
let name = node.name;
|
|
178
|
+
const isDirectory = name.endsWith("/");
|
|
179
|
+
if (isDirectory) name = name.slice(0, -1);
|
|
180
|
+
const nodeType = isDirectory ? "directory" : "file";
|
|
181
|
+
const cssClass = node.classAnnotation || void 0;
|
|
182
|
+
const rawIcon = node.iconAnnotation;
|
|
183
|
+
const icon = rawIcon !== void 0 ? rawIcon || "none" : void 0;
|
|
184
|
+
const rawDesc = node.descAnnotation || void 0;
|
|
185
|
+
const description = rawDesc ? sanitizeText(rawDesc, getConfig()) : void 0;
|
|
186
|
+
db_default.addNode(level, name, nodeType, cssClass, icon, description);
|
|
187
|
+
}
|
|
188
|
+
}, "populate");
|
|
189
|
+
var parser = { parse: /* @__PURE__ */ __name(async (input) => {
|
|
190
|
+
const { text, lineMap } = preprocessBoxDrawing(input);
|
|
191
|
+
try {
|
|
192
|
+
const ast = await parse("treeView", text);
|
|
193
|
+
log.debug(ast);
|
|
194
|
+
populate(ast);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (lineMap.size > 0 && error instanceof Error) error.message = remapErrorLines(error.message, lineMap);
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
199
|
+
}, "parse") };
|
|
200
|
+
var treeViewIcons = {
|
|
201
|
+
prefix: "mermaid-treeview",
|
|
202
|
+
height: 24,
|
|
203
|
+
width: 24,
|
|
204
|
+
icons: {
|
|
205
|
+
folder: { 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\"/>" },
|
|
206
|
+
file: { 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\"/>" }
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
function detectIcon(name, config) {
|
|
210
|
+
const filenameIcon = config?.filenameIcons?.[name];
|
|
211
|
+
if (filenameIcon) return filenameIcon;
|
|
212
|
+
const dotIdx = name.lastIndexOf(".");
|
|
213
|
+
if (dotIdx > 0) {
|
|
214
|
+
const ext = name.substring(dotIdx).toLowerCase();
|
|
215
|
+
const extensionIcons = config?.extensionIcons;
|
|
216
|
+
return extensionIcons?.[ext] ?? extensionIcons?.[ext.slice(1)];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
__name(detectIcon, "detectIcon");
|
|
220
|
+
function qualifyIcon(icon, defaultIconPack) {
|
|
221
|
+
if (icon.includes(":")) return icon;
|
|
222
|
+
if (icon in treeViewIcons.icons || !defaultIconPack) return `${treeViewIcons.prefix}:${icon}`;
|
|
223
|
+
return `${defaultIconPack}:${icon}`;
|
|
224
|
+
}
|
|
225
|
+
__name(qualifyIcon, "qualifyIcon");
|
|
226
|
+
function getNodeIcon(node, config) {
|
|
227
|
+
if (node.icon === "none") return;
|
|
228
|
+
if (node.icon) return qualifyIcon(node.icon, config.defaultIconPack);
|
|
229
|
+
if (!config.showIcons) return;
|
|
230
|
+
if (node.nodeType === "file") {
|
|
231
|
+
const detected = detectIcon(node.name, config);
|
|
232
|
+
if (detected === "none") return;
|
|
233
|
+
if (detected) return qualifyIcon(detected, config.defaultIconPack);
|
|
234
|
+
}
|
|
235
|
+
return `${treeViewIcons.prefix}:${node.nodeType === "directory" ? "folder" : "file"}`;
|
|
236
|
+
}
|
|
237
|
+
__name(getNodeIcon, "getNodeIcon");
|
|
238
|
+
registerIconPacks([{
|
|
239
|
+
name: treeViewIcons.prefix,
|
|
240
|
+
icons: treeViewIcons
|
|
241
|
+
}]);
|
|
242
|
+
var ICON_SIZE = 14;
|
|
243
|
+
var ICON_GAP = 4;
|
|
244
|
+
var DESC_GAP = 16;
|
|
245
|
+
var resolveNodeIcons = /* @__PURE__ */ __name(async (root, config) => {
|
|
246
|
+
const nodeIcons = [];
|
|
247
|
+
const collect = /* @__PURE__ */ __name((node) => {
|
|
248
|
+
const icon = getNodeIcon(node, config);
|
|
249
|
+
if (icon) nodeIcons.push({
|
|
250
|
+
icon,
|
|
251
|
+
node
|
|
252
|
+
});
|
|
253
|
+
node.children.forEach(collect);
|
|
254
|
+
}, "collect");
|
|
255
|
+
collect(root);
|
|
256
|
+
const resolvedIcons = await Promise.all(nodeIcons.map(async ({ icon, node }) => ({
|
|
257
|
+
id: node.id,
|
|
258
|
+
svg: await getIconSVG(icon, {
|
|
259
|
+
height: ICON_SIZE,
|
|
260
|
+
width: ICON_SIZE
|
|
261
|
+
})
|
|
262
|
+
})));
|
|
263
|
+
return new Map(resolvedIcons.map(({ id, svg }) => [id, svg]));
|
|
264
|
+
}, "resolveNodeIcons");
|
|
265
|
+
var positionLabel = /* @__PURE__ */ __name((x, y, node, domElem, config, iconSVGs) => {
|
|
266
|
+
const nodeGroup = domElem.append("g");
|
|
267
|
+
let cssClasses = "treeView-node-label";
|
|
268
|
+
if (node.nodeType === "directory") cssClasses += " treeView-node-dir";
|
|
269
|
+
if (node.cssClass) cssClasses += ` ${node.cssClass}`;
|
|
270
|
+
const iconOffset = ICON_SIZE + ICON_GAP;
|
|
271
|
+
const icon = getNodeIcon(node, config);
|
|
272
|
+
const showIcon = icon !== void 0;
|
|
273
|
+
if (icon) nodeGroup.append("g").attr("class", "treeView-node-icon").attr("transform", `translate(${x + config.paddingX}, ${y + config.paddingY})`).html(iconSVGs.get(node.id) ?? "");
|
|
274
|
+
const label = nodeGroup.append("text").text(node.name).attr("dominant-baseline", "middle").attr("class", cssClasses);
|
|
275
|
+
const { height: labelHeight, width: labelWidth } = label.node().getBBox();
|
|
276
|
+
const height = labelHeight + config.paddingY * 2;
|
|
277
|
+
const labelX = x + config.paddingX + (showIcon ? iconOffset : 0);
|
|
278
|
+
label.attr("x", labelX);
|
|
279
|
+
label.attr("y", y + height / 2);
|
|
280
|
+
const labelRightEdge = labelX + labelWidth;
|
|
281
|
+
node.BBox = {
|
|
282
|
+
x,
|
|
283
|
+
y,
|
|
284
|
+
width: labelWidth + config.paddingX * 2 + (showIcon ? iconOffset : 0),
|
|
285
|
+
height
|
|
286
|
+
};
|
|
287
|
+
if (node.cssClass?.split(/\s+/).includes("highlight")) 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");
|
|
288
|
+
return {
|
|
289
|
+
node,
|
|
290
|
+
nodeGroup,
|
|
291
|
+
labelRightEdge,
|
|
292
|
+
centerY: y + height / 2
|
|
293
|
+
};
|
|
294
|
+
}, "positionLabel");
|
|
295
|
+
var positionLine = /* @__PURE__ */ __name((domElem, x1, y1, x2, y2, lineThickness) => {
|
|
296
|
+
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");
|
|
297
|
+
}, "positionLine");
|
|
298
|
+
var drawTree = /* @__PURE__ */ __name((elem, root, config, iconSVGs) => {
|
|
299
|
+
let totalHeight = 0;
|
|
300
|
+
let totalWidth = 0;
|
|
301
|
+
const renderInfos = [];
|
|
302
|
+
const drawNode = /* @__PURE__ */ __name((elem2, node, config2, depth) => {
|
|
303
|
+
const indent = depth * (config2.rowIndent + config2.paddingX);
|
|
304
|
+
const info = positionLabel(indent, totalHeight, node, elem2, config2, iconSVGs);
|
|
305
|
+
renderInfos.push(info);
|
|
306
|
+
const { height, width } = node.BBox;
|
|
307
|
+
positionLine(elem2, indent - config2.rowIndent, totalHeight + height / 2, indent, totalHeight + height / 2, config2.lineThickness);
|
|
308
|
+
totalWidth = Math.max(totalWidth, indent + width);
|
|
309
|
+
totalHeight += height;
|
|
310
|
+
}, "drawNode");
|
|
311
|
+
const processNode = /* @__PURE__ */ __name((node, depth = 0) => {
|
|
312
|
+
drawNode(elem, node, config, depth);
|
|
313
|
+
node.children.forEach((child) => {
|
|
314
|
+
processNode(child, depth + 1);
|
|
315
|
+
});
|
|
316
|
+
const { x, y, height } = node.BBox;
|
|
317
|
+
if (node.children.length) {
|
|
318
|
+
const { y: endY, height: endHeight } = node.children[node.children.length - 1].BBox;
|
|
319
|
+
positionLine(elem, x + config.paddingX, y + height, x + config.paddingX, endY + endHeight / 2 + config.lineThickness / 2, config.lineThickness);
|
|
320
|
+
}
|
|
321
|
+
}, "processNode");
|
|
322
|
+
processNode(root);
|
|
323
|
+
const nodesWithDesc = renderInfos.filter((ri) => ri.node.description);
|
|
324
|
+
if (nodesWithDesc.length > 0) {
|
|
325
|
+
const descX = Math.max(...renderInfos.map((ri) => ri.labelRightEdge)) + DESC_GAP;
|
|
326
|
+
for (const ri of nodesWithDesc) {
|
|
327
|
+
const descBBox = ri.nodeGroup.append("text").text(ri.node.description).attr("dominant-baseline", "middle").attr("class", "treeView-node-description").attr("x", descX).attr("y", ri.centerY).node().getBBox();
|
|
328
|
+
totalWidth = Math.max(totalWidth, descX + descBBox.width + config.paddingX);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
for (const ri of renderInfos) if (ri.node.cssClass?.split(/\s+/).includes("highlight")) {
|
|
332
|
+
const rect = ri.nodeGroup.select(".treeView-highlight-bg");
|
|
333
|
+
if (!rect.empty()) {
|
|
334
|
+
const rectWidth = totalWidth - ri.node.BBox.x + 8;
|
|
335
|
+
rect.attr("width", rectWidth);
|
|
336
|
+
totalWidth = Math.max(totalWidth, ri.node.BBox.x + rectWidth + 2);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return {
|
|
340
|
+
totalHeight,
|
|
341
|
+
totalWidth
|
|
342
|
+
};
|
|
343
|
+
}, "drawTree");
|
|
344
|
+
var renderer_default = { draw: /* @__PURE__ */ __name(async (text, id, _ver, diagObj) => {
|
|
345
|
+
log.debug("Rendering treeView diagram\n" + text);
|
|
346
|
+
const db2 = diagObj.db;
|
|
347
|
+
const root = db2.getRoot();
|
|
348
|
+
const config = db2.getConfig();
|
|
349
|
+
const svg = selectSvgElement(id);
|
|
350
|
+
const treeElem = svg.append("g");
|
|
351
|
+
treeElem.attr("class", "tree-view");
|
|
352
|
+
const { totalHeight, totalWidth } = drawTree(treeElem, root, config, await resolveNodeIcons(root, config));
|
|
353
|
+
svg.attr("viewBox", `-${config.lineThickness / 2} 0 ${totalWidth} ${totalHeight}`);
|
|
354
|
+
configureSvgSize(svg, totalHeight, totalWidth, config.useMaxWidth);
|
|
355
|
+
}, "draw") };
|
|
356
|
+
var defaultTreeViewDiagramStyles = {
|
|
357
|
+
labelFontSize: "16px",
|
|
358
|
+
labelColor: "black",
|
|
359
|
+
lineColor: "black",
|
|
360
|
+
iconColor: "#546e7a",
|
|
361
|
+
descriptionColor: "#6a9955",
|
|
362
|
+
highlightBg: "rgba(255, 193, 7, 0.15)",
|
|
363
|
+
highlightStroke: "#ffc107"
|
|
364
|
+
};
|
|
365
|
+
var diagram = {
|
|
366
|
+
db: db_default,
|
|
367
|
+
renderer: renderer_default,
|
|
368
|
+
parser,
|
|
369
|
+
styles: /* @__PURE__ */ __name(({ treeView }) => {
|
|
370
|
+
const { labelFontSize, labelColor, lineColor, iconColor, descriptionColor, highlightBg, highlightStroke } = cleanAndMerge(defaultTreeViewDiagramStyles, treeView);
|
|
371
|
+
return `
|
|
372
|
+
.treeView-node-label {
|
|
373
|
+
font-size: ${labelFontSize};
|
|
374
|
+
fill: ${labelColor};
|
|
375
|
+
white-space: pre;
|
|
376
|
+
}
|
|
377
|
+
.treeView-node-dir {
|
|
378
|
+
font-weight: bold;
|
|
379
|
+
}
|
|
380
|
+
.treeView-node-line {
|
|
381
|
+
stroke: ${lineColor};
|
|
382
|
+
}
|
|
383
|
+
.treeView-node-icon {
|
|
384
|
+
color: ${iconColor};
|
|
385
|
+
}
|
|
386
|
+
.treeView-node-description {
|
|
387
|
+
font-size: ${labelFontSize};
|
|
388
|
+
fill: ${descriptionColor};
|
|
389
|
+
font-style: italic;
|
|
390
|
+
white-space: pre;
|
|
391
|
+
}
|
|
392
|
+
.treeView-highlight-bg {
|
|
393
|
+
fill: ${highlightBg};
|
|
394
|
+
stroke: ${highlightStroke};
|
|
395
|
+
stroke-width: 1;
|
|
396
|
+
}
|
|
397
|
+
`;
|
|
398
|
+
}, "styles")
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
//#endregion
|
|
402
|
+
export { diagram };
|