schematex 0.2.2 → 0.2.3

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-YN467EEQ.js → chunk-2BM3HJSK.js} +544 -100
  18. package/dist/chunk-2BM3HJSK.js.map +1 -0
  19. package/dist/{chunk-ZO77FHBF.cjs → chunk-2JDVJRR3.cjs} +14 -6
  20. package/dist/chunk-2JDVJRR3.cjs.map +1 -0
  21. package/dist/{chunk-QR7VTCI4.cjs → chunk-3YZ6FPQW.cjs} +13 -7
  22. package/dist/chunk-3YZ6FPQW.cjs.map +1 -0
  23. package/dist/{chunk-GEPBET4L.js → chunk-45KP67RR.js} +14 -6
  24. package/dist/chunk-45KP67RR.js.map +1 -0
  25. package/dist/chunk-4QP37LD3.js +1112 -0
  26. package/dist/chunk-4QP37LD3.js.map +1 -0
  27. package/dist/{chunk-LKOBOVNL.cjs → chunk-5AEN2PLB.cjs} +14 -6
  28. package/dist/chunk-5AEN2PLB.cjs.map +1 -0
  29. package/dist/{chunk-Z63XPA2V.cjs → chunk-6LZJTAA3.cjs} +543 -99
  30. package/dist/chunk-6LZJTAA3.cjs.map +1 -0
  31. package/dist/{chunk-7IRT3LOY.cjs → chunk-A5D2IMOX.cjs} +16 -8
  32. package/dist/chunk-A5D2IMOX.cjs.map +1 -0
  33. package/dist/{chunk-XVCAOGFL.cjs → chunk-B37IKTI7.cjs} +221 -44
  34. package/dist/chunk-B37IKTI7.cjs.map +1 -0
  35. package/dist/{chunk-ISACNVFE.cjs → chunk-B6INLQBU.cjs} +15 -9
  36. package/dist/chunk-B6INLQBU.cjs.map +1 -0
  37. package/dist/{chunk-YXIIWLLB.cjs → chunk-COLTVQWR.cjs} +174 -6
  38. package/dist/chunk-COLTVQWR.cjs.map +1 -0
  39. package/dist/chunk-DNZFOCV7.js +796 -0
  40. package/dist/chunk-DNZFOCV7.js.map +1 -0
  41. package/dist/{chunk-XHZ7GXP2.cjs → chunk-E65ITQXV.cjs} +178 -22
  42. package/dist/chunk-E65ITQXV.cjs.map +1 -0
  43. package/dist/{chunk-LCR3KOJV.js → chunk-FCGHV6ZK.js} +16 -8
  44. package/dist/chunk-FCGHV6ZK.js.map +1 -0
  45. package/dist/{chunk-X2BQKXMA.js → chunk-FE6GAUNW.js} +13 -7
  46. package/dist/chunk-FE6GAUNW.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-MOU5QRZY.cjs +1121 -0
  52. package/dist/chunk-MOU5QRZY.cjs.map +1 -0
  53. package/dist/{chunk-4KYW63IK.js → chunk-OC22GGQN.js} +222 -45
  54. package/dist/chunk-OC22GGQN.js.map +1 -0
  55. package/dist/{chunk-7HKXU7J2.cjs → chunk-QXIGHMH2.cjs} +65 -38
  56. package/dist/chunk-QXIGHMH2.cjs.map +1 -0
  57. package/dist/{chunk-5UV5VQ7J.js → chunk-RP5UATRA.js} +174 -6
  58. package/dist/chunk-RP5UATRA.js.map +1 -0
  59. package/dist/{chunk-UUPYTUGR.js → chunk-S3RBKJM5.js} +54 -27
  60. package/dist/chunk-S3RBKJM5.js.map +1 -0
  61. package/dist/{chunk-Z3WOHHG3.js → chunk-SN7NTZI6.js} +8 -6
  62. package/dist/chunk-SN7NTZI6.js.map +1 -0
  63. package/dist/{chunk-ZNZIL244.js → chunk-U6L3FAML.js} +15 -9
  64. package/dist/chunk-U6L3FAML.js.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-CXHPP5BL.cjs → chunk-Z3DE6S64.cjs} +8 -6
  70. package/dist/chunk-Z3DE6S64.cjs.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-C97K-kuw.d.ts} +1 -1
  128. package/dist/{index-SSGpCggE.d.cts → index-lsSaw3E0.d.cts} +1 -1
  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) {
@@ -1150,96 +1158,30 @@ function getRequiredDefs(individuals, includeArrowMarker = false) {
1150
1158
  }
1151
1159
  }
