compasso 0.3.0 → 0.4.1
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 +95 -10
- package/dist/{chunk-RWPGGWO5.js → chunk-FYBABYC7.js} +34 -10
- package/dist/chunk-FYBABYC7.js.map +1 -0
- package/dist/{chunk-F47C6ZEB.js → chunk-IPE7JZO5.js} +3 -3
- package/dist/{chunk-F47C6ZEB.js.map → chunk-IPE7JZO5.js.map} +1 -1
- package/dist/{chunk-Q6DVTCXD.js → chunk-LR7BXUWM.js} +18 -6
- package/dist/chunk-LR7BXUWM.js.map +1 -0
- package/dist/{chunk-LRHHUJFZ.js → chunk-M4WA6ME7.js} +3 -3
- package/dist/{chunk-LRHHUJFZ.js.map → chunk-M4WA6ME7.js.map} +1 -1
- package/dist/{chunk-JP4N42AY.js → chunk-PGUMLTIM.js} +3 -3
- package/dist/{chunk-JP4N42AY.js.map → chunk-PGUMLTIM.js.map} +1 -1
- package/dist/{chunk-O3BT2O42.js → chunk-SD4NTRBM.js} +29 -3
- package/dist/chunk-SD4NTRBM.js.map +1 -0
- package/dist/chunk-TAE2UB7D.js +780 -0
- package/dist/chunk-TAE2UB7D.js.map +1 -0
- package/dist/{chunk-ZBDABVIO.js → chunk-WJYYBGZW.js} +3 -3
- package/dist/{chunk-ZBDABVIO.js.map → chunk-WJYYBGZW.js.map} +1 -1
- package/dist/core/index.cjs +30 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +18 -2
- package/dist/core/index.d.ts +18 -2
- package/dist/core/index.js +1 -1
- package/dist/ecomap/index.cjs +34 -11
- package/dist/ecomap/index.cjs.map +1 -1
- package/dist/ecomap/index.d.cts +12 -0
- package/dist/ecomap/index.d.ts +12 -0
- package/dist/ecomap/index.js +2 -2
- package/dist/fault-tree/index.js +2 -2
- package/dist/fishbone/index.js +2 -2
- package/dist/genogram/index.cjs +57 -7
- package/dist/genogram/index.cjs.map +1 -1
- package/dist/genogram/index.d.cts +20 -4
- package/dist/genogram/index.d.ts +20 -4
- package/dist/genogram/index.js +2 -2
- package/dist/index.cjs +1052 -191
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +8 -7
- package/dist/{kinship-DqEklrDN.d.ts → kinship-BF90HyyS.d.ts} +1 -1
- package/dist/{kinship-Dy_ijjJV.d.cts → kinship-BOUss5cT.d.cts} +1 -1
- package/dist/labels-B0aOMbHy.d.cts +103 -0
- package/dist/labels-B0aOMbHy.d.ts +103 -0
- package/dist/{labels-DNqRkWuI.d.ts → labels-CuLbFyrz.d.ts} +1 -1
- package/dist/{labels-CBQ_3Ec9.d.cts → labels-DhQe7I8m.d.cts} +1 -1
- package/dist/locales/pt-br.cjs +19 -0
- package/dist/locales/pt-br.cjs.map +1 -1
- package/dist/locales/pt-br.d.cts +7 -4
- package/dist/locales/pt-br.d.ts +7 -4
- package/dist/locales/pt-br.js +18 -1
- package/dist/locales/pt-br.js.map +1 -1
- package/dist/org-chart/index.cjs +895 -0
- package/dist/org-chart/index.cjs.map +1 -0
- package/dist/org-chart/index.d.cts +185 -0
- package/dist/org-chart/index.d.ts +185 -0
- package/dist/org-chart/index.js +4 -0
- package/dist/org-chart/index.js.map +1 -0
- package/dist/pedigree/index.d.cts +4 -4
- package/dist/pedigree/index.d.ts +4 -4
- package/dist/pedigree/index.js +2 -2
- package/dist/phylo/index.js +2 -2
- package/dist/{types-BnMG7TCd.d.cts → types-jE2fdM1t.d.cts} +8 -0
- package/dist/{types-BnMG7TCd.d.ts → types-jE2fdM1t.d.ts} +8 -0
- package/package.json +28 -11
- package/dist/chunk-O3BT2O42.js.map +0 -1
- package/dist/chunk-Q6DVTCXD.js.map +0 -1
- package/dist/chunk-RWPGGWO5.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,12 +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
|
-
**
|
|
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
8
|
distinctive-shape notation), the **fishbone** (Ishikawa cause-and-effect), the
|
|
9
|
-
**pedigree** (Bennett 2008 standardized clinical-genetics nomenclature)
|
|
10
|
-
**phylogenetic tree** (cladogram + phylogram)
|
|
11
|
-
see the roadmap.
|
|
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>
|
|
12
37
|
|
|
13
38
|
## Principles
|
|
14
39
|
|
|
@@ -196,6 +221,67 @@ Newick-importable. Branch lengths are never lost — a `null`/zero length is val
|
|
|
196
221
|
node sits at its parent's depth), and the verbatim length always rides the branch
|
|
197
222
|
`<title>`.
|
|
198
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
|
+
|
|
256
|
+
## Annotations
|
|
257
|
+
|
|
258
|
+
Any element you declare can be flagged `annotated: true` to draw a discreet, neutral marker —
|
|
259
|
+
a small dot on a node, a short tick on an edge — plus a matching legend row. compasso never
|
|
260
|
+
decides what an annotation *means*; you supply the legend wording, so it reads however your
|
|
261
|
+
domain needs (`"edited"`, `"under review"`, `"verified"`, …).
|
|
262
|
+
|
|
263
|
+
```ts
|
|
264
|
+
import { genogramSvg } from "compasso/genogram";
|
|
265
|
+
|
|
266
|
+
const { svg } = genogramSvg(
|
|
267
|
+
{
|
|
268
|
+
people: [
|
|
269
|
+
{ id: 1, label: "Ana", sex: "female", deceased: false, generation: 0, annotated: true },
|
|
270
|
+
{ id: 2, label: "Bea", sex: "female", deceased: false, generation: 0 },
|
|
271
|
+
],
|
|
272
|
+
unions: [],
|
|
273
|
+
parentLinks: [],
|
|
274
|
+
relationships: [],
|
|
275
|
+
},
|
|
276
|
+
{ annotationLabel: "edited" }, // legend row appears only when something is annotated
|
|
277
|
+
);
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Supported on `genogram` (people, unions, parent links, relationships), `ecomap` (ties) and
|
|
281
|
+
`org-chart` (positions, reports). The marker is **presence-only** — drawn as literal SVG
|
|
282
|
+
inside the element's `<g>`, it never affects layout — and the legend row appears only when you
|
|
283
|
+
pass `annotationLabel` **and** at least one element is annotated.
|
|
284
|
+
|
|
199
285
|
## Localization
|
|
200
286
|
|
|
201
287
|
```ts
|
|
@@ -222,16 +308,15 @@ with a negation list. PRs for new locales are welcome.
|
|
|
222
308
|
|
|
223
309
|
The goal is a family of standards-faithful technical diagrams sharing this core
|
|
224
310
|
(text metrics, stroke vocabulary, escaping, legend machinery). Shipped: genogram,
|
|
225
|
-
ecomap, fault tree, fishbone, pedigree, phylogenetic tree. Next:
|
|
226
|
-
|
|
227
|
-
|
|
311
|
+
ecomap, fault tree, fishbone, pedigree, phylogenetic tree, org chart. Next: flow/layered
|
|
312
|
+
diagrams (PRISMA, UML), and symbol-library diagrams (P&ID, single-line, ladder logic) —
|
|
313
|
+
each built from its public standard. AST-first; text DSLs may come later.
|
|
228
314
|
|
|
229
315
|
## Contributing
|
|
230
316
|
|
|
231
|
-
`AGENTS.md` is the contract for changing compasso
|
|
317
|
+
`AGENTS.md` is the contract for changing compasso — the house conventions (pure
|
|
232
318
|
input→SVG, determinism, the honesty rule, the overlap harness, validation doctrine,
|
|
233
|
-
module anatomy). `docs/architecture.md` covers the internal structure
|
|
234
|
-
the per-module design rationale.
|
|
319
|
+
module anatomy). `docs/architecture.md` covers the internal structure.
|
|
235
320
|
|
|
236
321
|
## Provenance & license
|
|
237
322
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeText, wrapLabelBalanced, clampLabel, estimateTextWidth, qualityLineStyle, xmlEscape, FONT_FAMILY, LEGEND_SWATCH_W, EDGE_STROKE, legendBlock } from './chunk-
|
|
1
|
+
import { normalizeText, wrapLabelBalanced, clampLabel, estimateTextWidth, qualityLineStyle, xmlEscape, annotationDot, FONT_FAMILY, LEGEND_SWATCH_W, EDGE_STROKE, annotationSwatch, legendBlock, annotationTick } from './chunk-SD4NTRBM.js';
|
|
2
2
|
|
|
3
3
|
// src/genogram/types.ts
|
|
4
4
|
var UNION_STATUSES = [
|
|
@@ -175,7 +175,8 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
175
175
|
parentId: l.parentId,
|
|
176
176
|
childId: l.childId,
|
|
177
177
|
quality: l.quality,
|
|
178
|
-
edgeId: PARENT_REL_ID_BASE + l.id
|
|
178
|
+
edgeId: PARENT_REL_ID_BASE + l.id,
|
|
179
|
+
annotated: l.annotated ?? false
|
|
179
180
|
}));
|
|
180
181
|
const declaredPairs = new Set(validLinks.map((l) => pairKey(l.parentId, l.childId)));
|
|
181
182
|
const promotedByPair = /* @__PURE__ */ new Map();
|
|
@@ -194,7 +195,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
194
195
|
[parentId, childId] = fromIsChild ? [r.toPersonId, r.fromPersonId] : [r.fromPersonId, r.toPersonId];
|
|
195
196
|
}
|
|
196
197
|
if (parentId === childId) continue;
|
|
197
|
-
promotedByPair.set(key, { parentId, childId, quality: r.quality, edgeId: PROMOTED_REL_ID_BASE + r.id });
|
|
198
|
+
promotedByPair.set(key, { parentId, childId, quality: r.quality, edgeId: PROMOTED_REL_ID_BASE + r.id, annotated: r.annotated ?? false });
|
|
198
199
|
}
|
|
199
200
|
const allLinks = [...realLinks, ...promotedByPair.values()].sort((a, b) => a.edgeId - b.edgeId);
|
|
200
201
|
const coupleByPair = /* @__PURE__ */ new Map();
|
|
@@ -527,6 +528,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
527
528
|
toPersonId: u.personBId,
|
|
528
529
|
titles: [unionTitle(u)],
|
|
529
530
|
lineStyle: "plain",
|
|
531
|
+
annotated: u.annotated ?? false,
|
|
530
532
|
build: () => {
|
|
531
533
|
const cy = geo.cy(rowOfPerson.get(leftId));
|
|
532
534
|
if (dipLevel === 0) {
|
|
@@ -561,6 +563,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
561
563
|
toPersonId: u.personBId,
|
|
562
564
|
titles: [unionTitle(u)],
|
|
563
565
|
lineStyle: "plain",
|
|
566
|
+
annotated: u.annotated ?? false,
|
|
564
567
|
build
|
|
565
568
|
});
|
|
566
569
|
}
|
|
@@ -617,6 +620,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
617
620
|
};
|
|
618
621
|
gutterReqs.push(spineReq);
|
|
619
622
|
const aId = (c) => linkOf.get(`${u.personAId}>${c}`).edgeId;
|
|
623
|
+
const aLinkAnnotated = (c) => linkOf.get(`${u.personAId}>${c}`).annotated ?? false;
|
|
620
624
|
const childDrop = (c, parentId) => {
|
|
621
625
|
const link = linkOf.get(`${parentId}>${c}`);
|
|
622
626
|
const edgeId = link.edgeId;
|
|
@@ -629,6 +633,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
629
633
|
toPersonId: c,
|
|
630
634
|
titles: [linkTitle(link)],
|
|
631
635
|
lineStyle: "plain",
|
|
636
|
+
annotated: link.annotated,
|
|
632
637
|
build: () => {
|
|
633
638
|
const y = geo.corridorLaneY(sibReq);
|
|
634
639
|
const x = geo.cx(colOrThrow(c)) + arrivalOffset(arr.slot, arrivalCount.get(c) ?? 1);
|
|
@@ -649,6 +654,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
649
654
|
toPersonId: null,
|
|
650
655
|
titles: [linkTitle(linkOf.get(`${u.personAId}>${c}`))],
|
|
651
656
|
lineStyle: "plain",
|
|
657
|
+
annotated: aLinkAnnotated(c),
|
|
652
658
|
build: () => {
|
|
653
659
|
const sy = geo.corridorLaneY(sibReq);
|
|
654
660
|
const sx = geo.gutterCenterX(interGutter);
|
|
@@ -674,6 +680,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
674
680
|
// declared quality word is dropped from the drawn element (FIX C-2 / SPEC inv #4).
|
|
675
681
|
titles: [aLinkTitle(groupKids[0]), ...groupKids.slice(2).map(aLinkTitle)],
|
|
676
682
|
lineStyle: "plain",
|
|
683
|
+
annotated: [groupKids[0], ...groupKids.slice(2)].some(aLinkAnnotated),
|
|
677
684
|
build: () => {
|
|
678
685
|
const y = geo.corridorLaneY(sibReq);
|
|
679
686
|
const xs = sibSpan();
|
|
@@ -692,6 +699,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
692
699
|
titles: [aLinkTitle(groupKids[1])],
|
|
693
700
|
// the A-side link this spine carries, verbatim
|
|
694
701
|
lineStyle: "plain",
|
|
702
|
+
annotated: aLinkAnnotated(groupKids[1]),
|
|
695
703
|
build: () => {
|
|
696
704
|
const sy = geo.corridorLaneY(sibReq);
|
|
697
705
|
const x = geo.gutterCenterX(interGutter);
|
|
@@ -719,6 +727,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
719
727
|
titles: [linkTitle(l)],
|
|
720
728
|
lineStyle: "plain",
|
|
721
729
|
dotted: true,
|
|
730
|
+
annotated: l.annotated,
|
|
722
731
|
build
|
|
723
732
|
});
|
|
724
733
|
}
|
|
@@ -731,10 +740,11 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
731
740
|
const title = r.quality !== null ? `${r.type} \xB7 ${r.quality}` : r.type;
|
|
732
741
|
const g = bondGroups.get(key);
|
|
733
742
|
if (g === void 0) {
|
|
734
|
-
bondGroups.set(key, { relIds: [r.id], titles: [title], style, aId: r.fromPersonId, bId: r.toPersonId });
|
|
743
|
+
bondGroups.set(key, { relIds: [r.id], titles: [title], style, aId: r.fromPersonId, bId: r.toPersonId, annotated: r.annotated ?? false });
|
|
735
744
|
} else {
|
|
736
745
|
g.relIds.push(r.id);
|
|
737
746
|
g.titles.push(title);
|
|
747
|
+
if (r.annotated) g.annotated = true;
|
|
738
748
|
}
|
|
739
749
|
}
|
|
740
750
|
const bondList = [...bondGroups.values()].sort((a, b) => Math.max(...a.relIds) - Math.max(...b.relIds));
|
|
@@ -753,6 +763,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
753
763
|
toPersonId: g.bId,
|
|
754
764
|
titles: g.titles,
|
|
755
765
|
lineStyle: g.style,
|
|
766
|
+
annotated: g.annotated,
|
|
756
767
|
build
|
|
757
768
|
});
|
|
758
769
|
}
|
|
@@ -849,6 +860,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
849
860
|
label: p.label,
|
|
850
861
|
shape: shapeForSex(p.sex),
|
|
851
862
|
deceased: p.deceased,
|
|
863
|
+
annotated: p.annotated ?? false,
|
|
852
864
|
cx: colCenterX[c],
|
|
853
865
|
cy: rowCenterY[r],
|
|
854
866
|
size: NODE_SIZE,
|
|
@@ -865,6 +877,7 @@ function computeGenogramLayout(people, unions, parentLinks, relationships, opts
|
|
|
865
877
|
points: pl.build(),
|
|
866
878
|
titles: pl.titles,
|
|
867
879
|
lineStyle: pl.lineStyle,
|
|
880
|
+
annotated: pl.annotated,
|
|
868
881
|
...pl.unionStyle !== void 0 ? { unionStyle: pl.unionStyle } : {},
|
|
869
882
|
...pl.dotted ? { dotted: true } : {}
|
|
870
883
|
}));
|
|
@@ -969,6 +982,7 @@ function elementSvg(el, override) {
|
|
|
969
982
|
}
|
|
970
983
|
return `<path d="${pathData(pts)}" fill="none" stroke="${EDGE_INK}" stroke-width="${width}" stroke-opacity="${opacity}"${dashAttr}/>`;
|
|
971
984
|
};
|
|
985
|
+
const tick = el.annotated ? annotationTick(el.points) : "";
|
|
972
986
|
if (el.kind === "union-bar" || el.kind === "union-elbow") {
|
|
973
987
|
const style = resolveUnionStyle(el, override);
|
|
974
988
|
const body = [drawLine(style.dash ?? null, STRUCT_WIDTH, STRUCT_OPACITY)];
|
|
@@ -977,15 +991,15 @@ function elementSvg(el, override) {
|
|
|
977
991
|
const [a, b] = pts.length === 2 ? [pts[0], pts[1]] : longestHSegment(pts);
|
|
978
992
|
body.push(slashMarks(a, b, slashes, STRUCT_WIDTH));
|
|
979
993
|
}
|
|
980
|
-
return `<g data-edge-id="${el.edgeId}">${title}${body.join("")}</g>`;
|
|
994
|
+
return `<g data-edge-id="${el.edgeId}">${title}${body.join("")}${tick}</g>`;
|
|
981
995
|
}
|
|
982
996
|
if (el.kind === "descent" || el.kind === "sibling-bar") {
|
|
983
997
|
const dash = el.dotted ? DOTTED_DASH : null;
|
|
984
998
|
const opacity = el.dotted ? DOTTED_OPACITY : STRUCT_OPACITY;
|
|
985
|
-
return `<g data-edge-id="${el.edgeId}">${title}${drawLine(dash, STRUCT_WIDTH, opacity)}</g>`;
|
|
999
|
+
return `<g data-edge-id="${el.edgeId}">${title}${drawLine(dash, STRUCT_WIDTH, opacity)}${tick}</g>`;
|
|
986
1000
|
}
|
|
987
1001
|
const ink = EDGE_STROKE[el.lineStyle];
|
|
988
|
-
return `<g data-edge-id="${el.edgeId}">${title}${drawLine(ink.dash, ink.width, ink.opacity)}</g>`;
|
|
1002
|
+
return `<g data-edge-id="${el.edgeId}">${title}${drawLine(ink.dash, ink.width, ink.opacity)}${tick}</g>`;
|
|
989
1003
|
}
|
|
990
1004
|
function genogramLayoutSvg(layout, opts = {}) {
|
|
991
1005
|
const override = opts.unionStyleByRelId ?? /* @__PURE__ */ new Map();
|
|
@@ -1003,6 +1017,9 @@ function genogramLayoutSvg(layout, opts = {}) {
|
|
|
1003
1017
|
`<line x1="${node.cx - half}" y1="${node.cy - half}" x2="${node.cx + half}" y2="${node.cy + half}" stroke="${GLYPH_STROKE}" stroke-width="2"/>`
|
|
1004
1018
|
);
|
|
1005
1019
|
}
|
|
1020
|
+
if (node.annotated) {
|
|
1021
|
+
pieces.push(annotationDot(node.cx + 0.7 * half, node.cy - 0.7 * half));
|
|
1022
|
+
}
|
|
1006
1023
|
const tspans = node.labelLines.map(
|
|
1007
1024
|
(line, i) => `<tspan x="${node.cx}" y="${node.labelTop + 10 + i * LABEL_LINE_H}">${xmlEscape(line)}</tspan>`
|
|
1008
1025
|
).join("");
|
|
@@ -1045,6 +1062,12 @@ function genogramLayoutSvg(layout, opts = {}) {
|
|
|
1045
1062
|
label: labels.isolated
|
|
1046
1063
|
});
|
|
1047
1064
|
}
|
|
1065
|
+
if (opts.annotationLabel !== void 0 && (layout.nodes.some((n) => n.annotated) || layout.elements.some((e) => e.annotated))) {
|
|
1066
|
+
entries.push({
|
|
1067
|
+
swatch: (x, y) => annotationSwatch(x, y),
|
|
1068
|
+
label: opts.annotationLabel
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1048
1071
|
const block = legendBlock(entries, layout.height);
|
|
1049
1072
|
if (block.svg !== "") {
|
|
1050
1073
|
parts.push(block.svg);
|
|
@@ -1096,11 +1119,12 @@ function genogramSvg(input, opts = {}) {
|
|
|
1096
1119
|
const svg = genogramLayoutSvg(layout, {
|
|
1097
1120
|
unionStyleByRelId,
|
|
1098
1121
|
...opts.legend === false ? { legend: false } : {},
|
|
1099
|
-
...opts.svgLabels !== void 0 ? { labels: opts.svgLabels } : {}
|
|
1122
|
+
...opts.svgLabels !== void 0 ? { labels: opts.svgLabels } : {},
|
|
1123
|
+
...opts.annotationLabel !== void 0 ? { annotationLabel: opts.annotationLabel } : {}
|
|
1100
1124
|
});
|
|
1101
1125
|
return { svg, layout };
|
|
1102
1126
|
}
|
|
1103
1127
|
|
|
1104
1128
|
export { EDGE_FONT, GENOGRAM_SVG_LABELS_EN, GENOGRAM_TITLE_LABELS_EN, KINSHIP_EN, LABEL_FONT, LABEL_LINE_H, NODE_SIZE, PARENT_REL_ID_BASE, PROMOTED_REL_ID_BASE, UNION_NOTATION, UNION_REL_ID_BASE, UNION_STATUSES, classifyRelationshipType, computeGenogramLayout, genogramLayoutSvg, genogramSvg, latestUnionPerPair, relationshipTypeTokens };
|
|
1105
|
-
//# sourceMappingURL=chunk-
|
|
1106
|
-
//# sourceMappingURL=chunk-
|
|
1129
|
+
//# sourceMappingURL=chunk-FYBABYC7.js.map
|
|
1130
|
+
//# sourceMappingURL=chunk-FYBABYC7.js.map
|