for-humanity 0.12.0 → 0.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/CHANGELOG.md +29 -0
- package/README.md +16 -9
- package/dist/browser.js +16 -16
- package/dist/cli.css +2 -968
- package/dist/cli.js +92 -2318
- package/dist/config.js +1 -0
- package/dist/constant/copy.d.ts +100 -0
- package/dist/constant/site.d.ts +20 -0
- package/dist/constant/status.d.ts +19 -0
- package/dist/copy-C1uzvEnr.js +103 -0
- package/dist/group-path-XAThmzvC.js +10 -0
- package/dist/load-site-CbpLEhwu.js +2379 -0
- package/dist/logger-Dv1i9xSV.js +9 -0
- package/dist/mermaid/THIRD-PARTY-NOTICES.txt +3134 -0
- package/dist/mermaid/chunk--TN-qHgG.js +2 -0
- package/dist/mermaid/chunk-0kM1Lv4D.js +2 -0
- package/dist/mermaid/chunk-3FHei3pH.js +2001 -0
- package/dist/mermaid/chunk-3_2p2GqN.js +2 -0
- package/dist/mermaid/chunk-6HLei9i0.js +84 -0
- package/dist/mermaid/chunk-7Sz3kAwl.js +2214 -0
- package/dist/mermaid/chunk-7Tarqbpa.js +18047 -0
- package/dist/mermaid/chunk-9kkt8lzL.js +10 -0
- package/dist/mermaid/chunk-B--pNBQF.js +884 -0
- package/dist/mermaid/chunk-B4F-pysn.js +4241 -0
- package/dist/mermaid/chunk-B58sEIY_.js +14 -0
- package/dist/mermaid/chunk-B9_UWzSH.js +1517 -0
- package/dist/mermaid/chunk-BB8uZHwY.js +75 -0
- package/dist/mermaid/chunk-BFfk0LEc.js +717 -0
- package/dist/mermaid/chunk-BKri0qr7.js +89 -0
- package/dist/mermaid/chunk-BL404pH5.js +26 -0
- package/dist/mermaid/chunk-BLeiQSWo.js +354 -0
- package/dist/mermaid/chunk-BOmH_UFd.js +2 -0
- package/dist/mermaid/chunk-BSej9Nhy.js +1361 -0
- package/dist/mermaid/chunk-BYzrzvCI.js +12 -0
- package/dist/mermaid/chunk-BariMtWr.js +3020 -0
- package/dist/mermaid/chunk-BcrBoMwH.js +2352 -0
- package/dist/mermaid/chunk-Bok8z-Yo.js +67 -0
- package/dist/mermaid/chunk-BpTHLKQM.js +1970 -0
- package/dist/mermaid/chunk-BqjuxRsC.js +733 -0
- package/dist/mermaid/chunk-BuvPd-s5.js +1073 -0
- package/dist/mermaid/chunk-BvVehae3.js +5069 -0
- package/dist/mermaid/chunk-C-JABYpd.js +3075 -0
- package/dist/mermaid/chunk-C9XlTm4w.js +2 -0
- package/dist/mermaid/chunk-CApNbSU9.js +6 -0
- package/dist/mermaid/chunk-CCM2AH-C.js +9 -0
- package/dist/mermaid/chunk-CD1E0F_N.js +2 -0
- package/dist/mermaid/chunk-CDWvKG7D.js +2 -0
- package/dist/mermaid/chunk-CEVPpC1F.js +34 -0
- package/dist/mermaid/chunk-CLDr12lf.js +47504 -0
- package/dist/mermaid/chunk-CLVYqOBI.js +61 -0
- package/dist/mermaid/chunk-CLeOkFb5.js +15 -0
- package/dist/mermaid/chunk-CLgRAtOz.js +37 -0
- package/dist/mermaid/chunk-CMqFNUBl.js +134 -0
- package/dist/mermaid/chunk-CTPaBJXB.js +2 -0
- package/dist/mermaid/chunk-CVi6IGBL.js +2 -0
- package/dist/mermaid/chunk-CWV_EN-4.js +4745 -0
- package/dist/mermaid/chunk-CZ0dAs3g.js +2 -0
- package/dist/mermaid/chunk-C_YGy4Fn.js +236 -0
- package/dist/mermaid/chunk-CcVH22Yt.js +100 -0
- package/dist/mermaid/chunk-CgG6CD9_.js +7175 -0
- package/dist/mermaid/chunk-CgOP6IDB.js +3397 -0
- package/dist/mermaid/chunk-Cgg2UTSf.js +13 -0
- package/dist/mermaid/chunk-ChJfJJ1A.js +214 -0
- package/dist/mermaid/chunk-Ck5XRA46.js +447 -0
- package/dist/mermaid/chunk-Ckuw16cl.js +203 -0
- package/dist/mermaid/chunk-CpAbRCbF.js +1880 -0
- package/dist/mermaid/chunk-CuYekbSv.js +2 -0
- package/dist/mermaid/chunk-CwS4wZ5a.js +2 -0
- package/dist/mermaid/chunk-D-bcrBO3.js +82 -0
- package/dist/mermaid/chunk-D3IEAkCW.js +76 -0
- package/dist/mermaid/chunk-D8XfBJ_K.js +645 -0
- package/dist/mermaid/chunk-D9Ddd9y4.js +2228 -0
- package/dist/mermaid/chunk-DBh1mIbK.js +12 -0
- package/dist/mermaid/chunk-DD6Df6Ic.js +5 -0
- package/dist/mermaid/chunk-DGVDaXjx.js +8 -0
- package/dist/mermaid/chunk-DK9KqIXj.js +632 -0
- package/dist/mermaid/chunk-DORnIAsy.js +4487 -0
- package/dist/mermaid/chunk-DU69_VcF.js +363 -0
- package/dist/mermaid/chunk-DVNvSFoz.js +2144 -0
- package/dist/mermaid/chunk-DZe-4kde.js +20 -0
- package/dist/mermaid/chunk-D_a06Rz4.js +287 -0
- package/dist/mermaid/chunk-DfyFJJi2.js +972 -0
- package/dist/mermaid/chunk-DhKYPp1Z.js +2 -0
- package/dist/mermaid/chunk-DjFqgNTG.js +94 -0
- package/dist/mermaid/chunk-DmbDDrr-.js +65 -0
- package/dist/mermaid/chunk-DpuxlyL_.js +696 -0
- package/dist/mermaid/chunk-DqGhppWe.js +2 -0
- package/dist/mermaid/chunk-DqPZxHXa.js +5 -0
- package/dist/mermaid/chunk-Dt_1Jyif.js +293 -0
- package/dist/mermaid/chunk-DyQBE_NW.js +1935 -0
- package/dist/mermaid/chunk-JckyC4mW.js +1009 -0
- package/dist/mermaid/chunk-K7Myuj2-.js +1334 -0
- package/dist/mermaid/chunk-KuPYb48V.js +275 -0
- package/dist/mermaid/chunk-MFVRUoO0.js +4020 -0
- package/dist/mermaid/chunk-MbInCS_6.js +28 -0
- package/dist/mermaid/chunk-MexOLyKV.js +355 -0
- package/dist/mermaid/chunk-NnbDtJzg.js +21856 -0
- package/dist/mermaid/chunk-SGpOYZbI.js +2139 -0
- package/dist/mermaid/chunk-TbxLDlcU.js +198 -0
- package/dist/mermaid/chunk-TftHqGLg.js +490 -0
- package/dist/mermaid/chunk-UjQ8vA_Z.js +4138 -0
- package/dist/mermaid/chunk-YgmVTKqc.js +16 -0
- package/dist/mermaid/chunk-_a9EZE1v.js +1798 -0
- package/dist/mermaid/chunk-dTb8jqeP.js +2 -0
- package/dist/mermaid/chunk-fFdMfF8S.js +2240 -0
- package/dist/mermaid/chunk-feYbMzBj.js +1267 -0
- package/dist/mermaid/chunk-g3Pn8DkW.js +46 -0
- package/dist/mermaid/chunk-hM77LvCb.js +19832 -0
- package/dist/mermaid/chunk-hUDb-eAW.js +527 -0
- package/dist/mermaid/chunk-tpABtZ-3.js +4252 -0
- package/dist/mermaid/chunk-xIbz3oFK.js +59 -0
- package/dist/mermaid/chunk-yBz-vst0.js +976 -0
- package/dist/mermaid/mermaid-BhtR3wyB.js +1145 -0
- package/dist/run-site-command-C80YoNOe.js +129 -0
- package/dist/site-config-bllORGpm.js +90 -0
- package/dist/site.js +1 -0
- package/dist/start-dev-server-C4_Lu1nZ.js +176 -0
- package/dist/to-change-queue-DbEnZGNK.js +34 -0
- package/dist/to-error-message-pF6_7wGK.js +16 -0
- package/dist/type/group-path.d.ts +7 -0
- package/dist/type/site-config.d.ts +57 -0
- package/package.json +34 -17
- package/src/component/widget/cursor-face/_constant/cursor-face.ts +0 -14
- package/src/component/widget/cursor-face/wg-cursor-face.css +0 -15
- package/src/component/widget/cursor-face/wg-cursor-face.tsx +0 -153
- package/src/component/widget/navigation/_constant/locale.ts +0 -9
- package/src/component/widget/navigation/_constant/navigation-data-schema.ts +0 -33
- package/src/component/widget/navigation/_constant/navigation.ts +0 -9
- package/src/component/widget/navigation/_constant/reading-line.ts +0 -4
- package/src/component/widget/navigation/_function/restore-navigation-scroll.ts +0 -59
- package/src/component/widget/navigation/_function/to-doc-groups/_to-doc-branches.ts +0 -15
- package/src/component/widget/navigation/_function/to-doc-groups/_to-doc-group-branches.ts +0 -70
- package/src/component/widget/navigation/_function/to-doc-groups/to-doc-groups.ts +0 -15
- package/src/component/widget/navigation/_function/to-navigation-data/_to-navigation-document.ts +0 -13
- package/src/component/widget/navigation/_function/to-navigation-data/_to-navigation-group.ts +0 -13
- package/src/component/widget/navigation/_function/to-navigation-data/to-navigation-data.ts +0 -18
- package/src/component/widget/navigation/_function/to-navigation-json.ts +0 -8
- package/src/component/widget/navigation/_function/to-toc-groups.ts +0 -38
- package/src/component/widget/navigation/_type/doc-branch.ts +0 -11
- package/src/component/widget/navigation/_type/doc-group.ts +0 -24
- package/src/component/widget/navigation/_type/navigation-data.ts +0 -75
- package/src/component/widget/navigation/_type/navigation-focus-snapshot.ts +0 -17
- package/src/component/widget/navigation/_type/toc-group.ts +0 -39
- package/src/component/widget/navigation/_wg-navigation-nav-list.css +0 -48
- package/src/component/widget/navigation/_wg-navigation-nav-list.tsx +0 -61
- package/src/component/widget/navigation/_wg-navigation-nav.css +0 -21
- package/src/component/widget/navigation/_wg-navigation-nav.tsx +0 -33
- package/src/component/widget/navigation/_wg-navigation-scroll.tsx +0 -117
- package/src/component/widget/navigation/_wg-navigation-toc.css +0 -91
- package/src/component/widget/navigation/_wg-navigation-toc.tsx +0 -114
- package/src/component/widget/navigation/wg-navigation.css +0 -282
- package/src/component/widget/navigation/wg-navigation.tsx +0 -420
- package/src/component/widget/prose/_constant/heading-highlight.ts +0 -4
- package/src/component/widget/prose/_constant/section.ts +0 -7
- package/src/component/widget/prose/_constant/status.ts +0 -9
- package/src/component/widget/prose/_function/has-block-content.ts +0 -30
- package/src/component/widget/prose/_function/rehype-head.ts +0 -31
- package/src/component/widget/prose/_function/rehype-sections/_to-section-headings.ts +0 -20
- package/src/component/widget/prose/_function/rehype-sections/rehype-sections.ts +0 -21
- package/src/component/widget/prose/_function/rehype-tables.ts +0 -22
- package/src/component/widget/prose/_function/remark-blocks.ts +0 -112
- package/src/component/widget/prose/_function/remark-flow.ts +0 -26
- package/src/component/widget/prose/_function/remark-links.ts +0 -33
- package/src/component/widget/prose/_function/remark-parts.ts +0 -26
- package/src/component/widget/prose/_function/remark-status.ts +0 -59
- package/src/component/widget/prose/_function/remark-swatch.ts +0 -16
- package/src/component/widget/prose/_function/remark-unknown-directives.ts +0 -25
- package/src/component/widget/prose/wg-prose.css +0 -484
- package/src/component/widget/prose/wg-prose.tsx +0 -43
- package/src/component/widget/shell/wg-shell.css +0 -63
- package/src/component/widget/shell/wg-shell.tsx +0 -88
- package/src/component/widget/shell-controls/wg-shell-controls.css +0 -4
- package/src/component/widget/shell-controls/wg-shell-controls.tsx +0 -170
- package/src/constant/asset.ts +0 -63
- package/src/constant/copy.ts +0 -133
- package/src/constant/doc.ts +0 -13
- package/src/constant/font.ts +0 -34
- package/src/constant/site.ts +0 -24
- package/src/constant/status.ts +0 -15
- package/src/entry/browser/browser.tsx +0 -22
- package/src/entry/cli/_constant/cli.ts +0 -19
- package/src/entry/cli/_constant/crawling.ts +0 -14
- package/src/entry/cli/_constant/snippet.ts +0 -21
- package/src/entry/cli/_function/create-app.tsx +0 -57
- package/src/entry/cli/_function/create-dev-app.ts +0 -87
- package/src/entry/cli/_function/create-processor/_rehype-assets.ts +0 -70
- package/src/entry/cli/_function/create-processor/_rehype-heading-ids.ts +0 -34
- package/src/entry/cli/_function/create-processor/_remark-report.ts +0 -15
- package/src/entry/cli/_function/create-processor/_remark-snippets.ts +0 -117
- package/src/entry/cli/_function/create-processor/_shiki-transformers.ts +0 -91
- package/src/entry/cli/_function/create-processor/create-processor.ts +0 -64
- package/src/entry/cli/_function/read-docs.ts +0 -128
- package/src/entry/cli/_function/read-home.ts +0 -32
- package/src/entry/cli/_function/to-crawling-app.ts +0 -42
- package/src/entry/cli/cli.test.ts +0 -804
- package/src/entry/cli/cli.ts +0 -206
- package/src/env.d.ts +0 -6
- package/src/page/doc/pg-doc.tsx +0 -35
- package/src/page/home/pg-home.tsx +0 -40
- package/src/store/navigation/create-navigation-stores.test.ts +0 -74
- package/src/store/navigation/create-navigation-stores.ts +0 -59
- package/src/store/navigation/navigation-state.ts +0 -36
- package/src/store/navigation/navigation-storage.ts +0 -9
- package/src/store/navigation/to-navigation-scroll-state.ts +0 -42
- package/src/style/base.css +0 -28
- package/src/style/token.css +0 -188
- package/src/type/doc-content.ts +0 -15
- package/src/type/doc-data.ts +0 -38
- package/src/type/doc-file-data.ts +0 -21
- package/src/type/doc-heading.ts +0 -17
- package/src/type/doc-outline.ts +0 -16
- package/src/type/doc-section.ts +0 -9
- package/src/type/doc.ts +0 -20
- package/src/type/group-path.ts +0 -7
- package/src/type/site-assets.ts +0 -25
- package/src/type/site-config.ts +0 -73
- package/src/type/vfile-data.d.ts +0 -10
- package/src/util/async/to-change-queue.test.ts +0 -58
- package/src/util/async/to-change-queue.ts +0 -43
- package/src/util/dom/find-hash-target.ts +0 -18
- package/src/util/dom/reveal-hash-target.ts +0 -15
- package/src/util/error/to-error-message.ts +0 -10
- package/src/util/file/to-asset-path.ts +0 -26
- package/src/util/font/to-font-css.test.ts +0 -41
- package/src/util/font/to-font-css.ts +0 -28
- package/src/util/mermaid/render-flow.js +0 -321
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatDecimal.js
|
|
2
|
+
function e(e) {
|
|
3
|
+
return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
|
|
4
|
+
}
|
|
5
|
+
function t(e, t) {
|
|
6
|
+
if (!isFinite(e) || e === 0) return null;
|
|
7
|
+
var n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e"), r = e.slice(0, n);
|
|
8
|
+
return [r.length > 1 ? r[0] + r.slice(2) : r, +e.slice(n + 1)];
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/exponent.js
|
|
12
|
+
function n(e) {
|
|
13
|
+
return e = t(Math.abs(e)), e ? e[1] : NaN;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatGroup.js
|
|
17
|
+
function r(e, t) {
|
|
18
|
+
return function(n, r) {
|
|
19
|
+
for (var i = n.length, a = [], o = 0, s = e[0], c = 0; i > 0 && s > 0 && (c + s + 1 > r && (s = Math.max(1, r - c)), a.push(n.substring(i -= s, i + s)), !((c += s + 1) > r));) s = e[o = (o + 1) % e.length];
|
|
20
|
+
return a.reverse().join(t);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatNumerals.js
|
|
25
|
+
function i(e) {
|
|
26
|
+
return function(t) {
|
|
27
|
+
return t.replace(/[0-9]/g, function(t) {
|
|
28
|
+
return e[+t];
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatSpecifier.js
|
|
34
|
+
var a = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
35
|
+
function o(e) {
|
|
36
|
+
if (!(t = a.exec(e))) throw Error("invalid format: " + e);
|
|
37
|
+
var t;
|
|
38
|
+
return new s({
|
|
39
|
+
fill: t[1],
|
|
40
|
+
align: t[2],
|
|
41
|
+
sign: t[3],
|
|
42
|
+
symbol: t[4],
|
|
43
|
+
zero: t[5],
|
|
44
|
+
width: t[6],
|
|
45
|
+
comma: t[7],
|
|
46
|
+
precision: t[8] && t[8].slice(1),
|
|
47
|
+
trim: t[9],
|
|
48
|
+
type: t[10]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
o.prototype = s.prototype;
|
|
52
|
+
function s(e) {
|
|
53
|
+
this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
|
|
54
|
+
}
|
|
55
|
+
s.prototype.toString = function() {
|
|
56
|
+
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;
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatTrim.js
|
|
60
|
+
function c(e) {
|
|
61
|
+
out: for (var t = e.length, n = 1, r = -1, i; n < t; ++n) switch (e[n]) {
|
|
62
|
+
case ".":
|
|
63
|
+
r = i = n;
|
|
64
|
+
break;
|
|
65
|
+
case "0":
|
|
66
|
+
r === 0 && (r = n), i = n;
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
if (!+e[n]) break out;
|
|
70
|
+
r > 0 && (r = 0);
|
|
71
|
+
}
|
|
72
|
+
return r > 0 ? e.slice(0, r) + e.slice(i + 1) : e;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatPrefixAuto.js
|
|
76
|
+
var l;
|
|
77
|
+
function u(e, n) {
|
|
78
|
+
var r = t(e, n);
|
|
79
|
+
if (!r) return l = void 0, e.toPrecision(n);
|
|
80
|
+
var i = r[0], a = r[1], o = a - (l = Math.max(-8, Math.min(8, Math.floor(a / 3))) * 3) + 1, s = i.length;
|
|
81
|
+
return o === s ? i : o > s ? i + Array(o - s + 1).join("0") : o > 0 ? i.slice(0, o) + "." + i.slice(o) : "0." + Array(1 - o).join("0") + t(e, Math.max(0, n + o - 1))[0];
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatRounded.js
|
|
85
|
+
function d(e, n) {
|
|
86
|
+
var r = t(e, n);
|
|
87
|
+
if (!r) return e + "";
|
|
88
|
+
var i = r[0], a = r[1];
|
|
89
|
+
return a < 0 ? "0." + Array(-a).join("0") + i : i.length > a + 1 ? i.slice(0, a + 1) + "." + i.slice(a + 1) : i + Array(a - i.length + 2).join("0");
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/formatTypes.js
|
|
93
|
+
var f = {
|
|
94
|
+
"%": (e, t) => (e * 100).toFixed(t),
|
|
95
|
+
b: (e) => Math.round(e).toString(2),
|
|
96
|
+
c: (e) => e + "",
|
|
97
|
+
d: e,
|
|
98
|
+
e: (e, t) => e.toExponential(t),
|
|
99
|
+
f: (e, t) => e.toFixed(t),
|
|
100
|
+
g: (e, t) => e.toPrecision(t),
|
|
101
|
+
o: (e) => Math.round(e).toString(8),
|
|
102
|
+
p: (e, t) => d(e * 100, t),
|
|
103
|
+
r: d,
|
|
104
|
+
s: u,
|
|
105
|
+
X: (e) => Math.round(e).toString(16).toUpperCase(),
|
|
106
|
+
x: (e) => Math.round(e).toString(16)
|
|
107
|
+
};
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/identity.js
|
|
110
|
+
function p(e) {
|
|
111
|
+
return e;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/locale.js
|
|
115
|
+
var m = Array.prototype.map, h = [
|
|
116
|
+
"y",
|
|
117
|
+
"z",
|
|
118
|
+
"a",
|
|
119
|
+
"f",
|
|
120
|
+
"p",
|
|
121
|
+
"n",
|
|
122
|
+
"µ",
|
|
123
|
+
"m",
|
|
124
|
+
"",
|
|
125
|
+
"k",
|
|
126
|
+
"M",
|
|
127
|
+
"G",
|
|
128
|
+
"T",
|
|
129
|
+
"P",
|
|
130
|
+
"E",
|
|
131
|
+
"Z",
|
|
132
|
+
"Y"
|
|
133
|
+
];
|
|
134
|
+
function g(e) {
|
|
135
|
+
var t = e.grouping === void 0 || e.thousands === void 0 ? p : r(m.call(e.grouping, Number), e.thousands + ""), a = e.currency === void 0 ? "" : e.currency[0] + "", s = e.currency === void 0 ? "" : e.currency[1] + "", u = e.decimal === void 0 ? "." : e.decimal + "", d = e.numerals === void 0 ? p : i(m.call(e.numerals, String)), g = e.percent === void 0 ? "%" : e.percent + "", _ = e.minus === void 0 ? "−" : e.minus + "", v = e.nan === void 0 ? "NaN" : e.nan + "";
|
|
136
|
+
function y(e, n) {
|
|
137
|
+
e = o(e);
|
|
138
|
+
var r = e.fill, i = e.align, p = e.sign, m = e.symbol, y = e.zero, b = e.width, x = e.comma, S = e.precision, C = e.trim, w = e.type;
|
|
139
|
+
w === "n" ? (x = !0, w = "g") : f[w] || (S === void 0 && (S = 12), C = !0, w = "g"), (y || r === "0" && i === "=") && (y = !0, r = "0", i = "=");
|
|
140
|
+
var T = (n && n.prefix !== void 0 ? n.prefix : "") + (m === "$" ? a : m === "#" && /[boxX]/.test(w) ? "0" + w.toLowerCase() : ""), E = (m === "$" ? s : /[%p]/.test(w) ? g : "") + (n && n.suffix !== void 0 ? n.suffix : ""), D = f[w], O = /[defgprs%]/.test(w);
|
|
141
|
+
S = S === void 0 ? 6 : /[gprs]/.test(w) ? Math.max(1, Math.min(21, S)) : Math.max(0, Math.min(20, S));
|
|
142
|
+
function k(e) {
|
|
143
|
+
var n = T, a = E, o, s, f;
|
|
144
|
+
if (w === "c") a = D(e) + a, e = "";
|
|
145
|
+
else {
|
|
146
|
+
e = +e;
|
|
147
|
+
var m = e < 0 || 1 / e < 0;
|
|
148
|
+
if (e = isNaN(e) ? v : D(Math.abs(e), S), C && (e = c(e)), m && +e == 0 && p !== "+" && (m = !1), n = (m ? p === "(" ? p : _ : p === "-" || p === "(" ? "" : p) + n, a = (w === "s" && !isNaN(e) && l !== void 0 ? h[8 + l / 3] : "") + a + (m && p === "(" ? ")" : ""), O) {
|
|
149
|
+
for (o = -1, s = e.length; ++o < s;) if (f = e.charCodeAt(o), 48 > f || f > 57) {
|
|
150
|
+
a = (f === 46 ? u + e.slice(o + 1) : e.slice(o)) + a, e = e.slice(0, o);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
x && !y && (e = t(e, Infinity));
|
|
156
|
+
var g = n.length + e.length + a.length, k = g < b ? Array(b - g + 1).join(r) : "";
|
|
157
|
+
switch (x && y && (e = t(k + e, k.length ? b - a.length : Infinity), k = ""), i) {
|
|
158
|
+
case "<":
|
|
159
|
+
e = n + e + a + k;
|
|
160
|
+
break;
|
|
161
|
+
case "=":
|
|
162
|
+
e = n + k + e + a;
|
|
163
|
+
break;
|
|
164
|
+
case "^":
|
|
165
|
+
e = k.slice(0, g = k.length >> 1) + n + e + a + k.slice(g);
|
|
166
|
+
break;
|
|
167
|
+
default: e = k + n + e + a;
|
|
168
|
+
}
|
|
169
|
+
return d(e);
|
|
170
|
+
}
|
|
171
|
+
return k.toString = function() {
|
|
172
|
+
return e + "";
|
|
173
|
+
}, k;
|
|
174
|
+
}
|
|
175
|
+
function b(e, t) {
|
|
176
|
+
var r = Math.max(-8, Math.min(8, Math.floor(n(t) / 3))) * 3, i = 10 ** -r, a = y((e = o(e), e.type = "f", e), { suffix: h[8 + r / 3] });
|
|
177
|
+
return function(e) {
|
|
178
|
+
return a(i * e);
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
format: y,
|
|
183
|
+
formatPrefix: b
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region node_modules/.pnpm/d3-format@3.1.2/node_modules/d3-format/src/defaultLocale.js
|
|
188
|
+
var _, v, y;
|
|
189
|
+
b({
|
|
190
|
+
thousands: ",",
|
|
191
|
+
grouping: [3],
|
|
192
|
+
currency: ["$", ""]
|
|
193
|
+
});
|
|
194
|
+
function b(e) {
|
|
195
|
+
return _ = g(e), v = _.format, y = _.formatPrefix, _;
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
export { n as i, y as n, o as r, v as t };
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
import { m as e } from "./chunk-DVNvSFoz.js";
|
|
2
|
+
import { n as t } from "./chunk-BYzrzvCI.js";
|
|
3
|
+
import { E as n, a as r, b as i, c as a, y as o, z as s } from "./chunk-MFVRUoO0.js";
|
|
4
|
+
import { t as c } from "./chunk-B58sEIY_.js";
|
|
5
|
+
//#region node_modules/.pnpm/mermaid@12.2.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2E7WHVMD.mjs
|
|
6
|
+
var l = "", u = "", d = "", f = [], p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ t((e) => s(e, i()), "sanitizeText"), h = /* @__PURE__ */ t((e) => {
|
|
7
|
+
switch (e.type) {
|
|
8
|
+
case "terminal": return {
|
|
9
|
+
...e,
|
|
10
|
+
value: m(e.value)
|
|
11
|
+
};
|
|
12
|
+
case "nonterminal": return {
|
|
13
|
+
...e,
|
|
14
|
+
name: m(e.name)
|
|
15
|
+
};
|
|
16
|
+
case "sequence": return {
|
|
17
|
+
...e,
|
|
18
|
+
elements: e.elements.map(h)
|
|
19
|
+
};
|
|
20
|
+
case "choice": return {
|
|
21
|
+
...e,
|
|
22
|
+
alternatives: e.alternatives.map(h)
|
|
23
|
+
};
|
|
24
|
+
case "optional": return {
|
|
25
|
+
...e,
|
|
26
|
+
element: h(e.element)
|
|
27
|
+
};
|
|
28
|
+
case "repetition": return {
|
|
29
|
+
...e,
|
|
30
|
+
element: h(e.element),
|
|
31
|
+
separator: e.separator ? h(e.separator) : void 0
|
|
32
|
+
};
|
|
33
|
+
case "special": return {
|
|
34
|
+
...e,
|
|
35
|
+
text: m(e.text)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}, "sanitizeAstNode"), g = /* @__PURE__ */ t(() => {
|
|
39
|
+
l = "", u = "", d = "", f.length = 0, p.clear(), r(), e.debug("[Railroad] Database cleared");
|
|
40
|
+
}, "clear"), _ = /* @__PURE__ */ t((t) => {
|
|
41
|
+
l = m(t), e.debug("[Railroad] Title set:", t);
|
|
42
|
+
}, "setTitle"), v = /* @__PURE__ */ t(() => l, "getTitle"), y = {
|
|
43
|
+
clear: g,
|
|
44
|
+
setTitle: _,
|
|
45
|
+
getTitle: v,
|
|
46
|
+
addRule: /* @__PURE__ */ t((t) => {
|
|
47
|
+
let n = {
|
|
48
|
+
...t,
|
|
49
|
+
name: m(t.name),
|
|
50
|
+
definition: h(t.definition),
|
|
51
|
+
comment: t.comment ? m(t.comment) : void 0
|
|
52
|
+
};
|
|
53
|
+
e.debug("[Railroad] Adding rule:", n.name), p.has(n.name) && e.warn(`[Railroad] Rule '${n.name}' is already defined. Overwriting.`), f.push(n), p.set(n.name, n);
|
|
54
|
+
}, "addRule"),
|
|
55
|
+
getRules: /* @__PURE__ */ t(() => f, "getRules"),
|
|
56
|
+
getRule: /* @__PURE__ */ t((e) => p.get(e), "getRule"),
|
|
57
|
+
setAccTitle: /* @__PURE__ */ t((t) => {
|
|
58
|
+
u = m(t).replace(/^\s+/g, ""), e.debug("[Railroad] Accessibility title set:", t);
|
|
59
|
+
}, "setAccTitle"),
|
|
60
|
+
getAccTitle: /* @__PURE__ */ t(() => u, "getAccTitle"),
|
|
61
|
+
setAccDescription: /* @__PURE__ */ t((t) => {
|
|
62
|
+
d = m(t).replace(/\n\s+/g, "\n"), e.debug("[Railroad] Accessibility description set:", t);
|
|
63
|
+
}, "setAccDescription"),
|
|
64
|
+
getAccDescription: /* @__PURE__ */ t(() => d, "getAccDescription"),
|
|
65
|
+
setDiagramTitle: _,
|
|
66
|
+
getDiagramTitle: v
|
|
67
|
+
}, b = {
|
|
68
|
+
compactMode: !1,
|
|
69
|
+
padding: 10,
|
|
70
|
+
verticalSeparation: 8,
|
|
71
|
+
horizontalSeparation: 10,
|
|
72
|
+
arcRadius: 10,
|
|
73
|
+
fontSize: 14,
|
|
74
|
+
fontFamily: "monospace",
|
|
75
|
+
terminalFill: "#FFFFC0",
|
|
76
|
+
terminalStroke: "#000000",
|
|
77
|
+
terminalTextColor: "#000000",
|
|
78
|
+
nonTerminalFill: "#FFFFFF",
|
|
79
|
+
nonTerminalStroke: "#000000",
|
|
80
|
+
nonTerminalTextColor: "#000000",
|
|
81
|
+
lineColor: "#000000",
|
|
82
|
+
strokeWidth: 2,
|
|
83
|
+
markerFill: "#000000",
|
|
84
|
+
commentFill: "#E8E8E8",
|
|
85
|
+
commentStroke: "#888888",
|
|
86
|
+
commentTextColor: "#666666",
|
|
87
|
+
specialFill: "#F0E0FF",
|
|
88
|
+
specialStroke: "#8800CC",
|
|
89
|
+
ruleNameColor: "#000066",
|
|
90
|
+
showMarkers: !0,
|
|
91
|
+
markerRadius: 5
|
|
92
|
+
}, x = /^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i, S = /^[\w "',.-]+$/, C = /* @__PURE__ */ new Set([
|
|
93
|
+
"compactMode",
|
|
94
|
+
"padding",
|
|
95
|
+
"verticalSeparation",
|
|
96
|
+
"horizontalSeparation",
|
|
97
|
+
"arcRadius",
|
|
98
|
+
"fontSize",
|
|
99
|
+
"fontFamily",
|
|
100
|
+
"terminalFill",
|
|
101
|
+
"terminalStroke",
|
|
102
|
+
"terminalTextColor",
|
|
103
|
+
"nonTerminalFill",
|
|
104
|
+
"nonTerminalStroke",
|
|
105
|
+
"nonTerminalTextColor",
|
|
106
|
+
"lineColor",
|
|
107
|
+
"strokeWidth",
|
|
108
|
+
"markerFill",
|
|
109
|
+
"commentFill",
|
|
110
|
+
"commentStroke",
|
|
111
|
+
"commentTextColor",
|
|
112
|
+
"specialFill",
|
|
113
|
+
"specialStroke",
|
|
114
|
+
"ruleNameColor",
|
|
115
|
+
"showMarkers",
|
|
116
|
+
"markerRadius"
|
|
117
|
+
]), w = /* @__PURE__ */ t((e) => e ? Object.keys(e).every((e) => e === "railroad" || C.has(e)) : !1, "isRailroadStyleOptions"), T = /* @__PURE__ */ t((e) => e ? "railroad" in e && e.railroad ? e.railroad : w(e) ? e : {} : {}, "extractRailroadOverrides"), E = /* @__PURE__ */ t((e) => {
|
|
118
|
+
if (!e || w(e)) return {};
|
|
119
|
+
let { railroad: t, svgId: n, theme: r, look: i, ...a } = e;
|
|
120
|
+
return a;
|
|
121
|
+
}, "extractThemeOverrides"), D = /* @__PURE__ */ t((e, t) => {
|
|
122
|
+
if (typeof e != "string") return t;
|
|
123
|
+
let n = e.trim();
|
|
124
|
+
return x.test(n) ? n : t;
|
|
125
|
+
}, "sanitizeColorValue"), O = /* @__PURE__ */ t((e, t) => {
|
|
126
|
+
if (typeof e != "string") return t;
|
|
127
|
+
let n = e.trim();
|
|
128
|
+
return S.test(n) ? n : t;
|
|
129
|
+
}, "sanitizeFontFamilyValue"), k = /* @__PURE__ */ t((e, t) => {
|
|
130
|
+
let n = typeof e == "number" ? e : typeof e == "string" ? Number.parseFloat(e) : NaN;
|
|
131
|
+
return Number.isFinite(n) && n >= 0 ? n : t;
|
|
132
|
+
}, "sanitizeNumberValue"), A = /* @__PURE__ */ t((e) => {
|
|
133
|
+
let t = typeof e == "number" ? e : typeof e == "string" ? Number.parseFloat(e) : NaN;
|
|
134
|
+
return Number.isFinite(t) && t > 0 ? t : void 0;
|
|
135
|
+
}, "parseThemeFontSize"), j = /* @__PURE__ */ t((e) => {
|
|
136
|
+
let t = O(e.fontFamily, b.fontFamily), n = A(e.fontSize) ?? b.fontSize;
|
|
137
|
+
return {
|
|
138
|
+
...b,
|
|
139
|
+
fontFamily: t,
|
|
140
|
+
fontSize: n,
|
|
141
|
+
terminalFill: D(e.secondBkg ?? e.secondaryColor, b.terminalFill),
|
|
142
|
+
terminalStroke: D(e.secondaryBorderColor ?? e.lineColor, b.terminalStroke),
|
|
143
|
+
terminalTextColor: D(e.secondaryTextColor ?? e.textColor, b.terminalTextColor),
|
|
144
|
+
nonTerminalFill: D(e.mainBkg ?? e.background, b.nonTerminalFill),
|
|
145
|
+
nonTerminalStroke: D(e.primaryBorderColor ?? e.lineColor, b.nonTerminalStroke),
|
|
146
|
+
nonTerminalTextColor: D(e.primaryTextColor ?? e.textColor, b.nonTerminalTextColor),
|
|
147
|
+
lineColor: D(e.lineColor, b.lineColor),
|
|
148
|
+
markerFill: D(e.lineColor, b.markerFill),
|
|
149
|
+
commentFill: D(e.labelBackground ?? e.tertiaryColor, b.commentFill),
|
|
150
|
+
commentStroke: D(e.tertiaryBorderColor ?? e.lineColor, b.commentStroke),
|
|
151
|
+
commentTextColor: D(e.tertiaryTextColor ?? e.textColor, b.commentTextColor),
|
|
152
|
+
specialFill: D(e.tertiaryColor ?? e.secondaryColor, b.specialFill),
|
|
153
|
+
specialStroke: D(e.tertiaryBorderColor ?? e.secondaryBorderColor, b.specialStroke),
|
|
154
|
+
ruleNameColor: D(e.titleColor ?? e.textColor, b.ruleNameColor)
|
|
155
|
+
};
|
|
156
|
+
}, "buildThemeDefaults"), M = /* @__PURE__ */ t((e) => {
|
|
157
|
+
let t = o(), r = j({
|
|
158
|
+
...n(),
|
|
159
|
+
...t.themeVariables ?? {},
|
|
160
|
+
...E(e)
|
|
161
|
+
}), i = {
|
|
162
|
+
...t.railroad ?? {},
|
|
163
|
+
...T(e)
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
compactMode: i.compactMode ?? r.compactMode,
|
|
167
|
+
padding: k(i.padding, r.padding),
|
|
168
|
+
verticalSeparation: k(i.verticalSeparation, r.verticalSeparation),
|
|
169
|
+
horizontalSeparation: k(i.horizontalSeparation, r.horizontalSeparation),
|
|
170
|
+
arcRadius: k(i.arcRadius, r.arcRadius),
|
|
171
|
+
fontSize: k(i.fontSize, r.fontSize),
|
|
172
|
+
fontFamily: O(i.fontFamily, r.fontFamily),
|
|
173
|
+
terminalFill: D(i.terminalFill, r.terminalFill),
|
|
174
|
+
terminalStroke: D(i.terminalStroke, r.terminalStroke),
|
|
175
|
+
terminalTextColor: D(i.terminalTextColor, r.terminalTextColor),
|
|
176
|
+
nonTerminalFill: D(i.nonTerminalFill, r.nonTerminalFill),
|
|
177
|
+
nonTerminalStroke: D(i.nonTerminalStroke, r.nonTerminalStroke),
|
|
178
|
+
nonTerminalTextColor: D(i.nonTerminalTextColor, r.nonTerminalTextColor),
|
|
179
|
+
lineColor: D(i.lineColor, r.lineColor),
|
|
180
|
+
strokeWidth: k(i.strokeWidth, r.strokeWidth),
|
|
181
|
+
markerFill: D(i.markerFill, r.markerFill),
|
|
182
|
+
commentFill: D(i.commentFill, r.commentFill),
|
|
183
|
+
commentStroke: D(i.commentStroke, r.commentStroke),
|
|
184
|
+
commentTextColor: D(i.commentTextColor, r.commentTextColor),
|
|
185
|
+
specialFill: D(i.specialFill, r.specialFill),
|
|
186
|
+
specialStroke: D(i.specialStroke, r.specialStroke),
|
|
187
|
+
ruleNameColor: D(i.ruleNameColor, r.ruleNameColor),
|
|
188
|
+
showMarkers: i.showMarkers ?? r.showMarkers,
|
|
189
|
+
markerRadius: k(i.markerRadius, r.markerRadius)
|
|
190
|
+
};
|
|
191
|
+
}, "buildRailroadStyleOptions"), N = /* @__PURE__ */ t((e) => {
|
|
192
|
+
let { fontFamily: t, fontSize: n, terminalFill: r, terminalStroke: i, terminalTextColor: a, nonTerminalFill: o, nonTerminalStroke: s, nonTerminalTextColor: c, lineColor: l, strokeWidth: u, markerFill: d, commentFill: f, commentStroke: p, commentTextColor: m, specialFill: h, specialStroke: g, ruleNameColor: _ } = M(e);
|
|
193
|
+
return `
|
|
194
|
+
.railroad-diagram {
|
|
195
|
+
font-family: ${t};
|
|
196
|
+
font-size: ${n}px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.railroad-terminal rect {
|
|
200
|
+
fill: ${r};
|
|
201
|
+
stroke: ${i};
|
|
202
|
+
stroke-width: ${u}px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.railroad-terminal text {
|
|
206
|
+
fill: ${a};
|
|
207
|
+
font-family: ${t};
|
|
208
|
+
font-size: ${n}px;
|
|
209
|
+
text-anchor: middle;
|
|
210
|
+
dominant-baseline: middle;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.railroad-nonterminal rect {
|
|
214
|
+
fill: ${o};
|
|
215
|
+
stroke: ${s};
|
|
216
|
+
stroke-width: ${u}px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.railroad-nonterminal text {
|
|
220
|
+
fill: ${c};
|
|
221
|
+
font-family: ${t};
|
|
222
|
+
font-size: ${n}px;
|
|
223
|
+
text-anchor: middle;
|
|
224
|
+
dominant-baseline: middle;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.railroad-line {
|
|
228
|
+
stroke: ${l};
|
|
229
|
+
stroke-width: ${u}px;
|
|
230
|
+
fill: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.railroad-start circle,
|
|
234
|
+
.railroad-end circle {
|
|
235
|
+
fill: ${d};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.railroad-comment ellipse {
|
|
239
|
+
fill: ${f};
|
|
240
|
+
stroke: ${p};
|
|
241
|
+
stroke-width: ${u}px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.railroad-comment text {
|
|
245
|
+
fill: ${m};
|
|
246
|
+
font-style: italic;
|
|
247
|
+
font-family: ${t};
|
|
248
|
+
font-size: ${n}px;
|
|
249
|
+
text-anchor: middle;
|
|
250
|
+
dominant-baseline: middle;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.railroad-special rect {
|
|
254
|
+
fill: ${h};
|
|
255
|
+
stroke: ${g};
|
|
256
|
+
stroke-width: ${u}px;
|
|
257
|
+
stroke-dasharray: 5,3;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.railroad-special text {
|
|
261
|
+
fill: ${c};
|
|
262
|
+
font-family: ${t};
|
|
263
|
+
font-size: ${n}px;
|
|
264
|
+
text-anchor: middle;
|
|
265
|
+
dominant-baseline: middle;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.railroad-rule-name {
|
|
269
|
+
font-weight: bold;
|
|
270
|
+
fill: ${_};
|
|
271
|
+
font-family: ${t};
|
|
272
|
+
font-size: ${n}px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.railroad-group {
|
|
276
|
+
/* Grouping container, no specific styles */
|
|
277
|
+
}
|
|
278
|
+
`;
|
|
279
|
+
}, "getStyles"), P = class {
|
|
280
|
+
constructor() {
|
|
281
|
+
this.d = "";
|
|
282
|
+
}
|
|
283
|
+
static {
|
|
284
|
+
t(this, "PathBuilder");
|
|
285
|
+
}
|
|
286
|
+
moveTo(e, t) {
|
|
287
|
+
return this.d += `M ${e} ${t} `, this;
|
|
288
|
+
}
|
|
289
|
+
lineTo(e, t) {
|
|
290
|
+
return this.d += `L ${e} ${t} `, this;
|
|
291
|
+
}
|
|
292
|
+
horizontalTo(e) {
|
|
293
|
+
return this.d += `H ${e} `, this;
|
|
294
|
+
}
|
|
295
|
+
verticalTo(e) {
|
|
296
|
+
return this.d += `V ${e} `, this;
|
|
297
|
+
}
|
|
298
|
+
arcTo(e, t, n, r, i, a, o) {
|
|
299
|
+
return this.d += `A ${e} ${t} ${n} ${+!!r} ${+!!i} ${a} ${o} `, this;
|
|
300
|
+
}
|
|
301
|
+
build() {
|
|
302
|
+
return this.d.trim();
|
|
303
|
+
}
|
|
304
|
+
}, F = class {
|
|
305
|
+
constructor(e, t = M()) {
|
|
306
|
+
this.textCache = /* @__PURE__ */ new Map(), this.svg = e, this.config = t;
|
|
307
|
+
}
|
|
308
|
+
static {
|
|
309
|
+
t(this, "RailroadRenderer");
|
|
310
|
+
}
|
|
311
|
+
measureText(e) {
|
|
312
|
+
if (this.textCache.has(e)) return this.textCache.get(e);
|
|
313
|
+
let t = this.svg.append("text").attr("font-family", this.config.fontFamily).attr("font-size", this.config.fontSize).text(e), n = t.node().getBBox(), r = {
|
|
314
|
+
width: n.width,
|
|
315
|
+
height: n.height
|
|
316
|
+
};
|
|
317
|
+
return t.remove(), this.textCache.set(e, r), r;
|
|
318
|
+
}
|
|
319
|
+
renderTerminal(e, t) {
|
|
320
|
+
let n = this.measureText(t), r = n.width + this.config.padding * 2, i = n.height + this.config.padding * 2, a = e.append("g").attr("class", "railroad-terminal");
|
|
321
|
+
return a.append("rect").attr("x", 0).attr("y", 0).attr("width", r).attr("height", i).attr("rx", 10).attr("ry", 10), a.append("text").attr("x", r / 2).attr("y", i / 2).text(t), {
|
|
322
|
+
element: a.node(),
|
|
323
|
+
dimensions: {
|
|
324
|
+
width: r,
|
|
325
|
+
height: i,
|
|
326
|
+
up: i / 2,
|
|
327
|
+
down: i / 2
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
renderNonTerminal(e, t) {
|
|
332
|
+
let n = this.measureText(t), r = n.width + this.config.padding * 2, i = n.height + this.config.padding * 2, a = e.append("g").attr("class", "railroad-nonterminal");
|
|
333
|
+
return a.append("rect").attr("x", 0).attr("y", 0).attr("width", r).attr("height", i), a.append("text").attr("x", r / 2).attr("y", i / 2).text(t), {
|
|
334
|
+
element: a.node(),
|
|
335
|
+
dimensions: {
|
|
336
|
+
width: r,
|
|
337
|
+
height: i,
|
|
338
|
+
up: i / 2,
|
|
339
|
+
down: i / 2
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
renderSequence(e, t) {
|
|
344
|
+
let n = t.map((t) => this.renderExpression(e, t)), r = 0, i = 0, a = 0;
|
|
345
|
+
for (let e of n) r += e.dimensions.width, i = Math.max(i, e.dimensions.up), a = Math.max(a, e.dimensions.down);
|
|
346
|
+
r += (n.length - 1) * this.config.horizontalSeparation;
|
|
347
|
+
let o = e.append("g").attr("class", "railroad-sequence"), s = 0;
|
|
348
|
+
for (let e = 0; e < n.length; e++) {
|
|
349
|
+
let t = n[e], r = i - t.dimensions.up;
|
|
350
|
+
if (o.node().appendChild(t.element).setAttribute("transform", `translate(${s}, ${r})`), e < n.length - 1) {
|
|
351
|
+
let e = s + t.dimensions.width, n = e + this.config.horizontalSeparation, r = i;
|
|
352
|
+
o.append("path").attr("class", "railroad-line").attr("d", new P().moveTo(e, r).lineTo(n, r).build());
|
|
353
|
+
}
|
|
354
|
+
s += t.dimensions.width + this.config.horizontalSeparation;
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
element: o.node(),
|
|
358
|
+
dimensions: {
|
|
359
|
+
width: r,
|
|
360
|
+
height: i + a,
|
|
361
|
+
up: i,
|
|
362
|
+
down: a
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
renderChoice(e, t) {
|
|
367
|
+
let n = t.map((t) => this.renderExpression(e, t)), r = 0, i = 0;
|
|
368
|
+
for (let e of n) r = Math.max(r, e.dimensions.width), i += e.dimensions.height;
|
|
369
|
+
i += (n.length - 1) * this.config.verticalSeparation;
|
|
370
|
+
let a = this.config.arcRadius, o = a * 4, s = r + o, c = e.append("g").attr("class", "railroad-choice"), l = 0, u = i / 2;
|
|
371
|
+
for (let e of n) {
|
|
372
|
+
let t = l, n = t + e.dimensions.up, i = a * 2 + (r - e.dimensions.width) / 2;
|
|
373
|
+
c.node().appendChild(e.element).setAttribute("transform", `translate(${i}, ${t})`);
|
|
374
|
+
let o = new P(), d = n > u;
|
|
375
|
+
n === u ? o.moveTo(0, u).lineTo(i, n) : o.moveTo(0, u).arcTo(a, a, 0, !1, d, a, u + (d ? a : -a)).lineTo(a, n - (d ? a : -a)).arcTo(a, a, 0, !1, !d, a * 2, n).lineTo(i, n), c.append("path").attr("class", "railroad-line").attr("d", o.build());
|
|
376
|
+
let f = new P(), p = i + e.dimensions.width, m = s - a * 2;
|
|
377
|
+
n === u ? f.moveTo(p, n).lineTo(s, u) : f.moveTo(p, n).lineTo(m, n).arcTo(a, a, 0, !1, !d, s - a, n + (d ? -a : a)).lineTo(s - a, u + (d ? a : -a)).arcTo(a, a, 0, !1, d, s, u), c.append("path").attr("class", "railroad-line").attr("d", f.build()), l += e.dimensions.height + this.config.verticalSeparation;
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
element: c.node(),
|
|
381
|
+
dimensions: {
|
|
382
|
+
width: s,
|
|
383
|
+
height: i,
|
|
384
|
+
up: u,
|
|
385
|
+
down: i - u
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
renderOptional(e, t) {
|
|
390
|
+
let n = this.renderExpression(e, t), r = this.config.arcRadius, i = r * 2, a = n.dimensions.width + r * 4, o = n.dimensions.height + i, s = e.append("g").attr("class", "railroad-optional"), c = r * 2, l = i;
|
|
391
|
+
s.node().appendChild(n.element).setAttribute("transform", `translate(${c}, ${l})`);
|
|
392
|
+
let u = l + n.dimensions.up, d = new P().moveTo(0, u).lineTo(r * 2, u);
|
|
393
|
+
s.append("path").attr("class", "railroad-line").attr("d", d.build());
|
|
394
|
+
let f = new P().moveTo(c + n.dimensions.width, u).lineTo(a, u);
|
|
395
|
+
s.append("path").attr("class", "railroad-line").attr("d", f.build());
|
|
396
|
+
let p = new P().moveTo(0, u).arcTo(r, r, 0, !1, !1, r, u - r).lineTo(r, r).arcTo(r, r, 0, !1, !0, r * 2, 0).lineTo(a - r * 2, 0).arcTo(r, r, 0, !1, !0, a - r, r).lineTo(a - r, u - r).arcTo(r, r, 0, !1, !1, a, u);
|
|
397
|
+
return s.append("path").attr("class", "railroad-line").attr("d", p.build()), {
|
|
398
|
+
element: s.node(),
|
|
399
|
+
dimensions: {
|
|
400
|
+
width: a,
|
|
401
|
+
height: o,
|
|
402
|
+
up: u,
|
|
403
|
+
down: o - u
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
renderRepetition(e, t, n) {
|
|
408
|
+
let r = this.renderExpression(e, t), i = this.config.arcRadius, a = i * 2, o = r.dimensions.width + i * 4, s = n === 0, c = r.dimensions.height + a + (s ? a : 0), l = e.append("g").attr("class", "railroad-repetition"), u = i * 2, d = s ? a : 0;
|
|
409
|
+
l.node().appendChild(r.element).setAttribute("transform", `translate(${u}, ${d})`);
|
|
410
|
+
let f = d + r.dimensions.up;
|
|
411
|
+
l.append("path").attr("class", "railroad-line").attr("d", new P().moveTo(0, f).lineTo(i * 2, f).build()), l.append("path").attr("class", "railroad-line").attr("d", new P().moveTo(u + r.dimensions.width, f).lineTo(o, f).build());
|
|
412
|
+
let p = d + r.dimensions.height + i, m = new P().moveTo(u + r.dimensions.width, f).arcTo(i, i, 0, !1, !0, u + r.dimensions.width + i, f + i).lineTo(u + r.dimensions.width + i, p).arcTo(i, i, 0, !1, !0, u + r.dimensions.width, p + i).lineTo(i * 2, p + i).arcTo(i, i, 0, !1, !0, i, p).lineTo(i, f + i).arcTo(i, i, 0, !1, !0, i * 2, f);
|
|
413
|
+
if (l.append("path").attr("class", "railroad-line").attr("d", m.build()), s) {
|
|
414
|
+
let e = new P().moveTo(0, f).arcTo(i, i, 0, !1, !1, i, f - i).lineTo(i, i).arcTo(i, i, 0, !1, !0, i * 2, 0).lineTo(o - i * 2, 0).arcTo(i, i, 0, !1, !0, o - i, i).lineTo(o - i, f - i).arcTo(i, i, 0, !1, !1, o, f);
|
|
415
|
+
l.append("path").attr("class", "railroad-line").attr("d", e.build());
|
|
416
|
+
}
|
|
417
|
+
return {
|
|
418
|
+
element: l.node(),
|
|
419
|
+
dimensions: {
|
|
420
|
+
width: o,
|
|
421
|
+
height: c,
|
|
422
|
+
up: f,
|
|
423
|
+
down: c - f
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
renderSpecial(e, t) {
|
|
428
|
+
let n = this.measureText("? " + t + " ?"), r = n.width + this.config.padding * 2, i = n.height + this.config.padding * 2, a = e.append("g").attr("class", "railroad-special");
|
|
429
|
+
return a.append("rect").attr("x", 0).attr("y", 0).attr("width", r).attr("height", i), a.append("text").attr("x", r / 2).attr("y", i / 2).text("? " + t + " ?"), {
|
|
430
|
+
element: a.node(),
|
|
431
|
+
dimensions: {
|
|
432
|
+
width: r,
|
|
433
|
+
height: i,
|
|
434
|
+
up: i / 2,
|
|
435
|
+
down: i / 2
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
renderExpression(e, t) {
|
|
440
|
+
switch (t.type) {
|
|
441
|
+
case "terminal": return this.renderTerminal(e, t.value);
|
|
442
|
+
case "nonterminal": return this.renderNonTerminal(e, t.name);
|
|
443
|
+
case "sequence": return this.renderSequence(e, t.elements);
|
|
444
|
+
case "choice": return this.renderChoice(e, t.alternatives);
|
|
445
|
+
case "optional": return this.renderOptional(e, t.element);
|
|
446
|
+
case "repetition": return this.renderRepetition(e, t.element, t.min);
|
|
447
|
+
case "special": return this.renderSpecial(e, t.text);
|
|
448
|
+
default: throw Error(`Unknown node type: ${t.type}`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
renderRule(e, t) {
|
|
452
|
+
let n = this.svg.append("g").attr("class", "railroad-rule").attr("transform", `translate(0, ${t})`), r = e.name + " =", i = this.measureText(r).width + 20, a = i + 20, o = n.append("g"), s = this.renderExpression(o, e.definition), c = Math.max(20, s.dimensions.up), l = c - s.dimensions.up;
|
|
453
|
+
return o.attr("transform", `translate(${a}, ${l})`), n.append("g").attr("class", "railroad-rule-name-group").append("text").attr("class", "railroad-rule-name").attr("x", 0).attr("y", c).text(r), n.append("g").attr("class", "railroad-start").append("circle").attr("cx", i).attr("cy", c).attr("r", this.config.markerRadius), n.append("g").attr("class", "railroad-end").append("circle").attr("cx", a + s.dimensions.width + 10).attr("cy", c).attr("r", this.config.markerRadius), n.append("path").attr("class", "railroad-line").attr("d", new P().moveTo(i + this.config.markerRadius, c).lineTo(a, c).build()), n.append("path").attr("class", "railroad-line").attr("d", new P().moveTo(a + s.dimensions.width, c).lineTo(a + s.dimensions.width + 10 - this.config.markerRadius, c).build()), {
|
|
454
|
+
height: Math.max(40, l + s.dimensions.height + this.config.padding * 2),
|
|
455
|
+
width: a + s.dimensions.width + 10 + this.config.markerRadius
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
renderDiagram(e) {
|
|
459
|
+
let t = this.config.padding, n = 0;
|
|
460
|
+
for (let r of e) {
|
|
461
|
+
let e = this.renderRule(r, t);
|
|
462
|
+
t += e.height + this.config.verticalSeparation, n = Math.max(n, e.width);
|
|
463
|
+
}
|
|
464
|
+
return {
|
|
465
|
+
width: n + this.config.padding * 2,
|
|
466
|
+
height: t + this.config.padding
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
}, I = /* @__PURE__ */ t((e, t, n) => {
|
|
470
|
+
a(e, t.height, t.width, n), e.attr("viewBox", `0 0 ${t.width} ${t.height}`);
|
|
471
|
+
}, "configureRailroadSvgSize"), L = { draw: /* @__PURE__ */ t((t, n, r) => {
|
|
472
|
+
e.debug("[Railroad] Rendering diagram\n" + t);
|
|
473
|
+
try {
|
|
474
|
+
let t = c(n);
|
|
475
|
+
t.attr("class", "railroad-diagram");
|
|
476
|
+
let r = o().railroad?.useMaxWidth ?? !0, i = y.getRules();
|
|
477
|
+
if (e.debug(`[Railroad] Rendering ${i.length} rules`), i.length === 0) {
|
|
478
|
+
e.warn("[Railroad] No rules to render"), I(t, {
|
|
479
|
+
height: 100,
|
|
480
|
+
width: 200
|
|
481
|
+
}, r);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
I(t, new F(t, M()).renderDiagram(i), r), e.debug("[Railroad] Render complete");
|
|
485
|
+
} catch (t) {
|
|
486
|
+
throw e.error("[Railroad] Render error:", t), t;
|
|
487
|
+
}
|
|
488
|
+
}, "draw") };
|
|
489
|
+
//#endregion
|
|
490
|
+
export { N as n, L as r, y as t };
|