1152
1160
  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")) {
1161
+ function quadClips(suffix, x, y, w, h) {
1162
+ const r = chunkHDKDQAEQ_cjs.rect({ x, y, width: w, height: h });
1234
1163
  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
- ])
1164
+ chunkHDKDQAEQ_cjs.el(
1165
+ "clipPath",
1166
+ { id: `schematex-genogram-clip-${suffix}-rect`, clipPathUnits: "objectBoundingBox" },
1167
+ [r]
1168
+ ),
1169
+ chunkHDKDQAEQ_cjs.el(
1170
+ "clipPath",
1171
+ { id: `schematex-genogram-clip-${suffix}-circle`, clipPathUnits: "objectBoundingBox" },
1172
+ [r]
1173
+ )
1241
1174
  );
1242
1175
  }
1176
+ if (neededFills.has("half-left")) quadClips("half-left", 0, 0, 0.5, 1);
1177
+ if (neededFills.has("half-right")) quadClips("half-right", 0.5, 0, 0.5, 1);
1178
+ if (neededFills.has("half-top")) quadClips("half-top", 0, 0, 1, 0.5);
1179
+ if (neededFills.has("half-bottom")) quadClips("half-bottom", 0, 0.5, 1, 0.5);
1180
+ if (neededFills.has("quarter")) quadClips("quarter", 0, 0, 0.5, 0.5);
1181
+ if (neededFills.has("quad-tl")) quadClips("quad-tl", 0, 0, 0.5, 0.5);
1182
+ if (neededFills.has("quad-tr")) quadClips("quad-tr", 0.5, 0, 0.5, 0.5);
1183
+ if (neededFills.has("quad-bl")) quadClips("quad-bl", 0, 0.5, 0.5, 0.5);
1184
+ if (neededFills.has("quad-br")) quadClips("quad-br", 0.5, 0.5, 0.5, 0.5);
1243
1185
  if (neededFills.has("striped")) {
1244
1186
  children.push(
1245
1187
  chunkHDKDQAEQ_cjs.pattern(
@@ -1420,6 +1362,469 @@ function conditionFillElement(sex, half, cond) {
1420
1362
  }
1421
1363
  }
1422
1364
 
1365
+ // src/diagrams/genogram/legend.ts
1366
+ var EMOTIONAL_TYPES2 = /* @__PURE__ */ new Set([
1367
+ "harmony",
1368
+ "close",
1369
+ "bestfriends",
1370
+ "love",
1371
+ "inlove",
1372
+ "friendship",
1373
+ "hostile",
1374
+ "conflict",
1375
+ "enmity",
1376
+ "distant-hostile",
1377
+ "cutoff",
1378
+ "close-hostile",
1379
+ "fused",
1380
+ "fused-hostile",
1381
+ "distant",
1382
+ "normal",
1383
+ "nevermet",
1384
+ "abuse",
1385
+ "physical-abuse",
1386
+ "emotional-abuse",
1387
+ "sexual-abuse",
1388
+ "neglect",
1389
+ "manipulative",
1390
+ "controlling",
1391
+ "jealous",
1392
+ "focused",
1393
+ "focused-neg",
1394
+ "distrust",
1395
+ "admirer",
1396
+ "limerence"
1397
+ ]);
1398
+ var STRUCTURAL_TYPES = /* @__PURE__ */ new Set([
1399
+ "married",
1400
+ "divorced",
1401
+ "separated",
1402
+ "engaged",
1403
+ "cohabiting",
1404
+ "domestic-partnership",
1405
+ "consanguineous",
1406
+ "parent-child",
1407
+ "adopted",
1408
+ "foster",
1409
+ "twin-identical",
1410
+ "twin-fraternal"
1411
+ ]);
1412
+ var HERITAGE_PALETTE = [
1413
+ "#2563eb",
1414
+ "#059669",
1415
+ "#d97706",
1416
+ "#dc2626",
1417
+ "#7c3aed",
1418
+ "#0891b2",
1419
+ "#ca8a04",
1420
+ "#db2777"
1421
+ ];
1422
+ var SECTIONS = [
1423
+ { id: "symbols", title: "Symbols" },
1424
+ { id: "structural", title: "Structural" },
1425
+ { id: "relationships", title: "Relationships" },
1426
+ { id: "conditions", title: "Conditions" },
1427
+ { id: "heritage", title: "Heritage" },
1428
+ { id: "markers", title: "Markers" }
1429
+ ];
1430
+ function buildGenogramLegend(ast, theme) {
1431
+ const items = [];
1432
+ items.push(...buildSymbolItems(ast.individuals, theme));
1433
+ items.push(...buildStructuralItems(ast.relationships, theme));
1434
+ items.push(...buildRelationshipItems(ast.relationships));
1435
+ items.push(...buildConditionItems(ast.individuals));
1436
+ items.push(...buildHeritageItems(ast.individuals));
1437
+ items.push(...buildMarkerItems(ast.individuals, theme));
1438
+ return {
1439
+ mode: "auto",
1440
+ title: "Legend",
1441
+ position: "bottom-inline",
1442
+ columns: 1,
1443
+ sections: SECTIONS,
1444
+ items
1445
+ };
1446
+ }
1447
+ var OBVIOUS_SEX = /* @__PURE__ */ new Set(["male", "female"]);
1448
+ function buildSymbolItems(individuals, theme) {
1449
+ const items = [];
1450
+ const sexUsed = /* @__PURE__ */ new Set();
1451
+ const statusUsed = /* @__PURE__ */ new Set();
1452
+ for (const ind of individuals) {
1453
+ sexUsed.add(ind.sex);
1454
+ if (ind.status && ind.status !== "alive") statusUsed.add(ind.status);
1455
+ }
1456
+ const sexOrder = [
1457
+ "unknown",
1458
+ "other",
1459
+ "nonbinary",
1460
+ "intersex"
1461
+ ];
1462
+ for (const s of sexOrder) {
1463
+ if (!sexUsed.has(s)) continue;
1464
+ if (OBVIOUS_SEX.has(s)) continue;
1465
+ items.push({
1466
+ key: `sex.${s}`,
1467
+ label: sexLabel(s),
1468
+ kind: "shape",
1469
+ shape: sexShape(s),
1470
+ fill: theme ? sexFill(s, theme) : void 0,
1471
+ color: theme?.stroke,
1472
+ section: "symbols"
1473
+ });
1474
+ }
1475
+ const statusOrder = [
1476
+ "deceased",
1477
+ "stillborn",
1478
+ "miscarriage",
1479
+ "abortion",
1480
+ "pregnancy",
1481
+ "sab",
1482
+ "tab",
1483
+ "ectopic"
1484
+ ];
1485
+ for (const st of statusOrder) {
1486
+ if (!statusUsed.has(st)) continue;
1487
+ items.push({
1488
+ key: `status.${st}`,
1489
+ label: statusLabel(st),
1490
+ kind: "marker",
1491
+ marker: statusMarker(st),
1492
+ color: theme?.deceasedMark,
1493
+ section: "symbols"
1494
+ });
1495
+ }
1496
+ return items;
1497
+ }
1498
+ function sexFill(s, theme) {
1499
+ switch (s) {
1500
+ case "male":
1501
+ return theme.maleFill;
1502
+ case "female":
1503
+ return theme.femaleFill;
1504
+ default:
1505
+ return theme.unknownFill;
1506
+ }
1507
+ }
1508
+ function sexShape(s) {
1509
+ switch (s) {
1510
+ case "male":
1511
+ return "square";
1512
+ case "female":
1513
+ return "circle";
1514
+ case "unknown":
1515
+ return "diamond";
1516
+ case "other":
1517
+ case "nonbinary":
1518
+ return "diamond";
1519
+ case "intersex":
1520
+ return "diamond";
1521
+ default:
1522
+ return "square";
1523
+ }
1524
+ }
1525
+ function sexLabel(s) {
1526
+ switch (s) {
1527
+ case "male":
1528
+ return "Male";
1529
+ case "female":
1530
+ return "Female";
1531
+ case "unknown":
1532
+ return "Unknown";
1533
+ case "other":
1534
+ return "Other";
1535
+ case "nonbinary":
1536
+ return "Non-binary";
1537
+ case "intersex":
1538
+ return "Intersex";
1539
+ default:
1540
+ return s;
1541
+ }
1542
+ }
1543
+ function statusMarker(s) {
1544
+ switch (s) {
1545
+ case "deceased":
1546
+ case "stillborn":
1547
+ return "X";
1548
+ case "miscarriage":
1549
+ case "sab":
1550
+ case "tab":
1551
+ case "abortion":
1552
+ case "ectopic":
1553
+ return "slash";
1554
+ default:
1555
+ return "dot";
1556
+ }
1557
+ }
1558
+ function statusLabel(s) {
1559
+ switch (s) {
1560
+ case "deceased":
1561
+ return "Deceased";
1562
+ case "stillborn":
1563
+ return "Stillborn";
1564
+ case "miscarriage":
1565
+ return "Miscarriage";
1566
+ case "abortion":
1567
+ return "Abortion";
1568
+ case "pregnancy":
1569
+ return "Pregnancy";
1570
+ case "sab":
1571
+ return "Spontaneous abortion";
1572
+ case "tab":
1573
+ return "Therapeutic abortion";
1574
+ case "ectopic":
1575
+ return "Ectopic pregnancy";
1576
+ default:
1577
+ return s;
1578
+ }
1579
+ }
1580
+ var OBVIOUS_STRUCTURAL = /* @__PURE__ */ new Set([
1581
+ "married",
1582
+ // single horizontal line — universal McGoldrick
1583
+ "parent-child"
1584
+ // single vertical line — universal
1585
+ ]);
1586
+ function buildStructuralItems(rels, theme) {
1587
+ const used = /* @__PURE__ */ new Set();
1588
+ for (const r of rels) {
1589
+ if (STRUCTURAL_TYPES.has(r.type)) used.add(r.type);
1590
+ }
1591
+ const order = [
1592
+ "divorced",
1593
+ "separated",
1594
+ "engaged",
1595
+ "cohabiting",
1596
+ "domestic-partnership",
1597
+ "consanguineous",
1598
+ "adopted",
1599
+ "foster",
1600
+ "twin-identical",
1601
+ "twin-fraternal"
1602
+ ];
1603
+ const items = [];
1604
+ for (const t of order) {
1605
+ if (!used.has(t)) continue;
1606
+ if (OBVIOUS_STRUCTURAL.has(t)) continue;
1607
+ items.push(structuralItem(t, theme));
1608
+ }
1609
+ return items;
1610
+ }
1611
+ function structuralItem(t, theme) {
1612
+ const base = {
1613
+ key: t,
1614
+ label: humanize(t),
1615
+ kind: "line",
1616
+ color: theme?.stroke,
1617
+ section: "structural",
1618
+ pattern: "solid"
1619
+ };
1620
+ switch (t) {
1621
+ case "divorced":
1622
+ return { ...base, kind: "edge", marker: "X", pattern: "solid" };
1623
+ case "separated":
1624
+ return { ...base, kind: "edge", marker: "slash", pattern: "solid" };
1625
+ case "engaged":
1626
+ case "cohabiting":
1627
+ case "adopted":
1628
+ case "foster":
1629
+ return { ...base, pattern: "dashed" };
1630
+ case "consanguineous":
1631
+ return { ...base, pattern: "double" };
1632
+ case "twin-identical":
1633
+ case "twin-fraternal":
1634
+ return { ...base, pattern: "solid" };
1635
+ default:
1636
+ return base;
1637
+ }
1638
+ }
1639
+ function buildRelationshipItems(rels) {
1640
+ const used = /* @__PURE__ */ new Set();
1641
+ for (const r of rels) {
1642
+ if (EMOTIONAL_TYPES2.has(r.type)) used.add(r.type);
1643
+ }
1644
+ const order = [
1645
+ "harmony",
1646
+ "close",
1647
+ "bestfriends",
1648
+ "love",
1649
+ "inlove",
1650
+ "friendship",
1651
+ "hostile",
1652
+ "conflict",
1653
+ "enmity",
1654
+ "distant-hostile",
1655
+ "cutoff",
1656
+ "close-hostile",
1657
+ "fused",
1658
+ "fused-hostile",
1659
+ "distant",
1660
+ "normal",
1661
+ "nevermet",
1662
+ "abuse",
1663
+ "physical-abuse",
1664
+ "emotional-abuse",
1665
+ "sexual-abuse",
1666
+ "neglect",
1667
+ "manipulative",
1668
+ "controlling",
1669
+ "jealous",
1670
+ "focused",
1671
+ "focused-neg",
1672
+ "distrust",
1673
+ "admirer",
1674
+ "limerence"
1675
+ ];
1676
+ const items = [];
1677
+ for (const t of order) {
1678
+ if (!used.has(t)) continue;
1679
+ items.push({
1680
+ key: t,
1681
+ label: humanize(t),
1682
+ kind: "line",
1683
+ color: emotionalColor(t),
1684
+ pattern: emotionalPattern(t),
1685
+ strokeWidth: emotionalStrokeWidth(t),
1686
+ section: "relationships"
1687
+ });
1688
+ }
1689
+ return items;
1690
+ }
1691
+ function emotionalColor(t) {
1692
+ if (["harmony", "close", "bestfriends", "love", "inlove", "friendship"].includes(t)) return "#4caf50";
1693
+ if (["hostile", "conflict", "enmity", "distant-hostile", "cutoff"].includes(t)) return "#e53935";
1694
+ if (["close-hostile", "fused", "fused-hostile"].includes(t)) return "#9c27b0";
1695
+ if (["distant", "normal", "nevermet"].includes(t)) return "#9e9e9e";
1696
+ if (["abuse", "physical-abuse", "emotional-abuse", "sexual-abuse", "neglect"].includes(t)) return "#b71c1c";
1697
+ if (["manipulative", "controlling", "jealous"].includes(t)) return "#e65100";
1698
+ return "#1565c0";
1699
+ }
1700
+ function emotionalPattern(t) {
1701
+ if (["hostile", "conflict", "enmity", "distant-hostile", "close-hostile", "fused-hostile"].includes(t)) return "zigzag";
1702
+ if (["distant", "nevermet"].includes(t)) return "dashed";
1703
+ if (t === "cutoff") return "broken";
1704
+ return "solid";
1705
+ }
1706
+ function emotionalStrokeWidth(t) {
1707
+ if (["fused", "fused-hostile", "bestfriends"].includes(t)) return 4;
1708
+ if (["close", "close-hostile", "love", "inlove"].includes(t)) return 3;
1709
+ return 2;
1710
+ }
1711
+ function buildConditionItems(individuals) {
1712
+ const seen = /* @__PURE__ */ new Map();
1713
+ for (const ind of individuals) {
1714
+ if (!ind.conditions) continue;
1715
+ for (const c of ind.conditions) {
1716
+ if (seen.has(c.label)) continue;
1717
+ const color = c.color ?? defaultCategoryColor(c.category);
1718
+ const isFull = c.fill === "full";
1719
+ seen.set(c.label, {
1720
+ key: c.label,
1721
+ label: humanize(c.label),
1722
+ kind: isFull ? "fill" : "fill-pattern",
1723
+ color,
1724
+ shape: isFull ? void 0 : c.fill,
1725
+ section: "conditions"
1726
+ });
1727
+ }
1728
+ }
1729
+ return Array.from(seen.values());
1730
+ }
1731
+ function defaultCategoryColor(cat) {
1732
+ if (!cat) return "#9ca3af";
1733
+ const map = {
1734
+ cardiovascular: "#dc2626",
1735
+ cancer: "#a21caf",
1736
+ diabetes: "#d97706",
1737
+ "mental-health": "#2563eb",
1738
+ depression: "#1d4ed8",
1739
+ anxiety: "#0ea5e9",
1740
+ bipolar: "#6366f1",
1741
+ ptsd: "#475569",
1742
+ "substance-alcohol": "#92400e",
1743
+ "substance-drugs": "#7c2d12",
1744
+ "substance-tobacco": "#854d0e",
1745
+ neurological: "#7e22ce",
1746
+ respiratory: "#0891b2",
1747
+ autoimmune: "#be185d",
1748
+ genetic: "#0f766e",
1749
+ reproductive: "#db2777",
1750
+ "eating-disorder": "#9333ea",
1751
+ "learning-developmental": "#0369a1",
1752
+ kidney: "#b45309",
1753
+ "liver-gi": "#ca8a04",
1754
+ obesity: "#ea580c",
1755
+ other: "#9ca3af"
1756
+ };
1757
+ return map[cat] ?? "#9ca3af";
1758
+ }
1759
+ function buildHeritageItems(individuals) {
1760
+ const all = /* @__PURE__ */ new Set();
1761
+ for (const ind of individuals) {
1762
+ if (!ind.heritage) continue;
1763
+ for (const h of ind.heritage) all.add(h);
1764
+ }
1765
+ const ordered = Array.from(all).sort();
1766
+ return ordered.map((id, i) => ({
1767
+ key: id,
1768
+ label: humanize(id),
1769
+ kind: "fill",
1770
+ color: HERITAGE_PALETTE[i % HERITAGE_PALETTE.length],
1771
+ section: "heritage"
1772
+ }));
1773
+ }
1774
+ function buildMarkerItems(individuals, theme) {
1775
+ const used = /* @__PURE__ */ new Set();
1776
+ for (const ind of individuals) {
1777
+ if (!ind.markers) continue;
1778
+ for (const m of ind.markers) used.add(m);
1779
+ }
1780
+ const order = [
1781
+ "proband",
1782
+ "consultand",
1783
+ "evaluated",
1784
+ "index-person",
1785
+ "transgender",
1786
+ "no-children",
1787
+ "infertile"
1788
+ ];
1789
+ const items = [];
1790
+ for (const m of order) {
1791
+ if (!used.has(m)) continue;
1792
+ items.push(markerItem(m, theme));
1793
+ }
1794
+ return items;
1795
+ }
1796
+ function markerItem(m, theme) {
1797
+ switch (m) {
1798
+ case "proband":
1799
+ return { key: `marker.${m}`, label: "Proband (P)", kind: "marker", marker: "P", section: "markers" };
1800
+ case "consultand":
1801
+ return { key: `marker.${m}`, label: "Consultand (C)", kind: "marker", marker: "C", section: "markers" };
1802
+ case "evaluated":
1803
+ return { key: `marker.${m}`, label: "Evaluated (E)", kind: "marker", marker: "E", section: "markers" };
1804
+ case "index-person":
1805
+ return {
1806
+ key: `marker.${m}`,
1807
+ label: "Index person (focal subject)",
1808
+ kind: "shape",
1809
+ shape: "concentric-square",
1810
+ fill: "#fef3c7",
1811
+ color: theme?.stroke,
1812
+ section: "markers"
1813
+ };
1814
+ case "transgender":
1815
+ return { key: `marker.${m}`, label: "Transgender", kind: "marker", marker: "star", section: "markers" };
1816
+ case "no-children":
1817
+ return { key: `marker.${m}`, label: "No children (by choice)", kind: "marker", marker: "slash", section: "markers" };
1818
+ case "infertile":
1819
+ return { key: `marker.${m}`, label: "Infertile", kind: "marker", marker: "X", section: "markers" };
1820
+ default:
1821
+ return { key: `marker.${m}`, label: humanize(m), kind: "marker", marker: "dot", section: "markers" };
1822
+ }
1823
+ }
1824
+ function humanize(s) {
1825
+ return s.replace(/[-_]+/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
1826
+ }
1827
+
1423
1828
  // src/diagrams/genogram/renderer.ts
1424
1829
  function renderGenogram(layout, config, ast) {
1425
1830
  const hasDirectional = layout.edges.some((e) => e.relationship.directional);
@@ -1446,8 +1851,9 @@ function renderGenogram(layout, config, ast) {
1446
1851
  defsStr,
1447
1852
  styleStr
1448
1853
  ];
1854
+ const chartContent = [];
1449
1855
  if (chartTitle) {
1450
- layers.push(
1856
+ chartContent.push(
1451
1857
  chunkHDKDQAEQ_cjs.text(
1452
1858
  {
1453
1859
  x: layout.width / 2,
@@ -1462,17 +1868,54 @@ function renderGenogram(layout, config, ast) {
1462
1868
  )
1463
1869
  );
1464
1870
  }
1465
- const contentGroup = chunkHDKDQAEQ_cjs.group(
1466
- { transform: titleHeight > 0 ? `translate(0, ${titleHeight})` : void 0 },
1467
- [edgeLayers, emotionalLayer, ...nodeLayers, labelLayer, edgeLabelLayer]
1871
+ chartContent.push(
1872
+ chunkHDKDQAEQ_cjs.group(
1873
+ { transform: titleHeight > 0 ? `translate(0, ${titleHeight})` : void 0 },
1874
+ [edgeLayers, emotionalLayer, ...nodeLayers, labelLayer, edgeLabelLayer]
1875
+ )
1876
+ );
1877
+ let finalWidth = layout.width;
1878
+ let finalHeight = totalHeight;
1879
+ let legendSvg = "";
1880
+ if (ast) {
1881
+ const themeBase = chunkD7EHZFK4_cjs.resolveGenogramTheme(config.theme);
1882
+ const autoSpec = buildGenogramLegend(ast, themeBase);
1883
+ const finalSpec = chunkULYRO2KY_cjs.applyLegendOverrides(autoSpec, ast.legendOverrides);
1884
+ if (finalSpec.mode === "on" && finalSpec.items.length > 0) {
1885
+ const { svg, bbox: lb } = chunkULYRO2KY_cjs.renderLegend(
1886
+ finalSpec,
1887
+ {
1888
+ canvasWidth: layout.width,
1889
+ canvasHeight: totalHeight,
1890
+ padding: 16,
1891
+ titleHeight
1892
+ },
1893
+ themeBase,
1894
+ { fontFamily: config.fontFamily, fontSize: config.fontSize }
1895
+ );
1896
+ if (svg) {
1897
+ legendSvg = svg;
1898
+ const overflowX = lb.x + lb.w + 8;
1899
+ const overflowY = lb.y + lb.h + 8;
1900
+ if (overflowX > finalWidth) finalWidth = overflowX;
1901
+ if (overflowY > finalHeight) finalHeight = overflowY;
1902
+ }
1903
+ }
1904
+ }
1905
+ const chartXOffset = Math.max(0, (finalWidth - layout.width) / 2);
1906
+ layers.push(
1907
+ chunkHDKDQAEQ_cjs.group(
1908
+ { transform: chartXOffset > 0 ? `translate(${chartXOffset}, 0)` : void 0 },
1909
+ chartContent
1910
+ )
1468
1911
  );
1469
- layers.push(contentGroup);
1912
+ if (legendSvg) layers.push(legendSvg);
1470
1913
  return chunkHDKDQAEQ_cjs.svgRoot(
1471
1914
  {
1472
- viewBox: `0 0 ${layout.width} ${totalHeight}`,
1915
+ viewBox: `0 0 ${finalWidth} ${finalHeight}`,
1473
1916
  class: "schematex-diagram schematex-genogram",
1474
- width: layout.width,
1475
- height: totalHeight
1917
+ width: finalWidth,
1918
+ height: finalHeight
1476
1919
  },
1477
1920
  layers
1478
1921
  );
@@ -1493,7 +1936,8 @@ function buildStyles(config) {
1493
1936
  .schematex-genogram-edge-divorced .schematex-genogram-divorce-mark { stroke: ${t.neutral}; stroke-width: ${chunkD7EHZFK4_cjs.STROKE_WIDTH.normal}; }
1494
1937
  .schematex-genogram-edge-separated .schematex-genogram-separation-mark { stroke: ${t.neutral}; stroke-width: ${chunkD7EHZFK4_cjs.STROKE_WIDTH.normal}; }
1495
1938
  .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}; }
1939
+ /* 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. */
1940
+ .schematex-genogram-condition-fill:not([fill]) { fill: ${t.conditionFill}; }
1497
1941
  .schematex-genogram-age { font-family: ${config.fontFamily}; fill: ${t.text}; pointer-events: none; }
1498
1942
  .schematex-genogram-title { fill: ${t.text}; }
1499
1943
  .schematex-genogram-edge-label { font-family: ${config.fontFamily}; fill: ${t.text}; }
@@ -1800,5 +2244,5 @@ exports.layoutGenogram = layoutGenogram;
1800
2244
  exports.parseGenogram = parseGenogram;
1801
2245
  exports.renderGenogram = renderGenogram;
1802
2246
  exports.renderIndividualSymbol = renderIndividualSymbol;
1803
- //# sourceMappingURL=chunk-Z63XPA2V.cjs.map
1804
- //# sourceMappingURL=chunk-Z63XPA2V.cjs.map
2247
+ //# sourceMappingURL=chunk-6LZJTAA3.cjs.map
2248
+ //# sourceMappingURL=chunk-6LZJTAA3.cjs.map