schematex 0.9.15 → 0.9.16

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.
@@ -19,6 +19,8 @@ var ParseError = class extends Error {
19
19
  };
20
20
  var COUPLE_OPS = [
21
21
  { token: "~/~", type: "cohabiting-ended" },
22
+ { token: "~x~", type: "divorced" },
23
+ // the form the grammar advertises; `-x-` is the ASCII alias
22
24
  { token: "-//", type: "separated" },
23
25
  // alias for -/-
24
26
  { token: "-x-", type: "divorced" },
@@ -35,6 +37,16 @@ var VALID_STATUS = /* @__PURE__ */ new Set([
35
37
  "miscarriage",
36
38
  "abortion"
37
39
  ]);
40
+ var STATUS_ALIASES = {
41
+ stillbirth: "stillborn",
42
+ stillbirths: "stillborn",
43
+ miscarried: "miscarriage",
44
+ miscarry: "miscarriage",
45
+ aborted: "abortion",
46
+ dead: "deceased",
47
+ died: "deceased",
48
+ decd: "deceased"
49
+ };
38
50
  var SPECIAL_CHILD_PROPS = /* @__PURE__ */ new Set([
39
51
  "adopted",
40
52
  "foster",
@@ -454,8 +466,8 @@ function buildIndividual(id, propsStr, lineNum, lineText) {
454
466
  const tokenLower = token.toLowerCase();
455
467
  if (VALID_SEX.has(tokenLower)) {
456
468
  individual.sex = tokenLower;
457
- } else if (VALID_STATUS.has(tokenLower)) {
458
- individual.status = tokenLower;
469
+ } else if (VALID_STATUS.has(tokenLower) || STATUS_ALIASES[tokenLower]) {
470
+ individual.status = STATUS_ALIASES[tokenLower] ?? tokenLower;
459
471
  } else if (tokenLower === "index") {
460
472
  if (!individual.markers) individual.markers = [];
461
473
  individual.markers.push("index-person");
@@ -465,6 +477,8 @@ function buildIndividual(id, propsStr, lineNum, lineText) {
465
477
  if (!individual.label || individual.label === id) individual.label = "?";
466
478
  } else if (SPECIAL_CHILD_PROPS.has(tokenLower) || tokenLower === "guardian") {
467
479
  continue;
480
+ } else if (/^\d{1,3}$/.test(tokenLower)) {
481
+ individual.age = parseInt(token, 10);
468
482
  } else if (/^\d{4}$/.test(tokenLower)) {
469
483
  if (individual.birthYear !== void 0) {
470
484
  individual.deathYear = parseInt(token, 10);
@@ -551,7 +565,7 @@ function parseConditions(raw, lineNum, lineText) {
551
565
  const parts = raw.split("+").map((s) => s.trim());
552
566
  const conditions = [];
553
567
  for (const part of parts) {
554
- const match = part.match(/^([a-zA-Z0-9_-]+)\(([^)]+)\)$/);
568
+ const match = part.match(/^([^(]+)\(([^)]+)\)$/);
555
569
  if (!match) {
556
570
  throw new ParseError(
557
571
  `Invalid condition format '${part}'. Expected: name(fill) or name(fill, #color)`,
@@ -560,7 +574,8 @@ function parseConditions(raw, lineNum, lineText) {
560
574
  lineText
561
575
  );
562
576
  }
563
- const [, label, innerRaw] = match;
577
+ const label = match[1].trim();
578
+ const innerRaw = match[2];
564
579
  const innerParts = innerRaw.split(",").map((s) => s.trim());
565
580
  const fill = innerParts[0];
566
581
  const color = innerParts[1];
@@ -2729,5 +2744,5 @@ var genogram = {
2729
2744
  };
2730
2745
 
2731
2746
  export { ParseError, genogram, getRequiredDefs, layoutGenogram, parseGenogram, renderGenogram, renderIndividualSymbol };
2732
- //# sourceMappingURL=chunk-KWY52MLQ.js.map
2733
- //# sourceMappingURL=chunk-KWY52MLQ.js.map
2747
+ //# sourceMappingURL=chunk-LXQQNNOT.js.map
2748
+ //# sourceMappingURL=chunk-LXQQNNOT.js.map