compasso 0.1.0 → 0.3.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 (83) hide show
  1. package/README.md +126 -8
  2. package/dist/chunk-F47C6ZEB.js +1041 -0
  3. package/dist/chunk-F47C6ZEB.js.map +1 -0
  4. package/dist/chunk-JP4N42AY.js +497 -0
  5. package/dist/chunk-JP4N42AY.js.map +1 -0
  6. package/dist/chunk-LRHHUJFZ.js +703 -0
  7. package/dist/chunk-LRHHUJFZ.js.map +1 -0
  8. package/dist/{chunk-E456YKAJ.js → chunk-O3BT2O42.js} +69 -10
  9. package/dist/chunk-O3BT2O42.js.map +1 -0
  10. package/dist/{chunk-L5CYESBI.js → chunk-Q6DVTCXD.js} +9 -24
  11. package/dist/chunk-Q6DVTCXD.js.map +1 -0
  12. package/dist/{chunk-5RRRE2GF.js → chunk-RWPGGWO5.js} +9 -28
  13. package/dist/chunk-RWPGGWO5.js.map +1 -0
  14. package/dist/chunk-ZBDABVIO.js +252 -0
  15. package/dist/chunk-ZBDABVIO.js.map +1 -0
  16. package/dist/core/index.cjs +74 -7
  17. package/dist/core/index.cjs.map +1 -1
  18. package/dist/core/index.d.cts +33 -29
  19. package/dist/core/index.d.ts +33 -29
  20. package/dist/core/index.js +1 -1
  21. package/dist/ecomap/index.cjs +43 -28
  22. package/dist/ecomap/index.cjs.map +1 -1
  23. package/dist/ecomap/index.js +2 -2
  24. package/dist/fault-tree/index.cjs +782 -0
  25. package/dist/fault-tree/index.cjs.map +1 -0
  26. package/dist/fault-tree/index.d.cts +148 -0
  27. package/dist/fault-tree/index.d.ts +148 -0
  28. package/dist/fault-tree/index.js +4 -0
  29. package/dist/fault-tree/index.js.map +1 -0
  30. package/dist/fishbone/index.cjs +314 -0
  31. package/dist/fishbone/index.cjs.map +1 -0
  32. package/dist/fishbone/index.d.cts +91 -0
  33. package/dist/fishbone/index.d.ts +91 -0
  34. package/dist/fishbone/index.js +4 -0
  35. package/dist/fishbone/index.js.map +1 -0
  36. package/dist/genogram/index.cjs +47 -32
  37. package/dist/genogram/index.cjs.map +1 -1
  38. package/dist/genogram/index.d.cts +7 -4
  39. package/dist/genogram/index.d.ts +7 -4
  40. package/dist/genogram/index.js +2 -2
  41. package/dist/index.cjs +2622 -55
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.cts +12 -2
  44. package/dist/index.d.ts +12 -2
  45. package/dist/index.js +7 -3
  46. package/dist/kinship-DqEklrDN.d.ts +51 -0
  47. package/dist/kinship-Dy_ijjJV.d.cts +51 -0
  48. package/dist/labels-CBQ_3Ec9.d.cts +123 -0
  49. package/dist/labels-CYbM5XV7.d.cts +83 -0
  50. package/dist/labels-CYbM5XV7.d.ts +83 -0
  51. package/dist/labels-DNqRkWuI.d.ts +123 -0
  52. package/dist/labels-iZjijjtK.d.cts +64 -0
  53. package/dist/labels-iZjijjtK.d.ts +64 -0
  54. package/dist/locales/pt-br.cjs +94 -0
  55. package/dist/locales/pt-br.cjs.map +1 -1
  56. package/dist/locales/pt-br.d.cts +14 -2
  57. package/dist/locales/pt-br.d.ts +14 -2
  58. package/dist/locales/pt-br.js +88 -1
  59. package/dist/locales/pt-br.js.map +1 -1
  60. package/dist/pedigree/index.cjs +1151 -0
  61. package/dist/pedigree/index.cjs.map +1 -0
  62. package/dist/pedigree/index.d.cts +155 -0
  63. package/dist/pedigree/index.d.ts +155 -0
  64. package/dist/pedigree/index.js +4 -0
  65. package/dist/pedigree/index.js.map +1 -0
  66. package/dist/phylo/index.cjs +553 -0
  67. package/dist/phylo/index.cjs.map +1 -0
  68. package/dist/phylo/index.d.cts +158 -0
  69. package/dist/phylo/index.d.ts +158 -0
  70. package/dist/phylo/index.js +4 -0
  71. package/dist/phylo/index.js.map +1 -0
  72. package/dist/text-DuO_PwYw.d.cts +45 -0
  73. package/dist/text-DuO_PwYw.d.ts +45 -0
  74. package/dist/types-BnMG7TCd.d.cts +66 -0
  75. package/dist/types-BnMG7TCd.d.ts +66 -0
  76. package/dist/xml-DDae1eUr.d.cts +4 -0
  77. package/dist/xml-DDae1eUr.d.ts +4 -0
  78. package/package.json +100 -26
  79. package/dist/chunk-5RRRE2GF.js.map +0 -1
  80. package/dist/chunk-E456YKAJ.js.map +0 -1
  81. package/dist/chunk-L5CYESBI.js.map +0 -1
  82. package/dist/kinship-BARO5-qz.d.cts +0 -115
  83. package/dist/kinship-Bkf87Jhu.d.ts +0 -115
