for-humanity 0.12.0 → 0.13.1

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.
Files changed (226) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +16 -9
  3. package/dist/browser.js +14 -16
  4. package/dist/cli.css +2 -968
  5. package/dist/cli.js +92 -2318
  6. package/dist/config.js +1 -0
  7. package/dist/constant/copy.d.ts +100 -0
  8. package/dist/constant/site.d.ts +20 -0
  9. package/dist/constant/status.d.ts +19 -0
  10. package/dist/copy-C1uzvEnr.js +103 -0
  11. package/dist/group-path-XAThmzvC.js +10 -0
  12. package/dist/load-site-B-u5-jv0.js +2343 -0
  13. package/dist/logger-Dv1i9xSV.js +9 -0
  14. package/dist/mermaid/THIRD-PARTY-NOTICES.txt +3134 -0
  15. package/dist/mermaid/chunk--TN-qHgG.js +2 -0
  16. package/dist/mermaid/chunk-0kM1Lv4D.js +2 -0
  17. package/dist/mermaid/chunk-3FHei3pH.js +2001 -0
  18. package/dist/mermaid/chunk-3_2p2GqN.js +2 -0
  19. package/dist/mermaid/chunk-6HLei9i0.js +84 -0
  20. package/dist/mermaid/chunk-7Sz3kAwl.js +2214 -0
  21. package/dist/mermaid/chunk-7Tarqbpa.js +18047 -0
  22. package/dist/mermaid/chunk-9kkt8lzL.js +10 -0
  23. package/dist/mermaid/chunk-B--pNBQF.js +884 -0
  24. package/dist/mermaid/chunk-B4F-pysn.js +4241 -0
  25. package/dist/mermaid/chunk-B58sEIY_.js +14 -0
  26. package/dist/mermaid/chunk-B9_UWzSH.js +1517 -0
  27. package/dist/mermaid/chunk-BB8uZHwY.js +75 -0
  28. package/dist/mermaid/chunk-BFfk0LEc.js +717 -0
  29. package/dist/mermaid/chunk-BKri0qr7.js +89 -0
  30. package/dist/mermaid/chunk-BL404pH5.js +26 -0
  31. package/dist/mermaid/chunk-BLeiQSWo.js +354 -0
  32. package/dist/mermaid/chunk-BOmH_UFd.js +2 -0
  33. package/dist/mermaid/chunk-BSej9Nhy.js +1361 -0
  34. package/dist/mermaid/chunk-BYzrzvCI.js +12 -0
  35. package/dist/mermaid/chunk-BariMtWr.js +3020 -0
  36. package/dist/mermaid/chunk-BcrBoMwH.js +2352 -0
  37. package/dist/mermaid/chunk-Bok8z-Yo.js +67 -0
  38. package/dist/mermaid/chunk-BpTHLKQM.js +1970 -0
  39. package/dist/mermaid/chunk-BqjuxRsC.js +733 -0
  40. package/dist/mermaid/chunk-BuvPd-s5.js +1073 -0
  41. package/dist/mermaid/chunk-BvVehae3.js +5069 -0
  42. package/dist/mermaid/chunk-C-JABYpd.js +3075 -0
  43. package/dist/mermaid/chunk-C9XlTm4w.js +2 -0
  44. package/dist/mermaid/chunk-CApNbSU9.js +6 -0
  45. package/dist/mermaid/chunk-CCM2AH-C.js +9 -0
  46. package/dist/mermaid/chunk-CD1E0F_N.js +2 -0
  47. package/dist/mermaid/chunk-CDWvKG7D.js +2 -0
  48. package/dist/mermaid/chunk-CEVPpC1F.js +34 -0
  49. package/dist/mermaid/chunk-CLDr12lf.js +47504 -0
  50. package/dist/mermaid/chunk-CLVYqOBI.js +61 -0
  51. package/dist/mermaid/chunk-CLeOkFb5.js +15 -0
  52. package/dist/mermaid/chunk-CLgRAtOz.js +37 -0
  53. package/dist/mermaid/chunk-CMqFNUBl.js +134 -0
  54. package/dist/mermaid/chunk-CTPaBJXB.js +2 -0
  55. package/dist/mermaid/chunk-CVi6IGBL.js +2 -0
  56. package/dist/mermaid/chunk-CWV_EN-4.js +4745 -0
  57. package/dist/mermaid/chunk-CZ0dAs3g.js +2 -0
  58. package/dist/mermaid/chunk-C_YGy4Fn.js +236 -0
  59. package/dist/mermaid/chunk-CcVH22Yt.js +100 -0
  60. package/dist/mermaid/chunk-CgG6CD9_.js +7175 -0
  61. package/dist/mermaid/chunk-CgOP6IDB.js +3397 -0
  62. package/dist/mermaid/chunk-Cgg2UTSf.js +13 -0
  63. package/dist/mermaid/chunk-ChJfJJ1A.js +214 -0
  64. package/dist/mermaid/chunk-Ck5XRA46.js +447 -0
  65. package/dist/mermaid/chunk-Ckuw16cl.js +203 -0
  66. package/dist/mermaid/chunk-CpAbRCbF.js +1880 -0
  67. package/dist/mermaid/chunk-CuYekbSv.js +2 -0
  68. package/dist/mermaid/chunk-CwS4wZ5a.js +2 -0
  69. package/dist/mermaid/chunk-D-bcrBO3.js +82 -0
  70. package/dist/mermaid/chunk-D3IEAkCW.js +76 -0
  71. package/dist/mermaid/chunk-D8XfBJ_K.js +645 -0
  72. package/dist/mermaid/chunk-D9Ddd9y4.js +2228 -0
  73. package/dist/mermaid/chunk-DBh1mIbK.js +12 -0
  74. package/dist/mermaid/chunk-DD6Df6Ic.js +5 -0
  75. package/dist/mermaid/chunk-DGVDaXjx.js +8 -0
  76. package/dist/mermaid/chunk-DK9KqIXj.js +632 -0
  77. package/dist/mermaid/chunk-DORnIAsy.js +4487 -0
  78. package/dist/mermaid/chunk-DU69_VcF.js +363 -0
  79. package/dist/mermaid/chunk-DVNvSFoz.js +2144 -0
  80. package/dist/mermaid/chunk-DZe-4kde.js +20 -0
  81. package/dist/mermaid/chunk-D_a06Rz4.js +287 -0
  82. package/dist/mermaid/chunk-DfyFJJi2.js +972 -0
  83. package/dist/mermaid/chunk-DhKYPp1Z.js +2 -0
  84. package/dist/mermaid/chunk-DjFqgNTG.js +94 -0
  85. package/dist/mermaid/chunk-DmbDDrr-.js +65 -0
  86. package/dist/mermaid/chunk-DpuxlyL_.js +696 -0
  87. package/dist/mermaid/chunk-DqGhppWe.js +2 -0
  88. package/dist/mermaid/chunk-DqPZxHXa.js +5 -0
  89. package/dist/mermaid/chunk-Dt_1Jyif.js +293 -0
  90. package/dist/mermaid/chunk-DyQBE_NW.js +1935 -0
  91. package/dist/mermaid/chunk-JckyC4mW.js +1009 -0
  92. package/dist/mermaid/chunk-K7Myuj2-.js +1334 -0
  93. package/dist/mermaid/chunk-KuPYb48V.js +275 -0
  94. package/dist/mermaid/chunk-MFVRUoO0.js +4020 -0
  95. package/dist/mermaid/chunk-MbInCS_6.js +28 -0
  96. package/dist/mermaid/chunk-MexOLyKV.js +355 -0
  97. package/dist/mermaid/chunk-NnbDtJzg.js +21856 -0
  98. package/dist/mermaid/chunk-SGpOYZbI.js +2139 -0
  99. package/dist/mermaid/chunk-TbxLDlcU.js +198 -0
  100. package/dist/mermaid/chunk-TftHqGLg.js +490 -0
  101. package/dist/mermaid/chunk-UjQ8vA_Z.js +4138 -0
  102. package/dist/mermaid/chunk-YgmVTKqc.js +16 -0
  103. package/dist/mermaid/chunk-_a9EZE1v.js +1798 -0
  104. package/dist/mermaid/chunk-dTb8jqeP.js +2 -0
  105. package/dist/mermaid/chunk-fFdMfF8S.js +2240 -0
  106. package/dist/mermaid/chunk-feYbMzBj.js +1267 -0
  107. package/dist/mermaid/chunk-g3Pn8DkW.js +46 -0
  108. package/dist/mermaid/chunk-hM77LvCb.js +19832 -0
  109. package/dist/mermaid/chunk-hUDb-eAW.js +527 -0
  110. package/dist/mermaid/chunk-tpABtZ-3.js +4252 -0
  111. package/dist/mermaid/chunk-xIbz3oFK.js +59 -0
  112. package/dist/mermaid/chunk-yBz-vst0.js +976 -0
  113. package/dist/mermaid/mermaid-BhtR3wyB.js +1145 -0
  114. package/dist/run-site-command-cqCjpIlc.js +129 -0
  115. package/dist/site-config-bllORGpm.js +90 -0
  116. package/dist/site.js +1 -0
  117. package/dist/start-dev-server-x7Ja5uwv.js +184 -0
  118. package/dist/to-change-queue-DbEnZGNK.js +34 -0
  119. package/dist/to-error-message-pF6_7wGK.js +16 -0
  120. package/dist/type/group-path.d.ts +7 -0
  121. package/dist/type/site-config.d.ts +57 -0
  122. package/package.json +34 -17
  123. package/src/component/widget/cursor-face/_constant/cursor-face.ts +0 -14
  124. package/src/component/widget/cursor-face/wg-cursor-face.css +0 -15
  125. package/src/component/widget/cursor-face/wg-cursor-face.tsx +0 -153
  126. package/src/component/widget/navigation/_constant/locale.ts +0 -9
  127. package/src/component/widget/navigation/_constant/navigation-data-schema.ts +0 -33
  128. package/src/component/widget/navigation/_constant/navigation.ts +0 -9
  129. package/src/component/widget/navigation/_constant/reading-line.ts +0 -4
  130. package/src/component/widget/navigation/_function/restore-navigation-scroll.ts +0 -59
  131. package/src/component/widget/navigation/_function/to-doc-groups/_to-doc-branches.ts +0 -15
  132. package/src/component/widget/navigation/_function/to-doc-groups/_to-doc-group-branches.ts +0 -70
  133. package/src/component/widget/navigation/_function/to-doc-groups/to-doc-groups.ts +0 -15
  134. package/src/component/widget/navigation/_function/to-navigation-data/_to-navigation-document.ts +0 -13
  135. package/src/component/widget/navigation/_function/to-navigation-data/_to-navigation-group.ts +0 -13
  136. package/src/component/widget/navigation/_function/to-navigation-data/to-navigation-data.ts +0 -18
  137. package/src/component/widget/navigation/_function/to-navigation-json.ts +0 -8
  138. package/src/component/widget/navigation/_function/to-toc-groups.ts +0 -38
  139. package/src/component/widget/navigation/_type/doc-branch.ts +0 -11
  140. package/src/component/widget/navigation/_type/doc-group.ts +0 -24
  141. package/src/component/widget/navigation/_type/navigation-data.ts +0 -75
  142. package/src/component/widget/navigation/_type/navigation-focus-snapshot.ts +0 -17
  143. package/src/component/widget/navigation/_type/toc-group.ts +0 -39
  144. package/src/component/widget/navigation/_wg-navigation-nav-list.css +0 -48
  145. package/src/component/widget/navigation/_wg-navigation-nav-list.tsx +0 -61
  146. package/src/component/widget/navigation/_wg-navigation-nav.css +0 -21
  147. package/src/component/widget/navigation/_wg-navigation-nav.tsx +0 -33
  148. package/src/component/widget/navigation/_wg-navigation-scroll.tsx +0 -117
  149. package/src/component/widget/navigation/_wg-navigation-toc.css +0 -91
  150. package/src/component/widget/navigation/_wg-navigation-toc.tsx +0 -114
  151. package/src/component/widget/navigation/wg-navigation.css +0 -282
  152. package/src/component/widget/navigation/wg-navigation.tsx +0 -420
  153. package/src/component/widget/prose/_constant/heading-highlight.ts +0 -4
  154. package/src/component/widget/prose/_constant/section.ts +0 -7
  155. package/src/component/widget/prose/_constant/status.ts +0 -9
  156. package/src/component/widget/prose/_function/has-block-content.ts +0 -30
  157. package/src/component/widget/prose/_function/rehype-head.ts +0 -31
  158. package/src/component/widget/prose/_function/rehype-sections/_to-section-headings.ts +0 -20
  159. package/src/component/widget/prose/_function/rehype-sections/rehype-sections.ts +0 -21
  160. package/src/component/widget/prose/_function/rehype-tables.ts +0 -22
  161. package/src/component/widget/prose/_function/remark-blocks.ts +0 -112
  162. package/src/component/widget/prose/_function/remark-flow.ts +0 -26
  163. package/src/component/widget/prose/_function/remark-links.ts +0 -33
  164. package/src/component/widget/prose/_function/remark-parts.ts +0 -26
  165. package/src/component/widget/prose/_function/remark-status.ts +0 -59
  166. package/src/component/widget/prose/_function/remark-swatch.ts +0 -16
  167. package/src/component/widget/prose/_function/remark-unknown-directives.ts +0 -25
  168. package/src/component/widget/prose/wg-prose.css +0 -484
  169. package/src/component/widget/prose/wg-prose.tsx +0 -43
  170. package/src/component/widget/shell/wg-shell.css +0 -63
  171. package/src/component/widget/shell/wg-shell.tsx +0 -88
  172. package/src/component/widget/shell-controls/wg-shell-controls.css +0 -4
  173. package/src/component/widget/shell-controls/wg-shell-controls.tsx +0 -170
  174. package/src/constant/asset.ts +0 -63
  175. package/src/constant/copy.ts +0 -133
  176. package/src/constant/doc.ts +0 -13
  177. package/src/constant/font.ts +0 -34
  178. package/src/constant/site.ts +0 -24
  179. package/src/constant/status.ts +0 -15
  180. package/src/entry/browser/browser.tsx +0 -22
  181. package/src/entry/cli/_constant/cli.ts +0 -19
  182. package/src/entry/cli/_constant/crawling.ts +0 -14
  183. package/src/entry/cli/_constant/snippet.ts +0 -21
  184. package/src/entry/cli/_function/create-app.tsx +0 -57
  185. package/src/entry/cli/_function/create-dev-app.ts +0 -87
  186. package/src/entry/cli/_function/create-processor/_rehype-assets.ts +0 -70
  187. package/src/entry/cli/_function/create-processor/_rehype-heading-ids.ts +0 -34
  188. package/src/entry/cli/_function/create-processor/_remark-report.ts +0 -15
  189. package/src/entry/cli/_function/create-processor/_remark-snippets.ts +0 -117
  190. package/src/entry/cli/_function/create-processor/_shiki-transformers.ts +0 -91
  191. package/src/entry/cli/_function/create-processor/create-processor.ts +0 -64
  192. package/src/entry/cli/_function/read-docs.ts +0 -128
  193. package/src/entry/cli/_function/read-home.ts +0 -32
  194. package/src/entry/cli/_function/to-crawling-app.ts +0 -42
  195. package/src/entry/cli/cli.test.ts +0 -804
  196. package/src/entry/cli/cli.ts +0 -206
  197. package/src/env.d.ts +0 -6
  198. package/src/page/doc/pg-doc.tsx +0 -35
  199. package/src/page/home/pg-home.tsx +0 -40
  200. package/src/store/navigation/create-navigation-stores.test.ts +0 -74
  201. package/src/store/navigation/create-navigation-stores.ts +0 -59
  202. package/src/store/navigation/navigation-state.ts +0 -36
  203. package/src/store/navigation/navigation-storage.ts +0 -9
  204. package/src/store/navigation/to-navigation-scroll-state.ts +0 -42
  205. package/src/style/base.css +0 -28
  206. package/src/style/token.css +0 -188
  207. package/src/type/doc-content.ts +0 -15
  208. package/src/type/doc-data.ts +0 -38
  209. package/src/type/doc-file-data.ts +0 -21
  210. package/src/type/doc-heading.ts +0 -17
  211. package/src/type/doc-outline.ts +0 -16
  212. package/src/type/doc-section.ts +0 -9
  213. package/src/type/doc.ts +0 -20
  214. package/src/type/group-path.ts +0 -7
  215. package/src/type/site-assets.ts +0 -25
  216. package/src/type/site-config.ts +0 -73
  217. package/src/type/vfile-data.d.ts +0 -10
  218. package/src/util/async/to-change-queue.test.ts +0 -58
  219. package/src/util/async/to-change-queue.ts +0 -43
  220. package/src/util/dom/find-hash-target.ts +0 -18
  221. package/src/util/dom/reveal-hash-target.ts +0 -15
  222. package/src/util/error/to-error-message.ts +0 -10
  223. package/src/util/file/to-asset-path.ts +0 -26
  224. package/src/util/font/to-font-css.test.ts +0 -41
  225. package/src/util/font/to-font-css.ts +0 -28
  226. package/src/util/mermaid/render-flow.js +0 -321
