@diagrammo/dgmo 0.48.1 → 0.49.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 (216) hide show
  1. package/.cursorrules +8 -3
  2. package/.github/copilot-instructions.md +8 -3
  3. package/.windsurfrules +8 -3
  4. package/SKILL.md +8 -3
  5. package/dist/advanced.d.ts +444 -1
  6. package/dist/advanced.js +208 -146
  7. package/dist/auto.css +74 -5
  8. package/dist/auto.js +213 -107
  9. package/dist/auto.mjs +6906 -831
  10. package/dist/block.css +74 -5
  11. package/dist/block.d.ts +13 -5
  12. package/dist/block.js +148 -62
  13. package/dist/{charts-d3-QOZHKTCT.js → charts-d3-EW3YQTEA.js} +9 -8
  14. package/dist/chunk-26RVGM44.js +331 -0
  15. package/dist/{chunk-44CM72SQ.js → chunk-2WMBWZY2.js} +3 -3
  16. package/dist/{chunk-L66GEFB6.js → chunk-35BBZDFE.js} +4 -4
  17. package/dist/{chunk-4GRI7MEB.js → chunk-3BIAFYD2.js} +6 -6
  18. package/dist/chunk-3NFJWFNP.js +1474 -0
  19. package/dist/{chunk-76OWZ3BA.js → chunk-4BD7EVPK.js} +2 -2
  20. package/dist/{chunk-MITI6NOL.js → chunk-4FIV4K4Z.js} +9 -9
  21. package/dist/chunk-4HVNZ7WF.js +574 -0
  22. package/dist/{chunk-X5LCYCL5.js → chunk-4NQ3IKUM.js} +2 -2
  23. package/dist/{chunk-PWIHZ6NJ.js → chunk-4UDKKGHH.js} +4 -4
  24. package/dist/{chunk-6NYWYNBI.js → chunk-4XK3FLFB.js} +3 -3
  25. package/dist/chunk-4YNP6O47.js +607 -0
  26. package/dist/{chunk-3MQQNXPD.js → chunk-5FGDJIJX.js} +3 -3
  27. package/dist/{chunk-WCT3NYCV.js → chunk-5LWQH6QV.js} +1 -1
  28. package/dist/chunk-5XCM7UUW.js +261 -0
  29. package/dist/{chunk-RYEGFMUO.js → chunk-5ZZLLBFK.js} +2 -2
  30. package/dist/{chunk-EB6FPQUP.js → chunk-65RTDUZH.js} +3 -3
  31. package/dist/chunk-6CLKNXVP.js +664 -0
  32. package/dist/{chunk-H6PI3KJT.js → chunk-6IUAK7RZ.js} +2 -2
  33. package/dist/{chunk-ZGR7ULFJ.js → chunk-6SA7FJE4.js} +31 -19
  34. package/dist/{chunk-LIOHW36Z.js → chunk-6VE3VLWM.js} +3 -3
  35. package/dist/{chunk-AN2MOO5T.js → chunk-7OVSJI2V.js} +3 -3
  36. package/dist/{chunk-YAA6IID3.js → chunk-7UEMZREK.js} +2 -2
  37. package/dist/{chunk-FCIIHT24.js → chunk-7VLUGEMJ.js} +7 -7
  38. package/dist/{chunk-VOKGH627.js → chunk-AHGF2YYA.js} +13 -3
  39. package/dist/{chunk-3R5POCTZ.js → chunk-AJ2PEY7J.js} +6 -6
  40. package/dist/{chunk-PBHE5UG6.js → chunk-ALRHIR6I.js} +46 -12
  41. package/dist/{chunk-7JEGTRLD.js → chunk-B57V3DWN.js} +3 -3
  42. package/dist/{chunk-ILKORZ3H.js → chunk-BCT5G2VN.js} +7 -7
  43. package/dist/{chunk-TYS6CSS5.js → chunk-BCYVE3N5.js} +2 -2
  44. package/dist/{chunk-ZBWMSD5N.js → chunk-BGJV5ATD.js} +4 -4
  45. package/dist/{chunk-G2H74XJZ.js → chunk-BPIJLRYE.js} +8 -8
  46. package/dist/{chunk-YGJTDXVR.js → chunk-C4GQDB5L.js} +2 -2
  47. package/dist/{chunk-Y2ZE3MSG.js → chunk-C63UWAKM.js} +2 -2
  48. package/dist/{chunk-QEBUY5NY.js → chunk-CEHZOPGM.js} +4 -4
  49. package/dist/{chunk-725LDASD.js → chunk-CLD2OKV7.js} +2 -2
  50. package/dist/{chunk-5QXL4NYS.js → chunk-CLR4A2N2.js} +10 -5
  51. package/dist/{chunk-WBRZJOEC.js → chunk-CMCR5WBW.js} +3 -3
  52. package/dist/{chunk-SML67VPV.js → chunk-D5AVQCDN.js} +3 -3
  53. package/dist/{chunk-2LACINWN.js → chunk-DDTJ5N7Q.js} +9 -9
  54. package/dist/{chunk-FITOLXSX.js → chunk-EOFPYPAU.js} +26 -2
  55. package/dist/{chunk-B65G5DNL.js → chunk-EYN7VFKL.js} +3 -3
  56. package/dist/{chunk-4OHACBGX.js → chunk-F2L5GCQ4.js} +2 -2
  57. package/dist/{chunk-RVMRZAPB.js → chunk-F743CM2N.js} +3 -3
  58. package/dist/{chunk-3JLKYGBQ.js → chunk-F7BFXWNQ.js} +2 -2
  59. package/dist/{chunk-WCSOJFU3.js → chunk-FMKTYMP4.js} +3 -3
  60. package/dist/{chunk-RTLBSQ3G.js → chunk-FUCAB3KQ.js} +3 -3
  61. package/dist/{chunk-SGZYXELT.js → chunk-GB3YZTAM.js} +9 -6
  62. package/dist/{chunk-QLCCJEJI.js → chunk-HBVD67XG.js} +2 -2
  63. package/dist/{chunk-PBAHEPLQ.js → chunk-HGN652MU.js} +7 -6
  64. package/dist/{chunk-3SMGIJDD.js → chunk-HHXOONLX.js} +13 -1
  65. package/dist/{chunk-QOOUC2J5.js → chunk-HQCHYB5F.js} +2 -2
  66. package/dist/chunk-IAEC4KLA.js +492 -0
  67. package/dist/{chunk-J5FIXQRT.js → chunk-IBC35BTK.js} +4 -4
  68. package/dist/{chunk-NURGB5Z4.js → chunk-IFK3GIUW.js} +2 -2
  69. package/dist/{chunk-FANX6UJR.js → chunk-IHLSHCPZ.js} +11 -11
  70. package/dist/{chunk-GMR5MFHJ.js → chunk-IUK7AGD4.js} +2 -2
  71. package/dist/chunk-IVKC4GID.js +32 -0
  72. package/dist/{chunk-OJR3MQYV.js → chunk-JFPY3UJ7.js} +296 -57
  73. package/dist/{chunk-5MLYVTYM.js → chunk-K6HNAY5V.js} +2 -2
  74. package/dist/{chunk-P235SVAH.js → chunk-KQAEKMIX.js} +2 -2
  75. package/dist/{chunk-7DTWEFUE.js → chunk-KUBBJ2CD.js} +10 -10
  76. package/dist/{chunk-BUVJFRPY.js → chunk-KV6Y2HE6.js} +4 -4
  77. package/dist/{chunk-OURHMODR.js → chunk-LG4TWW4U.js} +13 -13
  78. package/dist/{chunk-XAKEUMEJ.js → chunk-LVHPTBO3.js} +3 -3
  79. package/dist/{chunk-ERLBPDGU.js → chunk-MJCG5K2O.js} +2 -2
  80. package/dist/{chunk-THXCFRTU.js → chunk-N4J5KGWG.js} +12 -12
  81. package/dist/{chunk-MZSBFAPJ.js → chunk-NVT6C2VE.js} +9 -9
  82. package/dist/{chunk-AELOBFW5.js → chunk-O5MQPK7E.js} +3 -3
  83. package/dist/{chunk-JM4LEPY3.js → chunk-O7NUCTFU.js} +2 -2
  84. package/dist/{chunk-JED6ZDEE.js → chunk-O7WP4ZD4.js} +2 -2
  85. package/dist/{chunk-ZO27FGJS.js → chunk-PH5X4GIP.js} +2 -2
  86. package/dist/{chunk-B7JUCQUA.js → chunk-PU3AUQPA.js} +4 -4
  87. package/dist/{chunk-A4VFQH5G.js → chunk-PZFVK3IH.js} +52 -7
  88. package/dist/chunk-QQJUTGQH.js +135 -0
  89. package/dist/{chunk-HSH73DP6.js → chunk-RI4NIMFP.js} +99 -39
  90. package/dist/{chunk-33LCUH4H.js → chunk-RTERS6S5.js} +3 -3
  91. package/dist/{chunk-T3UBLACL.js → chunk-SCQ5VPUF.js} +19 -5
  92. package/dist/chunk-SGHSY3LU.js +377 -0
  93. package/dist/{chunk-SRTU6HMQ.js → chunk-SJEGO2QL.js} +8 -8
  94. package/dist/chunk-SQDFK5ZQ.js +273 -0
  95. package/dist/{chunk-UC7TFHUM.js → chunk-SVDWQGX2.js} +296 -121
  96. package/dist/{chunk-Z5CGSFJB.js → chunk-T7IKPCMI.js} +4 -4
  97. package/dist/chunk-TC3YWBFO.js +233 -0
  98. package/dist/{chunk-EVCVDTXE.js → chunk-TLKMTQYL.js} +3 -3
  99. package/dist/{chunk-IJZFN3HM.js → chunk-TWQUYVP3.js} +4 -4
  100. package/dist/{chunk-IZMRON6C.js → chunk-UVCXZEGU.js} +2 -2
  101. package/dist/{chunk-CKNVO24D.js → chunk-UWDO3O52.js} +2 -2
  102. package/dist/{chunk-RJE5JTVK.js → chunk-VC3TR4NL.js} +7 -7
  103. package/dist/{chunk-CI2G3OEB.js → chunk-X2CH42BN.js} +9 -9
  104. package/dist/{chunk-6HO5ZTXK.js → chunk-XCC2RENT.js} +2 -2
  105. package/dist/chunk-XHVV4NVW.js +51 -0
  106. package/dist/{chunk-ZJEL4H2R.js → chunk-XJ7J6WOO.js} +9 -9
  107. package/dist/{chunk-ULOEATBZ.js → chunk-XKTN7CZF.js} +106 -29
  108. package/dist/{chunk-IPWPWM6R.js → chunk-YM2BSPYW.js} +111 -10
  109. package/dist/{chunk-BUPDIHML.js → chunk-YRVLP7UU.js} +3 -3
  110. package/dist/{chunk-T2OE3YQB.js → chunk-YTN572Q2.js} +3 -3
  111. package/dist/{chunk-WVAJFAIA.js → chunk-YYX3SU6H.js} +3 -3
  112. package/dist/{chunk-MO5YHHMQ.js → chunk-ZDUQGL3N.js} +2 -2
  113. package/dist/{chunk-Y3J7VR52.js → chunk-ZNQX6QWH.js} +30 -2
  114. package/dist/{chunk-UWN33VNX.js → chunk-ZREZOIGS.js} +8 -8
  115. package/dist/{chunk-6SM5NJQH.js → chunk-ZTLWVRNS.js} +4 -4
  116. package/dist/{chunk-RUNNI6VE.js → chunk-ZXL6MB4R.js} +3 -3
  117. package/dist/cli.cjs +159 -122
  118. package/dist/dgmo-router-ODKPEJ3P.js +79 -0
  119. package/dist/dimensions-WSIJXT5Q.js +22 -0
  120. package/dist/editor.js +4 -1
  121. package/dist/element.js +214 -108
  122. package/dist/element.mjs +6906 -831
  123. package/dist/{flowchart-parser-ZNSKIBVR.js → flowchart-parser-IVZN7CQN.js} +4 -4
  124. package/dist/{flowchart-renderer-SNDSII4D.js → flowchart-renderer-GMI2U3DD.js} +9 -9
  125. package/dist/highlight.js +7 -1
  126. package/dist/index.d.ts +5 -1
  127. package/dist/index.js +193 -232
  128. package/dist/{layout-HRBZPFCN.js → layout-34CLNICW.js} +5 -5
  129. package/dist/{layout-5RA6QWR6.js → layout-4Z5JM7PT.js} +6 -6
  130. package/dist/layout-6RDJHS6E.js +9 -0
  131. package/dist/{layout-7QXCNOVS.js → layout-7H4H46CS.js} +3 -3
  132. package/dist/{layout-46N4JJYK.js → layout-7SKMFYHL.js} +5 -5
  133. package/dist/{layout-HWDSRX5E.js → layout-D42XE4RE.js} +6 -6
  134. package/dist/{layout-EE6GE46Y.js → layout-DC4TVXER.js} +5 -5
  135. package/dist/layout-FGQWRYYW.js +14 -0
  136. package/dist/layout-GZ2CWONU.js +14 -0
  137. package/dist/layout-HQMBPJVS.js +10 -0
  138. package/dist/{layout-UM5F4DJB.js → layout-K2ZN3Q42.js} +5 -5
  139. package/dist/{layout-S2QBYSK2.js → layout-NXG63LWH.js} +3 -3
  140. package/dist/{layout-N76NR4ZO.js → layout-PUQCB6AN.js} +7 -7
  141. package/dist/{layout-HYZPWAK5.js → layout-QNUQLEHU.js} +3 -3
  142. package/dist/layout-S3EK4IYO.js +14 -0
  143. package/dist/{layout-search-OYV77HHS.js → layout-search-QS44PI5R.js} +6 -6
  144. package/dist/{parser-KNSQSKQO.js → parser-4BKIFG2C.js} +5 -5
  145. package/dist/{parser-OV7NOBW6.js → parser-4ROBKVUR.js} +4 -4
  146. package/dist/parser-667RGSUW.js +13 -0
  147. package/dist/{parser-IXSZZQHY.js → parser-BL7Z72EY.js} +4 -4
  148. package/dist/{parser-AQETEVRW.js → parser-CLMFZWCC.js} +4 -4
  149. package/dist/{parser-XKRP7QKP.js → parser-D6ONJQFR.js} +3 -3
  150. package/dist/{parser-2EWECDSA.js → parser-DERPY5KC.js} +4 -4
  151. package/dist/{parser-4OGOBJJ4.js → parser-GFSOPDB7.js} +4 -4
  152. package/dist/{parser-2MFP2H2E.js → parser-HVJFTOXL.js} +3 -3
  153. package/dist/{parser-VQP2UJ6W.js → parser-IKZFTLOJ.js} +3 -3
  154. package/dist/parser-J3P2D6IP.js +13 -0
  155. package/dist/{parser-PQ3POX45.js → parser-JD7OQ2E6.js} +4 -4
  156. package/dist/{parser-O5J4VBII.js → parser-K647FRI4.js} +3 -3
  157. package/dist/{parser-NGU3ETO6.js → parser-KPMN5KKE.js} +4 -4
  158. package/dist/{parser-4FL2CMDG.js → parser-MBJSBTL5.js} +4 -4
  159. package/dist/{parser-TFZFBVWN.js → parser-MCJWF5G3.js} +3 -3
  160. package/dist/{parser-NRAI6O25.js → parser-MRBPXXIV.js} +4 -4
  161. package/dist/{parser-6BTRLKRZ.js → parser-OBQG655V.js} +4 -4
  162. package/dist/{parser-3STE62GB.js → parser-QJYS7KQQ.js} +4 -4
  163. package/dist/{parser-XDVELHRK.js → parser-SMBJO3XN.js} +4 -4
  164. package/dist/{parser-TRTHDFPP.js → parser-TITK4YW6.js} +5 -5
  165. package/dist/{parser-I6KXEYFK.js → parser-TNYX5S7E.js} +4 -4
  166. package/dist/{parser-Y6WTBU76.js → parser-UBGPTIZD.js} +3 -3
  167. package/dist/parser-UGA23PYK.js +14 -0
  168. package/dist/{parser-N5O4IHUN.js → parser-WISPH7LW.js} +4 -4
  169. package/dist/{parser-CFZD5IBL.js → parser-XWUDFJ7P.js} +4 -4
  170. package/dist/parser-ZKF5K2H2.js +15 -0
  171. package/dist/{parser-ZSDPZYQP.js → parser-ZYC3XGNS.js} +4 -4
  172. package/dist/{renderer-AWWAF6XD.js → renderer-4IUPINAE.js} +10 -10
  173. package/dist/renderer-6L3NBEY5.js +24 -0
  174. package/dist/{renderer-ZRNG54CW.js → renderer-6T3KK4S3.js} +11 -11
  175. package/dist/{renderer-KQB7UGDS.js → renderer-7RH2SI3B.js} +3 -3
  176. package/dist/{renderer-6EEZHMH4.js → renderer-A5VFZQQK.js} +9 -9
  177. package/dist/{renderer-5MYBMBYO.js → renderer-BB5PREMY.js} +5 -5
  178. package/dist/{renderer-BYCNMBF7.js → renderer-CGW7QPNA.js} +10 -10
  179. package/dist/{renderer-QIWVHWZO.js → renderer-DAXMXIKD.js} +3 -3
  180. package/dist/{renderer-7MVLWWQD.js → renderer-DKESNMU5.js} +9 -9
  181. package/dist/{renderer-ZTR3DER3.js → renderer-HVCU2C3Z.js} +3 -3
  182. package/dist/{renderer-VACVQYML.js → renderer-LWGJFT3D.js} +8 -8
  183. package/dist/{renderer-PGX2TKVS.js → renderer-MFJ7HY2H.js} +8 -8
  184. package/dist/{renderer-B2OMQIQG.js → renderer-MJDDU27W.js} +15 -15
  185. package/dist/{renderer-4JHRUBE6.js → renderer-QL5KO6SK.js} +10 -10
  186. package/dist/{renderer-W4M6QLIJ.js → renderer-QNHUXCRL.js} +14 -14
  187. package/dist/{renderer-ZGNTUWC4.js → renderer-ROV756WT.js} +8 -8
  188. package/dist/{renderer-YY2OSF6E.js → renderer-SQ3JUAI7.js} +9 -9
  189. package/dist/renderer-THD6V5TL.js +22 -0
  190. package/dist/{renderer-5NDVNDAZ.js → renderer-TPIBXNOS.js} +9 -9
  191. package/dist/{renderer-RPOA5YPZ.js → renderer-TYXRHMRI.js} +13 -13
  192. package/dist/{renderer-N43WR5GV.js → renderer-UZF3JROD.js} +11 -11
  193. package/dist/{renderer-6W5462RB.js → renderer-V3JEMWMM.js} +9 -9
  194. package/dist/{renderer-JGBKUCZD.js → renderer-VFUVRNLK.js} +4 -4
  195. package/dist/{renderer-Z7I3W2PP.js → renderer-VICQ4WNY.js} +8 -8
  196. package/dist/renderer-W5RMOURB.js +21 -0
  197. package/dist/renderer-XEKIRPI6.js +23 -0
  198. package/dist/{renderer-CLJHQPBJ.js → renderer-YHXPN3GF.js} +12 -12
  199. package/dist/renderer-radial-MHO2VDXN.js +21 -0
  200. package/dist/{resolver-NOAA7ID7.js → resolver-FHBCO3PL.js} +3 -3
  201. package/dist/{state-parser-Z2V23ATR.js → state-parser-RX3GXOIB.js} +4 -4
  202. package/dist/{state-renderer-B4DQBM6M.js → state-renderer-AJUKGNWU.js} +9 -9
  203. package/docs/ai-integration.md +8 -3
  204. package/docs/language-reference.md +179 -5
  205. package/gallery/fixtures/family.dgmo +23 -0
  206. package/gallery/fixtures/sketch.dgmo +22 -0
  207. package/package.json +1 -1
  208. package/dist/chunk-ODZVHU3R.js +0 -153
  209. package/dist/dgmo-router-X35VLZLM.js +0 -73
  210. package/dist/dimensions-J3FHIMJ6.js +0 -22
  211. package/dist/layout-5T6RH5M6.js +0 -14
  212. package/dist/layout-G23F7LDH.js +0 -9
  213. package/dist/layout-OB3RI63S.js +0 -14
  214. package/dist/parser-JAL2HD4I.js +0 -13
  215. package/dist/renderer-SMIBCRVB.js +0 -24
  216. package/dist/renderer-radial-C32GPJQ7.js +0 -21
