schematex 0.2.2 → 0.2.4

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 (163) hide show
  1. package/dist/ai/ai-sdk.cjs +85 -0
  2. package/dist/ai/ai-sdk.cjs.map +1 -0
  3. package/dist/ai/ai-sdk.d.cts +30 -0
  4. package/dist/ai/ai-sdk.d.ts +30 -0
  5. package/dist/ai/ai-sdk.js +83 -0
  6. package/dist/ai/ai-sdk.js.map +1 -0
  7. package/dist/ai/index.cjs +60 -0
  8. package/dist/ai/index.cjs.map +1 -0
  9. package/dist/ai/index.d.cts +155 -0
  10. package/dist/ai/index.d.ts +155 -0
  11. package/dist/ai/index.js +23 -0
  12. package/dist/ai/index.js.map +1 -0
  13. package/dist/browser.cjs +16 -15
  14. package/dist/browser.cjs.map +1 -1
  15. package/dist/browser.js +14 -13
  16. package/dist/browser.js.map +1 -1
  17. package/dist/{chunk-ZO77FHBF.cjs → chunk-2JDVJRR3.cjs} +14 -6
  18. package/dist/chunk-2JDVJRR3.cjs.map +1 -0
  19. package/dist/{chunk-QR7VTCI4.cjs → chunk-3YZ6FPQW.cjs} +13 -7
  20. package/dist/chunk-3YZ6FPQW.cjs.map +1 -0
  21. package/dist/{chunk-GEPBET4L.js → chunk-45KP67RR.js} +14 -6
  22. package/dist/chunk-45KP67RR.js.map +1 -0
  23. package/dist/{chunk-LKOBOVNL.cjs → chunk-5AEN2PLB.cjs} +14 -6
  24. package/dist/chunk-5AEN2PLB.cjs.map +1 -0
  25. package/dist/{chunk-7IRT3LOY.cjs → chunk-A5D2IMOX.cjs} +16 -8
  26. package/dist/chunk-A5D2IMOX.cjs.map +1 -0
  27. package/dist/{chunk-XVCAOGFL.cjs → chunk-B37IKTI7.cjs} +221 -44
  28. package/dist/chunk-B37IKTI7.cjs.map +1 -0
  29. package/dist/{chunk-ISACNVFE.cjs → chunk-B6INLQBU.cjs} +15 -9
  30. package/dist/chunk-B6INLQBU.cjs.map +1 -0
  31. package/dist/{chunk-YXIIWLLB.cjs → chunk-COLTVQWR.cjs} +174 -6
  32. package/dist/chunk-COLTVQWR.cjs.map +1 -0
  33. package/dist/chunk-DNZFOCV7.js +796 -0
  34. package/dist/chunk-DNZFOCV7.js.map +1 -0
  35. package/dist/chunk-DPQYGWCT.cjs +1121 -0
  36. package/dist/chunk-DPQYGWCT.cjs.map +1 -0
  37. package/dist/{chunk-XHZ7GXP2.cjs → chunk-E65ITQXV.cjs} +178 -22
  38. package/dist/chunk-E65ITQXV.cjs.map +1 -0
  39. package/dist/{chunk-LCR3KOJV.js → chunk-FCGHV6ZK.js} +16 -8
  40. package/dist/chunk-FCGHV6ZK.js.map +1 -0
  41. package/dist/{chunk-X2BQKXMA.js → chunk-FE6GAUNW.js} +13 -7
  42. package/dist/chunk-FE6GAUNW.js.map +1 -0
  43. package/dist/{chunk-YN467EEQ.js → chunk-H2OEUBPO.js} +547 -101
  44. package/dist/chunk-H2OEUBPO.js.map +1 -0
  45. package/dist/{chunk-Z3WOHHG3.js → chunk-J2LVOWVY.js} +177 -24
  46. package/dist/chunk-J2LVOWVY.js.map +1 -0
  47. package/dist/{chunk-CJ2A3UEQ.js → chunk-LR4X4ZRG.js} +179 -23
  48. package/dist/chunk-LR4X4ZRG.js.map +1 -0
  49. package/dist/{chunk-LXNFVHDT.cjs → chunk-MCFQAUQV.cjs} +21 -13
  50. package/dist/chunk-MCFQAUQV.cjs.map +1 -0
  51. package/dist/{chunk-Z63XPA2V.cjs → chunk-MJGDP3CS.cjs} +546 -100
  52. package/dist/chunk-MJGDP3CS.cjs.map +1 -0
  53. package/dist/chunk-MR5HU5WU.js +1112 -0
  54. package/dist/chunk-MR5HU5WU.js.map +1 -0
  55. package/dist/{chunk-7HKXU7J2.cjs → chunk-MSYBSOU2.cjs} +65 -38
  56. package/dist/chunk-MSYBSOU2.cjs.map +1 -0
  57. package/dist/{chunk-4KYW63IK.js → chunk-OC22GGQN.js} +222 -45
  58. package/dist/chunk-OC22GGQN.js.map +1 -0
  59. package/dist/{chunk-5UV5VQ7J.js → chunk-RP5UATRA.js} +174 -6
  60. package/dist/chunk-RP5UATRA.js.map +1 -0
  61. package/dist/{chunk-ZNZIL244.js → chunk-U6L3FAML.js} +15 -9
  62. package/dist/chunk-U6L3FAML.js.map +1 -0
  63. package/dist/{chunk-CXHPP5BL.cjs → chunk-UAGSCTYI.cjs} +177 -24
  64. package/dist/chunk-UAGSCTYI.cjs.map +1 -0
  65. package/dist/{chunk-5SH5NUDW.js → chunk-UGCUNADI.js} +21 -13
  66. package/dist/chunk-UGCUNADI.js.map +1 -0
  67. package/dist/chunk-ULYRO2KY.cjs +800 -0
  68. package/dist/chunk-ULYRO2KY.cjs.map +1 -0
  69. package/dist/{chunk-UUPYTUGR.js → chunk-VPKCW4PB.js} +54 -27
  70. package/dist/chunk-VPKCW4PB.js.map +1 -0
  71. package/dist/{chunk-6YMQSTFF.js → chunk-ZNDIGQJD.js} +14 -6
  72. package/dist/chunk-ZNDIGQJD.js.map +1 -0
  73. package/dist/diagrams/blockdiagram/index.cjs +5 -5
  74. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  75. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  76. package/dist/diagrams/blockdiagram/index.js +1 -1
  77. package/dist/diagrams/circuit/index.d.cts +1 -1
  78. package/dist/diagrams/circuit/index.d.ts +1 -1
  79. package/dist/diagrams/ecomap/index.cjs +7 -6
  80. package/dist/diagrams/ecomap/index.d.cts +2 -2
  81. package/dist/diagrams/ecomap/index.d.ts +2 -2
  82. package/dist/diagrams/ecomap/index.js +2 -1
  83. package/dist/diagrams/entity/index.d.cts +1 -1
  84. package/dist/diagrams/entity/index.d.ts +1 -1
  85. package/dist/diagrams/fishbone/index.cjs +7 -7
  86. package/dist/diagrams/fishbone/index.d.cts +1 -1
  87. package/dist/diagrams/fishbone/index.d.ts +1 -1
  88. package/dist/diagrams/fishbone/index.js +1 -1
  89. package/dist/diagrams/flowchart/index.cjs +7 -7
  90. package/dist/diagrams/flowchart/index.d.cts +2 -2
  91. package/dist/diagrams/flowchart/index.d.ts +2 -2
  92. package/dist/diagrams/flowchart/index.js +1 -1
  93. package/dist/diagrams/genogram/index.cjs +9 -8
  94. package/dist/diagrams/genogram/index.d.cts +1 -1
  95. package/dist/diagrams/genogram/index.d.ts +1 -1
  96. package/dist/diagrams/genogram/index.js +2 -1
  97. package/dist/diagrams/ladder/index.cjs +5 -5
  98. package/dist/diagrams/ladder/index.d.cts +1 -1
  99. package/dist/diagrams/ladder/index.d.ts +1 -1
  100. package/dist/diagrams/ladder/index.js +1 -1
  101. package/dist/diagrams/logic/index.d.cts +1 -1
  102. package/dist/diagrams/logic/index.d.ts +1 -1
  103. package/dist/diagrams/orgchart/index.cjs +6 -6
  104. package/dist/diagrams/orgchart/index.d.cts +5 -2
  105. package/dist/diagrams/orgchart/index.d.ts +5 -2
  106. package/dist/diagrams/orgchart/index.js +1 -1
  107. package/dist/diagrams/pedigree/index.cjs +7 -6
  108. package/dist/diagrams/pedigree/index.d.cts +1 -1
  109. package/dist/diagrams/pedigree/index.d.ts +1 -1
  110. package/dist/diagrams/pedigree/index.js +2 -1
  111. package/dist/diagrams/phylo/index.d.cts +1 -1
  112. package/dist/diagrams/phylo/index.d.ts +1 -1
  113. package/dist/diagrams/sld/index.cjs +5 -5
  114. package/dist/diagrams/sld/index.d.cts +1 -1
  115. package/dist/diagrams/sld/index.d.ts +1 -1
  116. package/dist/diagrams/sld/index.js +1 -1
  117. package/dist/diagrams/sociogram/index.cjs +6 -5
  118. package/dist/diagrams/sociogram/index.d.cts +2 -1
  119. package/dist/diagrams/sociogram/index.d.ts +2 -1
  120. package/dist/diagrams/sociogram/index.js +2 -1
  121. package/dist/diagrams/timing/index.cjs +4 -4
  122. package/dist/diagrams/timing/index.d.cts +1 -1
  123. package/dist/diagrams/timing/index.d.ts +1 -1
  124. package/dist/diagrams/timing/index.js +1 -1
  125. package/dist/diagrams/venn/index.d.cts +1 -1
  126. package/dist/diagrams/venn/index.d.ts +1 -1
  127. package/dist/{index-ga04CTBI.d.ts → index-BTZEka65.d.cts} +11 -2
  128. package/dist/{index-SSGpCggE.d.cts → index-DcU88F9i.d.ts} +11 -2
  129. package/dist/index.cjs +28 -27
  130. package/dist/index.d.cts +2 -2
  131. package/dist/index.d.ts +2 -2
  132. package/dist/index.js +13 -12
  133. package/dist/react.cjs +14 -13
  134. package/dist/react.cjs.map +1 -1
  135. package/dist/react.js +13 -12
  136. package/dist/react.js.map +1 -1
  137. package/dist/{types-BcPhMdHd.d.ts → types-C4LnMEcB.d.cts} +58 -4
  138. package/dist/{types-BcPhMdHd.d.cts → types-C4LnMEcB.d.ts} +58 -4
  139. package/package.json +27 -5
  140. package/dist/chunk-4KYW63IK.js.map +0 -1
  141. package/dist/chunk-5SH5NUDW.js.map +0 -1
  142. package/dist/chunk-5UV5VQ7J.js.map +0 -1
  143. package/dist/chunk-6YMQSTFF.js.map +0 -1
  144. package/dist/chunk-7HKXU7J2.cjs.map +0 -1
  145. package/dist/chunk-7IRT3LOY.cjs.map +0 -1
  146. package/dist/chunk-CJ2A3UEQ.js.map +0 -1
  147. package/dist/chunk-CXHPP5BL.cjs.map +0 -1
  148. package/dist/chunk-GEPBET4L.js.map +0 -1
  149. package/dist/chunk-ISACNVFE.cjs.map +0 -1
  150. package/dist/chunk-LCR3KOJV.js.map +0 -1
  151. package/dist/chunk-LKOBOVNL.cjs.map +0 -1
  152. package/dist/chunk-LXNFVHDT.cjs.map +0 -1
  153. package/dist/chunk-QR7VTCI4.cjs.map +0 -1
  154. package/dist/chunk-UUPYTUGR.js.map +0 -1
  155. package/dist/chunk-X2BQKXMA.js.map +0 -1
  156. package/dist/chunk-XHZ7GXP2.cjs.map +0 -1
  157. package/dist/chunk-XVCAOGFL.cjs.map +0 -1
  158. package/dist/chunk-YN467EEQ.js.map +0 -1
  159. package/dist/chunk-YXIIWLLB.cjs.map +0 -1
  160. package/dist/chunk-Z3WOHHG3.js.map +0 -1
  161. package/dist/chunk-Z63XPA2V.cjs.map +0 -1
  162. package/dist/chunk-ZNZIL244.js.map +0 -1
  163. package/dist/chunk-ZO77FHBF.cjs.map +0 -1
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var chunkULYRO2KY_cjs = require('./chunk-ULYRO2KY.cjs');
3
4
  var chunkD7EHZFK4_cjs = require('./chunk-D7EHZFK4.cjs');