@@ -0,0 +1,155 @@
1
+ import { c as PedigreeInput, d as PedigreeRole, Z as Zygosity, f as PedigreeTitleLabels, e as PedigreeSvgLabels } from '../labels-DNqRkWuI.js';
2
+ export { C as Condition, I as Individual, L as LIFE_STATUSES, a as LifeStatus, M as Mating, P as PEDIGREE_SVG_LABELS_EN, b as PEDIGREE_TITLE_LABELS_EN, S as Sibship, T as TwinGroup } from '../labels-DNqRkWuI.js';
3
+ import { P as Point } from '../text-DuO_PwYw.js';
4
+ export { e as estimateTextWidth } from '../text-DuO_PwYw.js';
5
+ import { N as NodeShape } from '../types-BnMG7TCd.js';
6
+ export { b as PersonSex } from '../types-BnMG7TCd.js';
7
+
8
+ /** Stable machine-readable issue codes (kebab-case; part of the public contract). */
9
+ type PedigreeIssueCode = "duplicate-id" | "unknown-partner" | "self-mating" | "unknown-sibship-mating" | "unknown-child" | "child-of-two-sibships" | "twin-not-in-sibship" | "twin-group-too-small" | "twin-group-not-contiguous" | "generation-not-integer" | "unknown-condition" | "too-many-conditions" | "generation-inversion";
10
+ interface PedigreeIssue {
11
+ code: PedigreeIssueCode;
12
+ message: string;
13
+ }
14
+ /** Thrown by computePedigreeLayout / pedigreeSvg on a structurally invalid pedigree. */
15
+ declare class PedigreeValidationError extends Error {
16
+ readonly issues: readonly PedigreeIssue[];
17
+ constructor(issues: readonly PedigreeIssue[]);
18
+ }
19
+ /** The PSSC quadrant cap: ≤4 conditions partition a glyph; beyond that needs a key/table. */
20
+ declare const MAX_CONDITIONS_PER_INDIVIDUAL = 4;
21
+ /**
22
+ * Computes ALL validation issues for the input, deduplicated and deterministically sorted
23
+ * (code, then message) — array order of individuals/matings/sibships never changes the
24
+ * result. Empty input (no individuals AND no matings AND no sibships) is valid by
25
+ * definition (the renderer's empty-but-valid SVG case) and reports no issues.
26
+ */
27
+ declare function pedigreeIssues(input: PedigreeInput): readonly PedigreeIssue[];
28
+ /** Throws PedigreeValidationError (carrying ALL issues) when the input is invalid. */
29
+ declare function validatePedigree(input: PedigreeInput): void;
30
+
31
+ /** Glyph side length / diameter (px). */
32
+ declare const PED_GLYPH = 40;
33
+ /** Node label font size (px). */
34
+ declare const PED_LABEL_FONT = 12;
35
+ /** Line height for stacked label lines (px). */
36
+ declare const PED_LABEL_LINE_H = 14;
37
+ /** Font size for the "II-3" within-generation address drawn under each glyph. */
38
+ declare const PED_ADDRESS_FONT = 10;
39
+ /** Gap from a glyph's bottom to the top of its first label line. */
40
+ declare const PED_LABEL_GAP = 6;
41
+ declare const PED_MATING_ID_BASE = 1000000;
42
+ declare const PED_DESCENT_ID_BASE = 2000000;
43
+ declare const PED_SIBBAR_ID_BASE = 3000000;
44
+ declare const PED_RISER_ID_BASE = 4000000;
45
+ declare const PED_TWINBAR_ID_BASE = 5000000;
46
+ interface PedigreeNode {
47
+ individualId: number;
48
+ shape: NodeShape;
49
+ cx: number;
50
+ cy: number;
51
+ size: number;
52
+ deceased: boolean;
53
+ carrier: boolean;
54
+ role: PedigreeRole;
55
+ stillbirth: boolean;
56
+ /** Condition ids in declared order → vertical fill partitions (≤4); [] = unaffected. */
57
+ affectedBy: number[];
58
+ labelLines: string[];
59
+ /** Top of the first label line's box (below the glyph). */
60
+ labelTop: number;
61
+ /** "II-3" within-generation address. */
62
+ addressLabel: string;
63
+ /** Verbatim <title> text (never truncated). */
64
+ title: string;
65
+ }
66
+ type PedigreeElementKind = "mating" | "mating-elbow" | "descent" | "sibship-bar" | "riser" | "twin-bar";
67
+ interface PedigreeElement {
68
+ /** Namespaced id (PED_*_ID_BASE + …). */
69
+ edgeId: number;
70
+ kind: PedigreeElementKind;
71
+ /** Every consecutive pair axis-aligned. */
72
+ points: Point[];
73
+ /** mating: draw a second parallel line (the PSSC consanguineous double line). */
74
+ consanguineous: boolean;
75
+ title: string;
76
+ }
77
+ /** Roman label + the y of a generation row (the left-margin gutter). */
78
+ interface PedigreeGenerationLabel {
79
+ roman: string;
80
+ y: number;
81
+ }
82
+ interface PedigreeLayout {
83
+ width: number;
84
+ height: number;
85
+ nodes: PedigreeNode[];
86
+ elements: PedigreeElement[];
87
+ generations: PedigreeGenerationLabel[];
88
+ /** Used condition ids in declared order → assigned fill ink + verbatim label (the legend
89
+ * keys these; label kept here so the emitter never re-derives it from a node title). */
90
+ conditionFills: {
91
+ id: number;
92
+ ink: string;
93
+ label: string;
94
+ }[];
95
+ /** Twin zygosities actually used (drives the used-keys-only legend). */
96
+ twinZygositiesUsed: Zygosity[];
97
+ /** Junction points of unknown-zygosity twin groups — the emitter draws a "?" at each. */
98
+ unknownTwinJunctions: Point[];
99
+ /** Individuals in no mating and no sibship — grouped + drawn aside (genogram precedent). */
100
+ isolatedIndividualIds: number[];
101
+ }
102
+ interface PedigreeLayoutOptions {
103
+ /** Cap each node's DISPLAY label (compact preview); verbatim text stays in `title`. */
104
+ maxLabelChars?: number;
105
+ /** Locale pack for <title>s — English default; see locale packs. */
106
+ titleLabels?: PedigreeTitleLabels;
107
+ }
108
+ /**
109
+ * Fixed condition fill ramp — the existing zinc ink array (NO new palette, §1.7). At most
110
+ * 4 conditions are ever drawn (the PSSC quadrant cap, enforced in ./validate.ts), so 4
111
+ * distinct, decodable solids suffice; the legend keys each one.
112
+ */
113
+ declare const PED_CONDITION_FILLS: readonly ["#52525b", "#a1a1aa", "#3f3f46", "#71717a"];
114
+ /**
115
+ * Deterministic, overlap-proof pedigree layout (pure function of the inputs). Validates
116
+ * first and THROWS PedigreeValidationError on a structurally invalid pedigree — never
117
+ * sanitizes. Empty input yields an empty, padded layout.
118
+ */
119
+ declare function computePedigreeLayout(input: PedigreeInput, opts?: PedigreeLayoutOptions): PedigreeLayout;
120
+
121
+ interface PedigreeSvgOptions {
122
+ /** Set false to suppress the legend (compact preview); default true. */
123
+ legend?: boolean;
124
+ /** Display vocabulary (legend/accessibility) — English default; see locale packs. */
125
+ labels?: PedigreeSvgLabels;
126
+ }
127
+ /**
128
+ * Emits a self-contained SVG for a computed pedigree layout. Pure + deterministic.
129
+ * Coordinates come straight from the layout; all interpolated text is XML-escaped; all
130
+ * presentation attributes are literal. The legend lists ONLY the features actually used.
131
+ */
132
+ declare function pedigreeLayoutSvg(layout: PedigreeLayout, opts?: PedigreeSvgOptions): string;
133
+
134
+ interface PedigreeRenderOptions extends PedigreeLayoutOptions {
135
+ /** Set false to suppress the legend (compact preview); default true. */
136
+ legend?: boolean;
137
+ /** Display vocabulary for the emitter (legend/accessibility) — English default. */
138
+ svgLabels?: PedigreeSvgLabels;
139
+ }
140
+ interface PedigreeRenderResult {
141
+ /** Self-contained SVG (numeric width/height + matching viewBox — PDF-embedder safe). */
142
+ svg: string;
143
+ /** The computed layout, for callers that decorate or hit-test the diagram. */
144
+ layout: PedigreeLayout;
145
+ }
146
+ /**
147
+ * Renders a pedigree input to a self-contained SVG string. Deterministic: same data → same
148
+ * SVG (array order never matters; a sibship's `childIds` order is honored as the declared
149
+ * left-to-right birth order). Throws PedigreeValidationError — carrying EVERY issue,
150
+ * deterministically sorted — on a structurally invalid pedigree. Empty input yields an
151
+ * empty-but-valid SVG; callers decide their own empty state.
152
+ */
153
+ declare function pedigreeSvg(input: PedigreeInput, opts?: PedigreeRenderOptions): PedigreeRenderResult;
154
+
155
+ export { MAX_CONDITIONS_PER_INDIVIDUAL, NodeShape, PED_ADDRESS_FONT, PED_CONDITION_FILLS, PED_DESCENT_ID_BASE, PED_GLYPH, PED_LABEL_FONT, PED_LABEL_GAP, PED_LABEL_LINE_H, PED_MATING_ID_BASE, PED_RISER_ID_BASE, PED_SIBBAR_ID_BASE, PED_TWINBAR_ID_BASE, type PedigreeElement, type PedigreeElementKind, type PedigreeGenerationLabel, PedigreeInput, type PedigreeIssue, type PedigreeIssueCode, type PedigreeLayout, type PedigreeLayoutOptions, type PedigreeNode, type PedigreeRenderOptions, type PedigreeRenderResult, PedigreeRole, PedigreeSvgLabels, type PedigreeSvgOptions, PedigreeTitleLabels, PedigreeValidationError, Point, Zygosity, computePedigreeLayout, pedigreeIssues, pedigreeLayoutSvg, pedigreeSvg, validatePedigree };
@@ -0,0 +1,4 @@
1
+ export { LIFE_STATUSES, MAX_CONDITIONS_PER_INDIVIDUAL, PEDIGREE_SVG_LABELS_EN, PEDIGREE_TITLE_LABELS_EN, PED_ADDRESS_FONT, PED_CONDITION_FILLS, PED_DESCENT_ID_BASE, PED_GLYPH, PED_LABEL_FONT, PED_LABEL_GAP, PED_LABEL_LINE_H, PED_MATING_ID_BASE, PED_RISER_ID_BASE, PED_SIBBAR_ID_BASE, PED_TWINBAR_ID_BASE, PedigreeValidationError, computePedigreeLayout, pedigreeIssues, pedigreeLayoutSvg, pedigreeSvg, validatePedigree } from '../chunk-F47C6ZEB.js';
2
+ export { estimateTextWidth } from '../chunk-O3BT2O42.js';
3
+ //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}