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,66 @@
1
+ /** Sex marker for a genogram node (standard notation: square/circle/diamond). */
2
+ type PersonSex = "male" | "female" | "unknown";
3
+ /** A genogram node. `generation` is relative (0 = index person; negative = older). */
4
+ interface Person {
5
+ id: number;
6
+ label: string;
7
+ sex: PersonSex;
8
+ deceased: boolean;
9
+ generation: number | null;
10
+ }
11
+ /**
12
+ * CLOSED status vocabulary for a declared union. Notable semantics:
13
+ * - "coparental": the two were NEVER a couple and have child(ren) together;
14
+ * - "unknown": a union was declared, but its type was not;
15
+ * - widowhood is NOT a status — death lives on Person.deceased and never
16
+ * alters the declared status;
17
+ * - no value for "not stated": the union simply is not passed in.
18
+ */
19
+ declare const UNION_STATUSES: readonly ["married", "cohabiting", "dating", "separated", "divorced", "coparental", "unknown"];
20
+ type UnionStatus = (typeof UNION_STATUSES)[number];
21
+ /**
22
+ * A declared couple bond between two people. The pair is unordered and expected
23
+ * normalized to personAId < personBId with ONE union per pair (duplicates are the
24
+ * caller's to resolve). `quality` is the author's verbatim wording about the bond.
25
+ */
26
+ interface Union {
27
+ id: number;
28
+ /** Always the smaller person id (normalized pair). */
29
+ personAId: number;
30
+ personBId: number;
31
+ status: UnionStatus;
32
+ quality: string | null;
33
+ }
34
+ /**
35
+ * A declared parentage link: parent → child, one row PER DECLARED genitor (two
36
+ * genitors = two links, each individually stated — never promoted from a union).
37
+ */
38
+ interface ParentLink {
39
+ id: number;
40
+ parentId: number;
41
+ childId: number;
42
+ quality: string | null;
43
+ }
44
+ /**
45
+ * A typed free-text edge between two people. `type` and `quality` are verbatim
46
+ * labels. This carries NON-STRUCTURAL ties only (closeness, conflict…) — unions
47
+ * and parentage are first-class above.
48
+ */
49
+ interface Relationship {
50
+ id: number;
51
+ fromPersonId: number;
52
+ toPersonId: number;
53
+ type: string;
54
+ quality: string | null;
55
+ }
56
+ /** Input to the genogram render pipeline. */
57
+ interface GenogramInput {
58
+ people: Person[];
59
+ unions: Union[];
60
+ parentLinks: ParentLink[];
61
+ relationships: Relationship[];
62
+ }
63
+ /** Node glyph shapes (standard notation: square = male, circle = female, diamond = unknown). */
64
+ type NodeShape = "square" | "circle" | "diamond";
65
+
66
+ export { type GenogramInput as G, type NodeShape as N, type ParentLink as P, type Relationship as R, UNION_STATUSES as U, type Person as a, type PersonSex as b, type Union as c, type UnionStatus as d };
@@ -0,0 +1,66 @@
1
+ /** Sex marker for a genogram node (standard notation: square/circle/diamond). */
2
+ type PersonSex = "male" | "female" | "unknown";
3
+ /** A genogram node. `generation` is relative (0 = index person; negative = older). */
4
+ interface Person {
5
+ id: number;
6
+ label: string;
7
+ sex: PersonSex;
8
+ deceased: boolean;
9
+ generation: number | null;
10
+ }
11
+ /**
12
+ * CLOSED status vocabulary for a declared union. Notable semantics:
13
+ * - "coparental": the two were NEVER a couple and have child(ren) together;
14
+ * - "unknown": a union was declared, but its type was not;
15
+ * - widowhood is NOT a status — death lives on Person.deceased and never
16
+ * alters the declared status;
17
+ * - no value for "not stated": the union simply is not passed in.
18
+ */
19
+ declare const UNION_STATUSES: readonly ["married", "cohabiting", "dating", "separated", "divorced", "coparental", "unknown"];
20
+ type UnionStatus = (typeof UNION_STATUSES)[number];
21
+ /**
22
+ * A declared couple bond between two people. The pair is unordered and expected
23
+ * normalized to personAId < personBId with ONE union per pair (duplicates are the
24
+ * caller's to resolve). `quality` is the author's verbatim wording about the bond.
25
+ */
26
+ interface Union {
27
+ id: number;
28
+ /** Always the smaller person id (normalized pair). */
29
+ personAId: number;
30
+ personBId: number;
31
+ status: UnionStatus;
32
+ quality: string | null;
33
+ }
34
+ /**
35
+ * A declared parentage link: parent → child, one row PER DECLARED genitor (two
36
+ * genitors = two links, each individually stated — never promoted from a union).
37
+ */
38
+ interface ParentLink {
39
+ id: number;
40
+ parentId: number;
41
+ childId: number;
42
+ quality: string | null;
43
+ }
44
+ /**
45
+ * A typed free-text edge between two people. `type` and `quality` are verbatim
46
+ * labels. This carries NON-STRUCTURAL ties only (closeness, conflict…) — unions
47
+ * and parentage are first-class above.
48
+ */
49
+ interface Relationship {
50
+ id: number;
51
+ fromPersonId: number;
52
+ toPersonId: number;
53
+ type: string;
54
+ quality: string | null;
55
+ }
56
+ /** Input to the genogram render pipeline. */
57
+ interface GenogramInput {
58
+ people: Person[];
59
+ unions: Union[];
60
+ parentLinks: ParentLink[];
61
+ relationships: Relationship[];
62
+ }
63
+ /** Node glyph shapes (standard notation: square = male, circle = female, diamond = unknown). */
64
+ type NodeShape = "square" | "circle" | "diamond";
65
+
66
+ export { type GenogramInput as G, type NodeShape as N, type ParentLink as P, type Relationship as R, UNION_STATUSES as U, type Person as a, type PersonSex as b, type Union as c, type UnionStatus as d };
@@ -0,0 +1,4 @@
1
+ /** Escapes a string for use in SVG/XML text content AND attribute values. */
2
+ declare function xmlEscape(text: string): string;
3
+
4
+ export { xmlEscape as x };
@@ -0,0 +1,4 @@
1
+ /** Escapes a string for use in SVG/XML text content AND attribute values. */
2
+ declare function xmlEscape(text: string): string;
3
+
4
+ export { xmlEscape as x };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "compasso",
3
- "version": "0.1.0",
4
- "description": "Standards-faithful relational diagrams (genogram, ecomap) as pure SVG strings. Deterministic, zero dependencies, server-safe.",
3
+ "version": "0.3.0",
4
+ "description": "Standards-faithful relational and analytical diagrams (genogram, ecomap, fault tree, fishbone, pedigree, phylogenetic tree) as pure SVG strings. Deterministic, zero dependencies, server-safe.",
5
5
  "license": "MIT",
6
6
  "author": "Victor Canô",
7
7
  "repository": {
@@ -15,44 +15,110 @@
15
15
  "types": "./dist/index.d.ts",
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/index.d.ts",
19
- "import": "./dist/index.js",
20
- "require": "./dist/index.cjs"
18
+ "import": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "require": {
23
+ "types": "./dist/index.d.cts",
24
+ "default": "./dist/index.cjs"
25
+ }
21
26
  },
22
27
  "./core": {
23
- "types": "./dist/core/index.d.ts",
24
- "import": "./dist/core/index.js",
25
- "require": "./dist/core/index.cjs"
28
+ "import": {
29
+ "types": "./dist/core/index.d.ts",
30
+ "default": "./dist/core/index.js"
31
+ },
32
+ "require": {
33
+ "types": "./dist/core/index.d.cts",
34
+ "default": "./dist/core/index.cjs"
35
+ }
26
36
  },
27
37
  "./genogram": {
28
- "types": "./dist/genogram/index.d.ts",
29
- "import": "./dist/genogram/index.js",
30
- "require": "./dist/genogram/index.cjs"
38
+ "import": {
39
+ "types": "./dist/genogram/index.d.ts",
40
+ "default": "./dist/genogram/index.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/genogram/index.d.cts",
44
+ "default": "./dist/genogram/index.cjs"
45
+ }
31
46
  },