@@ -0,0 +1,261 @@
1
+ import {
2
+ getFigure,
3
+ resolvePartKey
4
+ } from "./chunk-3NFJWFNP.js";
5
+ import {
6
+ renderIntegratedLegend
7
+ } from "./chunk-4UDKKGHH.js";
8
+ import {
9
+ FONT_FAMILY
10
+ } from "./chunk-6KFWC4CO.js";
11
+ import {
12
+ getSeriesColors,
13
+ mix
14
+ } from "./chunk-P6T66CCZ.js";
15
+ import {
16
+ resolveActiveTagGroup,
17
+ resolveTagColor
18
+ } from "./chunk-HBVD67XG.js";
19
+ import {
20
+ resolveColor
21
+ } from "./chunk-TLVIHFRO.js";
22
+
23
+ // src/body/renderer.ts
24
+ import * as d3Selection from "d3-selection";
25
+ var esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
26
+ var TITLE_H = 60;
27
+ var LEGEND_SCALE = 2.4;
28
+ var LEGEND_BAND = 76;
29
+ var TITLE_PAD = TITLE_H + LEGEND_BAND;
30
+ var BOTTOM_PAD = 40;
31
+ var PAGE_MARGIN = 160;
32
+ var OUTER_MARGIN = 30;
33
+ var CENTER_COL = 420;
34
+ var LABEL_FONT = 23;
35
+ var NOTE_FONT = 17;
36
+ function renderFigureBody(fig, parts, partColor, form, palette, defs) {
37
+ const [vx, vy, vw, vh] = fig.viewBox.split(" ").map(Number);
38
+ const muscleFill = mix(palette.bg, palette.border, 0.7);
39
+ const seam = palette.bg;
40
+ const outlineStroke = palette.textMuted;
41
+ let out = "";
42
+ if (form === "skin") {
43
+ const gid = `body-skin-${vx}-${vy}`;
44
+ defs.push(
45
+ `<linearGradient id="${gid}" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${mix(palette.surface, palette.bg, 0.4)}"/><stop offset="1" stop-color="${mix(palette.border, palette.bg, 0.3)}"/></linearGradient>`
46
+ );
47
+ out += `<path d="${fig.outline}" fill="url(#${gid})"/>`;
48
+ for (const d of fig.headPaths) {
49
+ out += `<path d="${d}" fill="url(#${gid})" stroke="${outlineStroke}" stroke-width="2.5"/>`;
50
+ }
51
+ const hairFill = mix(palette.text, palette.bg, 0.6);
52
+ for (const d of fig.hairPaths) {
53
+ out += `<path d="${d}" fill="${hairFill}" stroke="${outlineStroke}" stroke-width="1.5"/>`;
54
+ }
55
+ } else {
56
+ for (const d of fig.base) {
57
+ out += `<path d="${d}" fill="${muscleFill}" stroke="${seam}" stroke-width="1"/>`;
58
+ }
59
+ }
60
+ const anchors = /* @__PURE__ */ new Map();
61
+ for (const part of parts) {
62
+ const key = resolvePartKey(fig, part.name);
63
+ if (!key) continue;
64
+ const geom = fig.parts[key];
65
+ const color = partColor(part);
66
+ const dataLine = ` class="dgmo-body-part" data-line-number="${part.lineNumber}"`;
67
+ if (form === "skin") {
68
+ for (const d of geom.paths) {
69
+ out += `<path${dataLine} d="${d}" fill="${color}" fill-opacity="0.5" stroke="${color}" stroke-width="1.5"/>`;
70
+ }
71
+ } else {
72
+ for (const d of geom.paths) {
73
+ out += `<path${dataLine} d="${d}" fill="${color}" stroke="${seam}" stroke-width="1"/>`;
74
+ }
75
+ }
76
+ anchors.set(part.name.toLowerCase(), {
77
+ x: geom.anchor.x,
78
+ y: geom.anchor.y,
79
+ color,
80
+ part
81
+ });
82
+ }
83
+ out += `<path d="${fig.outline}" fill="none" stroke="${outlineStroke}" stroke-width="2.5"/>`;
84
+ return { fig, body: out, anchors, vx, vy, vw, vh };
85
+ }
86
+ function gutterLabels(r, palette) {
87
+ const { vx, vw, vh } = r;
88
+ const cx = vx + vw / 2;
89
+ const list = [...r.anchors.values()];
90
+ const left = list.filter((a) => a.x < cx).sort((a, b) => a.y - b.y);
91
+ const right = list.filter((a) => a.x >= cx).sort((a, b) => a.y - b.y);
92
+ let labels = "";
93
+ const place = (arr, side) => {
94
+ const gx = side === "L" ? vx - 14 : vx + vw + 14;
95
+ const anchorX = side === "L" ? "end" : "start";
96
+ const minGap = vh * 0.05;
97
+ let prevY = -1e9;
98
+ for (const a of arr) {
99
+ const ly = Math.max(a.y - 6, prevY + minGap);
100
+ prevY = ly;
101
+ const note = a.part.notes.length ? a.part.notes[0] : "";
102
+ labels += `<path d="M${gx} ${ly} L${a.x} ${a.y}" stroke="${a.color}" stroke-width="1.6" fill="none" opacity="0.75"/><circle cx="${a.x}" cy="${a.y}" r="5" fill="${a.color}"/><text x="${gx}" y="${ly - 3}" text-anchor="${anchorX}" font-size="${LABEL_FONT}" font-weight="700" fill="${palette.text}">${esc(a.part.name)}</text>`;
103
+ if (note) {
104
+ labels += `<text x="${gx}" y="${ly + 21}" text-anchor="${anchorX}" font-size="${NOTE_FONT}" fill="${palette.textMuted}">${esc(note)}</text>`;
105
+ }
106
+ }
107
+ };
108
+ place(left, "L");
109
+ place(right, "R");
110
+ return labels;
111
+ }
112
+ function renderBody(container, parsed, palette, _isDark, _onClickItem, exportDims, tagOverride) {
113
+ const accent = getSeriesColors(palette)[0];
114
+ const activeGroup = resolveActiveTagGroup(
115
+ parsed.tagGroups,
116
+ void 0,
117
+ tagOverride
118
+ );
119
+ const partColor = (part) => resolveTagColor(part.metadata, parsed.tagGroups, activeGroup) ?? accent;
120
+ const defs = [];
121
+ const rendered = parsed.options.views.map(
122
+ (view) => renderFigureBody(
123
+ getFigure(parsed.options.sex, view),
124
+ parsed.parts,
125
+ partColor,
126
+ parsed.options.form,
127
+ palette,
128
+ defs
129
+ )
130
+ );
131
+ const figH = Math.max(...rendered.map((r) => r.fig.contentBox.h));
132
+ let body = "";
133
+ let totalW;
134
+ if (rendered.length === 1) {
135
+ const r = rendered[0];
136
+ const gutter = r.vw * 0.42;
137
+ const tx = OUTER_MARGIN + gutter - r.vx;
138
+ const ty = TITLE_PAD - r.vy;
139
+ body = `<g transform="translate(${tx.toFixed(2)} ${ty.toFixed(2)})">${r.body}${gutterLabels(r, palette)}</g>`;
140
+ totalW = OUTER_MARGIN * 2 + gutter * 2 + r.vw;
141
+ } else {
142
+ const fL = rendered[0];
143
+ const fR = rendered[1];
144
+ const cbL = fL.fig.contentBox;
145
+ const cbR = fR.fig.contentBox;
146
+ const sL = figH / cbL.h;
147
+ const sR = figH / cbR.h;
148
+ const leftX = OUTER_MARGIN;
149
+ const rightX = OUTER_MARGIN + cbL.w * sL + CENTER_COL;
150
+ const txL = leftX - cbL.x * sL;
151
+ const txR = rightX - cbR.x * sR;
152
+ const tyL = TITLE_PAD - cbL.y * sL;
153
+ const tyR = TITLE_PAD - cbR.y * sR;
154
+ body += `<g transform="translate(${txL.toFixed(2)} ${tyL.toFixed(2)}) scale(${sL.toFixed(4)})">${fL.body}</g>`;
155
+ body += `<g transform="translate(${txR.toFixed(2)} ${tyR.toFixed(2)}) scale(${sR.toFixed(4)})">${fR.body}</g>`;
156
+ totalW = OUTER_MARGIN * 2 + cbL.w * sL + CENTER_COL + cbR.w * sR;
157
+ const centerX = OUTER_MARGIN + cbL.w * sL + CENTER_COL / 2;
158
+ const mapL = (a) => ({
159
+ x: txL + a.x * sL,
160
+ y: tyL + a.y * sL
161
+ });
162
+ const mapR = (a) => ({
163
+ x: txR + a.x * sR,
164
+ y: tyR + a.y * sR
165
+ });
166
+ const seen = /* @__PURE__ */ new Set();
167
+ const items = [];
168
+ for (const part of parsed.parts) {
169
+ const nm = part.name.toLowerCase();
170
+ if (seen.has(nm)) continue;
171
+ const aL = fL.anchors.get(nm);
172
+ const aR = fR.anchors.get(nm);
173
+ if (!aL && !aR) continue;
174
+ seen.add(nm);
175
+ const left = aL ? mapL(aL) : void 0;
176
+ const right = aR ? mapR(aR) : void 0;
177
+ const ys = [left?.y, right?.y].filter((v) => v != null);
178
+ items.push({
179
+ name: part.name,
180
+ note: part.notes.length ? part.notes[0] : "",
181
+ color: (aL ?? aR).color,
182
+ ...left && { left },
183
+ ...right && { right },
184
+ y: ys.reduce((s, v) => s + v, 0) / ys.length
185
+ });
186
+ }
187
+ items.sort((a, b) => a.y - b.y);
188
+ const minGap = figH * 0.052;
189
+ let prevY = -1e9;
190
+ for (const it of items) {
191
+ it.y = Math.max(it.y, prevY + minGap);
192
+ prevY = it.y;
193
+ }
194
+ let labels = "";
195
+ const stub = 96;
196
+ for (const it of items) {
197
+ if (it.left) {
198
+ labels += `<path d="M${(centerX - stub).toFixed(1)} ${it.y.toFixed(1)} L${it.left.x.toFixed(1)} ${it.left.y.toFixed(1)}" stroke="${it.color}" stroke-width="1.6" fill="none" opacity="0.75"/><circle cx="${it.left.x.toFixed(1)}" cy="${it.left.y.toFixed(1)}" r="5" fill="${it.color}"/>`;
199
+ }
200
+ if (it.right) {
201
+ labels += `<path d="M${(centerX + stub).toFixed(1)} ${it.y.toFixed(1)} L${it.right.x.toFixed(1)} ${it.right.y.toFixed(1)}" stroke="${it.color}" stroke-width="1.6" fill="none" opacity="0.75"/><circle cx="${it.right.x.toFixed(1)}" cy="${it.right.y.toFixed(1)}" r="5" fill="${it.color}"/>`;
202
+ }
203
+ labels += `<text x="${centerX}" y="${(it.y - 3).toFixed(1)}" text-anchor="middle" font-size="${LABEL_FONT}" font-weight="700" fill="${palette.text}">${esc(it.name)}</text>`;
204
+ if (it.note) {
205
+ labels += `<text x="${centerX}" y="${(it.y + 20).toFixed(1)}" text-anchor="middle" font-size="${NOTE_FONT}" fill="${palette.textMuted}">${esc(it.note)}</text>`;
206
+ }
207
+ }
208
+ body += labels;
209
+ }
210
+ const totalH = TITLE_PAD + figH + BOTTOM_PAD;
211
+ const exportMode = !!exportDims;
212
+ d3Selection.select(container).selectAll("svg").remove();
213
+ const width = exportDims?.width ?? container.clientWidth ?? 1200;
214
+ const height = exportDims?.height ?? container.clientHeight ?? 800;
215
+ const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).attr(
216
+ "viewBox",
217
+ `${-PAGE_MARGIN} ${-PAGE_MARGIN} ${(totalW + 2 * PAGE_MARGIN).toFixed(0)} ${(totalH + 2 * PAGE_MARGIN).toFixed(0)}`
218
+ ).attr("preserveAspectRatio", "xMidYMin meet").attr("xmlns", "http://www.w3.org/2000/svg").style("font-family", FONT_FAMILY);
219
+ if (defs.length) svg.append("defs").html(defs.join(""));
220
+ svg.append("g").html(body);
221
+ if (parsed.title) {
222
+ svg.append("text").attr("x", totalW / 2).attr("y", 40).attr("text-anchor", "middle").attr("font-size", 34).attr("font-weight", 700).attr("fill", palette.text).text(parsed.title);
223
+ }
224
+ if (!parsed.options.noLegend && parsed.tagGroups.length) {
225
+ const legendG = svg.append("g").attr("transform", `translate(0, ${TITLE_H}) scale(${LEGEND_SCALE})`);
226
+ const groups = parsed.tagGroups.map((g) => ({
227
+ name: g.name,
228
+ entries: g.entries.map((e) => ({
229
+ value: e.value,
230
+ color: resolveColor(e.color, palette) ?? e.color
231
+ }))
232
+ }));
233
+ renderIntegratedLegend(legendG, {
234
+ groups,
235
+ palette,
236
+ isDark: _isDark,
237
+ // Legend lays out in its own (pre-scale) coordinate space; passing the
238
+ // de-scaled width keeps it centered after the scale transform.
239
+ width: totalW / LEGEND_SCALE,
240
+ mode: exportMode ? "export" : "preview",
241
+ activeGroup
242
+ });
243
+ }
244
+ }
245
+ function renderBodyForExport(container, parsed, palette, isDark, exportDims, tagOverride) {
246
+ renderBody(
247
+ container,
248
+ parsed,
249
+ palette,
250
+ isDark,
251
+ void 0,
252
+ exportDims,
253
+ tagOverride
254
+ );
255
+ }
256
+
257
+ export {
258
+ renderBody,
259
+ renderBodyForExport
260
+ };
261
+ //# sourceMappingURL=chunk-5XCM7UUW.js.map
@@ -10,7 +10,7 @@ import {
10
10
  splitNameAndMeta,
11
11
  tryParseSharedOption,
12
12
  warnUnknownMetaKeys
13
- } from "./chunk-Y3J7VR52.js";
13
+ } from "./chunk-ZNQX6QWH.js";
14
14
  import {
15
15
  resolveColorWithDiagnostic
16
16
  } from "./chunk-TLVIHFRO.js";
