compasso 0.2.0 → 0.4.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 (77) hide show
  1. package/README.md +126 -7
  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-P2S7AUOL.js → chunk-LRHHUJFZ.js} +3 -3
  7. package/dist/{chunk-P2S7AUOL.js.map → chunk-LRHHUJFZ.js.map} +1 -1
  8. package/dist/{chunk-5B453C4P.js → chunk-O3BT2O42.js} +32 -3
  9. package/dist/chunk-O3BT2O42.js.map +1 -0
  10. package/dist/{chunk-EHQMKVDM.js → chunk-Q6DVTCXD.js} +9 -24
  11. package/dist/chunk-Q6DVTCXD.js.map +1 -0
  12. package/dist/{chunk-5PGOL2KR.js → chunk-RWPGGWO5.js} +9 -28
  13. package/dist/chunk-RWPGGWO5.js.map +1 -0
  14. package/dist/chunk-UJVU7B44.js +764 -0
  15. package/dist/chunk-UJVU7B44.js.map +1 -0
  16. package/dist/{chunk-TP3JOOJW.js → chunk-ZBDABVIO.js} +3 -3
  17. package/dist/{chunk-TP3JOOJW.js.map → chunk-ZBDABVIO.js.map} +1 -1
  18. package/dist/core/index.cjs +30 -0
  19. package/dist/core/index.cjs.map +1 -1
  20. package/dist/core/index.d.cts +5 -1
  21. package/dist/core/index.d.ts +5 -1
  22. package/dist/core/index.js +1 -1
  23. package/dist/ecomap/index.cjs +32 -21
  24. package/dist/ecomap/index.cjs.map +1 -1
  25. package/dist/ecomap/index.js +2 -2
  26. package/dist/fault-tree/index.js +2 -2
  27. package/dist/fishbone/index.js +2 -2
  28. package/dist/genogram/index.cjs +36 -25
  29. package/dist/genogram/index.cjs.map +1 -1
  30. package/dist/genogram/index.d.cts +4 -2
  31. package/dist/genogram/index.d.ts +4 -2
  32. package/dist/genogram/index.js +2 -2
  33. package/dist/index.cjs +2397 -55
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +9 -2
  36. package/dist/index.d.ts +9 -2
  37. package/dist/index.js +8 -5
  38. package/dist/kinship-DqEklrDN.d.ts +51 -0
  39. package/dist/kinship-Dy_ijjJV.d.cts +51 -0
  40. package/dist/labels-CBQ_3Ec9.d.cts +123 -0
  41. package/dist/labels-DNqRkWuI.d.ts +123 -0
  42. package/dist/labels-RtFw9tX1.d.cts +91 -0
  43. package/dist/labels-RtFw9tX1.d.ts +91 -0
  44. package/dist/labels-iZjijjtK.d.cts +64 -0
  45. package/dist/labels-iZjijjtK.d.ts +64 -0
  46. package/dist/locales/pt-br.cjs +77 -0
  47. package/dist/locales/pt-br.cjs.map +1 -1
  48. package/dist/locales/pt-br.d.cts +12 -2
  49. package/dist/locales/pt-br.d.ts +12 -2
  50. package/dist/locales/pt-br.js +72 -1
  51. package/dist/locales/pt-br.js.map +1 -1
  52. package/dist/org-chart/index.cjs +853 -0
  53. package/dist/org-chart/index.cjs.map +1 -0
  54. package/dist/org-chart/index.d.cts +168 -0
  55. package/dist/org-chart/index.d.ts +168 -0
  56. package/dist/org-chart/index.js +4 -0
  57. package/dist/org-chart/index.js.map +1 -0
  58. package/dist/pedigree/index.cjs +1151 -0
  59. package/dist/pedigree/index.cjs.map +1 -0
  60. package/dist/pedigree/index.d.cts +155 -0
  61. package/dist/pedigree/index.d.ts +155 -0
  62. package/dist/pedigree/index.js +4 -0
  63. package/dist/pedigree/index.js.map +1 -0
  64. package/dist/phylo/index.cjs +553 -0
  65. package/dist/phylo/index.cjs.map +1 -0
  66. package/dist/phylo/index.d.cts +158 -0
  67. package/dist/phylo/index.d.ts +158 -0
  68. package/dist/phylo/index.js +4 -0
  69. package/dist/phylo/index.js.map +1 -0
  70. package/dist/types-BnMG7TCd.d.cts +66 -0
  71. package/dist/types-BnMG7TCd.d.ts +66 -0
  72. package/package.json +42 -3
  73. package/dist/chunk-5B453C4P.js.map +0 -1
  74. package/dist/chunk-5PGOL2KR.js.map +0 -1
  75. package/dist/chunk-EHQMKVDM.js.map +0 -1
  76. package/dist/kinship-BARO5-qz.d.cts +0 -115
  77. package/dist/kinship-Bkf87Jhu.d.ts +0 -115
