@draftably/editor 0.0.0-stage → 0.1.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.
Files changed (185) hide show
  1. package/README.md +26 -2
  2. package/dist/LICENSE +21 -0
  3. package/dist/assets/engine.worker-DmHew5f6.js +6813 -0
  4. package/dist/assets/import-d2.worker-CnXfFXoa.js +5395 -0
  5. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +87 -0
  6. package/dist/chunks/arc-rJj0TtXf.js +83 -0
  7. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +4781 -0
  8. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +1440 -0
  9. package/dist/chunks/browser-iNhbPsGc.js +40 -0
  10. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +1524 -0
  11. package/dist/chunks/channel-qMvPU6eH.js +5 -0
  12. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +670 -0
  13. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +18 -0
  14. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +262 -0
  15. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +68 -0
  16. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +19 -0
  17. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +8 -0
  18. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +19 -0
  19. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +8 -0
  20. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +451 -0
  21. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +1570 -0
  22. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +2608 -0
  23. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +22361 -0
  24. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +299 -0
  25. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +18791 -0
  26. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +2157 -0
  27. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  28. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +531 -0
  29. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +153 -0
  30. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +346 -0
  31. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +480 -0
  32. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +219 -0
  33. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +2586 -0
  34. package/dist/chunks/dot-importer-B23jwEkx.js +1547 -0
  35. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +109 -0
  36. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +49229 -0
  37. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +1064 -0
  38. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +1771 -0
  39. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +2729 -0
  40. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +815 -0
  41. package/dist/chunks/graph-CKJmgLki.js +1541 -0
  42. package/dist/chunks/import-core-C-I1wGfw.js +145 -0
  43. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +24 -0
  44. package/dist/chunks/init-DjUOC4st.js +16 -0
  45. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +624 -0
  46. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +834 -0
  47. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +724 -0
  48. package/dist/chunks/katex-BsrBVQKd.js +11314 -0
  49. package/dist/chunks/linear-4t7D_ros.js +259 -0
  50. package/dist/chunks/mermaid-facade-BoLWBerE.js +289 -0
  51. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +478 -0
  52. package/dist/chunks/mermaid.core-DXv6D2Sm.js +19244 -0
  53. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +837 -0
  54. package/dist/chunks/mount-C1Xk_GQz.js +22131 -0
  55. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  56. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +95 -0
  57. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +208 -0
  58. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +1029 -0
  59. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +77 -0
  60. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +889 -0
  61. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +859 -0
  62. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +2972 -0
  63. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +46 -0
  64. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +1520 -0
  65. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +4991 -0
  66. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +13 -0
  67. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +1058 -0
  68. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +7945 -0
  69. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +1578 -0
  70. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +678 -0
  71. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +1536 -0
  72. package/dist/element.js +36 -0
  73. package/dist/index.js +4 -0
  74. package/dist/types/src/cli/links.d.ts +4 -0
  75. package/dist/types/src/cli/pdf.d.ts +29 -0
  76. package/dist/types/src/cli/png.d.ts +23 -0
  77. package/dist/types/src/cli/svg.d.ts +4 -0
  78. package/dist/types/src/components/Icon.d.ts +14 -0
  79. package/dist/types/src/components/LayoutPreviewBar.d.ts +2 -0
  80. package/dist/types/src/components/canvas/Canvas.d.ts +15 -0
  81. package/dist/types/src/components/canvas/Frame.d.ts +22 -0
  82. package/dist/types/src/components/canvas/InlineEditor.d.ts +2 -0
  83. package/dist/types/src/components/canvas/Notes.d.ts +5 -0
  84. package/dist/types/src/components/canvas/Overlay.d.ts +2 -0
  85. package/dist/types/src/components/canvas/StateBar.d.ts +5 -0
  86. package/dist/types/src/components/canvas/TextHits.d.ts +6 -0
  87. package/dist/types/src/components/canvas/ZoomControls.d.ts +1 -0
  88. package/dist/types/src/components/canvas/text-boxes.d.ts +24 -0
  89. package/dist/types/src/components/controls.d.ts +88 -0
  90. package/dist/types/src/components/scene/EdgeView.d.ts +22 -0
  91. package/dist/types/src/components/scene/GroupView.d.ts +22 -0
  92. package/dist/types/src/components/scene/Lifelines.d.ts +15 -0
  93. package/dist/types/src/components/scene/LinkMark.d.ts +11 -0
  94. package/dist/types/src/components/scene/NodeView.d.ts +18 -0
  95. package/dist/types/src/components/scene/parts.d.ts +50 -0
  96. package/dist/types/src/components/sculpt/BrushDock.d.ts +2 -0
  97. package/dist/types/src/components/sculpt/TimelineDeck.d.ts +2 -0
  98. package/dist/types/src/components/session-context.d.ts +486 -0
  99. package/dist/types/src/dsl/cells.d.ts +91 -0
  100. package/dist/types/src/dsl/channels.d.ts +53 -0
  101. package/dist/types/src/dsl/compile.d.ts +162 -0
  102. package/dist/types/src/dsl/frame.d.ts +38 -0
  103. package/dist/types/src/dsl/lanes.d.ts +23 -0
  104. package/dist/types/src/dsl/layout-edits.d.ts +58 -0
  105. package/dist/types/src/dsl/legend-notes.d.ts +3 -0
  106. package/dist/types/src/dsl/project.d.ts +39 -0
  107. package/dist/types/src/dsl/source-edits.d.ts +37 -0
  108. package/dist/types/src/dsl/syntax.d.ts +317 -0
  109. package/dist/types/src/dsl/translate.d.ts +69 -0
  110. package/dist/types/src/editor/Editor.d.ts +6 -0
  111. package/dist/types/src/editor/element.d.ts +15 -0
  112. package/dist/types/src/editor/mount.d.ts +23 -0
  113. package/dist/types/src/import/browser.d.ts +3 -0
  114. package/dist/types/src/import/detect.d.ts +31 -0
  115. package/dist/types/src/import/dot-importer.d.ts +3 -0
  116. package/dist/types/src/import/import-core.d.ts +105 -0
  117. package/dist/types/src/import/mermaid-facade.d.ts +120 -0
  118. package/dist/types/src/import/mermaid-importer.d.ts +4 -0
  119. package/dist/types/src/import/mermaid-sequence.d.ts +8 -0
  120. package/dist/types/src/import/scratch.d.ts +3 -0
  121. package/dist/types/src/lib/engine-tasks.d.ts +88 -0
  122. package/dist/types/src/lib/font-data.d.ts +9 -0
  123. package/dist/types/src/lib/saved-diagram.d.ts +4 -0
  124. package/dist/types/src/lib/scene-cache.d.ts +4 -0
  125. package/dist/types/src/lib/source-hash.d.ts +7 -0
  126. package/dist/types/src/lib/svg-export.d.ts +15 -0
  127. package/dist/types/src/model/appearance.d.ts +209 -0
  128. package/dist/types/src/model/bounds.d.ts +19 -0
  129. package/dist/types/src/model/camera.d.ts +21 -0
  130. package/dist/types/src/model/candidates.d.ts +53 -0
  131. package/dist/types/src/model/colors.d.ts +22 -0
  132. package/dist/types/src/model/document.d.ts +24 -0
  133. package/dist/types/src/model/edits.d.ts +133 -0
  134. package/dist/types/src/model/embed.d.ts +17 -0
  135. package/dist/types/src/model/examples.d.ts +15 -0
  136. package/dist/types/src/model/font-faces.d.ts +24 -0
  137. package/dist/types/src/model/fonts.d.ts +47 -0
  138. package/dist/types/src/model/footnote.d.ts +34 -0
  139. package/dist/types/src/model/frame.d.ts +71 -0
  140. package/dist/types/src/model/geometry.d.ts +29 -0
  141. package/dist/types/src/model/graph.d.ts +53 -0
  142. package/dist/types/src/model/heading.d.ts +38 -0
  143. package/dist/types/src/model/icons.d.ts +2 -0
  144. package/dist/types/src/model/label-hits.d.ts +27 -0
  145. package/dist/types/src/model/labels.d.ts +88 -0
  146. package/dist/types/src/model/legend.d.ts +25 -0
  147. package/dist/types/src/model/link.d.ts +63 -0
  148. package/dist/types/src/model/markers.d.ts +47 -0
  149. package/dist/types/src/model/note.d.ts +75 -0
  150. package/dist/types/src/model/panels.d.ts +11 -0
  151. package/dist/types/src/model/rich-text.d.ts +24 -0
  152. package/dist/types/src/model/routes.d.ts +170 -0
  153. package/dist/types/src/model/samples.d.ts +11 -0
  154. package/dist/types/src/model/stack.d.ts +8 -0
  155. package/dist/types/src/model/static-scene.d.ts +15 -0
  156. package/dist/types/src/model/status.d.ts +84 -0
  157. package/dist/types/src/model/styles.d.ts +13 -0
  158. package/dist/types/src/model/surface.d.ts +31 -0
  159. package/dist/types/src/model/types.d.ts +277 -0
  160. package/dist/types/src/runtime/svg-renderer.d.ts +38 -0
  161. package/dist/types/src/server/file-session.d.ts +19 -0
  162. package/dist/types/src/server/workspace.d.ts +21 -0
  163. package/dist/types/src/state/active-session.d.ts +479 -0
  164. package/dist/types/src/state/commands.d.ts +529 -0
  165. package/dist/types/src/state/comparison.d.ts +151 -0
  166. package/dist/types/src/state/files.d.ts +61 -0
  167. package/dist/types/src/state/keyboard.d.ts +6 -0
  168. package/dist/types/src/state/keys.d.ts +5 -0
  169. package/dist/types/src/state/launch.d.ts +61 -0
  170. package/dist/types/src/state/links.d.ts +11 -0
  171. package/dist/types/src/state/session/actions.d.ts +77 -0
  172. package/dist/types/src/state/session/canvas-text.d.ts +24 -0
  173. package/dist/types/src/state/session/document.d.ts +84 -0
  174. package/dist/types/src/state/session/editor.d.ts +81 -0
  175. package/dist/types/src/state/session/emphasis.d.ts +11 -0
  176. package/dist/types/src/state/session/file-session.d.ts +98 -0
  177. package/dist/types/src/state/session/index.d.ts +496 -0
  178. package/dist/types/src/state/session/layout.d.ts +79 -0
  179. package/dist/types/src/state/session/pointer.d.ts +19 -0
  180. package/dist/types/src/state/session/routing.d.ts +20 -0
  181. package/dist/types/src/state/session/scene.d.ts +144 -0
  182. package/dist/types/src/state/session/sculpt.d.ts +70 -0
  183. package/dist/types/src/state/toast.d.ts +14 -0
  184. package/dist/types/src/state/ui.d.ts +39 -0
  185. package/package.json +41 -3
