• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphty-org / graphty-element / 19792929756

30 Nov 2025 02:57AM UTC coverage: 86.308% (+3.9%) from 82.377%
19792929756

push

github

apowers313
docs: fix stories for chromatic

3676 of 4303 branches covered (85.43%)

Branch coverage included in aggregate %.

17 of 17 new or added lines in 2 files covered. (100.0%)

1093 existing lines in 30 files now uncovered.

17371 of 20083 relevant lines covered (86.5%)

7075.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.0
/src/layout/ArfLayoutEngine.ts
1
import {arfLayout, Edge as LayoutEdge, Node as LayoutNode} from "@graphty/layout";
2✔
2
import {z} from "zod/v4";
2✔
3

4
import {SimpleLayoutConfig, SimpleLayoutEngine} from "./LayoutEngine";
2✔
5

6
export const ArfLayoutConfig = z.strictObject({
2✔
7
    ... SimpleLayoutConfig.shape,
2✔
8
    pos: z.record(
2✔
9
        z.number(),
2✔
10
        z.array(z.number()),
2✔
11
    ).or(z.null()).default(null),
2✔
12
    scaling: z.number().positive().default(1),
2✔
13
    a: z.number().positive().default(1.1),
2✔
14
    maxIter: z.number().positive().default(1000),
2✔
15
    seed: z.number().positive().or(z.null()).default(null),
2✔
16
});
2✔
17
export type ArfLayoutConfigType = z.infer<typeof ArfLayoutConfig>;
18
export type ArfLayoutOpts = Partial<ArfLayoutConfigType>;
19

20
export class ArfLayout extends SimpleLayoutEngine {
2✔
21
    static type = "arf";
2✔
22
    static maxDimensions = 2;
2✔
23
    scalingFactor = 100;
2✔
24
    config: ArfLayoutConfigType;
25

26
    constructor(opts: ArfLayoutOpts) {
2✔
27
        super(opts);
1✔
28
        this.config = ArfLayoutConfig.parse(opts);
1✔
29
    }
1✔
30

31
    static getOptionsForDimension(dimension: 2 | 3): object | null {
2✔
32
        // Arf only supports 2D
33
        if (dimension > this.maxDimensions) {
1!
UNCOV
34
            return null;
×
UNCOV
35
        }
×
36

37
        // Arf doesn't use 'dim' parameter
38
        return {};
1✔
39
    }
1✔
40

41
    doLayout(): void {
2✔
42
        this.stale = false;
1✔
43
        const nodes = (): LayoutNode[] => this._nodes.map((n) => n.id as LayoutNode);
1✔
44
        const edges = (): LayoutEdge[] => this._edges.map((e) => [e.srcId, e.dstId] as LayoutEdge);
1✔
45

46
        this.positions = arfLayout(
1✔
47
            {nodes, edges},
1✔
48
            this.config.pos,
1✔
49
            this.config.scaling,
1✔
50
            this.config.a,
1✔
51
            this.config.maxIter,
1✔
52
            this.config.seed,
1✔
53
        );
1✔
54
    }
1✔
55
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc