compasso 0.1.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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -0
  3. package/dist/chunk-5RRRE2GF.js +1125 -0
  4. package/dist/chunk-5RRRE2GF.js.map +1 -0
  5. package/dist/chunk-E456YKAJ.js +86 -0
  6. package/dist/chunk-E456YKAJ.js.map +1 -0
  7. package/dist/chunk-L5CYESBI.js +208 -0
  8. package/dist/chunk-L5CYESBI.js.map +1 -0
  9. package/dist/core/index.cjs +98 -0
  10. package/dist/core/index.cjs.map +1 -0
  11. package/dist/core/index.d.cts +36 -0
  12. package/dist/core/index.d.ts +36 -0
  13. package/dist/core/index.js +3 -0
  14. package/dist/core/index.js.map +1 -0
  15. package/dist/ecomap/index.cjs +287 -0
  16. package/dist/ecomap/index.cjs.map +1 -0
  17. package/dist/ecomap/index.d.cts +53 -0
  18. package/dist/ecomap/index.d.ts +53 -0
  19. package/dist/ecomap/index.js +4 -0
  20. package/dist/ecomap/index.js.map +1 -0
  21. package/dist/genogram/index.cjs +1222 -0
  22. package/dist/genogram/index.cjs.map +1 -0
  23. package/dist/genogram/index.d.cts +149 -0
  24. package/dist/genogram/index.d.ts +149 -0
  25. package/dist/genogram/index.js +4 -0
  26. package/dist/genogram/index.js.map +1 -0
  27. package/dist/index.cjs +1441 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +5 -0
  30. package/dist/index.d.ts +5 -0
  31. package/dist/index.js +5 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/kinship-BARO5-qz.d.cts +115 -0
  34. package/dist/kinship-Bkf87Jhu.d.ts +115 -0
  35. package/dist/locales/pt-br.cjs +123 -0
  36. package/dist/locales/pt-br.cjs.map +1 -0
  37. package/dist/locales/pt-br.d.cts +11 -0
  38. package/dist/locales/pt-br.d.ts +11 -0
  39. package/dist/locales/pt-br.js +117 -0
  40. package/dist/locales/pt-br.js.map +1 -0
  41. package/dist/stroke-MQ427drt.d.cts +35 -0
  42. package/dist/stroke-MQ427drt.d.ts +35 -0
  43. package/package.json +72 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Victor Canô
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # compasso
2
+
3
+ Standards-faithful relational diagrams as **pure SVG strings**. Deterministic, zero
4
+ runtime dependencies, server-safe (no DOM, no canvas, no clock, no randomness).
5
+
6
+ **v0.1 ships two clinical diagrams:** the **genogram** (McGoldrick family-systems
7
+ notation) and the **ecomap** (radial person↔environment ties). The architecture is
8
+ built for more — see the roadmap.
9
+
10
+ ## Principles
11
+
12
+ - **Pure data → string.** Every renderer is a pure function: same input, same SVG,
13
+ in any runtime (browser, Node, edge, tests).
14
+ - **Honesty rule.** The diagram presents only what the caller declared — no synthesized
15
+ structure (two declared parents without a declared union never merge into a couple),
16
+ no interpretation (a line style is a conservative lexical hint from the author's own
17
+ words; ambiguity abstains to neutral). Verbatim text always rides each element's
18
+ `<title>`.
19
+ - **Overlap-proof by construction.** The genogram layout is a grid of columns, rows,
20
+ gutters and corridors with lane allocation — labels and routed lines cannot collide,
21
+ and a test harness proves it on every commit. No diagonals, no text on edges.
22
+ - **Embedder-safe output.** Numeric `width`/`height` + matching `viewBox`, literal
23
+ presentation attributes (no CSS classes, no `currentColor`, no `<marker>` defs),
24
+ XML-escaped everywhere — safe for `innerHTML` and for SVG-to-PDF pipelines.
25
+ - **Localizable.** English defaults; vocabularies (labels, kinship words, quality
26
+ lexicons) are injectable packs. `compasso/locales/pt-br` ships Brazilian Portuguese.
27
+
28
+ ## Install
29
+
30
+ ```sh
31
+ pnpm add compasso
32
+ ```
33
+
34
+ ## Genogram
35
+
36
+ ```ts
37
+ import { genogramSvg } from "compasso/genogram";
38
+
39
+ const { svg } = genogramSvg({
40
+ people: [
41
+ { id: 1, label: "my mother", sex: "female", deceased: false, generation: -1 },
42
+ { id: 2, label: "my father", sex: "male", deceased: true, generation: -1 },
43
+ { id: 3, label: "me", sex: "unknown", deceased: false, generation: 0 },
44
+ ],
45
+ unions: [{ id: 1, personAId: 1, personBId: 2, status: "divorced", quality: null }],
46
+ parentLinks: [
47
+ { id: 1, parentId: 1, childId: 3, quality: null },
48
+ { id: 2, parentId: 2, childId: 3, quality: "distant for years" },
49
+ ],
50
+ relationships: [],
51
+ });
52
+ ```
53
+
54
+ Union statuses: `married | cohabiting | dating | separated | divorced | coparental |
55
+ unknown` — each drawn with its McGoldrick notation (solid bar, dashed bar, one slash,
56
+ two slashes). A `coparental` union draws **no couple element** at all: the
57
+ co-parenthood shows only on the descents converging on the child.
58
+
59
+ Free-text `relationships` are classified conservatively: derived kinship words
60
+ (sibling, grandparent, uncle…) draw **nothing** (the tree already implies them), direct
61
+ parentage words may be **promoted** to a dotted descent oriented by declared
62
+ generation, everything else stays a non-structural bond line. People left with no
63
+ drawn connection are grouped and labeled, never floated silently.
64
+
65
+ Lower-level entry points: `computeGenogramLayout` (pure layout: nodes, routed
66
+ orthogonal elements, traceable `data-edge-id`s) and `genogramLayoutSvg` (layout →
67
+ string), for callers that decorate, hit-test, or post-process.
68
+
69
+ ## Ecomap
70
+
71
+ ```ts
72
+ import { ecomapSvg } from "compasso/ecomap";
73
+
74
+ const svg = ecomapSvg({
75
+ centerLabel: "Me",
76
+ ties: [
77
+ { id: 1, label: "work", quality: "draining", direction: "out" },
78
+ { id: 2, label: "church", quality: "very close", direction: "in" },
79
+ { id: 3, label: "neighbors", quality: null, direction: null }, // neutral line, no arrow
80
+ ],
81
+ });
82
+ ```
83
+
84
+ Arrowheads appear **only** for a declared `direction` (`"in"` toward the center,
85
+ `"out"` toward the system, `"both"`); `null` draws no arrow — never a default. Large
86
+ sets split onto two alternating rings; node spacing is overlap-proof by construction.
87
+
88
+ ## Localization
89
+
90
+ ```ts
91
+ import { genogramSvg } from "compasso/genogram";
92
+ import {
93
+ GENOGRAM_SVG_LABELS_PT_BR,
94
+ GENOGRAM_TITLE_LABELS_PT_BR,
95
+ KINSHIP_PT_BR,
96
+ QUALITY_LEXICON_PT_BR,
97
+ } from "compasso/locales/pt-br";
98
+
99
+ genogramSvg(input, {
100
+ kinship: KINSHIP_PT_BR,
101
+ qualityLexicon: QUALITY_LEXICON_PT_BR,
102
+ titleLabels: GENOGRAM_TITLE_LABELS_PT_BR,
103
+ svgLabels: GENOGRAM_SVG_LABELS_PT_BR,
104
+ });
105
+ ```
106
+
107
+ A locale pack is plain data — labels, whole-word kinship tokens, quality-word needles
108
+ with a negation list. PRs for new locales are welcome.
109
+
110
+ ## Roadmap
111
+
112
+ The goal is a family of standards-faithful technical diagrams sharing this core
113
+ (text metrics, stroke vocabulary, escaping, legend machinery): tree-based diagrams
114
+ (fault tree, phylogenetic, fishbone), flow/layered diagrams (PRISMA, UML), and
115
+ symbol-library diagrams (P&ID, single-line, ladder logic) — each built from its public
116
+ standard. AST-first; text DSLs may come later.
117
+
118
+ ## Provenance & license
119
+
120
+ MIT © Victor Canô. The genogram engine descends from a production renderer the author
121
+ wrote for a clinical intake product (same copyright holder); the ecomap renderer is
122
+ original to this repository. Developed independently of any third-party diagram
123
+ engine's code.