@@ -952,4 +952,4 @@ export {
952
952
  parseRaci,
953
953
  allTasks
954
954
  };
955
- //# sourceMappingURL=chunk-RYEGFMUO.js.map
955
+ //# sourceMappingURL=chunk-5ZZLLBFK.js.map
@@ -10,7 +10,7 @@ import {
10
10
  tagAttrKey,
11
11
  validateTagGroupNames,
12
12
  validateTagValues
13
- } from "./chunk-QLCCJEJI.js";
13
+ } from "./chunk-HBVD67XG.js";
14
14
  import {
15
15
  MINDMAP_REGISTRY,
16
16
  OPTION_NOCOLON_RE,
@@ -21,7 +21,7 @@ import {
21
21
  tryParseSharedOption,
22
22
  warnUnknownMetaKeys,
23
23
  withTagAliases
24
- } from "./chunk-Y3J7VR52.js";
24
+ } from "./chunk-ZNQX6QWH.js";
25
25
  import {
26
26
  formatDgmoError,
27
27
  makeDgmoError,
@@ -313,4 +313,4 @@ function findMetadataParent(indent, indentStack) {
313
313
  export {
314
314
  parseMindmap
315
315
  };
316
- //# sourceMappingURL=chunk-EB6FPQUP.js.map
316
+ //# sourceMappingURL=chunk-65RTDUZH.js.map