32
47
  "./ecomap": {
33
- "types": "./dist/ecomap/index.d.ts",
34
- "import": "./dist/ecomap/index.js",
35
- "require": "./dist/ecomap/index.cjs"
48
+ "import": {
49
+ "types": "./dist/ecomap/index.d.ts",
50
+ "default": "./dist/ecomap/index.js"
51
+ },
52
+ "require": {
53
+ "types": "./dist/ecomap/index.d.cts",
54
+ "default": "./dist/ecomap/index.cjs"
55
+ }
56
+ },
57
+ "./fault-tree": {
58
+ "import": {
59
+ "types": "./dist/fault-tree/index.d.ts",
60
+ "default": "./dist/fault-tree/index.js"
61
+ },
62
+ "require": {
63
+ "types": "./dist/fault-tree/index.d.cts",
64
+ "default": "./dist/fault-tree/index.cjs"
65
+ }
66
+ },
67
+ "./fishbone": {
68
+ "import": {
69
+ "types": "./dist/fishbone/index.d.ts",
70
+ "default": "./dist/fishbone/index.js"
71
+ },
72
+ "require": {
73
+ "types": "./dist/fishbone/index.d.cts",
74
+ "default": "./dist/fishbone/index.cjs"
75
+ }
76
+ },
77
+ "./pedigree": {
78
+ "import": {
79
+ "types": "./dist/pedigree/index.d.ts",
80
+ "default": "./dist/pedigree/index.js"
81
+ },
82
+ "require": {
83
+ "types": "./dist/pedigree/index.d.cts",
84
+ "default": "./dist/pedigree/index.cjs"
85
+ }
86
+ },
87
+ "./phylo": {
88
+ "import": {
89
+ "types": "./dist/phylo/index.d.ts",
90
+ "default": "./dist/phylo/index.js"
91
+ },
92
+ "require": {
93
+ "types": "./dist/phylo/index.d.cts",
94
+ "default": "./dist/phylo/index.cjs"
95
+ }
36
96
  },
37
97
  "./locales/pt-br": {
38
- "types": "./dist/locales/pt-br.d.ts",
39
- "import": "./dist/locales/pt-br.js",
40
- "require": "./dist/locales/pt-br.cjs"
98
+ "import": {
99
+ "types": "./dist/locales/pt-br.d.ts",
100
+ "default": "./dist/locales/pt-br.js"
101
+ },
102
+ "require": {
103
+ "types": "./dist/locales/pt-br.d.cts",
104
+ "default": "./dist/locales/pt-br.cjs"
105
+ }
41
106
  }
42
107
  },
43
108
  "files": [
44
109
  "dist"
45
110
  ],
46
- "scripts": {
47
- "build": "tsup",
48
- "test": "vitest run",
49
- "test:watch": "vitest",
50
- "typecheck": "tsc --noEmit",
51
- "prepublishOnly": "pnpm typecheck && pnpm test && pnpm build"
52
- },
53
111
  "keywords": [
54
112
  "genogram",
55
113
  "ecomap",
114
+ "fault-tree",
115
+ "fta",
116
+ "fishbone",
117
+ "ishikawa",
118
+ "pedigree",
119
+ "phylogenetics",
120
+ "cladogram",
121
+ "phylogram",
56
122
  "svg",
57
123
  "diagram",
58
124
  "mcgoldrick",
@@ -62,11 +128,19 @@
62
128
  "engines": {
63
129
  "node": ">=18"
64
130
  },
65
- "packageManager": "pnpm@10.33.2",
66
131
  "devDependencies": {
67
132
  "@types/node": "^24",
133
+ "eslint": "^10.4.1",
68
134
  "tsup": "^8",
69
135
  "typescript": "^5",
136
+ "typescript-eslint": "^8.61.0",
70
137
  "vitest": "4.1.8"
138
+ },
139
+ "scripts": {
140
+ "build": "tsup",
141
+ "test": "vitest run",
142
+ "test:watch": "vitest",
143
+ "typecheck": "tsc --noEmit",
144
+ "lint": "eslint ."
71
145
  }
72
- }
146
+ }