4
5
  var chunkHDKDQAEQ_cjs = require('./chunk-HDKDQAEQ.cjs');
5
6
 
@@ -110,6 +111,7 @@ function parseGenogram(text2) {
110
111
  const individualsMap = /* @__PURE__ */ new Map();
111
112
  const relationships = [];
112
113
  const childSpecialProps = /* @__PURE__ */ new Map();
114
+ const legendOverrides = {};
113
115
  skipBlankAndComments(state);
114
116
  while (state.currentLine < state.lines.length) {
115
117
  skipBlankAndComments(state);
@@ -120,6 +122,10 @@ function parseGenogram(text2) {
120
122
  state.currentLine++;
121
123
  continue;
122
124
  }
125
+ if (chunkULYRO2KY_cjs.parseLegendDirective(trimmed, legendOverrides)) {
126
+ state.currentLine++;
127
+ continue;
128
+ }
123
129
  const emotionalMatch = detectEmotionalOp(trimmed);
124
130
  if (emotionalMatch) {
125
131
  const { leftId, emotionalType, rightId: emRightId, directional, label: emLabel } = emotionalMatch;
@@ -245,11 +251,13 @@ function parseGenogram(text2) {
245
251
  });
246
252
  }
247
253
  }
254
+ const hasLegendOverrides = Object.keys(legendOverrides).length > 0 && Object.values(legendOverrides).some((v) => v !== void 0);
248
255
  return {
249
256
  type: "genogram",
250
257
  individuals: Array.from(individualsMap.values()),
251
258
  relationships,
252
- metadata: Object.keys(metadata).length > 0 ? metadata : void 0
259
+ metadata: Object.keys(metadata).length > 0 ? metadata : void 0,
260
+ legendOverrides: hasLegendOverrides ? legendOverrides : void 0
253
261
  };