package/README.md CHANGED
@@ -3,10 +3,37 @@
3
3
  Standards-faithful technical diagrams as **pure SVG strings**. Deterministic, zero
4
4
  runtime dependencies, server-safe (no DOM, no canvas, no clock, no randomness).
5
5
 
6
- **Four diagrams shipped:** the **genogram** (McGoldrick family-systems notation), the
6
+ **Seven diagrams shipped:** the **genogram** (McGoldrick family-systems notation), the
7
7
  **ecomap** (radial person↔environment ties), the **fault tree** (NUREG-0492 / IEC 61025
8
- distinctive-shape notation) and the **fishbone** (Ishikawa cause-and-effect). The
9
- architecture is built for more see the roadmap.
8
+ distinctive-shape notation), the **fishbone** (Ishikawa cause-and-effect), the
9
+ **pedigree** (Bennett 2008 standardized clinical-genetics nomenclature), the
10
+ **phylogenetic tree** (cladogram + phylogram) and the **org chart** (top-down reporting
11
+ hierarchy). The architecture is built for more — see the roadmap.
12
+
13
+ ## Gallery
14
+
15
+ Every image below is a committed SVG in [`examples/svg/`](examples/svg) — rendered by the
16
+ current code and pinned byte-for-byte by `test/snapshots/gallery.test.ts`, so the pictures
17
+ can never drift from what compasso emits. Reproduce them all with `pnpm build && node
18
+ examples/demo.mjs`.
19
+
20
+ <table>
21
+ <tr>
22
+ <td align="center" width="50%"><strong>Genogram</strong><br><img src="examples/svg/genogram.svg" alt="genogram example" width="370"></td>
23
+ <td align="center" width="50%"><strong>Ecomap</strong><br><img src="examples/svg/ecomap.svg" alt="ecomap example" width="330"></td>
24
+ </tr>
25
+ <tr>
26
+ <td align="center"><strong>Fault tree</strong><br><img src="examples/svg/fault-tree.svg" alt="fault tree example" width="440"></td>
27
+ <td align="center"><strong>Fishbone</strong><br><img src="examples/svg/fishbone.svg" alt="fishbone example" width="440"></td>
28
+ </tr>
29
+ <tr>
30
+ <td align="center"><strong>Pedigree</strong><br><img src="examples/svg/pedigree.svg" alt="pedigree example" width="270"></td>
31
+ <td align="center"><strong>Phylogenetic tree</strong><br><img src="examples/svg/phylo.svg" alt="phylogenetic tree example" width="400"></td>
32
+ </tr>
33
+ <tr>
34
+ <td align="center" colspan="2"><strong>Org chart</strong><br><img src="examples/svg/org-chart.svg" alt="org chart example" width="470"></td>
35
+ </tr>
36
+ </table>
10
37
 
11
38
  ## Principles
12
39
 
@@ -139,6 +166,93 @@ effect at every level (suppressible via `arrowheads: false`). **Declared order i
139
166
  honored** — significance-near-the-head is the analyst's call, never re-sorted. Label
140
167
  spacing is driven by measured text widths, so labels never collide.
141
168
 
