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.
- package/README.md +126 -8
- package/dist/chunk-F47C6ZEB.js +1041 -0
- package/dist/chunk-F47C6ZEB.js.map +1 -0
- package/dist/chunk-JP4N42AY.js +497 -0
- package/dist/chunk-JP4N42AY.js.map +1 -0
- package/dist/chunk-LRHHUJFZ.js +703 -0
- package/dist/chunk-LRHHUJFZ.js.map +1 -0
- package/dist/{chunk-E456YKAJ.js → chunk-O3BT2O42.js} +69 -10
- package/dist/chunk-O3BT2O42.js.map +1 -0
- package/dist/{chunk-L5CYESBI.js → chunk-Q6DVTCXD.js} +9 -24
- package/dist/chunk-Q6DVTCXD.js.map +1 -0
- package/dist/{chunk-5RRRE2GF.js → chunk-RWPGGWO5.js} +9 -28
- package/dist/chunk-RWPGGWO5.js.map +1 -0
- package/dist/chunk-ZBDABVIO.js +252 -0
- package/dist/chunk-ZBDABVIO.js.map +1 -0
- package/dist/core/index.cjs +74 -7
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +33 -29
- package/dist/core/index.d.ts +33 -29
- package/dist/core/index.js +1 -1
- package/dist/ecomap/index.cjs +43 -28
- package/dist/ecomap/index.cjs.map +1 -1
- package/dist/ecomap/index.js +2 -2
- package/dist/fault-tree/index.cjs +782 -0
- package/dist/fault-tree/index.cjs.map +1 -0
- package/dist/fault-tree/index.d.cts +148 -0
- package/dist/fault-tree/index.d.ts +148 -0
- package/dist/fault-tree/index.js +4 -0
- package/dist/fault-tree/index.js.map +1 -0
- package/dist/fishbone/index.cjs +314 -0
- package/dist/fishbone/index.cjs.map +1 -0
- package/dist/fishbone/index.d.cts +91 -0
- package/dist/fishbone/index.d.ts +91 -0
- package/dist/fishbone/index.js +4 -0
- package/dist/fishbone/index.js.map +1 -0
- package/dist/genogram/index.cjs +47 -32
- package/dist/genogram/index.cjs.map +1 -1
- package/dist/genogram/index.d.cts +7 -4
- package/dist/genogram/index.d.ts +7 -4
- package/dist/genogram/index.js +2 -2
- package/dist/index.cjs +2622 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +7 -3
- package/dist/kinship-DqEklrDN.d.ts +51 -0
- package/dist/kinship-Dy_ijjJV.d.cts +51 -0
- package/dist/labels-CBQ_3Ec9.d.cts +123 -0
- package/dist/labels-CYbM5XV7.d.cts +83 -0
- package/dist/labels-CYbM5XV7.d.ts +83 -0
- package/dist/labels-DNqRkWuI.d.ts +123 -0
- package/dist/labels-iZjijjtK.d.cts +64 -0
- package/dist/labels-iZjijjtK.d.ts +64 -0
- package/dist/locales/pt-br.cjs +94 -0
- package/dist/locales/pt-br.cjs.map +1 -1
- package/dist/locales/pt-br.d.cts +14 -2
- package/dist/locales/pt-br.d.ts +14 -2
- package/dist/locales/pt-br.js +88 -1
- package/dist/locales/pt-br.js.map +1 -1
- package/dist/pedigree/index.cjs +1151 -0
- package/dist/pedigree/index.cjs.map +1 -0
- package/dist/pedigree/index.d.cts +155 -0
- package/dist/pedigree/index.d.ts +155 -0
- package/dist/pedigree/index.js +4 -0
- package/dist/pedigree/index.js.map +1 -0
- package/dist/phylo/index.cjs +553 -0
- package/dist/phylo/index.cjs.map +1 -0
- package/dist/phylo/index.d.cts +158 -0
- package/dist/phylo/index.d.ts +158 -0
- package/dist/phylo/index.js +4 -0
- package/dist/phylo/index.js.map +1 -0
- package/dist/text-DuO_PwYw.d.cts +45 -0
- package/dist/text-DuO_PwYw.d.ts +45 -0
- package/dist/types-BnMG7TCd.d.cts +66 -0
- package/dist/types-BnMG7TCd.d.ts +66 -0
- package/dist/xml-DDae1eUr.d.cts +4 -0
- package/dist/xml-DDae1eUr.d.ts +4 -0
- package/package.json +100 -26
- package/dist/chunk-5RRRE2GF.js.map +0 -1
- package/dist/chunk-E456YKAJ.js.map +0 -1
- package/dist/chunk-L5CYESBI.js.map +0 -1
- package/dist/kinship-BARO5-qz.d.cts +0 -115
- package/dist/kinship-Bkf87Jhu.d.ts +0 -115
package/README.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# compasso
|
|
2
2
|
|
|
3
|
-
Standards-faithful
|
|
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
|
-
**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
**Six diagrams shipped:** the **genogram** (McGoldrick family-systems notation), the
|
|
7
|
+
**ecomap** (radial person↔environment ties), the **fault tree** (NUREG-0492 / IEC 61025
|
|
8
|
+
distinctive-shape notation), the **fishbone** (Ishikawa cause-and-effect), the
|
|
9
|
+
**pedigree** (Bennett 2008 standardized clinical-genetics nomenclature) and the
|
|
10
|
+
**phylogenetic tree** (cladogram + phylogram). The architecture is built for more —
|
|
11
|
+
see the roadmap.
|
|
9
12
|
|
|
10
13
|
## Principles
|
|
11
14
|
|
|
@@ -85,6 +88,114 @@ Arrowheads appear **only** for a declared `direction` (`"in"` toward the center,
|
|
|
85
88
|
`"out"` toward the system, `"both"`); `null` draws no arrow — never a default. Large
|
|
86
89
|
sets split onto two alternating rings; node spacing is overlap-proof by construction.
|
|
87
90
|
|
|
91
|
+
## Fault tree
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { faultTreeSvg } from "compasso/fault-tree";
|
|
95
|
+
|
|
96
|
+
const { svg, layout } = faultTreeSvg({
|
|
97
|
+
topId: 1,
|
|
98
|
+
events: [
|
|
99
|
+
{ id: 1, kind: "intermediate", label: "Pump system fails", code: "TOP" },
|
|
100
|
+
{ id: 2, kind: "basic", label: "Motor winding failure", code: "B1" },
|
|
101
|
+
{ id: 3, kind: "undeveloped", label: "Control logic fault", code: "U1" },
|
|
102
|
+
],
|
|
103
|
+
gates: [{ id: 1, type: "or", eventId: 1, inputIds: [2, 3] }],
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
NUREG-0492 distinctive shapes: rectangles (intermediate events), circles (basic),
|
|
108
|
+
diamonds (undeveloped), house (expected external events), oval (conditioning events
|
|
109
|
+
attached to INHIBIT gates), transfer triangles. Gates: `and | or | xor | inhibit |
|
|
110
|
+
vote` (k-of-n, drawn with its threshold). The layout is deterministic, orthogonal and
|
|
111
|
+
overlap-proof (proven by its own test harness).
|
|
112
|
+
|
|
113
|
+
A fault tree is a **logic artifact**, so structurally invalid input is **refused**, not
|
|
114
|
+
repaired: `faultTreeSvg` throws `FaultTreeValidationError` listing **every** issue with
|
|
115
|
+
a stable machine-readable `code` (`event-without-gate`, `cycle`, `unknown-input`, …).
|
|
116
|
+
Honest incompleteness has standard notation instead — that's what `undeveloped` and
|
|
117
|
+
`transfer` are for.
|
|
118
|
+
|
|
119
|
+
## Fishbone
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { fishboneSvg } from "compasso/fishbone";
|
|
123
|
+
|
|
124
|
+
const svg = fishboneSvg({
|
|
125
|
+
effectLabel: "Late deliveries",
|
|
126
|
+
categories: [
|
|
127
|
+
{
|
|
128
|
+
id: 1,
|
|
129
|
+
label: "People",
|
|
130
|
+
causes: [
|
|
131
|
+
{ id: 1, label: "Driver shortage", subCauses: [{ id: 1, label: "High turnover" }] },
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Classic Ishikawa: spine into the effect head, category bones alternating above/below,
|
|
139
|
+
horizontal cause twigs, one level of sub-causes, arrowheads converging toward the
|
|
140
|
+
effect at every level (suppressible via `arrowheads: false`). **Declared order is
|
|
141
|
+
honored** — significance-near-the-head is the analyst's call, never re-sorted. Label
|
|
142
|
+
spacing is driven by measured text widths, so labels never collide.
|
|
143
|
+
|
|
144
|
+
## Pedigree
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
import { pedigreeSvg } from "compasso/pedigree";
|
|
148
|
+
|
|
149
|
+
const { svg } = pedigreeSvg({
|
|
150
|
+
conditions: [{ id: 1, label: "Cystic fibrosis" }],
|
|
151
|
+
individuals: [
|
|
152
|
+
{ id: 1, label: "I-1", sex: "male", generation: 1, deceased: true, carrier: true, role: null, lifeStatus: "alive", affectedBy: [] },
|
|
153
|
+
{ id: 2, label: "I-2", sex: "female", generation: 1, deceased: false, carrier: true, role: null, lifeStatus: "alive", affectedBy: [] },
|
|
154
|
+
{ id: 3, label: "II-1", sex: "female", generation: 2, deceased: false, carrier: false, role: "proband", lifeStatus: "alive", affectedBy: [1] },
|
|
155
|
+
],
|
|
156
|
+
matings: [{ id: 1, partnerAId: 1, partnerBId: 2, consanguineous: false }],
|
|
157
|
+
sibships: [{ id: 1, matingId: 1, childIds: [3], twinGroups: [] }],
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Standardized clinical-genetics notation (Bennett et al. 2008): square/circle/diamond by
|
|
162
|
+
sex, **filled glyph = affected** (multiple conditions shown as up to four vertical
|
|
163
|
+
partitions), carrier center dot, deceased slash, **proband filled arrow / consultand
|
|
164
|
+
open arrow**, **consanguineous matings as a double line**, MZ/DZ/unknown-zygosity twins,
|
|
165
|
+
Roman-numeral generations with within-generation "II-3" addresses. A pedigree is a
|
|
166
|
+
clinical record, so structurally invalid input is **refused with coded issues**
|
|
167
|
+
(`PedigreeValidationError`), never silently repaired. The layout is deterministic and
|
|
168
|
+
overlap-proof — including remarriages and multi-spouse hubs.
|
|
169
|
+
|
|
170
|
+
## Phylogenetic tree
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
import { phyloSvg } from "compasso/phylo";
|
|
174
|
+
|
|
175
|
+
const { svg } = phyloSvg({
|
|
176
|
+
rootId: 1,
|
|
177
|
+
nodes: [
|
|
178
|
+
{ id: 1, label: "root" },
|
|
179
|
+
{ id: 2, label: "Clade A", support: 98 },
|
|
180
|
+
{ id: 3, label: "Homo sapiens" },
|
|
181
|
+
{ id: 4, label: "Pan troglodytes" },
|
|
182
|
+
],
|
|
183
|
+
edges: [
|
|
184
|
+
{ id: 1, parentId: 1, childId: 2, length: 0.4 },
|
|
185
|
+
{ id: 2, parentId: 2, childId: 3, length: 0.6 },
|
|
186
|
+
{ id: 3, parentId: 2, childId: 4, length: 0.55 },
|
|
187
|
+
],
|
|
188
|
+
}, { mode: "phylogram", showSupport: true });
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Rectangular cladogram or phylogram. In `phylogram` mode each node's x is its cumulative
|
|
192
|
+
branch length from the root (fit to width); in `cladogram` mode tips right-align with
|
|
193
|
+
optional dotted extensions. Optional bootstrap/posterior `support` values at clades and a
|
|
194
|
+
distance scale bar (phylogram only). The flat `{rootId, nodes, edges}` AST is
|
|
195
|
+
Newick-importable. Branch lengths are never lost — a `null`/zero length is valid (the
|
|
196
|
+
node sits at its parent's depth), and the verbatim length always rides the branch
|
|
197
|
+
`<title>`.
|
|
198
|
+
|
|
88
199
|
## Localization
|
|
89
200
|
|
|
90
201
|
```ts
|
|
@@ -110,10 +221,17 @@ with a negation list. PRs for new locales are welcome.
|
|
|
110
221
|
## Roadmap
|
|
111
222
|
|
|
112
223
|
The goal is a family of standards-faithful technical diagrams sharing this core
|
|
113
|
-
(text metrics, stroke vocabulary, escaping, legend machinery):
|
|
114
|
-
|
|
115
|
-
symbol-library diagrams (P&ID, single-line, ladder
|
|
116
|
-
standard. AST-first; text DSLs may come later.
|
|
224
|
+
(text metrics, stroke vocabulary, escaping, legend machinery). Shipped: genogram,
|
|
225
|
+
ecomap, fault tree, fishbone, pedigree, phylogenetic tree. Next: org charts, flow/
|
|
226
|
+
layered diagrams (PRISMA, UML), and symbol-library diagrams (P&ID, single-line, ladder
|
|
227
|
+
logic) — each built from its public standard. AST-first; text DSLs may come later.
|
|
228
|
+
|
|
229
|
+
## Contributing
|
|
230
|
+
|
|
231
|
+
`AGENTS.md` is the contract for changing compasso (the house conventions: pure
|
|
232
|
+
input→SVG, determinism, the honesty rule, the overlap harness, validation doctrine,
|
|
233
|
+
module anatomy). `docs/architecture.md` covers the internal structure and `docs/design/`
|
|
234
|
+
the per-module design rationale.
|
|
117
235
|
|
|
118
236
|
## Provenance & license
|
|
119
237
|
|