@@ -0,0 +1,346 @@
1
+ import { I as W } from "./chunk-2Q5K7J3B-gqtzQ8ux.js";
2
+ import { p as X } from "./chunk-JWPE2WC7-CnAFS2xF.js";
3
+ import { q as z, b as G, s as Y, t as P, g as q, a as F, _ as g, N as k, l as A, Q as Z, d as j, L as E, A as U, j as Q, aq as J, O as K, ar as ee } from "./mermaid.core-DXv6D2Sm.js";
4
+ import { p as te } from "./cynefin-EF2NZ3EQ-Bt6b88hY.js";
5
+ var L = /[─━│┃└┗├┣]/, D = /[└┗├┣]/, ne = /[─━]/, N = /^[\s│┃]+$/, T = /^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/, V = /^\s*%%/, re = " ";
6
+ function _(n) {
7
+ return n.some((t) => L.test(t));
8
+ }
9
+ g(_, "isBoxDrawingFormat");
10
+ function M(n) {
11
+ for (const t of n) {
12
+ const e = D.exec(t);
13
+ if (e?.index && e.index > 0)
14
+ return e.index;
15
+ }
16
+ return 4;
17
+ }
18
+ g(M, "inferSegmentWidth");
19
+ function S(n, t) {
20
+ return n.replace(/\bline\s+(\d+)\b/gi, (e, r) => {
21
+ const s = parseInt(r, 10), i = t.get(s);
22
+ return i ? `line ${i}` : e;
23
+ });
24
+ }
25
+ g(S, "remapErrorLines");
26
+ function R(n) {
27
+ const t = n.split(`
28
+ `), e = /* @__PURE__ */ new Map();
29
+ let r = -1;
30
+ for (const [p, c] of t.entries())
31
+ if (c.trim() === "treeView-beta") {
32
+ r = p;
33
+ break;
34
+ }
35
+ if (r === -1)
36
+ return { text: n, lineMap: e };
37
+ const s = [];
38
+ for (let p = r + 1; p < t.length; p++) {
39
+ const c = t[p];
40
+ c.trim() === "" || V.test(c) || T.test(c) || N.test(c) || s.push(c.replace(/\t/g, " "));
41
+ }
42
+ if (!_(s))
43
+ return { text: n, lineMap: e };
44
+ const i = M(s), o = [];
45
+ let a = 0;
46
+ for (let p = 0; p <= r; p++)
47
+ o.push(t[p]), a++, e.set(a, p + 1);
48
+ for (let p = r + 1; p < t.length; p++) {
49
+ const c = t[p], d = c.trim(), h = p + 1;
50
+ if (d === "") {
51
+ o.push(c), a++, e.set(a, h);
52
+ continue;
53
+ }
54
+ if (V.test(c)) {
55
+ o.push(c), a++, e.set(a, h);
56
+ continue;
57
+ }
58
+ if (T.test(c)) {
59
+ o.push(c), a++, e.set(a, h);
60
+ continue;
61
+ }
62
+ if (N.test(c))
63
+ continue;
64
+ const l = c.replace(/\t/g, " "), w = D.exec(l);
65
+ if (w?.index !== void 0) {
66
+ const f = w.index, m = Math.round(f / i) + 1;
67
+ let u = f + 1;
68
+ for (; u < l.length && ne.test(l[u]); )
69
+ u++;
70
+ for (; u < l.length && l[u] === " "; )
71
+ u++;
72
+ const v = l.slice(u).trimEnd();
73
+ if (!v)
74
+ throw new Error(
75
+ `Line ${h}: Empty node — expected a filename or directory name after the box-drawing prefix`
76
+ );
77
+ const O = re.repeat(m);
78
+ o.push(O + v), a++, e.set(a, h);
79
+ } else {
80
+ if (/^[\s─━│┃└┗├┣]+$/.test(l))
81
+ continue;
82
+ if (L.test(l))
83
+ o.push(c), a++, e.set(a, h);
84
+ else {
85
+ if (/^\s+/.test(l))
86
+ throw new Error(
87
+ `Line ${h}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`
88
+ );
89
+ o.push(c), a++, e.set(a, h);
90
+ }
91
+ }
92
+ }
93
+ return { text: o.join(`
94
+ `), lineMap: e };
95
+ }
96
+ g(R, "preprocessBoxDrawing");
97
+ var x = new W(() => ({
98
+ cnt: 1,
99
+ stack: [
100
+ {
101
+ id: 0,
102
+ level: -1,
103
+ name: "/",
104
+ nodeType: "directory",
105
+ children: []
106
+ }
107
+ ]
108
+ })), ie = /* @__PURE__ */ g(() => {
109
+ x.reset(), U();
110
+ }, "clear"), oe = /* @__PURE__ */ g(() => x.records.stack[0], "getRoot"), se = /* @__PURE__ */ g(() => x.records.cnt, "getCount"), ae = K.treeView, ce = /* @__PURE__ */ g(() => k(ae, E().treeView), "getConfig"), le = /* @__PURE__ */ g((n, t, e, r, s, i) => {
111
+ for (; n <= x.records.stack[x.records.stack.length - 1].level; )
112
+ x.records.stack.pop();
113
+ const o = {
114
+ id: x.records.cnt++,
115
+ level: n,
116
+ name: t,
117
+ nodeType: e,
118
+ icon: s,
119
+ cssClass: r,
120
+ description: i,
121
+ children: []
122
+ };
123
+ x.records.stack[x.records.stack.length - 1].children.push(o), x.records.stack.push(o);
124
+ }, "addNode"), de = {
125
+ clear: ie,
126
+ addNode: le,
127
+ getRoot: oe,
128
+ getCount: se,
129
+ getConfig: ce,
130
+ getAccTitle: F,
131
+ getAccDescription: q,
132
+ getDiagramTitle: P,
133
+ setAccDescription: Y,
134
+ setAccTitle: G,
135
+ setDiagramTitle: z
136
+ }, I = de, he = /* @__PURE__ */ g((n) => {
137
+ X(n, I);
138
+ for (const t of n.nodes) {
139
+ const e = typeof t.indent == "number" ? t.indent : 0;
140
+ let r = t.name;
141
+ const s = r.endsWith("/");
142
+ s && (r = r.slice(0, -1));
143
+ const i = s ? "directory" : "file", o = t.classAnnotation || void 0, a = t.iconAnnotation, p = a !== void 0 ? a || "none" : void 0, c = t.descAnnotation || void 0, d = c ? Q(c, E()) : void 0;
144
+ I.addNode(e, r, i, o, p, d);
145
+ }
146
+ }, "populate"), pe = {
147
+ parse: /* @__PURE__ */ g(async (n) => {
148
+ const { text: t, lineMap: e } = R(n);
149
+ try {
150
+ const r = await te("treeView", t);
151
+ A.debug(r), he(r);
152
+ } catch (r) {
153
+ throw e.size > 0 && r instanceof Error && (r.message = S(r.message, e)), r;
154
+ }
155
+ }, "parse")
156
+ }, b = {
157
+ prefix: "mermaid-treeview",
158
+ height: 24,
159
+ width: 24,
160
+ icons: {
161
+ folder: {
162
+ 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"/>'
163
+ },
164
+ file: {
165
+ 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"/>'
166
+ }
167
+ }
168
+ };
169
+ function H(n, t) {
170
+ const e = t?.filenameIcons?.[n];
171
+ if (e)
172
+ return e;
173
+ const r = n.lastIndexOf(".");
174
+ if (r > 0) {
175
+ const s = n.substring(r).toLowerCase(), i = t?.extensionIcons;
176
+ return i?.[s] ?? i?.[s.slice(1)];
177
+ }
178
+ }
179
+ g(H, "detectIcon");
180
+ function C(n, t) {
181
+ return n.includes(":") ? n : n in b.icons || !t ? `${b.prefix}:${n}` : `${t}:${n}`;
182
+ }
183
+ g(C, "qualifyIcon");
184
+ function B(n, t) {
185
+ if (n.icon !== "none") {
186
+ if (n.icon)
187
+ return C(n.icon, t.defaultIconPack);
188
+ if (t.showIcons) {
189
+ if (n.nodeType === "file") {
190
+ const e = H(n.name, t);
191
+ if (e === "none")
192
+ return;
193
+ if (e)
194
+ return C(e, t.defaultIconPack);
195
+ }
196
+ return `${b.prefix}:${n.nodeType === "directory" ? "folder" : "file"}`;
197
+ }
198
+ }
199
+ }
200
+ g(B, "getNodeIcon");
201
+ ee([
202
+ {
203
+ name: b.prefix,
204
+ icons: b
205
+ }
206
+ ]);
207
+ var y = 14, ge = 4, fe = 16, ue = /* @__PURE__ */ g(async (n, t) => {
208
+ const e = [], r = /* @__PURE__ */ g((i) => {
209
+ const o = B(i, t);
210
+ o && e.push({ icon: o, node: i }), i.children.forEach(r);
211
+ }, "collect");
212
+ r(n);
213
+ const s = await Promise.all(
214
+ e.map(async ({ icon: i, node: o }) => ({
215
+ id: o.id,
216
+ svg: await J(i, {
217
+ height: y,
218
+ width: y
219
+ })
220
+ }))
221
+ );
222
+ return new Map(s.map(({ id: i, svg: o }) => [i, o]));
223
+ }, "resolveNodeIcons"), we = /* @__PURE__ */ g((n, t, e, r, s, i) => {
224
+ const o = r.append("g");
225
+ let a = "treeView-node-label";
226
+ e.nodeType === "directory" && (a += " treeView-node-dir"), e.cssClass && (a += ` ${e.cssClass}`);
227
+ const p = y + ge, c = B(e, s), d = c !== void 0;
228
+ c && o.append("g").attr("class", "treeView-node-icon").attr("transform", `translate(${n + s.paddingX}, ${t + s.paddingY})`).html(i.get(e.id) ?? "");
229
+ const h = o.append("text").text(e.name).attr("dominant-baseline", "middle").attr("class", a), { height: l, width: w } = h.node().getBBox(), f = l + s.paddingY * 2, m = n + s.paddingX + (d ? p : 0);
230
+ h.attr("x", m), h.attr("y", t + f / 2);
231
+ const u = m + w, v = w + s.paddingX * 2 + (d ? p : 0);
232
+ return e.BBox = { x: n, y: t, width: v, height: f }, e.cssClass?.split(/\s+/).includes("highlight") && o.insert("rect", ":first-child").attr("x", n).attr("y", t + 1).attr("width", 0).attr("height", f - 2).attr("rx", 3).attr("class", "treeView-highlight-bg"), { node: e, nodeGroup: o, labelRightEdge: u, centerY: t + f / 2 };
233
+ }, "positionLabel"), $ = /* @__PURE__ */ g((n, t, e, r, s, i) => n.append("line").attr("x1", t).attr("y1", e).attr("x2", r).attr("y2", s).attr("stroke-width", i).attr("class", "treeView-node-line"), "positionLine"), me = /* @__PURE__ */ g((n, t, e, r) => {
234
+ let s = 0, i = 0;
235
+ const o = [], a = /* @__PURE__ */ g((d, h, l, w) => {
236
+ const f = w * (l.rowIndent + l.paddingX), m = we(f, s, h, d, l, r);
237
+ o.push(m);
238
+ const { height: u, width: v } = h.BBox;
239
+ $(
240
+ d,
241
+ f - l.rowIndent,
242
+ s + u / 2,
243
+ f,
244
+ s + u / 2,
245
+ l.lineThickness
246
+ ), i = Math.max(i, f + v), s += u;
247
+ }, "drawNode"), p = /* @__PURE__ */ g((d, h = 0) => {
248
+ a(n, d, e, h), d.children.forEach((m) => {
249
+ p(m, h + 1);
250
+ });
251
+ const { x: l, y: w, height: f } = d.BBox;
252
+ if (d.children.length) {
253
+ const { y: m, height: u } = d.children[d.children.length - 1].BBox;
254
+ $(
255
+ n,
256
+ l + e.paddingX,
257
+ w + f,
258
+ l + e.paddingX,
259
+ m + u / 2 + e.lineThickness / 2,
260
+ e.lineThickness
261
+ );
262
+ }
263
+ }, "processNode");
264
+ p(t);
265
+ const c = o.filter((d) => d.node.description);
266
+ if (c.length > 0) {
267
+ const h = Math.max(...o.map((l) => l.labelRightEdge)) + fe;
268
+ for (const l of c) {
269
+ const f = l.nodeGroup.append("text").text(l.node.description).attr("dominant-baseline", "middle").attr("class", "treeView-node-description").attr("x", h).attr("y", l.centerY).node().getBBox();
270
+ i = Math.max(i, h + f.width + e.paddingX);
271
+ }
272
+ }
273
+ for (const d of o)
274
+ if (d.node.cssClass?.split(/\s+/).includes("highlight")) {
275
+ const h = d.nodeGroup.select(".treeView-highlight-bg");
276
+ if (!h.empty()) {
277
+ const l = i - d.node.BBox.x + 8;
278
+ h.attr("width", l), i = Math.max(i, d.node.BBox.x + l + 2);
279
+ }
280
+ }
281
+ return { totalHeight: s, totalWidth: i };
282
+ }, "drawTree"), xe = /* @__PURE__ */ g(async (n, t, e, r) => {
283
+ A.debug(`Rendering treeView diagram
284
+ ` + n);
285
+ const s = r.db, i = s.getRoot(), o = s.getConfig(), a = Z(t), p = a.append("g");
286
+ p.attr("class", "tree-view");
287
+ const c = await ue(i, o), { totalHeight: d, totalWidth: h } = me(p, i, o, c);
288
+ a.attr("viewBox", `-${o.lineThickness / 2} 0 ${h} ${d}`), j(a, d, h, o.useMaxWidth);
289
+ }, "draw"), ve = {
290
+ draw: xe
291
+ }, be = ve, Ie = {
292
+ labelFontSize: "16px",
293
+ labelColor: "black",
294
+ lineColor: "black",
295
+ iconColor: "#546e7a",
296
+ descriptionColor: "#6a9955",
297
+ highlightBg: "rgba(255, 193, 7, 0.15)",
298
+ highlightStroke: "#ffc107"
299
+ }, Ce = /* @__PURE__ */ g(({
300
+ treeView: n
301
+ }) => {
302
+ const {
303
+ labelFontSize: t,
304
+ labelColor: e,
305
+ lineColor: r,
306
+ iconColor: s,
307
+ descriptionColor: i,
308
+ highlightBg: o,
309
+ highlightStroke: a
310
+ } = k(Ie, n);
311
+ return `
312
+ .treeView-node-label {
313
+ font-size: ${t};
314
+ fill: ${e};
315
+ white-space: pre;
316
+ }
317
+ .treeView-node-dir {
318
+ font-weight: bold;
319
+ }
320
+ .treeView-node-line {
321
+ stroke: ${r};
322
+ }
323
+ .treeView-node-icon {
324
+ color: ${s};
325
+ }
326
+ .treeView-node-description {
327
+ font-size: ${t};
328
+ fill: ${i};
329
+ font-style: italic;
330
+ white-space: pre;
331
+ }
332
+ .treeView-highlight-bg {
333
+ fill: ${o};
334
+ stroke: ${a};
335
+ stroke-width: 1;
336
+ }
337
+ `;
338
+ }, "styles"), ye = Ce, $e = {
339
+ db: I,
340
+ renderer: be,
341
+ parser: pe,
342
+ styles: ye
343
+ };
344
+ export {
345
+ $e as diagram
346
+ };