254
262
  }
255
263
  function currentLineText(state) {
@@ -915,7 +923,9 @@ function computeEdges(graph, positions, config) {
915
923
  path: dropPath
916
924
  });
917
925
  if (childPositions.length > 1) {
918
- const sibPath = `M ${leftX} ${dropY} L ${rightX} ${dropY}`;
926
+ const sibLeft = Math.min(leftX, midX);
927
+ const sibRight = Math.max(rightX, midX);
928
+ const sibPath = `M ${sibLeft} ${dropY} L ${sibRight} ${dropY}`;
919
929
  edges.push({
920
930
  from: fu.partners[0],
921
931
  to: fu.partners[1],
@@ -1150,96 +1160,30 @@ function getRequiredDefs(individuals, includeArrowMarker = false) {
1150
1160
  }
1151
1161
  }
1152
1162
  const children = [];
1153
- if (neededFills.has("half-left")) {
1154
- children.push(
1155
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-half-left-rect" }, [
1156
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "0", width: "50%", height: "100%" })
1157
- ]),
1158
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-half-left-circle" }, [
1159
- chunkHDKDQAEQ_cjs.rect({ x: "-50", y: "-50", width: "50", height: "100" })
1160
- ])
1161
- );
1162
- }
1163
- if (neededFills.has("half-right")) {
1164
- children.push(
1165
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-half-right-rect" }, [
1166
- chunkHDKDQAEQ_cjs.rect({ x: "50%", y: "0", width: "50%", height: "100%" })
1167
- ]),
1168
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-half-right-circle" }, [
1169
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "-50", width: "50", height: "100" })
1170
- ])
1171
- );
1172
- }
1173
- if (neededFills.has("half-bottom")) {
1174
- children.push(
1175
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-half-bottom-rect" }, [
1176
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "50%", width: "100%", height: "50%" })
1177
- ]),
1178
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-half-bottom-circle" }, [
1179
- chunkHDKDQAEQ_cjs.rect({ x: "-50", y: "0", width: "100", height: "50" })
1180
- ])
1181
- );
1182
- }
1183
- if (neededFills.has("quarter")) {
1184
- children.push(
1185
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quarter-rect" }, [
1186
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "0", width: "50%", height: "50%" })
1187
- ]),
1188
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quarter-circle" }, [
1189
- chunkHDKDQAEQ_cjs.rect({ x: "-50", y: "-50", width: "50", height: "50" })
1190
- ])
1191
- );
1192
- }
1193
- if (neededFills.has("half-top")) {
1194
- children.push(
1195
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-half-top-rect" }, [
1196
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "0", width: "100%", height: "50%" })
1197
- ]),
1198
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-half-top-circle" }, [
1199
- chunkHDKDQAEQ_cjs.rect({ x: "-50", y: "-50", width: "100", height: "50" })
1200
- ])
1201
- );
1202
- }
1203
- if (neededFills.has("quad-tl")) {
1204
- children.push(
1205
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quad-tl-rect" }, [
1206
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "0", width: "50%", height: "50%" })
1207
- ]),
1208
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quad-tl-circle" }, [
1209
- chunkHDKDQAEQ_cjs.rect({ x: "-50", y: "-50", width: "50", height: "50" })
1210
- ])
1211
- );
1212
- }
1213
- if (neededFills.has("quad-tr")) {
1214
- children.push(
1215
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quad-tr-rect" }, [
1216
- chunkHDKDQAEQ_cjs.rect({ x: "50%", y: "0", width: "50%", height: "50%" })
1217
- ]),
1218
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quad-tr-circle" }, [
1219
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "-50", width: "50", height: "50" })
1220
- ])
1221
- );
1222
- }
1223
- if (neededFills.has("quad-bl")) {
1224
- children.push(
1225
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quad-bl-rect" }, [
1226
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "50%", width: "50%", height: "50%" })
1227
- ]),
1228
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quad-bl-circle" }, [
1229
- chunkHDKDQAEQ_cjs.rect({ x: "-50", y: "0", width: "50", height: "50" })
1230
- ])
1231
- );
1232
- }
1233
- if (neededFills.has("quad-br")) {
1163
+ function quadClips(suffix, x, y, w, h) {
1164
+ const r = chunkHDKDQAEQ_cjs.rect({ x, y, width: w, height: h });
1234
1165
  children.push(
1235
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quad-br-rect" }, [
1236
- chunkHDKDQAEQ_cjs.rect({ x: "50%", y: "50%", width: "50%", height: "50%" })
1237
- ]),
1238
- chunkHDKDQAEQ_cjs.el("clipPath", { id: "schematex-genogram-clip-quad-br-circle" }, [
1239
- chunkHDKDQAEQ_cjs.rect({ x: "0", y: "0", width: "50", height: "50" })
1240
- ])
1166
+ chunkHDKDQAEQ_cjs.el(
1167
+ "clipPath",
1168
+ { id: `schematex-genogram-clip-${suffix}-rect`, clipPathUnits: "objectBoundingBox" },
1169
+ [r]
1170
+ ),
1171
+ chunkHDKDQAEQ_cjs.el(
1172
+ "clipPath",
1173
+ { id: `schematex-genogram-clip-${suffix}-circle`, clipPathUnits: "objectBoundingBox" },
1174
+ [r]
1175
+ )
1241
1176
  );
