compasso 0.3.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.
- package/README.md +66 -10
- package/dist/chunk-UJVU7B44.js +764 -0
- package/dist/chunk-UJVU7B44.js.map +1 -0
- package/dist/index.cjs +785 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/labels-RtFw9tX1.d.cts +91 -0
- package/dist/labels-RtFw9tX1.d.ts +91 -0
- package/dist/locales/pt-br.cjs +19 -0
- package/dist/locales/pt-br.cjs.map +1 -1
- package/dist/locales/pt-br.d.cts +4 -1
- package/dist/locales/pt-br.d.ts +4 -1
- package/dist/locales/pt-br.js +18 -1
- package/dist/locales/pt-br.js.map +1 -1
- package/dist/org-chart/index.cjs +853 -0
- package/dist/org-chart/index.cjs.map +1 -0
- package/dist/org-chart/index.d.cts +168 -0
- package/dist/org-chart/index.d.ts +168 -0
- package/dist/org-chart/index.js +4 -0
- package/dist/org-chart/index.js.map +1 -0
- package/package.json +28 -11
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,38 @@ 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
|
+
|
|
199
256
|
## Localization
|
|
200
257
|
|
|
201
258
|
```ts
|
|
@@ -222,16 +279,15 @@ with a negation list. PRs for new locales are welcome.
|
|
|
222
279
|
|
|
223
280
|
The goal is a family of standards-faithful technical diagrams sharing this core
|
|
224
281
|
(text metrics, stroke vocabulary, escaping, legend machinery). Shipped: genogram,
|
|
225
|
-
ecomap, fault tree, fishbone, pedigree, phylogenetic tree. Next:
|
|
226
|
-
|
|
227
|
-
|
|
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.
|
|
228
285
|
|
|
229
286
|
## Contributing
|
|
230
287
|
|
|
231
|
-
`AGENTS.md` is the contract for changing compasso
|
|
288
|
+
`AGENTS.md` is the contract for changing compasso — the house conventions (pure
|
|
232
289
|
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.
|
|
290
|
+
module anatomy). `docs/architecture.md` covers the internal structure.
|
|
235
291
|
|
|
236
292
|
## Provenance & license
|
|
237
293
|
|