@umami/shiso 1.12.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/dist/chunks/App.js +76 -49
- 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 +987 -91
- 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 +1 -1
- package/dist/entry-server.js +1 -1
- package/docs.schema.json +1 -1
- package/package.json +2 -1
- package/scripts/expand-navigation-globs.mjs +77 -8
- package/src/components/CodeBlock.tsx +36 -0
- package/src/components/Docs.tsx +44 -21
- package/src/components/OpenApiOperation.tsx +28 -20
- package/src/components/SideNav.tsx +8 -3
- package/src/components/docs/Changelog.tsx +163 -0
- 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/lib/rehype-shiki.ts +18 -1
- package/types/components.d.ts +79 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { t as initRange } from "./init.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js
|
|
4
|
+
var InternMap = class extends Map {
|
|
5
|
+
constructor(entries, key = keyof) {
|
|
6
|
+
super();
|
|
7
|
+
Object.defineProperties(this, {
|
|
8
|
+
_intern: { value: /* @__PURE__ */ new Map() },
|
|
9
|
+
_key: { value: key }
|
|
10
|
+
});
|
|
11
|
+
if (entries != null) for (const [key, value] of entries) this.set(key, value);
|
|
12
|
+
}
|
|
13
|
+
get(key) {
|
|
14
|
+
return super.get(intern_get(this, key));
|
|
15
|
+
}
|
|
16
|
+
has(key) {
|
|
17
|
+
return super.has(intern_get(this, key));
|
|
18
|
+
}
|
|
19
|
+
set(key, value) {
|
|
20
|
+
return super.set(intern_set(this, key), value);
|
|
21
|
+
}
|
|
22
|
+
delete(key) {
|
|
23
|
+
return super.delete(intern_delete(this, key));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function intern_get({ _intern, _key }, value) {
|
|
27
|
+
const key = _key(value);
|
|
28
|
+
return _intern.has(key) ? _intern.get(key) : value;
|
|
29
|
+
}
|
|
30
|
+
function intern_set({ _intern, _key }, value) {
|
|
31
|
+
const key = _key(value);
|
|
32
|
+
if (_intern.has(key)) return _intern.get(key);
|
|
33
|
+
_intern.set(key, value);
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
function intern_delete({ _intern, _key }, value) {
|
|
37
|
+
const key = _key(value);
|
|
38
|
+
if (_intern.has(key)) {
|
|
39
|
+
value = _intern.get(key);
|
|
40
|
+
_intern.delete(key);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function keyof(value) {
|
|
45
|
+
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js
|
|
50
|
+
const implicit = Symbol("implicit");
|
|
51
|
+
function ordinal() {
|
|
52
|
+
var index = new InternMap(), domain = [], range = [], unknown = implicit;
|
|
53
|
+
function scale(d) {
|
|
54
|
+
let i = index.get(d);
|
|
55
|
+
if (i === void 0) {
|
|
56
|
+
if (unknown !== implicit) return unknown;
|
|
57
|
+
index.set(d, i = domain.push(d) - 1);
|
|
58
|
+
}
|
|
59
|
+
return range[i % range.length];
|
|
60
|
+
}
|
|
61
|
+
scale.domain = function(_) {
|
|
62
|
+
if (!arguments.length) return domain.slice();
|
|
63
|
+
domain = [], index = new InternMap();
|
|
64
|
+
for (const value of _) {
|
|
65
|
+
if (index.has(value)) continue;
|
|
66
|
+
index.set(value, domain.push(value) - 1);
|
|
67
|
+
}
|
|
68
|
+
return scale;
|
|
69
|
+
};
|
|
70
|
+
scale.range = function(_) {
|
|
71
|
+
return arguments.length ? (range = Array.from(_), scale) : range.slice();
|
|
72
|
+
};
|
|
73
|
+
scale.unknown = function(_) {
|
|
74
|
+
return arguments.length ? (unknown = _, scale) : unknown;
|
|
75
|
+
};
|
|
76
|
+
scale.copy = function() {
|
|
77
|
+
return ordinal(domain, range).unknown(unknown);
|
|
78
|
+
};
|
|
79
|
+
initRange.apply(scale, arguments);
|
|
80
|
+
return scale;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
export { ordinal as t };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js
|
|
2
|
+
const pi = Math.PI;
|
|
3
|
+
const tau = 2 * pi;
|
|
4
|
+
const epsilon = 1e-6;
|
|
5
|
+
const tauEpsilon = tau - epsilon;
|
|
6
|
+
function append(strings) {
|
|
7
|
+
this._ += strings[0];
|
|
8
|
+
for (let i = 1, n = strings.length; i < n; ++i) this._ += arguments[i] + strings[i];
|
|
9
|
+
}
|
|
10
|
+
function appendRound(digits) {
|
|
11
|
+
let d = Math.floor(digits);
|
|
12
|
+
if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);
|
|
13
|
+
if (d > 15) return append;
|
|
14
|
+
const k = 10 ** d;
|
|
15
|
+
return function(strings) {
|
|
16
|
+
this._ += strings[0];
|
|
17
|
+
for (let i = 1, n = strings.length; i < n; ++i) this._ += Math.round(arguments[i] * k) / k + strings[i];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
var Path = class {
|
|
21
|
+
constructor(digits) {
|
|
22
|
+
this._x0 = this._y0 = this._x1 = this._y1 = null;
|
|
23
|
+
this._ = "";
|
|
24
|
+
this._append = digits == null ? append : appendRound(digits);
|
|
25
|
+
}
|
|
26
|
+
moveTo(x, y) {
|
|
27
|
+
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
|
|
28
|
+
}
|
|
29
|
+
closePath() {
|
|
30
|
+
if (this._x1 !== null) {
|
|
31
|
+
this._x1 = this._x0, this._y1 = this._y0;
|
|
32
|
+
this._append`Z`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
lineTo(x, y) {
|
|
36
|
+
this._append`L${this._x1 = +x},${this._y1 = +y}`;
|
|
37
|
+
}
|
|
38
|
+
quadraticCurveTo(x1, y1, x, y) {
|
|
39
|
+
this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
|
|
40
|
+
}
|
|
41
|
+
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
42
|
+
this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
|
|
43
|
+
}
|
|
44
|
+
arcTo(x1, y1, x2, y2, r) {
|
|
45
|
+
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
|
46
|
+
if (r < 0) throw new Error(`negative radius: ${r}`);
|
|
47
|
+
let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
|
|
48
|
+
if (this._x1 === null) this._append`M${this._x1 = x1},${this._y1 = y1}`;
|
|
49
|
+
else if (!(l01_2 > epsilon));
|
|
50
|
+
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._append`L${this._x1 = x1},${this._y1 = y1}`;
|
|
51
|
+
else {
|
|
52
|
+
let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
|
|
53
|
+
if (Math.abs(t01 - 1) > epsilon) this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
|
|
54
|
+
this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
arc(x, y, r, a0, a1, ccw) {
|
|
58
|
+
x = +x, y = +y, r = +r, ccw = !!ccw;
|
|
59
|
+
if (r < 0) throw new Error(`negative radius: ${r}`);
|
|
60
|
+
let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
|
|
61
|
+
if (this._x1 === null) this._append`M${x0},${y0}`;
|
|
62
|
+
else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._append`L${x0},${y0}`;
|
|
63
|
+
if (!r) return;
|
|
64
|
+
if (da < 0) da = da % tau + tau;
|
|
65
|
+
if (da > tauEpsilon) this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
|
|
66
|
+
else if (da > epsilon) this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
|
|
67
|
+
}
|
|
68
|
+
rect(x, y, w, h) {
|
|
69
|
+
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
|
|
70
|
+
}
|
|
71
|
+
toString() {
|
|
72
|
+
return this._;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function path() {
|
|
76
|
+
return new Path();
|
|
77
|
+
}
|
|
78
|
+
path.prototype = Path.prototype;
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js
|
|
82
|
+
function constant_default(x) {
|
|
83
|
+
return function constant() {
|
|
84
|
+
return x;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js
|
|
90
|
+
function withPath(shape) {
|
|
91
|
+
let digits = 3;
|
|
92
|
+
shape.digits = function(_) {
|
|
93
|
+
if (!arguments.length) return digits;
|
|
94
|
+
if (_ == null) digits = null;
|
|
95
|
+
else {
|
|
96
|
+
const d = Math.floor(_);
|
|
97
|
+
if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
|
98
|
+
digits = d;
|
|
99
|
+
}
|
|
100
|
+
return shape;
|
|
101
|
+
};
|
|
102
|
+
return () => new Path(digits);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { constant_default as n, withPath as t };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { t as MermaidParseError, u as createRailroadPegServices } from "./mermaid-parser.core.js";
|
|
2
|
+
import { n as __name } from "./chunk-Y2CYZVJY.js";
|
|
3
|
+
import { m as log } from "./src.js";
|
|
4
|
+
import "./chunk-DU6HZSFF.js";
|
|
5
|
+
import { n as getStyles, r as renderer, t as db } from "./chunk-SVP7TREG.js";
|
|
6
|
+
import { t as populateCommonDb } from "./chunk-JWPE2WC7.js";
|
|
7
|
+
import "./mermaid.core.js";
|
|
8
|
+
|
|
9
|
+
//#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/pegDiagram-XKGWAZYB.mjs
|
|
10
|
+
var langiumParser = createRailroadPegServices().RailroadPeg.parser.LangiumParser;
|
|
11
|
+
var transformOrderedChoice = /* @__PURE__ */ __name((choice) => {
|
|
12
|
+
const alternatives = choice.alternatives.map(transformSequence);
|
|
13
|
+
if (alternatives.length === 1) return alternatives[0];
|
|
14
|
+
return {
|
|
15
|
+
type: "choice",
|
|
16
|
+
alternatives
|
|
17
|
+
};
|
|
18
|
+
}, "transformOrderedChoice");
|
|
19
|
+
var transformSequence = /* @__PURE__ */ __name((sequence) => {
|
|
20
|
+
const elements = sequence.elements.map(transformPrefix);
|
|
21
|
+
if (elements.length === 1) return elements[0];
|
|
22
|
+
return {
|
|
23
|
+
type: "sequence",
|
|
24
|
+
elements
|
|
25
|
+
};
|
|
26
|
+
}, "transformSequence");
|
|
27
|
+
var transformPrefix = /* @__PURE__ */ __name((prefix) => {
|
|
28
|
+
const inner = transformSuffix(prefix.suffix);
|
|
29
|
+
if (!prefix.operator) return inner;
|
|
30
|
+
return {
|
|
31
|
+
type: "special",
|
|
32
|
+
text: prefix.operator === "&" ? `&${nodeToLabel(inner)}` : `!${nodeToLabel(inner)}`
|
|
33
|
+
};
|
|
34
|
+
}, "transformPrefix");
|
|
35
|
+
var nodeToLabel = /* @__PURE__ */ __name((node) => {
|
|
36
|
+
switch (node.type) {
|
|
37
|
+
case "terminal": return `"${node.value}"`;
|
|
38
|
+
case "nonterminal": return node.name;
|
|
39
|
+
case "special": return node.text;
|
|
40
|
+
default: return "(...)";
|
|
41
|
+
}
|
|
42
|
+
}, "nodeToLabel");
|
|
43
|
+
var transformSuffix = /* @__PURE__ */ __name((suffix) => {
|
|
44
|
+
const inner = transformPrimary(suffix.primary);
|
|
45
|
+
if (!suffix.operator) return inner;
|
|
46
|
+
switch (suffix.operator) {
|
|
47
|
+
case "?": return {
|
|
48
|
+
type: "optional",
|
|
49
|
+
element: inner
|
|
50
|
+
};
|
|
51
|
+
case "*": return {
|
|
52
|
+
type: "repetition",
|
|
53
|
+
element: inner,
|
|
54
|
+
min: 0,
|
|
55
|
+
max: Infinity
|
|
56
|
+
};
|
|
57
|
+
case "+": return {
|
|
58
|
+
type: "repetition",
|
|
59
|
+
element: inner,
|
|
60
|
+
min: 1,
|
|
61
|
+
max: Infinity
|
|
62
|
+
};
|
|
63
|
+
default: throw new Error(`Unsupported PEG suffix operator: ${suffix.operator}`);
|
|
64
|
+
}
|
|
65
|
+
}, "transformSuffix");
|
|
66
|
+
var transformPrimary = /* @__PURE__ */ __name((primary) => {
|
|
67
|
+
switch (primary.$type) {
|
|
68
|
+
case "PegLiteral": return {
|
|
69
|
+
type: "terminal",
|
|
70
|
+
value: primary.value
|
|
71
|
+
};
|
|
72
|
+
case "PegIdentifier": return {
|
|
73
|
+
type: "nonterminal",
|
|
74
|
+
name: primary.name
|
|
75
|
+
};
|
|
76
|
+
case "PegGroup": return transformOrderedChoice(primary.element);
|
|
77
|
+
case "PegAny": return {
|
|
78
|
+
type: "special",
|
|
79
|
+
text: primary.dot
|
|
80
|
+
};
|
|
81
|
+
default: throw new Error(`Unsupported PEG primary node: ${primary.$type}`);
|
|
82
|
+
}
|
|
83
|
+
}, "transformPrimary");
|
|
84
|
+
var transformRule = /* @__PURE__ */ __name((rule) => {
|
|
85
|
+
return {
|
|
86
|
+
name: rule.name,
|
|
87
|
+
definition: transformOrderedChoice(rule.definition)
|
|
88
|
+
};
|
|
89
|
+
}, "transformRule");
|
|
90
|
+
var populateDb = /* @__PURE__ */ __name((ast) => {
|
|
91
|
+
populateCommonDb(ast, db);
|
|
92
|
+
if (ast.title) db.setTitle(ast.title);
|
|
93
|
+
ast.rules.map((rule) => db.addRule(transformRule(rule)));
|
|
94
|
+
}, "populateDb");
|
|
95
|
+
var diagram = {
|
|
96
|
+
parser: {
|
|
97
|
+
parse: /* @__PURE__ */ __name((input) => {
|
|
98
|
+
db.clear();
|
|
99
|
+
log.debug("[PEG Parser] Starting Langium parse");
|
|
100
|
+
const result = langiumParser.parse(input);
|
|
101
|
+
if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) throw new MermaidParseError(result);
|
|
102
|
+
const ast = result.value;
|
|
103
|
+
log.debug("[PEG Parser] Parsed rules:", ast.rules.length);
|
|
104
|
+
populateDb(ast);
|
|
105
|
+
log.debug("[PEG Parser] Parse complete");
|
|
106
|
+
}, "parse"),
|
|
107
|
+
parser: { yy: db }
|
|
108
|
+
},
|
|
109
|
+
db,
|
|
110
|
+
renderer,
|
|
111
|
+
styles: getStyles
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
export { diagram };
|
|
@@ -0,0 +1,297 @@
|
|
|
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, c as configureSvgSize, f as defaultConfig_default, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-DU6HZSFF.js";
|
|
5
|
+
import { t as ordinal } from "./ordinal.js";
|
|
6
|
+
import { n as constant_default } from "./path.js";
|
|
7
|
+
import { m as tau } from "./dist.js";
|
|
8
|
+
import { t as arc_default } from "./arc.js";
|
|
9
|
+
import { t as array_default } from "./array.js";
|
|
10
|
+
import { i as cleanAndMerge, p as parseFontSize } from "./chunk-75Z2AOVW.js";
|
|
11
|
+
import { t as populateCommonDb } from "./chunk-JWPE2WC7.js";
|
|
12
|
+
import { f as selectSvgElement } from "./mermaid.core.js";
|
|
13
|
+
|
|
14
|
+
//#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/descending.js
|
|
15
|
+
function descending_default(a, b) {
|
|
16
|
+
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/identity.js
|
|
21
|
+
function identity_default(d) {
|
|
22
|
+
return d;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/pie.js
|
|
27
|
+
function pie_default() {
|
|
28
|
+
var value = identity_default, sortValues = descending_default, sort = null, startAngle = constant_default(0), endAngle = constant_default(tau), padAngle = constant_default(0);
|
|
29
|
+
function pie(data) {
|
|
30
|
+
var i, n = (data = array_default(data)).length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
|
|
31
|
+
for (i = 0; i < n; ++i) if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) sum += v;
|
|
32
|
+
if (sortValues != null) index.sort(function(i, j) {
|
|
33
|
+
return sortValues(arcs[i], arcs[j]);
|
|
34
|
+
});
|
|
35
|
+
else if (sort != null) index.sort(function(i, j) {
|
|
36
|
+
return sort(data[i], data[j]);
|
|
37
|
+
});
|
|
38
|
+
for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
|
|
39
|
+
data: data[j],
|
|
40
|
+
index: i,
|
|
41
|
+
value: v,
|
|
42
|
+
startAngle: a0,
|
|
43
|
+
endAngle: a1,
|
|
44
|
+
padAngle: p
|
|
45
|
+
};
|
|
46
|
+
return arcs;
|
|
47
|
+
}
|
|
48
|
+
pie.value = function(_) {
|
|
49
|
+
return arguments.length ? (value = typeof _ === "function" ? _ : constant_default(+_), pie) : value;
|
|
50
|
+
};
|
|
51
|
+
pie.sortValues = function(_) {
|
|
52
|
+
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
|
|
53
|
+
};
|
|
54
|
+
pie.sort = function(_) {
|
|
55
|
+
return arguments.length ? (sort = _, sortValues = null, pie) : sort;
|
|
56
|
+
};
|
|
57
|
+
pie.startAngle = function(_) {
|
|
58
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : startAngle;
|
|
59
|
+
};
|
|
60
|
+
pie.endAngle = function(_) {
|
|
61
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : endAngle;
|
|
62
|
+
};
|
|
63
|
+
pie.padAngle = function(_) {
|
|
64
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : padAngle;
|
|
65
|
+
};
|
|
66
|
+
return pie;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-E7YTZNPT.mjs
|
|
71
|
+
var DEFAULT_PIE_CONFIG = defaultConfig_default.pie;
|
|
72
|
+
var DEFAULT_PIE_DB = {
|
|
73
|
+
sections: /* @__PURE__ */ new Map(),
|
|
74
|
+
showData: false,
|
|
75
|
+
config: DEFAULT_PIE_CONFIG
|
|
76
|
+
};
|
|
77
|
+
var sections = DEFAULT_PIE_DB.sections;
|
|
78
|
+
var showData = DEFAULT_PIE_DB.showData;
|
|
79
|
+
var config = structuredClone(DEFAULT_PIE_CONFIG);
|
|
80
|
+
var db = {
|
|
81
|
+
getConfig: /* @__PURE__ */ __name(() => structuredClone(config), "getConfig"),
|
|
82
|
+
clear: /* @__PURE__ */ __name(() => {
|
|
83
|
+
sections = /* @__PURE__ */ new Map();
|
|
84
|
+
showData = DEFAULT_PIE_DB.showData;
|
|
85
|
+
clear();
|
|
86
|
+
}, "clear"),
|
|
87
|
+
setDiagramTitle,
|
|
88
|
+
getDiagramTitle,
|
|
89
|
+
setAccTitle,
|
|
90
|
+
getAccTitle,
|
|
91
|
+
setAccDescription,
|
|
92
|
+
getAccDescription,
|
|
93
|
+
addSection: /* @__PURE__ */ __name(({ label, value }) => {
|
|
94
|
+
if (value < 0) throw new Error(`"${label}" has invalid value: ${value}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);
|
|
95
|
+
if (!sections.has(label)) {
|
|
96
|
+
sections.set(label, value);
|
|
97
|
+
log.debug(`added new section: ${label}, with value: ${value}`);
|
|
98
|
+
}
|
|
99
|
+
}, "addSection"),
|
|
100
|
+
getSections: /* @__PURE__ */ __name(() => sections, "getSections"),
|
|
101
|
+
setShowData: /* @__PURE__ */ __name((toggle) => {
|
|
102
|
+
showData = toggle;
|
|
103
|
+
}, "setShowData"),
|
|
104
|
+
getShowData: /* @__PURE__ */ __name(() => showData, "getShowData")
|
|
105
|
+
};
|
|
106
|
+
var populateDb = /* @__PURE__ */ __name((ast, db2) => {
|
|
107
|
+
populateCommonDb(ast, db2);
|
|
108
|
+
db2.setShowData(ast.showData);
|
|
109
|
+
ast.sections.map(db2.addSection);
|
|
110
|
+
}, "populateDb");
|
|
111
|
+
var parser = { parse: /* @__PURE__ */ __name(async (input) => {
|
|
112
|
+
const ast = await parse("pie", input);
|
|
113
|
+
log.debug(ast);
|
|
114
|
+
populateDb(ast, db);
|
|
115
|
+
}, "parse") };
|
|
116
|
+
var pieStyles_default = /* @__PURE__ */ __name((options) => `
|
|
117
|
+
.pieCircle{
|
|
118
|
+
stroke: ${options.pieStrokeColor};
|
|
119
|
+
stroke-width : ${options.pieStrokeWidth};
|
|
120
|
+
opacity : ${options.pieOpacity};
|
|
121
|
+
}
|
|
122
|
+
.pieCircle.highlighted{
|
|
123
|
+
scale: 1.05;
|
|
124
|
+
opacity: 1;
|
|
125
|
+
}
|
|
126
|
+
.pieCircle.highlightedOnHover:hover{
|
|
127
|
+
transition-duration: 250ms;
|
|
128
|
+
scale: 1.05;
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
131
|
+
.pieOuterCircle{
|
|
132
|
+
stroke: ${options.pieOuterStrokeColor};
|
|
133
|
+
stroke-width: ${options.pieOuterStrokeWidth};
|
|
134
|
+
fill: none;
|
|
135
|
+
}
|
|
136
|
+
.pieTitleText {
|
|
137
|
+
text-anchor: middle;
|
|
138
|
+
font-size: ${options.pieTitleTextSize};
|
|
139
|
+
fill: ${options.pieTitleTextColor};
|
|
140
|
+
font-family: ${options.fontFamily};
|
|
141
|
+
}
|
|
142
|
+
.slice {
|
|
143
|
+
font-family: ${options.fontFamily};
|
|
144
|
+
fill: ${options.pieSectionTextColor};
|
|
145
|
+
font-size:${options.pieSectionTextSize};
|
|
146
|
+
// fill: white;
|
|
147
|
+
}
|
|
148
|
+
.legend text {
|
|
149
|
+
fill: ${options.pieLegendTextColor};
|
|
150
|
+
font-family: ${options.fontFamily};
|
|
151
|
+
font-size: ${options.pieLegendTextSize};
|
|
152
|
+
}
|
|
153
|
+
`, "getStyles");
|
|
154
|
+
var createPieArcs = /* @__PURE__ */ __name((sections2) => {
|
|
155
|
+
const sum = [...sections2.values()].reduce((acc, val) => acc + val, 0);
|
|
156
|
+
const pieData = [...sections2.entries()].map(([label, value]) => ({
|
|
157
|
+
label,
|
|
158
|
+
value
|
|
159
|
+
})).filter((d) => d.value / sum * 100 >= 1);
|
|
160
|
+
return pie_default().value((d) => d.value).sort(null)(pieData);
|
|
161
|
+
}, "createPieArcs");
|
|
162
|
+
var diagram = {
|
|
163
|
+
parser,
|
|
164
|
+
db,
|
|
165
|
+
renderer: { draw: /* @__PURE__ */ __name((text, id, _version, diagObj) => {
|
|
166
|
+
log.debug("rendering pie chart\n" + text);
|
|
167
|
+
const db2 = diagObj.db;
|
|
168
|
+
const globalConfig = getConfig2();
|
|
169
|
+
const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
|
|
170
|
+
const MARGIN = 40;
|
|
171
|
+
const LEGEND_RECT_SIZE = 18;
|
|
172
|
+
const LEGEND_SPACING = 4;
|
|
173
|
+
const height = 450;
|
|
174
|
+
const pieWidth = height;
|
|
175
|
+
const svg = selectSvgElement(id);
|
|
176
|
+
const group = svg.append("g");
|
|
177
|
+
group.attr("transform", "translate(225,225)");
|
|
178
|
+
const { themeVariables } = globalConfig;
|
|
179
|
+
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
|
|
180
|
+
outerStrokeWidth ??= 2;
|
|
181
|
+
const legendPosition = pieConfig.legendPosition;
|
|
182
|
+
const textPosition = pieConfig.textPosition;
|
|
183
|
+
const innerHole = pieConfig.donutHole > 0 && pieConfig.donutHole <= .9 ? pieConfig.donutHole : 0;
|
|
184
|
+
const radius = Math.min(pieWidth, height) / 2 - MARGIN;
|
|
185
|
+
const arcGenerator = arc_default().innerRadius(innerHole * radius).outerRadius(radius);
|
|
186
|
+
const labelArcGenerator = arc_default().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
|
|
187
|
+
const pie = group.append("g");
|
|
188
|
+
pie.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
|
|
189
|
+
const sections2 = db2.getSections();
|
|
190
|
+
const arcs = createPieArcs(sections2);
|
|
191
|
+
const myGeneratedColors = [
|
|
192
|
+
themeVariables.pie1,
|
|
193
|
+
themeVariables.pie2,
|
|
194
|
+
themeVariables.pie3,
|
|
195
|
+
themeVariables.pie4,
|
|
196
|
+
themeVariables.pie5,
|
|
197
|
+
themeVariables.pie6,
|
|
198
|
+
themeVariables.pie7,
|
|
199
|
+
themeVariables.pie8,
|
|
200
|
+
themeVariables.pie9,
|
|
201
|
+
themeVariables.pie10,
|
|
202
|
+
themeVariables.pie11,
|
|
203
|
+
themeVariables.pie12
|
|
204
|
+
];
|
|
205
|
+
let sum = 0;
|
|
206
|
+
sections2.forEach((section) => {
|
|
207
|
+
sum += section;
|
|
208
|
+
});
|
|
209
|
+
const filteredArcs = arcs.filter((datum) => (datum.data.value / sum * 100).toFixed(0) !== "0");
|
|
210
|
+
const color = ordinal(myGeneratedColors).domain([...sections2.keys()]);
|
|
211
|
+
pie.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
|
|
212
|
+
return color(datum.data.label);
|
|
213
|
+
}).attr("class", (datum) => {
|
|
214
|
+
let className = "pieCircle";
|
|
215
|
+
if (pieConfig.highlightSlice === "hover") className += " highlightedOnHover";
|
|
216
|
+
else if (pieConfig.highlightSlice === datum.data.label) className += " highlighted";
|
|
217
|
+
return className;
|
|
218
|
+
});
|
|
219
|
+
pie.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum) => {
|
|
220
|
+
return (datum.data.value / sum * 100).toFixed(0) + "%";
|
|
221
|
+
}).attr("transform", (datum) => {
|
|
222
|
+
return "translate(" + labelArcGenerator.centroid(datum) + ")";
|
|
223
|
+
}).style("text-anchor", "middle").attr("class", "slice");
|
|
224
|
+
const titleText = group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
|
|
225
|
+
const allSectionData = [...sections2.entries()].map(([label, value]) => ({
|
|
226
|
+
label,
|
|
227
|
+
value
|
|
228
|
+
}));
|
|
229
|
+
const legend = group.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend");
|
|
230
|
+
legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", (d) => color(d.label)).style("stroke", (d) => color(d.label));
|
|
231
|
+
legend.append("text").attr("x", 22).attr("y", 14).text((d) => {
|
|
232
|
+
if (db2.getShowData()) return `${d.label} [${d.value}]`;
|
|
233
|
+
return d.label;
|
|
234
|
+
});
|
|
235
|
+
const longestTextWidth = Math.max(...legend.selectAll("text").nodes().map((node) => node?.getBoundingClientRect().width ?? 0));
|
|
236
|
+
let chartAndLegendHeight = height;
|
|
237
|
+
let chartAndLegendWidth = 490;
|
|
238
|
+
const legendHeight = 22;
|
|
239
|
+
const totalLegendHeight = allSectionData.length * legendHeight;
|
|
240
|
+
switch (legendPosition) {
|
|
241
|
+
case "center":
|
|
242
|
+
legend.attr("transform", (_datum, index) => {
|
|
243
|
+
const offset = legendHeight * allSectionData.length / 2;
|
|
244
|
+
const horizontal = -longestTextWidth / 2 - 22;
|
|
245
|
+
const vertical = index * legendHeight - offset;
|
|
246
|
+
return "translate(" + horizontal + "," + vertical + ")";
|
|
247
|
+
});
|
|
248
|
+
break;
|
|
249
|
+
case "top":
|
|
250
|
+
chartAndLegendHeight += totalLegendHeight;
|
|
251
|
+
legend.attr("transform", (_datum, index) => {
|
|
252
|
+
const offset = radius;
|
|
253
|
+
return `translate(${-longestTextWidth / 2 - 22}, ${index * legendHeight - offset})`;
|
|
254
|
+
});
|
|
255
|
+
pie.attr("transform", () => {
|
|
256
|
+
return `translate(0, ${totalLegendHeight + legendHeight})`;
|
|
257
|
+
});
|
|
258
|
+
break;
|
|
259
|
+
case "bottom":
|
|
260
|
+
chartAndLegendHeight += totalLegendHeight;
|
|
261
|
+
legend.attr("transform", (_datum, index) => {
|
|
262
|
+
const offset = -207;
|
|
263
|
+
const horizontal = -longestTextWidth / 2 - 22;
|
|
264
|
+
const vertical = index * legendHeight - offset;
|
|
265
|
+
return "translate(" + horizontal + "," + vertical + ")";
|
|
266
|
+
});
|
|
267
|
+
break;
|
|
268
|
+
case "left":
|
|
269
|
+
chartAndLegendWidth += 22 + longestTextWidth;
|
|
270
|
+
legend.attr("transform", (_datum, index) => {
|
|
271
|
+
const offset = legendHeight * allSectionData.length / 2;
|
|
272
|
+
return "translate(-207," + (index * legendHeight - offset) + ")";
|
|
273
|
+
});
|
|
274
|
+
pie.attr("transform", () => {
|
|
275
|
+
return `translate(${longestTextWidth + LEGEND_RECT_SIZE + LEGEND_SPACING}, 0)`;
|
|
276
|
+
});
|
|
277
|
+
break;
|
|
278
|
+
default:
|
|
279
|
+
chartAndLegendWidth += 22 + longestTextWidth;
|
|
280
|
+
legend.attr("transform", (_datum, index) => {
|
|
281
|
+
const offset = legendHeight * allSectionData.length / 2;
|
|
282
|
+
return "translate(216," + (index * legendHeight - offset) + ")";
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
const titleWidth = titleText.node()?.getBoundingClientRect().width ?? 0;
|
|
286
|
+
const titleLeft = pieWidth / 2 - titleWidth / 2;
|
|
287
|
+
const titleRight = pieWidth / 2 + titleWidth / 2;
|
|
288
|
+
const viewBoxX = Math.min(0, titleLeft);
|
|
289
|
+
const totalWidth = Math.max(chartAndLegendWidth, titleRight) - viewBoxX;
|
|
290
|
+
svg.attr("viewBox", `${viewBoxX} 0 ${totalWidth} ${chartAndLegendHeight}`);
|
|
291
|
+
configureSvgSize(svg, chartAndLegendHeight, totalWidth, pieConfig.useMaxWidth);
|
|
292
|
+
}, "draw") },
|
|
293
|
+
styles: pieStyles_default
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
//#endregion
|
|
297
|
+
export { diagram };
|