1242
1177
  }
1178
+ if (neededFills.has("half-left")) quadClips("half-left", 0, 0, 0.5, 1);
1179
+ if (neededFills.has("half-right")) quadClips("half-right", 0.5, 0, 0.5, 1);
1180
+ if (neededFills.has("half-top")) quadClips("half-top", 0, 0, 1, 0.5);
1181
+ if (neededFills.has("half-bottom")) quadClips("half-bottom", 0, 0.5, 1, 0.5);
1182
+ if (neededFills.has("quarter")) quadClips("quarter", 0, 0, 0.5, 0.5);
1183
+ if (neededFills.has("quad-tl")) quadClips("quad-tl", 0, 0, 0.5, 0.5);
1184
+ if (neededFills.has("quad-tr")) quadClips("quad-tr", 0.5, 0, 0.5, 0.5);
1185
+ if (neededFills.has("quad-bl")) quadClips("quad-bl", 0, 0.5, 0.5, 0.5);
1186
+ if (neededFills.has("quad-br")) quadClips("quad-br", 0.5, 0.5, 0.5, 0.5);
1243
1187
  if (neededFills.has("striped")) {
1244
1188
  children.push(
1245
1189
  chunkHDKDQAEQ_cjs.pattern(
@@ -1420,6 +1364,469 @@ function conditionFillElement(sex, half, cond) {
1420
1364
  }
1421
1365
  }
1422
1366
 
1367
+ // src/diagrams/genogram/legend.ts
1368
+ var EMOTIONAL_TYPES2 = /* @__PURE__ */ new Set([
1369
+ "harmony",
1370
+ "close",
1371
+ "bestfriends",
1372
+ "love",
1373
+ "inlove",
1374
+ "friendship",
1375
+ "hostile",
1376
+ "conflict",
1377
+ "enmity",
1378
+ "distant-hostile",
1379
+ "cutoff",
1380
+ "close-hostile",
1381
+ "fused",
1382
+ "fused-hostile",
1383
+ "distant",
1384
+ "normal",
1385
+ "nevermet",
1386
+ "abuse",
1387
+ "physical-abuse",
1388
+ "emotional-abuse",
1389
+ "sexual-abuse",
1390
+ "neglect",
1391
+ "manipulative",
1392
+ "controlling",
1393
+ "jealous",
1394
+ "focused",
1395
+ "focused-neg",
1396
+ "distrust",
1397
+ "admirer",
1398
+ "limerence"
1399
+ ]);
1400
+ var STRUCTURAL_TYPES = /* @__PURE__ */ new Set([
1401
+ "married",
1402
+ "divorced",
1403
+ "separated",
1404
+ "engaged",
1405
+ "cohabiting",
1406
+ "domestic-partnership",
1407
+ "consanguineous",
1408
+ "parent-child",
1409
+ "adopted",
1410
+ "foster",
1411
+ "twin-identical",
1412
+ "twin-fraternal"
1413
+ ]);
1414
+ var HERITAGE_PALETTE = [
1415
+ "#2563eb",
1416
+ "#059669",
1417
+ "#d97706",
1418
+ "#dc2626",
1419
+ "#7c3aed",
1420
+ "#0891b2",
1421
+ "#ca8a04",
1422
+ "#db2777"
1423
+ ];
1424
+ var SECTIONS = [
1425
+ { id: "symbols", title: "Symbols" },
1426
+ { id: "structural", title: "Structural" },
1427
+ { id: "relationships", title: "Relationships" },
1428
+ { id: "conditions", title: "Conditions" },
1429
+ { id: "heritage", title: "Heritage" },
1430
+ { id: "markers", title: "Markers" }
1431
+ ];
1432
+ function buildGenogramLegend(ast, theme) {
1433
+ const items = [];
1434
+ items.push(...buildSymbolItems(ast.individuals, theme));
1435
+ items.push(...buildStructuralItems(ast.relationships, theme));
1436
+ items.push(...buildRelationshipItems(ast.relationships));
1437
+ items.push(...buildConditionItems(ast.individuals));
1438
+ items.push(...buildHeritageItems(ast.individuals));
1439
+ items.push(...buildMarkerItems(ast.individuals, theme));
1440
+ return {
1441
+ mode: "auto",
1442
+ title: "Legend",
1443
+ position: "bottom-inline",
1444
+ columns: 1,
1445
+ sections: SECTIONS,
1446
+ items
1447
+ };
1448
+ }
1449
+ var OBVIOUS_SEX = /* @__PURE__ */ new Set(["male", "female"]);
1450
+ function buildSymbolItems(individuals, theme) {
1451
+ const items = [];
1452
+ const sexUsed = /* @__PURE__ */ new Set();
1453
+ const statusUsed = /* @__PURE__ */ new Set();
1454
+ for (const ind of individuals) {
1455
+ sexUsed.add(ind.sex);
1456
+ if (ind.status && ind.status !== "alive") statusUsed.add(ind.status);
1457
+ }
1458
+ const sexOrder = [
1459
+ "unknown",
1460
+ "other",
1461
+ "nonbinary",
1462
+ "intersex"
1463
+ ];
1464
+ for (const s of sexOrder) {
1465
+ if (!sexUsed.has(s)) continue;
1466
+ if (OBVIOUS_SEX.has(s)) continue;
1467
+ items.push({
1468
+ key: `sex.${s}`,
1469
+ label: sexLabel(s),
1470
+ kind: "shape",
1471
+ shape: sexShape(s),
1472
+ fill: theme ? sexFill(s, theme) : void 0,
1473
+ color: theme?.stroke,
1474
+ section: "symbols"
1475
+ });
1476
+ }
1477
+ const statusOrder = [
1478
+ "deceased",
1479
+ "stillborn",
1480
+ "miscarriage",
1481
+ "abortion",
1482
+ "pregnancy",
1483
+ "sab",
1484
+ "tab",
1485
+ "ectopic"
1486
+ ];
1487
+ for (const st of statusOrder) {
1488
+ if (!statusUsed.has(st)) continue;
1489
+ items.push({
1490
+ key: `status.${st}`,
1491
+ label: statusLabel(st),
1492
+ kind: "marker",
1493
+ marker: statusMarker(st),
1494
+ color: theme?.deceasedMark,
1495
+ section: "symbols"
1496
+ });
1497
+ }
1498
+ return items;
1499
+ }
1500
+ function sexFill(s, theme) {
1501
+ switch (s) {
1502
+ case "male":
1503
+ return theme.maleFill;
1504
+ case "female":
1505
+ return theme.femaleFill;
1506
+ default:
1507
+ return theme.unknownFill;
1508
+ }
1509
+ }
1510
+ function sexShape(s) {
1511
+ switch (s) {
1512
+ case "male":
1513
+ return "square";
1514
+ case "female":
1515
+ return "circle";
1516
+ case "unknown":
1517
+ return "diamond";
1518
+ case "other":
1519
+ case "nonbinary":
1520
+ return "diamond";
1521
+ case "intersex":
1522
+ return "diamond";
1523
+ default:
1524
+ return "square";
1525
+ }
1526
+ }
1527
+ function sexLabel(s) {
1528
+ switch (s) {
1529
+ case "male":
1530
+ return "Male";
1531
+ case "female":
1532
+ return "Female";
1533
+ case "unknown":
1534
+ return "Unknown";
1535
+ case "other":
1536
+ return "Other";
1537
+ case "nonbinary":
1538
+ return "Non-binary";
1539
+ case "intersex":
1540
+ return "Intersex";
1541
+ default:
1542
+ return s;
1543
+ }
1544
+ }
1545
+ function statusMarker(s) {
1546
+ switch (s) {
1547
+ case "deceased":
1548
+ case "stillborn":
1549
+ return "X";
1550
+ case "miscarriage":
1551
+ case "sab":
1552
+ case "tab":
1553
+ case "abortion":
1554
+ case "ectopic":
1555
+ return "slash";
1556
+ default:
1557
+ return "dot";
1558
+ }
1559
+ }
1560
+ function statusLabel(s) {
1561
+ switch (s) {
1562
+ case "deceased":
1563
+ return "Deceased";
1564
+ case "stillborn":
1565
+ return "Stillborn";
1566
+ case "miscarriage":
1567
+ return "Miscarriage";
1568
+ case "abortion":
1569
+ return "Abortion";
1570
+ case "pregnancy":
1571
+ return "Pregnancy";
1572
+ case "sab":
1573
+ return "Spontaneous abortion";
1574
+ case "tab":
1575
+ return "Therapeutic abortion";
1576
+ case "ectopic":
1577
+ return "Ectopic pregnancy";
1578
+ default:
1579
+ return s;
1580
+ }
1581
+ }
1582
+ var OBVIOUS_STRUCTURAL = /* @__PURE__ */ new Set([
1583
+ "married",
1584
+ // single horizontal line — universal McGoldrick
1585
+ "parent-child"
1586
+ // single vertical line — universal
1587
+ ]);
1588
+ function buildStructuralItems(rels, theme) {
1589
+ const used = /* @__PURE__ */ new Set();
1590
+ for (const r of rels) {
1591
+ if (STRUCTURAL_TYPES.has(r.type)) used.add(r.type);
1592
+ }
1593
+ const order = [
1594
+ "divorced",
1595
+ "separated",
1596
+ "engaged",
1597
+ "cohabiting",
1598
+ "domestic-partnership",
1599
+ "consanguineous",
1600
+ "adopted",
1601
+ "foster",
1602
+ "twin-identical",
1603
+ "twin-fraternal"
1604
+ ];
1605
+ const items = [];
1606
+ for (const t of order) {
1607
+ if (!used.has(t)) continue;
1608
+ if (OBVIOUS_STRUCTURAL.has(t)) continue;
1609
+ items.push(structuralItem(t, theme));
1610
+ }
1611
+ return items;
1612
+ }
1613
+ function structuralItem(t, theme) {
1614
+ const base = {
1615
+ key: t,
1616
+ label: humanize(t),
1617
+ kind: "line",
1618
+ color: theme?.stroke,
1619
+ section: "structural",
1620
+ pattern: "solid"
1621
+ };
1622
+ switch (t) {
1623
+ case "divorced":
1624
+ return { ...base, kind: "edge", marker: "X", pattern: "solid" };
1625
+ case "separated":
1626
+ return { ...base, kind: "edge", marker: "slash", pattern: "solid" };
1627
+ case "engaged":
1628
+ case "cohabiting":
1629
+ case "adopted":
1630
+ case "foster":
1631
+ return { ...base, pattern: "dashed" };
1632
+ case "consanguineous":
1633
+ return { ...base, pattern: "double" };
1634
+ case "twin-identical":
1635
+ case "twin-fraternal":
1636
+ return { ...base, pattern: "solid" };
1637
+ default:
1638
+ return base;
1639
+ }
1640
+ }
1641
+ function buildRelationshipItems(rels) {
1642
+ const used = /* @__PURE__ */ new Set();
1643
+ for (const r of rels) {
1644
+ if (EMOTIONAL_TYPES2.has(r.type)) used.add(r.type);
1645
+ }
1646
+ const order = [
1647
+ "harmony",
1648
+ "close",
1649
+ "bestfriends",
1650
+ "love",
1651
+ "inlove",
1652
+ "friendship",
1653
+ "hostile",
1654
+ "conflict",
1655
+ "enmity",
1656
+ "distant-hostile",
1657
+ "cutoff",
1658
+ "close-hostile",
1659
+ "fused",
1660
+ "fused-hostile",
1661
+ "distant",
1662
+ "normal",
1663
+ "nevermet",
1664
+ "abuse",
1665
+ "physical-abuse",
1666
+ "emotional-abuse",
1667
+ "sexual-abuse",
1668
+ "neglect",
1669
+ "manipulative",
1670
+ "controlling",
1671
+ "jealous",
1672
+ "focused",
1673
+ "focused-neg",
1674
+ "distrust",
1675
+ "admirer",
1676
+ "limerence"
1677
+ ];
1678
+ const items = [];
1679
+ for (const t of order) {
1680
+ if (!used.has(t)) continue;
1681
+ items.push({
1682
+ key: t,
1683
+ label: humanize(t),
1684
+ kind: "line",
1685
+ color: emotionalColor(t),
1686
+ pattern: emotionalPattern(t),
1687
+ strokeWidth: emotionalStrokeWidth(t),
1688
+ section: "relationships"
1689
+ });
1690
+ }
1691
+ return items;
1692
+ }
1693
+ function emotionalColor(t) {
1694
+ if (["harmony", "close", "bestfriends", "love", "inlove", "friendship"].includes(t)) return "#4caf50";
1695
+ if (["hostile", "conflict", "enmity", "distant-hostile", "cutoff"].includes(t)) return "#e53935";
1696
+ if (["close-hostile", "fused", "fused-hostile"].includes(t)) return "#9c27b0";
1697
+ if (["distant", "normal", "nevermet"].includes(t)) return "#9e9e9e";
1698
+ if (["abuse", "physical-abuse", "emotional-abuse", "sexual-abuse", "neglect"].includes(t)) return "#b71c1c";
1699
+ if (["manipulative", "controlling", "jealous"].includes(t)) return "#e65100";
1700
+ return "#1565c0";
1701
+ }
1702
+ function emotionalPattern(t) {
1703
+ if (["hostile", "conflict", "enmity", "distant-hostile", "close-hostile", "fused-hostile"].includes(t)) return "zigzag";
1704
+ if (["distant", "nevermet"].includes(t)) return "dashed";
1705
+ if (t === "cutoff") return "broken";
1706
+ return "solid";
1707
+ }
1708
+ function emotionalStrokeWidth(t) {
1709
+ if (["fused", "fused-hostile", "bestfriends"].includes(t)) return 4;
1710
+ if (["close", "close-hostile", "love", "inlove"].includes(t)) return 3;
1711
+ return 2;
1712
+ }
1713
+ function buildConditionItems(individuals) {
1714
+ const seen = /* @__PURE__ */ new Map();
1715
+ for (const ind of individuals) {
1716
+ if (!ind.conditions) continue;
1717
+ for (const c of ind.conditions) {
1718
+ if (seen.has(c.label)) continue;
1719
+ const color = c.color ?? defaultCategoryColor(c.category);
1720
+ const isFull = c.fill === "full";
1721
+ seen.set(c.label, {
1722
+ key: c.label,
1723
+ label: humanize(c.label),
1724
+ kind: isFull ? "fill" : "fill-pattern",
1725
+ color,
1726
+ shape: isFull ? void 0 : c.fill,
1727
+ section: "conditions"
1728
+ });
1729
+ }
1730
+ }
1731
+ return Array.from(seen.values());
1732
+ }
1733
+ function defaultCategoryColor(cat) {
1734
+ if (!cat) return "#9ca3af";
1735
+ const map = {
1736
+ cardiovascular: "#dc2626",
1737
+ cancer: "#a21caf",
1738
+ diabetes: "#d97706",
1739
+ "mental-health": "#2563eb",
1740
+ depression: "#1d4ed8",
1741
+ anxiety: "#0ea5e9",
1742
+ bipolar: "#6366f1",
1743
+ ptsd: "#475569",
1744
+ "substance-alcohol": "#92400e",
1745
+ "substance-drugs": "#7c2d12",
1746
+ "substance-tobacco": "#854d0e",
1747
+ neurological: "#7e22ce",
1748
+ respiratory: "#0891b2",
1749
+ autoimmune: "#be185d",
1750
+ genetic: "#0f766e",
1751
+ reproductive: "#db2777",
1752
+ "eating-disorder": "#9333ea",
1753
+ "learning-developmental": "#0369a1",
1754
+ kidney: "#b45309",
1755
+ "liver-gi": "#ca8a04",
1756
+ obesity: "#ea580c",
1757
+ other: "#9ca3af"
1758
+ };
1759
+ return map[cat] ?? "#9ca3af";
1760
+ }
1761
+ function buildHeritageItems(individuals) {
1762
+ const all = /* @__PURE__ */ new Set();
1763
+ for (const ind of individuals) {
1764
+ if (!ind.heritage) continue;
1765
+ for (const h of ind.heritage) all.add(h);
1766
+ }
1767
+ const ordered = Array.from(all).sort();
1768
+ return ordered.map((id, i) => ({
1769
+ key: id,
1770
+ label: humanize(id),
1771
+ kind: "fill",
1772
+ color: HERITAGE_PALETTE[i % HERITAGE_PALETTE.length],
1773
+ section: "heritage"
1774
+ }));
1775
+ }
1776
+ function buildMarkerItems(individuals, theme) {
1777
+ const used = /* @__PURE__ */ new Set();
1778
+ for (const ind of individuals) {
1779
+ if (!ind.markers) continue;
1780
+ for (const m of ind.markers) used.add(m);
1781
+ }
1782
+ const order = [
1783
+ "proband",
1784
+ "consultand",
1785
+ "evaluated",
1786
+ "index-person",
1787
+ "transgender",
1788
+ "no-children",
1789
+ "infertile"
1790
+ ];
1791
+ const items = [];
1792
+ for (const m of order) {
1793
+ if (!used.has(m)) continue;
1794
+ items.push(markerItem(m, theme));
1795
+ }
1796
+ return items;
1797
+ }
1798
+ function markerItem(m, theme) {
1799
+ switch (m) {
1800
+ case "proband":
1801
+ return { key: `marker.${m}`, label: "Proband (P)", kind: "marker", marker: "P", section: "markers" };
1802
+ case "consultand":
1803
+ return { key: `marker.${m}`, label: "Consultand (C)", kind: "marker", marker: "C", section: "markers" };
1804
+ case "evaluated":
1805
+ return { key: `marker.${m}`, label: "Evaluated (E)", kind: "marker", marker: "E", section: "markers" };
1806
+ case "index-person":
1807
+ return {
1808
+ key: `marker.${m}`,
1809
+ label: "Index person (focal subject)",
1810
+ kind: "shape",
1811
+ shape: "concentric-square",
1812
+ fill: "#fef3c7",
1813
+ color: theme?.stroke,
1814
+ section: "markers"
1815
+ };
1816
+ case "transgender":
1817
+ return { key: `marker.${m}`, label: "Transgender", kind: "marker", marker: "star", section: "markers" };
1818
+ case "no-children":
1819
+ return { key: `marker.${m}`, label: "No children (by choice)", kind: "marker", marker: "slash", section: "markers" };
1820
+ case "infertile":
1821
+ return { key: `marker.${m}`, label: "Infertile", kind: "marker", marker: "X", section: "markers" };
1822
+ default:
1823
+ return { key: `marker.${m}`, label: humanize(m), kind: "marker", marker: "dot", section: "markers" };
1824
+ }
1825
+ }
1826
+ function humanize(s) {
1827
+ return s.replace(/[-_]+/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
1828
+ }
1829
+
1423
1830
  // src/diagrams/genogram/renderer.ts
1424
1831
  function renderGenogram(layout, config, ast) {
1425
1832
  const hasDirectional = layout.edges.some((e) => e.relationship.directional);
@@ -1446,8 +1853,9 @@ function renderGenogram(layout, config, ast) {
1446
1853
  defsStr,
1447
1854
  styleStr
1448
1855
  ];
1856
+ const chartContent = [];
1449
1857
  if (chartTitle) {
1450
- layers.push(
1858
+ chartContent.push(
1451
1859
  chunkHDKDQAEQ_cjs.text(
1452
1860
  {
1453
1861
  x: layout.width / 2,
@@ -1462,17 +1870,54 @@ function renderGenogram(layout, config, ast) {
1462
1870
  )
1463
1871
  );
1464
1872
  }
1465
- const contentGroup = chunkHDKDQAEQ_cjs.group(
1466
- { transform: titleHeight > 0 ? `translate(0, ${titleHeight})` : void 0 },
1467
- [edgeLayers, emotionalLayer, ...nodeLayers, labelLayer, edgeLabelLayer]
1873
+ chartContent.push(
1874
+ chunkHDKDQAEQ_cjs.group(
1875
+ { transform: titleHeight > 0 ? `translate(0, ${titleHeight})` : void 0 },
1876
+ [edgeLayers, emotionalLayer, ...nodeLayers, labelLayer, edgeLabelLayer]
1877
+ )
1878
+ );
1879
+ let finalWidth = layout.width;
1880
+ let finalHeight = totalHeight;
1881
+ let legendSvg = "";
1882
+ if (ast) {
1883
+ const themeBase = chunkD7EHZFK4_cjs.resolveGenogramTheme(config.theme);
1884
+ const autoSpec = buildGenogramLegend(ast, themeBase);
1885
+ const finalSpec = chunkULYRO2KY_cjs.applyLegendOverrides(autoSpec, ast.legendOverrides);
1886
+ if (finalSpec.mode === "on" && finalSpec.items.length > 0) {
1887
+ const { svg, bbox: lb } = chunkULYRO2KY_cjs.renderLegend(
1888
+ finalSpec,
1889
+ {
1890
+ canvasWidth: layout.width,
1891
+ canvasHeight: totalHeight,
1892
+ padding: 16,
1893
+ titleHeight
1894
+ },
1895
+ themeBase,
1896
+ { fontFamily: config.fontFamily, fontSize: config.fontSize }
1897
+ );
1898
+ if (svg) {
1899
+ legendSvg = svg;
1900
+ const overflowX = lb.x + lb.w + 8;
1901
+ const overflowY = lb.y + lb.h + 8;
1902
+ if (overflowX > finalWidth) finalWidth = overflowX;
1903
+ if (overflowY > finalHeight) finalHeight = overflowY;
1904
+ }
1905
+ }
1906
+ }
1907
+ const chartXOffset = Math.max(0, (finalWidth - layout.width) / 2);
1908
+ layers.push(
1909
+ chunkHDKDQAEQ_cjs.group(
1910
+ { transform: chartXOffset > 0 ? `translate(${chartXOffset}, 0)` : void 0 },
1911
+ chartContent
1912
+ )
1468
1913
  );
1469
- layers.push(contentGroup);
1914
+ if (legendSvg) layers.push(legendSvg);
1470
1915
  return chunkHDKDQAEQ_cjs.svgRoot(
1471
1916
  {
1472
- viewBox: `0 0 ${layout.width} ${totalHeight}`,
1917
+ viewBox: `0 0 ${finalWidth} ${finalHeight}`,
1473
1918
  class: "schematex-diagram schematex-genogram",
1474
- width: layout.width,
1475
- height: totalHeight
1919
+ width: finalWidth,
1920
+ height: finalHeight
1476
1921
  },
1477
1922
  layers
1478
1923
  );
@@ -1493,7 +1938,8 @@ function buildStyles(config) {
1493
1938
  .schematex-genogram-edge-divorced .schematex-genogram-divorce-mark { stroke: ${t.neutral}; stroke-width: ${chunkD7EHZFK4_cjs.STROKE_WIDTH.normal}; }
1494
1939
  .schematex-genogram-edge-separated .schematex-genogram-separation-mark { stroke: ${t.neutral}; stroke-width: ${chunkD7EHZFK4_cjs.STROKE_WIDTH.normal}; }
1495
1940
  .schematex-genogram-deceased-mark { stroke: ${t.deceasedMark}; stroke-width: ${chunkD7EHZFK4_cjs.STROKE_WIDTH.normal}; stroke-linecap: round; }
1496
- .schematex-genogram-condition-fill { fill: ${t.conditionFill}; }
1941
+ /* Inline fill on each .schematex-genogram-condition-fill element comes from cond.color. The CSS only sets a default for elements that did not receive an inline fill attribute. */
1942
+ .schematex-genogram-condition-fill:not([fill]) { fill: ${t.conditionFill}; }
1497
1943
  .schematex-genogram-age { font-family: ${config.fontFamily}; fill: ${t.text}; pointer-events: none; }
1498
1944
  .schematex-genogram-title { fill: ${t.text}; }
1499
1945
  .schematex-genogram-edge-label { font-family: ${config.fontFamily}; fill: ${t.text}; }
@@ -1800,5 +2246,5 @@ exports.layoutGenogram = layoutGenogram;
1800
2246
  exports.parseGenogram = parseGenogram;
1801
2247
  exports.renderGenogram = renderGenogram;
1802
2248
  exports.renderIndividualSymbol = renderIndividualSymbol;
1803
- //# sourceMappingURL=chunk-Z63XPA2V.cjs.map
1804
- //# sourceMappingURL=chunk-Z63XPA2V.cjs.map
2249
+ //# sourceMappingURL=chunk-MJGDP3CS.cjs.map
2250
+ //# sourceMappingURL=chunk-MJGDP3CS.cjs.map