169
+ ## Pedigree
170
+
171
+ ```ts
172
+ import { pedigreeSvg } from "compasso/pedigree";
173
+
174
+ const { svg } = pedigreeSvg({
175
+ conditions: [{ id: 1, label: "Cystic fibrosis" }],
176
+ individuals: [
177
+ { id: 1, label: "I-1", sex: "male", generation: 1, deceased: true, carrier: true, role: null, lifeStatus: "alive", affectedBy: [] },
178
+ { id: 2, label: "I-2", sex: "female", generation: 1, deceased: false, carrier: true, role: null, lifeStatus: "alive", affectedBy: [] },
179
+ { id: 3, label: "II-1", sex: "female", generation: 2, deceased: false, carrier: false, role: "proband", lifeStatus: "alive", affectedBy: [1] },
180
+ ],
181
+ matings: [{ id: 1, partnerAId: 1, partnerBId: 2, consanguineous: false }],
182
+ sibships: [{ id: 1, matingId: 1, childIds: [3], twinGroups: [] }],
183
+ });
184
+ ```
185
+
186
+ Standardized clinical-genetics notation (Bennett et al. 2008): square/circle/diamond by
187
+ sex, **filled glyph = affected** (multiple conditions shown as up to four vertical
188
+ partitions), carrier center dot, deceased slash, **proband filled arrow / consultand
189
+ open arrow**, **consanguineous matings as a double line**, MZ/DZ/unknown-zygosity twins,
190
+ Roman-numeral generations with within-generation "II-3" addresses. A pedigree is a
191
+ clinical record, so structurally invalid input is **refused with coded issues**
192
+ (`PedigreeValidationError`), never silently repaired. The layout is deterministic and
193
+ overlap-proof — including remarriages and multi-spouse hubs.
194
+
195
+ ## Phylogenetic tree
196
+
197
+ ```ts
198
+ import { phyloSvg } from "compasso/phylo";
199
+
200
+ const { svg } = phyloSvg({
201
+ rootId: 1,
202
+ nodes: [
203
+ { id: 1, label: "root" },
204
+ { id: 2, label: "Clade A", support: 98 },
205
+ { id: 3, label: "Homo sapiens" },
206
+ { id: 4, label: "Pan troglodytes" },
207
+ ],
208
+ edges: [
209
+ { id: 1, parentId: 1, childId: 2, length: 0.4 },
210
+ { id: 2, parentId: 2, childId: 3, length: 0.6 },
211
+ { id: 3, parentId: 2, childId: 4, length: 0.55 },
212
+ ],
213
+ }, { mode: "phylogram", showSupport: true });
214
+ ```
215
+
216
+ Rectangular cladogram or phylogram. In `phylogram` mode each node's x is its cumulative
217
+ branch length from the root (fit to width); in `cladogram` mode tips right-align with
218
+ optional dotted extensions. Optional bootstrap/posterior `support` values at clades and a
219
+ distance scale bar (phylogram only). The flat `{rootId, nodes, edges}` AST is
220
+ Newick-importable. Branch lengths are never lost — a `null`/zero length is valid (the
221
+ node sits at its parent's depth), and the verbatim length always rides the branch
222
+ `<title>`.
223
+
224
+ ## Org chart
225
+
226
+ ```ts
227
+ import { orgChartSvg } from "compasso/org-chart";
228
+
229
+ const { svg } = orgChartSvg({
230
+ positions: [
231
+ { id: 1, name: "Alex Mercer", title: "CEO", subtitle: null, vacancy: "filled" },
232
+ { id: 2, name: "Priya Nair", title: "Executive Assistant", subtitle: null, vacancy: "filled" },
233
+ { id: 3, name: "Dana Brooks", title: "VP, Engineering", subtitle: null, vacancy: "filled" },
234
+ { id: 4, name: "", title: "Staff Engineer", subtitle: null, vacancy: "vacant" },
235
+ ],
236
+ reports: [
237
+ { id: 1, managerId: 1, reportId: 2, kind: "assistant" },
238
+ { id: 2, managerId: 1, reportId: 3, kind: "line" },
239
+ { id: 3, managerId: 3, reportId: 4, kind: "line" },
240
+ ],
241
+ });
242
+ ```
243
+
244
+ A top-down reporting hierarchy with a deterministic, overlap-proof tidy-tree layout (fully
245
+ orthogonal — no diagonals). Three reporting kinds: `line` (the solid primary report that
246
+ defines the spine), `assistant` (a staff/EA role on a side-stem), and `dotted` (a secondary
247
+ / matrix line, routed clear of every box). A `vacant` position draws a dashed open-seat box.
248
+ The hierarchy is **read from the declared reports** — there is no depth or order field, and
249
+ multiple roots (a forest) are drawn exactly as declared. An org chart is authoritative, so
250
+ structurally invalid input is **refused with coded issues** (`OrgChartValidationError`:
251
+ `cycle`, `multiple-managers`, `unknown-manager`, …), never silently repaired.
252
+
253
+ Lower-level entry points: `computeOrgChartLayout` (pure layout) and `orgChartLayoutSvg`
254
+ (layout → string).
255
+
142
256
  ## Localization
143
257
 
144
258
  ```ts
@@ -165,10 +279,15 @@ with a negation list. PRs for new locales are welcome.
165
279
 
166
280
  The goal is a family of standards-faithful technical diagrams sharing this core
167
281
  (text metrics, stroke vocabulary, escaping, legend machinery). Shipped: genogram,
168
- ecomap, fault tree, fishbone. Next: more tree-based diagrams (phylogenetic, org
169
- charts), flow/layered diagrams (PRISMA, UML), and symbol-library diagrams (P&ID,
170
- single-line, ladder logic) — each built from its public standard. AST-first; text
171
- DSLs may come later.
282
+ ecomap, fault tree, fishbone, pedigree, phylogenetic tree, org chart. Next: flow/layered
283
+ diagrams (PRISMA, UML), and symbol-library diagrams (P&ID, single-line, ladder logic) —
284
+ each built from its public standard. AST-first; text DSLs may come later.
285
+
286
+ ## Contributing
287
+
288
+ `AGENTS.md` is the contract for changing compasso — the house conventions (pure
289
+ input→SVG, determinism, the honesty rule, the overlap harness, validation doctrine,
290
+ module anatomy). `docs/architecture.md` covers the internal structure.
172
291
 
173
292
  ## Provenance & license
174
293