@treeviz/gedcom-parser 2.1.15 → 2.1.17
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.
- package/dist/classes/common.d.ts.map +1 -1
- package/dist/classes/date.d.ts +2 -0
- package/dist/classes/date.d.ts.map +1 -1
- package/dist/classes/index.js +41 -10
- package/dist/cli/index.js +41 -10
- package/dist/constants/index.js +1149 -1117
- package/dist/factories/index.js +1192 -1160
- package/dist/index.js +41 -10
- package/dist/kinship-translator/index.js +1192 -1160
- package/dist/structures/individual.d.ts +1 -0
- package/dist/structures/individual.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/utils/date-formatter.d.ts.map +1 -1
- package/dist/utils/gedcom7-schema.d.ts.map +1 -1
- package/dist/utils/index.js +41 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -814,7 +814,11 @@ var Common = class _Common {
|
|
|
814
814
|
const current = this.get(validKey);
|
|
815
815
|
const mergeValue = other.get(validKey);
|
|
816
816
|
if (mergeValue) {
|
|
817
|
-
if (current instanceof _Common
|
|
817
|
+
if (current instanceof _Common && !current.isListable) {
|
|
818
|
+
if (override) {
|
|
819
|
+
this.set(validKey, mergeValue);
|
|
820
|
+
}
|
|
821
|
+
} else if (current instanceof _Common || current instanceof List) {
|
|
818
822
|
this.assign(validKey, mergeValue, true);
|
|
819
823
|
} else if (!current || override && validKey !== "id" && validKey !== "_id") {
|
|
820
824
|
this.set(validKey, mergeValue);
|
|
@@ -2438,19 +2442,41 @@ var ACCEPTED_DATE_FORMATS_REGEX = new RegExp(
|
|
|
2438
2442
|
).join("|")})`,
|
|
2439
2443
|
"gi"
|
|
2440
2444
|
);
|
|
2445
|
+
var firstDate = (date) => {
|
|
2446
|
+
if (!date) return void 0;
|
|
2447
|
+
if (isCommonDate(date)) return date;
|
|
2448
|
+
if (date instanceof List) {
|
|
2449
|
+
return firstDate(
|
|
2450
|
+
date.index(0)
|
|
2451
|
+
);
|
|
2452
|
+
}
|
|
2453
|
+
const node = date;
|
|
2454
|
+
if (typeof node.toValue === "function") {
|
|
2455
|
+
return node;
|
|
2456
|
+
}
|
|
2457
|
+
return void 0;
|
|
2458
|
+
};
|
|
2459
|
+
var dateNote = (date, shortNote = true) => {
|
|
2460
|
+
if (date && typeof date.toNote === "function") {
|
|
2461
|
+
return date.toNote(shortNote) ?? "";
|
|
2462
|
+
}
|
|
2463
|
+
return "";
|
|
2464
|
+
};
|
|
2441
2465
|
var commonDateFormatter = (date, format2 = "yyyy", prefix = "") => {
|
|
2442
|
-
const
|
|
2466
|
+
const used = firstDate(date);
|
|
2467
|
+
const formattedDate = used?.toValue(format2);
|
|
2443
2468
|
if (!formattedDate) {
|
|
2444
2469
|
return void 0;
|
|
2445
2470
|
}
|
|
2446
2471
|
return `${prefix}${formattedDate}`.trim();
|
|
2447
2472
|
};
|
|
2448
2473
|
var noteDateFormatter = (date, format2 = "yyyy", prefix = "", shortNote = true, showNote = true) => {
|
|
2449
|
-
const
|
|
2474
|
+
const used = firstDate(date);
|
|
2475
|
+
const rawDate = commonDateFormatter(used, format2, "");
|
|
2450
2476
|
if (!rawDate) {
|
|
2451
2477
|
return void 0;
|
|
2452
2478
|
}
|
|
2453
|
-
const note =
|
|
2479
|
+
const note = dateNote(used, shortNote);
|
|
2454
2480
|
return `${prefix}${note && showNote ? i18n.t(`${note} {{date}}`, { date: rawDate }) : rawDate}`;
|
|
2455
2481
|
};
|
|
2456
2482
|
var marriageDateFormatter = (fam, showDays = false, showPlaces = false, shortNote = true, showNote = true, showDisplayTextIfNoDate = true, showAllEvents = false, dateFormatPattern) => {
|
|
@@ -2568,11 +2594,12 @@ var dateFormatter = (indi, showMarriages = false, showDays = false, showPlaces =
|
|
|
2568
2594
|
const birthPlaces = [];
|
|
2569
2595
|
const eventsToProcess = showAllEvents ? birthEvents : birthEvents.slice(0, 1);
|
|
2570
2596
|
eventsToProcess.forEach((birthEvent) => {
|
|
2597
|
+
const birthDateNode = firstDate(birthEvent?.DATE);
|
|
2571
2598
|
const birthDate = commonDateFormatter(
|
|
2572
|
-
|
|
2599
|
+
birthDateNode,
|
|
2573
2600
|
showDays ? fullDateFormat : "yyyy"
|
|
2574
2601
|
);
|
|
2575
|
-
const birthEventNote =
|
|
2602
|
+
const birthEventNote = dateNote(birthDateNode, shortNote);
|
|
2576
2603
|
const birthEventPlace = showPlaces ? birthEvent?.PLAC?.value : void 0;
|
|
2577
2604
|
if (birthDate) {
|
|
2578
2605
|
birthStrings.push(
|
|
@@ -2587,11 +2614,12 @@ var dateFormatter = (indi, showMarriages = false, showDays = false, showPlaces =
|
|
|
2587
2614
|
const deathPlaces = [];
|
|
2588
2615
|
const deathEventsToProcess = showAllEvents ? deathEvents : deathEvents.slice(0, 1);
|
|
2589
2616
|
deathEventsToProcess.forEach((deathEvent) => {
|
|
2617
|
+
const deathDateNode = firstDate(deathEvent?.DATE);
|
|
2590
2618
|
const deathDate = commonDateFormatter(
|
|
2591
|
-
|
|
2619
|
+
deathDateNode,
|
|
2592
2620
|
showDays ? fullDateFormat : "yyyy"
|
|
2593
2621
|
);
|
|
2594
|
-
const deathEventNote =
|
|
2622
|
+
const deathEventNote = dateNote(deathDateNode, shortNote);
|
|
2595
2623
|
const deathEventPlace = showPlaces ? deathEvent?.PLAC?.value : void 0;
|
|
2596
2624
|
if (deathDate) {
|
|
2597
2625
|
deathStrings.push(
|
|
@@ -8728,6 +8756,8 @@ var formatDateWithComponents = (date, hasDay, hasMonth, hasYear, noteValue, base
|
|
|
8728
8756
|
var CommonDate = class extends Common {
|
|
8729
8757
|
constructor(gedcom, id, main, parent) {
|
|
8730
8758
|
super(gedcom, id, main, parent);
|
|
8759
|
+
/** One DATE per event — merge must not turn this into a List. */
|
|
8760
|
+
this.isListable = false;
|
|
8731
8761
|
delete this.id;
|
|
8732
8762
|
}
|
|
8733
8763
|
get calendar() {
|
|
@@ -9774,7 +9804,8 @@ var TREEVIZ_EXTENSION_URIS = {
|
|
|
9774
9804
|
_TREEVIZ_SETTINGS: `${TREEVIZ_EXTENSION_BASE_URI}#_TREEVIZ_SETTINGS`,
|
|
9775
9805
|
_TREEVIZ_VIEW: `${TREEVIZ_EXTENSION_BASE_URI}#_TREEVIZ_VIEW`,
|
|
9776
9806
|
_TREEVIZ_DETECTIVE: `${TREEVIZ_EXTENSION_BASE_URI}#_TREEVIZ_DETECTIVE`,
|
|
9777
|
-
_TREEVIZ_DETECTIVE_STATE: `${TREEVIZ_EXTENSION_BASE_URI}#_TREEVIZ_DETECTIVE_STATE
|
|
9807
|
+
_TREEVIZ_DETECTIVE_STATE: `${TREEVIZ_EXTENSION_BASE_URI}#_TREEVIZ_DETECTIVE_STATE`,
|
|
9808
|
+
_TREEVIZ_FS_IGNORE: `${TREEVIZ_EXTENSION_BASE_URI}#_TREEVIZ_FS_IGNORE`
|
|
9778
9809
|
};
|
|
9779
9810
|
var parseTagDefinition = (payload) => {
|
|
9780
9811
|
const trimmed = payload.trim();
|
|
@@ -9908,7 +9939,7 @@ var collectExtensionTagsFrom = (node, into = /* @__PURE__ */ new Set()) => {
|
|
|
9908
9939
|
// package.json
|
|
9909
9940
|
var package_default = {
|
|
9910
9941
|
name: "@treeviz/gedcom-parser",
|
|
9911
|
-
version: "2.1.
|
|
9942
|
+
version: "2.1.17"};
|
|
9912
9943
|
|
|
9913
9944
|
// src/utils/get-product-details.ts
|
|
9914
9945
|
var isDevelopment = () => {
|