@@ -0,0 +1,2 @@
1
+ import "./chunk-hM77LvCb.js";
2
+ export { c as createTreeViewServices } from "./chunk-DK9KqIXj.js";
@@ -0,0 +1,5 @@
1
+ import { n as e } from "./chunk-BYzrzvCI.js";
2
+ //#region node_modules/.pnpm/mermaid@12.2.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5VM5RSS4.mjs
3
+ var t = /* @__PURE__ */ e(() => "\n /* Font Awesome icon styling - consolidated */\n .label-icon {\n display: inline-block;\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n }\n \n .node .label-icon path {\n fill: currentColor;\n stroke: revert;\n stroke-width: revert;\n }\n", "getIconStyles");
4
+ //#endregion
5
+ export { t };
@@ -0,0 +1,293 @@
1
+ import { m as e } from "./chunk-DVNvSFoz.js";
2
+ import { n as t } from "./chunk-BYzrzvCI.js";
3
+ import { C as n, H as r, U as i, _ as a, a as o, c as s, f as c, q as l, v as u, y as d, z as f } from "./chunk-MFVRUoO0.js";
4
+ import { i as p } from "./chunk-K7Myuj2-.js";
5
+ import { t as m } from "./chunk-B58sEIY_.js";
6
+ import { r as h, t as g } from "./chunk-KuPYb48V.js";
7
+ import { n as _ } from "./chunk-DK9KqIXj.js";
8
+ import { t as v } from "./chunk-DGVDaXjx.js";
9
+ import { t as y } from "./chunk-CLeOkFb5.js";
10
+ //#region node_modules/.pnpm/mermaid@12.2.0/node_modules/mermaid/dist/chunks/mermaid.core/diagram-ODIL2UCW.mjs
11
+ var b = /[─━│┃└┗├┣]/, x = /[└┗├┣]/, S = /[─━]/, C = /^[\s│┃]+$/, w = /^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/, T = /^\s*%%/, E = " ";
12
+ function D(e) {
13
+ return e.some((e) => b.test(e));
14
+ }
15
+ t(D, "isBoxDrawingFormat");
16
+ function O(e) {
17
+ for (let t of e) {
18
+ let e = x.exec(t);
19
+ if (e?.index && e.index > 0) return e.index;
20
+ }
21
+ return 4;
22
+ }
23
+ t(O, "inferSegmentWidth");
24
+ function k(e, t) {
25
+ return e.replace(/\bline\s+(\d+)\b/gi, (e, n) => {
26
+ let r = parseInt(n, 10), i = t.get(r);
27
+ return i ? `line ${i}` : e;
28
+ });
29
+ }
30
+ t(k, "remapErrorLines");
31
+ function A(e) {
32
+ let t = e.split("\n"), n = /* @__PURE__ */ new Map(), r = -1;
33
+ for (let [e, n] of t.entries()) if (n.trim() === "treeView-beta") {
34
+ r = e;
35
+ break;
36
+ }
37
+ if (r === -1) return {
38
+ text: e,
39
+ lineMap: n
40
+ };
41
+ let i = [];
42
+ for (let e = r + 1; e < t.length; e++) {
43
+ let n = t[e];
44
+ n.trim() === "" || T.test(n) || w.test(n) || C.test(n) || i.push(n.replace(/\t/g, " "));
45
+ }
46
+ if (!D(i)) return {
47
+ text: e,
48
+ lineMap: n
49
+ };
50
+ let a = O(i), o = [], s = 0;
51
+ for (let e = 0; e <= r; e++) o.push(t[e]), s++, n.set(s, e + 1);
52
+ for (let e = r + 1; e < t.length; e++) {
53
+ let r = t[e], i = r.trim(), c = e + 1;
54
+ if (i === "" || T.test(r) || w.test(r)) {
55
+ o.push(r), s++, n.set(s, c);
56
+ continue;
57
+ }
58
+ if (C.test(r)) continue;
59
+ let l = r.replace(/\t/g, " "), u = x.exec(l);
60
+ if (u?.index !== void 0) {
61
+ let e = u.index, t = Math.round(e / a) + 1, r = e + 1;
62
+ for (; r < l.length && S.test(l[r]);) r++;
63
+ for (; r < l.length && l[r] === " ";) r++;
64
+ let i = l.slice(r).trimEnd();
65
+ if (!i) throw Error(`Line ${c}: Empty node \u2014 expected a filename or directory name after the box-drawing prefix`);
66
+ let d = E.repeat(t);
67
+ o.push(d + i), s++, n.set(s, c);
68
+ } else if (/^[\s─━│┃└┗├┣]+$/.test(l)) continue;
69
+ else if (b.test(l)) o.push(r), s++, n.set(s, c);
70
+ else if (/^\s+/.test(l)) throw Error(`Line ${c}: Unexpected indentation without box-drawing characters. In box-drawing format, use \u251C\u2500\u2500 or \u2514\u2500\u2500 prefixes for indented nodes.`);
71
+ else o.push(r), s++, n.set(s, c);
72
+ }
73
+ return {
74
+ text: o.join("\n"),
75
+ lineMap: n
76
+ };
77
+ }
78
+ t(A, "preprocessBoxDrawing");
79
+ var j = new y(() => ({
80
+ cnt: 1,
81
+ stack: [{
82
+ id: 0,
83
+ level: -1,
84
+ name: "/",
85
+ nodeType: "directory",
86
+ children: []
87
+ }]
88
+ })), M = /* @__PURE__ */ t(() => {
89
+ j.reset(), o();
90
+ }, "clear"), N = /* @__PURE__ */ t(() => j.records.stack[0], "getRoot"), P = /* @__PURE__ */ t(() => j.records.cnt, "getCount"), F = c.treeView, I = {
91
+ clear: M,
92
+ addNode: /* @__PURE__ */ t((e, t, n, r, i, a) => {
93
+ for (; e <= j.records.stack[j.records.stack.length - 1].level;) j.records.stack.pop();
94
+ let o = {
95
+ id: j.records.cnt++,
96
+ level: e,
97
+ name: t,
98
+ nodeType: n,
99
+ icon: i,
100
+ cssClass: r,
101
+ description: a,
102
+ children: []
103
+ };
104
+ j.records.stack[j.records.stack.length - 1].children.push(o), j.records.stack.push(o);
105
+ }, "addNode"),
106
+ getRoot: N,
107
+ getCount: P,
108
+ getConfig: /* @__PURE__ */ t(() => p(F, d().treeView), "getConfig"),
109
+ getAccTitle: u,
110
+ getAccDescription: a,
111
+ getDiagramTitle: n,
112
+ setAccDescription: r,
113
+ setAccTitle: i,
114
+ setDiagramTitle: l
115
+ }, L = /* @__PURE__ */ t((e) => {
116
+ v(e, I);
117
+ for (let t of e.nodes) {
118
+ let e = typeof t.indent == "number" ? t.indent : 0, n = t.name, r = n.endsWith("/");
119
+ r && (n = n.slice(0, -1));
120
+ let i = r ? "directory" : "file", a = t.classAnnotation || void 0, o = t.iconAnnotation, s = o === void 0 ? void 0 : o || "none", c = t.descAnnotation || void 0, l = c ? f(c, d()) : void 0;
121
+ I.addNode(e, n, i, a, s, l);
122
+ }
123
+ }, "populate"), R = { parse: /* @__PURE__ */ t(async (t) => {
124
+ let { text: n, lineMap: r } = A(t);
125
+ try {
126
+ let t = await _("treeView", n);
127
+ e.debug(t), L(t);
128
+ } catch (e) {
129
+ throw r.size > 0 && e instanceof Error && (e.message = k(e.message, r)), e;
130
+ }
131
+ }, "parse") }, z = {
132
+ prefix: "mermaid-treeview",
133
+ height: 24,
134
+ width: 24,
135
+ icons: {
136
+ 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\"/>" },
137
+ 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\"/>" }
138
+ }
139
+ };
140
+ function B(e, t) {
141
+ let n = t?.filenameIcons?.[e];
142
+ if (n) return n;
143
+ let r = e.lastIndexOf(".");
144
+ if (r > 0) {
145
+ let n = e.substring(r).toLowerCase(), i = t?.extensionIcons;
146
+ return i?.[n] ?? i?.[n.slice(1)];
147
+ }
148
+ }
149
+ t(B, "detectIcon");
150
+ function V(e, t) {
151
+ return e.includes(":") ? e : e in z.icons || !t ? `${z.prefix}:${e}` : `${t}:${e}`;
152
+ }
153
+ t(V, "qualifyIcon");
154
+ function H(e, t) {
155
+ if (e.icon !== "none") {
156
+ if (e.icon) return V(e.icon, t.defaultIconPack);
157
+ if (t.showIcons) {
158
+ if (e.nodeType === "file") {
159
+ let n = B(e.name, t);
160
+ if (n === "none") return;
161
+ if (n) return V(n, t.defaultIconPack);
162
+ }
163
+ return `${z.prefix}:${e.nodeType === "directory" ? "folder" : "file"}`;
164
+ }
165
+ }
166
+ }
167
+ t(H, "getNodeIcon"), h([{
168
+ name: z.prefix,
169
+ icons: z
170
+ }]);
171
+ var U = 14, W = 4, G = 16, K = /* @__PURE__ */ t(async (e, n) => {
172
+ let r = [], i = /* @__PURE__ */ t((e) => {
173
+ let t = H(e, n);
174
+ t && r.push({
175
+ icon: t,
176
+ node: e
177
+ }), e.children.forEach(i);
178
+ }, "collect");
179
+ i(e);
180
+ let a = await Promise.all(r.map(async ({ icon: e, node: t }) => ({
181
+ id: t.id,
182
+ svg: await g(e, {
183
+ height: U,
184
+ width: U
185
+ })
186
+ })));
187
+ return new Map(a.map(({ id: e, svg: t }) => [e, t]));
188
+ }, "resolveNodeIcons"), q = /* @__PURE__ */ t((e, t, n, r, i, a) => {
189
+ let o = r.append("g"), s = "treeView-node-label";
190
+ n.nodeType === "directory" && (s += " treeView-node-dir"), n.cssClass && (s += ` ${n.cssClass}`);
191
+ let c = U + W, l = H(n, i), u = l !== void 0;
192
+ l && o.append("g").attr("class", "treeView-node-icon").attr("transform", `translate(${e + i.paddingX}, ${t + i.paddingY})`).html(a.get(n.id) ?? "");
193
+ let d = o.append("text").text(n.name).attr("dominant-baseline", "middle").attr("class", s), { height: f, width: p } = d.node().getBBox(), m = f + i.paddingY * 2, h = e + i.paddingX + (u ? c : 0);
194
+ d.attr("x", h), d.attr("y", t + m / 2);
195
+ let g = h + p;
196
+ return n.BBox = {
197
+ x: e,
198
+ y: t,
199
+ width: p + i.paddingX * 2 + (u ? c : 0),
200
+ height: m
201
+ }, n.cssClass?.split(/\s+/).includes("highlight") && o.insert("rect", ":first-child").attr("x", e).attr("y", t + 1).attr("width", 0).attr("height", m - 2).attr("rx", 3).attr("class", "treeView-highlight-bg"), {
202
+ node: n,
203
+ nodeGroup: o,
204
+ labelRightEdge: g,
205
+ centerY: t + m / 2
206
+ };
207
+ }, "positionLabel"), J = /* @__PURE__ */ t((e, t, n, r, i, a) => e.append("line").attr("x1", t).attr("y1", n).attr("x2", r).attr("y2", i).attr("stroke-width", a).attr("class", "treeView-node-line"), "positionLine"), Y = /* @__PURE__ */ t((e, n, r, i) => {
208
+ let a = 0, o = 0, s = [], c = /* @__PURE__ */ t((e, t, n, r) => {
209
+ let c = r * (n.rowIndent + n.paddingX), l = q(c, a, t, e, n, i);
210
+ s.push(l);
211
+ let { height: u, width: d } = t.BBox;
212
+ J(e, c - n.rowIndent, a + u / 2, c, a + u / 2, n.lineThickness), o = Math.max(o, c + d), a += u;
213
+ }, "drawNode"), l = /* @__PURE__ */ t((t, n = 0) => {
214
+ c(e, t, r, n), t.children.forEach((e) => {
215
+ l(e, n + 1);
216
+ });
217
+ let { x: i, y: a, height: o } = t.BBox;
218
+ if (t.children.length) {
219
+ let { y: n, height: s } = t.children[t.children.length - 1].BBox;
220
+ J(e, i + r.paddingX, a + o, i + r.paddingX, n + s / 2 + r.lineThickness / 2, r.lineThickness);
221
+ }
222
+ }, "processNode");
223
+ l(n);
224
+ let u = s.filter((e) => e.node.description);
225
+ if (u.length > 0) {
226
+ let e = Math.max(...s.map((e) => e.labelRightEdge)) + G;
227
+ for (let t of u) {
228
+ let n = t.nodeGroup.append("text").text(t.node.description).attr("dominant-baseline", "middle").attr("class", "treeView-node-description").attr("x", e).attr("y", t.centerY).node().getBBox();
229
+ o = Math.max(o, e + n.width + r.paddingX);
230
+ }
231
+ }
232
+ for (let e of s) if (e.node.cssClass?.split(/\s+/).includes("highlight")) {
233
+ let t = e.nodeGroup.select(".treeView-highlight-bg");
234
+ if (!t.empty()) {
235
+ let n = o - e.node.BBox.x + 8;
236
+ t.attr("width", n), o = Math.max(o, e.node.BBox.x + n + 2);
237
+ }
238
+ }
239
+ return {
240
+ totalHeight: a,
241
+ totalWidth: o
242
+ };
243
+ }, "drawTree"), X = { draw: /* @__PURE__ */ t(async (t, n, r, i) => {
244
+ e.debug("Rendering treeView diagram\n" + t);
245
+ let a = i.db, o = a.getRoot(), c = a.getConfig(), l = m(n), u = l.append("g");
246
+ u.attr("class", "tree-view");
247
+ let { totalHeight: d, totalWidth: f } = Y(u, o, c, await K(o, c));
248
+ l.attr("viewBox", `-${c.lineThickness / 2} 0 ${f} ${d}`), s(l, d, f, c.useMaxWidth);
249
+ }, "draw") }, Z = {
250
+ labelFontSize: "16px",
251
+ labelColor: "black",
252
+ lineColor: "black",
253
+ iconColor: "#546e7a",
254
+ descriptionColor: "#6a9955",
255
+ highlightBg: "rgba(255, 193, 7, 0.15)",
256
+ highlightStroke: "#ffc107"
257
+ }, Q = {
258
+ db: I,
259
+ renderer: X,
260
+ parser: R,
261
+ styles: /* @__PURE__ */ t(({ treeView: e }) => {
262
+ let { labelFontSize: t, labelColor: n, lineColor: r, iconColor: i, descriptionColor: a, highlightBg: o, highlightStroke: s } = p(Z, e);
263
+ return `
264
+ .treeView-node-label {
265
+ font-size: ${t};
266
+ fill: ${n};
267
+ white-space: pre;
268
+ }
269
+ .treeView-node-dir {
270
+ font-weight: bold;
271
+ }
272
+ .treeView-node-line {
273
+ stroke: ${r};
274
+ }
275
+ .treeView-node-icon {
276
+ color: ${i};
277
+ }
278
+ .treeView-node-description {
279
+ font-size: ${t};
280
+ fill: ${a};
281
+ font-style: italic;
282
+ white-space: pre;
283
+ }
284
+ .treeView-highlight-bg {
285
+ fill: ${o};
286
+ stroke: ${s};
287
+ stroke-width: 1;
288
+ }
289
+ `;
290
+ }, "styles")
291
+ };
292
+ //#endregion
293
+ export { Q as diagram };